next-anteater 0.2.0 → 0.2.2

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/lib/scaffold.mjs CHANGED
@@ -295,7 +295,7 @@ export function generateClaudeSettings({ model, permissionsMode }) {
295
295
  /**
296
296
  * Generate the GitHub Actions workflow.
297
297
  */
298
- export function generateWorkflow({ allowedGlobs, blockedGlobs, productionBranch, model }) {
298
+ export function generateWorkflow({ allowedGlobs, blockedGlobs, productionBranch, model, packageManager = "npm" }) {
299
299
  const allowed = allowedGlobs.join(", ");
300
300
  const blocked = blockedGlobs.join(", ");
301
301
 
@@ -352,9 +352,7 @@ jobs:
352
352
  node-version: 22
353
353
 
354
354
  - name: Install dependencies
355
- run: |
356
- npm install -g pnpm@9 --silent
357
- pnpm install --frozen-lockfile
355
+ run: ${packageManager === "pnpm" ? "npm install -g pnpm@9 --silent && pnpm install --frozen-lockfile" : packageManager === "yarn" ? "yarn install --frozen-lockfile" : "npm ci"}
358
356
 
359
357
  - name: Run Anteater agent
360
358
  uses: anthropics/claude-code-action@v1
package/lib/setup.mjs CHANGED
@@ -9,7 +9,7 @@ import { execSync } from "node:child_process";
9
9
  import {
10
10
  bold, dim, green, red, yellow, cyan,
11
11
  ok, fail, warn, info, heading, blank,
12
- ask, confirm, select, spinner,
12
+ ask, confirm, select, spinner, closeRL,
13
13
  } from "./ui.mjs";
14
14
  import { detectProject } from "./detect.mjs";
15
15
  import { scaffoldFiles } from "./scaffold.mjs";
@@ -227,6 +227,7 @@ export async function main() {
227
227
  layoutFile: project.layoutFile,
228
228
  model,
229
229
  permissionsMode,
230
+ packageManager: project.packageManager,
230
231
  })
231
232
  );
232
233
 
@@ -313,6 +314,7 @@ export async function main() {
313
314
  else warn("Test dispatch failed \u2014 check GitHub Actions");
314
315
 
315
316
  // ─── Done! ──────────────────────────────────────────────────
317
+ closeRL();
316
318
  blank();
317
319
  console.log(` ${bold(green("\u{1F41C} Anteater is ready."))}`);
318
320
  blank();
package/lib/ui.mjs CHANGED
@@ -1,5 +1,9 @@
1
1
  /**
2
2
  * Terminal UI helpers — zero dependencies.
3
+ *
4
+ * Uses a single shared readline interface so piped input works correctly.
5
+ * Creating multiple interfaces on the same stdin consumes the buffer on
6
+ * the first close, breaking subsequent reads.
3
7
  */
4
8
  import * as readline from "node:readline";
5
9
 
@@ -20,37 +24,58 @@ export const heading = (msg) => console.log(`\n ${bold(msg)}\n ${"─".repeat(
20
24
  export const blank = () => console.log();
21
25
 
22
26
  /**
23
- * Prompt the user for text input.
27
+ * Shared readline interface created lazily, closed once at process exit.
24
28
  */
25
- export function ask(question, { mask = false } = {}) {
26
- return new Promise((resolve) => {
27
- const rl = readline.createInterface({
29
+ let _rl = null;
30
+
31
+ function getRL() {
32
+ if (!_rl) {
33
+ _rl = readline.createInterface({
28
34
  input: process.stdin,
29
35
  output: process.stdout,
30
36
  });
37
+ // Don't let the readline keep the process alive
38
+ _rl.on("close", () => { _rl = null; });
39
+ }
40
+ return _rl;
41
+ }
42
+
43
+ /** Close the shared readline (call at end of setup). */
44
+ export function closeRL() {
45
+ if (_rl) {
46
+ _rl.close();
47
+ _rl = null;
48
+ }
49
+ }
50
+
51
+ /**
52
+ * Prompt the user for text input.
53
+ */
54
+ export function ask(question, { mask = false } = {}) {
55
+ return new Promise((resolve) => {
56
+ const rl = getRL();
31
57
 
32
- // If masking, mute output and write dots
33
58
  if (mask) {
34
59
  const origWrite = process.stdout.write.bind(process.stdout);
60
+ const restore = () => { process.stdout.write = origWrite; };
61
+
35
62
  process.stdout.write = (chunk, encoding, cb) => {
36
- // Let the question prompt through, mask everything after
37
63
  if (typeof chunk === "string" && chunk.includes(question)) {
38
64
  return origWrite(chunk, encoding, cb);
39
65
  }
40
- // Replace characters with bullets
41
66
  const masked = typeof chunk === "string" ? chunk.replace(/[^\r\n]/g, "•") : chunk;
42
67
  return origWrite(masked, encoding, cb);
43
68
  };
44
69
 
45
- rl.on("close", () => {
46
- process.stdout.write = origWrite;
70
+ rl.question(` ${cyan("?")} ${question} `, (answer) => {
71
+ restore();
72
+ resolve(answer.trim());
73
+ });
74
+ } else {
75
+ rl.question(` ${cyan("?")} ${question} `, (answer) => {
76
+ resolve(answer.trim());
47
77
  });
48
78
  }
49
-
50
- rl.question(` ${cyan("?")} ${question} `, (answer) => {
51
- rl.close();
52
- resolve(answer.trim());
53
- });
54
79
  });
55
80
  }
56
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "next-anteater",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
4
4
  "description": "AI-powered live editing for your Next.js app",
5
5
  "bin": {
6
6
  "anteater": "bin/setup-anteater.mjs",