cursor-sdd 1.0.6 → 1.0.8
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/{setup.js → setup.ts} +28 -7
- package/package.json +6 -3
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
#!/usr/bin/env
|
|
1
|
+
#!/usr/bin/env tsx
|
|
2
|
+
// @ts-nocheck
|
|
2
3
|
|
|
3
4
|
const fs = require('fs');
|
|
4
5
|
const path = require('path');
|
|
@@ -13,6 +14,9 @@ const FOLDERS_BY_MODE = {
|
|
|
13
14
|
new: ['commands', 'rules', 'templates'],
|
|
14
15
|
assign: ['assign'],
|
|
15
16
|
};
|
|
17
|
+
const MANAGED_FOLDERS = Array.from(
|
|
18
|
+
new Set([...FOLDERS_BY_MODE.new, ...FOLDERS_BY_MODE.assign, 'bin'])
|
|
19
|
+
);
|
|
16
20
|
|
|
17
21
|
// プロジェクトのルートを取得(node_modules の2つ上)
|
|
18
22
|
function getProjectRoot() {
|
|
@@ -59,6 +63,20 @@ function copyRecursive(src, dest) {
|
|
|
59
63
|
}
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
function cleanOtherFolders(mode) {
|
|
67
|
+
if (!fs.existsSync(targetDir)) return;
|
|
68
|
+
|
|
69
|
+
const keep = new Set(FOLDERS_BY_MODE[mode] || []);
|
|
70
|
+
for (const folder of MANAGED_FOLDERS) {
|
|
71
|
+
if (keep.has(folder)) continue;
|
|
72
|
+
const dest = path.join(targetDir, folder);
|
|
73
|
+
if (fs.existsSync(dest)) {
|
|
74
|
+
fs.rmSync(dest, { recursive: true, force: true });
|
|
75
|
+
console.log(` 🧹 Removed: ${path.relative(projectRoot, dest)}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
|
|
62
80
|
function getArgValue(flag) {
|
|
63
81
|
const idx = process.argv.indexOf(flag);
|
|
64
82
|
if (idx === -1) return null;
|
|
@@ -91,12 +109,12 @@ function createTTYInterface() {
|
|
|
91
109
|
const input = process.stdin.isTTY
|
|
92
110
|
? process.stdin
|
|
93
111
|
: (() => {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
112
|
+
try {
|
|
113
|
+
return fs.createReadStream('/dev/tty');
|
|
114
|
+
} catch {
|
|
115
|
+
return process.stdin;
|
|
116
|
+
}
|
|
117
|
+
})();
|
|
100
118
|
const output = process.stdout; // 出力は常に標準出力に寄せる
|
|
101
119
|
return readline.createInterface({ input, output });
|
|
102
120
|
}
|
|
@@ -144,6 +162,9 @@ function setup({ mode, sourceRoot, folders }) {
|
|
|
144
162
|
fs.mkdirSync(targetDir, { recursive: true });
|
|
145
163
|
}
|
|
146
164
|
|
|
165
|
+
// 選択したモード以外のフォルダを掃除
|
|
166
|
+
cleanOtherFolders(mode);
|
|
167
|
+
|
|
147
168
|
if (!folders.length) {
|
|
148
169
|
console.log(`ℹ️ No folders to copy for mode: ${mode}.`);
|
|
149
170
|
return;
|
package/package.json
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "cursor-sdd",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.8",
|
|
4
4
|
"description": "Cursor SDD (Spec-Driven Development) - AI-powered spec templates, rules and commands for Cursor IDE",
|
|
5
5
|
"bin": {
|
|
6
|
-
"cursor-sdd": "./bin/setup.
|
|
6
|
+
"cursor-sdd": "./bin/setup.ts"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
9
|
"bin",
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
"assign"
|
|
14
14
|
],
|
|
15
15
|
"scripts": {
|
|
16
|
-
"postinstall": "
|
|
16
|
+
"postinstall": "tsx bin/setup.ts --auto"
|
|
17
17
|
},
|
|
18
18
|
"keywords": [
|
|
19
19
|
"cursor",
|
|
@@ -26,6 +26,9 @@
|
|
|
26
26
|
],
|
|
27
27
|
"author": "",
|
|
28
28
|
"license": "MIT",
|
|
29
|
+
"dependencies": {
|
|
30
|
+
"tsx": "^4.7.0"
|
|
31
|
+
},
|
|
29
32
|
"repository": {
|
|
30
33
|
"type": "git",
|
|
31
34
|
"url": ""
|