Skip to content

astryx init foolproof: per-command setup nudge + centralized setup check#4153

Merged
josephfarina merged 1 commit into
mainfrom
navi/vibe/cli-setup-nudge
Jul 22, 2026
Merged

astryx init foolproof: per-command setup nudge + centralized setup check#4153
josephfarina merged 1 commit into
mainfrom
navi/vibe/cli-setup-nudge

Conversation

@josephfarina

@josephfarina josephfarina commented Jul 22, 2026

Copy link
Copy Markdown
Contributor

Part of making astryx init foolproof (agents install the design system but never run init). Enforcement layer 3 of 3:

  1. @astryxdesign/core postinstall nudge — astryx init foolproof: @astryxdesign/core postinstall nudge #4155
  2. @astryxdesign/cli postinstall nudge — astryx init foolproof: @astryxdesign/cli postinstall nudge #4154 (reuses the check below)
  3. per-command nudge — this PR

What

  • One canonical AGENT_DOC_PATHS now feeds discoverAgentDocs, removeAgentDocs, and a new isAstryxInitialized() — so "where init writes", "where remove looks", and "where the check looks" can never drift. Closes a real gap: discovery/removal previously missed the Hermes files (.hermes.md / HERMES.md).
  • isAstryxInitialized(dir) — single source of truth for "is Astryx set up here?" (marker present in any agent-doc file, incl. legacy XDS).
  • preAction nudge — after any command, if the project isn't set up, remind the user/agent to run init. preAction (not postAction) so it fires for every valid command, even ones that error or exit early.

Why it fires in --json

Agents almost always pass --json. The nudge writes to stderr, which never corrupts the stdout JSON envelope — so agents actually see it and JSON parsing stays clean. Quiet once set up, outside a project (no package.json), and for init/agent-docs.

Tests

setup-nudge.test.mjs — 14 cases: marker detection across all 6 agent-doc locations + legacy; nudge matrix incl. --json stdout stays valid JSON.

The nudge message is identical across all 3 layers; it becomes getCliInvocation() once #4151 lands.

@vercel

vercel Bot commented Jul 22, 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 3:44am

Request Review

@meta-cla meta-cla Bot added the CLA Signed This label is managed by the Meta Open Source bot. label Jul 22, 2026
github-actions Bot added a commit that referenced this pull request Jul 22, 2026
@github-actions

github-actions Bot commented Jul 22, 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

Enforcement layer 3 of making `astryx init` foolproof: if a project hasn't
run init yet (no Astryx marker in any agent-doc file), remind the user/agent
after any command to run `astryx init`.

- Centralize agent-doc discovery: one AGENT_DOC_PATHS list now feeds
  discoverAgentDocs, removeAgentDocs, and the new isAstryxInitialized(). It now
  includes the Hermes files (.hermes.md / HERMES.md) that discovery previously
  missed — so "where init writes", "where remove looks", and "where the check
  looks" can never drift again.
- Add isAstryxInitialized(): single source of truth for "is Astryx set up
  here?" (Astryx marker present in any agent-doc file, incl. legacy XDS).
- preAction nudge (index.mjs): fires for every valid command — even in --json.
  Agents pass --json, so the nudge goes to stderr and never corrupts the stdout
  JSON envelope. Quiet once set up, outside a project, and for init itself.
- Guardrail test: all agent-doc locations + the nudge matrix incl --json.
@josephfarina
josephfarina force-pushed the navi/vibe/cli-setup-nudge branch from a913a63 to 2af3f76 Compare July 22, 2026 03:41
@josephfarina
josephfarina marked this pull request as ready for review July 22, 2026 03:42
github-actions Bot added a commit that referenced this pull request Jul 22, 2026
@josephfarina
josephfarina merged commit 9764a3d into main Jul 22, 2026
22 checks passed
@github-actions
github-actions Bot deleted the navi/vibe/cli-setup-nudge 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