@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,96 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Vector Utilities Tests
|
|
3
|
+
* Tests for embedding operations and serialization
|
|
4
|
+
*/
|
|
5
|
+
import { describe, it, expect } from 'vitest';
|
|
6
|
+
import { cosineSimilarity, numberArrayToBytes, bytesToNumberArray, } from './vectors.js';
|
|
7
|
+
describe('Vector Utilities', () => {
|
|
8
|
+
describe('cosineSimilarity', () => {
|
|
9
|
+
it('should return 1 for identical vectors', () => {
|
|
10
|
+
const v = [1, 2, 3, 4, 5];
|
|
11
|
+
expect(cosineSimilarity(v, v)).toBeCloseTo(1.0, 5);
|
|
12
|
+
});
|
|
13
|
+
it('should return 0 for orthogonal vectors', () => {
|
|
14
|
+
const v1 = [1, 0, 0];
|
|
15
|
+
const v2 = [0, 1, 0];
|
|
16
|
+
expect(cosineSimilarity(v1, v2)).toBeCloseTo(0.0, 5);
|
|
17
|
+
});
|
|
18
|
+
it('should return -1 for opposite vectors', () => {
|
|
19
|
+
const v1 = [1, 2, 3];
|
|
20
|
+
const v2 = [-1, -2, -3];
|
|
21
|
+
expect(cosineSimilarity(v1, v2)).toBeCloseTo(-1.0, 5);
|
|
22
|
+
});
|
|
23
|
+
it('should handle normalized vectors correctly', () => {
|
|
24
|
+
// Two unit vectors at 60 degrees
|
|
25
|
+
const v1 = [1, 0];
|
|
26
|
+
const v2 = [0.5, Math.sqrt(3) / 2];
|
|
27
|
+
expect(cosineSimilarity(v1, v2)).toBeCloseTo(0.5, 5);
|
|
28
|
+
});
|
|
29
|
+
it('should handle high-dimensional vectors', () => {
|
|
30
|
+
const dim = 384; // MiniLM dimension
|
|
31
|
+
const v1 = new Array(dim).fill(0).map(() => Math.random());
|
|
32
|
+
const v2 = v1.map(x => x * 1.5); // Scaled version
|
|
33
|
+
// Scaled vectors should have similarity 1
|
|
34
|
+
expect(cosineSimilarity(v1, v2)).toBeCloseTo(1.0, 5);
|
|
35
|
+
});
|
|
36
|
+
it('should be symmetric', () => {
|
|
37
|
+
const v1 = [1, 2, 3, 4];
|
|
38
|
+
const v2 = [4, 3, 2, 1];
|
|
39
|
+
expect(cosineSimilarity(v1, v2)).toBeCloseTo(cosineSimilarity(v2, v1), 10);
|
|
40
|
+
});
|
|
41
|
+
it('should handle zero vectors gracefully', () => {
|
|
42
|
+
const v1 = [0, 0, 0];
|
|
43
|
+
const v2 = [1, 2, 3];
|
|
44
|
+
const result = cosineSimilarity(v1, v2);
|
|
45
|
+
expect(Number.isNaN(result) || result === 0).toBe(true);
|
|
46
|
+
});
|
|
47
|
+
});
|
|
48
|
+
describe('numberArrayToBytes and bytesToNumberArray', () => {
|
|
49
|
+
it('should round-trip small arrays', () => {
|
|
50
|
+
const original = [1.5, -2.3, 0.0, 100.123];
|
|
51
|
+
const bytes = numberArrayToBytes(original);
|
|
52
|
+
const recovered = bytesToNumberArray(bytes);
|
|
53
|
+
expect(recovered.length).toBe(original.length);
|
|
54
|
+
original.forEach((val, i) => {
|
|
55
|
+
expect(recovered[i]).toBeCloseTo(val, 5);
|
|
56
|
+
});
|
|
57
|
+
});
|
|
58
|
+
it('should round-trip large arrays (embedding size)', () => {
|
|
59
|
+
const original = new Array(384).fill(0).map(() => Math.random() * 2 - 1);
|
|
60
|
+
const bytes = numberArrayToBytes(original);
|
|
61
|
+
const recovered = bytesToNumberArray(bytes);
|
|
62
|
+
expect(recovered.length).toBe(original.length);
|
|
63
|
+
original.forEach((val, i) => {
|
|
64
|
+
expect(recovered[i]).toBeCloseTo(val, 5);
|
|
65
|
+
});
|
|
66
|
+
});
|
|
67
|
+
it('should produce correct byte size', () => {
|
|
68
|
+
const arr = [1, 2, 3, 4, 5];
|
|
69
|
+
const bytes = numberArrayToBytes(arr);
|
|
70
|
+
// Float32 = 4 bytes per number
|
|
71
|
+
expect(bytes.length).toBe(arr.length * 4);
|
|
72
|
+
});
|
|
73
|
+
it('should handle empty arrays', () => {
|
|
74
|
+
const original = [];
|
|
75
|
+
const bytes = numberArrayToBytes(original);
|
|
76
|
+
const recovered = bytesToNumberArray(bytes);
|
|
77
|
+
expect(recovered.length).toBe(0);
|
|
78
|
+
});
|
|
79
|
+
it('should handle special values', () => {
|
|
80
|
+
const original = [Number.MAX_VALUE / 2, Number.MIN_VALUE * 2, 0, -0];
|
|
81
|
+
const bytes = numberArrayToBytes(original);
|
|
82
|
+
const recovered = bytesToNumberArray(bytes);
|
|
83
|
+
// Float32 has limited precision, so we use looser comparison
|
|
84
|
+
expect(recovered.length).toBe(original.length);
|
|
85
|
+
});
|
|
86
|
+
it('should handle negative numbers', () => {
|
|
87
|
+
const original = [-1, -0.5, -100, -0.001];
|
|
88
|
+
const bytes = numberArrayToBytes(original);
|
|
89
|
+
const recovered = bytesToNumberArray(bytes);
|
|
90
|
+
original.forEach((val, i) => {
|
|
91
|
+
expect(recovered[i]).toBeCloseTo(val, 5);
|
|
92
|
+
});
|
|
93
|
+
});
|
|
94
|
+
});
|
|
95
|
+
});
|
|
96
|
+
//# sourceMappingURL=vectors.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vectors.test.js","sourceRoot":"","sources":["../../src/utils/vectors.test.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH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CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACrE,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC3C,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAE5C,6DAA6D;YAC7D,MAAM,CAAC,SAAS,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QACjD,CAAC,CAAC,CAAC;QAEH,EAAE,CAAC,gCAAgC,EAAE,GAAG,EAAE;YACxC,MAAM,QAAQ,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,CAAC,KAAK,CAAC,CAAC;YAC1C,MAAM,KAAK,GAAG,kBAAkB,CAAC,QAAQ,CAAC,CAAC;YAC3C,MAAM,SAAS,GAAG,kBAAkB,CAAC,KAAK,CAAC,CAAC;YAE5C,QAAQ,CAAC,OAAO,CAAC,CAAC,GAAG,EAAE,CAAC,EAAE,EAAE;gBAC1B,MAAM,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC,CAAC,CAAC;YAC3C,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
package/package.json
ADDED
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@dragonflymcp/plugin",
|
|
3
|
+
"version": "1.0.0",
|
|
4
|
+
"description": "Dragonfly MCP Plugin — Sonnet-optimized code intelligence, memory, and workflow tools",
|
|
5
|
+
"main": "dist/index.js",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"files": [
|
|
8
|
+
"dist/",
|
|
9
|
+
"templates/",
|
|
10
|
+
"scripts/",
|
|
11
|
+
".claude-plugin/"
|
|
12
|
+
],
|
|
13
|
+
"bin": {
|
|
14
|
+
"dragonfly-init": "./scripts/init.js"
|
|
15
|
+
},
|
|
16
|
+
"scripts": {
|
|
17
|
+
"build": "tsc",
|
|
18
|
+
"dev": "tsx watch src/index.ts",
|
|
19
|
+
"start": "node dist/index.js",
|
|
20
|
+
"test": "vitest",
|
|
21
|
+
"test:run": "vitest run",
|
|
22
|
+
"test:coverage": "vitest run --coverage",
|
|
23
|
+
"lint": "eslint src/",
|
|
24
|
+
"postinstall": "node scripts/init.js"
|
|
25
|
+
},
|
|
26
|
+
"dependencies": {
|
|
27
|
+
"@modelcontextprotocol/sdk": "^1.24.0",
|
|
28
|
+
"better-sqlite3": "^11.10.0",
|
|
29
|
+
"fast-glob": "^3.3.3",
|
|
30
|
+
"web-tree-sitter": "^0.24.7",
|
|
31
|
+
"tree-sitter-wasms": "^0.1.13",
|
|
32
|
+
"@huggingface/transformers": "^3.8.1"
|
|
33
|
+
},
|
|
34
|
+
"devDependencies": {
|
|
35
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
36
|
+
"@types/node": "^22.19.0",
|
|
37
|
+
"@vitest/coverage-v8": "^3.2.0",
|
|
38
|
+
"tsx": "^4.21.0",
|
|
39
|
+
"typescript": "^5.9.3",
|
|
40
|
+
"vitest": "^3.2.0",
|
|
41
|
+
"eslint": "^9.39.0"
|
|
42
|
+
},
|
|
43
|
+
"engines": {
|
|
44
|
+
"node": ">=18.0.0"
|
|
45
|
+
},
|
|
46
|
+
"license": "MIT",
|
|
47
|
+
"author": {
|
|
48
|
+
"name": "Michael Kolb",
|
|
49
|
+
"url": "https://github.com/mkolb22"
|
|
50
|
+
},
|
|
51
|
+
"homepage": "https://github.com/mkolb22/dragonfly-plugin",
|
|
52
|
+
"repository": {
|
|
53
|
+
"type": "git",
|
|
54
|
+
"url": "https://github.com/mkolb22/dragonfly-plugin.git"
|
|
55
|
+
},
|
|
56
|
+
"publishConfig": {
|
|
57
|
+
"access": "public"
|
|
58
|
+
},
|
|
59
|
+
"keywords": [
|
|
60
|
+
"mcp",
|
|
61
|
+
"ast",
|
|
62
|
+
"semantic-search",
|
|
63
|
+
"test-generation",
|
|
64
|
+
"code-repair",
|
|
65
|
+
"claude-code",
|
|
66
|
+
"dragonfly",
|
|
67
|
+
"sonnet"
|
|
68
|
+
]
|
|
69
|
+
}
|
package/scripts/init.js
ADDED
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* dragonfly-init — one-shot setup for consuming projects
|
|
4
|
+
*
|
|
5
|
+
* Run from the project root after installing @dragonflymcp/plugin:
|
|
6
|
+
* npx dragonfly-init
|
|
7
|
+
*
|
|
8
|
+
* Steps:
|
|
9
|
+
* 1. Write .mcp.json
|
|
10
|
+
* 2. Copy agents → .claude/agents/
|
|
11
|
+
* 3. Copy skills → .claude/skills/ (strip .template suffix)
|
|
12
|
+
* 4. Copy commands → .claude/commands/ (strip .template suffix)
|
|
13
|
+
* 5. Copy hooks → .claude/hooks/ (strip .template suffix, chmod +x *.sh)
|
|
14
|
+
* 6. Copy hooks/lib → .claude/hooks/lib/
|
|
15
|
+
*/
|
|
16
|
+
|
|
17
|
+
import { fileURLToPath } from 'url';
|
|
18
|
+
import { dirname, join, basename, resolve } from 'path';
|
|
19
|
+
import {
|
|
20
|
+
existsSync, mkdirSync, copyFileSync, chmodSync,
|
|
21
|
+
readdirSync, cpSync, writeFileSync,
|
|
22
|
+
} from 'fs';
|
|
23
|
+
|
|
24
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
25
|
+
const pkgRoot = join(__dirname, '..'); // node_modules/@dragonflymcp/plugin
|
|
26
|
+
|
|
27
|
+
// When running as a postinstall hook, npm sets INIT_CWD to the directory
|
|
28
|
+
// where `npm install` was invoked (the consuming project root). Use it
|
|
29
|
+
// preferentially over cwd(), which points to the package dir inside node_modules.
|
|
30
|
+
const projectRoot = process.env.INIT_CWD ?? process.cwd();
|
|
31
|
+
|
|
32
|
+
// Guard: skip if we'd be writing into our own package (dev npm install).
|
|
33
|
+
if (projectRoot === pkgRoot || resolve(projectRoot) === resolve(pkgRoot)) {
|
|
34
|
+
process.exit(0);
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
function ensure(dir) {
|
|
38
|
+
if (!existsSync(dir)) mkdirSync(dir, { recursive: true });
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
function log(msg) {
|
|
42
|
+
process.stdout.write(msg + '\n');
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// ── Step 1: .mcp.json ────────────────────────────────────────────────────────
|
|
46
|
+
const mcpPath = join(projectRoot, '.mcp.json');
|
|
47
|
+
if (existsSync(mcpPath)) {
|
|
48
|
+
log(`[skip] .mcp.json already exists — review manually if needed`);
|
|
49
|
+
} else {
|
|
50
|
+
const mcpConfig = {
|
|
51
|
+
mcpServers: {
|
|
52
|
+
dragonfly: {
|
|
53
|
+
type: 'stdio',
|
|
54
|
+
command: 'node',
|
|
55
|
+
args: [
|
|
56
|
+
'--no-wasm-tier-up',
|
|
57
|
+
'--liftoff-only',
|
|
58
|
+
'node_modules/@dragonflymcp/plugin/dist/index.js',
|
|
59
|
+
],
|
|
60
|
+
},
|
|
61
|
+
},
|
|
62
|
+
};
|
|
63
|
+
writeFileSync(mcpPath, JSON.stringify(mcpConfig, null, 2) + '\n');
|
|
64
|
+
log(`[write] .mcp.json`);
|
|
65
|
+
}
|
|
66
|
+
|
|
67
|
+
// ── Step 2: Agents ───────────────────────────────────────────────────────────
|
|
68
|
+
const agentsSrc = join(pkgRoot, 'templates', 'agents');
|
|
69
|
+
const agentsDst = join(projectRoot, '.claude', 'agents');
|
|
70
|
+
ensure(agentsDst);
|
|
71
|
+
let agentCount = 0;
|
|
72
|
+
for (const file of readdirSync(agentsSrc)) {
|
|
73
|
+
if (!file.endsWith('.md')) continue;
|
|
74
|
+
const dst = join(agentsDst, file);
|
|
75
|
+
if (!existsSync(dst)) {
|
|
76
|
+
copyFileSync(join(agentsSrc, file), dst);
|
|
77
|
+
agentCount++;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
log(`[agents] ${agentCount} copied → .claude/agents/`);
|
|
81
|
+
|
|
82
|
+
// ── Step 3: Skills ───────────────────────────────────────────────────────────
|
|
83
|
+
const skillsSrc = join(pkgRoot, 'templates', 'skills');
|
|
84
|
+
const skillsDst = join(projectRoot, '.claude', 'skills');
|
|
85
|
+
ensure(skillsDst);
|
|
86
|
+
let skillCount = 0;
|
|
87
|
+
for (const file of readdirSync(skillsSrc)) {
|
|
88
|
+
if (!file.endsWith('.md.template')) continue;
|
|
89
|
+
const dstName = basename(file, '.template'); // strip .template → keep .md
|
|
90
|
+
const dst = join(skillsDst, dstName);
|
|
91
|
+
if (!existsSync(dst)) {
|
|
92
|
+
copyFileSync(join(skillsSrc, file), dst);
|
|
93
|
+
skillCount++;
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
log(`[skills] ${skillCount} copied → .claude/skills/`);
|
|
97
|
+
|
|
98
|
+
// ── Step 4: Commands ─────────────────────────────────────────────────────────
|
|
99
|
+
const commandsSrc = join(pkgRoot, 'templates', 'commands');
|
|
100
|
+
const commandsDst = join(projectRoot, '.claude', 'commands');
|
|
101
|
+
ensure(commandsDst);
|
|
102
|
+
let commandCount = 0;
|
|
103
|
+
for (const file of readdirSync(commandsSrc)) {
|
|
104
|
+
if (!file.endsWith('.md.template')) continue;
|
|
105
|
+
const dstName = basename(file, '.template');
|
|
106
|
+
const dst = join(commandsDst, dstName);
|
|
107
|
+
if (!existsSync(dst)) {
|
|
108
|
+
copyFileSync(join(commandsSrc, file), dst);
|
|
109
|
+
commandCount++;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
log(`[commands] ${commandCount} copied → .claude/commands/`);
|
|
113
|
+
|
|
114
|
+
// ── Step 5: Hooks ────────────────────────────────────────────────────────────
|
|
115
|
+
const hooksSrc = join(pkgRoot, 'templates', 'hooks');
|
|
116
|
+
const hooksDst = join(projectRoot, '.claude', 'hooks');
|
|
117
|
+
ensure(hooksDst);
|
|
118
|
+
let hookCount = 0;
|
|
119
|
+
for (const file of readdirSync(hooksSrc)) {
|
|
120
|
+
if (!file.endsWith('.template')) continue;
|
|
121
|
+
const dstName = basename(file, '.template');
|
|
122
|
+
const dst = join(hooksDst, dstName);
|
|
123
|
+
if (!existsSync(dst)) {
|
|
124
|
+
copyFileSync(join(hooksSrc, file), dst);
|
|
125
|
+
if (dstName.endsWith('.sh')) {
|
|
126
|
+
chmodSync(dst, 0o755);
|
|
127
|
+
}
|
|
128
|
+
hookCount++;
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
log(`[hooks] ${hookCount} copied → .claude/hooks/`);
|
|
132
|
+
|
|
133
|
+
// ── Step 6: hooks/lib ────────────────────────────────────────────────────────
|
|
134
|
+
const libSrc = join(hooksSrc, 'lib');
|
|
135
|
+
const libDst = join(hooksDst, 'lib');
|
|
136
|
+
if (existsSync(libSrc) && !existsSync(libDst)) {
|
|
137
|
+
cpSync(libSrc, libDst, { recursive: true });
|
|
138
|
+
log(`[hooks/lib] copied → .claude/hooks/lib/`);
|
|
139
|
+
}
|
|
140
|
+
|
|
141
|
+
// ── Done ─────────────────────────────────────────────────────────────────────
|
|
142
|
+
log(`\nDragonfly setup complete. Restart Claude Code to activate the MCP server.`);
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
<!-- zen:managed:start - DO NOT EDIT (regenerated by .zen/install.sh) -->
|
|
2
|
+
|
|
3
|
+
## How to Work on This Project
|
|
4
|
+
|
|
5
|
+
**These are standing orders, not suggestions. Follow them without being prompted.**
|
|
6
|
+
|
|
7
|
+
### Before Writing Code
|
|
8
|
+
|
|
9
|
+
1. **Index the codebase** (`index_project`) on affected packages. Then use `get_call_graph`, `find_references`, and `find_implementations` to understand call chains, blast radius, and interface contracts before changing anything.
|
|
10
|
+
2. **Check existing specs** (`zen_spec_list`, `zen_spec_get`). If a spec covers the area you're modifying, use its contracts to validate your implementation. If no spec exists for a significant module, create one with `zen_spec_save`.
|
|
11
|
+
3. **Search for patterns** (`semantic_search`, `find_similar_code`). Find related implementations already in the codebase. If semantic search returns nothing, run `embed_project` first. Don't reinvent what exists.
|
|
12
|
+
4. **Read before writing**. Use `get_symbol_info` with `includeBody: true` to inspect specific symbols. Never propose changes to code you haven't read.
|
|
13
|
+
|
|
14
|
+
### While Writing Code
|
|
15
|
+
|
|
16
|
+
Apply these patterns in every module, on the first pass — not as a second-pass optimization:
|
|
17
|
+
|
|
18
|
+
- **Cache clients and connections**: Any SDK client, DB handle, or connection created in a hot path must be cached and reused. Never create-and-close per call.
|
|
19
|
+
- **Bound all collections**: Every map or list that grows with user data must have a cleanup/eviction path. If an entry is created on add, it must be deleted on remove.
|
|
20
|
+
- **Pre-allocate**: When the capacity is known or estimable, pre-allocate collections.
|
|
21
|
+
- **Conditional writes**: Don't write to DB/store when the value hasn't changed. Compare before writing.
|
|
22
|
+
- **Limit input**: All external input (HTTP bodies, webhook payloads) must be size-limited.
|
|
23
|
+
- **Thread parsed data**: If a value is parsed/deserialized, pass it through the call chain. Never re-parse.
|
|
24
|
+
- **No duplication**: If logic exists in a helper, call it. Don't inline a copy.
|
|
25
|
+
|
|
26
|
+
### After Writing Code
|
|
27
|
+
|
|
28
|
+
1. **Build and test** before declaring anything complete.
|
|
29
|
+
2. **Save a checkpoint** (`zen_checkpoint_save`) after completing significant milestones — not just when asked.
|
|
30
|
+
3. **Update memory** (`memory_store`) if you learned something stable about the project (architecture, gotchas, patterns).
|
|
31
|
+
|
|
32
|
+
### For Features and Multi-Step Work
|
|
33
|
+
|
|
34
|
+
Use zen workflow tools to structure work:
|
|
35
|
+
- `zen_start_workflow` for new features — plans steps and assigns models
|
|
36
|
+
- `zen_advance_workflow` to move through phases
|
|
37
|
+
- `zen_get_concept` to load phase-specific instructions (story, architecture, implementation, quality)
|
|
38
|
+
- `zen_story_save` / `zen_story_get` to capture and retrieve requirements
|
|
39
|
+
- `zen_spec_save` / `zen_spec_generate` to define contracts and generate code from specs
|
|
40
|
+
|
|
41
|
+
Don't skip phases. The story phase catches requirement gaps. The architecture phase catches design issues. The quality phase catches bugs. Each phase exists because skipping it has cost rework.
|
|
42
|
+
|
|
43
|
+
### What This Means in Practice
|
|
44
|
+
|
|
45
|
+
If the user says "add feature X", the response is NOT to start writing code. It is:
|
|
46
|
+
1. Index the codebase (`index_project`, `embed_project`)
|
|
47
|
+
2. Search for related patterns (`semantic_search`, `find_symbol`, `find_similar_code`)
|
|
48
|
+
3. Understand the call graph (`get_call_graph`, `find_references`, `find_implementations`)
|
|
49
|
+
4. Check/create specs (`zen_spec_list`, `zen_spec_save`)
|
|
50
|
+
5. Plan the approach, then implement — applying the code quality standards above on the first pass
|
|
51
|
+
|
|
52
|
+
The tools were built for you. Use them.
|
|
53
|
+
|
|
54
|
+
## After Auto-Compact
|
|
55
|
+
|
|
56
|
+
After context compression (auto-compact), always:
|
|
57
|
+
- Read `CLAUDE.md` to restore project context
|
|
58
|
+
- Run `zen_checkpoint_restore` with `latest: true` to reload pending work
|
|
59
|
+
- Use `memory_recall` to retrieve relevant project knowledge
|
|
60
|
+
|
|
61
|
+
## Critical: .zen/ is Read-Only
|
|
62
|
+
|
|
63
|
+
The `.zen/` directory is a **read-only git submodule**. NEVER edit, create, or delete files in `.zen/`.
|
|
64
|
+
|
|
65
|
+
## Available Commands
|
|
66
|
+
|
|
67
|
+
- `/feature "description"` - Start a new feature workflow
|
|
68
|
+
- `/workflow "description"` - Full automatic workflow
|
|
69
|
+
- `/health` - Check context health status
|
|
70
|
+
- `/checkpoint` - Save session state
|
|
71
|
+
- `/restore` - Restore from checkpoint
|
|
72
|
+
- `/remember "fact"` - Store in semantic memory
|
|
73
|
+
- `/recall query` - Retrieve memories
|
|
74
|
+
|
|
75
|
+
<!-- zen:managed:end -->
|
|
76
|
+
|
|
77
|
+
# ${PROJECT_NAME}
|
|
78
|
+
|
|
79
|
+
> Powered by [Zen](https://github.com/mkolb22/zen) - Self-evolving architecture with persistent memory and multi-tier model optimization.
|
|
80
|
+
|
|
81
|
+
## Project Description
|
|
82
|
+
|
|
83
|
+
_Describe your project here._
|
|
84
|
+
|
|
85
|
+
## Build Commands
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
# Add your build commands here
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
## Repository Structure
|
|
92
|
+
|
|
93
|
+
_Add your project structure here._
|
|
94
|
+
|
|
95
|
+
---
|
|
96
|
+
*Zen installed: ${TIMESTAMP}*
|
|
@@ -0,0 +1,237 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: architecture-concept
|
|
3
|
+
type: workflow
|
|
4
|
+
execution: task-tool
|
|
5
|
+
model: sonnet
|
|
6
|
+
color: purple
|
|
7
|
+
description: Architecture Concept - Designs system architecture and makes technical decisions using Sonnet for high-quality trade-off analysis
|
|
8
|
+
tools: "*"
|
|
9
|
+
|
|
10
|
+
# Enhanced Metadata (Phase 3)
|
|
11
|
+
cost_per_action: 0.003
|
|
12
|
+
optimization_level: "phase2"
|
|
13
|
+
expected_context_tokens: 1100
|
|
14
|
+
baseline_context_tokens: 100000
|
|
15
|
+
context_reduction: "99%"
|
|
16
|
+
expected_duration_seconds: 15
|
|
17
|
+
---
|
|
18
|
+
|
|
19
|
+
# 🏗️ Architecture Concept
|
|
20
|
+
|
|
21
|
+
## Model Assignment
|
|
22
|
+
|
|
23
|
+
**Model**: Sonnet (high-quality architecture design — MAP-Elites evolution proved equivalent to Opus at 5x lower cost)
|
|
24
|
+
**Cost per Action**: ~$0.003
|
|
25
|
+
**Never Calls**: No other concepts (pure design work)
|
|
26
|
+
|
|
27
|
+
## Core Principle: Structured Trade-Off Analysis
|
|
28
|
+
|
|
29
|
+
Architecture requires:
|
|
30
|
+
- Complex trade-off analysis
|
|
31
|
+
- Novel problem solving
|
|
32
|
+
- Pattern synthesis across domains
|
|
33
|
+
- Risk evaluation
|
|
34
|
+
- Long-term impact assessment
|
|
35
|
+
|
|
36
|
+
MAP-Elites evolution (Feb 2026) proved Sonnet produces equivalent or superior architecture output to Opus on complex benchmarks (0.96 vs 0.90), while costing 5x less.
|
|
37
|
+
|
|
38
|
+
## Actions
|
|
39
|
+
|
|
40
|
+
### design(story_id, context)
|
|
41
|
+
|
|
42
|
+
Creates technical architecture for a requirement.
|
|
43
|
+
|
|
44
|
+
**Inputs**:
|
|
45
|
+
- `story_id`: Reference to the story being architected
|
|
46
|
+
- `context`: Existing system architecture, constraints, patterns
|
|
47
|
+
|
|
48
|
+
**Process**:
|
|
49
|
+
1. Analyze the requirement and acceptance criteria
|
|
50
|
+
2. **Use INCREMENTAL LOADING with MCP tools** (99% context reduction)
|
|
51
|
+
3. Identify technical approaches (2-3 options)
|
|
52
|
+
4. Evaluate trade-offs for each approach
|
|
53
|
+
5. Select recommended approach with justification
|
|
54
|
+
6. Design component structure, interfaces, data flow
|
|
55
|
+
7. Identify risks and mitigation strategies
|
|
56
|
+
8. Generate technical specifications
|
|
57
|
+
9. Return architecture results to parent workflow
|
|
58
|
+
|
|
59
|
+
## Incremental Context Loading
|
|
60
|
+
|
|
61
|
+
Use MCP tools to understand the codebase before designing:
|
|
62
|
+
|
|
63
|
+
**Stage 1: Overview** — `get_file_symbols` for key files, `find_symbol` to locate components
|
|
64
|
+
**Stage 2: Targeted** — `get_symbol_info` with `includeBody: true` for specific symbols, `find_references` for usage patterns
|
|
65
|
+
**Stage 3: Deep Dive** — Read full files only when stages 1-2 prove insufficient
|
|
66
|
+
|
|
67
|
+
**Golden Rule**: Never read a full file before checking if MCP tools can answer your question.
|
|
68
|
+
|
|
69
|
+
## Output Format (YAML with Progressive Disclosure)
|
|
70
|
+
|
|
71
|
+
```yaml
|
|
72
|
+
id: "arch-001"
|
|
73
|
+
status: "completed"
|
|
74
|
+
estimated_risk: "medium"
|
|
75
|
+
summary: "OAuth2 authentication using passport.js with Google provider"
|
|
76
|
+
|
|
77
|
+
details:
|
|
78
|
+
story_id: "story-001"
|
|
79
|
+
|
|
80
|
+
approaches_evaluated:
|
|
81
|
+
- name: "OAuth2 with Passport.js"
|
|
82
|
+
pros: ["Well-tested library", "Multiple provider support", "Active maintenance"]
|
|
83
|
+
cons: ["Additional dependency", "Learning curve"]
|
|
84
|
+
score: 8/10
|
|
85
|
+
|
|
86
|
+
- name: "Custom OAuth2 implementation"
|
|
87
|
+
pros: ["Full control", "No dependencies"]
|
|
88
|
+
cons: ["Security risk", "Maintenance burden", "Reinventing wheel"]
|
|
89
|
+
score: 3/10
|
|
90
|
+
|
|
91
|
+
- name: "SAML with passport-saml"
|
|
92
|
+
pros: ["Enterprise-ready", "Strong security"]
|
|
93
|
+
cons: ["Complex setup", "Overkill for use case"]
|
|
94
|
+
score: 5/10
|
|
95
|
+
|
|
96
|
+
selected_approach:
|
|
97
|
+
name: "OAuth2 with Passport.js"
|
|
98
|
+
justification: |
|
|
99
|
+
Passport.js is battle-tested with 1M+ downloads/week,
|
|
100
|
+
supports multiple providers, and has strong security practices.
|
|
101
|
+
The team has experience with it from previous projects.
|
|
102
|
+
|
|
103
|
+
technical_design:
|
|
104
|
+
components:
|
|
105
|
+
- name: "AuthController"
|
|
106
|
+
purpose: "Handle OAuth2 flow and callbacks"
|
|
107
|
+
interfaces: ["POST /auth/google", "GET /auth/google/callback"]
|
|
108
|
+
|
|
109
|
+
- name: "PassportStrategy"
|
|
110
|
+
purpose: "Configure Google OAuth2 strategy"
|
|
111
|
+
config: ["CLIENT_ID", "CLIENT_SECRET", "CALLBACK_URL"]
|
|
112
|
+
|
|
113
|
+
- name: "UserService"
|
|
114
|
+
purpose: "Create/update user from OAuth profile"
|
|
115
|
+
methods: ["findOrCreateFromOAuth(profile)"]
|
|
116
|
+
|
|
117
|
+
data_flow:
|
|
118
|
+
- "User clicks 'Sign in with Google'"
|
|
119
|
+
- "Redirect to Google consent screen"
|
|
120
|
+
- "Google redirects to /auth/google/callback with code"
|
|
121
|
+
- "Exchange code for access token"
|
|
122
|
+
- "Fetch user profile from Google"
|
|
123
|
+
- "Create/update user in database"
|
|
124
|
+
- "Generate session token"
|
|
125
|
+
- "Redirect to dashboard"
|
|
126
|
+
|
|
127
|
+
security_considerations:
|
|
128
|
+
- "Store CLIENT_SECRET in environment variables"
|
|
129
|
+
- "Validate redirect_uri to prevent open redirects"
|
|
130
|
+
- "Use HTTPS in production"
|
|
131
|
+
- "Implement CSRF protection on auth endpoints"
|
|
132
|
+
|
|
133
|
+
risks:
|
|
134
|
+
- risk: "OAuth provider downtime affects login"
|
|
135
|
+
severity: "medium"
|
|
136
|
+
mitigation: "Implement fallback to email/password login"
|
|
137
|
+
|
|
138
|
+
- risk: "User profile changes at provider"
|
|
139
|
+
severity: "low"
|
|
140
|
+
mitigation: "Sync profile on each login, handle missing fields gracefully"
|
|
141
|
+
|
|
142
|
+
metadata:
|
|
143
|
+
created_at: "2025-11-11T10:35:00Z"
|
|
144
|
+
concept: "architecture"
|
|
145
|
+
model: "sonnet"
|
|
146
|
+
cost: 0.003
|
|
147
|
+
context_tokens: 1100
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## State Management
|
|
151
|
+
|
|
152
|
+
### Progressive Disclosure Pattern
|
|
153
|
+
|
|
154
|
+
All architecture outputs use the progressive disclosure pattern:
|
|
155
|
+
|
|
156
|
+
**Summary Section** (first 5 lines):
|
|
157
|
+
- `arch_id`: Unique identifier
|
|
158
|
+
- `status`: Current state (in_progress/completed/blocked)
|
|
159
|
+
- `estimated_risk`: Risk level (low/medium/high)
|
|
160
|
+
- `summary`: One-line description of the selected approach
|
|
161
|
+
|
|
162
|
+
**Details Section** (loaded on demand):
|
|
163
|
+
- Approaches evaluated with trade-offs
|
|
164
|
+
- Selected approach with justification
|
|
165
|
+
- Complete technical design
|
|
166
|
+
- Component structure and data flow
|
|
167
|
+
- Security considerations
|
|
168
|
+
- Risk assessment and mitigation
|
|
169
|
+
- Metadata and provenance
|
|
170
|
+
|
|
171
|
+
### State Management
|
|
172
|
+
|
|
173
|
+
Architecture results are returned to the parent workflow session. Use `zen_event_log` MCP tool for architecture provenance tracking.
|
|
174
|
+
|
|
175
|
+
### Status Values
|
|
176
|
+
|
|
177
|
+
- `in_progress`: Design work ongoing
|
|
178
|
+
- `completed`: Architecture finalized, ready for implementation
|
|
179
|
+
- `blocked`: Cannot proceed without external input
|
|
180
|
+
|
|
181
|
+
## Integration with Synchronizations
|
|
182
|
+
|
|
183
|
+
The architecture concept is triggered by:
|
|
184
|
+
- Story completion (via `story-to-arch` sync)
|
|
185
|
+
- Direct invocation (`/architecture <story-id>`)
|
|
186
|
+
|
|
187
|
+
The architecture concept triggers (via synchronizations):
|
|
188
|
+
- `implementation` concept when status = "completed"
|
|
189
|
+
- User notification if status = "blocked"
|
|
190
|
+
|
|
191
|
+
## Validation Rules
|
|
192
|
+
|
|
193
|
+
Architecture is "completed" when:
|
|
194
|
+
- [ ] At least 2 approaches evaluated
|
|
195
|
+
- [ ] Selected approach has clear justification
|
|
196
|
+
- [ ] Component structure is defined
|
|
197
|
+
- [ ] Data flow is documented
|
|
198
|
+
- [ ] Security considerations identified
|
|
199
|
+
- [ ] Risks assessed with mitigations
|
|
200
|
+
- [ ] Technical specs are implementable
|
|
201
|
+
|
|
202
|
+
## Error Handling
|
|
203
|
+
|
|
204
|
+
If architecture fails:
|
|
205
|
+
1. Save partial state with status="blocked"
|
|
206
|
+
2. Document what information is missing
|
|
207
|
+
3. Return clear error message
|
|
208
|
+
4. Do not trigger implementation concept
|
|
209
|
+
|
|
210
|
+
## Never Do This
|
|
211
|
+
|
|
212
|
+
- ❌ Call other concepts directly
|
|
213
|
+
- ❌ Implement any code
|
|
214
|
+
- ❌ Run tests or quality checks
|
|
215
|
+
- ❌ Perform git operations
|
|
216
|
+
- ❌ Read entire codebase (use MCP tools)
|
|
217
|
+
- ❌ Skip incremental loading stages
|
|
218
|
+
|
|
219
|
+
## Always Do This
|
|
220
|
+
|
|
221
|
+
- ✅ Use Sonnet model
|
|
222
|
+
- ✅ Use MCP tools before reading full files
|
|
223
|
+
- ✅ Evaluate multiple approaches
|
|
224
|
+
- ✅ Document trade-offs and reasoning
|
|
225
|
+
- ✅ Return structured results to parent workflow
|
|
226
|
+
- ✅ Use progressive disclosure format
|
|
227
|
+
- ✅ Track context usage in metadata
|
|
228
|
+
- ✅ Follow YAML safety rules (see below)
|
|
229
|
+
|
|
230
|
+
## YAML Safety Rules
|
|
231
|
+
|
|
232
|
+
All YAML output MUST follow these rules to prevent silent parse failures:
|
|
233
|
+
|
|
234
|
+
1. **Quote strings containing special characters.** Any string with `@`, `#`, `:`, `{`, `[`, `"`, `!`, `*`, `&`, `|`, `>`, or `%` must be wrapped in double quotes with inner quotes escaped.
|
|
235
|
+
2. **Avoid nested quotes in unquoted list items.** If a list item (`- ...`) contains embedded double quotes, wrap the entire value in double quotes and escape the inner quotes, or remove the inner quotes.
|
|
236
|
+
3. **Use block scalars for long text.** Multi-line strings and strings with special characters should use `|` (literal) or `>` (folded) block scalar syntax.
|
|
237
|
+
4. **Validate output parses.** Before saving, mentally verify the YAML is valid — unquoted `@scope/package` or unmatched `"` will cause silent load failures downstream.
|