@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,606 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Artifact Index Types
|
|
3
|
+
*
|
|
4
|
+
* Shared TypeScript types for the artifact indexing system.
|
|
5
|
+
* Used by index-builder, query-engine, dep-graph, and stats modules.
|
|
6
|
+
*
|
|
7
|
+
* @implements #420
|
|
8
|
+
* @source @src/artifacts/cli.ts
|
|
9
|
+
* @tests @test/unit/artifacts/index-builder.test.ts
|
|
10
|
+
*/
|
|
11
|
+
import fs from 'fs';
|
|
12
|
+
import os from 'node:os';
|
|
13
|
+
import path from 'node:path';
|
|
14
|
+
import { load as loadYaml } from 'js-yaml';
|
|
15
|
+
import { DEFAULT_PROJECT_AIWG_DIR, projectAiwgPath, resolveProjectAiwgDir, } from '../config/project-artifacts.js';
|
|
16
|
+
/**
|
|
17
|
+
* Operational artifact kinds that belong on the broad capability-discovery
|
|
18
|
+
* surface. This is intentionally narrower than every indexed artifact type:
|
|
19
|
+
* `query` remains the general document/artifact search surface, while
|
|
20
|
+
* `discover` is for assets agents can act on or route to.
|
|
21
|
+
*/
|
|
22
|
+
export const OPERATIONAL_DISCOVERY_TYPES = [
|
|
23
|
+
'skill',
|
|
24
|
+
'agent',
|
|
25
|
+
'command',
|
|
26
|
+
'rule',
|
|
27
|
+
'flow',
|
|
28
|
+
'runbook',
|
|
29
|
+
'template',
|
|
30
|
+
'behavior',
|
|
31
|
+
];
|
|
32
|
+
/**
|
|
33
|
+
* Operational artifact kinds that `aiwg show <type> <name>` can fetch. Hooks
|
|
34
|
+
* are operational but low-level, so they are showable and focus-searchable
|
|
35
|
+
* without being part of broad discovery defaults.
|
|
36
|
+
*/
|
|
37
|
+
export const OPERATIONAL_SHOW_TYPES = [
|
|
38
|
+
...OPERATIONAL_DISCOVERY_TYPES,
|
|
39
|
+
'hook',
|
|
40
|
+
];
|
|
41
|
+
export function isOperationalShowType(value) {
|
|
42
|
+
return OPERATIONAL_SHOW_TYPES.includes(value);
|
|
43
|
+
}
|
|
44
|
+
export const DEFAULT_INDEX_EXTENSIONS = ['.md', '.yaml', '.yml', '.json'];
|
|
45
|
+
/**
|
|
46
|
+
* Template assets are often provider-native files (`config.toml`,
|
|
47
|
+
* `AGENTS.md.aiwg-template`, GitHub workflow `.yml`, JSONC snippets, etc.).
|
|
48
|
+
* These extensions are only meaningful as operational templates when the file
|
|
49
|
+
* is under a `templates/` directory; type inference enforces that boundary.
|
|
50
|
+
*/
|
|
51
|
+
export const TEMPLATE_INDEX_EXTENSIONS = [
|
|
52
|
+
'.aiwg-template',
|
|
53
|
+
'.aiwg-base',
|
|
54
|
+
'.jsonc',
|
|
55
|
+
'.tmpl',
|
|
56
|
+
'.j2',
|
|
57
|
+
'.csv',
|
|
58
|
+
'.toml',
|
|
59
|
+
];
|
|
60
|
+
export const FRAMEWORK_INDEX_EXTENSIONS = [
|
|
61
|
+
...DEFAULT_INDEX_EXTENSIONS,
|
|
62
|
+
...TEMPLATE_INDEX_EXTENSIONS,
|
|
63
|
+
];
|
|
64
|
+
/**
|
|
65
|
+
* Normalize a raw edge value to TypedEdge.
|
|
66
|
+
* Handles backward compatibility: plain strings become { path, type: "depends-on" }.
|
|
67
|
+
*/
|
|
68
|
+
export function normalizeEdge(edge) {
|
|
69
|
+
if (typeof edge === 'string')
|
|
70
|
+
return { path: edge, type: 'depends-on' };
|
|
71
|
+
return edge;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Normalize an array of raw edges to TypedEdge[].
|
|
75
|
+
*/
|
|
76
|
+
export function normalizeEdges(edges) {
|
|
77
|
+
return edges.map(normalizeEdge);
|
|
78
|
+
}
|
|
79
|
+
/**
|
|
80
|
+
* Phase name to directory mapping
|
|
81
|
+
*/
|
|
82
|
+
export const PHASE_DIRECTORIES = {
|
|
83
|
+
requirements: '.aiwg/requirements',
|
|
84
|
+
architecture: '.aiwg/architecture',
|
|
85
|
+
testing: '.aiwg/testing',
|
|
86
|
+
security: '.aiwg/security',
|
|
87
|
+
deployment: '.aiwg/deployment',
|
|
88
|
+
risks: '.aiwg/risks',
|
|
89
|
+
planning: '.aiwg/planning',
|
|
90
|
+
intake: '.aiwg/intake',
|
|
91
|
+
reports: '.aiwg/reports',
|
|
92
|
+
};
|
|
93
|
+
/**
|
|
94
|
+
* Default index output directory
|
|
95
|
+
*/
|
|
96
|
+
export const INDEX_DIR = '.aiwg/.index';
|
|
97
|
+
/**
|
|
98
|
+
* Current index format version
|
|
99
|
+
*/
|
|
100
|
+
export const INDEX_VERSION = '1.0.0';
|
|
101
|
+
/**
|
|
102
|
+
* Metadata extraction revision. Unlike INDEX_VERSION, this can change without
|
|
103
|
+
* making the serialized index schema incompatible; a mismatch simply forces a
|
|
104
|
+
* one-time content re-extraction during the next incremental build.
|
|
105
|
+
*/
|
|
106
|
+
export const INDEX_EXTRACTOR_VERSION = '2026.07.21.2';
|
|
107
|
+
/**
|
|
108
|
+
* Built-in graph definitions
|
|
109
|
+
*/
|
|
110
|
+
export const BUILTIN_GRAPH_CONFIGS = {
|
|
111
|
+
framework: {
|
|
112
|
+
type: 'framework',
|
|
113
|
+
// Includes `agentic/code/extensions` and
|
|
114
|
+
// `agentic/code/behaviors` so extension bundles (sys, net, it, sec,
|
|
115
|
+
// stream, dev) and top-level behaviors (concierge, security-sentinel, ...)
|
|
116
|
+
// appear in `aiwg discover` alongside frameworks and addons. Marketplace
|
|
117
|
+
// plugin bundles under `agentic/code/plugins` are provider/package mirrors
|
|
118
|
+
// of canonical framework/addon/extension capabilities, so they are
|
|
119
|
+
// intentionally excluded from the capability graph to avoid duplicate
|
|
120
|
+
// records, slower searches, and inflated Fortemi caches. `inferType()` in
|
|
121
|
+
// index-builder.ts uses nearest-type-dir ancestor matching to handle
|
|
122
|
+
// every nested layout (slug vs flat, frameworks/<f>/extensions/<sub>,
|
|
123
|
+
// research-complete/elaboration/{agents,commands}, etc.).
|
|
124
|
+
scanDirs: [
|
|
125
|
+
'agentic/code/frameworks',
|
|
126
|
+
'agentic/code/addons',
|
|
127
|
+
'agentic/code/extensions',
|
|
128
|
+
'agentic/code/agents',
|
|
129
|
+
'agentic/code/behaviors',
|
|
130
|
+
'docs',
|
|
131
|
+
],
|
|
132
|
+
extensions: [...FRAMEWORK_INDEX_EXTENSIONS],
|
|
133
|
+
shared: true,
|
|
134
|
+
// Not built by `aiwg index build` (no flag) — that would write to
|
|
135
|
+
// the shared XDG location from any project. Freshness is guaranteed
|
|
136
|
+
// by the explicit post-deploy rebuild in `useHandler` (#1212/#1214)
|
|
137
|
+
// and by `aiwg index build --graph framework` for manual rebuilds.
|
|
138
|
+
defaultBuild: false,
|
|
139
|
+
buildTier: 'standard',
|
|
140
|
+
},
|
|
141
|
+
project: {
|
|
142
|
+
type: 'project',
|
|
143
|
+
scanDirs: ['.aiwg'],
|
|
144
|
+
// Project-local bundles are byte-compatible pilots of upstream
|
|
145
|
+
// extensions/addons/frameworks/plugins. Scan the same provider-native
|
|
146
|
+
// template extensions as the framework graph so local assets do not
|
|
147
|
+
// disappear from discover/show merely because they have not been
|
|
148
|
+
// promoted upstream yet.
|
|
149
|
+
extensions: [...FRAMEWORK_INDEX_EXTENSIONS],
|
|
150
|
+
shared: false,
|
|
151
|
+
defaultBuild: true,
|
|
152
|
+
buildTier: 'standard',
|
|
153
|
+
},
|
|
154
|
+
codebase: {
|
|
155
|
+
type: 'codebase',
|
|
156
|
+
scanDirs: ['src', 'test', 'tools'],
|
|
157
|
+
extensions: ['.ts', '.mts', '.js', '.mjs', '.json', '.yaml', '.yml'],
|
|
158
|
+
shared: false,
|
|
159
|
+
defaultBuild: true,
|
|
160
|
+
buildTier: 'heavy',
|
|
161
|
+
},
|
|
162
|
+
source: {
|
|
163
|
+
type: 'source',
|
|
164
|
+
scanDirs: ['src', 'tools', 'test', 'config', 'bin', 'apps', 'vscode-extension'],
|
|
165
|
+
extensions: ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'],
|
|
166
|
+
shared: false,
|
|
167
|
+
defaultBuild: false,
|
|
168
|
+
buildTier: 'heavy',
|
|
169
|
+
},
|
|
170
|
+
user: {
|
|
171
|
+
type: 'user',
|
|
172
|
+
scanDirs: [
|
|
173
|
+
'~/.aiwg/skills',
|
|
174
|
+
'~/.aiwg/agents',
|
|
175
|
+
'~/.aiwg/commands',
|
|
176
|
+
'~/.aiwg/rules',
|
|
177
|
+
'~/.aiwg/flows',
|
|
178
|
+
'~/.aiwg/runbooks',
|
|
179
|
+
'~/.aiwg/frameworks',
|
|
180
|
+
],
|
|
181
|
+
extensions: [...DEFAULT_INDEX_EXTENSIONS],
|
|
182
|
+
shared: true,
|
|
183
|
+
defaultBuild: false,
|
|
184
|
+
buildTier: 'standard',
|
|
185
|
+
},
|
|
186
|
+
};
|
|
187
|
+
/**
|
|
188
|
+
* Mutable graph configs — starts with built-ins, extended by user config
|
|
189
|
+
*
|
|
190
|
+
* @implements #426
|
|
191
|
+
*/
|
|
192
|
+
export const GRAPH_CONFIGS = { ...BUILTIN_GRAPH_CONFIGS };
|
|
193
|
+
/**
|
|
194
|
+
* Normalize metadataSupplements entries.
|
|
195
|
+
*
|
|
196
|
+
* Accepts the shorthand `match: "frontmatter.<field>"` and expands it to
|
|
197
|
+
* `matchOn` + `nodeKey`. This lets users write the compact form in config:
|
|
198
|
+
*
|
|
199
|
+
* match: frontmatter.ref
|
|
200
|
+
*
|
|
201
|
+
* instead of the explicit two-field form:
|
|
202
|
+
*
|
|
203
|
+
* matchOn: frontmatter.ref
|
|
204
|
+
* nodeKey: ref
|
|
205
|
+
*
|
|
206
|
+
* @implements #738
|
|
207
|
+
*/
|
|
208
|
+
function normalizeSupplements(raw) {
|
|
209
|
+
return raw.map((entry) => {
|
|
210
|
+
let matchOn = entry.matchOn;
|
|
211
|
+
let nodeKey = entry.nodeKey;
|
|
212
|
+
// Accept "match" shorthand: derive matchOn and nodeKey from it
|
|
213
|
+
if (!matchOn && typeof entry.match === 'string') {
|
|
214
|
+
matchOn = entry.match;
|
|
215
|
+
}
|
|
216
|
+
// Derive nodeKey from matchOn if not explicitly provided
|
|
217
|
+
// e.g. "frontmatter.ref" -> nodeKey "ref"
|
|
218
|
+
if (!nodeKey && matchOn) {
|
|
219
|
+
nodeKey = matchOn.replace(/^frontmatter\./, '');
|
|
220
|
+
}
|
|
221
|
+
return {
|
|
222
|
+
scanDir: entry.scanDir,
|
|
223
|
+
matchOn: matchOn ?? '',
|
|
224
|
+
nodeKey: nodeKey ?? '',
|
|
225
|
+
mergeFields: Array.isArray(entry.mergeFields) ? entry.mergeFields : [],
|
|
226
|
+
};
|
|
227
|
+
});
|
|
228
|
+
}
|
|
229
|
+
/**
|
|
230
|
+
* Parse a raw graph definition object into a GraphConfig.
|
|
231
|
+
*
|
|
232
|
+
* Shared between loadUserGraphConfigs and loadModuleGraphConfigs.
|
|
233
|
+
*/
|
|
234
|
+
function parseGraphDef(name, graphDef) {
|
|
235
|
+
if (!Array.isArray(graphDef.scanDirs))
|
|
236
|
+
return null;
|
|
237
|
+
return {
|
|
238
|
+
type: name,
|
|
239
|
+
scanDirs: graphDef.scanDirs,
|
|
240
|
+
extensions: Array.isArray(graphDef.extensions) ? graphDef.extensions : [...DEFAULT_INDEX_EXTENSIONS],
|
|
241
|
+
shared: graphDef.shared === true,
|
|
242
|
+
defaultBuild: graphDef.defaultBuild !== false,
|
|
243
|
+
buildTier: graphDef.buildTier === 'lightweight' || graphDef.buildTier === 'standard' || graphDef.buildTier === 'heavy'
|
|
244
|
+
? graphDef.buildTier
|
|
245
|
+
: undefined,
|
|
246
|
+
buildOrder: typeof graphDef.buildOrder === 'number' && Number.isFinite(graphDef.buildOrder)
|
|
247
|
+
? graphDef.buildOrder
|
|
248
|
+
: undefined,
|
|
249
|
+
edgeExtraction: graphDef.edgeExtraction,
|
|
250
|
+
nodeStrategy: graphDef.nodeStrategy,
|
|
251
|
+
filenamePattern: typeof graphDef.filenamePattern === 'string' ? graphDef.filenamePattern : undefined,
|
|
252
|
+
metadataSupplements: Array.isArray(graphDef.metadataSupplements)
|
|
253
|
+
? normalizeSupplements(graphDef.metadataSupplements)
|
|
254
|
+
: undefined,
|
|
255
|
+
graphBackend: typeof graphDef.graphBackend === 'string'
|
|
256
|
+
? graphDef.graphBackend
|
|
257
|
+
: undefined,
|
|
258
|
+
};
|
|
259
|
+
}
|
|
260
|
+
const BUILD_TIER_ORDER = {
|
|
261
|
+
lightweight: 10,
|
|
262
|
+
standard: 50,
|
|
263
|
+
heavy: 90,
|
|
264
|
+
};
|
|
265
|
+
function inferredGraphBuildOrder(name) {
|
|
266
|
+
const normalized = name.toLowerCase();
|
|
267
|
+
if (/(^|[-_])(refs?|references?)([-_]|$)/.test(normalized))
|
|
268
|
+
return 10;
|
|
269
|
+
if (/(citation|citations|cites|citation-network)/.test(normalized))
|
|
270
|
+
return 20;
|
|
271
|
+
if (/(bib|bibliography)/.test(normalized))
|
|
272
|
+
return 30;
|
|
273
|
+
if (/(summary|summaries)/.test(normalized))
|
|
274
|
+
return 40;
|
|
275
|
+
if (/(paper|papers|source|codebase|embedding|full)/.test(normalized))
|
|
276
|
+
return 90;
|
|
277
|
+
return 50;
|
|
278
|
+
}
|
|
279
|
+
export function graphBuildOrder(name, config) {
|
|
280
|
+
if (typeof config.buildOrder === 'number' && Number.isFinite(config.buildOrder)) {
|
|
281
|
+
return config.buildOrder;
|
|
282
|
+
}
|
|
283
|
+
if (config.buildTier)
|
|
284
|
+
return BUILD_TIER_ORDER[config.buildTier];
|
|
285
|
+
return inferredGraphBuildOrder(name);
|
|
286
|
+
}
|
|
287
|
+
export function orderedGraphEntries(entries) {
|
|
288
|
+
return [...entries].sort(([leftName, leftConfig], [rightName, rightConfig]) => {
|
|
289
|
+
const orderCmp = graphBuildOrder(leftName, leftConfig) - graphBuildOrder(rightName, rightConfig);
|
|
290
|
+
if (orderCmp !== 0)
|
|
291
|
+
return orderCmp;
|
|
292
|
+
return leftName.localeCompare(rightName);
|
|
293
|
+
});
|
|
294
|
+
}
|
|
295
|
+
/**
|
|
296
|
+
* Load graph configs declared in framework/addon manifest.json files.
|
|
297
|
+
*
|
|
298
|
+
* Reads `.aiwg/frameworks/registry.json` to find installed modules,
|
|
299
|
+
* then loads each module's manifest and merges `index.graphs` declarations
|
|
300
|
+
* into GRAPH_CONFIGS. Module-declared graphs cannot override built-in names.
|
|
301
|
+
*
|
|
302
|
+
* This runs before operator config so that .aiwg/config.yaml can override
|
|
303
|
+
* module-declared graphs.
|
|
304
|
+
*
|
|
305
|
+
* @param cwd - Project root directory
|
|
306
|
+
* @returns Names of module-declared graphs that were loaded
|
|
307
|
+
*
|
|
308
|
+
* @implements #726
|
|
309
|
+
*/
|
|
310
|
+
export function loadModuleGraphConfigs(cwd, diagnostics) {
|
|
311
|
+
const registryPath = projectAiwgPath(cwd, 'frameworks', 'registry.json');
|
|
312
|
+
const loaded = [];
|
|
313
|
+
try {
|
|
314
|
+
if (!fs.existsSync(registryPath))
|
|
315
|
+
return loaded;
|
|
316
|
+
const registryContent = fs.readFileSync(registryPath, 'utf-8');
|
|
317
|
+
const registry = JSON.parse(registryContent);
|
|
318
|
+
if (!Array.isArray(registry.frameworks))
|
|
319
|
+
return loaded;
|
|
320
|
+
// Search paths for manifest.json (framework source locations)
|
|
321
|
+
const searchRoots = [
|
|
322
|
+
`${cwd}/agentic/code/frameworks`,
|
|
323
|
+
`${cwd}/agentic/code/addons`,
|
|
324
|
+
`${cwd}/agentic/code/plugins`,
|
|
325
|
+
];
|
|
326
|
+
for (const entry of registry.frameworks) {
|
|
327
|
+
const id = entry.id;
|
|
328
|
+
let manifestData = null;
|
|
329
|
+
// Try each search root to find the manifest
|
|
330
|
+
for (const root of searchRoots) {
|
|
331
|
+
const manifestPath = `${root}/${id}/manifest.json`;
|
|
332
|
+
if (fs.existsSync(manifestPath)) {
|
|
333
|
+
try {
|
|
334
|
+
manifestData = JSON.parse(fs.readFileSync(manifestPath, 'utf-8'));
|
|
335
|
+
}
|
|
336
|
+
catch {
|
|
337
|
+
// Malformed manifest — skip, but surface it (#1624) instead of
|
|
338
|
+
// dropping silently.
|
|
339
|
+
diagnostics?.push({
|
|
340
|
+
graph: id,
|
|
341
|
+
reason: `manifest.json is not valid JSON (${manifestPath})`,
|
|
342
|
+
source: 'module',
|
|
343
|
+
});
|
|
344
|
+
}
|
|
345
|
+
break;
|
|
346
|
+
}
|
|
347
|
+
}
|
|
348
|
+
if (!manifestData)
|
|
349
|
+
continue;
|
|
350
|
+
// Extract index.graphs from manifest
|
|
351
|
+
const indexSection = manifestData.index;
|
|
352
|
+
if (!indexSection || typeof indexSection !== 'object')
|
|
353
|
+
continue;
|
|
354
|
+
const graphs = indexSection.graphs;
|
|
355
|
+
if (!graphs || typeof graphs !== 'object')
|
|
356
|
+
continue;
|
|
357
|
+
for (const [name, def] of Object.entries(graphs)) {
|
|
358
|
+
if (name in BUILTIN_GRAPH_CONFIGS)
|
|
359
|
+
continue;
|
|
360
|
+
// Module graphs don't override already-loaded graphs (first module wins)
|
|
361
|
+
if (name in GRAPH_CONFIGS && !(name in BUILTIN_GRAPH_CONFIGS))
|
|
362
|
+
continue;
|
|
363
|
+
const config = parseGraphDef(name, def);
|
|
364
|
+
if (config) {
|
|
365
|
+
GRAPH_CONFIGS[name] = config;
|
|
366
|
+
loaded.push(name);
|
|
367
|
+
}
|
|
368
|
+
else {
|
|
369
|
+
// #1624 — a declared-but-invalid graph (e.g. missing/non-array
|
|
370
|
+
// scanDirs) used to vanish silently. Report it.
|
|
371
|
+
diagnostics?.push({
|
|
372
|
+
graph: name,
|
|
373
|
+
reason: 'invalid graph definition — `scanDirs` is missing or not an array',
|
|
374
|
+
source: 'module',
|
|
375
|
+
});
|
|
376
|
+
}
|
|
377
|
+
}
|
|
378
|
+
}
|
|
379
|
+
}
|
|
380
|
+
catch {
|
|
381
|
+
// Module config loading is best-effort
|
|
382
|
+
}
|
|
383
|
+
return loaded;
|
|
384
|
+
}
|
|
385
|
+
/**
|
|
386
|
+
* Load user-defined graph configs from .aiwg/config.yaml
|
|
387
|
+
*
|
|
388
|
+
* Also loads module-declared graphs from installed framework manifests.
|
|
389
|
+
* Module graphs are loaded first; operator config overrides them.
|
|
390
|
+
* Neither can override built-in graph names.
|
|
391
|
+
*
|
|
392
|
+
* @param cwd - Project root directory
|
|
393
|
+
* @returns Names of user-defined graphs that were loaded (includes module graphs)
|
|
394
|
+
*
|
|
395
|
+
* @implements #426 #726
|
|
396
|
+
*/
|
|
397
|
+
export function loadUserGraphConfigs(cwd, diagnostics) {
|
|
398
|
+
// Load module-declared graphs first (frameworks/addons)
|
|
399
|
+
const moduleLoaded = loadModuleGraphConfigs(cwd, diagnostics);
|
|
400
|
+
const loaded = [...moduleLoaded];
|
|
401
|
+
// Resolve the operator's index.graphs source. Canonical home is
|
|
402
|
+
// the configured artifact root's aiwg.config (JSON, #1491); the legacy
|
|
403
|
+
// config.yaml is a
|
|
404
|
+
// deprecated fallback so un-migrated corpora keep working.
|
|
405
|
+
let graphs;
|
|
406
|
+
let fromDeprecatedYaml = false;
|
|
407
|
+
// (a) Canonical: .aiwg/aiwg.config (JSON).
|
|
408
|
+
try {
|
|
409
|
+
const aiwgConfigPath = projectAiwgPath(cwd, 'aiwg.config');
|
|
410
|
+
if (fs.existsSync(aiwgConfigPath)) {
|
|
411
|
+
const parsed = JSON.parse(fs.readFileSync(aiwgConfigPath, 'utf-8'));
|
|
412
|
+
const idx = parsed.index;
|
|
413
|
+
const g = idx?.graphs;
|
|
414
|
+
if (g && typeof g === 'object')
|
|
415
|
+
graphs = g;
|
|
416
|
+
}
|
|
417
|
+
}
|
|
418
|
+
catch {
|
|
419
|
+
// #1624 — surface a malformed aiwg.config rather than dropping the whole
|
|
420
|
+
// index block silently.
|
|
421
|
+
diagnostics?.push({
|
|
422
|
+
graph: '.aiwg/aiwg.config',
|
|
423
|
+
reason: 'aiwg.config is not valid JSON — index.graphs not loaded',
|
|
424
|
+
source: 'operator-config',
|
|
425
|
+
});
|
|
426
|
+
}
|
|
427
|
+
// (b) Fallback: legacy .aiwg/config.yaml.
|
|
428
|
+
if (!graphs) {
|
|
429
|
+
try {
|
|
430
|
+
const configPath = projectAiwgPath(cwd, 'config.yaml');
|
|
431
|
+
if (fs.existsSync(configPath)) {
|
|
432
|
+
const config = loadYaml(fs.readFileSync(configPath, 'utf-8'));
|
|
433
|
+
const idx = config?.index;
|
|
434
|
+
const g = idx?.graphs;
|
|
435
|
+
if (g && typeof g === 'object') {
|
|
436
|
+
graphs = g;
|
|
437
|
+
fromDeprecatedYaml = true;
|
|
438
|
+
}
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
catch {
|
|
442
|
+
// best-effort
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
if (!graphs)
|
|
446
|
+
return loaded;
|
|
447
|
+
if (fromDeprecatedYaml && !yamlIndexDeprecationWarned) {
|
|
448
|
+
yamlIndexDeprecationWarned = true;
|
|
449
|
+
process.stderr.write('[aiwg index] note: index.graphs in .aiwg/config.yaml is deprecated — move the index block into .aiwg/aiwg.config (see docs/cli-reference.md, #1491).\n');
|
|
450
|
+
}
|
|
451
|
+
for (const [name, def] of Object.entries(graphs)) {
|
|
452
|
+
if (name in BUILTIN_GRAPH_CONFIGS) {
|
|
453
|
+
// Cannot override built-in graph names
|
|
454
|
+
continue;
|
|
455
|
+
}
|
|
456
|
+
const graphConfig = parseGraphDef(name, def);
|
|
457
|
+
if (!graphConfig) {
|
|
458
|
+
// #1624 — report the invalid operator-declared graph instead of the
|
|
459
|
+
// historical silent `continue`.
|
|
460
|
+
diagnostics?.push({
|
|
461
|
+
graph: name,
|
|
462
|
+
reason: 'invalid graph definition — `scanDirs` is missing or not an array',
|
|
463
|
+
source: 'operator-config',
|
|
464
|
+
});
|
|
465
|
+
continue;
|
|
466
|
+
}
|
|
467
|
+
// Operator config overrides module-declared graphs; built-ins are protected above.
|
|
468
|
+
GRAPH_CONFIGS[name] = graphConfig;
|
|
469
|
+
if (!moduleLoaded.includes(name))
|
|
470
|
+
loaded.push(name);
|
|
471
|
+
}
|
|
472
|
+
return loaded;
|
|
473
|
+
}
|
|
474
|
+
/**
|
|
475
|
+
* Load user/global graph configs from ~/.aiwg/aiwg.config.
|
|
476
|
+
*
|
|
477
|
+
* These graphs are shared across projects and written to the XDG AIWG index
|
|
478
|
+
* sidecar. They intentionally cannot override built-in graph names or
|
|
479
|
+
* project/operator graph names; project-local definitions remain more
|
|
480
|
+
* specific than broad user-level defaults.
|
|
481
|
+
*/
|
|
482
|
+
export function loadGlobalGraphConfigs(diagnostics) {
|
|
483
|
+
const loaded = [];
|
|
484
|
+
const home = process.env.HOME;
|
|
485
|
+
if (!home)
|
|
486
|
+
return loaded;
|
|
487
|
+
const configPath = `${home}/.aiwg/aiwg.config`;
|
|
488
|
+
let graphs;
|
|
489
|
+
let rootGraphs;
|
|
490
|
+
try {
|
|
491
|
+
if (!fs.existsSync(configPath))
|
|
492
|
+
return loaded;
|
|
493
|
+
const parsed = JSON.parse(fs.readFileSync(configPath, 'utf-8'));
|
|
494
|
+
const index = parsed.index;
|
|
495
|
+
const g = index?.graphs;
|
|
496
|
+
if (g && typeof g === 'object')
|
|
497
|
+
graphs = g;
|
|
498
|
+
const indices = parsed.indices;
|
|
499
|
+
const user = indices?.user;
|
|
500
|
+
const roots = user?.roots;
|
|
501
|
+
if (roots && typeof roots === 'object')
|
|
502
|
+
rootGraphs = roots;
|
|
503
|
+
}
|
|
504
|
+
catch {
|
|
505
|
+
diagnostics?.push({
|
|
506
|
+
graph: '~/.aiwg/aiwg.config',
|
|
507
|
+
reason: 'user aiwg.config is not valid JSON — index.graphs not loaded',
|
|
508
|
+
source: 'operator-config',
|
|
509
|
+
});
|
|
510
|
+
return loaded;
|
|
511
|
+
}
|
|
512
|
+
if (rootGraphs) {
|
|
513
|
+
for (const [name, rawRoot] of Object.entries(rootGraphs)) {
|
|
514
|
+
if (name in GRAPH_CONFIGS)
|
|
515
|
+
continue;
|
|
516
|
+
if (!rawRoot || typeof rawRoot !== 'object' || Array.isArray(rawRoot)) {
|
|
517
|
+
diagnostics?.push({
|
|
518
|
+
graph: name,
|
|
519
|
+
reason: 'invalid user-level root definition — expected an object with `path`',
|
|
520
|
+
source: 'operator-config',
|
|
521
|
+
});
|
|
522
|
+
continue;
|
|
523
|
+
}
|
|
524
|
+
const root = rawRoot;
|
|
525
|
+
if (typeof root.path !== 'string' || root.path.trim() === '') {
|
|
526
|
+
diagnostics?.push({
|
|
527
|
+
graph: name,
|
|
528
|
+
reason: 'invalid user-level root definition — `path` is required',
|
|
529
|
+
source: 'operator-config',
|
|
530
|
+
});
|
|
531
|
+
continue;
|
|
532
|
+
}
|
|
533
|
+
GRAPH_CONFIGS[name] = {
|
|
534
|
+
type: name,
|
|
535
|
+
scanDirs: [root.path],
|
|
536
|
+
extensions: Array.isArray(root.extensions) ? root.extensions.map(String) : ['.md', '.yaml', '.json'],
|
|
537
|
+
shared: true,
|
|
538
|
+
defaultBuild: false,
|
|
539
|
+
};
|
|
540
|
+
loaded.push(name);
|
|
541
|
+
}
|
|
542
|
+
}
|
|
543
|
+
if (!graphs)
|
|
544
|
+
return loaded;
|
|
545
|
+
for (const [name, def] of Object.entries(graphs)) {
|
|
546
|
+
if (name in GRAPH_CONFIGS)
|
|
547
|
+
continue;
|
|
548
|
+
const graphConfig = parseGraphDef(name, def);
|
|
549
|
+
if (!graphConfig) {
|
|
550
|
+
diagnostics?.push({
|
|
551
|
+
graph: name,
|
|
552
|
+
reason: 'invalid user-level graph definition — `scanDirs` is missing or not an array',
|
|
553
|
+
source: 'operator-config',
|
|
554
|
+
});
|
|
555
|
+
continue;
|
|
556
|
+
}
|
|
557
|
+
GRAPH_CONFIGS[name] = { ...graphConfig, shared: true };
|
|
558
|
+
loaded.push(name);
|
|
559
|
+
}
|
|
560
|
+
return loaded;
|
|
561
|
+
}
|
|
562
|
+
/** Module-scoped guard so the config.yaml deprecation note prints at most once per process. */
|
|
563
|
+
let yamlIndexDeprecationWarned = false;
|
|
564
|
+
/**
|
|
565
|
+
* Get the index output directory for a given graph type
|
|
566
|
+
*
|
|
567
|
+
* @param cwd - Project root
|
|
568
|
+
* @param graphType - Graph type
|
|
569
|
+
* @returns Absolute path to the graph's index directory
|
|
570
|
+
*/
|
|
571
|
+
export function getGraphIndexDir(cwd, graphType) {
|
|
572
|
+
const config = GRAPH_CONFIGS[graphType];
|
|
573
|
+
if (graphType === 'framework' || config?.shared) {
|
|
574
|
+
// Shared across projects — XDG data directory
|
|
575
|
+
const xdgData = process.env.XDG_DATA_HOME ?? path.join(os.homedir(), '.local', 'share');
|
|
576
|
+
return path.join(xdgData, 'aiwg', 'index', graphType);
|
|
577
|
+
}
|
|
578
|
+
return path.join(getProjectIndexRoot(cwd), graphType);
|
|
579
|
+
}
|
|
580
|
+
/**
|
|
581
|
+
* Resolve the project-local index root for the configured AIWG artifact dir.
|
|
582
|
+
*/
|
|
583
|
+
export function getProjectIndexRoot(cwd) {
|
|
584
|
+
return path.join(resolveProjectAiwgDir(cwd), '.index');
|
|
585
|
+
}
|
|
586
|
+
/**
|
|
587
|
+
* Resolve graph scan directories using the same AIWG artifact root contract as
|
|
588
|
+
* runtime config/storage. This keeps built-in project graph paths virtualized
|
|
589
|
+
* as `.aiwg/...` while allowing the physical directory to be renamed or moved.
|
|
590
|
+
*/
|
|
591
|
+
export function resolveGraphScanDir(cwd, scanDir) {
|
|
592
|
+
if (scanDir === '~')
|
|
593
|
+
return process.env.HOME ?? scanDir;
|
|
594
|
+
if (scanDir.startsWith('~/')) {
|
|
595
|
+
return path.join(process.env.HOME ?? '', scanDir.slice(2));
|
|
596
|
+
}
|
|
597
|
+
if (path.isAbsolute(scanDir))
|
|
598
|
+
return scanDir;
|
|
599
|
+
if (scanDir === DEFAULT_PROJECT_AIWG_DIR)
|
|
600
|
+
return resolveProjectAiwgDir(cwd);
|
|
601
|
+
if (scanDir.startsWith(`${DEFAULT_PROJECT_AIWG_DIR}/`)) {
|
|
602
|
+
return path.join(resolveProjectAiwgDir(cwd), scanDir.slice(DEFAULT_PROJECT_AIWG_DIR.length + 1));
|
|
603
|
+
}
|
|
604
|
+
return path.join(cwd, scanDir);
|
|
605
|
+
}
|
|
606
|
+
//# sourceMappingURL=types.js.map
|