mirror of
https://github.com/lukaszraczylo/harness-sync.git
synced 2026-10-12 00:45:22 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0e35af67b6 | ||
|
|
6483eb8044 |
@@ -1,12 +1,13 @@
|
|||||||
module github.com/lukaszraczylo/harness-sync
|
module github.com/lukaszraczylo/harness-sync
|
||||||
|
|
||||||
go 1.25
|
go 1.25.0
|
||||||
|
|
||||||
require (
|
require (
|
||||||
github.com/charmbracelet/huh v1.0.0
|
github.com/charmbracelet/huh v1.0.0
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3
|
github.com/lukaszraczylo/oss-telemetry v0.2.1
|
||||||
|
github.com/pelletier/go-toml/v2 v2.3.1
|
||||||
github.com/spf13/afero v1.15.0
|
github.com/spf13/afero v1.15.0
|
||||||
github.com/spf13/cobra v1.8.1
|
github.com/spf13/cobra v1.10.2
|
||||||
github.com/stretchr/testify v1.9.0
|
github.com/stretchr/testify v1.9.0
|
||||||
gopkg.in/yaml.v3 v3.0.1
|
gopkg.in/yaml.v3 v3.0.1
|
||||||
)
|
)
|
||||||
@@ -15,32 +16,33 @@ require (
|
|||||||
github.com/atotto/clipboard v0.1.4 // indirect
|
github.com/atotto/clipboard v0.1.4 // indirect
|
||||||
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
github.com/aymanbagabas/go-osc52/v2 v2.0.1 // indirect
|
||||||
github.com/catppuccin/go v0.3.0 // indirect
|
github.com/catppuccin/go v0.3.0 // indirect
|
||||||
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 // indirect
|
github.com/charmbracelet/bubbles v1.0.0 // indirect
|
||||||
github.com/charmbracelet/bubbletea v1.3.6 // indirect
|
github.com/charmbracelet/bubbletea v1.3.10 // indirect
|
||||||
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc // indirect
|
github.com/charmbracelet/colorprofile v0.4.3 // indirect
|
||||||
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
github.com/charmbracelet/lipgloss v1.1.0 // indirect
|
||||||
github.com/charmbracelet/x/ansi v0.9.3 // indirect
|
github.com/charmbracelet/x/ansi v0.11.7 // indirect
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.13 // indirect
|
github.com/charmbracelet/x/cellbuf v0.0.15 // indirect
|
||||||
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 // indirect
|
github.com/charmbracelet/x/exp/strings v0.1.0 // indirect
|
||||||
github.com/charmbracelet/x/term v0.2.1 // indirect
|
github.com/charmbracelet/x/term v0.2.2 // indirect
|
||||||
|
github.com/clipperhouse/displaywidth v0.11.0 // indirect
|
||||||
|
github.com/clipperhouse/uax29/v2 v2.7.0 // indirect
|
||||||
github.com/davecgh/go-spew v1.1.1 // indirect
|
github.com/davecgh/go-spew v1.1.1 // indirect
|
||||||
github.com/dustin/go-humanize v1.0.1 // indirect
|
github.com/dustin/go-humanize v1.0.1 // indirect
|
||||||
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
github.com/erikgeiser/coninput v0.0.0-20211004153227-1c3628e74d0f // indirect
|
||||||
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
github.com/inconshreveable/mousetrap v1.1.0 // indirect
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 // indirect
|
github.com/lucasb-eyer/go-colorful v1.4.0 // indirect
|
||||||
github.com/lukaszraczylo/oss-telemetry v0.2.1 // indirect
|
github.com/mattn/go-isatty v0.0.22 // indirect
|
||||||
github.com/mattn/go-isatty v0.0.20 // indirect
|
|
||||||
github.com/mattn/go-localereader v0.0.1 // indirect
|
github.com/mattn/go-localereader v0.0.1 // indirect
|
||||||
github.com/mattn/go-runewidth v0.0.16 // indirect
|
github.com/mattn/go-runewidth v0.0.23 // indirect
|
||||||
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
github.com/mitchellh/hashstructure/v2 v2.0.2 // indirect
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 // indirect
|
||||||
github.com/muesli/cancelreader v0.2.2 // indirect
|
github.com/muesli/cancelreader v0.2.2 // indirect
|
||||||
github.com/muesli/termenv v0.16.0 // indirect
|
github.com/muesli/termenv v0.16.0 // indirect
|
||||||
github.com/pmezard/go-difflib v1.0.0 // indirect
|
github.com/pmezard/go-difflib v1.0.0 // indirect
|
||||||
github.com/rivo/uniseg v0.4.7 // indirect
|
github.com/rivo/uniseg v0.4.7 // indirect
|
||||||
github.com/spf13/pflag v1.0.5 // indirect
|
github.com/spf13/pflag v1.0.10 // indirect
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e // indirect
|
||||||
golang.org/x/sync v0.16.0 // indirect
|
golang.org/x/sync v0.20.0 // indirect
|
||||||
golang.org/x/sys v0.33.0 // indirect
|
golang.org/x/sys v0.45.0 // indirect
|
||||||
golang.org/x/text v0.28.0 // indirect
|
golang.org/x/text v0.37.0 // indirect
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -10,18 +10,28 @@ github.com/catppuccin/go v0.3.0 h1:d+0/YicIq+hSTo5oPuRi5kOpqkVA5tAsU6dNhvRu+aY=
|
|||||||
github.com/catppuccin/go v0.3.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
|
github.com/catppuccin/go v0.3.0/go.mod h1:8IHJuMGaUUjQM82qBrGNBv7LFq6JI3NnQCF6MOlZjpc=
|
||||||
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 h1:JFgG/xnwFfbezlUnFMJy0nusZvytYysV4SCS2cYbvws=
|
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7 h1:JFgG/xnwFfbezlUnFMJy0nusZvytYysV4SCS2cYbvws=
|
||||||
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7/go.mod h1:ISC1gtLcVilLOf23wvTfoQuYbW2q0JevFxPfUzZ9Ybw=
|
github.com/charmbracelet/bubbles v0.21.1-0.20250623103423-23b8fd6302d7/go.mod h1:ISC1gtLcVilLOf23wvTfoQuYbW2q0JevFxPfUzZ9Ybw=
|
||||||
|
github.com/charmbracelet/bubbles v1.0.0 h1:12J8/ak/uCZEMQ6KU7pcfwceyjLlWsDLAxB5fXonfvc=
|
||||||
|
github.com/charmbracelet/bubbles v1.0.0/go.mod h1:9d/Zd5GdnauMI5ivUIVisuEm3ave1XwXtD1ckyV6r3E=
|
||||||
github.com/charmbracelet/bubbletea v1.3.6 h1:VkHIxPJQeDt0aFJIsVxw8BQdh/F/L2KKZGsK6et5taU=
|
github.com/charmbracelet/bubbletea v1.3.6 h1:VkHIxPJQeDt0aFJIsVxw8BQdh/F/L2KKZGsK6et5taU=
|
||||||
github.com/charmbracelet/bubbletea v1.3.6/go.mod h1:oQD9VCRQFF8KplacJLo28/jofOI2ToOfGYeFgBBxHOc=
|
github.com/charmbracelet/bubbletea v1.3.6/go.mod h1:oQD9VCRQFF8KplacJLo28/jofOI2ToOfGYeFgBBxHOc=
|
||||||
|
github.com/charmbracelet/bubbletea v1.3.10 h1:otUDHWMMzQSB0Pkc87rm691KZ3SWa4KUlvF9nRvCICw=
|
||||||
|
github.com/charmbracelet/bubbletea v1.3.10/go.mod h1:ORQfo0fk8U+po9VaNvnV95UPWA1BitP1E0N6xJPlHr4=
|
||||||
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
|
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc h1:4pZI35227imm7yK2bGPcfpFEmuY1gc2YSTShr4iJBfs=
|
||||||
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
|
github.com/charmbracelet/colorprofile v0.2.3-0.20250311203215-f60798e515dc/go.mod h1:X4/0JoqgTIPSFcRA/P6INZzIuyqdFY5rm8tb41s9okk=
|
||||||
|
github.com/charmbracelet/colorprofile v0.4.3 h1:QPa1IWkYI+AOB+fE+mg/5/4HRMZcaXex9t5KX76i20Q=
|
||||||
|
github.com/charmbracelet/colorprofile v0.4.3/go.mod h1:/zT4BhpD5aGFpqQQqw7a+VtHCzu+zrQtt1zhMt9mR4Q=
|
||||||
github.com/charmbracelet/huh v1.0.0 h1:wOnedH8G4qzJbmhftTqrpppyqHakl/zbbNdXIWJyIxw=
|
github.com/charmbracelet/huh v1.0.0 h1:wOnedH8G4qzJbmhftTqrpppyqHakl/zbbNdXIWJyIxw=
|
||||||
github.com/charmbracelet/huh v1.0.0/go.mod h1:5YVc+SlZ1IhQALxRPpkGwwEKftN/+OlJlnJYlDRFqN4=
|
github.com/charmbracelet/huh v1.0.0/go.mod h1:5YVc+SlZ1IhQALxRPpkGwwEKftN/+OlJlnJYlDRFqN4=
|
||||||
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
github.com/charmbracelet/lipgloss v1.1.0 h1:vYXsiLHVkK7fp74RkV7b2kq9+zDLoEU4MZoFqR/noCY=
|
||||||
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
github.com/charmbracelet/lipgloss v1.1.0/go.mod h1:/6Q8FR2o+kj8rz4Dq0zQc3vYf7X+B0binUUBwA0aL30=
|
||||||
github.com/charmbracelet/x/ansi v0.9.3 h1:BXt5DHS/MKF+LjuK4huWrC6NCvHtexww7dMayh6GXd0=
|
github.com/charmbracelet/x/ansi v0.9.3 h1:BXt5DHS/MKF+LjuK4huWrC6NCvHtexww7dMayh6GXd0=
|
||||||
github.com/charmbracelet/x/ansi v0.9.3/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
|
github.com/charmbracelet/x/ansi v0.9.3/go.mod h1:3RQDQ6lDnROptfpWuUVIUG64bD2g2BgntdxH0Ya5TeE=
|
||||||
|
github.com/charmbracelet/x/ansi v0.11.7 h1:kzv1kJvjg2S3r9KHo8hDdHFQLEqn4RBCb39dAYC84jI=
|
||||||
|
github.com/charmbracelet/x/ansi v0.11.7/go.mod h1:9qGpnAVYz+8ACONkZBUWPtL7lulP9No6p1epAihUZwQ=
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k=
|
github.com/charmbracelet/x/cellbuf v0.0.13 h1:/KBBKHuVRbq1lYx5BzEHBAFBP8VcQzJejZ/IA3iR28k=
|
||||||
github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
|
github.com/charmbracelet/x/cellbuf v0.0.13/go.mod h1:xe0nKWGd3eJgtqZRaN9RjMtK7xUYchjzPr7q6kcvCCs=
|
||||||
|
github.com/charmbracelet/x/cellbuf v0.0.15 h1:ur3pZy0o6z/R7EylET877CBxaiE1Sp1GMxoFPAIztPI=
|
||||||
|
github.com/charmbracelet/x/cellbuf v0.0.15/go.mod h1:J1YVbR7MUuEGIFPCaaZ96KDl5NoS0DAWkskup+mOY+Q=
|
||||||
github.com/charmbracelet/x/conpty v0.1.0 h1:4zc8KaIcbiL4mghEON8D72agYtSeIgq8FSThSPQIb+U=
|
github.com/charmbracelet/x/conpty v0.1.0 h1:4zc8KaIcbiL4mghEON8D72agYtSeIgq8FSThSPQIb+U=
|
||||||
github.com/charmbracelet/x/conpty v0.1.0/go.mod h1:rMFsDJoDwVmiYM10aD4bH2XiRgwI7NYJtQgl5yskjEQ=
|
github.com/charmbracelet/x/conpty v0.1.0/go.mod h1:rMFsDJoDwVmiYM10aD4bH2XiRgwI7NYJtQgl5yskjEQ=
|
||||||
github.com/charmbracelet/x/errors v0.0.0-20240508181413-e8d8b6e2de86 h1:JSt3B+U9iqk37QUU2Rvb6DSBYRLtWqFqfxf8l5hOZUA=
|
github.com/charmbracelet/x/errors v0.0.0-20240508181413-e8d8b6e2de86 h1:JSt3B+U9iqk37QUU2Rvb6DSBYRLtWqFqfxf8l5hOZUA=
|
||||||
@@ -30,13 +40,22 @@ github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91 h1:payR
|
|||||||
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
|
github.com/charmbracelet/x/exp/golden v0.0.0-20241011142426-46044092ad91/go.mod h1:wDlXFlCrmJ8J+swcL/MnGUuYnqgQdW9rhSD61oNMb6U=
|
||||||
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 h1:qko3AQ4gK1MTS/de7F5hPGx6/k1u0w4TeYmBFwzYVP4=
|
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0 h1:qko3AQ4gK1MTS/de7F5hPGx6/k1u0w4TeYmBFwzYVP4=
|
||||||
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ=
|
github.com/charmbracelet/x/exp/strings v0.0.0-20240722160745-212f7b056ed0/go.mod h1:pBhA0ybfXv6hDjQUZ7hk1lVxBiUbupdw5R31yPUViVQ=
|
||||||
|
github.com/charmbracelet/x/exp/strings v0.1.0 h1:i69S2XI7uG1u4NLGeJPSYU++Nmjvpo9nwd6aoEm7gkA=
|
||||||
|
github.com/charmbracelet/x/exp/strings v0.1.0/go.mod h1:/ehtMPNh9K4odGFkqYJKpIYyePhdp1hLBRvyY4bWkH8=
|
||||||
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
|
github.com/charmbracelet/x/term v0.2.1 h1:AQeHeLZ1OqSXhrAWpYUtZyX1T3zVxfpZuEQMIQaGIAQ=
|
||||||
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
|
github.com/charmbracelet/x/term v0.2.1/go.mod h1:oQ4enTYFV7QN4m0i9mzHrViD7TQKvNEEkHUMCmsxdUg=
|
||||||
|
github.com/charmbracelet/x/term v0.2.2 h1:xVRT/S2ZcKdhhOuSP4t5cLi5o+JxklsoEObBSgfgZRk=
|
||||||
|
github.com/charmbracelet/x/term v0.2.2/go.mod h1:kF8CY5RddLWrsgVwpw4kAa6TESp6EB5y3uxGLeCqzAI=
|
||||||
github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY=
|
github.com/charmbracelet/x/termios v0.1.1 h1:o3Q2bT8eqzGnGPOYheoYS8eEleT5ZVNYNy8JawjaNZY=
|
||||||
github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo=
|
github.com/charmbracelet/x/termios v0.1.1/go.mod h1:rB7fnv1TgOPOyyKRJ9o+AsTU/vK5WHJ2ivHeut/Pcwo=
|
||||||
github.com/charmbracelet/x/xpty v0.1.2 h1:Pqmu4TEJ8KeA9uSkISKMU3f+C1F6OGBn8ABuGlqCbtI=
|
github.com/charmbracelet/x/xpty v0.1.2 h1:Pqmu4TEJ8KeA9uSkISKMU3f+C1F6OGBn8ABuGlqCbtI=
|
||||||
github.com/charmbracelet/x/xpty v0.1.2/go.mod h1:XK2Z0id5rtLWcpeNiMYBccNNBrP2IJnzHI0Lq13Xzq4=
|
github.com/charmbracelet/x/xpty v0.1.2/go.mod h1:XK2Z0id5rtLWcpeNiMYBccNNBrP2IJnzHI0Lq13Xzq4=
|
||||||
|
github.com/clipperhouse/displaywidth v0.11.0 h1:lBc6kY44VFw+TDx4I8opi/EtL9m20WSEFgwIwO+UVM8=
|
||||||
|
github.com/clipperhouse/displaywidth v0.11.0/go.mod h1:bkrFNkf81G8HyVqmKGxsPufD3JhNl3dSqnGhOoSD/o0=
|
||||||
|
github.com/clipperhouse/uax29/v2 v2.7.0 h1:+gs4oBZ2gPfVrKPthwbMzWZDaAFPGYK72F0NJv2v7Vk=
|
||||||
|
github.com/clipperhouse/uax29/v2 v2.7.0/go.mod h1:EFJ2TJMRUaplDxHKj1qAEhCtQPW2tJSwu5BF98AuoVM=
|
||||||
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
github.com/cpuguy83/go-md2man/v2 v2.0.4/go.mod h1:tgQtvFlXSQOSOSIRvRPT7W67SCa46tRHOmNcaadrF8o=
|
||||||
|
github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g=
|
||||||
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
github.com/creack/pty v1.1.24 h1:bJrF4RRfyJnbTJqzRLHzcGaZK1NeM5kTC9jGgovnR1s=
|
||||||
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
github.com/creack/pty v1.1.24/go.mod h1:08sCNb52WyoAwi2QDyzUCTgcvVFhUzewun7wtTfvcwE=
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
||||||
@@ -49,14 +68,20 @@ github.com/inconshreveable/mousetrap v1.1.0 h1:wN+x4NVGpMsO7ErUn/mUI3vEoE6Jt13X2
|
|||||||
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
github.com/inconshreveable/mousetrap v1.1.0/go.mod h1:vpF70FUmC8bwa3OWnCshd2FqLfsEA9PFc4w1p2J65bw=
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
github.com/lucasb-eyer/go-colorful v1.2.0 h1:1nnpGOrhyZZuNyfu1QjKiUICQ74+3FNCN69Aj6K7nkY=
|
||||||
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
github.com/lucasb-eyer/go-colorful v1.2.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||||
|
github.com/lucasb-eyer/go-colorful v1.4.0 h1:UtrWVfLdarDgc44HcS7pYloGHJUjHV/4FwW4TvVgFr4=
|
||||||
|
github.com/lucasb-eyer/go-colorful v1.4.0/go.mod h1:R4dSotOR9KMtayYi1e77YzuveK+i7ruzyGqttikkLy0=
|
||||||
github.com/lukaszraczylo/oss-telemetry v0.2.1 h1:6ULyfzXplpdmIY/i01OPM1jeod9+L1RAhI0jtbVnJI0=
|
github.com/lukaszraczylo/oss-telemetry v0.2.1 h1:6ULyfzXplpdmIY/i01OPM1jeod9+L1RAhI0jtbVnJI0=
|
||||||
github.com/lukaszraczylo/oss-telemetry v0.2.1/go.mod h1:+Cn78qZo8rc3T9eZt0v3oICYRdd75wORtSidc8lNjDQ=
|
github.com/lukaszraczylo/oss-telemetry v0.2.1/go.mod h1:+Cn78qZo8rc3T9eZt0v3oICYRdd75wORtSidc8lNjDQ=
|
||||||
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
github.com/mattn/go-isatty v0.0.20 h1:xfD0iDuEKnDkl03q4limB+vH+GxLEtL/jb4xVJSWWEY=
|
||||||
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
github.com/mattn/go-isatty v0.0.20/go.mod h1:W+V8PltTTMOvKvAeJH7IuucS94S2C6jfK/D7dTCTo3Y=
|
||||||
|
github.com/mattn/go-isatty v0.0.22 h1:j8l17JJ9i6VGPUFUYoTUKPSgKe/83EYU2zBC7YNKMw4=
|
||||||
|
github.com/mattn/go-isatty v0.0.22/go.mod h1:ZXfXG4SQHsB/w3ZeOYbR0PrPwLy+n6xiMrJlRFqopa4=
|
||||||
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
|
github.com/mattn/go-localereader v0.0.1 h1:ygSAOl7ZXTx4RdPYinUpg6W99U8jWvWi9Ye2JC/oIi4=
|
||||||
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
|
github.com/mattn/go-localereader v0.0.1/go.mod h1:8fBrzywKY7BI3czFoHkuzRoWE9C+EiG4R1k4Cjx5p88=
|
||||||
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
github.com/mattn/go-runewidth v0.0.16 h1:E5ScNMtiwvlvB5paMFdw9p4kSQzbXFikJ5SQO6TULQc=
|
||||||
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
github.com/mattn/go-runewidth v0.0.16/go.mod h1:Jdepj2loyihRzMpdS35Xk/zdY8IAYHsh153qUoGf23w=
|
||||||
|
github.com/mattn/go-runewidth v0.0.23 h1:7ykA0T0jkPpzSvMS5i9uoNn2Xy3R383f9HDx3RybWcw=
|
||||||
|
github.com/mattn/go-runewidth v0.0.23/go.mod h1:XBkDxAl56ILZc9knddidhrOlY5R/pDhgLpndooCuJAs=
|
||||||
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
|
github.com/mitchellh/hashstructure/v2 v2.0.2 h1:vGKWl0YJqUNxE8d+h8f6NJLcCJrgbhC4NcD46KavDd4=
|
||||||
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
|
github.com/mitchellh/hashstructure/v2 v2.0.2/go.mod h1:MG3aRVU/N29oo/V/IhBX8GR/zz4kQkprJgF2EVszyDE=
|
||||||
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
|
github.com/muesli/ansi v0.0.0-20230316100256-276c6243b2f6 h1:ZK8zHtRHOkbHy6Mmr5D264iyp3TiX5OmNcI5cIARiQI=
|
||||||
@@ -67,6 +92,8 @@ github.com/muesli/termenv v0.16.0 h1:S5AlUN9dENB57rsbnkPyfdGuWIlkmzJjbFf0Tf5FWUc
|
|||||||
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
|
github.com/muesli/termenv v0.16.0/go.mod h1:ZRfOIKPFDYQoDFF4Olj7/QJbW60Ol/kL1pU3VfY/Cnk=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
github.com/pelletier/go-toml/v2 v2.2.3 h1:YmeHyLY8mFWbdkNWwpr+qIL2bEqT0o95WSdkNHvL12M=
|
||||||
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
github.com/pelletier/go-toml/v2 v2.2.3/go.mod h1:MfCQTFTvCcUyyvvwm1+G6H/jORL20Xlb6rzQu9GuUkc=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.3.1 h1:MYEvvGnQjeNkRF1qUuGolNtNExTDwct51yp7olPtrEc=
|
||||||
|
github.com/pelletier/go-toml/v2 v2.3.1/go.mod h1:2gIqNv+qfxSVS7cM2xJQKtLSTLUE9V8t9Stt+h56mCY=
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
||||||
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
github.com/rivo/uniseg v0.2.0/go.mod h1:J6wj4VEh+S6ZtnVlnTBMWIodfgj8LQOQFoIToxlJtxc=
|
||||||
@@ -77,22 +104,34 @@ github.com/spf13/afero v1.15.0 h1:b/YBCLWAJdFWJTN9cLhiXXcD7mzKn9Dm86dNnfyQw1I=
|
|||||||
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
|
github.com/spf13/afero v1.15.0/go.mod h1:NC2ByUVxtQs4b3sIUphxK0NioZnmxgyCrfzeuq8lxMg=
|
||||||
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
github.com/spf13/cobra v1.8.1 h1:e5/vxKd/rZsfSJMUX1agtjeTDf+qv1/JdBF8gg5k9ZM=
|
||||||
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
github.com/spf13/cobra v1.8.1/go.mod h1:wHxEcudfqmLYa8iTfL+OuZPbBZkmvliBWKIezN3kD9Y=
|
||||||
|
github.com/spf13/cobra v1.10.2 h1:DMTTonx5m65Ic0GOoRY2c16WCbHxOOw6xxezuLaBpcU=
|
||||||
|
github.com/spf13/cobra v1.10.2/go.mod h1:7C1pvHqHw5A4vrJfjNwvOdzYu0Gml16OCs2GRiTUUS4=
|
||||||
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
github.com/spf13/pflag v1.0.5 h1:iy+VFUOCP1a+8yFto/drg2CJ5u0yRoB7fZw3DKv/JXA=
|
||||||
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
github.com/spf13/pflag v1.0.5/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/pflag v1.0.9/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
|
github.com/spf13/pflag v1.0.10 h1:4EBh2KAYBwaONj6b2Ye1GiHfwjqyROoF4RwYO+vPwFk=
|
||||||
|
github.com/spf13/pflag v1.0.10/go.mod h1:McXfInJRrz4CZXVZOBLb0bTZqETkiAhM9Iw0y3An2Bg=
|
||||||
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg=
|
||||||
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY=
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e h1:JVG44RsyaB9T2KIHavMF/ppJZNG9ZpyihvCd0w101no=
|
||||||
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
github.com/xo/terminfo v0.0.0-20220910002029-abceb7e1c41e/go.mod h1:RbqR21r5mrJuqunuUZ/Dhy/avygyECGrLceyNeo4LiM=
|
||||||
|
go.yaml.in/yaml/v3 v3.0.4/go.mod h1:DhzuOOF2ATzADvBadXxruRBLzYTpT36CKvDb3+aBEFg=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
golang.org/x/exp v0.0.0-20231006140011-7918f672742d h1:jtJma62tbqLibJ5sFQz8bKtEM8rJBtfilJ2qTU199MI=
|
||||||
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
golang.org/x/exp v0.0.0-20231006140011-7918f672742d/go.mod h1:ldy0pHrwJyGW56pPQzzkH36rKxoZW1tw7ZJpeKx+hdo=
|
||||||
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
golang.org/x/sync v0.16.0 h1:ycBJEhp9p4vXvUZNszeOq0kGTPghopOL8q0fq3vstxw=
|
||||||
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
golang.org/x/sync v0.16.0/go.mod h1:1dzgHSNfp02xaA81J2MS99Qcpr2w7fw1gpm99rleRqA=
|
||||||
|
golang.org/x/sync v0.20.0 h1:e0PTpb7pjO8GAtTs2dQ6jYa5BWYlMuX047Dco/pItO4=
|
||||||
|
golang.org/x/sync v0.20.0/go.mod h1:9xrNwdLfx4jkKbNva9FpL6vEN7evnE43NNNJQ2LF3+0=
|
||||||
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.0.0-20210809222454-d867a43fc93e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
|
||||||
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
golang.org/x/sys v0.33.0 h1:q3i8TbbEz+JRD9ywIRlyRAQbM0qF7hu24q3teo2hbuw=
|
||||||
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
golang.org/x/sys v0.33.0/go.mod h1:BJP2sWEmIv4KK5OTEluFJCKSidICx8ciO85XgH3Ak8k=
|
||||||
|
golang.org/x/sys v0.45.0 h1:dO4czNzziLiiXplLQgBCEpCvXQ3dnkn0SdaZSYdQ+FY=
|
||||||
|
golang.org/x/sys v0.45.0/go.mod h1:4GL1E5IUh+htKOUEOaiffhrAeqysfVGipDYzABqnCmw=
|
||||||
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
golang.org/x/text v0.28.0 h1:rhazDwis8INMIwQ4tpjLDzUhx6RlXqZNPEM0huQojng=
|
||||||
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
golang.org/x/text v0.28.0/go.mod h1:U8nCwOR8jO/marOQ0QbDiOngZVEBB7MAiitBuMjXiNU=
|
||||||
|
golang.org/x/text v0.37.0 h1:Cqjiwd9eSg8e0QAkyCaQTNHFIIzWtidPahFWR83rTrc=
|
||||||
|
golang.org/x/text v0.37.0/go.mod h1:a5sjxXGs9hsn/AJVwuElvCAo9v8QYLzvavO5z2PiM38=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
||||||
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
|
||||||
|
|||||||
@@ -11,10 +11,6 @@ import (
|
|||||||
|
|
||||||
const fallbackGatewayProviderID = "harness-sync-gateway"
|
const fallbackGatewayProviderID = "harness-sync-gateway"
|
||||||
|
|
||||||
// GatewayProviderID is the canonical provider key used across all adapters.
|
|
||||||
// Deprecated: prefer GatewayProviderKey(gatewayURL) for a stable URL-derived key.
|
|
||||||
const GatewayProviderID = fallbackGatewayProviderID
|
|
||||||
|
|
||||||
// GatewayProviderKey returns a stable provider key derived from the gateway URL.
|
// GatewayProviderKey returns a stable provider key derived from the gateway URL.
|
||||||
// Format: "hs-<hostname>" with dots and special chars normalised to dashes.
|
// Format: "hs-<hostname>" with dots and special chars normalised to dashes.
|
||||||
// Falls back to "harness-sync-gateway" when the URL is empty or unparseable.
|
// Falls back to "harness-sync-gateway" when the URL is empty or unparseable.
|
||||||
@@ -34,52 +30,6 @@ func GatewayProviderKey(gatewayURL string) string {
|
|||||||
return "hs-" + r.Replace(host)
|
return "hs-" + r.Replace(host)
|
||||||
}
|
}
|
||||||
|
|
||||||
// ProviderEntry is a generic provider record. Adapters may massage further.
|
|
||||||
type ProviderEntry = map[string]any
|
|
||||||
|
|
||||||
// BuildProviders returns the canonical-to-generic provider list: gateway first
|
|
||||||
// (if configured), then any upstreams. Each entry has id, name, base_url,
|
|
||||||
// api_key, and (for the gateway) a models list.
|
|
||||||
func BuildProviders(p *canonical.Profile) []ProviderEntry {
|
|
||||||
out := make([]ProviderEntry, 0, len(p.Upstreams)+1)
|
|
||||||
if p.Gateway.URL != "" {
|
|
||||||
key := GatewayProviderKey(p.Gateway.URL)
|
|
||||||
gw := ProviderEntry{
|
|
||||||
"id": key,
|
|
||||||
"name": "harness-sync gateway",
|
|
||||||
"base_url": p.Gateway.URL,
|
|
||||||
"api_key": p.Gateway.Token,
|
|
||||||
}
|
|
||||||
if models := buildModels(p.Models); len(models) > 0 {
|
|
||||||
gw["models"] = models
|
|
||||||
}
|
|
||||||
out = append(out, gw)
|
|
||||||
}
|
|
||||||
for _, up := range p.Upstreams {
|
|
||||||
e := ProviderEntry{"id": up.Name, "name": up.Name}
|
|
||||||
if up.BaseURL != "" {
|
|
||||||
e["base_url"] = up.BaseURL
|
|
||||||
}
|
|
||||||
if up.APIKey != "" {
|
|
||||||
e["api_key"] = up.APIKey
|
|
||||||
}
|
|
||||||
out = append(out, e)
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
func buildModels(models []canonical.Model) []map[string]any {
|
|
||||||
out := make([]map[string]any, 0, len(models))
|
|
||||||
for _, m := range models {
|
|
||||||
e := map[string]any{"id": m.ID}
|
|
||||||
if m.Alias != "" {
|
|
||||||
e["alias"] = m.Alias
|
|
||||||
}
|
|
||||||
out = append(out, e)
|
|
||||||
}
|
|
||||||
return out
|
|
||||||
}
|
|
||||||
|
|
||||||
// crushModel builds a 10-field model entry required by the crush schema.
|
// crushModel builds a 10-field model entry required by the crush schema.
|
||||||
func crushModel(id string) map[string]any {
|
func crushModel(id string) map[string]any {
|
||||||
return map[string]any{
|
return map[string]any{
|
||||||
@@ -209,40 +159,6 @@ func ProvidersAsCagentMap(p *canonical.Profile) map[string]any {
|
|||||||
return out
|
return out
|
||||||
}
|
}
|
||||||
|
|
||||||
// ZedLanguageModels returns the language_models.openai block for Zed when a
|
|
||||||
// gateway URL is configured.
|
|
||||||
func ZedLanguageModels(p *canonical.Profile) map[string]any {
|
|
||||||
if p.Gateway.URL == "" {
|
|
||||||
return map[string]any{}
|
|
||||||
}
|
|
||||||
models := make([]map[string]any, 0)
|
|
||||||
for _, m := range p.Models {
|
|
||||||
models = append(models, map[string]any{
|
|
||||||
"name": m.ID,
|
|
||||||
"display_name": func() string {
|
|
||||||
if m.Alias != "" {
|
|
||||||
return m.Alias
|
|
||||||
}
|
|
||||||
return m.ID
|
|
||||||
}(),
|
|
||||||
"max_tokens": 8192,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
if len(models) == 0 && p.Gateway.DefaultModel != "" {
|
|
||||||
models = append(models, map[string]any{
|
|
||||||
"name": p.Gateway.DefaultModel,
|
|
||||||
"display_name": p.Gateway.DefaultModel,
|
|
||||||
"max_tokens": 8192,
|
|
||||||
})
|
|
||||||
}
|
|
||||||
return map[string]any{
|
|
||||||
"openai": map[string]any{
|
|
||||||
"api_url": p.Gateway.URL,
|
|
||||||
"available_models": models,
|
|
||||||
},
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// GooseCustomProviderFile returns the JSON body and provider ID for the goose
|
// GooseCustomProviderFile returns the JSON body and provider ID for the goose
|
||||||
// custom_providers/<id>.json file. Returns nil body when Gateway.URL is empty.
|
// custom_providers/<id>.json file. Returns nil body when Gateway.URL is empty.
|
||||||
func GooseCustomProviderFile(p *canonical.Profile) ([]byte, string) {
|
func GooseCustomProviderFile(p *canonical.Profile) ([]byte, string) {
|
||||||
|
|||||||
@@ -9,32 +9,6 @@ import (
|
|||||||
"github.com/lukaszraczylo/harness-sync/internal/canonical"
|
"github.com/lukaszraczylo/harness-sync/internal/canonical"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestBuildProvidersGatewayFirst(t *testing.T) {
|
|
||||||
p := &canonical.Profile{
|
|
||||||
Gateway: canonical.Gateway{URL: "https://gw", Token: "t", DefaultModel: "x"},
|
|
||||||
Models: []canonical.Model{{ID: "m1", Alias: "a1"}},
|
|
||||||
Upstreams: []canonical.Upstream{
|
|
||||||
{Name: "anthropic", APIKey: "k", BaseURL: "https://api.anthropic.com"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
out := BuildProviders(p)
|
|
||||||
require.Len(t, out, 2)
|
|
||||||
assert.Equal(t, "hs-gw", out[0]["id"])
|
|
||||||
assert.Equal(t, "anthropic", out[1]["id"])
|
|
||||||
assert.NotNil(t, out[0]["models"])
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuildProvidersNoGateway(t *testing.T) {
|
|
||||||
p := &canonical.Profile{
|
|
||||||
Upstreams: []canonical.Upstream{
|
|
||||||
{Name: "anthropic", APIKey: "k"},
|
|
||||||
},
|
|
||||||
}
|
|
||||||
out := BuildProviders(p)
|
|
||||||
require.Len(t, out, 1)
|
|
||||||
assert.Equal(t, "anthropic", out[0]["id"])
|
|
||||||
}
|
|
||||||
|
|
||||||
func TestBuildMCPMap(t *testing.T) {
|
func TestBuildMCPMap(t *testing.T) {
|
||||||
reg := &canonical.MCPRegistry{Servers: []canonical.MCPServer{
|
reg := &canonical.MCPRegistry{Servers: []canonical.MCPServer{
|
||||||
{Name: "filepuff", Command: "/bin/x", Transport: "stdio"},
|
{Name: "filepuff", Command: "/bin/x", Transport: "stdio"},
|
||||||
|
|||||||
@@ -0,0 +1,12 @@
|
|||||||
|
package common
|
||||||
|
|
||||||
|
import "os"
|
||||||
|
|
||||||
|
// DefaultHome returns the current user's home directory, or "" on error.
|
||||||
|
func DefaultHome() string {
|
||||||
|
h, err := os.UserHomeDir()
|
||||||
|
if err != nil {
|
||||||
|
return ""
|
||||||
|
}
|
||||||
|
return h
|
||||||
|
}
|
||||||
@@ -31,32 +31,7 @@ func BuildMCPMapStyled(reg *canonical.MCPRegistry, style MCPStyle) map[string]an
|
|||||||
func mcpEntry(s canonical.MCPServer, style MCPStyle) map[string]any {
|
func mcpEntry(s canonical.MCPServer, style MCPStyle) map[string]any {
|
||||||
e := map[string]any{}
|
e := map[string]any{}
|
||||||
switch style {
|
switch style {
|
||||||
case MCPClaudeStyle:
|
case MCPClaudeStyle, MCPCrushStyle:
|
||||||
// Claude Code's actual entry shape uses "type" (not "transport").
|
|
||||||
// Default to stdio when no URL is set.
|
|
||||||
t := s.Transport
|
|
||||||
if s.URL != "" {
|
|
||||||
if t == "" {
|
|
||||||
t = "http"
|
|
||||||
}
|
|
||||||
e["type"] = t
|
|
||||||
e["url"] = s.URL
|
|
||||||
} else {
|
|
||||||
if t == "" {
|
|
||||||
t = "stdio"
|
|
||||||
}
|
|
||||||
e["type"] = t
|
|
||||||
if s.Command != "" {
|
|
||||||
e["command"] = s.Command
|
|
||||||
}
|
|
||||||
if len(s.Args) > 0 {
|
|
||||||
e["args"] = s.Args
|
|
||||||
}
|
|
||||||
if len(s.Env) > 0 {
|
|
||||||
e["env"] = s.Env
|
|
||||||
}
|
|
||||||
}
|
|
||||||
case MCPCrushStyle:
|
|
||||||
if s.URL != "" {
|
if s.URL != "" {
|
||||||
t := s.Transport
|
t := s.Transport
|
||||||
if t == "" {
|
if t == "" {
|
||||||
@@ -65,7 +40,12 @@ func mcpEntry(s canonical.MCPServer, style MCPStyle) map[string]any {
|
|||||||
e["type"] = t
|
e["type"] = t
|
||||||
e["url"] = s.URL
|
e["url"] = s.URL
|
||||||
} else {
|
} else {
|
||||||
e["type"] = "stdio"
|
// Claude honours Transport field; Crush always uses "stdio".
|
||||||
|
t := "stdio"
|
||||||
|
if style == MCPClaudeStyle && s.Transport != "" {
|
||||||
|
t = s.Transport
|
||||||
|
}
|
||||||
|
e["type"] = t
|
||||||
if s.Command != "" {
|
if s.Command != "" {
|
||||||
e["command"] = s.Command
|
e["command"] = s.Command
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -29,21 +29,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
|
|||||||
@@ -25,21 +25,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
|
|||||||
@@ -23,21 +23,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
|
|||||||
@@ -32,21 +32,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
@@ -152,8 +144,8 @@ func buildExtensions(servers []canonical.MCPServer) map[string]any {
|
|||||||
// splitProviderModel splits "provider/model" into its parts.
|
// splitProviderModel splits "provider/model" into its parts.
|
||||||
// If no slash, provider is "anthropic" and the whole string is the model.
|
// If no slash, provider is "anthropic" and the whole string is the model.
|
||||||
func splitProviderModel(s string) (string, string) {
|
func splitProviderModel(s string) (string, string) {
|
||||||
if idx := strings.IndexByte(s, '/'); idx >= 0 {
|
if p, m, ok := strings.Cut(s, "/"); ok {
|
||||||
return s[:idx], s[idx+1:]
|
return p, m
|
||||||
}
|
}
|
||||||
return "anthropic", s
|
return "anthropic", s
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -27,21 +27,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
@@ -110,50 +102,15 @@ func (a *Adapter) Render(b *canonical.Bundle) (*adapter.FileSet, error) {
|
|||||||
|
|
||||||
// Also merge into opencode.jsonc when present — kilo reads it as its
|
// Also merge into opencode.jsonc when present — kilo reads it as its
|
||||||
// primary config. Delete the enabled_providers filter so our provider is
|
// primary config. Delete the enabled_providers filter so our provider is
|
||||||
// visible alongside user-defined providers. Deep-merge the provider map
|
// visible alongside user-defined providers.
|
||||||
// so existing providers (e.g. "llmgw") are preserved.
|
|
||||||
ocPath := filepath.Join(base, "opencode.jsonc")
|
ocPath := filepath.Join(base, "opencode.jsonc")
|
||||||
if ocRaw, readErr := os.ReadFile(ocPath); readErr == nil {
|
if ocContent, mergeErr := mergeOpenCodeJSONC(ocPath, overlay, b.Profile.Gateway.URL); mergeErr != nil {
|
||||||
// Parse existing content (supports JSONC comments internally).
|
return nil, mergeErr
|
||||||
var ocBase map[string]any
|
} else if ocContent != nil {
|
||||||
clean := common.StripJSONComments(string(ocRaw))
|
|
||||||
_ = json.Unmarshal([]byte(clean), &ocBase)
|
|
||||||
if ocBase == nil {
|
|
||||||
ocBase = map[string]any{}
|
|
||||||
}
|
|
||||||
|
|
||||||
ocOverlay := map[string]any{
|
|
||||||
"enabled_providers": nil, // delete filter
|
|
||||||
}
|
|
||||||
|
|
||||||
// Deep-merge provider: add our entries INTO the existing provider map,
|
|
||||||
// then absorb any duplicate providers that share the same gateway URL.
|
|
||||||
if newProv, ok := overlay["provider"].(map[string]any); ok && len(newProv) > 0 {
|
|
||||||
existingProv, _ := ocBase["provider"].(map[string]any)
|
|
||||||
if existingProv == nil {
|
|
||||||
existingProv = map[string]any{}
|
|
||||||
}
|
|
||||||
maps.Copy(existingProv, newProv)
|
|
||||||
// Absorb providers at the same URL into harness-sync-gateway,
|
|
||||||
// preserving user-crafted display names and custom limits.
|
|
||||||
merged := common.AbsorbDuplicateProviders(existingProv, common.GatewayProviderKey(b.Profile.Gateway.URL), b.Profile.Gateway.URL)
|
|
||||||
ocOverlay["provider"] = merged
|
|
||||||
}
|
|
||||||
// Copy model/small_model/mcp from the kilo.json overlay.
|
|
||||||
for _, k := range []string{"model", "small_model", "mcp"} {
|
|
||||||
if v, ok := overlay[k]; ok {
|
|
||||||
ocOverlay[k] = v
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
ocMerged, mergeErr := common.MergeJSONKeys([]byte(clean), ocOverlay)
|
|
||||||
if mergeErr != nil {
|
|
||||||
return nil, mergeErr
|
|
||||||
}
|
|
||||||
fs.Add(adapter.File{
|
fs.Add(adapter.File{
|
||||||
Dest: ocPath,
|
Dest: ocPath,
|
||||||
Kind: adapter.RenderedFile,
|
Kind: adapter.RenderedFile,
|
||||||
Content: ocMerged,
|
Content: ocContent,
|
||||||
NoMerge: true,
|
NoMerge: true,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
@@ -161,6 +118,41 @@ func (a *Adapter) Render(b *canonical.Bundle) (*adapter.FileSet, error) {
|
|||||||
return fs, nil
|
return fs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// mergeOpenCodeJSONC deep-merges our overlay into the existing opencode.jsonc
|
||||||
|
// file, deleting the enabled_providers filter and deduplicating gateway providers.
|
||||||
|
// Returns nil content (no error) when the file does not exist.
|
||||||
|
func mergeOpenCodeJSONC(path string, overlay map[string]any, gatewayURL string) ([]byte, error) {
|
||||||
|
ocRaw, err := os.ReadFile(path)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil //nolint:nilerr // file absent is not an error
|
||||||
|
}
|
||||||
|
|
||||||
|
var ocBase map[string]any
|
||||||
|
clean := common.StripJSONComments(string(ocRaw))
|
||||||
|
_ = json.Unmarshal([]byte(clean), &ocBase)
|
||||||
|
if ocBase == nil {
|
||||||
|
ocBase = map[string]any{}
|
||||||
|
}
|
||||||
|
|
||||||
|
ocOverlay := map[string]any{"enabled_providers": nil}
|
||||||
|
|
||||||
|
if newProv, ok := overlay["provider"].(map[string]any); ok && len(newProv) > 0 {
|
||||||
|
existingProv, _ := ocBase["provider"].(map[string]any)
|
||||||
|
if existingProv == nil {
|
||||||
|
existingProv = map[string]any{}
|
||||||
|
}
|
||||||
|
maps.Copy(existingProv, newProv)
|
||||||
|
ocOverlay["provider"] = common.AbsorbDuplicateProviders(existingProv, common.GatewayProviderKey(gatewayURL), gatewayURL)
|
||||||
|
}
|
||||||
|
for _, k := range []string{"model", "small_model", "mcp"} {
|
||||||
|
if v, ok := overlay[k]; ok {
|
||||||
|
ocOverlay[k] = v
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return common.MergeJSONKeys([]byte(clean), ocOverlay)
|
||||||
|
}
|
||||||
|
|
||||||
// Import reads kilo config from home and returns a canonical ImportResult.
|
// Import reads kilo config from home and returns a canonical ImportResult.
|
||||||
func (a *Adapter) Import(home string) (*adapter.ImportResult, error) {
|
func (a *Adapter) Import(home string) (*adapter.ImportResult, error) {
|
||||||
return importFrom(home)
|
return importFrom(home)
|
||||||
|
|||||||
@@ -24,21 +24,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
|
|||||||
@@ -28,21 +28,13 @@ func WithHome(h string) Option { return func(a *Adapter) { a.home = h } }
|
|||||||
|
|
||||||
// New returns a new Adapter with the given options applied.
|
// New returns a new Adapter with the given options applied.
|
||||||
func New(opts ...Option) *Adapter {
|
func New(opts ...Option) *Adapter {
|
||||||
a := &Adapter{home: defaultHome()}
|
a := &Adapter{home: common.DefaultHome()}
|
||||||
for _, o := range opts {
|
for _, o := range opts {
|
||||||
o(a)
|
o(a)
|
||||||
}
|
}
|
||||||
return a
|
return a
|
||||||
}
|
}
|
||||||
|
|
||||||
func defaultHome() string {
|
|
||||||
h, err := os.UserHomeDir()
|
|
||||||
if err != nil {
|
|
||||||
return ""
|
|
||||||
}
|
|
||||||
return h
|
|
||||||
}
|
|
||||||
|
|
||||||
// Name returns the harness identifier.
|
// Name returns the harness identifier.
|
||||||
func (a *Adapter) Name() string { return name }
|
func (a *Adapter) Name() string { return name }
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user