Commit fc1002b

HPCesia <me@hpcesia.com>
2026-10-17 07:09:46
crush: split cline config to file
1 parent e9047e7
Changed files (2)
modules
modules/dev/agents/crush/default.nix
@@ -88,44 +88,7 @@
               --matcher '^bash$' \
               --command "${lib.getExe pkgs.nur.repos.hpcesia.dcg}"
 
-            provider add cline \
-              --type openai-compat \
-              --base-url "https://api.cline.bot/api/v1/" \
-              --discover-models false
-
-            # The feed lists ids without capabilities, so join it with OpenRouter.
-            _cline_pass_models="$(${lib.getExe pkgs.curl} -fsSL --max-time 20 \
-              "https://api.cline.bot/api/v1/ai/cline/recommended-models" || true)"
-            if [ -n "$_cline_pass_models" ]; then
-              ${lib.getExe pkgs.curl} -fsSL --max-time 30 \
-                "https://openrouter.ai/api/v1/models" \
-                | ${lib.getExe pkgs.jq} -r --argjson cp "$_cline_pass_models" '
-                  (.data // []
-                    | map({key: (.id | split("/") | last), value: .})
-                    | from_entries) as $or
-                  | $cp.clinePass[]?
-                  | (.id | sub("^cline-pass/"; "")) as $slug
-                  | ($or[$slug] // {}) as $m
-                  | [
-                      $slug,
-                      (($m.name // $slug) | sub("^[^:]+: "; "")),
-                      ($m.context_length // 128000),
-                      ($m.top_provider.max_completion_tokens // 8192),
-                      (($m | length) == 0
-                        or (($m.supported_parameters // []) | index("reasoning")) != null
-                        or $m.reasoning != null),
-                      ((($m.architecture.input_modalities // []) | index("image")) != null)
-                    ]
-                  | @tsv
-                ' \
-                | while IFS=$'\t' read -r slug name ctx maxtokens canreason images; do
-                    model add "cline/cline-pass/$slug" --name "$name" \
-                      --context-window "$ctx" \
-                      --default-max-tokens "$maxtokens" \
-                      --can-reason "$canreason" \
-                      --supports-images "$images" </dev/null
-                  done
-            fi
+            source ${./provider-cline.sh}
           '';
         };
       };
modules/dev/agents/crush/provider-cline.sh
@@ -0,0 +1,38 @@
+provider add cline \
+  --type openai-compat \
+  --base-url "https://api.cline.bot/api/v1/" \
+  --discover-models false
+
+# The feed lists ids without capabilities, so join it with OpenRouter.
+_cline_pass_models="$(curl -fsSL --max-time 20 \
+  "https://api.cline.bot/api/v1/ai/cline/recommended-models" || true)"
+if [ -n "$_cline_pass_models" ]; then
+  curl -fsSL --max-time 30 \
+    "https://openrouter.ai/api/v1/models" |
+    jq -r --argjson cp "$_cline_pass_models" '
+      (.data // []
+        | map({key: (.id | split("/") | last), value: .})
+        | from_entries) as $or
+      | $cp.clinePass[]?
+      | (.id | sub("^cline-pass/"; "")) as $slug
+      | ($or[$slug] // {}) as $m
+      | [
+          $slug,
+          (($m.name // $slug) | sub("^[^:]+: "; "")),
+          ($m.context_length // 128000),
+          ($m.top_provider.max_completion_tokens // 8192),
+          (($m | length) == 0
+            or (($m.supported_parameters // []) | index("reasoning")) != null
+            or $m.reasoning != null),
+          ((($m.architecture.input_modalities // []) | index("image")) != null)
+        ]
+      | @tsv
+    ' |
+    while IFS=$'\t' read -r slug name ctx maxtokens canreason images; do
+      model add "cline/cline-pass/$slug" --name "$name" \
+        --context-window "$ctx" \
+        --default-max-tokens "$maxtokens" \
+        --can-reason "$canreason" \
+        --supports-images "$images" </dev/null
+    done
+fi