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.
- package/cli.js +132 -84
- 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
|
-
|
|
449
|
-
|
|
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
|
|
491
|
-
path.join(targetDir, '
|
|
492
|
-
path.join(targetDir, '
|
|
493
|
-
path.join(targetDir, '
|
|
494
|
-
path.join(targetDir, '
|
|
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
|
-
|
|
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
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
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
|
-
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
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
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
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
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
557
|
-
|
|
558
|
-
|
|
559
|
-
|
|
560
|
-
|
|
561
|
-
|
|
562
|
-
|
|
563
|
-
|
|
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
|
-
//
|
|
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
|
|
571
|
-
|
|
572
|
-
|
|
573
|
-
|
|
574
|
-
|
|
575
|
-
|
|
576
|
-
|
|
577
|
-
|
|
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
|
|
582
|
-
|
|
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(
|
|
593
|
-
fs.writeFileSync(path.join(
|
|
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(
|
|
596
|
-
fs.writeFileSync(path.join(
|
|
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(
|
|
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(' •
|
|
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(' •
|
|
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.
|
|
664
|
-
console.log(' 2.
|
|
665
|
-
console.log(' 3.
|
|
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
|
|