@aiwg/cli 0.0.0-bootstrap.0 → 2026.7.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 (467) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +22 -1
  3. package/bin/aiwg.mjs +349 -0
  4. package/dist/src/a2a/agent-card.js +145 -0
  5. package/dist/src/a2a/client.js +411 -0
  6. package/dist/src/a2a/hitl-cli.js +171 -0
  7. package/dist/src/a2a/hitl-driver.js +370 -0
  8. package/dist/src/a2a/hitl.js +181 -0
  9. package/dist/src/a2a/http.js +193 -0
  10. package/dist/src/a2a/jcs.js +128 -0
  11. package/dist/src/a2a/jws.js +187 -0
  12. package/dist/src/a2a/types.js +24 -0
  13. package/dist/src/a2a/webhook.js +240 -0
  14. package/dist/src/activity-log/cli.js +348 -0
  15. package/dist/src/activity-log/parser.js +81 -0
  16. package/dist/src/activity-log/types.js +50 -0
  17. package/dist/src/agents/agent-deployer.js +367 -0
  18. package/dist/src/agents/agent-packager.js +271 -0
  19. package/dist/src/agents/agent-validator.js +271 -0
  20. package/dist/src/agents/grounding/knowledge-base.js +161 -0
  21. package/dist/src/agents/grounding/types.js +12 -0
  22. package/dist/src/agents/index.js +10 -0
  23. package/dist/src/agents/packaged-agent-inventory.js +75 -0
  24. package/dist/src/agents/types.js +7 -0
  25. package/dist/src/api/index.d.ts +10 -0
  26. package/dist/src/api/index.js +10 -0
  27. package/dist/src/artifacts/address-parser.js +73 -0
  28. package/dist/src/artifacts/audit/cli.js +183 -0
  29. package/dist/src/artifacts/audit/drift.js +122 -0
  30. package/dist/src/artifacts/audit/types.js +12 -0
  31. package/dist/src/artifacts/backends/graphology-backend.js +160 -0
  32. package/dist/src/artifacts/backends/json-backend.js +129 -0
  33. package/dist/src/artifacts/backends/sqlite-backend.js +199 -0
  34. package/dist/src/artifacts/browser-export.js +622 -0
  35. package/dist/src/artifacts/capability-resolver.js +94 -0
  36. package/dist/src/artifacts/checksum-manifest.js +91 -0
  37. package/dist/src/artifacts/citation-parser.js +162 -0
  38. package/dist/src/artifacts/cli.js +1486 -0
  39. package/dist/src/artifacts/corpus-tools/citation-densify.js +311 -0
  40. package/dist/src/artifacts/corpus-tools/cli.js +393 -0
  41. package/dist/src/artifacts/corpus-tools/corpus-graph.js +225 -0
  42. package/dist/src/artifacts/corpus-tools/curator.js +186 -0
  43. package/dist/src/artifacts/corpus-tools/discovery-log.js +70 -0
  44. package/dist/src/artifacts/corpus-tools/funder-network.js +141 -0
  45. package/dist/src/artifacts/corpus-tools/induction-audit.js +233 -0
  46. package/dist/src/artifacts/corpus-tools/integrity-scan.js +202 -0
  47. package/dist/src/artifacts/corpus-tools/profile-communities.js +166 -0
  48. package/dist/src/artifacts/corpus-tools/profile-edges.js +72 -0
  49. package/dist/src/artifacts/corpus-tools/profile-embed.js +113 -0
  50. package/dist/src/artifacts/corpus-tools/profile-generate-fm.js +167 -0
  51. package/dist/src/artifacts/corpus-tools/profile-generate.js +181 -0
  52. package/dist/src/artifacts/corpus-tools/profile-metrics.js +98 -0
  53. package/dist/src/artifacts/corpus-tools/profile-status.js +86 -0
  54. package/dist/src/artifacts/corpus-tools/profile-temporal.js +139 -0
  55. package/dist/src/artifacts/corpus-tools/radar-init.js +93 -0
  56. package/dist/src/artifacts/corpus-tools/radar-report.js +118 -0
  57. package/dist/src/artifacts/corpus-tools/radar-shared.js +189 -0
  58. package/dist/src/artifacts/corpus-tools/radar-status.js +68 -0
  59. package/dist/src/artifacts/corpus-tools/sidecar-lint.js +233 -0
  60. package/dist/src/artifacts/corpus-tools/sidecar-repair.js +277 -0
  61. package/dist/src/artifacts/corpus-tools/snapshot.js +591 -0
  62. package/dist/src/artifacts/corpus-tools/source-types.js +164 -0
  63. package/dist/src/artifacts/corpus-tools/vision-extract.js +243 -0
  64. package/dist/src/artifacts/corpus-views/build.js +126 -0
  65. package/dist/src/artifacts/corpus-views/corpus-config.js +124 -0
  66. package/dist/src/artifacts/corpus-views/ref-parser.js +437 -0
  67. package/dist/src/artifacts/corpus-views/renderers.js +353 -0
  68. package/dist/src/artifacts/corpus-views/taxonomies.js +131 -0
  69. package/dist/src/artifacts/dep-graph.js +173 -0
  70. package/dist/src/artifacts/discover-facets.js +375 -0
  71. package/dist/src/artifacts/embedding-index.js +354 -0
  72. package/dist/src/artifacts/enrichment/cli.js +240 -0
  73. package/dist/src/artifacts/enrichment/prompt.js +47 -0
  74. package/dist/src/artifacts/enrichment/store.js +90 -0
  75. package/dist/src/artifacts/enrichment/types.js +12 -0
  76. package/dist/src/artifacts/fortemi-core-query-adapter.js +475 -0
  77. package/dist/src/artifacts/fortemi-core-sync.js +251 -0
  78. package/dist/src/artifacts/fortemi-shard-export.js +44 -0
  79. package/dist/src/artifacts/fulltext.js +108 -0
  80. package/dist/src/artifacts/graph-backend.js +51 -0
  81. package/dist/src/artifacts/graph-query.js +247 -0
  82. package/dist/src/artifacts/hybrid-query.js +225 -0
  83. package/dist/src/artifacts/index-builder.js +1089 -0
  84. package/dist/src/artifacts/index-reader.js +112 -0
  85. package/dist/src/artifacts/index-status.js +193 -0
  86. package/dist/src/artifacts/legacy-index-migration.js +169 -0
  87. package/dist/src/artifacts/move.js +154 -0
  88. package/dist/src/artifacts/operational-state.js +239 -0
  89. package/dist/src/artifacts/prebuilt-build-lock.js +49 -0
  90. package/dist/src/artifacts/query-engine.js +1955 -0
  91. package/dist/src/artifacts/source-graph.js +529 -0
  92. package/dist/src/artifacts/stats.js +169 -0
  93. package/dist/src/artifacts/types.js +606 -0
  94. package/dist/src/artifacts/views/cli.js +293 -0
  95. package/dist/src/artifacts/views/definition.js +170 -0
  96. package/dist/src/artifacts/views/store.js +149 -0
  97. package/dist/src/artifacts/views/types.js +8 -0
  98. package/dist/src/artifacts/watcher.js +255 -0
  99. package/dist/src/catalog/builtin-models.json +636 -0
  100. package/dist/src/catalog/cli.js +228 -0
  101. package/dist/src/catalog/cli.mjs +289 -0
  102. package/dist/src/catalog/index.js +15 -0
  103. package/dist/src/catalog/loader.js +217 -0
  104. package/dist/src/catalog/loader.mjs +251 -0
  105. package/dist/src/catalog/sources.json +41 -0
  106. package/dist/src/catalog/types.js +8 -0
  107. package/dist/src/channel/manager.mjs +504 -0
  108. package/dist/src/cli/agent-spawn.js +178 -0
  109. package/dist/src/cli/cli-extension-loader.js +245 -0
  110. package/dist/src/cli/command-log.js +275 -0
  111. package/dist/src/cli/config-loader.js +232 -0
  112. package/dist/src/cli/env.js +82 -0
  113. package/dist/src/cli/errors.js +150 -0
  114. package/dist/src/cli/find-package-root.js +40 -0
  115. package/dist/src/cli/git-hooks.js +250 -0
  116. package/dist/src/cli/handlers/agentcard.js +206 -0
  117. package/dist/src/cli/handlers/artifacts.js +76 -0
  118. package/dist/src/cli/handlers/best-practices-audit.js +280 -0
  119. package/dist/src/cli/handlers/cockpit.js +137 -0
  120. package/dist/src/cli/handlers/command-log.js +37 -0
  121. package/dist/src/cli/handlers/daemon.js +59 -0
  122. package/dist/src/cli/handlers/diagnose.js +300 -0
  123. package/dist/src/cli/handlers/execution-mode.js +105 -0
  124. package/dist/src/cli/handlers/feedback.js +341 -0
  125. package/dist/src/cli/handlers/help.js +147 -0
  126. package/dist/src/cli/handlers/index.js +302 -0
  127. package/dist/src/cli/handlers/init.js +179 -0
  128. package/dist/src/cli/handlers/install.js +129 -0
  129. package/dist/src/cli/handlers/issues.js +46 -0
  130. package/dist/src/cli/handlers/lint.js +42 -0
  131. package/dist/src/cli/handlers/local-executor.js +315 -0
  132. package/dist/src/cli/handlers/marketplace.js +168 -0
  133. package/dist/src/cli/handlers/mc.js +1010 -0
  134. package/dist/src/cli/handlers/models.js +352 -0
  135. package/dist/src/cli/handlers/packages.js +155 -0
  136. package/dist/src/cli/handlers/ralph-launcher.js +717 -0
  137. package/dist/src/cli/handlers/ralph.js +575 -0
  138. package/dist/src/cli/handlers/refresh.js +432 -0
  139. package/dist/src/cli/handlers/regenerate.js +336 -0
  140. package/dist/src/cli/handlers/repo-access.js +109 -0
  141. package/dist/src/cli/handlers/run.js +165 -0
  142. package/dist/src/cli/handlers/runtime-info.js +301 -0
  143. package/dist/src/cli/handlers/sandbox.js +197 -0
  144. package/dist/src/cli/handlers/scaffolding.js +149 -0
  145. package/dist/src/cli/handlers/script-runner.js +121 -0
  146. package/dist/src/cli/handlers/sdlc-accelerate.js +148 -0
  147. package/dist/src/cli/handlers/serve.js +1835 -0
  148. package/dist/src/cli/handlers/session.js +348 -0
  149. package/dist/src/cli/handlers/setup.js +440 -0
  150. package/dist/src/cli/handlers/skill-lint.js +367 -0
  151. package/dist/src/cli/handlers/skill-usage.js +74 -0
  152. package/dist/src/cli/handlers/steward.js +567 -0
  153. package/dist/src/cli/handlers/subcommands.js +1702 -0
  154. package/dist/src/cli/handlers/team.js +337 -0
  155. package/dist/src/cli/handlers/types.js +11 -0
  156. package/dist/src/cli/handlers/use.js +2772 -0
  157. package/dist/src/cli/handlers/utilities.js +703 -0
  158. package/dist/src/cli/handlers/version.js +134 -0
  159. package/dist/src/cli/handlers/workspace-context.js +93 -0
  160. package/dist/src/cli/handlers/workspace.js +126 -0
  161. package/dist/src/cli/help-generator.js +178 -0
  162. package/dist/src/cli/hooks/builtin/activity-log-hook.js +126 -0
  163. package/dist/src/cli/hooks/executor.js +96 -0
  164. package/dist/src/cli/hooks/index.js +15 -0
  165. package/dist/src/cli/hooks/registry.js +143 -0
  166. package/dist/src/cli/hooks/types.js +13 -0
  167. package/dist/src/cli/log.js +492 -0
  168. package/dist/src/cli/project-isolation/detect.js +70 -0
  169. package/dist/src/cli/project-isolation/index.js +7 -0
  170. package/dist/src/cli/project-isolation/signals.js +17 -0
  171. package/dist/src/cli/project-isolation/warning.js +102 -0
  172. package/dist/src/cli/prompt-utils.js +155 -0
  173. package/dist/src/cli/provider-deployment-plan.js +126 -0
  174. package/dist/src/cli/provider-resolution.js +119 -0
  175. package/dist/src/cli/router.js +305 -0
  176. package/dist/src/cli/scope-resolver.js +392 -0
  177. package/dist/src/cli/skill-usage.js +616 -0
  178. package/dist/src/cli/ui.js +224 -0
  179. package/dist/src/cli/watch-service.js +203 -0
  180. package/dist/src/cli/workflow-orchestrator.js +478 -0
  181. package/dist/src/cli/workspace-signals.js +321 -0
  182. package/dist/src/community/footer.js +14 -0
  183. package/dist/src/community/links.js +123 -0
  184. package/dist/src/community/milestones.js +46 -0
  185. package/dist/src/community/nudge-policy.js +93 -0
  186. package/dist/src/config/aiwg-config.js +883 -0
  187. package/dist/src/config/cli.js +703 -0
  188. package/dist/src/config/gitignore.js +156 -0
  189. package/dist/src/config/project-artifacts.js +76 -0
  190. package/dist/src/config/user-config.js +428 -0
  191. package/dist/src/config/user-registry.js +127 -0
  192. package/dist/src/config/workspace.js +276 -0
  193. package/dist/src/contributors/detect.js +39 -0
  194. package/dist/src/contributors/discover.js +172 -0
  195. package/dist/src/contributors/heuristic.js +186 -0
  196. package/dist/src/contributors/index.js +11 -0
  197. package/dist/src/contributors/types.js +13 -0
  198. package/dist/src/contributors/validation.js +116 -0
  199. package/dist/src/data/community.schema.json +43 -0
  200. package/dist/src/data/community.yaml +16 -0
  201. package/dist/src/extensions/capability-index.js +270 -0
  202. package/dist/src/extensions/claude-hooks-installer.js +268 -0
  203. package/dist/src/extensions/commands/definitions.js +3485 -0
  204. package/dist/src/extensions/deployment-registration.js +463 -0
  205. package/dist/src/extensions/index.js +22 -0
  206. package/dist/src/extensions/loader.js +132 -0
  207. package/dist/src/extensions/managed-marker.js +100 -0
  208. package/dist/src/extensions/manifest.js +196 -0
  209. package/dist/src/extensions/project-local-activity.js +114 -0
  210. package/dist/src/extensions/project-local-discovery.js +261 -0
  211. package/dist/src/extensions/project-local-doctor.js +281 -0
  212. package/dist/src/extensions/project-local-gitignore.js +176 -0
  213. package/dist/src/extensions/project-local-paths.js +121 -0
  214. package/dist/src/extensions/project-local-promote.js +218 -0
  215. package/dist/src/extensions/project-local-remove.js +373 -0
  216. package/dist/src/extensions/project-local-scaffold.js +252 -0
  217. package/dist/src/extensions/project-quickref.js +291 -0
  218. package/dist/src/extensions/registry.js +368 -0
  219. package/dist/src/extensions/shadow-resolver.js +271 -0
  220. package/dist/src/extensions/types.js +86 -0
  221. package/dist/src/extensions/upstream-registry.js +195 -0
  222. package/dist/src/extensions/validation.js +631 -0
  223. package/dist/src/features/catalog.js +88 -0
  224. package/dist/src/features/cli.js +197 -0
  225. package/dist/src/features/installer.js +57 -0
  226. package/dist/src/features/paths.js +14 -0
  227. package/dist/src/features/runtime.js +21 -0
  228. package/dist/src/features/status.js +134 -0
  229. package/dist/src/hooks/laziness-detection.js +532 -0
  230. package/dist/src/intake/git-history-analyzer.js +486 -0
  231. package/dist/src/intake/index.js +9 -0
  232. package/dist/src/issues/cli.js +327 -0
  233. package/dist/src/issues/index.js +5 -0
  234. package/dist/src/issues/live.js +154 -0
  235. package/dist/src/issues/local.js +666 -0
  236. package/dist/src/issues/sync.js +143 -0
  237. package/dist/src/issues/types.js +2 -0
  238. package/dist/src/issues/workflows.js +164 -0
  239. package/dist/src/kb/cli.js +173 -0
  240. package/dist/src/lint/cli.js +171 -0
  241. package/dist/src/lint/loader.js +225 -0
  242. package/dist/src/lint/reporters.js +141 -0
  243. package/dist/src/lint/runner.js +364 -0
  244. package/dist/src/lint/types.js +10 -0
  245. package/dist/src/marketplace/cache.js +110 -0
  246. package/dist/src/marketplace/identifier.js +63 -0
  247. package/dist/src/marketplace/registry.js +36 -0
  248. package/dist/src/marketplace/sources/clawhub.js +53 -0
  249. package/dist/src/marketplace/sources/git.js +45 -0
  250. package/dist/src/marketplace/types.js +9 -0
  251. package/dist/src/mcp/adapters/codex-runtime.js +224 -0
  252. package/dist/src/mcp/cli.mjs +1197 -0
  253. package/dist/src/mcp/elicitation.mjs +149 -0
  254. package/dist/src/mcp/helpers.mjs +287 -0
  255. package/dist/src/mcp/index.mjs +11 -0
  256. package/dist/src/mcp/profiles.js +263 -0
  257. package/dist/src/mcp/profiles.mjs +360 -0
  258. package/dist/src/mcp/registry.js +376 -0
  259. package/dist/src/mcp/registry.mjs +387 -0
  260. package/dist/src/mcp/server.mjs +633 -0
  261. package/dist/src/mcp/test-simple.mjs +271 -0
  262. package/dist/src/mcp/tools/command-run.mjs +101 -0
  263. package/dist/src/mcp/tools/discovery.mjs +291 -0
  264. package/dist/src/mcp/tools/interaction.mjs +87 -0
  265. package/dist/src/mcp/tools/orchestration.mjs +320 -0
  266. package/dist/src/mcp/tools/subsystems.mjs +640 -0
  267. package/dist/src/memory/cli.js +166 -0
  268. package/dist/src/memory/project-registry.js +282 -0
  269. package/dist/src/metrics/artifact-metrics.js +184 -0
  270. package/dist/src/metrics/context-budget.js +174 -0
  271. package/dist/src/metrics/token-counter.js +133 -0
  272. package/dist/src/models/config-loader.js +228 -0
  273. package/dist/src/models/index.js +22 -0
  274. package/dist/src/models/model-capabilities.v1.json +120 -0
  275. package/dist/src/models/model-catalog.v1.json +96 -0
  276. package/dist/src/models/model-discovery.js +521 -0
  277. package/dist/src/models/provider-models.js +73 -0
  278. package/dist/src/models/provider-policy.js +273 -0
  279. package/dist/src/models/resolver.js +245 -0
  280. package/dist/src/models/router.js +70 -0
  281. package/dist/src/models/types.js +8 -0
  282. package/dist/src/models/wrapper-deployment.js +178 -0
  283. package/dist/src/models/wrapper-route.js +54 -0
  284. package/dist/src/ops/cli.js +268 -0
  285. package/dist/src/ops/registry.js +623 -0
  286. package/dist/src/packages/adapters/clawhub.js +113 -0
  287. package/dist/src/packages/adapters/git.js +153 -0
  288. package/dist/src/packages/adapters/gitea.js +93 -0
  289. package/dist/src/packages/adapters/github.js +69 -0
  290. package/dist/src/packages/adapters/local-cache.js +89 -0
  291. package/dist/src/packages/package-registry.js +143 -0
  292. package/dist/src/packages/registry.js +238 -0
  293. package/dist/src/packages/types.js +11 -0
  294. package/dist/src/plugin/cross-framework-ops.js +475 -0
  295. package/dist/src/plugin/framework-config-loader.js +235 -0
  296. package/dist/src/plugin/framework-detector.js +186 -0
  297. package/dist/src/plugin/framework-isolator.js +341 -0
  298. package/dist/src/plugin/framework-migration.js +371 -0
  299. package/dist/src/plugin/metadata-validator.js +906 -0
  300. package/dist/src/plugin/plugin-installer.js +436 -0
  301. package/dist/src/plugin/plugin-status.js +369 -0
  302. package/dist/src/plugin/plugin-uninstaller.js +473 -0
  303. package/dist/src/plugin/registry-validator.js +344 -0
  304. package/dist/src/plugin/skill-command-translator.js +415 -0
  305. package/dist/src/plugin/workspace-creator.js +189 -0
  306. package/dist/src/plugin/workspace-migrator.js +821 -0
  307. package/dist/src/policy/authorization.js +390 -0
  308. package/dist/src/policy/repo-access.js +215 -0
  309. package/dist/src/provenance/cli.js +16 -0
  310. package/dist/src/providers/capability-matrix.js +300 -0
  311. package/dist/src/providers/capability-matrix.yaml +514 -0
  312. package/dist/src/providers/provider-definitions.js +977 -0
  313. package/dist/src/providers/provider-definitions.mjs +159 -0
  314. package/dist/src/providers/provider-inventory.js +169 -0
  315. package/dist/src/quality/feedback-ab.js +174 -0
  316. package/dist/src/quality/feedback-collector.js +176 -0
  317. package/dist/src/quality/feedback-tracker.js +123 -0
  318. package/dist/src/quality/patterns/adr.json +24 -0
  319. package/dist/src/quality/patterns/sad.json +24 -0
  320. package/dist/src/quality/patterns/test-plan.json +24 -0
  321. package/dist/src/quality/patterns/use-case.json +24 -0
  322. package/dist/src/quality/scoring.js +157 -0
  323. package/dist/src/reflections/cli.js +15 -0
  324. package/dist/src/release/plan.js +139 -0
  325. package/dist/src/research/cache/manager.js +227 -0
  326. package/dist/src/research/clients/arxiv.js +156 -0
  327. package/dist/src/research/clients/base.js +197 -0
  328. package/dist/src/research/clients/crossref.js +112 -0
  329. package/dist/src/research/clients/semantic-scholar.js +126 -0
  330. package/dist/src/research/clients/unpaywall.js +87 -0
  331. package/dist/src/research/index.js +14 -0
  332. package/dist/src/research/query-cli.js +336 -0
  333. package/dist/src/research/services/acquisition.js +313 -0
  334. package/dist/src/research/services/archival.js +225 -0
  335. package/dist/src/research/services/citation.js +279 -0
  336. package/dist/src/research/services/discovery.js +243 -0
  337. package/dist/src/research/services/documentation.js +269 -0
  338. package/dist/src/research/services/index.js +14 -0
  339. package/dist/src/research/services/provenance.js +279 -0
  340. package/dist/src/research/services/quality.js +370 -0
  341. package/dist/src/research/services/types.js +7 -0
  342. package/dist/src/research/storage-cli.js +20 -0
  343. package/dist/src/research/types.js +47 -0
  344. package/dist/src/resources/index.d.ts +2 -0
  345. package/dist/src/resources/index.js +2 -0
  346. package/dist/src/resources/web-release.d.ts +89 -0
  347. package/dist/src/resources/web-release.js +886 -0
  348. package/dist/src/rlm/cache/cli.js +162 -0
  349. package/dist/src/rlm/cache/hash.js +35 -0
  350. package/dist/src/rlm/cache/store.js +170 -0
  351. package/dist/src/rlm/cache/types.js +8 -0
  352. package/dist/src/rlm/cli.js +650 -0
  353. package/dist/src/serve/a2a-terminal-observer.js +120 -0
  354. package/dist/src/serve/agent-router.js +205 -0
  355. package/dist/src/serve/dispatch-router.js +171 -0
  356. package/dist/src/serve/executor-registry.js +715 -0
  357. package/dist/src/serve/mission-conductor.js +177 -0
  358. package/dist/src/serve/orchestrator-adapter.js +113 -0
  359. package/dist/src/serve/orchestrator-override.js +94 -0
  360. package/dist/src/serve/orchestrator-pty.js +133 -0
  361. package/dist/src/serve/pty-bridge.js +799 -0
  362. package/dist/src/serve/sandbox-registry.js +832 -0
  363. package/dist/src/serve/screen-reader.js +228 -0
  364. package/dist/src/serve/stack-adapters.js +68 -0
  365. package/dist/src/serve/telemetry.js +143 -0
  366. package/dist/src/skills/adapters/clawhub.js +250 -0
  367. package/dist/src/skills/adapters/local.js +335 -0
  368. package/dist/src/skills/adapters/openclaw.js +316 -0
  369. package/dist/src/skills/cli.js +334 -0
  370. package/dist/src/skills/registry.js +117 -0
  371. package/dist/src/skills/run.js +259 -0
  372. package/dist/src/skills/runtime.js +94 -0
  373. package/dist/src/skills/types.js +10 -0
  374. package/dist/src/smiths/agentsmith/demo.js +116 -0
  375. package/dist/src/smiths/agentsmith/examples.js +300 -0
  376. package/dist/src/smiths/agentsmith/generator.js +503 -0
  377. package/dist/src/smiths/agentsmith/index.js +11 -0
  378. package/dist/src/smiths/agentsmith/types.js +8 -0
  379. package/dist/src/smiths/commandsmith/example.js +220 -0
  380. package/dist/src/smiths/commandsmith/generator.js +288 -0
  381. package/dist/src/smiths/commandsmith/index.js +41 -0
  382. package/dist/src/smiths/commandsmith/templates.js +296 -0
  383. package/dist/src/smiths/commandsmith/types.js +7 -0
  384. package/dist/src/smiths/context-pipeline/aiwg-md.js +104 -0
  385. package/dist/src/smiths/context-pipeline/allowlist.js +195 -0
  386. package/dist/src/smiths/context-pipeline/claude-hook.js +127 -0
  387. package/dist/src/smiths/context-pipeline/discovery.js +187 -0
  388. package/dist/src/smiths/context-pipeline/external-links-section.js +49 -0
  389. package/dist/src/smiths/context-pipeline/finalization.js +147 -0
  390. package/dist/src/smiths/context-pipeline/generator.js +477 -0
  391. package/dist/src/smiths/context-pipeline/index.js +30 -0
  392. package/dist/src/smiths/context-pipeline/legacy-inject.js +103 -0
  393. package/dist/src/smiths/context-pipeline/managed-hook.js +95 -0
  394. package/dist/src/smiths/context-pipeline/overflow.js +212 -0
  395. package/dist/src/smiths/context-pipeline/parallelism-section.js +94 -0
  396. package/dist/src/smiths/context-pipeline/provider-policy.js +64 -0
  397. package/dist/src/smiths/context-pipeline/sanitizer.js +93 -0
  398. package/dist/src/smiths/context-pipeline/types.js +23 -0
  399. package/dist/src/smiths/context-pipeline/workspace-context.js +988 -0
  400. package/dist/src/smiths/hook-bridge/codex-translator.js +129 -0
  401. package/dist/src/smiths/hook-bridge/copilot-translator.js +64 -0
  402. package/dist/src/smiths/hook-bridge/factory-translator.js +43 -0
  403. package/dist/src/smiths/hook-bridge/hermes-translator.js +88 -0
  404. package/dist/src/smiths/hook-bridge/index.js +79 -0
  405. package/dist/src/smiths/hook-bridge/loader.js +116 -0
  406. package/dist/src/smiths/hook-bridge/shim.js +89 -0
  407. package/dist/src/smiths/hook-bridge/types.js +31 -0
  408. package/dist/src/smiths/index.js +39 -0
  409. package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +390 -0
  410. package/dist/src/smiths/mcpsmith/example.js +119 -0
  411. package/dist/src/smiths/mcpsmith/generator.js +236 -0
  412. package/dist/src/smiths/mcpsmith/index.js +17 -0
  413. package/dist/src/smiths/mcpsmith/types.js +10 -0
  414. package/dist/src/smiths/platform-paths.js +101 -0
  415. package/dist/src/smiths/skillsmith/codex-sidecar.js +85 -0
  416. package/dist/src/smiths/skillsmith/collision-detector.js +249 -0
  417. package/dist/src/smiths/skillsmith/demo.js +83 -0
  418. package/dist/src/smiths/skillsmith/examples.js +161 -0
  419. package/dist/src/smiths/skillsmith/generator.js +316 -0
  420. package/dist/src/smiths/skillsmith/index.js +12 -0
  421. package/dist/src/smiths/skillsmith/namespace-adapter.js +180 -0
  422. package/dist/src/smiths/skillsmith/platform-resolver.js +157 -0
  423. package/dist/src/smiths/skillsmith/types.js +9 -0
  424. package/dist/src/smiths/toolsmith/index.js +10 -0
  425. package/dist/src/smiths/toolsmith/runtime-discovery.mjs +710 -0
  426. package/dist/src/smiths/toolsmith/types.js +8 -0
  427. package/dist/src/storage/backends/fortemi.js +227 -0
  428. package/dist/src/storage/backends/fs.js +134 -0
  429. package/dist/src/storage/backends/logseq.js +309 -0
  430. package/dist/src/storage/backends/obsidian.js +233 -0
  431. package/dist/src/storage/cli.js +468 -0
  432. package/dist/src/storage/config.js +272 -0
  433. package/dist/src/storage/index.js +108 -0
  434. package/dist/src/storage/subsystem-cli.js +201 -0
  435. package/dist/src/storage/types.js +33 -0
  436. package/dist/src/testing/corpus/corpus-builder.js +383 -0
  437. package/dist/src/testing/corpus/ground-truth-manager.js +460 -0
  438. package/dist/src/testing/corpus/index.js +10 -0
  439. package/dist/src/testing/fixtures/index.js +9 -0
  440. package/dist/src/testing/fixtures/test-data-factory.js +472 -0
  441. package/dist/src/testing/generators/index.js +11 -0
  442. package/dist/src/testing/generators/test-case-generator.js +393 -0
  443. package/dist/src/testing/generators/test-code-generator.js +384 -0
  444. package/dist/src/testing/generators/use-case-parser.js +325 -0
  445. package/dist/src/testing/index.js +11 -0
  446. package/dist/src/tracker/capability-protocol.js +118 -0
  447. package/dist/src/update/checker.mjs +396 -0
  448. package/dist/src/update/notifier.mjs +235 -0
  449. package/dist/src/writing/content-diversifier.js +804 -0
  450. package/dist/src/writing/example-generator.js +959 -0
  451. package/dist/src/writing/example-templates.js +99 -0
  452. package/dist/src/writing/pattern-library.js +486 -0
  453. package/dist/src/writing/patterns/banned-phrases.json +4413 -0
  454. package/dist/src/writing/patterns/formulaic-structures.json +1300 -0
  455. package/dist/src/writing/patterns/generic-adjectives.json +1510 -0
  456. package/dist/src/writing/patterns/hedging-language.json +2096 -0
  457. package/dist/src/writing/patterns/transition-words.json +1285 -0
  458. package/dist/src/writing/patterns/weak-verbs.json +1112 -0
  459. package/dist/src/writing/prompt-optimizer.js +660 -0
  460. package/dist/src/writing/prompt-templates.js +583 -0
  461. package/dist/src/writing/scoring-config-loader.js +168 -0
  462. package/dist/src/writing/validation-engine.js +595 -0
  463. package/dist/src/writing/validation-rules.js +380 -0
  464. package/dist/src/writing/voice-analyzer.js +439 -0
  465. package/dist/src/writing/voice-calibration.js +661 -0
  466. package/dist/src/writing/voice-profiles.json +588 -0
  467. package/package.json +65 -9
@@ -0,0 +1,364 @@
1
+ /**
2
+ * Lint Runner
3
+ *
4
+ * Core lint execution engine. Matches rules to files,
5
+ * runs checks, and collects diagnostics.
6
+ *
7
+ * @issue #810
8
+ */
9
+ import fs from 'fs';
10
+ import fsp from 'fs/promises';
11
+ import path from 'path';
12
+ import { glob } from 'glob';
13
+ import { minimatch } from 'minimatch';
14
+ /**
15
+ * Parse YAML-style frontmatter from a markdown file
16
+ * Returns key-value pairs from the --- delimited block
17
+ */
18
+ function parseFrontmatter(content) {
19
+ const match = content.match(/^---\n([\s\S]*?)\n---/);
20
+ if (!match)
21
+ return {};
22
+ const result = {};
23
+ for (const line of match[1].split('\n')) {
24
+ const kv = line.match(/^(\w[\w-]*)\s*:\s*(.+)$/);
25
+ if (kv) {
26
+ result[kv[1]] = kv[2].trim().replace(/^["']|["']$/g, '');
27
+ }
28
+ }
29
+ return result;
30
+ }
31
+ const DEFAULT_REFERENCE_PATTERN = '\\bREF-\\d{3,}\\b';
32
+ /**
33
+ * Build a target-wide artifact ID index once per lint run.
34
+ *
35
+ * Reference documents may use either an exact filename (`REF-001.md`) or the
36
+ * canonical slugged form (`REF-001-some-title.md`). Indexing the ID prefix also
37
+ * makes resolution independent of a particular corpus directory layout.
38
+ */
39
+ function buildReferenceIndex(allFiles) {
40
+ const references = new Set();
41
+ for (const file of allFiles) {
42
+ if (path.extname(file).toLowerCase() !== '.md')
43
+ continue;
44
+ const basename = path.basename(file, '.md');
45
+ if (/^REF-\d+-(?:citations|radar)$/.test(basename))
46
+ continue;
47
+ references.add(basename);
48
+ const artifactId = basename.match(/^(.+?-\d+)(?:-|$)/);
49
+ if (artifactId)
50
+ references.add(artifactId[1]);
51
+ }
52
+ return references;
53
+ }
54
+ /**
55
+ * Preserve support for references stored outside the lint target when a rule
56
+ * explicitly supplies basePath. Accept both exact and slugged filenames.
57
+ */
58
+ function resolvesFromBasePath(refId, targetDir, basePath) {
59
+ const candidateDirs = new Set([
60
+ path.resolve(targetDir, basePath),
61
+ path.resolve(process.cwd(), basePath),
62
+ ]);
63
+ for (const dir of candidateDirs) {
64
+ try {
65
+ if (fs.existsSync(path.join(dir, `${refId}.md`)))
66
+ return true;
67
+ if (fs.readdirSync(dir).some(file => file.startsWith(`${refId}-`) && file.endsWith('.md'))) {
68
+ return true;
69
+ }
70
+ }
71
+ catch {
72
+ // Missing or unreadable candidate directories do not resolve the ID.
73
+ }
74
+ }
75
+ return false;
76
+ }
77
+ /**
78
+ * Run a single check against a file's content and frontmatter
79
+ */
80
+ function runCheck(check, content, frontmatter, filePath, targetDir, allFiles, referenceIndex) {
81
+ const diagnostics = [];
82
+ switch (check.type) {
83
+ case 'frontmatter-required': {
84
+ if (!check.fields)
85
+ break;
86
+ for (const field of check.fields) {
87
+ if (!frontmatter[field] || frontmatter[field].trim() === '') {
88
+ diagnostics.push({
89
+ ruleId: '',
90
+ ruleName: '',
91
+ severity: 'error',
92
+ file: filePath,
93
+ message: `Missing required frontmatter field: ${field}`,
94
+ fix: `Add '${field}:' to the YAML frontmatter block`,
95
+ });
96
+ }
97
+ }
98
+ break;
99
+ }
100
+ case 'frontmatter-format': {
101
+ if (!check.field || !check.pattern)
102
+ break;
103
+ const value = frontmatter[check.field];
104
+ if (value && !new RegExp(check.pattern).test(value)) {
105
+ diagnostics.push({
106
+ ruleId: '',
107
+ ruleName: '',
108
+ severity: 'warn',
109
+ file: filePath,
110
+ message: `Frontmatter field '${check.field}' value '${value}' does not match pattern: ${check.pattern}`,
111
+ fix: `Update '${check.field}' to match the expected format`,
112
+ });
113
+ }
114
+ break;
115
+ }
116
+ case 'reference-resolves': {
117
+ const refPattern = check.referencePattern || DEFAULT_REFERENCE_PATTERN;
118
+ const regex = new RegExp(refPattern, 'g');
119
+ const lines = content.split('\n');
120
+ for (let i = 0; i < lines.length; i++) {
121
+ let match;
122
+ while ((match = regex.exec(lines[i])) !== null) {
123
+ const refId = match[0];
124
+ const basePath = check.basePath || '.aiwg/research/findings';
125
+ if (!referenceIndex.has(refId) && !resolvesFromBasePath(refId, targetDir, basePath)) {
126
+ diagnostics.push({
127
+ ruleId: '',
128
+ ruleName: '',
129
+ severity: 'error',
130
+ file: filePath,
131
+ message: `Reference '${refId}' does not resolve to an existing file`,
132
+ line: i + 1,
133
+ });
134
+ }
135
+ }
136
+ }
137
+ break;
138
+ }
139
+ case 'pattern-match': {
140
+ if (!check.pattern)
141
+ break;
142
+ const regex = new RegExp(check.pattern);
143
+ if (!regex.test(content)) {
144
+ diagnostics.push({
145
+ ruleId: '',
146
+ ruleName: '',
147
+ severity: 'warn',
148
+ file: filePath,
149
+ message: `File content does not match expected pattern: ${check.pattern}`,
150
+ });
151
+ }
152
+ break;
153
+ }
154
+ case 'file-exists': {
155
+ if (!check.field)
156
+ break;
157
+ const refPath = frontmatter[check.field];
158
+ if (refPath) {
159
+ const resolved = path.resolve(targetDir, refPath);
160
+ if (!fs.existsSync(resolved)) {
161
+ diagnostics.push({
162
+ ruleId: '',
163
+ ruleName: '',
164
+ severity: 'error',
165
+ file: filePath,
166
+ message: `Referenced file '${refPath}' (from field '${check.field}') does not exist`,
167
+ });
168
+ }
169
+ }
170
+ break;
171
+ }
172
+ case 'id-unique': {
173
+ // Handled at ruleset level in runRule
174
+ break;
175
+ }
176
+ case 'id-format': {
177
+ if (!check.pattern)
178
+ break;
179
+ const basename = path.basename(filePath, '.md');
180
+ if (!new RegExp(check.pattern).test(basename)) {
181
+ diagnostics.push({
182
+ ruleId: '',
183
+ ruleName: '',
184
+ severity: 'warn',
185
+ file: filePath,
186
+ message: `File name '${basename}' does not match expected format: ${check.pattern}`,
187
+ fix: `Rename to match the pattern ${check.pattern}`,
188
+ });
189
+ }
190
+ break;
191
+ }
192
+ case 'cross-ref-bidirectional': {
193
+ const refPattern = check.referencePattern || DEFAULT_REFERENCE_PATTERN;
194
+ const regex = new RegExp(refPattern, 'g');
195
+ const currentBasename = path.basename(filePath, '.md');
196
+ const matches = content.match(regex) || [];
197
+ for (const ref of matches) {
198
+ if (ref === currentBasename)
199
+ continue;
200
+ // Find the referenced file
201
+ const refFile = allFiles.find(f => path.basename(f, '.md') === ref);
202
+ if (refFile) {
203
+ try {
204
+ const refContent = fs.readFileSync(path.resolve(targetDir, refFile), 'utf8');
205
+ if (!refContent.includes(currentBasename)) {
206
+ diagnostics.push({
207
+ ruleId: '',
208
+ ruleName: '',
209
+ severity: 'info',
210
+ file: filePath,
211
+ message: `References '${ref}' but '${ref}' does not reference back to '${currentBasename}'`,
212
+ fix: `Add a cross-reference to '${currentBasename}' in ${ref}.md`,
213
+ });
214
+ }
215
+ }
216
+ catch {
217
+ // Skip if can't read
218
+ }
219
+ }
220
+ }
221
+ break;
222
+ }
223
+ }
224
+ return diagnostics;
225
+ }
226
+ /**
227
+ * Run a single rule against all matching files in the target
228
+ */
229
+ async function runRule(rule, targetDir, allFiles, referenceIndex) {
230
+ const diagnostics = [];
231
+ // Filter files matching the rule's glob
232
+ const ruleGlob = rule.appliesTo.glob;
233
+ const matchingFiles = allFiles.filter(f => minimatch(f, ruleGlob));
234
+ if (matchingFiles.length === 0)
235
+ return diagnostics;
236
+ // Handle id-unique check at the ruleset level
237
+ const uniqueCheck = rule.checks.find(c => c.type === 'id-unique');
238
+ if (uniqueCheck) {
239
+ const ids = new Map();
240
+ for (const file of matchingFiles) {
241
+ const basename = path.basename(file, '.md');
242
+ if (ids.has(basename)) {
243
+ diagnostics.push({
244
+ ruleId: rule.id,
245
+ ruleName: rule.name,
246
+ severity: rule.severity,
247
+ file,
248
+ message: `Duplicate identifier '${basename}' — also found in ${ids.get(basename)}`,
249
+ });
250
+ }
251
+ else {
252
+ ids.set(basename, file);
253
+ }
254
+ }
255
+ }
256
+ // Run per-file checks
257
+ for (const file of matchingFiles) {
258
+ const absPath = path.resolve(targetDir, file);
259
+ let content;
260
+ try {
261
+ content = await fsp.readFile(absPath, 'utf8');
262
+ }
263
+ catch {
264
+ continue;
265
+ }
266
+ const frontmatter = parseFrontmatter(content);
267
+ for (const check of rule.checks) {
268
+ if (check.type === 'id-unique')
269
+ continue; // Already handled
270
+ const checkDiagnostics = runCheck(check, content, frontmatter, file, targetDir, allFiles, referenceIndex);
271
+ for (const d of checkDiagnostics) {
272
+ d.ruleId = rule.id;
273
+ d.ruleName = rule.name;
274
+ d.severity = d.severity || rule.severity;
275
+ diagnostics.push(d);
276
+ }
277
+ }
278
+ }
279
+ return diagnostics;
280
+ }
281
+ /**
282
+ * Collect all files under a target directory
283
+ */
284
+ async function collectFiles(targetDir, recursive) {
285
+ const pattern = recursive ? '**/*' : '*';
286
+ try {
287
+ const files = await glob(pattern, {
288
+ cwd: targetDir,
289
+ nodir: true,
290
+ dot: false,
291
+ });
292
+ return files.filter(f => f.endsWith('.md') || f.endsWith('.yaml') || f.endsWith('.yml') || f.endsWith('.json'));
293
+ }
294
+ catch {
295
+ return [];
296
+ }
297
+ }
298
+ /**
299
+ * Auto-detect which rulesets apply to a target path
300
+ *
301
+ * Maps known directory patterns to rulesets:
302
+ * - .aiwg/research/ → research-complete
303
+ * - .aiwg/requirements/, .aiwg/architecture/ → sdlc-complete
304
+ */
305
+ function autoDetectRulesets(target, available) {
306
+ const normalized = target.replace(/\\/g, '/');
307
+ const matches = [];
308
+ for (const rs of available) {
309
+ // Match by framework ID patterns
310
+ if (normalized.includes('research') && rs.framework.includes('research')) {
311
+ matches.push(rs);
312
+ }
313
+ else if ((normalized.includes('requirements') ||
314
+ normalized.includes('architecture') ||
315
+ normalized.includes('testing') ||
316
+ normalized.includes('deployment')) &&
317
+ rs.framework.includes('sdlc')) {
318
+ matches.push(rs);
319
+ }
320
+ }
321
+ // If no auto-detection, return all available
322
+ return matches.length > 0 ? matches : available;
323
+ }
324
+ /**
325
+ * Run lint on a target path with specified or auto-detected rulesets
326
+ */
327
+ export async function runLint(targetDir, rulesets, options = {}) {
328
+ const recursive = options.recursive ?? true;
329
+ const allFiles = await collectFiles(targetDir, recursive);
330
+ const referenceIndex = buildReferenceIndex(allFiles);
331
+ const allDiagnostics = [];
332
+ for (const ruleset of rulesets) {
333
+ for (const rule of ruleset.rules) {
334
+ const diagnostics = await runRule(rule, targetDir, allFiles, referenceIndex);
335
+ allDiagnostics.push(...diagnostics);
336
+ }
337
+ }
338
+ const errors = allDiagnostics.filter(d => d.severity === 'error').length;
339
+ const warnings = allDiagnostics.filter(d => d.severity === 'warn').length;
340
+ const infos = allDiagnostics.filter(d => d.severity === 'info').length;
341
+ const failOn = options.failOn || 'error';
342
+ let passed = true;
343
+ if (failOn === 'error' && errors > 0)
344
+ passed = false;
345
+ if (failOn === 'warn' && (errors > 0 || warnings > 0))
346
+ passed = false;
347
+ if (failOn === 'info' && allDiagnostics.length > 0)
348
+ passed = false;
349
+ return {
350
+ target: targetDir,
351
+ rulesets: rulesets.map(r => r.id),
352
+ diagnostics: allDiagnostics,
353
+ summary: {
354
+ filesChecked: allFiles.length,
355
+ errors,
356
+ warnings,
357
+ infos,
358
+ passed,
359
+ },
360
+ timestamp: new Date().toISOString(),
361
+ };
362
+ }
363
+ export { autoDetectRulesets };
364
+ //# sourceMappingURL=runner.js.map
@@ -0,0 +1,10 @@
1
+ /**
2
+ * Lint System Types
3
+ *
4
+ * Defines interfaces for lint rules, rulesets, results, and configuration.
5
+ * Rules are declarative YAML; the runner evaluates them against target files.
6
+ *
7
+ * @issue #810
8
+ */
9
+ export {};
10
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1,110 @@
1
+ /**
2
+ * Marketplace Local Cache
3
+ *
4
+ * Manages the ~/.aiwg/marketplace-cache/ directory that stores fetched plugins.
5
+ *
6
+ * Layout: ~/.aiwg/marketplace-cache/<source>/<packageId>/<version>/
7
+ *
8
+ * @implements #787
9
+ */
10
+ import fs from 'fs';
11
+ import path from 'path';
12
+ import os from 'os';
13
+ /**
14
+ * Resolve the cache root. Supports AIWG_CACHE_DIR override for testing.
15
+ */
16
+ export function getCacheRoot() {
17
+ if (process.env.AIWG_CACHE_DIR) {
18
+ return process.env.AIWG_CACHE_DIR;
19
+ }
20
+ return path.join(os.homedir(), '.aiwg', 'marketplace-cache');
21
+ }
22
+ /**
23
+ * Resolve the path for a specific package version
24
+ */
25
+ export function getPackagePath(source, packageId, version) {
26
+ // Sanitize package ID for filesystem safety (replace / and : with -)
27
+ const safePackageId = packageId.replace(/[/:]/g, '__');
28
+ return path.join(getCacheRoot(), source, safePackageId, version);
29
+ }
30
+ /**
31
+ * Check whether a package version is cached
32
+ */
33
+ export function isCached(source, packageId, version) {
34
+ const packagePath = getPackagePath(source, packageId, version);
35
+ const manifestPath = path.join(packagePath, 'manifest.json');
36
+ return fs.existsSync(manifestPath);
37
+ }
38
+ /**
39
+ * Write a package bundle to the cache
40
+ */
41
+ export function cachePackage(bundle) {
42
+ const packagePath = getPackagePath(bundle.metadata.source, bundle.metadata.name, bundle.metadata.version);
43
+ fs.mkdirSync(packagePath, { recursive: true });
44
+ // Write normalized manifest
45
+ fs.writeFileSync(path.join(packagePath, 'manifest.json'), JSON.stringify(bundle.metadata, null, 2) + '\n', 'utf-8');
46
+ // Write raw source manifest for update detection
47
+ fs.writeFileSync(path.join(packagePath, 'raw-manifest.json'), JSON.stringify(bundle.rawManifest, null, 2) + '\n', 'utf-8');
48
+ // Note: actual artifact files are expected to be in bundle.localPath already;
49
+ // in a complete implementation we'd copy them into packagePath here.
50
+ return packagePath;
51
+ }
52
+ export function listCachedPackages() {
53
+ const root = getCacheRoot();
54
+ if (!fs.existsSync(root))
55
+ return [];
56
+ const entries = [];
57
+ // Walk <source>/<packageId>/<version>/manifest.json
58
+ const sources = fs.readdirSync(root);
59
+ for (const source of sources) {
60
+ const sourcePath = path.join(root, source);
61
+ if (!fs.statSync(sourcePath).isDirectory())
62
+ continue;
63
+ const packages = fs.readdirSync(sourcePath);
64
+ for (const pkg of packages) {
65
+ const pkgPath = path.join(sourcePath, pkg);
66
+ if (!fs.statSync(pkgPath).isDirectory())
67
+ continue;
68
+ const versions = fs.readdirSync(pkgPath);
69
+ for (const version of versions) {
70
+ const manifestPath = path.join(pkgPath, version, 'manifest.json');
71
+ if (!fs.existsSync(manifestPath))
72
+ continue;
73
+ try {
74
+ const metadata = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
75
+ const stat = fs.statSync(manifestPath);
76
+ entries.push({
77
+ source: source,
78
+ packageId: pkg.replace(/__/g, '/'),
79
+ version,
80
+ cachedAt: stat.mtime,
81
+ metadata,
82
+ });
83
+ }
84
+ catch {
85
+ // Skip malformed entries
86
+ }
87
+ }
88
+ }
89
+ }
90
+ return entries;
91
+ }
92
+ /**
93
+ * Remove a specific cached package (all versions or a specific one)
94
+ */
95
+ export function uncachePackage(source, packageId, version) {
96
+ const safePackageId = packageId.replace(/[/:]/g, '__');
97
+ const pkgPath = path.join(getCacheRoot(), source, safePackageId);
98
+ if (version) {
99
+ const versionPath = path.join(pkgPath, version);
100
+ if (!fs.existsSync(versionPath))
101
+ return false;
102
+ fs.rmSync(versionPath, { recursive: true, force: true });
103
+ return true;
104
+ }
105
+ if (!fs.existsSync(pkgPath))
106
+ return false;
107
+ fs.rmSync(pkgPath, { recursive: true, force: true });
108
+ return true;
109
+ }
110
+ //# sourceMappingURL=cache.js.map
@@ -0,0 +1,63 @@
1
+ /**
2
+ * Source Identifier Parser
3
+ *
4
+ * Parses marketplace source identifiers of the form `<source>:<package>[@<version>]`.
5
+ *
6
+ * @implements #787
7
+ */
8
+ const VALID_SOURCES = [
9
+ 'clawhub',
10
+ 'cursor',
11
+ 'codex',
12
+ 'claude',
13
+ 'git',
14
+ ];
15
+ /**
16
+ * Parse a marketplace source identifier.
17
+ *
18
+ * Examples:
19
+ * "clawhub:aiwg/sdlc" → { source: 'clawhub', packageId: 'aiwg/sdlc' }
20
+ * "cursor:publisher.package" → { source: 'cursor', packageId: 'publisher.package' }
21
+ * "codex:some-plugin@1.2.0" → { source: 'codex', packageId: 'some-plugin', version: '1.2.0' }
22
+ * "claude:user/repo#plugin" → { source: 'claude', packageId: 'user/repo#plugin' }
23
+ * "git:https://github.com/foo/bar" → { source: 'git', packageId: 'https://github.com/foo/bar' }
24
+ *
25
+ * @throws Error if the identifier is malformed or the source is unknown
26
+ */
27
+ export function parseIdentifier(identifier) {
28
+ // Split on first colon; the rest is the package id (may contain colons for git URLs)
29
+ const colonIdx = identifier.indexOf(':');
30
+ if (colonIdx === -1) {
31
+ throw new Error(`Invalid marketplace identifier '${identifier}'. Expected format: <source>:<package>[@<version>]`);
32
+ }
33
+ const source = identifier.slice(0, colonIdx).trim().toLowerCase();
34
+ let packageId = identifier.slice(colonIdx + 1).trim();
35
+ if (!VALID_SOURCES.includes(source)) {
36
+ throw new Error(`Unknown marketplace source '${source}'. Valid sources: ${VALID_SOURCES.join(', ')}`);
37
+ }
38
+ // Extract optional @version suffix (but not for git URLs which can contain @)
39
+ let version;
40
+ if (source !== 'git') {
41
+ const atIdx = packageId.lastIndexOf('@');
42
+ if (atIdx > 0) {
43
+ version = packageId.slice(atIdx + 1).trim();
44
+ packageId = packageId.slice(0, atIdx).trim();
45
+ }
46
+ }
47
+ if (!packageId) {
48
+ throw new Error(`Empty package id in identifier '${identifier}'`);
49
+ }
50
+ return {
51
+ source: source,
52
+ packageId,
53
+ version,
54
+ };
55
+ }
56
+ /**
57
+ * Format a parsed identifier back to string form
58
+ */
59
+ export function formatIdentifier(parsed) {
60
+ const base = `${parsed.source}:${parsed.packageId}`;
61
+ return parsed.version ? `${base}@${parsed.version}` : base;
62
+ }
63
+ //# sourceMappingURL=identifier.js.map
@@ -0,0 +1,36 @@
1
+ /**
2
+ * Marketplace Source Registry
3
+ *
4
+ * Registers marketplace source adapters and resolves a parsed identifier
5
+ * to its adapter.
6
+ *
7
+ * @implements #787
8
+ */
9
+ import { ClawHubSource } from './sources/clawhub.js';
10
+ import { GitSource } from './sources/git.js';
11
+ /**
12
+ * Registered source adapters keyed by source id.
13
+ * Additional adapters (cursor, codex, claude) will be registered here as
14
+ * their implementations land.
15
+ */
16
+ const adapters = new Map();
17
+ adapters.set('clawhub', new ClawHubSource());
18
+ adapters.set('git', new GitSource());
19
+ /**
20
+ * Get the adapter for a given source.
21
+ */
22
+ export function getSource(source) {
23
+ const adapter = adapters.get(source);
24
+ if (!adapter) {
25
+ throw new Error(`No adapter registered for marketplace source '${source}'. ` +
26
+ `Registered sources: ${Array.from(adapters.keys()).join(', ')}`);
27
+ }
28
+ return adapter;
29
+ }
30
+ /**
31
+ * List all registered source ids
32
+ */
33
+ export function listRegisteredSources() {
34
+ return Array.from(adapters.keys());
35
+ }
36
+ //# sourceMappingURL=registry.js.map
@@ -0,0 +1,53 @@
1
+ /**
2
+ * ClawHub Source Adapter
3
+ *
4
+ * Fetches plugins from the ClawHub registry. ClawHub is OpenClaw's central
5
+ * package registry.
6
+ *
7
+ * Status: scaffold. Full implementation requires ClawHub API spec or CLI
8
+ * integration.
9
+ *
10
+ * @implements #787
11
+ */
12
+ export class ClawHubSource {
13
+ source = 'clawhub';
14
+ async fetch(packageId, _version) {
15
+ // TODO: invoke ClawHub CLI or HTTP API to fetch the package tarball,
16
+ // extract to a temp directory, parse clawhub.json, and return a
17
+ // normalized PackageBundle. For now, throw with a clear message.
18
+ throw new Error(`ClawHub source adapter is a scaffold. Full implementation pending. ` +
19
+ `Tried to fetch: clawhub:${packageId}`);
20
+ }
21
+ async search(_query, _options) {
22
+ throw new Error('ClawHub search not yet implemented');
23
+ }
24
+ validate(manifest) {
25
+ const errors = [];
26
+ const warnings = [];
27
+ if (typeof manifest !== 'object' || manifest === null) {
28
+ return { valid: false, errors: ['Manifest is not an object'], warnings };
29
+ }
30
+ const m = manifest;
31
+ // Required fields per ClawHub spec
32
+ if (typeof m.name !== 'string')
33
+ errors.push('Missing required field: name');
34
+ if (typeof m.version !== 'string')
35
+ errors.push('Missing required field: version');
36
+ if (typeof m.description !== 'string')
37
+ errors.push('Missing required field: description');
38
+ // Namespace collision check
39
+ if (typeof m.name === 'string' && m.name.startsWith('aiwg-') && m.author !== 'AIWG Contributors') {
40
+ warnings.push(`Package name '${m.name}' uses the aiwg- prefix but is not authored by AIWG. ` +
41
+ `This may cause namespace collisions.`);
42
+ }
43
+ return {
44
+ valid: errors.length === 0,
45
+ errors,
46
+ warnings,
47
+ };
48
+ }
49
+ async getVersions(_packageId) {
50
+ throw new Error('ClawHub getVersions not yet implemented');
51
+ }
52
+ }
53
+ //# sourceMappingURL=clawhub.js.map
@@ -0,0 +1,45 @@
1
+ /**
2
+ * Git (generic) Source Adapter
3
+ *
4
+ * Fetches plugins from any Git URL. Detects the manifest format automatically
5
+ * (looks for .claude-plugin/, .codex-plugin/, .cursor-plugin/, .factory-plugin/,
6
+ * clawhub.json in that order).
7
+ *
8
+ * Status: scaffold. Full implementation requires git-clone integration.
9
+ *
10
+ * @implements #787
11
+ */
12
+ export class GitSource {
13
+ source = 'git';
14
+ async fetch(packageId, _version) {
15
+ // TODO: git clone into a temp dir, detect manifest format, normalize
16
+ throw new Error(`Git source adapter is a scaffold. Full implementation pending. ` +
17
+ `Tried to fetch: git:${packageId}`);
18
+ }
19
+ async search(_query, _options) {
20
+ // Git doesn't have a searchable registry — this is a no-op
21
+ return [];
22
+ }
23
+ validate(manifest) {
24
+ // Generic git manifest validation — accepts any of the known formats
25
+ if (typeof manifest !== 'object' || manifest === null) {
26
+ return { valid: false, errors: ['Manifest is not an object'], warnings: [] };
27
+ }
28
+ const m = manifest;
29
+ const errors = [];
30
+ if (typeof m.name !== 'string')
31
+ errors.push('Missing required field: name');
32
+ if (typeof m.version !== 'string')
33
+ errors.push('Missing required field: version');
34
+ return {
35
+ valid: errors.length === 0,
36
+ errors,
37
+ warnings: [],
38
+ };
39
+ }
40
+ async getVersions(_packageId) {
41
+ // Git "versions" would be tags or SHA references — requires git ls-remote
42
+ throw new Error('Git getVersions not yet implemented');
43
+ }
44
+ }
45
+ //# sourceMappingURL=git.js.map
@@ -0,0 +1,9 @@
1
+ /**
2
+ * Marketplace Consumer Types
3
+ *
4
+ * Interfaces for third-party marketplace plugin ingestion.
5
+ *
6
+ * @implements #787
7
+ */
8
+ export {};
9
+ //# sourceMappingURL=types.js.map