@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.
- package/LICENSE +21 -0
- package/README.md +22 -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 +1486 -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 +886 -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 +65 -9
|
@@ -0,0 +1,316 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SkillSmith Skill Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates skills with platform-aware deployment.
|
|
5
|
+
*
|
|
6
|
+
* @module smiths/skillsmith/generator
|
|
7
|
+
*/
|
|
8
|
+
import { promises as fs } from 'fs';
|
|
9
|
+
import * as path from 'path';
|
|
10
|
+
import { PlatformSkillResolver } from './platform-resolver.js';
|
|
11
|
+
/**
|
|
12
|
+
* Generate a skill from options
|
|
13
|
+
*/
|
|
14
|
+
export async function generateSkill(options) {
|
|
15
|
+
// Validate skill name
|
|
16
|
+
const nameValidation = PlatformSkillResolver.validateSkillName(options.name);
|
|
17
|
+
if (!nameValidation.valid) {
|
|
18
|
+
throw new Error(`Invalid skill name: ${nameValidation.error}`);
|
|
19
|
+
}
|
|
20
|
+
// Description is REQUIRED. Codex rejects SKILL.md files without a non-empty
|
|
21
|
+
// description field; Claude Code uses it for natural-language invocation.
|
|
22
|
+
// Never allow generation of a SKILL.md with a missing or blank description.
|
|
23
|
+
if (typeof options.description !== 'string' ||
|
|
24
|
+
options.description.trim() === '') {
|
|
25
|
+
throw new Error(`Skill description is required and must be non-empty. ` +
|
|
26
|
+
`Codex (and other platforms) reject SKILL.md files without a description. ` +
|
|
27
|
+
`Skill: '${options.name}'`);
|
|
28
|
+
}
|
|
29
|
+
// Check if platform supports skills natively
|
|
30
|
+
const supportsSkills = PlatformSkillResolver.supportsSkills(options.platform);
|
|
31
|
+
if (!supportsSkills) {
|
|
32
|
+
const alternative = PlatformSkillResolver.getAlternativeStrategy(options.platform);
|
|
33
|
+
console.warn(`Platform '${options.platform}' does not natively support skills.`);
|
|
34
|
+
if (alternative) {
|
|
35
|
+
console.warn(`Consider deploying as ${alternative} instead.`);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
// Generate skill content
|
|
39
|
+
const content = generateSkillContent(options);
|
|
40
|
+
// Generate references if requested
|
|
41
|
+
const references = options.createReferences
|
|
42
|
+
? generateDefaultReferences(options)
|
|
43
|
+
: undefined;
|
|
44
|
+
// Resolve deployment path
|
|
45
|
+
const deployPath = PlatformSkillResolver.getSkillPath(options.platform, options.projectPath, options.name);
|
|
46
|
+
return {
|
|
47
|
+
name: options.name,
|
|
48
|
+
path: deployPath,
|
|
49
|
+
content,
|
|
50
|
+
platform: options.platform,
|
|
51
|
+
references,
|
|
52
|
+
version: options.version || '1.0.0',
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Deploy a generated skill to the target platform
|
|
57
|
+
*/
|
|
58
|
+
export async function deploySkill(skill, projectPath, dryRun = false) {
|
|
59
|
+
const filesCreated = [];
|
|
60
|
+
try {
|
|
61
|
+
if (dryRun) {
|
|
62
|
+
console.log(`[DRY RUN] Would deploy skill to: ${skill.path}`);
|
|
63
|
+
return {
|
|
64
|
+
skill,
|
|
65
|
+
success: true,
|
|
66
|
+
deployPath: skill.path,
|
|
67
|
+
filesCreated: [],
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// Create skill directory
|
|
71
|
+
await fs.mkdir(skill.path, { recursive: true });
|
|
72
|
+
// Write SKILL.md
|
|
73
|
+
const skillFilePath = PlatformSkillResolver.getSkillFilePath(skill.platform, projectPath, skill.name);
|
|
74
|
+
await fs.writeFile(skillFilePath, skill.content, 'utf-8');
|
|
75
|
+
filesCreated.push(skillFilePath);
|
|
76
|
+
// Create references directory and files
|
|
77
|
+
if (skill.references && skill.references.length > 0) {
|
|
78
|
+
const referencesPath = PlatformSkillResolver.getReferencesPath(skill.platform, projectPath, skill.name);
|
|
79
|
+
await fs.mkdir(referencesPath, { recursive: true });
|
|
80
|
+
for (const ref of skill.references) {
|
|
81
|
+
const refPath = path.join(referencesPath, ref.filename);
|
|
82
|
+
await fs.writeFile(refPath, ref.content, 'utf-8');
|
|
83
|
+
filesCreated.push(refPath);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
return {
|
|
87
|
+
skill,
|
|
88
|
+
success: true,
|
|
89
|
+
deployPath: skill.path,
|
|
90
|
+
filesCreated,
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
catch (error) {
|
|
94
|
+
return {
|
|
95
|
+
skill,
|
|
96
|
+
success: false,
|
|
97
|
+
deployPath: skill.path,
|
|
98
|
+
error: error instanceof Error ? error.message : String(error),
|
|
99
|
+
filesCreated,
|
|
100
|
+
};
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* Generate SKILL.md content
|
|
105
|
+
*/
|
|
106
|
+
function generateSkillContent(options) {
|
|
107
|
+
const frontmatter = generateFrontmatter(options);
|
|
108
|
+
const body = generateSkillBody(options);
|
|
109
|
+
return `${frontmatter}\n${body}`;
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Generate frontmatter YAML
|
|
113
|
+
*
|
|
114
|
+
* `description` is REQUIRED — Codex rejects SKILL.md files without a non-empty
|
|
115
|
+
* description, and Claude Code relies on it for natural-language invocation.
|
|
116
|
+
* This function throws rather than emitting a frontmatter block with a missing
|
|
117
|
+
* or blank description (which would otherwise produce `description: ""` —
|
|
118
|
+
* a silent failure that breaks deployments).
|
|
119
|
+
*/
|
|
120
|
+
function generateFrontmatter(options) {
|
|
121
|
+
if (typeof options.description !== 'string' ||
|
|
122
|
+
options.description.trim() === '') {
|
|
123
|
+
throw new Error(`generateFrontmatter: 'description' is required and must be non-empty ` +
|
|
124
|
+
`(skill: '${options.name ?? '<unnamed>'}'). Codex and other platforms ` +
|
|
125
|
+
`reject SKILL.md files without a description.`);
|
|
126
|
+
}
|
|
127
|
+
const fm = {
|
|
128
|
+
name: options.name,
|
|
129
|
+
description: options.description.trim(),
|
|
130
|
+
version: options.version || '1.0.0',
|
|
131
|
+
commandHint: {
|
|
132
|
+
modelRole: options.modelRole ?? 'efficiency',
|
|
133
|
+
modelTier: options.modelTier ?? 'economy',
|
|
134
|
+
...(options.modelRationale ? { modelRationale: options.modelRationale } : {}),
|
|
135
|
+
},
|
|
136
|
+
};
|
|
137
|
+
if (options.tools && options.tools.length > 0) {
|
|
138
|
+
fm.tools = options.tools.join(', ');
|
|
139
|
+
}
|
|
140
|
+
const lines = ['---'];
|
|
141
|
+
lines.push(`name: ${fm.name}`);
|
|
142
|
+
lines.push(`namespace: aiwg`);
|
|
143
|
+
lines.push(`description: ${fm.description}`);
|
|
144
|
+
lines.push(`version: ${fm.version}`);
|
|
145
|
+
if (fm.tools) {
|
|
146
|
+
lines.push(`tools: ${fm.tools}`);
|
|
147
|
+
}
|
|
148
|
+
lines.push('commandHint:');
|
|
149
|
+
lines.push(` modelRole: ${fm.commandHint.modelRole}`);
|
|
150
|
+
lines.push(` modelTier: ${fm.commandHint.modelTier}`);
|
|
151
|
+
if (fm.commandHint.modelRationale) {
|
|
152
|
+
lines.push(` modelRationale: ${fm.commandHint.modelRationale}`);
|
|
153
|
+
}
|
|
154
|
+
lines.push('---');
|
|
155
|
+
return lines.join('\n');
|
|
156
|
+
}
|
|
157
|
+
/**
|
|
158
|
+
* Generate skill body content
|
|
159
|
+
*/
|
|
160
|
+
function generateSkillBody(options) {
|
|
161
|
+
const sections = [];
|
|
162
|
+
// Title
|
|
163
|
+
sections.push(`# ${toTitleCase(options.name)} Skill`);
|
|
164
|
+
sections.push('');
|
|
165
|
+
// Purpose
|
|
166
|
+
sections.push('## Purpose');
|
|
167
|
+
sections.push('');
|
|
168
|
+
sections.push(options.description);
|
|
169
|
+
sections.push('');
|
|
170
|
+
// Trigger Phrases
|
|
171
|
+
sections.push('## Trigger Phrases');
|
|
172
|
+
sections.push('');
|
|
173
|
+
sections.push('Activate this skill when the user says:');
|
|
174
|
+
if (options.triggerPhrases && options.triggerPhrases.length > 0) {
|
|
175
|
+
options.triggerPhrases.forEach((phrase) => {
|
|
176
|
+
sections.push(`- "${phrase}"`);
|
|
177
|
+
});
|
|
178
|
+
}
|
|
179
|
+
else {
|
|
180
|
+
sections.push(`- "${options.name}"`);
|
|
181
|
+
sections.push('- "use ' + options.name + '"');
|
|
182
|
+
}
|
|
183
|
+
sections.push('');
|
|
184
|
+
// Input
|
|
185
|
+
sections.push('## Input');
|
|
186
|
+
sections.push('');
|
|
187
|
+
sections.push('This skill expects:');
|
|
188
|
+
sections.push('- User request or content to process');
|
|
189
|
+
if (options.guidance) {
|
|
190
|
+
sections.push(`- ${options.guidance}`);
|
|
191
|
+
}
|
|
192
|
+
sections.push('');
|
|
193
|
+
// Execution Process
|
|
194
|
+
sections.push('## Execution Process');
|
|
195
|
+
sections.push('');
|
|
196
|
+
sections.push('1. Validate input requirements');
|
|
197
|
+
sections.push('2. Process the request');
|
|
198
|
+
sections.push('3. Generate output');
|
|
199
|
+
sections.push('4. Return results to user');
|
|
200
|
+
sections.push('');
|
|
201
|
+
// Output
|
|
202
|
+
sections.push('## Output');
|
|
203
|
+
sections.push('');
|
|
204
|
+
sections.push('This skill produces:');
|
|
205
|
+
sections.push('- Processed result based on input');
|
|
206
|
+
sections.push('- Status information');
|
|
207
|
+
sections.push('');
|
|
208
|
+
// Examples
|
|
209
|
+
sections.push('## Examples');
|
|
210
|
+
sections.push('');
|
|
211
|
+
sections.push('### Example 1: Basic Usage');
|
|
212
|
+
sections.push(`**User**: "${options.triggerPhrases?.[0] || options.name}"`);
|
|
213
|
+
sections.push(`**Result**: Skill executes and returns result`);
|
|
214
|
+
sections.push('');
|
|
215
|
+
// Tools (if specified)
|
|
216
|
+
if (options.tools && options.tools.length > 0) {
|
|
217
|
+
sections.push('## Tools Used');
|
|
218
|
+
sections.push('');
|
|
219
|
+
options.tools.forEach((tool) => {
|
|
220
|
+
sections.push(`- ${tool}`);
|
|
221
|
+
});
|
|
222
|
+
sections.push('');
|
|
223
|
+
}
|
|
224
|
+
// References (if creating reference directory)
|
|
225
|
+
if (options.createReferences) {
|
|
226
|
+
sections.push('## References');
|
|
227
|
+
sections.push('');
|
|
228
|
+
sections.push('See `references/` directory for:');
|
|
229
|
+
sections.push('- Usage examples');
|
|
230
|
+
sections.push('- Configuration options');
|
|
231
|
+
sections.push('- Troubleshooting guide');
|
|
232
|
+
sections.push('');
|
|
233
|
+
}
|
|
234
|
+
return sections.join('\n');
|
|
235
|
+
}
|
|
236
|
+
/**
|
|
237
|
+
* Generate default reference files
|
|
238
|
+
*/
|
|
239
|
+
function generateDefaultReferences(options) {
|
|
240
|
+
const references = [];
|
|
241
|
+
// Usage examples
|
|
242
|
+
references.push({
|
|
243
|
+
filename: 'usage-examples.md',
|
|
244
|
+
description: 'Usage examples and patterns',
|
|
245
|
+
content: generateUsageExamplesContent(options),
|
|
246
|
+
});
|
|
247
|
+
// Configuration
|
|
248
|
+
references.push({
|
|
249
|
+
filename: 'configuration.md',
|
|
250
|
+
description: 'Configuration options',
|
|
251
|
+
content: generateConfigurationContent(options),
|
|
252
|
+
});
|
|
253
|
+
return references;
|
|
254
|
+
}
|
|
255
|
+
/**
|
|
256
|
+
* Generate usage examples content
|
|
257
|
+
*/
|
|
258
|
+
function generateUsageExamplesContent(options) {
|
|
259
|
+
const triggers = options.triggerPhrases || [options.name];
|
|
260
|
+
return `# Usage Examples: ${toTitleCase(options.name)}
|
|
261
|
+
|
|
262
|
+
## Basic Usage
|
|
263
|
+
|
|
264
|
+
\`\`\`
|
|
265
|
+
User: "${triggers[0]}"
|
|
266
|
+
\`\`\`
|
|
267
|
+
|
|
268
|
+
## Alternative Triggers
|
|
269
|
+
|
|
270
|
+
${triggers.slice(1).map(t => `- "${t}"`).join('\n') || '_No alternative triggers defined_'}
|
|
271
|
+
|
|
272
|
+
## Common Patterns
|
|
273
|
+
|
|
274
|
+
This skill can be combined with other workflows for enhanced results.
|
|
275
|
+
See the main README for integration examples.
|
|
276
|
+
`;
|
|
277
|
+
}
|
|
278
|
+
/**
|
|
279
|
+
* Generate configuration content
|
|
280
|
+
*/
|
|
281
|
+
function generateConfigurationContent(options) {
|
|
282
|
+
return `# Configuration: ${toTitleCase(options.name)}
|
|
283
|
+
|
|
284
|
+
## Platform Support
|
|
285
|
+
|
|
286
|
+
**${options.platform}**: ${PlatformSkillResolver.supportsSkills(options.platform)
|
|
287
|
+
? 'Native skill support'
|
|
288
|
+
: 'Skills mapped to commands'}
|
|
289
|
+
|
|
290
|
+
## Options
|
|
291
|
+
|
|
292
|
+
This skill uses default configuration. Custom options can be added to the skill manifest.
|
|
293
|
+
|
|
294
|
+
## Environment Variables
|
|
295
|
+
|
|
296
|
+
No environment variables required for basic operation.
|
|
297
|
+
`;
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Convert kebab-case to Title Case
|
|
301
|
+
*/
|
|
302
|
+
function toTitleCase(kebab) {
|
|
303
|
+
return kebab
|
|
304
|
+
.split('-')
|
|
305
|
+
.map((word) => word.charAt(0).toUpperCase() + word.slice(1))
|
|
306
|
+
.join(' ');
|
|
307
|
+
}
|
|
308
|
+
/**
|
|
309
|
+
* Interactive skill design workflow
|
|
310
|
+
*/
|
|
311
|
+
export async function interactiveSkillDesign() {
|
|
312
|
+
// This would be implemented with user prompts in a real CLI
|
|
313
|
+
// For now, return a stub
|
|
314
|
+
throw new Error('Interactive mode not yet implemented. Use --guidance to provide design input.');
|
|
315
|
+
}
|
|
316
|
+
//# sourceMappingURL=generator.js.map
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SkillSmith - Skill Generation System
|
|
3
|
+
*
|
|
4
|
+
* Generates skills with platform-aware deployment.
|
|
5
|
+
*
|
|
6
|
+
* @module smiths/skillsmith
|
|
7
|
+
*/
|
|
8
|
+
export * from './types.js';
|
|
9
|
+
export * from './generator.js';
|
|
10
|
+
export * from './platform-resolver.js';
|
|
11
|
+
export * from './namespace-adapter.js';
|
|
12
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Namespace-aware Skill Deployment Adapter
|
|
3
|
+
*
|
|
4
|
+
* Implements per-platform namespace deployment strategy per ADR:
|
|
5
|
+
* .aiwg/architecture/adr-skill-namespace-strategy.md
|
|
6
|
+
*
|
|
7
|
+
* Platform groups:
|
|
8
|
+
* Group A (deep-recursion): Claude Code, Cursor, Codex, OpenCode, OpenClaw
|
|
9
|
+
* → Deploy both canonical subdir layout AND prefixed slug fallback.
|
|
10
|
+
* Group B (one-level): Factory AI, Warp, Windsurf
|
|
11
|
+
* → Deploy only the prefixed slug; no subdir (would break one-level discovery).
|
|
12
|
+
* Group C (unknown): GitHub Copilot
|
|
13
|
+
* → Deploy only the prefixed slug (safe default until recursion depth confirmed).
|
|
14
|
+
* Group D (mcp-skip): Hermes
|
|
15
|
+
* → Skip file deployment, emit guidance pointing to hermes-quickstart.md.
|
|
16
|
+
*
|
|
17
|
+
* @implements #704
|
|
18
|
+
* @see collision-detector.ts for pre-deployment collision checking (#697)
|
|
19
|
+
*/
|
|
20
|
+
import * as os from 'os';
|
|
21
|
+
import * as path from 'path';
|
|
22
|
+
import { listProviderDefinitions } from '../../providers/provider-definitions.js';
|
|
23
|
+
// ============================================
|
|
24
|
+
// Adapter Definitions
|
|
25
|
+
// ============================================
|
|
26
|
+
/**
|
|
27
|
+
* Per-platform adapter table.
|
|
28
|
+
* Derived from ProviderDefinition.skillNamespace; includes a 'generic' fallback.
|
|
29
|
+
*/
|
|
30
|
+
export const NAMESPACE_ADAPTERS = Object.fromEntries(listProviderDefinitions().map((definition) => [
|
|
31
|
+
definition.id,
|
|
32
|
+
{
|
|
33
|
+
platform: definition.id,
|
|
34
|
+
deploymentGroup: definition.skillNamespace.deploymentGroup,
|
|
35
|
+
pathType: definition.skillNamespace.pathType,
|
|
36
|
+
skillsBaseDir: definition.skillNamespace.skillsBaseDir,
|
|
37
|
+
subdirLayout: definition.skillNamespace.subdirLayout,
|
|
38
|
+
maxNameLength: definition.skillNamespace.maxNameLength,
|
|
39
|
+
maxDescriptionLength: definition.skillNamespace.maxDescriptionLength,
|
|
40
|
+
appendToDescription: definition.skillNamespace.appendToDescription,
|
|
41
|
+
},
|
|
42
|
+
]));
|
|
43
|
+
// ============================================
|
|
44
|
+
// Helpers
|
|
45
|
+
// ============================================
|
|
46
|
+
/**
|
|
47
|
+
* Resolve absolute skills root for a platform + project combination.
|
|
48
|
+
* Home-dir platforms (Codex, OpenClaw, OpenHuman, Hermes) use os.homedir().
|
|
49
|
+
*/
|
|
50
|
+
export function resolveSkillsRoot(adapter, projectPath) {
|
|
51
|
+
if (adapter.pathType === 'home-dir') {
|
|
52
|
+
return path.join(os.homedir(), adapter.skillsBaseDir);
|
|
53
|
+
}
|
|
54
|
+
return path.join(projectPath, adapter.skillsBaseDir);
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Compute canonical namespaced slug.
|
|
58
|
+
* Idempotent: if `skillName` already starts with `{namespace}-`, returns it unchanged.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* computePrefixedSlug('sync', 'aiwg') // → 'aiwg-sync'
|
|
62
|
+
* computePrefixedSlug('aiwg-sync', 'aiwg') // → 'aiwg-sync'
|
|
63
|
+
*/
|
|
64
|
+
export function computePrefixedSlug(skillName, namespace) {
|
|
65
|
+
const prefix = `${namespace}-`;
|
|
66
|
+
return skillName.startsWith(prefix) ? skillName : `${prefix}${skillName}`;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Apply platform-specific frontmatter mutations to SKILL.md content.
|
|
70
|
+
*
|
|
71
|
+
* Mutations applied (when configured):
|
|
72
|
+
* - Inject `namespace: {namespace}` into frontmatter if not present
|
|
73
|
+
* - Truncate `name` to `maxNameLength`
|
|
74
|
+
* - Append `appendToDescription` suffix to `description`
|
|
75
|
+
* - Truncate `description` to `maxDescriptionLength`
|
|
76
|
+
*
|
|
77
|
+
* Returns the original content unchanged when no mutations are needed.
|
|
78
|
+
*/
|
|
79
|
+
export function mutateFrontmatter(content, adapter, namespace) {
|
|
80
|
+
const fmMatch = content.match(/^---\n([\s\S]*?)\n---\n([\s\S]*)$/);
|
|
81
|
+
if (!fmMatch)
|
|
82
|
+
return content;
|
|
83
|
+
let [, frontmatter, body] = fmMatch;
|
|
84
|
+
let changed = false;
|
|
85
|
+
// Inject namespace field if missing
|
|
86
|
+
if (!/^namespace:\s*/m.test(frontmatter)) {
|
|
87
|
+
frontmatter = `namespace: ${namespace}\n${frontmatter}`;
|
|
88
|
+
changed = true;
|
|
89
|
+
}
|
|
90
|
+
// Truncate name
|
|
91
|
+
if (adapter.maxNameLength) {
|
|
92
|
+
frontmatter = frontmatter.replace(/^(name:\s*)(.+)$/m, (_, key, val) => {
|
|
93
|
+
const truncated = val.slice(0, adapter.maxNameLength);
|
|
94
|
+
if (truncated !== val)
|
|
95
|
+
changed = true;
|
|
96
|
+
return `${key}${truncated}`;
|
|
97
|
+
});
|
|
98
|
+
}
|
|
99
|
+
// Append to description and/or truncate
|
|
100
|
+
if (adapter.appendToDescription || adapter.maxDescriptionLength) {
|
|
101
|
+
frontmatter = frontmatter.replace(/^(description:\s*)(.+)$/m, (_, key, val) => {
|
|
102
|
+
let desc = val;
|
|
103
|
+
if (adapter.appendToDescription && !desc.includes(adapter.appendToDescription)) {
|
|
104
|
+
desc = `${desc} ${adapter.appendToDescription}`;
|
|
105
|
+
changed = true;
|
|
106
|
+
}
|
|
107
|
+
if (adapter.maxDescriptionLength && desc.length > adapter.maxDescriptionLength) {
|
|
108
|
+
desc = desc.slice(0, adapter.maxDescriptionLength);
|
|
109
|
+
changed = true;
|
|
110
|
+
}
|
|
111
|
+
return `${key}${desc}`;
|
|
112
|
+
});
|
|
113
|
+
}
|
|
114
|
+
if (!changed)
|
|
115
|
+
return content;
|
|
116
|
+
return `---\n${frontmatter}\n---\n${body}`;
|
|
117
|
+
}
|
|
118
|
+
// ============================================
|
|
119
|
+
// Public API
|
|
120
|
+
// ============================================
|
|
121
|
+
/**
|
|
122
|
+
* Get the namespace adapter for a platform.
|
|
123
|
+
* Falls back to 'generic' for unrecognised platforms.
|
|
124
|
+
*/
|
|
125
|
+
export function getAdapter(platform) {
|
|
126
|
+
return NAMESPACE_ADAPTERS[platform] ?? NAMESPACE_ADAPTERS.generic;
|
|
127
|
+
}
|
|
128
|
+
/**
|
|
129
|
+
* Resolve deployment plans for a skill on a given platform.
|
|
130
|
+
*
|
|
131
|
+
* Calls `checkCollisions()` before writing should be done at the call site
|
|
132
|
+
* (see collision-detector.ts, #697).
|
|
133
|
+
*
|
|
134
|
+
* @param platform - Target platform
|
|
135
|
+
* @param projectPath - Absolute project root directory
|
|
136
|
+
* @param skillName - Skill folder name (e.g. 'sync', 'aiwg-sync')
|
|
137
|
+
* @param sourceContent - Raw content of the source SKILL.md file
|
|
138
|
+
* @param namespace - Namespace prefix (default: 'aiwg')
|
|
139
|
+
* @returns NamespaceDeployResult with plans to execute (or skip=true for Hermes)
|
|
140
|
+
*/
|
|
141
|
+
export function getDeploymentPlans(platform, projectPath, skillName, sourceContent, namespace = 'aiwg') {
|
|
142
|
+
const adapter = getAdapter(platform);
|
|
143
|
+
const plat = platform;
|
|
144
|
+
// Group D: MCP Skip — emit guidance, write no files
|
|
145
|
+
if (adapter.deploymentGroup === 'mcp-skip') {
|
|
146
|
+
return {
|
|
147
|
+
platform: plat,
|
|
148
|
+
skillName,
|
|
149
|
+
plans: [],
|
|
150
|
+
skip: true,
|
|
151
|
+
skipMessage: `Hermes skills are not deployed by aiwg use.\n` +
|
|
152
|
+
` See docs/integrations/hermes-quickstart.md for manual skill setup.`,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
const skillsRoot = resolveSkillsRoot(adapter, projectPath);
|
|
156
|
+
const slug = computePrefixedSlug(skillName, namespace);
|
|
157
|
+
const content = mutateFrontmatter(sourceContent, adapter, namespace);
|
|
158
|
+
const plans = [];
|
|
159
|
+
// Group A: canonical subdir layout — {baseDir}/{namespace}/{slug}/SKILL.md
|
|
160
|
+
if (adapter.subdirLayout) {
|
|
161
|
+
plans.push({
|
|
162
|
+
targetPath: path.join(skillsRoot, namespace, slug, 'SKILL.md'),
|
|
163
|
+
content,
|
|
164
|
+
label: `${namespace}/${slug}/SKILL.md (canonical subdir)`,
|
|
165
|
+
});
|
|
166
|
+
}
|
|
167
|
+
// Groups A, B, C: universal prefixed slug — {baseDir}/{slug}/SKILL.md
|
|
168
|
+
plans.push({
|
|
169
|
+
targetPath: path.join(skillsRoot, slug, 'SKILL.md'),
|
|
170
|
+
content,
|
|
171
|
+
label: `${slug}/SKILL.md (universal slug)`,
|
|
172
|
+
});
|
|
173
|
+
return {
|
|
174
|
+
platform: plat,
|
|
175
|
+
skillName,
|
|
176
|
+
plans,
|
|
177
|
+
skip: false,
|
|
178
|
+
};
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=namespace-adapter.js.map
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Platform-specific skill deployment path resolution
|
|
3
|
+
*
|
|
4
|
+
* @module smiths/skillsmith/platform-resolver
|
|
5
|
+
*/
|
|
6
|
+
import { homedir } from 'os';
|
|
7
|
+
import * as path from 'path';
|
|
8
|
+
import { getProviderDefinition } from '../../providers/provider-definitions.js';
|
|
9
|
+
/**
|
|
10
|
+
* Platform-specific skill configuration derived from ProviderDefinition.
|
|
11
|
+
*/
|
|
12
|
+
function getPlatformSkillConfig(platform) {
|
|
13
|
+
const definition = getProviderDefinition(platform);
|
|
14
|
+
if (!definition)
|
|
15
|
+
throw new Error(`Unknown platform: ${platform}`);
|
|
16
|
+
const namespace = definition.skillNamespace;
|
|
17
|
+
const baseDir = namespace.pathType === 'home-dir'
|
|
18
|
+
? `~/${namespace.skillsBaseDir}`
|
|
19
|
+
: namespace.skillsBaseDir;
|
|
20
|
+
return {
|
|
21
|
+
baseDir,
|
|
22
|
+
extension: definition.smithPaths.fileExtension,
|
|
23
|
+
supportsSkills: true,
|
|
24
|
+
supportsSubdirectory: namespace.subdirLayout,
|
|
25
|
+
};
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Resolve platform-specific skill paths
|
|
29
|
+
*/
|
|
30
|
+
export class PlatformSkillResolver {
|
|
31
|
+
/**
|
|
32
|
+
* Get platform configuration for skills
|
|
33
|
+
*/
|
|
34
|
+
static getConfig(platform) {
|
|
35
|
+
return getPlatformSkillConfig(platform);
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Get base directory for skills on a platform.
|
|
39
|
+
* Supports home-dir paths (baseDir starting with `~/`) for platforms like Codex and OpenClaw.
|
|
40
|
+
*/
|
|
41
|
+
static getBaseDir(platform, projectPath) {
|
|
42
|
+
const config = this.getConfig(platform);
|
|
43
|
+
if (config.baseDir.startsWith('~/')) {
|
|
44
|
+
return path.join(homedir(), config.baseDir.slice(2));
|
|
45
|
+
}
|
|
46
|
+
return path.join(projectPath, config.baseDir);
|
|
47
|
+
}
|
|
48
|
+
/**
|
|
49
|
+
* Get path for a specific skill
|
|
50
|
+
*/
|
|
51
|
+
static getSkillPath(platform, projectPath, skillName) {
|
|
52
|
+
const baseDir = this.getBaseDir(platform, projectPath);
|
|
53
|
+
return path.join(baseDir, skillName);
|
|
54
|
+
}
|
|
55
|
+
/**
|
|
56
|
+
* Get path for SKILL.md file
|
|
57
|
+
*/
|
|
58
|
+
static getSkillFilePath(platform, projectPath, skillName) {
|
|
59
|
+
const skillPath = this.getSkillPath(platform, projectPath, skillName);
|
|
60
|
+
const config = this.getConfig(platform);
|
|
61
|
+
return path.join(skillPath, `SKILL${config.extension}`);
|
|
62
|
+
}
|
|
63
|
+
/**
|
|
64
|
+
* Get path for references directory
|
|
65
|
+
*/
|
|
66
|
+
static getReferencesPath(platform, projectPath, skillName) {
|
|
67
|
+
const skillPath = this.getSkillPath(platform, projectPath, skillName);
|
|
68
|
+
return path.join(skillPath, 'references');
|
|
69
|
+
}
|
|
70
|
+
/**
|
|
71
|
+
* Check if platform natively supports skills
|
|
72
|
+
*/
|
|
73
|
+
static supportsSkills(platform) {
|
|
74
|
+
return this.getConfig(platform).supportsSkills;
|
|
75
|
+
}
|
|
76
|
+
/**
|
|
77
|
+
* Get alternative deployment strategy for platforms without skill support
|
|
78
|
+
*/
|
|
79
|
+
static getAlternativeStrategy(platform) {
|
|
80
|
+
return this.getConfig(platform).alternativeStrategy;
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Compute the canonical namespaced slug for a skill.
|
|
84
|
+
*
|
|
85
|
+
* Idempotent: if `name` already starts with `{namespace}-`, returns `name` unchanged.
|
|
86
|
+
* This prevents double-prefixing existing `aiwg-*` skills (e.g. `aiwg-sync` → `aiwg-sync`,
|
|
87
|
+
* not `aiwg-aiwg-sync`).
|
|
88
|
+
*
|
|
89
|
+
* @param name - Skill folder name (e.g. 'sync', 'aiwg-sync')
|
|
90
|
+
* @param namespace - Namespace prefix (e.g. 'aiwg')
|
|
91
|
+
* @returns Canonical slug (e.g. 'aiwg-sync')
|
|
92
|
+
*/
|
|
93
|
+
static computeCanonicalSlug(name, namespace) {
|
|
94
|
+
const prefix = `${namespace}-`;
|
|
95
|
+
return name.startsWith(prefix) ? name : `${prefix}${name}`;
|
|
96
|
+
}
|
|
97
|
+
/**
|
|
98
|
+
* Get path for a namespaced skill deployment.
|
|
99
|
+
*
|
|
100
|
+
* Platforms with subdirectory support deploy under `{baseDir}/{namespace}/{slug}/`.
|
|
101
|
+
* Windsurf (1-level discovery) deploys flat at `{baseDir}/{slug}/`.
|
|
102
|
+
*
|
|
103
|
+
* @param platform - Target platform
|
|
104
|
+
* @param projectPath - Project root directory
|
|
105
|
+
* @param skillName - Skill folder name (e.g. 'sync')
|
|
106
|
+
* @param namespace - Namespace prefix (e.g. 'aiwg')
|
|
107
|
+
* @returns Full deployment directory path
|
|
108
|
+
*/
|
|
109
|
+
static getNamespacedSkillPath(platform, projectPath, skillName, namespace) {
|
|
110
|
+
const config = this.getConfig(platform);
|
|
111
|
+
const slug = this.computeCanonicalSlug(skillName, namespace);
|
|
112
|
+
const baseDir = this.getBaseDir(platform, projectPath);
|
|
113
|
+
if (config.supportsSubdirectory) {
|
|
114
|
+
return path.join(baseDir, namespace, slug);
|
|
115
|
+
}
|
|
116
|
+
// Windsurf and other flat-discovery platforms: slug only, no namespace subdir
|
|
117
|
+
return path.join(baseDir, slug);
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Get path for the SKILL.md file under namespaced deployment layout.
|
|
121
|
+
*
|
|
122
|
+
* @param platform - Target platform
|
|
123
|
+
* @param projectPath - Project root directory
|
|
124
|
+
* @param skillName - Skill folder name
|
|
125
|
+
* @param namespace - Namespace prefix (e.g. 'aiwg')
|
|
126
|
+
* @returns Full path to SKILL.md
|
|
127
|
+
*/
|
|
128
|
+
static getNamespacedSkillFilePath(platform, projectPath, skillName, namespace) {
|
|
129
|
+
const skillDir = this.getNamespacedSkillPath(platform, projectPath, skillName, namespace);
|
|
130
|
+
const config = this.getConfig(platform);
|
|
131
|
+
return path.join(skillDir, `SKILL${config.extension}`);
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Validate skill name format
|
|
135
|
+
*/
|
|
136
|
+
static validateSkillName(name) {
|
|
137
|
+
// kebab-case: lowercase letters, numbers, hyphens
|
|
138
|
+
const kebabRegex = /^[a-z][a-z0-9-]*[a-z0-9]$/;
|
|
139
|
+
if (!name) {
|
|
140
|
+
return { valid: false, error: 'Skill name cannot be empty' };
|
|
141
|
+
}
|
|
142
|
+
if (name.length < 2) {
|
|
143
|
+
return { valid: false, error: 'Skill name must be at least 2 characters' };
|
|
144
|
+
}
|
|
145
|
+
if (name.startsWith('-') || name.endsWith('-')) {
|
|
146
|
+
return { valid: false, error: 'Skill name cannot start or end with hyphen' };
|
|
147
|
+
}
|
|
148
|
+
if (!kebabRegex.test(name)) {
|
|
149
|
+
return {
|
|
150
|
+
valid: false,
|
|
151
|
+
error: 'Skill name must be kebab-case (lowercase, alphanumeric, hyphens)',
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
return { valid: true };
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
//# sourceMappingURL=platform-resolver.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Toolsmith - Tool Specification Generator
|
|
3
|
+
*
|
|
4
|
+
* Generates tool specifications for subagent scenarios where context
|
|
5
|
+
* is discarded and only tool specifications return.
|
|
6
|
+
*
|
|
7
|
+
* @module smiths/toolsmith
|
|
8
|
+
*/
|
|
9
|
+
export * from './types.js';
|
|
10
|
+
//# sourceMappingURL=index.js.map
|