openlore 2.0.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/LICENSE +21 -0
- package/README.md +268 -0
- package/dist/api/analyze.d.ts +17 -0
- package/dist/api/analyze.d.ts.map +1 -0
- package/dist/api/analyze.js +143 -0
- package/dist/api/analyze.js.map +1 -0
- package/dist/api/audit.d.ts +10 -0
- package/dist/api/audit.d.ts.map +1 -0
- package/dist/api/audit.js +117 -0
- package/dist/api/audit.js.map +1 -0
- package/dist/api/decisions.d.ts +55 -0
- package/dist/api/decisions.d.ts.map +1 -0
- package/dist/api/decisions.js +157 -0
- package/dist/api/decisions.js.map +1 -0
- package/dist/api/drift.d.ts +21 -0
- package/dist/api/drift.d.ts.map +1 -0
- package/dist/api/drift.js +152 -0
- package/dist/api/drift.js.map +1 -0
- package/dist/api/generate.d.ts +18 -0
- package/dist/api/generate.d.ts.map +1 -0
- package/dist/api/generate.js +259 -0
- package/dist/api/generate.js.map +1 -0
- package/dist/api/index.d.ts +41 -0
- package/dist/api/index.d.ts.map +1 -0
- package/dist/api/index.js +34 -0
- package/dist/api/index.js.map +1 -0
- package/dist/api/init.d.ts +18 -0
- package/dist/api/init.d.ts.map +1 -0
- package/dist/api/init.js +83 -0
- package/dist/api/init.js.map +1 -0
- package/dist/api/run.d.ts +19 -0
- package/dist/api/run.d.ts.map +1 -0
- package/dist/api/run.js +312 -0
- package/dist/api/run.js.map +1 -0
- package/dist/api/specs.d.ts +49 -0
- package/dist/api/specs.d.ts.map +1 -0
- package/dist/api/specs.js +137 -0
- package/dist/api/specs.js.map +1 -0
- package/dist/api/types.d.ts +201 -0
- package/dist/api/types.d.ts.map +1 -0
- package/dist/api/types.js +9 -0
- package/dist/api/types.js.map +1 -0
- package/dist/api/verify.d.ts +20 -0
- package/dist/api/verify.d.ts.map +1 -0
- package/dist/api/verify.js +117 -0
- package/dist/api/verify.js.map +1 -0
- package/dist/cli/commands/analyze.d.ts +30 -0
- package/dist/cli/commands/analyze.d.ts.map +1 -0
- package/dist/cli/commands/analyze.js +683 -0
- package/dist/cli/commands/analyze.js.map +1 -0
- package/dist/cli/commands/audit.d.ts +9 -0
- package/dist/cli/commands/audit.d.ts.map +1 -0
- package/dist/cli/commands/audit.js +98 -0
- package/dist/cli/commands/audit.js.map +1 -0
- package/dist/cli/commands/decisions.d.ts +16 -0
- package/dist/cli/commands/decisions.d.ts.map +1 -0
- package/dist/cli/commands/decisions.js +864 -0
- package/dist/cli/commands/decisions.js.map +1 -0
- package/dist/cli/commands/digest.d.ts +9 -0
- package/dist/cli/commands/digest.d.ts.map +1 -0
- package/dist/cli/commands/digest.js +61 -0
- package/dist/cli/commands/digest.js.map +1 -0
- package/dist/cli/commands/doctor.d.ts +9 -0
- package/dist/cli/commands/doctor.d.ts.map +1 -0
- package/dist/cli/commands/doctor.js +398 -0
- package/dist/cli/commands/doctor.js.map +1 -0
- package/dist/cli/commands/drift.d.ts +9 -0
- package/dist/cli/commands/drift.d.ts.map +1 -0
- package/dist/cli/commands/drift.js +550 -0
- package/dist/cli/commands/drift.js.map +1 -0
- package/dist/cli/commands/generate.d.ts +9 -0
- package/dist/cli/commands/generate.d.ts.map +1 -0
- package/dist/cli/commands/generate.js +565 -0
- package/dist/cli/commands/generate.js.map +1 -0
- package/dist/cli/commands/init.d.ts +9 -0
- package/dist/cli/commands/init.d.ts.map +1 -0
- package/dist/cli/commands/init.js +173 -0
- package/dist/cli/commands/init.js.map +1 -0
- package/dist/cli/commands/mcp.d.ts +2235 -0
- package/dist/cli/commands/mcp.d.ts.map +1 -0
- package/dist/cli/commands/mcp.js +1384 -0
- package/dist/cli/commands/mcp.js.map +1 -0
- package/dist/cli/commands/refresh-stories.d.ts +10 -0
- package/dist/cli/commands/refresh-stories.d.ts.map +1 -0
- package/dist/cli/commands/refresh-stories.js +314 -0
- package/dist/cli/commands/refresh-stories.js.map +1 -0
- package/dist/cli/commands/run.d.ts +9 -0
- package/dist/cli/commands/run.d.ts.map +1 -0
- package/dist/cli/commands/run.js +459 -0
- package/dist/cli/commands/run.js.map +1 -0
- package/dist/cli/commands/setup.d.ts +19 -0
- package/dist/cli/commands/setup.d.ts.map +1 -0
- package/dist/cli/commands/setup.js +355 -0
- package/dist/cli/commands/setup.js.map +1 -0
- package/dist/cli/commands/test.d.ts +22 -0
- package/dist/cli/commands/test.d.ts.map +1 -0
- package/dist/cli/commands/test.js +180 -0
- package/dist/cli/commands/test.js.map +1 -0
- package/dist/cli/commands/verify.d.ts +9 -0
- package/dist/cli/commands/verify.d.ts.map +1 -0
- package/dist/cli/commands/verify.js +383 -0
- package/dist/cli/commands/verify.js.map +1 -0
- package/dist/cli/commands/view.d.ts +13 -0
- package/dist/cli/commands/view.d.ts.map +1 -0
- package/dist/cli/commands/view.js +547 -0
- package/dist/cli/commands/view.js.map +1 -0
- package/dist/cli/index.d.ts +9 -0
- package/dist/cli/index.d.ts.map +1 -0
- package/dist/cli/index.js +118 -0
- package/dist/cli/index.js.map +1 -0
- package/dist/cli/tui-approval.d.ts +11 -0
- package/dist/cli/tui-approval.d.ts.map +1 -0
- package/dist/cli/tui-approval.js +129 -0
- package/dist/cli/tui-approval.js.map +1 -0
- package/dist/constants.d.ts +314 -0
- package/dist/constants.d.ts.map +1 -0
- package/dist/constants.js +382 -0
- package/dist/constants.js.map +1 -0
- package/dist/core/analyzer/ai-config-generator.d.ts +54 -0
- package/dist/core/analyzer/ai-config-generator.d.ts.map +1 -0
- package/dist/core/analyzer/ai-config-generator.js +98 -0
- package/dist/core/analyzer/ai-config-generator.js.map +1 -0
- package/dist/core/analyzer/architecture-writer.d.ts +67 -0
- package/dist/core/analyzer/architecture-writer.d.ts.map +1 -0
- package/dist/core/analyzer/architecture-writer.js +209 -0
- package/dist/core/analyzer/architecture-writer.js.map +1 -0
- package/dist/core/analyzer/artifact-generator.d.ts +261 -0
- package/dist/core/analyzer/artifact-generator.d.ts.map +1 -0
- package/dist/core/analyzer/artifact-generator.js +909 -0
- package/dist/core/analyzer/artifact-generator.js.map +1 -0
- package/dist/core/analyzer/ast-chunker.d.ts +24 -0
- package/dist/core/analyzer/ast-chunker.d.ts.map +1 -0
- package/dist/core/analyzer/ast-chunker.js +198 -0
- package/dist/core/analyzer/ast-chunker.js.map +1 -0
- package/dist/core/analyzer/call-graph.d.ts +162 -0
- package/dist/core/analyzer/call-graph.d.ts.map +1 -0
- package/dist/core/analyzer/call-graph.js +2040 -0
- package/dist/core/analyzer/call-graph.js.map +1 -0
- package/dist/core/analyzer/code-shaper.d.ts +33 -0
- package/dist/core/analyzer/code-shaper.d.ts.map +1 -0
- package/dist/core/analyzer/code-shaper.js +154 -0
- package/dist/core/analyzer/code-shaper.js.map +1 -0
- package/dist/core/analyzer/codebase-digest.d.ts +40 -0
- package/dist/core/analyzer/codebase-digest.d.ts.map +1 -0
- package/dist/core/analyzer/codebase-digest.js +195 -0
- package/dist/core/analyzer/codebase-digest.js.map +1 -0
- package/dist/core/analyzer/cpp-header-resolver.d.ts +30 -0
- package/dist/core/analyzer/cpp-header-resolver.d.ts.map +1 -0
- package/dist/core/analyzer/cpp-header-resolver.js +71 -0
- package/dist/core/analyzer/cpp-header-resolver.js.map +1 -0
- package/dist/core/analyzer/dependency-graph.d.ts +230 -0
- package/dist/core/analyzer/dependency-graph.d.ts.map +1 -0
- package/dist/core/analyzer/dependency-graph.js +752 -0
- package/dist/core/analyzer/dependency-graph.js.map +1 -0
- package/dist/core/analyzer/duplicate-detector.d.ts +52 -0
- package/dist/core/analyzer/duplicate-detector.d.ts.map +1 -0
- package/dist/core/analyzer/duplicate-detector.js +289 -0
- package/dist/core/analyzer/duplicate-detector.js.map +1 -0
- package/dist/core/analyzer/embedding-service.d.ts +56 -0
- package/dist/core/analyzer/embedding-service.d.ts.map +1 -0
- package/dist/core/analyzer/embedding-service.js +118 -0
- package/dist/core/analyzer/embedding-service.js.map +1 -0
- package/dist/core/analyzer/env-extractor.d.ts +33 -0
- package/dist/core/analyzer/env-extractor.d.ts.map +1 -0
- package/dist/core/analyzer/env-extractor.js +196 -0
- package/dist/core/analyzer/env-extractor.js.map +1 -0
- package/dist/core/analyzer/external-packages.d.ts +20 -0
- package/dist/core/analyzer/external-packages.d.ts.map +1 -0
- package/dist/core/analyzer/external-packages.js +175 -0
- package/dist/core/analyzer/external-packages.js.map +1 -0
- package/dist/core/analyzer/file-walker.d.ts +78 -0
- package/dist/core/analyzer/file-walker.d.ts.map +1 -0
- package/dist/core/analyzer/file-walker.js +532 -0
- package/dist/core/analyzer/file-walker.js.map +1 -0
- package/dist/core/analyzer/function-registry-trie.d.ts +21 -0
- package/dist/core/analyzer/function-registry-trie.d.ts.map +1 -0
- package/dist/core/analyzer/function-registry-trie.js +39 -0
- package/dist/core/analyzer/function-registry-trie.js.map +1 -0
- package/dist/core/analyzer/http-route-parser.d.ts +152 -0
- package/dist/core/analyzer/http-route-parser.d.ts.map +1 -0
- package/dist/core/analyzer/http-route-parser.js +971 -0
- package/dist/core/analyzer/http-route-parser.js.map +1 -0
- package/dist/core/analyzer/import-parser.d.ts +100 -0
- package/dist/core/analyzer/import-parser.d.ts.map +1 -0
- package/dist/core/analyzer/import-parser.js +952 -0
- package/dist/core/analyzer/import-parser.js.map +1 -0
- package/dist/core/analyzer/import-resolver-bridge.d.ts +25 -0
- package/dist/core/analyzer/import-resolver-bridge.d.ts.map +1 -0
- package/dist/core/analyzer/import-resolver-bridge.js +99 -0
- package/dist/core/analyzer/import-resolver-bridge.js.map +1 -0
- package/dist/core/analyzer/index.d.ts +10 -0
- package/dist/core/analyzer/index.d.ts.map +1 -0
- package/dist/core/analyzer/index.js +10 -0
- package/dist/core/analyzer/index.js.map +1 -0
- package/dist/core/analyzer/middleware-extractor.d.ts +29 -0
- package/dist/core/analyzer/middleware-extractor.d.ts.map +1 -0
- package/dist/core/analyzer/middleware-extractor.js +195 -0
- package/dist/core/analyzer/middleware-extractor.js.map +1 -0
- package/dist/core/analyzer/refactor-analyzer.d.ts +83 -0
- package/dist/core/analyzer/refactor-analyzer.d.ts.map +1 -0
- package/dist/core/analyzer/refactor-analyzer.js +351 -0
- package/dist/core/analyzer/refactor-analyzer.js.map +1 -0
- package/dist/core/analyzer/repository-mapper.d.ts +150 -0
- package/dist/core/analyzer/repository-mapper.d.ts.map +1 -0
- package/dist/core/analyzer/repository-mapper.js +740 -0
- package/dist/core/analyzer/repository-mapper.js.map +1 -0
- package/dist/core/analyzer/schema-extractor.d.ts +41 -0
- package/dist/core/analyzer/schema-extractor.d.ts.map +1 -0
- package/dist/core/analyzer/schema-extractor.js +229 -0
- package/dist/core/analyzer/schema-extractor.js.map +1 -0
- package/dist/core/analyzer/signature-extractor.d.ts +31 -0
- package/dist/core/analyzer/signature-extractor.d.ts.map +1 -0
- package/dist/core/analyzer/signature-extractor.js +675 -0
- package/dist/core/analyzer/signature-extractor.js.map +1 -0
- package/dist/core/analyzer/significance-scorer.d.ts +79 -0
- package/dist/core/analyzer/significance-scorer.d.ts.map +1 -0
- package/dist/core/analyzer/significance-scorer.js +407 -0
- package/dist/core/analyzer/significance-scorer.js.map +1 -0
- package/dist/core/analyzer/spec-snapshot-generator.d.ts +17 -0
- package/dist/core/analyzer/spec-snapshot-generator.d.ts.map +1 -0
- package/dist/core/analyzer/spec-snapshot-generator.js +201 -0
- package/dist/core/analyzer/spec-snapshot-generator.js.map +1 -0
- package/dist/core/analyzer/spec-vector-index.d.ts +68 -0
- package/dist/core/analyzer/spec-vector-index.d.ts.map +1 -0
- package/dist/core/analyzer/spec-vector-index.js +340 -0
- package/dist/core/analyzer/spec-vector-index.js.map +1 -0
- package/dist/core/analyzer/subgraph-extractor.d.ts +51 -0
- package/dist/core/analyzer/subgraph-extractor.d.ts.map +1 -0
- package/dist/core/analyzer/subgraph-extractor.js +147 -0
- package/dist/core/analyzer/subgraph-extractor.js.map +1 -0
- package/dist/core/analyzer/type-inference-engine.d.ts +23 -0
- package/dist/core/analyzer/type-inference-engine.d.ts.map +1 -0
- package/dist/core/analyzer/type-inference-engine.js +130 -0
- package/dist/core/analyzer/type-inference-engine.js.map +1 -0
- package/dist/core/analyzer/ui-component-extractor.d.ts +43 -0
- package/dist/core/analyzer/ui-component-extractor.d.ts.map +1 -0
- package/dist/core/analyzer/ui-component-extractor.js +245 -0
- package/dist/core/analyzer/ui-component-extractor.js.map +1 -0
- package/dist/core/analyzer/unified-search.d.ts +116 -0
- package/dist/core/analyzer/unified-search.d.ts.map +1 -0
- package/dist/core/analyzer/unified-search.js +231 -0
- package/dist/core/analyzer/unified-search.js.map +1 -0
- package/dist/core/analyzer/vector-index.d.ts +92 -0
- package/dist/core/analyzer/vector-index.d.ts.map +1 -0
- package/dist/core/analyzer/vector-index.js +451 -0
- package/dist/core/analyzer/vector-index.js.map +1 -0
- package/dist/core/decisions/consolidator.d.ts +14 -0
- package/dist/core/decisions/consolidator.d.ts.map +1 -0
- package/dist/core/decisions/consolidator.js +169 -0
- package/dist/core/decisions/consolidator.js.map +1 -0
- package/dist/core/decisions/extractor.d.ts +26 -0
- package/dist/core/decisions/extractor.d.ts.map +1 -0
- package/dist/core/decisions/extractor.js +156 -0
- package/dist/core/decisions/extractor.js.map +1 -0
- package/dist/core/decisions/index.d.ts +19 -0
- package/dist/core/decisions/index.d.ts.map +1 -0
- package/dist/core/decisions/index.js +16 -0
- package/dist/core/decisions/index.js.map +1 -0
- package/dist/core/decisions/store.d.ts +36 -0
- package/dist/core/decisions/store.d.ts.map +1 -0
- package/dist/core/decisions/store.js +109 -0
- package/dist/core/decisions/store.js.map +1 -0
- package/dist/core/decisions/syncer.d.ts +27 -0
- package/dist/core/decisions/syncer.d.ts.map +1 -0
- package/dist/core/decisions/syncer.js +214 -0
- package/dist/core/decisions/syncer.js.map +1 -0
- package/dist/core/decisions/verifier.d.ts +20 -0
- package/dist/core/decisions/verifier.d.ts.map +1 -0
- package/dist/core/decisions/verifier.js +115 -0
- package/dist/core/decisions/verifier.js.map +1 -0
- package/dist/core/digest/digest-generator.d.ts +29 -0
- package/dist/core/digest/digest-generator.d.ts.map +1 -0
- package/dist/core/digest/digest-generator.js +181 -0
- package/dist/core/digest/digest-generator.js.map +1 -0
- package/dist/core/drift/drift-detector.d.ts +102 -0
- package/dist/core/drift/drift-detector.d.ts.map +1 -0
- package/dist/core/drift/drift-detector.js +598 -0
- package/dist/core/drift/drift-detector.js.map +1 -0
- package/dist/core/drift/git-diff.d.ts +60 -0
- package/dist/core/drift/git-diff.d.ts.map +1 -0
- package/dist/core/drift/git-diff.js +383 -0
- package/dist/core/drift/git-diff.js.map +1 -0
- package/dist/core/drift/index.d.ts +12 -0
- package/dist/core/drift/index.d.ts.map +1 -0
- package/dist/core/drift/index.js +9 -0
- package/dist/core/drift/index.js.map +1 -0
- package/dist/core/drift/spec-mapper.d.ts +73 -0
- package/dist/core/drift/spec-mapper.d.ts.map +1 -0
- package/dist/core/drift/spec-mapper.js +353 -0
- package/dist/core/drift/spec-mapper.js.map +1 -0
- package/dist/core/drift/test-suggester.d.ts +18 -0
- package/dist/core/drift/test-suggester.d.ts.map +1 -0
- package/dist/core/drift/test-suggester.js +107 -0
- package/dist/core/drift/test-suggester.js.map +1 -0
- package/dist/core/generator/adr-generator.d.ts +32 -0
- package/dist/core/generator/adr-generator.d.ts.map +1 -0
- package/dist/core/generator/adr-generator.js +192 -0
- package/dist/core/generator/adr-generator.js.map +1 -0
- package/dist/core/generator/index.d.ts +9 -0
- package/dist/core/generator/index.d.ts.map +1 -0
- package/dist/core/generator/index.js +12 -0
- package/dist/core/generator/index.js.map +1 -0
- package/dist/core/generator/mapping-generator.d.ts +54 -0
- package/dist/core/generator/mapping-generator.d.ts.map +1 -0
- package/dist/core/generator/mapping-generator.js +240 -0
- package/dist/core/generator/mapping-generator.js.map +1 -0
- package/dist/core/generator/openspec-compat.d.ts +160 -0
- package/dist/core/generator/openspec-compat.d.ts.map +1 -0
- package/dist/core/generator/openspec-compat.js +524 -0
- package/dist/core/generator/openspec-compat.js.map +1 -0
- package/dist/core/generator/openspec-format-generator.d.ts +131 -0
- package/dist/core/generator/openspec-format-generator.d.ts.map +1 -0
- package/dist/core/generator/openspec-format-generator.js +963 -0
- package/dist/core/generator/openspec-format-generator.js.map +1 -0
- package/dist/core/generator/openspec-writer.d.ts +130 -0
- package/dist/core/generator/openspec-writer.d.ts.map +1 -0
- package/dist/core/generator/openspec-writer.js +404 -0
- package/dist/core/generator/openspec-writer.js.map +1 -0
- package/dist/core/generator/prompts.d.ts +35 -0
- package/dist/core/generator/prompts.d.ts.map +1 -0
- package/dist/core/generator/prompts.js +212 -0
- package/dist/core/generator/prompts.js.map +1 -0
- package/dist/core/generator/rag-manifest-generator.d.ts +37 -0
- package/dist/core/generator/rag-manifest-generator.d.ts.map +1 -0
- package/dist/core/generator/rag-manifest-generator.js +134 -0
- package/dist/core/generator/rag-manifest-generator.js.map +1 -0
- package/dist/core/generator/schemas.d.ts +365 -0
- package/dist/core/generator/schemas.d.ts.map +1 -0
- package/dist/core/generator/schemas.js +190 -0
- package/dist/core/generator/schemas.js.map +1 -0
- package/dist/core/generator/spec-pipeline.d.ts +123 -0
- package/dist/core/generator/spec-pipeline.d.ts.map +1 -0
- package/dist/core/generator/spec-pipeline.js +699 -0
- package/dist/core/generator/spec-pipeline.js.map +1 -0
- package/dist/core/generator/stages/stage1-survey.d.ts +19 -0
- package/dist/core/generator/stages/stage1-survey.d.ts.map +1 -0
- package/dist/core/generator/stages/stage1-survey.js +171 -0
- package/dist/core/generator/stages/stage1-survey.js.map +1 -0
- package/dist/core/generator/stages/stage2-entities.d.ts +11 -0
- package/dist/core/generator/stages/stage2-entities.d.ts.map +1 -0
- package/dist/core/generator/stages/stage2-entities.js +74 -0
- package/dist/core/generator/stages/stage2-entities.js.map +1 -0
- package/dist/core/generator/stages/stage3-services.d.ts +11 -0
- package/dist/core/generator/stages/stage3-services.d.ts.map +1 -0
- package/dist/core/generator/stages/stage3-services.js +85 -0
- package/dist/core/generator/stages/stage3-services.js.map +1 -0
- package/dist/core/generator/stages/stage4-api.d.ts +11 -0
- package/dist/core/generator/stages/stage4-api.d.ts.map +1 -0
- package/dist/core/generator/stages/stage4-api.js +72 -0
- package/dist/core/generator/stages/stage4-api.js.map +1 -0
- package/dist/core/generator/stages/stage5-architecture.d.ts +11 -0
- package/dist/core/generator/stages/stage5-architecture.d.ts.map +1 -0
- package/dist/core/generator/stages/stage5-architecture.js +75 -0
- package/dist/core/generator/stages/stage5-architecture.js.map +1 -0
- package/dist/core/generator/stages/stage6-adr.d.ts +8 -0
- package/dist/core/generator/stages/stage6-adr.d.ts.map +1 -0
- package/dist/core/generator/stages/stage6-adr.js +47 -0
- package/dist/core/generator/stages/stage6-adr.js.map +1 -0
- package/dist/core/services/chat-agent.d.ts +50 -0
- package/dist/core/services/chat-agent.d.ts.map +1 -0
- package/dist/core/services/chat-agent.js +369 -0
- package/dist/core/services/chat-agent.js.map +1 -0
- package/dist/core/services/chat-tools.d.ts +32 -0
- package/dist/core/services/chat-tools.d.ts.map +1 -0
- package/dist/core/services/chat-tools.js +494 -0
- package/dist/core/services/chat-tools.js.map +1 -0
- package/dist/core/services/config-manager.d.ts +61 -0
- package/dist/core/services/config-manager.d.ts.map +1 -0
- package/dist/core/services/config-manager.js +149 -0
- package/dist/core/services/config-manager.js.map +1 -0
- package/dist/core/services/edge-store.d.ts +57 -0
- package/dist/core/services/edge-store.d.ts.map +1 -0
- package/dist/core/services/edge-store.js +419 -0
- package/dist/core/services/edge-store.js.map +1 -0
- package/dist/core/services/gitignore-manager.d.ts +29 -0
- package/dist/core/services/gitignore-manager.d.ts.map +1 -0
- package/dist/core/services/gitignore-manager.js +95 -0
- package/dist/core/services/gitignore-manager.js.map +1 -0
- package/dist/core/services/index.d.ts +8 -0
- package/dist/core/services/index.d.ts.map +1 -0
- package/dist/core/services/index.js +8 -0
- package/dist/core/services/index.js.map +1 -0
- package/dist/core/services/llm-service.d.ts +379 -0
- package/dist/core/services/llm-service.d.ts.map +1 -0
- package/dist/core/services/llm-service.js +1553 -0
- package/dist/core/services/llm-service.js.map +1 -0
- package/dist/core/services/mcp-handlers/analysis.d.ts +127 -0
- package/dist/core/services/mcp-handlers/analysis.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/analysis.js +1185 -0
- package/dist/core/services/mcp-handlers/analysis.js.map +1 -0
- package/dist/core/services/mcp-handlers/change.d.ts +14 -0
- package/dist/core/services/mcp-handlers/change.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/change.js +416 -0
- package/dist/core/services/mcp-handlers/change.js.map +1 -0
- package/dist/core/services/mcp-handlers/decisions.d.ts +16 -0
- package/dist/core/services/mcp-handlers/decisions.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/decisions.js +239 -0
- package/dist/core/services/mcp-handlers/decisions.js.map +1 -0
- package/dist/core/services/mcp-handlers/graph.d.ts +94 -0
- package/dist/core/services/mcp-handlers/graph.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/graph.js +693 -0
- package/dist/core/services/mcp-handlers/graph.js.map +1 -0
- package/dist/core/services/mcp-handlers/orient.d.ts +17 -0
- package/dist/core/services/mcp-handlers/orient.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/orient.js +357 -0
- package/dist/core/services/mcp-handlers/orient.js.map +1 -0
- package/dist/core/services/mcp-handlers/semantic.d.ts +66 -0
- package/dist/core/services/mcp-handlers/semantic.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/semantic.js +432 -0
- package/dist/core/services/mcp-handlers/semantic.js.map +1 -0
- package/dist/core/services/mcp-handlers/utils.d.ts +85 -0
- package/dist/core/services/mcp-handlers/utils.d.ts.map +1 -0
- package/dist/core/services/mcp-handlers/utils.js +262 -0
- package/dist/core/services/mcp-handlers/utils.js.map +1 -0
- package/dist/core/services/mcp-watcher.d.ts +41 -0
- package/dist/core/services/mcp-watcher.d.ts.map +1 -0
- package/dist/core/services/mcp-watcher.js +254 -0
- package/dist/core/services/mcp-watcher.js.map +1 -0
- package/dist/core/services/project-detector.d.ts +32 -0
- package/dist/core/services/project-detector.d.ts.map +1 -0
- package/dist/core/services/project-detector.js +100 -0
- package/dist/core/services/project-detector.js.map +1 -0
- package/dist/core/test-generator/coverage-analyzer.d.ts +27 -0
- package/dist/core/test-generator/coverage-analyzer.d.ts.map +1 -0
- package/dist/core/test-generator/coverage-analyzer.js +285 -0
- package/dist/core/test-generator/coverage-analyzer.js.map +1 -0
- package/dist/core/test-generator/framework-detector.d.ts +17 -0
- package/dist/core/test-generator/framework-detector.d.ts.map +1 -0
- package/dist/core/test-generator/framework-detector.js +65 -0
- package/dist/core/test-generator/framework-detector.js.map +1 -0
- package/dist/core/test-generator/index.d.ts +14 -0
- package/dist/core/test-generator/index.d.ts.map +1 -0
- package/dist/core/test-generator/index.js +11 -0
- package/dist/core/test-generator/index.js.map +1 -0
- package/dist/core/test-generator/renderers/catch2.d.ts +8 -0
- package/dist/core/test-generator/renderers/catch2.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/catch2.js +47 -0
- package/dist/core/test-generator/renderers/catch2.js.map +1 -0
- package/dist/core/test-generator/renderers/gtest.d.ts +8 -0
- package/dist/core/test-generator/renderers/gtest.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/gtest.js +45 -0
- package/dist/core/test-generator/renderers/gtest.js.map +1 -0
- package/dist/core/test-generator/renderers/index.d.ts +20 -0
- package/dist/core/test-generator/renderers/index.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/index.js +35 -0
- package/dist/core/test-generator/renderers/index.js.map +1 -0
- package/dist/core/test-generator/renderers/playwright.d.ts +8 -0
- package/dist/core/test-generator/renderers/playwright.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/playwright.js +44 -0
- package/dist/core/test-generator/renderers/playwright.js.map +1 -0
- package/dist/core/test-generator/renderers/pytest.d.ts +8 -0
- package/dist/core/test-generator/renderers/pytest.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/pytest.js +44 -0
- package/dist/core/test-generator/renderers/pytest.js.map +1 -0
- package/dist/core/test-generator/renderers/shared.d.ts +21 -0
- package/dist/core/test-generator/renderers/shared.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/shared.js +56 -0
- package/dist/core/test-generator/renderers/shared.js.map +1 -0
- package/dist/core/test-generator/renderers/vitest.d.ts +8 -0
- package/dist/core/test-generator/renderers/vitest.d.ts.map +1 -0
- package/dist/core/test-generator/renderers/vitest.js +52 -0
- package/dist/core/test-generator/renderers/vitest.js.map +1 -0
- package/dist/core/test-generator/scenario-parser.d.ts +33 -0
- package/dist/core/test-generator/scenario-parser.d.ts.map +1 -0
- package/dist/core/test-generator/scenario-parser.js +244 -0
- package/dist/core/test-generator/scenario-parser.js.map +1 -0
- package/dist/core/test-generator/test-generator.d.ts +30 -0
- package/dist/core/test-generator/test-generator.d.ts.map +1 -0
- package/dist/core/test-generator/test-generator.js +174 -0
- package/dist/core/test-generator/test-generator.js.map +1 -0
- package/dist/core/test-generator/test-writer.d.ts +25 -0
- package/dist/core/test-generator/test-writer.d.ts.map +1 -0
- package/dist/core/test-generator/test-writer.js +128 -0
- package/dist/core/test-generator/test-writer.js.map +1 -0
- package/dist/core/test-generator/then-matchers.d.ts +35 -0
- package/dist/core/test-generator/then-matchers.d.ts.map +1 -0
- package/dist/core/test-generator/then-matchers.js +211 -0
- package/dist/core/test-generator/then-matchers.js.map +1 -0
- package/dist/core/verifier/index.d.ts +5 -0
- package/dist/core/verifier/index.d.ts.map +1 -0
- package/dist/core/verifier/index.js +5 -0
- package/dist/core/verifier/index.js.map +1 -0
- package/dist/core/verifier/verification-engine.d.ts +293 -0
- package/dist/core/verifier/verification-engine.d.ts.map +1 -0
- package/dist/core/verifier/verification-engine.js +919 -0
- package/dist/core/verifier/verification-engine.js.map +1 -0
- package/dist/types/index.d.ts +368 -0
- package/dist/types/index.d.ts.map +1 -0
- package/dist/types/index.js +5 -0
- package/dist/types/index.js.map +1 -0
- package/dist/types/pipeline.d.ts +167 -0
- package/dist/types/pipeline.d.ts.map +1 -0
- package/dist/types/pipeline.js +5 -0
- package/dist/types/pipeline.js.map +1 -0
- package/dist/types/test-generator.d.ts +103 -0
- package/dist/types/test-generator.d.ts.map +1 -0
- package/dist/types/test-generator.js +17 -0
- package/dist/types/test-generator.js.map +1 -0
- package/dist/utils/command-helpers.d.ts +68 -0
- package/dist/utils/command-helpers.d.ts.map +1 -0
- package/dist/utils/command-helpers.js +150 -0
- package/dist/utils/command-helpers.js.map +1 -0
- package/dist/utils/errors.d.ts +51 -0
- package/dist/utils/errors.d.ts.map +1 -0
- package/dist/utils/errors.js +129 -0
- package/dist/utils/errors.js.map +1 -0
- package/dist/utils/logger.d.ts +149 -0
- package/dist/utils/logger.d.ts.map +1 -0
- package/dist/utils/logger.js +342 -0
- package/dist/utils/logger.js.map +1 -0
- package/dist/utils/misc.d.ts +10 -0
- package/dist/utils/misc.d.ts.map +1 -0
- package/dist/utils/misc.js +21 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/progress.d.ts +142 -0
- package/dist/utils/progress.d.ts.map +1 -0
- package/dist/utils/progress.js +283 -0
- package/dist/utils/progress.js.map +1 -0
- package/dist/utils/prompts.d.ts +53 -0
- package/dist/utils/prompts.d.ts.map +1 -0
- package/dist/utils/prompts.js +199 -0
- package/dist/utils/prompts.js.map +1 -0
- package/dist/utils/shutdown.d.ts +89 -0
- package/dist/utils/shutdown.d.ts.map +1 -0
- package/dist/utils/shutdown.js +238 -0
- package/dist/utils/shutdown.js.map +1 -0
- package/examples/bmad/README.md +113 -0
- package/examples/bmad/agents/architect.md +226 -0
- package/examples/bmad/agents/dev-brownfield.md +69 -0
- package/examples/bmad/setup/architect.customize.yaml +14 -0
- package/examples/bmad/tasks/implement-story.md +254 -0
- package/examples/bmad/tasks/onboarding.md +169 -0
- package/examples/bmad/tasks/refactor.md +178 -0
- package/examples/bmad/tasks/sprint-planning.md +168 -0
- package/examples/bmad/templates/story.md +108 -0
- package/examples/cline-workflows/openlore-analyze-codebase.md +101 -0
- package/examples/cline-workflows/openlore-check-spec-drift.md +102 -0
- package/examples/cline-workflows/openlore-execute-refactor.md +212 -0
- package/examples/cline-workflows/openlore-implement-feature.md +266 -0
- package/examples/cline-workflows/openlore-plan-refactor.md +279 -0
- package/examples/cline-workflows/openlore-refactor-codebase.md +16 -0
- package/examples/cline-workflows/openlore-write-tests.md +177 -0
- package/examples/drift-demo/openspec/config.yaml +14 -0
- package/examples/drift-demo/openspec/specs/architecture/spec.md +30 -0
- package/examples/drift-demo/openspec/specs/auth/spec.md +71 -0
- package/examples/drift-demo/openspec/specs/database/spec.md +33 -0
- package/examples/drift-demo/openspec/specs/overview/spec.md +20 -0
- package/examples/drift-demo/openspec/specs/projects/spec.md +55 -0
- package/examples/drift-demo/openspec/specs/tasks/spec.md +78 -0
- package/examples/drift-demo/package.json +21 -0
- package/examples/drift-demo/src/auth/auth-middleware.ts +30 -0
- package/examples/drift-demo/src/auth/auth-routes.ts +29 -0
- package/examples/drift-demo/src/auth/auth-service.ts +45 -0
- package/examples/drift-demo/src/database/connection.ts +27 -0
- package/examples/drift-demo/src/index.ts +16 -0
- package/examples/drift-demo/src/projects/project-model.ts +15 -0
- package/examples/drift-demo/src/projects/project-service.ts +34 -0
- package/examples/drift-demo/src/tasks/task-model.ts +37 -0
- package/examples/drift-demo/src/tasks/task-routes.ts +53 -0
- package/examples/drift-demo/src/tasks/task-service.ts +60 -0
- package/examples/drift-demo/src/utils/validation.ts +11 -0
- package/examples/drift-demo/tests/auth.test.ts +4 -0
- package/examples/drift-demo/tests/tasks.test.ts +4 -0
- package/examples/drift-demo/tsconfig.json +10 -0
- package/examples/drift-test/run-drift-test.sh +1087 -0
- package/examples/gsd/README.md +119 -0
- package/examples/gsd/commands/gsd/openlore-drift.md +111 -0
- package/examples/gsd/commands/gsd/openlore-orient.md +191 -0
- package/examples/mistral-vibe/README.md +101 -0
- package/examples/mistral-vibe/antipatterns-template.md +18 -0
- package/examples/mistral-vibe/skills/openlore-analyze-codebase/SKILL.md +124 -0
- package/examples/mistral-vibe/skills/openlore-brainstorm/SKILL.md +379 -0
- package/examples/mistral-vibe/skills/openlore-debug/SKILL.md +330 -0
- package/examples/mistral-vibe/skills/openlore-execute-refactor/SKILL.md +291 -0
- package/examples/mistral-vibe/skills/openlore-generate/SKILL.md +245 -0
- package/examples/mistral-vibe/skills/openlore-implement-story/SKILL.md +326 -0
- package/examples/mistral-vibe/skills/openlore-plan-refactor/SKILL.md +365 -0
- package/examples/mistral-vibe/skills/openlore-review-changes/SKILL.md +128 -0
- package/examples/mistral-vibe/skills/openlore-write-tests/SKILL.md +261 -0
- package/examples/opencode/agent-guard.ts +170 -0
- package/examples/opencode/plugins/anti-laziness.ts +202 -0
- package/examples/opencode/plugins/lib/openlore-context-injector-helpers.ts +116 -0
- package/examples/opencode/plugins/lib/openlore-decision-extractor-helpers.ts +65 -0
- package/examples/opencode/plugins/openlore-context-injector.test.ts +211 -0
- package/examples/opencode/plugins/openlore-context-injector.ts +165 -0
- package/examples/opencode/plugins/openlore-decision-extractor.test.ts +131 -0
- package/examples/opencode/plugins/openlore-decision-extractor.ts +322 -0
- package/examples/opencode/plugins/openlore-enforcer.ts +227 -0
- package/examples/opencode/prompts/sisyphus-sdd.md +150 -0
- package/examples/opencode-skills/openlore-analyze-codebase/SKILL.md +101 -0
- package/examples/opencode-skills/openlore-brainstorm/SKILL.md +354 -0
- package/examples/opencode-skills/openlore-debug/SKILL.md +291 -0
- package/examples/opencode-skills/openlore-execute-refactor/SKILL.md +241 -0
- package/examples/opencode-skills/openlore-generate/SKILL.md +236 -0
- package/examples/opencode-skills/openlore-implement-story/SKILL.md +251 -0
- package/examples/opencode-skills/openlore-plan-refactor/SKILL.md +298 -0
- package/examples/opencode-skills/openlore-review-changes/SKILL.md +134 -0
- package/examples/opencode-skills/openlore-write-tests/SKILL.md +230 -0
- package/examples/openspec-analysis/README.md +59 -0
- package/examples/openspec-analysis/SUMMARY.md +72 -0
- package/examples/openspec-analysis/config.json +16 -0
- package/examples/openspec-analysis/dependencies.mermaid +35 -0
- package/examples/openspec-analysis/dependency-graph.json +12116 -0
- package/examples/openspec-analysis/llm-context.json +119 -0
- package/examples/openspec-analysis/repo-structure.json +871 -0
- package/examples/openspec-cli/README.md +67 -0
- package/examples/openspec-cli/openspec/config.yaml +26 -0
- package/examples/openspec-cli/openspec/specs/architecture/spec.md +178 -0
- package/examples/openspec-cli/openspec/specs/artifact-graph/spec.md +143 -0
- package/examples/openspec-cli/openspec/specs/cli/spec.md +138 -0
- package/examples/openspec-cli/openspec/specs/overview/spec.md +60 -0
- package/examples/openspec-cli/openspec/specs/parsing/spec.md +123 -0
- package/examples/openspec-cli/openspec/specs/validation/spec.md +108 -0
- package/examples/spec-kit/README.md +104 -0
- package/examples/spec-kit/commands/drift.md +87 -0
- package/examples/spec-kit/commands/orient.md +138 -0
- package/examples/spec-kit/extension.yml +54 -0
- package/package.json +125 -0
- package/src/viewer/InteractiveGraphViewer.jsx +1600 -0
- package/src/viewer/app/index.html +17 -0
- package/src/viewer/app/main.jsx +13 -0
- package/src/viewer/components/ArchitectureView.jsx +177 -0
- package/src/viewer/components/ChatPanel.jsx +450 -0
- package/src/viewer/components/ClassGraph.jsx +782 -0
- package/src/viewer/components/ClusterGraph.jsx +469 -0
- package/src/viewer/components/FilterBar.jsx +179 -0
- package/src/viewer/components/FlatGraph.jsx +282 -0
- package/src/viewer/components/MicroComponents.jsx +85 -0
- package/src/viewer/hooks/usePanZoom.js +79 -0
- package/src/viewer/utils/constants.js +64 -0
- package/src/viewer/utils/graph-helpers.js +303 -0
- package/src/viewer/utils/graph-helpers.test.ts +39 -0
- package/src/viewer/utils/themes.js +206 -0
- package/stubs/tree-sitter-cli-stub/package.json +6 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openlore-review-changes
|
|
3
|
+
description: Risk-aware code review using detect_changes + get_minimal_context + get_cluster. Surfaces the riskiest changed functions, interprets callType/coverage/cluster density, and produces a go/no-go recommendation. No code written.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: openlore MCP server
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- use_mcp_tool
|
|
9
|
+
- ask_followup_question
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
# openlore: Review Changes
|
|
13
|
+
|
|
14
|
+
## When to use this skill
|
|
15
|
+
|
|
16
|
+
Trigger whenever the user asks to **review, audit, or check the safety of recent changes**:
|
|
17
|
+
- "review my changes"
|
|
18
|
+
- "what did I break?"
|
|
19
|
+
- "is this branch safe to merge?"
|
|
20
|
+
- "pre-PR check" / "what's risky in this diff?"
|
|
21
|
+
- explicit command `/openlore-review-changes`
|
|
22
|
+
|
|
23
|
+
**No code is written.** Output is a risk-ranked review with a go/no-go recommendation.
|
|
24
|
+
|
|
25
|
+
---
|
|
26
|
+
|
|
27
|
+
## Step 1 — Confirm directory and base ref
|
|
28
|
+
|
|
29
|
+
Ask: which project? Diff against which base? (default: `main`)
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 2 — Detect changed functions and risk scores
|
|
34
|
+
|
|
35
|
+
```xml
|
|
36
|
+
<use_mcp_tool>
|
|
37
|
+
<server_name>openlore</server_name>
|
|
38
|
+
<tool_name>detect_changes</tool_name>
|
|
39
|
+
<arguments>{"directory": "$DIRECTORY", "base": "$BASE_REF"}</arguments>
|
|
40
|
+
</use_mcp_tool>
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Risk score is **multiplicative**: `likelihood × impact`.
|
|
44
|
+
- `likelihood` = changeScore × (1 + coveragePenalty) — `"called"` tests count full; `"imported"`-only count 0.3×
|
|
45
|
+
- `impact` = log(fanIn) + distance-weighted transitive callers (weighted by callType) + external boundary calls
|
|
46
|
+
|
|
47
|
+
Functions with fanIn=0 calling nothing external score 0 — correct; focus on non-zero scores.
|
|
48
|
+
|
|
49
|
+
Present a risk-ranked table:
|
|
50
|
+
|
|
51
|
+
| Rank | Function | File | riskScore | blastRadius | fanIn | testedBy |
|
|
52
|
+
|---|---|---|---|---|---|---|
|
|
53
|
+
|
|
54
|
+
Flag: `≥ 5` → 🔴 HIGH | `2–5` → 🟡 MEDIUM | `< 2` → 🟢 LOW
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Step 3 — Deep-inspect each HIGH function
|
|
59
|
+
|
|
60
|
+
```xml
|
|
61
|
+
<use_mcp_tool>
|
|
62
|
+
<server_name>openlore</server_name>
|
|
63
|
+
<tool_name>get_minimal_context</tool_name>
|
|
64
|
+
<arguments>{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME"}</arguments>
|
|
65
|
+
</use_mcp_tool>
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
**What to read:**
|
|
69
|
+
- `function.riskLevel` — `"high"` means up to 24 callers/callees shown; all are in blast radius.
|
|
70
|
+
- `callers[*].callType` — all `"awaited"` = async interface frozen; signature change breaks all callers silently. Mixed = looser.
|
|
71
|
+
- `callees[*].isExternal: true` — external boundary; failures propagate past mocks.
|
|
72
|
+
- `testedBy[*].confidence` — `"called"` = strong. `"imported"` only = `vi.mock()` can neutralize; treat as untested.
|
|
73
|
+
|
|
74
|
+
State for each HIGH function:
|
|
75
|
+
```
|
|
76
|
+
$FUNCTION_NAME: interface frozen? | external boundary? | effective coverage | verdict
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Step 4 — Check cluster density for non-safe HIGH functions
|
|
82
|
+
|
|
83
|
+
```xml
|
|
84
|
+
<use_mcp_tool>
|
|
85
|
+
<server_name>openlore</server_name>
|
|
86
|
+
<tool_name>get_cluster</tool_name>
|
|
87
|
+
<arguments>{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME"}</arguments>
|
|
88
|
+
</use_mcp_tool>
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`stats.clusterDensity`:
|
|
92
|
+
- `< 0.05` → sparse; change isolated; safe to land independently
|
|
93
|
+
- `0.05–0.15` → moderate; review `internalCallGraph` for transitively dependent functions
|
|
94
|
+
- `> 0.15` → dense; coordinate whole cluster; consider feature flag or staged rollout
|
|
95
|
+
|
|
96
|
+
---
|
|
97
|
+
|
|
98
|
+
## Step 5 — Coverage gap check
|
|
99
|
+
|
|
100
|
+
For each HIGH/MEDIUM function with `testedBy` empty or all `"imported"`:
|
|
101
|
+
> "⚠️ `$FUNCTION_NAME` has no direct test coverage. Recommend a characterisation test before merging."
|
|
102
|
+
|
|
103
|
+
Suggest a concrete test scenario from the function body.
|
|
104
|
+
|
|
105
|
+
---
|
|
106
|
+
|
|
107
|
+
## Step 6 — Output
|
|
108
|
+
|
|
109
|
+
### Summary
|
|
110
|
+
Total changed: N | HIGH: N | MEDIUM: N | Coverage gaps: N
|
|
111
|
+
|
|
112
|
+
### Risk table (from Step 2)
|
|
113
|
+
|
|
114
|
+
### Function verdicts (HIGH only)
|
|
115
|
+
|
|
116
|
+
### Go / No-Go
|
|
117
|
+
- ✅ **Safe to merge** — no HIGH-risk uncovered functions
|
|
118
|
+
- ⚠️ **Merge with caution** — HIGH functions exist but covered by direct tests
|
|
119
|
+
- 🛑 **Do not merge** — HIGH uncovered functions with frozen interfaces or external boundaries
|
|
120
|
+
|
|
121
|
+
---
|
|
122
|
+
|
|
123
|
+
## Absolute constraints
|
|
124
|
+
|
|
125
|
+
- Never skip Step 3 for HIGH functions — riskScore alone is not enough
|
|
126
|
+
- `callType` determines whether interface change is breaking — always interpret it
|
|
127
|
+
- `"imported"` confidence is not strong coverage — always flag it
|
|
128
|
+
- Do not recommend merging: riskScore ≥ 5 + zero direct tests + external callee
|
|
@@ -0,0 +1,261 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openlore-write-tests
|
|
3
|
+
description: Write real tests for a function or spec scenario — language-agnostic (TypeScript, Python, C++…). Reads the implementation and spec contract first, runs tests, fixes failures. No stubs, no placeholders.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: openlore MCP server
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- ask_followup_question
|
|
9
|
+
- use_mcp_tool
|
|
10
|
+
- read_file
|
|
11
|
+
- write_file
|
|
12
|
+
- str_replace_based_edit
|
|
13
|
+
- replace_in_file
|
|
14
|
+
- run_command
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
# openlore: Write Tests
|
|
18
|
+
|
|
19
|
+
## When to use this skill
|
|
20
|
+
|
|
21
|
+
Trigger this skill when the user wants to **write real tests** for a function, module, or spec
|
|
22
|
+
scenario, with phrasings like:
|
|
23
|
+
- "write tests for X"
|
|
24
|
+
- "add test coverage for Y"
|
|
25
|
+
- "what spec scenarios are untested?"
|
|
26
|
+
- "implement the test for this scenario"
|
|
27
|
+
- explicit command `/openlore-write-tests`
|
|
28
|
+
|
|
29
|
+
**The rule**: read the implementation and spec contract before writing a single assertion.
|
|
30
|
+
No `expect(true).toBe(true)`, no stubs, no placeholders.
|
|
31
|
+
|
|
32
|
+
**Prerequisite**: openlore analysis must exist (`openlore analyze` has been run).
|
|
33
|
+
If `orient` returns `"error": "no cache"` → run `openlore analyze` first, then retry.
|
|
34
|
+
|
|
35
|
+
---
|
|
36
|
+
|
|
37
|
+
## Step 1 — Identify target + detect framework
|
|
38
|
+
|
|
39
|
+
Ask the user:
|
|
40
|
+
1. **Target** — a function name, file path, spec scenario, or domain to test. If unsure, skip to Step 1b.
|
|
41
|
+
2. **`$PROJECT_ROOT`** — project root directory.
|
|
42
|
+
|
|
43
|
+
**Step 1b — Find untested scenarios (if no target given)**
|
|
44
|
+
|
|
45
|
+
```xml
|
|
46
|
+
<use_mcp_tool>
|
|
47
|
+
<server_name>openlore</server_name>
|
|
48
|
+
<tool_name>get_test_coverage</tool_name>
|
|
49
|
+
<arguments>{"directory": "$PROJECT_ROOT"}</arguments>
|
|
50
|
+
</use_mcp_tool>
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
Present the top 5 uncovered scenarios to the user, ranked by spec importance. Ask which to
|
|
54
|
+
implement first.
|
|
55
|
+
|
|
56
|
+
**Step 1c — Detect test framework**
|
|
57
|
+
|
|
58
|
+
Scan the project root for framework config files:
|
|
59
|
+
|
|
60
|
+
| File found | Framework |
|
|
61
|
+
|---|---|
|
|
62
|
+
| `vitest.config.*`, `vitest.config.ts` | Vitest — runner: `npx vitest run <file>` |
|
|
63
|
+
| `jest.config.*` | Jest — runner: `npx jest <file>` |
|
|
64
|
+
| `pytest.ini`, `pyproject.toml` (with `[tool.pytest]`), `setup.cfg` | pytest — runner: `pytest <file> -v` |
|
|
65
|
+
| `CMakeLists.txt` with `enable_testing()`, `*.test.cpp` | CTest/GTest — runner: build + `ctest` |
|
|
66
|
+
| `go.mod` | Go test — runner: `go test ./...` |
|
|
67
|
+
|
|
68
|
+
Store as `$TEST_RUNNER`. If ambiguous, ask the user.
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 2 — Orient
|
|
73
|
+
|
|
74
|
+
```xml
|
|
75
|
+
<use_mcp_tool>
|
|
76
|
+
<server_name>openlore</server_name>
|
|
77
|
+
<tool_name>orient</tool_name>
|
|
78
|
+
<arguments>{
|
|
79
|
+
"directory": "$PROJECT_ROOT",
|
|
80
|
+
"task": "write tests for $TARGET",
|
|
81
|
+
"limit": 5
|
|
82
|
+
}</arguments>
|
|
83
|
+
</use_mcp_tool>
|
|
84
|
+
```
|
|
85
|
+
|
|
86
|
+
Extract:
|
|
87
|
+
- **`$TARGET_FILE`** — the file containing the function(s) to test
|
|
88
|
+
- **`$EXISTING_TEST_FILE`** — nearby test file, if any (e.g. `foo.test.ts`, `test_foo.py`, `foo_test.go`)
|
|
89
|
+
- **`$SPEC_DOMAIN`** — the spec domain associated with the target
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Step 3 — Read implementation + spec contract
|
|
94
|
+
|
|
95
|
+
**This step is mandatory. Do not write any test before completing it.**
|
|
96
|
+
|
|
97
|
+
**3a — Read the function body**
|
|
98
|
+
|
|
99
|
+
```xml
|
|
100
|
+
<use_mcp_tool>
|
|
101
|
+
<server_name>openlore</server_name>
|
|
102
|
+
<tool_name>get_function_body</tool_name>
|
|
103
|
+
<arguments>{
|
|
104
|
+
"directory": "$PROJECT_ROOT",
|
|
105
|
+
"symbol": "$TARGET_FUNCTION",
|
|
106
|
+
"filePath": "$TARGET_FILE"
|
|
107
|
+
}</arguments>
|
|
108
|
+
</use_mcp_tool>
|
|
109
|
+
```
|
|
110
|
+
|
|
111
|
+
Identify:
|
|
112
|
+
- What the function takes as input, what it returns
|
|
113
|
+
- What external dependencies it calls (filesystem, network, DB, LLM, subprocess)
|
|
114
|
+
- What invariants are visible (guards, throws, early returns)
|
|
115
|
+
|
|
116
|
+
**3b — Find the spec contract (if specs exist)**
|
|
117
|
+
|
|
118
|
+
```xml
|
|
119
|
+
<use_mcp_tool>
|
|
120
|
+
<server_name>openlore</server_name>
|
|
121
|
+
<tool_name>search_specs</tool_name>
|
|
122
|
+
<arguments>{
|
|
123
|
+
"directory": "$PROJECT_ROOT",
|
|
124
|
+
"query": "$TARGET — expected behaviour",
|
|
125
|
+
"limit": 5
|
|
126
|
+
}</arguments>
|
|
127
|
+
</use_mcp_tool>
|
|
128
|
+
```
|
|
129
|
+
|
|
130
|
+
For each matching spec scenario, note:
|
|
131
|
+
- The **GIVEN / WHEN / THEN** clauses — these become the test body
|
|
132
|
+
- The scenario name — this becomes the `it()` / `def test_` / `TEST()` description
|
|
133
|
+
|
|
134
|
+
If no specs exist, infer the contract from the function signature, docstring, and call sites.
|
|
135
|
+
Document the inferred contract explicitly before writing any test.
|
|
136
|
+
|
|
137
|
+
**3c — Absorb local test conventions**
|
|
138
|
+
|
|
139
|
+
If `$EXISTING_TEST_FILE` exists, read it. Extract:
|
|
140
|
+
- Mock setup pattern (`vi.mock`, `unittest.mock.patch`, `gmock`, etc.)
|
|
141
|
+
- Fixture or factory helpers
|
|
142
|
+
- Import path style (relative vs absolute)
|
|
143
|
+
- Describe/class/suite structure
|
|
144
|
+
|
|
145
|
+
If no test file exists nearby, find the closest test file in the project tree and read that instead.
|
|
146
|
+
|
|
147
|
+
---
|
|
148
|
+
|
|
149
|
+
## Step 4 — Write tests
|
|
150
|
+
|
|
151
|
+
Write (or append to) `$EXISTING_TEST_FILE` (or create `<name>.test.ts` / `test_<name>.py` / `<name>_test.go` next to the source file).
|
|
152
|
+
|
|
153
|
+
### Rules — enforced without exception
|
|
154
|
+
|
|
155
|
+
1. **No placeholder assertions** — `expect(true).toBe(true)`, `assert True`, `EXPECT_TRUE(true)`,
|
|
156
|
+
`self.assertTrue(True)` are forbidden. Every assertion must test real return values or side effects.
|
|
157
|
+
|
|
158
|
+
2. **One test = one scenario** — each `it()` / `def test_` / `TEST()` maps to one GIVEN/WHEN/THEN
|
|
159
|
+
clause. Use the spec scenario name (or a descriptive contract statement) as the test description.
|
|
160
|
+
|
|
161
|
+
3. **Annotation tag (mandatory)** — place a coverage tag on the line immediately above each
|
|
162
|
+
`describe` / class / suite block so `openlore test --coverage` can track it:
|
|
163
|
+
- TypeScript/JS: `// openlore: {"domain":"$DOMAIN","requirement":"$REQ","scenario":"$SCENARIO","specFile":"openspec/specs/$DOMAIN/spec.md"}`
|
|
164
|
+
- Python: `# openlore: {"domain":"$DOMAIN","requirement":"$REQ","scenario":"$SCENARIO"}`
|
|
165
|
+
- C++/Go: `// openlore: {"domain":"$DOMAIN","requirement":"$REQ","scenario":"$SCENARIO"}`
|
|
166
|
+
|
|
167
|
+
If no spec scenario exists (contract inferred), omit the tag.
|
|
168
|
+
|
|
169
|
+
4. **Mock only system boundaries** — mock filesystem, network, LLM API, DB connections, and
|
|
170
|
+
external processes. Do not mock the function under test, its pure helpers, or in-memory logic.
|
|
171
|
+
|
|
172
|
+
5. **One suite per function** — `describe` / class / suite named after the function.
|
|
173
|
+
Use nested blocks for distinct concerns (happy path, error path, edge cases).
|
|
174
|
+
|
|
175
|
+
6. **At least one edge case** — empty input, null/None/nullptr, maximum value, or an error path
|
|
176
|
+
must be included for every function tested.
|
|
177
|
+
|
|
178
|
+
7. **Small model constraint** — if the test file exceeds 200 lines, split into multiple files
|
|
179
|
+
grouped by concern. Each file must be independently runnable.
|
|
180
|
+
|
|
181
|
+
### Structure reference (adapt to the detected framework)
|
|
182
|
+
|
|
183
|
+
```typescript
|
|
184
|
+
// TypeScript / Vitest
|
|
185
|
+
import { describe, it, expect, vi, beforeEach } from 'vitest';
|
|
186
|
+
import { $TARGET_FUNCTION } from '../$TARGET_FILE';
|
|
187
|
+
|
|
188
|
+
vi.mock('../$DEPENDENCY', () => ({ ... }));
|
|
189
|
+
|
|
190
|
+
// openlore: {"domain":"$DOMAIN","requirement":"$REQUIREMENT","scenario":"$SCENARIO","specFile":"openspec/specs/$DOMAIN/spec.md"}
|
|
191
|
+
describe('$TARGET_FUNCTION', () => {
|
|
192
|
+
beforeEach(() => { vi.resetAllMocks(); });
|
|
193
|
+
|
|
194
|
+
describe('$SCENARIO_NAME', () => {
|
|
195
|
+
it('should $EXPECTED_BEHAVIOUR when $CONDITION', () => {
|
|
196
|
+
// GIVEN
|
|
197
|
+
// WHEN
|
|
198
|
+
const result = $TARGET_FUNCTION($INPUT);
|
|
199
|
+
// THEN
|
|
200
|
+
expect(result).toEqual($EXPECTED);
|
|
201
|
+
});
|
|
202
|
+
});
|
|
203
|
+
});
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
```python
|
|
207
|
+
# Python / pytest
|
|
208
|
+
import pytest
|
|
209
|
+
from unittest.mock import patch, MagicMock
|
|
210
|
+
from $MODULE import $TARGET_FUNCTION
|
|
211
|
+
|
|
212
|
+
# openlore: {"domain":"$DOMAIN","requirement":"$REQUIREMENT","scenario":"$SCENARIO"}
|
|
213
|
+
class Test$TargetFunction:
|
|
214
|
+
def test_$scenario_name_when_$condition(self):
|
|
215
|
+
# GIVEN / WHEN / THEN
|
|
216
|
+
result = $target_function($input)
|
|
217
|
+
assert result == $expected
|
|
218
|
+
```
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Step 5 — Run and fix
|
|
223
|
+
|
|
224
|
+
Run the test file with `$TEST_RUNNER`. Iterate until all tests pass.
|
|
225
|
+
|
|
226
|
+
| Outcome | Action |
|
|
227
|
+
|---|---|
|
|
228
|
+
| All green | Proceed to Step 6 |
|
|
229
|
+
| Failure in new test | Diagnose: is the assertion wrong, or is there a real bug? Fix the assertion if the expectation was incorrect. If a real bug is revealed, do not weaken the assertion — report the bug instead. |
|
|
230
|
+
| Failure in pre-existing test | Stop. Fix the regression before adding more tests. |
|
|
231
|
+
| Test can't compile / import | Fix the import path, mock setup, or dependency injection before retrying. |
|
|
232
|
+
|
|
233
|
+
Do not weaken assertions to make tests pass. A test that masks a bug is worse than no test.
|
|
234
|
+
|
|
235
|
+
---
|
|
236
|
+
|
|
237
|
+
## Step 6 — Coverage check
|
|
238
|
+
|
|
239
|
+
```xml
|
|
240
|
+
<use_mcp_tool>
|
|
241
|
+
<server_name>openlore</server_name>
|
|
242
|
+
<tool_name>get_test_coverage</tool_name>
|
|
243
|
+
<arguments>{"directory": "$PROJECT_ROOT"}</arguments>
|
|
244
|
+
</use_mcp_tool>
|
|
245
|
+
```
|
|
246
|
+
|
|
247
|
+
Report:
|
|
248
|
+
- Which spec scenarios are now covered (new)
|
|
249
|
+
- Which scenarios remain uncovered in `$SPEC_DOMAIN`
|
|
250
|
+
- Whether any hub functions in `$SPEC_DOMAIN` are still untested (high-value next targets)
|
|
251
|
+
|
|
252
|
+
---
|
|
253
|
+
|
|
254
|
+
## Absolute constraints
|
|
255
|
+
|
|
256
|
+
- Never write `expect(true).toBe(true)`, `assert True`, or equivalent placeholder assertions
|
|
257
|
+
- Never skip Step 3 — the implementation read and spec contract are the test source of truth
|
|
258
|
+
- Never mock the function under test itself
|
|
259
|
+
- Never weaken an assertion to make a test pass — fix the implementation or the expectation
|
|
260
|
+
- If `get_test_coverage` shows the scenario is already covered, report it and stop
|
|
261
|
+
- Do not refactor the implementation as part of this skill — open a separate task
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* openlore Agent Guard — OpenCode plugin
|
|
3
|
+
*
|
|
4
|
+
* Install: openlore setup --tools opencode
|
|
5
|
+
* (copies to .opencode/plugins/ — auto-loaded by OpenCode)
|
|
6
|
+
*
|
|
7
|
+
* What it does:
|
|
8
|
+
* 1. Anti-premature-stop: injects a system-prompt rule that prevents the agent
|
|
9
|
+
* from declaring "Task completed" without having made real file changes.
|
|
10
|
+
* Once real work is done, switches to a check_spec_drift reminder instead.
|
|
11
|
+
* 2. record_decision nudge: when a structural file (service/, domain/, core/, adapter/)
|
|
12
|
+
* is modified without a prior record_decision call, appends a non-blocking
|
|
13
|
+
* reminder to the tool output the agent reads.
|
|
14
|
+
* 3. Compaction safety: injects pending decisions into the compaction context
|
|
15
|
+
* so they survive session summarisation.
|
|
16
|
+
* 4. tool.definition enrichment: adds known spec domains to the record_decision
|
|
17
|
+
* tool description so the model uses the right domain names.
|
|
18
|
+
*
|
|
19
|
+
* Consolidation is NOT the plugin's responsibility.
|
|
20
|
+
* The record_decision MCP handler spawns `openlore decisions --consolidate` in the
|
|
21
|
+
* background automatically after saving each draft. By commit time, decisions are
|
|
22
|
+
* already consolidated — the pre-commit gate does no LLM work and is instant.
|
|
23
|
+
*/
|
|
24
|
+
|
|
25
|
+
import type { Plugin } from "@opencode-ai/plugin"
|
|
26
|
+
import { spawn } from "node:child_process"
|
|
27
|
+
import { readFile, readdir } from "node:fs/promises"
|
|
28
|
+
import { join } from "node:path"
|
|
29
|
+
|
|
30
|
+
const STRUCTURAL = /\/(service|domain|core|adapter)\//
|
|
31
|
+
|
|
32
|
+
interface PendingDecision {
|
|
33
|
+
id: string
|
|
34
|
+
title: string
|
|
35
|
+
status: string
|
|
36
|
+
affectedDomains: string[]
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async function loadPendingDecisions(directory: string): Promise<PendingDecision[]> {
|
|
40
|
+
try {
|
|
41
|
+
const raw = await readFile(join(directory, ".openlore", "decisions", "pending.json"), "utf-8")
|
|
42
|
+
const store = JSON.parse(raw)
|
|
43
|
+
return (store.decisions ?? []).filter(
|
|
44
|
+
(d: PendingDecision) => !["synced", "rejected"].includes(d.status),
|
|
45
|
+
)
|
|
46
|
+
} catch {
|
|
47
|
+
return []
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
async function loadSpecDomains(directory: string): Promise<string[]> {
|
|
52
|
+
try {
|
|
53
|
+
const entries = await readdir(join(directory, "openspec", "specs"), { withFileTypes: true })
|
|
54
|
+
return entries.filter(e => e.isDirectory()).map(e => e.name)
|
|
55
|
+
} catch {
|
|
56
|
+
return []
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
// Tools that write files — trigger re-analysis so the call graph stays fresh.
|
|
61
|
+
const EDIT_TOOL_RE = /write_file|edit_file|create_file|str_replace|insert|patch/i
|
|
62
|
+
|
|
63
|
+
// In-memory debounce: spawn at most one analysis per 10 s regardless of edit rate.
|
|
64
|
+
let lastAnalyzeMs = 0
|
|
65
|
+
const ANALYZE_DEBOUNCE_MS = 10_000
|
|
66
|
+
|
|
67
|
+
function spawnAnalyze(directory: string): void {
|
|
68
|
+
const now = Date.now()
|
|
69
|
+
if (now - lastAnalyzeMs < ANALYZE_DEBOUNCE_MS) return
|
|
70
|
+
lastAnalyzeMs = now
|
|
71
|
+
// Fire-and-forget: detached + unref so it survives plugin process exit.
|
|
72
|
+
const child = spawn("openlore", ["analyze", "--output", ".openlore/analysis"], {
|
|
73
|
+
detached: true,
|
|
74
|
+
stdio: "ignore",
|
|
75
|
+
cwd: directory,
|
|
76
|
+
})
|
|
77
|
+
child.unref()
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
export const AgentGuard: Plugin = async ({ directory }) => {
|
|
81
|
+
const toolCalls = new Map<string, number>()
|
|
82
|
+
const rdCalled = new Map<string, boolean>()
|
|
83
|
+
const driftChecked = new Map<string, boolean>()
|
|
84
|
+
|
|
85
|
+
const inc = (sid: string) => toolCalls.set(sid, (toolCalls.get(sid) ?? 0) + 1)
|
|
86
|
+
const reset = (sid: string) => {
|
|
87
|
+
toolCalls.set(sid, 0)
|
|
88
|
+
rdCalled.set(sid, false)
|
|
89
|
+
driftChecked.set(sid, false)
|
|
90
|
+
}
|
|
91
|
+
|
|
92
|
+
return {
|
|
93
|
+
// Keep agent working until it has explicitly verified completion.
|
|
94
|
+
"experimental.chat.system.transform": async ({ sessionID }, output) => {
|
|
95
|
+
const n = toolCalls.get(sessionID) ?? 0
|
|
96
|
+
const checked = driftChecked.get(sessionID) ?? false
|
|
97
|
+
|
|
98
|
+
if (n === 0) {
|
|
99
|
+
output.system.push(
|
|
100
|
+
"Do not say 'Task completed', 'Done', or 'Finished' without having executed " +
|
|
101
|
+
"at least one file modification tool call. If no real work has been done yet, keep working.",
|
|
102
|
+
)
|
|
103
|
+
} else if (!checked) {
|
|
104
|
+
output.system.push(
|
|
105
|
+
"Before saying 'Task completed': re-read the original request and verify every part " +
|
|
106
|
+
"of it is addressed. If anything is missing or untested, keep working.",
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
},
|
|
110
|
+
|
|
111
|
+
// Track tool calls; nudge record_decision on structural file changes.
|
|
112
|
+
"tool.execute.after": async (input, output) => {
|
|
113
|
+
const { sessionID, tool, args } = input
|
|
114
|
+
inc(sessionID)
|
|
115
|
+
|
|
116
|
+
if (tool.includes("check_spec_drift")) {
|
|
117
|
+
driftChecked.set(sessionID, true)
|
|
118
|
+
return
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
if (tool.includes("record_decision")) {
|
|
122
|
+
rdCalled.set(sessionID, true)
|
|
123
|
+
return
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
const file: string = args?.filePath ?? args?.path ?? ""
|
|
127
|
+
if (STRUCTURAL.test(file) && !rdCalled.get(sessionID)) {
|
|
128
|
+
output.output +=
|
|
129
|
+
"\n\n[openlore] Structural file modified. " +
|
|
130
|
+
"Consider calling record_decision before continuing."
|
|
131
|
+
}
|
|
132
|
+
|
|
133
|
+
// Keep call graph fresh after every file edit (debounced 10 s).
|
|
134
|
+
if (EDIT_TOOL_RE.test(tool)) {
|
|
135
|
+
spawnAnalyze(directory)
|
|
136
|
+
}
|
|
137
|
+
},
|
|
138
|
+
|
|
139
|
+
// Inject pending decisions into compaction context so they survive summarisation.
|
|
140
|
+
"experimental.session.compacting": async (_input, output) => {
|
|
141
|
+
const decisions = await loadPendingDecisions(directory)
|
|
142
|
+
if (decisions.length > 0) {
|
|
143
|
+
const lines = decisions.map(
|
|
144
|
+
d => ` - [${d.status}] ${d.title} (domains: ${d.affectedDomains.join(", ")})`,
|
|
145
|
+
)
|
|
146
|
+
output.context.push(
|
|
147
|
+
`Pending architectural decisions — do not lose track of these:\n${lines.join("\n")}`,
|
|
148
|
+
)
|
|
149
|
+
}
|
|
150
|
+
},
|
|
151
|
+
|
|
152
|
+
// Enrich record_decision description with known spec domains.
|
|
153
|
+
"tool.definition": async ({ toolID }, output) => {
|
|
154
|
+
if (!toolID.includes("record_decision")) return
|
|
155
|
+
const domains = await loadSpecDomains(directory)
|
|
156
|
+
if (domains.length > 0) {
|
|
157
|
+
output.description +=
|
|
158
|
+
`\n\nKnown affectedDomains values for this project: ${domains.join(", ")}`
|
|
159
|
+
}
|
|
160
|
+
},
|
|
161
|
+
|
|
162
|
+
// Reset per-session counters on lifecycle events.
|
|
163
|
+
event: async ({ event }) => {
|
|
164
|
+
const sid = (event as any).properties?.sessionID
|
|
165
|
+
if (sid && ["session.idle", "session.created"].includes((event as any).type)) {
|
|
166
|
+
reset(sid)
|
|
167
|
+
}
|
|
168
|
+
},
|
|
169
|
+
}
|
|
170
|
+
}
|