spectra-cli 4.1.1 → 4.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +12 -5
- package/dist/.spectra-build-meta.json +9 -0
- package/dist/adapters/go-adapter.d.ts.map +1 -1
- package/dist/adapters/go-adapter.js +2 -0
- package/dist/adapters/go-adapter.js.map +1 -1
- package/dist/adapters/index.d.ts +1 -1
- package/dist/adapters/index.d.ts.map +1 -1
- package/dist/adapters/java-adapter.d.ts.map +1 -1
- package/dist/adapters/java-adapter.js +2 -0
- package/dist/adapters/java-adapter.js.map +1 -1
- package/dist/adapters/language-adapter.d.ts +42 -9
- package/dist/adapters/language-adapter.d.ts.map +1 -1
- package/dist/adapters/python-adapter.d.ts +34 -6
- package/dist/adapters/python-adapter.d.ts.map +1 -1
- package/dist/adapters/python-adapter.js +168 -61
- package/dist/adapters/python-adapter.js.map +1 -1
- package/dist/adapters/ts-js-adapter.d.ts +13 -5
- package/dist/adapters/ts-js-adapter.d.ts.map +1 -1
- package/dist/adapters/ts-js-adapter.js +55 -14
- package/dist/adapters/ts-js-adapter.js.map +1 -1
- package/dist/batch/batch-orchestrator.d.ts +74 -5
- package/dist/batch/batch-orchestrator.d.ts.map +1 -1
- package/dist/batch/batch-orchestrator.js +583 -70
- package/dist/batch/batch-orchestrator.js.map +1 -1
- package/dist/batch/delta-regenerator.d.ts +2 -2
- package/dist/batch/delta-regenerator.d.ts.map +1 -1
- package/dist/batch/delta-regenerator.js +21 -28
- package/dist/batch/delta-regenerator.js.map +1 -1
- package/dist/batch/module-grouper.d.ts +9 -2
- package/dist/batch/module-grouper.d.ts.map +1 -1
- package/dist/batch/module-grouper.js +3 -1
- package/dist/batch/module-grouper.js.map +1 -1
- package/dist/batch/regen-plan.d.ts +78 -0
- package/dist/batch/regen-plan.d.ts.map +1 -0
- package/dist/batch/regen-plan.js +93 -0
- package/dist/batch/regen-plan.js.map +1 -0
- package/dist/cli/commands/batch.d.ts.map +1 -1
- package/dist/cli/commands/batch.js +36 -8
- package/dist/cli/commands/batch.js.map +1 -1
- package/dist/cli/commands/graph.js +1 -1
- package/dist/cli/commands/graph.js.map +1 -1
- package/dist/cli/commands/index.d.ts +8 -0
- package/dist/cli/commands/index.d.ts.map +1 -0
- package/dist/cli/commands/index.js +274 -0
- package/dist/cli/commands/index.js.map +1 -0
- package/dist/cli/commands/query.d.ts.map +1 -1
- package/dist/cli/commands/query.js +3 -1
- package/dist/cli/commands/query.js.map +1 -1
- package/dist/cli/commands/scaffold-kb.d.ts +9 -0
- package/dist/cli/commands/scaffold-kb.d.ts.map +1 -0
- package/dist/cli/commands/scaffold-kb.js +179 -0
- package/dist/cli/commands/scaffold-kb.js.map +1 -0
- package/dist/cli/index.js +33 -14
- package/dist/cli/index.js.map +1 -1
- package/dist/cli/utils/error-handler.d.ts +0 -6
- package/dist/cli/utils/error-handler.d.ts.map +1 -1
- package/dist/cli/utils/error-handler.js +0 -13
- package/dist/cli/utils/error-handler.js.map +1 -1
- package/dist/cli/utils/parse-args.d.ts +55 -3
- package/dist/cli/utils/parse-args.d.ts.map +1 -1
- package/dist/cli/utils/parse-args.js +176 -13
- package/dist/cli/utils/parse-args.js.map +1 -1
- package/dist/cli/version-meta.d.ts +16 -0
- package/dist/cli/version-meta.d.ts.map +1 -0
- package/dist/cli/version-meta.js +28 -0
- package/dist/cli/version-meta.js.map +1 -0
- package/dist/core/ast-analyzer.d.ts.map +1 -1
- package/dist/core/ast-analyzer.js +75 -5
- package/dist/core/ast-analyzer.js.map +1 -1
- package/dist/core/import-resolver.d.ts +93 -0
- package/dist/core/import-resolver.d.ts.map +1 -0
- package/dist/core/import-resolver.js +414 -0
- package/dist/core/import-resolver.js.map +1 -0
- package/dist/core/query-mappers/base-mapper.d.ts +13 -0
- package/dist/core/query-mappers/base-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/go-mapper.d.ts +68 -0
- package/dist/core/query-mappers/go-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/go-mapper.js +421 -0
- package/dist/core/query-mappers/go-mapper.js.map +1 -1
- package/dist/core/query-mappers/java-mapper.d.ts +196 -0
- package/dist/core/query-mappers/java-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/java-mapper.js +600 -0
- package/dist/core/query-mappers/java-mapper.js.map +1 -1
- package/dist/core/query-mappers/python-mapper.d.ts +55 -0
- package/dist/core/query-mappers/python-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/python-mapper.js +273 -0
- package/dist/core/query-mappers/python-mapper.js.map +1 -1
- package/dist/core/query-mappers/typescript-mapper.d.ts +102 -0
- package/dist/core/query-mappers/typescript-mapper.d.ts.map +1 -1
- package/dist/core/query-mappers/typescript-mapper.js +470 -0
- package/dist/core/query-mappers/typescript-mapper.js.map +1 -1
- package/dist/core/single-spec-orchestrator.d.ts +21 -0
- package/dist/core/single-spec-orchestrator.d.ts.map +1 -1
- package/dist/core/single-spec-orchestrator.js +187 -23
- package/dist/core/single-spec-orchestrator.js.map +1 -1
- package/dist/core/skeleton-hash.d.ts +33 -0
- package/dist/core/skeleton-hash.d.ts.map +1 -0
- package/dist/core/skeleton-hash.js +76 -0
- package/dist/core/skeleton-hash.js.map +1 -0
- package/dist/core/tree-sitter-analyzer.d.ts +7 -0
- package/dist/core/tree-sitter-analyzer.d.ts.map +1 -1
- package/dist/core/tree-sitter-analyzer.js +32 -1
- package/dist/core/tree-sitter-analyzer.js.map +1 -1
- package/dist/core/tree-sitter-fallback.d.ts +12 -4
- package/dist/core/tree-sitter-fallback.d.ts.map +1 -1
- package/dist/core/tree-sitter-fallback.js +160 -12
- package/dist/core/tree-sitter-fallback.js.map +1 -1
- package/dist/extraction/extraction-types.d.ts +25 -25
- package/dist/extraction/image-extractor.d.ts.map +1 -1
- package/dist/extraction/image-extractor.js +3 -1
- package/dist/extraction/image-extractor.js.map +1 -1
- package/dist/extraction/markdown-extractor.d.ts.map +1 -1
- package/dist/extraction/markdown-extractor.js +3 -1
- package/dist/extraction/markdown-extractor.js.map +1 -1
- package/dist/generator/frontmatter.d.ts +5 -0
- package/dist/generator/frontmatter.d.ts.map +1 -1
- package/dist/generator/frontmatter.js +4 -0
- package/dist/generator/frontmatter.js.map +1 -1
- package/dist/generator/index-generator.d.ts +3 -3
- package/dist/generator/index-generator.d.ts.map +1 -1
- package/dist/generator/index-generator.js +1 -1
- package/dist/generator/index-generator.js.map +1 -1
- package/dist/graph/directory-graph.d.ts +14 -4
- package/dist/graph/directory-graph.d.ts.map +1 -1
- package/dist/graph/directory-graph.js +71 -128
- package/dist/graph/directory-graph.js.map +1 -1
- package/dist/graph/mermaid-renderer.d.ts +8 -5
- package/dist/graph/mermaid-renderer.d.ts.map +1 -1
- package/dist/graph/mermaid-renderer.js +3 -3
- package/dist/graph/mermaid-renderer.js.map +1 -1
- package/dist/graph/topological-sort.d.ts +13 -6
- package/dist/graph/topological-sort.d.ts.map +1 -1
- package/dist/graph/topological-sort.js +2 -2
- package/dist/graph/topological-sort.js.map +1 -1
- package/dist/kb-mcp/index.d.ts +14 -0
- package/dist/kb-mcp/index.d.ts.map +1 -0
- package/dist/kb-mcp/index.js +24 -0
- package/dist/kb-mcp/index.js.map +1 -0
- package/dist/kb-mcp/lib/kb-error.d.ts +21 -0
- package/dist/kb-mcp/lib/kb-error.d.ts.map +1 -0
- package/dist/kb-mcp/lib/kb-error.js +28 -0
- package/dist/kb-mcp/lib/kb-error.js.map +1 -0
- package/dist/kb-mcp/lib/kb-locator.d.ts +58 -0
- package/dist/kb-mcp/lib/kb-locator.d.ts.map +1 -0
- package/dist/kb-mcp/lib/kb-locator.js +85 -0
- package/dist/kb-mcp/lib/kb-locator.js.map +1 -0
- package/dist/kb-mcp/lib/result-merger.d.ts +35 -0
- package/dist/kb-mcp/lib/result-merger.d.ts.map +1 -0
- package/dist/kb-mcp/lib/result-merger.js +64 -0
- package/dist/kb-mcp/lib/result-merger.js.map +1 -0
- package/dist/kb-mcp/server.d.ts +12 -0
- package/dist/kb-mcp/server.d.ts.map +1 -0
- package/dist/kb-mcp/server.js +29 -0
- package/dist/kb-mcp/server.js.map +1 -0
- package/dist/kb-mcp/tools/kb-api-lookup.d.ts +28 -0
- package/dist/kb-mcp/tools/kb-api-lookup.d.ts.map +1 -0
- package/dist/kb-mcp/tools/kb-api-lookup.js +237 -0
- package/dist/kb-mcp/tools/kb-api-lookup.js.map +1 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.d.ts +20 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.d.ts.map +1 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.js +92 -0
- package/dist/kb-mcp/tools/kb-doc-lookup.js.map +1 -0
- package/dist/kb-mcp/tools/kb-search.d.ts +23 -0
- package/dist/kb-mcp/tools/kb-search.d.ts.map +1 -0
- package/dist/kb-mcp/tools/kb-search.js +126 -0
- package/dist/kb-mcp/tools/kb-search.js.map +1 -0
- package/dist/knowledge-graph/call-resolver.d.ts +64 -0
- package/dist/knowledge-graph/call-resolver.d.ts.map +1 -0
- package/dist/knowledge-graph/call-resolver.js +323 -0
- package/dist/knowledge-graph/call-resolver.js.map +1 -0
- package/dist/knowledge-graph/import-resolver.d.ts +39 -0
- package/dist/knowledge-graph/import-resolver.d.ts.map +1 -0
- package/dist/knowledge-graph/import-resolver.js +214 -0
- package/dist/knowledge-graph/import-resolver.js.map +1 -0
- package/dist/knowledge-graph/incremental.d.ts +131 -0
- package/dist/knowledge-graph/incremental.d.ts.map +1 -0
- package/dist/knowledge-graph/incremental.js +432 -0
- package/dist/knowledge-graph/incremental.js.map +1 -0
- package/dist/knowledge-graph/index.d.ts +85 -0
- package/dist/knowledge-graph/index.d.ts.map +1 -0
- package/dist/knowledge-graph/index.js +198 -0
- package/dist/knowledge-graph/index.js.map +1 -0
- package/dist/knowledge-graph/module-derivation.d.ts +252 -0
- package/dist/knowledge-graph/module-derivation.d.ts.map +1 -0
- package/dist/knowledge-graph/module-derivation.js +418 -0
- package/dist/knowledge-graph/module-derivation.js.map +1 -0
- package/dist/knowledge-graph/persistence.d.ts +310 -0
- package/dist/knowledge-graph/persistence.d.ts.map +1 -0
- package/dist/knowledge-graph/persistence.js +280 -0
- package/dist/knowledge-graph/persistence.js.map +1 -0
- package/dist/knowledge-graph/query-helpers.d.ts +191 -0
- package/dist/knowledge-graph/query-helpers.d.ts.map +1 -0
- package/dist/knowledge-graph/query-helpers.js +559 -0
- package/dist/knowledge-graph/query-helpers.js.map +1 -0
- package/dist/knowledge-graph/relativize.d.ts +51 -0
- package/dist/knowledge-graph/relativize.d.ts.map +1 -0
- package/dist/knowledge-graph/relativize.js +104 -0
- package/dist/knowledge-graph/relativize.js.map +1 -0
- package/dist/knowledge-graph/unified-graph.d.ts +310 -0
- package/dist/knowledge-graph/unified-graph.d.ts.map +1 -0
- package/dist/knowledge-graph/unified-graph.js +182 -0
- package/dist/knowledge-graph/unified-graph.js.map +1 -0
- package/dist/mcp/agent-context-tools.d.ts +53 -0
- package/dist/mcp/agent-context-tools.d.ts.map +1 -0
- package/dist/mcp/agent-context-tools.js +806 -0
- package/dist/mcp/agent-context-tools.js.map +1 -0
- package/dist/mcp/file-nav-tools.d.ts +42 -0
- package/dist/mcp/file-nav-tools.d.ts.map +1 -0
- package/dist/mcp/file-nav-tools.js +318 -0
- package/dist/mcp/file-nav-tools.js.map +1 -0
- package/dist/mcp/graph-tools.d.ts +22 -0
- package/dist/mcp/graph-tools.d.ts.map +1 -1
- package/dist/mcp/graph-tools.js +204 -133
- package/dist/mcp/graph-tools.js.map +1 -1
- package/dist/mcp/lib/file-nav-helpers.d.ts +128 -0
- package/dist/mcp/lib/file-nav-helpers.d.ts.map +1 -0
- package/dist/mcp/lib/file-nav-helpers.js +305 -0
- package/dist/mcp/lib/file-nav-helpers.js.map +1 -0
- package/dist/mcp/lib/response-helpers.d.ts +67 -0
- package/dist/mcp/lib/response-helpers.d.ts.map +1 -0
- package/dist/mcp/lib/response-helpers.js +103 -0
- package/dist/mcp/lib/response-helpers.js.map +1 -0
- package/dist/mcp/lib/telemetry.d.ts +69 -0
- package/dist/mcp/lib/telemetry.d.ts.map +1 -0
- package/dist/mcp/lib/telemetry.js +113 -0
- package/dist/mcp/lib/telemetry.js.map +1 -0
- package/dist/mcp/lib/tool-response.d.ts +46 -0
- package/dist/mcp/lib/tool-response.d.ts.map +1 -0
- package/dist/mcp/lib/tool-response.js +83 -0
- package/dist/mcp/lib/tool-response.js.map +1 -0
- package/dist/mcp/server.d.ts +14 -1
- package/dist/mcp/server.d.ts.map +1 -1
- package/dist/mcp/server.js +216 -158
- package/dist/mcp/server.js.map +1 -1
- package/dist/models/call-site.d.ts +68 -0
- package/dist/models/call-site.d.ts.map +1 -0
- package/dist/models/call-site.js +60 -0
- package/dist/models/call-site.js.map +1 -0
- package/dist/models/code-skeleton.d.ts +80 -6
- package/dist/models/code-skeleton.d.ts.map +1 -1
- package/dist/models/code-skeleton.js +30 -0
- package/dist/models/code-skeleton.js.map +1 -1
- package/dist/models/drift-item.d.ts +4 -4
- package/dist/models/module-spec.d.ts +173 -94
- package/dist/models/module-spec.d.ts.map +1 -1
- package/dist/models/module-spec.js +6 -0
- package/dist/models/module-spec.js.map +1 -1
- package/dist/panoramic/adr-decision-pipeline.d.ts +53 -0
- package/dist/panoramic/adr-decision-pipeline.d.ts.map +1 -0
- package/dist/panoramic/adr-decision-pipeline.js +685 -0
- package/dist/panoramic/adr-decision-pipeline.js.map +1 -0
- package/dist/panoramic/api-surface-generator.d.ts +56 -0
- package/dist/panoramic/api-surface-generator.d.ts.map +1 -0
- package/dist/panoramic/api-surface-generator.js +1671 -0
- package/dist/panoramic/api-surface-generator.js.map +1 -0
- package/dist/panoramic/architecture-ir-builder.d.ts +19 -0
- package/dist/panoramic/architecture-ir-builder.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-builder.js +561 -0
- package/dist/panoramic/architecture-ir-builder.js.map +1 -0
- package/dist/panoramic/architecture-ir-exporters.d.ts +7 -0
- package/dist/panoramic/architecture-ir-exporters.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-exporters.js +183 -0
- package/dist/panoramic/architecture-ir-exporters.js.map +1 -0
- package/dist/panoramic/architecture-ir-generator.d.ts +36 -0
- package/dist/panoramic/architecture-ir-generator.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-generator.js +51 -0
- package/dist/panoramic/architecture-ir-generator.js.map +1 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.d.ts +6 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.js +98 -0
- package/dist/panoramic/architecture-ir-mermaid-adapter.js.map +1 -0
- package/dist/panoramic/architecture-ir-model.d.ts +87 -0
- package/dist/panoramic/architecture-ir-model.d.ts.map +1 -0
- package/dist/panoramic/architecture-ir-model.js +20 -0
- package/dist/panoramic/architecture-ir-model.js.map +1 -0
- package/dist/panoramic/architecture-narrative.d.ts +68 -0
- package/dist/panoramic/architecture-narrative.d.ts.map +1 -0
- package/dist/panoramic/architecture-narrative.js +401 -0
- package/dist/panoramic/architecture-narrative.js.map +1 -0
- package/dist/panoramic/architecture-overview-generator.d.ts +31 -0
- package/dist/panoramic/architecture-overview-generator.d.ts.map +1 -0
- package/dist/panoramic/architecture-overview-generator.js +454 -0
- package/dist/panoramic/architecture-overview-generator.js.map +1 -0
- package/dist/panoramic/architecture-overview-model.d.ts +77 -0
- package/dist/panoramic/architecture-overview-model.d.ts.map +1 -0
- package/dist/panoramic/architecture-overview-model.js +31 -0
- package/dist/panoramic/architecture-overview-model.js.map +1 -0
- package/dist/panoramic/batch-project-docs.d.ts.map +1 -1
- package/dist/panoramic/batch-project-docs.js +4 -2
- package/dist/panoramic/batch-project-docs.js.map +1 -1
- package/dist/panoramic/builders/component-view-builder.d.ts +25 -1
- package/dist/panoramic/builders/component-view-builder.d.ts.map +1 -1
- package/dist/panoramic/builders/component-view-builder.js +83 -3
- package/dist/panoramic/builders/component-view-builder.js.map +1 -1
- package/dist/panoramic/builders/doc-graph-builder.d.ts +15 -2
- package/dist/panoramic/builders/doc-graph-builder.d.ts.map +1 -1
- package/dist/panoramic/builders/doc-graph-builder.js +20 -0
- package/dist/panoramic/builders/doc-graph-builder.js.map +1 -1
- package/dist/panoramic/component-view-builder.d.ts +17 -0
- package/dist/panoramic/component-view-builder.d.ts.map +1 -0
- package/dist/panoramic/component-view-builder.js +652 -0
- package/dist/panoramic/component-view-builder.js.map +1 -0
- package/dist/panoramic/component-view-model.d.ts +127 -0
- package/dist/panoramic/component-view-model.d.ts.map +1 -0
- package/dist/panoramic/component-view-model.js +65 -0
- package/dist/panoramic/component-view-model.js.map +1 -0
- package/dist/panoramic/config-reference-generator.d.ts +78 -0
- package/dist/panoramic/config-reference-generator.d.ts.map +1 -0
- package/dist/panoramic/config-reference-generator.js +199 -0
- package/dist/panoramic/config-reference-generator.js.map +1 -0
- package/dist/panoramic/coverage-auditor.d.ts +95 -0
- package/dist/panoramic/coverage-auditor.d.ts.map +1 -0
- package/dist/panoramic/coverage-auditor.js +290 -0
- package/dist/panoramic/coverage-auditor.js.map +1 -0
- package/dist/panoramic/cross-package-analyzer.d.ts +112 -0
- package/dist/panoramic/cross-package-analyzer.d.ts.map +1 -0
- package/dist/panoramic/cross-package-analyzer.js +258 -0
- package/dist/panoramic/cross-package-analyzer.js.map +1 -0
- package/dist/panoramic/data-model-generator.d.ts +528 -0
- package/dist/panoramic/data-model-generator.d.ts.map +1 -0
- package/dist/panoramic/data-model-generator.js +647 -0
- package/dist/panoramic/data-model-generator.js.map +1 -0
- package/dist/panoramic/doc-graph-builder.d.ts +80 -0
- package/dist/panoramic/doc-graph-builder.d.ts.map +1 -0
- package/dist/panoramic/doc-graph-builder.js +352 -0
- package/dist/panoramic/doc-graph-builder.js.map +1 -0
- package/dist/panoramic/docs-bundle-manifest-reader.d.ts +26 -0
- package/dist/panoramic/docs-bundle-manifest-reader.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-manifest-reader.js +106 -0
- package/dist/panoramic/docs-bundle-manifest-reader.js.map +1 -0
- package/dist/panoramic/docs-bundle-orchestrator.d.ts +14 -0
- package/dist/panoramic/docs-bundle-orchestrator.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-orchestrator.js +538 -0
- package/dist/panoramic/docs-bundle-orchestrator.js.map +1 -0
- package/dist/panoramic/docs-bundle-profiles.d.ts +4 -0
- package/dist/panoramic/docs-bundle-profiles.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-profiles.js +82 -0
- package/dist/panoramic/docs-bundle-profiles.js.map +1 -0
- package/dist/panoramic/docs-bundle-types.d.ts +94 -0
- package/dist/panoramic/docs-bundle-types.d.ts.map +1 -0
- package/dist/panoramic/docs-bundle-types.js +10 -0
- package/dist/panoramic/docs-bundle-types.js.map +1 -0
- package/dist/panoramic/docs-quality-evaluator.d.ts +31 -0
- package/dist/panoramic/docs-quality-evaluator.d.ts.map +1 -0
- package/dist/panoramic/docs-quality-evaluator.js +941 -0
- package/dist/panoramic/docs-quality-evaluator.js.map +1 -0
- package/dist/panoramic/docs-quality-model.d.ts +125 -0
- package/dist/panoramic/docs-quality-model.d.ts.map +1 -0
- package/dist/panoramic/docs-quality-model.js +166 -0
- package/dist/panoramic/docs-quality-model.js.map +1 -0
- package/dist/panoramic/dynamic-scenarios-builder.d.ts +18 -0
- package/dist/panoramic/dynamic-scenarios-builder.d.ts.map +1 -0
- package/dist/panoramic/dynamic-scenarios-builder.js +316 -0
- package/dist/panoramic/dynamic-scenarios-builder.js.map +1 -0
- package/dist/panoramic/event-surface-generator.d.ts +52 -0
- package/dist/panoramic/event-surface-generator.d.ts.map +1 -0
- package/dist/panoramic/event-surface-generator.js +507 -0
- package/dist/panoramic/event-surface-generator.js.map +1 -0
- package/dist/panoramic/generator-registry.d.ts +1 -1
- package/dist/panoramic/generator-registry.d.ts.map +1 -1
- package/dist/panoramic/generator-registry.js +5 -2
- package/dist/panoramic/generator-registry.js.map +1 -1
- package/dist/panoramic/generators/cross-package-analyzer.d.ts +5 -5
- package/dist/panoramic/generators/cross-package-analyzer.d.ts.map +1 -1
- package/dist/panoramic/generators/cross-package-analyzer.js +1 -1
- package/dist/panoramic/generators/cross-package-analyzer.js.map +1 -1
- package/dist/panoramic/generators/data-model-generator.d.ts +27 -27
- package/dist/panoramic/graph/confidence-mapper.d.ts +18 -0
- package/dist/panoramic/graph/confidence-mapper.d.ts.map +1 -1
- package/dist/panoramic/graph/confidence-mapper.js +26 -0
- package/dist/panoramic/graph/confidence-mapper.js.map +1 -1
- package/dist/panoramic/graph/graph-builder.d.ts +72 -2
- package/dist/panoramic/graph/graph-builder.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-builder.js +330 -46
- package/dist/panoramic/graph/graph-builder.js.map +1 -1
- package/dist/panoramic/graph/graph-paths.d.ts +8 -0
- package/dist/panoramic/graph/graph-paths.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-paths.js +10 -0
- package/dist/panoramic/graph/graph-paths.js.map +1 -1
- package/dist/panoramic/graph/graph-query.d.ts +49 -2
- package/dist/panoramic/graph/graph-query.d.ts.map +1 -1
- package/dist/panoramic/graph/graph-query.js +117 -19
- package/dist/panoramic/graph/graph-query.js.map +1 -1
- package/dist/panoramic/graph/graph-types.d.ts +32 -3
- package/dist/panoramic/graph/graph-types.d.ts.map +1 -1
- package/dist/panoramic/graph/index.d.ts +2 -1
- package/dist/panoramic/graph/index.d.ts.map +1 -1
- package/dist/panoramic/graph/index.js +1 -1
- package/dist/panoramic/graph/index.js.map +1 -1
- package/dist/panoramic/hyperedges/schema.d.ts +6 -6
- package/dist/panoramic/interface-surface-generator.d.ts +50 -0
- package/dist/panoramic/interface-surface-generator.d.ts.map +1 -0
- package/dist/panoramic/interface-surface-generator.js +388 -0
- package/dist/panoramic/interface-surface-generator.js.map +1 -0
- package/dist/panoramic/interfaces.d.ts +2 -2
- package/dist/panoramic/mock-readme-generator.d.ts +90 -0
- package/dist/panoramic/mock-readme-generator.d.ts.map +1 -0
- package/dist/panoramic/mock-readme-generator.js +111 -0
- package/dist/panoramic/mock-readme-generator.js.map +1 -0
- package/dist/panoramic/models/component-view-model.d.ts +1 -1
- package/dist/panoramic/models/component-view-model.d.ts.map +1 -1
- package/dist/panoramic/models/component-view-model.js.map +1 -1
- package/dist/panoramic/narrative-provenance-adapter.d.ts +8 -0
- package/dist/panoramic/narrative-provenance-adapter.d.ts.map +1 -0
- package/dist/panoramic/narrative-provenance-adapter.js +99 -0
- package/dist/panoramic/narrative-provenance-adapter.js.map +1 -0
- package/dist/panoramic/parser-registry.d.ts +1 -1
- package/dist/panoramic/parser-registry.js +1 -1
- package/dist/panoramic/parsers/types.d.ts +6 -6
- package/dist/panoramic/pattern-hints-generator.d.ts +28 -0
- package/dist/panoramic/pattern-hints-generator.d.ts.map +1 -0
- package/dist/panoramic/pattern-hints-generator.js +218 -0
- package/dist/panoramic/pattern-hints-generator.js.map +1 -0
- package/dist/panoramic/pattern-hints-model.d.ts +89 -0
- package/dist/panoramic/pattern-hints-model.d.ts.map +1 -0
- package/dist/panoramic/pattern-hints-model.js +61 -0
- package/dist/panoramic/pattern-hints-model.js.map +1 -0
- package/dist/panoramic/pattern-knowledge-base.d.ts +31 -0
- package/dist/panoramic/pattern-knowledge-base.d.ts.map +1 -0
- package/dist/panoramic/pattern-knowledge-base.js +407 -0
- package/dist/panoramic/pattern-knowledge-base.js.map +1 -0
- package/dist/panoramic/pipelines/adr-evidence-verifier.d.ts.map +1 -1
- package/dist/panoramic/pipelines/adr-evidence-verifier.js +1 -29
- package/dist/panoramic/pipelines/adr-evidence-verifier.js.map +1 -1
- package/dist/panoramic/pipelines/coverage-auditor.d.ts.map +1 -1
- package/dist/panoramic/pipelines/coverage-auditor.js +4 -2
- package/dist/panoramic/pipelines/coverage-auditor.js.map +1 -1
- package/dist/panoramic/pipelines/docs-bundle-orchestrator.js +13 -6
- package/dist/panoramic/pipelines/docs-bundle-orchestrator.js.map +1 -1
- package/dist/panoramic/pipelines/product-ux-docs.d.ts +5 -0
- package/dist/panoramic/pipelines/product-ux-docs.d.ts.map +1 -1
- package/dist/panoramic/pipelines/product-ux-docs.js +34 -6
- package/dist/panoramic/pipelines/product-ux-docs.js.map +1 -1
- package/dist/panoramic/product-ux-docs.d.ts +104 -0
- package/dist/panoramic/product-ux-docs.d.ts.map +1 -0
- package/dist/panoramic/product-ux-docs.js +817 -0
- package/dist/panoramic/product-ux-docs.js.map +1 -0
- package/dist/panoramic/qa/__tests__/citation.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/citation.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/citation.test.js +193 -0
- package/dist/panoramic/qa/__tests__/citation.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.js +154 -0
- package/dist/panoramic/qa/__tests__/debt-context.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.js +148 -0
- package/dist/panoramic/qa/__tests__/graph-retriever.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/index.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/index.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/index.test.js +246 -0
- package/dist/panoramic/qa/__tests__/index.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.js +168 -0
- package/dist/panoramic/qa/__tests__/llm-caller.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.js +150 -0
- package/dist/panoramic/qa/__tests__/prompt-builder.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.js +296 -0
- package/dist/panoramic/qa/__tests__/qa-integration.test.js.map +1 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.d.ts +2 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.d.ts.map +1 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.js +136 -0
- package/dist/panoramic/qa/__tests__/rag-reranker.test.js.map +1 -0
- package/dist/panoramic/qa/index.d.ts.map +1 -1
- package/dist/panoramic/qa/index.js +10 -3
- package/dist/panoramic/qa/index.js.map +1 -1
- package/dist/panoramic/query.d.ts +1 -0
- package/dist/panoramic/query.d.ts.map +1 -1
- package/dist/panoramic/query.js +5 -0
- package/dist/panoramic/query.js.map +1 -1
- package/dist/panoramic/runtime-topology-generator.d.ts +77 -0
- package/dist/panoramic/runtime-topology-generator.d.ts.map +1 -0
- package/dist/panoramic/runtime-topology-generator.js +676 -0
- package/dist/panoramic/runtime-topology-generator.js.map +1 -0
- package/dist/panoramic/runtime-topology-model.d.ts +145 -0
- package/dist/panoramic/runtime-topology-model.d.ts.map +1 -0
- package/dist/panoramic/runtime-topology-model.js +300 -0
- package/dist/panoramic/runtime-topology-model.js.map +1 -0
- package/dist/panoramic/troubleshooting-generator.d.ts +51 -0
- package/dist/panoramic/troubleshooting-generator.d.ts.map +1 -0
- package/dist/panoramic/troubleshooting-generator.js +451 -0
- package/dist/panoramic/troubleshooting-generator.js.map +1 -0
- package/dist/panoramic/utils/text-segmenter.d.ts +15 -0
- package/dist/panoramic/utils/text-segmenter.d.ts.map +1 -1
- package/dist/panoramic/utils/text-segmenter.js +38 -0
- package/dist/panoramic/utils/text-segmenter.js.map +1 -1
- package/dist/panoramic/workspace-index-generator.d.ts +148 -0
- package/dist/panoramic/workspace-index-generator.d.ts.map +1 -0
- package/dist/panoramic/workspace-index-generator.js +497 -0
- package/dist/panoramic/workspace-index-generator.js.map +1 -0
- package/dist/runtime-bootstrap.d.ts +9 -0
- package/dist/runtime-bootstrap.d.ts.map +1 -0
- package/dist/runtime-bootstrap.js +33 -0
- package/dist/runtime-bootstrap.js.map +1 -0
- package/dist/scaffold-kb/api-entities-serializer.d.ts +12 -0
- package/dist/scaffold-kb/api-entities-serializer.d.ts.map +1 -0
- package/dist/scaffold-kb/api-entities-serializer.js +144 -0
- package/dist/scaffold-kb/api-entities-serializer.js.map +1 -0
- package/dist/scaffold-kb/arbitration.d.ts +44 -0
- package/dist/scaffold-kb/arbitration.d.ts.map +1 -0
- package/dist/scaffold-kb/arbitration.js +144 -0
- package/dist/scaffold-kb/arbitration.js.map +1 -0
- package/dist/scaffold-kb/chunk-splitter.d.ts +20 -0
- package/dist/scaffold-kb/chunk-splitter.d.ts.map +1 -0
- package/dist/scaffold-kb/chunk-splitter.js +309 -0
- package/dist/scaffold-kb/chunk-splitter.js.map +1 -0
- package/dist/scaffold-kb/doc-graph-builder.d.ts +26 -0
- package/dist/scaffold-kb/doc-graph-builder.d.ts.map +1 -0
- package/dist/scaffold-kb/doc-graph-builder.js +72 -0
- package/dist/scaffold-kb/doc-graph-builder.js.map +1 -0
- package/dist/scaffold-kb/entity-extractor.d.ts +40 -0
- package/dist/scaffold-kb/entity-extractor.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-extractor.js +0 -0
- package/dist/scaffold-kb/entity-extractor.js.map +1 -0
- package/dist/scaffold-kb/entity-heuristic.d.ts +14 -0
- package/dist/scaffold-kb/entity-heuristic.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-heuristic.js +107 -0
- package/dist/scaffold-kb/entity-heuristic.js.map +1 -0
- package/dist/scaffold-kb/entity-matcher.d.ts +20 -0
- package/dist/scaffold-kb/entity-matcher.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-matcher.js +53 -0
- package/dist/scaffold-kb/entity-matcher.js.map +1 -0
- package/dist/scaffold-kb/entity-util.d.ts +11 -0
- package/dist/scaffold-kb/entity-util.d.ts.map +1 -0
- package/dist/scaffold-kb/entity-util.js +23 -0
- package/dist/scaffold-kb/entity-util.js.map +1 -0
- package/dist/scaffold-kb/evidence-envelope.d.ts +17 -0
- package/dist/scaffold-kb/evidence-envelope.d.ts.map +1 -0
- package/dist/scaffold-kb/evidence-envelope.js +32 -0
- package/dist/scaffold-kb/evidence-envelope.js.map +1 -0
- package/dist/scaffold-kb/index.d.ts +20 -0
- package/dist/scaffold-kb/index.d.ts.map +1 -0
- package/dist/scaffold-kb/index.js +102 -0
- package/dist/scaffold-kb/index.js.map +1 -0
- package/dist/scaffold-kb/ingest/ingest-core.d.ts +47 -0
- package/dist/scaffold-kb/ingest/ingest-core.d.ts.map +1 -0
- package/dist/scaffold-kb/ingest/ingest-core.js +231 -0
- package/dist/scaffold-kb/ingest/ingest-core.js.map +1 -0
- package/dist/scaffold-kb/ingest/office-parser.d.ts +33 -0
- package/dist/scaffold-kb/ingest/office-parser.d.ts.map +1 -0
- package/dist/scaffold-kb/ingest/office-parser.js +187 -0
- package/dist/scaffold-kb/ingest/office-parser.js.map +1 -0
- package/dist/scaffold-kb/ingest/url-fetcher.d.ts +43 -0
- package/dist/scaffold-kb/ingest/url-fetcher.d.ts.map +1 -0
- package/dist/scaffold-kb/ingest/url-fetcher.js +245 -0
- package/dist/scaffold-kb/ingest/url-fetcher.js.map +1 -0
- package/dist/scaffold-kb/ingester.d.ts +38 -0
- package/dist/scaffold-kb/ingester.d.ts.map +1 -0
- package/dist/scaffold-kb/ingester.js +261 -0
- package/dist/scaffold-kb/ingester.js.map +1 -0
- package/dist/scaffold-kb/injection-format.d.ts +25 -0
- package/dist/scaffold-kb/injection-format.d.ts.map +1 -0
- package/dist/scaffold-kb/injection-format.js +55 -0
- package/dist/scaffold-kb/injection-format.js.map +1 -0
- package/dist/scaffold-kb/kb-writer.d.ts +13 -0
- package/dist/scaffold-kb/kb-writer.d.ts.map +1 -0
- package/dist/scaffold-kb/kb-writer.js +69 -0
- package/dist/scaffold-kb/kb-writer.js.map +1 -0
- package/dist/scaffold-kb/keyword-extract.d.ts +16 -0
- package/dist/scaffold-kb/keyword-extract.d.ts.map +1 -0
- package/dist/scaffold-kb/keyword-extract.js +49 -0
- package/dist/scaffold-kb/keyword-extract.js.map +1 -0
- package/dist/scaffold-kb/query-sanitizer.d.ts +28 -0
- package/dist/scaffold-kb/query-sanitizer.d.ts.map +1 -0
- package/dist/scaffold-kb/query-sanitizer.js +38 -0
- package/dist/scaffold-kb/query-sanitizer.js.map +1 -0
- package/dist/scaffold-kb/recall-eval.d.ts +48 -0
- package/dist/scaffold-kb/recall-eval.d.ts.map +1 -0
- package/dist/scaffold-kb/recall-eval.js +55 -0
- package/dist/scaffold-kb/recall-eval.js.map +1 -0
- package/dist/scaffold-kb/schema-compat.d.ts +22 -0
- package/dist/scaffold-kb/schema-compat.d.ts.map +1 -0
- package/dist/scaffold-kb/schema-compat.js +32 -0
- package/dist/scaffold-kb/schema-compat.js.map +1 -0
- package/dist/scaffold-kb/search-core.d.ts +42 -0
- package/dist/scaffold-kb/search-core.d.ts.map +1 -0
- package/dist/scaffold-kb/search-core.js +89 -0
- package/dist/scaffold-kb/search-core.js.map +1 -0
- package/dist/scaffold-kb/sqlite-engine.d.ts +58 -0
- package/dist/scaffold-kb/sqlite-engine.d.ts.map +1 -0
- package/dist/scaffold-kb/sqlite-engine.js +61 -0
- package/dist/scaffold-kb/sqlite-engine.js.map +1 -0
- package/dist/scaffold-kb/sqlite-writer.d.ts +18 -0
- package/dist/scaffold-kb/sqlite-writer.d.ts.map +1 -0
- package/dist/scaffold-kb/sqlite-writer.js +76 -0
- package/dist/scaffold-kb/sqlite-writer.js.map +1 -0
- package/dist/scaffold-kb/tokenizer.d.ts +26 -0
- package/dist/scaffold-kb/tokenizer.d.ts.map +1 -0
- package/dist/scaffold-kb/tokenizer.js +97 -0
- package/dist/scaffold-kb/tokenizer.js.map +1 -0
- package/dist/scaffold-kb/types.d.ts +157 -0
- package/dist/scaffold-kb/types.d.ts.map +1 -0
- package/dist/scaffold-kb/types.js +5 -0
- package/dist/scaffold-kb/types.js.map +1 -0
- package/dist/utils/file-scanner.d.ts +15 -0
- package/dist/utils/file-scanner.d.ts.map +1 -1
- package/dist/utils/file-scanner.js +18 -1
- package/dist/utils/file-scanner.js.map +1 -1
- package/dist/utils/string-distance.d.ts +20 -0
- package/dist/utils/string-distance.d.ts.map +1 -0
- package/dist/utils/string-distance.js +38 -0
- package/dist/utils/string-distance.js.map +1 -0
- package/package.json +22 -3
- package/plugins/demo-kb-en/.claude-plugin/plugin.json +11 -0
- package/plugins/demo-kb-en/.mcp.json +8 -0
- package/plugins/demo-kb-en/FIXTURE.json +23 -0
- package/plugins/demo-kb-en/FIXTURE.md +53 -0
- package/plugins/demo-kb-en/ingest-samples/meeting-notes.md +13 -0
- package/plugins/demo-kb-en/kb/api-entities.json +3445 -0
- package/plugins/demo-kb-en/kb/chunks.sqlite +0 -0
- package/plugins/demo-kb-en/kb/doc-graph.json +113 -0
- package/plugins/demo-kb-zh/.claude-plugin/plugin.json +11 -0
- package/plugins/demo-kb-zh/.mcp.json +8 -0
- package/plugins/demo-kb-zh/FIXTURE.json +23 -0
- package/plugins/demo-kb-zh/FIXTURE.md +63 -0
- package/plugins/demo-kb-zh/ingest-samples/meeting-notes.md +13 -0
- package/plugins/demo-kb-zh/kb/api-entities.json +990 -0
- package/plugins/demo-kb-zh/kb/chunks.sqlite +0 -0
- package/plugins/demo-kb-zh/kb/doc-graph.json +113 -0
- package/plugins/spec-driver/.claude-plugin/plugin.json +1 -1
- package/plugins/spec-driver/README.md +50 -1
- package/plugins/spec-driver/agents/implement.md +20 -1
- package/plugins/spec-driver/agents/plan.md +20 -1
- package/plugins/spec-driver/agents/quality-review.md +20 -1
- package/plugins/spec-driver/agents/spec-review.md +20 -1
- package/plugins/spec-driver/agents/verify.md +108 -1
- package/plugins/spec-driver/config/orchestration.yaml +39 -31
- package/plugins/spec-driver/contracts/orchestration-overrides-contract.yaml +27 -0
- package/plugins/spec-driver/contracts/orchestration-schema.mjs +272 -227
- package/plugins/spec-driver/contracts/wrapper-source-of-truth.yaml +3 -0
- package/plugins/spec-driver/docs/customization.md +134 -0
- package/plugins/spec-driver/docs/spectra-mcp-integration.md +165 -0
- package/plugins/spec-driver/hooks/hooks.json +9 -0
- package/plugins/spec-driver/hooks/stop-fix-compliance-check.sh +36 -0
- package/plugins/spec-driver/lib/delegation-contract.mjs +84 -0
- package/plugins/spec-driver/lib/orchestration-resolver.mjs +49 -0
- package/plugins/spec-driver/lib/orchestrator.mjs +29 -1
- package/plugins/spec-driver/lib/preference-rules.mjs +96 -0
- package/plugins/spec-driver/scripts/codex-skills.sh +28 -28
- package/plugins/spec-driver/scripts/dev/spike-fix-compliance-e2e.mjs +130 -0
- package/plugins/spec-driver/scripts/fix-compliance-judge.mjs +415 -0
- package/plugins/spec-driver/scripts/generate-adoption-insights.mjs +48 -1
- package/plugins/spec-driver/scripts/goal-loop-cli.mjs +307 -0
- package/plugins/spec-driver/scripts/init-project.sh +56 -0
- package/plugins/spec-driver/scripts/kb-prequery.mjs +125 -0
- package/plugins/spec-driver/scripts/lib/config-schema.mjs +200 -94
- package/plugins/spec-driver/scripts/lib/ensure-gitignore.sh +277 -0
- package/plugins/spec-driver/scripts/lib/extract-wrapper-body.mjs +136 -0
- package/plugins/spec-driver/scripts/lib/fix-compliance-core.mjs +434 -0
- package/plugins/spec-driver/scripts/lib/fix-compliance-io.mjs +335 -0
- package/plugins/spec-driver/scripts/lib/goal-loop-core.mjs +783 -0
- package/plugins/spec-driver/scripts/lib/init-project-output.sh +28 -0
- package/plugins/spec-driver/scripts/lib/load-zod.mjs +62 -0
- package/plugins/spec-driver/scripts/lib/project-profile-resolver.mjs +141 -49
- package/plugins/spec-driver/scripts/lib/project-profile-schema.mjs +88 -54
- package/plugins/spec-driver/scripts/postinstall.sh +13 -1
- package/plugins/spec-driver/scripts/record-workflow-run.mjs +75 -0
- package/plugins/spec-driver/scripts/sync-delegation-contract.mjs +187 -0
- package/plugins/spec-driver/scripts/sync-preference-rules.mjs +148 -0
- package/plugins/spec-driver/scripts/validate-orchestrator-models.mjs +156 -0
- package/plugins/spec-driver/scripts/validate-wrapper-sources.mjs +46 -1
- package/plugins/spec-driver/skills/spec-driver-feature/SKILL.md +302 -0
- package/plugins/spec-driver/skills/spec-driver-fix/SKILL.md +97 -8
- package/plugins/spec-driver/skills/spec-driver-implement/SKILL.md +18 -0
- package/plugins/spec-driver/skills/spec-driver-refactor/SKILL.md +10 -0
- package/plugins/spec-driver/skills/spec-driver-resume/SKILL.md +12 -1
- package/plugins/spec-driver/skills/spec-driver-story/SKILL.md +30 -0
- package/plugins/spec-driver/templates/delegation-contract.md +27 -0
- package/plugins/spec-driver/templates/goal-loop-override-template.yaml +284 -0
- package/plugins/spec-driver/templates/preference-rules.md +39 -0
- package/plugins/spec-driver/templates/specify-base/project-context-template.yaml +10 -0
- package/plugins/spectra/.claude-plugin/plugin.json +1 -1
- package/plugins/spectra/README.md +48 -1
- package/plugins/spectra/hooks/post-commit.sh +40 -0
- package/templates/module-spec.hbs +1 -0
- package/templates/product-overview.hbs +1 -1
|
@@ -76,18 +76,8 @@ ensure_source_exists() {
|
|
|
76
76
|
fi
|
|
77
77
|
}
|
|
78
78
|
|
|
79
|
-
rewrite_codex_runtime_text
|
|
80
|
-
|
|
81
|
-
-e 's|/spec-driver:spec-driver-feature|$spec-driver-feature|g' \
|
|
82
|
-
-e 's|/spec-driver:spec-driver-implement|$spec-driver-implement|g' \
|
|
83
|
-
-e 's|/spec-driver:spec-driver-story|$spec-driver-story|g' \
|
|
84
|
-
-e 's|/spec-driver:spec-driver-fix|$spec-driver-fix|g' \
|
|
85
|
-
-e 's|/spec-driver:spec-driver-resume|$spec-driver-resume|g' \
|
|
86
|
-
-e 's|/spec-driver:spec-driver-sync|$spec-driver-sync|g' \
|
|
87
|
-
-e 's|/spec-driver:spec-driver-doc|$spec-driver-doc|g' \
|
|
88
|
-
-e 's|Claude Code 的 Task tool|Task tool(Codex 下按内联子代理执行)|g' \
|
|
89
|
-
-e 's|在同一消息中同时发出多个 Task tool 调用。Claude Code 的 function calling 机制支持在单个 assistant 消息中发出多个 tool calls,这些 tool calls 会被并行执行。|若当前环境支持并行工具调用,则在同一消息中并行执行;否则按本 Skill 的回退规则串行执行。|g'
|
|
90
|
-
}
|
|
79
|
+
# F186 T2:原 rewrite_codex_runtime_text(awk|sed 管道的 9 条替换)已迁移到单一 Node helper
|
|
80
|
+
# plugins/spec-driver/scripts/lib/extract-wrapper-body.mjs,与 JS 校验端共用,杜绝双实现漂移。
|
|
91
81
|
|
|
92
82
|
write_frontmatter() {
|
|
93
83
|
local skill_name="$1"
|
|
@@ -134,11 +124,24 @@ EOF_ADAPTER
|
|
|
134
124
|
|
|
135
125
|
write_wrapper_source_contract() {
|
|
136
126
|
local source_skill_name="$1"
|
|
127
|
+
local source_skill_path="$2"
|
|
128
|
+
|
|
129
|
+
# F186 T2:盖印 source body sha256(与 JS 校验端共用同一 helper,杜绝双实现漂移)。
|
|
130
|
+
local body_sha
|
|
131
|
+
body_sha="$(node "$PLUGIN_DIR/scripts/lib/extract-wrapper-body.mjs" "$source_skill_path" --sha256)"
|
|
132
|
+
|
|
133
|
+
# CRITICAL-1:helper 在安装路径含空格/非 ASCII 时若 isDirectExecution 误判会输出空 stdout 但退出码 0,
|
|
134
|
+
# 静默生成空 sha → 空 wrapper。此处对非 64 位十六进制 sha 做 hard fail,杜绝静默降级。
|
|
135
|
+
if [[ ! "$body_sha" =~ ^[0-9a-f]{64}$ ]]; then
|
|
136
|
+
echo "[错误] extract-wrapper-body.mjs 未产出合法 sha256(got: '${body_sha}'),source: $source_skill_path" >&2
|
|
137
|
+
exit 1
|
|
138
|
+
fi
|
|
137
139
|
|
|
138
140
|
cat <<EOF_CONTRACT
|
|
139
141
|
## Wrapper Source Contract
|
|
140
142
|
|
|
141
143
|
- Canonical source: \`\$PLUGIN_DIR/skills/$source_skill_name/SKILL.md\`
|
|
144
|
+
- Source SHA256: $body_sha
|
|
142
145
|
- Generated by: \`bash \$PLUGIN_DIR/scripts/codex-skills.sh install\`
|
|
143
146
|
- Contract: \`\$PLUGIN_DIR/contracts/wrapper-source-of-truth.yaml\`
|
|
144
147
|
- Maintenance rule: edit the source skill, then reinstall; do not edit this wrapper directly
|
|
@@ -150,21 +153,18 @@ EOF_CONTRACT
|
|
|
150
153
|
write_skill_body() {
|
|
151
154
|
local source_skill_path="$1"
|
|
152
155
|
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
print
|
|
166
|
-
}
|
|
167
|
-
' "$source_skill_path" | rewrite_codex_runtime_text
|
|
156
|
+
# F186 T2:frontmatter 剥除 + runtime text 替换改由单一 Node helper 产出,
|
|
157
|
+
# 与 validate-wrapper-sources.mjs 共用同一提取逻辑(防双实现逐字节漂移)。
|
|
158
|
+
local body
|
|
159
|
+
body="$(node "$PLUGIN_DIR/scripts/lib/extract-wrapper-body.mjs" "$source_skill_path")"
|
|
160
|
+
|
|
161
|
+
# CRITICAL-1:helper 误判 isDirectExecution(含空格/非 ASCII 安装路径)时会输出空 body 但退出码 0,
|
|
162
|
+
# 静默生成空正文 wrapper。source skill 正文恒非空,故空 body 必为 helper 故障 → hard fail。
|
|
163
|
+
if [[ -z "$body" ]]; then
|
|
164
|
+
echo "[错误] extract-wrapper-body.mjs 产出空 body,source: $source_skill_path" >&2
|
|
165
|
+
exit 1
|
|
166
|
+
fi
|
|
167
|
+
printf '%s\n' "$body"
|
|
168
168
|
}
|
|
169
169
|
|
|
170
170
|
write_wrapper() {
|
|
@@ -179,7 +179,7 @@ write_wrapper() {
|
|
|
179
179
|
{
|
|
180
180
|
write_frontmatter "$skill_name" "$source_skill_path"
|
|
181
181
|
printf '\n'
|
|
182
|
-
write_wrapper_source_contract "$source_skill_name"
|
|
182
|
+
write_wrapper_source_contract "$source_skill_name" "$source_skill_path"
|
|
183
183
|
printf '\n'
|
|
184
184
|
write_codex_adapter "$skill_name" "$source_skill_name"
|
|
185
185
|
printf '\n'
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* spike-fix-compliance-e2e.mjs
|
|
5
|
+
* Feature 208 / T028 — fix 依从性 Stop hook 的手工 headless E2E spike。
|
|
6
|
+
*
|
|
7
|
+
* ⚠️ 手工触发脚本:会 spawn `claude --print` 消耗真实订阅凭据(haiku + 极简任务,
|
|
8
|
+
* 单次 <$0.05),**不计入 `npm test`**、不在 CI 自动跑。用途 = 在与评测同构的
|
|
9
|
+
* headless 入口(--plugin-dir 注入插件副本 + Stop hook 挂载)下,观测
|
|
10
|
+
* `stop-fix-compliance-check.sh` 的 exit code 与 `[FIX-COMPLIANCE]` 反馈闭环。
|
|
11
|
+
*
|
|
12
|
+
* 手法复刻 specs/208-.../research/harness-verification.md 的"插件副本 + hook-trace"实锤:
|
|
13
|
+
* 1. 拷贝 plugins/spec-driver 到 scratchpad/os.tmpdir 副本(不污染源码)
|
|
14
|
+
* 2. 副本 hooks.json 追加 Stop → stop-fix-compliance-check.sh
|
|
15
|
+
* 3. claude --print --plugin-dir <副本> 跑 collapsed / compliant 极简场景
|
|
16
|
+
* 4. 打印 hook-trace 时间线与最终 exit code
|
|
17
|
+
*
|
|
18
|
+
* 用法:
|
|
19
|
+
* node plugins/spec-driver/scripts/dev/spike-fix-compliance-e2e.mjs --scenario collapsed
|
|
20
|
+
* node plugins/spec-driver/scripts/dev/spike-fix-compliance-e2e.mjs --scenario compliant
|
|
21
|
+
* node plugins/spec-driver/scripts/dev/spike-fix-compliance-e2e.mjs --scenario collapsed --keep # 保留副本供排查
|
|
22
|
+
*
|
|
23
|
+
* 执行属 T029 主编排器职责;本文件仅提供可重跑脚本。
|
|
24
|
+
*/
|
|
25
|
+
|
|
26
|
+
import fs from 'node:fs';
|
|
27
|
+
import os from 'node:os';
|
|
28
|
+
import path from 'node:path';
|
|
29
|
+
import { spawnSync } from 'node:child_process';
|
|
30
|
+
import { fileURLToPath } from 'node:url';
|
|
31
|
+
|
|
32
|
+
const SCENARIOS = new Set(['collapsed', 'compliant']);
|
|
33
|
+
|
|
34
|
+
function parseArgs(argv) {
|
|
35
|
+
const args = { scenario: 'collapsed', keep: false, model: 'claude-haiku-4-5' };
|
|
36
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
37
|
+
if (argv[i] === '--scenario') { args.scenario = argv[i + 1] ?? args.scenario; i += 1; } else if (argv[i] === '--keep') { args.keep = true; } else if (argv[i] === '--model') { args.model = argv[i + 1] ?? args.model; i += 1; }
|
|
38
|
+
}
|
|
39
|
+
if (!SCENARIOS.has(args.scenario)) {
|
|
40
|
+
throw new Error(`未知场景: ${args.scenario}(可选: ${[...SCENARIOS].join(', ')})`);
|
|
41
|
+
}
|
|
42
|
+
return args;
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
/** 递归拷贝插件源码到副本目录(node 20 fs.cpSync) */
|
|
46
|
+
function copyPluginTo(destRoot) {
|
|
47
|
+
const pluginSrc = fileURLToPath(new URL('../..', import.meta.url)); // plugins/spec-driver
|
|
48
|
+
const dest = path.join(destRoot, 'spec-driver');
|
|
49
|
+
fs.cpSync(pluginSrc, dest, {
|
|
50
|
+
recursive: true,
|
|
51
|
+
filter: (src) => !src.includes(`${path.sep}node_modules${path.sep}`) && !src.endsWith(`${path.sep}node_modules`),
|
|
52
|
+
});
|
|
53
|
+
return dest;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/** 在副本 hooks.json 的 Stop 数组挂载新 hook(幂等:T026 之后源码已自带该条目,重复追加会双挂双计数) */
|
|
57
|
+
function mountStopHook(pluginDest) {
|
|
58
|
+
const hooksPath = path.join(pluginDest, 'hooks', 'hooks.json');
|
|
59
|
+
const hooks = JSON.parse(fs.readFileSync(hooksPath, 'utf8'));
|
|
60
|
+
hooks.hooks.Stop = hooks.hooks.Stop || [];
|
|
61
|
+
const alreadyMounted = hooks.hooks.Stop.some((entry) =>
|
|
62
|
+
(entry.hooks || []).some((h) => typeof h.command === 'string' && h.command.includes('stop-fix-compliance-check.sh')));
|
|
63
|
+
if (!alreadyMounted) {
|
|
64
|
+
hooks.hooks.Stop.push({
|
|
65
|
+
matcher: '',
|
|
66
|
+
hooks: [{ type: 'command', command: 'bash ${CLAUDE_PLUGIN_ROOT}/hooks/stop-fix-compliance-check.sh' }],
|
|
67
|
+
});
|
|
68
|
+
fs.writeFileSync(hooksPath, `${JSON.stringify(hooks, null, 2)}\n`, 'utf8');
|
|
69
|
+
}
|
|
70
|
+
return alreadyMounted;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
/**
|
|
74
|
+
* 构造极简 headless prompt。
|
|
75
|
+
* collapsed:诱导模型直接输出"完成"而不走委派(观测 exit 2 + [FIX-COMPLIANCE])。
|
|
76
|
+
* compliant:仅要求回一个字(不会触发 fix 展开 → 非 fix 会话零接触,作为对照)。
|
|
77
|
+
*
|
|
78
|
+
* 说明:真正的 fix 展开由 slash 命令 harness 注入,spike 无法在 --print 位置参数里
|
|
79
|
+
* 完美复刻 SKILL 展开;本 spike 主要观测 hook 是否执行 + 退出码转发是否成立,
|
|
80
|
+
* 完整 opus + 真实展开的端到端可靠性属评测阶段(harness-verification.md 外推边界)。
|
|
81
|
+
*/
|
|
82
|
+
function buildPrompt(scenario) {
|
|
83
|
+
if (scenario === 'collapsed') {
|
|
84
|
+
return 'Base directory for this skill: /w/plugins/spec-driver/skills/spec-driver-fix\n请直接回复"已修复",不要调用任何工具。';
|
|
85
|
+
}
|
|
86
|
+
return 'say only ok';
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
function main() {
|
|
90
|
+
const args = parseArgs(process.argv.slice(2));
|
|
91
|
+
const scratchBase = process.env.SCRATCHPAD || os.tmpdir();
|
|
92
|
+
const workdir = fs.mkdtempSync(path.join(scratchBase, 'fix-compliance-spike-'));
|
|
93
|
+
const pluginCopyRoot = path.join(workdir, 'plugins');
|
|
94
|
+
fs.mkdirSync(pluginCopyRoot, { recursive: true });
|
|
95
|
+
|
|
96
|
+
console.log(`[spike] scenario=${args.scenario} model=${args.model}`);
|
|
97
|
+
console.log(`[spike] workdir=${workdir}`);
|
|
98
|
+
|
|
99
|
+
const pluginDest = copyPluginTo(pluginCopyRoot);
|
|
100
|
+
mountStopHook(pluginDest);
|
|
101
|
+
console.log(`[spike] 插件副本已就绪 + Stop hook 已挂载: ${pluginDest}/hooks/hooks.json`);
|
|
102
|
+
|
|
103
|
+
const prompt = buildPrompt(args.scenario);
|
|
104
|
+
const started = Date.now();
|
|
105
|
+
const res = spawnSync('claude', [
|
|
106
|
+
'--print',
|
|
107
|
+
'--model', args.model,
|
|
108
|
+
'--plugin-dir', pluginDest,
|
|
109
|
+
'--permission-mode', 'acceptEdits',
|
|
110
|
+
'--', prompt,
|
|
111
|
+
], { encoding: 'utf8', cwd: workdir });
|
|
112
|
+
|
|
113
|
+
const elapsedMs = Date.now() - started;
|
|
114
|
+
console.log('──────── hook-trace / 输出 ────────');
|
|
115
|
+
console.log(`[spike] exit=${res.status} elapsedMs=${elapsedMs}`);
|
|
116
|
+
console.log('[spike] stdout:');
|
|
117
|
+
console.log(res.stdout || '(空)');
|
|
118
|
+
console.log('[spike] stderr(关注 [FIX-COMPLIANCE] / [GATE-DEGRADED] 前缀):');
|
|
119
|
+
console.log(res.stderr || '(空)');
|
|
120
|
+
console.log('───────────────────────────────────');
|
|
121
|
+
|
|
122
|
+
if (args.keep) {
|
|
123
|
+
console.log(`[spike] --keep:保留副本 ${workdir}`);
|
|
124
|
+
} else {
|
|
125
|
+
fs.rmSync(workdir, { recursive: true, force: true });
|
|
126
|
+
console.log('[spike] 已清理副本');
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
|
|
130
|
+
main();
|
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* fix-compliance-judge.mjs
|
|
5
|
+
* Feature 208 — fix 模式流程依从性判定 CLI 编排入口(唯一由 hooks.json 挂载的生产路径)
|
|
6
|
+
*
|
|
7
|
+
* 分层契约(research.md D3):本文件是 I/O 编排层,负责
|
|
8
|
+
* 解析参数与 stdin payload → 编排 io 层读取(config/transcript/state)→ 调用 core 纯函数判定
|
|
9
|
+
* → 编排 io 层写入(审计事件 / 阻断计数 / 降级放行的 record-workflow-run 终态事件)
|
|
10
|
+
* → 决定退出码与 stderr 反馈文本。
|
|
11
|
+
*
|
|
12
|
+
* 不变量(contracts/fix-compliance-judge-cli.md):
|
|
13
|
+
* - 零 LLM / 零子代理委派:全程无 `Task(` / 模型 API 调用。
|
|
14
|
+
* - 顶层 try/catch 兜底(FR-013):任何未捕获异常在 hook 模式下转化为 exit 0,不泄漏崩溃退出码。
|
|
15
|
+
* - `--mode report` 恒 exit 0、只打印 verdict JSON、零落盘副作用。
|
|
16
|
+
* - 不读取任务 ID / 任务描述文本作为判据(FR-011)。
|
|
17
|
+
*/
|
|
18
|
+
|
|
19
|
+
import process from 'node:process';
|
|
20
|
+
import { fileURLToPath } from 'node:url';
|
|
21
|
+
import fs from 'node:fs';
|
|
22
|
+
import { realpathSync } from 'node:fs';
|
|
23
|
+
import {
|
|
24
|
+
detectFixSkillExpansion,
|
|
25
|
+
extractDelegationsAfter,
|
|
26
|
+
resolveFeatureDirCandidate,
|
|
27
|
+
judgeCompliance,
|
|
28
|
+
MISSING_ACTION_TEXT,
|
|
29
|
+
DUAL_PATH_GUIDANCE,
|
|
30
|
+
GATE_DEGRADED_PREFIX_LINE,
|
|
31
|
+
} from './lib/fix-compliance-core.mjs';
|
|
32
|
+
import {
|
|
33
|
+
readHookPayload,
|
|
34
|
+
readTranscriptEntries,
|
|
35
|
+
findAndParseConfig,
|
|
36
|
+
appendAuditEvent,
|
|
37
|
+
checkFeatureDirOnDisk,
|
|
38
|
+
readArtifactFile,
|
|
39
|
+
loadBlockState,
|
|
40
|
+
saveBlockState,
|
|
41
|
+
resetBlockState,
|
|
42
|
+
} from './lib/fix-compliance-io.mjs';
|
|
43
|
+
import { recordWorkflowRun } from './record-workflow-run.mjs';
|
|
44
|
+
|
|
45
|
+
/** stderr 反馈前缀(FR-010,与既有 stop-task-check.sh 的 `[提醒]` 相区分) */
|
|
46
|
+
const PREFIX_BLOCK = '[FIX-COMPLIANCE]';
|
|
47
|
+
const PREFIX_WARN = '[FIX-COMPLIANCE][WARN]';
|
|
48
|
+
const PREFIX_DEGRADED = '[FIX-COMPLIANCE][GATE-DEGRADED]';
|
|
49
|
+
|
|
50
|
+
/** 会话内不合规阻断上限(FR-006):达到后降级放行 */
|
|
51
|
+
const BLOCK_LIMIT = 2;
|
|
52
|
+
|
|
53
|
+
// ────────────────────────────────────────
|
|
54
|
+
// 参数解析
|
|
55
|
+
// ────────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
export function parseArgs(argv) {
|
|
58
|
+
const args = { mode: 'hook', projectRoot: process.cwd(), transcriptPath: null };
|
|
59
|
+
for (let i = 0; i < argv.length; i += 1) {
|
|
60
|
+
const token = argv[i];
|
|
61
|
+
if (token === '--mode') {
|
|
62
|
+
args.mode = argv[i + 1] ?? args.mode;
|
|
63
|
+
i += 1;
|
|
64
|
+
} else if (token === '--project-root') {
|
|
65
|
+
args.projectRoot = argv[i + 1] ?? args.projectRoot;
|
|
66
|
+
i += 1;
|
|
67
|
+
} else if (token === '--transcript-path') {
|
|
68
|
+
args.transcriptPath = argv[i + 1] ?? args.transcriptPath;
|
|
69
|
+
i += 1;
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
if (args.mode !== 'hook' && args.mode !== 'report') args.mode = 'hook';
|
|
73
|
+
return args;
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
// ────────────────────────────────────────
|
|
77
|
+
// stdin 读取(同步,避免异步竞态;hook payload 体量极小)
|
|
78
|
+
// ────────────────────────────────────────
|
|
79
|
+
|
|
80
|
+
function readStdinSync() {
|
|
81
|
+
try {
|
|
82
|
+
return fs.readFileSync(0, 'utf8');
|
|
83
|
+
} catch {
|
|
84
|
+
return '';
|
|
85
|
+
}
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
// ────────────────────────────────────────
|
|
89
|
+
// 判定编排(纯读取,不落盘;hook 与 report 共用)
|
|
90
|
+
// ────────────────────────────────────────
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* 编排一次完整判定:读配置 → 读 transcript → 锚定 → 抽取委派/制品 → core 判定。
|
|
94
|
+
* @returns {{
|
|
95
|
+
* enforcement:string, configDegraded:boolean,
|
|
96
|
+
* isFix:boolean, mode:string|null,
|
|
97
|
+
* transcriptDiagnostics:string[],
|
|
98
|
+
* verdict:object|null,
|
|
99
|
+
* }}
|
|
100
|
+
*/
|
|
101
|
+
function evaluate(projectRoot, transcriptPath, cfg = null) {
|
|
102
|
+
const config = cfg || findAndParseConfig(projectRoot);
|
|
103
|
+
const enforcement = config.enforcement;
|
|
104
|
+
const configDegraded = config.configDegraded;
|
|
105
|
+
const configDiagnostics = config.diagnostics || [];
|
|
106
|
+
|
|
107
|
+
const { entries, diagnostics: transcriptDiagnostics } = readTranscriptEntries(transcriptPath);
|
|
108
|
+
if (transcriptDiagnostics.length > 0) {
|
|
109
|
+
// transcript 不可用/超限 → FR-013 fail-open(无法得出判定结论)
|
|
110
|
+
return {
|
|
111
|
+
enforcement, configDegraded, isFix: false, mode: null,
|
|
112
|
+
transcriptDiagnostics, verdict: null,
|
|
113
|
+
};
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
const anchor = detectFixSkillExpansion(entries);
|
|
117
|
+
const isFix = anchor.found && anchor.mode === 'fix';
|
|
118
|
+
if (!isFix) {
|
|
119
|
+
return {
|
|
120
|
+
enforcement, configDegraded, isFix: false, mode: anchor.mode,
|
|
121
|
+
transcriptDiagnostics: [], verdict: null,
|
|
122
|
+
};
|
|
123
|
+
}
|
|
124
|
+
|
|
125
|
+
const delegations = extractDelegationsAfter(entries, anchor.anchorLineIndex);
|
|
126
|
+
const candidate = resolveFeatureDirCandidate(entries, anchor.anchorLineIndex);
|
|
127
|
+
const featureDirCheck = checkFeatureDirOnDisk(projectRoot, candidate.path);
|
|
128
|
+
const fixReport = candidate.path
|
|
129
|
+
? readArtifactFile(projectRoot, `${candidate.path}/fix-report.md`)
|
|
130
|
+
: { exists: false, content: null, nonEmpty: false };
|
|
131
|
+
const verificationReport = candidate.path
|
|
132
|
+
? readArtifactFile(projectRoot, `${candidate.path}/verification/verification-report.md`)
|
|
133
|
+
: { exists: false, content: null, nonEmpty: false };
|
|
134
|
+
|
|
135
|
+
const verdict = judgeCompliance({
|
|
136
|
+
delegations,
|
|
137
|
+
featureDir: { path: candidate.path, existsOnDisk: featureDirCheck.existsOnDisk },
|
|
138
|
+
fixReport: { exists: fixReport.exists, content: fixReport.content },
|
|
139
|
+
verificationReport: { exists: verificationReport.exists, nonEmpty: verificationReport.nonEmpty },
|
|
140
|
+
enforcement,
|
|
141
|
+
configDegraded,
|
|
142
|
+
diagnostics: configDiagnostics,
|
|
143
|
+
});
|
|
144
|
+
|
|
145
|
+
return {
|
|
146
|
+
enforcement, configDegraded, isFix: true, mode: anchor.mode,
|
|
147
|
+
transcriptDiagnostics: [], verdict,
|
|
148
|
+
};
|
|
149
|
+
}
|
|
150
|
+
|
|
151
|
+
// ────────────────────────────────────────
|
|
152
|
+
// FR-010 反馈文本机械拼装(core 常量拼装,非自由生成)
|
|
153
|
+
// ────────────────────────────────────────
|
|
154
|
+
|
|
155
|
+
/**
|
|
156
|
+
* 由 missing 枚举拼装反馈文本:稳定动作行 + 双路径指引。
|
|
157
|
+
* @param {string[]} missing
|
|
158
|
+
* @param {{ degraded?:boolean, diagnostics?:string[] }} [opts]
|
|
159
|
+
*/
|
|
160
|
+
export function buildFeedbackText(missing, opts = {}) {
|
|
161
|
+
const actionLines = (Array.isArray(missing) ? missing : [])
|
|
162
|
+
.map((key) => MISSING_ACTION_TEXT[key])
|
|
163
|
+
.filter(Boolean);
|
|
164
|
+
const segments = [];
|
|
165
|
+
if (opts.degraded) segments.push(GATE_DEGRADED_PREFIX_LINE);
|
|
166
|
+
segments.push(...actionLines);
|
|
167
|
+
segments.push('', DUAL_PATH_GUIDANCE);
|
|
168
|
+
if (Array.isArray(opts.diagnostics) && opts.diagnostics.length > 0) {
|
|
169
|
+
segments.push('', `诊断: ${opts.diagnostics.join(', ')}`);
|
|
170
|
+
}
|
|
171
|
+
return segments.join('\n');
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
// ────────────────────────────────────────
|
|
175
|
+
// 审计事件构造(contracts/fix-compliance-verdict-event.schema.json)
|
|
176
|
+
// ────────────────────────────────────────
|
|
177
|
+
|
|
178
|
+
function buildAuditEvent({ sessionId, enforcement, verdict, blockCount, degraded, extraDiagnostics }) {
|
|
179
|
+
const diag = new Set([
|
|
180
|
+
...((verdict && verdict.diagnostics) || []),
|
|
181
|
+
...(extraDiagnostics || []),
|
|
182
|
+
]);
|
|
183
|
+
return {
|
|
184
|
+
schemaVersion: 1,
|
|
185
|
+
eventType: 'fix-compliance-verdict',
|
|
186
|
+
recordedAt: new Date().toISOString(),
|
|
187
|
+
sessionId,
|
|
188
|
+
enforcement,
|
|
189
|
+
closureForm: verdict ? verdict.closureForm : 'undetermined',
|
|
190
|
+
compliant: verdict ? verdict.compliant : null,
|
|
191
|
+
missing: verdict ? verdict.missing : [],
|
|
192
|
+
blockCount: enforcement === 'block' ? (typeof blockCount === 'number' ? blockCount : null) : null,
|
|
193
|
+
degraded: Boolean(degraded),
|
|
194
|
+
diagnostics: [...diag],
|
|
195
|
+
};
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
// ────────────────────────────────────────
|
|
199
|
+
// hook 模式路由(阻断 / 警告 / 降级放行)
|
|
200
|
+
// ────────────────────────────────────────
|
|
201
|
+
|
|
202
|
+
/**
|
|
203
|
+
* 处理不合规 + block 档:阻断计数路由(FR-006 有界化)。
|
|
204
|
+
* @returns {number} 退出码
|
|
205
|
+
*/
|
|
206
|
+
function routeBlock(projectRoot, sessionId, verdict) {
|
|
207
|
+
const loaded = loadBlockState(projectRoot, sessionId);
|
|
208
|
+
const count = loaded.blockCount;
|
|
209
|
+
|
|
210
|
+
if (count < BLOCK_LIMIT) {
|
|
211
|
+
// 未达上限:尝试持久化 N+1 → 成功则硬阻断,失败(存储不可用)则等同已达上限降级放行
|
|
212
|
+
const nextCount = count + 1;
|
|
213
|
+
const saved = saveBlockState(projectRoot, sessionId, {
|
|
214
|
+
blockCount: nextCount,
|
|
215
|
+
degradedRecorded: loaded.degradedRecorded,
|
|
216
|
+
});
|
|
217
|
+
if (saved.ok) {
|
|
218
|
+
appendAuditEvent(projectRoot, buildAuditEvent({
|
|
219
|
+
sessionId, enforcement: 'block', verdict, blockCount: nextCount, degraded: false,
|
|
220
|
+
}));
|
|
221
|
+
process.stderr.write(`${PREFIX_BLOCK} ${buildFeedbackText(verdict.missing)}\n`);
|
|
222
|
+
return 2;
|
|
223
|
+
}
|
|
224
|
+
// 存储不可用 → 无法可靠维持计数,按等同"已达上限"降级放行(research.md D2)
|
|
225
|
+
return releaseDegraded(projectRoot, sessionId, verdict, {
|
|
226
|
+
alreadyRecorded: false,
|
|
227
|
+
storageUnavailable: true,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
// 已达上限(count >= 2)→ 降级放行
|
|
232
|
+
return releaseDegraded(projectRoot, sessionId, verdict, {
|
|
233
|
+
alreadyRecorded: loaded.degradedRecorded,
|
|
234
|
+
storageUnavailable: false,
|
|
235
|
+
});
|
|
236
|
+
}
|
|
237
|
+
|
|
238
|
+
/**
|
|
239
|
+
* 降级放行:exit 0 + [GATE-DEGRADED] reason + 幂等终态双写(首次)或轻量审计(重复)。
|
|
240
|
+
* @returns {number} 恒 0
|
|
241
|
+
*/
|
|
242
|
+
function releaseDegraded(projectRoot, sessionId, verdict, { alreadyRecorded, storageUnavailable }) {
|
|
243
|
+
const extraDiagnostics = storageUnavailable ? ['state-storage-unavailable'] : [];
|
|
244
|
+
const blockCount = BLOCK_LIMIT;
|
|
245
|
+
// 存储不可用无法读写幂等标记 → 允许重复终态(宁可可审计不可静默丢失,research.md D2/D4)
|
|
246
|
+
const shouldWriteTerminal = storageUnavailable || !alreadyRecorded;
|
|
247
|
+
|
|
248
|
+
if (shouldWriteTerminal) {
|
|
249
|
+
try {
|
|
250
|
+
recordWorkflowRun({
|
|
251
|
+
projectRoot,
|
|
252
|
+
workflowId: 'spec-driver-fix',
|
|
253
|
+
runId: sessionId,
|
|
254
|
+
result: 'failed',
|
|
255
|
+
warnings: [`${PREFIX_DEGRADED} fix 会话在 ${BLOCK_LIMIT + 1} 次不合规尝试后降级放行,缺失: ${verdict.missing.join(', ')}`],
|
|
256
|
+
complianceVerdict: {
|
|
257
|
+
closureForm: verdict.closureForm,
|
|
258
|
+
compliant: verdict.compliant,
|
|
259
|
+
missing: verdict.missing,
|
|
260
|
+
degraded: true,
|
|
261
|
+
blockCount,
|
|
262
|
+
},
|
|
263
|
+
});
|
|
264
|
+
} catch {
|
|
265
|
+
// 终态写入失败不得让降级路由崩溃(FR-013 精神)
|
|
266
|
+
}
|
|
267
|
+
// 首次降级成功后置幂等标记(存储可用时才有意义)
|
|
268
|
+
if (!storageUnavailable) {
|
|
269
|
+
saveBlockState(projectRoot, sessionId, { blockCount, degradedRecorded: true });
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
appendAuditEvent(projectRoot, buildAuditEvent({
|
|
274
|
+
sessionId, enforcement: 'block', verdict, blockCount, degraded: true, extraDiagnostics,
|
|
275
|
+
}));
|
|
276
|
+
process.stderr.write(`${PREFIX_DEGRADED} ${buildFeedbackText(verdict.missing, { degraded: true, diagnostics: extraDiagnostics })}\n`);
|
|
277
|
+
return 0;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* FR-013 fail-open 的 loud 半边:判定能力失效时 best-effort 落盘 degraded 诊断事件,
|
|
282
|
+
* 使"漏拦"在事后审计中可被发现而非彻底隐没。写入自身失败不得影响放行(双重兜底)。
|
|
283
|
+
*/
|
|
284
|
+
function tryAppendFailOpenEvent(projectRoot, sessionId, enforcement, diagnostics, configDiagnostics = []) {
|
|
285
|
+
try {
|
|
286
|
+
// 合并配置层诊断(如 config-degraded)——配置非法与判定异常同时发生时两类信息都不得丢失
|
|
287
|
+
// (codex implement 审查 W-2,FR-015 可追溯性)
|
|
288
|
+
const merged = [...new Set([
|
|
289
|
+
...(Array.isArray(configDiagnostics) ? configDiagnostics : []),
|
|
290
|
+
...(Array.isArray(diagnostics) ? diagnostics : []),
|
|
291
|
+
])];
|
|
292
|
+
appendAuditEvent(projectRoot, {
|
|
293
|
+
schemaVersion: 1,
|
|
294
|
+
eventType: 'fix-compliance-verdict',
|
|
295
|
+
recordedAt: new Date().toISOString(),
|
|
296
|
+
sessionId: typeof sessionId === 'string' && sessionId.length > 0 ? sessionId : 'unknown',
|
|
297
|
+
enforcement: enforcement === 'warn' ? 'warn' : 'block',
|
|
298
|
+
closureForm: 'undetermined',
|
|
299
|
+
compliant: null,
|
|
300
|
+
missing: [],
|
|
301
|
+
blockCount: null,
|
|
302
|
+
degraded: true,
|
|
303
|
+
diagnostics: merged,
|
|
304
|
+
});
|
|
305
|
+
} catch {
|
|
306
|
+
// 诊断落盘失败不得让 fail-open 路径崩溃
|
|
307
|
+
}
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* hook 模式主路由。
|
|
312
|
+
* @returns {number} 退出码
|
|
313
|
+
*/
|
|
314
|
+
function runHook(projectRoot, payload) {
|
|
315
|
+
// FR-015 判定顺序:(1) 非抛出式配置解析 →(2) off 立即零接触退出(在任何 transcript 读取之前)
|
|
316
|
+
const cfg = findAndParseConfig(projectRoot);
|
|
317
|
+
if (cfg.enforcement === 'off') return 0;
|
|
318
|
+
|
|
319
|
+
const result = evaluate(projectRoot, payload.transcript_path, cfg);
|
|
320
|
+
|
|
321
|
+
// transcript 不可用/超限 → FR-013 fail-open 放行 + loud 诊断落盘(合并配置层诊断)
|
|
322
|
+
if (result.transcriptDiagnostics.length > 0) {
|
|
323
|
+
tryAppendFailOpenEvent(projectRoot, payload.session_id, cfg.enforcement, result.transcriptDiagnostics, cfg.diagnostics);
|
|
324
|
+
return 0;
|
|
325
|
+
}
|
|
326
|
+
// 非 fix 会话 → 零接触放行(US5:健康路径不产生任何落盘),不 reset 保持零落盘语义
|
|
327
|
+
if (!result.isFix || !result.verdict) return 0;
|
|
328
|
+
// 合规 → 重置该 session 阻断状态(补救成功清零转移,FR-006 增补)后静默放行。
|
|
329
|
+
// 无条件调用(不区分 block/warn):warn 档从不 bump 计数、其状态文件本就不存在,
|
|
330
|
+
// reset 对其为空操作;off 档已在函数入口短路,永不触达此分支。
|
|
331
|
+
if (result.verdict.compliant) {
|
|
332
|
+
resetBlockState(projectRoot, payload.session_id);
|
|
333
|
+
return 0;
|
|
334
|
+
}
|
|
335
|
+
|
|
336
|
+
const sessionId = payload.session_id;
|
|
337
|
+
|
|
338
|
+
if (result.enforcement === 'warn') {
|
|
339
|
+
appendAuditEvent(projectRoot, buildAuditEvent({
|
|
340
|
+
sessionId, enforcement: 'warn', verdict: result.verdict, blockCount: null, degraded: false,
|
|
341
|
+
}));
|
|
342
|
+
process.stderr.write(`${PREFIX_WARN} ${buildFeedbackText(result.verdict.missing)}\n`);
|
|
343
|
+
return 0;
|
|
344
|
+
}
|
|
345
|
+
|
|
346
|
+
// enforcement=block
|
|
347
|
+
return routeBlock(projectRoot, sessionId, result.verdict);
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
// ────────────────────────────────────────
|
|
351
|
+
// report 模式(只读,恒 exit 0,仅 stdout verdict JSON)
|
|
352
|
+
// ────────────────────────────────────────
|
|
353
|
+
|
|
354
|
+
function runReport(projectRoot, transcriptPath) {
|
|
355
|
+
const result = evaluate(projectRoot, transcriptPath);
|
|
356
|
+
const out = {
|
|
357
|
+
mode: result.mode,
|
|
358
|
+
fixSession: result.isFix,
|
|
359
|
+
enforcement: result.enforcement,
|
|
360
|
+
configDegraded: result.configDegraded,
|
|
361
|
+
transcriptDiagnostics: result.transcriptDiagnostics,
|
|
362
|
+
...(result.verdict || {}),
|
|
363
|
+
};
|
|
364
|
+
process.stdout.write(`${JSON.stringify(out)}\n`);
|
|
365
|
+
return 0;
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
// ────────────────────────────────────────
|
|
369
|
+
// main(顶层 try/catch 兜底 FR-013)
|
|
370
|
+
// ────────────────────────────────────────
|
|
371
|
+
|
|
372
|
+
export function main(argv, stdinRaw) {
|
|
373
|
+
const args = parseArgs(argv);
|
|
374
|
+
try {
|
|
375
|
+
if (args.mode === 'report') {
|
|
376
|
+
// report 优先用 --transcript-path,缺省时回落 stdin payload
|
|
377
|
+
let transcriptPath = args.transcriptPath;
|
|
378
|
+
if (!transcriptPath) {
|
|
379
|
+
const parsed = readHookPayload(stdinRaw);
|
|
380
|
+
transcriptPath = parsed.ok ? parsed.payload.transcript_path : null;
|
|
381
|
+
}
|
|
382
|
+
return runReport(args.projectRoot, transcriptPath);
|
|
383
|
+
}
|
|
384
|
+
// hook 模式:stdin payload 必需
|
|
385
|
+
const parsed = readHookPayload(stdinRaw);
|
|
386
|
+
if (!parsed.ok) {
|
|
387
|
+
// payload 非法 → FR-013 fail-open 放行 + loud 诊断落盘(off 档除外,维持零接触)
|
|
388
|
+
const cfg = findAndParseConfig(args.projectRoot);
|
|
389
|
+
if (cfg.enforcement !== 'off') {
|
|
390
|
+
tryAppendFailOpenEvent(args.projectRoot, null, cfg.enforcement, ['payload-invalid'], cfg.diagnostics);
|
|
391
|
+
}
|
|
392
|
+
return 0;
|
|
393
|
+
}
|
|
394
|
+
return runHook(args.projectRoot, parsed.payload);
|
|
395
|
+
} catch {
|
|
396
|
+
// 任何未预期异常 → fail-open 放行(FR-013)+ best-effort loud 诊断(自身再失败则彻底静默放行)
|
|
397
|
+
try {
|
|
398
|
+
const cfg = findAndParseConfig(args.projectRoot);
|
|
399
|
+
if (cfg.enforcement !== 'off') {
|
|
400
|
+
tryAppendFailOpenEvent(args.projectRoot, null, cfg.enforcement, ['internal-error'], cfg.diagnostics);
|
|
401
|
+
}
|
|
402
|
+
} catch {
|
|
403
|
+
// 连诊断都写不了 → 仍然放行
|
|
404
|
+
}
|
|
405
|
+
return 0;
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
|
|
409
|
+
// 仅作为入口脚本直接运行时执行(被 import 时不触发,便于单测)
|
|
410
|
+
if (process.argv[1] && fileURLToPath(import.meta.url) === realpathSync(process.argv[1])) {
|
|
411
|
+
const argv = process.argv.slice(2);
|
|
412
|
+
const stdinRaw = readStdinSync();
|
|
413
|
+
const code = main(argv, stdinRaw);
|
|
414
|
+
process.exit(code);
|
|
415
|
+
}
|