@darkrei08/setup-ai 3.0.2 → 3.0.4

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/README.md CHANGED
@@ -10,24 +10,24 @@ skill — each via its **official, current** method for your OS.
10
10
 
11
11
  ## Quick start
12
12
 
13
- One command. No install, no clone. It opens a menu to choose what to set up:
13
+ One command opens a menu to choose what to set up:
14
14
 
15
15
  ```bash
16
- npx github:darkrei08/setup-ai
16
+ npx @darkrei08/setup-ai
17
17
  ```
18
18
 
19
- Prefer non-interactive? Same command, add a flag:
19
+ Non-interactive:
20
20
 
21
21
  ```bash
22
- npx github:darkrei08/setup-ai --only pi,codex,opencode # just these
23
- npx github:darkrei08/setup-ai --all # everything
22
+ npx @darkrei08/setup-ai --only pi,codex,opencode # just these
23
+ npx @darkrei08/setup-ai --all # everything
24
24
  ```
25
25
 
26
26
  That's the whole thing. Three details worth knowing:
27
27
 
28
+ - **Use the npm package above.** `npx github:darkrei08/setup-ai` also works, but many npm setups block git fetches (`EALLOWGIT`); the published package avoids that. Run it from any folder except the repo's own source dir.
28
29
  - **Windows PowerShell**: one command per line (no bash `\`). If node or git was just installed, open a **new terminal** so PATH refreshes.
29
- - **What it does**: detects your OS and runs `setup-ai.sh` (macOS/Linux) or `setup-ai.ps1` (Windows). Menu keys: ↑/↓ move · Space toggle · `a` all · Enter.
30
- - **Shorter name**: once it's on npm, drop `github:` → `npx @darkrei08/setup-ai` (run it from any folder except the repo's own source dir).
30
+ - **What it does**: detects your OS and runs `setup-ai.sh` (macOS/Linux) or `setup-ai.ps1` (Windows). `--list` shows modules; menu keys: ↑/↓ move · Space toggle · `a` all · Enter.
31
31
 
32
32
  ### npm vs npx
33
33
 
package/bin/setup-ai.mjs CHANGED
@@ -106,7 +106,7 @@ function toScriptArgs(mode, csv) {
106
106
 
107
107
  // ---- interactive multi-select (gentle-ai style) ---------------------------
108
108
  function interactiveMenu() {
109
- return new Promise((resolve) => {
109
+ return new Promise((resolve, reject) => {
110
110
  const items = menuModules.map((m) => ({ ...m, checked: m.core }));
111
111
  let cursor = 0;
112
112
  const out = process.stdout;
@@ -125,17 +125,29 @@ function interactiveMenu() {
125
125
  };
126
126
 
127
127
  const stdin = process.stdin;
128
- stdin.setRawMode(true);
128
+ if (typeof stdin.setRawMode !== "function") {
129
+ return reject(new Error("stdin is not a raw-capable TTY"));
130
+ }
131
+ try {
132
+ stdin.setRawMode(true);
133
+ } catch (err) {
134
+ return reject(err);
135
+ }
129
136
  stdin.resume();
130
137
  stdin.setEncoding("utf8");
131
138
  render(true);
132
139
 
133
140
  const cleanup = () => {
134
- stdin.setRawMode(false);
141
+ try { stdin.setRawMode(false); } catch { /* ignore */ }
135
142
  stdin.pause();
136
143
  stdin.removeListener("data", onData);
144
+ stdin.removeListener("end", onEnd);
137
145
  };
138
146
 
147
+ // If stdin closes before a choice (e.g. npx consumed it), fall back instead
148
+ // of hanging or exiting silently.
149
+ const onEnd = () => { cleanup(); reject(new Error("stdin closed before a choice was made")); };
150
+
139
151
  const onData = (key) => {
140
152
  if (key === "\x03" || key === "q") { // ctrl-c / q
141
153
  cleanup();
@@ -156,6 +168,7 @@ function interactiveMenu() {
156
168
  }
157
169
  };
158
170
  stdin.on("data", onData);
171
+ stdin.on("end", onEnd);
159
172
  });
160
173
  }
161
174
 
@@ -165,6 +178,11 @@ function defaultSelection() {
165
178
  }
166
179
 
167
180
  async function main() {
181
+ // Always emit a first line so the user sees the launcher started, even if
182
+ // something downstream fails (this is what "npx returns to prompt silently"
183
+ // needed).
184
+ console.log(`setup-ai launcher · ${process.platform}`);
185
+
168
186
  if (has("--help") || has("-h")) return runScript(toScriptArgs("help"));
169
187
  if (has("--list")) return runScript(toScriptArgs("list"));
170
188
  if (has("--all")) return runScript(toScriptArgs("all"));
@@ -174,18 +192,36 @@ async function main() {
174
192
 
175
193
  if (has("--yes") || has("-y")) return runScript(toScriptArgs("yes"));
176
194
 
177
- // No selection flag: interactive menu if we have a TTY, else core defaults.
195
+ // No selection flag: try the interactive menu; fall back cleanly if the
196
+ // terminal/stdin can't drive it (common under some npx/CI shells).
197
+ let chosen = null;
178
198
  if (process.stdin.isTTY && process.stdout.isTTY) {
179
- const chosen = await interactiveMenu();
180
- if (!chosen.length) {
181
- console.log("Nothing selected exiting.");
182
- process.exit(0);
199
+ try {
200
+ chosen = await interactiveMenu();
201
+ } catch (err) {
202
+ console.log(`\n(interactive menu unavailable: ${err.message})`);
203
+ chosen = null;
183
204
  }
184
- return runScript(toScriptArgs("only", chosen.join(",")));
205
+ } else {
206
+ console.log("No interactive terminal detected.");
207
+ }
208
+
209
+ if (!chosen) {
210
+ console.log("Installing the CORE set. Customize with:");
211
+ console.log(" npx github:darkrei08/setup-ai --only pi,codex,opencode");
212
+ console.log(" npx github:darkrei08/setup-ai --all (everything)");
213
+ console.log(" npx github:darkrei08/setup-ai --list (see modules)\n");
214
+ chosen = defaultSelection();
185
215
  }
186
216
 
187
- console.log("No TTY detected — installing the core module set. Use --only/--all to customize.");
188
- return runScript(toScriptArgs("only", defaultSelection().join(",")));
217
+ if (!chosen.length) {
218
+ console.log("Nothing selected — exiting.");
219
+ process.exit(0);
220
+ }
221
+ return runScript(toScriptArgs("only", chosen.join(",")));
189
222
  }
190
223
 
191
- main();
224
+ main().catch((err) => {
225
+ console.error(`setup-ai launcher error: ${err?.message || err}`);
226
+ process.exit(1);
227
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@darkrei08/setup-ai",
3
- "version": "3.0.2",
3
+ "version": "3.0.4",
4
4
  "description": "Cross-OS installer for an AI coding toolchain (pi, codex, antigravity, opencode, herdr, gentle-ai, engram, Engineering Excellence) with an interactive module menu.",
5
5
  "type": "module",
6
6
  "bin": {
package/setup-ai.ps1 CHANGED
@@ -2,7 +2,7 @@
2
2
  <#
3
3
  ==============================================================================
4
4
  AI Dev Suite — Engineering Excellence Edition (Windows)
5
- Version: 3.0.0
5
+ Version: 3.0.4
6
6
 
7
7
  Windows-native installer, sibling of setup-ai.sh. Uses each tool's official
8
8
  Windows method: winget for language runtimes, the vendor install.ps1 scripts
@@ -33,7 +33,15 @@ param(
33
33
  $ErrorActionPreference = 'Stop'
34
34
  Set-StrictMode -Version Latest
35
35
 
36
- $ScriptVersion = "3.0.2"
36
+ # Render child-process UTF-8 output (npx skills box-drawing, banners) correctly
37
+ # instead of mojibake on the default Windows console codepage.
38
+ try {
39
+ [Console]::OutputEncoding = [System.Text.Encoding]::UTF8
40
+ $OutputEncoding = [System.Text.Encoding]::UTF8
41
+ if (Get-Command chcp -ErrorAction SilentlyContinue) { chcp 65001 | Out-Null }
42
+ } catch { }
43
+
44
+ $ScriptVersion = "3.0.4"
37
45
  $ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
38
46
  $LogDir = Join-Path $ScriptDir "logs"
39
47
  New-Item -ItemType Directory -Force -Path $LogDir | Out-Null
package/setup-ai.sh CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  # ==============================================================================
4
4
  # AI Dev Suite — Engineering Excellence Edition
5
- # Version: 3.0.0
5
+ # Version: 3.0.4
6
6
  #
7
7
  # Cross-platform (macOS + all major Linux distros) installer for an AI coding
8
8
  # toolchain. Windows is handled by the sibling setup-ai.ps1; the Node launcher
@@ -26,7 +26,7 @@
26
26
  set -Eeuo pipefail
27
27
  IFS=$'\n\t'
28
28
 
29
- SCRIPT_VERSION="3.0.2"
29
+ SCRIPT_VERSION="3.0.4"
30
30
 
31
31
  SCRIPT_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)"
32
32
  LOG_DIR="${SCRIPT_DIR}/logs"