@aiagenta2z/agtm 1.1.0 → 1.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -3,14 +3,18 @@
3
3
 
4
4
  [GitHub](https://github.com/aiagenta2z/agtm)|[AI Agent Marketplace CLI Doc](https://www.deepnlp.org/doc/ai_agent_marketplace)|[DeepNLP AI Agent Marketplace](https://www.deepnlp.org/store/ai-agent) | [OneKey Gateway](https://deepnlp.org/doc/onekey_gateway) | [Agent MCP OneKey Router Ranking](https://www.deepnlp.org/agent/rankings) | [NodeJS agtm](https://www.npmjs.com/package/@aiagenta2z/agtm)
5
5
 
6
- `agtm` (AI Agent Management CLI) unifies skill management, agent registration, marketplace search, and provider CLI execution. Install skills from GitHub, log and rate skill runs, upload agent metadata to registries, query the public marketplace, and run agent toolchains with fuzzy hints.
6
+ `agtm` (AI Agent Manager CLI) unifies skill management, agent registration, marketplace search, and provider CLI execution. Install skills from GitHub, log and rate skill runs, upload agent metadata to registries, query the public marketplace, and run agent toolchains with fuzzy hints.
7
7
 
8
8
  ## Features
9
9
 
10
- *`agtm skills`*: Manage Skills, Add Skills, List Skills, Log Skills Performance, Skills performance Evaluator, compare to realworld benchmarks
11
- *`agtm upload`*: AI Agent Registry, register local agent meta information of json or yaml format(agent.json/agent.yaml) or sync your github source meta including README.md
12
- *`agtm search`*: Search the open source AI Agent Marketplace, including github community, huggingface community, product hunt community, deepnlp ai agent marketplace index, etc
13
- *`agtm run`*: Run agent clis, don't need to remember, with the powerful hints and completion ability, just type a few characters and "--hint" will help you complete the command line.
10
+ **agtm skills**: Manage Skills, Add Skills, List Skills, Log Skills Performance, Skills performance Evaluator, compare to realworld benchmarks
11
+ **agtm upload**: AI Agent Registry, register local agent meta information of json or yaml format(agent.json/agent.yaml) or sync your github source meta including README.md
12
+ **agtm search**: Search the open source AI Agent Marketplace, including github community, huggingface community, product hunt community, deepnlp ai agent marketplace index, etc
13
+ **agtm run**: Run agent clis, don't need to remember, with the powerful hints and completion ability, just type a few characters and "--hint" will help you complete the command line.
14
+
15
+ The agent cli run hint from "play" to "playwright" complete cli.
16
+
17
+ <img src="docs/static/snapshot_playwright_google.png" width="400px" />
14
18
 
15
19
  Furthermore, `agtm` provides memory to track skill outputs and enables performance rating against industry job level benchmarks. This allows you to score each skill execution and assign a professional tier to your AI Agent's capabilities—for example, evaluating its performance as equivalent to that of an L3 or L5 software engineer, marketing professional, etc.
16
20
 
@@ -18,6 +22,7 @@ Furthermore, `agtm` provides memory to track skill outputs and enables performan
18
22
  skill_id run_times score level
19
23
  ------------------- --------- ----- -----
20
24
  code_success_skills 5 0.9 L3(100%)
25
+ code_fail_skills 4 0.9 L3(100%)
21
26
  ```
22
27
 
23
28
  ## Quickstart
@@ -31,18 +36,18 @@ npm install -g @aiagenta2z/agtm
31
36
 
32
37
  Setup hint and skills benchmark
33
38
  ```shell
34
- agtm setup --levels ## Needed before `agtm rate`, to sync the benchmarks json to local folder
35
- agtm setup --hint ## Needed before `agtm run`
39
+ npx agtm setup --levels ## Needed before `agtm rate`, to sync the benchmarks json to local folder
40
+ npx agtm setup --hint ## Needed before `agtm run`
36
41
  ```
37
42
 
38
43
  Agtm CLI Options
39
44
 
40
45
  | CLI | Command and Options | Document |
41
46
  |-------------|-------------------------------------------|--------------------------------|
42
- | agtm skills | add, list, log, rate | [Doc](../docs/skills/README.md) |
43
- | agtm search | --q query | [Doc](../docs/registry/README.md) |
44
- | agtm upload | --github --config to local agent meta | [Doc](../docs/registry/README.md) |
45
- | agtm run | --hint agent-cli hint and auto completion | [Doc](../docs/run/README.md) |
47
+ | agtm skills | add, list, log, rate | [Doc](./docs/skills/README.md) |
48
+ | agtm search | --q query | [Doc](./docs/registry/README.md) |
49
+ | agtm upload | --github --config to local agent meta | [Doc](./docs/registry/README.md) |
50
+ | agtm run | --hint agent-cli hint and auto completion | [Doc](./docs/run/README.md) |
46
51
 
47
52
  ## `skills`
48
53
 
@@ -52,27 +57,27 @@ Download and add skills to your agent directory.
52
57
 
53
58
  #### Usage
54
59
  ```
55
- agtm skills add <unique_id>
56
- agtm skills add <github_url>
57
- agtm skills add <github_url> -a <agent_id>
58
- agtm skills add <owner_id/repo_id> -s <skill_id>
60
+ npx agtm skills add <unique_id>
61
+ npx agtm skills add <github_url>
62
+ npx agtm skills add <github_url> -a <agent_id>
63
+ npx agtm skills add <owner_id/repo_id> -s <skill_id>
59
64
  ```
60
65
 
61
66
  #### Example
62
67
  ```
63
- agtm skills add anthropics/skills -a claude-code ## install skills only to claude-codex
64
- agtm skills add msitarzewski/agency-agents
65
- agtm skills add aiagenta2z/onekey-gateway
66
- agtm skills add msitarzewski/agency-agents -s academic-anthropologist -a codex
67
- agtm skills add anthropics/skills -s skill-creator -a claude-code --global
68
+ npx agtm skills add anthropics/skills -a claude-code ## install skills only to claude-codex
69
+ npx agtm skills add msitarzewski/agency-agents
70
+ npx agtm skills add aiagenta2z/onekey-gateway
71
+ npx agtm skills add msitarzewski/agency-agents -s academic-anthropologist -a codex
72
+ npx agtm skills add anthropics/skills -s skill-creator -a claude-code --global
68
73
  ```
69
74
 
70
75
  ### skills list
71
76
 
72
77
  #### Usage
73
78
  ```
74
- agtm skills list
75
- agtm skills list --agent <agent_id> --global
79
+ npx agtm skills list
80
+ npx agtm skills list --agent <agent_id> --global
76
81
  ```
77
82
  Lists installed skills with `agent`, `skill_id`, `description`, install `path`, average `score`, and aggregated `level` (if ratings exist).
78
83
 
@@ -80,9 +85,9 @@ Lists installed skills with `agent`, `skill_id`, `description`, install `path`,
80
85
 
81
86
  #### Example
82
87
  ```
83
- agtm skills list
84
- agtm skills list --agent codex
85
- agtm skills list --agent claude-code --global
88
+ npx agtm skills list
89
+ npx agtm skills list --agent codex
90
+ npx agtm skills list --agent claude-code --global
86
91
  ```
87
92
 
88
93
 
@@ -90,15 +95,16 @@ agtm skills list --agent claude-code --global
90
95
 
91
96
  #### Usage
92
97
  ```
93
- agtm skills log <skill_id> --data '<json_payload>'
98
+ npx agtm skills log <skill_id> --data '<json_payload>'
94
99
  ```
100
+
95
101
  - Persists a run record at `.agtm/skills/log/<uuid>.json` (or the `--logDir` you supply).
96
102
  - `<json_payload>` must contain at least `input` and `output`; optional fields (meta, rating, level) are accepted.
97
103
 
98
104
  #### Example
99
105
  ```
100
- agtm skills log <skill_id> --data '{"input":"write a website for store","output":"success"}'
101
- agtm skills log code_success_skills --data '{"input":"generate sql","output":"ok","meta":{"agent":"claude-code"}}'
106
+ npx agtm skills log <skill_id> --data '{"input":"write a website for store","output":"success"}'
107
+ npx agtm skills log code_success_skills --data '{"input":"generate sql","output":"ok","meta":{"agent":"claude-code"}}'
102
108
  ```
103
109
 
104
110
  ### skills rate
@@ -107,14 +113,14 @@ agtm skills log code_success_skills --data '{"input":"generate sql","output":"ok
107
113
 
108
114
  To use the rate command, have to setup the benchmark levels configuration. save to `./agtm/levels/*.json` files
109
115
  ```shell
110
- agtm setup --levels
116
+ npx agtm setup --levels
111
117
  ```
112
118
 
113
119
  #### Usage
114
120
  ```
115
- agtm skills rate prepare --skill_id <skill_id> --prompt "<eval_prompt>" --benchmark <path/benchmark.json>
116
- agtm skills rate apply --skill_id <skill_id> --result '<result_json>'
117
- agtm skills rate show --skill_id <skill_id>
121
+ npx agtm skills rate prepare --skill_id <skill_id> --prompt "<eval_prompt>" --benchmark <path/benchmark.json>
122
+ npx agtm skills rate apply --skill_id <skill_id> --result '<result_json>'
123
+ npx agtm skills rate show --skill_id <skill_id>
118
124
  ```
119
125
  - `prepare` exports logs plus the top benchmark slices (e.g., Google SWE L3–L7) for an external evaluator.
120
126
  - `apply` writes evaluator outputs (`rating`, `level`) back to each log.
@@ -122,9 +128,9 @@ agtm skills rate show --skill_id <skill_id>
122
128
 
123
129
  #### Example
124
130
  ```
125
- agtm skills rate prepare --skill_id code_success_skills --prompt "Evaluate the results" --benchmark path/customized_agent_benchmark.json
126
- agtm skills rate apply --skill_id code_success_skills --result '{"results":[{"log_id":"3679a3fe-4d97-4eb1-83bc-f83d711be195","rating":0.90,"level":"L4"}]}'
127
- agtm skills rate show --skill_id code_success_skills
131
+ npx agtm skills rate prepare --skill_id code_success_skills --prompt "Evaluate the results" --benchmark path/customized_agent_benchmark.json
132
+ npx agtm skills rate apply --skill_id code_success_skills --result '{"results":[{"log_id":"3679a3fe-4d97-4eb1-83bc-f83d711be195","rating":0.90,"level":"L4"}]}'
133
+ npx agtm skills rate show --skill_id code_success_skills
128
134
  ```
129
135
  Sample output:
130
136
  ```
@@ -36,10 +36,514 @@
36
36
  {
37
37
  "cli": "onekey llm --payload <json|@file>",
38
38
  "hint": "Run a raw LLM request using a pre-formatted JSON payload or configuration file"
39
+ },
40
+ {
41
+ "cli": "onekey agent bing-image-search-mcp/bing-image-search-mcp search_images '{\"query\": \"Eiffel Tower sunset\", \"limit\": 5}'",
42
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
43
+ },
44
+ {
45
+ "cli": "onekey agent bing-image-search-mcp/bing-image-search-mcp search_images_batch '{\"query_list\": [\"Eiffel Tower sunset\", \"Louvre at night\"], \"limit\": 3}'",
46
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
47
+ },
48
+ {
49
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_geocode '{\"address\": \"Times Square, New York\"}'",
50
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
51
+ },
52
+ {
53
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_reverse_geocode '{\"latitude\": 40.758, \"longitude\": -73.9855}'",
54
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
55
+ },
56
+ {
57
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_search_places '{\"query\": \"Italian restaurants\", \"location\": {\"latitude\": 40.758, \"longitude\": -73.9855}, \"radius\": 500}'",
58
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
59
+ },
60
+ {
61
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_place_details '{\"place_id\": \"ChIJmQJIxlVYwokRLgeuocVOGVU\"}'",
62
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
63
+ },
64
+ {
65
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_distance_matrix '{\"origins\": [\"Times Square, NY\"], \"destinations\": [\"Central Park, NY\"], \"mode\": \"driving\"}'",
66
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
67
+ },
68
+ {
69
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_elevation '{\"locations\": [{\"latitude\": 36.057944, \"longitude\": -112.125168}]}'",
70
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
71
+ },
72
+ {
73
+ "cli": "onekey agent baidu-maps-sse/baidu-maps-sse maps_directions '{\"origin\": \"Golden Gate Bridge\", \"destination\": \"Ferry Building San Francisco\", \"mode\": \"driving\"}'",
74
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
75
+ },
76
+ {
77
+ "cli": "onekey agent brave-search/brave-search brave_web_search '{\"query\": \"latest AI research 2026\"}'",
78
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
79
+ },
80
+ {
81
+ "cli": "onekey agent brave-search/brave-search brave_local_search '{\"query\": \"coffee near Times Square\"}'",
82
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
83
+ },
84
+ {
85
+ "cli": "onekey agent google-search/google-search google_search '{\"query\": \"US inflation rate February 2026\", \"num\": 5, \"start\": 0}'",
86
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
87
+ },
88
+ {
89
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_area_chart '{}'",
90
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
91
+ },
92
+ {
93
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_bar_chart '{}'",
94
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
95
+ },
96
+ {
97
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_boxplot_chart '{}'",
98
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
99
+ },
100
+ {
101
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_column_chart '{}'",
102
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
103
+ },
104
+ {
105
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_district_map '{}'",
106
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
107
+ },
108
+ {
109
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_dual_axes_chart '{}'",
110
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
111
+ },
112
+ {
113
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_fishbone_diagram '{}'",
114
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
115
+ },
116
+ {
117
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_flow_diagram '{}'",
118
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
119
+ },
120
+ {
121
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_funnel_chart '{}'",
122
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
123
+ },
124
+ {
125
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_histogram_chart '{}'",
126
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
127
+ },
128
+ {
129
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_line_chart '{}'",
130
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
131
+ },
132
+ {
133
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_liquid_chart '{}'",
134
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
135
+ },
136
+ {
137
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_mind_map '{}'",
138
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
139
+ },
140
+ {
141
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_network_graph '{}'",
142
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
143
+ },
144
+ {
145
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_organization_chart '{}'",
146
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
147
+ },
148
+ {
149
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_path_map '{}'",
150
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
151
+ },
152
+ {
153
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_pie_chart '{}'",
154
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
155
+ },
156
+ {
157
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_pin_map '{}'",
158
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
159
+ },
160
+ {
161
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_radar_chart '{}'",
162
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
163
+ },
164
+ {
165
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_sankey_chart '{}'",
166
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
167
+ },
168
+ {
169
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_scatter_chart '{}'",
170
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
171
+ },
172
+ {
173
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_treemap_chart '{}'",
174
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
175
+ },
176
+ {
177
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_venn_chart '{}'",
178
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
179
+ },
180
+ {
181
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_violin_chart '{}'",
182
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
183
+ },
184
+ {
185
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_waterfall_chart '{}'",
186
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
187
+ },
188
+ {
189
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_word_cloud_chart '{}'",
190
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
191
+ },
192
+ {
193
+ "cli": "onekey agent mcp-server-chart/mcp-server-chart generate_spreadsheet '{}'",
194
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
195
+ },
196
+ {
197
+ "cli": "onekey agent tavily-remote-mcp/tavily-remote-mcp tavily_search '{\"query\": \"NVIDIA earnings\", \"max_results\": 5, \"search_depth\": \"advanced\"}'",
198
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
199
+ },
200
+ {
201
+ "cli": "onekey agent tavily-remote-mcp/tavily-remote-mcp tavily_extract '{\"urls\": [\"https://example.com/article\"], \"extract_depth\": \"advanced\", \"format\": \"markdown\"}'",
202
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
203
+ },
204
+ {
205
+ "cli": "onekey agent tavily-remote-mcp/tavily-remote-mcp tavily_crawl '{\"url\": \"https://example.com\", \"max_depth\": 1, \"max_breadth\": 10, \"limit\": 20}'",
206
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
207
+ },
208
+ {
209
+ "cli": "onekey agent tavily-remote-mcp/tavily-remote-mcp tavily_map '{\"url\": \"https://example.com/docs\", \"max_depth\": 1, \"max_breadth\": 10, \"limit\": 30}'",
210
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
211
+ },
212
+ {
213
+ "cli": "onekey agent tavily-remote-mcp/tavily-remote-mcp tavily_research '{\"input\": \"Impact of AI on healthcare\", \"model\": \"pro\"}'",
214
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
215
+ },
216
+ {
217
+ "cli": "onekey agent google-maps/google-maps maps_geocode '{\"address\": \"Times Square, New York\"}'",
218
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
219
+ },
220
+ {
221
+ "cli": "onekey agent google-maps/google-maps maps_reverse_geocode '{\"latitude\": 40.758, \"longitude\": -73.9855}'",
222
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
223
+ },
224
+ {
225
+ "cli": "onekey agent google-maps/google-maps maps_search_places '{\"query\": \"Italian restaurants\", \"location\": {\"latitude\": 40.758, \"longitude\": -73.9855}, \"radius\": 500}'",
226
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
227
+ },
228
+ {
229
+ "cli": "onekey agent google-maps/google-maps maps_place_details '{\"place_id\": \"ChIJmQJIxlVYwokRLgeuocVOGVU\"}'",
230
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
231
+ },
232
+ {
233
+ "cli": "onekey agent google-maps/google-maps maps_distance_matrix '{\"origins\": [\"Times Square, NY\"], \"destinations\": [\"Central Park, NY\"], \"mode\": \"driving\"}'",
234
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
235
+ },
236
+ {
237
+ "cli": "onekey agent google-maps/google-maps maps_elevation '{\"locations\": [{\"latitude\": 36.057944, \"longitude\": -112.125168}]}'",
238
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
239
+ },
240
+ {
241
+ "cli": "onekey agent google-maps/google-maps maps_directions '{\"origin\": \"Golden Gate Bridge\", \"destination\": \"Ferry Building San Francisco\", \"mode\": \"driving\"}'",
242
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
243
+ },
244
+ {
245
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_scrape '{\"url\": \"https://example.com/api-docs\", \"formats\": [\"json\"], \"onlyMainContent\": true}'",
246
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
247
+ },
248
+ {
249
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_map '{\"query\": \"webhook\"}'",
250
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
251
+ },
252
+ {
253
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_search '{\"query\": \"product pricing site:example.com\"}'",
254
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
255
+ },
256
+ {
257
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_crawl '{\"url\": \"https://example.com\"}'",
258
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
259
+ },
260
+ {
261
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_check_crawl_status '{\"crawl_id\": \"crawl-123\"}'",
262
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
263
+ },
264
+ {
265
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_extract '{\"url\": \"https://example.com\", \"selector\": \"h1\"}'",
266
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
267
+ },
268
+ {
269
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_agent '{\"task\": \"find pricing\", \"url\": \"https://example.com\"}'",
270
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
271
+ },
272
+ {
273
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_agent_status '{\"job_id\": \"job-123\"}'",
274
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
275
+ },
276
+ {
277
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_browser_create '{\"profile\": \"default\"}'",
278
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
279
+ },
280
+ {
281
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_browser_execute '{\"browser_id\": \"browser-1\", \"script\": \"document.title\"}'",
282
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
283
+ },
284
+ {
285
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_browser_delete '{\"browser_id\": \"browser-1\"}'",
286
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
287
+ },
288
+ {
289
+ "cli": "onekey agent firecrawl-mcp/firecrawl-mcp firecrawl_browser_list '{}'",
290
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
291
+ },
292
+ {
293
+ "cli": "onekey agent perplexity/perplexity perplexity_ask '{\"question\": \"Who won the 2024 World Series?\"}'",
294
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
295
+ },
296
+ {
297
+ "cli": "onekey agent perplexity/perplexity perplexity_research '{\"query\": \"renewable energy policies US\"}'",
298
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
299
+ },
300
+ {
301
+ "cli": "onekey agent perplexity/perplexity perplexity_reason '{\"topic\": \"impact of quantum computing\"}'",
302
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
303
+ },
304
+ {
305
+ "cli": "onekey agent perplexity/perplexity perplexity_search '{\"query\": \"best VR headsets 2026\"}'",
306
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
307
+ },
308
+ {
309
+ "cli": "onekey agent github/github add_comment_to_pending_review '{}'",
310
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
311
+ },
312
+ {
313
+ "cli": "onekey agent github/github add_issue_comment '{}'",
314
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
315
+ },
316
+ {
317
+ "cli": "onekey agent github/github create_branch '{}'",
318
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
319
+ },
320
+ {
321
+ "cli": "onekey agent github/github create_or_update_file '{}'",
322
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
323
+ },
324
+ {
325
+ "cli": "onekey agent github/github create_pull_request '{}'",
326
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
327
+ },
328
+ {
329
+ "cli": "onekey agent github/github create_repository '{}'",
330
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
331
+ },
332
+ {
333
+ "cli": "onekey agent github/github delete_file '{}'",
334
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
335
+ },
336
+ {
337
+ "cli": "onekey agent github/github fork_repository '{}'",
338
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
339
+ },
340
+ {
341
+ "cli": "onekey agent github/github get_commit '{}'",
342
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
343
+ },
344
+ {
345
+ "cli": "onekey agent github/github get_file_contents '{}'",
346
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
347
+ },
348
+ {
349
+ "cli": "onekey agent github/github get_label '{}'",
350
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
351
+ },
352
+ {
353
+ "cli": "onekey agent github/github get_latest_release '{}'",
354
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
355
+ },
356
+ {
357
+ "cli": "onekey agent github/github get_me '{}'",
358
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
359
+ },
360
+ {
361
+ "cli": "onekey agent github/github get_release_by_tag '{}'",
362
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
363
+ },
364
+ {
365
+ "cli": "onekey agent github/github get_tag '{}'",
366
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
367
+ },
368
+ {
369
+ "cli": "onekey agent github/github get_team_members '{}'",
370
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
371
+ },
372
+ {
373
+ "cli": "onekey agent github/github get_teams '{}'",
374
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
375
+ },
376
+ {
377
+ "cli": "onekey agent github/github issue_read '{}'",
378
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
379
+ },
380
+ {
381
+ "cli": "onekey agent github/github issue_write '{}'",
382
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
383
+ },
384
+ {
385
+ "cli": "onekey agent github/github list_branches '{}'",
386
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
387
+ },
388
+ {
389
+ "cli": "onekey agent github/github list_commits '{}'",
390
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
391
+ },
392
+ {
393
+ "cli": "onekey agent github/github list_issue_types '{}'",
394
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
395
+ },
396
+ {
397
+ "cli": "onekey agent github/github list_issues '{}'",
398
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
399
+ },
400
+ {
401
+ "cli": "onekey agent github/github list_pull_requests '{}'",
402
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
403
+ },
404
+ {
405
+ "cli": "onekey agent github/github list_releases '{}'",
406
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
407
+ },
408
+ {
409
+ "cli": "onekey agent github/github list_tags '{}'",
410
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
411
+ },
412
+ {
413
+ "cli": "onekey agent github/github merge_pull_request '{}'",
414
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
415
+ },
416
+ {
417
+ "cli": "onekey agent github/github pull_request_read '{}'",
418
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
419
+ },
420
+ {
421
+ "cli": "onekey agent github/github pull_request_review_write '{}'",
422
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
423
+ },
424
+ {
425
+ "cli": "onekey agent github/github push_files '{}'",
426
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
427
+ },
428
+ {
429
+ "cli": "onekey agent github/github request_copilot_review '{}'",
430
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
431
+ },
432
+ {
433
+ "cli": "onekey agent github/github search_code '{}'",
434
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
435
+ },
436
+ {
437
+ "cli": "onekey agent github/github search_issues '{}'",
438
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
439
+ },
440
+ {
441
+ "cli": "onekey agent github/github search_pull_requests '{}'",
442
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
443
+ },
444
+ {
445
+ "cli": "onekey agent github/github search_repositories '{}'",
446
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
447
+ },
448
+ {
449
+ "cli": "onekey agent github/github search_users '{}'",
450
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
451
+ },
452
+ {
453
+ "cli": "onekey agent github/github sub_issue_write '{}'",
454
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
455
+ },
456
+ {
457
+ "cli": "onekey agent github/github update_pull_request '{}'",
458
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
459
+ },
460
+ {
461
+ "cli": "onekey agent github/github update_pull_request_branch '{}'",
462
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
463
+ },
464
+ {
465
+ "cli": "onekey agent gemini-nano-banana/gemini-nano-banana generate_image_gemini '{\"model\": \"gemini-2.5-flash-image\", \"prompt\": \"sunrise over mountains\", \"aspect_ratio\": \"16:9\", \"image_size\": \"1K\"}'",
466
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
467
+ },
468
+ {
469
+ "cli": "onekey agent gemini-nano-banana/gemini-nano-banana generate_image_nano_banana '{\"model\": \"gemini-2.5-flash-image\", \"prompt\": \"robot reading book\", \"aspect_ratio\": \"16:9\", \"image_size\": \"1K\"}'",
470
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
471
+ },
472
+ {
473
+ "cli": "onekey agent gemini-nano-banana/gemini-nano-banana generate_image_nano_banana_with_reference '{\"model\": \"gemini-3-pro-image-preview\", \"prompt\": \"winter coat style\", \"images\": [\"https://avatars.githubusercontent.com/u/242328252\"], \"aspect_ratio\": \"1:1\"}'",
474
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
475
+ },
476
+ {
477
+ "cli": "onekey agent gemini-nano-banana/gemini-nano-banana ocr_extract_text_from_image '{\"images\": [\"https://avatars.githubusercontent.com/u/242328252\"], \"model\": \"gemini-3-flash-preview\"}'",
478
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
479
+ },
480
+ {
481
+ "cli": "onekey agent gemini-nano-banana/gemini-nano-banana list_items_from_image '{\"images\": [\"https://avatars.githubusercontent.com/u/242328252\"], \"model\": \"gemini-3-flash-preview\", \"output_json\": true}'",
482
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
483
+ },
484
+ {
485
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_direction_bicycling '{\"origin\": \"116.481028,39.989643\", \"destination\": \"116.465302,40.004717\"}'",
486
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
487
+ },
488
+ {
489
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_direction_driving '{\"origin\": \"116.481028,39.989643\", \"destination\": \"116.465302,40.004717\"}'",
490
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
491
+ },
492
+ {
493
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_direction_transit_integrated '{\"origin\": \"116.481028,39.989643\", \"destination\": \"116.465302,40.004717\", \"city\": \"北京\", \"cityd\": \"上海\"}'",
494
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
495
+ },
496
+ {
497
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_direction_walking '{\"origin\": \"116.481028,39.989643\", \"destination\": \"116.465302,40.004717\"}'",
498
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
499
+ },
500
+ {
501
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_distance '{\"origins\": \"116.481028,39.989643|116.465302,40.004717\", \"destination\": \"116.481028,39.989643\", \"type\": \"1\"}'",
502
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
503
+ },
504
+ {
505
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_geo '{\"address\": \"Beijing Capital Airport\", \"city\": \"北京\"}'",
506
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
507
+ },
508
+ {
509
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_regeocode '{\"location\": \"116.481488,39.990464\"}'",
510
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
511
+ },
512
+ {
513
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_ip_location '{\"ip\": \"8.8.8.8\"}'",
514
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
515
+ },
516
+ {
517
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_schema_personal_map '{\"orgName\": \"Weekend Trip\", \"lineList\": [{\"title\": \"Day1\", \"pointInfoList\": [{\"name\": \"Tiananmen\", \"lon\": 116.3975, \"lat\": 39.9087, \"poiId\": \"B000A8UIN8\"}]}]}'",
518
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
519
+ },
520
+ {
521
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_around_search '{\"keywords\": \"coffee\", \"location\": \"116.481488,39.990464\", \"radius\": \"2000\"}'",
522
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
523
+ },
524
+ {
525
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_search_detail '{\"id\": \"B0FFFABCD1\"}'",
526
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
527
+ },
528
+ {
529
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_text_search '{\"keywords\": \"Tsinghua University\", \"city\": \"北京\", \"citylimit\": true}'",
530
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
531
+ },
532
+ {
533
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_schema_navi '{\"lon\": \"116.3975\", \"lat\": \"39.9087\"}'",
534
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
535
+ },
536
+ {
537
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_schema_take_taxi '{\"slon\": \"116.3975\", \"slat\": \"39.9087\", \"sname\": \"Tiananmen\", \"dlon\": \"116.481028\", \"dlat\": \"39.989643\", \"dname\": \"Sanlitun\"}'",
538
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
539
+ },
540
+ {
541
+ "cli": "onekey agent amap-maps-streamableHTTP/amap-maps-streamableHTTP maps_weather '{\"city\": \"北京\"}'",
542
+ "hint": "Invoke a specific agent by ID with structured JSON data or a file input"
39
543
  }
40
544
  ]
41
545
  },
42
- "openai/codex-cli": {
546
+ "openai/codex-cli": {
43
547
  "hints": [
44
548
  {
45
549
  "cli": "codex",
package/dist/agtm-cli.js CHANGED
@@ -458,7 +458,7 @@ async function handleSkillsAdd(options) {
458
458
  process.exit(1);
459
459
  return;
460
460
  }
461
- console.log("INFO: Staring to fetch skills...");
461
+ console.log("INFO: Starting to fetch skills...");
462
462
  const resolved = resolveSkillSource(source);
463
463
  const skills = discoverSkills(resolved.root);
464
464
  if (skills.length === 0) {
@@ -1214,10 +1214,53 @@ function loadCombinedHints(useGlobal) {
1214
1214
  function buildIdTrie(hints) {
1215
1215
  const trie = createTrie();
1216
1216
  for (const id of Object.keys(hints)) {
1217
- insertTrie(trie, id, id);
1217
+ for (let i = 0; i < id.length; i++) {
1218
+ insertTrie(trie, id.substring(i), id);
1219
+ }
1218
1220
  }
1219
1221
  return trie;
1220
1222
  }
1223
+ function buildInvertedIndex(hints) {
1224
+ const index = {};
1225
+ for (const [id, entry] of Object.entries(hints)) {
1226
+ if (!entry.hints)
1227
+ continue;
1228
+ for (const item of entry.hints) {
1229
+ const doc = { id, cli: item.cli, hint: item.hint || '' };
1230
+ const text = `${id} ${item.cli} ${item.hint || ''}`.toLowerCase();
1231
+ const tokens = Array.from(new Set(text.split(/[^a-z0-9]+/)));
1232
+ for (const token of tokens) {
1233
+ if (!token)
1234
+ continue;
1235
+ if (!index[token])
1236
+ index[token] = [];
1237
+ if (!index[token].some(d => d.id === doc.id && d.cli === doc.cli)) {
1238
+ index[token].push(doc);
1239
+ }
1240
+ }
1241
+ }
1242
+ }
1243
+ return index;
1244
+ }
1245
+ function searchInvertedIndex(index, query) {
1246
+ const tokens = query.toLowerCase().split(/[^a-z0-9]+/).filter(Boolean);
1247
+ if (tokens.length === 0)
1248
+ return [];
1249
+ let results = new Map();
1250
+ for (const [key, docs] of Object.entries(index)) {
1251
+ for (const token of tokens) {
1252
+ if (key.includes(token)) {
1253
+ for (const doc of docs) {
1254
+ const docKey = `${doc.id}::${doc.cli}`;
1255
+ if (!results.has(docKey)) {
1256
+ results.set(docKey, doc);
1257
+ }
1258
+ }
1259
+ }
1260
+ }
1261
+ }
1262
+ return Array.from(results.values());
1263
+ }
1221
1264
  function buildCliTrie(hints) {
1222
1265
  const trie = createTrie();
1223
1266
  for (const item of hints) {
@@ -1233,9 +1276,19 @@ function filterCliHints(hints, query, limit) {
1233
1276
  }
1234
1277
  const trimmed = query.trim().toLowerCase();
1235
1278
  if (trimmed) {
1236
- const scored = hints
1237
- .map((item) => ({ item, score: fuzzyScore(trimmed, item.cli) }))
1238
- .filter((entry) => entry.score > 0);
1279
+ const queryTokens = Array.from(new Set(trimmed.split(/[^a-z0-9]+/))).filter(Boolean);
1280
+ const scored = hints.map((item) => {
1281
+ const text = `${item.cli} ${item.hint || ''}`.toLowerCase();
1282
+ let tokenMatches = 0;
1283
+ for (const token of queryTokens) {
1284
+ if (text.includes(token)) {
1285
+ tokenMatches += 1;
1286
+ }
1287
+ }
1288
+ const fScore = fuzzyScore(trimmed, item.cli);
1289
+ const score = tokenMatches * 10 + fScore;
1290
+ return { item, score };
1291
+ }).filter((entry) => entry.score > 0);
1239
1292
  scored.sort((a, b) => b.score - a.score || a.item.cli.localeCompare(b.item.cli));
1240
1293
  return scored.slice(0, limit).map((entry) => entry.item);
1241
1294
  }
@@ -1358,14 +1411,35 @@ async function selectSkillId(hints, input, limit = 5, trie) {
1358
1411
  }
1359
1412
  const activeTrie = trie || buildIdTrie(hints);
1360
1413
  const prefix = input || '';
1361
- let suggestions = searchTrie(activeTrie, prefix, limit);
1362
- if (suggestions.length === 0 && prefix) {
1414
+ let trieSuggestions = searchTrie(activeTrie, prefix, limit);
1415
+ let hintMatches = new Set();
1416
+ let finalSuggestions = [];
1417
+ if (prefix) {
1418
+ const index = buildInvertedIndex(hints);
1419
+ const docs = searchInvertedIndex(index, prefix);
1420
+ const scoredDocs = new Map();
1421
+ for (const doc of docs) {
1422
+ scoredDocs.set(doc.id, (scoredDocs.get(doc.id) || 0) + 1);
1423
+ }
1424
+ const sortedDocs = Array.from(scoredDocs.entries()).sort((a, b) => b[1] - a[1]);
1425
+ for (const [id] of sortedDocs) {
1426
+ finalSuggestions.push(id);
1427
+ hintMatches.add(id);
1428
+ }
1429
+ }
1430
+ for (const id of trieSuggestions) {
1431
+ if (!finalSuggestions.includes(id)) {
1432
+ finalSuggestions.push(id);
1433
+ }
1434
+ }
1435
+ if (finalSuggestions.length === 0 && prefix) {
1363
1436
  const scored = ids
1364
1437
  .map((id) => ({ id, score: fuzzyScore(prefix, id) }))
1365
1438
  .filter((entry) => entry.score > 0);
1366
1439
  scored.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));
1367
- suggestions = scored.slice(0, limit).map((entry) => entry.id);
1440
+ finalSuggestions = scored.slice(0, limit).map((entry) => entry.id);
1368
1441
  }
1442
+ let suggestions = finalSuggestions.slice(0, limit);
1369
1443
  if (suggestions.length === 0) {
1370
1444
  return null;
1371
1445
  }
@@ -1377,7 +1451,8 @@ async function selectSkillId(hints, input, limit = 5, trie) {
1377
1451
  trackedLog('');
1378
1452
  trackedLog('Skill ID suggestions:');
1379
1453
  suggestions.forEach((value, index) => {
1380
- trackedLog(` ${index + 1}. ${highlightMatches(value, prefix)}`);
1454
+ const hintBadge = hintMatches.has(value) ? ', \x1b[32m[hints]\x1b[0m' : '';
1455
+ trackedLog(` ${index + 1}. ${highlightMatches(value, prefix)}${hintBadge}`);
1381
1456
  });
1382
1457
  const selected = await promptSelection('Select skill id (number or id): ', suggestions);
1383
1458
  printedLines += 1; // prompt line
@@ -1491,8 +1566,28 @@ function countConsoleLogLines(message) {
1491
1566
  return 1;
1492
1567
  return message.split('\n').length;
1493
1568
  }
1569
+ /**
1570
+ If input json is single quoted already, don't double quote
1571
+ '{"a":1}': unchanged
1572
+ "{"a":1}": unchanged
1573
+ {"a":1}: '{"a":1}'
1574
+ */
1575
+ function safelyQuoteArgs(cmd) {
1576
+ return cmd.replace(/(['"])?({[^{}]*})(['"])?/g, (match, open, json, close) => {
1577
+ // already quoted properly → keep as-is
1578
+ if (open && close && open === close) {
1579
+ return match;
1580
+ }
1581
+ // wrap ONLY the JSON part
1582
+ return `'${json.replace(/'/g, `'\\''`)}'`;
1583
+ });
1584
+ }
1585
+ /**
1586
+ Usage: agtm run <unique_id> <cli>
1587
+ */
1494
1588
  async function handleRun(idArg, commandArgs = [], options = {}) {
1495
1589
  const isAgent = (options.mode || 'human').toLowerCase() === MODE_AGENT;
1590
+ const originalIdArg = idArg;
1496
1591
  // first load local hints
1497
1592
  // 1. Install Local and Global Cache
1498
1593
  let hints = loadCombinedHints(false);
@@ -1527,17 +1622,41 @@ async function handleRun(idArg, commandArgs = [], options = {}) {
1527
1622
  if (!idArg || !activeHints[idArg]) {
1528
1623
  const query = idArg || '';
1529
1624
  const trie = cachedIdTrie || buildIdTrie(activeHints);
1530
- let suggestions = searchTrie(trie, query, 2);
1531
- if (suggestions.length === 0 && query) {
1625
+ let trieSuggestions = searchTrie(trie, query, 5);
1626
+ let hintMatches = new Set();
1627
+ let finalSuggestions = [];
1628
+ if (query) {
1629
+ const index = buildInvertedIndex(activeHints);
1630
+ const docs = searchInvertedIndex(index, query);
1631
+ const scoredDocs = new Map();
1632
+ for (const doc of docs) {
1633
+ scoredDocs.set(doc.id, (scoredDocs.get(doc.id) || 0) + 1);
1634
+ }
1635
+ const sortedDocs = Array.from(scoredDocs.entries()).sort((a, b) => b[1] - a[1]);
1636
+ for (const [id] of sortedDocs) {
1637
+ finalSuggestions.push(id);
1638
+ hintMatches.add(id);
1639
+ }
1640
+ }
1641
+ for (const id of trieSuggestions) {
1642
+ if (!finalSuggestions.includes(id)) {
1643
+ finalSuggestions.push(id);
1644
+ }
1645
+ }
1646
+ if (finalSuggestions.length === 0 && query) {
1532
1647
  const scored = ids
1533
1648
  .map((id) => ({ id, score: fuzzyScore(query, id) }))
1534
1649
  .filter((entry) => entry.score > 0);
1535
1650
  scored.sort((a, b) => b.score - a.score || a.id.localeCompare(b.id));
1536
- suggestions = scored.slice(0, 2).map((entry) => entry.id);
1651
+ finalSuggestions = scored.slice(0, 5).map((entry) => entry.id);
1537
1652
  }
1653
+ let suggestions = finalSuggestions.slice(0, 5);
1654
+ // In agent mode, if we have a very strong single match, we might want to use it.
1655
+ // But for now, let's just print suggestions and exit as before, but with better ranking.
1538
1656
  console.log('\nSkill ID suggestions:');
1539
1657
  suggestions.forEach((value, index) => {
1540
- console.log(` ${index + 1}. ${highlightMatches(value, query)}`);
1658
+ const hintBadge = hintMatches.has(value) ? ', \x1b[32m[hints]\x1b[0m' : '';
1659
+ console.log(` ${index + 1}. ${highlightMatches(value, query)}${hintBadge}`);
1541
1660
  const entry = activeHints[value];
1542
1661
  if (entry?.hints?.length) {
1543
1662
  const preview = entry.hints.slice(0, 2).map((h) => `${h.cli}${h.hint ? ` # ${h.hint}` : ''}`);
@@ -1547,6 +1666,7 @@ async function handleRun(idArg, commandArgs = [], options = {}) {
1547
1666
  process.exit(1);
1548
1667
  }
1549
1668
  let finalCommandArgs = commandArgs;
1669
+ // Adjust idArg and finalCommandArgs if necessary
1550
1670
  if (finalCommandArgs.length > 0 && activeHints[finalCommandArgs[0]]) {
1551
1671
  idArg = finalCommandArgs[0];
1552
1672
  finalCommandArgs = finalCommandArgs.slice(1);
@@ -1557,7 +1677,10 @@ async function handleRun(idArg, commandArgs = [], options = {}) {
1557
1677
  const hintEntry = activeHints[idArg];
1558
1678
  if (!finalCommandArgs || finalCommandArgs.length === 0) {
1559
1679
  console.log('\nCommand hints:');
1560
- hintEntry?.hints?.slice(0, 5).forEach((item, index) => {
1680
+ // USE originalIdArg to filter hints even in agent mode if no command specified
1681
+ const searchQuery = (originalIdArg && originalIdArg !== idArg) ? originalIdArg : '';
1682
+ const suggestions = filterCliHints(hintEntry.hints || [], searchQuery, 5);
1683
+ suggestions.forEach((item, index) => {
1561
1684
  const hintText = item.hint ? ` # ${item.hint}` : '';
1562
1685
  console.log(` ${index + 1}. ${item.cli}${hintText}`);
1563
1686
  });
@@ -1643,7 +1766,8 @@ async function handleRun(idArg, commandArgs = [], options = {}) {
1643
1766
  if (!finalCommandArgs || finalCommandArgs.length === 0) {
1644
1767
  let chosen = null;
1645
1768
  if (hintEntry?.hints && hintEntry.hints.length > 0) {
1646
- const query = await promptCommandLine(`\nEnter command to run (leave empty to list cli hints): `, ``);
1769
+ const defaultQuery = (originalIdArg && originalIdArg !== idArg) ? originalIdArg : '';
1770
+ const query = await promptCommandLine(`\nEnter command to run (leave empty to list cli hints): `, defaultQuery);
1647
1771
  const searchQuery = query || '';
1648
1772
  chosen = await selectCliHint(hintEntry.hints, searchQuery);
1649
1773
  }
@@ -1670,19 +1794,32 @@ async function handleRun(idArg, commandArgs = [], options = {}) {
1670
1794
  console.error('\n❌ Error: Missing command to run.');
1671
1795
  process.exit(1);
1672
1796
  }
1673
- const finalCommandLine = finalCommandArgs.join(' ');
1797
+ let finalCommandLine = finalCommandArgs.join(' ');
1674
1798
  console.log("\nComplete the Cli with your arguments or leave blank and press Enter");
1675
1799
  const edited = await promptCommandLine(`\nFinal command line [${finalCommandLine}]:\n`, `${finalCommandLine}`);
1800
+ // if (edited && edited.trim()) {
1801
+ // finalCommandArgs = edited.split(/\s+/).filter(Boolean);
1802
+ // }
1803
+ // IMPORTANT: do NOT split anymore, keep the json in <cli> not split again agtm run <id> <cli>
1676
1804
  if (edited && edited.trim()) {
1677
- finalCommandArgs = edited.split(/\s+/).filter(Boolean);
1805
+ finalCommandLine = edited.trim();
1678
1806
  }
1807
+ // re-add quotes for JSON
1808
+ finalCommandLine = safelyQuoteArgs(finalCommandLine);
1679
1809
  const [command, ...args] = finalCommandArgs;
1680
- const printable = `agtm run ${idArg} ${finalCommandArgs.join(' ')}`.trim();
1810
+ const printable = `agtm run ${idArg} ${finalCommandLine}`.trim();
1681
1811
  console.log(`\u001b[32m${printable}\u001b[0m`);
1682
1812
  if (options.print || options.dryRun) {
1683
1813
  return;
1684
1814
  }
1685
- const child = spawn(command, args, { stdio: 'inherit' });
1815
+ if (LOG_ENABLE) {
1816
+ console.log(`finalCommandLine is ${finalCommandLine}`);
1817
+ }
1818
+ const child = spawn(finalCommandLine, {
1819
+ stdio: 'inherit',
1820
+ shell: true
1821
+ });
1822
+ // const child = spawn(command, args, { stdio: 'inherit' });
1686
1823
  child.on('error', (err) => {
1687
1824
  if (err.code === 'ENOENT') {
1688
1825
  console.error(`\n❌ Error: Command not found: ${command}`);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aiagenta2z/agtm",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "agtm: CLI Tool for AI Agent Management, Skills, Agent Registry, Benchmarks and Hints in AI Agent Marketplace\n",
5
5
  "main": "dist/agtm-cli.js",
6
6
  "type": "module",