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,291 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openlore-execute-refactor
|
|
3
|
+
description: Apply the refactoring plan produced by openlore-plan-refactor. Reads .openlore/refactor-plan.md and re-reads it before each change to stay on track. Requires a confirmed plan to exist before running.
|
|
4
|
+
license: MIT
|
|
5
|
+
compatibility: openlore MCP server
|
|
6
|
+
user-invocable: true
|
|
7
|
+
allowed-tools:
|
|
8
|
+
- use_mcp_tool
|
|
9
|
+
- read_file
|
|
10
|
+
- write_file
|
|
11
|
+
- str_replace_based_edit
|
|
12
|
+
- replace_in_file
|
|
13
|
+
- apply_diff
|
|
14
|
+
- run_command
|
|
15
|
+
- openlore-plan-refactor
|
|
16
|
+
---
|
|
17
|
+
|
|
18
|
+
# openlore: Execute Refactor
|
|
19
|
+
|
|
20
|
+
## When to use this skill
|
|
21
|
+
|
|
22
|
+
Trigger this skill when the user asks to **apply a refactoring plan**, with phrasings like:
|
|
23
|
+
- "apply the refactor plan"
|
|
24
|
+
- "execute the planned refactoring"
|
|
25
|
+
- explicit command `/openlore-execute-refactor`
|
|
26
|
+
|
|
27
|
+
**Prerequisite**: the `openlore-plan-refactor` skill must have been run and the plan confirmed.
|
|
28
|
+
The file `.openlore/refactor-plan.md` must exist.
|
|
29
|
+
|
|
30
|
+
---
|
|
31
|
+
|
|
32
|
+
## ⚠️ Fundamental principle — each change is a complete mini-development
|
|
33
|
+
|
|
34
|
+
Each change in the plan is treated as an **independent, self-contained development unit**.
|
|
35
|
+
The cycle for every single change, without exception:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
READ plan entry
|
|
39
|
+
→ EDIT (targeted tool, ≤ 50 lines touched)
|
|
40
|
+
→ DIFF (git diff --stat + git diff — verify no lost code)
|
|
41
|
+
→ TEST (run the test gate from the plan)
|
|
42
|
+
├─ green → mark ✅ in plan, move to next change
|
|
43
|
+
└─ red → git checkout HEAD -- <file>
|
|
44
|
+
diagnose the failure
|
|
45
|
+
retry from EDIT (attempt 2, then 3)
|
|
46
|
+
if still red after 3 attempts → STOP (see circuit-breaker below)
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
**Never accumulate broken state. Never skip the test gate. Never batch two changes before testing.**
|
|
50
|
+
|
|
51
|
+
### Circuit-breaker — 3 failed attempts
|
|
52
|
+
|
|
53
|
+
If a change fails its test gate 3 times in a row, stop immediately and report:
|
|
54
|
+
|
|
55
|
+
> "Change N (`<label>`) failed after 3 attempts. The working tree has been restored to the last green state.
|
|
56
|
+
> Options:
|
|
57
|
+
> a) Split this change into smaller sub-changes (≤ 50 lines each) and update the plan
|
|
58
|
+
> b) Return to planning (`/openlore-plan-refactor`) to redesign this step
|
|
59
|
+
> c) Skip this change and continue — note the acceptance criteria may not be fully met"
|
|
60
|
+
|
|
61
|
+
Do not attempt a 4th retry without explicit user instruction.
|
|
62
|
+
|
|
63
|
+
---
|
|
64
|
+
|
|
65
|
+
## Step 1 — Read the plan
|
|
66
|
+
|
|
67
|
+
Read `.openlore/refactor-plan.md` from the project directory.
|
|
68
|
+
|
|
69
|
+
If the file does not exist, stop immediately:
|
|
70
|
+
> "No refactor plan found at `.openlore/refactor-plan.md`. Please run `/openlore-plan-refactor` first."
|
|
71
|
+
|
|
72
|
+
Extract and display a summary:
|
|
73
|
+
- Target function, file, and line range
|
|
74
|
+
- Strategy and risk score
|
|
75
|
+
- Number of changes planned
|
|
76
|
+
- Test command
|
|
77
|
+
- Acceptance criteria
|
|
78
|
+
|
|
79
|
+
**Ask the user to confirm before proceeding.**
|
|
80
|
+
|
|
81
|
+
> **Execution mode**: once confirmed, execute all changes in the plan **without asking for permission between steps**. The only valid reasons to pause mid-execution are: (a) a test fails and 3 retries are exhausted (circuit-breaker), (b) you detect potentially lost code (`git diff` shows far more deletions than additions with no new file created), or (c) Step 6 is explicitly requested. Any other pause is non-compliant with this skill.
|
|
82
|
+
|
|
83
|
+
---
|
|
84
|
+
|
|
85
|
+
## Step 2 — Establish a green baseline
|
|
86
|
+
|
|
87
|
+
Confirm the test suite is passing using the test command from the plan.
|
|
88
|
+
|
|
89
|
+
**If tests are already failing, stop and tell the user. Under no circumstances continue on a red baseline — not even if the failures appear pre-existing.** Pre-existing failures must be fixed or explicitly acknowledged in the plan before any refactoring starts. Do not offer to "proceed at your own risk" on a red baseline.
|
|
90
|
+
|
|
91
|
+
If a coverage tool is available, run it on the target file and compare against the coverage baseline in the plan.
|
|
92
|
+
|
|
93
|
+
**Coverage thresholds:**
|
|
94
|
+
|
|
95
|
+
| Coverage on files to touch | Recommendation |
|
|
96
|
+
|---|---|
|
|
97
|
+
| ≥ 70% lines | Safe — proceed |
|
|
98
|
+
| 40–69% lines | Caution — write characterisation tests first |
|
|
99
|
+
| < 40% lines | **Stop.** Strongly recommend writing tests first |
|
|
100
|
+
| 0% (no tests) | **Blocked.** Propose a minimal test harness, then restart |
|
|
101
|
+
|
|
102
|
+
If coverage is below 40%:
|
|
103
|
+
> "Coverage on the target file is X%. Refactoring without test coverage risks introducing silent regressions. Would you like me to suggest test cases based on the function signatures, or do you want to proceed at your own risk?"
|
|
104
|
+
|
|
105
|
+
Only continue past this point with **explicit user confirmation**.
|
|
106
|
+
|
|
107
|
+
**Large file warning**: if the target function spans more than 300 lines:
|
|
108
|
+
> "This function is X lines long. Devstral Small 2 may lose code when editing files of this size in a single pass. The plan must decompose each change to ≤ 50 lines. Verify the plan respects this before continuing."
|
|
109
|
+
|
|
110
|
+
---
|
|
111
|
+
|
|
112
|
+
## Step 3 — Set the restore point
|
|
113
|
+
|
|
114
|
+
Verify the working tree is clean:
|
|
115
|
+
|
|
116
|
+
```bash
|
|
117
|
+
git status # must show: nothing to commit, working tree clean
|
|
118
|
+
git log --oneline -1 # note this commit hash — your restore point
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
If there are uncommitted changes, stop and ask the user to commit or stash them first.
|
|
122
|
+
|
|
123
|
+
Fill in the `Restore point` section of `.openlore/refactor-plan.md` with the current commit hash.
|
|
124
|
+
|
|
125
|
+
---
|
|
126
|
+
|
|
127
|
+
## Step 4 — Apply changes (mini-development loop)
|
|
128
|
+
|
|
129
|
+
Before applying the first change, record the refactoring decision:
|
|
130
|
+
|
|
131
|
+
```xml
|
|
132
|
+
<use_mcp_tool>
|
|
133
|
+
<server_name>openlore</server_name>
|
|
134
|
+
<tool_name>record_decision</tool_name>
|
|
135
|
+
<arguments>{
|
|
136
|
+
"directory": "$DIRECTORY",
|
|
137
|
+
"title": "Refactor $TARGET_FUNCTION via $STRATEGY",
|
|
138
|
+
"rationale": "$PRIMARY_REASON from the plan's Why section",
|
|
139
|
+
"consequences": "Callers unchanged; complexity distributed across extracted helpers",
|
|
140
|
+
"affectedFiles": ["$TARGET_FILE"]
|
|
141
|
+
}</arguments>
|
|
142
|
+
</use_mcp_tool>
|
|
143
|
+
```
|
|
144
|
+
|
|
145
|
+
Also call `record_decision` for any unexpected architectural choice that emerges mid-refactor (new module boundary discovered, shared interface change required, dependency introduced).
|
|
146
|
+
|
|
147
|
+
For **each change** in the plan, execute the full mini-development cycle below.
|
|
148
|
+
Do not move to the next change until the current one is marked ✅.
|
|
149
|
+
|
|
150
|
+
### Before each change
|
|
151
|
+
|
|
152
|
+
Re-read `.openlore/refactor-plan.md` to confirm:
|
|
153
|
+
- Which change you are on (check for ✅ markers)
|
|
154
|
+
- Exactly what to extract, where to put it, and which call sites to update
|
|
155
|
+
- The test gate command for this specific change
|
|
156
|
+
|
|
157
|
+
### Editing tool rule
|
|
158
|
+
|
|
159
|
+
Always prefer a targeted edit tool (`replace_in_file`, `str_replace_based_edit`, `apply_diff`) over a full-file rewrite (`write_to_file`). Only use `write_to_file` if the file is under 100 lines. If a change seems to require `write_to_file` on a larger file, stop and split it into smaller targeted edits.
|
|
160
|
+
|
|
161
|
+
**Devstral Small 2 constraint**: each edit must touch a contiguous block of at most **50 lines**. If the planned change exceeds this, split it into sub-changes before proceeding — do not attempt an oversized edit.
|
|
162
|
+
|
|
163
|
+
### Mini-development cycle (execute for each change)
|
|
164
|
+
|
|
165
|
+
**Attempt counter**: reset to 1 at the start of each new change.
|
|
166
|
+
|
|
167
|
+
**1 — READ**
|
|
168
|
+
Re-read the source file around the lines to extract. Do not rely on memory or on earlier reads — the file may have changed from previous edits.
|
|
169
|
+
|
|
170
|
+
**2 — EDIT**
|
|
171
|
+
- Extract or move the identified block (≤ 50 lines)
|
|
172
|
+
- Place it in the target file and target class specified in the plan
|
|
173
|
+
- If the target file is new, create it with only the extracted code
|
|
174
|
+
- Update all call sites listed in the plan
|
|
175
|
+
|
|
176
|
+
**3 — DIFF**
|
|
177
|
+
Verify the edit before running tests:
|
|
178
|
+
```bash
|
|
179
|
+
git diff --stat # only the expected files should appear
|
|
180
|
+
git diff # scan deleted lines (−) and confirm each removal is
|
|
181
|
+
# intentional — moved, not silently dropped.
|
|
182
|
+
# If deleted lines >> added lines with no new file
|
|
183
|
+
# created, code was likely lost — abort immediately.
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
If the diff shows unexpected files or lost code (deletions >> additions, no new file):
|
|
187
|
+
```bash
|
|
188
|
+
git checkout HEAD -- <file>
|
|
189
|
+
```
|
|
190
|
+
Then re-examine the plan and retry from step 2 (counts as an attempt).
|
|
191
|
+
|
|
192
|
+
**4 — TEST**
|
|
193
|
+
Run the test gate from the plan entry. This is the exact command specified for this change.
|
|
194
|
+
|
|
195
|
+
```
|
|
196
|
+
Test result?
|
|
197
|
+
├─ GREEN → go to step 5 (mark done)
|
|
198
|
+
└─ RED → git checkout HEAD -- <file>
|
|
199
|
+
increment attempt counter
|
|
200
|
+
if attempts < 3:
|
|
201
|
+
diagnose the failure, adjust the edit, go back to step 2
|
|
202
|
+
if attempts == 3:
|
|
203
|
+
STOP — trigger circuit-breaker (see above)
|
|
204
|
+
```
|
|
205
|
+
|
|
206
|
+
**5 — MARK DONE**
|
|
207
|
+
Append `✅` to the change heading in `.openlore/refactor-plan.md`, then proceed to the next change.
|
|
208
|
+
|
|
209
|
+
---
|
|
210
|
+
|
|
211
|
+
## Step 5 — Verify improvement
|
|
212
|
+
|
|
213
|
+
```xml
|
|
214
|
+
<use_mcp_tool>
|
|
215
|
+
<server_name>openlore</server_name>
|
|
216
|
+
<tool_name>analyze_codebase</tool_name>
|
|
217
|
+
<arguments>{"directory": "$DIRECTORY", "force": true}</arguments>
|
|
218
|
+
</use_mcp_tool>
|
|
219
|
+
|
|
220
|
+
<use_mcp_tool>
|
|
221
|
+
<server_name>openlore</server_name>
|
|
222
|
+
<tool_name>get_refactor_report</tool_name>
|
|
223
|
+
<arguments>{"directory": "$DIRECTORY"}</arguments>
|
|
224
|
+
</use_mcp_tool>
|
|
225
|
+
```
|
|
226
|
+
|
|
227
|
+
Check each acceptance criterion from the plan:
|
|
228
|
+
- Priority score dropped below the target
|
|
229
|
+
- Function is no longer in the top-5 list
|
|
230
|
+
- Full test suite passes
|
|
231
|
+
|
|
232
|
+
If not, investigate and iterate (add a new change to the plan if needed, respecting the ≤ 50 line constraint).
|
|
233
|
+
|
|
234
|
+
Run the full test suite one final time to confirm the refactored state is clean.
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Step 6 (optional — requires openlore generate to have been run)
|
|
239
|
+
|
|
240
|
+
> ⚠️ This step proposes irreversible changes (deletions, renames). Do not apply anything without explicit user confirmation at each sub-step.
|
|
241
|
+
|
|
242
|
+
### 6a — Dead code: orphan functions
|
|
243
|
+
|
|
244
|
+
```xml
|
|
245
|
+
<use_mcp_tool>
|
|
246
|
+
<server_name>openlore</server_name>
|
|
247
|
+
<tool_name>get_mapping</tool_name>
|
|
248
|
+
<arguments>{"directory": "$DIRECTORY", "orphansOnly": true}</arguments>
|
|
249
|
+
</use_mcp_tool>
|
|
250
|
+
```
|
|
251
|
+
|
|
252
|
+
Present the orphan list (kind `function` or `class` only). For each one, check:
|
|
253
|
+
- Is it exported and potentially consumed by external code?
|
|
254
|
+
- Is it re-exported from an index file?
|
|
255
|
+
- Was it simply missed by the LLM?
|
|
256
|
+
|
|
257
|
+
**Do not delete anything without the user explicitly approving each function.**
|
|
258
|
+
|
|
259
|
+
### 6b — Naming alignment: spec vocabulary vs actual names
|
|
260
|
+
|
|
261
|
+
```xml
|
|
262
|
+
<use_mcp_tool>
|
|
263
|
+
<server_name>openlore</server_name>
|
|
264
|
+
<tool_name>get_mapping</tool_name>
|
|
265
|
+
<arguments>{"directory": "$DIRECTORY"}</arguments>
|
|
266
|
+
</use_mcp_tool>
|
|
267
|
+
```
|
|
268
|
+
|
|
269
|
+
Build a table of mismatches and present it before touching any code:
|
|
270
|
+
|
|
271
|
+
| Current name | Proposed name | File | Confidence |
|
|
272
|
+
|---|---|---|---|
|
|
273
|
+
|
|
274
|
+
Only renames with `confidence: "llm"` should be proposed automatically. Flag `confidence: "heuristic"` entries for manual verification first.
|
|
275
|
+
|
|
276
|
+
**Wait for explicit user approval of the full rename table before applying any change. Apply renames one file at a time, run tests after each, and respect the ≤ 50-line edit constraint.**
|
|
277
|
+
|
|
278
|
+
---
|
|
279
|
+
|
|
280
|
+
## Absolute constraints
|
|
281
|
+
|
|
282
|
+
- Always re-read `.openlore/refactor-plan.md` before each change
|
|
283
|
+
- Never use `write_to_file` on a file > 100 lines
|
|
284
|
+
- Never accumulate broken state — restore immediately on any test failure
|
|
285
|
+
- Always verify the diff before running tests
|
|
286
|
+
- Never proceed to Step 6 without explicit user request
|
|
287
|
+
- Always flag potentially lost code (deleted lines >> added lines with no new file created)
|
|
288
|
+
- Never ask for confirmation between steps — only pause for circuit-breaker or lost-code signals
|
|
289
|
+
- Never continue on a red baseline, regardless of whether failures appear pre-existing
|
|
290
|
+
- Never attempt more than 3 retries on a single change without user input
|
|
291
|
+
- Each edit must touch ≤ 50 contiguous lines — split if needed, never skip this constraint
|
|
@@ -0,0 +1,245 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: openlore-generate
|
|
3
|
+
description: Reverse-engineer OpenSpec specifications from an existing codebase. Performs "code archaeology" — extracting what code actually does and documenting it as structured OpenSpec specs across all detected domains.
|
|
4
|
+
license: MIT
|
|
5
|
+
version: 1.0.0
|
|
6
|
+
author: Clay Good
|
|
7
|
+
repository: https://github.com/clay-good/openlore
|
|
8
|
+
compatibility: openlore MCP server
|
|
9
|
+
user-invocable: true
|
|
10
|
+
allowed-tools:
|
|
11
|
+
- read_file
|
|
12
|
+
- write_file
|
|
13
|
+
- list_directory
|
|
14
|
+
- run_command
|
|
15
|
+
- use_mcp_tool
|
|
16
|
+
- openlore-analyze-codebase
|
|
17
|
+
- openlore-plan-refactor
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# openlore: Generate OpenSpec Specifications
|
|
21
|
+
|
|
22
|
+
## When to use this skill
|
|
23
|
+
|
|
24
|
+
Trigger this skill when the user asks to **generate specs from an existing codebase**, with phrasings like:
|
|
25
|
+
- "run openlore on this codebase"
|
|
26
|
+
- "reverse-engineer the specs"
|
|
27
|
+
- "generate OpenSpec from my code"
|
|
28
|
+
- "document what this code does"
|
|
29
|
+
- explicit command `/openlore-generate`
|
|
30
|
+
|
|
31
|
+
---
|
|
32
|
+
|
|
33
|
+
## Philosophy
|
|
34
|
+
|
|
35
|
+
- **Archaeology over Creativity**: document what the code ACTUALLY does, not what you imagine it should do
|
|
36
|
+
- **Evidence-based**: every requirement and scenario must trace back to actual code
|
|
37
|
+
- **OpenSpec-native**: output follows OpenSpec conventions exactly
|
|
38
|
+
|
|
39
|
+
---
|
|
40
|
+
|
|
41
|
+
## Phase 1 — Codebase Survey
|
|
42
|
+
|
|
43
|
+
Understand the project structure before touching any files.
|
|
44
|
+
|
|
45
|
+
**1. Identify project type** by checking for:
|
|
46
|
+
|
|
47
|
+
| File | Stack |
|
|
48
|
+
|---|---|
|
|
49
|
+
| `package.json` | Node.js / TypeScript |
|
|
50
|
+
| `pyproject.toml` / `setup.py` | Python |
|
|
51
|
+
| `go.mod` | Go |
|
|
52
|
+
| `Cargo.toml` | Rust |
|
|
53
|
+
| `pom.xml` / `build.gradle` | Java |
|
|
54
|
+
|
|
55
|
+
**2. Find high-value files** — prioritize:
|
|
56
|
+
- Schema / model files (entities, types, interfaces)
|
|
57
|
+
- Service files (business logic)
|
|
58
|
+
- Route / controller files (API surface)
|
|
59
|
+
- Config files (settings, environment)
|
|
60
|
+
- Entry points (main, index, app)
|
|
61
|
+
|
|
62
|
+
**3. Identify domains** by looking for:
|
|
63
|
+
- Directory structure (`src/users/`, `src/orders/`, etc.)
|
|
64
|
+
- File naming patterns (`user-service`, `order-controller`)
|
|
65
|
+
- Import clusters (files that import each other heavily)
|
|
66
|
+
|
|
67
|
+
**4. Detect frameworks** from dependencies and patterns:
|
|
68
|
+
- Web: Express, NestJS, FastAPI, Django, etc.
|
|
69
|
+
- Database: PostgreSQL, MongoDB, etc.
|
|
70
|
+
- Auth: JWT, OAuth, etc.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## Phase 2 — Deep Analysis
|
|
75
|
+
|
|
76
|
+
For each identified domain, analyze the relevant files.
|
|
77
|
+
|
|
78
|
+
**Extract entities:**
|
|
79
|
+
- What data structures exist?
|
|
80
|
+
- What are their properties and types?
|
|
81
|
+
- How do they relate to each other?
|
|
82
|
+
|
|
83
|
+
**Extract behaviors:**
|
|
84
|
+
- What operations can be performed?
|
|
85
|
+
- What are the business rules / validations?
|
|
86
|
+
- What side effects occur (emails, payments, etc.)?
|
|
87
|
+
|
|
88
|
+
**Extract API surface** (if applicable):
|
|
89
|
+
- What endpoints exist?
|
|
90
|
+
- What are the request / response shapes?
|
|
91
|
+
- What authentication is required?
|
|
92
|
+
|
|
93
|
+
---
|
|
94
|
+
|
|
95
|
+
## Phase 3 — Generate OpenSpec Specifications
|
|
96
|
+
|
|
97
|
+
Create the OpenSpec directory structure if it doesn't exist:
|
|
98
|
+
|
|
99
|
+
```
|
|
100
|
+
openspec/
|
|
101
|
+
├── config.yaml
|
|
102
|
+
└── specs/
|
|
103
|
+
├── overview/
|
|
104
|
+
│ └── spec.md
|
|
105
|
+
├── {domain-1}/
|
|
106
|
+
│ └── spec.md
|
|
107
|
+
├── {domain-2}/
|
|
108
|
+
│ └── spec.md
|
|
109
|
+
└── architecture/
|
|
110
|
+
└── spec.md
|
|
111
|
+
```
|
|
112
|
+
|
|
113
|
+
### Spec file format
|
|
114
|
+
|
|
115
|
+
Each `spec.md` MUST follow this exact format:
|
|
116
|
+
|
|
117
|
+
```markdown
|
|
118
|
+
# {Domain} Specification
|
|
119
|
+
|
|
120
|
+
> Generated by openlore on {date}
|
|
121
|
+
> Source files: {list of files analyzed}
|
|
122
|
+
|
|
123
|
+
## Purpose
|
|
124
|
+
|
|
125
|
+
{2-3 sentences describing what this domain handles}
|
|
126
|
+
|
|
127
|
+
## Requirements
|
|
128
|
+
|
|
129
|
+
### Requirement: {RequirementName}
|
|
130
|
+
|
|
131
|
+
{The system SHALL/MUST/SHOULD do X...}
|
|
132
|
+
|
|
133
|
+
Use RFC 2119 keywords:
|
|
134
|
+
- **SHALL/MUST**: Required behavior
|
|
135
|
+
- **SHOULD**: Recommended behavior
|
|
136
|
+
- **MAY**: Optional behavior
|
|
137
|
+
|
|
138
|
+
#### Scenario: {ScenarioName}
|
|
139
|
+
- **GIVEN** {precondition}
|
|
140
|
+
- **WHEN** {action}
|
|
141
|
+
- **THEN** {expected outcome}
|
|
142
|
+
|
|
143
|
+
## Technical Notes
|
|
144
|
+
|
|
145
|
+
- **Implementation**: `{file paths}`
|
|
146
|
+
- **Dependencies**: {related domains/services}
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Critical formatting rules
|
|
150
|
+
|
|
151
|
+
1. Requirements use RFC 2119 keywords (SHALL, MUST, SHOULD, MAY)
|
|
152
|
+
2. Scenarios use exactly 4 hashtags (`####`)
|
|
153
|
+
3. Scenarios follow Given/When/Then format with **bold** labels
|
|
154
|
+
4. No delta markers (ADDED, MODIFIED, REMOVED) — these are baseline specs
|
|
155
|
+
|
|
156
|
+
---
|
|
157
|
+
|
|
158
|
+
## Phase 4 — Update OpenSpec Config
|
|
159
|
+
|
|
160
|
+
**If `openspec/config.yaml` exists**, preserve all existing content and append:
|
|
161
|
+
|
|
162
|
+
```yaml
|
|
163
|
+
# Auto-detected by openlore
|
|
164
|
+
openlore:
|
|
165
|
+
generatedAt: "{timestamp}"
|
|
166
|
+
domains:
|
|
167
|
+
- {domain-1}
|
|
168
|
+
- {domain-2}
|
|
169
|
+
```
|
|
170
|
+
|
|
171
|
+
**If it doesn't exist**, create a minimal config:
|
|
172
|
+
|
|
173
|
+
```yaml
|
|
174
|
+
schema: spec-driven
|
|
175
|
+
context: |
|
|
176
|
+
{Brief project description based on analysis}
|
|
177
|
+
|
|
178
|
+
Tech stack: {detected technologies}
|
|
179
|
+
Architecture: {detected pattern}
|
|
180
|
+
```
|
|
181
|
+
|
|
182
|
+
---
|
|
183
|
+
|
|
184
|
+
## Phase 5 — Drift Detection
|
|
185
|
+
|
|
186
|
+
When specs already exist and code has changed, check for **spec drift** — divergence between the codebase and its specifications.
|
|
187
|
+
|
|
188
|
+
**When to check:** before committing code, when reviewing PRs, or when explicitly asked to validate specs.
|
|
189
|
+
|
|
190
|
+
**Process:**
|
|
191
|
+
|
|
192
|
+
1. **Identify what changed** — use git to find added, modified, deleted, or renamed source files compared to the base branch. Filter out: test files, generated files, lock files, static assets, CI configs.
|
|
193
|
+
|
|
194
|
+
2. **Map changes to specs** — for each changed file, determine which spec domain covers it by checking:
|
|
195
|
+
- `> Source files:` header in each `spec.md`
|
|
196
|
+
- `**Implementation**:` references in Technical Notes
|
|
197
|
+
- Directory structure inference (e.g. `src/auth/` → auth domain)
|
|
198
|
+
|
|
199
|
+
3. **Detect four categories of drift:**
|
|
200
|
+
|
|
201
|
+
| Category | Meaning |
|
|
202
|
+
|---|---|
|
|
203
|
+
| **Gap** | Code changed but its spec was not updated |
|
|
204
|
+
| **Stale** | Spec references a deleted or renamed file |
|
|
205
|
+
| **Uncovered** | New source file has no matching spec domain |
|
|
206
|
+
| **Orphaned Spec** | Spec declares source files that no longer exist |
|
|
207
|
+
|
|
208
|
+
4. **Report** each issue with: affected file, domain, and a suggested resolution.
|
|
209
|
+
|
|
210
|
+
**CLI shorthand:** `openlore drift` runs this check. Use `openlore drift --install-hook` to add it as a git pre-commit hook.
|
|
211
|
+
|
|
212
|
+
---
|
|
213
|
+
|
|
214
|
+
## Output Checklist
|
|
215
|
+
|
|
216
|
+
Before finishing, verify every item:
|
|
217
|
+
|
|
218
|
+
- [ ] `openspec/specs/overview/spec.md` exists with system summary
|
|
219
|
+
- [ ] Each domain has `openspec/specs/{domain}/spec.md`
|
|
220
|
+
- [ ] `openspec/specs/architecture/spec.md` describes system structure
|
|
221
|
+
- [ ] All requirements use RFC 2119 keywords
|
|
222
|
+
- [ ] All scenarios use Given/When/Then format
|
|
223
|
+
- [ ] `openspec/config.yaml` is created or updated
|
|
224
|
+
- [ ] No spec drift — run `openlore drift` to verify specs match code
|
|
225
|
+
|
|
226
|
+
---
|
|
227
|
+
|
|
228
|
+
## Absolute constraints
|
|
229
|
+
|
|
230
|
+
- **Never invent requirements** — every item must be traceable to actual code
|
|
231
|
+
- Always preserve existing `openspec/config.yaml` content before appending
|
|
232
|
+
- Never use delta markers (ADDED, MODIFIED, REMOVED) in baseline specs
|
|
233
|
+
- Scenarios must use exactly 4 hashtags — never 3 or 5
|
|
234
|
+
- RFC 2119 keywords (SHALL, MUST, SHOULD, MAY) must be uppercase
|
|
235
|
+
|
|
236
|
+
---
|
|
237
|
+
|
|
238
|
+
## Suggested next steps after generation
|
|
239
|
+
|
|
240
|
+
Report what was created, then suggest:
|
|
241
|
+
- `openspec validate --all` — check spec structure
|
|
242
|
+
- `openlore drift --install-hook` — catch future drift automatically
|
|
243
|
+
- `openspec list --specs` — see all generated specs
|
|
244
|
+
- Manual review and refinement of generated specs
|
|
245
|
+
- Run `/openlore-plan-refactor` to identify refactoring targets now that specs exist
|