Skip to content

Commit 9148f0f

Browse files
committed
Fix plugin installed list
1 parent 7adb870 commit 9148f0f

4 files changed

Lines changed: 21 additions & 20 deletions

File tree

src/eca/features/commands.clj

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -430,8 +430,9 @@
430430
(str s "**" source-name "** (`" (:source-url (first source-plugins)) "`)\n"
431431
(reduce
432432
(fn [s2 {:keys [name description installed?]}]
433-
(str s2 "- " name
434-
(when installed? "")
433+
(str s2 "- "
434+
(when installed? "")
435+
name
435436
(when description (str "" description))
436437
"\n"))
437438
""

src/eca/features/plugins.clj

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@
2323

2424
(defn ^:private sanitize-source-url
2525
"Converts a git URL into a human-readable directory name.
26-
e.g. 'https://github.com/nubank/ai-agents-plugins.git' -> 'github.com-nubank-ai-agents-plugins'"
26+
e.g. 'https://github.com/my-org/my-plugins.git' -> 'github.com-my-org-my-plugins'"
2727
^String [^String url]
2828
(-> url
2929
(string/replace #"^https?://" "")
@@ -327,7 +327,7 @@
327327
Returns a seq of {:name :source-name :source-url :description :installed?} maps."
328328
[plugins-config]
329329
(when (seq plugins-config)
330-
(let [installed-set (set (get plugins-config :install []))
330+
(let [installed-set (set (get plugins-config "install" []))
331331
sources (parse-sources plugins-config)]
332332
(doall
333333
(for [[source-name source-url] sources
@@ -375,7 +375,7 @@
375375
[plugins-config ^String input]
376376
(let [{:keys [plugin-name marketplace]} (parse-plugin-arg input)
377377
sources (parse-sources plugins-config)
378-
current-install (set (get plugins-config :install []))]
378+
current-install (set (get plugins-config "install" []))]
379379
(cond
380380
(empty? sources)
381381
{:status :error
@@ -400,7 +400,7 @@
400400
"Uninstalls a plugin by removing it from the global config install list.
401401
Returns {:status :ok/:error, :message ...}."
402402
[plugins-config ^String plugin-name]
403-
(let [current-install (set (get plugins-config :install []))]
403+
(let [current-install (set (get plugins-config "install" []))]
404404
(if (contains? current-install plugin-name)
405405
(let [new-install (vec (sort (disj current-install plugin-name)))]
406406
(config/update-global-config! {:plugins {:install new-install}})

test/eca/features/agents_test.clj

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@
6161
(let [md (str "---\n"
6262
"description: You sleep one second when asked\n"
6363
"mode: subagent\n"
64-
"model: nubank-anthropic/sonnet-4.5\n"
64+
"model: my-org-anthropic/sonnet-4.5\n"
6565
"steps: 5\n"
6666
"tools:\n"
6767
" byDefault: ask\n"
@@ -76,7 +76,7 @@
7676
config (#'agents/md->agent-config parsed)]
7777
(is (match? {:description "You sleep one second when asked"
7878
:mode "subagent"
79-
:defaultModel "nubank-anthropic/sonnet-4.5"
79+
:defaultModel "my-org-anthropic/sonnet-4.5"
8080
:maxSteps 5
8181
:systemPrompt "You should run sleep 1 and return \"I sleeped 1 second\""
8282
:toolCall {:approval {:byDefault "ask"

test/eca/features/plugins_test.clj

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,11 @@
99

1010
(deftest sanitize-source-url-test
1111
(testing "HTTPS URL"
12-
(is (= "github.com-nubank-ai-agents-plugins"
13-
(#'plugins/sanitize-source-url "https://github.com/nubank/ai-agents-plugins.git"))))
12+
(is (= "github.com-my-org-my-plugins"
13+
(#'plugins/sanitize-source-url "https://github.com/my-org/my-plugins.git"))))
1414
(testing "SSH URL"
15-
(is (= "github.com-nubank-ai-agents-plugins"
16-
(#'plugins/sanitize-source-url "git@github.com:nubank/ai-agents-plugins.git"))))
15+
(is (= "github.com-my-org-my-plugins"
16+
(#'plugins/sanitize-source-url "git@github.com:my-org/my-plugins.git"))))
1717
(testing "GitLab URL"
1818
(is (= "gitlab.com-org-repo"
1919
(#'plugins/sanitize-source-url "https://gitlab.com/org/repo.git")))))
@@ -135,15 +135,15 @@
135135

136136
(deftest parse-sources-test
137137
(testing "extracts source entries, filtering install"
138-
(let [config {:nubank {:source "https://github.com/nubank/ai-agents-plugins.git"}
139-
:local {:source "/home/user/plugins"}
140-
:install ["plugin-a" "plugin-b"]}]
141-
(is (match? (m/in-any-order [["nubank" "https://github.com/nubank/ai-agents-plugins.git"]
138+
(let [config {"my-org" {:source "https://github.com/my-org/my-plugins.git"}
139+
"local" {:source "/home/user/plugins"}
140+
"install" ["plugin-a" "plugin-b"]}]
141+
(is (match? (m/in-any-order [["my-org" "https://github.com/my-org/my-plugins.git"]
142142
["local" "/home/user/plugins"]])
143143
(#'plugins/parse-sources config)))))
144144

145145
(testing "returns empty for no sources"
146-
(is (empty? (#'plugins/parse-sources {:install ["plugin-a"]})))))
146+
(is (empty? (#'plugins/parse-sources {"install" ["plugin-a"]})))))
147147

148148
(deftest resolve-all!-test
149149
(let [tmp-dir (fs/create-temp-dir)]
@@ -235,20 +235,20 @@
235235
(let [updated (atom nil)]
236236
(with-redefs [eca.config/update-global-config! (fn [c] (reset! updated c))]
237237
(let [result (plugins/uninstall-plugin!
238-
{:install ["alpha" "beta" "gamma"]}
238+
{"install" ["alpha" "beta" "gamma"]}
239239
"beta")]
240240
(is (= :ok (:status result)))
241241
(is (= ["alpha" "gamma"] (get-in @updated [:plugins :install])))))))
242242

243243
(testing "returns error when plugin is not installed"
244244
(let [result (plugins/uninstall-plugin!
245-
{:install ["alpha"]}
245+
{"install" ["alpha"]}
246246
"beta")]
247247
(is (= :error (:status result)))
248248
(is (re-find #"not installed" (:message result)))))
249249

250250
(testing "returns error when install list is empty"
251251
(let [result (plugins/uninstall-plugin!
252-
{:install []}
252+
{"install" []}
253253
"beta")]
254254
(is (= :error (:status result))))))

0 commit comments

Comments
 (0)