sisyo 1.2.0 → 1.2.1
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/bin/sisyo.js +67 -32
- package/package.json +1 -1
package/bin/sisyo.js
CHANGED
|
@@ -5,40 +5,63 @@ const path = require("path");
|
|
|
5
5
|
|
|
6
6
|
const RESET = "\x1b[0m";
|
|
7
7
|
const GREEN = "\x1b[32m";
|
|
8
|
+
const YELLOW = "\x1b[33m";
|
|
8
9
|
const CYAN = "\x1b[36m";
|
|
9
10
|
const BOLD = "\x1b[1m";
|
|
10
11
|
const DIM = "\x1b[2m";
|
|
11
12
|
|
|
12
13
|
function log(msg) { console.log(msg); }
|
|
13
14
|
function ok(msg) { log(`${GREEN}+${RESET} ${msg}`); }
|
|
15
|
+
function up(msg) { log(`${YELLOW}~${RESET} ${msg}`); }
|
|
14
16
|
function info(msg) { log(`${DIM} ${msg}${RESET}`); }
|
|
15
17
|
|
|
16
|
-
|
|
18
|
+
// System files that get replaced on --update
|
|
19
|
+
const SYSTEM_FILES = [
|
|
20
|
+
".claude/rules/docs.md",
|
|
21
|
+
".claude/skills/vibe-docs/SKILL.md",
|
|
22
|
+
];
|
|
23
|
+
|
|
24
|
+
function isSystemFile(relativePath) {
|
|
25
|
+
return SYSTEM_FILES.some(f => relativePath === f || relativePath.endsWith(f));
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
function copyDir(src, dest, { updateMode = false } = {}) {
|
|
17
29
|
fs.mkdirSync(dest, { recursive: true });
|
|
18
30
|
for (const entry of fs.readdirSync(src, { withFileTypes: true })) {
|
|
19
31
|
const srcPath = path.join(src, entry.name);
|
|
20
32
|
const destPath = path.join(dest, entry.name);
|
|
21
33
|
if (entry.isDirectory()) {
|
|
22
|
-
copyDir(srcPath, destPath);
|
|
34
|
+
copyDir(srcPath, destPath, { updateMode });
|
|
23
35
|
} else {
|
|
24
|
-
|
|
36
|
+
const rel = path.relative(process.cwd(), destPath);
|
|
25
37
|
if (fs.existsSync(destPath)) {
|
|
26
|
-
|
|
38
|
+
if (updateMode && isSystemFile(rel)) {
|
|
39
|
+
fs.copyFileSync(srcPath, destPath);
|
|
40
|
+
up(`${rel} (updated)`);
|
|
41
|
+
} else {
|
|
42
|
+
info(`skip ${rel} (exists)`);
|
|
43
|
+
}
|
|
27
44
|
continue;
|
|
28
45
|
}
|
|
29
46
|
fs.copyFileSync(srcPath, destPath);
|
|
30
|
-
ok(
|
|
47
|
+
ok(rel);
|
|
31
48
|
}
|
|
32
49
|
}
|
|
33
50
|
}
|
|
34
51
|
|
|
35
52
|
function main() {
|
|
36
|
-
const
|
|
53
|
+
const args = process.argv.slice(2);
|
|
54
|
+
const updateMode = args.includes("--update");
|
|
55
|
+
const targetDir = args.find(a => !a.startsWith("-")) || ".";
|
|
37
56
|
const target = path.resolve(targetDir);
|
|
38
57
|
const templatesDir = path.join(__dirname, "..", "templates");
|
|
39
58
|
|
|
40
59
|
log("");
|
|
41
|
-
|
|
60
|
+
if (updateMode) {
|
|
61
|
+
log(`${BOLD}${CYAN}sisyo${RESET} ${DIM}Updating system files...${RESET}`);
|
|
62
|
+
} else {
|
|
63
|
+
log(`${BOLD}${CYAN}sisyo${RESET} ${DIM}Smart docs for Claude Code${RESET}`);
|
|
64
|
+
}
|
|
42
65
|
log("");
|
|
43
66
|
|
|
44
67
|
if (!fs.existsSync(templatesDir)) {
|
|
@@ -47,31 +70,39 @@ function main() {
|
|
|
47
70
|
}
|
|
48
71
|
|
|
49
72
|
// Copy all templates
|
|
50
|
-
copyDir(templatesDir, target);
|
|
73
|
+
copyDir(templatesDir, target, { updateMode });
|
|
51
74
|
|
|
52
75
|
// Get today's date
|
|
53
76
|
const today = new Date().toISOString().split("T")[0];
|
|
54
77
|
|
|
55
|
-
// Update dates in MAP.md and handoff
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
78
|
+
// Update dates in MAP.md and handoff (only on fresh install, not --update)
|
|
79
|
+
if (!updateMode) {
|
|
80
|
+
const mapPath = path.join(target, "docs", "MAP.md");
|
|
81
|
+
if (fs.existsSync(mapPath)) {
|
|
82
|
+
let mapContent = fs.readFileSync(mapPath, "utf8");
|
|
83
|
+
if (mapContent.includes("YYYY-MM-DD")) {
|
|
84
|
+
mapContent = mapContent.replace(/YYYY-MM-DD/g, today);
|
|
85
|
+
fs.writeFileSync(mapPath, mapContent);
|
|
86
|
+
}
|
|
87
|
+
}
|
|
62
88
|
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
89
|
+
const handoffPath = path.join(target, "docs", "99_progress", "handoff.md");
|
|
90
|
+
if (fs.existsSync(handoffPath)) {
|
|
91
|
+
let content = fs.readFileSync(handoffPath, "utf8");
|
|
92
|
+
if (content.includes("YYYY-MM-DD")) {
|
|
93
|
+
content = content.replace(/YYYY-MM-DD/g, today);
|
|
94
|
+
fs.writeFileSync(handoffPath, content);
|
|
95
|
+
}
|
|
96
|
+
}
|
|
69
97
|
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
98
|
+
const todoPath = path.join(target, "docs", "99_progress", "todo.md");
|
|
99
|
+
if (fs.existsSync(todoPath)) {
|
|
100
|
+
let content = fs.readFileSync(todoPath, "utf8");
|
|
101
|
+
if (content.includes("YYYY-MM-DD")) {
|
|
102
|
+
content = content.replace(/YYYY-MM-DD/g, today);
|
|
103
|
+
fs.writeFileSync(todoPath, content);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
75
106
|
}
|
|
76
107
|
|
|
77
108
|
// Add to .gitignore if exists
|
|
@@ -87,13 +118,17 @@ function main() {
|
|
|
87
118
|
}
|
|
88
119
|
|
|
89
120
|
log("");
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
121
|
+
if (updateMode) {
|
|
122
|
+
log(`${BOLD}Done!${RESET} System files updated. Your docs are untouched.`);
|
|
123
|
+
} else {
|
|
124
|
+
log(`${BOLD}Done!${RESET} Next steps:`);
|
|
125
|
+
log("");
|
|
126
|
+
log(` 1. Edit ${CYAN}CLAUDE.md${RESET} — replace [Project Name] with yours`);
|
|
127
|
+
log(` 2. Open Claude Code and start building`);
|
|
128
|
+
log(` 3. Docs auto-update as you work`);
|
|
129
|
+
}
|
|
95
130
|
log("");
|
|
96
|
-
log(`${DIM}Docs system: CLAUDE.md -> docs/MAP.md ->
|
|
131
|
+
log(`${DIM}Docs system: CLAUDE.md -> docs/MAP.md -> _summary.md -> detail files${RESET}`);
|
|
97
132
|
log("");
|
|
98
133
|
}
|
|
99
134
|
|