cursor-sdd 1.0.6 → 1.0.7

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.
@@ -1,4 +1,5 @@
1
1
  #!/usr/bin/env node
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;
@@ -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,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-sdd",
3
- "version": "1.0.6",
3
+ "version": "1.0.7",
4
4
  "description": "Cursor SDD (Spec-Driven Development) - AI-powered spec templates, rules and commands for Cursor IDE",
5
5
  "bin": {
6
6
  "cursor-sdd": "./bin/setup.js"