@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,286 @@
|
|
|
1
|
+
# Zen Architecture Example: RESTful API Design
|
|
2
|
+
#
|
|
3
|
+
# This example demonstrates architecture design for a RESTful API
|
|
4
|
+
# with proper resource modeling, versioning, and error handling.
|
|
5
|
+
|
|
6
|
+
example_id: "example-arch-api"
|
|
7
|
+
category: "architecture"
|
|
8
|
+
domain: "api-design"
|
|
9
|
+
complexity: "moderate"
|
|
10
|
+
tags: ["api", "rest", "http", "versioning"]
|
|
11
|
+
|
|
12
|
+
# ============================================================================
|
|
13
|
+
# INPUT
|
|
14
|
+
# ============================================================================
|
|
15
|
+
|
|
16
|
+
input:
|
|
17
|
+
story_id: "story-example-002"
|
|
18
|
+
title: "Create API for task management"
|
|
19
|
+
description: |
|
|
20
|
+
Build a RESTful API that allows users to manage their tasks.
|
|
21
|
+
The API will be consumed by web and mobile clients.
|
|
22
|
+
|
|
23
|
+
acceptance_criteria:
|
|
24
|
+
- criterion: "Given I have a valid auth token, when I POST to /tasks with task data, then a new task is created and returned with 201 status"
|
|
25
|
+
priority: high
|
|
26
|
+
- criterion: "Given I own a task, when I GET /tasks/{id}, then I receive the task details"
|
|
27
|
+
priority: high
|
|
28
|
+
- criterion: "Given I request a non-existent task, when I GET /tasks/{id}, then I receive 404 with error details"
|
|
29
|
+
priority: medium
|
|
30
|
+
- criterion: "Given I send invalid data, when I POST to /tasks, then I receive 400 with validation errors"
|
|
31
|
+
priority: medium
|
|
32
|
+
|
|
33
|
+
# ============================================================================
|
|
34
|
+
# OUTPUT
|
|
35
|
+
# ============================================================================
|
|
36
|
+
|
|
37
|
+
output:
|
|
38
|
+
arch_id: "arch-example-002"
|
|
39
|
+
story_id: "story-example-002"
|
|
40
|
+
status: "completed"
|
|
41
|
+
|
|
42
|
+
summary:
|
|
43
|
+
approach: "RESTful API with JSON:API response format and URL versioning"
|
|
44
|
+
risk_level: "low"
|
|
45
|
+
estimated_complexity: "moderate"
|
|
46
|
+
key_decision: "JSON:API format for consistent, self-documenting responses"
|
|
47
|
+
|
|
48
|
+
reasoning:
|
|
49
|
+
requirements_analysis: |
|
|
50
|
+
**Functional:**
|
|
51
|
+
- CRUD operations for tasks
|
|
52
|
+
- Authentication required
|
|
53
|
+
- Support multiple clients (web, mobile)
|
|
54
|
+
|
|
55
|
+
**Non-Functional:**
|
|
56
|
+
- Consistent error handling
|
|
57
|
+
- Discoverable/self-documenting
|
|
58
|
+
- Versioning for future changes
|
|
59
|
+
- Pagination for lists
|
|
60
|
+
|
|
61
|
+
constraints_identified:
|
|
62
|
+
- constraint: "Must support web and mobile clients"
|
|
63
|
+
impact: "Need consistent JSON format, proper CORS"
|
|
64
|
+
- constraint: "Existing authentication system"
|
|
65
|
+
impact: "Use JWT tokens from auth system"
|
|
66
|
+
|
|
67
|
+
approaches_considered:
|
|
68
|
+
- name: "Custom JSON format"
|
|
69
|
+
description: "Define our own response structure"
|
|
70
|
+
pros:
|
|
71
|
+
- "Full control over format"
|
|
72
|
+
- "Can optimize for our use cases"
|
|
73
|
+
cons:
|
|
74
|
+
- "Must document everything ourselves"
|
|
75
|
+
- "Clients need custom parsing"
|
|
76
|
+
- "Inconsistency risk across endpoints"
|
|
77
|
+
fit_score: 0.5
|
|
78
|
+
|
|
79
|
+
- name: "JSON:API specification"
|
|
80
|
+
description: "Follow the JSON:API standard (jsonapi.org)"
|
|
81
|
+
pros:
|
|
82
|
+
- "Well-documented standard"
|
|
83
|
+
- "Client libraries available"
|
|
84
|
+
- "Consistent structure enforced"
|
|
85
|
+
- "Built-in pagination, filtering, relationships"
|
|
86
|
+
cons:
|
|
87
|
+
- "More verbose than minimal JSON"
|
|
88
|
+
- "Learning curve for standard"
|
|
89
|
+
fit_score: 0.8
|
|
90
|
+
|
|
91
|
+
- name: "GraphQL"
|
|
92
|
+
description: "Use GraphQL instead of REST"
|
|
93
|
+
pros:
|
|
94
|
+
- "Clients request exactly what they need"
|
|
95
|
+
- "Single endpoint"
|
|
96
|
+
- "Strong typing"
|
|
97
|
+
cons:
|
|
98
|
+
- "Different paradigm - team learning curve"
|
|
99
|
+
- "Caching more complex"
|
|
100
|
+
- "Overkill for simple CRUD"
|
|
101
|
+
fit_score: 0.4
|
|
102
|
+
|
|
103
|
+
selected_approach:
|
|
104
|
+
name: "JSON:API specification"
|
|
105
|
+
rationale: |
|
|
106
|
+
JSON:API provides a well-defined structure that:
|
|
107
|
+
1. Ensures consistency across all endpoints
|
|
108
|
+
2. Has existing client libraries for web/mobile
|
|
109
|
+
3. Includes conventions for pagination, errors, relationships
|
|
110
|
+
4. Is well-documented, reducing our documentation burden
|
|
111
|
+
|
|
112
|
+
The verbosity trade-off is acceptable given the benefits of
|
|
113
|
+
consistency and standardization.
|
|
114
|
+
confidence: 0.8
|
|
115
|
+
|
|
116
|
+
components:
|
|
117
|
+
- name: "TaskController"
|
|
118
|
+
responsibility: "Handle HTTP requests for task resources"
|
|
119
|
+
interface: |
|
|
120
|
+
GET /api/v1/tasks - List tasks (paginated)
|
|
121
|
+
POST /api/v1/tasks - Create task
|
|
122
|
+
GET /api/v1/tasks/:id - Get task
|
|
123
|
+
PATCH /api/v1/tasks/:id - Update task
|
|
124
|
+
DELETE /api/v1/tasks/:id - Delete task
|
|
125
|
+
dependencies: ["TaskService", "ResponseFormatter"]
|
|
126
|
+
|
|
127
|
+
- name: "TaskService"
|
|
128
|
+
responsibility: "Business logic for task operations"
|
|
129
|
+
interface: |
|
|
130
|
+
list(userId, filters, pagination) -> { tasks, meta }
|
|
131
|
+
create(userId, data) -> task
|
|
132
|
+
get(userId, taskId) -> task
|
|
133
|
+
update(userId, taskId, data) -> task
|
|
134
|
+
delete(userId, taskId) -> void
|
|
135
|
+
dependencies: ["TaskRepository"]
|
|
136
|
+
|
|
137
|
+
- name: "ResponseFormatter"
|
|
138
|
+
responsibility: "Format responses according to JSON:API spec"
|
|
139
|
+
interface: |
|
|
140
|
+
success(data, meta?) -> JSON:API response
|
|
141
|
+
error(errors) -> JSON:API error response
|
|
142
|
+
paginated(data, pagination) -> JSON:API collection
|
|
143
|
+
dependencies: []
|
|
144
|
+
|
|
145
|
+
- name: "ErrorHandler"
|
|
146
|
+
responsibility: "Global error handling middleware"
|
|
147
|
+
interface: |
|
|
148
|
+
handleError(error, req, res, next)
|
|
149
|
+
dependencies: ["ResponseFormatter"]
|
|
150
|
+
|
|
151
|
+
- name: "ValidationMiddleware"
|
|
152
|
+
responsibility: "Validate request data against schemas"
|
|
153
|
+
interface: |
|
|
154
|
+
validate(schema)(req, res, next)
|
|
155
|
+
dependencies: []
|
|
156
|
+
|
|
157
|
+
technical_decisions:
|
|
158
|
+
- decision: "URL-based versioning (/api/v1/)"
|
|
159
|
+
rationale: |
|
|
160
|
+
URL versioning is explicit, easy to understand, and works with
|
|
161
|
+
all HTTP clients. Alternative header-based versioning is harder
|
|
162
|
+
to test and discover.
|
|
163
|
+
alternatives_rejected:
|
|
164
|
+
- name: "Header versioning (Accept-Version)"
|
|
165
|
+
reason: "Harder to test, less discoverable"
|
|
166
|
+
- name: "No versioning"
|
|
167
|
+
reason: "Breaking changes would affect all clients"
|
|
168
|
+
|
|
169
|
+
- decision: "Use HTTP status codes semantically"
|
|
170
|
+
rationale: |
|
|
171
|
+
- 200: Success (GET, PATCH)
|
|
172
|
+
- 201: Created (POST)
|
|
173
|
+
- 204: No Content (DELETE)
|
|
174
|
+
- 400: Validation error
|
|
175
|
+
- 401: Not authenticated
|
|
176
|
+
- 403: Not authorized
|
|
177
|
+
- 404: Not found
|
|
178
|
+
- 500: Server error
|
|
179
|
+
alternatives_rejected:
|
|
180
|
+
- name: "Always return 200 with error in body"
|
|
181
|
+
reason: "Breaks HTTP semantics, harder for clients"
|
|
182
|
+
|
|
183
|
+
- decision: "Pagination with cursor, not offset"
|
|
184
|
+
rationale: |
|
|
185
|
+
Cursor-based pagination is stable when data changes (no skipped
|
|
186
|
+
or duplicate items) and more efficient for large datasets.
|
|
187
|
+
alternatives_rejected:
|
|
188
|
+
- name: "Offset/limit pagination"
|
|
189
|
+
reason: "Unstable with changing data, inefficient at scale"
|
|
190
|
+
|
|
191
|
+
risks:
|
|
192
|
+
- risk: "Breaking changes in future versions"
|
|
193
|
+
probability: "medium"
|
|
194
|
+
impact: "medium"
|
|
195
|
+
mitigation: |
|
|
196
|
+
1. Version from day one
|
|
197
|
+
2. Deprecation policy (6 months notice)
|
|
198
|
+
3. Maintain previous version during transition
|
|
199
|
+
|
|
200
|
+
- risk: "Inconsistent error responses"
|
|
201
|
+
probability: "low"
|
|
202
|
+
impact: "medium"
|
|
203
|
+
mitigation: |
|
|
204
|
+
Global error handler ensures all errors go through
|
|
205
|
+
ResponseFormatter, maintaining consistency.
|
|
206
|
+
|
|
207
|
+
implementation_guidance:
|
|
208
|
+
- "1. Set up Express router with /api/v1 prefix"
|
|
209
|
+
- "2. Implement ResponseFormatter for JSON:API format"
|
|
210
|
+
- "3. Create global ErrorHandler middleware"
|
|
211
|
+
- "4. Implement ValidationMiddleware with JSON schemas"
|
|
212
|
+
- "5. Build TaskController with CRUD endpoints"
|
|
213
|
+
- "6. Add pagination to list endpoint"
|
|
214
|
+
- "7. Write API tests for each endpoint"
|
|
215
|
+
|
|
216
|
+
# Example responses
|
|
217
|
+
api_examples:
|
|
218
|
+
success_response: |
|
|
219
|
+
{
|
|
220
|
+
"data": {
|
|
221
|
+
"type": "tasks",
|
|
222
|
+
"id": "123",
|
|
223
|
+
"attributes": {
|
|
224
|
+
"title": "Complete API design",
|
|
225
|
+
"status": "in_progress",
|
|
226
|
+
"createdAt": "2025-01-15T10:00:00Z"
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
error_response: |
|
|
232
|
+
{
|
|
233
|
+
"errors": [
|
|
234
|
+
{
|
|
235
|
+
"status": "400",
|
|
236
|
+
"code": "VALIDATION_ERROR",
|
|
237
|
+
"title": "Invalid attribute",
|
|
238
|
+
"detail": "Title must be at least 3 characters",
|
|
239
|
+
"source": { "pointer": "/data/attributes/title" }
|
|
240
|
+
}
|
|
241
|
+
]
|
|
242
|
+
}
|
|
243
|
+
|
|
244
|
+
collection_response: |
|
|
245
|
+
{
|
|
246
|
+
"data": [...],
|
|
247
|
+
"meta": {
|
|
248
|
+
"totalCount": 42
|
|
249
|
+
},
|
|
250
|
+
"links": {
|
|
251
|
+
"self": "/api/v1/tasks?page[cursor]=abc",
|
|
252
|
+
"next": "/api/v1/tasks?page[cursor]=def",
|
|
253
|
+
"prev": "/api/v1/tasks?page[cursor]=xyz"
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
# ============================================================================
|
|
258
|
+
# TEACHING NOTES
|
|
259
|
+
# ============================================================================
|
|
260
|
+
|
|
261
|
+
teaching_notes:
|
|
262
|
+
key_patterns:
|
|
263
|
+
- pattern: "Standards Adoption"
|
|
264
|
+
explanation: |
|
|
265
|
+
Using JSON:API instead of inventing our own format reduces
|
|
266
|
+
documentation burden and leverages existing ecosystem.
|
|
267
|
+
|
|
268
|
+
- pattern: "Semantic HTTP"
|
|
269
|
+
explanation: |
|
|
270
|
+
Using HTTP status codes correctly (201 for create, 204 for delete)
|
|
271
|
+
makes the API predictable and follows industry conventions.
|
|
272
|
+
|
|
273
|
+
- pattern: "Cursor Pagination"
|
|
274
|
+
explanation: |
|
|
275
|
+
Cursor-based pagination handles real-time data better than
|
|
276
|
+
offset-based, especially for feeds or frequently-updated lists.
|
|
277
|
+
|
|
278
|
+
common_mistakes:
|
|
279
|
+
- mistake: "Inconsistent error formats across endpoints"
|
|
280
|
+
better: "Global error handler with standardized format"
|
|
281
|
+
|
|
282
|
+
- mistake: "No versioning from the start"
|
|
283
|
+
better: "Add /v1/ prefix immediately, even if no plans to change"
|
|
284
|
+
|
|
285
|
+
- mistake: "Using POST for everything"
|
|
286
|
+
better: "Use appropriate HTTP methods (GET, POST, PATCH, DELETE)"
|
|
@@ -0,0 +1,305 @@
|
|
|
1
|
+
# Zen Architecture Example: OAuth Authentication
|
|
2
|
+
#
|
|
3
|
+
# This example demonstrates a well-structured architecture design
|
|
4
|
+
# for implementing OAuth authentication with multiple providers.
|
|
5
|
+
#
|
|
6
|
+
# Use this as a reference when designing authentication systems.
|
|
7
|
+
|
|
8
|
+
example_id: "example-arch-oauth"
|
|
9
|
+
category: "architecture"
|
|
10
|
+
domain: "authentication"
|
|
11
|
+
complexity: "moderate"
|
|
12
|
+
tags: ["oauth", "authentication", "security", "jwt"]
|
|
13
|
+
|
|
14
|
+
# ============================================================================
|
|
15
|
+
# INPUT: The story that triggered this architecture
|
|
16
|
+
# ============================================================================
|
|
17
|
+
|
|
18
|
+
input:
|
|
19
|
+
story_id: "story-example-001"
|
|
20
|
+
title: "Add user authentication with OAuth"
|
|
21
|
+
description: |
|
|
22
|
+
Users should be able to log in using their existing Google or GitHub
|
|
23
|
+
accounts instead of creating new credentials. This improves security
|
|
24
|
+
(no password storage) and reduces friction for new users.
|
|
25
|
+
|
|
26
|
+
acceptance_criteria:
|
|
27
|
+
- criterion: "Given I am on the login page, when I click 'Sign in with Google', then I am redirected to Google's OAuth consent screen"
|
|
28
|
+
priority: high
|
|
29
|
+
- criterion: "Given I complete Google OAuth, when I am redirected back, then I am logged in and see my dashboard"
|
|
30
|
+
priority: high
|
|
31
|
+
- criterion: "Given I am logged in, when I close and reopen the browser within 30 days, then I remain logged in"
|
|
32
|
+
priority: high
|
|
33
|
+
- criterion: "Given I am logged in, when I click logout, then my session is terminated"
|
|
34
|
+
priority: medium
|
|
35
|
+
|
|
36
|
+
# ============================================================================
|
|
37
|
+
# OUTPUT: The architecture design
|
|
38
|
+
# ============================================================================
|
|
39
|
+
|
|
40
|
+
output:
|
|
41
|
+
arch_id: "arch-example-001"
|
|
42
|
+
story_id: "story-example-001"
|
|
43
|
+
status: "completed"
|
|
44
|
+
|
|
45
|
+
summary:
|
|
46
|
+
approach: "JWT with refresh tokens using passport.js OAuth strategies"
|
|
47
|
+
risk_level: "medium"
|
|
48
|
+
estimated_complexity: "moderate"
|
|
49
|
+
key_decision: "Stateless JWT over server-side sessions for scalability"
|
|
50
|
+
|
|
51
|
+
# Explicit reasoning process (Chain-of-Thought)
|
|
52
|
+
reasoning:
|
|
53
|
+
requirements_analysis: |
|
|
54
|
+
**Functional Requirements:**
|
|
55
|
+
- OAuth with Google and GitHub providers
|
|
56
|
+
- Persistent login for 30 days
|
|
57
|
+
- Logout capability
|
|
58
|
+
|
|
59
|
+
**Non-Functional Requirements:**
|
|
60
|
+
- Security: No password storage, secure token handling
|
|
61
|
+
- Performance: Fast authentication checks
|
|
62
|
+
- Scalability: Support horizontal scaling
|
|
63
|
+
|
|
64
|
+
**Implicit Requirements (inferred):**
|
|
65
|
+
- Handle OAuth failures gracefully
|
|
66
|
+
- Support adding new providers in future
|
|
67
|
+
- Maintain user identity across providers
|
|
68
|
+
|
|
69
|
+
constraints_identified:
|
|
70
|
+
- constraint: "Existing Express.js backend"
|
|
71
|
+
impact: "Use passport.js ecosystem for consistency"
|
|
72
|
+
- constraint: "PostgreSQL database"
|
|
73
|
+
impact: "Store user records and refresh tokens in PostgreSQL"
|
|
74
|
+
- constraint: "Must support mobile apps in future"
|
|
75
|
+
impact: "JWT preferred over cookies for mobile compatibility"
|
|
76
|
+
|
|
77
|
+
# Always consider multiple approaches
|
|
78
|
+
approaches_considered:
|
|
79
|
+
- name: "Server-side sessions with Redis"
|
|
80
|
+
description: |
|
|
81
|
+
Traditional session-based auth where session ID is stored in cookie
|
|
82
|
+
and session data lives in Redis.
|
|
83
|
+
pros:
|
|
84
|
+
- "Simple mental model"
|
|
85
|
+
- "Easy session invalidation (delete from Redis)"
|
|
86
|
+
- "Server controls all session state"
|
|
87
|
+
cons:
|
|
88
|
+
- "Requires Redis infrastructure"
|
|
89
|
+
- "Sticky sessions or shared session store needed"
|
|
90
|
+
- "Harder to scale horizontally"
|
|
91
|
+
- "Not ideal for mobile/API clients"
|
|
92
|
+
fit_score: 0.6
|
|
93
|
+
|
|
94
|
+
- name: "JWT with refresh tokens"
|
|
95
|
+
description: |
|
|
96
|
+
Stateless access tokens (short-lived) with rotating refresh tokens
|
|
97
|
+
(long-lived) stored in database.
|
|
98
|
+
pros:
|
|
99
|
+
- "Stateless - easy horizontal scaling"
|
|
100
|
+
- "No additional infrastructure (Redis)"
|
|
101
|
+
- "Works well for mobile/API clients"
|
|
102
|
+
- "Standard approach with good tooling"
|
|
103
|
+
cons:
|
|
104
|
+
- "Token revocation requires blocklist or short expiry"
|
|
105
|
+
- "More complex token rotation logic"
|
|
106
|
+
- "Larger payload than session ID"
|
|
107
|
+
fit_score: 0.85
|
|
108
|
+
|
|
109
|
+
- name: "OAuth tokens only (no local tokens)"
|
|
110
|
+
description: |
|
|
111
|
+
Store and use OAuth provider tokens directly, refreshing
|
|
112
|
+
through provider when needed.
|
|
113
|
+
pros:
|
|
114
|
+
- "Simplest implementation"
|
|
115
|
+
- "Always fresh user data from provider"
|
|
116
|
+
cons:
|
|
117
|
+
- "Dependent on provider availability"
|
|
118
|
+
- "Can't add local-only features"
|
|
119
|
+
- "Rate limits from providers"
|
|
120
|
+
- "Different token formats per provider"
|
|
121
|
+
fit_score: 0.4
|
|
122
|
+
|
|
123
|
+
selected_approach:
|
|
124
|
+
name: "JWT with refresh tokens"
|
|
125
|
+
rationale: |
|
|
126
|
+
This approach best fits our requirements:
|
|
127
|
+
|
|
128
|
+
1. **Scalability**: Stateless JWTs allow any server to validate tokens
|
|
129
|
+
without shared state, critical for horizontal scaling.
|
|
130
|
+
|
|
131
|
+
2. **Security**: Short-lived access tokens (15 min) limit exposure window.
|
|
132
|
+
Refresh token rotation detects token theft.
|
|
133
|
+
|
|
134
|
+
3. **Flexibility**: Works for web (cookies) and future mobile (headers).
|
|
135
|
+
|
|
136
|
+
4. **Simplicity**: No additional infrastructure beyond our existing
|
|
137
|
+
PostgreSQL for refresh token storage.
|
|
138
|
+
|
|
139
|
+
The main drawback (revocation complexity) is mitigated by short access
|
|
140
|
+
token expiry - even if compromised, exposure is limited to 15 minutes.
|
|
141
|
+
confidence: 0.85
|
|
142
|
+
|
|
143
|
+
# Component breakdown
|
|
144
|
+
components:
|
|
145
|
+
- name: "AuthController"
|
|
146
|
+
responsibility: "Handle OAuth callbacks and coordinate authentication flow"
|
|
147
|
+
interface: |
|
|
148
|
+
GET /auth/google - Initiate Google OAuth
|
|
149
|
+
GET /auth/google/callback - Handle Google OAuth callback
|
|
150
|
+
GET /auth/github - Initiate GitHub OAuth
|
|
151
|
+
GET /auth/github/callback - Handle GitHub OAuth callback
|
|
152
|
+
POST /auth/refresh - Refresh access token
|
|
153
|
+
POST /auth/logout - Terminate session
|
|
154
|
+
dependencies: ["TokenService", "UserService", "passport"]
|
|
155
|
+
|
|
156
|
+
- name: "TokenService"
|
|
157
|
+
responsibility: "JWT creation, validation, and refresh token rotation"
|
|
158
|
+
interface: |
|
|
159
|
+
createTokenPair(userId) -> { accessToken, refreshToken }
|
|
160
|
+
validateAccessToken(token) -> payload | throw
|
|
161
|
+
refreshTokens(refreshToken) -> { accessToken, refreshToken }
|
|
162
|
+
revokeRefreshToken(token) -> void
|
|
163
|
+
dependencies: []
|
|
164
|
+
|
|
165
|
+
- name: "UserService"
|
|
166
|
+
responsibility: "User lookup and creation from OAuth profile"
|
|
167
|
+
interface: |
|
|
168
|
+
findOrCreateFromOAuth(provider, profile) -> User
|
|
169
|
+
findById(userId) -> User
|
|
170
|
+
linkProvider(userId, provider, providerId) -> void
|
|
171
|
+
dependencies: ["UserRepository"]
|
|
172
|
+
|
|
173
|
+
- name: "AuthMiddleware"
|
|
174
|
+
responsibility: "Protect routes, extract user from token"
|
|
175
|
+
interface: |
|
|
176
|
+
requireAuth(req, res, next) - Block if not authenticated
|
|
177
|
+
optionalAuth(req, res, next) - Attach user if token present
|
|
178
|
+
dependencies: ["TokenService"]
|
|
179
|
+
|
|
180
|
+
- name: "RefreshTokenRepository"
|
|
181
|
+
responsibility: "Persist refresh tokens for rotation and revocation"
|
|
182
|
+
interface: |
|
|
183
|
+
store(userId, tokenHash, expiresAt) -> void
|
|
184
|
+
find(tokenHash) -> RefreshToken | null
|
|
185
|
+
revoke(tokenHash) -> void
|
|
186
|
+
revokeAllForUser(userId) -> void
|
|
187
|
+
dependencies: ["Database"]
|
|
188
|
+
|
|
189
|
+
# Key technical decisions
|
|
190
|
+
technical_decisions:
|
|
191
|
+
- decision: "Use httpOnly cookies for token storage (web)"
|
|
192
|
+
rationale: |
|
|
193
|
+
httpOnly cookies prevent JavaScript access, mitigating XSS token theft.
|
|
194
|
+
Tokens are automatically included in requests, simplifying client code.
|
|
195
|
+
alternatives_rejected:
|
|
196
|
+
- name: "localStorage"
|
|
197
|
+
reason: "Vulnerable to XSS - any script can read tokens"
|
|
198
|
+
- name: "sessionStorage"
|
|
199
|
+
reason: "Lost on tab close - poor UX for 30-day persistence"
|
|
200
|
+
|
|
201
|
+
- decision: "15-minute access token expiry"
|
|
202
|
+
rationale: |
|
|
203
|
+
Short expiry limits damage from token theft. Users won't notice
|
|
204
|
+
as refresh happens automatically. Balance between security and
|
|
205
|
+
refresh frequency.
|
|
206
|
+
alternatives_rejected:
|
|
207
|
+
- name: "1-hour expiry"
|
|
208
|
+
reason: "Too long exposure window for sensitive operations"
|
|
209
|
+
- name: "5-minute expiry"
|
|
210
|
+
reason: "Too frequent refreshes, unnecessary load"
|
|
211
|
+
|
|
212
|
+
- decision: "Rotate refresh tokens on each use"
|
|
213
|
+
rationale: |
|
|
214
|
+
If a refresh token is stolen and used, the legitimate user's next
|
|
215
|
+
refresh will fail (token already rotated), signaling compromise.
|
|
216
|
+
Attacker can be detected and all tokens revoked.
|
|
217
|
+
alternatives_rejected:
|
|
218
|
+
- name: "Static refresh tokens"
|
|
219
|
+
reason: "Theft goes undetected until expiry"
|
|
220
|
+
|
|
221
|
+
- decision: "Hash refresh tokens in database"
|
|
222
|
+
rationale: |
|
|
223
|
+
If database is compromised, attacker can't use hashed tokens.
|
|
224
|
+
Same security principle as password hashing.
|
|
225
|
+
alternatives_rejected:
|
|
226
|
+
- name: "Store tokens in plain text"
|
|
227
|
+
reason: "Database breach = all sessions compromised"
|
|
228
|
+
|
|
229
|
+
# Risk assessment
|
|
230
|
+
risks:
|
|
231
|
+
- risk: "Refresh token theft enables persistent access"
|
|
232
|
+
probability: "low"
|
|
233
|
+
impact: "high"
|
|
234
|
+
mitigation: |
|
|
235
|
+
1. Rotate tokens on each use (detect theft)
|
|
236
|
+
2. Hash tokens in database
|
|
237
|
+
3. Bind tokens to user agent/IP (optional strictness)
|
|
238
|
+
4. Provide "logout all devices" feature
|
|
239
|
+
|
|
240
|
+
- risk: "OAuth provider outage blocks new logins"
|
|
241
|
+
probability: "low"
|
|
242
|
+
impact: "medium"
|
|
243
|
+
mitigation: |
|
|
244
|
+
1. Support multiple providers (Google AND GitHub)
|
|
245
|
+
2. Existing sessions continue to work (JWT validation is local)
|
|
246
|
+
3. Add email/password as fallback (future enhancement)
|
|
247
|
+
|
|
248
|
+
- risk: "JWT secret key compromise"
|
|
249
|
+
probability: "very low"
|
|
250
|
+
impact: "critical"
|
|
251
|
+
mitigation: |
|
|
252
|
+
1. Store secrets in environment variables, never in code
|
|
253
|
+
2. Use strong, randomly generated secrets (256+ bits)
|
|
254
|
+
3. Implement key rotation capability
|
|
255
|
+
4. Monitor for unusual authentication patterns
|
|
256
|
+
|
|
257
|
+
# Implementation guidance
|
|
258
|
+
implementation_guidance:
|
|
259
|
+
- "1. Set up passport.js with Google OAuth strategy first (simpler)"
|
|
260
|
+
- "2. Implement TokenService with JWT signing/verification"
|
|
261
|
+
- "3. Create RefreshTokenRepository with PostgreSQL"
|
|
262
|
+
- "4. Add AuthMiddleware and test with Google provider"
|
|
263
|
+
- "5. Add GitHub strategy (follows same pattern as Google)"
|
|
264
|
+
- "6. Implement token refresh endpoint"
|
|
265
|
+
- "7. Add refresh token rotation and reuse detection"
|
|
266
|
+
- "8. Write integration tests for full OAuth flow"
|
|
267
|
+
|
|
268
|
+
open_questions: []
|
|
269
|
+
|
|
270
|
+
# ============================================================================
|
|
271
|
+
# TEACHING NOTES
|
|
272
|
+
# ============================================================================
|
|
273
|
+
|
|
274
|
+
teaching_notes:
|
|
275
|
+
key_patterns:
|
|
276
|
+
- pattern: "Trade-off Documentation"
|
|
277
|
+
explanation: |
|
|
278
|
+
Notice how each approach has explicit pros/cons and a fit_score.
|
|
279
|
+
This makes the decision-making process transparent and auditable.
|
|
280
|
+
|
|
281
|
+
- pattern: "Chain-of-Thought Reasoning"
|
|
282
|
+
explanation: |
|
|
283
|
+
The 'reasoning' section shows the thought process explicitly:
|
|
284
|
+
analyzing requirements, identifying constraints, then evaluating
|
|
285
|
+
options against those constraints.
|
|
286
|
+
|
|
287
|
+
- pattern: "Security by Design"
|
|
288
|
+
explanation: |
|
|
289
|
+
Security decisions (httpOnly cookies, token rotation, hashing)
|
|
290
|
+
are made at architecture time, not retrofitted later.
|
|
291
|
+
|
|
292
|
+
- pattern: "Implementation Ordering"
|
|
293
|
+
explanation: |
|
|
294
|
+
The guidance section provides a logical order that handles
|
|
295
|
+
dependencies correctly (TokenService before AuthMiddleware).
|
|
296
|
+
|
|
297
|
+
common_mistakes:
|
|
298
|
+
- mistake: "Jumping to implementation without considering alternatives"
|
|
299
|
+
better: "Always evaluate 2-3 approaches, even if one seems obvious"
|
|
300
|
+
|
|
301
|
+
- mistake: "Storing tokens in localStorage"
|
|
302
|
+
better: "Use httpOnly cookies for web; secure storage for mobile"
|
|
303
|
+
|
|
304
|
+
- mistake: "Long-lived access tokens for 'convenience'"
|
|
305
|
+
better: "Short access tokens + refresh flow is more secure and just as convenient"
|