@dragonflymcp/plugin 1.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/.claude-plugin/plugin.json +26 -0
- package/LICENSE +21 -0
- package/README.md +126 -0
- package/dist/core/annotations.d.ts +71 -0
- package/dist/core/annotations.d.ts.map +1 -0
- package/dist/core/annotations.js +61 -0
- package/dist/core/annotations.js.map +1 -0
- package/dist/core/config.d.ts +66 -0
- package/dist/core/config.d.ts.map +1 -0
- package/dist/core/config.js +131 -0
- package/dist/core/config.js.map +1 -0
- package/dist/core/dispatcher.d.ts +77 -0
- package/dist/core/dispatcher.d.ts.map +1 -0
- package/dist/core/dispatcher.js +132 -0
- package/dist/core/dispatcher.js.map +1 -0
- package/dist/core/server.d.ts +24 -0
- package/dist/core/server.d.ts.map +1 -0
- package/dist/core/server.js +41 -0
- package/dist/core/server.js.map +1 -0
- package/dist/core/store.d.ts +91 -0
- package/dist/core/store.d.ts.map +1 -0
- package/dist/core/store.js +157 -0
- package/dist/core/store.js.map +1 -0
- package/dist/core/types.d.ts +128 -0
- package/dist/core/types.d.ts.map +1 -0
- package/dist/core/types.js +5 -0
- package/dist/core/types.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +81 -0
- package/dist/index.js.map +1 -0
- package/dist/test-utils/store-harness.d.ts +41 -0
- package/dist/test-utils/store-harness.d.ts.map +1 -0
- package/dist/test-utils/store-harness.js +61 -0
- package/dist/test-utils/store-harness.js.map +1 -0
- package/dist/tools/analytics/aggregators.d.ts +18 -0
- package/dist/tools/analytics/aggregators.d.ts.map +1 -0
- package/dist/tools/analytics/aggregators.js +260 -0
- package/dist/tools/analytics/aggregators.js.map +1 -0
- package/dist/tools/analytics/aggregators.test.d.ts +2 -0
- package/dist/tools/analytics/aggregators.test.d.ts.map +1 -0
- package/dist/tools/analytics/aggregators.test.js +177 -0
- package/dist/tools/analytics/aggregators.test.js.map +1 -0
- package/dist/tools/analytics/drift.d.ts +15 -0
- package/dist/tools/analytics/drift.d.ts.map +1 -0
- package/dist/tools/analytics/drift.js +135 -0
- package/dist/tools/analytics/drift.js.map +1 -0
- package/dist/tools/analytics/drift.test.d.ts +2 -0
- package/dist/tools/analytics/drift.test.d.ts.map +1 -0
- package/dist/tools/analytics/drift.test.js +99 -0
- package/dist/tools/analytics/drift.test.js.map +1 -0
- package/dist/tools/analytics/index.d.ts +10 -0
- package/dist/tools/analytics/index.d.ts.map +1 -0
- package/dist/tools/analytics/index.js +192 -0
- package/dist/tools/analytics/index.js.map +1 -0
- package/dist/tools/analytics/learner.d.ts +29 -0
- package/dist/tools/analytics/learner.d.ts.map +1 -0
- package/dist/tools/analytics/learner.js +135 -0
- package/dist/tools/analytics/learner.js.map +1 -0
- package/dist/tools/analytics/learner.test.d.ts +2 -0
- package/dist/tools/analytics/learner.test.d.ts.map +1 -0
- package/dist/tools/analytics/learner.test.js +118 -0
- package/dist/tools/analytics/learner.test.js.map +1 -0
- package/dist/tools/analytics/observe.d.ts +22 -0
- package/dist/tools/analytics/observe.d.ts.map +1 -0
- package/dist/tools/analytics/observe.js +143 -0
- package/dist/tools/analytics/observe.js.map +1 -0
- package/dist/tools/analytics/observe.test.d.ts +2 -0
- package/dist/tools/analytics/observe.test.d.ts.map +1 -0
- package/dist/tools/analytics/observe.test.js +95 -0
- package/dist/tools/analytics/observe.test.js.map +1 -0
- package/dist/tools/analytics/store.d.ts +29 -0
- package/dist/tools/analytics/store.d.ts.map +1 -0
- package/dist/tools/analytics/store.js +192 -0
- package/dist/tools/analytics/store.js.map +1 -0
- package/dist/tools/analytics/types.d.ts +290 -0
- package/dist/tools/analytics/types.d.ts.map +1 -0
- package/dist/tools/analytics/types.js +7 -0
- package/dist/tools/analytics/types.js.map +1 -0
- package/dist/tools/ast/index.d.ts +8 -0
- package/dist/tools/ast/index.d.ts.map +1 -0
- package/dist/tools/ast/index.js +242 -0
- package/dist/tools/ast/index.js.map +1 -0
- package/dist/tools/ast/indexer.d.ts +41 -0
- package/dist/tools/ast/indexer.d.ts.map +1 -0
- package/dist/tools/ast/indexer.js +617 -0
- package/dist/tools/ast/indexer.js.map +1 -0
- package/dist/tools/ast/store.d.ts +87 -0
- package/dist/tools/ast/store.d.ts.map +1 -0
- package/dist/tools/ast/store.js +280 -0
- package/dist/tools/ast/store.js.map +1 -0
- package/dist/tools/ast/store.test.d.ts +6 -0
- package/dist/tools/ast/store.test.d.ts.map +1 -0
- package/dist/tools/ast/store.test.js +257 -0
- package/dist/tools/ast/store.test.js.map +1 -0
- package/dist/tools/bridge/bridge.d.ts +37 -0
- package/dist/tools/bridge/bridge.d.ts.map +1 -0
- package/dist/tools/bridge/bridge.js +82 -0
- package/dist/tools/bridge/bridge.js.map +1 -0
- package/dist/tools/bridge/bridge.test.d.ts +2 -0
- package/dist/tools/bridge/bridge.test.d.ts.map +1 -0
- package/dist/tools/bridge/bridge.test.js +119 -0
- package/dist/tools/bridge/bridge.test.js.map +1 -0
- package/dist/tools/bridge/index.d.ts +8 -0
- package/dist/tools/bridge/index.d.ts.map +1 -0
- package/dist/tools/bridge/index.js +153 -0
- package/dist/tools/bridge/index.js.map +1 -0
- package/dist/tools/bridge/store.d.ts +45 -0
- package/dist/tools/bridge/store.d.ts.map +1 -0
- package/dist/tools/bridge/store.js +307 -0
- package/dist/tools/bridge/store.js.map +1 -0
- package/dist/tools/bridge/store.test.d.ts +2 -0
- package/dist/tools/bridge/store.test.d.ts.map +1 -0
- package/dist/tools/bridge/store.test.js +180 -0
- package/dist/tools/bridge/store.test.js.map +1 -0
- package/dist/tools/bridge/types.d.ts +44 -0
- package/dist/tools/bridge/types.d.ts.map +1 -0
- package/dist/tools/bridge/types.js +6 -0
- package/dist/tools/bridge/types.js.map +1 -0
- package/dist/tools/evolve/algorithm.d.ts +33 -0
- package/dist/tools/evolve/algorithm.d.ts.map +1 -0
- package/dist/tools/evolve/algorithm.js +64 -0
- package/dist/tools/evolve/algorithm.js.map +1 -0
- package/dist/tools/evolve/algorithm.test.d.ts +6 -0
- package/dist/tools/evolve/algorithm.test.d.ts.map +1 -0
- package/dist/tools/evolve/algorithm.test.js +138 -0
- package/dist/tools/evolve/algorithm.test.js.map +1 -0
- package/dist/tools/evolve/index.d.ts +11 -0
- package/dist/tools/evolve/index.d.ts.map +1 -0
- package/dist/tools/evolve/index.js +300 -0
- package/dist/tools/evolve/index.js.map +1 -0
- package/dist/tools/evolve/store.d.ts +27 -0
- package/dist/tools/evolve/store.d.ts.map +1 -0
- package/dist/tools/evolve/store.js +147 -0
- package/dist/tools/evolve/store.js.map +1 -0
- package/dist/tools/evolve/store.test.d.ts +6 -0
- package/dist/tools/evolve/store.test.d.ts.map +1 -0
- package/dist/tools/evolve/store.test.js +162 -0
- package/dist/tools/evolve/store.test.js.map +1 -0
- package/dist/tools/evolve/types.d.ts +38 -0
- package/dist/tools/evolve/types.d.ts.map +1 -0
- package/dist/tools/evolve/types.js +6 -0
- package/dist/tools/evolve/types.js.map +1 -0
- package/dist/tools/framework/content-loader.d.ts +45 -0
- package/dist/tools/framework/content-loader.d.ts.map +1 -0
- package/dist/tools/framework/content-loader.js +258 -0
- package/dist/tools/framework/content-loader.js.map +1 -0
- package/dist/tools/framework/content-loader.test.d.ts +5 -0
- package/dist/tools/framework/content-loader.test.d.ts.map +1 -0
- package/dist/tools/framework/content-loader.test.js +262 -0
- package/dist/tools/framework/content-loader.test.js.map +1 -0
- package/dist/tools/framework/index.d.ts +30 -0
- package/dist/tools/framework/index.d.ts.map +1 -0
- package/dist/tools/framework/index.js +517 -0
- package/dist/tools/framework/index.js.map +1 -0
- package/dist/tools/framework/session.d.ts +85 -0
- package/dist/tools/framework/session.d.ts.map +1 -0
- package/dist/tools/framework/session.js +311 -0
- package/dist/tools/framework/session.js.map +1 -0
- package/dist/tools/framework/session.test.d.ts +5 -0
- package/dist/tools/framework/session.test.d.ts.map +1 -0
- package/dist/tools/framework/session.test.js +291 -0
- package/dist/tools/framework/session.test.js.map +1 -0
- package/dist/tools/framework/sync-evaluator.d.ts +41 -0
- package/dist/tools/framework/sync-evaluator.d.ts.map +1 -0
- package/dist/tools/framework/sync-evaluator.js +298 -0
- package/dist/tools/framework/sync-evaluator.js.map +1 -0
- package/dist/tools/framework/sync-evaluator.test.d.ts +5 -0
- package/dist/tools/framework/sync-evaluator.test.d.ts.map +1 -0
- package/dist/tools/framework/sync-evaluator.test.js +288 -0
- package/dist/tools/framework/sync-evaluator.test.js.map +1 -0
- package/dist/tools/framework/types.d.ts +279 -0
- package/dist/tools/framework/types.d.ts.map +1 -0
- package/dist/tools/framework/types.js +6 -0
- package/dist/tools/framework/types.js.map +1 -0
- package/dist/tools/framework/workflow-intelligence.d.ts +55 -0
- package/dist/tools/framework/workflow-intelligence.d.ts.map +1 -0
- package/dist/tools/framework/workflow-intelligence.js +199 -0
- package/dist/tools/framework/workflow-intelligence.js.map +1 -0
- package/dist/tools/framework/workflow-intelligence.test.d.ts +6 -0
- package/dist/tools/framework/workflow-intelligence.test.d.ts.map +1 -0
- package/dist/tools/framework/workflow-intelligence.test.js +257 -0
- package/dist/tools/framework/workflow-intelligence.test.js.map +1 -0
- package/dist/tools/framework/workflow-planner.d.ts +10 -0
- package/dist/tools/framework/workflow-planner.d.ts.map +1 -0
- package/dist/tools/framework/workflow-planner.js +214 -0
- package/dist/tools/framework/workflow-planner.js.map +1 -0
- package/dist/tools/framework/workflow-planner.test.d.ts +5 -0
- package/dist/tools/framework/workflow-planner.test.d.ts.map +1 -0
- package/dist/tools/framework/workflow-planner.test.js +137 -0
- package/dist/tools/framework/workflow-planner.test.js.map +1 -0
- package/dist/tools/knowledge/bridge.d.ts +34 -0
- package/dist/tools/knowledge/bridge.d.ts.map +1 -0
- package/dist/tools/knowledge/bridge.js +249 -0
- package/dist/tools/knowledge/bridge.js.map +1 -0
- package/dist/tools/knowledge/bridge.test.d.ts +5 -0
- package/dist/tools/knowledge/bridge.test.d.ts.map +1 -0
- package/dist/tools/knowledge/bridge.test.js +221 -0
- package/dist/tools/knowledge/bridge.test.js.map +1 -0
- package/dist/tools/knowledge/extractor.d.ts +22 -0
- package/dist/tools/knowledge/extractor.d.ts.map +1 -0
- package/dist/tools/knowledge/extractor.js +154 -0
- package/dist/tools/knowledge/extractor.js.map +1 -0
- package/dist/tools/knowledge/index.d.ts +12 -0
- package/dist/tools/knowledge/index.d.ts.map +1 -0
- package/dist/tools/knowledge/index.js +505 -0
- package/dist/tools/knowledge/index.js.map +1 -0
- package/dist/tools/knowledge/retrieval.d.ts +28 -0
- package/dist/tools/knowledge/retrieval.d.ts.map +1 -0
- package/dist/tools/knowledge/retrieval.js +164 -0
- package/dist/tools/knowledge/retrieval.js.map +1 -0
- package/dist/tools/knowledge/store.d.ts +96 -0
- package/dist/tools/knowledge/store.d.ts.map +1 -0
- package/dist/tools/knowledge/store.js +562 -0
- package/dist/tools/knowledge/store.js.map +1 -0
- package/dist/tools/knowledge/store.test.d.ts +6 -0
- package/dist/tools/knowledge/store.test.d.ts.map +1 -0
- package/dist/tools/knowledge/store.test.js +385 -0
- package/dist/tools/knowledge/store.test.js.map +1 -0
- package/dist/tools/knowledge/types.d.ts +168 -0
- package/dist/tools/knowledge/types.d.ts.map +1 -0
- package/dist/tools/knowledge/types.js +6 -0
- package/dist/tools/knowledge/types.js.map +1 -0
- package/dist/tools/memory/evolution.d.ts +31 -0
- package/dist/tools/memory/evolution.d.ts.map +1 -0
- package/dist/tools/memory/evolution.js +130 -0
- package/dist/tools/memory/evolution.js.map +1 -0
- package/dist/tools/memory/index.d.ts +11 -0
- package/dist/tools/memory/index.d.ts.map +1 -0
- package/dist/tools/memory/index.js +239 -0
- package/dist/tools/memory/index.js.map +1 -0
- package/dist/tools/memory/store.d.ts +75 -0
- package/dist/tools/memory/store.d.ts.map +1 -0
- package/dist/tools/memory/store.js +398 -0
- package/dist/tools/memory/store.js.map +1 -0
- package/dist/tools/memory/store.test.d.ts +6 -0
- package/dist/tools/memory/store.test.d.ts.map +1 -0
- package/dist/tools/memory/store.test.js +429 -0
- package/dist/tools/memory/store.test.js.map +1 -0
- package/dist/tools/memory/types.d.ts +171 -0
- package/dist/tools/memory/types.d.ts.map +1 -0
- package/dist/tools/memory/types.js +6 -0
- package/dist/tools/memory/types.js.map +1 -0
- package/dist/tools/pipeline/composer.d.ts +29 -0
- package/dist/tools/pipeline/composer.d.ts.map +1 -0
- package/dist/tools/pipeline/composer.js +225 -0
- package/dist/tools/pipeline/composer.js.map +1 -0
- package/dist/tools/pipeline/composer.test.d.ts +2 -0
- package/dist/tools/pipeline/composer.test.d.ts.map +1 -0
- package/dist/tools/pipeline/composer.test.js +162 -0
- package/dist/tools/pipeline/composer.test.js.map +1 -0
- package/dist/tools/pipeline/index.d.ts +8 -0
- package/dist/tools/pipeline/index.d.ts.map +1 -0
- package/dist/tools/pipeline/index.js +102 -0
- package/dist/tools/pipeline/index.js.map +1 -0
- package/dist/tools/pipeline/planner.d.ts +10 -0
- package/dist/tools/pipeline/planner.d.ts.map +1 -0
- package/dist/tools/pipeline/planner.js +147 -0
- package/dist/tools/pipeline/planner.js.map +1 -0
- package/dist/tools/pipeline/planner.test.d.ts +2 -0
- package/dist/tools/pipeline/planner.test.d.ts.map +1 -0
- package/dist/tools/pipeline/planner.test.js +96 -0
- package/dist/tools/pipeline/planner.test.js.map +1 -0
- package/dist/tools/pipeline/preconditions.d.ts +14 -0
- package/dist/tools/pipeline/preconditions.d.ts.map +1 -0
- package/dist/tools/pipeline/preconditions.js +65 -0
- package/dist/tools/pipeline/preconditions.js.map +1 -0
- package/dist/tools/pipeline/preconditions.test.d.ts +2 -0
- package/dist/tools/pipeline/preconditions.test.d.ts.map +1 -0
- package/dist/tools/pipeline/preconditions.test.js +74 -0
- package/dist/tools/pipeline/preconditions.test.js.map +1 -0
- package/dist/tools/pipeline/types.d.ts +105 -0
- package/dist/tools/pipeline/types.d.ts.map +1 -0
- package/dist/tools/pipeline/types.js +6 -0
- package/dist/tools/pipeline/types.js.map +1 -0
- package/dist/tools/repair/index.d.ts +8 -0
- package/dist/tools/repair/index.d.ts.map +1 -0
- package/dist/tools/repair/index.js +384 -0
- package/dist/tools/repair/index.js.map +1 -0
- package/dist/tools/repair/repairer.d.ts +67 -0
- package/dist/tools/repair/repairer.d.ts.map +1 -0
- package/dist/tools/repair/repairer.js +257 -0
- package/dist/tools/repair/repairer.js.map +1 -0
- package/dist/tools/repair/repairer.test.d.ts +6 -0
- package/dist/tools/repair/repairer.test.d.ts.map +1 -0
- package/dist/tools/repair/repairer.test.js +159 -0
- package/dist/tools/repair/repairer.test.js.map +1 -0
- package/dist/tools/semantic/chunker.d.ts +23 -0
- package/dist/tools/semantic/chunker.d.ts.map +1 -0
- package/dist/tools/semantic/chunker.js +244 -0
- package/dist/tools/semantic/chunker.js.map +1 -0
- package/dist/tools/semantic/embedder.d.ts +16 -0
- package/dist/tools/semantic/embedder.d.ts.map +1 -0
- package/dist/tools/semantic/embedder.js +88 -0
- package/dist/tools/semantic/embedder.js.map +1 -0
- package/dist/tools/semantic/index.d.ts +8 -0
- package/dist/tools/semantic/index.d.ts.map +1 -0
- package/dist/tools/semantic/index.js +144 -0
- package/dist/tools/semantic/index.js.map +1 -0
- package/dist/tools/semantic/store.d.ts +31 -0
- package/dist/tools/semantic/store.d.ts.map +1 -0
- package/dist/tools/semantic/store.js +168 -0
- package/dist/tools/semantic/store.js.map +1 -0
- package/dist/tools/semantic/store.test.d.ts +6 -0
- package/dist/tools/semantic/store.test.d.ts.map +1 -0
- package/dist/tools/semantic/store.test.js +240 -0
- package/dist/tools/semantic/store.test.js.map +1 -0
- package/dist/tools/spec/generator.d.ts +32 -0
- package/dist/tools/spec/generator.d.ts.map +1 -0
- package/dist/tools/spec/generator.js +278 -0
- package/dist/tools/spec/generator.js.map +1 -0
- package/dist/tools/spec/generator.test.d.ts +6 -0
- package/dist/tools/spec/generator.test.d.ts.map +1 -0
- package/dist/tools/spec/generator.test.js +208 -0
- package/dist/tools/spec/generator.test.js.map +1 -0
- package/dist/tools/spec/index.d.ts +11 -0
- package/dist/tools/spec/index.d.ts.map +1 -0
- package/dist/tools/spec/index.js +426 -0
- package/dist/tools/spec/index.js.map +1 -0
- package/dist/tools/spec/store.d.ts +24 -0
- package/dist/tools/spec/store.d.ts.map +1 -0
- package/dist/tools/spec/store.js +104 -0
- package/dist/tools/spec/store.js.map +1 -0
- package/dist/tools/spec/store.test.d.ts +6 -0
- package/dist/tools/spec/store.test.d.ts.map +1 -0
- package/dist/tools/spec/store.test.js +173 -0
- package/dist/tools/spec/store.test.js.map +1 -0
- package/dist/tools/spec/types.d.ts +61 -0
- package/dist/tools/spec/types.d.ts.map +1 -0
- package/dist/tools/spec/types.js +6 -0
- package/dist/tools/spec/types.js.map +1 -0
- package/dist/tools/state/index.d.ts +11 -0
- package/dist/tools/state/index.d.ts.map +1 -0
- package/dist/tools/state/index.js +386 -0
- package/dist/tools/state/index.js.map +1 -0
- package/dist/tools/state/migrate.d.ts +39 -0
- package/dist/tools/state/migrate.d.ts.map +1 -0
- package/dist/tools/state/migrate.js +242 -0
- package/dist/tools/state/migrate.js.map +1 -0
- package/dist/tools/state/migrate.test.d.ts +2 -0
- package/dist/tools/state/migrate.test.d.ts.map +1 -0
- package/dist/tools/state/migrate.test.js +265 -0
- package/dist/tools/state/migrate.test.js.map +1 -0
- package/dist/tools/state/store.d.ts +107 -0
- package/dist/tools/state/store.d.ts.map +1 -0
- package/dist/tools/state/store.js +365 -0
- package/dist/tools/state/store.js.map +1 -0
- package/dist/tools/state/store.test.d.ts +5 -0
- package/dist/tools/state/store.test.d.ts.map +1 -0
- package/dist/tools/state/store.test.js +293 -0
- package/dist/tools/state/store.test.js.map +1 -0
- package/dist/tools/state/types.d.ts +90 -0
- package/dist/tools/state/types.d.ts.map +1 -0
- package/dist/tools/state/types.js +6 -0
- package/dist/tools/state/types.js.map +1 -0
- package/dist/tools/testing/analyzer.d.ts +44 -0
- package/dist/tools/testing/analyzer.d.ts.map +1 -0
- package/dist/tools/testing/analyzer.js +280 -0
- package/dist/tools/testing/analyzer.js.map +1 -0
- package/dist/tools/testing/generator.d.ts +57 -0
- package/dist/tools/testing/generator.d.ts.map +1 -0
- package/dist/tools/testing/generator.js +478 -0
- package/dist/tools/testing/generator.js.map +1 -0
- package/dist/tools/testing/generator.test.d.ts +6 -0
- package/dist/tools/testing/generator.test.d.ts.map +1 -0
- package/dist/tools/testing/generator.test.js +285 -0
- package/dist/tools/testing/generator.test.js.map +1 -0
- package/dist/tools/testing/index.d.ts +8 -0
- package/dist/tools/testing/index.d.ts.map +1 -0
- package/dist/tools/testing/index.js +373 -0
- package/dist/tools/testing/index.js.map +1 -0
- package/dist/utils/embedder.d.ts +7 -0
- package/dist/utils/embedder.d.ts.map +1 -0
- package/dist/utils/embedder.js +13 -0
- package/dist/utils/embedder.js.map +1 -0
- package/dist/utils/execution.d.ts +68 -0
- package/dist/utils/execution.d.ts.map +1 -0
- package/dist/utils/execution.js +467 -0
- package/dist/utils/execution.js.map +1 -0
- package/dist/utils/graph.d.ts +26 -0
- package/dist/utils/graph.d.ts.map +1 -0
- package/dist/utils/graph.js +32 -0
- package/dist/utils/graph.js.map +1 -0
- package/dist/utils/guards.d.ts +32 -0
- package/dist/utils/guards.d.ts.map +1 -0
- package/dist/utils/guards.js +40 -0
- package/dist/utils/guards.js.map +1 -0
- package/dist/utils/ids.d.ts +5 -0
- package/dist/utils/ids.d.ts.map +1 -0
- package/dist/utils/ids.js +7 -0
- package/dist/utils/ids.js.map +1 -0
- package/dist/utils/languages.d.ts +34 -0
- package/dist/utils/languages.d.ts.map +1 -0
- package/dist/utils/languages.js +153 -0
- package/dist/utils/languages.js.map +1 -0
- package/dist/utils/lazy.d.ts +17 -0
- package/dist/utils/lazy.d.ts.map +1 -0
- package/dist/utils/lazy.js +35 -0
- package/dist/utils/lazy.js.map +1 -0
- package/dist/utils/project.d.ts +41 -0
- package/dist/utils/project.d.ts.map +1 -0
- package/dist/utils/project.js +82 -0
- package/dist/utils/project.js.map +1 -0
- package/dist/utils/responses.d.ts +27 -0
- package/dist/utils/responses.d.ts.map +1 -0
- package/dist/utils/responses.js +72 -0
- package/dist/utils/responses.js.map +1 -0
- package/dist/utils/vectors.d.ts +33 -0
- package/dist/utils/vectors.d.ts.map +1 -0
- package/dist/utils/vectors.js +80 -0
- package/dist/utils/vectors.js.map +1 -0
- package/dist/utils/vectors.test.d.ts +6 -0
- package/dist/utils/vectors.test.d.ts.map +1 -0
- package/dist/utils/vectors.test.js +96 -0
- package/dist/utils/vectors.test.js.map +1 -0
- package/package.json +69 -0
- package/scripts/init.js +142 -0
- package/templates/CLAUDE.md.template +96 -0
- package/templates/agents/architecture-concept.md +237 -0
- package/templates/agents/checkpoint-concept.md +218 -0
- package/templates/agents/code-analysis-concept.md +171 -0
- package/templates/agents/compete-control.md +44 -0
- package/templates/agents/compete-evaluator.md +87 -0
- package/templates/agents/compete-treatment.md +55 -0
- package/templates/agents/context-concept.md +254 -0
- package/templates/agents/debate-advocate.md +127 -0
- package/templates/agents/debate-critic.md +119 -0
- package/templates/agents/debate-synthesis.md +160 -0
- package/templates/agents/documentation-concept.md +294 -0
- package/templates/agents/implementation-concept.md +165 -0
- package/templates/agents/quality-concept.md +299 -0
- package/templates/agents/research-concept.md +169 -0
- package/templates/agents/security-concept.md +255 -0
- package/templates/agents/story-concept.md +207 -0
- package/templates/agents/verification-concept.md +456 -0
- package/templates/agents/version-concept.md +163 -0
- package/templates/anchors/directory.anchor.yaml.template +53 -0
- package/templates/anchors/rules.anchor.yaml.template +70 -0
- package/templates/anchors/safety.anchor.yaml.template +96 -0
- package/templates/claude-md-managed.template +105 -0
- package/templates/commands/cache.md.template +439 -0
- package/templates/commands/checkpoint.md.template +121 -0
- package/templates/commands/classify.md.template +138 -0
- package/templates/commands/compete.md.template +90 -0
- package/templates/commands/costs.md.template +111 -0
- package/templates/commands/estimate.md.template +196 -0
- package/templates/commands/explore.md.template +186 -0
- package/templates/commands/feature.md.template +216 -0
- package/templates/commands/forget.md.template +104 -0
- package/templates/commands/global-recall.md.template +250 -0
- package/templates/commands/global-remember.md.template +187 -0
- package/templates/commands/health.md.template +107 -0
- package/templates/commands/help.md.template +253 -0
- package/templates/commands/observe.md.template +211 -0
- package/templates/commands/pr-review.md.template +164 -0
- package/templates/commands/predict-cost.md.template +251 -0
- package/templates/commands/profile.md.template +142 -0
- package/templates/commands/reasoning.md.template +228 -0
- package/templates/commands/recall.md.template +197 -0
- package/templates/commands/remember.md.template +148 -0
- package/templates/commands/replay.md.template +449 -0
- package/templates/commands/restore.md.template +87 -0
- package/templates/commands/retrospective.md.template +47 -0
- package/templates/commands/slo.md.template +286 -0
- package/templates/commands/spec.md.template +164 -0
- package/templates/commands/status.md.template +53 -0
- package/templates/commands/sync.md.template +321 -0
- package/templates/commands/task.md.template +86 -0
- package/templates/commands/trace.md.template +86 -0
- package/templates/commands/visualize.md.template +216 -0
- package/templates/commands/workflow.md.template +375 -0
- package/templates/concepts/README.md +329 -0
- package/templates/concepts/architecture.md.template +74 -0
- package/templates/concepts/code-analysis.md.template +186 -0
- package/templates/concepts/context-compactor.md.template +393 -0
- package/templates/concepts/context.md.template +62 -0
- package/templates/concepts/documentation.md.template +452 -0
- package/templates/concepts/estimator.md.template +214 -0
- package/templates/concepts/exploration.md.template +257 -0
- package/templates/concepts/global-memory.md.template +222 -0
- package/templates/concepts/implementation.md.template +62 -0
- package/templates/concepts/pr-review.md.template +277 -0
- package/templates/concepts/project-profile.md.template +358 -0
- package/templates/concepts/quality.md.template +63 -0
- package/templates/concepts/react-fallback.md.template +286 -0
- package/templates/concepts/research.md.template +221 -0
- package/templates/concepts/retrospective.md.template +93 -0
- package/templates/concepts/security.md.template +442 -0
- package/templates/concepts/slo.md.template +274 -0
- package/templates/concepts/spec.md.template +71 -0
- package/templates/concepts/story.md.template +50 -0
- package/templates/concepts/tool-router.md.template +289 -0
- package/templates/concepts/verification-synthesizer.md.template +279 -0
- package/templates/concepts/version.md.template +61 -0
- package/templates/config.yaml.template +347 -0
- package/templates/examples/README.md +77 -0
- package/templates/examples/architecture/api-design.yaml.template +286 -0
- package/templates/examples/architecture/oauth-authentication.yaml.template +305 -0
- package/templates/health/status.yaml.template +120 -0
- package/templates/hooks/concept-complete.sh.template +45 -0
- package/templates/hooks/lib/common.sh.template +160 -0
- package/templates/hooks/post-commit.sh.template +37 -0
- package/templates/hooks/post-concept-action.template +39 -0
- package/templates/hooks/post-tool-structure-check.sh.template +138 -0
- package/templates/hooks/post-tool-use.sh.template +51 -0
- package/templates/hooks/pre-compact.sh.template +48 -0
- package/templates/hooks/pre-tool-grounding.template +148 -0
- package/templates/hooks/session-exit-checkpoint.sh.template +35 -0
- package/templates/hooks/session-start.sh.template +67 -0
- package/templates/hooks/statusline.sh.template +148 -0
- package/templates/hooks/stop.sh.template +45 -0
- package/templates/hooks/subagent-stop.sh.template +40 -0
- package/templates/hooks/sync-blocked.sh.template +45 -0
- package/templates/hooks/timeout.sh.template +48 -0
- package/templates/hooks/user-prompt-submit.sh.template +68 -0
- package/templates/koan/README.md +58 -0
- package/templates/memory/index.yaml.template +48 -0
- package/templates/memory/procedural/debugging.yaml.template +24 -0
- package/templates/memory/procedural/workflows.yaml.template +22 -0
- package/templates/memory/semantic/architecture.yaml.template +21 -0
- package/templates/memory/semantic/conventions.yaml.template +18 -0
- package/templates/memory/semantic/patterns.yaml.template +21 -0
- package/templates/memory/semantic/preferences.yaml.template +18 -0
- package/templates/prompts/architecture.yaml.template +349 -0
- package/templates/prompts/context.yaml.template +384 -0
- package/templates/prompts/implementation.yaml.template +365 -0
- package/templates/prompts/planning.yaml.template +303 -0
- package/templates/prompts/quality.yaml.template +345 -0
- package/templates/prompts/retrospective.yaml.template +231 -0
- package/templates/prompts/slo.yaml.template +360 -0
- package/templates/prompts/story.yaml.template +236 -0
- package/templates/prompts/tree-of-thoughts.yaml.template +299 -0
- package/templates/prompts/verification.yaml.template +286 -0
- package/templates/prompts/version.yaml.template +279 -0
- package/templates/schemas/agent-schema.json +98 -0
- package/templates/schemas/architecture.schema.json +69 -0
- package/templates/schemas/config-schema.json +165 -0
- package/templates/schemas/implementation.schema.json +75 -0
- package/templates/schemas/planning.schema.json +243 -0
- package/templates/schemas/provenance.schema.json +111 -0
- package/templates/schemas/retrospective.schema.json +174 -0
- package/templates/schemas/review.schema.json +284 -0
- package/templates/schemas/slo.schema.json +443 -0
- package/templates/schemas/story.schema.json +68 -0
- package/templates/schemas/sync-schema.json +196 -0
- package/templates/schemas/task.schema.json +127 -0
- package/templates/schemas/tree-of-thoughts.schema.json +175 -0
- package/templates/schemas/verification.schema.json +106 -0
- package/templates/settings.full.json.template +135 -0
- package/templates/settings.minimal.json.template +68 -0
- package/templates/settings.standard.json.template +135 -0
- package/templates/skills/acceptance-criteria-generation.md.template +330 -0
- package/templates/skills/accessibility-checking.md.template +341 -0
- package/templates/skills/api-design-patterns.md.template +395 -0
- package/templates/skills/batch-processing.md.template +605 -0
- package/templates/skills/branch-strategy.md.template +362 -0
- package/templates/skills/changelog-generation.md.template +403 -0
- package/templates/skills/code-coverage-analysis.md.template +362 -0
- package/templates/skills/code-style-enforcement.md.template +294 -0
- package/templates/skills/code-template-patterns.md.template +419 -0
- package/templates/skills/concept-development.md.template +159 -0
- package/templates/skills/context-prioritization.md.template +306 -0
- package/templates/skills/cost-optimization.md.template +482 -0
- package/templates/skills/cross-project-knowledge.md.template +316 -0
- package/templates/skills/dependency-impact-analysis.md.template +263 -0
- package/templates/skills/documentation-generation.md.template +409 -0
- package/templates/skills/effort-estimation.md.template +350 -0
- package/templates/skills/error-classification.md.template +709 -0
- package/templates/skills/error-messages.md.template +339 -0
- package/templates/skills/ide-diagnostics.md.template +480 -0
- package/templates/skills/incremental-loading.md.template +574 -0
- package/templates/skills/output-caching.md.template +524 -0
- package/templates/skills/performance-estimation.md.template +325 -0
- package/templates/skills/performance-testing-patterns.md.template +341 -0
- package/templates/skills/phase2-optimizations-summary.md.template +458 -0
- package/templates/skills/progressive-disclosure-pattern.md.template +190 -0
- package/templates/skills/project-structure.md.template +372 -0
- package/templates/skills/provenance-analysis.md.template +609 -0
- package/templates/skills/react-executor.md.template +366 -0
- package/templates/skills/refactoring-patterns.md.template +422 -0
- package/templates/skills/release-management.md.template +373 -0
- package/templates/skills/requirement-prioritization.md.template +357 -0
- package/templates/skills/schema-validation.md.template +321 -0
- package/templates/skills/security-design-patterns.md.template +692 -0
- package/templates/skills/security-vulnerability-scanning.md.template +663 -0
- package/templates/skills/semantic-memory.md.template +266 -0
- package/templates/skills/semantic-versioning.md.template +371 -0
- package/templates/skills/smart-retry.md.template +676 -0
- package/templates/skills/smart-summarization.md.template +358 -0
- package/templates/skills/story-decomposition.md.template +278 -0
- package/templates/skills/synchronization-patterns.md.template +303 -0
- package/templates/skills/test-generation-strategy.md.template +247 -0
- package/templates/skills/workflow-replay.md.template +478 -0
- package/templates/skills/wysiwid-principles.md.template +364 -0
- package/templates/skills-manifest.yaml.template +526 -0
- package/templates/stubs/agents/architecture-concept.md +20 -0
- package/templates/stubs/agents/checkpoint-concept.md +19 -0
- package/templates/stubs/agents/code-analysis-concept.md +36 -0
- package/templates/stubs/agents/context-concept.md +37 -0
- package/templates/stubs/agents/debate-advocate.md +12 -0
- package/templates/stubs/agents/debate-critic.md +12 -0
- package/templates/stubs/agents/debate-synthesis.md +12 -0
- package/templates/stubs/agents/documentation-concept.md +39 -0
- package/templates/stubs/agents/implementation-concept.md +41 -0
- package/templates/stubs/agents/quality-concept.md +41 -0
- package/templates/stubs/agents/research-concept.md +35 -0
- package/templates/stubs/agents/security-concept.md +40 -0
- package/templates/stubs/agents/spec-concept.md +35 -0
- package/templates/stubs/agents/story-concept.md +36 -0
- package/templates/stubs/agents/verification-concept.md +39 -0
- package/templates/stubs/agents/version-concept.md +37 -0
- package/templates/stubs/commands/cache.md.template +2 -0
- package/templates/stubs/commands/checkpoint.md.template +2 -0
- package/templates/stubs/commands/classify.md.template +2 -0
- package/templates/stubs/commands/compete.md.template +2 -0
- package/templates/stubs/commands/costs.md.template +2 -0
- package/templates/stubs/commands/estimate.md.template +2 -0
- package/templates/stubs/commands/explore.md.template +2 -0
- package/templates/stubs/commands/feature.md.template +2 -0
- package/templates/stubs/commands/forget.md.template +2 -0
- package/templates/stubs/commands/global-recall.md.template +2 -0
- package/templates/stubs/commands/global-remember.md.template +2 -0
- package/templates/stubs/commands/health.md.template +2 -0
- package/templates/stubs/commands/help.md.template +2 -0
- package/templates/stubs/commands/observe.md.template +2 -0
- package/templates/stubs/commands/pr-review.md.template +2 -0
- package/templates/stubs/commands/predict-cost.md.template +2 -0
- package/templates/stubs/commands/profile.md.template +2 -0
- package/templates/stubs/commands/reasoning.md.template +2 -0
- package/templates/stubs/commands/recall.md.template +2 -0
- package/templates/stubs/commands/remember.md.template +2 -0
- package/templates/stubs/commands/replay.md.template +2 -0
- package/templates/stubs/commands/restore.md.template +2 -0
- package/templates/stubs/commands/retrospective.md.template +2 -0
- package/templates/stubs/commands/slo.md.template +2 -0
- package/templates/stubs/commands/spec.md.template +2 -0
- package/templates/stubs/commands/sync.md.template +2 -0
- package/templates/stubs/commands/task.md.template +2 -0
- package/templates/stubs/commands/trace.md.template +2 -0
- package/templates/stubs/commands/visualize.md.template +2 -0
- package/templates/stubs/commands/workflow.md.template +2 -0
- package/templates/synchronizations/archive/adaptive-learning.yaml.template +595 -0
- package/templates/synchronizations/archive/code-understanding-flow.yaml.template +533 -0
- package/templates/synchronizations/archive/collaboration-flow.yaml.template +521 -0
- package/templates/synchronizations/archive/context-folding.yaml.template +353 -0
- package/templates/synchronizations/archive/dead-letter-queue.yaml.template +530 -0
- package/templates/synchronizations/archive/documentation-flow.yaml.template +560 -0
- package/templates/synchronizations/archive/error-recovery-flow.yaml.template +1031 -0
- package/templates/synchronizations/archive/execution-loop.yaml.template +336 -0
- package/templates/synchronizations/archive/exploration-flow.yaml.template +369 -0
- package/templates/synchronizations/archive/feature-development.yaml.template +2145 -0
- package/templates/synchronizations/archive/learning-loop.yaml.template +657 -0
- package/templates/synchronizations/archive/multi-verify.yaml.template +346 -0
- package/templates/synchronizations/archive/planning-flow.yaml.template +312 -0
- package/templates/synchronizations/archive/retrospective-flow.yaml.template +277 -0
- package/templates/synchronizations/archive/security-flow.yaml.template +477 -0
- package/templates/synchronizations/archive/slo-monitoring.yaml.template +209 -0
- package/templates/synchronizations/archive/task-routing.yaml.template +489 -0
- package/templates/synchronizations/archive/test-driven.yaml.template +291 -0
- package/templates/synchronizations/archive/tool-routing.yaml.template +326 -0
- package/templates/synchronizations/archive/verification-flow.yaml.template +407 -0
- package/templates/synchronizations/error-policy.yaml.template +188 -0
- package/templates/synchronizations/main.sync.template +319 -0
- package/templates/synchronizations/slo-registry.yaml.template +229 -0
- package/templates/tasks/task.yaml.template +67 -0
- package/templates/zen-profile.yaml.template +14 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Evaluator
|
|
3
|
+
* Loads synchronization rules from .claude/synchronizations/ and matches by event type.
|
|
4
|
+
*
|
|
5
|
+
* Supports two formats:
|
|
6
|
+
* 1. Compact DSL (main.sync): `story.create[ready]:completed -> architecture.design:opus @architecture`
|
|
7
|
+
* 2. Legacy YAML (legacy/*.yaml): `synchronizations:` blocks with when/where/then
|
|
8
|
+
*
|
|
9
|
+
* Key constraint: Does NOT evaluate `where` conditions — returns them to Claude,
|
|
10
|
+
* which has the runtime state context. Only matches by when.concept + when.action + when.status.
|
|
11
|
+
*/
|
|
12
|
+
import type { SyncEvalResult } from "./types.js";
|
|
13
|
+
/**
|
|
14
|
+
* SyncEvaluator loads and matches synchronization rules
|
|
15
|
+
*/
|
|
16
|
+
export declare class SyncEvaluator {
|
|
17
|
+
private rules;
|
|
18
|
+
private loaded;
|
|
19
|
+
private syncRoot;
|
|
20
|
+
constructor(contentRoot: string);
|
|
21
|
+
/**
|
|
22
|
+
* Evaluate an event against loaded sync rules.
|
|
23
|
+
* Returns matching rules with their actions and unevaluated where conditions.
|
|
24
|
+
*/
|
|
25
|
+
evaluate(concept: string, action: string, status: string): SyncEvalResult;
|
|
26
|
+
/**
|
|
27
|
+
* Get all loaded rules count
|
|
28
|
+
*/
|
|
29
|
+
getRuleCount(): number;
|
|
30
|
+
/**
|
|
31
|
+
* Check if event matches a rule's when clause
|
|
32
|
+
*/
|
|
33
|
+
private matchesEvent;
|
|
34
|
+
/**
|
|
35
|
+
* Lazy load all sync rules from disk
|
|
36
|
+
*/
|
|
37
|
+
private ensureLoaded;
|
|
38
|
+
}
|
|
39
|
+
export declare const getSyncEvaluator: () => SyncEvaluator;
|
|
40
|
+
export declare const resetSyncEvaluator: () => void;
|
|
41
|
+
//# sourceMappingURL=sync-evaluator.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-evaluator.d.ts","sourceRoot":"","sources":["../../../src/tools/framework/sync-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAIH,OAAO,KAAK,EAAwB,cAAc,EAAE,MAAM,YAAY,CAAC;AAuMvE;;GAEG;AACH,qBAAa,aAAa;IACxB,OAAO,CAAC,KAAK,CAAkB;IAC/B,OAAO,CAAC,MAAM,CAAS;IACvB,OAAO,CAAC,QAAQ,CAAS;gBAEb,WAAW,EAAE,MAAM;IAI/B;;;OAGG;IACH,QAAQ,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,GAAG,cAAc;IAqBzE;;OAEG;IACH,YAAY,IAAI,MAAM;IAKtB;;OAEG;IACH,OAAO,CAAC,YAAY;IAgBpB;;OAEG;IACH,OAAO,CAAC,YAAY;CA6CrB;AAQD,eAAO,MAAM,gBAAgB,qBAA0B,CAAC;AACxD,eAAO,MAAM,kBAAkB,YAA4B,CAAC"}
|
|
@@ -0,0 +1,298 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Sync Evaluator
|
|
3
|
+
* Loads synchronization rules from .claude/synchronizations/ and matches by event type.
|
|
4
|
+
*
|
|
5
|
+
* Supports two formats:
|
|
6
|
+
* 1. Compact DSL (main.sync): `story.create[ready]:completed -> architecture.design:opus @architecture`
|
|
7
|
+
* 2. Legacy YAML (legacy/*.yaml): `synchronizations:` blocks with when/where/then
|
|
8
|
+
*
|
|
9
|
+
* Key constraint: Does NOT evaluate `where` conditions — returns them to Claude,
|
|
10
|
+
* which has the runtime state context. Only matches by when.concept + when.action + when.status.
|
|
11
|
+
*/
|
|
12
|
+
import * as fs from "fs";
|
|
13
|
+
import * as path from "path";
|
|
14
|
+
import { createResettableLazyLoader } from "../../utils/lazy.js";
|
|
15
|
+
import { config } from "../../core/config.js";
|
|
16
|
+
/** Files to skip in synchronizations directory */
|
|
17
|
+
const SKIP_FILES = new Set(["slo-registry.yaml", "error-policy.yaml"]);
|
|
18
|
+
/**
|
|
19
|
+
* Parse compact DSL rule lines from main.sync
|
|
20
|
+
*
|
|
21
|
+
* Format: `concept.action[qualifier]:status -> target_concept.target_action:model @slo [conditions]`
|
|
22
|
+
*
|
|
23
|
+
* Examples:
|
|
24
|
+
* - story.create[ready]:completed -> code-analysis.context:sonnet @mcp [parallel]
|
|
25
|
+
* - architecture.design:completed -> verification.verify[pass=1]:sonnet @verification [risk != low]
|
|
26
|
+
* - quality.test:failed -> quality.self_repair:sonnet @execution_loop [repair_attempts < 3, mcp]
|
|
27
|
+
*/
|
|
28
|
+
function parseDslRules(content, sourcePath) {
|
|
29
|
+
const rules = [];
|
|
30
|
+
const lines = content.split("\n");
|
|
31
|
+
let currentSection = "";
|
|
32
|
+
let ruleIndex = 0;
|
|
33
|
+
for (const line of lines) {
|
|
34
|
+
const trimmed = line.trim();
|
|
35
|
+
// Track section headers
|
|
36
|
+
const sectionMatch = trimmed.match(/^(\w+):$/);
|
|
37
|
+
if (sectionMatch) {
|
|
38
|
+
currentSection = sectionMatch[1];
|
|
39
|
+
continue;
|
|
40
|
+
}
|
|
41
|
+
// Skip non-rule sections
|
|
42
|
+
if (!["rules", "recovery", "learning", "context", "checkpoints", "fallback"].includes(currentSection)) {
|
|
43
|
+
continue;
|
|
44
|
+
}
|
|
45
|
+
// Match rule lines: `- trigger -> action`
|
|
46
|
+
const ruleMatch = trimmed.match(/^-\s+(.+?)\s+->\s+(.+)$/);
|
|
47
|
+
if (!ruleMatch)
|
|
48
|
+
continue;
|
|
49
|
+
const triggerPart = ruleMatch[1].trim();
|
|
50
|
+
const actionPart = ruleMatch[2].trim();
|
|
51
|
+
// Parse trigger: concept.action[qualifier]:status
|
|
52
|
+
const triggerRegex = /^([\w*-]+)\.([\w*|]+)(?:\[([^\]]*)\])?:(\w+)$/;
|
|
53
|
+
const triggerMatch = triggerPart.match(triggerRegex);
|
|
54
|
+
if (!triggerMatch)
|
|
55
|
+
continue;
|
|
56
|
+
const [, concept, action, qualifier, status] = triggerMatch;
|
|
57
|
+
// Parse action: target_concept.target_action:model @slo [conditions]
|
|
58
|
+
// Some actions are special (ask_user, inject_context, set_flag, etc.)
|
|
59
|
+
const actionRegex = /^([\w-]+(?:\.[\w-]+)?)(?:\[([^\]]*)\])?(?::(\w+))?\s*(?:@(\w+))?\s*(?:\[([^\]]*)\])?$/;
|
|
60
|
+
const actionMatch = actionPart.match(actionRegex);
|
|
61
|
+
let targetConcept = "";
|
|
62
|
+
let targetAction = "";
|
|
63
|
+
let model = null;
|
|
64
|
+
let conditions = null;
|
|
65
|
+
if (actionMatch) {
|
|
66
|
+
const fullTarget = actionMatch[1];
|
|
67
|
+
const dotIdx = fullTarget.indexOf(".");
|
|
68
|
+
if (dotIdx !== -1) {
|
|
69
|
+
targetConcept = fullTarget.slice(0, dotIdx);
|
|
70
|
+
targetAction = fullTarget.slice(dotIdx + 1);
|
|
71
|
+
}
|
|
72
|
+
else {
|
|
73
|
+
targetConcept = fullTarget;
|
|
74
|
+
targetAction = "";
|
|
75
|
+
}
|
|
76
|
+
model = actionMatch[3] || null;
|
|
77
|
+
conditions = actionMatch[5] || null;
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
// Fallback: just use the whole thing as concept
|
|
81
|
+
targetConcept = actionPart;
|
|
82
|
+
}
|
|
83
|
+
// Build where clause from qualifier and conditions
|
|
84
|
+
const whereParts = [];
|
|
85
|
+
if (qualifier)
|
|
86
|
+
whereParts.push(qualifier);
|
|
87
|
+
if (conditions)
|
|
88
|
+
whereParts.push(conditions);
|
|
89
|
+
const where = whereParts.length > 0 ? whereParts.join(" AND ") : null;
|
|
90
|
+
ruleIndex++;
|
|
91
|
+
rules.push({
|
|
92
|
+
id: `dsl-${currentSection}-${ruleIndex}`,
|
|
93
|
+
description: `${currentSection}: ${triggerPart} -> ${actionPart}`,
|
|
94
|
+
source: path.basename(sourcePath),
|
|
95
|
+
when: { concept, action, status },
|
|
96
|
+
where,
|
|
97
|
+
then: [
|
|
98
|
+
{
|
|
99
|
+
concept: targetConcept,
|
|
100
|
+
action: targetAction,
|
|
101
|
+
model,
|
|
102
|
+
inputs: {},
|
|
103
|
+
},
|
|
104
|
+
],
|
|
105
|
+
});
|
|
106
|
+
}
|
|
107
|
+
return rules;
|
|
108
|
+
}
|
|
109
|
+
/**
|
|
110
|
+
* Parse legacy YAML synchronization rules
|
|
111
|
+
*
|
|
112
|
+
* Extracts from `synchronizations:` blocks using regex-based parsing
|
|
113
|
+
* (no js-yaml dependency, same approach as content-loader frontmatter parser)
|
|
114
|
+
*/
|
|
115
|
+
function parseLegacyYamlRules(content, sourcePath) {
|
|
116
|
+
const rules = [];
|
|
117
|
+
// Find the synchronizations block
|
|
118
|
+
const syncBlockStart = content.indexOf("\nsynchronizations:");
|
|
119
|
+
if (syncBlockStart === -1)
|
|
120
|
+
return rules;
|
|
121
|
+
const afterSync = content.slice(syncBlockStart + "\nsynchronizations:".length);
|
|
122
|
+
// Split into individual rule blocks (each starts with ` - id:`)
|
|
123
|
+
const ruleBlocks = afterSync.split(/\n - id:\s*/);
|
|
124
|
+
for (let i = 1; i < ruleBlocks.length; i++) {
|
|
125
|
+
const block = ruleBlocks[i];
|
|
126
|
+
// Extract id
|
|
127
|
+
const idMatch = block.match(/^"([^"]+)"/);
|
|
128
|
+
if (!idMatch)
|
|
129
|
+
continue;
|
|
130
|
+
const id = idMatch[1];
|
|
131
|
+
// Extract description
|
|
132
|
+
const descMatch = block.match(/description:\s*"([^"]+)"/);
|
|
133
|
+
const description = descMatch ? descMatch[1] : id;
|
|
134
|
+
// Extract when block
|
|
135
|
+
const conceptMatch = block.match(/when:\s*\n\s+concept:\s*"([^"]+)"/);
|
|
136
|
+
const actionMatch = block.match(/action:\s*"([^"]+)"/);
|
|
137
|
+
const statusMatch = block.match(/status:\s*"([^"]+)"/);
|
|
138
|
+
if (!conceptMatch || !statusMatch)
|
|
139
|
+
continue;
|
|
140
|
+
const concept = conceptMatch[1];
|
|
141
|
+
const action = actionMatch ? actionMatch[1] : "*";
|
|
142
|
+
const status = statusMatch[1];
|
|
143
|
+
// Extract where query
|
|
144
|
+
const whereMatch = block.match(/where:\s*\n\s+query:\s*"([^"]+)"/);
|
|
145
|
+
const where = whereMatch ? whereMatch[1] : null;
|
|
146
|
+
// Extract then actions
|
|
147
|
+
const thenActions = [];
|
|
148
|
+
const thenMatch = block.match(/then:\s*\n([\s\S]*?)(?=\n\s{4}\w|\n\s{2}-\s+id:|\n[a-z]|$)/);
|
|
149
|
+
if (thenMatch) {
|
|
150
|
+
const thenBlock = thenMatch[1];
|
|
151
|
+
// Find concept-based actions using a global regex
|
|
152
|
+
const conceptActionRegex = /- concept:\s*"([^"]+)"[\s\S]*?action:\s*"([^"]+)"(?:[\s\S]*?model:\s*"([^"]+)")?/g;
|
|
153
|
+
let match;
|
|
154
|
+
while ((match = conceptActionRegex.exec(thenBlock)) !== null) {
|
|
155
|
+
thenActions.push({
|
|
156
|
+
concept: match[1],
|
|
157
|
+
action: match[2],
|
|
158
|
+
model: match[3] || null,
|
|
159
|
+
inputs: {},
|
|
160
|
+
});
|
|
161
|
+
}
|
|
162
|
+
// Also handle special actions (ask_user, inject_context, etc.)
|
|
163
|
+
if (thenActions.length === 0) {
|
|
164
|
+
const specialAction = thenBlock.match(/- action:\s*"([^"]+)"/);
|
|
165
|
+
if (specialAction) {
|
|
166
|
+
thenActions.push({
|
|
167
|
+
concept: "",
|
|
168
|
+
action: specialAction[1],
|
|
169
|
+
model: null,
|
|
170
|
+
inputs: {},
|
|
171
|
+
});
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
}
|
|
175
|
+
if (thenActions.length === 0)
|
|
176
|
+
continue;
|
|
177
|
+
rules.push({
|
|
178
|
+
id,
|
|
179
|
+
description,
|
|
180
|
+
source: path.basename(sourcePath),
|
|
181
|
+
when: { concept, action, status },
|
|
182
|
+
where,
|
|
183
|
+
then: thenActions,
|
|
184
|
+
});
|
|
185
|
+
}
|
|
186
|
+
return rules;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* SyncEvaluator loads and matches synchronization rules
|
|
190
|
+
*/
|
|
191
|
+
export class SyncEvaluator {
|
|
192
|
+
rules = [];
|
|
193
|
+
loaded = false;
|
|
194
|
+
syncRoot;
|
|
195
|
+
constructor(contentRoot) {
|
|
196
|
+
this.syncRoot = path.join(contentRoot, "synchronizations");
|
|
197
|
+
}
|
|
198
|
+
/**
|
|
199
|
+
* Evaluate an event against loaded sync rules.
|
|
200
|
+
* Returns matching rules with their actions and unevaluated where conditions.
|
|
201
|
+
*/
|
|
202
|
+
evaluate(concept, action, status) {
|
|
203
|
+
this.ensureLoaded();
|
|
204
|
+
const matched = [];
|
|
205
|
+
for (const rule of this.rules) {
|
|
206
|
+
if (!this.matchesEvent(rule, concept, action, status))
|
|
207
|
+
continue;
|
|
208
|
+
matched.push({
|
|
209
|
+
rule,
|
|
210
|
+
actions: rule.then,
|
|
211
|
+
where: rule.where,
|
|
212
|
+
});
|
|
213
|
+
}
|
|
214
|
+
return {
|
|
215
|
+
event: { concept, action, status },
|
|
216
|
+
matchedRules: matched,
|
|
217
|
+
noMatch: matched.length === 0,
|
|
218
|
+
};
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Get all loaded rules count
|
|
222
|
+
*/
|
|
223
|
+
getRuleCount() {
|
|
224
|
+
this.ensureLoaded();
|
|
225
|
+
return this.rules.length;
|
|
226
|
+
}
|
|
227
|
+
/**
|
|
228
|
+
* Check if event matches a rule's when clause
|
|
229
|
+
*/
|
|
230
|
+
matchesEvent(rule, concept, action, status) {
|
|
231
|
+
// Concept matching (supports *)
|
|
232
|
+
if (rule.when.concept !== "*" && rule.when.concept !== concept)
|
|
233
|
+
return false;
|
|
234
|
+
// Action matching (supports * and pipe-separated alternatives)
|
|
235
|
+
if (rule.when.action !== "*") {
|
|
236
|
+
const allowedActions = rule.when.action.split("|");
|
|
237
|
+
if (!allowedActions.includes(action))
|
|
238
|
+
return false;
|
|
239
|
+
}
|
|
240
|
+
// Status matching
|
|
241
|
+
if (rule.when.status !== status)
|
|
242
|
+
return false;
|
|
243
|
+
return true;
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Lazy load all sync rules from disk
|
|
247
|
+
*/
|
|
248
|
+
ensureLoaded() {
|
|
249
|
+
if (this.loaded)
|
|
250
|
+
return;
|
|
251
|
+
if (!fs.existsSync(this.syncRoot)) {
|
|
252
|
+
this.loaded = true;
|
|
253
|
+
return;
|
|
254
|
+
}
|
|
255
|
+
// Load main.sync (compact DSL) — check both installed and template forms
|
|
256
|
+
const mainSyncPath = path.join(this.syncRoot, "main.sync");
|
|
257
|
+
const mainSyncTemplatePath = path.join(this.syncRoot, "main.sync.template");
|
|
258
|
+
const syncPath = fs.existsSync(mainSyncPath) ? mainSyncPath : fs.existsSync(mainSyncTemplatePath) ? mainSyncTemplatePath : null;
|
|
259
|
+
if (syncPath) {
|
|
260
|
+
try {
|
|
261
|
+
const content = fs.readFileSync(syncPath, "utf-8");
|
|
262
|
+
this.rules.push(...parseDslRules(content, syncPath));
|
|
263
|
+
}
|
|
264
|
+
catch {
|
|
265
|
+
// Skip on read error
|
|
266
|
+
}
|
|
267
|
+
}
|
|
268
|
+
// Load legacy YAML files — check both installed and template forms
|
|
269
|
+
const legacyDir = path.join(this.syncRoot, "legacy");
|
|
270
|
+
const archiveDir = path.join(this.syncRoot, "archive");
|
|
271
|
+
const legacyDirs = [legacyDir, archiveDir].filter((d) => fs.existsSync(d));
|
|
272
|
+
for (const dir of legacyDirs) {
|
|
273
|
+
try {
|
|
274
|
+
const files = fs.readdirSync(dir).filter((f) => (f.endsWith(".yaml") || f.endsWith(".yaml.template")) && !SKIP_FILES.has(f) && !SKIP_FILES.has(f.replace(".template", "")));
|
|
275
|
+
for (const file of files) {
|
|
276
|
+
try {
|
|
277
|
+
const content = fs.readFileSync(path.join(dir, file), "utf-8");
|
|
278
|
+
this.rules.push(...parseLegacyYamlRules(content, file));
|
|
279
|
+
}
|
|
280
|
+
catch {
|
|
281
|
+
// Skip files that can't be parsed
|
|
282
|
+
}
|
|
283
|
+
}
|
|
284
|
+
}
|
|
285
|
+
catch {
|
|
286
|
+
// Skip if directory can't be read
|
|
287
|
+
}
|
|
288
|
+
}
|
|
289
|
+
this.loaded = true;
|
|
290
|
+
}
|
|
291
|
+
}
|
|
292
|
+
/**
|
|
293
|
+
* Singleton sync evaluator (resettable for testing)
|
|
294
|
+
*/
|
|
295
|
+
const syncEvaluatorLoader = createResettableLazyLoader(() => new SyncEvaluator(config().frameworkContentRoot));
|
|
296
|
+
export const getSyncEvaluator = syncEvaluatorLoader.get;
|
|
297
|
+
export const resetSyncEvaluator = syncEvaluatorLoader.reset;
|
|
298
|
+
//# sourceMappingURL=sync-evaluator.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-evaluator.js","sourceRoot":"","sources":["../../../src/tools/framework/sync-evaluator.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAEH,OAAO,KAAK,EAAE,MAAM,IAAI,CAAC;AACzB,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAA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B,CAAC,CACvD,CAAC;AACF,MAAM,CAAC,MAAM,gBAAgB,GAAG,mBAAmB,CAAC,GAAG,CAAC;AACxD,MAAM,CAAC,MAAM,kBAAkB,GAAG,mBAAmB,CAAC,KAAK,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"sync-evaluator.test.d.ts","sourceRoot":"","sources":["../../../src/tools/framework/sync-evaluator.test.ts"],"names":[],"mappings":"AAAA;;GAEG"}
|
|
@@ -0,0 +1,288 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SyncEvaluator Tests
|
|
3
|
+
*/
|
|
4
|
+
import { describe, it, expect, beforeEach, afterEach } from "vitest";
|
|
5
|
+
import * as fs from "fs";
|
|
6
|
+
import * as path from "path";
|
|
7
|
+
import * as os from "os";
|
|
8
|
+
import { SyncEvaluator } from "./sync-evaluator.js";
|
|
9
|
+
import { evaluateSyncForStep, CONCEPT_DEFAULT_ACTIONS } from "./index.js";
|
|
10
|
+
describe("SyncEvaluator", () => {
|
|
11
|
+
let tmpDir;
|
|
12
|
+
beforeEach(() => {
|
|
13
|
+
tmpDir = fs.mkdtempSync(path.join(os.tmpdir(), "sync-eval-test-"));
|
|
14
|
+
fs.mkdirSync(path.join(tmpDir, "synchronizations"), { recursive: true });
|
|
15
|
+
fs.mkdirSync(path.join(tmpDir, "synchronizations", "legacy"), { recursive: true });
|
|
16
|
+
});
|
|
17
|
+
afterEach(() => {
|
|
18
|
+
fs.rmSync(tmpDir, { recursive: true, force: true });
|
|
19
|
+
});
|
|
20
|
+
describe("compact DSL parsing", () => {
|
|
21
|
+
it("should parse basic DSL rules", () => {
|
|
22
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
23
|
+
rules:
|
|
24
|
+
- story.create:completed -> architecture.design:opus @architecture
|
|
25
|
+
- architecture.design:completed -> implementation.generate:sonnet @implementation
|
|
26
|
+
`);
|
|
27
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
28
|
+
const result = evaluator.evaluate("story", "create", "completed");
|
|
29
|
+
expect(result.noMatch).toBe(false);
|
|
30
|
+
expect(result.matchedRules).toHaveLength(1);
|
|
31
|
+
expect(result.matchedRules[0].actions[0].concept).toBe("architecture");
|
|
32
|
+
expect(result.matchedRules[0].actions[0].action).toBe("design");
|
|
33
|
+
expect(result.matchedRules[0].actions[0].model).toBe("opus");
|
|
34
|
+
});
|
|
35
|
+
it("should parse rules with qualifiers as where clauses", () => {
|
|
36
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
37
|
+
rules:
|
|
38
|
+
- story.create[ready]:completed -> architecture.design:opus @architecture
|
|
39
|
+
`);
|
|
40
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
41
|
+
const result = evaluator.evaluate("story", "create", "completed");
|
|
42
|
+
expect(result.matchedRules).toHaveLength(1);
|
|
43
|
+
expect(result.matchedRules[0].where).toContain("ready");
|
|
44
|
+
});
|
|
45
|
+
it("should parse rules with conditions", () => {
|
|
46
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
47
|
+
rules:
|
|
48
|
+
- architecture.design:completed -> verification.verify:sonnet @verification [risk != low]
|
|
49
|
+
`);
|
|
50
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
51
|
+
const result = evaluator.evaluate("architecture", "design", "completed");
|
|
52
|
+
expect(result.matchedRules).toHaveLength(1);
|
|
53
|
+
expect(result.matchedRules[0].where).toContain("risk != low");
|
|
54
|
+
});
|
|
55
|
+
it("should parse rules from multiple sections", () => {
|
|
56
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
57
|
+
rules:
|
|
58
|
+
- story.create:completed -> architecture.design:opus @architecture
|
|
59
|
+
|
|
60
|
+
recovery:
|
|
61
|
+
- story.create:failed -> ask_user @quick
|
|
62
|
+
|
|
63
|
+
learning:
|
|
64
|
+
- quality.review:completed -> retrospective.extract_pattern:sonnet @quick
|
|
65
|
+
`);
|
|
66
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
67
|
+
const storyComplete = evaluator.evaluate("story", "create", "completed");
|
|
68
|
+
expect(storyComplete.matchedRules).toHaveLength(1);
|
|
69
|
+
const storyFailed = evaluator.evaluate("story", "create", "failed");
|
|
70
|
+
expect(storyFailed.matchedRules).toHaveLength(1);
|
|
71
|
+
const qualityComplete = evaluator.evaluate("quality", "review", "completed");
|
|
72
|
+
expect(qualityComplete.matchedRules).toHaveLength(1);
|
|
73
|
+
});
|
|
74
|
+
it("should skip non-rule sections like workflows and decisions", () => {
|
|
75
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
76
|
+
workflows:
|
|
77
|
+
feature:
|
|
78
|
+
pipeline: story | architecture | implementation
|
|
79
|
+
|
|
80
|
+
decisions:
|
|
81
|
+
story_ambiguous:
|
|
82
|
+
trigger: story.clarity == ambiguous
|
|
83
|
+
|
|
84
|
+
rules:
|
|
85
|
+
- story.create:completed -> architecture.design:opus @architecture
|
|
86
|
+
`);
|
|
87
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
88
|
+
expect(evaluator.getRuleCount()).toBe(1);
|
|
89
|
+
});
|
|
90
|
+
});
|
|
91
|
+
describe("legacy YAML parsing", () => {
|
|
92
|
+
it("should parse legacy synchronization blocks", () => {
|
|
93
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "legacy", "feature-development.yaml"), `
|
|
94
|
+
version: "1.0.0"
|
|
95
|
+
|
|
96
|
+
synchronizations:
|
|
97
|
+
- id: "story-to-arch"
|
|
98
|
+
description: "When story ready, design architecture"
|
|
99
|
+
when:
|
|
100
|
+
concept: "story"
|
|
101
|
+
action: "create"
|
|
102
|
+
status: "completed"
|
|
103
|
+
where:
|
|
104
|
+
query: "story.status == 'ready'"
|
|
105
|
+
then:
|
|
106
|
+
- concept: "architecture"
|
|
107
|
+
action: "design"
|
|
108
|
+
model: "opus"
|
|
109
|
+
inputs:
|
|
110
|
+
story_id: "\${story.id}"
|
|
111
|
+
|
|
112
|
+
provenance:
|
|
113
|
+
flow_id: "\${flow.id}"
|
|
114
|
+
`);
|
|
115
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
116
|
+
const result = evaluator.evaluate("story", "create", "completed");
|
|
117
|
+
// Should match both DSL and legacy (if DSL also has one)
|
|
118
|
+
expect(result.noMatch).toBe(false);
|
|
119
|
+
const legacyMatch = result.matchedRules.find((m) => m.rule.id === "story-to-arch");
|
|
120
|
+
expect(legacyMatch).toBeDefined();
|
|
121
|
+
expect(legacyMatch.where).toBe("story.status == 'ready'");
|
|
122
|
+
expect(legacyMatch.actions[0].concept).toBe("architecture");
|
|
123
|
+
});
|
|
124
|
+
it("should skip metadata files", () => {
|
|
125
|
+
// These should be ignored
|
|
126
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "legacy", "slo-registry.yaml"), "slo_templates:\n test: true");
|
|
127
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "legacy", "error-policy.yaml"), "error_policies:\n test: true");
|
|
128
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
129
|
+
expect(evaluator.getRuleCount()).toBe(0);
|
|
130
|
+
});
|
|
131
|
+
});
|
|
132
|
+
describe("event matching", () => {
|
|
133
|
+
let evaluator;
|
|
134
|
+
beforeEach(() => {
|
|
135
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
136
|
+
rules:
|
|
137
|
+
- story.create:completed -> architecture.design:opus @architecture
|
|
138
|
+
- architecture.design:completed -> implementation.generate:sonnet @implementation
|
|
139
|
+
- implementation.generate:completed -> quality.review:sonnet @quality
|
|
140
|
+
|
|
141
|
+
checkpoints:
|
|
142
|
+
- version.commit:completed -> checkpoint.create:haiku @quick
|
|
143
|
+
`);
|
|
144
|
+
evaluator = new SyncEvaluator(tmpDir);
|
|
145
|
+
});
|
|
146
|
+
it("should match exact concept+action+status", () => {
|
|
147
|
+
const result = evaluator.evaluate("story", "create", "completed");
|
|
148
|
+
expect(result.matchedRules.length).toBeGreaterThanOrEqual(1);
|
|
149
|
+
expect(result.matchedRules.some((m) => m.actions[0].concept === "architecture")).toBe(true);
|
|
150
|
+
});
|
|
151
|
+
it("should match rules from checkpoints section", () => {
|
|
152
|
+
const result = evaluator.evaluate("version", "commit", "completed");
|
|
153
|
+
const checkpointMatch = result.matchedRules.find((m) => m.actions[0].concept === "checkpoint");
|
|
154
|
+
expect(checkpointMatch).toBeDefined();
|
|
155
|
+
});
|
|
156
|
+
it("should return noMatch for unmatched events", () => {
|
|
157
|
+
const result = evaluator.evaluate("story", "create", "starting");
|
|
158
|
+
expect(result.noMatch).toBe(true);
|
|
159
|
+
expect(result.matchedRules).toHaveLength(0);
|
|
160
|
+
});
|
|
161
|
+
it("should echo the event in results", () => {
|
|
162
|
+
const result = evaluator.evaluate("story", "create", "completed");
|
|
163
|
+
expect(result.event).toEqual({
|
|
164
|
+
concept: "story",
|
|
165
|
+
action: "create",
|
|
166
|
+
status: "completed",
|
|
167
|
+
});
|
|
168
|
+
});
|
|
169
|
+
});
|
|
170
|
+
describe("pipe-separated action matching", () => {
|
|
171
|
+
it("should match pipe-separated actions", () => {
|
|
172
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "legacy", "test.yaml"), `
|
|
173
|
+
synchronizations:
|
|
174
|
+
- id: "quality-any-to-version"
|
|
175
|
+
description: "Quality review or test triggers version"
|
|
176
|
+
when:
|
|
177
|
+
concept: "quality"
|
|
178
|
+
action: "review|test"
|
|
179
|
+
status: "completed"
|
|
180
|
+
then:
|
|
181
|
+
- concept: "version"
|
|
182
|
+
action: "commit"
|
|
183
|
+
model: "sonnet"
|
|
184
|
+
|
|
185
|
+
provenance:
|
|
186
|
+
flow_id: "test"
|
|
187
|
+
`);
|
|
188
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
189
|
+
const reviewResult = evaluator.evaluate("quality", "review", "completed");
|
|
190
|
+
expect(reviewResult.noMatch).toBe(false);
|
|
191
|
+
const testResult = evaluator.evaluate("quality", "test", "completed");
|
|
192
|
+
expect(testResult.noMatch).toBe(false);
|
|
193
|
+
const otherResult = evaluator.evaluate("quality", "analyze", "completed");
|
|
194
|
+
expect(otherResult.noMatch).toBe(true);
|
|
195
|
+
});
|
|
196
|
+
});
|
|
197
|
+
describe("getRuleCount()", () => {
|
|
198
|
+
it("should return total loaded rules", () => {
|
|
199
|
+
fs.writeFileSync(path.join(tmpDir, "synchronizations", "main.sync"), `
|
|
200
|
+
rules:
|
|
201
|
+
- story.create:completed -> architecture.design:opus @architecture
|
|
202
|
+
- architecture.design:completed -> implementation.generate:sonnet @impl
|
|
203
|
+
|
|
204
|
+
recovery:
|
|
205
|
+
- story.create:failed -> ask_user @quick
|
|
206
|
+
`);
|
|
207
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
208
|
+
expect(evaluator.getRuleCount()).toBe(3);
|
|
209
|
+
});
|
|
210
|
+
it("should return 0 when no sync files exist", () => {
|
|
211
|
+
// Remove the synchronizations directory
|
|
212
|
+
fs.rmSync(path.join(tmpDir, "synchronizations"), { recursive: true });
|
|
213
|
+
const evaluator = new SyncEvaluator(tmpDir);
|
|
214
|
+
expect(evaluator.getRuleCount()).toBe(0);
|
|
215
|
+
});
|
|
216
|
+
});
|
|
217
|
+
});
|
|
218
|
+
describe("evaluateSyncForStep", () => {
|
|
219
|
+
describe("CONCEPT_DEFAULT_ACTIONS mapping", () => {
|
|
220
|
+
it("should map all core workflow concepts", () => {
|
|
221
|
+
expect(CONCEPT_DEFAULT_ACTIONS.story).toBe("create");
|
|
222
|
+
expect(CONCEPT_DEFAULT_ACTIONS.architecture).toBe("design");
|
|
223
|
+
expect(CONCEPT_DEFAULT_ACTIONS.implementation).toBe("generate");
|
|
224
|
+
expect(CONCEPT_DEFAULT_ACTIONS.quality).toBe("review");
|
|
225
|
+
expect(CONCEPT_DEFAULT_ACTIONS.version).toBe("commit");
|
|
226
|
+
});
|
|
227
|
+
it("should map optional concepts", () => {
|
|
228
|
+
expect(CONCEPT_DEFAULT_ACTIONS["code-analysis"]).toBe("context");
|
|
229
|
+
expect(CONCEPT_DEFAULT_ACTIONS.verification).toBe("verify");
|
|
230
|
+
expect(CONCEPT_DEFAULT_ACTIONS.documentation).toBe("generate");
|
|
231
|
+
expect(CONCEPT_DEFAULT_ACTIONS.security).toBe("threat_model");
|
|
232
|
+
});
|
|
233
|
+
});
|
|
234
|
+
describe("evaluateSyncForStep()", () => {
|
|
235
|
+
it("should return a result (may include catch-all rules from bundled templates)", () => {
|
|
236
|
+
// evaluateSyncForStep uses the singleton evaluator which reads from
|
|
237
|
+
// frameworkContentRoot. With bundled templates, catch-all rules (e.g. SLO monitoring)
|
|
238
|
+
// may match unknown concepts, so we only verify the event mapping is correct.
|
|
239
|
+
const result = evaluateSyncForStep("nonexistent-concept", "success");
|
|
240
|
+
// Result may be defined (catch-all rule matched) or undefined (no rules) — both valid
|
|
241
|
+
if (result) {
|
|
242
|
+
expect(result.event.concept).toBe("nonexistent-concept");
|
|
243
|
+
expect(result.event.status).toBe("completed");
|
|
244
|
+
}
|
|
245
|
+
});
|
|
246
|
+
it("should map success outcome to completed status", () => {
|
|
247
|
+
// The function maps "success" → "completed" for sync evaluation
|
|
248
|
+
// We verify the mapping indirectly through the result
|
|
249
|
+
const result = evaluateSyncForStep("story", "success");
|
|
250
|
+
// If rules match, the event should show "completed" status
|
|
251
|
+
if (result) {
|
|
252
|
+
expect(result.event.status).toBe("completed");
|
|
253
|
+
expect(result.event.action).toBe("create");
|
|
254
|
+
}
|
|
255
|
+
});
|
|
256
|
+
it("should map failed outcome to failed status", () => {
|
|
257
|
+
const result = evaluateSyncForStep("story", "failed");
|
|
258
|
+
if (result) {
|
|
259
|
+
expect(result.event.status).toBe("failed");
|
|
260
|
+
}
|
|
261
|
+
});
|
|
262
|
+
it("should map partial outcome to completed status", () => {
|
|
263
|
+
const result = evaluateSyncForStep("architecture", "partial");
|
|
264
|
+
if (result) {
|
|
265
|
+
expect(result.event.status).toBe("completed");
|
|
266
|
+
expect(result.event.action).toBe("design");
|
|
267
|
+
}
|
|
268
|
+
});
|
|
269
|
+
it("should set autoAdvance true when rules have no where conditions", () => {
|
|
270
|
+
const result = evaluateSyncForStep("story", "success");
|
|
271
|
+
if (result && result.matched) {
|
|
272
|
+
// Rules without where conditions should set autoAdvance=true
|
|
273
|
+
const hasNoWhereRule = result.rules.some((r) => r.where === null);
|
|
274
|
+
if (hasNoWhereRule) {
|
|
275
|
+
expect(result.autoAdvance).toBe(true);
|
|
276
|
+
}
|
|
277
|
+
}
|
|
278
|
+
});
|
|
279
|
+
it("should use concept name as fallback action for unknown concepts", () => {
|
|
280
|
+
// An unknown concept should use itself as the action
|
|
281
|
+
const result = evaluateSyncForStep("custom-concept", "success");
|
|
282
|
+
// Even if no match, the function returns undefined (no match)
|
|
283
|
+
// The important thing is it doesn't crash
|
|
284
|
+
expect(result === undefined || result.matched).toBeTruthy();
|
|
285
|
+
});
|
|
286
|
+
});
|
|
287
|
+
});
|
|
288
|
+
//# sourceMappingURL=sync-evaluator.test.js.map
|