@inneranimalmedia/agentsam-sdk 2.6.3 → 2.6.4
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/AGENTSAM.md +6 -0
- package/README.md +16 -1
- package/bin/agentsam +16 -1
- package/docs/BRAND_INTELLIGENCE.md +1 -1
- package/docs/architecture/AGENTSAM_DISTRIBUTION_OWNERSHIP.md +176 -0
- package/docs/architecture/AGENTSAM_GO_RUNTIME.md +282 -0
- package/docs/architecture/CODEBASEINDEX_GUIDED_PATH.md +202 -0
- package/docs/architecture/FS_E2E_CLOSURE_RECEIPT.md +59 -0
- package/docs/architecture/LOCAL_FS_AUTHORITY.md +38 -0
- package/docs/architecture/LOCAL_STUDIO_CLOUDFLARE_OAUTH.md +28 -0
- package/docs/architecture/PLAN_CLI_AND_LOCAL_STUDIO_DESKTOP.md +96 -0
- package/docs/architecture/SAM_ACTIVITY_RECOVERY_RECEIPT.md +39 -0
- package/docs/architecture/SAM_DECISION_WORK_RECEIPT.md +54 -0
- package/docs/architecture/SAM_KERNEL.md +181 -0
- package/docs/architecture/SAM_MACHINE_NORMALIZATION_PRECOMMIT_REPORT.md +208 -0
- package/docs/architecture/SLASH_SKILLS_PORTABLE.md +116 -0
- package/docs/architecture/fs-e2e-receipt.latest.json +42 -0
- package/docs/architecture/previews/codebaseindex-guided-path/CODEBASEINDEX_GUIDED_PATH.md +202 -0
- package/docs/architecture/previews/codebaseindex-guided-path/index.html +321 -0
- package/migrations/d1/0010_portable_tickets_memory.sql +140 -0
- package/migrations/d1/0011_agentsam_skill_v2.sql +185 -0
- package/migrations/d1/0011b_agentsam_skill_v2_cutover.sql +22 -0
- package/migrations/d1/0011c_agentsam_skill_v2_backfill.sql +76 -0
- package/migrations/d1/0011d_agentsam_skill_v2_retrieval_revisions.sql +50 -0
- package/migrations/d1/0012_agentsam_tools_required_seed.sql +67 -0
- package/migrations/d1/0013_identity_oauth_states.sql +15 -0
- package/migrations/d1/0014_auth_event_log.sql +20 -0
- package/migrations/d1/0015_identity_oauth_state_app_id.sql +3 -0
- package/migrations/d1/README_PORTABLE_CONTROL_PLANE.md +16 -0
- package/migrations/sqlite/agentsam_skill_retrieval.portable.sql +42 -0
- package/package.json +19 -4
- package/packages/agentsam-contracts/src/errors.ts +16 -0
- package/packages/agentsam-errors/src/envelope.js +53 -0
- package/packages/agentsam-errors/src/index.js +1 -0
- package/packages/agentsam-errors/src/recovery.js +301 -0
- package/packages/agentsam-knowledge/src/providers/index.js +18 -6
- package/packages/connectors/cloudflare/src/routes.js +9 -0
- package/packages/connectors/cloudflare/tests/connector.test.mjs +26 -1
- package/packages/identity/.agentsam/features/oauth-login-portal/agentsam.feature.json +1 -1
- package/packages/identity/.agentsam/features/oauth-login-portal/routes.json +11 -2
- package/packages/identity/docs/PORTABLE_IDENTITY_ARCHITECTURE.md +50 -0
- package/packages/identity/migrations/D1_SCHEMA_MAPPING.md +31 -0
- package/packages/identity/migrations/sqlite/001_identity_core.sql +99 -0
- package/packages/identity/migrations/sqlite/002_identity_oauth_client.sql +38 -0
- package/packages/identity/migrations/sqlite/003_identity_oauth_server.sql +64 -0
- package/packages/identity/package.json +2 -2
- package/packages/identity/src/adapters/cloudflare-d1/index.js +122 -22
- package/packages/identity/src/adapters/sqlite/index.js +319 -0
- package/packages/identity/src/app/verify-app.js +95 -0
- package/packages/identity/src/contracts/identity-store.js +115 -0
- package/packages/identity/src/contracts/route-ids.js +30 -0
- package/packages/identity/src/contracts/route-projection.js +218 -0
- package/packages/identity/src/contracts/routes.js +11 -0
- package/packages/identity/src/core/browser-paths.js +4 -5
- package/packages/identity/src/core/constants.js +13 -8
- package/packages/identity/src/core/session-policy.js +32 -0
- package/packages/identity/src/frontend/auth-portal/pages/login.html +10 -10
- package/packages/identity/src/frontend/auth-portal/pages/reset.html +3 -3
- package/packages/identity/src/frontend/auth-portal/pages/signup.html +3 -3
- package/packages/identity/src/frontend/auth-portal/preview/dashboard-stub.html +1 -1
- package/packages/identity/src/index.js +25 -0
- package/packages/identity/src/oauth/README.md +10 -4
- package/packages/identity/src/oauth/credentials.js +20 -13
- package/packages/identity/src/oauth/finalize-inbound.js +1 -1
- package/packages/identity/src/oauth/iam-platform.js +8 -7
- package/packages/identity/src/oauth/redirect-paths.js +27 -36
- package/packages/identity/src/server/identity-service.js +30 -13
- package/packages/identity/src/server/mount-policy.js +30 -0
- package/packages/identity/src/server/post-auth.js +79 -0
- package/packages/identity/src/server/worker-router.js +104 -72
- package/packages/identity/tests/finalize-inbound-oauth.test.mjs +6 -6
- package/packages/identity/tests/iam-provider.test.mjs +1 -1
- package/packages/identity/tests/identity-service.test.mjs +36 -5
- package/packages/identity/tests/oauth-credentials.test.mjs +3 -1
- package/packages/identity/tests/portable-identity-architecture.test.mjs +157 -0
- package/packages/identity/tests/session-routes-policy.test.mjs +21 -0
- package/packages/theme-church-site/package.json +2 -1
- package/packages/theme-church-site/src/index.js +1 -0
- package/packages/theme-companions-site/package.json +2 -1
- package/packages/theme-companions-site/src/index.js +1 -0
- package/packages/theme-floors-site/package.json +2 -1
- package/packages/theme-floors-site/src/index.js +1 -0
- package/packages/theme-fuelnfree-site/package.json +2 -1
- package/packages/theme-fuelnfree-site/src/index.js +1 -0
- package/packages/theme-handyman-site/package.json +2 -1
- package/packages/theme-handyman-site/src/index.js +1 -0
- package/packages/theme-insurance-site/package.json +2 -1
- package/packages/theme-insurance-site/src/index.js +1 -0
- package/packages/theme-shinshu-site/package.json +2 -1
- package/packages/theme-shinshu-site/src/index.js +1 -0
- package/protocol/apps/agentsam.app.v1.schema.json +51 -0
- package/protocol/brand/brandpack.v1.schema.json +43 -0
- package/protocol/credentials/issue.v1.schema.json +38 -0
- package/protocol/database/connection.v1.schema.json +41 -0
- package/protocol/embeddings/embedding-profile.v1.schema.json +20 -0
- package/protocol/errors/error-envelope.schema.json +135 -1
- package/protocol/errors/recovery.v1.schema.json +50 -0
- package/protocol/runtime/workspace-fs.v1.schema.json +71 -0
- package/protocol/sam/activity.v1.schema.json +48 -0
- package/protocol/sam/answer.v1.schema.json +35 -0
- package/protocol/sam/calibration.v1.schema.json +21 -0
- package/protocol/sam/decision-receipt.v1.schema.json +29 -0
- package/protocol/sam/evaluation.v1.schema.json +19 -0
- package/protocol/sam/operation.schema.json +66 -0
- package/protocol/sam/outcome.v1.schema.json +36 -0
- package/protocol/sam/question.v1.schema.json +26 -0
- package/protocol/sam/registry.seed.json +153 -0
- package/protocol/sam/result.schema.json +53 -0
- package/protocol/sam/state.v1.schema.json +23 -0
- package/protocol/skills/agentsam.interaction.v1.schema.json +50 -0
- package/protocol/skills/agentsam.skill.v1.schema.json +57 -0
- package/protocol/ui/icon-registry.mjs +226 -0
- package/protocol/ui/icon.v1.schema.json +51 -0
- package/skills/README.md +22 -9
- package/skills/agentsam-codebaseindex/SKILL.md +225 -0
- package/skills/catalog.json +14 -0
- package/src/cli/command-catalog.js +130 -0
- package/src/cli/dispatch.js +48 -0
- package/src/cli.js +43 -1
- package/src/commands/api-key.js +244 -0
- package/src/commands/app.js +60 -28
- package/src/commands/brand.js +17 -19
- package/src/commands/codebaseindex.js +688 -0
- package/src/commands/env.js +152 -25
- package/src/commands/go.js +366 -53
- package/src/commands/interaction-clack.js +115 -0
- package/src/commands/models.js +1 -1
- package/src/commands/providers.js +62 -14
- package/src/commands/shell.js +43 -2
- package/src/commands/skill.js +248 -0
- package/src/commands/skills.js +1 -1
- package/src/commands/start-local.js +4 -0
- package/src/commands/whoami.js +90 -18
- package/src/go/build.js +229 -39
- package/src/go/cloudflare.js +506 -105
- package/src/go/container.js +120 -0
- package/src/go/contract.js +9 -4
- package/src/go/discover.js +149 -33
- package/src/go/index.js +15 -3
- package/src/go/native-probe-runner.mjs +119 -0
- package/src/go/{registry.js → official-registry.js} +64 -7
- package/src/go/official-release.js +10 -0
- package/src/go/receipts.js +77 -10
- package/src/go/verify.js +9 -2
- package/src/index.js +27 -0
- package/src/indexing/ingest/discover-models.js +298 -0
- package/src/indexing/ingest/inventory.js +243 -0
- package/src/indexing/ingest/job-graph.js +181 -0
- package/src/indexing/ingest/materials.js +210 -0
- package/src/lib/provider-credentials.js +63 -21
- package/src/lib/slash-commands.js +1 -0
- package/src/local-fs/capability.js +121 -0
- package/src/local-fs/freshness.js +75 -0
- package/src/local-fs/index.js +385 -0
- package/src/local-fs/paths.js +100 -0
- package/src/local-pty/server.js +295 -19
- package/src/mcp/client.js +2 -2
- package/src/models/ai-access-onboarding.js +112 -0
- package/src/models/discovery.js +10 -2
- package/src/models/inventory-core.js +9 -1
- package/src/sam/activity/index.js +183 -0
- package/src/sam/client.js +252 -0
- package/src/sam/decision/calibration.js +109 -0
- package/src/sam/decision/confidence.js +126 -0
- package/src/sam/decision/evaluate.js +157 -0
- package/src/sam/decision/evaluators/deterministic.js +341 -0
- package/src/sam/decision/evaluators/heuristic.js +61 -0
- package/src/sam/decision/evaluators/select.js +50 -0
- package/src/sam/decision/evaluators/semantic.js +149 -0
- package/src/sam/decision/hierarchical.js +61 -0
- package/src/sam/decision/index.js +53 -0
- package/src/sam/decision/policy.js +86 -0
- package/src/sam/decision/questions.js +120 -0
- package/src/sam/decision/receipt.js +148 -0
- package/src/sam/decision/state.js +117 -0
- package/src/sam/decision/types.js +22 -0
- package/src/sam/decision/validate.js +200 -0
- package/src/sam/define.js +51 -0
- package/src/sam/index.js +65 -0
- package/src/sam/operations/brand-scan.js +62 -0
- package/src/sam/operations/cad-blender-inspect.js +36 -0
- package/src/sam/operations/codebaseindex-ingest.js +49 -0
- package/src/sam/operations/decision-evaluate.js +59 -0
- package/src/sam/operations/planning-astar.js +77 -0
- package/src/sam/operations/planning-goap.js +60 -0
- package/src/sam/operations/repository-inspect.js +72 -0
- package/src/sam/operations/security-scan.js +33 -0
- package/src/sam/operations/terminal-exec.js +29 -0
- package/src/sam/planning/astar.js +311 -0
- package/src/sam/planning/goap.js +177 -0
- package/src/sam/planning/index.js +21 -0
- package/src/sam/planning/state.js +84 -0
- package/src/sam/registry.js +48 -0
- package/src/sam/result.js +77 -0
- package/src/sam/seed.js +44 -0
- package/src/sam/types.js +91 -0
- package/src/skills/catalog.js +64 -0
- package/src/skills/content-resolver.js +124 -0
- package/src/skills/hosted-store.js +37 -0
- package/src/skills/index.js +29 -64
- package/src/skills/interaction.js +102 -0
- package/src/skills/local-store.js +228 -0
- package/src/skills/manifest.js +104 -0
- package/src/skills/metrics.js +31 -0
- package/src/skills/registry.js +184 -0
- package/src/skills/runtime.js +287 -0
- package/src/skills/slash.js +44 -0
- package/src/ui/cli/help.js +94 -101
- package/test/cli/api-key-env-whoami.test.mjs +129 -0
- package/test/cli/codebaseindex-plan-ux.test.mjs +37 -0
- package/test/cli/go.test.mjs +62 -5
- package/test/cli/skill-npm-and-env.test.mjs +52 -0
- package/test/cli/wireframes-go-registry.test.mjs +87 -2
- package/test/go/build-source-identity.test.mjs +31 -0
- package/test/go/cloudflare-probe.test.mjs +274 -10
- package/test/go/distribution.test.mjs +28 -0
- package/test/integration/ai-access-onboarding.test.mjs +47 -0
- package/test/integration/cli-help.test.mjs +1 -1
- package/test/integration/cms-site-tenancy-contract.test.mjs +6 -6
- package/test/integration/codebaseindex-ingest.test.mjs +166 -0
- package/test/integration/icon-registry.test.mjs +67 -0
- package/test/integration/ingest-discover-models.test.mjs +30 -0
- package/test/integration/install-script.test.mjs +12 -9
- package/test/integration/local-fs.test.mjs +113 -0
- package/test/integration/provider-env-cli.test.mjs +2 -1
- package/test/integration/sam-activity-recovery.test.mjs +147 -0
- package/test/integration/sam-decision.test.mjs +584 -0
- package/test/integration/sam-kernel.test.mjs +99 -0
- package/test/integration/sam-planning-astar.test.mjs +279 -0
- package/test/integration/skill-runtime.test.mjs +240 -0
- package/test/integration/studio-fs-pty-e2e.test.mjs +294 -0
- package/test/models.test.mjs +14 -7
- package/test/shell.test.mjs +4 -4
|
@@ -0,0 +1,225 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: agentsam-codebaseindex
|
|
3
|
+
description: Inventory-first codebase ingest — materials, scope, optional embeddings/storage. Pipeline IDs are not shell commands.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# AgentSam CodebaseIndex
|
|
7
|
+
|
|
8
|
+
`agentsam-codebaseindex` teaches you how to inventory, scope, index, search,
|
|
9
|
+
and migrate code/document knowledge with AgentSam.
|
|
10
|
+
|
|
11
|
+
CodebaseIndex is designed to work **locally first**.
|
|
12
|
+
|
|
13
|
+
You do NOT need an AgentSam account, a paid LLM, a cloud database, embeddings,
|
|
14
|
+
Supabase, or Cloudflare to build a useful codebase index.
|
|
15
|
+
|
|
16
|
+
Minimum useful setup:
|
|
17
|
+
|
|
18
|
+
```text
|
|
19
|
+
repository/files → deterministic inventory → AST + text index → local SQLite
|
|
20
|
+
→ literal / structural retrieval
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
Embeddings, hosted storage, and model-assisted scope suggestions are upgrades,
|
|
24
|
+
not prerequisites.
|
|
25
|
+
|
|
26
|
+
---
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
agentsam codebaseindex
|
|
32
|
+
# alias: agentsam ingest
|
|
33
|
+
# tip: use skill agentsam-codebaseindex
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Guided flow (inventory-first):
|
|
37
|
+
|
|
38
|
+
1. Connection
|
|
39
|
+
2. Materials
|
|
40
|
+
3. Inventory / file map
|
|
41
|
+
4. Scope
|
|
42
|
+
5. Embedding profile
|
|
43
|
+
6. Vector / data source lane
|
|
44
|
+
7. Execution
|
|
45
|
+
|
|
46
|
+
AgentSam shows what exists before asking what should be indexed.
|
|
47
|
+
|
|
48
|
+
---
|
|
49
|
+
|
|
50
|
+
## Important: "pipeline" is not a shell command
|
|
51
|
+
|
|
52
|
+
You may see:
|
|
53
|
+
|
|
54
|
+
```text
|
|
55
|
+
Plan complete · pipeline id sam.codebaseindex.index.run
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Do **not** type:
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
pipeline sam.codebaseindex.index.run
|
|
62
|
+
sam.codebaseindex.index.run
|
|
63
|
+
agentsam sam.codebaseindex.index.run
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
`sam.codebaseindex.index.run` is the **canonical SAM pipeline identifier** —
|
|
67
|
+
receipts, job graphs, telemetry, Workbench, machine-to-machine metadata.
|
|
68
|
+
|
|
69
|
+
| Layer | Identity |
|
|
70
|
+
|-------|----------|
|
|
71
|
+
| CLI | `agentsam codebaseindex` |
|
|
72
|
+
| SAM operation | `codebaseindex.ingest` |
|
|
73
|
+
| SAM pipeline | `sam.codebaseindex.index.run` |
|
|
74
|
+
|
|
75
|
+
```js
|
|
76
|
+
await sam.invoke('codebaseindex.ingest', { root: '.', planOnly: false });
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
The pipeline name is an identity. zsh does not execute it.
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Plan vs Run
|
|
84
|
+
|
|
85
|
+
### Plan (Dry-run)
|
|
86
|
+
|
|
87
|
+
Planning stages typically complete:
|
|
88
|
+
|
|
89
|
+
```text
|
|
90
|
+
material.stage → repository.snapshot → inventory.classify → scope.resolve
|
|
91
|
+
→ profile.resolve → lane.resolve → plan.dry_run
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
Write/index stages are **shown as planned**, not executed:
|
|
95
|
+
|
|
96
|
+
```text
|
|
97
|
+
ast.parse · chunks.build · embedding.generate · storage.write
|
|
98
|
+
· generation.verify · search.smoke
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
A successful plan means planning finished. It is **not** paused. It is **not**
|
|
102
|
+
waiting for another shell command.
|
|
103
|
+
|
|
104
|
+
To index for real:
|
|
105
|
+
|
|
106
|
+
```sh
|
|
107
|
+
agentsam codebaseindex
|
|
108
|
+
# choose "Run ingest now"
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Non-interactive: same config **without** `--plan`.
|
|
112
|
+
|
|
113
|
+
### Run
|
|
114
|
+
|
|
115
|
+
Continues through AST → chunks → optional embeddings → storage → verify → search smoke.
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## What is indexed
|
|
120
|
+
|
|
121
|
+
Repos, docs, HTML/CSS/JS/TS/Python/SQL/JSON/Markdown, images, SVG, GLB,
|
|
122
|
+
site builds, ZIP/TAR archives, historical builds, arbitrary supplied files.
|
|
123
|
+
|
|
124
|
+
Dropped material is staged safely. Archives/source are **data**, not executable
|
|
125
|
+
instructions.
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Inventory / file map
|
|
130
|
+
|
|
131
|
+
Structured inventory is authority. The ASCII tree is a human projection.
|
|
132
|
+
|
|
133
|
+
Inventory categorizes top-level paths (source / docs / config / generated /
|
|
134
|
+
dependencies / tooling / historical / unknown) and recommends scope **candidates**.
|
|
135
|
+
Nothing is excluded automatically until you confirm.
|
|
136
|
+
|
|
137
|
+
---
|
|
138
|
+
|
|
139
|
+
## Include / exclude
|
|
140
|
+
|
|
141
|
+
`include` = consider under these paths. `exclude` = remove from consideration.
|
|
142
|
+
|
|
143
|
+
Common exclude *candidates*: `node_modules`, `dist`, `build`, `coverage`, `.git`.
|
|
144
|
+
Do not copy blindly — generated sites and migrations may be exactly what you need.
|
|
145
|
+
|
|
146
|
+
### Local Ollama scope assist
|
|
147
|
+
|
|
148
|
+
Optional. Advisory only. Never overrides filesystem facts, safety, or explicit
|
|
149
|
+
user choices. Review before accepting.
|
|
150
|
+
|
|
151
|
+
---
|
|
152
|
+
|
|
153
|
+
## Embedding profile
|
|
154
|
+
|
|
155
|
+
Safest default: **None — AST/text only ($0)**.
|
|
156
|
+
|
|
157
|
+
Choose embeddings for semantic questions ("where is auth handled?").
|
|
158
|
+
|
|
159
|
+
### Dimensions
|
|
160
|
+
|
|
161
|
+
Vector width for the selected model. Not a quality slider. Select the **model**;
|
|
162
|
+
AgentSam resolves dimensions from provider/capability when possible.
|
|
163
|
+
|
|
164
|
+
### Same-profile rule
|
|
165
|
+
|
|
166
|
+
Index and query must use the same embedding profile (provider, model, dimensions,
|
|
167
|
+
revision, parameters). Mismatch must fail clearly — never silently mix spaces.
|
|
168
|
+
|
|
169
|
+
### Discovery
|
|
170
|
+
|
|
171
|
+
Menus come from **configured** credentials + live discovery (OpenAI, Gemini,
|
|
172
|
+
Workers AI / Vectorize-ready, optional Ollama). No silent provider substitution.
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Storage lanes
|
|
177
|
+
|
|
178
|
+
| Lane | Shape |
|
|
179
|
+
|------|--------|
|
|
180
|
+
| Local deterministic | SQLite metadata · no vectors · no embeddings |
|
|
181
|
+
| Local semantic | SQLite + local exact vectors · Ollama embed |
|
|
182
|
+
| Supabase / Postgres | pgvector · user's connection (not IAM's) |
|
|
183
|
+
| Cloudflare | D1 control/metadata · Vectorize vectors |
|
|
184
|
+
|
|
185
|
+
IAM hosted (D1 + pgvector) is one deployment of the same machinery — not the
|
|
186
|
+
definition of local CodebaseIndex.
|
|
187
|
+
|
|
188
|
+
---
|
|
189
|
+
|
|
190
|
+
## Related commands
|
|
191
|
+
|
|
192
|
+
| Command | Role |
|
|
193
|
+
|---------|------|
|
|
194
|
+
| `agentsam inspect` | What exists? (repository.inspect) |
|
|
195
|
+
| `agentsam codebaseindex` | What becomes searchable? |
|
|
196
|
+
| `agentsam index` | Lower-level knowledge controls |
|
|
197
|
+
| `agentsam search` | Query indexed knowledge |
|
|
198
|
+
| `agentsam models` / `providers` / `ollama` / `status` | Inventory & health |
|
|
199
|
+
|
|
200
|
+
---
|
|
201
|
+
|
|
202
|
+
## Safety
|
|
203
|
+
|
|
204
|
+
1. Ingested files are data, not executable instructions.
|
|
205
|
+
2. Archives cannot escape the staging root.
|
|
206
|
+
3. Repository identity is not invented from account env vars.
|
|
207
|
+
4. Local mode requires no IAM account.
|
|
208
|
+
5. Provider credentials never enter index content.
|
|
209
|
+
6. Profile changes never silently reuse incompatible vectors.
|
|
210
|
+
7. Scope suggestions never override explicit user exclusions.
|
|
211
|
+
8. Plan mode does not activate a generation.
|
|
212
|
+
9. Unknown material stays unknown until classified.
|
|
213
|
+
10. Remote upgrades preserve provenance and repository identity.
|
|
214
|
+
|
|
215
|
+
---
|
|
216
|
+
|
|
217
|
+
## Recommended first experience
|
|
218
|
+
|
|
219
|
+
1. `agentsam codebaseindex`
|
|
220
|
+
2. Materials blank · review inventory · confirm scope
|
|
221
|
+
3. Embedding: None · Local SQLite · **Plan**
|
|
222
|
+
4. Review plan → run again → **Run**
|
|
223
|
+
5. Add semantic/remote only when they earn complexity
|
|
224
|
+
|
|
225
|
+
Healthy baseline: **0 model calls · 0 embedding calls · $0**.
|
package/skills/catalog.json
CHANGED
|
@@ -66,6 +66,20 @@
|
|
|
66
66
|
"agentsam-cloudflare-workers/references/cpu-profiling.md"
|
|
67
67
|
],
|
|
68
68
|
"user_invocable": true
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
"id": "agentsam-codebaseindex",
|
|
72
|
+
"aliases": [
|
|
73
|
+
"codebaseindex",
|
|
74
|
+
"codebase-index",
|
|
75
|
+
"ingest",
|
|
76
|
+
"sam.codebaseindex"
|
|
77
|
+
],
|
|
78
|
+
"title": "AgentSam Codebaseindex",
|
|
79
|
+
"description": "Inventory-first codebase ingest. Pipeline IDs are not shell commands — use agentsam codebaseindex / codebaseindex.ingest.",
|
|
80
|
+
"entry": "agentsam-codebaseindex/SKILL.md",
|
|
81
|
+
"references": [],
|
|
82
|
+
"user_invocable": true
|
|
69
83
|
}
|
|
70
84
|
]
|
|
71
85
|
}
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI command catalog — machine-readable authority for help, assist tips, and dispatch hints.
|
|
3
|
+
* Alias ≠ authority: skill tips and SAM operation ids live here so help is not a prose-only dump.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
/** @typedef {{ id: string, aliases?: string[], summary: string, topic: string, skill?: string, operation?: string, common?: boolean }} CliCommandEntry */
|
|
7
|
+
|
|
8
|
+
/** @type {CliCommandEntry[]} */
|
|
9
|
+
export const CLI_COMMAND_CATALOG = Object.freeze([
|
|
10
|
+
{ id: 'help', aliases: ['-h', '--help'], summary: 'Interactive or topic help from this catalog', topic: 'start', skill: 'agentsam-app-fundamentals', common: true },
|
|
11
|
+
{ id: 'create', summary: 'Scaffold a new AgentSam project from a preset', topic: 'create', skill: 'agentsam-app-fundamentals', common: false },
|
|
12
|
+
{ id: 'add', summary: 'Add an explicit feature/capability selection', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
13
|
+
{ id: 'plugins', summary: 'Install and manage AgentSam plugins', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
14
|
+
{ id: 'dev', summary: 'Run this project’s npm dev script', topic: 'work', skill: 'agentsam-app-fundamentals' },
|
|
15
|
+
{ id: 'inspect', summary: 'Bounded repository inspect / authority view', topic: 'work', skill: 'agentsam-app-fundamentals', operation: 'repository.inspect', common: true },
|
|
16
|
+
{ id: 'capabilities', summary: 'Inspect capability contracts', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
17
|
+
{ id: 'skills', aliases: ['skill'], summary: 'List or load portable skill instructions', topic: 'create', skill: 'agentsam-app-fundamentals', common: true },
|
|
18
|
+
{ id: 'context', summary: 'Git + bridge context from any repo', topic: 'work', skill: 'agentsam-app-fundamentals' },
|
|
19
|
+
{ id: 'status', summary: 'Account, models, terminal, and live deploy awareness', topic: 'runtime', skill: 'agentsam-progression-guard', common: true },
|
|
20
|
+
{ id: 'db', summary: 'Project-local SQLite status/init', topic: 'runtime', skill: 'agentsam-app-fundamentals' },
|
|
21
|
+
{ id: 'models', summary: 'Probe hosted/local model availability', topic: 'start', skill: 'agentsam-app-fundamentals', common: true },
|
|
22
|
+
{ id: 'providers', summary: 'Configure machine provider credentials', topic: 'start', skill: 'agentsam-app-fundamentals' },
|
|
23
|
+
{ id: 'env', summary: 'Provider profile / shell loader helpers', topic: 'start', skill: 'agentsam-app-fundamentals' },
|
|
24
|
+
{ id: 'api-key', aliases: ['apikey', 'api-keys'], summary: 'Create/list/rotate AgentSam API keys (aak_*)', topic: 'start', skill: 'agentsam-app-fundamentals', common: true },
|
|
25
|
+
{ id: 'login', summary: 'Sign in and persist machine-local session', topic: 'start', skill: 'agentsam-app-fundamentals' },
|
|
26
|
+
{ id: 'logout', summary: 'Sign out locally', topic: 'start', skill: 'agentsam-app-fundamentals' },
|
|
27
|
+
{ id: 'whoami', summary: 'Authenticated account + tokenPermissions', topic: 'start', skill: 'agentsam-app-fundamentals', common: true },
|
|
28
|
+
{ id: 'resume', summary: 'Resume a saved AgentSam session', topic: 'start', skill: 'agentsam-app-fundamentals' },
|
|
29
|
+
{ id: 'shell', summary: 'Interactive slash-command shell', topic: 'inside', skill: 'agentsam-app-fundamentals' },
|
|
30
|
+
{ id: 'start-local', summary: 'Local PTY WebSocket service', topic: 'runtime', skill: 'agentsam-app-fundamentals' },
|
|
31
|
+
{ id: 'ollama', summary: 'Local Ollama setup/status/models', topic: 'runtime', skill: 'agentsam-app-fundamentals' },
|
|
32
|
+
{ id: 'tunnel', summary: 'Cloudflare Tunnel via Wrangler', topic: 'runtime', skill: 'agentsam-cloudflare-workers' },
|
|
33
|
+
{ id: 'connections', aliases: ['connection'], summary: 'Inspect execution connections', topic: 'runtime', skill: 'agentsam-cloudflare-workers' },
|
|
34
|
+
{ id: 'deploy', summary: 'Graduate intentionally to cloud', topic: 'runtime', skill: 'agentsam-progression-guard', common: true },
|
|
35
|
+
{ id: 'deploy-receipt', summary: 'Merkle deploy/checkpoint receipts', topic: 'runtime', skill: 'agentsam-progression-guard' },
|
|
36
|
+
{ id: 'cloudflare', aliases: ['cf'], summary: 'Wrangler reads + Worker CPU profiles', topic: 'runtime', skill: 'agentsam-cloudflare-workers' },
|
|
37
|
+
{ id: 'go', summary: 'Go product discover/build/deploy', topic: 'runtime', skill: 'agentsam-cloudflare-workers' },
|
|
38
|
+
{ id: 'mcp', summary: 'MCP server catalog and client adapters', topic: 'runtime', skill: 'agentsam-cloudflare-workers' },
|
|
39
|
+
{ id: 'eval', summary: 'Context fixtures and live eval telemetry', topic: 'runtime', skill: 'agentsam-app-fundamentals' },
|
|
40
|
+
{ id: 'index', summary: 'Plan/run incremental AST (+ optional embeddings)', topic: 'work', skill: 'agentsam-codebaseindex', operation: 'codebaseindex.ingest' },
|
|
41
|
+
{ id: 'search', summary: 'Retrieve indexed code/text', topic: 'work', skill: 'agentsam-codebaseindex' },
|
|
42
|
+
{ id: 'repo', summary: 'Repository snapshot / observations', topic: 'work', skill: 'agentsam-app-fundamentals', operation: 'repository.inspect' },
|
|
43
|
+
{ id: 'init', summary: 'Knowledge setup or local scaffold', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
44
|
+
{ id: 'codebaseindex', aliases: ['ingest', 'codebase-index'], summary: 'Guided codebase ingest: materials, allowlist, embeddings, storage', topic: 'work', skill: 'agentsam-codebaseindex', operation: 'codebaseindex.ingest', common: true },
|
|
45
|
+
{ id: 'brand', summary: 'Deterministic brand intelligence', topic: 'work', skill: 'agentsam-app-fundamentals', operation: 'brand.scan' },
|
|
46
|
+
{ id: 'plan', summary: 'Composable plans (e.g. brand)', topic: 'work', skill: 'agentsam-app-fundamentals' },
|
|
47
|
+
{ id: 'security', aliases: ['sca'], summary: 'Dependency + trust-boundary scan', topic: 'work', skill: 'agentsam-progression-guard', operation: 'security.scan', common: true },
|
|
48
|
+
{ id: 'merkle', summary: 'File integrity snapshots and explorer', topic: 'work', skill: 'agentsam-app-fundamentals' },
|
|
49
|
+
{ id: 'cad', summary: 'Blender/OpenSCAD/FreeCAD CAD tools', topic: 'work', skill: 'agentsam-app-fundamentals', operation: 'cad.blender.inspect' },
|
|
50
|
+
{ id: 'dockerize', summary: 'Build/run supported containers', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
51
|
+
{ id: 'mini', summary: 'Create a small local gadget', topic: 'create', skill: 'agentsam-jr-dev' },
|
|
52
|
+
{ id: 'recon', summary: 'Bounded-worker packets + finding reports', topic: 'work', skill: 'agentsam-app-fundamentals' },
|
|
53
|
+
{ id: 'autorag', summary: 'AutoRAG configure/probe helpers', topic: 'work', skill: 'agentsam-codebaseindex' },
|
|
54
|
+
{ id: 'identity', summary: 'Identity portal, providers, protocol surfaces', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
55
|
+
{ id: 'scaffold', summary: 'Generate CMS or worker-api starter', topic: 'create', skill: 'agentsam-jr-dev' },
|
|
56
|
+
{ id: 'goap', summary: 'GOAP blackboard status/plan', topic: 'inside', skill: 'agentsam-app-fundamentals' },
|
|
57
|
+
{ id: 'app', aliases: ['apps'], summary: 'Bundled AgentSam apps launcher', topic: 'create', skill: 'agentsam-app-fundamentals' },
|
|
58
|
+
]);
|
|
59
|
+
|
|
60
|
+
const byId = new Map();
|
|
61
|
+
for (const entry of CLI_COMMAND_CATALOG) {
|
|
62
|
+
byId.set(entry.id, entry);
|
|
63
|
+
for (const alias of entry.aliases || []) byId.set(alias, entry);
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
/**
|
|
67
|
+
* @param {string} name
|
|
68
|
+
* @returns {CliCommandEntry|null}
|
|
69
|
+
*/
|
|
70
|
+
export function getCliCommand(name) {
|
|
71
|
+
const key = String(name || '').trim().toLowerCase();
|
|
72
|
+
if (!key) return null;
|
|
73
|
+
return byId.get(key) || null;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
export function listCliCommands(options = {}) {
|
|
77
|
+
let rows = [...CLI_COMMAND_CATALOG];
|
|
78
|
+
if (options.topic) rows = rows.filter((r) => r.topic === options.topic);
|
|
79
|
+
if (options.common) rows = rows.filter((r) => r.common);
|
|
80
|
+
return rows;
|
|
81
|
+
}
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* Machine baseline: every command surfaces how to load its skill from inside the CLI.
|
|
85
|
+
* @param {CliCommandEntry|string} entryOrId
|
|
86
|
+
* @param {{ write?: (s: string) => void, quiet?: boolean }} [options]
|
|
87
|
+
*/
|
|
88
|
+
export function printAssistTip(entryOrId, options = {}) {
|
|
89
|
+
if (options.quiet) return;
|
|
90
|
+
// Never contaminate machine JSON streams.
|
|
91
|
+
if (options.json || process.argv.includes('--json') || process.argv.includes('--format=json')) return;
|
|
92
|
+
const entry = typeof entryOrId === 'string' ? getCliCommand(entryOrId) : entryOrId;
|
|
93
|
+
if (!entry?.skill) return;
|
|
94
|
+
const write = options.write || ((s) => process.stderr.write(s));
|
|
95
|
+
const op = entry.operation ? ` · sam.invoke("${entry.operation}")` : '';
|
|
96
|
+
write(` tip: use skill ${entry.skill} (agentsam skills ${entry.skill})${op}\n`);
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
/**
|
|
100
|
+
* Suggest close command ids for unknown input.
|
|
101
|
+
* @param {string} name
|
|
102
|
+
* @param {number} [limit]
|
|
103
|
+
*/
|
|
104
|
+
export function suggestCliCommands(name, limit = 5) {
|
|
105
|
+
const q = String(name || '').toLowerCase();
|
|
106
|
+
if (!q) return listCliCommands({ common: true }).slice(0, limit);
|
|
107
|
+
return CLI_COMMAND_CATALOG
|
|
108
|
+
.map((entry) => {
|
|
109
|
+
const hay = [entry.id, ...(entry.aliases || []), entry.summary].join(' ').toLowerCase();
|
|
110
|
+
let score = 0;
|
|
111
|
+
if (entry.id.startsWith(q) || (entry.aliases || []).some((a) => a.startsWith(q))) score += 3;
|
|
112
|
+
if (hay.includes(q)) score += 1;
|
|
113
|
+
for (const t of q.split(/[^a-z0-9]+/).filter(Boolean)) {
|
|
114
|
+
if (hay.includes(t)) score += 1;
|
|
115
|
+
}
|
|
116
|
+
return { entry, score };
|
|
117
|
+
})
|
|
118
|
+
.filter((x) => x.score > 0)
|
|
119
|
+
.sort((a, b) => b.score - a.score || a.entry.id.localeCompare(b.entry.id))
|
|
120
|
+
.slice(0, limit)
|
|
121
|
+
.map((x) => x.entry);
|
|
122
|
+
}
|
|
123
|
+
|
|
124
|
+
export const CLI_HELP_TOPICS = Object.freeze([
|
|
125
|
+
{ id: 'start', label: 'Start / resume', summary: 'Enter AgentSam, resume work, identity, models.' },
|
|
126
|
+
{ id: 'work', label: 'Build / inspect', summary: 'Repository intelligence, ingest, security, brand.' },
|
|
127
|
+
{ id: 'runtime', label: 'Runtime / terminal', summary: 'Local, remote, sandbox, and deployment controls.' },
|
|
128
|
+
{ id: 'inside', label: 'Inside AgentSam', summary: 'Shell and GOAP surfaces.' },
|
|
129
|
+
{ id: 'create', label: 'Create / extend', summary: 'Scaffold, add capabilities, identity, skills.' },
|
|
130
|
+
]);
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Catalog-backed dispatch bootstrap.
|
|
3
|
+
* Full cli.js cutover is incremental — this module is the target authority for handlers.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { getCliCommand, printAssistTip, suggestCliCommands } from './command-catalog.js';
|
|
7
|
+
|
|
8
|
+
/** @type {Record<string, () => Promise<(argv: string[]) => unknown>>} */
|
|
9
|
+
const HANDLERS = {
|
|
10
|
+
codebaseindex: async () => (await import('../commands/codebaseindex.js')).runCodebaseindex,
|
|
11
|
+
ingest: async () => (await import('../commands/codebaseindex.js')).runCodebaseindex,
|
|
12
|
+
'codebase-index': async () => (await import('../commands/codebaseindex.js')).runCodebaseindex,
|
|
13
|
+
skill: async () => (await import('../commands/skill.js')).runSkill,
|
|
14
|
+
skills: async () => (await import('../commands/skills.js')).runSkills,
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @param {string} command
|
|
19
|
+
* @param {string[]} rest
|
|
20
|
+
* @param {{ reportError?: (e: Error) => void }} [ctx]
|
|
21
|
+
*/
|
|
22
|
+
export async function dispatchCatalogCommand(command, rest = [], ctx = {}) {
|
|
23
|
+
const entry = getCliCommand(command);
|
|
24
|
+
if (!entry) {
|
|
25
|
+
const suggestions = suggestCliCommands(command);
|
|
26
|
+
const err = new Error(`Unknown command: ${command}`);
|
|
27
|
+
err.code = 'AGENTSAM_UNKNOWN_COMMAND';
|
|
28
|
+
err.suggestions = suggestions;
|
|
29
|
+
throw err;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
printAssistTip(entry, { json: rest.includes('--json') });
|
|
33
|
+
|
|
34
|
+
const loader = HANDLERS[entry.id] || HANDLERS[command];
|
|
35
|
+
if (!loader) {
|
|
36
|
+
const err = new Error(`Catalog entry "${entry.id}" is not yet wired to a lazy handler (legacy cli.js path).`);
|
|
37
|
+
err.code = 'AGENTSAM_HANDLER_NOT_MIGRATED';
|
|
38
|
+
err.entry = entry;
|
|
39
|
+
throw err;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
const run = await loader();
|
|
43
|
+
return run(rest);
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
export function listDispatchableCommands() {
|
|
47
|
+
return Object.keys(HANDLERS);
|
|
48
|
+
}
|
package/src/cli.js
CHANGED
|
@@ -34,11 +34,13 @@ import { runSecurity } from './commands/security.js';
|
|
|
34
34
|
import { runRecon } from './commands/recon.js';
|
|
35
35
|
import { runCad } from './commands/cad.js';
|
|
36
36
|
import { runSkills } from './commands/skills.js';
|
|
37
|
+
import { runSkill } from './commands/skill.js';
|
|
37
38
|
import { runEval } from './commands/eval.js';
|
|
38
39
|
import { runMcp } from './commands/mcp.js';
|
|
39
40
|
import { runCloudflare } from './commands/cloudflare.js';
|
|
40
41
|
import { runGo } from './commands/go.js';
|
|
41
42
|
import { runWhoami } from './commands/whoami.js';
|
|
43
|
+
import { runApiKey } from './commands/api-key.js';
|
|
42
44
|
import { runResume } from './commands/resume.js';
|
|
43
45
|
import { runLogin, runLogout } from './commands/account-auth.js';
|
|
44
46
|
import { runPlugins } from './commands/plugins.js';
|
|
@@ -50,6 +52,7 @@ import { resolveAccountAuth } from './lib/account-session.js';
|
|
|
50
52
|
import { renderDiagnosticError } from './errors/index.js';
|
|
51
53
|
import { renderHelpOverview, runHelp } from './ui/cli/help.js';
|
|
52
54
|
import { hydrateSecureCredentials } from './security/local-vault.js';
|
|
55
|
+
import { getCliCommand, printAssistTip, suggestCliCommands } from './cli/command-catalog.js';
|
|
53
56
|
|
|
54
57
|
const VERSION = pkg.version;
|
|
55
58
|
|
|
@@ -81,12 +84,14 @@ function printLegacyHelp() {
|
|
|
81
84
|
|
|
82
85
|
Capability discovery:
|
|
83
86
|
agentsam capabilities [capability-id] [--json]
|
|
87
|
+
agentsam skill list|create|inspect|install|alias|remove|invoke
|
|
84
88
|
agentsam skills [skill-id-or-alias] [--references] [--json]
|
|
85
89
|
|
|
86
90
|
Power-user UX:
|
|
87
91
|
agentsam context [--json] Git repo/revision + bridge configuration from any repo
|
|
88
92
|
agentsam init Configure knowledge in this repo; --name scaffolds a new project
|
|
89
93
|
agentsam index Plan/run incremental AST and optional embeddings (--help)
|
|
94
|
+
agentsam codebaseindex Guided ingest: materials/allowlist/embeddings/storage (alias: ingest)
|
|
90
95
|
agentsam search "query" Retrieve indexed code/text; --semantic enables embeddings
|
|
91
96
|
agentsam repo snapshot Git composition/churn; --save retains observations
|
|
92
97
|
agentsam cad blender Programmatic Blender inspect/build/render/export (--help)
|
|
@@ -317,6 +322,11 @@ const rest = process.argv.slice(3);
|
|
|
317
322
|
|
|
318
323
|
hydrateSecureCredentials(process.env);
|
|
319
324
|
|
|
325
|
+
const catalogEntry = command && !command.startsWith('-') ? getCliCommand(command) : null;
|
|
326
|
+
if (catalogEntry && command !== 'help') {
|
|
327
|
+
printAssistTip(catalogEntry);
|
|
328
|
+
}
|
|
329
|
+
|
|
320
330
|
if (command === '--version' || command === '-v') {
|
|
321
331
|
console.log(VERSION);
|
|
322
332
|
} else if (command === 'help') {
|
|
@@ -463,6 +473,13 @@ if (command === '--version' || command === '-v') {
|
|
|
463
473
|
reportCliError(e);
|
|
464
474
|
process.exitCode = 1;
|
|
465
475
|
}
|
|
476
|
+
} else if (command === 'api-key' || command === 'apikey' || command === 'api-keys') {
|
|
477
|
+
try {
|
|
478
|
+
await runApiKey(rest);
|
|
479
|
+
} catch (e) {
|
|
480
|
+
reportCliError(e);
|
|
481
|
+
process.exitCode = 1;
|
|
482
|
+
}
|
|
466
483
|
} else if (command === 'resume') {
|
|
467
484
|
try {
|
|
468
485
|
await runResume(rest);
|
|
@@ -547,13 +564,20 @@ if (command === '--version' || command === '-v') {
|
|
|
547
564
|
}
|
|
548
565
|
} else if (command === 'security' || command === 'sca') {
|
|
549
566
|
await runSecurity(rest);
|
|
550
|
-
} else if (command === 'skills'
|
|
567
|
+
} else if (command === 'skills') {
|
|
551
568
|
try {
|
|
552
569
|
runSkills(rest);
|
|
553
570
|
} catch (e) {
|
|
554
571
|
reportCliError(e);
|
|
555
572
|
process.exitCode = 1;
|
|
556
573
|
}
|
|
574
|
+
} else if (command === 'skill') {
|
|
575
|
+
try {
|
|
576
|
+
await runSkill(rest);
|
|
577
|
+
} catch (e) {
|
|
578
|
+
reportCliError(e);
|
|
579
|
+
process.exitCode = 1;
|
|
580
|
+
}
|
|
557
581
|
} else if (command === 'merkle') {
|
|
558
582
|
await runMerkle(rest);
|
|
559
583
|
} else if (command === 'deploy-receipt') {
|
|
@@ -570,6 +594,15 @@ if (command === '--version' || command === '-v') {
|
|
|
570
594
|
} else if (command === 'autorag') {
|
|
571
595
|
try { await (await import('./commands/autorag.js')).runAutoRag(rest); }
|
|
572
596
|
catch (e) { reportCliError(e); process.exitCode = 1; }
|
|
597
|
+
} else if (command === 'codebaseindex' || command === 'ingest' || command === 'codebase-index') {
|
|
598
|
+
try {
|
|
599
|
+
await (await import('./commands/codebaseindex.js')).runCodebaseindex(rest);
|
|
600
|
+
} catch (e) {
|
|
601
|
+
if (e?.code !== 'AGENTSAM_CODEBASEINDEX_CANCELLED') {
|
|
602
|
+
reportCliError(e);
|
|
603
|
+
process.exitCode = 1;
|
|
604
|
+
}
|
|
605
|
+
}
|
|
573
606
|
} else if (['index', 'search', 'repo'].includes(command)) {
|
|
574
607
|
try {
|
|
575
608
|
const commands = await import('./commands/knowledge.js');
|
|
@@ -642,6 +675,15 @@ if (command === '--version' || command === '-v') {
|
|
|
642
675
|
}
|
|
643
676
|
} else {
|
|
644
677
|
console.error(`\n Unknown command: ${command}\n`);
|
|
678
|
+
const suggestions = suggestCliCommands(command);
|
|
679
|
+
if (suggestions.length) {
|
|
680
|
+
console.error(' Did you mean:');
|
|
681
|
+
for (const row of suggestions) {
|
|
682
|
+
console.error(` agentsam ${row.id} — ${row.summary}`);
|
|
683
|
+
if (row.skill) console.error(` tip: use skill ${row.skill}`);
|
|
684
|
+
}
|
|
685
|
+
console.error('');
|
|
686
|
+
}
|
|
645
687
|
printHelp();
|
|
646
688
|
process.exit(1);
|
|
647
689
|
}
|