cursor-sdd 1.0.4 → 1.0.5

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/bin/setup.js +28 -2
  2. package/package.json +1 -1
package/bin/setup.js CHANGED
@@ -71,12 +71,38 @@ function normalizeMode(value) {
71
71
  return null;
72
72
  }
73
73
 
74
+ function hasTTY() {
75
+ if (process.stdout.isTTY && process.stdin.isTTY) return true;
76
+ // npm install 時に stdin がパイプ扱いになる場合のため /dev/tty を確認
77
+ try {
78
+ fs.accessSync('/dev/tty', fs.constants.R_OK | fs.constants.W_OK);
79
+ return true;
80
+ } catch {
81
+ return false;
82
+ }
83
+ }
84
+
85
+ function createTTYInterface() {
86
+ // stdin が非TTYでも /dev/tty を使って対話できるようにする
87
+ const input = process.stdin.isTTY
88
+ ? process.stdin
89
+ : (() => {
90
+ try {
91
+ return fs.createReadStream('/dev/tty');
92
+ } catch {
93
+ return process.stdin;
94
+ }
95
+ })();
96
+ const output = process.stdout; // 出力は常に標準出力に寄せる
97
+ return readline.createInterface({ input, output });
98
+ }
99
+
74
100
  function shouldPromptForMode(explicitMode) {
75
- return !explicitMode && process.stdout.isTTY && process.stdin.isTTY && !process.env.CI;
101
+ return !explicitMode && hasTTY() && !process.env.CI;
76
102
  }
77
103
 
78
104
  async function askMode() {
79
- const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
105
+ const rl = createTTYInterface();
80
106
  const answer = await new Promise((resolve) => {
81
107
  rl.question('新規PJを立ち上げますか?既存PJにアサインしますか? [n]ew/[a]ssign (default: new): ', resolve);
82
108
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cursor-sdd",
3
- "version": "1.0.4",
3
+ "version": "1.0.5",
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"