Skip to content

1/n astryx init foolproof: remove TTY gating (init non-interactive)#4147

Merged
josephfarina merged 4 commits into
mainfrom
navi/vibe/install-init-foolproof
Jul 22, 2026
Merged

1/n astryx init foolproof: remove TTY gating (init non-interactive)#4147
josephfarina merged 4 commits into
mainfrom
navi/vibe/install-init-foolproof

Conversation

@josephfarina

@josephfarina josephfarina commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

1/n — astryx init foolproof. A series of small, independently-mergeable fixes, each measurably improving how reliably AI agents set up Astryx. Merge as each proves out.

Problem

People install @astryxdesign/core but agents rarely run astryx init, so the component cheat sheet never lands and agents guess APIs. On a real fresh install (2-turn: install astryx design + NextJS appbuild a to-do app), init-ran is 0–29% across GPT-5.5 / Opus 4.8 / GPT-5.2 / Sonnet 4.

This PR

Bare astryx init errored in the non-TTY shells agents run in (requireInteractive), so it never installed the cheat sheet. Now init installs the AGENTS.md/CLAUDE.md docs non-interactively — no prompts, never hangs or errors on a missing TTY. Deletes the interactive.mjs module; interactive-guard tests updated to assert the new behavior (7/7 pass).

Impact

Measured via a fresh-install vibe test (headless agents, isolated /tmp, real npm install; ground truth = the <!-- ASTRYX:START --> marker). Before/after init-ran numbers attached with the PR.

Follow-up PRs (each its own data point)

  • 2/n — thorough TTY purge: delete dead interactive code, drop @clack/prompts where unused
  • 3/n — close the README docs.mjs off-ramp (route lookups through npx astryx component)
  • 4/n — first-run hook on astryx component
  • 5/n — passive in-package cheat sheet (AGENTS.md in the package + @see in .d.ts)

Test plan

  • CLI unit tests pass (interactive-guard + init.next-steps)
  • before/after init-ran measured (dev signal → rigorous backtest)

@vercel

vercel Bot commented Jul 21, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
astryx Ready Ready Preview, Comment Jul 22, 2026 12:44am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 21, 2026
@josephfarina
josephfarina force-pushed the navi/vibe/install-init-foolproof branch from 15396b2 to 7d4744f Compare July 21, 2026 21:39
@github-actions

github-actions Bot commented Jul 21, 2026

Copy link
Copy Markdown
Contributor

PR Analysis Report

📚 Storybook Preview

View Storybook for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

🧪 Sandbox Preview

View Sandbox for this PR
GitHub Pages may take up to a minute to hydrate after deploy.

No new or modified components detected.

Bundle Size Summary

Package Size (ESM) Size (CJS) Gzipped
@astryxdesign/core N/A 4.7KB 0B

Accessibility Audit

Status: No accessibility violations detected.


Generated by PR Enrichment workflow | Storybook | Sandbox | View full report

github-actions Bot added a commit that referenced this pull request Jul 21, 2026
@josephfarina josephfarina changed the title Foolproof astryx init for AI agents (WIP) 1/n astryx init foolproof: remove TTY gating (init non-interactive) Jul 21, 2026
@josephfarina
josephfarina marked this pull request as ready for review July 21, 2026 23:34
Agents and CI run in non-TTY shells, where bare `astryx init` errored via
requireInteractive() and never installed the agent cheat sheet (measured
init-ran rate 0–29% across GPT/Opus/Sonnet in fresh-install vibe tests).

Remove TTY/interactive gating from the CLI completely:
- `init` installs the AGENTS.md/CLAUDE.md cheat sheet non-interactively
  (no prompts, never hangs or errors on a missing TTY); remove the dead
  interactive wizard, its @Clack prompts, and the isCancel helper
- layout reads stdin only on explicit `-` (kills a non-TTY auto-read hang)
- template/swizzle/build-theme: existing files require an explicit
  --overwrite; remove the now-unreachable @Clack confirm prompts and the
  orphaned detectThemeCollision/listThemes helpers
- ensure-jscodeshift: fail fast with --install-deps instead of prompting
- delete the interactive.mjs (requireInteractive/isTTY) module and the
  isNonInteractive() TTY probe in path-safety
- index help: `init` is "Setup + AI agent docs", not "Interactive setup"

interactive-guard.test asserts the new behavior: init exits 0, writes the
ASTRYX:START cheat sheet, and never hangs headless. A guided `--interactive`
mode can return later as an explicit opt-in.
@josephfarina
josephfarina force-pushed the navi/vibe/install-init-foolproof branch from 7d4744f to bda49c6 Compare July 21, 2026 23:38
github-actions Bot added a commit that referenced this pull request Jul 21, 2026
TTY gating was removed, so `astryx init` is non-interactive and no longer
scaffolds a theme/template via prompts. Update user-facing text that still
implied otherwise:

- init --all tip: "scaffolds a theme + starter template" -> "points you to
  the theme and page-building workflows" (--all runs the theme/template
  features, which now just print guidance)
- getting-started doc: drop "init wizard / pick a starter template" wording;
  describe init as the non-interactive agent-docs installer
- agent-docs JSDoc: "init wizard" -> "init command"

Co-authored-by: Cursor <cursoragent@cursor.com>
The CLI is fully non-interactive (all TTY prompts were already removed), so
clack was only providing non-blocking output — `log.*`, `intro`, `outro`.
Replace that with a tiny in-repo logger and drop the dependency:

- add src/lib/term-log.mjs mirroring the clack API we used (all output to
  stdout, matching prior behavior; --json still uses the existing silent
  no-op log stubs so machine output stays clean)
- repoint upgrade.mjs + codemods (ensure-jscodeshift, runner, run-codemod)
  from '@clack/prompts' to '../lib/term-log.mjs'
- remove @clack/prompts from package.json and both lockfiles (pnpm-lock.yaml
  + the stale packages/cli/package-lock.json); prunes @clack/core and its
  orphaned transitives
- scrub remaining "clack" mentions in comments/CONTRIBUTING

No behavioral change. Full CLI suite green (1987/1987).

Co-authored-by: Cursor <cursoragent@cursor.com>
github-actions Bot added a commit that referenced this pull request Jul 22, 2026
@josephfarina
josephfarina merged commit e486729 into main Jul 22, 2026
20 checks passed
josephfarina added a commit that referenced this pull request Jul 22, 2026
…uatter

Bare `npx astryx` resolves to an unrelated package on the npm registry when the
CLI isn't installed. Route every command the CLI prints through a single
install-aware source of truth (getCliInvocation / formatCliCommand /
getDlxPrefix / isCliOneOff in package-manager.mjs):

- installed / global / dev runs  -> `<pm> astryx <cmd>` (unchanged)
- one-off runs (npx / pnpm dlx / yarn dlx / bunx cache) -> `<dlx> @astryxdesign/cli <cmd>`

Applied to search, component, hook, docs, build, template, swizzle, discover,
theme, init, upgrade, doctor, update-check, the manifest pointer, the postinstall
banner, and the injected AGENTS.md/CLAUDE.md index. Structured `--json` fields
keep the canonical bare `astryx <cmd>` form; only human output is rewritten.
Docs use the scoped package for bootstrap and bare `astryx` for references
(fails cleanly, never a look-alike fetch). Also fixes the stale `npx xds init`
postinstall banner and the core <Theme> runtime warning.

Stacked on #4147.

Co-authored-by: Cursor <cursoragent@cursor.com>
josephfarina added a commit that referenced this pull request Jul 22, 2026
…uatter

Bare `npx astryx` resolves to an unrelated package on the npm registry when the
CLI isn't installed. Route every command the CLI prints through a single
install-aware source of truth (getCliInvocation / formatCliCommand /
getDlxPrefix / isCliOneOff in package-manager.mjs):

- installed / global / dev runs  -> `<pm> astryx <cmd>` (unchanged)
- one-off runs (npx / pnpm dlx / yarn dlx / bunx cache) -> `<dlx> @astryxdesign/cli <cmd>`

Applied to search, component, hook, docs, build, template, swizzle, discover,
theme, init, upgrade, doctor, update-check, the manifest pointer, the postinstall
banner, and the injected AGENTS.md/CLAUDE.md index. Structured `--json` fields
keep the canonical bare `astryx <cmd>` form; only human output is rewritten.
Docs use the scoped package for bootstrap and bare `astryx` for references
(fails cleanly, never a look-alike fetch). Also fixes the stale `npx xds init`
postinstall banner and the core <Theme> runtime warning.

Stacked on #4147.

Co-authored-by: Cursor <cursoragent@cursor.com>
josephfarina added a commit that referenced this pull request Jul 22, 2026
…uatter (#4151)

Bare `npx astryx` resolves to an unrelated package on the npm registry when the
CLI isn't installed. Route every command the CLI prints through a single
install-aware source of truth (getCliInvocation / formatCliCommand /
getDlxPrefix / isCliOneOff in package-manager.mjs):

- installed / global / dev runs  -> `<pm> astryx <cmd>` (unchanged)
- one-off runs (npx / pnpm dlx / yarn dlx / bunx cache) -> `<dlx> @astryxdesign/cli <cmd>`

Applied to search, component, hook, docs, build, template, swizzle, discover,
theme, init, upgrade, doctor, update-check, the manifest pointer, the postinstall
banner, and the injected AGENTS.md/CLAUDE.md index. Structured `--json` fields
keep the canonical bare `astryx <cmd>` form; only human output is rewritten.
Docs use the scoped package for bootstrap and bare `astryx` for references
(fails cleanly, never a look-alike fetch). Also fixes the stale `npx xds init`
postinstall banner and the core <Theme> runtime warning.

Stacked on #4147.

Co-authored-by: Cursor <cursoragent@cursor.com>
@github-actions
github-actions Bot deleted the navi/vibe/install-init-foolproof branch July 22, 2026 06:56
cixzhang added a commit that referenced this pull request Jul 22, 2026
Seven published-behavior PRs merged since v0.1.7 without a changeset, which
would leave their contributors uncredited in the CHANGELOG. Add changesets so
the v0.1.8 bump credits them:

- core docs.mjs redirect to the CLI (#4207)
- Table tree-data plugin: useTableTreeState / useTableTreeData (#3789)
- Table tree expander aria-label localization (#4149)
- foolproof init: postinstall nudges + non-interactive init (#4147, #4153, #4154, #4155)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

CLA Signed This label is managed by the Meta Open Source bot.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant