@documentation-robotics/cli 0.1.0 → 0.1.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +466 -693
- package/dist/analysis/data-model-analyzer.js +189 -0
- package/dist/analysis/data-model-analyzer.js.map +7 -0
- package/dist/analysis/index.js +3 -0
- package/dist/analysis/index.js.map +7 -0
- package/dist/analysis/relationship-classifier.js +181 -0
- package/dist/analysis/relationship-classifier.js.map +7 -0
- package/dist/analyzers/base-analyzer.js +1 -0
- package/dist/analyzers/base-analyzer.js.map +7 -0
- package/dist/analyzers/call-graph-utils.js +39 -0
- package/dist/analyzers/call-graph-utils.js.map +7 -0
- package/dist/analyzers/cbm-analyzer.js +1205 -0
- package/dist/analyzers/cbm-analyzer.js.map +7 -0
- package/dist/analyzers/heuristic-utils.js +55 -0
- package/dist/analyzers/heuristic-utils.js.map +7 -0
- package/dist/analyzers/mapping-loader.js +146 -0
- package/dist/analyzers/mapping-loader.js.map +7 -0
- package/dist/analyzers/registry.js +124 -0
- package/dist/analyzers/registry.js.map +7 -0
- package/dist/analyzers/session-state.js +176 -0
- package/dist/analyzers/session-state.js.map +7 -0
- package/dist/analyzers/stdio-client.js +206 -0
- package/dist/analyzers/stdio-client.js.map +7 -0
- package/dist/analyzers/types.js +15 -0
- package/dist/analyzers/types.js.map +7 -0
- package/dist/analyzers/verify-engine.js +209 -0
- package/dist/analyzers/verify-engine.js.map +7 -0
- package/dist/analyzers/verify-ignore.js +130 -0
- package/dist/analyzers/verify-ignore.js.map +7 -0
- package/dist/analyzers/version.js +8 -0
- package/dist/analyzers/version.js.map +7 -0
- package/dist/audit/ai/runner.js +41 -0
- package/dist/audit/ai/runner.js.map +7 -0
- package/dist/audit/differential-analyzer.js +183 -0
- package/dist/audit/differential-analyzer.js.map +7 -0
- package/dist/audit/index.js +32 -0
- package/dist/audit/index.js.map +7 -0
- package/dist/audit/nodes/ai/evaluator.js +49 -0
- package/dist/audit/nodes/ai/evaluator.js.map +7 -0
- package/dist/audit/nodes/ai/parser.js +55 -0
- package/dist/audit/nodes/ai/parser.js.map +7 -0
- package/dist/audit/nodes/ai/prompts.js +103 -0
- package/dist/audit/nodes/ai/prompts.js.map +7 -0
- package/dist/audit/nodes/analysis/node-completeness-checker.js +32 -0
- package/dist/audit/nodes/analysis/node-completeness-checker.js.map +7 -0
- package/dist/audit/nodes/analysis/node-definition-analyzer.js +47 -0
- package/dist/audit/nodes/analysis/node-definition-analyzer.js.map +7 -0
- package/dist/audit/nodes/analysis/node-overlap-detector.js +79 -0
- package/dist/audit/nodes/analysis/node-overlap-detector.js.map +7 -0
- package/dist/audit/nodes/model/orchestrator.js +82 -0
- package/dist/audit/nodes/model/orchestrator.js.map +7 -0
- package/dist/audit/nodes/spec/loader.js +116 -0
- package/dist/audit/nodes/spec/loader.js.map +7 -0
- package/dist/audit/nodes/spec/orchestrator.js +68 -0
- package/dist/audit/nodes/spec/orchestrator.js.map +7 -0
- package/dist/audit/nodes/types.js +1 -0
- package/dist/audit/nodes/types.js.map +7 -0
- package/dist/audit/pipeline/index.js +5 -0
- package/dist/audit/pipeline/index.js.map +7 -0
- package/dist/audit/pipeline/pipeline-orchestrator.js +218 -0
- package/dist/audit/pipeline/pipeline-orchestrator.js.map +7 -0
- package/dist/audit/relationships/ai/evaluator.js +235 -0
- package/dist/audit/relationships/ai/evaluator.js.map +7 -0
- package/dist/audit/relationships/ai/parser.js +197 -0
- package/dist/audit/relationships/ai/parser.js.map +7 -0
- package/dist/audit/relationships/ai/prompts.js +274 -0
- package/dist/audit/relationships/ai/prompts.js.map +7 -0
- package/dist/audit/relationships/analysis/balance-assessor.js +115 -0
- package/dist/audit/relationships/analysis/balance-assessor.js.map +7 -0
- package/dist/audit/relationships/analysis/coverage-analyzer.js +99 -0
- package/dist/audit/relationships/analysis/coverage-analyzer.js.map +7 -0
- package/dist/audit/relationships/analysis/duplicate-detector.js +95 -0
- package/dist/audit/relationships/analysis/duplicate-detector.js.map +7 -0
- package/dist/audit/relationships/analysis/gap-analyzer.js +99 -0
- package/dist/audit/relationships/analysis/gap-analyzer.js.map +7 -0
- package/dist/audit/relationships/analysis/layer-templates.js +294 -0
- package/dist/audit/relationships/analysis/layer-templates.js.map +7 -0
- package/dist/audit/relationships/graph/connectivity.js +129 -0
- package/dist/audit/relationships/graph/connectivity.js.map +7 -0
- package/dist/audit/relationships/graph/relationship-graph.js +179 -0
- package/dist/audit/relationships/graph/relationship-graph.js.map +7 -0
- package/dist/audit/relationships/model/balance-assessor.js +49 -0
- package/dist/audit/relationships/model/balance-assessor.js.map +7 -0
- package/dist/audit/relationships/model/coverage-analyzer.js +34 -0
- package/dist/audit/relationships/model/coverage-analyzer.js.map +7 -0
- package/dist/audit/relationships/model/duplicate-detector.js +68 -0
- package/dist/audit/relationships/model/duplicate-detector.js.map +7 -0
- package/dist/audit/relationships/model/gap-analyzer.js +41 -0
- package/dist/audit/relationships/model/gap-analyzer.js.map +7 -0
- package/dist/audit/relationships/model/orchestrator.js +126 -0
- package/dist/audit/relationships/model/orchestrator.js.map +7 -0
- package/dist/audit/relationships/spec/orchestrator.js +157 -0
- package/dist/audit/relationships/spec/orchestrator.js.map +7 -0
- package/dist/audit/reports/index.js +5 -0
- package/dist/audit/reports/index.js.map +7 -0
- package/dist/audit/reports/report-generator.js +118 -0
- package/dist/audit/reports/report-generator.js.map +7 -0
- package/dist/audit/snapshot-storage.js +163 -0
- package/dist/audit/snapshot-storage.js.map +7 -0
- package/dist/audit/types.js +21 -0
- package/dist/audit/types.js.map +7 -0
- package/dist/cli.js +223 -92
- package/dist/cli.js.map +3 -3
- package/dist/coding-agents/agents/claude-code.js +147 -0
- package/dist/coding-agents/agents/claude-code.js.map +7 -0
- package/dist/coding-agents/agents/index.js +5 -0
- package/dist/coding-agents/agents/index.js.map +7 -0
- package/dist/coding-agents/agents/types.js +1 -0
- package/dist/coding-agents/agents/types.js.map +7 -0
- package/dist/coding-agents/base-chat-client.js +45 -0
- package/dist/coding-agents/base-chat-client.js.map +7 -0
- package/dist/coding-agents/chat-utils.js +23 -0
- package/dist/coding-agents/chat-utils.js.map +7 -0
- package/dist/coding-agents/claude-code-client.js +246 -0
- package/dist/coding-agents/claude-code-client.js.map +7 -0
- package/dist/coding-agents/copilot-client.js +209 -0
- package/dist/coding-agents/copilot-client.js.map +7 -0
- package/dist/commands/add.js +95 -33
- package/dist/commands/add.js.map +2 -2
- package/dist/commands/analyzer.js +511 -0
- package/dist/commands/analyzer.js.map +7 -0
- package/dist/commands/audit-diff.js +49 -0
- package/dist/commands/audit-diff.js.map +7 -0
- package/dist/commands/audit-snapshots.js +62 -0
- package/dist/commands/audit-snapshots.js.map +7 -0
- package/dist/commands/audit.js +81 -0
- package/dist/commands/audit.js.map +7 -0
- package/dist/commands/catalog.js +248 -0
- package/dist/commands/catalog.js.map +7 -0
- package/dist/commands/changeset.js +577 -66
- package/dist/commands/changeset.js.map +2 -2
- package/dist/commands/chat.js +106 -83
- package/dist/commands/chat.js.map +2 -2
- package/dist/commands/claude.js +74 -0
- package/dist/commands/claude.js.map +7 -0
- package/dist/commands/conformance.js +71 -68
- package/dist/commands/conformance.js.map +2 -2
- package/dist/commands/copilot.js +75 -0
- package/dist/commands/copilot.js.map +7 -0
- package/dist/commands/delete.js +125 -11
- package/dist/commands/delete.js.map +3 -3
- package/dist/commands/discover-logic.js +44 -0
- package/dist/commands/discover-logic.js.map +7 -0
- package/dist/commands/docs.js +87 -0
- package/dist/commands/docs.js.map +7 -0
- package/dist/commands/element.js +14 -20
- package/dist/commands/element.js.map +2 -2
- package/dist/commands/export.js +13 -3
- package/dist/commands/export.js.map +2 -2
- package/dist/commands/import.js +51 -0
- package/dist/commands/import.js.map +7 -0
- package/dist/commands/info.js +30 -24
- package/dist/commands/info.js.map +2 -2
- package/dist/commands/init.js +27 -11
- package/dist/commands/init.js.map +2 -2
- package/dist/commands/list.js +63 -13
- package/dist/commands/list.js.map +3 -3
- package/dist/commands/relationship.js +225 -37
- package/dist/commands/relationship.js.map +2 -2
- package/dist/commands/report.js +54 -0
- package/dist/commands/report.js.map +7 -0
- package/dist/commands/reports.js +45 -0
- package/dist/commands/reports.js.map +7 -0
- package/dist/commands/schema.js +135 -0
- package/dist/commands/schema.js.map +7 -0
- package/dist/commands/search.js +40 -12
- package/dist/commands/search.js.map +2 -2
- package/dist/commands/show.js +58 -27
- package/dist/commands/show.js.map +2 -2
- package/dist/commands/stats.js +35 -0
- package/dist/commands/stats.js.map +7 -0
- package/dist/commands/trace.js +39 -16
- package/dist/commands/trace.js.map +2 -2
- package/dist/commands/update.js +141 -14
- package/dist/commands/update.js.map +2 -2
- package/dist/commands/upgrade.js +210 -46
- package/dist/commands/upgrade.js.map +3 -3
- package/dist/commands/validate.js +142 -23
- package/dist/commands/validate.js.map +3 -3
- package/dist/commands/version.js +8 -12
- package/dist/commands/version.js.map +2 -2
- package/dist/commands/visualize.js +155 -25
- package/dist/commands/visualize.js.map +2 -2
- package/dist/core/base-snapshot-manager.js +84 -0
- package/dist/core/base-snapshot-manager.js.map +7 -0
- package/dist/core/changeset-exporter.js +305 -0
- package/dist/core/changeset-exporter.js.map +7 -0
- package/dist/core/changeset-validator.js +41 -0
- package/dist/core/changeset-validator.js.map +7 -0
- package/dist/core/changeset.js +88 -173
- package/dist/core/changeset.js.map +2 -2
- package/dist/core/dependency-tracker.js +4 -2
- package/dist/core/dependency-tracker.js.map +2 -2
- package/dist/core/element.js +98 -27
- package/dist/core/element.js.map +2 -2
- package/dist/core/golden-copy-cache.js +290 -0
- package/dist/core/golden-copy-cache.js.map +7 -0
- package/dist/core/graph-model.js +266 -0
- package/dist/core/graph-model.js.map +7 -0
- package/dist/core/layer.js +159 -16
- package/dist/core/layer.js.map +2 -2
- package/dist/core/layers.js +32 -0
- package/dist/core/layers.js.map +7 -0
- package/dist/core/manifest.js +32 -11
- package/dist/core/manifest.js.map +2 -2
- package/dist/core/migration-registry.js +56 -1
- package/dist/core/migration-registry.js.map +2 -2
- package/dist/core/model.js +424 -217
- package/dist/core/model.js.map +3 -3
- package/dist/core/mutation-handler.js +179 -0
- package/dist/core/mutation-handler.js.map +7 -0
- package/dist/core/reference-registry.js +29 -21
- package/dist/core/reference-registry.js.map +2 -2
- package/dist/core/relationship-catalog.js +189 -0
- package/dist/core/relationship-catalog.js.map +7 -0
- package/dist/core/relationship-registry.js.map +2 -2
- package/dist/core/relationships.js.map +1 -1
- package/dist/core/report-data-model.js +285 -0
- package/dist/core/report-data-model.js.map +7 -0
- package/dist/core/spec-data-service.js +185 -0
- package/dist/core/spec-data-service.js.map +7 -0
- package/dist/core/spec-loader-types.js +1 -0
- package/dist/core/spec-loader-types.js.map +7 -0
- package/dist/core/spec-loader.js +234 -0
- package/dist/core/spec-loader.js.map +7 -0
- package/dist/core/staged-changeset-storage.js +282 -0
- package/dist/core/staged-changeset-storage.js.map +7 -0
- package/dist/core/staging-area.js +1002 -0
- package/dist/core/staging-area.js.map +7 -0
- package/dist/core/stats-collector.js +169 -0
- package/dist/core/stats-collector.js.map +7 -0
- package/dist/core/virtual-projection.js +443 -0
- package/dist/core/virtual-projection.js.map +7 -0
- package/dist/export/archimate-exporter.js +99 -60
- package/dist/export/archimate-exporter.js.map +2 -2
- package/dist/export/audit-formatters.js +479 -0
- package/dist/export/audit-formatters.js.map +7 -0
- package/dist/export/diff-formatters.js +99 -0
- package/dist/export/diff-formatters.js.map +7 -0
- package/dist/export/export-manager.js.map +2 -2
- package/dist/export/graphml-exporter.js +44 -27
- package/dist/export/graphml-exporter.js.map +2 -2
- package/dist/export/index.js +4 -0
- package/dist/export/index.js.map +2 -2
- package/dist/export/json-schema-exporter.js +55 -42
- package/dist/export/json-schema-exporter.js.map +2 -2
- package/dist/export/markdown-exporter.js +92 -70
- package/dist/export/markdown-exporter.js.map +2 -2
- package/dist/export/markdown-generator.js +248 -0
- package/dist/export/markdown-generator.js.map +7 -0
- package/dist/export/markdown-utils.js +30 -0
- package/dist/export/markdown-utils.js.map +7 -0
- package/dist/export/mermaid-markdown-exporter.js +37 -0
- package/dist/export/mermaid-markdown-exporter.js.map +7 -0
- package/dist/export/openapi-exporter.js +119 -71
- package/dist/export/openapi-exporter.js.map +2 -2
- package/dist/export/plantuml-exporter.js +104 -39
- package/dist/export/plantuml-exporter.js.map +2 -2
- package/dist/export/report-formatters.js +111 -0
- package/dist/export/report-formatters.js.map +7 -0
- package/dist/export/stats-formatters.js +98 -0
- package/dist/export/stats-formatters.js.map +7 -0
- package/dist/export/types.js +2 -14
- package/dist/export/types.js.map +2 -2
- package/dist/export/verify-formatters.js +153 -0
- package/dist/export/verify-formatters.js.map +7 -0
- package/dist/generated/compiled-validators.js +17 -0
- package/dist/generated/compiled-validators.js.map +7 -0
- package/dist/generated/index.js +31 -0
- package/dist/generated/index.js.map +7 -0
- package/dist/generated/layer-registry.js +190 -0
- package/dist/generated/layer-registry.js.map +7 -0
- package/dist/generated/layer-types.js +7 -0
- package/dist/generated/layer-types.js.map +7 -0
- package/dist/generated/node-types.js +1719 -0
- package/dist/generated/node-types.js.map +7 -0
- package/dist/generated/relationship-index.js +14552 -0
- package/dist/generated/relationship-index.js.map +7 -0
- package/dist/import/archimate-importer.js +166 -0
- package/dist/import/archimate-importer.js.map +7 -0
- package/dist/import/index.js +47 -0
- package/dist/import/index.js.map +7 -0
- package/dist/import/openapi-importer.js +143 -0
- package/dist/import/openapi-importer.js.map +7 -0
- package/dist/import/types.js +1 -0
- package/dist/import/types.js.map +7 -0
- package/dist/integrations/base-manager.js +311 -0
- package/dist/integrations/base-manager.js.map +7 -0
- package/dist/integrations/claude-manager.js +360 -0
- package/dist/integrations/claude-manager.js.map +7 -0
- package/dist/integrations/claude_code/agents/dr-advisor.md +253 -0
- package/dist/integrations/claude_code/agents/dr-architect.md +278 -0
- package/dist/integrations/claude_code/agents/dr-extractor.md +286 -0
- package/dist/integrations/claude_code/commands/dr-changeset.md +657 -0
- package/dist/integrations/claude_code/commands/dr-design.md +373 -0
- package/dist/integrations/claude_code/commands/dr-info.md +132 -0
- package/dist/integrations/claude_code/commands/dr-init.md +251 -0
- package/dist/integrations/claude_code/commands/dr-map.md +936 -0
- package/dist/integrations/claude_code/commands/dr-model.md +493 -0
- package/dist/integrations/claude_code/commands/dr-relate.md +814 -0
- package/dist/integrations/claude_code/commands/dr-sync.md +279 -0
- package/dist/integrations/claude_code/commands/dr-validate.md +654 -0
- package/dist/integrations/claude_code/commands/dr-verify.md +559 -0
- package/dist/integrations/claude_code/docs/END_TO_END_WALKTHROUGH.md +903 -0
- package/dist/integrations/claude_code/docs/QUICK_START.md +271 -0
- package/dist/integrations/claude_code/docs/README.md +347 -0
- package/dist/integrations/claude_code/skills/dr_01_motivation_layer/SKILL.md +550 -0
- package/dist/integrations/claude_code/skills/dr_02_business_layer/SKILL.md +620 -0
- package/dist/integrations/claude_code/skills/dr_03_security_layer/SKILL.md +642 -0
- package/dist/integrations/claude_code/skills/dr_04_application_layer/SKILL.md +911 -0
- package/dist/integrations/claude_code/skills/dr_05_technology_layer/SKILL.md +836 -0
- package/dist/integrations/claude_code/skills/dr_06_api_layer/SKILL.md +933 -0
- package/dist/integrations/claude_code/skills/dr_07_data_model_layer/SKILL.md +210 -0
- package/dist/integrations/claude_code/skills/dr_08_dataset_layer/SKILL.md +319 -0
- package/dist/integrations/claude_code/skills/dr_09_ux_layer/SKILL.md +319 -0
- package/dist/integrations/claude_code/skills/dr_10_navigation_layer/SKILL.md +318 -0
- package/dist/integrations/claude_code/skills/dr_11_apm_layer/SKILL.md +273 -0
- package/dist/integrations/claude_code/skills/dr_12_testing_layer/SKILL.md +273 -0
- package/dist/integrations/claude_code/skills/dr_changeset_reviewer/SKILL.md +187 -0
- package/dist/integrations/claude_code/skills/dr_codebase_memory/SKILL.md +590 -0
- package/dist/integrations/claude_code/skills/dr_engineering_guide/SKILL.md +295 -0
- package/dist/integrations/copilot-manager.js +328 -0
- package/dist/integrations/copilot-manager.js.map +7 -0
- package/dist/integrations/github_copilot/agents/dr-advisor.md +243 -0
- package/dist/integrations/github_copilot/agents/dr-architect.md +1567 -0
- package/dist/integrations/github_copilot/skills/dr_01_motivation_layer/SKILL.md +491 -0
- package/dist/integrations/github_copilot/skills/dr_02_business_layer/SKILL.md +539 -0
- package/dist/integrations/github_copilot/skills/dr_03_security_layer/SKILL.md +667 -0
- package/dist/integrations/github_copilot/skills/dr_04_application_layer/SKILL.md +670 -0
- package/dist/integrations/github_copilot/skills/dr_05_technology_layer/SKILL.md +660 -0
- package/dist/integrations/github_copilot/skills/dr_06_api_layer/SKILL.md +855 -0
- package/dist/integrations/github_copilot/skills/dr_07_data_model_layer/SKILL.md +171 -0
- package/dist/integrations/github_copilot/skills/dr_08_dataset_layer/SKILL.md +216 -0
- package/dist/integrations/github_copilot/skills/dr_09_ux_layer/SKILL.md +230 -0
- package/dist/integrations/github_copilot/skills/dr_10_navigation_layer/SKILL.md +228 -0
- package/dist/integrations/github_copilot/skills/dr_11_apm_layer/SKILL.md +234 -0
- package/dist/integrations/github_copilot/skills/dr_12_testing_layer/SKILL.md +230 -0
- package/dist/integrations/github_copilot/skills/dr_changeset_reviewer/SKILL.md +187 -0
- package/dist/integrations/hash-utils.js +51 -0
- package/dist/integrations/hash-utils.js.map +7 -0
- package/dist/integrations/types.js +16 -0
- package/dist/integrations/types.js.map +7 -0
- package/dist/reports/model-layer-report-generator.js +278 -0
- package/dist/reports/model-layer-report-generator.js.map +7 -0
- package/dist/reports/model-report-data.js +57 -0
- package/dist/reports/model-report-data.js.map +7 -0
- package/dist/reports/model-report-orchestrator.js +103 -0
- package/dist/reports/model-report-orchestrator.js.map +7 -0
- package/dist/schemas/bundled/analyzers/cbm.json +595 -0
- package/dist/schemas/bundled/analyzers/manifest.json +9 -0
- package/dist/schemas/bundled/api.json +3411 -0
- package/dist/schemas/bundled/apm.json +2371 -0
- package/dist/schemas/bundled/application.json +1253 -0
- package/dist/schemas/bundled/base.json +1622 -0
- package/dist/schemas/bundled/business.json +1279 -0
- package/dist/schemas/bundled/data-model.json +1298 -0
- package/dist/schemas/bundled/data-store.json +2025 -0
- package/dist/schemas/bundled/manifest.json +93 -0
- package/dist/schemas/bundled/motivation.json +1360 -0
- package/dist/schemas/bundled/navigation.json +1874 -0
- package/dist/schemas/bundled/security.json +3488 -0
- package/dist/schemas/bundled/technology.json +2067 -0
- package/dist/schemas/bundled/testing.json +3120 -0
- package/dist/schemas/bundled/ux.json +3592 -0
- package/dist/server/schemas.js +202 -0
- package/dist/server/schemas.js.map +7 -0
- package/dist/server/server.js +1336 -252
- package/dist/server/server.js.map +3 -3
- package/dist/server/telemetry-middleware.js +22 -15
- package/dist/server/telemetry-middleware.js.map +2 -2
- package/dist/server-entry.js +65 -0
- package/dist/server-entry.js.map +7 -0
- package/dist/telemetry/config.js +89 -0
- package/dist/telemetry/config.js.map +7 -0
- package/dist/telemetry/console-interceptor.js.map +1 -1
- package/dist/telemetry/detect.js +24 -0
- package/dist/telemetry/detect.js.map +7 -0
- package/dist/telemetry/fetch-otlp-exporter.js +112 -0
- package/dist/telemetry/fetch-otlp-exporter.js.map +7 -0
- package/dist/telemetry/index.js +153 -3
- package/dist/telemetry/index.js.map +2 -2
- package/dist/telemetry/resilient-exporter.js +22 -8
- package/dist/telemetry/resilient-exporter.js.map +2 -2
- package/dist/telemetry/resilient-log-exporter.js +17 -8
- package/dist/telemetry/resilient-log-exporter.js.map +2 -2
- package/dist/telemetry/test-instrumentation.js.map +2 -2
- package/dist/types/index.js +84 -0
- package/dist/types/index.js.map +3 -3
- package/dist/types/source-reference.js +1 -0
- package/dist/types/source-reference.js.map +7 -0
- package/dist/utils/chat-logger.js +292 -0
- package/dist/utils/chat-logger.js.map +7 -0
- package/dist/utils/claude-stream.js +8 -0
- package/dist/utils/claude-stream.js.map +7 -0
- package/dist/utils/date-utils.js +7 -0
- package/dist/utils/date-utils.js.map +7 -0
- package/dist/utils/element-utils.js.map +1 -1
- package/dist/utils/errors.js +88 -15
- package/dist/utils/errors.js.map +3 -3
- package/dist/utils/export-python-annotations.js +82 -0
- package/dist/utils/export-python-annotations.js.map +7 -0
- package/dist/utils/file-io.js +7 -2
- package/dist/utils/file-io.js.map +2 -2
- package/dist/utils/file-lock.js +156 -0
- package/dist/utils/file-lock.js.map +7 -0
- package/dist/utils/id-generator.js +18 -0
- package/dist/utils/id-generator.js.map +7 -0
- package/dist/utils/layer-name-formatter.js +16 -0
- package/dist/utils/layer-name-formatter.js.map +7 -0
- package/dist/utils/markdown-anchor.js +7 -0
- package/dist/utils/markdown-anchor.js.map +7 -0
- package/dist/utils/markdown-link.js +12 -0
- package/dist/utils/markdown-link.js.map +7 -0
- package/dist/utils/markdown-table.js +17 -0
- package/dist/utils/markdown-table.js.map +7 -0
- package/dist/utils/mermaid-utils.js +11 -0
- package/dist/utils/mermaid-utils.js.map +7 -0
- package/dist/utils/project-paths.js.map +2 -2
- package/dist/utils/source-reference.js +52 -0
- package/dist/utils/source-reference.js.map +7 -0
- package/dist/utils/spec-installer.js +40 -53
- package/dist/utils/spec-installer.js.map +2 -2
- package/dist/utils/spec-version.js +5 -1
- package/dist/utils/spec-version.js.map +2 -2
- package/dist/utils/string-utils.js +12 -0
- package/dist/utils/string-utils.js.map +7 -0
- package/dist/utils/table-formatting.js +19 -0
- package/dist/utils/table-formatting.js.map +7 -0
- package/dist/validators/index.js +4 -0
- package/dist/validators/index.js.map +2 -2
- package/dist/validators/naming-validator.js +20 -23
- package/dist/validators/naming-validator.js.map +2 -2
- package/dist/validators/reference-validator.js +23 -38
- package/dist/validators/reference-validator.js.map +2 -2
- package/dist/validators/relationship-schema-validator.js +243 -0
- package/dist/validators/relationship-schema-validator.js.map +7 -0
- package/dist/validators/schema-validator.js +168 -68
- package/dist/validators/schema-validator.js.map +2 -2
- package/dist/validators/semantic-validator.js +36 -60
- package/dist/validators/semantic-validator.js.map +2 -2
- package/dist/validators/types.js.map +2 -2
- package/dist/validators/validation-formatter.js +159 -0
- package/dist/validators/validation-formatter.js.map +7 -0
- package/dist/validators/validator.js +24 -38
- package/dist/validators/validator.js.map +2 -2
- package/dist/viewer/README.md +139 -0
- package/dist/viewer/assets/main-CY0Xufuj.css +1 -0
- package/dist/viewer/assets/main-DtgErnwF.js +81 -0
- package/dist/viewer/assets/vendor-CxKvDp2x.js +17 -0
- package/dist/viewer/favicon.svg +11 -0
- package/dist/viewer/fonts/inter/Inter-Black.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Bold.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-ExtraBold.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Light.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Medium.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-Regular.woff2 +0 -0
- package/dist/viewer/fonts/inter/Inter-SemiBold.woff2 +0 -0
- package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Medium.woff2 +0 -0
- package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-Regular.woff2 +0 -0
- package/dist/viewer/fonts/jetbrains-mono/JetBrainsMono-SemiBold.woff2 +0 -0
- package/dist/viewer/index.html +15 -0
- package/dist/viewer/manifest.json +99 -0
- package/dist/viewer/version.json +1 -0
- package/package.json +37 -13
- package/PYTHON_CLI_PARITY.md +0 -265
- package/PYTHON_CLI_STRUCTURE_UPDATE.md +0 -246
- package/biome.json +0 -42
- package/bunfig.toml +0 -3
- package/dist/ai/claude-client.js +0 -71
- package/dist/ai/claude-client.js.map +0 -7
- package/dist/ai/context-provider.js +0 -129
- package/dist/ai/context-provider.js.map +0 -7
- package/dist/ai/tools.js +0 -231
- package/dist/ai/tools.js.map +0 -7
- package/dist/commands/migrate.js +0 -36
- package/dist/commands/migrate.js.map +0 -7
- package/dist/commands/project.js +0 -74
- package/dist/commands/project.js.map +0 -7
- package/dist/core/active-changeset.js +0 -52
- package/dist/core/active-changeset.js.map +0 -7
- package/dist/core/projection-engine.js +0 -288
- package/dist/core/projection-engine.js.map +0 -7
- package/dist/schemas/bundled/01-motivation-layer.schema.json +0 -942
- package/dist/schemas/bundled/02-business-layer.schema.json +0 -1293
- package/dist/schemas/bundled/03-security-layer.schema.json +0 -2177
- package/dist/schemas/bundled/04-application-layer.schema.json +0 -1328
- package/dist/schemas/bundled/05-technology-layer.schema.json +0 -1465
- package/dist/schemas/bundled/06-api-layer.schema.json +0 -1743
- package/dist/schemas/bundled/07-data-model-layer.schema.json +0 -1253
- package/dist/schemas/bundled/08-datastore-layer.schema.json +0 -892
- package/dist/schemas/bundled/09-ux-layer.schema.json +0 -1506
- package/dist/schemas/bundled/10-navigation-layer.schema.json +0 -843
- package/dist/schemas/bundled/11-apm-observability-layer.schema.json +0 -1430
- package/dist/schemas/bundled/12-testing-layer.schema.json +0 -1091
- package/dist/schemas/bundled/common/layer-extensions.schema.json +0 -266
- package/dist/schemas/bundled/common/predicates.schema.json +0 -493
- package/dist/schemas/bundled/common/relationships.schema.json +0 -791
- package/dist/schemas/bundled/common/source-references.schema.json +0 -71
- package/dist/schemas/bundled/link-registry.json +0 -1839
- package/dist/schemas/bundled/link-registry.schema.json +0 -339
- package/dist/schemas/bundled/relationship-catalog.json +0 -1302
- package/dist/schemas/bundled/relationship-type.schema.json +0 -221
- package/dist/utils/model-path.js +0 -22
- package/dist/utils/model-path.js.map +0 -7
- package/docs/TEST-INSTRUMENTATION.md +0 -405
- package/docs/telemetry.md +0 -427
- package/test-debug.js +0 -33
- package/test-special.mjs +0 -46
- package/test_runner.ts +0 -7
|
@@ -0,0 +1,295 @@
|
|
|
1
|
+
# dr_engineering_guide — Engineering Guidance Skill
|
|
2
|
+
|
|
3
|
+
## Purpose
|
|
4
|
+
|
|
5
|
+
Provides structured engineering guidance across three phases of implementation work:
|
|
6
|
+
|
|
7
|
+
- **Mode 1: Requirements Review** — Before any code is written
|
|
8
|
+
- **Mode 2: Implementation Guidance** — While structuring implementation
|
|
9
|
+
- **Mode 3: Implementation Critique** — After code exists (PR review, code review)
|
|
10
|
+
|
|
11
|
+
This skill is advisory-only. It always recommends a DR command to run next rather than executing model changes directly.
|
|
12
|
+
|
|
13
|
+
## When This Skill Activates
|
|
14
|
+
|
|
15
|
+
This skill should activate when the user:
|
|
16
|
+
|
|
17
|
+
- Shares code or a PR for review
|
|
18
|
+
- Asks "does this make sense architecturally?"
|
|
19
|
+
- Asks "how should I implement X?"
|
|
20
|
+
- Asks "is this the right pattern?"
|
|
21
|
+
- Says "review my code" or "review this PR"
|
|
22
|
+
- Asks "am I missing anything?"
|
|
23
|
+
- Mentions a feature they're about to build
|
|
24
|
+
- Asks "what should I build first?"
|
|
25
|
+
|
|
26
|
+
## Routing Logic
|
|
27
|
+
|
|
28
|
+
```
|
|
29
|
+
Does the user have existing code/PR to show?
|
|
30
|
+
└─ Yes → Mode 3: Implementation Critique
|
|
31
|
+
|
|
32
|
+
Is the user asking HOW to implement something?
|
|
33
|
+
└─ Yes → Mode 2: Implementation Guidance
|
|
34
|
+
|
|
35
|
+
Is the user describing something they WANT to build (not yet built)?
|
|
36
|
+
└─ Yes → Mode 1: Requirements Review
|
|
37
|
+
```
|
|
38
|
+
|
|
39
|
+
When ambiguous, ask: "Are you about to start building this, currently building it, or sharing finished code for review?"
|
|
40
|
+
|
|
41
|
+
---
|
|
42
|
+
|
|
43
|
+
## Mode 1: Requirements Review
|
|
44
|
+
|
|
45
|
+
**Triggered when:** User describes a feature or change they want to make, before implementation begins.
|
|
46
|
+
|
|
47
|
+
**Goal:** Surface architectural concerns, gaps, and alignment issues before any code is written.
|
|
48
|
+
|
|
49
|
+
### Checklist to Work Through
|
|
50
|
+
|
|
51
|
+
**1. Layer Coverage Check**
|
|
52
|
+
Map the proposed change to the 12-layer model:
|
|
53
|
+
|
|
54
|
+
- Which layers are touched? (List them explicitly)
|
|
55
|
+
- Which layers are conspicuously absent? (e.g., a new service with no APM or security)
|
|
56
|
+
- Flag: "This proposal affects X layers — are you planning to address all of them?"
|
|
57
|
+
|
|
58
|
+
**2. Layer Hierarchy Check**
|
|
59
|
+
|
|
60
|
+
- Does the proposal respect the "higher layers reference lower layers" rule?
|
|
61
|
+
- Example red flag: "A data-store change that has no corresponding data-model change"
|
|
62
|
+
- Example red flag: "An API endpoint that doesn't map to any application service"
|
|
63
|
+
|
|
64
|
+
**3. Motivation Alignment Check**
|
|
65
|
+
|
|
66
|
+
- Does the proposal trace back to an existing motivation element (goal, requirement)?
|
|
67
|
+
- If not: "I don't see a goal or requirement in the model for this. Is this a new business need? Consider adding one with /dr-design."
|
|
68
|
+
|
|
69
|
+
**4. Missing Concerns**
|
|
70
|
+
Explicitly check for:
|
|
71
|
+
|
|
72
|
+
- **Security**: Are there access controls defined? Who can use this feature?
|
|
73
|
+
- **Observability**: Are there metrics, spans, or alerts planned?
|
|
74
|
+
- **Testing**: What test cases validate this feature?
|
|
75
|
+
- **Error handling**: What happens when this fails? Is there a fallback?
|
|
76
|
+
|
|
77
|
+
**5. Cross-Layer Reference Completeness**
|
|
78
|
+
|
|
79
|
+
- If a new API endpoint is proposed, is there a corresponding application service?
|
|
80
|
+
- If a new application service is proposed, does it trace to a business service?
|
|
81
|
+
|
|
82
|
+
### Output Format
|
|
83
|
+
|
|
84
|
+
```
|
|
85
|
+
Requirements Review: [Feature Name]
|
|
86
|
+
=====================================
|
|
87
|
+
|
|
88
|
+
LAYER COVERAGE
|
|
89
|
+
Touched: motivation, application, api, data-model
|
|
90
|
+
Missing: security (⚠️ no access controls mentioned), apm (⚠️ no monitoring planned)
|
|
91
|
+
|
|
92
|
+
MOTIVATION ALIGNMENT
|
|
93
|
+
✓ Traces to: motivation.goal.customer-retention (existing)
|
|
94
|
+
— or —
|
|
95
|
+
⚠️ No existing goal covers this. Recommend adding one before implementation.
|
|
96
|
+
|
|
97
|
+
LAYER HIERARCHY
|
|
98
|
+
✓ Layers flow correctly (application → api, application → data-model)
|
|
99
|
+
— or —
|
|
100
|
+
⚠️ Issue: [specific hierarchy violation]
|
|
101
|
+
|
|
102
|
+
CONCERNS
|
|
103
|
+
⚠️ Security: No authentication scheme specified for the new endpoint
|
|
104
|
+
⚠️ APM: No SLO or latency target mentioned
|
|
105
|
+
ℹ️ Testing: Integration tests should cover the state machine transitions
|
|
106
|
+
|
|
107
|
+
VERDICT
|
|
108
|
+
[Approved / Approved with concerns / Needs revision]
|
|
109
|
+
|
|
110
|
+
RECOMMENDED NEXT STEP
|
|
111
|
+
Run: /dr-design "[feature description]"
|
|
112
|
+
This will generate a complete model design across all affected layers with reasoning.
|
|
113
|
+
```
|
|
114
|
+
|
|
115
|
+
---
|
|
116
|
+
|
|
117
|
+
## Mode 2: Implementation Guidance
|
|
118
|
+
|
|
119
|
+
**Triggered when:** User is about to implement something and asks how to structure it.
|
|
120
|
+
|
|
121
|
+
**Goal:** Ground the implementation in the existing model — find the patterns to follow, explain the expected structure.
|
|
122
|
+
|
|
123
|
+
### Steps to Follow
|
|
124
|
+
|
|
125
|
+
**1. Look Up Relevant Model Elements**
|
|
126
|
+
|
|
127
|
+
```bash
|
|
128
|
+
dr search "<key terms from the feature>"
|
|
129
|
+
dr list <most relevant layer>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
**2. Find Source-Tracked Elements as Canonical Patterns**
|
|
133
|
+
|
|
134
|
+
```bash
|
|
135
|
+
dr search --source-file <path> --layer application
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Elements with source file tracking are the patterns to follow — they represent how the team has already built this kind of thing.
|
|
139
|
+
|
|
140
|
+
**3. Describe the Expected Patterns**
|
|
141
|
+
For each relevant layer the implementation touches, describe:
|
|
142
|
+
|
|
143
|
+
- What the canonical element type is (e.g., ApplicationService, ApiOperation)
|
|
144
|
+
- What the naming convention is (layer.type.kebab-name)
|
|
145
|
+
- What cross-layer relationships it should have
|
|
146
|
+
- What the implementation pattern looks like in code
|
|
147
|
+
|
|
148
|
+
**4. Cross-Reference with Spec Layer Types**
|
|
149
|
+
|
|
150
|
+
```bash
|
|
151
|
+
dr schema types <layer>
|
|
152
|
+
dr schema node <spec-node-id>
|
|
153
|
+
```
|
|
154
|
+
|
|
155
|
+
"Your service should match the ApplicationService spec type, which means: single responsibility, exposes at most one API contract, references exactly one business service."
|
|
156
|
+
|
|
157
|
+
**5. Suggest Implementation Order**
|
|
158
|
+
Based on the 12-layer model, suggest bottom-up implementation:
|
|
159
|
+
|
|
160
|
+
1. Data model / data store first (schema before logic)
|
|
161
|
+
2. Application service next (business logic)
|
|
162
|
+
3. API operations last (contract layer)
|
|
163
|
+
4. Cross-cutting: security, APM, testing alongside each layer
|
|
164
|
+
|
|
165
|
+
**6. Flag Common Pitfalls for This Change Type**
|
|
166
|
+
Draw on layer-specific knowledge:
|
|
167
|
+
|
|
168
|
+
- "Application services shouldn't directly call the data store — route through a repository pattern"
|
|
169
|
+
- "API operations should expose, not implement, business logic"
|
|
170
|
+
|
|
171
|
+
### Output Format
|
|
172
|
+
|
|
173
|
+
```
|
|
174
|
+
Implementation Guidance: [Feature Name]
|
|
175
|
+
=========================================
|
|
176
|
+
|
|
177
|
+
EXISTING PATTERNS TO FOLLOW
|
|
178
|
+
Similar element: application.service.order-service
|
|
179
|
+
Source: src/services/order.ts
|
|
180
|
+
Pattern: Service class with repository injection, exposes via api.operation.*
|
|
181
|
+
|
|
182
|
+
EXPECTED STRUCTURE
|
|
183
|
+
Layer: application
|
|
184
|
+
Type: application.service (ApplicationService spec type)
|
|
185
|
+
Naming: application.service.<kebab-name>
|
|
186
|
+
Required relationships:
|
|
187
|
+
- realizes → business.service.<matching-business-service>
|
|
188
|
+
- exposes (via API layer) → api.operation.*
|
|
189
|
+
|
|
190
|
+
IMPLEMENTATION ORDER
|
|
191
|
+
1. data-model.entity.<name> — define schema first
|
|
192
|
+
2. data-store.table.<name> — create table/migration
|
|
193
|
+
3. application.service.<name> — implement business logic
|
|
194
|
+
4. api.operation.<name> — define contract
|
|
195
|
+
|
|
196
|
+
PITFALLS TO AVOID
|
|
197
|
+
- Don't embed SQL in service classes — use repository pattern (see order.ts)
|
|
198
|
+
- Don't return internal entity types from API operations — use DTOs
|
|
199
|
+
|
|
200
|
+
RECOMMENDED NEXT STEP
|
|
201
|
+
When implementation is complete, run: /dr-sync --branch <your-branch>
|
|
202
|
+
to update the model with the new elements.
|
|
203
|
+
```
|
|
204
|
+
|
|
205
|
+
---
|
|
206
|
+
|
|
207
|
+
## Mode 3: Implementation Critique
|
|
208
|
+
|
|
209
|
+
**Triggered when:** User shares existing code or a PR and wants to know if it matches the model.
|
|
210
|
+
|
|
211
|
+
**Goal:** Identify model drift, pattern violations, and traceability gaps. Always end with a concrete next step.
|
|
212
|
+
|
|
213
|
+
### Steps to Follow
|
|
214
|
+
|
|
215
|
+
**1. Identify Corresponding Model Elements**
|
|
216
|
+
|
|
217
|
+
```bash
|
|
218
|
+
dr search --source-file <changed-file>
|
|
219
|
+
dr search "<class/function name from code>"
|
|
220
|
+
```
|
|
221
|
+
|
|
222
|
+
For each significant class or module in the code, find the matching model element (if any).
|
|
223
|
+
|
|
224
|
+
**2. Check for Model Drift**
|
|
225
|
+
|
|
226
|
+
- New classes with no model element? → Flag as "untracked element"
|
|
227
|
+
- Renamed classes that don't match element IDs? → Flag as "naming drift"
|
|
228
|
+
- Deleted classes still in the model? → Flag as "ghost element"
|
|
229
|
+
- New endpoints not in the API layer? → Flag as "undocumented API operation"
|
|
230
|
+
|
|
231
|
+
**3. Check Pattern Compliance**
|
|
232
|
+
For each identified model element, verify:
|
|
233
|
+
|
|
234
|
+
- Does the code class name match the element naming convention?
|
|
235
|
+
- Are layer boundaries respected? (e.g., no direct DB calls from API route handlers)
|
|
236
|
+
- Are cross-layer references implemented correctly? (e.g., does the service actually call what the model says it depends on?)
|
|
237
|
+
- Is there a corresponding test case in the testing layer?
|
|
238
|
+
|
|
239
|
+
**4. Check Traceability Quality**
|
|
240
|
+
|
|
241
|
+
- Does each new/changed service trace back to a business service in the model?
|
|
242
|
+
- Is there APM instrumentation for the implementation?
|
|
243
|
+
- Are cross-layer references present in the code (not just in the model)?
|
|
244
|
+
|
|
245
|
+
### Output Format
|
|
246
|
+
|
|
247
|
+
```
|
|
248
|
+
Implementation Critique: [Feature/PR Name]
|
|
249
|
+
============================================
|
|
250
|
+
|
|
251
|
+
MODEL DRIFT
|
|
252
|
+
⚠️ Untracked: PaymentProcessorService (src/services/payment-processor.ts)
|
|
253
|
+
→ No model element for this class. Add it with /dr-model or /dr-sync
|
|
254
|
+
✓ Tracked: OrderService matches application.service.order-service
|
|
255
|
+
⚠️ Ghost: application.service.legacy-billing still in model (billing.ts was deleted)
|
|
256
|
+
→ Remove with: dr delete application.service.legacy-billing --force
|
|
257
|
+
|
|
258
|
+
PATTERN COMPLIANCE
|
|
259
|
+
✓ OrderService: follows service pattern (single responsibility, repository injection)
|
|
260
|
+
⚠️ PaymentController: directly queries DB without going through service layer
|
|
261
|
+
→ This violates the application/data-store layer boundary
|
|
262
|
+
✓ API operations: all route handlers delegate to services (no logic in routes)
|
|
263
|
+
|
|
264
|
+
TRACEABILITY
|
|
265
|
+
✓ OrderService → realizes → business.service.order-management
|
|
266
|
+
⚠️ PaymentProcessorService → no business service reference
|
|
267
|
+
⚠️ POST /api/v1/payments → not in model (undocumented API operation)
|
|
268
|
+
✓ APM spans present in order-service.ts (opentelemetry instrumentation found)
|
|
269
|
+
|
|
270
|
+
VERDICT
|
|
271
|
+
[Pass / Pass with warnings / Needs fixes before merge]
|
|
272
|
+
|
|
273
|
+
RECOMMENDED NEXT STEP
|
|
274
|
+
Run /dr-sync to update the model to match this implementation:
|
|
275
|
+
- Add application.service.payment-processor
|
|
276
|
+
- Add api.operation.create-payment
|
|
277
|
+
- Remove application.service.legacy-billing
|
|
278
|
+
- Link new elements to business services
|
|
279
|
+
— or —
|
|
280
|
+
Fix the layer boundary violation (PaymentController direct DB query) before merging.
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
---
|
|
284
|
+
|
|
285
|
+
## General Principles
|
|
286
|
+
|
|
287
|
+
**Advisory only.** Never run `dr add`, `dr update`, `dr delete`, or `dr changeset` commands directly in this skill. Always recommend the appropriate command for the user to run or delegate to dr-architect.
|
|
288
|
+
|
|
289
|
+
**Be specific.** Vague feedback like "this could be better" is not useful. Reference element IDs, file names, line numbers, and spec types.
|
|
290
|
+
|
|
291
|
+
**Be constructive.** Every issue identified should have a concrete remediation — a specific command to run or a specific code change to make.
|
|
292
|
+
|
|
293
|
+
**Prioritize actionability.** Don't overwhelm with every possible issue. Lead with the highest-impact concerns, then list lower-priority items.
|
|
294
|
+
|
|
295
|
+
**Close the loop.** Every mode ends with a "RECOMMENDED NEXT STEP" that tells the user exactly what to do next — whether it's `/dr-design`, `/dr-sync`, a specific code fix, or `/dr-changeset commit`.
|
|
@@ -0,0 +1,328 @@
|
|
|
1
|
+
import { BaseIntegrationManager } from "./base-manager.js";
|
|
2
|
+
import { findProjectRoot } from "../utils/project-paths.js";
|
|
3
|
+
import { confirm, spinner, isCancel } from "@clack/prompts";
|
|
4
|
+
import ansis from "ansis";
|
|
5
|
+
import { join } from "node:path";
|
|
6
|
+
import { mkdir } from "node:fs/promises";
|
|
7
|
+
import { existsSync } from "node:fs";
|
|
8
|
+
class CopilotIntegrationManager extends BaseIntegrationManager {
|
|
9
|
+
targetDir = ".github";
|
|
10
|
+
versionFileName = ".dr-copilot-version";
|
|
11
|
+
integrationSourceDir = "github_copilot";
|
|
12
|
+
/**
|
|
13
|
+
* Component configuration for Copilot integration
|
|
14
|
+
* Extends BaseIntegrationManager with Copilot-specific components.
|
|
15
|
+
*
|
|
16
|
+
* All components are DR-owned (tracked: true by default).
|
|
17
|
+
* See isTrackedComponent in base-manager.ts for tracking logic.
|
|
18
|
+
*/
|
|
19
|
+
components = {
|
|
20
|
+
agents: {
|
|
21
|
+
source: "agents",
|
|
22
|
+
target: "agents",
|
|
23
|
+
description: "Specialized sub-agent definitions",
|
|
24
|
+
prefix: "",
|
|
25
|
+
type: "files"
|
|
26
|
+
// tracked: true (default)
|
|
27
|
+
},
|
|
28
|
+
skills: {
|
|
29
|
+
source: "skills",
|
|
30
|
+
target: "skills",
|
|
31
|
+
description: "Auto-activating capabilities",
|
|
32
|
+
prefix: "",
|
|
33
|
+
type: "dirs"
|
|
34
|
+
// tracked: true (default)
|
|
35
|
+
}
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Install Copilot integration files
|
|
39
|
+
*
|
|
40
|
+
* Copies files from bundled source to .github/ directory, prompting for
|
|
41
|
+
* confirmation if files already exist. Optionally filters to specific components.
|
|
42
|
+
*
|
|
43
|
+
* @param options Installation options
|
|
44
|
+
* @param options.components Optional list of component names to install
|
|
45
|
+
* @param options.force Skip confirmation prompts
|
|
46
|
+
*/
|
|
47
|
+
async install(options = {}) {
|
|
48
|
+
const projectRoot = await this.getProjectRoot();
|
|
49
|
+
this.targetDir = join(projectRoot, ".github");
|
|
50
|
+
const { components = Object.keys(this.components), force = !1 } = options, invalid = components.filter((c) => !this.components[c]);
|
|
51
|
+
if (invalid.length > 0)
|
|
52
|
+
throw new Error(`Invalid components: ${invalid.join(", ")}
|
|
53
|
+
Valid: ${Object.keys(this.components).join(", ")}`);
|
|
54
|
+
if (await this.isInstalled() && !force) {
|
|
55
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY))
|
|
56
|
+
throw new Error(`Interactive confirmation is not available in non-TTY environments.
|
|
57
|
+
Use --force to skip confirmation and proceed with installation`);
|
|
58
|
+
const response = await confirm({
|
|
59
|
+
message: "GitHub Copilot integration already installed. Overwrite?"
|
|
60
|
+
});
|
|
61
|
+
if (isCancel(response) || !response) {
|
|
62
|
+
console.log(ansis.yellow("\u2717 Installation cancelled"));
|
|
63
|
+
return;
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
await mkdir(this.targetDir, { recursive: !0 });
|
|
67
|
+
let totalInstalled = 0;
|
|
68
|
+
const spinnerObj = spinner();
|
|
69
|
+
spinnerObj.start("Installing components...");
|
|
70
|
+
try {
|
|
71
|
+
for (const componentName of components) {
|
|
72
|
+
const count = await this.installComponent(componentName, force);
|
|
73
|
+
totalInstalled += count;
|
|
74
|
+
}
|
|
75
|
+
spinnerObj.stop("Installation complete");
|
|
76
|
+
const cliVersion = await this.getCliVersion();
|
|
77
|
+
await this.updateVersionFile(cliVersion), console.log(ansis.green("\u2713 GitHub Copilot integration installed successfully!")), console.log(ansis.green(" Installed " + totalInstalled + " files")), this.printNextSteps();
|
|
78
|
+
} catch (error) {
|
|
79
|
+
throw spinnerObj.stop("Installation failed"), error;
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
/**
|
|
83
|
+
* Upgrade installed Copilot integration files
|
|
84
|
+
*
|
|
85
|
+
* Detects file changes, shows a summary, and applies upgrades with optional
|
|
86
|
+
* dry-run mode to preview changes without applying them.
|
|
87
|
+
*
|
|
88
|
+
* @param options Upgrade options
|
|
89
|
+
* @param options.dryRun Preview changes without applying
|
|
90
|
+
* @param options.force Skip confirmation prompts and overwrite conflict/user-modified files
|
|
91
|
+
*/
|
|
92
|
+
async upgrade(options = {}) {
|
|
93
|
+
const projectRoot = await this.getProjectRoot();
|
|
94
|
+
this.targetDir = join(projectRoot, ".github");
|
|
95
|
+
const { dryRun = !1, force = !1 } = options;
|
|
96
|
+
if (!await this.isInstalled()) {
|
|
97
|
+
console.log(ansis.yellow("\u26A0 GitHub Copilot integration not installed")), console.log(ansis.dim("Run: dr copilot install"));
|
|
98
|
+
return;
|
|
99
|
+
}
|
|
100
|
+
const versionData = await this.loadVersionFile();
|
|
101
|
+
if (!versionData)
|
|
102
|
+
throw new Error("Version file corrupted. Run: dr copilot install");
|
|
103
|
+
let totalChanges = 0;
|
|
104
|
+
const changes = [], unknownComponents = /* @__PURE__ */ new Set();
|
|
105
|
+
for (const componentName of Object.keys(versionData.components || {})) {
|
|
106
|
+
const config = this.components[componentName];
|
|
107
|
+
if (!config) {
|
|
108
|
+
unknownComponents.add(componentName), console.warn(ansis.yellow(`\u26A0 Unknown component in version file: ${componentName}. Skipping.`));
|
|
109
|
+
continue;
|
|
110
|
+
}
|
|
111
|
+
const targetPath = join(this.targetDir, config.target);
|
|
112
|
+
if (!existsSync(targetPath))
|
|
113
|
+
continue;
|
|
114
|
+
const componentChanges = await this.checkUpdates(componentName, versionData);
|
|
115
|
+
for (const change of componentChanges) {
|
|
116
|
+
const status = this.changeTypeToStatus(change.changeType), action = force && (change.changeType === "conflict" || change.changeType === "user-modified") ? "Overwrite" : this.changeTypeToAction(change.changeType);
|
|
117
|
+
changes.push({
|
|
118
|
+
file: change.component + "/" + change.path,
|
|
119
|
+
status,
|
|
120
|
+
action
|
|
121
|
+
}), totalChanges++;
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
const obsolete = await this.detectObsoleteFiles();
|
|
125
|
+
for (const file of obsolete)
|
|
126
|
+
changes.push({
|
|
127
|
+
file: file.component + "/" + file.path,
|
|
128
|
+
status: "Obsolete",
|
|
129
|
+
action: "Remove"
|
|
130
|
+
}), totalChanges++;
|
|
131
|
+
if (totalChanges === 0) {
|
|
132
|
+
console.log(ansis.green("\u2713 All files are up to date"));
|
|
133
|
+
const cliVersion = await this.getCliVersion();
|
|
134
|
+
versionData.version !== cliVersion && (await this.updateVersionFile(cliVersion), console.log(ansis.green("\u2713 Version updated to " + cliVersion)));
|
|
135
|
+
return;
|
|
136
|
+
}
|
|
137
|
+
console.log(ansis.bold(`
|
|
138
|
+
Planned Changes:`));
|
|
139
|
+
for (const change of changes) {
|
|
140
|
+
const statusColor = change.status === "Obsolete" ? ansis.yellow : ansis.cyan, actionColor = change.action === "Remove" ? ansis.red : ansis.green;
|
|
141
|
+
console.log(" " + statusColor(change.status.padEnd(10)) + " " + change.file + " " + actionColor(change.action));
|
|
142
|
+
}
|
|
143
|
+
if (dryRun) {
|
|
144
|
+
console.log(ansis.yellow(`
|
|
145
|
+
Dry run - no changes applied`));
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
if (!changes.some((c) => c.action !== "Skip")) {
|
|
149
|
+
console.log(ansis.yellow("\u26A0 No changes to apply (all changes are skipped or conflicts)"));
|
|
150
|
+
return;
|
|
151
|
+
}
|
|
152
|
+
if (!force) {
|
|
153
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY))
|
|
154
|
+
throw new Error(`Interactive confirmation is not available in non-TTY environments.
|
|
155
|
+
Use --force to skip confirmation and proceed with upgrade`);
|
|
156
|
+
const response = await confirm({
|
|
157
|
+
message: "Apply upgrades?"
|
|
158
|
+
});
|
|
159
|
+
if (isCancel(response) || !response) {
|
|
160
|
+
console.log(ansis.yellow("\u2717 Upgrade cancelled"));
|
|
161
|
+
return;
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
const spinnerObj = spinner();
|
|
165
|
+
spinnerObj.start("Applying upgrades...");
|
|
166
|
+
try {
|
|
167
|
+
for (const componentName of Object.keys(versionData.components || {})) {
|
|
168
|
+
if (unknownComponents.has(componentName))
|
|
169
|
+
continue;
|
|
170
|
+
const config = this.components[componentName];
|
|
171
|
+
if (!config)
|
|
172
|
+
continue;
|
|
173
|
+
const targetPath = join(this.targetDir, config.target);
|
|
174
|
+
existsSync(targetPath) && await this.installComponent(componentName, force);
|
|
175
|
+
}
|
|
176
|
+
await this.removeObsoleteFiles(), spinnerObj.stop("Upgrades applied");
|
|
177
|
+
const cliVersion = await this.getCliVersion();
|
|
178
|
+
await this.updateVersionFile(cliVersion), console.log(ansis.green("\u2713 Upgrade completed successfully!"));
|
|
179
|
+
} catch (error) {
|
|
180
|
+
throw spinnerObj.stop("Upgrade failed"), error;
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
/**
|
|
184
|
+
* Remove Copilot integration files
|
|
185
|
+
*
|
|
186
|
+
* Removes files and the version file. Optionally filters to specific components.
|
|
187
|
+
*
|
|
188
|
+
* @param options Remove options
|
|
189
|
+
* @param options.components Optional list of component names to remove
|
|
190
|
+
* @param options.force Skip confirmation prompts
|
|
191
|
+
*/
|
|
192
|
+
async remove(options = {}) {
|
|
193
|
+
const projectRoot = await this.getProjectRoot();
|
|
194
|
+
this.targetDir = join(projectRoot, ".github");
|
|
195
|
+
const { components = Object.keys(this.components), force = !1 } = options;
|
|
196
|
+
if (!await this.isInstalled()) {
|
|
197
|
+
console.log(ansis.yellow("\u26A0 GitHub Copilot integration not installed"));
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
if (!force) {
|
|
201
|
+
if (!(process.stdin.isTTY && process.stdout.isTTY))
|
|
202
|
+
throw new Error(`Interactive confirmation is not available in non-TTY environments.
|
|
203
|
+
Use --force to skip confirmation and proceed with removal`);
|
|
204
|
+
console.log(ansis.yellow("This will remove: " + components.join(", ")));
|
|
205
|
+
const response = await confirm({
|
|
206
|
+
message: "Continue?"
|
|
207
|
+
});
|
|
208
|
+
if (isCancel(response) || !response) {
|
|
209
|
+
console.log(ansis.yellow("\u2717 Removal cancelled"));
|
|
210
|
+
return;
|
|
211
|
+
}
|
|
212
|
+
}
|
|
213
|
+
const spinnerObj = spinner();
|
|
214
|
+
spinnerObj.start("Removing files...");
|
|
215
|
+
try {
|
|
216
|
+
const fs = await import("node:fs/promises"), { rmSync } = await import("node:fs");
|
|
217
|
+
let removedCount = 0;
|
|
218
|
+
for (const componentName of components) {
|
|
219
|
+
const config = this.components[componentName];
|
|
220
|
+
if (!config)
|
|
221
|
+
continue;
|
|
222
|
+
const targetPath = join(this.targetDir, config.target);
|
|
223
|
+
existsSync(targetPath) && (rmSync(targetPath, { recursive: !0, force: !0 }), removedCount++);
|
|
224
|
+
}
|
|
225
|
+
if (components.length === Object.keys(this.components).length) {
|
|
226
|
+
const versionFile = join(this.targetDir, this.versionFileName);
|
|
227
|
+
existsSync(versionFile) && await fs.unlink(versionFile);
|
|
228
|
+
}
|
|
229
|
+
spinnerObj.stop("Removal complete"), console.log(ansis.green("\u2713 Removed " + removedCount + " component(s) successfully"));
|
|
230
|
+
} catch (error) {
|
|
231
|
+
throw spinnerObj.stop("Removal failed"), error;
|
|
232
|
+
}
|
|
233
|
+
}
|
|
234
|
+
/**
|
|
235
|
+
* Display installation status
|
|
236
|
+
*
|
|
237
|
+
* Shows what's installed, which files are modified, and version information.
|
|
238
|
+
*/
|
|
239
|
+
async status() {
|
|
240
|
+
const projectRoot = await this.getProjectRoot();
|
|
241
|
+
if (this.targetDir = join(projectRoot, ".github"), !await this.isInstalled()) {
|
|
242
|
+
console.log(ansis.yellow("GitHub Copilot integration not installed")), console.log(ansis.dim("Run: dr copilot install"));
|
|
243
|
+
return;
|
|
244
|
+
}
|
|
245
|
+
const versionData = await this.loadVersionFile();
|
|
246
|
+
if (!versionData) {
|
|
247
|
+
console.log(ansis.red("\u2717 Version file corrupted"));
|
|
248
|
+
return;
|
|
249
|
+
}
|
|
250
|
+
console.log(ansis.bold(`
|
|
251
|
+
Installation Status`)), console.log("Version: " + ansis.cyan(versionData.version)), console.log("Installed: " + ansis.cyan(new Date(versionData.installed_at).toLocaleString())), console.log(""), console.log(ansis.bold("Components:"));
|
|
252
|
+
for (const [componentName] of Object.entries(this.components)) {
|
|
253
|
+
const files = versionData.components[componentName] || {}, fileCount = Object.keys(files).length, status = fileCount > 0 ? ansis.green("\u2713") : ansis.dim("-");
|
|
254
|
+
console.log(" " + status + " " + componentName.padEnd(20) + " " + fileCount + " files");
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
/**
|
|
258
|
+
* List available components
|
|
259
|
+
*
|
|
260
|
+
* Shows all components that can be installed along with descriptions.
|
|
261
|
+
*/
|
|
262
|
+
async list() {
|
|
263
|
+
console.log(ansis.bold(`
|
|
264
|
+
Available Components:`)), console.log("");
|
|
265
|
+
for (const [name, config] of Object.entries(this.components))
|
|
266
|
+
console.log(ansis.cyan(name)), console.log(ansis.dim(" " + config.description)), console.log("");
|
|
267
|
+
}
|
|
268
|
+
/**
|
|
269
|
+
* Get the project root directory
|
|
270
|
+
*
|
|
271
|
+
* @returns Absolute path to project root
|
|
272
|
+
* @throws Error if no project found
|
|
273
|
+
*/
|
|
274
|
+
async getProjectRoot() {
|
|
275
|
+
const root = await findProjectRoot();
|
|
276
|
+
if (!root)
|
|
277
|
+
throw new Error('No DR project found. Run "dr init" to create a new project');
|
|
278
|
+
return root;
|
|
279
|
+
}
|
|
280
|
+
/**
|
|
281
|
+
* Convert change type to human-readable status
|
|
282
|
+
*/
|
|
283
|
+
changeTypeToStatus(changeType) {
|
|
284
|
+
switch (changeType) {
|
|
285
|
+
case "added":
|
|
286
|
+
return "New";
|
|
287
|
+
case "modified":
|
|
288
|
+
return "Updated";
|
|
289
|
+
case "user-modified":
|
|
290
|
+
return "Modified";
|
|
291
|
+
case "conflict":
|
|
292
|
+
return "Conflict";
|
|
293
|
+
case "deleted":
|
|
294
|
+
return "Removed";
|
|
295
|
+
default:
|
|
296
|
+
return changeType;
|
|
297
|
+
}
|
|
298
|
+
}
|
|
299
|
+
/**
|
|
300
|
+
* Convert change type to action
|
|
301
|
+
*/
|
|
302
|
+
changeTypeToAction(changeType) {
|
|
303
|
+
switch (changeType) {
|
|
304
|
+
case "added":
|
|
305
|
+
case "modified":
|
|
306
|
+
case "deleted":
|
|
307
|
+
return "Update";
|
|
308
|
+
case "user-modified":
|
|
309
|
+
return "Skip";
|
|
310
|
+
case "conflict":
|
|
311
|
+
return "Skip";
|
|
312
|
+
default:
|
|
313
|
+
return "Update";
|
|
314
|
+
}
|
|
315
|
+
}
|
|
316
|
+
/**
|
|
317
|
+
* Print helpful next steps after installation
|
|
318
|
+
*/
|
|
319
|
+
printNextSteps() {
|
|
320
|
+
console.log(ansis.bold(`
|
|
321
|
+
Next steps:`)), console.log("1. Agents available in: .github/agents/"), console.log("2. Skills available in: .github/skills/"), console.log("3. Run: dr copilot status"), console.log(ansis.dim(`
|
|
322
|
+
Note: Restart Copilot to load new files`));
|
|
323
|
+
}
|
|
324
|
+
}
|
|
325
|
+
export {
|
|
326
|
+
CopilotIntegrationManager
|
|
327
|
+
};
|
|
328
|
+
//# sourceMappingURL=copilot-manager.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../../src/integrations/copilot-manager.ts"],
|
|
4
|
+
"sourcesContent": ["/**\n * GitHub Copilot Integration Manager\n *\n * Manages installation, updates, and removal of GitHub Copilot integration files.\n * Extends the base integration manager with Copilot-specific configuration and behavior.\n *\n * Handles 2 component types:\n * - agents: Specialized agents (.md files in agents/)\n * - skills: Auto-activating capabilities (directories with SKILL.md)\n */\n\nimport { BaseIntegrationManager } from \"./base-manager.js\";\nimport { ComponentConfig } from \"./types.js\";\nimport { findProjectRoot } from \"../utils/project-paths.js\";\nimport { confirm, spinner, isCancel } from \"@clack/prompts\";\nimport ansis from \"ansis\";\nimport { join } from \"node:path\";\nimport { mkdir } from \"node:fs/promises\";\nimport { existsSync } from \"node:fs\";\n\n/**\n * GitHub Copilot Integration Manager\n *\n * Manages installation and updating of GitHub Copilot integration files in .github/ directory\n */\nexport class CopilotIntegrationManager extends BaseIntegrationManager {\n protected targetDir: string = \".github\";\n protected readonly versionFileName = \".dr-copilot-version\";\n protected readonly integrationSourceDir = \"github_copilot\";\n\n /**\n * Component configuration for Copilot integration\n * Extends BaseIntegrationManager with Copilot-specific components.\n *\n * All components are DR-owned (tracked: true by default).\n * See isTrackedComponent in base-manager.ts for tracking logic.\n */\n protected readonly components: Record<string, ComponentConfig> = {\n agents: {\n source: \"agents\",\n target: \"agents\",\n description: \"Specialized sub-agent definitions\",\n prefix: \"\",\n type: \"files\",\n // tracked: true (default)\n },\n skills: {\n source: \"skills\",\n target: \"skills\",\n description: \"Auto-activating capabilities\",\n prefix: \"\",\n type: \"dirs\",\n // tracked: true (default)\n },\n };\n\n /**\n * Install Copilot integration files\n *\n * Copies files from bundled source to .github/ directory, prompting for\n * confirmation if files already exist. Optionally filters to specific components.\n *\n * @param options Installation options\n * @param options.components Optional list of component names to install\n * @param options.force Skip confirmation prompts\n */\n async install(\n options: {\n components?: string[];\n force?: boolean;\n } = {}\n ): Promise<void> {\n const projectRoot = await this.getProjectRoot();\n this.targetDir = join(projectRoot, \".github\");\n\n const { components = Object.keys(this.components), force = false } = options;\n\n // Validate components\n const invalid = components.filter((c) => !this.components[c]);\n if (invalid.length > 0) {\n throw new Error(\n `Invalid components: ${invalid.join(\", \")}\\n` +\n `Valid: ${Object.keys(this.components).join(\", \")}`\n );\n }\n\n // Check if already installed\n if (await this.isInstalled()) {\n if (!force) {\n // Check for non-TTY only when we need confirmation\n const isInteractive = process.stdin.isTTY && process.stdout.isTTY;\n if (!isInteractive) {\n throw new Error(\n \"Interactive confirmation is not available in non-TTY environments.\\n\" +\n \"Use --force to skip confirmation and proceed with installation\"\n );\n }\n\n const response = await confirm({\n message: \"GitHub Copilot integration already installed. Overwrite?\",\n });\n if (isCancel(response) || !response) {\n console.log(ansis.yellow(\"\u2717 Installation cancelled\"));\n return;\n }\n }\n }\n\n // Create .github directory\n await mkdir(this.targetDir, { recursive: true });\n\n // Install components\n let totalInstalled = 0;\n const spinnerObj = spinner();\n spinnerObj.start(\"Installing components...\");\n\n try {\n for (const componentName of components) {\n const count = await this.installComponent(componentName, force);\n totalInstalled += count;\n }\n\n spinnerObj.stop(\"Installation complete\");\n\n // Update version file\n const cliVersion = await this.getCliVersion();\n await this.updateVersionFile(cliVersion);\n\n console.log(ansis.green(\"\u2713 GitHub Copilot integration installed successfully!\"));\n console.log(ansis.green(\" Installed \" + totalInstalled + \" files\"));\n\n // Print next steps\n this.printNextSteps();\n } catch (error) {\n spinnerObj.stop(\"Installation failed\");\n throw error;\n }\n }\n\n /**\n * Upgrade installed Copilot integration files\n *\n * Detects file changes, shows a summary, and applies upgrades with optional\n * dry-run mode to preview changes without applying them.\n *\n * @param options Upgrade options\n * @param options.dryRun Preview changes without applying\n * @param options.force Skip confirmation prompts and overwrite conflict/user-modified files\n */\n async upgrade(\n options: {\n dryRun?: boolean;\n force?: boolean;\n } = {}\n ): Promise<void> {\n const projectRoot = await this.getProjectRoot();\n this.targetDir = join(projectRoot, \".github\");\n\n const { dryRun = false, force = false } = options;\n\n // Check if installed\n if (!(await this.isInstalled())) {\n console.log(ansis.yellow(\"\u26A0 GitHub Copilot integration not installed\"));\n console.log(ansis.dim(\"Run: dr copilot install\"));\n return;\n }\n\n // Load version file\n const versionData = await this.loadVersionFile();\n if (!versionData) {\n throw new Error(\"Version file corrupted. Run: dr copilot install\");\n }\n\n // Check for updates\n let totalChanges = 0;\n const changes: Array<{ file: string; status: string; action: string }> = [];\n const unknownComponents = new Set<string>();\n\n // Only check components that are currently installed (have actual files in target directory)\n for (const componentName of Object.keys(versionData.components || {})) {\n const config = this.components[componentName];\n\n // Track unknown components (e.g., if CLI was updated and a component was removed)\n if (!config) {\n unknownComponents.add(componentName);\n console.warn(\n ansis.yellow(`\u26A0 Unknown component in version file: ${componentName}. Skipping.`)\n );\n continue;\n }\n\n const targetPath = join(this.targetDir, config.target);\n\n // Only check components that have files in the target directory\n if (!existsSync(targetPath)) {\n continue;\n }\n\n const componentChanges = await this.checkUpdates(componentName, versionData);\n\n for (const change of componentChanges) {\n const status = this.changeTypeToStatus(change.changeType);\n // When force=true, conflicts and user-modified files are overwritten rather than skipped\n const action =\n force && (change.changeType === \"conflict\" || change.changeType === \"user-modified\")\n ? \"Overwrite\"\n : this.changeTypeToAction(change.changeType);\n changes.push({\n file: change.component + \"/\" + change.path,\n status,\n action,\n });\n totalChanges++;\n }\n }\n\n // Check for obsolete files\n const obsolete = await this.detectObsoleteFiles();\n for (const file of obsolete) {\n changes.push({\n file: file.component + \"/\" + file.path,\n status: \"Obsolete\",\n action: \"Remove\",\n });\n totalChanges++;\n }\n\n // If no changes, still update version file if needed\n if (totalChanges === 0) {\n console.log(ansis.green(\"\u2713 All files are up to date\"));\n\n // Update version file even if no file changes\n const cliVersion = await this.getCliVersion();\n if (versionData.version !== cliVersion) {\n await this.updateVersionFile(cliVersion);\n console.log(ansis.green(\"\u2713 Version updated to \" + cliVersion));\n }\n return;\n }\n\n // Show changes\n console.log(ansis.bold(\"\\nPlanned Changes:\"));\n for (const change of changes) {\n const statusColor = change.status === \"Obsolete\" ? ansis.yellow : ansis.cyan;\n const actionColor = change.action === \"Remove\" ? ansis.red : ansis.green;\n console.log(\n \" \" +\n statusColor(change.status.padEnd(10)) +\n \" \" +\n change.file +\n \" \" +\n actionColor(change.action)\n );\n }\n\n if (dryRun) {\n console.log(ansis.yellow(\"\\nDry run - no changes applied\"));\n return;\n }\n\n // Check if there are actual changes to apply (not just skipped changes)\n const hasActualChanges = changes.some((c) => c.action !== \"Skip\");\n\n // If no actual changes to apply, return early\n if (!hasActualChanges) {\n console.log(ansis.yellow(\"\u26A0 No changes to apply (all changes are skipped or conflicts)\"));\n return;\n }\n\n // Only ask for confirmation if there are real changes to apply\n if (!force) {\n const isInteractive = process.stdin.isTTY && process.stdout.isTTY;\n if (!isInteractive) {\n throw new Error(\n \"Interactive confirmation is not available in non-TTY environments.\\n\" +\n \"Use --force to skip confirmation and proceed with upgrade\"\n );\n }\n\n const response = await confirm({\n message: \"Apply upgrades?\",\n });\n if (isCancel(response) || !response) {\n console.log(ansis.yellow(\"\u2717 Upgrade cancelled\"));\n return;\n }\n }\n\n // Apply upgrades\n const spinnerObj = spinner();\n spinnerObj.start(\"Applying upgrades...\");\n\n try {\n // Only upgrade components that are currently installed (have actual files)\n for (const componentName of Object.keys(versionData.components || {})) {\n // Skip unknown components silently (already warned during detection phase)\n if (unknownComponents.has(componentName)) {\n continue;\n }\n\n const config = this.components[componentName];\n if (!config) {\n continue;\n }\n\n const targetPath = join(this.targetDir, config.target);\n\n // Only upgrade components that have files in the target directory\n if (!existsSync(targetPath)) {\n continue;\n }\n\n await this.installComponent(componentName, force);\n }\n\n // Remove obsolete files\n await this.removeObsoleteFiles();\n\n spinnerObj.stop(\"Upgrades applied\");\n\n // Update version file\n const cliVersion = await this.getCliVersion();\n await this.updateVersionFile(cliVersion);\n\n console.log(ansis.green(\"\u2713 Upgrade completed successfully!\"));\n } catch (error) {\n spinnerObj.stop(\"Upgrade failed\");\n throw error;\n }\n }\n\n /**\n * Remove Copilot integration files\n *\n * Removes files and the version file. Optionally filters to specific components.\n *\n * @param options Remove options\n * @param options.components Optional list of component names to remove\n * @param options.force Skip confirmation prompts\n */\n async remove(\n options: {\n components?: string[];\n force?: boolean;\n } = {}\n ): Promise<void> {\n const projectRoot = await this.getProjectRoot();\n this.targetDir = join(projectRoot, \".github\");\n\n const { components = Object.keys(this.components), force = false } = options;\n\n // Check if installed\n if (!(await this.isInstalled())) {\n console.log(ansis.yellow(\"\u26A0 GitHub Copilot integration not installed\"));\n return;\n }\n\n // Ask for confirmation (check for non-TTY only when we need confirmation)\n if (!force) {\n const isInteractive = process.stdin.isTTY && process.stdout.isTTY;\n if (!isInteractive) {\n throw new Error(\n \"Interactive confirmation is not available in non-TTY environments.\\n\" +\n \"Use --force to skip confirmation and proceed with removal\"\n );\n }\n\n console.log(ansis.yellow(\"This will remove: \" + components.join(\", \")));\n const response = await confirm({\n message: \"Continue?\",\n });\n if (isCancel(response) || !response) {\n console.log(ansis.yellow(\"\u2717 Removal cancelled\"));\n return;\n }\n }\n\n // Remove components\n const spinnerObj = spinner();\n spinnerObj.start(\"Removing files...\");\n\n try {\n const fs = await import(\"node:fs/promises\");\n const { rmSync } = await import(\"node:fs\");\n\n let removedCount = 0;\n\n for (const componentName of components) {\n const config = this.components[componentName];\n if (!config) continue;\n\n const targetPath = join(this.targetDir, config.target);\n if (existsSync(targetPath)) {\n rmSync(targetPath, { recursive: true, force: true });\n removedCount++;\n }\n }\n\n // Remove version file if all components were removed\n if (components.length === Object.keys(this.components).length) {\n const versionFile = join(this.targetDir, this.versionFileName);\n if (existsSync(versionFile)) {\n await fs.unlink(versionFile);\n }\n }\n\n spinnerObj.stop(\"Removal complete\");\n console.log(ansis.green(\"\u2713 Removed \" + removedCount + \" component(s) successfully\"));\n } catch (error) {\n spinnerObj.stop(\"Removal failed\");\n throw error;\n }\n }\n\n /**\n * Display installation status\n *\n * Shows what's installed, which files are modified, and version information.\n */\n async status(): Promise<void> {\n const projectRoot = await this.getProjectRoot();\n this.targetDir = join(projectRoot, \".github\");\n\n if (!(await this.isInstalled())) {\n console.log(ansis.yellow(\"GitHub Copilot integration not installed\"));\n console.log(ansis.dim(\"Run: dr copilot install\"));\n return;\n }\n\n const versionData = await this.loadVersionFile();\n if (!versionData) {\n console.log(ansis.red(\"\u2717 Version file corrupted\"));\n return;\n }\n\n console.log(ansis.bold(\"\\nInstallation Status\"));\n console.log(\"Version: \" + ansis.cyan(versionData.version));\n console.log(\"Installed: \" + ansis.cyan(new Date(versionData.installed_at).toLocaleString()));\n console.log(\"\");\n\n // Show component table\n console.log(ansis.bold(\"Components:\"));\n for (const [componentName] of Object.entries(this.components)) {\n const files = versionData.components[componentName] || {};\n const fileCount = Object.keys(files).length;\n const status = fileCount > 0 ? ansis.green(\"\u2713\") : ansis.dim(\"-\");\n\n console.log(\" \" + status + \" \" + componentName.padEnd(20) + \" \" + fileCount + \" files\");\n }\n }\n\n /**\n * List available components\n *\n * Shows all components that can be installed along with descriptions.\n */\n async list(): Promise<void> {\n console.log(ansis.bold(\"\\nAvailable Components:\"));\n console.log(\"\");\n\n for (const [name, config] of Object.entries(this.components)) {\n console.log(ansis.cyan(name));\n console.log(ansis.dim(\" \" + config.description));\n console.log(\"\");\n }\n }\n\n /**\n * Get the project root directory\n *\n * @returns Absolute path to project root\n * @throws Error if no project found\n */\n private async getProjectRoot(): Promise<string> {\n const root = await findProjectRoot();\n if (!root) {\n throw new Error('No DR project found. Run \"dr init\" to create a new project');\n }\n return root;\n }\n\n /**\n * Convert change type to human-readable status\n */\n private changeTypeToStatus(changeType: string): string {\n switch (changeType) {\n case \"added\":\n return \"New\";\n case \"modified\":\n return \"Updated\";\n case \"user-modified\":\n return \"Modified\";\n case \"conflict\":\n return \"Conflict\";\n case \"deleted\":\n return \"Removed\";\n default:\n return changeType;\n }\n }\n\n /**\n * Convert change type to action\n */\n private changeTypeToAction(changeType: string): string {\n switch (changeType) {\n case \"added\":\n case \"modified\":\n case \"deleted\":\n return \"Update\";\n case \"user-modified\":\n return \"Skip\";\n case \"conflict\":\n return \"Skip\";\n default:\n return \"Update\";\n }\n }\n\n /**\n * Print helpful next steps after installation\n */\n private printNextSteps(): void {\n console.log(ansis.bold(\"\\nNext steps:\"));\n console.log(\"1. Agents available in: .github/agents/\");\n console.log(\"2. Skills available in: .github/skills/\");\n console.log(\"3. Run: dr copilot status\");\n console.log(ansis.dim(\"\\nNote: Restart Copilot to load new files\"));\n }\n}\n"],
|
|
5
|
+
"mappings": "AAWA,SAAS,8BAA8B;AAEvC,SAAS,uBAAuB;AAChC,SAAS,SAAS,SAAS,gBAAgB;AAC3C,OAAO,WAAW;AAClB,SAAS,YAAY;AACrB,SAAS,aAAa;AACtB,SAAS,kBAAkB;AAOrB,MAAO,kCAAkC,uBAAsB;EACzD,YAAoB;EACX,kBAAkB;EAClB,uBAAuB;;;;;;;;EASvB,aAA8C;IAC/D,QAAQ;MACN,QAAQ;MACR,QAAQ;MACR,aAAa;MACb,QAAQ;MACR,MAAM;;;IAGR,QAAQ;MACN,QAAQ;MACR,QAAQ;MACR,aAAa;MACb,QAAQ;MACR,MAAM;;;;;;;;;;;;;;EAeV,MAAM,QACJ,UAGI,CAAA,GAAE;AAEN,UAAM,cAAc,MAAM,KAAK,eAAc;AAC7C,SAAK,YAAY,KAAK,aAAa,SAAS;AAE5C,UAAM,EAAE,aAAa,OAAO,KAAK,KAAK,UAAU,GAAG,QAAQ,GAAK,IAAK,SAG/D,UAAU,WAAW,OAAO,CAAC,MAAM,CAAC,KAAK,WAAW,CAAC,CAAC;AAC5D,QAAI,QAAQ,SAAS;AACnB,YAAM,IAAI,MACR,uBAAuB,QAAQ,KAAK,IAAI,CAAC;SAC7B,OAAO,KAAK,KAAK,UAAU,EAAE,KAAK,IAAI,CAAC,EAAE;AAKzD,QAAI,MAAM,KAAK,YAAW,KACpB,CAAC,OAAO;AAGV,UAAI,EADkB,QAAQ,MAAM,SAAS,QAAQ,OAAO;AAE1D,cAAM,IAAI,MACR;+DACkE;AAItE,YAAM,WAAW,MAAM,QAAQ;QAC7B,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