code-framework 1.0.0 → 1.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/install.js CHANGED
@@ -9,6 +9,7 @@
9
9
 
10
10
  const fs = require('fs');
11
11
  const path = require('path');
12
+ const readline = require('readline');
12
13
 
13
14
  const LOGO = `
14
15
  ██████╗ ██████╗ ██████╗ ███████╗
@@ -25,16 +26,115 @@ Context. Outline. Documentation. Evolve.
25
26
  const colors = {
26
27
  reset: '\x1b[0m',
27
28
  bright: '\x1b[1m',
29
+ dim: '\x1b[2m',
28
30
  green: '\x1b[32m',
29
31
  cyan: '\x1b[36m',
30
32
  yellow: '\x1b[33m',
31
33
  red: '\x1b[31m',
34
+ magenta: '\x1b[35m',
35
+ };
36
+
37
+ // CLI tool configurations
38
+ const CLI_TOOLS = {
39
+ 'claude-code': {
40
+ name: 'Claude Code',
41
+ description: 'Anthropic\'s official CLI for Claude',
42
+ configFile: '.claude/commands.yaml',
43
+ settingsFile: '.claude/settings.json',
44
+ instructionsFile: 'CLAUDE.md',
45
+ recommended: true,
46
+ },
47
+ 'antigravity': {
48
+ name: 'Antigravity',
49
+ description: 'AI-powered development assistant',
50
+ configFile: '.antigravity/commands.yaml',
51
+ settingsFile: '.antigravity/settings.json',
52
+ instructionsFile: 'ANTIGRAVITY.md',
53
+ recommended: false,
54
+ },
55
+ 'opencode': {
56
+ name: 'OpenCode',
57
+ description: 'Open source AI coding assistant',
58
+ configFile: '.opencode/commands.yaml',
59
+ settingsFile: '.opencode/settings.json',
60
+ instructionsFile: 'OPENCODE.md',
61
+ recommended: false,
62
+ },
63
+ 'cursor': {
64
+ name: 'Cursor',
65
+ description: 'AI-first code editor',
66
+ configFile: '.cursor/rules',
67
+ settingsFile: null,
68
+ instructionsFile: '.cursorrules',
69
+ recommended: true,
70
+ },
71
+ 'windsurf': {
72
+ name: 'Windsurf',
73
+ description: 'Codeium\'s AI IDE',
74
+ configFile: '.windsurf/rules',
75
+ settingsFile: null,
76
+ instructionsFile: '.windsurfrules',
77
+ recommended: false,
78
+ },
79
+ 'aider': {
80
+ name: 'Aider',
81
+ description: 'AI pair programming in your terminal',
82
+ configFile: '.aider.conf.yml',
83
+ settingsFile: null,
84
+ instructionsFile: 'CONVENTIONS.md',
85
+ recommended: false,
86
+ },
87
+ 'cline': {
88
+ name: 'Cline',
89
+ description: 'VS Code AI assistant',
90
+ configFile: '.cline/rules',
91
+ settingsFile: null,
92
+ instructionsFile: '.clinerules',
93
+ recommended: false,
94
+ },
32
95
  };
33
96
 
34
97
  function log(msg, color = '') {
35
98
  console.log(`${color}${msg}${colors.reset}`);
36
99
  }
37
100
 
101
+ function createPrompt() {
102
+ return readline.createInterface({
103
+ input: process.stdin,
104
+ output: process.stdout,
105
+ });
106
+ }
107
+
108
+ async function ask(rl, question) {
109
+ return new Promise((resolve) => {
110
+ rl.question(question, resolve);
111
+ });
112
+ }
113
+
114
+ async function selectMultiple(rl, message, options) {
115
+ console.log(`\n${colors.cyan}${message}${colors.reset}\n`);
116
+
117
+ options.forEach((opt, i) => {
118
+ const marker = opt.recommended ? `${colors.green}⭐${colors.reset}` : ' ';
119
+ const check = opt.selected ? `${colors.green}[✓]${colors.reset}` : '[ ]';
120
+ console.log(` ${i + 1}. ${check} ${marker} ${opt.name} ${colors.dim}- ${opt.description}${colors.reset}`);
121
+ });
122
+
123
+ console.log(`\n${colors.dim}Enter numbers separated by commas (e.g., 1,2,4) or 'all' or 'none':${colors.reset}`);
124
+ const answer = await ask(rl, '> ');
125
+
126
+ if (answer.toLowerCase() === 'all') {
127
+ return options.map((_, i) => i);
128
+ }
129
+ if (answer.toLowerCase() === 'none' || answer.trim() === '') {
130
+ return [];
131
+ }
132
+
133
+ return answer.split(',')
134
+ .map(s => parseInt(s.trim()) - 1)
135
+ .filter(n => !isNaN(n) && n >= 0 && n < options.length);
136
+ }
137
+
38
138
  function copyRecursive(src, dest) {
39
139
  const stats = fs.statSync(src);
40
140
 
@@ -45,7 +145,6 @@ function copyRecursive(src, dest) {
45
145
 
46
146
  const files = fs.readdirSync(src);
47
147
  for (const file of files) {
48
- // Skip .git folder
49
148
  if (file === '.git') continue;
50
149
  copyRecursive(path.join(src, file), path.join(dest, file));
51
150
  }
@@ -54,139 +153,342 @@ function copyRecursive(src, dest) {
54
153
  }
55
154
  }
56
155
 
57
- function install(targetDir = process.cwd()) {
58
- console.log(colors.cyan + LOGO + colors.reset);
59
-
60
- log('\n📦 Installing CODE Framework...\n', colors.bright);
61
-
62
- const sourceDir = __dirname;
63
- const codeDir = path.join(targetDir, '_code');
64
- const projectTemplateDir = path.join(sourceDir, 'project-template');
65
-
66
- // Check if already installed
67
- if (fs.existsSync(codeDir)) {
68
- log('⚠️ CODE framework already installed in this directory.', colors.yellow);
69
- log(' Use --force to overwrite.\n');
156
+ function generateInstructionsFile(toolId, targetDir) {
157
+ const tool = CLI_TOOLS[toolId];
158
+ const commandPrefix = 'code';
70
159
 
71
- if (!process.argv.includes('--force')) {
72
- process.exit(1);
73
- }
74
- log(' --force detected, overwriting...\n', colors.yellow);
75
- }
160
+ const content = `# CODE Framework
76
161
 
77
- // Copy _code framework
78
- log('📁 Copying framework files...', colors.cyan);
79
- copyRecursive(path.join(sourceDir, '_code'), codeDir);
80
- log(' ✓ _code/ folder created\n', colors.green);
81
-
82
- // Copy project template folders
83
- log('📁 Creating project structure...', colors.cyan);
84
-
85
- const folders = [
86
- '1-context',
87
- '2-outline',
88
- '3-ux',
89
- '4-documentation',
90
- '5-evolution',
91
- 'research',
92
- '.claude'
93
- ];
94
-
95
- for (const folder of folders) {
96
- const srcFolder = path.join(projectTemplateDir, folder);
97
- const destFolder = path.join(targetDir, folder);
98
-
99
- if (fs.existsSync(srcFolder)) {
100
- // Don't overwrite existing folders unless forced
101
- if (fs.existsSync(destFolder) && !process.argv.includes('--force')) {
102
- log(` ⏭️ ${folder}/ exists, skipping`, colors.yellow);
103
- } else {
104
- copyRecursive(srcFolder, destFolder);
105
- log(` ✓ ${folder}/ created`, colors.green);
106
- }
107
- }
108
- }
162
+ This project uses the CODE Framework for AI-assisted development.
109
163
 
110
- // Create CLAUDE.md for Claude Code integration
111
- const claudeMd = `# CODE Framework
164
+ ## Quick Start
112
165
 
113
- This project uses the CODE Framework for AI-assisted development.
166
+ Run \`/${commandPrefix}-help\` to see all available commands.
114
167
 
115
168
  ## Commands
116
169
 
117
170
  | Command | Description |
118
171
  |---------|-------------|
119
- | \`/sage\` | Start with SAGE - the orchestrator |
120
- | \`/brief\` | Fill out or improve your BRIEF |
121
- | \`/outline\` | Generate technical architecture |
122
- | \`/ux\` | Generate sitemap and wireframes |
123
- | \`/docs\` | Generate epics and stories |
124
- | \`/evolve\` | Add a new feature |
125
- | \`/implement\` | Start coding a story |
126
- | \`/party\` | Multi-agent discussion |
172
+ | \`/${commandPrefix}-help\` | Show help and available commands |
173
+ | \`/${commandPrefix}-status\` | Check project status and next steps |
174
+ | \`/${commandPrefix}-sage\` | Start with SAGE - the orchestrator |
175
+ | \`/${commandPrefix}-brief\` | Fill out or improve your BRIEF |
176
+ | \`/${commandPrefix}-outline\` | Generate technical architecture |
177
+ | \`/${commandPrefix}-ux\` | Generate sitemap and wireframes |
178
+ | \`/${commandPrefix}-docs\` | Generate epics and stories |
179
+ | \`/${commandPrefix}-implement\` | Start coding a story |
180
+ | \`/${commandPrefix}-review\` | Quality review and testing |
181
+ | \`/${commandPrefix}-evolve\` | Add a new feature/version |
182
+ | \`/${commandPrefix}-party\` | Multi-agent discussion |
127
183
 
128
184
  ## Agents
129
185
 
130
- - **SAGE** 🧙 - Guide & Orchestrator
131
- - **IRIS** 🎯 - Context Architect (BRIEF)
132
- - **ATLAS** 🏗️ - Technical Architect
133
- - **LUNA** 🎨 - Experience Designer
134
- - **ECHO** 📖 - Story Keeper
135
- - **PHOENIX** 🚀 - Evolution Strategist
136
- - **BUILDER** 💻 - Developer
137
- - **SCOUT** 🧪 - Quality Guide
186
+ | Agent | Role | Expertise |
187
+ |-------|------|-----------|
188
+ | **SAGE** 🧙 | Guide & Orchestrator | Routes to right agent, tracks progress |
189
+ | **IRIS** 🎯 | Context Architect | Requirements, stakeholders, goals |
190
+ | **ATLAS** 🏗️ | Technical Architect | Architecture, tech stack, schemas |
191
+ | **LUNA** 🎨 | Experience Designer | UX, wireframes, user flows |
192
+ | **ECHO** 📖 | Story Keeper | Epics, stories, documentation |
193
+ | **PHOENIX** 🚀 | Evolution Strategist | Versioning, migrations, changelog |
194
+ | **BUILDER** 💻 | Developer | Implementation, coding, integration |
195
+ | **SCOUT** 🧪 | Quality Guide | Testing, review, quality gates |
138
196
 
139
197
  ## Project Structure
140
198
 
141
199
  \`\`\`
142
- 1-context/ # BRIEF goes here (start here!)
200
+ _code/ # Framework (read-only)
201
+ ├── agents/ # Agent definitions
202
+ ├── workflows/ # Workflow steps
203
+ ├── templates/ # Document templates
204
+ └── checklists/ # Quality gates
205
+
206
+ 1-context/ # Your BRIEF (start here!)
207
+ ├── v1.0.0/ # Version folder
208
+ │ ├── 1-brainstorm/
209
+ │ ├── 2-requirements/
210
+ │ ├── 3-inspiration/
211
+ │ ├── 4-entities/
212
+ │ └── 5-framework/
213
+
143
214
  2-outline/ # Technical architecture
144
215
  3-ux/ # Sitemap and wireframes
145
216
  4-documentation/ # Epics and stories
146
- 5-evolution/ # Changelog
147
- _code/ # Framework (don't edit)
217
+ 5-evolution/ # Changelog and versions
218
+ research/ # Research notes
148
219
  \`\`\`
149
220
 
150
- ## Getting Started
221
+ ## Workflow
222
+
223
+ 1. **Brief** → Fill out context in \`1-context/v1.0.0/\`
224
+ 2. **Outline** → Generate technical architecture
225
+ 3. **UX** → Create sitemap and wireframes
226
+ 4. **Docs** → Generate epics and stories
227
+ 5. **Implement** → Build story by story
228
+ 6. **Review** → Quality check each story
229
+ 7. **Evolve** → Plan next version
230
+
231
+ ## Quality Gates
151
232
 
152
- 1. Fill out the files in \`1-context/v1.0.0/\`
153
- 2. Run \`/brief\` to have IRIS help you improve them
154
- 3. Run \`/outline\` for technical architecture
155
- 4. Run \`/ux\` for sitemap and wireframes
156
- 5. Run \`/docs\` for epics and stories
157
- 6. Run \`/implement\` to start building!
233
+ Each workflow has quality checklists in \`_code/checklists/\`:
234
+ - \`brief-checklist.md\` - Context completeness
235
+ - \`architecture-checklist.md\` - Technical design review
236
+ - \`story-checklist.md\` - Story quality review
237
+ - \`code-review-checklist.md\` - Implementation review
238
+ - \`pre-release-checklist.md\` - Release readiness
158
239
 
159
240
  ## Philosophy
160
241
 
161
242
  > "All ideas deserve a story."
162
243
 
163
- Every feature, every thought gets documented and tracked.
244
+ Every feature gets documented, tracked, and evolved.
164
245
  `;
165
246
 
166
- const claudePath = path.join(targetDir, 'CLAUDE.md');
167
- if (!fs.existsSync(claudePath) || process.argv.includes('--force')) {
168
- fs.writeFileSync(claudePath, claudeMd);
169
- log(' ✓ CLAUDE.md created', colors.green);
170
- } else {
171
- log(' ⏭️ CLAUDE.md exists, skipping', colors.yellow);
247
+ return content;
248
+ }
249
+
250
+ function generateCommandsYaml() {
251
+ return `# CODE Framework Commands
252
+ # All commands are prefixed with /code- to avoid conflicts
253
+
254
+ commands:
255
+ # Help & Status
256
+ code-help:
257
+ description: "Show CODE framework help and available commands"
258
+ workflow: "_code/workflows/help.md"
259
+
260
+ code-status:
261
+ description: "Check project status and recommended next steps"
262
+ workflow: "_code/workflows/status.md"
263
+
264
+ # Main Workflows
265
+ code-sage:
266
+ description: "Start with SAGE - the orchestrator who guides you"
267
+ agent: "_code/agents/sage.agent.yaml"
268
+
269
+ code-brief:
270
+ description: "Fill out or improve your project BRIEF"
271
+ workflow: "_code/workflows/brief/workflow.md"
272
+ agent: "_code/agents/iris.agent.yaml"
273
+
274
+ code-outline:
275
+ description: "Generate technical architecture and schemas"
276
+ workflow: "_code/workflows/outline/workflow.md"
277
+ agent: "_code/agents/atlas.agent.yaml"
278
+
279
+ code-ux:
280
+ description: "Generate sitemap and wireframes"
281
+ workflow: "_code/workflows/ux/workflow.md"
282
+ agent: "_code/agents/luna.agent.yaml"
283
+
284
+ code-docs:
285
+ description: "Generate epics and user stories"
286
+ workflow: "_code/workflows/docs/workflow.md"
287
+ agent: "_code/agents/echo.agent.yaml"
288
+
289
+ code-implement:
290
+ description: "Implement a user story"
291
+ workflow: "_code/workflows/implement/workflow.md"
292
+ agent: "_code/agents/builder.agent.yaml"
293
+
294
+ code-review:
295
+ description: "Quality review and testing"
296
+ workflow: "_code/workflows/review/workflow.md"
297
+ agent: "_code/agents/scout.agent.yaml"
298
+
299
+ code-evolve:
300
+ description: "Plan and create a new version"
301
+ workflow: "_code/workflows/evolve/workflow.md"
302
+ agent: "_code/agents/phoenix.agent.yaml"
303
+
304
+ code-party:
305
+ description: "Multi-agent collaborative discussion"
306
+ workflow: "_code/workflows/party/workflow.md"
307
+
308
+ # Utility Commands
309
+ code-checklist:
310
+ description: "Run a quality checklist"
311
+ workflow: "_code/workflows/checklist.md"
312
+
313
+ code-research:
314
+ description: "Research a topic and save findings"
315
+ workflow: "_code/workflows/research.md"
316
+ `;
317
+ }
318
+
319
+ function generateSettingsJson() {
320
+ return JSON.stringify({
321
+ permissions: {
322
+ allow: [
323
+ "Bash(npm:*)",
324
+ "Bash(npx:*)",
325
+ "Bash(git:*)",
326
+ "Bash(ls:*)",
327
+ "Bash(cat:*)",
328
+ "Bash(mkdir:*)",
329
+ "Read",
330
+ "Write",
331
+ "Edit"
332
+ ],
333
+ deny: []
334
+ }
335
+ }, null, 2);
336
+ }
337
+
338
+ async function install(targetDir = process.cwd()) {
339
+ console.log(colors.cyan + LOGO + colors.reset);
340
+
341
+ log('\n📦 CODE Framework Installer\n', colors.bright);
342
+
343
+ const sourceDir = __dirname;
344
+ const codeDir = path.join(targetDir, '_code');
345
+ const projectTemplateDir = path.join(sourceDir, 'project-template');
346
+
347
+ // Check if already installed
348
+ if (fs.existsSync(codeDir)) {
349
+ log('⚠️ CODE framework already installed in this directory.', colors.yellow);
350
+ log(' Use --force to overwrite.\n');
351
+
352
+ if (!process.argv.includes('--force')) {
353
+ process.exit(1);
354
+ }
355
+ log(' --force detected, overwriting...\n', colors.yellow);
172
356
  }
173
357
 
174
- log('\n✅ Installation complete!\n', colors.green + colors.bright);
175
-
176
- log('📋 Next Steps:', colors.bright);
177
- log(' 1. Fill out the files in 1-context/v1.0.0/');
178
- log(' 2. Run /sage or /brief to get started with AI assistance');
179
- log('');
180
- log('📚 Structure:', colors.bright);
181
- log(' 1-context/ ← Start here! Fill out your BRIEF');
182
- log(' 2-outline/ ← Technical architecture (generated)');
183
- log(' 3-ux/ ← Sitemap & wireframes (generated)');
184
- log(' 4-documentation/ ← Epics & stories (generated)');
185
- log(' 5-evolution/ ← Track changes over time');
186
- log(' _code/ ← Framework files (don\'t edit)');
187
- log('');
188
- log('🧙 Run /sage to begin your CODE journey!', colors.cyan + colors.bright);
189
- log('');
358
+ const rl = createPrompt();
359
+
360
+ try {
361
+ // Step 1: Select CLI tools
362
+ log('🔧 Step 1: Select AI CLI Tools to Configure\n', colors.bright);
363
+ log('CODE Framework can integrate with multiple AI coding assistants.', colors.dim);
364
+ log('Select which tools you want to configure:\n', colors.dim);
365
+
366
+ const toolOptions = Object.entries(CLI_TOOLS).map(([id, tool]) => ({
367
+ id,
368
+ name: tool.name,
369
+ description: tool.description,
370
+ recommended: tool.recommended,
371
+ selected: tool.recommended,
372
+ }));
373
+
374
+ const selectedIndices = await selectMultiple(rl, 'Select tools to configure:', toolOptions);
375
+ const selectedTools = selectedIndices.map(i => toolOptions[i].id);
376
+
377
+ if (selectedTools.length === 0) {
378
+ log('\n⚠️ No tools selected. Installing framework files only.', colors.yellow);
379
+ } else {
380
+ log(`\n✓ Selected: ${selectedTools.map(id => CLI_TOOLS[id].name).join(', ')}`, colors.green);
381
+ }
382
+
383
+ // Step 2: Copy framework files
384
+ log('\n📁 Step 2: Installing Framework Files...\n', colors.bright);
385
+
386
+ // Copy _code framework
387
+ log(' Copying framework files...', colors.cyan);
388
+ copyRecursive(path.join(sourceDir, '_code'), codeDir);
389
+ log(' ✓ _code/ folder created', colors.green);
390
+
391
+ // Copy project template folders
392
+ log(' Creating project structure...', colors.cyan);
393
+
394
+ const folders = [
395
+ '1-context',
396
+ '2-outline',
397
+ '3-ux',
398
+ '4-documentation',
399
+ '5-evolution',
400
+ 'research',
401
+ ];
402
+
403
+ for (const folder of folders) {
404
+ const srcFolder = path.join(projectTemplateDir, folder);
405
+ const destFolder = path.join(targetDir, folder);
406
+
407
+ if (fs.existsSync(srcFolder)) {
408
+ if (fs.existsSync(destFolder) && !process.argv.includes('--force')) {
409
+ log(` ⏭️ ${folder}/ exists, skipping`, colors.yellow);
410
+ } else {
411
+ copyRecursive(srcFolder, destFolder);
412
+ log(` ✓ ${folder}/ created`, colors.green);
413
+ }
414
+ }
415
+ }
416
+
417
+ // Step 3: Configure selected tools
418
+ if (selectedTools.length > 0) {
419
+ log('\n🔧 Step 3: Configuring AI Tools...\n', colors.bright);
420
+
421
+ for (const toolId of selectedTools) {
422
+ const tool = CLI_TOOLS[toolId];
423
+ log(` Configuring ${tool.name}...`, colors.cyan);
424
+
425
+ // Create config directory
426
+ const configDir = path.dirname(path.join(targetDir, tool.configFile));
427
+ if (!fs.existsSync(configDir)) {
428
+ fs.mkdirSync(configDir, { recursive: true });
429
+ }
430
+
431
+ // Write commands file
432
+ if (tool.configFile.endsWith('.yaml') || tool.configFile.endsWith('.yml')) {
433
+ fs.writeFileSync(
434
+ path.join(targetDir, tool.configFile),
435
+ generateCommandsYaml()
436
+ );
437
+ }
438
+
439
+ // Write settings file
440
+ if (tool.settingsFile) {
441
+ const settingsPath = path.join(targetDir, tool.settingsFile);
442
+ if (!fs.existsSync(settingsPath) || process.argv.includes('--force')) {
443
+ fs.writeFileSync(settingsPath, generateSettingsJson());
444
+ }
445
+ }
446
+
447
+ // Write instructions file
448
+ const instructionsPath = path.join(targetDir, tool.instructionsFile);
449
+ if (!fs.existsSync(instructionsPath) || process.argv.includes('--force')) {
450
+ fs.writeFileSync(instructionsPath, generateInstructionsFile(toolId, targetDir));
451
+ }
452
+
453
+ log(` ✓ ${tool.name} configured`, colors.green);
454
+ }
455
+ }
456
+
457
+ rl.close();
458
+
459
+ // Final summary
460
+ log('\n✅ Installation complete!\n', colors.green + colors.bright);
461
+
462
+ log('📋 What was installed:', colors.bright);
463
+ log(' _code/ Framework files (agents, workflows, checklists)');
464
+ log(' 1-context/ Your project BRIEF (start here!)');
465
+ log(' 2-outline/ Technical architecture');
466
+ log(' 3-ux/ UX designs and wireframes');
467
+ log(' 4-documentation/ Epics and stories');
468
+ log(' 5-evolution/ Version history');
469
+ log(' research/ Research notes');
470
+
471
+ if (selectedTools.length > 0) {
472
+ log('\n🔧 Configured tools:', colors.bright);
473
+ for (const toolId of selectedTools) {
474
+ const tool = CLI_TOOLS[toolId];
475
+ log(` ✓ ${tool.name} (${tool.instructionsFile})`);
476
+ }
477
+ }
478
+
479
+ log('\n📋 Next Steps:', colors.bright);
480
+ log(' 1. Fill out the files in 1-context/v1.0.0/');
481
+ log(' 2. Run /code-help to see available commands');
482
+ log(' 3. Run /code-sage to start with the AI guide');
483
+ log('');
484
+ log('🧙 Run /code-sage to begin your CODE journey!', colors.cyan + colors.bright);
485
+ log('');
486
+
487
+ } catch (error) {
488
+ rl.close();
489
+ log(`\n❌ Installation failed: ${error.message}`, colors.red);
490
+ process.exit(1);
491
+ }
190
492
  }
191
493
 
192
494
  // Run installer
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "code-framework",
3
- "version": "1.0.0",
3
+ "version": "1.1.0",
4
4
  "description": "Context. Outline. Documentation. Evolve. - AI-assisted development framework",
5
5
  "main": "install.js",
6
6
  "bin": {