@aiwg/cli 0.0.0-bootstrap.0 → 2026.7.17
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +21 -1
- package/bin/aiwg.mjs +349 -0
- package/dist/src/a2a/agent-card.js +145 -0
- package/dist/src/a2a/client.js +411 -0
- package/dist/src/a2a/hitl-cli.js +171 -0
- package/dist/src/a2a/hitl-driver.js +370 -0
- package/dist/src/a2a/hitl.js +181 -0
- package/dist/src/a2a/http.js +193 -0
- package/dist/src/a2a/jcs.js +128 -0
- package/dist/src/a2a/jws.js +187 -0
- package/dist/src/a2a/types.js +24 -0
- package/dist/src/a2a/webhook.js +240 -0
- package/dist/src/activity-log/cli.js +348 -0
- package/dist/src/activity-log/parser.js +81 -0
- package/dist/src/activity-log/types.js +50 -0
- package/dist/src/agents/agent-deployer.js +367 -0
- package/dist/src/agents/agent-packager.js +271 -0
- package/dist/src/agents/agent-validator.js +271 -0
- package/dist/src/agents/grounding/knowledge-base.js +161 -0
- package/dist/src/agents/grounding/types.js +12 -0
- package/dist/src/agents/index.js +10 -0
- package/dist/src/agents/packaged-agent-inventory.js +75 -0
- package/dist/src/agents/types.js +7 -0
- package/dist/src/api/index.d.ts +10 -0
- package/dist/src/api/index.js +10 -0
- package/dist/src/artifacts/address-parser.js +73 -0
- package/dist/src/artifacts/audit/cli.js +183 -0
- package/dist/src/artifacts/audit/drift.js +122 -0
- package/dist/src/artifacts/audit/types.js +12 -0
- package/dist/src/artifacts/backends/graphology-backend.js +160 -0
- package/dist/src/artifacts/backends/json-backend.js +129 -0
- package/dist/src/artifacts/backends/sqlite-backend.js +199 -0
- package/dist/src/artifacts/browser-export.js +622 -0
- package/dist/src/artifacts/capability-resolver.js +94 -0
- package/dist/src/artifacts/checksum-manifest.js +91 -0
- package/dist/src/artifacts/citation-parser.js +162 -0
- package/dist/src/artifacts/cli.js +1462 -0
- package/dist/src/artifacts/corpus-tools/citation-densify.js +311 -0
- package/dist/src/artifacts/corpus-tools/cli.js +393 -0
- package/dist/src/artifacts/corpus-tools/corpus-graph.js +225 -0
- package/dist/src/artifacts/corpus-tools/curator.js +186 -0
- package/dist/src/artifacts/corpus-tools/discovery-log.js +70 -0
- package/dist/src/artifacts/corpus-tools/funder-network.js +141 -0
- package/dist/src/artifacts/corpus-tools/induction-audit.js +233 -0
- package/dist/src/artifacts/corpus-tools/integrity-scan.js +202 -0
- package/dist/src/artifacts/corpus-tools/profile-communities.js +166 -0
- package/dist/src/artifacts/corpus-tools/profile-edges.js +72 -0
- package/dist/src/artifacts/corpus-tools/profile-embed.js +113 -0
- package/dist/src/artifacts/corpus-tools/profile-generate-fm.js +167 -0
- package/dist/src/artifacts/corpus-tools/profile-generate.js +181 -0
- package/dist/src/artifacts/corpus-tools/profile-metrics.js +98 -0
- package/dist/src/artifacts/corpus-tools/profile-status.js +86 -0
- package/dist/src/artifacts/corpus-tools/profile-temporal.js +139 -0
- package/dist/src/artifacts/corpus-tools/radar-init.js +93 -0
- package/dist/src/artifacts/corpus-tools/radar-report.js +118 -0
- package/dist/src/artifacts/corpus-tools/radar-shared.js +189 -0
- package/dist/src/artifacts/corpus-tools/radar-status.js +68 -0
- package/dist/src/artifacts/corpus-tools/sidecar-lint.js +233 -0
- package/dist/src/artifacts/corpus-tools/sidecar-repair.js +277 -0
- package/dist/src/artifacts/corpus-tools/snapshot.js +591 -0
- package/dist/src/artifacts/corpus-tools/source-types.js +164 -0
- package/dist/src/artifacts/corpus-tools/vision-extract.js +243 -0
- package/dist/src/artifacts/corpus-views/build.js +126 -0
- package/dist/src/artifacts/corpus-views/corpus-config.js +124 -0
- package/dist/src/artifacts/corpus-views/ref-parser.js +437 -0
- package/dist/src/artifacts/corpus-views/renderers.js +353 -0
- package/dist/src/artifacts/corpus-views/taxonomies.js +131 -0
- package/dist/src/artifacts/dep-graph.js +173 -0
- package/dist/src/artifacts/discover-facets.js +375 -0
- package/dist/src/artifacts/embedding-index.js +354 -0
- package/dist/src/artifacts/enrichment/cli.js +240 -0
- package/dist/src/artifacts/enrichment/prompt.js +47 -0
- package/dist/src/artifacts/enrichment/store.js +90 -0
- package/dist/src/artifacts/enrichment/types.js +12 -0
- package/dist/src/artifacts/fortemi-core-query-adapter.js +475 -0
- package/dist/src/artifacts/fortemi-core-sync.js +251 -0
- package/dist/src/artifacts/fortemi-shard-export.js +44 -0
- package/dist/src/artifacts/fulltext.js +108 -0
- package/dist/src/artifacts/graph-backend.js +51 -0
- package/dist/src/artifacts/graph-query.js +247 -0
- package/dist/src/artifacts/hybrid-query.js +225 -0
- package/dist/src/artifacts/index-builder.js +1089 -0
- package/dist/src/artifacts/index-reader.js +112 -0
- package/dist/src/artifacts/index-status.js +193 -0
- package/dist/src/artifacts/legacy-index-migration.js +169 -0
- package/dist/src/artifacts/move.js +154 -0
- package/dist/src/artifacts/operational-state.js +239 -0
- package/dist/src/artifacts/prebuilt-build-lock.js +49 -0
- package/dist/src/artifacts/query-engine.js +1955 -0
- package/dist/src/artifacts/source-graph.js +529 -0
- package/dist/src/artifacts/stats.js +169 -0
- package/dist/src/artifacts/types.js +606 -0
- package/dist/src/artifacts/views/cli.js +293 -0
- package/dist/src/artifacts/views/definition.js +170 -0
- package/dist/src/artifacts/views/store.js +149 -0
- package/dist/src/artifacts/views/types.js +8 -0
- package/dist/src/artifacts/watcher.js +255 -0
- package/dist/src/catalog/builtin-models.json +636 -0
- package/dist/src/catalog/cli.js +228 -0
- package/dist/src/catalog/cli.mjs +289 -0
- package/dist/src/catalog/index.js +15 -0
- package/dist/src/catalog/loader.js +217 -0
- package/dist/src/catalog/loader.mjs +251 -0
- package/dist/src/catalog/sources.json +41 -0
- package/dist/src/catalog/types.js +8 -0
- package/dist/src/channel/manager.mjs +504 -0
- package/dist/src/cli/agent-spawn.js +178 -0
- package/dist/src/cli/cli-extension-loader.js +245 -0
- package/dist/src/cli/command-log.js +275 -0
- package/dist/src/cli/config-loader.js +232 -0
- package/dist/src/cli/env.js +82 -0
- package/dist/src/cli/errors.js +150 -0
- package/dist/src/cli/find-package-root.js +40 -0
- package/dist/src/cli/git-hooks.js +250 -0
- package/dist/src/cli/handlers/agentcard.js +206 -0
- package/dist/src/cli/handlers/artifacts.js +76 -0
- package/dist/src/cli/handlers/best-practices-audit.js +280 -0
- package/dist/src/cli/handlers/cockpit.js +137 -0
- package/dist/src/cli/handlers/command-log.js +37 -0
- package/dist/src/cli/handlers/daemon.js +59 -0
- package/dist/src/cli/handlers/diagnose.js +300 -0
- package/dist/src/cli/handlers/execution-mode.js +105 -0
- package/dist/src/cli/handlers/feedback.js +341 -0
- package/dist/src/cli/handlers/help.js +147 -0
- package/dist/src/cli/handlers/index.js +302 -0
- package/dist/src/cli/handlers/init.js +179 -0
- package/dist/src/cli/handlers/install.js +129 -0
- package/dist/src/cli/handlers/issues.js +46 -0
- package/dist/src/cli/handlers/lint.js +42 -0
- package/dist/src/cli/handlers/local-executor.js +315 -0
- package/dist/src/cli/handlers/marketplace.js +168 -0
- package/dist/src/cli/handlers/mc.js +1010 -0
- package/dist/src/cli/handlers/models.js +352 -0
- package/dist/src/cli/handlers/packages.js +155 -0
- package/dist/src/cli/handlers/ralph-launcher.js +717 -0
- package/dist/src/cli/handlers/ralph.js +575 -0
- package/dist/src/cli/handlers/refresh.js +432 -0
- package/dist/src/cli/handlers/regenerate.js +336 -0
- package/dist/src/cli/handlers/repo-access.js +109 -0
- package/dist/src/cli/handlers/run.js +165 -0
- package/dist/src/cli/handlers/runtime-info.js +301 -0
- package/dist/src/cli/handlers/sandbox.js +197 -0
- package/dist/src/cli/handlers/scaffolding.js +149 -0
- package/dist/src/cli/handlers/script-runner.js +121 -0
- package/dist/src/cli/handlers/sdlc-accelerate.js +148 -0
- package/dist/src/cli/handlers/serve.js +1835 -0
- package/dist/src/cli/handlers/session.js +348 -0
- package/dist/src/cli/handlers/setup.js +440 -0
- package/dist/src/cli/handlers/skill-lint.js +367 -0
- package/dist/src/cli/handlers/skill-usage.js +74 -0
- package/dist/src/cli/handlers/steward.js +567 -0
- package/dist/src/cli/handlers/subcommands.js +1702 -0
- package/dist/src/cli/handlers/team.js +337 -0
- package/dist/src/cli/handlers/types.js +11 -0
- package/dist/src/cli/handlers/use.js +2772 -0
- package/dist/src/cli/handlers/utilities.js +703 -0
- package/dist/src/cli/handlers/version.js +134 -0
- package/dist/src/cli/handlers/workspace-context.js +93 -0
- package/dist/src/cli/handlers/workspace.js +126 -0
- package/dist/src/cli/help-generator.js +178 -0
- package/dist/src/cli/hooks/builtin/activity-log-hook.js +126 -0
- package/dist/src/cli/hooks/executor.js +96 -0
- package/dist/src/cli/hooks/index.js +15 -0
- package/dist/src/cli/hooks/registry.js +143 -0
- package/dist/src/cli/hooks/types.js +13 -0
- package/dist/src/cli/log.js +492 -0
- package/dist/src/cli/project-isolation/detect.js +70 -0
- package/dist/src/cli/project-isolation/index.js +7 -0
- package/dist/src/cli/project-isolation/signals.js +17 -0
- package/dist/src/cli/project-isolation/warning.js +102 -0
- package/dist/src/cli/prompt-utils.js +155 -0
- package/dist/src/cli/provider-deployment-plan.js +126 -0
- package/dist/src/cli/provider-resolution.js +119 -0
- package/dist/src/cli/router.js +305 -0
- package/dist/src/cli/scope-resolver.js +392 -0
- package/dist/src/cli/skill-usage.js +616 -0
- package/dist/src/cli/ui.js +224 -0
- package/dist/src/cli/watch-service.js +203 -0
- package/dist/src/cli/workflow-orchestrator.js +478 -0
- package/dist/src/cli/workspace-signals.js +321 -0
- package/dist/src/community/footer.js +14 -0
- package/dist/src/community/links.js +123 -0
- package/dist/src/community/milestones.js +46 -0
- package/dist/src/community/nudge-policy.js +93 -0
- package/dist/src/config/aiwg-config.js +883 -0
- package/dist/src/config/cli.js +703 -0
- package/dist/src/config/gitignore.js +156 -0
- package/dist/src/config/project-artifacts.js +76 -0
- package/dist/src/config/user-config.js +428 -0
- package/dist/src/config/user-registry.js +127 -0
- package/dist/src/config/workspace.js +276 -0
- package/dist/src/contributors/detect.js +39 -0
- package/dist/src/contributors/discover.js +172 -0
- package/dist/src/contributors/heuristic.js +186 -0
- package/dist/src/contributors/index.js +11 -0
- package/dist/src/contributors/types.js +13 -0
- package/dist/src/contributors/validation.js +116 -0
- package/dist/src/data/community.schema.json +43 -0
- package/dist/src/data/community.yaml +16 -0
- package/dist/src/extensions/capability-index.js +270 -0
- package/dist/src/extensions/claude-hooks-installer.js +268 -0
- package/dist/src/extensions/commands/definitions.js +3485 -0
- package/dist/src/extensions/deployment-registration.js +463 -0
- package/dist/src/extensions/index.js +22 -0
- package/dist/src/extensions/loader.js +132 -0
- package/dist/src/extensions/managed-marker.js +100 -0
- package/dist/src/extensions/manifest.js +196 -0
- package/dist/src/extensions/project-local-activity.js +114 -0
- package/dist/src/extensions/project-local-discovery.js +261 -0
- package/dist/src/extensions/project-local-doctor.js +281 -0
- package/dist/src/extensions/project-local-gitignore.js +176 -0
- package/dist/src/extensions/project-local-paths.js +121 -0
- package/dist/src/extensions/project-local-promote.js +218 -0
- package/dist/src/extensions/project-local-remove.js +373 -0
- package/dist/src/extensions/project-local-scaffold.js +252 -0
- package/dist/src/extensions/project-quickref.js +291 -0
- package/dist/src/extensions/registry.js +368 -0
- package/dist/src/extensions/shadow-resolver.js +271 -0
- package/dist/src/extensions/types.js +86 -0
- package/dist/src/extensions/upstream-registry.js +195 -0
- package/dist/src/extensions/validation.js +631 -0
- package/dist/src/features/catalog.js +88 -0
- package/dist/src/features/cli.js +197 -0
- package/dist/src/features/installer.js +57 -0
- package/dist/src/features/paths.js +14 -0
- package/dist/src/features/runtime.js +21 -0
- package/dist/src/features/status.js +134 -0
- package/dist/src/hooks/laziness-detection.js +532 -0
- package/dist/src/intake/git-history-analyzer.js +486 -0
- package/dist/src/intake/index.js +9 -0
- package/dist/src/issues/cli.js +327 -0
- package/dist/src/issues/index.js +5 -0
- package/dist/src/issues/live.js +154 -0
- package/dist/src/issues/local.js +666 -0
- package/dist/src/issues/sync.js +143 -0
- package/dist/src/issues/types.js +2 -0
- package/dist/src/issues/workflows.js +164 -0
- package/dist/src/kb/cli.js +173 -0
- package/dist/src/lint/cli.js +171 -0
- package/dist/src/lint/loader.js +225 -0
- package/dist/src/lint/reporters.js +141 -0
- package/dist/src/lint/runner.js +364 -0
- package/dist/src/lint/types.js +10 -0
- package/dist/src/marketplace/cache.js +110 -0
- package/dist/src/marketplace/identifier.js +63 -0
- package/dist/src/marketplace/registry.js +36 -0
- package/dist/src/marketplace/sources/clawhub.js +53 -0
- package/dist/src/marketplace/sources/git.js +45 -0
- package/dist/src/marketplace/types.js +9 -0
- package/dist/src/mcp/adapters/codex-runtime.js +224 -0
- package/dist/src/mcp/cli.mjs +1197 -0
- package/dist/src/mcp/elicitation.mjs +149 -0
- package/dist/src/mcp/helpers.mjs +287 -0
- package/dist/src/mcp/index.mjs +11 -0
- package/dist/src/mcp/profiles.js +263 -0
- package/dist/src/mcp/profiles.mjs +360 -0
- package/dist/src/mcp/registry.js +376 -0
- package/dist/src/mcp/registry.mjs +387 -0
- package/dist/src/mcp/server.mjs +633 -0
- package/dist/src/mcp/test-simple.mjs +271 -0
- package/dist/src/mcp/tools/command-run.mjs +101 -0
- package/dist/src/mcp/tools/discovery.mjs +291 -0
- package/dist/src/mcp/tools/interaction.mjs +87 -0
- package/dist/src/mcp/tools/orchestration.mjs +320 -0
- package/dist/src/mcp/tools/subsystems.mjs +640 -0
- package/dist/src/memory/cli.js +166 -0
- package/dist/src/memory/project-registry.js +282 -0
- package/dist/src/metrics/artifact-metrics.js +184 -0
- package/dist/src/metrics/context-budget.js +174 -0
- package/dist/src/metrics/token-counter.js +133 -0
- package/dist/src/models/config-loader.js +228 -0
- package/dist/src/models/index.js +22 -0
- package/dist/src/models/model-capabilities.v1.json +120 -0
- package/dist/src/models/model-catalog.v1.json +96 -0
- package/dist/src/models/model-discovery.js +521 -0
- package/dist/src/models/provider-models.js +73 -0
- package/dist/src/models/provider-policy.js +273 -0
- package/dist/src/models/resolver.js +245 -0
- package/dist/src/models/router.js +70 -0
- package/dist/src/models/types.js +8 -0
- package/dist/src/models/wrapper-deployment.js +178 -0
- package/dist/src/models/wrapper-route.js +54 -0
- package/dist/src/ops/cli.js +268 -0
- package/dist/src/ops/registry.js +623 -0
- package/dist/src/packages/adapters/clawhub.js +113 -0
- package/dist/src/packages/adapters/git.js +153 -0
- package/dist/src/packages/adapters/gitea.js +93 -0
- package/dist/src/packages/adapters/github.js +69 -0
- package/dist/src/packages/adapters/local-cache.js +89 -0
- package/dist/src/packages/package-registry.js +143 -0
- package/dist/src/packages/registry.js +238 -0
- package/dist/src/packages/types.js +11 -0
- package/dist/src/plugin/cross-framework-ops.js +475 -0
- package/dist/src/plugin/framework-config-loader.js +235 -0
- package/dist/src/plugin/framework-detector.js +186 -0
- package/dist/src/plugin/framework-isolator.js +341 -0
- package/dist/src/plugin/framework-migration.js +371 -0
- package/dist/src/plugin/metadata-validator.js +906 -0
- package/dist/src/plugin/plugin-installer.js +436 -0
- package/dist/src/plugin/plugin-status.js +369 -0
- package/dist/src/plugin/plugin-uninstaller.js +473 -0
- package/dist/src/plugin/registry-validator.js +344 -0
- package/dist/src/plugin/skill-command-translator.js +415 -0
- package/dist/src/plugin/workspace-creator.js +189 -0
- package/dist/src/plugin/workspace-migrator.js +821 -0
- package/dist/src/policy/authorization.js +390 -0
- package/dist/src/policy/repo-access.js +215 -0
- package/dist/src/provenance/cli.js +16 -0
- package/dist/src/providers/capability-matrix.js +300 -0
- package/dist/src/providers/capability-matrix.yaml +514 -0
- package/dist/src/providers/provider-definitions.js +977 -0
- package/dist/src/providers/provider-definitions.mjs +159 -0
- package/dist/src/providers/provider-inventory.js +169 -0
- package/dist/src/quality/feedback-ab.js +174 -0
- package/dist/src/quality/feedback-collector.js +176 -0
- package/dist/src/quality/feedback-tracker.js +123 -0
- package/dist/src/quality/patterns/adr.json +24 -0
- package/dist/src/quality/patterns/sad.json +24 -0
- package/dist/src/quality/patterns/test-plan.json +24 -0
- package/dist/src/quality/patterns/use-case.json +24 -0
- package/dist/src/quality/scoring.js +157 -0
- package/dist/src/reflections/cli.js +15 -0
- package/dist/src/release/plan.js +139 -0
- package/dist/src/research/cache/manager.js +227 -0
- package/dist/src/research/clients/arxiv.js +156 -0
- package/dist/src/research/clients/base.js +197 -0
- package/dist/src/research/clients/crossref.js +112 -0
- package/dist/src/research/clients/semantic-scholar.js +126 -0
- package/dist/src/research/clients/unpaywall.js +87 -0
- package/dist/src/research/index.js +14 -0
- package/dist/src/research/query-cli.js +336 -0
- package/dist/src/research/services/acquisition.js +313 -0
- package/dist/src/research/services/archival.js +225 -0
- package/dist/src/research/services/citation.js +279 -0
- package/dist/src/research/services/discovery.js +243 -0
- package/dist/src/research/services/documentation.js +269 -0
- package/dist/src/research/services/index.js +14 -0
- package/dist/src/research/services/provenance.js +279 -0
- package/dist/src/research/services/quality.js +370 -0
- package/dist/src/research/services/types.js +7 -0
- package/dist/src/research/storage-cli.js +20 -0
- package/dist/src/research/types.js +47 -0
- package/dist/src/resources/index.d.ts +2 -0
- package/dist/src/resources/index.js +2 -0
- package/dist/src/resources/web-release.d.ts +89 -0
- package/dist/src/resources/web-release.js +882 -0
- package/dist/src/rlm/cache/cli.js +162 -0
- package/dist/src/rlm/cache/hash.js +35 -0
- package/dist/src/rlm/cache/store.js +170 -0
- package/dist/src/rlm/cache/types.js +8 -0
- package/dist/src/rlm/cli.js +650 -0
- package/dist/src/serve/a2a-terminal-observer.js +120 -0
- package/dist/src/serve/agent-router.js +205 -0
- package/dist/src/serve/dispatch-router.js +171 -0
- package/dist/src/serve/executor-registry.js +715 -0
- package/dist/src/serve/mission-conductor.js +177 -0
- package/dist/src/serve/orchestrator-adapter.js +113 -0
- package/dist/src/serve/orchestrator-override.js +94 -0
- package/dist/src/serve/orchestrator-pty.js +133 -0
- package/dist/src/serve/pty-bridge.js +799 -0
- package/dist/src/serve/sandbox-registry.js +832 -0
- package/dist/src/serve/screen-reader.js +228 -0
- package/dist/src/serve/stack-adapters.js +68 -0
- package/dist/src/serve/telemetry.js +143 -0
- package/dist/src/skills/adapters/clawhub.js +250 -0
- package/dist/src/skills/adapters/local.js +335 -0
- package/dist/src/skills/adapters/openclaw.js +316 -0
- package/dist/src/skills/cli.js +334 -0
- package/dist/src/skills/registry.js +117 -0
- package/dist/src/skills/run.js +259 -0
- package/dist/src/skills/runtime.js +94 -0
- package/dist/src/skills/types.js +10 -0
- package/dist/src/smiths/agentsmith/demo.js +116 -0
- package/dist/src/smiths/agentsmith/examples.js +300 -0
- package/dist/src/smiths/agentsmith/generator.js +503 -0
- package/dist/src/smiths/agentsmith/index.js +11 -0
- package/dist/src/smiths/agentsmith/types.js +8 -0
- package/dist/src/smiths/commandsmith/example.js +220 -0
- package/dist/src/smiths/commandsmith/generator.js +288 -0
- package/dist/src/smiths/commandsmith/index.js +41 -0
- package/dist/src/smiths/commandsmith/templates.js +296 -0
- package/dist/src/smiths/commandsmith/types.js +7 -0
- package/dist/src/smiths/context-pipeline/aiwg-md.js +104 -0
- package/dist/src/smiths/context-pipeline/allowlist.js +195 -0
- package/dist/src/smiths/context-pipeline/claude-hook.js +127 -0
- package/dist/src/smiths/context-pipeline/discovery.js +187 -0
- package/dist/src/smiths/context-pipeline/external-links-section.js +49 -0
- package/dist/src/smiths/context-pipeline/finalization.js +147 -0
- package/dist/src/smiths/context-pipeline/generator.js +477 -0
- package/dist/src/smiths/context-pipeline/index.js +30 -0
- package/dist/src/smiths/context-pipeline/legacy-inject.js +103 -0
- package/dist/src/smiths/context-pipeline/managed-hook.js +95 -0
- package/dist/src/smiths/context-pipeline/overflow.js +212 -0
- package/dist/src/smiths/context-pipeline/parallelism-section.js +94 -0
- package/dist/src/smiths/context-pipeline/provider-policy.js +64 -0
- package/dist/src/smiths/context-pipeline/sanitizer.js +93 -0
- package/dist/src/smiths/context-pipeline/types.js +23 -0
- package/dist/src/smiths/context-pipeline/workspace-context.js +988 -0
- package/dist/src/smiths/hook-bridge/codex-translator.js +129 -0
- package/dist/src/smiths/hook-bridge/copilot-translator.js +64 -0
- package/dist/src/smiths/hook-bridge/factory-translator.js +43 -0
- package/dist/src/smiths/hook-bridge/hermes-translator.js +88 -0
- package/dist/src/smiths/hook-bridge/index.js +79 -0
- package/dist/src/smiths/hook-bridge/loader.js +116 -0
- package/dist/src/smiths/hook-bridge/shim.js +89 -0
- package/dist/src/smiths/hook-bridge/types.js +31 -0
- package/dist/src/smiths/index.js +39 -0
- package/dist/src/smiths/mcpsmith/analyzers/cli-analyzer.js +390 -0
- package/dist/src/smiths/mcpsmith/example.js +119 -0
- package/dist/src/smiths/mcpsmith/generator.js +236 -0
- package/dist/src/smiths/mcpsmith/index.js +17 -0
- package/dist/src/smiths/mcpsmith/types.js +10 -0
- package/dist/src/smiths/platform-paths.js +101 -0
- package/dist/src/smiths/skillsmith/codex-sidecar.js +85 -0
- package/dist/src/smiths/skillsmith/collision-detector.js +249 -0
- package/dist/src/smiths/skillsmith/demo.js +83 -0
- package/dist/src/smiths/skillsmith/examples.js +161 -0
- package/dist/src/smiths/skillsmith/generator.js +316 -0
- package/dist/src/smiths/skillsmith/index.js +12 -0
- package/dist/src/smiths/skillsmith/namespace-adapter.js +180 -0
- package/dist/src/smiths/skillsmith/platform-resolver.js +157 -0
- package/dist/src/smiths/skillsmith/types.js +9 -0
- package/dist/src/smiths/toolsmith/index.js +10 -0
- package/dist/src/smiths/toolsmith/runtime-discovery.mjs +710 -0
- package/dist/src/smiths/toolsmith/types.js +8 -0
- package/dist/src/storage/backends/fortemi.js +227 -0
- package/dist/src/storage/backends/fs.js +134 -0
- package/dist/src/storage/backends/logseq.js +309 -0
- package/dist/src/storage/backends/obsidian.js +233 -0
- package/dist/src/storage/cli.js +468 -0
- package/dist/src/storage/config.js +272 -0
- package/dist/src/storage/index.js +108 -0
- package/dist/src/storage/subsystem-cli.js +201 -0
- package/dist/src/storage/types.js +33 -0
- package/dist/src/testing/corpus/corpus-builder.js +383 -0
- package/dist/src/testing/corpus/ground-truth-manager.js +460 -0
- package/dist/src/testing/corpus/index.js +10 -0
- package/dist/src/testing/fixtures/index.js +9 -0
- package/dist/src/testing/fixtures/test-data-factory.js +472 -0
- package/dist/src/testing/generators/index.js +11 -0
- package/dist/src/testing/generators/test-case-generator.js +393 -0
- package/dist/src/testing/generators/test-code-generator.js +384 -0
- package/dist/src/testing/generators/use-case-parser.js +325 -0
- package/dist/src/testing/index.js +11 -0
- package/dist/src/tracker/capability-protocol.js +118 -0
- package/dist/src/update/checker.mjs +396 -0
- package/dist/src/update/notifier.mjs +235 -0
- package/dist/src/writing/content-diversifier.js +804 -0
- package/dist/src/writing/example-generator.js +959 -0
- package/dist/src/writing/example-templates.js +99 -0
- package/dist/src/writing/pattern-library.js +486 -0
- package/dist/src/writing/patterns/banned-phrases.json +4413 -0
- package/dist/src/writing/patterns/formulaic-structures.json +1300 -0
- package/dist/src/writing/patterns/generic-adjectives.json +1510 -0
- package/dist/src/writing/patterns/hedging-language.json +2096 -0
- package/dist/src/writing/patterns/transition-words.json +1285 -0
- package/dist/src/writing/patterns/weak-verbs.json +1112 -0
- package/dist/src/writing/prompt-optimizer.js +660 -0
- package/dist/src/writing/prompt-templates.js +583 -0
- package/dist/src/writing/scoring-config-loader.js +168 -0
- package/dist/src/writing/validation-engine.js +595 -0
- package/dist/src/writing/validation-rules.js +380 -0
- package/dist/src/writing/voice-analyzer.js +439 -0
- package/dist/src/writing/voice-calibration.js +661 -0
- package/dist/src/writing/voice-profiles.json +588 -0
- package/package.json +64 -9
|
@@ -0,0 +1,463 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Deployment Registration
|
|
3
|
+
*
|
|
4
|
+
* Scans deployed agent and skill directories, extracts metadata from frontmatter,
|
|
5
|
+
* and registers them in the extension registry for discovery.
|
|
6
|
+
*
|
|
7
|
+
* @implements #56, #57
|
|
8
|
+
* @architecture @.aiwg/architecture/unified-extension-schema.md
|
|
9
|
+
* @tests @test/unit/extensions/deployment-registration.test.ts
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import path from 'path';
|
|
13
|
+
/**
|
|
14
|
+
* Parse frontmatter from markdown content
|
|
15
|
+
*
|
|
16
|
+
* Extracts YAML frontmatter between --- delimiters.
|
|
17
|
+
*
|
|
18
|
+
* @param content - Markdown content
|
|
19
|
+
* @returns Parsed frontmatter and remaining content
|
|
20
|
+
*/
|
|
21
|
+
function parseFrontmatter(content) {
|
|
22
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n/);
|
|
23
|
+
if (!fmMatch) {
|
|
24
|
+
return { frontmatter: {}, content };
|
|
25
|
+
}
|
|
26
|
+
const yamlContent = fmMatch[1];
|
|
27
|
+
const remainingContent = content.slice(fmMatch[0].length);
|
|
28
|
+
// Simple YAML parser (basic key: value pairs)
|
|
29
|
+
const frontmatter = {};
|
|
30
|
+
const lines = yamlContent.split('\n');
|
|
31
|
+
for (const line of lines) {
|
|
32
|
+
const match = line.match(/^(\w+):\s*(.+)$/);
|
|
33
|
+
if (match) {
|
|
34
|
+
const [, key, value] = match;
|
|
35
|
+
// Remove quotes if present
|
|
36
|
+
frontmatter[key] = value.replace(/^['"]|['"]$/g, '');
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return { frontmatter, content: remainingContent };
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Extract description from markdown content
|
|
43
|
+
*
|
|
44
|
+
* Looks for first paragraph after frontmatter.
|
|
45
|
+
*
|
|
46
|
+
* @param content - Markdown content (without frontmatter)
|
|
47
|
+
* @returns Extracted description
|
|
48
|
+
*/
|
|
49
|
+
function extractDescription(content) {
|
|
50
|
+
// Find first paragraph
|
|
51
|
+
const paragraphMatch = content.match(/^[^\n#*-]+/m);
|
|
52
|
+
if (paragraphMatch) {
|
|
53
|
+
return paragraphMatch[0].trim().slice(0, 200); // Limit to 200 chars
|
|
54
|
+
}
|
|
55
|
+
return 'No description available';
|
|
56
|
+
}
|
|
57
|
+
/**
|
|
58
|
+
* Extract capabilities from agent content
|
|
59
|
+
*
|
|
60
|
+
* Parses ## Capabilities or ## Skills sections.
|
|
61
|
+
*
|
|
62
|
+
* @param content - Markdown content
|
|
63
|
+
* @returns Array of capabilities
|
|
64
|
+
*/
|
|
65
|
+
function extractCapabilities(content) {
|
|
66
|
+
const capabilitiesMatch = content.match(/##\s+(?:Capabilities|Skills)\s*\n([\s\S]*?)(?=\n##|\n$)/i);
|
|
67
|
+
if (!capabilitiesMatch)
|
|
68
|
+
return [];
|
|
69
|
+
const capSection = capabilitiesMatch[1];
|
|
70
|
+
const items = capSection.match(/^[-*]\s+(.+)$/gm);
|
|
71
|
+
if (!items)
|
|
72
|
+
return [];
|
|
73
|
+
return items.map(item => {
|
|
74
|
+
const text = item.replace(/^[-*]\s+/, '').trim();
|
|
75
|
+
// Extract just the capability name (before colon if present)
|
|
76
|
+
const colonIdx = text.indexOf(':');
|
|
77
|
+
return colonIdx > 0 ? text.slice(0, colonIdx).trim().toLowerCase() : text.toLowerCase();
|
|
78
|
+
}).slice(0, 10); // Limit to 10 capabilities
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Extract keywords from content
|
|
82
|
+
*
|
|
83
|
+
* Simple keyword extraction from headings and first paragraph.
|
|
84
|
+
*
|
|
85
|
+
* @param content - Markdown content
|
|
86
|
+
* @param name - Extension name
|
|
87
|
+
* @returns Array of keywords
|
|
88
|
+
*/
|
|
89
|
+
function extractKeywords(content, name) {
|
|
90
|
+
const keywords = new Set();
|
|
91
|
+
// Add name words
|
|
92
|
+
name.toLowerCase().split(/[-\s]+/).forEach(word => {
|
|
93
|
+
if (word.length > 2)
|
|
94
|
+
keywords.add(word);
|
|
95
|
+
});
|
|
96
|
+
// Extract from headings
|
|
97
|
+
const headings = content.match(/^#+\s+(.+)$/gm);
|
|
98
|
+
if (headings) {
|
|
99
|
+
headings.slice(0, 5).forEach(heading => {
|
|
100
|
+
const text = heading.replace(/^#+\s+/, '');
|
|
101
|
+
text.toLowerCase().split(/[\s,]+/).forEach(word => {
|
|
102
|
+
if (word.length > 3 && !/^(and|the|for|with|from)$/.test(word)) {
|
|
103
|
+
keywords.add(word);
|
|
104
|
+
}
|
|
105
|
+
});
|
|
106
|
+
});
|
|
107
|
+
}
|
|
108
|
+
return Array.from(keywords).slice(0, 10);
|
|
109
|
+
}
|
|
110
|
+
/**
|
|
111
|
+
* Parse model specification from frontmatter
|
|
112
|
+
*
|
|
113
|
+
* Handles both simple (opus/sonnet/haiku) and full model names.
|
|
114
|
+
*
|
|
115
|
+
* @param modelValue - Model value from frontmatter
|
|
116
|
+
* @returns Model metadata
|
|
117
|
+
*/
|
|
118
|
+
function parseModel(modelValue) {
|
|
119
|
+
const modelStr = String(modelValue || 'sonnet').toLowerCase();
|
|
120
|
+
let tier = 'sonnet';
|
|
121
|
+
if (/haiku/i.test(modelStr))
|
|
122
|
+
tier = 'haiku';
|
|
123
|
+
else if (/opus/i.test(modelStr))
|
|
124
|
+
tier = 'opus';
|
|
125
|
+
return { tier };
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Scan deployed agents directory
|
|
129
|
+
*
|
|
130
|
+
* Reads agent markdown files from the deployed directory and creates Extension
|
|
131
|
+
* objects with metadata extracted from frontmatter.
|
|
132
|
+
*
|
|
133
|
+
* @param agentsPath - Path to .claude/agents or equivalent
|
|
134
|
+
* @param provider - Provider platform name
|
|
135
|
+
* @param cwd - Working directory for relative path resolution
|
|
136
|
+
* @returns Array of agent extensions
|
|
137
|
+
*/
|
|
138
|
+
export async function scanDeployedAgents(agentsPath, provider, cwd = process.cwd()) {
|
|
139
|
+
const absolutePath = path.isAbsolute(agentsPath) ? agentsPath : path.join(cwd, agentsPath);
|
|
140
|
+
// Check if directory exists
|
|
141
|
+
if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isDirectory()) {
|
|
142
|
+
return [];
|
|
143
|
+
}
|
|
144
|
+
const agents = [];
|
|
145
|
+
const files = fs.readdirSync(absolutePath);
|
|
146
|
+
for (const file of files) {
|
|
147
|
+
if (!file.endsWith('.md'))
|
|
148
|
+
continue;
|
|
149
|
+
const filePath = path.join(absolutePath, file);
|
|
150
|
+
const content = fs.readFileSync(filePath, 'utf8');
|
|
151
|
+
const { frontmatter, content: bodyContent } = parseFrontmatter(content);
|
|
152
|
+
// Extract ID from filename (remove .md extension)
|
|
153
|
+
const id = path.basename(file, '.md');
|
|
154
|
+
// Extract name (prefer frontmatter, fallback to title-cased ID)
|
|
155
|
+
const name = String(frontmatter.name ||
|
|
156
|
+
id.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '));
|
|
157
|
+
// Extract description
|
|
158
|
+
const description = String(frontmatter.description || extractDescription(bodyContent));
|
|
159
|
+
// Extract capabilities
|
|
160
|
+
const capabilities = extractCapabilities(bodyContent);
|
|
161
|
+
// Extract keywords
|
|
162
|
+
const keywords = extractKeywords(bodyContent, name);
|
|
163
|
+
// Parse model
|
|
164
|
+
const model = parseModel(frontmatter.model);
|
|
165
|
+
// Extract tools (default to common tools)
|
|
166
|
+
const toolsValue = frontmatter.tools || 'Read, Write, Bash';
|
|
167
|
+
const tools = String(toolsValue).split(',').map(t => t.trim());
|
|
168
|
+
// Extract role
|
|
169
|
+
const role = String(frontmatter.role || frontmatter.description || description);
|
|
170
|
+
// Build agent extension
|
|
171
|
+
const agent = {
|
|
172
|
+
id,
|
|
173
|
+
type: 'agent',
|
|
174
|
+
name,
|
|
175
|
+
description,
|
|
176
|
+
version: String(frontmatter.version || '1.0.0'),
|
|
177
|
+
capabilities,
|
|
178
|
+
keywords,
|
|
179
|
+
category: String(frontmatter.category || 'agent'),
|
|
180
|
+
platforms: {
|
|
181
|
+
[provider]: 'full',
|
|
182
|
+
},
|
|
183
|
+
deployment: {
|
|
184
|
+
pathTemplate: `${agentsPath}/{id}.md`,
|
|
185
|
+
core: false,
|
|
186
|
+
},
|
|
187
|
+
metadata: {
|
|
188
|
+
type: 'agent',
|
|
189
|
+
role,
|
|
190
|
+
model,
|
|
191
|
+
tools,
|
|
192
|
+
},
|
|
193
|
+
installation: {
|
|
194
|
+
installedAt: new Date().toISOString(),
|
|
195
|
+
installedFrom: 'local',
|
|
196
|
+
installedPath: filePath,
|
|
197
|
+
enabled: true,
|
|
198
|
+
},
|
|
199
|
+
};
|
|
200
|
+
agents.push(agent);
|
|
201
|
+
}
|
|
202
|
+
return agents;
|
|
203
|
+
}
|
|
204
|
+
/**
|
|
205
|
+
* Scan deployed skills directory
|
|
206
|
+
*
|
|
207
|
+
* Reads skill directories from the deployed directory and creates Extension
|
|
208
|
+
* objects with metadata extracted from skill.md files.
|
|
209
|
+
*
|
|
210
|
+
* @param skillsPath - Path to .claude/skills or equivalent
|
|
211
|
+
* @param provider - Provider platform name
|
|
212
|
+
* @param cwd - Working directory for relative path resolution
|
|
213
|
+
* @returns Array of skill extensions
|
|
214
|
+
*/
|
|
215
|
+
export async function scanDeployedSkills(skillsPath, provider, cwd = process.cwd()) {
|
|
216
|
+
const absolutePath = path.isAbsolute(skillsPath) ? skillsPath : path.join(cwd, skillsPath);
|
|
217
|
+
// Check if directory exists
|
|
218
|
+
if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isDirectory()) {
|
|
219
|
+
return [];
|
|
220
|
+
}
|
|
221
|
+
const skills = [];
|
|
222
|
+
const entries = fs.readdirSync(absolutePath, { withFileTypes: true });
|
|
223
|
+
// Collect skill directories, descending one namespace level when a top-level
|
|
224
|
+
// entry has no direct SKILL.md but holds child skill dirs — e.g. OpenClaw
|
|
225
|
+
// kernel skills at ~/.openclaw/skills/aiwg/<name>/SKILL.md (PUW-025).
|
|
226
|
+
// OpenClaw's own loader recurses under skill roots, so the registrar must too;
|
|
227
|
+
// otherwise it reports "Registered 0 skills" for skills that actually load (#1563).
|
|
228
|
+
const hasSkillFile = (dir) => fs.existsSync(path.join(dir, 'SKILL.md')) || fs.existsSync(path.join(dir, 'skill.md'));
|
|
229
|
+
const skillDirs = [];
|
|
230
|
+
for (const entry of entries) {
|
|
231
|
+
if (!entry.isDirectory())
|
|
232
|
+
continue;
|
|
233
|
+
const dir = path.join(absolutePath, entry.name);
|
|
234
|
+
if (hasSkillFile(dir)) {
|
|
235
|
+
skillDirs.push(dir);
|
|
236
|
+
continue;
|
|
237
|
+
}
|
|
238
|
+
for (const child of fs.readdirSync(dir, { withFileTypes: true })) {
|
|
239
|
+
if (!child.isDirectory())
|
|
240
|
+
continue;
|
|
241
|
+
const childDir = path.join(dir, child.name);
|
|
242
|
+
if (hasSkillFile(childDir))
|
|
243
|
+
skillDirs.push(childDir);
|
|
244
|
+
}
|
|
245
|
+
}
|
|
246
|
+
for (const skillDir of skillDirs) {
|
|
247
|
+
const skillFile = path.join(skillDir, 'SKILL.md');
|
|
248
|
+
const skillFileLower = path.join(skillDir, 'skill.md');
|
|
249
|
+
const actualSkillFile = fs.existsSync(skillFile) ? skillFile : skillFileLower;
|
|
250
|
+
const content = fs.readFileSync(actualSkillFile, 'utf8');
|
|
251
|
+
const { frontmatter, content: bodyContent } = parseFrontmatter(content);
|
|
252
|
+
// Extract ID from directory name
|
|
253
|
+
const id = path.basename(skillDir);
|
|
254
|
+
// Extract name
|
|
255
|
+
const name = String(frontmatter.name ||
|
|
256
|
+
id.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '));
|
|
257
|
+
// Extract description
|
|
258
|
+
const description = String(frontmatter.description || extractDescription(bodyContent));
|
|
259
|
+
// Extract trigger phrases
|
|
260
|
+
const triggersValue = frontmatter.triggers || frontmatter.triggerPhrases || '';
|
|
261
|
+
const triggerPhrases = String(triggersValue)
|
|
262
|
+
.split(',')
|
|
263
|
+
.map(t => t.trim())
|
|
264
|
+
.filter(t => t.length > 0);
|
|
265
|
+
// Extract tools
|
|
266
|
+
const toolsValue = frontmatter.tools || '';
|
|
267
|
+
const tools = toolsValue ? String(toolsValue).split(',').map(t => t.trim()) : undefined;
|
|
268
|
+
// Build skill extension
|
|
269
|
+
const skill = {
|
|
270
|
+
id,
|
|
271
|
+
type: 'skill',
|
|
272
|
+
name,
|
|
273
|
+
description,
|
|
274
|
+
version: String(frontmatter.version || '1.0.0'),
|
|
275
|
+
capabilities: extractCapabilities(bodyContent),
|
|
276
|
+
keywords: extractKeywords(bodyContent, name),
|
|
277
|
+
category: String(frontmatter.category || 'skill'),
|
|
278
|
+
platforms: {
|
|
279
|
+
[provider]: 'full',
|
|
280
|
+
},
|
|
281
|
+
deployment: {
|
|
282
|
+
pathTemplate: `${skillsPath}/{id}/skill.md`,
|
|
283
|
+
additionalFiles: ['references.md'].filter(f => fs.existsSync(path.join(skillDir, f))),
|
|
284
|
+
core: false,
|
|
285
|
+
},
|
|
286
|
+
metadata: {
|
|
287
|
+
type: 'skill',
|
|
288
|
+
triggerPhrases: triggerPhrases.length > 0 ? triggerPhrases : [`use ${id}`, name.toLowerCase()],
|
|
289
|
+
tools,
|
|
290
|
+
},
|
|
291
|
+
installation: {
|
|
292
|
+
installedAt: new Date().toISOString(),
|
|
293
|
+
installedFrom: 'local',
|
|
294
|
+
installedPath: skillDir,
|
|
295
|
+
enabled: true,
|
|
296
|
+
},
|
|
297
|
+
};
|
|
298
|
+
skills.push(skill);
|
|
299
|
+
}
|
|
300
|
+
return skills;
|
|
301
|
+
}
|
|
302
|
+
function inferKernelSkillsPath(skillsPath) {
|
|
303
|
+
const parsed = path.parse(skillsPath);
|
|
304
|
+
const rel = parsed.root ? path.relative(parsed.root, skillsPath) : skillsPath;
|
|
305
|
+
const segments = rel.split(/[\\/]+/).filter(Boolean);
|
|
306
|
+
const aiwgIdx = segments.lastIndexOf('.aiwg');
|
|
307
|
+
if (aiwgIdx < 0)
|
|
308
|
+
return null;
|
|
309
|
+
const next = segments[aiwgIdx + 1];
|
|
310
|
+
if (next !== 'skills' && next !== 'skill')
|
|
311
|
+
return null;
|
|
312
|
+
const kernelSegments = [...segments.slice(0, aiwgIdx), ...segments.slice(aiwgIdx + 1)];
|
|
313
|
+
const kernelPath = parsed.root
|
|
314
|
+
? path.join(parsed.root, ...kernelSegments)
|
|
315
|
+
: path.join(...kernelSegments);
|
|
316
|
+
return kernelPath && kernelPath !== skillsPath ? kernelPath : null;
|
|
317
|
+
}
|
|
318
|
+
function uniqueSkillPaths(skillsPath) {
|
|
319
|
+
const inputs = Array.isArray(skillsPath) ? skillsPath : [skillsPath];
|
|
320
|
+
const paths = [];
|
|
321
|
+
for (const p of inputs) {
|
|
322
|
+
if (!p)
|
|
323
|
+
continue;
|
|
324
|
+
paths.push(p);
|
|
325
|
+
const kernelPath = inferKernelSkillsPath(p);
|
|
326
|
+
if (kernelPath)
|
|
327
|
+
paths.push(kernelPath);
|
|
328
|
+
}
|
|
329
|
+
return [...new Set(paths)];
|
|
330
|
+
}
|
|
331
|
+
/**
|
|
332
|
+
* Scan deployed behaviors directory
|
|
333
|
+
*
|
|
334
|
+
* Reads behavior directories from the deployed path and creates Extension objects
|
|
335
|
+
* with metadata extracted from BEHAVIOR.md frontmatter.
|
|
336
|
+
*
|
|
337
|
+
* Behaviors are directories containing a BEHAVIOR.md file and optionally a scripts/
|
|
338
|
+
* subdirectory. On OpenClaw this is the native format; on other providers behaviors
|
|
339
|
+
* are emulated via hook wrappers or session injection.
|
|
340
|
+
*
|
|
341
|
+
* @param behaviorsPath - Path to deployed behaviors directory (e.g., ~/.openclaw/behaviors/)
|
|
342
|
+
* @param provider - Provider platform name
|
|
343
|
+
* @param cwd - Working directory for relative path resolution
|
|
344
|
+
* @returns Array of behavior extensions
|
|
345
|
+
*
|
|
346
|
+
* @implements #609
|
|
347
|
+
*/
|
|
348
|
+
export async function scanDeployedBehaviors(behaviorsPath, provider, cwd = process.cwd()) {
|
|
349
|
+
if (!behaviorsPath)
|
|
350
|
+
return [];
|
|
351
|
+
const absolutePath = path.isAbsolute(behaviorsPath) ? behaviorsPath : path.join(cwd, behaviorsPath);
|
|
352
|
+
if (!fs.existsSync(absolutePath) || !fs.statSync(absolutePath).isDirectory()) {
|
|
353
|
+
return [];
|
|
354
|
+
}
|
|
355
|
+
const behaviors = [];
|
|
356
|
+
const entries = fs.readdirSync(absolutePath, { withFileTypes: true });
|
|
357
|
+
for (const entry of entries) {
|
|
358
|
+
if (!entry.isDirectory())
|
|
359
|
+
continue;
|
|
360
|
+
const behaviorDir = path.join(absolutePath, entry.name);
|
|
361
|
+
const behaviorFile = path.join(behaviorDir, 'BEHAVIOR.md');
|
|
362
|
+
if (!fs.existsSync(behaviorFile))
|
|
363
|
+
continue;
|
|
364
|
+
const content = fs.readFileSync(behaviorFile, 'utf8');
|
|
365
|
+
const { frontmatter, content: bodyContent } = parseFrontmatter(content);
|
|
366
|
+
const id = entry.name;
|
|
367
|
+
const name = String(frontmatter.name ||
|
|
368
|
+
id.split('-').map(w => w.charAt(0).toUpperCase() + w.slice(1)).join(' '));
|
|
369
|
+
const description = String(frontmatter.description || extractDescription(bodyContent));
|
|
370
|
+
const keywords = extractKeywords(bodyContent, name);
|
|
371
|
+
const behavior = {
|
|
372
|
+
id,
|
|
373
|
+
type: 'behavior',
|
|
374
|
+
name,
|
|
375
|
+
description,
|
|
376
|
+
version: String(frontmatter.version || '1.0.0'),
|
|
377
|
+
capabilities: [],
|
|
378
|
+
keywords,
|
|
379
|
+
category: String(frontmatter.category || 'behavior'),
|
|
380
|
+
platforms: {
|
|
381
|
+
[provider]: 'full',
|
|
382
|
+
},
|
|
383
|
+
deployment: {
|
|
384
|
+
pathTemplate: `${behaviorsPath}/{id}/BEHAVIOR.md`,
|
|
385
|
+
core: false,
|
|
386
|
+
},
|
|
387
|
+
metadata: {
|
|
388
|
+
type: 'behavior',
|
|
389
|
+
},
|
|
390
|
+
installation: {
|
|
391
|
+
installedAt: new Date().toISOString(),
|
|
392
|
+
installedFrom: 'local',
|
|
393
|
+
installedPath: behaviorDir,
|
|
394
|
+
enabled: true,
|
|
395
|
+
},
|
|
396
|
+
};
|
|
397
|
+
behaviors.push(behavior);
|
|
398
|
+
}
|
|
399
|
+
return behaviors;
|
|
400
|
+
}
|
|
401
|
+
/**
|
|
402
|
+
* Register deployed extensions in the registry
|
|
403
|
+
*
|
|
404
|
+
* Scans deployed agent, skill, and behavior directories, creates Extension objects,
|
|
405
|
+
* and registers them in the provided registry.
|
|
406
|
+
*
|
|
407
|
+
* @param registry - Extension registry to populate
|
|
408
|
+
* @param options - Registration options
|
|
409
|
+
*
|
|
410
|
+
* @example
|
|
411
|
+
* ```typescript
|
|
412
|
+
* import { getRegistry } from './registry.js';
|
|
413
|
+
* import { registerDeployedExtensions } from './deployment-registration.js';
|
|
414
|
+
*
|
|
415
|
+
* const registry = getRegistry();
|
|
416
|
+
* await registerDeployedExtensions(registry, {
|
|
417
|
+
* agentsPath: '.claude/agents',
|
|
418
|
+
* skillsPath: '.claude/skills',
|
|
419
|
+
* provider: 'claude',
|
|
420
|
+
* });
|
|
421
|
+
*
|
|
422
|
+
* // Now list all deployed agents
|
|
423
|
+
* const agents = registry.getByType('agent');
|
|
424
|
+
* console.log(`Deployed ${agents.length} agents`);
|
|
425
|
+
* ```
|
|
426
|
+
*/
|
|
427
|
+
export async function registerDeployedExtensions(registry, options) {
|
|
428
|
+
const { agentsPath, skillsPath, behaviorsPath, provider, cwd } = options;
|
|
429
|
+
// Scan and register agents
|
|
430
|
+
if (agentsPath) {
|
|
431
|
+
const agents = await scanDeployedAgents(agentsPath, provider, cwd);
|
|
432
|
+
for (const agent of agents) {
|
|
433
|
+
registry.register(agent);
|
|
434
|
+
}
|
|
435
|
+
console.log(`Registered ${agents.length} agents from ${agentsPath}`);
|
|
436
|
+
}
|
|
437
|
+
// Scan and register skills
|
|
438
|
+
if (skillsPath) {
|
|
439
|
+
let total = 0;
|
|
440
|
+
const perPath = [];
|
|
441
|
+
for (const pathToScan of uniqueSkillPaths(skillsPath)) {
|
|
442
|
+
const skills = await scanDeployedSkills(pathToScan, provider, cwd);
|
|
443
|
+
for (const skill of skills) {
|
|
444
|
+
registry.register(skill);
|
|
445
|
+
}
|
|
446
|
+
total += skills.length;
|
|
447
|
+
perPath.push(`${skills.length} from ${pathToScan}`);
|
|
448
|
+
}
|
|
449
|
+
console.log(`Registered ${total} skills (${perPath.join(', ')})`);
|
|
450
|
+
}
|
|
451
|
+
// Scan and register behaviors (#609)
|
|
452
|
+
if (behaviorsPath) {
|
|
453
|
+
const behaviors = await scanDeployedBehaviors(behaviorsPath, provider, cwd);
|
|
454
|
+
for (const behavior of behaviors) {
|
|
455
|
+
registry.register(behavior);
|
|
456
|
+
}
|
|
457
|
+
if (behaviors.length > 0) {
|
|
458
|
+
console.log(`Registered ${behaviors.length} behaviors from ${behaviorsPath}`);
|
|
459
|
+
}
|
|
460
|
+
}
|
|
461
|
+
// Commands are already registered via command definitions, so we skip scanning
|
|
462
|
+
}
|
|
463
|
+
//# sourceMappingURL=deployment-registration.js.map
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extensions Module
|
|
3
|
+
*
|
|
4
|
+
* Unified extension system for AIWG - provides types, registry, validation,
|
|
5
|
+
* capability indexing, and loading functionality for all extension types.
|
|
6
|
+
*
|
|
7
|
+
* @implements @.aiwg/requirements/use-cases/UC-004-extension-system.md
|
|
8
|
+
* @architecture @.aiwg/architecture/unified-extension-schema.md
|
|
9
|
+
*/
|
|
10
|
+
// Core types
|
|
11
|
+
export * from './types.js';
|
|
12
|
+
// Registry
|
|
13
|
+
export { ExtensionRegistry, getRegistry, createRegistry, } from './registry.js';
|
|
14
|
+
// Capability index
|
|
15
|
+
export { CapabilityIndex } from './capability-index.js';
|
|
16
|
+
// Validation
|
|
17
|
+
export { validateExtension, isValidExtension, validateExtensionStrict, } from './validation.js';
|
|
18
|
+
// Loader
|
|
19
|
+
export { loadRegistry, getLoadedRegistry, linkHandlers, } from './loader.js';
|
|
20
|
+
// Command definitions
|
|
21
|
+
export { commandDefinitions } from './commands/definitions.js';
|
|
22
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,132 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Extension Registry Loader
|
|
3
|
+
*
|
|
4
|
+
* Populates the ExtensionRegistry with command definitions and builds
|
|
5
|
+
* capability indexes for fast lookup.
|
|
6
|
+
*
|
|
7
|
+
* @implements @.aiwg/requirements/use-cases/UC-004-extension-system.md
|
|
8
|
+
* @architecture @.aiwg/architecture/unified-extension-schema.md
|
|
9
|
+
* @tests @test/unit/extensions/loader.test.ts
|
|
10
|
+
*/
|
|
11
|
+
import { getRegistry, createRegistry } from './registry.js';
|
|
12
|
+
import { CapabilityIndex } from './capability-index.js';
|
|
13
|
+
import { commandDefinitions } from './commands/definitions.js';
|
|
14
|
+
import { allHandlers } from '../cli/handlers/index.js';
|
|
15
|
+
/**
|
|
16
|
+
* Load and populate the registry
|
|
17
|
+
*
|
|
18
|
+
* Loads command definitions, registers them with the registry, builds alias
|
|
19
|
+
* map, optionally builds capability index, and links handlers to definitions.
|
|
20
|
+
*
|
|
21
|
+
* @param options - Loader options
|
|
22
|
+
* @returns Loaded registry with handler map
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```typescript
|
|
26
|
+
* // Load with capability indexing
|
|
27
|
+
* const result = await loadRegistry({ indexCapabilities: true });
|
|
28
|
+
*
|
|
29
|
+
* // Resolve command alias
|
|
30
|
+
* const id = result.registry.resolveCommand('--help'); // 'help'
|
|
31
|
+
*
|
|
32
|
+
* // Get extension definition
|
|
33
|
+
* const ext = result.registry.get(id);
|
|
34
|
+
*
|
|
35
|
+
* // Get handler
|
|
36
|
+
* const handler = result.handlerMap.get(id);
|
|
37
|
+
*
|
|
38
|
+
* // Query by capability
|
|
39
|
+
* const cliCommands = result.capabilityIndex?.getByCapability('cli');
|
|
40
|
+
* ```
|
|
41
|
+
*/
|
|
42
|
+
export async function loadRegistry(options) {
|
|
43
|
+
const { registry = createRegistry(), indexCapabilities = false } = options || {};
|
|
44
|
+
// Register all command definitions
|
|
45
|
+
for (const definition of commandDefinitions) {
|
|
46
|
+
registry.register(definition);
|
|
47
|
+
}
|
|
48
|
+
// Build alias map from command metadata
|
|
49
|
+
for (const definition of commandDefinitions) {
|
|
50
|
+
if (definition.type === 'command' || definition.type === 'skill') {
|
|
51
|
+
// Find matching handler to get aliases
|
|
52
|
+
const handler = allHandlers.find(h => h.id === definition.id);
|
|
53
|
+
if (handler) {
|
|
54
|
+
// Register all aliases
|
|
55
|
+
for (const alias of handler.aliases) {
|
|
56
|
+
registry.registerAlias(alias, definition.id);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
// Build capability index if requested
|
|
62
|
+
let capabilityIndex;
|
|
63
|
+
if (indexCapabilities) {
|
|
64
|
+
capabilityIndex = new CapabilityIndex();
|
|
65
|
+
for (const extension of registry.getAll()) {
|
|
66
|
+
capabilityIndex.index(extension);
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Link handlers to definitions
|
|
70
|
+
const handlerMap = linkHandlers(allHandlers);
|
|
71
|
+
return {
|
|
72
|
+
registry,
|
|
73
|
+
capabilityIndex,
|
|
74
|
+
handlerMap,
|
|
75
|
+
};
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Get the loaded global registry
|
|
79
|
+
*
|
|
80
|
+
* Convenience function for CLI - uses the global singleton registry.
|
|
81
|
+
* This is useful when you want the same registry instance across calls.
|
|
82
|
+
*
|
|
83
|
+
* @returns Loaded registry with handler map
|
|
84
|
+
*
|
|
85
|
+
* @example
|
|
86
|
+
* ```typescript
|
|
87
|
+
* // Get global registry
|
|
88
|
+
* const result = await getLoadedRegistry();
|
|
89
|
+
*
|
|
90
|
+
* // Later, in another module
|
|
91
|
+
* const sameResult = await getLoadedRegistry();
|
|
92
|
+
* // result.registry === sameResult.registry (same instance)
|
|
93
|
+
* ```
|
|
94
|
+
*/
|
|
95
|
+
export async function getLoadedRegistry() {
|
|
96
|
+
const globalRegistry = getRegistry();
|
|
97
|
+
// Check if already loaded
|
|
98
|
+
if (globalRegistry.size === 0) {
|
|
99
|
+
// Load into global registry
|
|
100
|
+
return loadRegistry({ registry: globalRegistry });
|
|
101
|
+
}
|
|
102
|
+
// Already loaded - just build handler map
|
|
103
|
+
const handlerMap = linkHandlers(allHandlers);
|
|
104
|
+
return {
|
|
105
|
+
registry: globalRegistry,
|
|
106
|
+
handlerMap,
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Link handlers to command definitions
|
|
111
|
+
*
|
|
112
|
+
* Creates a map from handler ID to handler instance for O(1) lookup.
|
|
113
|
+
* This allows routing from extension definition to handler implementation.
|
|
114
|
+
*
|
|
115
|
+
* @param handlers - Array of command handlers
|
|
116
|
+
* @returns Map of handler ID -> handler
|
|
117
|
+
*
|
|
118
|
+
* @example
|
|
119
|
+
* ```typescript
|
|
120
|
+
* const handlerMap = linkHandlers(allHandlers);
|
|
121
|
+
* const helpHandler = handlerMap.get('help');
|
|
122
|
+
* await helpHandler.execute(ctx);
|
|
123
|
+
* ```
|
|
124
|
+
*/
|
|
125
|
+
export function linkHandlers(handlers) {
|
|
126
|
+
const handlerMap = new Map();
|
|
127
|
+
for (const handler of handlers) {
|
|
128
|
+
handlerMap.set(handler.id, handler);
|
|
129
|
+
}
|
|
130
|
+
return handlerMap;
|
|
131
|
+
}
|
|
132
|
+
//# sourceMappingURL=loader.js.map
|