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,251 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openlore-implement-story
|
|
3
|
+
description: Implement a story on a brownfield codebase using openlore structural context. Runs orient + risk check before coding, validates against specs, enforces a test gate before drift check.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: openlore MCP server
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# openlore: Implement Story
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
Trigger this skill when the user asks to **implement a story or task** on a codebase that has
|
|
13
|
+
openlore analysis available, with phrasings like:
|
|
14
|
+
- "implement story X"
|
|
15
|
+
- "work on task Y"
|
|
16
|
+
- "start implementing this feature"
|
|
17
|
+
- explicit command `/openlore-implement-story`
|
|
18
|
+
|
|
19
|
+
**Prerequisite**: openlore analysis must exist (`openlore analyze` has been run).
|
|
20
|
+
If `orient` returns `"error": "no cache"` → run `analyze_codebase` first, then retry.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Step 1 — Read the story and risk context
|
|
25
|
+
|
|
26
|
+
Read the story file. Extract:
|
|
27
|
+
- `$STORY_TITLE`, `$AC` (acceptance criteria), `$PROJECT_ROOT`
|
|
28
|
+
- `$RISK_CONTEXT` — the `risk_context` section if present (pre-filled by Architect Agent)
|
|
29
|
+
|
|
30
|
+
| Situation | Approach |
|
|
31
|
+
|---|---|
|
|
32
|
+
| `risk_context` present, risk 🟢 < 40 | Skip to Step 3 — use insertion point from context |
|
|
33
|
+
| `risk_context` present, risk 🟡 40–69 | Run Step 2 impact check, then proceed |
|
|
34
|
+
| `risk_context` present, risk 🔴 ≥ 70 | Stop — a blocking refactor story must be resolved first |
|
|
35
|
+
| `risk_context` absent | Run the full Step 2 orientation |
|
|
36
|
+
|
|
37
|
+
---
|
|
38
|
+
|
|
39
|
+
## Step 2 — Orient and assess risk
|
|
40
|
+
|
|
41
|
+
Call the openlore MCP tool `orient` with:
|
|
42
|
+
```json
|
|
43
|
+
{
|
|
44
|
+
"directory": "$PROJECT_ROOT",
|
|
45
|
+
"task": "$STORY_TITLE",
|
|
46
|
+
"limit": 7
|
|
47
|
+
}
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
For the top 2 functions returned, get minimal context first (callers, callees, body, test coverage in one call):
|
|
51
|
+
```json
|
|
52
|
+
// get_minimal_context
|
|
53
|
+
{
|
|
54
|
+
"directory": "$PROJECT_ROOT",
|
|
55
|
+
"functionName": "$FUNCTION_NAME"
|
|
56
|
+
}
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
**What to read from the result before proceeding:**
|
|
60
|
+
- `function.riskLevel` — `"high"` means fanIn ≥ 30 or fanOut ≥ 15; the tool expanded caller/callee lists to 24. All shown entries are in scope.
|
|
61
|
+
- `callers[*].callType` — all `"awaited"` = async interface frozen; changing signature or return type breaks every caller. Mixed = looser coupling.
|
|
62
|
+
- `callees[*].isExternal: true` — function touches HTTP/DB boundary; new code paths may fail silently in tests (mocked) but loudly in production.
|
|
63
|
+
- `testedBy[*].confidence` — `"called"` = direct test (strong). `"imported"` = test imports module only; `vi.mock()` can nullify it. Only `"imported"` entries = treat as effectively untested.
|
|
64
|
+
|
|
65
|
+
If `riskLevel` is `"high"` or any callee is external, check the cluster:
|
|
66
|
+
```json
|
|
67
|
+
// get_cluster
|
|
68
|
+
{
|
|
69
|
+
"directory": "$PROJECT_ROOT",
|
|
70
|
+
"functionName": "$FUNCTION_NAME"
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
- `clusterDensity < 0.05` → sparse, change is isolated, proceed
|
|
74
|
+
- `clusterDensity 0.05–0.15` → check `internalCallGraph` for transitively dependent functions
|
|
75
|
+
- `clusterDensity > 0.15` → dense cluster; coordinate the whole cluster or discuss scope with user
|
|
76
|
+
|
|
77
|
+
Then check risk:
|
|
78
|
+
```json
|
|
79
|
+
// analyze_impact
|
|
80
|
+
{
|
|
81
|
+
"directory": "$PROJECT_ROOT",
|
|
82
|
+
"symbol": "$FUNCTION_NAME",
|
|
83
|
+
"depth": 2
|
|
84
|
+
}
|
|
85
|
+
```
|
|
86
|
+
|
|
87
|
+
**If any function has `riskScore ≥ 70`: stop.**
|
|
88
|
+
Do not implement. Run `/openlore-execute-refactor` on the blocking function first, or create a
|
|
89
|
+
blocking refactor task and return to this story once the risk is resolved.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
## Step 2.5 — Stack inventory (conditional)
|
|
94
|
+
|
|
95
|
+
Based on the story title and orient results, call the relevant inventory tool(s) **before reading any source file**. Skip if the story clearly involves none of these areas.
|
|
96
|
+
|
|
97
|
+
| Story involves | Tool | Purpose |
|
|
98
|
+
|---|---|---|
|
|
99
|
+
| Data models / ORM / database / tables | `get_schema_inventory` | See existing tables and fields — don't re-invent what already exists |
|
|
100
|
+
| HTTP routes / API / endpoints | `get_route_inventory` | See existing routes before adding new ones |
|
|
101
|
+
| Config / env vars / secrets | `get_env_vars` | Identify which vars are required vs have defaults |
|
|
102
|
+
| UI components | `get_ui_components` | See existing component props and framework |
|
|
103
|
+
|
|
104
|
+
Call whichever openlore MCP inventory tool applies, e.g. `get_schema_inventory` with `{"directory": "$PROJECT_ROOT"}`.
|
|
105
|
+
|
|
106
|
+
Use the results to ground the implementation in existing schemas/routes — the plan cannot contradict what already exists.
|
|
107
|
+
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
## Step 3 — Check the spec
|
|
111
|
+
|
|
112
|
+
First, verify that OpenSpec specs exist:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
ls $PROJECT_ROOT/openspec/specs/ 2>/dev/null | wc -l
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
**If 0 specs found:**
|
|
119
|
+
> No OpenSpec specs exist yet. `search_specs` will return empty results and
|
|
120
|
+
> `check_spec_drift` (Step 7) will flag everything as uncovered.
|
|
121
|
+
>
|
|
122
|
+
> Recommended: run `/openlore-generate` after this story to create a spec baseline.
|
|
123
|
+
> You only need to do this once.
|
|
124
|
+
>
|
|
125
|
+
> Continuing with structural analysis only.
|
|
126
|
+
|
|
127
|
+
Skip the `search_specs` call and go to Step 4.
|
|
128
|
+
|
|
129
|
+
**If specs exist:**
|
|
130
|
+
|
|
131
|
+
Call the openlore MCP tool `search_specs` with:
|
|
132
|
+
```json
|
|
133
|
+
{
|
|
134
|
+
"directory": "$PROJECT_ROOT",
|
|
135
|
+
"query": "$STORY_TITLE",
|
|
136
|
+
"limit": 5
|
|
137
|
+
}
|
|
138
|
+
```
|
|
139
|
+
|
|
140
|
+
If relevant requirements are found, read the domain spec before writing any code.
|
|
141
|
+
Note any constraints that apply.
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## Step 3.5 — Audit spec coverage of the target domain
|
|
146
|
+
|
|
147
|
+
Call the openlore MCP tool `audit_spec_coverage` with `{"directory": "$PROJECT_ROOT"}`.
|
|
148
|
+
|
|
149
|
+
From the result, check:
|
|
150
|
+
- `staleDomains` — if the target domain appears here, its spec is outdated.
|
|
151
|
+
Recommend running `openlore generate --domains $DOMAIN` before implementing.
|
|
152
|
+
- `hubGaps` — uncovered hub functions. If the feature touches one of these,
|
|
153
|
+
add it to the adversarial check in Step 4b (high blast radius + no spec = risk).
|
|
154
|
+
|
|
155
|
+
If both are clean, continue to Step 4 without action.
|
|
156
|
+
|
|
157
|
+
---
|
|
158
|
+
|
|
159
|
+
## Step 4 — Find the insertion point
|
|
160
|
+
|
|
161
|
+
Use `insertion_points` from `risk_context` if present. Otherwise:
|
|
162
|
+
|
|
163
|
+
Call the openlore MCP tool `suggest_insertion_points` with:
|
|
164
|
+
```json
|
|
165
|
+
{
|
|
166
|
+
"directory": "$PROJECT_ROOT",
|
|
167
|
+
"description": "$STORY_TITLE",
|
|
168
|
+
"limit": 5
|
|
169
|
+
}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
Read the skeleton of the target file by calling the openlore MCP tool `get_function_skeleton` with:
|
|
173
|
+
```json
|
|
174
|
+
{
|
|
175
|
+
"directory": "$PROJECT_ROOT",
|
|
176
|
+
"filePath": "$TARGET_FILE"
|
|
177
|
+
}
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
**Confirm the approach with the user before writing code.**
|
|
181
|
+
|
|
182
|
+
### Step 4b — Adversarial challenge
|
|
183
|
+
|
|
184
|
+
Before writing any code, state explicitly what could break with this approach.
|
|
185
|
+
If `.claude/antipatterns.md` exists, read it and include any applicable patterns.
|
|
186
|
+
|
|
187
|
+
> "Risk check on `$INSERTION_POINT`:
|
|
188
|
+
> - `$CALLER_A` and `$CALLER_B` depend on this function — verify their assumptions
|
|
189
|
+
> hold after the change.
|
|
190
|
+
> - `$EDGE_CASE` is not covered by the current test suite — add it in Step 6.
|
|
191
|
+
> - [if antipatterns apply] AP-NNN (`$PATTERN_NAME`) — `$RULE` — applies here because `$REASON`."
|
|
192
|
+
|
|
193
|
+
This is not a gate — do not wait for user input. It is a mandatory self-check
|
|
194
|
+
that must appear in the output before the first line of code is written.
|
|
195
|
+
|
|
196
|
+
---
|
|
197
|
+
|
|
198
|
+
## Step 5 — Implement
|
|
199
|
+
|
|
200
|
+
Apply changes in this order:
|
|
201
|
+
1. New types/interfaces (if needed)
|
|
202
|
+
2. Core logic at the insertion point
|
|
203
|
+
3. Updated call sites (if any)
|
|
204
|
+
|
|
205
|
+
Do not touch functions outside the scope identified in Step 2 / `risk_context` without
|
|
206
|
+
re-running the gate.
|
|
207
|
+
|
|
208
|
+
**Small model constraint**: if the model is under 13B parameters, each edit must touch a contiguous block of at most 50 lines. Split larger changes.
|
|
209
|
+
|
|
210
|
+
---
|
|
211
|
+
|
|
212
|
+
## Step 6 — Tests
|
|
213
|
+
|
|
214
|
+
Both levels required before proceeding to Step 7.
|
|
215
|
+
|
|
216
|
+
**Mandatory — existing tests must not regress:**
|
|
217
|
+
Run the full test suite. If any pre-existing test breaks, fix the regression before continuing.
|
|
218
|
+
|
|
219
|
+
**Recommended — at least one new test per AC:**
|
|
220
|
+
Write a test that directly exercises the behaviour described in the acceptance criterion.
|
|
221
|
+
|
|
222
|
+
| Situation | Action |
|
|
223
|
+
|---|---|
|
|
224
|
+
| All tests green, new tests written | Proceed to Step 7 |
|
|
225
|
+
| Existing test broken | Fix regression. Do not proceed. |
|
|
226
|
+
| New test reveals a misunderstanding of the AC | Return to Step 5, adjust implementation |
|
|
227
|
+
| Brownfield: no existing test coverage | Write the new test anyway. Note the coverage gap. |
|
|
228
|
+
|
|
229
|
+
---
|
|
230
|
+
|
|
231
|
+
## Step 7 — Verify drift
|
|
232
|
+
|
|
233
|
+
Only run once tests are green.
|
|
234
|
+
|
|
235
|
+
Call the openlore MCP tool `check_spec_drift` with `{"directory": "$PROJECT_ROOT"}`.
|
|
236
|
+
|
|
237
|
+
| Drift type | Resolution |
|
|
238
|
+
|---|---|
|
|
239
|
+
| `uncovered` on new files | Note it — propose `openlore generate` post-sprint |
|
|
240
|
+
| `gap` on existing domain | Run `openlore generate --domains $DOMAIN` |
|
|
241
|
+
| `stale` | Fix the reference |
|
|
242
|
+
| No drift | Done |
|
|
243
|
+
|
|
244
|
+
---
|
|
245
|
+
|
|
246
|
+
## Absolute constraints
|
|
247
|
+
|
|
248
|
+
- Do not write code before Step 4 confirmation
|
|
249
|
+
- If `riskScore ≥ 70` — stop, do not work around it, run `/openlore-execute-refactor` first
|
|
250
|
+
- Do not run `check_spec_drift` before tests are green
|
|
251
|
+
- Do not propose a spec update on untested code
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openlore-plan-refactor
|
|
3
|
+
description: Identify the highest-priority refactoring target using static analysis, assess its blast radius, and produce a detailed written plan saved to .openlore/refactor-plan.md. Makes no code changes.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: openlore MCP server
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
# openlore: Plan Refactor
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
Trigger this skill whenever the user asks to **plan a refactoring** on a codebase, with phrasings like:
|
|
13
|
+
- "plan a refactoring of X"
|
|
14
|
+
- "analyze my code and prepare a refactor plan"
|
|
15
|
+
- "generate a refactoring plan"
|
|
16
|
+
- "I want to refactor this function / this file"
|
|
17
|
+
- explicit command `/openlore-plan-refactor`
|
|
18
|
+
|
|
19
|
+
**This skill modifies no code files.** It only produces `.openlore/refactor-plan.md`.
|
|
20
|
+
To apply the plan, use the `openlore-execute-refactor` skill.
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## ⚠️ Fundamental principle — each change is a complete mini-development
|
|
25
|
+
|
|
26
|
+
**The plan must be written so that every entry in the change sequence is independently executable and testable.**
|
|
27
|
+
|
|
28
|
+
Each change = one atomic edit → one diff verification → one full test run → ✅ or rollback.
|
|
29
|
+
|
|
30
|
+
This is not a final gate at the end. Testing is a mandatory sub-step after **every single change**.
|
|
31
|
+
The plan must make this cycle explicit and impossible to skip.
|
|
32
|
+
|
|
33
|
+
**For small models (< 13B parameters)**: each change must touch at most **50 contiguous lines** in the source file.
|
|
34
|
+
If a logical extraction exceeds this limit, split it into smaller sub-changes, each with its own test gate.
|
|
35
|
+
|
|
36
|
+
---
|
|
37
|
+
|
|
38
|
+
## User-specified target — shortcut path
|
|
39
|
+
|
|
40
|
+
If the user has already named a specific file or function to refactor:
|
|
41
|
+
- **Skip** Steps 2, 3, and 3b (discovery is not needed).
|
|
42
|
+
- **Do not skip** Steps 3c, 4, 5, 6, and 6b — coverage check and impact analysis are mandatory regardless of how the target was chosen.
|
|
43
|
+
- Jump directly to Step 3c using the user-provided target.
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Step 1 — Confirm the project directory
|
|
48
|
+
|
|
49
|
+
Ask the user which project to analyze, or confirm the current workspace root.
|
|
50
|
+
|
|
51
|
+
---
|
|
52
|
+
|
|
53
|
+
## Step 2 — Run static analysis
|
|
54
|
+
|
|
55
|
+
Call the openlore MCP tool `analyze_codebase` with `{"directory": "$DIRECTORY"}`.
|
|
56
|
+
|
|
57
|
+
If a recent analysis already exists, skip unless the user explicitly requests a fresh run.
|
|
58
|
+
|
|
59
|
+
---
|
|
60
|
+
|
|
61
|
+
## Step 3 — Get the refactoring report
|
|
62
|
+
|
|
63
|
+
Call the openlore MCP tool `get_refactor_report` with `{"directory": "$DIRECTORY"}`.
|
|
64
|
+
|
|
65
|
+
Present the top 5 candidates:
|
|
66
|
+
|
|
67
|
+
| Function | File | Issues | Priority score |
|
|
68
|
+
|---|---|---|---|
|
|
69
|
+
|
|
70
|
+
---
|
|
71
|
+
|
|
72
|
+
## Step 3b — Check for duplicate code
|
|
73
|
+
|
|
74
|
+
Call the openlore MCP tool `get_duplicate_report` with `{"directory": "$DIRECTORY"}`.
|
|
75
|
+
|
|
76
|
+
If a top candidate appears in a clone group, prepend a **deduplication note** to the plan:
|
|
77
|
+
> "⚠️ `<function>` has N near-clones. Consolidate them first to reduce the blast radius of this refactor."
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
## Step 3c — Check test coverage
|
|
82
|
+
|
|
83
|
+
Before presenting a choice to the user, check test coverage for the files containing the candidates. Detect the coverage tool from the project:
|
|
84
|
+
|
|
85
|
+
| Ecosystem | Command |
|
|
86
|
+
|---|---|
|
|
87
|
+
| Node.js | `npm test -- --coverage --collectCoverageFrom="<files>"` |
|
|
88
|
+
| Python | `pytest --cov=<module> --cov-report=term-missing` |
|
|
89
|
+
| Rust | `cargo tarpaulin --include-files <files>` |
|
|
90
|
+
| Go | `go test -cover ./...` |
|
|
91
|
+
|
|
92
|
+
Enrich the candidate table:
|
|
93
|
+
|
|
94
|
+
| Function | File | Priority | Coverage |
|
|
95
|
+
|---|---|---|---|
|
|
96
|
+
| ... | ... | ... | 72% ✅ / 35% ⚠️ / 0% 🚫 |
|
|
97
|
+
|
|
98
|
+
**Thresholds:**
|
|
99
|
+
|
|
100
|
+
| Coverage | Badge | Meaning |
|
|
101
|
+
|---|---|---|
|
|
102
|
+
| ≥ 70% lines | ✅ | Safe to refactor |
|
|
103
|
+
| 40–69% lines | ⚠️ | Write characterisation tests first |
|
|
104
|
+
| < 40% lines | 🛑 | Strongly discouraged |
|
|
105
|
+
| 0% (no tests) | 🚫 | Blocked — propose a test harness first |
|
|
106
|
+
|
|
107
|
+
If **all candidates are below 40%**:
|
|
108
|
+
> "Every high-priority target has insufficient test coverage (< 40%). I recommend writing a minimal test harness for at least one target before proceeding. Would you like me to suggest test cases based on the function signatures?"
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Step 4 — Get minimal context + analyze impact
|
|
113
|
+
|
|
114
|
+
Get the condensed view of the target function (callers, callees, body, test coverage in one call):
|
|
115
|
+
|
|
116
|
+
Call the openlore MCP tool `get_minimal_context` with `{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME"}`.
|
|
117
|
+
|
|
118
|
+
**What to read before deciding whether to proceed:**
|
|
119
|
+
- `function.riskLevel` — `"high"` (fanIn ≥ 30 or fanOut ≥ 15) means up to 24 callers/callees shown. Read all — they are all in scope for this refactor.
|
|
120
|
+
- `callers[*].callType` — all `"awaited"` = async interface frozen; extracting or splitting requires updating every call site. `"direct"` / `"method"` = more portable.
|
|
121
|
+
- `testedBy[*].confidence` — `"called"` = direct test, safe to refactor under. `"imported"` only = `vi.mock()` can neutralize it; write a characterisation test **before** refactoring.
|
|
122
|
+
|
|
123
|
+
Then get the full impact analysis:
|
|
124
|
+
|
|
125
|
+
Call the openlore MCP tool `analyze_impact` with `{"directory": "$DIRECTORY", "symbol": "$FUNCTION_NAME"}`.
|
|
126
|
+
|
|
127
|
+
Note: risk score (0–100), recommended strategy (`extract` / `split` / `facade` / `delegate`), top 5 upstream callers and downstream callees.
|
|
128
|
+
|
|
129
|
+
**If `riskLevel` is `"high"` or impact risk score ≥ 60**, check the cluster to set refactor scope:
|
|
130
|
+
|
|
131
|
+
Call the openlore MCP tool `get_cluster` with `{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME"}`.
|
|
132
|
+
|
|
133
|
+
Read `stats.clusterDensity`:
|
|
134
|
+
- `< 0.05` — sparse; extract the target independently, others not in scope
|
|
135
|
+
- `0.05–0.15` — moderate; include functions in `internalCallGraph` that call the target in the plan's risk section
|
|
136
|
+
- `> 0.15` — dense; refactor the whole cluster together or not at all; add all members to affected-files list
|
|
137
|
+
|
|
138
|
+
---
|
|
139
|
+
|
|
140
|
+
## Step 5 — Visualise the call neighbourhood
|
|
141
|
+
|
|
142
|
+
Call the openlore MCP tool `get_subgraph` with:
|
|
143
|
+
```json
|
|
144
|
+
{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME", "direction": "both", "format": "mermaid"}
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Show the Mermaid diagram to the user.
|
|
148
|
+
|
|
149
|
+
---
|
|
150
|
+
|
|
151
|
+
## Step 6 — Find safe entry points (bottom-up)
|
|
152
|
+
|
|
153
|
+
Call the openlore MCP tool `get_low_risk_refactor_candidates` with:
|
|
154
|
+
```json
|
|
155
|
+
{"directory": "$DIRECTORY", "filePattern": "$TARGET_FILE", "limit": 5}
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
Cross-reference with the subgraph from Step 5: a good first extraction candidate already appears as a callee of the target function.
|
|
159
|
+
|
|
160
|
+
---
|
|
161
|
+
|
|
162
|
+
## Step 6b — Find insertion points for extracted helpers
|
|
163
|
+
|
|
164
|
+
Before designing the change sequence, identify where extracted functions should land.
|
|
165
|
+
This avoids creating helpers in the wrong file or layer.
|
|
166
|
+
|
|
167
|
+
Call the openlore MCP tool `suggest_insertion_points` with:
|
|
168
|
+
```json
|
|
169
|
+
{"directory": "$DIRECTORY", "query": "extract helper from $FUNCTION_NAME", "limit": 5}
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
For each candidate, note its role and strategy. Prefer candidates that already call into — or are called by — the target function (visible in the Step 5 subgraph).
|
|
173
|
+
|
|
174
|
+
---
|
|
175
|
+
|
|
176
|
+
## Step 7 — Design the change sequence
|
|
177
|
+
|
|
178
|
+
Design an ordered sequence of atomic changes based on the strategy from Step 4.
|
|
179
|
+
|
|
180
|
+
### Size constraint (mandatory for small models)
|
|
181
|
+
|
|
182
|
+
**Each change must touch at most 50 contiguous lines** in the source file.
|
|
183
|
+
If a logical extraction requires moving more than 50 lines in one pass, split it into sub-changes:
|
|
184
|
+
- Sub-change A: extract the inner block (≤ 50 lines)
|
|
185
|
+
- Sub-change B: extract the outer wrapper (≤ 50 lines)
|
|
186
|
+
Each sub-change gets its own test gate. Never group two sub-changes before testing.
|
|
187
|
+
|
|
188
|
+
### Each change must specify
|
|
189
|
+
|
|
190
|
+
- **What**: the exact block to move (line range or description)
|
|
191
|
+
- **Lines touched**: estimated count in source file — must be ≤ 50
|
|
192
|
+
- **New name**: the function or method name to give it
|
|
193
|
+
- **Target file**: existing or new file (with justification)
|
|
194
|
+
- **Target class** (if applicable)
|
|
195
|
+
- **Call sites to update**: list each `file:line`
|
|
196
|
+
- **Test gate**: exact test command to run after this change
|
|
197
|
+
|
|
198
|
+
### Mini-development cycle per change (write this explicitly in the plan)
|
|
199
|
+
|
|
200
|
+
```
|
|
201
|
+
READ plan entry → EDIT (targeted, ≤ 50 lines) → DIFF verify → TEST
|
|
202
|
+
├─ green → mark ✅, next change
|
|
203
|
+
└─ red → git checkout HEAD -- <file>, diagnose, retry
|
|
204
|
+
after 3 failed retries → STOP, report to user
|
|
205
|
+
```
|
|
206
|
+
|
|
207
|
+
The plan must show this cycle in the change sequence, not just in a footnote.
|
|
208
|
+
|
|
209
|
+
**Rules per strategy:**
|
|
210
|
+
|
|
211
|
+
| Strategy | Rule |
|
|
212
|
+
|---|---|
|
|
213
|
+
| `split` | Decompose into N sub-functions in the same file unless they clearly belong elsewhere |
|
|
214
|
+
| `extract` | Place in the nearest cohesive module or create a new file if none exists |
|
|
215
|
+
| `facade` | Keep the original signature, delegate to smaller functions; companion module if > 300 lines |
|
|
216
|
+
| `delegate` | Move ownership logic to callers; update every caller file in the upstream chain |
|
|
217
|
+
|
|
218
|
+
**Present the full sequence and wait for confirmation before writing the plan file.**
|
|
219
|
+
|
|
220
|
+
---
|
|
221
|
+
|
|
222
|
+
## Step 8 — Write `.openlore/refactor-plan.md`
|
|
223
|
+
|
|
224
|
+
Fill every section — **leave nothing as "TBD"**.
|
|
225
|
+
|
|
226
|
+
```markdown
|
|
227
|
+
# Refactor Plan
|
|
228
|
+
|
|
229
|
+
Generated: <ISO date>
|
|
230
|
+
Workflow: /openlore-plan-refactor → /openlore-execute-refactor
|
|
231
|
+
|
|
232
|
+
## Target
|
|
233
|
+
- **Function**: <n>
|
|
234
|
+
- **File**: <relative path>
|
|
235
|
+
- **Lines**: <start>–<end>
|
|
236
|
+
- **Risk score**: <0–100>
|
|
237
|
+
- **Strategy**: <extract | split | facade | delegate>
|
|
238
|
+
- **Priority score before refactor**: <value>
|
|
239
|
+
|
|
240
|
+
## Why
|
|
241
|
+
- <issue 1>
|
|
242
|
+
- <issue 2>
|
|
243
|
+
|
|
244
|
+
## Callers (upstream — must not break)
|
|
245
|
+
| Caller | File |
|
|
246
|
+
|---|---|
|
|
247
|
+
|
|
248
|
+
## Callees (downstream — candidates for extraction)
|
|
249
|
+
| Callee | File |
|
|
250
|
+
|---|---|
|
|
251
|
+
|
|
252
|
+
## Coverage baseline
|
|
253
|
+
- **File**: <target file>
|
|
254
|
+
- **Coverage**: <X>% lines, <Y>% branches
|
|
255
|
+
- **Status**: ✅ safe / ⚠️ caution / 🛑 discouraged
|
|
256
|
+
- **Test command**: <exact command>
|
|
257
|
+
|
|
258
|
+
## Change sequence
|
|
259
|
+
Each change is a complete mini-development: edit → diff → test → ✅ or rollback.
|
|
260
|
+
Never advance to the next change without a green test gate.
|
|
261
|
+
|
|
262
|
+
### Change 1 — <short label>
|
|
263
|
+
- **What**: extract lines <start>–<end> (logic: <one-line description>)
|
|
264
|
+
- **Lines touched in source**: ~<N> lines (must be ≤ 50)
|
|
265
|
+
- **New function name**: `<n>`
|
|
266
|
+
- **Target file**: `<path>` (<new file | existing file — reason>)
|
|
267
|
+
- **Target class**: `<ClassName>` or none
|
|
268
|
+
- **Call sites to update**: <list each file:line>
|
|
269
|
+
- **Expected diff**: +<N> lines in <target file>, -<M> lines in <source file>
|
|
270
|
+
- **Test gate**: `<exact test command>`
|
|
271
|
+
- **Retry limit**: 3 attempts — if still red after 3, stop and report
|
|
272
|
+
|
|
273
|
+
### Change 2 — <short label>
|
|
274
|
+
...
|
|
275
|
+
|
|
276
|
+
## Acceptance criteria
|
|
277
|
+
- Priority score drops below <target score> in `get_refactor_report`
|
|
278
|
+
- Function exits the top-5 list
|
|
279
|
+
- Full test suite passes (green)
|
|
280
|
+
- `git diff --stat` shows only the expected files
|
|
281
|
+
|
|
282
|
+
## Restore point
|
|
283
|
+
Hash: <to be filled by the execute workflow>
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
Once the file is written:
|
|
287
|
+
> "Plan written to `.openlore/refactor-plan.md`. Review it, then run `/openlore-execute-refactor` to apply the changes."
|
|
288
|
+
|
|
289
|
+
---
|
|
290
|
+
|
|
291
|
+
## Absolute constraints
|
|
292
|
+
|
|
293
|
+
- **No code modifications** in this workflow
|
|
294
|
+
- Always read the source file to confirm exact line numbers
|
|
295
|
+
- Never leave a section empty or as "TBD"
|
|
296
|
+
- Each change in the plan must include a test gate and a ≤ 50-line scope
|
|
297
|
+
- Prefer candidates with higher coverage when scores are otherwise close
|
|
298
|
+
- If the user does not pick a target, default to the top candidate
|
|
@@ -0,0 +1,134 @@
|
|
|
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
|
+
---
|
|
7
|
+
|
|
8
|
+
# openlore: Review Changes
|
|
9
|
+
|
|
10
|
+
## When to use this skill
|
|
11
|
+
|
|
12
|
+
Trigger this skill whenever the user asks to **review, audit, or check the safety of recent changes**, with phrasings like:
|
|
13
|
+
- "review my changes"
|
|
14
|
+
- "what did I break?"
|
|
15
|
+
- "is this branch safe to merge?"
|
|
16
|
+
- "pre-PR check"
|
|
17
|
+
- "what's risky in this diff?"
|
|
18
|
+
- "check the blast radius of my changes"
|
|
19
|
+
- explicit command `/openlore-review-changes`
|
|
20
|
+
|
|
21
|
+
**No code is written.** Output is a risk-ranked review with a go/no-go recommendation.
|
|
22
|
+
|
|
23
|
+
---
|
|
24
|
+
|
|
25
|
+
## Step 1 — Confirm directory and base ref
|
|
26
|
+
|
|
27
|
+
Ask: which project? Diff against which base? (default: `main`)
|
|
28
|
+
|
|
29
|
+
Store as `$DIRECTORY` and `$BASE_REF`.
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Step 2 — Detect changed functions and risk scores
|
|
34
|
+
|
|
35
|
+
Call the openlore MCP tool `detect_changes` with:
|
|
36
|
+
```json
|
|
37
|
+
{"directory": "$DIRECTORY", "base": "$BASE_REF"}
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
The risk score is **multiplicative**: `likelihood × impact`.
|
|
41
|
+
- `likelihood` = how much was changed × how poorly covered it is (`"called"` tests count full; `"imported"`-only count 0.3×)
|
|
42
|
+
- `impact` = structural blast radius (log fanIn + distance-weighted transitive callers weighted by callType + external boundary calls)
|
|
43
|
+
|
|
44
|
+
A function with fanIn=0 calling nothing external scores 0 regardless of change size — correct; focus on non-zero scores.
|
|
45
|
+
|
|
46
|
+
Present a risk-ranked table:
|
|
47
|
+
|
|
48
|
+
| Rank | Function | File | riskScore | blastRadius | fanIn | testedBy |
|
|
49
|
+
|---|---|---|---|---|---|---|
|
|
50
|
+
|
|
51
|
+
Flag:
|
|
52
|
+
- `riskScore ≥ 5` → 🔴 HIGH — must inspect
|
|
53
|
+
- `riskScore 2–5` → 🟡 MEDIUM — inspect if time allows
|
|
54
|
+
- `riskScore < 2` → 🟢 LOW
|
|
55
|
+
|
|
56
|
+
---
|
|
57
|
+
|
|
58
|
+
## Step 3 — Deep-inspect each HIGH function
|
|
59
|
+
|
|
60
|
+
For each function with `riskScore ≥ 5`, call `get_minimal_context`:
|
|
61
|
+
```json
|
|
62
|
+
{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME"}
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
**What to read:**
|
|
66
|
+
|
|
67
|
+
- `function.riskLevel` — `"high"` means the tool expanded caller/callee lists to 24. All shown entries are in the blast radius.
|
|
68
|
+
- `callers[*].callType` — all `"awaited"` = async interface frozen; any signature change breaks every caller without a compile error in JS. Mixed = looser coupling.
|
|
69
|
+
- `callees[*].isExternal: true` — function touches an external boundary (HTTP/DB). Failures here propagate outward and may not be caught in unit tests.
|
|
70
|
+
- `testedBy[*].confidence` — `"called"` = direct test (strong safety net). `"imported"` = test file only imports the module; `vi.mock()` can neutralize it entirely. Only `"imported"` = effectively untested.
|
|
71
|
+
|
|
72
|
+
For each HIGH function, state:
|
|
73
|
+
```
|
|
74
|
+
$FUNCTION_NAME ($FILE):
|
|
75
|
+
Interface frozen? [yes — all callers await | no — mixed]
|
|
76
|
+
External boundary? [yes: $CALLEES | no]
|
|
77
|
+
Effective coverage: [strong (called) | weak (imported only) | none]
|
|
78
|
+
Verdict: [safe | needs direct tests first | coordinate with callers before merge]
|
|
79
|
+
```
|
|
80
|
+
|
|
81
|
+
---
|
|
82
|
+
|
|
83
|
+
## Step 4 — Check cluster density for non-safe HIGH functions
|
|
84
|
+
|
|
85
|
+
For any HIGH function whose verdict is not "safe":
|
|
86
|
+
```json
|
|
87
|
+
{"directory": "$DIRECTORY", "functionName": "$FUNCTION_NAME"}
|
|
88
|
+
// get_cluster
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
Read `stats.clusterDensity`:
|
|
92
|
+
|
|
93
|
+
| Density | Meaning | Action |
|
|
94
|
+
|---|---|---|
|
|
95
|
+
| < 0.05 | Sparse — shared utilities | Change isolated; safe to land independently |
|
|
96
|
+
| 0.05–0.15 | Moderate coupling | Review `internalCallGraph` for transitively dependent functions |
|
|
97
|
+
| > 0.15 | Dense — tightly interwoven | Coordinate whole cluster; consider feature flag or staged rollout |
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Step 5 — Coverage gap check
|
|
102
|
+
|
|
103
|
+
For each HIGH or MEDIUM function with `testedBy` empty or all `"imported"`:
|
|
104
|
+
|
|
105
|
+
> "⚠️ `$FUNCTION_NAME` has no direct test coverage. Changes here are not caught by the test suite unless a test directly calls this function. Recommend adding a characterisation test before merging."
|
|
106
|
+
|
|
107
|
+
Suggest a concrete test scenario based on the function body from `get_minimal_context`.
|
|
108
|
+
|
|
109
|
+
---
|
|
110
|
+
|
|
111
|
+
## Step 6 — Output the review
|
|
112
|
+
|
|
113
|
+
### Summary
|
|
114
|
+
- Total changed: N | HIGH: N | MEDIUM: N | Coverage gaps: N
|
|
115
|
+
|
|
116
|
+
### Risk table
|
|
117
|
+
(from Step 2)
|
|
118
|
+
|
|
119
|
+
### Function verdicts (HIGH only)
|
|
120
|
+
(from Steps 3–4)
|
|
121
|
+
|
|
122
|
+
### Go / No-Go
|
|
123
|
+
- ✅ **Safe to merge** — no HIGH-risk uncovered functions
|
|
124
|
+
- ⚠️ **Merge with caution** — HIGH-risk functions exist but covered by direct tests
|
|
125
|
+
- 🛑 **Do not merge** — HIGH-risk uncovered functions with frozen interfaces or external boundaries
|
|
126
|
+
|
|
127
|
+
---
|
|
128
|
+
|
|
129
|
+
## Absolute constraints
|
|
130
|
+
|
|
131
|
+
- Never skip Step 3 for HIGH-risk functions — riskScore alone is not enough
|
|
132
|
+
- Always interpret `callType` — determines whether interface change is breaking
|
|
133
|
+
- Always interpret `testedBy.confidence` — `"imported"` is not strong coverage
|
|
134
|
+
- Do not recommend merging any function with `riskScore ≥ 5`, zero direct tests, and an external callee
|