@auis/cli 0.4.0 → 0.4.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/README.md CHANGED
@@ -8,7 +8,7 @@ npx @auis/cli@latest my-product
8
8
  ```
9
9
 
10
10
  ```
11
- auis 0.2.2
11
+ auis 0.4.2
12
12
  code-native design builder
13
13
 
14
14
  ✓ Template main · tarball
@@ -37,7 +37,7 @@ codebase, and AI agents build against them under enforced rules:
37
37
  - **Edit Mode** — non-destructive visual edits that agents materialize into code.
38
38
  - **UX Flows as code** (`/auis/ux-flow`) — navigable flow diagrams that are React pages.
39
39
  - **State Mode** (`/auis/states`) — every registered screen in every state, side by side.
40
- - **31 agent skills** — execution contracts for Claude Code, Codex and Cursor.
40
+ - **32 agent skills** — execution contracts for Claude Code, Codex and Cursor.
41
41
 
42
42
  ## Existing repository?
43
43
 
@@ -125,7 +125,7 @@ planned; it does not exist yet.
125
125
  ```
126
126
  npx @auis/cli@latest [directory] [options] scaffold a new project
127
127
  npx @auis/cli@latest doctor [directory] read an existing repo, write nothing
128
- npx @auis/cli@latest init [directory] install Review into an existing Next.js app
128
+ npx @auis/cli@latest init [directory] pick what to install into an existing Next.js app
129
129
  npx @auis/cli@latest uninstall [directory] take it back out, exactly
130
130
 
131
131
  --json doctor only: the full report as JSON
@@ -153,7 +153,8 @@ npx @auis/cli@latest . # current directory
153
153
  npx @auis/cli@latest my-product --pm pnpm --no-git
154
154
  npx @auis/cli@latest my-product --ref v1.0.0
155
155
  npx @auis/cli@latest doctor # what Auis can do in the current repo, writes nothing
156
- npx @auis/cli@latest init # install Review into the current Next.js app
156
+ npx @auis/cli@latest init # pick what to install into the current Next.js app
157
+ npx @auis/cli@latest init --only review --yes # same, no menu (CI, scripts)
157
158
  npx @auis/cli@latest uninstall # and take it back out
158
159
  ```
159
160
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@auis/cli",
3
- "version": "0.4.0",
3
+ "version": "0.4.2",
4
4
  "description": "Scaffold Auis — the code-native design builder for Next.js + Tailwind + shadcn/ui, with agent skills built in.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/detect.mjs CHANGED
@@ -19,6 +19,14 @@ const SKIP_DIRS = new Set([
19
19
  "dist", "build", "out", "coverage", "vendor", "__pycache__",
20
20
  ]);
21
21
 
22
+ /**
23
+ * Paths below the root that hold copies of the repository rather than its
24
+ * source. Claude Code keeps each worktree as a full checkout under
25
+ * `.claude/worktrees/`: reading them would count every file twice, eat the scan
26
+ * cap, and report what a stale copy does as what the app does.
27
+ */
28
+ const SKIP_PATHS = new Set([".claude/worktrees"]);
29
+
22
30
  const SOURCE_EXT = new Set([".ts", ".tsx", ".js", ".jsx", ".mjs", ".cjs", ".vue", ".svelte", ".astro"]);
23
31
 
24
32
  function read(root, rel) {
@@ -58,7 +66,8 @@ export function sourceFiles(root, limit = 4000) {
58
66
  if (entry.name.startsWith(".") && entry.name !== ".claude") continue;
59
67
  const p = path.join(dir, entry.name);
60
68
  if (entry.isDirectory()) {
61
- if (!SKIP_DIRS.has(entry.name)) walk(p);
69
+ const rel = path.relative(root, p).split(path.sep).join("/");
70
+ if (!SKIP_DIRS.has(entry.name) && !SKIP_PATHS.has(rel)) walk(p);
62
71
  } else if (SOURCE_EXT.has(path.extname(entry.name))) {
63
72
  out.push(p);
64
73
  }
package/src/install.mjs CHANGED
@@ -209,14 +209,31 @@ export function removeGitignoreBlock(source) {
209
209
  * with a reason when it cannot install there; otherwise the steps, each with
210
210
  * enough detail for doctor to print and for init to carry out.
211
211
  */
212
+ const FRAMEWORK_LABEL = {
213
+ nuxt: "Nuxt", remix: "Remix", astro: "Astro", sveltekit: "SvelteKit",
214
+ angular: "Angular", vite: "Vite", cra: "Create React App",
215
+ };
216
+
217
+ /** Why this folder is not a place init can install into, said plainly. */
218
+ function whatIsHere(d, root) {
219
+ if (d.framework.name === "unknown") {
220
+ return fs.existsSync(abs(root, "package.json"))
221
+ ? "the package.json here declares no framework. Run it from your app's root"
222
+ : "there is no package.json here. Run it from your app's root";
223
+ }
224
+ if (d.framework.name === "next") {
225
+ return d.router.name === "pages-router"
226
+ ? "this Next.js app is on the Pages Router"
227
+ : "this Next.js app has no app/layout";
228
+ }
229
+ return `this is ${FRAMEWORK_LABEL[d.framework.name] ?? d.framework.name}`;
230
+ }
231
+
212
232
  export function planInstall(d, root, { packageManager } = {}) {
213
233
  if (d.framework.name !== "next" || d.router.name !== "app-router") {
214
- const found = d.framework.name === "unknown"
215
- ? "no JavaScript framework"
216
- : `${d.framework.name}${d.router.name === "pages-router" ? " on the Pages Router" : ""}`;
217
234
  return {
218
235
  ok: false,
219
- reason: `auis init installs into a Next.js App Router app today; this is ${found}.`,
236
+ reason: `auis init installs into a Next.js App Router app today, and ${whatIsHere(d, root)}.`,
220
237
  steps: [],
221
238
  };
222
239
  }
@@ -517,7 +534,27 @@ function restore(root, artifact, surgical) {
517
534
  return "edited";
518
535
  }
519
536
 
520
- export async function uninstall({ directory = ".", install = true, purge = false, force = false } = {}) {
537
+ /**
538
+ * True when the host's lockfile still names the kit. It happens when init could
539
+ * not install (the install failed, or --no-install) and the person ran it
540
+ * afterwards, as init told them to: the lockfile changed after init, so the
541
+ * manifest holds nothing to restore it from.
542
+ */
543
+ function lockfileNamesKit(root, packageManager) {
544
+ for (const file of LOCKFILES[packageManager ?? "npm"] ?? []) {
545
+ const bytes = readMaybe(abs(root, file));
546
+ if (bytes && bytes.includes(KIT_PACKAGE)) return true;
547
+ }
548
+ return false;
549
+ }
550
+
551
+ export async function uninstall({
552
+ directory = ".",
553
+ install = true,
554
+ purge = false,
555
+ force = false,
556
+ run = exec,
557
+ } = {}) {
521
558
  const root = path.resolve(directory);
522
559
  const manifest = readManifest(root);
523
560
  if (!manifest) {
@@ -599,9 +636,13 @@ export async function uninstall({ directory = ".", install = true, purge = false
599
636
  }
600
637
  }
601
638
 
639
+ // The dependency is gone from package.json by now, so an install drops the
640
+ // kit's entries from a lockfile init never got to record.
641
+ if (!needsInstall && lockfileNamesKit(root, manifest.packageManager)) needsInstall = true;
642
+
602
643
  if (needsInstall && install) {
603
644
  const pm = manifest.packageManager ?? "npm";
604
- const { ok } = await exec(pm, ["install"], { cwd: root, inherit: true });
645
+ const { ok } = await run(pm, ["install"], { cwd: root, inherit: true });
605
646
  if (ok) step("lockfile", color.dim(`${pm} install`));
606
647
  else warn(`${pm} install failed — run it yourself to drop ${manifest.kit?.package ?? KIT_PACKAGE} from the lockfile.`);
607
648
  }
package/src/modules.mjs CHANGED
@@ -82,7 +82,9 @@ export function resolveOnly(value, choices) {
82
82
  }
83
83
  for (const id of asked) {
84
84
  const row = choices.find((c) => c.id === id);
85
- if (!row.selectable) return { ok: false, message: `${row.label} cannot be installed here: ${row.note}.` };
85
+ if (!row.selectable) {
86
+ return { ok: false, message: `${row.label} cannot be installed here: ${String(row.note).replace(/\.$/, "")}.` };
87
+ }
86
88
  }
87
89
  return { ok: true, ids: MODULE_IDS.filter((id) => asked.includes(id)) };
88
90
  }