sumulige-claude 1.0.1 → 1.0.2

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 (2) hide show
  1. package/cli.js +132 -84
  2. package/package.json +1 -1
package/cli.js CHANGED
@@ -342,7 +342,7 @@ const commands = {
342
342
  if (fs.existsSync(ragIndexFile)) {
343
343
  try {
344
344
  ragIndex = JSON.parse(fs.readFileSync(ragIndexFile, 'utf-8'));
345
- } catch (e) {}
345
+ } catch (e) { }
346
346
  }
347
347
 
348
348
  // 添加新技能到索引
@@ -445,9 +445,9 @@ const commands = {
445
445
  // 检查所有技能
446
446
  const allSkills = fs.existsSync(skillsDir)
447
447
  ? fs.readdirSync(skillsDir).filter(f => {
448
- const dir = path.join(skillsDir, f);
449
- return fs.statSync(dir).isDirectory() && f !== 'template' && f !== 'examples';
450
- })
448
+ const dir = path.join(skillsDir, f);
449
+ return fs.statSync(dir).isDirectory() && f !== 'template' && f !== 'examples';
450
+ })
451
451
  : [];
452
452
 
453
453
  console.log(`Found ${allSkills.length} skills\n`);
@@ -484,14 +484,46 @@ const commands = {
484
484
  process.exit(1);
485
485
  }
486
486
 
487
+ // 递归复制目录(含子目录和文件)
488
+ const copyRecursive = (src, dest, overwrite = false) => {
489
+ if (!fs.existsSync(src)) return 0;
490
+
491
+ if (!fs.existsSync(dest)) {
492
+ fs.mkdirSync(dest, { recursive: true });
493
+ }
494
+
495
+ let count = 0;
496
+ const entries = fs.readdirSync(src, { withFileTypes: true });
497
+
498
+ for (const entry of entries) {
499
+ const srcPath = path.join(src, entry.name);
500
+ const destPath = path.join(dest, entry.name);
501
+
502
+ if (entry.isDirectory()) {
503
+ count += copyRecursive(srcPath, destPath, overwrite);
504
+ } else {
505
+ if (overwrite || !fs.existsSync(destPath)) {
506
+ fs.copyFileSync(srcPath, destPath);
507
+ // 添加执行权限
508
+ if (entry.name.endsWith('.sh') || entry.name.endsWith('.cjs')) {
509
+ fs.chmodSync(destPath, 0o755);
510
+ }
511
+ count++;
512
+ }
513
+ }
514
+ }
515
+ return count;
516
+ };
517
+
487
518
  // 创建目录结构
488
519
  console.log('📁 Creating directory structure...');
489
520
  const dirs = [
490
- path.join(targetDir, '.claude/hooks'),
491
- path.join(targetDir, '.claude/thinking-routes'),
492
- path.join(targetDir, '.claude/skills'),
493
- path.join(targetDir, '.claude/rag'),
494
- path.join(targetDir, 'prompts')
521
+ path.join(targetDir, '.claude'),
522
+ path.join(targetDir, 'prompts'),
523
+ path.join(targetDir, 'development/todos/active'),
524
+ path.join(targetDir, 'development/todos/completed'),
525
+ path.join(targetDir, 'development/todos/backlog'),
526
+ path.join(targetDir, 'development/todos/archived')
495
527
  ];
496
528
 
497
529
  dirs.forEach(dir => {
@@ -504,82 +536,96 @@ const commands = {
504
536
  // 复制文件
505
537
  console.log('📋 Copying template files...');
506
538
 
507
- // 复制 .claude 文件
508
539
  const claudeTemplateDir = path.join(TEMPLATE_DIR, '.claude');
509
- if (fs.existsSync(claudeTemplateDir)) {
510
- // CLAUDE-template.md
511
- const claudeTemplate = path.join(claudeTemplateDir, 'CLAUDE-template.md');
512
- if (fs.existsSync(claudeTemplate)) {
513
- fs.copyFileSync(claudeTemplate, path.join(targetDir, '.claude/CLAUDE.md'));
514
- console.log(' ✅ .claude/CLAUDE.md');
515
- }
540
+ const targetClaudeDir = path.join(targetDir, '.claude');
516
541
 
517
- // settings.json
518
- const settingsFile = path.join(claudeTemplateDir, 'settings.json');
519
- if (fs.existsSync(settingsFile)) {
520
- fs.copyFileSync(settingsFile, path.join(targetDir, '.claude/settings.json'));
521
- console.log(' ✅ .claude/settings.json');
522
- }
542
+ // 1. CLAUDE.md (从 CLAUDE-template.md)
543
+ const claudeTemplate = path.join(claudeTemplateDir, 'CLAUDE-template.md');
544
+ if (fs.existsSync(claudeTemplate)) {
545
+ fs.copyFileSync(claudeTemplate, path.join(targetClaudeDir, 'CLAUDE.md'));
546
+ console.log(' ✅ .claude/CLAUDE.md');
547
+ }
523
548
 
524
- // hooks/
525
- const hooksDir = path.join(claudeTemplateDir, 'hooks');
526
- if (fs.existsSync(hooksDir)) {
527
- const hooks = fs.readdirSync(hooksDir);
528
- hooks.forEach(hook => {
529
- const src = path.join(hooksDir, hook);
530
- const dest = path.join(targetDir, '.claude/hooks', hook);
531
- fs.copyFileSync(src, dest);
532
- // 添加执行权限
533
- if (hook.endsWith('.js') || hook.endsWith('.sh')) {
534
- fs.chmodSync(dest, 0o755);
535
- }
536
- });
537
- console.log(' ✅ .claude/hooks/ (' + hooks.length + ' files)');
538
- }
549
+ // 2. README.md
550
+ const readmeFile = path.join(claudeTemplateDir, 'README.md');
551
+ if (fs.existsSync(readmeFile)) {
552
+ fs.copyFileSync(readmeFile, path.join(targetClaudeDir, 'README.md'));
553
+ console.log(' ✅ .claude/README.md');
554
+ }
539
555
 
540
- // thinking-routes/
541
- const routesDir = path.join(claudeTemplateDir, 'thinking-routes');
542
- if (fs.existsSync(routesDir)) {
543
- const files = fs.readdirSync(routesDir);
544
- files.forEach(file => {
545
- fs.copyFileSync(
546
- path.join(routesDir, file),
547
- path.join(targetDir, '.claude/thinking-routes', file)
548
- );
549
- });
550
- console.log(' ✅ .claude/thinking-routes/');
551
- }
556
+ // 3. settings.json
557
+ const settingsFile = path.join(claudeTemplateDir, 'settings.json');
558
+ if (fs.existsSync(settingsFile)) {
559
+ fs.copyFileSync(settingsFile, path.join(targetClaudeDir, 'settings.json'));
560
+ console.log(' ✅ .claude/settings.json');
561
+ }
552
562
 
553
- // rag/
554
- const ragDir = path.join(claudeTemplateDir, 'rag');
555
- if (fs.existsSync(ragDir)) {
556
- const files = fs.readdirSync(ragDir);
557
- files.forEach(file => {
558
- fs.copyFileSync(
559
- path.join(ragDir, file),
560
- path.join(targetDir, '.claude/rag', file)
561
- );
562
- });
563
- console.log(' ✅ .claude/rag/');
564
- }
563
+ // 4. boris-optimizations.md
564
+ const borisFile = path.join(claudeTemplateDir, 'boris-optimizations.md');
565
+ if (fs.existsSync(borisFile)) {
566
+ fs.copyFileSync(borisFile, path.join(targetClaudeDir, 'boris-optimizations.md'));
567
+ console.log(' ✅ .claude/boris-optimizations.md');
568
+ }
569
+
570
+ // 5. hooks/ (递归复制)
571
+ const hooksDir = path.join(claudeTemplateDir, 'hooks');
572
+ if (fs.existsSync(hooksDir)) {
573
+ const count = copyRecursive(hooksDir, path.join(targetClaudeDir, 'hooks'), true);
574
+ console.log(` ✅ .claude/hooks/ (${count} files)`);
575
+ }
576
+
577
+ // 6. commands/ (递归复制) ⭐ 新增
578
+ const commandsDir = path.join(claudeTemplateDir, 'commands');
579
+ if (fs.existsSync(commandsDir)) {
580
+ const count = copyRecursive(commandsDir, path.join(targetClaudeDir, 'commands'), true);
581
+ console.log(` ✅ .claude/commands/ (${count} files)`);
582
+ }
583
+
584
+ // 7. skills/ (递归复制) ⭐ 新增
585
+ const skillsDir = path.join(claudeTemplateDir, 'skills');
586
+ if (fs.existsSync(skillsDir)) {
587
+ const count = copyRecursive(skillsDir, path.join(targetClaudeDir, 'skills'), false);
588
+ console.log(` ✅ .claude/skills/ (${count} files)`);
589
+ }
590
+
591
+ // 8. templates/ (递归复制) ⭐ 新增
592
+ const templatesDir = path.join(claudeTemplateDir, 'templates');
593
+ if (fs.existsSync(templatesDir)) {
594
+ const count = copyRecursive(templatesDir, path.join(targetClaudeDir, 'templates'), false);
595
+ console.log(` ✅ .claude/templates/ (${count} files)`);
596
+ }
597
+
598
+ // 9. thinking-routes/
599
+ const routesDir = path.join(claudeTemplateDir, 'thinking-routes');
600
+ if (fs.existsSync(routesDir)) {
601
+ const count = copyRecursive(routesDir, path.join(targetClaudeDir, 'thinking-routes'), false);
602
+ console.log(` ✅ .claude/thinking-routes/ (${count} files)`);
565
603
  }
566
604
 
567
- // 复制 prompts/
605
+ // 10. rag/
606
+ const ragDir = path.join(claudeTemplateDir, 'rag');
607
+ if (fs.existsSync(ragDir)) {
608
+ const count = copyRecursive(ragDir, path.join(targetClaudeDir, 'rag'), true);
609
+ console.log(` ✅ .claude/rag/ (${count} files)`);
610
+ }
611
+
612
+ // 11. prompts/
568
613
  const promptsDir = path.join(TEMPLATE_DIR, 'prompts');
569
614
  if (fs.existsSync(promptsDir)) {
570
- const files = fs.readdirSync(promptsDir);
571
- files.forEach(file => {
572
- fs.copyFileSync(
573
- path.join(promptsDir, file),
574
- path.join(targetDir, 'prompts', file)
575
- );
576
- });
577
- console.log(' prompts/');
615
+ const count = copyRecursive(promptsDir, path.join(targetDir, 'prompts'), false);
616
+ console.log(` ✅ prompts/ (${count} files)`);
617
+ }
618
+
619
+ // 12. development/todos/
620
+ const todosDir = path.join(TEMPLATE_DIR, 'development', 'todos');
621
+ if (fs.existsSync(todosDir)) {
622
+ const count = copyRecursive(todosDir, path.join(targetDir, 'development', 'todos'), false);
623
+ console.log(` ✅ development/todos/ (${count} files)`);
578
624
  }
579
625
 
580
- // 复制根目录文件
581
- const files = ['project-paradigm.md', 'thinkinglens-silent.md'];
582
- files.forEach(file => {
626
+ // 13. 根目录文件
627
+ const rootFiles = ['project-paradigm.md', 'thinkinglens-silent.md', 'CLAUDE-template.md'];
628
+ rootFiles.forEach(file => {
583
629
  const src = path.join(TEMPLATE_DIR, file);
584
630
  if (fs.existsSync(src)) {
585
631
  fs.copyFileSync(src, path.join(targetDir, file));
@@ -589,11 +635,11 @@ const commands = {
589
635
 
590
636
  // 创建记忆文件
591
637
  console.log('📝 Creating memory files...');
592
- if (!fs.existsSync(path.join(targetDir, '.claude/MEMORY.md'))) {
593
- fs.writeFileSync(path.join(targetDir, '.claude/MEMORY.md'), '# Memory\n\n<!-- Project memory updated by AI -->\n');
638
+ if (!fs.existsSync(path.join(targetClaudeDir, 'MEMORY.md'))) {
639
+ fs.writeFileSync(path.join(targetClaudeDir, 'MEMORY.md'), '# Memory\n\n<!-- Project memory updated by AI -->\n');
594
640
  }
595
- if (!fs.existsSync(path.join(targetDir, '.claude/PROJECT_LOG.md'))) {
596
- fs.writeFileSync(path.join(targetDir, '.claude/PROJECT_LOG.md'), '# Project Log\n\n<!-- Build history and decisions -->\n');
641
+ if (!fs.existsSync(path.join(targetClaudeDir, 'PROJECT_LOG.md'))) {
642
+ fs.writeFileSync(path.join(targetClaudeDir, 'PROJECT_LOG.md'), '# Project Log\n\n<!-- Build history and decisions -->\n');
597
643
  }
598
644
  console.log(' ✅ Memory files created');
599
645
 
@@ -637,7 +683,7 @@ const commands = {
637
683
  ## Add Your Anchors Here...
638
684
 
639
685
  `;
640
- fs.writeFileSync(path.join(targetDir, '.claude/ANCHORS.md'), anchorsContent);
686
+ fs.writeFileSync(path.join(targetClaudeDir, 'ANCHORS.md'), anchorsContent);
641
687
  console.log(' ✅ .claude/ANCHORS.md');
642
688
 
643
689
  // 初始化 Sumulige Claude(如果已安装)
@@ -655,14 +701,16 @@ const commands = {
655
701
  console.log('');
656
702
  console.log('📦 What was included:');
657
703
  console.log(' • AI autonomous memory system (ThinkingLens)');
658
- console.log(' • Sumulige Claude integration');
704
+ console.log(' • Slash commands (/commit, /test, /review, etc.)');
705
+ console.log(' • Skills system with templates');
659
706
  console.log(' • RAG dynamic skill index');
660
- console.log(' • 20+ pre-configured skills');
707
+ console.log(' • Hooks for automation');
708
+ console.log(' • TODO management system');
661
709
  console.log('');
662
710
  console.log('Next steps:');
663
- console.log(' 1. Run: sumulige-claude kickoff # 开始项目规划');
664
- console.log(' 2. Edit .claude/CLAUDE.md with your project info');
665
- console.log(' 3. Run: sumulige-claude status');
711
+ console.log(' 1. Edit .claude/CLAUDE.md with your project info');
712
+ console.log(' 2. Run: claude # Start Claude Code');
713
+ console.log(' 3. Try: /commit, /test, /review');
666
714
  console.log('');
667
715
  },
668
716
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sumulige-claude",
3
- "version": "1.0.1",
3
+ "version": "1.0.2",
4
4
  "description": "The Best Agent Harness for Claude Code",
5
5
  "main": "cli.js",
6
6
  "bin": {