create-claude-context 1.0.0 → 1.2.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 (112) hide show
  1. package/LICENSE +21 -21
  2. package/README.md +146 -146
  3. package/bin/create-claude-context.js +61 -61
  4. package/lib/detector.js +373 -373
  5. package/lib/index.js +170 -170
  6. package/lib/installer.js +371 -362
  7. package/lib/placeholder.js +208 -208
  8. package/lib/prompts.js +287 -287
  9. package/lib/spinner.js +60 -60
  10. package/lib/validate.js +147 -147
  11. package/package.json +59 -59
  12. package/templates/CLAUDE.md.template +235 -235
  13. package/templates/base/README.md +257 -257
  14. package/templates/base/RPI_WORKFLOW_PLAN.md +320 -320
  15. package/templates/base/agents/api-developer.md +76 -76
  16. package/templates/base/agents/context-engineer.md +525 -525
  17. package/templates/base/agents/core-architect.md +76 -76
  18. package/templates/base/agents/database-ops.md +76 -76
  19. package/templates/base/agents/deployment-ops.md +76 -76
  20. package/templates/base/agents/integration-hub.md +76 -76
  21. package/templates/base/analytics/README.md +114 -114
  22. package/templates/base/automation/config.json +58 -0
  23. package/templates/base/automation/generators/code-mapper.js +308 -0
  24. package/templates/base/automation/generators/index-builder.js +321 -0
  25. package/templates/base/automation/hooks/post-commit.sh +83 -0
  26. package/templates/base/automation/hooks/pre-commit.sh +103 -0
  27. package/templates/base/ci-templates/README.md +108 -108
  28. package/templates/base/ci-templates/github-actions/context-check.yml +144 -144
  29. package/templates/base/ci-templates/github-actions/validate-docs.yml +105 -105
  30. package/templates/base/commands/analytics.md +238 -238
  31. package/templates/base/commands/auto-sync.md +172 -0
  32. package/templates/base/commands/collab.md +194 -194
  33. package/templates/base/commands/help.md +450 -450
  34. package/templates/base/commands/rpi-implement.md +115 -115
  35. package/templates/base/commands/rpi-plan.md +93 -93
  36. package/templates/base/commands/rpi-research.md +88 -88
  37. package/templates/base/commands/session-resume.md +144 -0
  38. package/templates/base/commands/session-save.md +112 -0
  39. package/templates/base/commands/validate-all.md +77 -77
  40. package/templates/base/commands/verify-docs-current.md +86 -86
  41. package/templates/base/config/base.json +57 -57
  42. package/templates/base/config/environments/development.json +13 -13
  43. package/templates/base/config/environments/production.json +17 -17
  44. package/templates/base/config/environments/staging.json +13 -13
  45. package/templates/base/config/local.json.example +21 -21
  46. package/templates/base/context/.meta/generated-at.json +18 -0
  47. package/templates/base/context/ARCHITECTURE_SNAPSHOT.md +156 -156
  48. package/templates/base/context/CODE_TO_WORKFLOW_MAP.md +94 -94
  49. package/templates/base/context/FILE_OWNERSHIP.md +57 -0
  50. package/templates/base/context/INTEGRATION_POINTS.md +92 -0
  51. package/templates/base/context/KNOWN_GOTCHAS.md +195 -195
  52. package/templates/base/context/TESTING_MAP.md +95 -0
  53. package/templates/base/context/WORKFLOW_INDEX.md +129 -129
  54. package/templates/base/context/workflows/WORKFLOW_TEMPLATE.md +294 -294
  55. package/templates/base/indexes/agents/CAPABILITY_MATRIX.md +255 -255
  56. package/templates/base/indexes/agents/CATEGORY_INDEX.md +44 -44
  57. package/templates/base/indexes/code/CATEGORY_INDEX.md +38 -38
  58. package/templates/base/indexes/routing/CATEGORY_INDEX.md +39 -39
  59. package/templates/base/indexes/search/CATEGORY_INDEX.md +39 -39
  60. package/templates/base/indexes/workflows/CATEGORY_INDEX.md +38 -38
  61. package/templates/base/knowledge/README.md +98 -98
  62. package/templates/base/knowledge/sessions/README.md +88 -88
  63. package/templates/base/knowledge/sessions/TEMPLATE.md +150 -150
  64. package/templates/base/knowledge/shared/decisions/0001-adopt-context-engineering.md +144 -144
  65. package/templates/base/knowledge/shared/decisions/README.md +49 -49
  66. package/templates/base/knowledge/shared/decisions/TEMPLATE.md +123 -123
  67. package/templates/base/knowledge/shared/patterns/README.md +62 -62
  68. package/templates/base/knowledge/shared/patterns/TEMPLATE.md +120 -120
  69. package/templates/base/plans/PLAN_TEMPLATE.md +250 -250
  70. package/templates/base/research/RESEARCH_TEMPLATE.md +153 -153
  71. package/templates/base/schemas/agent.schema.json +141 -141
  72. package/templates/base/schemas/anchors.schema.json +54 -0
  73. package/templates/base/schemas/automation.schema.json +93 -0
  74. package/templates/base/schemas/command.schema.json +134 -134
  75. package/templates/base/schemas/hashes.schema.json +40 -0
  76. package/templates/base/schemas/manifest.schema.json +117 -117
  77. package/templates/base/schemas/plan.schema.json +136 -136
  78. package/templates/base/schemas/research.schema.json +115 -115
  79. package/templates/base/schemas/roles.schema.json +34 -0
  80. package/templates/base/schemas/session.schema.json +77 -0
  81. package/templates/base/schemas/settings.schema.json +244 -244
  82. package/templates/base/schemas/staleness.schema.json +53 -0
  83. package/templates/base/schemas/team-config.schema.json +42 -0
  84. package/templates/base/schemas/workflow.schema.json +126 -126
  85. package/templates/base/session/checkpoints/.gitkeep +2 -0
  86. package/templates/base/session/current/state.json +20 -0
  87. package/templates/base/session/history/.gitkeep +2 -0
  88. package/templates/base/settings.json +79 -57
  89. package/templates/base/standards/COMPATIBILITY.md +219 -219
  90. package/templates/base/standards/EXTENSION_GUIDELINES.md +280 -280
  91. package/templates/base/standards/QUALITY_CHECKLIST.md +211 -211
  92. package/templates/base/standards/README.md +66 -66
  93. package/templates/base/sync/anchors.json +6 -0
  94. package/templates/base/sync/hashes.json +6 -0
  95. package/templates/base/sync/staleness.json +10 -0
  96. package/templates/base/team/README.md +168 -168
  97. package/templates/base/team/config.json +79 -79
  98. package/templates/base/team/roles.json +145 -145
  99. package/templates/base/tools/bin/claude-context.js +151 -151
  100. package/templates/base/tools/lib/anchor-resolver.js +276 -0
  101. package/templates/base/tools/lib/config-loader.js +363 -363
  102. package/templates/base/tools/lib/detector.js +350 -350
  103. package/templates/base/tools/lib/diagnose.js +206 -206
  104. package/templates/base/tools/lib/drift-detector.js +373 -0
  105. package/templates/base/tools/lib/errors.js +199 -199
  106. package/templates/base/tools/lib/index.js +36 -24
  107. package/templates/base/tools/lib/init.js +192 -192
  108. package/templates/base/tools/lib/logger.js +230 -230
  109. package/templates/base/tools/lib/placeholder.js +201 -201
  110. package/templates/base/tools/lib/session-manager.js +354 -0
  111. package/templates/base/tools/lib/validate.js +521 -521
  112. package/templates/base/tools/package.json +49 -49
package/lib/index.js CHANGED
@@ -1,170 +1,170 @@
1
- /**
2
- * Main orchestrator for create-claude-context
3
- *
4
- * Handles the full installation flow:
5
- * 1. Interactive prompts (or defaults)
6
- * 2. Directory structure creation
7
- * 3. Template copying
8
- * 4. Tech stack detection
9
- * 5. Placeholder replacement
10
- * 6. Validation
11
- * 7. Plugin installation (optional)
12
- */
13
-
14
- const path = require('path');
15
- const fs = require('fs');
16
- const chalk = require('chalk');
17
- const { runPrompts, getDefaults } = require('./prompts');
18
- const { createSpinner } = require('./spinner');
19
- const {
20
- createDirectoryStructure,
21
- copyTemplates,
22
- createClaudeMd
23
- } = require('./installer');
24
- const { detectTechStack } = require('./detector');
25
- const { replacePlaceholders } = require('./placeholder');
26
- const { validateInstallation } = require('./validate');
27
-
28
- /**
29
- * Main entry point
30
- */
31
- async function run(options = {}) {
32
- const {
33
- projectName,
34
- skipPrompts = false,
35
- installPlugin = true,
36
- template,
37
- initGit = true,
38
- dryRun = false,
39
- verbose = false
40
- } = options;
41
-
42
- // Determine target directory
43
- const targetDir = projectName
44
- ? path.resolve(process.cwd(), projectName)
45
- : process.cwd();
46
-
47
- const projectNameResolved = projectName || path.basename(targetDir);
48
-
49
- // Get configuration (prompts or defaults)
50
- let config;
51
- if (skipPrompts) {
52
- config = await getDefaults(targetDir, template);
53
- } else {
54
- config = await runPrompts(targetDir, template);
55
- }
56
-
57
- config.projectName = projectNameResolved;
58
- config.targetDir = targetDir;
59
- config.installPlugin = installPlugin && config.installPlugin;
60
- config.initGit = initGit;
61
- config.dryRun = dryRun;
62
- config.verbose = verbose;
63
-
64
- if (dryRun) {
65
- console.log(chalk.yellow('\n--dry-run mode: No changes will be made\n'));
66
- console.log('Configuration:', JSON.stringify(config, null, 2));
67
- return;
68
- }
69
-
70
- // Phase 1: Create target directory if needed
71
- const spinner = createSpinner();
72
-
73
- if (projectName && !fs.existsSync(targetDir)) {
74
- spinner.start('Creating project directory...');
75
- fs.mkdirSync(targetDir, { recursive: true });
76
- spinner.succeed(`Created project directory: ${projectNameResolved}`);
77
- }
78
-
79
- // Phase 2: Create .claude directory structure
80
- spinner.start('Creating .claude directory structure...');
81
- const dirsCreated = await createDirectoryStructure(targetDir, config);
82
- spinner.succeed(`Created .claude directory structure (${dirsCreated} directories)`);
83
-
84
- // Phase 3: Copy template files
85
- spinner.start('Copying template files...');
86
- const filesCopied = await copyTemplates(targetDir, config);
87
- spinner.succeed(`Copied ${filesCopied} template files`);
88
-
89
- // Phase 4: Detect technology stack
90
- spinner.start('Detecting technology stack...');
91
- const techStack = await detectTechStack(targetDir);
92
- spinner.succeed(`Detected: ${techStack.summary || 'Generic project'}`);
93
-
94
- // Phase 5: Replace placeholders
95
- spinner.start('Populating templates with project info...');
96
- const placeholdersReplaced = await replacePlaceholders(targetDir, {
97
- ...config,
98
- techStack
99
- });
100
- spinner.succeed(`Replaced ${placeholdersReplaced} placeholders`);
101
-
102
- // Phase 6: Create CLAUDE.md at root
103
- spinner.start('Creating CLAUDE.md...');
104
- await createClaudeMd(targetDir, config, techStack);
105
- spinner.succeed('Created CLAUDE.md at project root');
106
-
107
- // Phase 7: Validate installation
108
- spinner.start('Validating installation...');
109
- const validation = await validateInstallation(targetDir);
110
- if (validation.passed) {
111
- spinner.succeed('All validations passed');
112
- } else {
113
- spinner.warn(`Validation completed with ${validation.warnings} warnings`);
114
- }
115
-
116
- // Phase 8: Install Claude Code plugin (optional)
117
- if (config.installPlugin) {
118
- spinner.start('Installing Claude Code plugin...');
119
- // Plugin installation would use: npx claude-plugins install claude-context-engineering
120
- // For now, we'll note it as a next step
121
- spinner.succeed('Plugin ready (install with: /plugin install claude-context-engineering)');
122
- }
123
-
124
- // Phase 9: Initialize git (optional)
125
- if (config.initGit && !fs.existsSync(path.join(targetDir, '.git'))) {
126
- spinner.start('Initializing git repository...');
127
- try {
128
- const { execSync } = require('child_process');
129
- execSync('git init', { cwd: targetDir, stdio: 'pipe' });
130
- spinner.succeed('Initialized git repository');
131
- } catch (e) {
132
- spinner.warn('Could not initialize git (git may not be installed)');
133
- }
134
- }
135
-
136
- // Success message
137
- showSuccess(config, techStack);
138
- }
139
-
140
- /**
141
- * Display success message with next steps
142
- */
143
- function showSuccess(config, techStack) {
144
- const boxWidth = 59;
145
-
146
- console.log(`
147
- ${chalk.green('╔' + '═'.repeat(boxWidth) + '╗')}
148
- ${chalk.green('║')} ${chalk.bold.white('✓ Context Engineering Initialized Successfully!')} ${chalk.green('║')}
149
- ${chalk.green('╚' + '═'.repeat(boxWidth) + '╝')}
150
-
151
- ${chalk.bold('Created:')}
152
- ${chalk.cyan('•')} .claude/ ${chalk.gray('(context engineering system)')}
153
- ${chalk.cyan('•')} CLAUDE.md ${chalk.gray('(AI navigation guide)')}
154
-
155
- ${chalk.bold('Available Commands:')}
156
- ${chalk.cyan('•')} /rpi-research ${chalk.gray('Research a feature')}
157
- ${chalk.cyan('•')} /rpi-plan ${chalk.gray('Create implementation plan')}
158
- ${chalk.cyan('•')} /rpi-implement ${chalk.gray('Execute with documentation')}
159
- ${chalk.cyan('•')} /validate-all ${chalk.gray('Run validation suite')}
160
-
161
- ${chalk.bold('Next Steps:')}
162
- ${chalk.white('1.')} Review ${chalk.cyan('CLAUDE.md')} and customize for your project
163
- ${chalk.white('2.')} Run: ${chalk.cyan('@context-engineer "Discover workflows for this codebase"')}
164
- ${chalk.white('3.')} Use ${chalk.cyan('/rpi-research')} for your first feature
165
-
166
- ${chalk.gray('Documentation: https://github.com/SireJeff/claude-context-engineering-template')}
167
- `);
168
- }
169
-
170
- module.exports = { run };
1
+ /**
2
+ * Main orchestrator for create-claude-context
3
+ *
4
+ * Handles the full installation flow:
5
+ * 1. Interactive prompts (or defaults)
6
+ * 2. Directory structure creation
7
+ * 3. Template copying
8
+ * 4. Tech stack detection
9
+ * 5. Placeholder replacement
10
+ * 6. Validation
11
+ * 7. Plugin installation (optional)
12
+ */
13
+
14
+ const path = require('path');
15
+ const fs = require('fs');
16
+ const chalk = require('chalk');
17
+ const { runPrompts, getDefaults } = require('./prompts');
18
+ const { createSpinner } = require('./spinner');
19
+ const {
20
+ createDirectoryStructure,
21
+ copyTemplates,
22
+ createClaudeMd
23
+ } = require('./installer');
24
+ const { detectTechStack } = require('./detector');
25
+ const { replacePlaceholders } = require('./placeholder');
26
+ const { validateInstallation } = require('./validate');
27
+
28
+ /**
29
+ * Main entry point
30
+ */
31
+ async function run(options = {}) {
32
+ const {
33
+ projectName,
34
+ skipPrompts = false,
35
+ installPlugin = true,
36
+ template,
37
+ initGit = true,
38
+ dryRun = false,
39
+ verbose = false
40
+ } = options;
41
+
42
+ // Determine target directory
43
+ const targetDir = projectName
44
+ ? path.resolve(process.cwd(), projectName)
45
+ : process.cwd();
46
+
47
+ const projectNameResolved = projectName || path.basename(targetDir);
48
+
49
+ // Get configuration (prompts or defaults)
50
+ let config;
51
+ if (skipPrompts) {
52
+ config = await getDefaults(targetDir, template);
53
+ } else {
54
+ config = await runPrompts(targetDir, template);
55
+ }
56
+
57
+ config.projectName = projectNameResolved;
58
+ config.targetDir = targetDir;
59
+ config.installPlugin = installPlugin && config.installPlugin;
60
+ config.initGit = initGit;
61
+ config.dryRun = dryRun;
62
+ config.verbose = verbose;
63
+
64
+ if (dryRun) {
65
+ console.log(chalk.yellow('\n--dry-run mode: No changes will be made\n'));
66
+ console.log('Configuration:', JSON.stringify(config, null, 2));
67
+ return;
68
+ }
69
+
70
+ // Phase 1: Create target directory if needed
71
+ const spinner = createSpinner();
72
+
73
+ if (projectName && !fs.existsSync(targetDir)) {
74
+ spinner.start('Creating project directory...');
75
+ fs.mkdirSync(targetDir, { recursive: true });
76
+ spinner.succeed(`Created project directory: ${projectNameResolved}`);
77
+ }
78
+
79
+ // Phase 2: Create .claude directory structure
80
+ spinner.start('Creating .claude directory structure...');
81
+ const dirsCreated = await createDirectoryStructure(targetDir, config);
82
+ spinner.succeed(`Created .claude directory structure (${dirsCreated} directories)`);
83
+
84
+ // Phase 3: Copy template files
85
+ spinner.start('Copying template files...');
86
+ const filesCopied = await copyTemplates(targetDir, config);
87
+ spinner.succeed(`Copied ${filesCopied} template files`);
88
+
89
+ // Phase 4: Detect technology stack
90
+ spinner.start('Detecting technology stack...');
91
+ const techStack = await detectTechStack(targetDir);
92
+ spinner.succeed(`Detected: ${techStack.summary || 'Generic project'}`);
93
+
94
+ // Phase 5: Replace placeholders
95
+ spinner.start('Populating templates with project info...');
96
+ const placeholdersReplaced = await replacePlaceholders(targetDir, {
97
+ ...config,
98
+ techStack
99
+ });
100
+ spinner.succeed(`Replaced ${placeholdersReplaced} placeholders`);
101
+
102
+ // Phase 6: Create CLAUDE.md at root
103
+ spinner.start('Creating CLAUDE.md...');
104
+ await createClaudeMd(targetDir, config, techStack);
105
+ spinner.succeed('Created CLAUDE.md at project root');
106
+
107
+ // Phase 7: Validate installation
108
+ spinner.start('Validating installation...');
109
+ const validation = await validateInstallation(targetDir);
110
+ if (validation.passed) {
111
+ spinner.succeed('All validations passed');
112
+ } else {
113
+ spinner.warn(`Validation completed with ${validation.warnings} warnings`);
114
+ }
115
+
116
+ // Phase 8: Install Claude Code plugin (optional)
117
+ if (config.installPlugin) {
118
+ spinner.start('Installing Claude Code plugin...');
119
+ // Plugin installation would use: npx claude-plugins install claude-context-engineering
120
+ // For now, we'll note it as a next step
121
+ spinner.succeed('Plugin ready (install with: /plugin install claude-context-engineering)');
122
+ }
123
+
124
+ // Phase 9: Initialize git (optional)
125
+ if (config.initGit && !fs.existsSync(path.join(targetDir, '.git'))) {
126
+ spinner.start('Initializing git repository...');
127
+ try {
128
+ const { execSync } = require('child_process');
129
+ execSync('git init', { cwd: targetDir, stdio: 'pipe' });
130
+ spinner.succeed('Initialized git repository');
131
+ } catch (e) {
132
+ spinner.warn('Could not initialize git (git may not be installed)');
133
+ }
134
+ }
135
+
136
+ // Success message
137
+ showSuccess(config, techStack);
138
+ }
139
+
140
+ /**
141
+ * Display success message with next steps
142
+ */
143
+ function showSuccess(config, techStack) {
144
+ const boxWidth = 59;
145
+
146
+ console.log(`
147
+ ${chalk.green('╔' + '═'.repeat(boxWidth) + '╗')}
148
+ ${chalk.green('║')} ${chalk.bold.white('✓ Context Engineering Initialized Successfully!')} ${chalk.green('║')}
149
+ ${chalk.green('╚' + '═'.repeat(boxWidth) + '╝')}
150
+
151
+ ${chalk.bold('Created:')}
152
+ ${chalk.cyan('•')} .claude/ ${chalk.gray('(context engineering system)')}
153
+ ${chalk.cyan('•')} CLAUDE.md ${chalk.gray('(AI navigation guide)')}
154
+
155
+ ${chalk.bold('Available Commands:')}
156
+ ${chalk.cyan('•')} /rpi-research ${chalk.gray('Research a feature')}
157
+ ${chalk.cyan('•')} /rpi-plan ${chalk.gray('Create implementation plan')}
158
+ ${chalk.cyan('•')} /rpi-implement ${chalk.gray('Execute with documentation')}
159
+ ${chalk.cyan('•')} /validate-all ${chalk.gray('Run validation suite')}
160
+
161
+ ${chalk.bold('Next Steps:')}
162
+ ${chalk.white('1.')} Review ${chalk.cyan('CLAUDE.md')} and customize for your project
163
+ ${chalk.white('2.')} Run: ${chalk.cyan('@context-engineer "Discover workflows for this codebase"')}
164
+ ${chalk.white('3.')} Use ${chalk.cyan('/rpi-research')} for your first feature
165
+
166
+ ${chalk.gray('Documentation: https://github.com/SireJeff/claude-context-engineering-template')}
167
+ `);
168
+ }
169
+
170
+ module.exports = { run };