An open source design system that's fully customizable and agent ready
TypeScript
fix(cli): print init progress as plain ASCII (#6540)
Joeyd12f448cc1c2
diff --git a/.changeset/cli-spec-ascii-init-output.md b/.changeset/cli-spec-ascii-init-output.mdnew file mode 100644index 0000000000..fb7d6a5a7c--- /dev/null+++ b/.changeset/cli-spec-ascii-init-output.md@@ -0,0 +1,7 @@+---+'@astryxdesign/cli': patch+---++[fix] `astryx init` human output is now plain ASCII, including the per-file lines `init --remove-agents` prints. Status lines use `[ok]` instead of a check glyph, and dashes, bullets and arrows print as `-` and `->`. `--json` output is unchanged.++@josephfarinadiff --git a/packages/cli/api/init/init.test.mjs b/packages/cli/api/init/init.test.mjsindex 5534fcfc16..38426d5716 100644--- a/packages/cli/api/init/init.test.mjs+++ b/packages/cli/api/init/init.test.mjs@@ -230,13 +230,40 @@ describe('init() — logger', () => {errSpy.mockRestore();}const text = lines.join('\n');- expect(text).toContain('✓ AI agent docs installed → AGENTS.md');+ expect(text).toContain('[ok] AI agent docs installed -> AGENTS.md');expect(text).toContain(' Next steps:');// The exact next-steps block the CLI prints comes from getNextSteps().expect(text).toContain(getNextSteps('npx astryx')[2].slice(0, 20));});});+describe('init() — ASCII output', () => {+ it('prints only ASCII on the default, all-features, re-run, template, and remove paths', async () => {+ /** @type {string[]} */+ const lines = [];+ const logSpy = vi.spyOn(console, 'log').mockImplementation((...a) => lines.push(a.join(' ')));+ const errSpy = vi.spyOn(console, 'error').mockImplementation((...a) => lines.push(a.join(' ')));+ const empty = fs.mkdtempSync(path.join(process.cwd(), '.astryx-init-remove-'));+ logger.setSilent(false);+ try {+ await init({}, {cwd: tmpDir});+ await init({all: true}, {cwd: tmpDir});+ await init({all: true}, {cwd: tmpDir});+ await init({features: 'template', templateName: 'blank'}, {cwd: tmpDir});+ await init({removeAgents: true}, {cwd: tmpDir});+ await init({removeAgents: true}, {cwd: empty});+ } finally {+ logger.setSilent(true);+ logSpy.mockRestore();+ errSpy.mockRestore();+ fs.rmSync(empty, {recursive: true, force: true});+ }+ expect(lines.length).toBeGreaterThan(0);+ expect(lines.some(line => line.startsWith('[ok] Removed'))).toBe(true);+ expect(lines.filter(line => /[\u0080-\uFFFF]/.test(line))).toEqual([]);+ });+});+describe('init() — write-path safety', () => {it('template scaffold refuses to clobber an existing page.tsx', async () => {const dest = path.join(tmpDir, 'src', 'pages', 'blank');diff --git a/packages/cli/api/init/remove/remove.mjs b/packages/cli/api/init/remove/remove.mjsindex 586db9aedf..89c84e3d29 100644--- a/packages/cli/api/init/remove/remove.mjs+++ b/packages/cli/api/init/remove/remove.mjs@@ -24,6 +24,6 @@ import {logger} from '../../logger.mjs';*/export async function remove({cwd = process.cwd()} = {}) {removeAgentDocs(cwd);- logger.log('✓ AI agent docs removed.');+ logger.log('[ok] AI agent docs removed.');return {type: 'init.remove', data: {removed: true}};}diff --git a/packages/cli/api/init/run/run.mjs b/packages/cli/api/init/run/run.mjsindex b0b6189db8..f9005793f3 100644--- a/packages/cli/api/init/run/run.mjs+++ b/packages/cli/api/init/run/run.mjs@@ -98,7 +98,7 @@ async function applyAgents(cwd, options, invocation, data) {renderedBlock,});data.docsWritten = written;- logger.log(`✓ AI agent docs installed → ${written.join(', ')}`);+ logger.log(`[ok] AI agent docs installed -> ${written.join(', ')}`);} catch (err) {// PathSafetyError carries a precise, user-actionable message — surface it// (and flag exit 1) instead of the generic "could not install" warning so@@ -132,8 +132,8 @@ function applyTheme(cwd, invocation, data) {data.themeTemplatePath = didWrite ? written : null;logger.log(didWrite- ? `✓ Theme template written → ${written}`- : `• ${written} already exists — left as is.`,+ ? `[ok] Theme template written -> ${written}`+ : `- ${written} already exists - left as is.`,);} catch {// Soft failure, like agent docs: the guidance below is still useful.@@ -166,16 +166,16 @@ function applyTemplate(cwd, {templateName}, invocation, data) {// Point agents at the build workflow rather than dumping page-template// names — `build` surfaces pages AND blocks AND components for an idea,// and `build` with no args is the full how-to-build playbook.- logger.log('✓ To build UI, use these commands:');+ logger.log('[ok] To build UI, use these commands:');logger.log('');logger.log(- ` ${invocation} build "<what you're building>" build a page — kit: closest template + blocks + components`,+ ` ${invocation} build "<what you're building>" build a page - kit: closest template + blocks + components`,);logger.log(` ${invocation} build the how-to-build workflow (read this first)`,);logger.log(- ` ${invocation} search <query> find anything — components, docs, templates, blocks`,+ ` ${invocation} search <query> find anything - components, docs, templates, blocks`,);logger.log('');data.template = 'workflow';@@ -206,7 +206,7 @@ function applyTemplate(cwd, {templateName}, invocation, data) {fs.mkdirSync(outputDir, {recursive: true});fs.copyFileSync(srcPath, destFile);const rel = path.relative(cwd, outputDir);- logger.log(`✓ Template created at ${rel}/page.tsx`);+ logger.log(`[ok] Template created at ${rel}/page.tsx`);data.template = 'created';data.templatePath = rel;}diff --git a/packages/cli/foundation/agent-docs/agent-docs.mjs b/packages/cli/foundation/agent-docs/agent-docs.mjsindex dbdc04735e..f972e542ec 100644--- a/packages/cli/foundation/agent-docs/agent-docs.mjs+++ b/packages/cli/foundation/agent-docs/agent-docs.mjs@@ -718,9 +718,9 @@ export function removeAgentDocs(targetDir) {const deleteIfEmpty = p === AGENTS_MD || p === CLAUDE_DIR_MD;if (removeXdsBlock(filePath, {deleteIfEmpty})) {if (!fs.existsSync(filePath)) {- humanLog(`✓ Removed empty ${p}`);+ humanLog(`[ok] Removed empty ${p}`);} else {- humanLog(`✓ Removed design system section from ${p}`);+ humanLog(`[ok] Removed design system section from ${p}`);}}}