dhurandhar 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.
Files changed (54) hide show
  1. package/.dhurandhar-session-start.md +242 -0
  2. package/LICENSE +21 -0
  3. package/README.md +416 -0
  4. package/docs/ARCHITECTURE_V2.md +249 -0
  5. package/docs/DECISION_REGISTRY.md +357 -0
  6. package/docs/IMPLEMENTATION_PERSONAS.md +406 -0
  7. package/docs/PLUGGABLE_STRATEGIES.md +439 -0
  8. package/docs/SYSTEM_OBSERVER.md +433 -0
  9. package/docs/TEST_FIRST_AGILE.md +359 -0
  10. package/docs/architecture.md +279 -0
  11. package/docs/engineering-first-philosophy.md +263 -0
  12. package/docs/getting-started.md +218 -0
  13. package/docs/module-development.md +323 -0
  14. package/docs/strategy-example.md +299 -0
  15. package/docs/test-first-example.md +392 -0
  16. package/package.json +79 -0
  17. package/src/core/README.md +92 -0
  18. package/src/core/agent-instructions/backend-developer.md +412 -0
  19. package/src/core/agent-instructions/devops-engineer.md +372 -0
  20. package/src/core/agent-instructions/dhurandhar-council.md +547 -0
  21. package/src/core/agent-instructions/edge-case-hunter.md +322 -0
  22. package/src/core/agent-instructions/frontend-developer.md +494 -0
  23. package/src/core/agent-instructions/lead-system-architect.md +631 -0
  24. package/src/core/agent-instructions/system-observer.md +319 -0
  25. package/src/core/agent-instructions/test-architect.md +284 -0
  26. package/src/core/module.yaml +54 -0
  27. package/src/core/schemas/design-module-schema.yaml +995 -0
  28. package/src/core/schemas/system-design-map-schema.yaml +324 -0
  29. package/src/modules/example/README.md +130 -0
  30. package/src/modules/example/module.yaml +252 -0
  31. package/tools/cli/commands/audit.js +267 -0
  32. package/tools/cli/commands/config.js +113 -0
  33. package/tools/cli/commands/context.js +170 -0
  34. package/tools/cli/commands/decisions.js +398 -0
  35. package/tools/cli/commands/entity.js +218 -0
  36. package/tools/cli/commands/epic.js +125 -0
  37. package/tools/cli/commands/install.js +172 -0
  38. package/tools/cli/commands/module.js +109 -0
  39. package/tools/cli/commands/service.js +167 -0
  40. package/tools/cli/commands/story.js +225 -0
  41. package/tools/cli/commands/strategy.js +294 -0
  42. package/tools/cli/commands/test.js +277 -0
  43. package/tools/cli/commands/validate.js +107 -0
  44. package/tools/cli/dhurandhar.js +212 -0
  45. package/tools/lib/config-manager.js +170 -0
  46. package/tools/lib/filesystem.js +126 -0
  47. package/tools/lib/module-installer.js +61 -0
  48. package/tools/lib/module-manager.js +149 -0
  49. package/tools/lib/sdm-manager.js +982 -0
  50. package/tools/lib/test-engine.js +255 -0
  51. package/tools/lib/test-templates/api-client.template.js +100 -0
  52. package/tools/lib/test-templates/vitest.config.template.js +37 -0
  53. package/tools/lib/validators/config-validator.js +113 -0
  54. package/tools/lib/validators/module-validator.js +137 -0
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Audit Command - Architectural Drift Detection
3
+ * System Observer: Compare SDM (intended) vs Codebase (actual)
4
+ */
5
+
6
+ import * as clack from '@clack/prompts';
7
+ import chalk from 'chalk';
8
+ import { SDMManager } from '../../lib/sdm-manager.js';
9
+ import { ConfigManager } from '../../lib/config-manager.js';
10
+
11
+ export async function auditCommand(options) {
12
+ try {
13
+ const sdmManager = new SDMManager(process.cwd());
14
+ const configManager = new ConfigManager(process.cwd());
15
+
16
+ if (!configManager.exists()) {
17
+ clack.log.error(chalk.red('Framework not installed.'));
18
+ clack.log.info('Run: dhurandhar install');
19
+ process.exit(1);
20
+ }
21
+
22
+ if (!sdmManager.exists()) {
23
+ clack.log.error(chalk.red('SYSTEM_DESIGN_MAP.yaml not found.'));
24
+ process.exit(1);
25
+ }
26
+
27
+ if (options.summary) {
28
+ await showSummary(sdmManager);
29
+ } else if (options.drift) {
30
+ await showDrift(sdmManager);
31
+ } else if (options.sync) {
32
+ await syncToCodebase(sdmManager);
33
+ } else {
34
+ await fullAudit(sdmManager);
35
+ }
36
+
37
+ } catch (error) {
38
+ clack.log.error(chalk.red('Audit failed:'), error.message);
39
+ process.exit(1);
40
+ }
41
+ }
42
+
43
+ async function showSummary(sdmManager) {
44
+ const spinner = clack.spinner();
45
+ spinner.start('Scanning codebase...');
46
+
47
+ const audit = await sdmManager.performAudit();
48
+
49
+ spinner.stop('Scan complete');
50
+
51
+ clack.intro(chalk.cyan.bold('📊 System Health Summary'));
52
+
53
+ console.log('');
54
+ console.log(chalk.bold('Architectural Alignment:'));
55
+ console.log(` Services: ${chalk.cyan(audit.summary.implemented_services)}/${audit.summary.total_services} implemented`);
56
+ console.log(` Entities: ${chalk.cyan(audit.summary.implemented_entities)}/${audit.summary.total_entities} implemented`);
57
+
58
+ if (audit.summary.total_stories > 0) {
59
+ console.log(` Stories: ${chalk.cyan(audit.summary.tested_stories)}/${audit.summary.total_stories} tested`);
60
+ }
61
+
62
+ console.log(` Strategy Compliance: ${getComplianceColor(audit.summary.strategy_compliance_percentage)}${audit.summary.strategy_compliance_percentage}%${chalk.reset()}`);
63
+ console.log('');
64
+
65
+ const driftColor = audit.drift_percentage <= 10 ? chalk.green
66
+ : audit.drift_percentage <= 25 ? chalk.yellow
67
+ : chalk.red;
68
+
69
+ console.log(chalk.bold('Drift Assessment:'));
70
+ console.log(` Drift Percentage: ${driftColor(audit.drift_percentage + '%')}`);
71
+ console.log(` Status: ${getDriftStatus(audit.drift_percentage)}`);
72
+ console.log('');
73
+
74
+ if (audit.drift_percentage > 10) {
75
+ console.log(chalk.yellow('⚠ Architectural drift detected'));
76
+ console.log('');
77
+ console.log(chalk.cyan('View details:'));
78
+ console.log(' dhurandhar audit --drift');
79
+ console.log('');
80
+ } else {
81
+ clack.outro(chalk.green('✓ System aligned'));
82
+ }
83
+ }
84
+
85
+ async function showDrift(sdmManager) {
86
+ const spinner = clack.spinner();
87
+ spinner.start('Analyzing drift...');
88
+
89
+ const audit = await sdmManager.performAudit();
90
+
91
+ spinner.stop('Analysis complete');
92
+
93
+ clack.intro(chalk.cyan.bold('🔍 Drift Detection Report'));
94
+
95
+ console.log('');
96
+ console.log(chalk.dim(`Timestamp: ${audit.timestamp}`));
97
+ console.log('');
98
+
99
+ // Unimplemented (SDM → Code)
100
+ if (audit.unimplemented.services.length > 0 ||
101
+ audit.unimplemented.entities.length > 0 ||
102
+ audit.unimplemented.stories.length > 0) {
103
+ console.log(chalk.bold.red('Unimplemented (Defined in SDM, Missing in Code):'));
104
+
105
+ if (audit.unimplemented.services.length > 0) {
106
+ console.log('');
107
+ console.log(chalk.dim(' Services:'));
108
+ audit.unimplemented.services.forEach(s => {
109
+ console.log(` ${chalk.red('✗')} ${s.name}: ${chalk.dim(s.scope)}`);
110
+ });
111
+ }
112
+
113
+ if (audit.unimplemented.entities.length > 0) {
114
+ console.log('');
115
+ console.log(chalk.dim(' Entities:'));
116
+ audit.unimplemented.entities.forEach(e => {
117
+ console.log(` ${chalk.red('✗')} ${e.name} (table: ${e.table_name})`);
118
+ });
119
+ }
120
+
121
+ if (audit.unimplemented.stories.length > 0) {
122
+ console.log('');
123
+ console.log(chalk.dim(' Stories (Tests not generated):'));
124
+ audit.unimplemented.stories.forEach(s => {
125
+ console.log(` ${chalk.red('✗')} ${s.id}: ${s.name} (${s.epic})`);
126
+ });
127
+ }
128
+
129
+ console.log('');
130
+ }
131
+
132
+ // Unmanaged (Code → SDM)
133
+ if (audit.unmanaged.services.length > 0 ||
134
+ audit.unmanaged.entities.length > 0) {
135
+ console.log(chalk.bold.yellow('Unmanaged (Exists in Code, Not in SDM):'));
136
+
137
+ if (audit.unmanaged.services.length > 0) {
138
+ console.log('');
139
+ console.log(chalk.dim(' Services:'));
140
+ audit.unmanaged.services.forEach(s => {
141
+ console.log(` ${chalk.yellow('⚠')} ${s.name} (${s.path})`);
142
+ });
143
+ }
144
+
145
+ if (audit.unmanaged.entities.length > 0) {
146
+ console.log('');
147
+ console.log(chalk.dim(' Entities:'));
148
+ audit.unmanaged.entities.forEach(e => {
149
+ console.log(` ${chalk.yellow('⚠')} ${e.name} (${e.file})`);
150
+ });
151
+ }
152
+
153
+ console.log('');
154
+ }
155
+
156
+ // Strategy Violations
157
+ if (audit.strategy_violations.length > 0) {
158
+ console.log(chalk.bold.magenta('Strategy Violations:'));
159
+ console.log('');
160
+
161
+ audit.strategy_violations.forEach(v => {
162
+ console.log(` ${chalk.magenta('⚡')} ${chalk.bold(v.service)}: ${v.violation}`);
163
+ console.log(` Strategy: ${chalk.cyan(v.strategy)}`);
164
+ console.log(` Expected: ${v.expected}`);
165
+ console.log(` Actual: ${chalk.dim(v.actual)}`);
166
+ console.log('');
167
+ });
168
+ }
169
+
170
+ // Recommendations
171
+ console.log(chalk.bold('Recommendations:'));
172
+ console.log('');
173
+
174
+ if (audit.unmanaged.services.length > audit.unimplemented.services.length) {
175
+ console.log(` ${chalk.cyan('→')} Codebase is ahead of SDM`);
176
+ console.log(` Run: ${chalk.bold('dhurandhar audit --sync')} to update SDM`);
177
+ } else if (audit.unimplemented.services.length > 0) {
178
+ console.log(` ${chalk.cyan('→')} SDM is ahead of codebase`);
179
+ console.log(` Implement missing services or remove from SDM`);
180
+ }
181
+
182
+ if (audit.strategy_violations.length > 0) {
183
+ console.log(` ${chalk.cyan('→')} Strategy violations detected`);
184
+ console.log(` Run: ${chalk.bold('dhurandhar strategy --align')} to fix`);
185
+ }
186
+
187
+ console.log('');
188
+ clack.outro('');
189
+ }
190
+
191
+ async function syncToCodebase(sdmManager) {
192
+ clack.intro(chalk.cyan.bold('🔄 Sync SDM to Codebase'));
193
+
194
+ const spinner = clack.spinner();
195
+ spinner.start('Analyzing...');
196
+
197
+ const audit = await sdmManager.performAudit();
198
+
199
+ spinner.stop('Analysis complete');
200
+
201
+ console.log('');
202
+ console.log(chalk.bold('Sync Analysis:'));
203
+ console.log(` Unimplemented (SDM ahead): ${audit.unimplemented.services.length} services, ${audit.unimplemented.entities.length} entities`);
204
+ console.log(` Unmanaged (Code ahead): ${audit.unmanaged.services.length} services, ${audit.unmanaged.entities.length} entities`);
205
+ console.log('');
206
+
207
+ const direction = audit.unmanaged.services.length > audit.unimplemented.services.length
208
+ ? 'Update SDM to match code'
209
+ : 'Mark unimplemented as "planned"';
210
+
211
+ console.log(chalk.cyan(`Recommendation: ${direction}`));
212
+ console.log('');
213
+
214
+ const confirm = await clack.confirm({
215
+ message: 'Sync SDM to codebase state?',
216
+ initialValue: false,
217
+ });
218
+
219
+ if (clack.isCancel(confirm) || !confirm) {
220
+ clack.cancel('Cancelled.');
221
+ process.exit(0);
222
+ }
223
+
224
+ spinner.start('Synchronizing...');
225
+
226
+ const changes = await sdmManager.syncToCodebase();
227
+
228
+ spinner.stop('Synchronized');
229
+
230
+ clack.outro(chalk.green('✓ SDM synchronized'));
231
+
232
+ console.log('');
233
+ console.log(chalk.bold('Changes:'));
234
+ if (changes.added.services > 0) {
235
+ console.log(` ${chalk.green('+')} ${changes.added.services} services added to SDM`);
236
+ }
237
+ if (changes.added.entities > 0) {
238
+ console.log(` ${chalk.green('+')} ${changes.added.entities} entities added to SDM`);
239
+ }
240
+ console.log('');
241
+
242
+ console.log(chalk.cyan('Verify changes:'));
243
+ console.log(' dhurandhar audit --summary');
244
+ console.log('');
245
+ }
246
+
247
+ async function fullAudit(sdmManager) {
248
+ await showSummary(sdmManager);
249
+ console.log('');
250
+ console.log(chalk.dim('─'.repeat(60)));
251
+ console.log('');
252
+ await showDrift(sdmManager);
253
+ }
254
+
255
+ // Helper functions
256
+
257
+ function getComplianceColor(percentage) {
258
+ if (percentage >= 90) return chalk.green;
259
+ if (percentage >= 70) return chalk.yellow;
260
+ return chalk.red;
261
+ }
262
+
263
+ function getDriftStatus(percentage) {
264
+ if (percentage <= 10) return chalk.green('✓ Excellent alignment');
265
+ if (percentage <= 25) return chalk.yellow('⚠ Minor drift detected');
266
+ return chalk.red('✗ Significant drift - action required');
267
+ }
@@ -0,0 +1,113 @@
1
+ /**
2
+ * Config Command
3
+ * Manages framework configuration
4
+ */
5
+
6
+ import * as clack from '@clack/prompts';
7
+ import chalk from 'chalk';
8
+ import { ConfigManager } from '../../lib/config-manager.js';
9
+
10
+ export async function configCommand(options) {
11
+ try {
12
+ const configManager = new ConfigManager(process.cwd());
13
+
14
+ if (!configManager.exists()) {
15
+ clack.log.error(chalk.red('Dhurandhar is not installed in this directory.'));
16
+ clack.log.info('Run: dhurandhar install');
17
+ process.exit(1);
18
+ }
19
+
20
+ if (options.show) {
21
+ // Show current configuration
22
+ clack.intro(chalk.cyan.bold('Dhurandhar Configuration'));
23
+ const config = await configManager.load();
24
+
25
+ console.log('');
26
+ console.log(chalk.bold('Project Settings:'));
27
+ console.log(` Project Name: ${chalk.cyan(config.projectName || 'Not set')}`);
28
+ console.log(` User Name: ${chalk.cyan(config.userName || 'Not set')}`);
29
+ console.log(` Output Folder: ${chalk.cyan(config.outputFolder || 'Not set')}`);
30
+ console.log('');
31
+
32
+ if (config.modules && config.modules.length > 0) {
33
+ console.log(chalk.bold('Installed Modules:'));
34
+ config.modules.forEach(module => {
35
+ console.log(` ${chalk.green('✓')} ${module}`);
36
+ });
37
+ console.log('');
38
+ }
39
+
40
+ clack.outro(chalk.dim(`Config file: .dhurandhar/config.yaml`));
41
+
42
+ } else if (options.edit) {
43
+ // Edit configuration interactively
44
+ clack.intro(chalk.cyan.bold('Edit Configuration'));
45
+
46
+ const config = await configManager.load();
47
+
48
+ const projectName = await clack.text({
49
+ message: 'Project name:',
50
+ initialValue: config.projectName,
51
+ });
52
+
53
+ if (clack.isCancel(projectName)) {
54
+ clack.cancel('Configuration edit cancelled.');
55
+ process.exit(0);
56
+ }
57
+
58
+ const userName = await clack.text({
59
+ message: 'User name:',
60
+ initialValue: config.userName,
61
+ });
62
+
63
+ if (clack.isCancel(userName)) {
64
+ clack.cancel('Configuration edit cancelled.');
65
+ process.exit(0);
66
+ }
67
+
68
+ const outputFolder = await clack.text({
69
+ message: 'Output folder:',
70
+ initialValue: config.outputFolder,
71
+ });
72
+
73
+ if (clack.isCancel(outputFolder)) {
74
+ clack.cancel('Configuration edit cancelled.');
75
+ process.exit(0);
76
+ }
77
+
78
+ await configManager.update({
79
+ ...config,
80
+ projectName,
81
+ userName,
82
+ outputFolder,
83
+ });
84
+
85
+ clack.outro(chalk.green('✓ Configuration updated successfully!'));
86
+
87
+ } else if (options.reset) {
88
+ // Reset to defaults
89
+ const confirm = await clack.confirm({
90
+ message: 'Are you sure you want to reset to default configuration?',
91
+ });
92
+
93
+ if (clack.isCancel(confirm) || !confirm) {
94
+ clack.cancel('Reset cancelled.');
95
+ process.exit(0);
96
+ }
97
+
98
+ await configManager.reset();
99
+ clack.outro(chalk.green('✓ Configuration reset to defaults.'));
100
+
101
+ } else {
102
+ // No option provided, show help
103
+ console.log(chalk.cyan('Usage:'));
104
+ console.log(' dhurandhar config --show Show current configuration');
105
+ console.log(' dhurandhar config --edit Edit configuration');
106
+ console.log(' dhurandhar config --reset Reset to defaults');
107
+ }
108
+
109
+ } catch (error) {
110
+ clack.log.error(chalk.red('Config operation failed:'), error.message);
111
+ process.exit(1);
112
+ }
113
+ }
@@ -0,0 +1,170 @@
1
+ /**
2
+ * Context Command - Display SDM for Context Rehydration
3
+ * Shows current architecture state for agent/developer consumption
4
+ */
5
+
6
+ import * as clack from '@clack/prompts';
7
+ import chalk from 'chalk';
8
+ import { SDMManager } from '../../lib/sdm-manager.js';
9
+ import { ConfigManager } from '../../lib/config-manager.js';
10
+
11
+ export async function contextCommand(options) {
12
+ try {
13
+ const sdmManager = new SDMManager(process.cwd());
14
+ const configManager = new ConfigManager(process.cwd());
15
+
16
+ if (!configManager.exists()) {
17
+ clack.log.error(chalk.red('Framework not installed.'));
18
+ clack.log.info('Run: dhurandhar install');
19
+ process.exit(1);
20
+ }
21
+
22
+ if (!sdmManager.exists()) {
23
+ clack.log.error(chalk.red('SYSTEM_DESIGN_MAP.yaml not found.'));
24
+ process.exit(1);
25
+ }
26
+
27
+ const context = await sdmManager.getRehydrationContext();
28
+ const sdm = context.fullMap;
29
+
30
+ if (options.summary) {
31
+ // Brief summary
32
+ console.log('');
33
+ console.log(chalk.cyan.bold(`📋 ${sdm.metadata.project_name}`));
34
+ console.log(chalk.dim(`Architecture: ${sdm.metadata.architecture_type}`));
35
+ console.log(chalk.dim(`Last Updated: ${new Date(sdm.metadata.last_updated).toLocaleString()}`));
36
+ console.log('');
37
+ console.log(chalk.bold('Tech Stack:'));
38
+ console.log(` Languages: ${sdm.tech_stack.languages.join(', ') || 'None'}`);
39
+ console.log(` Frameworks: ${sdm.tech_stack.frameworks.join(', ') || 'None'}`);
40
+ console.log(` Databases: ${sdm.tech_stack.databases.join(', ') || 'None'}`);
41
+ console.log('');
42
+ console.log(chalk.bold('Components:'));
43
+ console.log(` Services: ${sdm.services.length}`);
44
+ console.log(` Entities: ${sdm.entities.length}`);
45
+ console.log(` User Types: ${sdm.user_types.length}`);
46
+ console.log('');
47
+
48
+ } else if (options.full) {
49
+ // Full architecture display
50
+ console.clear();
51
+ clack.intro(chalk.cyan.bold('🏗️ System Architecture Context'));
52
+
53
+ console.log('');
54
+ console.log(chalk.bold.underline('Project Metadata'));
55
+ console.log(`Name: ${chalk.cyan(sdm.metadata.project_name)}`);
56
+ console.log(`Version: ${chalk.cyan(sdm.metadata.version)}`);
57
+ console.log(`Architecture: ${chalk.cyan(sdm.metadata.architecture_type)}`);
58
+ console.log(`Updated: ${chalk.dim(new Date(sdm.metadata.last_updated).toLocaleString())}`);
59
+
60
+ console.log('');
61
+ console.log(chalk.bold.underline('Tech Stack'));
62
+ console.log(`Languages: ${chalk.cyan(sdm.tech_stack.languages.join(', ') || 'None')}`);
63
+ console.log(`Frameworks: ${chalk.cyan(sdm.tech_stack.frameworks.join(', ') || 'None')}`);
64
+ console.log(`Databases: ${chalk.cyan(sdm.tech_stack.databases.join(', ') || 'None')}`);
65
+ console.log(`Infrastructure: ${chalk.cyan(sdm.tech_stack.infrastructure.join(', ') || 'None')}`);
66
+
67
+ if (sdm.user_types.length > 0) {
68
+ console.log('');
69
+ console.log(chalk.bold.underline(`User Types (${sdm.user_types.length})`));
70
+ sdm.user_types.forEach(ut => {
71
+ console.log(` ${chalk.bold(ut.role)}`);
72
+ console.log(` Auth: ${ut.authentication}`);
73
+ console.log(` Permissions: ${ut.permissions.join(', ')}`);
74
+ });
75
+ }
76
+
77
+ if (sdm.entities.length > 0) {
78
+ console.log('');
79
+ console.log(chalk.bold.underline(`Entities (${sdm.entities.length})`));
80
+ sdm.entities.forEach(e => {
81
+ console.log(` ${chalk.bold(e.name)} (${e.attributes.length} attributes)`);
82
+ if (e.relationships && e.relationships.length > 0) {
83
+ e.relationships.forEach(rel => {
84
+ console.log(` ${chalk.dim(rel.type)} → ${chalk.cyan(rel.target)}`);
85
+ });
86
+ }
87
+ });
88
+ }
89
+
90
+ if (sdm.services.length > 0) {
91
+ console.log('');
92
+ console.log(chalk.bold.underline(`Services (${sdm.services.length})`));
93
+ sdm.services.forEach(s => {
94
+ console.log(` ${chalk.bold(s.name)}`);
95
+ console.log(` ${chalk.dim(s.scope)}`);
96
+ console.log(` Stack: ${chalk.cyan(s.tech_stack.language)}/${chalk.cyan(s.tech_stack.framework)}/${chalk.cyan(s.tech_stack.database || 'N/A')}`);
97
+ if (s.api) {
98
+ console.log(` API: ${s.api.type.toUpperCase()} ${s.api.base_path || ''} :${s.api.port || 'N/A'}`);
99
+ }
100
+ if (s.dependencies && s.dependencies.length > 0) {
101
+ console.log(` Depends on: ${s.dependencies.join(', ')}`);
102
+ }
103
+ });
104
+ }
105
+
106
+ if (sdm.communication.length > 0) {
107
+ console.log('');
108
+ console.log(chalk.bold.underline(`Service Communication (${sdm.communication.length})`));
109
+ sdm.communication.forEach(c => {
110
+ console.log(` ${chalk.cyan(c.from)} → ${chalk.cyan(c.to)} (${c.protocol}/${c.pattern})`);
111
+ });
112
+ }
113
+
114
+ if (sdm.infrastructure && sdm.infrastructure.components && sdm.infrastructure.components.length > 0) {
115
+ console.log('');
116
+ console.log(chalk.bold.underline('Infrastructure'));
117
+ console.log(`Deployment: ${chalk.cyan(sdm.infrastructure.deployment_target || 'Not specified')}`);
118
+ sdm.infrastructure.components.forEach(comp => {
119
+ console.log(` ${comp.type}: ${chalk.cyan(comp.name)} (${comp.technology})`);
120
+ });
121
+ }
122
+
123
+ // Technical Strategies
124
+ if (sdm.technical_strategies) {
125
+ console.log('');
126
+ console.log(chalk.bold.underline('Active Architectural Strategies'));
127
+
128
+ if (sdm.technical_strategies.persistence?.model) {
129
+ console.log(` Persistence: ${chalk.cyan(sdm.technical_strategies.persistence.model)}`);
130
+ }
131
+ if (sdm.technical_strategies.communication?.primary_pattern) {
132
+ console.log(` Communication: ${chalk.cyan(sdm.technical_strategies.communication.primary_pattern)}`);
133
+ if (sdm.technical_strategies.communication.event_bus) {
134
+ console.log(` Event Bus: ${chalk.cyan(sdm.technical_strategies.communication.event_bus.technology)}`);
135
+ }
136
+ }
137
+ if (sdm.technical_strategies.state_management?.caching_layer) {
138
+ console.log(` Caching: ${chalk.cyan(sdm.technical_strategies.state_management.caching_layer)}`);
139
+ }
140
+ if (sdm.technical_strategies.security?.authentication) {
141
+ console.log(` Auth: ${chalk.cyan(sdm.technical_strategies.security.authentication)}`);
142
+ }
143
+ if (sdm.technical_strategies.resilience?.circuit_breaker) {
144
+ console.log(` Resilience: Circuit Breaker ${chalk.green('enabled')}`);
145
+ }
146
+ }
147
+
148
+ console.log('');
149
+ clack.outro(chalk.dim('This context is persisted in SYSTEM_DESIGN_MAP.yaml'));
150
+
151
+ } else if (options.json) {
152
+ // JSON output for programmatic use
153
+ console.log(JSON.stringify(sdm, null, 2));
154
+
155
+ } else {
156
+ // Default: Agent-friendly summary
157
+ console.log('');
158
+ console.log(chalk.cyan.bold('🔄 Context Rehydrated'));
159
+ console.log('');
160
+ console.log(context.summary);
161
+ console.log('');
162
+ console.log(chalk.dim('Use --full for complete architecture view'));
163
+ console.log('');
164
+ }
165
+
166
+ } catch (error) {
167
+ clack.log.error(chalk.red('Context retrieval failed:'), error.message);
168
+ process.exit(1);
169
+ }
170
+ }