@aiwg/cli 2026.10.15 → 2026.10.18

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.
Files changed (286) hide show
  1. package/agentic/code/providers/pi/aiwg-bridge.ts +45 -7
  2. package/dist/src/artifacts/citation-parser.js +7 -6
  3. package/dist/src/artifacts/corpus-tools/citation-densify.js +4 -2
  4. package/dist/src/artifacts/corpus-tools/cli.js +8 -3
  5. package/dist/src/artifacts/corpus-tools/discovery-log.js +26 -24
  6. package/dist/src/artifacts/corpus-tools/expand-cli.js +3 -2
  7. package/dist/src/artifacts/corpus-tools/expand-dates.js +107 -0
  8. package/dist/src/artifacts/corpus-tools/expand-queue.js +4 -1
  9. package/dist/src/artifacts/corpus-tools/expand-review.js +104 -0
  10. package/dist/src/artifacts/corpus-tools/expand-state.js +17 -1
  11. package/dist/src/artifacts/corpus-tools/expand.js +16 -17
  12. package/dist/src/artifacts/corpus-tools/induction-audit.js +7 -6
  13. package/dist/src/artifacts/corpus-tools/integrity-scan.js +3 -3
  14. package/dist/src/artifacts/corpus-tools/radar-shared.js +7 -9
  15. package/dist/src/artifacts/corpus-tools/ref-files.js +11 -0
  16. package/dist/src/artifacts/corpus-tools/resolve-cli.js +11 -3
  17. package/dist/src/artifacts/corpus-tools/resolve.js +42 -11
  18. package/dist/src/artifacts/corpus-tools/retrieval-lab.js +2 -1
  19. package/dist/src/artifacts/corpus-tools/sidecar-lint.js +4 -4
  20. package/dist/src/artifacts/corpus-tools/sidecar-repair.js +2 -1
  21. package/dist/src/artifacts/corpus-views/ref-parser.js +3 -17
  22. package/dist/src/artifacts/graph-query.js +5 -3
  23. package/dist/src/artifacts/hybrid-query.js +11 -2
  24. package/dist/src/artifacts/index-refresh.js +2 -0
  25. package/dist/src/artifacts/query-engine-corpus.js +217 -0
  26. package/dist/src/artifacts/query-engine-discover-output.js +229 -0
  27. package/dist/src/artifacts/query-engine-discover.js +285 -0
  28. package/dist/src/artifacts/query-engine-entries.js +188 -0
  29. package/dist/src/artifacts/query-engine-index.js +249 -0
  30. package/dist/src/artifacts/query-engine-matching.js +143 -0
  31. package/dist/src/artifacts/query-engine-options.js +2 -0
  32. package/dist/src/artifacts/query-engine-rules.js +202 -0
  33. package/dist/src/artifacts/query-engine-scoring.js +436 -0
  34. package/dist/src/artifacts/query-engine-show-card.js +194 -0
  35. package/dist/src/artifacts/query-engine-show-load.js +211 -0
  36. package/dist/src/artifacts/query-engine-show.js +300 -0
  37. package/dist/src/artifacts/query-engine.js +7 -2576
  38. package/dist/src/cli/handlers/daemon.js +17 -1
  39. package/dist/src/cli/handlers/doctor-args.js +10 -5
  40. package/dist/src/cli/handlers/doctor-help.js +4 -1
  41. package/dist/src/cli/handlers/index.js +2 -2
  42. package/dist/src/cli/handlers/mc-agents.js +111 -0
  43. package/dist/src/cli/handlers/mc-args.js +54 -0
  44. package/dist/src/cli/handlers/mc-control.js +227 -0
  45. package/dist/src/cli/handlers/mc-dispatch.js +203 -0
  46. package/dist/src/cli/handlers/mc-help.js +171 -0
  47. package/dist/src/cli/handlers/mc-run.js +343 -0
  48. package/dist/src/cli/handlers/mc-session.js +138 -0
  49. package/dist/src/cli/handlers/mc-status.js +258 -0
  50. package/dist/src/cli/handlers/mc-summary.js +43 -0
  51. package/dist/src/cli/handlers/mc-types.js +3 -0
  52. package/dist/src/cli/handlers/mc-worker.js +205 -0
  53. package/dist/src/cli/handlers/mc.js +12 -1665
  54. package/dist/src/cli/handlers/models-refusal.js +13 -0
  55. package/dist/src/cli/handlers/models-resource-sample.js +10 -0
  56. package/dist/src/cli/handlers/models.js +5 -3
  57. package/dist/src/cli/handlers/regenerate.js +8 -16
  58. package/dist/src/cli/handlers/remove-bundled.js +133 -0
  59. package/dist/src/cli/handlers/remove-options.js +31 -0
  60. package/dist/src/cli/handlers/remove-user.js +174 -0
  61. package/dist/src/cli/handlers/remove.js +201 -0
  62. package/dist/src/cli/handlers/sessions.js +7 -7
  63. package/dist/src/cli/handlers/subcommands-bundles.js +257 -0
  64. package/dist/src/cli/handlers/subcommands-discovery.js +165 -0
  65. package/dist/src/cli/handlers/subcommands-list-format.js +129 -0
  66. package/dist/src/cli/handlers/subcommands-list.js +250 -0
  67. package/dist/src/cli/handlers/subcommands-plugins.js +213 -0
  68. package/dist/src/cli/handlers/subcommands-quickref.js +58 -0
  69. package/dist/src/cli/handlers/subcommands-rlm.js +113 -0
  70. package/dist/src/cli/handlers/subcommands-services.js +66 -0
  71. package/dist/src/cli/handlers/subcommands-storage.js +259 -0
  72. package/dist/src/cli/handlers/subcommands.js +18 -1976
  73. package/dist/src/cli/handlers/update.js +157 -0
  74. package/dist/src/cli/handlers/use.js +14 -4
  75. package/dist/src/cli/handlers/utilities.js +3 -560
  76. package/dist/src/cli/handlers/utility-doctor.js +412 -0
  77. package/dist/src/cli/scope-resolver.js +1 -142
  78. package/dist/src/cli/services/deployment-verification.js +0 -1
  79. package/dist/src/cli/user-scope-mirror.js +173 -0
  80. package/dist/src/config/aiwg-config.js +2 -1
  81. package/dist/src/config/authorization-cli.js +7 -3
  82. package/dist/src/config/dispatch-host-thresholds.js +2 -0
  83. package/dist/src/config/dispatch-thresholds-runtime.d.mts +3 -2
  84. package/dist/src/config/dispatch-thresholds-runtime.mjs +21 -7
  85. package/dist/src/config/framework-aliases.js +12 -0
  86. package/dist/src/config/host-resource-report.d.mts +24 -0
  87. package/dist/src/config/host-resource-report.mjs +110 -0
  88. package/dist/src/config/host-resource-runtime.d.mts +37 -0
  89. package/dist/src/config/host-resource-runtime.mjs +296 -0
  90. package/dist/src/config/installed-selection.js +22 -0
  91. package/dist/src/config/worker-invocation-marker.d.mts +1 -0
  92. package/dist/src/config/worker-invocation-marker.mjs +2 -0
  93. package/dist/src/decision/ensemble-study/artifacts.js +7 -0
  94. package/dist/src/decision/ensemble-study/gate-policy.js +58 -0
  95. package/dist/src/decision/ensemble-study/gates.js +78 -0
  96. package/dist/src/decision/ensemble-study/protocol.js +18 -21
  97. package/dist/src/decision/ensemble-study/score.js +3 -2
  98. package/dist/src/decision/ensemble-study/statistics.js +7 -26
  99. package/dist/src/decision/heldout/access.js +74 -0
  100. package/dist/src/decision/heldout/calibration.js +1 -0
  101. package/dist/src/decision/heldout/collector.js +8 -1
  102. package/dist/src/decision/sensitivity/comparative-gates.js +135 -0
  103. package/dist/src/decision/sensitivity/comparative.js +18 -41
  104. package/dist/src/effects/verifiers/file.js +22 -5
  105. package/dist/src/extensions/claude-attribution.js +82 -0
  106. package/dist/src/extensions/claude-hooks-installer.js +133 -69
  107. package/dist/src/extensions/commands/daemon.js +109 -0
  108. package/dist/src/extensions/commands/definitions.js +5 -89
  109. package/dist/src/gates/evaluate.js +2 -358
  110. package/dist/src/gates/heldout.js +17 -7
  111. package/dist/src/gates/observations.js +363 -0
  112. package/dist/src/gates/pack-composition.js +270 -0
  113. package/dist/src/gates/pack-tightening.js +197 -0
  114. package/dist/src/gates/pack-validation.js +262 -0
  115. package/dist/src/gates/registry-error.js +5 -0
  116. package/dist/src/gates/registry.js +13 -685
  117. package/dist/src/lint/check-patterns.js +163 -0
  118. package/dist/src/lint/checks.js +268 -0
  119. package/dist/src/lint/reference-resolution.js +54 -0
  120. package/dist/src/lint/runner.js +3 -465
  121. package/dist/src/mcp/helpers.mjs +11 -1
  122. package/dist/src/mcp/json-document.mjs +29 -0
  123. package/dist/src/mcp/muse-native-config.mjs +1 -28
  124. package/dist/src/memory/project-registry.js +44 -4
  125. package/dist/src/mission-protocol/worker-review-gate.js +7 -0
  126. package/dist/src/models/worker-plan.js +36 -5
  127. package/dist/src/models/wrapper-deployment.js +25 -12
  128. package/dist/src/models/wrapper-enforcement.js +47 -7
  129. package/dist/src/network-analysis/research.js +2 -1
  130. package/dist/src/plugin/command-ownership.js +34 -0
  131. package/dist/src/plugin/skill-command-frontmatter.js +197 -0
  132. package/dist/src/plugin/skill-command-translator.js +6 -232
  133. package/dist/src/policy/hitl-check.js +14 -4
  134. package/dist/src/policy/hitl-consume.js +54 -0
  135. package/dist/src/policy/hitl-receipt.js +2 -0
  136. package/dist/src/policy/hitl.js +11 -3
  137. package/dist/src/providers/context-output-ownership.js +26 -0
  138. package/dist/src/providers/deployment-ownership.d.mts +19 -0
  139. package/dist/src/providers/deployment-ownership.mjs +226 -0
  140. package/dist/src/providers/deployment-removal.js +200 -0
  141. package/dist/src/providers/provider-context-contracts.js +162 -0
  142. package/dist/src/providers/provider-definition-schema.js +136 -0
  143. package/dist/src/providers/provider-definitions.js +8 -1298
  144. package/dist/src/providers/provider-seeds-1.js +360 -0
  145. package/dist/src/providers/provider-seeds-2.js +387 -0
  146. package/dist/src/providers/provider-seeds-3.js +262 -0
  147. package/dist/src/providers/removal-transaction.js +86 -0
  148. package/dist/src/providers/settings-document.d.mts +3 -0
  149. package/dist/src/providers/settings-document.mjs +47 -0
  150. package/dist/src/providers/settings-removal.js +190 -0
  151. package/dist/src/providers/skill-ownership.d.mts +19 -2
  152. package/dist/src/providers/skill-ownership.mjs +12 -4
  153. package/dist/src/providers/transformation-receipt-integration.js +15 -271
  154. package/dist/src/providers/transformation-receipt-outputs.js +99 -0
  155. package/dist/src/providers/transformation-receipt-source.js +194 -0
  156. package/dist/src/research/clients/arxiv.js +4 -30
  157. package/dist/src/research/clients/base.js +48 -22
  158. package/dist/src/research/identity.js +42 -4
  159. package/dist/src/research/query-cli.js +3 -87
  160. package/dist/src/research/query-options.js +87 -0
  161. package/dist/src/research/reference-match.js +105 -24
  162. package/dist/src/research/services/acquisition.js +9 -7
  163. package/dist/src/research/services/citation.js +5 -2
  164. package/dist/src/research/types.js +2 -0
  165. package/dist/src/rules/activation.mjs +15 -6
  166. package/dist/src/rules/core-startup.mjs +2 -2
  167. package/dist/src/serve/mission-conductor.js +52 -4
  168. package/dist/src/serve/mission-summary.js +56 -0
  169. package/dist/src/sessions/adapters/grok-build-native.js +23 -0
  170. package/dist/src/sessions/adapters/grok-build.js +14 -7
  171. package/dist/src/sessions/workspace-discovery.js +5 -5
  172. package/dist/src/smiths/context-pipeline/aiwg-md.js +39 -46
  173. package/dist/src/smiths/context-pipeline/claude-hook.js +1 -1
  174. package/dist/src/smiths/context-pipeline/code-regions.js +28 -0
  175. package/dist/src/smiths/context-pipeline/context-file-safety.js +3 -0
  176. package/dist/src/smiths/context-pipeline/finalization.js +81 -51
  177. package/dist/src/smiths/context-pipeline/generator.js +10 -11
  178. package/dist/src/smiths/context-pipeline/managed-hook.js +1 -1
  179. package/dist/src/smiths/context-pipeline/muse-bridge.js +2 -2
  180. package/dist/src/smiths/context-pipeline/provider-policy.js +6 -12
  181. package/dist/src/smiths/context-pipeline/workspace-audit.js +299 -0
  182. package/dist/src/smiths/context-pipeline/workspace-bootstrap.js +148 -0
  183. package/dist/src/smiths/context-pipeline/workspace-context-shared.js +111 -0
  184. package/dist/src/smiths/context-pipeline/workspace-context.js +8 -1373
  185. package/dist/src/smiths/context-pipeline/workspace-doctor.js +192 -0
  186. package/dist/src/smiths/context-pipeline/workspace-document.js +201 -0
  187. package/dist/src/smiths/context-pipeline/workspace-extraction.js +205 -0
  188. package/dist/src/smiths/context-pipeline/workspace-migration.js +250 -0
  189. package/dist/src/smiths/hook-bridge/index.js +9 -0
  190. package/package.json +13 -1
  191. package/schemas/decision/D17StudyProtocol.v1.schema.json +39 -67
  192. package/schemas/decision/D29Study.v10.schema.json +65 -0
  193. package/tools/agents/deploy-agents.mjs +24 -675
  194. package/tools/agents/deploy-command-mirrors.mjs +229 -0
  195. package/tools/agents/deploy-options.mjs +258 -0
  196. package/tools/agents/deploy-support.mjs +165 -0
  197. package/tools/agents/providers/base-addon-discovery.mjs +139 -0
  198. package/tools/agents/providers/base-behaviors.mjs +168 -0
  199. package/tools/agents/providers/base-context.mjs +205 -0
  200. package/tools/agents/providers/base-contract.mjs +116 -0
  201. package/tools/agents/providers/base-files.mjs +252 -0
  202. package/tools/agents/providers/base-flat-artifacts.mjs +233 -0
  203. package/tools/agents/providers/base-framework-discovery.mjs +309 -0
  204. package/tools/agents/providers/base-frontmatter.mjs +196 -0
  205. package/tools/agents/providers/base-inventory.mjs +269 -0
  206. package/tools/agents/providers/base-kernel-skills.mjs +354 -0
  207. package/tools/agents/providers/base-migrations.mjs +258 -0
  208. package/tools/agents/providers/base-models-platforms.mjs +273 -0
  209. package/tools/agents/providers/base-rule-index.mjs +450 -0
  210. package/tools/agents/providers/base-runtime.mjs +60 -0
  211. package/tools/agents/providers/base-skill-copy.mjs +273 -0
  212. package/tools/agents/providers/base.mjs +16 -3364
  213. package/tools/agents/providers/claude-post-deploy.mjs +20 -1
  214. package/tools/agents/providers/context-write.mjs +4 -0
  215. package/tools/agents/providers/hermes-startup.mjs +0 -5
  216. package/tools/agents/providers/muse.mjs +7 -2
  217. package/tools/agents/providers/pi.mjs +3 -1
  218. package/tools/agents/providers/rule-delivery-surface.mjs +359 -0
  219. package/tools/agents/providers/rule-delivery.mjs +20 -1144
  220. package/tools/agents/providers/rule-deployment-commit.mjs +148 -0
  221. package/tools/agents/providers/rule-deployment-prepare.mjs +461 -0
  222. package/tools/agents/providers/rule-deployment-state.mjs +300 -0
  223. package/tools/agents/providers/rule-projection.mjs +3 -0
  224. package/tools/daemon/README.md +511 -0
  225. package/tools/daemon/adapters/base-adapter.mjs +84 -0
  226. package/tools/daemon/adapters/webhook-adapter.mjs +107 -0
  227. package/tools/daemon/agent-supervisor.mjs +299 -0
  228. package/tools/daemon/automation-engine.mjs +310 -0
  229. package/tools/daemon/autonomous-engine.mjs +346 -0
  230. package/tools/daemon/behavior-loader.mjs +316 -0
  231. package/tools/daemon/behavior.mjs +174 -0
  232. package/tools/daemon/concierge/intent-router.mjs +401 -0
  233. package/tools/daemon/concierge/orchestrator.mjs +272 -0
  234. package/tools/daemon/concierge/response-translator.mjs +462 -0
  235. package/tools/daemon/config.mjs +377 -0
  236. package/tools/daemon/cron-scheduler.mjs +178 -0
  237. package/tools/daemon/daemon-main.mjs +1169 -0
  238. package/tools/daemon/event-router.mjs +84 -0
  239. package/tools/daemon/file-watcher.mjs +383 -0
  240. package/tools/daemon/index.mjs +1181 -0
  241. package/tools/daemon/init-profile.mjs +124 -0
  242. package/tools/daemon/ipc-client.mjs +197 -0
  243. package/tools/daemon/ipc-ops-handlers.mjs +236 -0
  244. package/tools/daemon/ipc-server.mjs +275 -0
  245. package/tools/daemon/maintenance-owner.mjs +79 -0
  246. package/tools/daemon/memory-manager.mjs +386 -0
  247. package/tools/daemon/message-router.mjs +194 -0
  248. package/tools/daemon/provider-watcher.mjs +585 -0
  249. package/tools/daemon/pty-adapter.mjs +420 -0
  250. package/tools/daemon/repl-chat.mjs +359 -0
  251. package/tools/daemon/resource-bounds.mjs +88 -0
  252. package/tools/daemon/sandbox-transport.mjs +295 -0
  253. package/tools/daemon/scheduled-task-runner.mjs +535 -0
  254. package/tools/daemon/task-store.mjs +450 -0
  255. package/tools/daemon/tmux-manager.mjs +324 -0
  256. package/tools/daemon/update-policy.mjs +517 -0
  257. package/tools/daemon/web-server.mjs +399 -0
  258. package/tools/daemon/web-ui/index.html +585 -0
  259. package/tools/daemon/web-ui/styles.css +156 -0
  260. package/tools/docker/Dockerfile.daemon +35 -0
  261. package/tools/docker/container-manager.mjs +291 -0
  262. package/tools/messaging/adapter-registry.mjs +230 -0
  263. package/tools/messaging/adapters/base.mjs +326 -0
  264. package/tools/messaging/adapters/discord.mjs +462 -0
  265. package/tools/messaging/adapters/slack.mjs +402 -0
  266. package/tools/messaging/adapters/telegram.mjs +552 -0
  267. package/tools/messaging/chat-handler.mjs +297 -0
  268. package/tools/messaging/command-router.mjs +269 -0
  269. package/tools/messaging/event-bus.mjs +199 -0
  270. package/tools/messaging/index.mjs +456 -0
  271. package/tools/messaging/message-formatter.mjs +320 -0
  272. package/tools/messaging/room-manager.mjs +277 -0
  273. package/tools/messaging/types.mjs +94 -0
  274. package/tools/providers/pi-bridge-policy.mjs +4 -0
  275. package/tools/ralph-external/daemon-supervisor.mjs +394 -0
  276. package/tools/ralph-external/lib/behavior-registry.mjs +270 -0
  277. package/tools/ralph-external/lib/worker-invocation-processes.mjs +7 -4
  278. package/tools/ralph-external/lib/worker-isolation-args.mjs +217 -0
  279. package/tools/ralph-external/lib/worker-isolation-status.mjs +19 -0
  280. package/tools/ralph-external/lib/worker-isolation.mjs +11 -237
  281. package/tools/ralph-external/lib/worker-overflow.mjs +10 -2
  282. package/tools/ralph-external/lib/worker-termination.mjs +15 -8
  283. package/tools/ralph-external/lib/worker-unit-cleanup.mjs +72 -0
  284. package/tools/ralph-external/session-launcher.mjs +7 -7
  285. package/tools/scripts/resource-preflight.mjs +3 -242
  286. package/vscode-extension/schemas/aiwg.config.v1.json +2 -4
@@ -0,0 +1,165 @@
1
+ import { handlerResultFromError } from "../errors.js";
2
+ export const indexHandler = {
3
+ id: "index",
4
+ name: "Artifact Index",
5
+ description: "Artifact index commands (build, query, deps, stats)",
6
+ category: "index",
7
+ aliases: [],
8
+ async help() {
9
+ const { printIndexUsage } = await import("../../artifacts/cli.js");
10
+ printIndexUsage();
11
+ return { exitCode: 0 };
12
+ },
13
+ async execute(ctx) {
14
+ try {
15
+ const { main } = await import("../../artifacts/cli.js");
16
+ await main(ctx.args);
17
+ return {
18
+ exitCode: Number(process.exitCode ?? 0),
19
+ };
20
+ }
21
+ catch (error) {
22
+ const result = handlerResultFromError(error);
23
+ return { ...result, message: `Index command failed: ${result.message}` };
24
+ }
25
+ },
26
+ };
27
+ /**
28
+ * `aiwg corpus` — research-corpus tools (radar/freshness subsystem, #1498).
29
+ * Delegates to the corpus-tools router, mirroring indexHandler.
30
+ */
31
+ export const corpusHandler = {
32
+ id: "corpus",
33
+ name: "Research Corpus Tools",
34
+ description: "Research-corpus tools (radar-init, radar-status, radar-report)",
35
+ category: "index",
36
+ aliases: [],
37
+ async help() {
38
+ const { corpusMain } = await import("../../artifacts/corpus-tools/cli.js");
39
+ await corpusMain(["--help"]);
40
+ return { exitCode: 0 };
41
+ },
42
+ async execute(ctx) {
43
+ try {
44
+ const { corpusMain } = await import("../../artifacts/corpus-tools/cli.js");
45
+ await corpusMain(ctx.args, ctx.cwd);
46
+ return { exitCode: 0 };
47
+ }
48
+ catch (error) {
49
+ const result = handlerResultFromError(error);
50
+ return { ...result, message: `Corpus command failed: ${result.message}` };
51
+ }
52
+ },
53
+ };
54
+ /**
55
+ * Discovery command handler — first-class top-level verb (#1212).
56
+ *
57
+ * Forwards to the same implementation as `aiwg index discover` but
58
+ * exposes discovery as its own command so agents don't conflate it
59
+ * with the project's general-purpose artifact graph indices.
60
+ *
61
+ * aiwg discover "<phrase>" [--limit N] [--type skill,agent,...] [--json]
62
+ * [--resource-source local|web|auto] [--aiwg-version <version|range|digest|channel>] [--offline]
63
+ */
64
+ export const discoverHandler = {
65
+ id: "discover",
66
+ name: "Discover",
67
+ description: "Find AIWG operational assets by capability — index-driven on-demand discovery",
68
+ category: "index",
69
+ aliases: [],
70
+ async execute(ctx) {
71
+ try {
72
+ // Delegate to the same handler `aiwg index discover` uses, by
73
+ // prepending the `discover` subcommand and reusing the artifacts
74
+ // CLI router. This keeps a single implementation path.
75
+ const { main } = await import("../../artifacts/cli.js");
76
+ await main(["discover", ...ctx.args]);
77
+ return { exitCode: 0 };
78
+ }
79
+ catch (error) {
80
+ const result = handlerResultFromError(error);
81
+ return { ...result, message: `Discover command failed: ${result.message}` };
82
+ }
83
+ },
84
+ };
85
+ /**
86
+ * Features command handler — manage AIWG's optional runtime features (#1219).
87
+ *
88
+ * Subcommands: status / info / install / remove. Native feature installs use
89
+ * a user-owned package root with explicit package-level script approval.
90
+ */
91
+ export const featuresHandler = {
92
+ id: "features",
93
+ name: "Features",
94
+ description: "List, inspect, and install AIWG's optional runtime features",
95
+ category: "maintenance",
96
+ aliases: [],
97
+ async execute(ctx) {
98
+ try {
99
+ const { main } = await import("../../features/cli.js");
100
+ await main(ctx.args);
101
+ return { exitCode: 0 };
102
+ }
103
+ catch (error) {
104
+ const result = handlerResultFromError(error);
105
+ return { ...result, message: `Features command failed: ${result.message}` };
106
+ }
107
+ },
108
+ };
109
+ /**
110
+ * Show command handler — fetch the full text of a specific artifact (#1218).
111
+ *
112
+ * Forwards to the same implementation as `aiwg index show`. Companion to
113
+ * `aiwg discover`: where discover ranks candidates, show fetches the body
114
+ * so consumers don't need to navigate AIWG's storage paths themselves.
115
+ *
116
+ * aiwg show <name> [--type skill,agent,...] [--json] [--first]
117
+ * [--resource-source local|web|auto] [--aiwg-version <version|range|digest|channel>] [--offline]
118
+ */
119
+ export const showHandler = {
120
+ id: "show",
121
+ name: "Show",
122
+ description: "Show an AIWG metadata card; --section or --body fetches content",
123
+ category: "index",
124
+ aliases: [],
125
+ async execute(ctx) {
126
+ try {
127
+ const { main } = await import("../../artifacts/cli.js");
128
+ await main(["show", ...ctx.args]);
129
+ return { exitCode: 0 };
130
+ }
131
+ catch (error) {
132
+ const result = handlerResultFromError(error);
133
+ return { ...result, message: `Show command failed: ${result.message}` };
134
+ }
135
+ },
136
+ };
137
+ /**
138
+ * Skills command handler
139
+ *
140
+ * Dynamically imports and delegates to src/skills/cli.ts.
141
+ * Handles subcommands: search, info, list, install, publish
142
+ *
143
+ * @implements #539
144
+ */
145
+ export const skillsHandler = {
146
+ id: "skills",
147
+ name: "Skills Registry",
148
+ description: "Skill commands (search, info, list, install, publish)",
149
+ category: "catalog",
150
+ aliases: [],
151
+ async execute(ctx) {
152
+ try {
153
+ const { main } = await import("../../skills/cli.js");
154
+ await main(ctx.args);
155
+ return {
156
+ exitCode: 0,
157
+ };
158
+ }
159
+ catch (error) {
160
+ const result = handlerResultFromError(error);
161
+ return { ...result, message: `Skills command failed: ${result.message}` };
162
+ }
163
+ },
164
+ };
165
+ //# sourceMappingURL=subcommands-discovery.js.map
@@ -0,0 +1,129 @@
1
+ import { buildUpstreamRegistry } from "../../extensions/upstream-registry.js";
2
+ import { resolveShadows } from "../../extensions/shadow-resolver.js";
3
+ /**
4
+ * Format `aiwg list --project-local` output: only project-local bundles, with
5
+ * per-type breakdown and any validation errors surfaced. (#1034)
6
+ */
7
+ export function formatProjectLocalOnly(result) {
8
+ let output = '';
9
+ const total = result.counts.extension +
10
+ result.counts.addon +
11
+ result.counts.framework +
12
+ result.counts.plugin;
13
+ if (total === 0 && result.errors.length === 0) {
14
+ output += '\nNo project-local bundles found.\n';
15
+ output += '\nTip: place a manifest.json under the configured AIWG artifact root at {extensions,addons,frameworks,plugins,providers}/<name>/ to author a project-local artifact.\n';
16
+ return { exitCode: 0, message: output };
17
+ }
18
+ output += `\nProject-local bundles (${total}):\n`;
19
+ output += '─'.repeat(60) + '\n';
20
+ for (const b of result.bundles) {
21
+ output += ` ${b.id} [project] [${b.type}] v${b.manifest.version}\n`;
22
+ output += ` Path: ${b.localPath}\n`;
23
+ output += ` Description: ${b.manifest.description.slice(0, 80)}${b.manifest.description.length > 80 ? '...' : ''}\n\n`;
24
+ }
25
+ if (result.errors.length > 0) {
26
+ output += '\nValidation errors:\n';
27
+ output += '─'.repeat(60) + '\n';
28
+ for (const e of result.errors.slice(0, 10)) {
29
+ output += ` [${e.severity}] ${e.path}\n`;
30
+ output += ` ${e.field}: expected ${e.expected}, got ${e.actual}\n`;
31
+ if (e.hint)
32
+ output += ` hint: ${e.hint}\n`;
33
+ }
34
+ if (result.errors.length > 10) {
35
+ output += ` ... and ${result.errors.length - 10} more\n`;
36
+ }
37
+ }
38
+ output += '\n' + '═'.repeat(60) + '\n';
39
+ output += `Counts by type: extension=${result.counts.extension} addon=${result.counts.addon} framework=${result.counts.framework} plugin=${result.counts.plugin}\n`;
40
+ return { exitCode: 0, message: output };
41
+ }
42
+ /**
43
+ * Format `aiwg list --shadows` output: only artifacts that currently shadow
44
+ * an upstream artifact, with safety-critical and override status. (#1036)
45
+ */
46
+ export async function formatShadowsOnly(projectLocal) {
47
+ let output = '';
48
+ if (projectLocal.bundles.length === 0) {
49
+ output += '\nNo project-local bundles — no shadows possible.\n';
50
+ return { exitCode: 0, message: output };
51
+ }
52
+ const { getFrameworkRoot: gfr } = await import('../../channel/manager.mjs');
53
+ const frameworkRoot = await gfr();
54
+ const upstream = await buildUpstreamRegistry({ frameworkRoot });
55
+ const result = await resolveShadows(projectLocal.bundles, upstream);
56
+ if (result.shadows.length === 0) {
57
+ output += '\nNo active shadows.\n';
58
+ output += '\nProject-local bundles deploy alongside upstream without collision.\n';
59
+ return { exitCode: 0, message: output };
60
+ }
61
+ output += `\nActive shadows (${result.shadows.length}):\n`;
62
+ output += '─'.repeat(60) + '\n';
63
+ for (const r of result.shadows) {
64
+ const sc = r.upstream?.safetyCritical ? ' [SAFETY-CRITICAL]' : '';
65
+ output += ` ${r.artifactType}/${r.artifactId}${sc}\n`;
66
+ output += ` Bundle: ${r.bundleId} (${r.bundleLocalPath})\n`;
67
+ output += ` Project-local: ${r.artifactSourcePath}\n`;
68
+ if (r.upstream) {
69
+ output += ` Shadows ${r.upstream.source}: ${r.upstream.sourcePath}\n`;
70
+ }
71
+ output += ` Verdict: ${r.verdict}\n\n`;
72
+ }
73
+ if (result.blockedBundleIds.size > 0) {
74
+ output += `\n⚠ ${result.blockedBundleIds.size} bundle(s) blocked from deployment due to unsafe shadows.\n`;
75
+ }
76
+ return { exitCode: 0, message: output };
77
+ }
78
+ /**
79
+ * #1156 Phase 1 — `--scope user` detection. Mirrors `detectScope()` from
80
+ * scope-resolver but tolerates the absence of the flag (no throw on absent).
81
+ * Returns true when args contain `--scope user`.
82
+ */
83
+ export function isScopeUser(args) {
84
+ const idx = args.findIndex((a) => a === '--scope');
85
+ if (idx === -1)
86
+ return false;
87
+ return args[idx + 1] === 'user';
88
+ }
89
+ /**
90
+ * #1156 Phase 1 — Format the per-user registry (~/.aiwg/installed.json) as a
91
+ * human-readable inventory. Used by `aiwg list --scope user` / `aiwg list
92
+ * --user`. Independent of any project — works from any cwd.
93
+ */
94
+ export async function formatUserScopeRegistry() {
95
+ const { readUserRegistry, userRegistryPath } = await import('../../config/user-registry.js');
96
+ const registry = await readUserRegistry();
97
+ const frameworks = Object.entries(registry.installed);
98
+ let output = '';
99
+ if (frameworks.length === 0) {
100
+ output += '\nNo frameworks deployed at user scope.\n';
101
+ output += `\nRegistry path: ${userRegistryPath()}\n`;
102
+ output += '\nTip: run `aiwg use <framework> --provider <p> --scope user` to install at user scope.\n';
103
+ return { exitCode: 0, message: output };
104
+ }
105
+ output += `\nUser-scope deployments (${frameworks.length}):\n`;
106
+ output += '─'.repeat(60) + '\n';
107
+ for (const [name, entry] of frameworks) {
108
+ output += ` ${name} v${entry.version} [${entry.source}]\n`;
109
+ output += ` Installed: ${entry.installedAt}\n`;
110
+ const providers = Object.entries(entry.deployedTo);
111
+ for (const [provider, counts] of providers) {
112
+ const parts = [];
113
+ if (counts.agents > 0)
114
+ parts.push(`${counts.agents} agents`);
115
+ if (counts.commands > 0)
116
+ parts.push(`${counts.commands} commands`);
117
+ if (counts.skills > 0)
118
+ parts.push(`${counts.skills} skills`);
119
+ if (counts.rules > 0)
120
+ parts.push(`${counts.rules} rules`);
121
+ output += ` ${provider}: ${parts.length > 0 ? parts.join(', ') : '(empty)'}\n`;
122
+ }
123
+ output += '\n';
124
+ }
125
+ output += '═'.repeat(60) + '\n';
126
+ output += `Registry path: ${userRegistryPath()}\n`;
127
+ return { exitCode: 0, message: output };
128
+ }
129
+ //# sourceMappingURL=subcommands-list-format.js.map
@@ -0,0 +1,250 @@
1
+ import { createScriptRunner } from "./script-runner.js";
2
+ import { getFrameworkRoot } from "../../channel/manager.mjs";
3
+ import * as path from "node:path";
4
+ import * as fsSync from "node:fs";
5
+ import { getRegistry } from "../../extensions/registry.js";
6
+ import { registerDeployedExtensions } from "../../extensions/deployment-registration.js";
7
+ import { discoverProjectLocalBundles } from "../../extensions/project-local-discovery.js";
8
+ import { getProjectDir } from "../../config/aiwg-config.js";
9
+ import { formatDeployedWorkspaceSignalPlan, readWorkspaceSignalPlan } from "../workspace-signals.js";
10
+ import { isScopeUser, formatUserScopeRegistry, formatProjectLocalOnly, formatShadowsOnly } from "./subcommands-list-format.js";
11
+ const LIST_PROVIDER_TARGETS = [
12
+ { name: 'claude', root: '.claude', agentsPath: '.claude/agents', skillsPath: '.claude/skills', commandsPath: '.claude/commands' },
13
+ { name: 'codex', root: '.codex', agentsPath: '.codex/agents', skillsPath: '.codex/skills', commandsPath: '.codex/commands' },
14
+ { name: 'copilot', root: '.github', agentsPath: '.github/agents', skillsPath: '.github/skills', commandsPath: '.github/prompts' },
15
+ { name: 'cursor', root: '.cursor', agentsPath: '.cursor/agents', skillsPath: '.cursor/skills', commandsPath: '.cursor/commands' },
16
+ { name: 'opencode', root: '.opencode', agentsPath: '.opencode/agent', skillsPath: '.opencode/skill', commandsPath: '.opencode/command' },
17
+ { name: 'warp', root: '.warp', agentsPath: '.warp/agents', skillsPath: '.warp/skills', commandsPath: '.warp/commands' },
18
+ { name: 'factory', root: '.factory', agentsPath: '.factory/droids', skillsPath: '.factory/skills', commandsPath: '.factory/commands' },
19
+ { name: 'windsurf', root: '.windsurf', agentsPath: '.windsurf/agents', skillsPath: '.windsurf/skills', commandsPath: '.windsurf/workflows' },
20
+ { name: 'universal', root: '.agents', agentsPath: '.agents/agents', skillsPath: '.agents/skills', commandsPath: '.agents/commands' },
21
+ ];
22
+ function hasAnyPopulated(cwd, p) {
23
+ const candidates = [p.agentsPath, p.skillsPath, p.commandsPath];
24
+ for (const rel of candidates) {
25
+ const abs = path.join(cwd, rel);
26
+ try {
27
+ if (fsSync.statSync(abs).isDirectory() && fsSync.readdirSync(abs).length > 0)
28
+ return true;
29
+ }
30
+ catch {
31
+ // dir doesn't exist or unreadable — skip
32
+ }
33
+ }
34
+ return false;
35
+ }
36
+ function detectDeployedProviders(cwd) {
37
+ return LIST_PROVIDER_TARGETS.filter(p => hasAnyPopulated(cwd, p));
38
+ }
39
+ export const listHandler = {
40
+ id: "list",
41
+ name: "List Frameworks",
42
+ description: "List installed frameworks and plugins",
43
+ category: "framework",
44
+ aliases: ["ls"],
45
+ async execute(ctx) {
46
+ // Filter args: positional type filter, plus --project-local flag (#1034)
47
+ const projectLocalOnly = ctx.args.includes('--project-local');
48
+ const shadowsOnly = ctx.args.includes('--shadows');
49
+ const deployedOnly = ctx.args.includes('--deployed');
50
+ const filterType = ctx.args.find((a) => !a.startsWith('--')); // 'agents'|'skills'|'commands'|'all'|undefined
51
+ // #1156 Phase 1 — --scope user / --user surfaces the per-user registry
52
+ // (~/.aiwg/installed.json) instead of the project-scope deployed-extensions
53
+ // registry. Works from any cwd; does not require a project to be present.
54
+ const userScopeRequested = ctx.args.includes('--user') || isScopeUser(ctx.args);
55
+ if (userScopeRequested) {
56
+ return await formatUserScopeRegistry();
57
+ }
58
+ // Project-local bundle discovery (#1034) — read-only scan, no deploy
59
+ const projectLocal = await discoverProjectLocalBundles(ctx.cwd);
60
+ if (shadowsOnly) {
61
+ // #1036 — surface only artifacts that shadow upstream
62
+ return await formatShadowsOnly(projectLocal);
63
+ }
64
+ if (projectLocalOnly) {
65
+ // --project-local: only show project-local bundles; skip the deployed-
66
+ // extension registry read entirely
67
+ return formatProjectLocalOnly(projectLocal);
68
+ }
69
+ // Ensure registry is populated with deployed extensions
70
+ const registry = getRegistry();
71
+ // If registry is empty, try to populate it from EVERY deployed provider
72
+ // in the workspace (not just claude). Fixes #1530: in a Codex-only
73
+ // workspace the legacy hard-coded `.claude/...` lookup reported zero
74
+ // extensions even though `.codex/` was populated. Detection mirrors
75
+ // `tools/cli/workspace-status.mjs` so `aiwg list` and `aiwg status`
76
+ // agree on what counts as deployed.
77
+ //
78
+ // `--provider <name>` narrows registration to one provider; otherwise
79
+ // we register the union of everything detected so a multi-provider
80
+ // workspace shows everything in a single inventory.
81
+ if (registry.size === 0) {
82
+ try {
83
+ const provIdx = ctx.args.findIndex((a) => a === '--provider' || a === '--platform');
84
+ const requestedProvider = provIdx >= 0 ? ctx.args[provIdx + 1] : undefined;
85
+ let targets = detectDeployedProviders(ctx.cwd);
86
+ if (requestedProvider) {
87
+ targets = targets.filter((p) => p.name === requestedProvider);
88
+ if (targets.length === 0) {
89
+ return {
90
+ exitCode: 1,
91
+ message: `Error: provider '${requestedProvider}' is not deployed in this workspace.\n\nRun 'aiwg status' to see deployed providers.`,
92
+ };
93
+ }
94
+ }
95
+ if (targets.length === 0) {
96
+ // No deployed providers detected → return a clean empty-inventory
97
+ // message rather than dispatching to the legacy script (which
98
+ // requires a path argument it doesn't get here). Matches the
99
+ // legacy script's helpful guidance from #1530.
100
+ return {
101
+ exitCode: 0,
102
+ message: 'No agents, skills, or commands deployed in this workspace.\n\n' +
103
+ 'Tip: Deploy a framework with "aiwg use sdlc" (or another framework) to get started.\n' +
104
+ 'Run "aiwg status" for workspace health detail.\n',
105
+ };
106
+ }
107
+ for (const target of targets) {
108
+ await registerDeployedExtensions(registry, {
109
+ agentsPath: target.agentsPath,
110
+ skillsPath: target.skillsPath,
111
+ commandsPath: target.commandsPath,
112
+ provider: target.name,
113
+ cwd: ctx.cwd,
114
+ });
115
+ }
116
+ }
117
+ catch (error) {
118
+ // If registry population fails, fall back to legacy script
119
+ const frameworkRoot = await getFrameworkRoot();
120
+ const runner = createScriptRunner(frameworkRoot);
121
+ return runner.run("tools/plugin/plugin-status-cli.mjs", ctx.args, {
122
+ cwd: ctx.cwd,
123
+ });
124
+ }
125
+ }
126
+ // Determine what to show
127
+ const showAgents = !filterType || filterType === 'agents' || filterType === 'all';
128
+ const showSkills = !filterType || filterType === 'skills' || filterType === 'all';
129
+ const showCommands = !filterType || filterType === 'commands' || filterType === 'all';
130
+ let output = '';
131
+ if (showAgents) {
132
+ const agents = registry.getByType('agent');
133
+ output += `\nAgents (${agents.length}):\n`;
134
+ output += '─'.repeat(60) + '\n';
135
+ if (agents.length === 0) {
136
+ output += ' No agents deployed\n';
137
+ }
138
+ else {
139
+ for (const agent of agents.slice(0, 20)) { // Limit to 20 for readability
140
+ output += ` ${agent.name}\n`;
141
+ output += ` ID: ${agent.id}\n`;
142
+ output += ` Description: ${agent.description.slice(0, 80)}${agent.description.length > 80 ? '...' : ''}\n`;
143
+ if (agent.installation) {
144
+ output += ` Path: ${agent.installation.installedPath}\n`;
145
+ }
146
+ output += '\n';
147
+ }
148
+ if (agents.length > 20) {
149
+ output += ` ... and ${agents.length - 20} more\n`;
150
+ }
151
+ }
152
+ }
153
+ if (showSkills) {
154
+ const skills = registry.getByType('skill');
155
+ output += `\nSkills (${skills.length}):\n`;
156
+ output += '─'.repeat(60) + '\n';
157
+ if (skills.length === 0) {
158
+ output += ' No skills deployed\n';
159
+ }
160
+ else {
161
+ for (const skill of skills.slice(0, 20)) {
162
+ output += ` ${skill.name}\n`;
163
+ output += ` ID: ${skill.id}\n`;
164
+ output += ` Description: ${skill.description.slice(0, 80)}${skill.description.length > 80 ? '...' : ''}\n`;
165
+ if (skill.installation) {
166
+ output += ` Path: ${skill.installation.installedPath}\n`;
167
+ }
168
+ output += '\n';
169
+ }
170
+ if (skills.length > 20) {
171
+ output += ` ... and ${skills.length - 20} more\n`;
172
+ }
173
+ }
174
+ }
175
+ if (showCommands) {
176
+ const commands = registry.getByType('command');
177
+ output += `\nCommands (${commands.length}):\n`;
178
+ output += '─'.repeat(60) + '\n';
179
+ if (commands.length === 0) {
180
+ output += ' No commands registered\n';
181
+ }
182
+ else {
183
+ for (const command of commands.slice(0, 20)) {
184
+ output += ` ${command.name}\n`;
185
+ output += ` ID: ${command.id}\n`;
186
+ output += ` Description: ${command.description.slice(0, 80)}${command.description.length > 80 ? '...' : ''}\n`;
187
+ output += '\n';
188
+ }
189
+ if (commands.length > 20) {
190
+ output += ` ... and ${commands.length - 20} more\n`;
191
+ }
192
+ }
193
+ }
194
+ // Project-local bundles (#1034) — surfaced as a separate section with
195
+ // [project] source label
196
+ const totalProjectLocal = projectLocal.counts.extension +
197
+ projectLocal.counts.addon +
198
+ projectLocal.counts.framework +
199
+ projectLocal.counts.plugin;
200
+ if (totalProjectLocal > 0 || projectLocal.errors.length > 0) {
201
+ output += `\nProject-local bundles (${totalProjectLocal}):\n`;
202
+ output += '─'.repeat(60) + '\n';
203
+ for (const b of projectLocal.bundles) {
204
+ output += ` ${b.id} [project] [${b.type}]\n`;
205
+ output += ` Path: ${b.localPath}\n`;
206
+ output += ` Description: ${b.manifest.description.slice(0, 80)}${b.manifest.description.length > 80 ? '...' : ''}\n\n`;
207
+ }
208
+ if (projectLocal.errors.length > 0) {
209
+ output += ` ⚠ ${projectLocal.errors.length} validation error(s) — see "aiwg doctor" for details\n`;
210
+ }
211
+ }
212
+ // Summary
213
+ const totalAgents = registry.getByType('agent').length;
214
+ const totalSkills = registry.getByType('skill').length;
215
+ const totalCommands = registry.getByType('command').length;
216
+ const total = totalAgents + totalSkills + totalCommands;
217
+ output += '\n' + '═'.repeat(60) + '\n';
218
+ output += `Total: ${total} extensions (${totalAgents} agents, ${totalSkills} skills, ${totalCommands} commands)`;
219
+ if (totalProjectLocal > 0) {
220
+ output += ` + ${totalProjectLocal} project-local`;
221
+ }
222
+ output += '\n';
223
+ if (total === 0 && totalProjectLocal === 0) {
224
+ output += '\nTip: Deploy a framework with "aiwg use sdlc" to get started\n';
225
+ }
226
+ else if (totalCommands === 0 && totalAgents > 0) {
227
+ // Skill-only model (Claude Code default): commands aren't deployed as
228
+ // slash commands; capabilities reach the agent via natural language or
229
+ // `aiwg discover` (#1228). Surface this so 0 commands doesn't look like
230
+ // a deploy failure.
231
+ output += '\nNote: 0 commands is expected on Claude Code — capabilities are reached via natural language or `aiwg discover "<phrase>"`.\n';
232
+ }
233
+ if (deployedOnly) {
234
+ const projectDir = getProjectDir(ctx, ctx.args);
235
+ const plan = await readWorkspaceSignalPlan(projectDir);
236
+ if (plan) {
237
+ output += formatDeployedWorkspaceSignalPlan(plan);
238
+ }
239
+ else {
240
+ output += '\nWorkspace skill filter: no recorded plan found.\n';
241
+ output += 'Run `aiwg use --profile <name>` to record workspace-aware include/exclude reasons.\n';
242
+ }
243
+ }
244
+ return {
245
+ exitCode: 0,
246
+ message: output,
247
+ };
248
+ },
249
+ };
250
+ //# sourceMappingURL=subcommands-list.js.map