@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,252 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Project-Local Bundle Scaffolding
|
|
3
|
+
*
|
|
4
|
+
* Creates a complete `.aiwg/<type>/<name>/` bundle with a valid manifest,
|
|
5
|
+
* a starter artifact (skill or rule), and a README that includes the
|
|
6
|
+
* identical-form portability reminder.
|
|
7
|
+
*
|
|
8
|
+
* The output is byte-identical-shaped to upstream addon directories so
|
|
9
|
+
* `aiwg promote` can graduate it without any rewrite.
|
|
10
|
+
*
|
|
11
|
+
* @design @.aiwg/architecture/adr-identical-form-portability.md (#1038)
|
|
12
|
+
* @implements #1050
|
|
13
|
+
*/
|
|
14
|
+
import { mkdir, writeFile, stat } from 'fs/promises';
|
|
15
|
+
import { join } from 'path';
|
|
16
|
+
import { projectAiwgPath } from '../config/project-artifacts.js';
|
|
17
|
+
import { PROJECT_LOCAL_TYPE_TO_DIR as TYPE_TO_DIR } from './project-local-paths.js';
|
|
18
|
+
const NAME_REGEX = /^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/;
|
|
19
|
+
function buildManifest(opts) {
|
|
20
|
+
const { type, name, description = `Project-local ${type} '${name}'` } = opts;
|
|
21
|
+
const base = {
|
|
22
|
+
id: name,
|
|
23
|
+
type,
|
|
24
|
+
name,
|
|
25
|
+
version: '0.1.0',
|
|
26
|
+
description,
|
|
27
|
+
manifestVersion: '1',
|
|
28
|
+
platforms: { claude: 'full' },
|
|
29
|
+
keywords: [type, 'project-local'],
|
|
30
|
+
deployment: { pathTemplate: '.{platform}/skills/{id}.md' },
|
|
31
|
+
};
|
|
32
|
+
if (type === 'addon') {
|
|
33
|
+
base['addonConfig'] = { entry: { skills: 'skills/' } };
|
|
34
|
+
}
|
|
35
|
+
else if (type === 'framework') {
|
|
36
|
+
base['frameworkConfig'] = { path: 'src/' };
|
|
37
|
+
}
|
|
38
|
+
else if (type === 'plugin') {
|
|
39
|
+
base['pluginConfig'] = { payloadType: 'addon', payloadPath: 'payload/' };
|
|
40
|
+
}
|
|
41
|
+
else if (type === 'provider') {
|
|
42
|
+
base['providerConfig'] = { extends: 'claude', displayName: name };
|
|
43
|
+
}
|
|
44
|
+
return base;
|
|
45
|
+
}
|
|
46
|
+
function readme(opts) {
|
|
47
|
+
const { type, name, description = '' } = opts;
|
|
48
|
+
const usage = type === 'provider'
|
|
49
|
+
? `Select this provider while deploying a framework:
|
|
50
|
+
\`\`\`bash
|
|
51
|
+
aiwg use sdlc --provider ${name}
|
|
52
|
+
\`\`\``
|
|
53
|
+
: `Deploy to your configured providers:
|
|
54
|
+
\`\`\`bash
|
|
55
|
+
aiwg use ${name}
|
|
56
|
+
\`\`\``;
|
|
57
|
+
const upstreamDir = type === 'provider' ? 'providers' : 'addons';
|
|
58
|
+
return `# ${name}
|
|
59
|
+
|
|
60
|
+
${description || `Project-local ${type} bundle.`}
|
|
61
|
+
|
|
62
|
+
## What this is
|
|
63
|
+
|
|
64
|
+
A project-local AIWG ${type} living under \`.aiwg/${TYPE_TO_DIR[type]}/${name}/\`.
|
|
65
|
+
Discovered automatically by \`aiwg use\`${type === 'provider' ? ' as a provider alias.' : ' and deployed alongside upstream artifacts.'}
|
|
66
|
+
|
|
67
|
+
## Layout
|
|
68
|
+
|
|
69
|
+
\`\`\`
|
|
70
|
+
.aiwg/${TYPE_TO_DIR[type]}/${name}/
|
|
71
|
+
├── manifest.json # Bundle metadata (validated by aiwg)
|
|
72
|
+
├── README.md # This file
|
|
73
|
+
└── ${type === 'framework' ? 'src/' : type === 'plugin' ? 'payload/' : type === 'provider' ? 'manifest.json only' : 'skills/ or rules/'}
|
|
74
|
+
\`\`\`
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
${usage}
|
|
79
|
+
|
|
80
|
+
Inspect health:
|
|
81
|
+
\`\`\`bash
|
|
82
|
+
aiwg doctor --project-local
|
|
83
|
+
\`\`\`
|
|
84
|
+
|
|
85
|
+
Remove (preserves source under \`.aiwg/\`):
|
|
86
|
+
\`\`\`bash
|
|
87
|
+
aiwg remove ${name}
|
|
88
|
+
\`\`\`
|
|
89
|
+
|
|
90
|
+
## Identical-form portability
|
|
91
|
+
|
|
92
|
+
This directory is shaped **byte-identical** to upstream
|
|
93
|
+
\`agentic/code/${upstreamDir}/${name}/\`. To graduate, run:
|
|
94
|
+
|
|
95
|
+
\`\`\`bash
|
|
96
|
+
aiwg promote ${name} --dry-run # preview
|
|
97
|
+
aiwg promote ${name} # copy to upstream
|
|
98
|
+
aiwg promote ${name} --to corpus ~/my-corpus/ # or to a private corpus
|
|
99
|
+
\`\`\`
|
|
100
|
+
|
|
101
|
+
Keep this directory shaped like upstream so \`aiwg promote\` works.
|
|
102
|
+
|
|
103
|
+
## Customization tips
|
|
104
|
+
|
|
105
|
+
- Edit \`manifest.json\` to set a real \`description\`, bump \`version\` to
|
|
106
|
+
\`1.0.0\` when stable, and add platforms beyond \`claude\` if needed.
|
|
107
|
+
- Add new artifacts under \`skills/\`, \`rules/\`, \`agents/\`, or \`commands/\`
|
|
108
|
+
per AIWG conventions.
|
|
109
|
+
- Use \`@\`-references for cross-artifact links: \`@$AIWG_ROOT/...\` for
|
|
110
|
+
upstream paths, \`@.aiwg/...\` for project-local references (note: the
|
|
111
|
+
latter will block promotion unless \`--force\` is passed).
|
|
112
|
+
|
|
113
|
+
## See also
|
|
114
|
+
|
|
115
|
+
- \`docs/customization/project-local-quickstart.md\` — first bundle in 5 minutes
|
|
116
|
+
- \`docs/customization/project-local-lifecycle.md\` — full lifecycle reference
|
|
117
|
+
- \`docs/customization/extensions-vs-addons-vs-frameworks-vs-plugins.md\` — pick the right type
|
|
118
|
+
`;
|
|
119
|
+
}
|
|
120
|
+
const STARTER_SKILL = (name) => `---
|
|
121
|
+
name: ${name}-skill
|
|
122
|
+
description: Starter skill for the ${name} project-local bundle. Customize this.
|
|
123
|
+
commandHint:
|
|
124
|
+
modelRole: efficiency
|
|
125
|
+
modelTier: economy
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
# ${name}-skill
|
|
129
|
+
|
|
130
|
+
Replace this body with the workflow your skill performs.
|
|
131
|
+
|
|
132
|
+
## When to use
|
|
133
|
+
|
|
134
|
+
Describe the trigger conditions for this skill.
|
|
135
|
+
|
|
136
|
+
## Steps
|
|
137
|
+
|
|
138
|
+
1. Step one
|
|
139
|
+
2. Step two
|
|
140
|
+
|
|
141
|
+
<!-- TIP: keep front-matter \`name\` matching the file basename for predictable -->
|
|
142
|
+
<!-- TIP: deploy paths and traceability with the SKILL.md frontmatter schema. -->
|
|
143
|
+
`;
|
|
144
|
+
const STARTER_RULE = (name) => `---
|
|
145
|
+
id: ${name}-rule
|
|
146
|
+
---
|
|
147
|
+
|
|
148
|
+
# ${name}-rule
|
|
149
|
+
|
|
150
|
+
Describe the rule. Keep it concise — rules are loaded into every relevant
|
|
151
|
+
agent context, so terseness pays off.
|
|
152
|
+
|
|
153
|
+
## Why
|
|
154
|
+
|
|
155
|
+
Explain the motivation. Future-you will thank you.
|
|
156
|
+
|
|
157
|
+
## How to apply
|
|
158
|
+
|
|
159
|
+
State when this rule fires and what action it requires.
|
|
160
|
+
`;
|
|
161
|
+
const STARTER_AGENT = (name) => `---
|
|
162
|
+
name: ${name}-agent
|
|
163
|
+
description: Starter agent for the ${name} project-local bundle.
|
|
164
|
+
model-role: efficiency
|
|
165
|
+
model-tier: economy
|
|
166
|
+
---
|
|
167
|
+
|
|
168
|
+
# ${name}-agent
|
|
169
|
+
|
|
170
|
+
You are a specialist for [domain]. Customize this body with the agent's
|
|
171
|
+
focus, allowed tools, and termination conditions.
|
|
172
|
+
`;
|
|
173
|
+
export async function scaffoldProjectLocalBundle(options) {
|
|
174
|
+
const projectDir = options.projectDir ?? process.cwd();
|
|
175
|
+
const refuseOnExists = options.refuseOnExists ?? true;
|
|
176
|
+
const dryRun = options.dryRun ?? false;
|
|
177
|
+
if (!NAME_REGEX.test(options.name)) {
|
|
178
|
+
throw new Error(`Invalid bundle name '${options.name}': must be kebab-case (a-z, 0-9, '-'), no leading/trailing hyphen.`);
|
|
179
|
+
}
|
|
180
|
+
const dirName = TYPE_TO_DIR[options.type];
|
|
181
|
+
const bundlePath = projectAiwgPath(projectDir, dirName, options.name);
|
|
182
|
+
// Refuse to overwrite
|
|
183
|
+
try {
|
|
184
|
+
await stat(bundlePath);
|
|
185
|
+
if (refuseOnExists) {
|
|
186
|
+
return { bundlePath, filesCreated: [], alreadyExists: true, dryRun };
|
|
187
|
+
}
|
|
188
|
+
}
|
|
189
|
+
catch {
|
|
190
|
+
// Doesn't exist — good
|
|
191
|
+
}
|
|
192
|
+
if (dryRun) {
|
|
193
|
+
// Compute the file list without writing anything.
|
|
194
|
+
const starter = options.starter ?? (options.type === 'framework' || options.type === 'plugin' || options.type === 'provider' ? 'minimal' : 'skill');
|
|
195
|
+
const filesCreated = ['manifest.json', 'README.md'];
|
|
196
|
+
if (starter === 'skill')
|
|
197
|
+
filesCreated.push(`skills/${options.name}-skill/SKILL.md`);
|
|
198
|
+
else if (starter === 'rule')
|
|
199
|
+
filesCreated.push(`rules/${options.name}.md`);
|
|
200
|
+
else if (starter === 'agent')
|
|
201
|
+
filesCreated.push(`agents/${options.name}.md`);
|
|
202
|
+
if (options.type === 'framework')
|
|
203
|
+
filesCreated.push('src/.gitkeep');
|
|
204
|
+
if (options.type === 'plugin')
|
|
205
|
+
filesCreated.push('payload/.gitkeep');
|
|
206
|
+
return { bundlePath, filesCreated, alreadyExists: false, dryRun: true };
|
|
207
|
+
}
|
|
208
|
+
await mkdir(bundlePath, { recursive: true });
|
|
209
|
+
const filesCreated = [];
|
|
210
|
+
// Pick starter
|
|
211
|
+
const starter = options.starter ?? (options.type === 'framework' || options.type === 'plugin' || options.type === 'provider' ? 'minimal' : 'skill');
|
|
212
|
+
// manifest.json
|
|
213
|
+
const manifest = buildManifest(options);
|
|
214
|
+
await writeFile(join(bundlePath, 'manifest.json'), JSON.stringify(manifest, null, 2) + '\n', 'utf-8');
|
|
215
|
+
filesCreated.push('manifest.json');
|
|
216
|
+
// README.md
|
|
217
|
+
await writeFile(join(bundlePath, 'README.md'), readme(options), 'utf-8');
|
|
218
|
+
filesCreated.push('README.md');
|
|
219
|
+
// Starter artifact
|
|
220
|
+
if (starter === 'skill') {
|
|
221
|
+
const skillDir = join(bundlePath, 'skills', `${options.name}-skill`);
|
|
222
|
+
await mkdir(skillDir, { recursive: true });
|
|
223
|
+
await writeFile(join(skillDir, 'SKILL.md'), STARTER_SKILL(options.name), 'utf-8');
|
|
224
|
+
filesCreated.push(`skills/${options.name}-skill/SKILL.md`);
|
|
225
|
+
}
|
|
226
|
+
else if (starter === 'rule') {
|
|
227
|
+
const rulesDir = join(bundlePath, 'rules');
|
|
228
|
+
await mkdir(rulesDir, { recursive: true });
|
|
229
|
+
await writeFile(join(rulesDir, `${options.name}.md`), STARTER_RULE(options.name), 'utf-8');
|
|
230
|
+
filesCreated.push(`rules/${options.name}.md`);
|
|
231
|
+
}
|
|
232
|
+
else if (starter === 'agent') {
|
|
233
|
+
const agentsDir = join(bundlePath, 'agents');
|
|
234
|
+
await mkdir(agentsDir, { recursive: true });
|
|
235
|
+
await writeFile(join(agentsDir, `${options.name}.md`), STARTER_AGENT(options.name), 'utf-8');
|
|
236
|
+
filesCreated.push(`agents/${options.name}.md`);
|
|
237
|
+
}
|
|
238
|
+
// 'minimal' = no starter artifact (operator fills it in)
|
|
239
|
+
// Type-specific stub directories
|
|
240
|
+
if (options.type === 'framework') {
|
|
241
|
+
await mkdir(join(bundlePath, 'src'), { recursive: true });
|
|
242
|
+
await writeFile(join(bundlePath, 'src', '.gitkeep'), '# Framework source files go here\n', 'utf-8');
|
|
243
|
+
filesCreated.push('src/.gitkeep');
|
|
244
|
+
}
|
|
245
|
+
if (options.type === 'plugin') {
|
|
246
|
+
await mkdir(join(bundlePath, 'payload'), { recursive: true });
|
|
247
|
+
await writeFile(join(bundlePath, 'payload', '.gitkeep'), '# Plugin payload files go here\n', 'utf-8');
|
|
248
|
+
filesCreated.push('payload/.gitkeep');
|
|
249
|
+
}
|
|
250
|
+
return { bundlePath, filesCreated, alreadyExists: false };
|
|
251
|
+
}
|
|
252
|
+
//# sourceMappingURL=project-local-scaffold.js.map
|
|
@@ -0,0 +1,291 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Canonical project quickref generation and provider-aware deployment.
|
|
3
|
+
*
|
|
4
|
+
* The committed source is `.aiwg/quickref.json`. Generated and provider
|
|
5
|
+
* copies are expendable and carry ownership markers so stale copies can be
|
|
6
|
+
* removed without touching operator-authored skills.
|
|
7
|
+
*/
|
|
8
|
+
import { createHash } from 'crypto';
|
|
9
|
+
import { access, mkdir, readFile, readdir, rm, writeFile } from 'fs/promises';
|
|
10
|
+
import { dirname, isAbsolute, join, resolve } from 'path';
|
|
11
|
+
import { homedir } from 'os';
|
|
12
|
+
import { z } from 'zod';
|
|
13
|
+
import { getProviderDefinition, normalizeProviderDefinitionId, } from '../providers/provider-definitions.js';
|
|
14
|
+
import { OPERATIONAL_SHOW_TYPES } from '../artifacts/types.js';
|
|
15
|
+
import { projectAiwgPath } from '../config/project-artifacts.js';
|
|
16
|
+
import { appendAiwgSourceTrackBlock } from './project-local-gitignore.js';
|
|
17
|
+
const OWNERSHIP_MARKER = '.aiwg-project-quickref.json';
|
|
18
|
+
const ShowHintSchema = z.object({
|
|
19
|
+
type: z.enum(OPERATIONAL_SHOW_TYPES),
|
|
20
|
+
name: z.string().min(1).max(128),
|
|
21
|
+
}).strict();
|
|
22
|
+
const QuickrefEntrySchema = z.object({
|
|
23
|
+
title: z.string().min(1).max(128),
|
|
24
|
+
summary: z.string().min(1).max(512),
|
|
25
|
+
discover: z.array(z.string().min(1).max(256)).max(10).default([]),
|
|
26
|
+
show: z.array(ShowHintSchema).max(20).default([]),
|
|
27
|
+
}).strict().refine(entry => entry.discover.length > 0 || entry.show.length > 0, { message: 'each entry must provide at least one discover or show hint' });
|
|
28
|
+
export const ProjectQuickrefSchema = z.object({
|
|
29
|
+
version: z.literal('1'),
|
|
30
|
+
project: z.object({
|
|
31
|
+
id: z.string().regex(/^[a-z0-9]([a-z0-9-]*[a-z0-9])?$/, 'must be kebab-case'),
|
|
32
|
+
name: z.string().min(1).max(128),
|
|
33
|
+
description: z.string().min(1).max(512),
|
|
34
|
+
}).strict(),
|
|
35
|
+
precedence: z.string().min(1).max(1024),
|
|
36
|
+
entries: z.array(QuickrefEntrySchema).min(1).max(50),
|
|
37
|
+
}).strict();
|
|
38
|
+
function sha256(content) {
|
|
39
|
+
return createHash('sha256').update(content).digest('hex');
|
|
40
|
+
}
|
|
41
|
+
async function readIfPresent(filePath) {
|
|
42
|
+
try {
|
|
43
|
+
return await readFile(filePath, 'utf8');
|
|
44
|
+
}
|
|
45
|
+
catch {
|
|
46
|
+
return null;
|
|
47
|
+
}
|
|
48
|
+
}
|
|
49
|
+
export function projectQuickrefSkillName(projectId) {
|
|
50
|
+
return `aiwg-project-${projectId}-quickref`;
|
|
51
|
+
}
|
|
52
|
+
export async function loadProjectQuickref(projectDir) {
|
|
53
|
+
const sourcePath = projectAiwgPath(projectDir, 'quickref.json');
|
|
54
|
+
let raw;
|
|
55
|
+
try {
|
|
56
|
+
raw = await readFile(sourcePath, 'utf8');
|
|
57
|
+
}
|
|
58
|
+
catch (error) {
|
|
59
|
+
const code = error.code;
|
|
60
|
+
return {
|
|
61
|
+
sourcePath,
|
|
62
|
+
errors: code === 'ENOENT' ? [] : [`${sourcePath}: ${error.message}`],
|
|
63
|
+
exists: code !== 'ENOENT',
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
try {
|
|
67
|
+
const parsed = ProjectQuickrefSchema.safeParse(JSON.parse(raw));
|
|
68
|
+
if (!parsed.success) {
|
|
69
|
+
return {
|
|
70
|
+
sourcePath,
|
|
71
|
+
exists: true,
|
|
72
|
+
errors: parsed.error.issues.map(issue => `${sourcePath}: ${issue.path.join('.') || '(root)'}: ${issue.message}`),
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
return { sourcePath, definition: parsed.data, errors: [], exists: true };
|
|
76
|
+
}
|
|
77
|
+
catch (error) {
|
|
78
|
+
return { sourcePath, errors: [`${sourcePath}: invalid JSON: ${error.message}`], exists: true };
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
export function renderProjectQuickref(definition) {
|
|
82
|
+
const skillName = projectQuickrefSkillName(definition.project.id);
|
|
83
|
+
const lines = [
|
|
84
|
+
'---',
|
|
85
|
+
`name: ${skillName}`,
|
|
86
|
+
`description: ${JSON.stringify(`Project-specific orientation for ${definition.project.name}`)}`,
|
|
87
|
+
'kernel: true',
|
|
88
|
+
'platforms: [all]',
|
|
89
|
+
'---',
|
|
90
|
+
'',
|
|
91
|
+
`# ${definition.project.name} Quick Reference`,
|
|
92
|
+
'',
|
|
93
|
+
definition.project.description,
|
|
94
|
+
'',
|
|
95
|
+
'## Precedence',
|
|
96
|
+
'',
|
|
97
|
+
definition.precedence,
|
|
98
|
+
'',
|
|
99
|
+
];
|
|
100
|
+
for (const entry of definition.entries) {
|
|
101
|
+
lines.push(`## ${entry.title}`, '', entry.summary, '');
|
|
102
|
+
for (const phrase of entry.discover) {
|
|
103
|
+
lines.push(`- Discover: \`aiwg discover ${JSON.stringify(phrase)}\``);
|
|
104
|
+
}
|
|
105
|
+
for (const hint of entry.show) {
|
|
106
|
+
lines.push(`- Fetch: \`aiwg show ${hint.type} ${hint.name}\``);
|
|
107
|
+
}
|
|
108
|
+
lines.push('');
|
|
109
|
+
}
|
|
110
|
+
lines.push('The quickref is an orientation layer. Retrieve the indexed project asset before applying its full workflow.', '');
|
|
111
|
+
return lines.join('\n');
|
|
112
|
+
}
|
|
113
|
+
export async function generateProjectQuickref(projectDir, options = {}) {
|
|
114
|
+
const loaded = await loadProjectQuickref(projectDir);
|
|
115
|
+
if (!loaded.exists)
|
|
116
|
+
throw new Error(`Project quickref source not found: ${loaded.sourcePath}`);
|
|
117
|
+
if (!loaded.definition)
|
|
118
|
+
throw new Error(loaded.errors.join('\n'));
|
|
119
|
+
if (!options.dryRun)
|
|
120
|
+
await appendAiwgSourceTrackBlock(projectDir);
|
|
121
|
+
const skillName = projectQuickrefSkillName(loaded.definition.project.id);
|
|
122
|
+
const outputPath = projectAiwgPath(projectDir, 'generated', 'project-quickref', skillName, 'SKILL.md');
|
|
123
|
+
const content = renderProjectQuickref(loaded.definition);
|
|
124
|
+
const current = await readIfPresent(outputPath);
|
|
125
|
+
const changed = current !== content;
|
|
126
|
+
if (!options.dryRun && changed) {
|
|
127
|
+
await mkdir(dirname(outputPath), { recursive: true });
|
|
128
|
+
await writeFile(outputPath, content, 'utf8');
|
|
129
|
+
}
|
|
130
|
+
if (!options.dryRun) {
|
|
131
|
+
const generatedRoot = projectAiwgPath(projectDir, 'generated', 'project-quickref');
|
|
132
|
+
try {
|
|
133
|
+
const entries = await readdir(generatedRoot, { withFileTypes: true });
|
|
134
|
+
for (const entry of entries) {
|
|
135
|
+
if (entry.isDirectory() && entry.name !== skillName) {
|
|
136
|
+
await rm(join(generatedRoot, entry.name), { recursive: true });
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
catch (error) {
|
|
141
|
+
if (error.code !== 'ENOENT')
|
|
142
|
+
throw error;
|
|
143
|
+
}
|
|
144
|
+
}
|
|
145
|
+
return {
|
|
146
|
+
sourcePath: loaded.sourcePath,
|
|
147
|
+
outputPath,
|
|
148
|
+
skillName,
|
|
149
|
+
content,
|
|
150
|
+
changed,
|
|
151
|
+
dryRun: options.dryRun ?? false,
|
|
152
|
+
};
|
|
153
|
+
}
|
|
154
|
+
function resolveProviderSkillsRoot(provider, projectDir, homeDir) {
|
|
155
|
+
const normalized = normalizeProviderDefinitionId(provider);
|
|
156
|
+
if (!normalized)
|
|
157
|
+
throw new Error(`Unknown provider '${provider}'`);
|
|
158
|
+
const definition = getProviderDefinition(normalized);
|
|
159
|
+
if (!definition)
|
|
160
|
+
throw new Error(`Provider definition unavailable for '${provider}'`);
|
|
161
|
+
const configured = definition.paths.kernelSkills ?? definition.paths.artifacts.skills;
|
|
162
|
+
if (!configured)
|
|
163
|
+
throw new Error(`Provider '${normalized}' has no supported skill or aggregation target`);
|
|
164
|
+
const expanded = configured === '~'
|
|
165
|
+
? homeDir
|
|
166
|
+
: configured.startsWith('~/')
|
|
167
|
+
? join(homeDir, configured.slice(2))
|
|
168
|
+
: configured;
|
|
169
|
+
return {
|
|
170
|
+
provider: normalized,
|
|
171
|
+
root: isAbsolute(expanded) ? expanded : resolve(projectDir, expanded),
|
|
172
|
+
emulated: definition.paths.kernelSkills === null,
|
|
173
|
+
global: definition.paths.deployTarget === 'home' || configured.startsWith('~/'),
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
async function readOwnershipMarker(skillDir) {
|
|
177
|
+
const raw = await readIfPresent(join(skillDir, OWNERSHIP_MARKER));
|
|
178
|
+
if (!raw)
|
|
179
|
+
return null;
|
|
180
|
+
try {
|
|
181
|
+
const marker = JSON.parse(raw);
|
|
182
|
+
return marker.version === 1 ? marker : null;
|
|
183
|
+
}
|
|
184
|
+
catch {
|
|
185
|
+
return null;
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
async function findStaleOwnedQuickrefs(root, projectDir, keepName, global) {
|
|
189
|
+
let entries;
|
|
190
|
+
try {
|
|
191
|
+
entries = await readdir(root, { withFileTypes: true });
|
|
192
|
+
}
|
|
193
|
+
catch {
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
const stale = [];
|
|
197
|
+
for (const entry of entries) {
|
|
198
|
+
if (!entry.isDirectory() || entry.name === keepName)
|
|
199
|
+
continue;
|
|
200
|
+
const candidate = join(root, entry.name);
|
|
201
|
+
const marker = await readOwnershipMarker(candidate);
|
|
202
|
+
if (marker && (!global || marker.sourceProject === resolve(projectDir)))
|
|
203
|
+
stale.push(candidate);
|
|
204
|
+
}
|
|
205
|
+
return stale;
|
|
206
|
+
}
|
|
207
|
+
export async function deployProjectQuickref(projectDir, provider, options = {}) {
|
|
208
|
+
const generated = await generateProjectQuickref(projectDir, { dryRun: options.dryRun });
|
|
209
|
+
const loaded = await loadProjectQuickref(projectDir);
|
|
210
|
+
if (!loaded.definition)
|
|
211
|
+
throw new Error(loaded.errors.join('\n'));
|
|
212
|
+
const target = resolveProviderSkillsRoot(provider, projectDir, options.homeDir ?? homedir());
|
|
213
|
+
const targetDir = join(target.root, generated.skillName);
|
|
214
|
+
const targetPath = join(targetDir, 'SKILL.md');
|
|
215
|
+
const existingMarker = await readOwnershipMarker(targetDir);
|
|
216
|
+
try {
|
|
217
|
+
await access(targetDir);
|
|
218
|
+
if (!existingMarker) {
|
|
219
|
+
throw new Error(`Refusing to replace operator-owned skill directory: ${targetDir}`);
|
|
220
|
+
}
|
|
221
|
+
if (existingMarker.projectId !== loaded.definition.project.id ||
|
|
222
|
+
(target.global && existingMarker.sourceProject !== resolve(projectDir))) {
|
|
223
|
+
throw new Error(`Project quickref collision at ${targetDir}; project id '${loaded.definition.project.id}' is already owned by ${existingMarker.sourceProject}`);
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
catch (error) {
|
|
227
|
+
if (error.code !== 'ENOENT')
|
|
228
|
+
throw error;
|
|
229
|
+
}
|
|
230
|
+
const marker = {
|
|
231
|
+
version: 1,
|
|
232
|
+
projectId: loaded.definition.project.id,
|
|
233
|
+
sourceProject: resolve(projectDir),
|
|
234
|
+
sourcePath: loaded.sourcePath,
|
|
235
|
+
contentHash: sha256(generated.content),
|
|
236
|
+
};
|
|
237
|
+
const markerContent = JSON.stringify(marker, null, 2) + '\n';
|
|
238
|
+
const currentContent = await readIfPresent(targetPath);
|
|
239
|
+
const currentMarker = await readIfPresent(join(targetDir, OWNERSHIP_MARKER));
|
|
240
|
+
const changed = currentContent !== generated.content || currentMarker !== markerContent;
|
|
241
|
+
const stale = await findStaleOwnedQuickrefs(target.root, projectDir, generated.skillName, target.global);
|
|
242
|
+
if (!options.dryRun) {
|
|
243
|
+
for (const stalePath of stale)
|
|
244
|
+
await rm(stalePath, { recursive: true });
|
|
245
|
+
if (changed) {
|
|
246
|
+
await mkdir(targetDir, { recursive: true });
|
|
247
|
+
await writeFile(targetPath, generated.content, 'utf8');
|
|
248
|
+
await writeFile(join(targetDir, OWNERSHIP_MARKER), markerContent, 'utf8');
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return {
|
|
252
|
+
provider: target.provider,
|
|
253
|
+
targetPath,
|
|
254
|
+
skillName: generated.skillName,
|
|
255
|
+
changed,
|
|
256
|
+
pruned: stale,
|
|
257
|
+
emulated: target.emulated,
|
|
258
|
+
dryRun: options.dryRun ?? false,
|
|
259
|
+
};
|
|
260
|
+
}
|
|
261
|
+
export async function auditProjectQuickref(projectDir, providers, options = {}) {
|
|
262
|
+
const loaded = await loadProjectQuickref(projectDir);
|
|
263
|
+
if (!loaded.exists)
|
|
264
|
+
return { exists: false, errors: loaded.errors, drift: [] };
|
|
265
|
+
if (!loaded.definition)
|
|
266
|
+
return { exists: true, errors: loaded.errors, drift: [] };
|
|
267
|
+
const content = renderProjectQuickref(loaded.definition);
|
|
268
|
+
const skillName = projectQuickrefSkillName(loaded.definition.project.id);
|
|
269
|
+
const generatedPath = projectAiwgPath(projectDir, 'generated', 'project-quickref', skillName, 'SKILL.md');
|
|
270
|
+
const drift = [];
|
|
271
|
+
if (await readIfPresent(generatedPath) !== content) {
|
|
272
|
+
drift.push(`generated quickref is missing or stale: ${generatedPath}`);
|
|
273
|
+
}
|
|
274
|
+
for (const provider of providers) {
|
|
275
|
+
try {
|
|
276
|
+
const target = resolveProviderSkillsRoot(provider, projectDir, options.homeDir ?? homedir());
|
|
277
|
+
const deployed = join(target.root, skillName, 'SKILL.md');
|
|
278
|
+
if (await readIfPresent(deployed) !== content) {
|
|
279
|
+
drift.push(`${target.provider}: deployed quickref is missing or stale: ${deployed}`);
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
catch (error) {
|
|
283
|
+
drift.push(`${provider}: ${error.message}`);
|
|
284
|
+
}
|
|
285
|
+
}
|
|
286
|
+
return { exists: true, errors: [], drift, skillName };
|
|
287
|
+
}
|
|
288
|
+
export function projectQuickrefSourcePath(projectDir) {
|
|
289
|
+
return projectAiwgPath(projectDir, 'quickref.json');
|
|
290
|
+
}
|
|
291
|
+
//# sourceMappingURL=project-quickref.js.map
|