@astryxdesign/cli 0.6.3-canary.29be688 → 0.6.3-canary.2bb99ed

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.
Files changed (62) hide show
  1. package/README.md +2 -0
  2. package/api/docs/detail/section/section.mjs +9 -15
  3. package/api/docs/detail/section/section.test.mjs +15 -6
  4. package/api/doctor/doctor.mjs +1 -1
  5. package/api/doctor/doctor.test.mjs +6 -6
  6. package/api/upgrade/_adapter.d.mts +22 -4
  7. package/api/upgrade/_adapter.mjs +19 -6
  8. package/api/upgrade/run/run.mjs +355 -59
  9. package/api/upgrade/upgrade.doc.mjs +5 -1
  10. package/api/upgrade/upgrade.type.d.mts +34 -0
  11. package/api/upgrade/upgrade.type.mjs +15 -0
  12. package/assets/codemods/__tests__/runner.test.mjs +330 -8
  13. package/assets/codemods/integration-runner.mjs +56 -4
  14. package/assets/codemods/integration-runner.protection.test.mjs +153 -0
  15. package/assets/codemods/run-codemod.mjs +177 -34
  16. package/assets/codemods/runner.mjs +248 -110
  17. package/assets/codemods/transforms/next/__tests__/migrate-native-picker-to-presentation.test.mjs +63 -0
  18. package/assets/codemods/transforms/next/__tests__/migrate-theme-catalog-to-descriptors.test.mjs +4 -0
  19. package/assets/codemods/transforms/next/index.mjs +8 -0
  20. package/assets/codemods/transforms/next/migrate-native-picker-to-presentation.mjs +148 -0
  21. package/assets/docs/cli-integrations.doc.mjs +13 -0
  22. package/assets/templates/blocks/components/DateInput/DateInputDateRange.tsx +1 -1
  23. package/assets/templates/blocks/components/Item/ItemDocumentTabs.doc.mjs +14 -0
  24. package/assets/templates/blocks/components/Item/ItemDocumentTabs.tsx +100 -0
  25. package/assets/templates/blocks/components/TimeInput/TimeInputConstrained.tsx +1 -0
  26. package/authoring/codemod/type.ts +12 -0
  27. package/authoring/doctypes/_schema.d.mts +71 -141
  28. package/authoring/doctypes/_schema.mjs +29 -2
  29. package/authoring/doctypes/load-contract.test.mjs +1 -1
  30. package/authoring/doctypes/namespace/namespace.doc.mjs +2 -2
  31. package/authoring/doctypes/namespace/parse.test.mjs +23 -25
  32. package/authoring/doctypes/namespace/type.ts +5 -2
  33. package/authoring/doctypes/parse.mjs +3 -2
  34. package/authoring/doctypes/reference/reference.doc.mjs +5 -3
  35. package/authoring/doctypes/reference/type.ts +7 -8
  36. package/authoring/index.d.ts +1 -0
  37. package/clients/cli/commands/build-theme.mjs +10 -44
  38. package/clients/cli/commands/docs.mjs +15 -58
  39. package/clients/cli/commands/docs.test.mjs +11 -14
  40. package/clients/cli/commands/text-json-parity.test.mjs +718 -0
  41. package/clients/cli/commands/theme-targets.behavior.test.mjs +4 -3
  42. package/clients/cli/commands/upgrade.doc.mjs +2 -1
  43. package/clients/cli/commands/upgrade.file-protection.test.mjs +228 -0
  44. package/clients/cli/commands/upgrade.mjs +29 -7
  45. package/clients/cli/formatters/index.mjs +2 -0
  46. package/clients/cli/formatters/index.test.mjs +6 -0
  47. package/foundation/discovery/authoring-self-docs.test.mjs +3 -2
  48. package/foundation/discovery/docs-discovery.mjs +6 -5
  49. package/foundation/discovery/docs-discovery.test.mjs +7 -10
  50. package/foundation/discovery/docs-section-key.d.mts +19 -8
  51. package/foundation/discovery/docs-section-key.mjs +119 -32
  52. package/foundation/discovery/docs-section-key.test.mjs +41 -19
  53. package/foundation/doc-compiler/compile.mjs +5 -4
  54. package/foundation/fs/file-protection.d.mts +33 -0
  55. package/foundation/fs/file-protection.mjs +825 -0
  56. package/foundation/fs/file-protection.test.mjs +250 -0
  57. package/foundation/response/error-codes.d.mts +3 -1
  58. package/foundation/response/error-codes.d.ts +2 -0
  59. package/foundation/response/error-codes.doc.mjs +10 -0
  60. package/foundation/response/error-codes.mjs +6 -0
  61. package/foundation/response/error-codes.test.mjs +55 -11
  62. package/package.json +10 -9
@@ -0,0 +1,250 @@
1
+ // Copyright (c) Meta Platforms, Inc. and affiliates.
2
+
3
+ import {afterEach, beforeEach, describe, expect, it} from 'vitest';
4
+ import * as fs from 'node:fs';
5
+ import * as os from 'node:os';
6
+ import * as path from 'node:path';
7
+ import {
8
+ createFileProtectionResolver,
9
+ ProtectionSourceError,
10
+ } from './file-protection.mjs';
11
+
12
+ let root;
13
+
14
+ beforeEach(() => {
15
+ root = fs.mkdtempSync(path.join(os.tmpdir(), 'astryx-protection-'));
16
+ });
17
+
18
+ afterEach(() => {
19
+ fs.rmSync(root, {recursive: true, force: true});
20
+ });
21
+
22
+ function write(relative, contents = '') {
23
+ const file = path.join(root, relative);
24
+ fs.mkdirSync(path.dirname(file), {recursive: true});
25
+ fs.writeFileSync(file, contents);
26
+ return file;
27
+ }
28
+
29
+ function declarations(relative) {
30
+ return createFileProtectionResolver(root)
31
+ .classify(path.join(root, relative))
32
+ .map(item => item.declaration);
33
+ }
34
+
35
+ describe('working-tree .gitattributes', () => {
36
+ it('honors nested later rules and explicit false or unset values', () => {
37
+ write(
38
+ '.gitattributes',
39
+ [
40
+ '*.css linguist-generated=true',
41
+ 'vendor/** linguist-vendored',
42
+ 'authored.css -linguist-generated',
43
+ 'unset.css !linguist-generated',
44
+ '',
45
+ ].join('\n'),
46
+ );
47
+ write('generated.css', 'body {}');
48
+ write('authored.css', 'body {}');
49
+ write('unset.css', 'body {}');
50
+ write('nested/keep.css', 'body {}');
51
+ write('nested/.gitattributes', 'keep.css linguist-generated=false\n');
52
+ write('vendor/pkg/index.js', 'export {};');
53
+
54
+ expect(declarations('generated.css')).toContain(
55
+ 'linguist-generated in .gitattributes:1',
56
+ );
57
+ expect(declarations('authored.css')).toEqual([]);
58
+ expect(declarations('unset.css')).toEqual([]);
59
+ expect(declarations('nested/keep.css')).toEqual([]);
60
+ expect(declarations('vendor/pkg/index.js')).toContain(
61
+ 'linguist-vendored in .gitattributes:2',
62
+ );
63
+ });
64
+
65
+ it('expands top-level attribute macros, including forward definitions', () => {
66
+ write(
67
+ '.gitattributes',
68
+ 'via-macro/** outer\n[attr]outer generated\n[attr]generated linguist-generated\n',
69
+ );
70
+ write('via-macro/output.js', 'export {};');
71
+ expect(declarations('via-macro/output.js')).toContain(
72
+ 'linguist-generated in .gitattributes:1',
73
+ );
74
+ });
75
+
76
+ it('preserves escaped wildcards as literal path characters', () => {
77
+ write('.gitattributes', 'literal\\*.js linguist-generated\n');
78
+ write('literal*.js', 'export {};');
79
+ write('literalX.js', 'export {};');
80
+ expect(declarations('literal*.js')).toHaveLength(1);
81
+ expect(declarations('literalX.js')).toEqual([]);
82
+ });
83
+
84
+ it('supports quoted attribute patterns with spaces', () => {
85
+ write('.gitattributes', '"generated output/*.js" linguist-generated\n');
86
+ write('generated output/theme.js', 'export {};');
87
+ expect(declarations('generated output/theme.js')).toHaveLength(1);
88
+ });
89
+
90
+ it('matches basename patterns below the declaring directory', () => {
91
+ write('.gitattributes', '*.gen.ts linguist-generated\n');
92
+ write('src/deep/theme.gen.ts', 'export {};');
93
+ expect(declarations('src/deep/theme.gen.ts')).toHaveLength(1);
94
+ });
95
+ });
96
+
97
+ describe('working-tree ignore rules', () => {
98
+ it('honors gitignore negation and nested precedence', () => {
99
+ write('.gitignore', ['src/**/*.js', '!src/keep.js', ''].join('\n'));
100
+ write('src/drop.js', 'drop');
101
+ write('src/keep.js', 'keep');
102
+ write('src/deep/drop.js', 'drop');
103
+ write('src/.gitignore', '!deep/keep.js\n');
104
+ write('src/deep/keep.js', 'keep');
105
+
106
+ expect(declarations('src/drop.js')[0]).toBe('excluded by .gitignore');
107
+ expect(declarations('src/deep/drop.js')[0]).toBe('excluded by .gitignore');
108
+ expect(declarations('src/keep.js')).toEqual([]);
109
+ expect(declarations('src/deep/keep.js')).toEqual([]);
110
+ });
111
+
112
+ it('uses case-sensitive Git matching on case-sensitive platforms', () => {
113
+ write('.gitignore', 'FOO\n');
114
+ write('FOO', 'x');
115
+ write('foo', 'x');
116
+
117
+ expect(declarations('FOO')[0]).toBe('excluded by .gitignore');
118
+ expect(declarations('foo')).toEqual([]);
119
+ });
120
+
121
+ it('does not let a nested ignore file re-include beneath an excluded parent', () => {
122
+ write('.gitignore', 'ignored/\n');
123
+ write('ignored/.gitignore', '!keep.js\n');
124
+ write('ignored/keep.js', 'keep');
125
+
126
+ expect(declarations('ignored/keep.js')[0]).toBe('excluded by .gitignore');
127
+ });
128
+
129
+ it('ignores nested .hgignore files unless the root file includes them', () => {
130
+ write('sub/.hgignore', 'syntax: glob\n*.tmp\n');
131
+ write('sub/file.tmp', 'x');
132
+ expect(declarations('sub/file.tmp')).toEqual([]);
133
+ });
134
+
135
+ it('reads Mercurial glob and regexp syntax without a repository process', () => {
136
+ write(
137
+ '.hgignore',
138
+ ['syntax: glob', '**/*.generated.css', 're:^legacy/.+\\.js$', ''].join(
139
+ '\n',
140
+ ),
141
+ );
142
+ write('src/theme.generated.css', 'x');
143
+ write('legacy/file.js', 'x');
144
+ write('src/file.js', 'x');
145
+
146
+ expect(declarations('src/theme.generated.css')[0]).toMatch(/\.hgignore:2/);
147
+ expect(declarations('legacy/file.js')[0]).toMatch(/\.hgignore:3/);
148
+ expect(declarations('src/file.js')).toEqual([]);
149
+ });
150
+ });
151
+
152
+ describe('leading generated comments', () => {
153
+ it.each([
154
+ ['// @generated\nexport const x = 1;\n', '@generated'],
155
+ [
156
+ '/* @partially-generated */\nexport const x = 1;\n',
157
+ '@partially-generated',
158
+ ],
159
+ [
160
+ '// Code generated by Acme. DO NOT EDIT.\nconst x = 1;\n',
161
+ 'Code generated',
162
+ ],
163
+ ['#!/usr/bin/env node\n// @generated\nconsole.log(1);\n', '@generated'],
164
+ ])('protects a recognized leading marker', (source, expected) => {
165
+ write('file.js', source);
166
+ expect(declarations('file.js')[0]).toContain(expected);
167
+ });
168
+
169
+ it('recognizes hash comments after a shebang in an extensionless file', () => {
170
+ write('script', '#!/bin/sh\n# @generated\necho hi\n');
171
+ expect(declarations('script')[0]).toContain('@generated');
172
+ });
173
+
174
+ it('does not treat a marker after authored code as protection', () => {
175
+ write('file.js', 'export const authored = true;\n// @generated\n');
176
+ expect(declarations('file.js')).toEqual([]);
177
+ });
178
+
179
+ it('does not accept longer generated-like annotations', () => {
180
+ write('file.js', '// @generated-code\nexport const authored = true;\n');
181
+ expect(declarations('file.js')).toEqual([]);
182
+ });
183
+
184
+ it('does not mistake a leading CSS id selector for a comment', () => {
185
+ write('file.css', '#root { color: red; }\n/* @generated */\n');
186
+ expect(declarations('file.css')).toEqual([]);
187
+ });
188
+
189
+ it('extracts an exact regeneration command from a generated header', () => {
190
+ const file = write(
191
+ 'theme.css',
192
+ '/*\n * @generated\n * Command: pnpm astryx theme build src/theme.ts\n */\n',
193
+ );
194
+ const protection = createFileProtectionResolver(root).classify(file)[0];
195
+ expect(protection.command).toBe('pnpm astryx theme build src/theme.ts');
196
+ });
197
+ });
198
+
199
+ describe('hard boundaries and fail-closed parsing', () => {
200
+ it('protects dependency metadata, VCS metadata leaves, symlinks, and paths outside root', () => {
201
+ const dependency = write('node_modules/pkg/index.js', 'x');
202
+ const yarnDependency = write('.yarn/unplugged/pkg/index.js', 'x');
203
+ const yarnVirtual = write('.yarn/__virtual__/pkg/index.js', 'x');
204
+ const yarnInstallState = write('.yarn/install-state.gz', 'x');
205
+ const yarnPatch = write('.yarn/patches/pkg.patch', 'x');
206
+ const pnp = write('.pnp.cjs', 'x');
207
+ const pnpData = write('.pnp.data.json', '{}');
208
+ const metadata = write('.git', 'gitdir: elsewhere\n');
209
+ const target = write('target.js', 'x');
210
+ const link = path.join(root, 'link.js');
211
+ fs.symlinkSync(target, link);
212
+ const resolver = createFileProtectionResolver(root);
213
+
214
+ expect(resolver.classify(dependency)[0].reason).toBe('dependency');
215
+ expect(resolver.classify(yarnDependency)[0].reason).toBe('dependency');
216
+ expect(resolver.classify(yarnVirtual)[0].reason).toBe('dependency');
217
+ expect(resolver.classify(yarnInstallState)[0].reason).toBe('dependency');
218
+ expect(resolver.classify(yarnPatch)).toEqual([]);
219
+ expect(resolver.classify(pnp)[0].reason).toBe('dependency');
220
+ expect(resolver.classify(pnpData)[0].reason).toBe('dependency');
221
+ expect(resolver.classify(metadata)[0].reason).toBe('vcs');
222
+ expect(resolver.classify(link)[0].reason).toBe('symlink');
223
+ expect(
224
+ resolver.classify(path.join(root, '..', 'outside.js'))[0].reason,
225
+ ).toBe('outside-root');
226
+ });
227
+
228
+ it('rejects an .hgignore include reached through a symlink', () => {
229
+ const outside = path.join(
230
+ os.tmpdir(),
231
+ `astryx-ignore-${process.pid}-${Date.now()}`,
232
+ );
233
+ fs.writeFileSync(outside, 'syntax: glob\n*.generated\n');
234
+ try {
235
+ fs.symlinkSync(outside, path.join(root, 'rules'));
236
+ write('.hgignore', 'include:rules\n');
237
+ expect(() => createFileProtectionResolver(root)).toThrow(/symbolic link/);
238
+ } finally {
239
+ fs.rmSync(outside, {force: true});
240
+ }
241
+ });
242
+
243
+ it('fails before use when a protection source cannot be parsed', () => {
244
+ write('.hgignore', 'syntax: regexp\n[unterminated\n');
245
+ expect(() => createFileProtectionResolver(root)).toThrow(
246
+ ProtectionSourceError,
247
+ );
248
+ expect(() => createFileProtectionResolver(root)).toThrow(/\.hgignore/);
249
+ });
250
+ });
@@ -75,6 +75,8 @@ export function allErrorCodes(): string[];
75
75
  * | 'ERR_UNKNOWN_FEATURE'
76
76
  * | 'ERR_UNKNOWN_CODEMOD'
77
77
  * | 'ERR_CODEMOD_FAILED'
78
+ * | 'ERR_CODEMOD_PROTECTED'
79
+ * | 'ERR_CODEMOD_PROTECTION_SOURCE'
78
80
  * | 'ERR_NOT_FOUND'
79
81
  * | 'ERR_NO_DOC'
80
82
  * | 'ERR_NO_SHOWCASE'
@@ -107,4 +109,4 @@ export const ERROR_CODES: Readonly<Record<ErrorCode, ErrorCode>>;
107
109
  /**
108
110
  * Stable error-code string union. Append-only.
109
111
  */
110
- export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED");
112
+ export type ErrorCode = ("ERR_UNKNOWN" | "ERR_UNKNOWN_COMMAND" | "ERR_UNKNOWN_SUBCOMMAND" | "ERR_INVALID_OPTION" | "ERR_INVALID_ARGUMENT" | "ERR_MISSING_ARGUMENT" | "ERR_INVALID_LANG" | "ERR_INVALID_DETAIL" | "ERR_NODE_VERSION" | "ERR_CORE_NOT_FOUND" | "ERR_CORE_INCOMPATIBLE" | "ERR_UNKNOWN_COMPONENT" | "ERR_UNKNOWN_HOOK" | "ERR_UNKNOWN_TOPIC" | "ERR_UNKNOWN_SECTION" | "ERR_UNKNOWN_CATEGORY" | "ERR_UNKNOWN_TEMPLATE" | "ERR_AMBIGUOUS_TEMPLATE" | "ERR_AMBIGUOUS_COMPONENT" | "ERR_AMBIGUOUS_THEME" | "ERR_UNKNOWN_THEME" | "ERR_INTEGRATION_ROOT_CONFLICT" | "ERR_INTEGRATION_EXPORT_CONFLICT" | "ERR_UNKNOWN_PACKAGE" | "ERR_UNKNOWN_AGENT" | "ERR_UNKNOWN_FEATURE" | "ERR_UNKNOWN_CODEMOD" | "ERR_CODEMOD_FAILED" | "ERR_CODEMOD_PROTECTED" | "ERR_CODEMOD_PROTECTION_SOURCE" | "ERR_NOT_FOUND" | "ERR_NO_DOC" | "ERR_NO_SHOWCASE" | "ERR_NO_SOURCE" | "ERR_INVALID_DOC" | "ERR_FILE_NOT_FOUND" | "ERR_FILE_EXISTS" | "ERR_PATH_TRAVERSAL" | "ERR_WRITE_FAILED" | "ERR_THEME_INVALID" | "ERR_THEME_LOAD" | "ERR_PALETTE_GENERATION" | "ERR_VERSION_DETECT" | "ERR_INVALID_VERSION" | "ERR_DEP_MISSING" | "ERR_GH_CLI" | "ERR_UNKNOWN_POST" | "ERR_FETCH_FAILED" | "ERR_LAYOUT_PARSE" | "ERR_LAYOUT_INVALID" | "ERR_UNCLASSIFIED_EXIT" | "ERR_SIGNAL_TERMINATED");
@@ -34,6 +34,8 @@ export type ErrorCode =
34
34
  | 'ERR_UNKNOWN_FEATURE'
35
35
  | 'ERR_UNKNOWN_CODEMOD'
36
36
  | 'ERR_CODEMOD_FAILED'
37
+ | 'ERR_CODEMOD_PROTECTED'
38
+ | 'ERR_CODEMOD_PROTECTION_SOURCE'
37
39
  | 'ERR_NOT_FOUND'
38
40
  | 'ERR_NO_DOC'
39
41
  | 'ERR_NO_SHOWCASE'
@@ -154,6 +154,16 @@ export const doc = {
154
154
  value: 'ERR_CODEMOD_FAILED',
155
155
  description: 'One or more codemods failed during an upgrade run.',
156
156
  },
157
+ {
158
+ value: 'ERR_CODEMOD_PROTECTED',
159
+ description:
160
+ 'A required codemod change remains blocked by a protected consumer file.',
161
+ },
162
+ {
163
+ value: 'ERR_CODEMOD_PROTECTION_SOURCE',
164
+ description:
165
+ 'A working-tree protection declaration could not be read or parsed.',
166
+ },
157
167
  {
158
168
  value: 'ERR_NOT_FOUND',
159
169
  description:
@@ -64,6 +64,8 @@
64
64
  * | 'ERR_UNKNOWN_FEATURE'
65
65
  * | 'ERR_UNKNOWN_CODEMOD'
66
66
  * | 'ERR_CODEMOD_FAILED'
67
+ * | 'ERR_CODEMOD_PROTECTED'
68
+ * | 'ERR_CODEMOD_PROTECTION_SOURCE'
67
69
  * | 'ERR_NOT_FOUND'
68
70
  * | 'ERR_NO_DOC'
69
71
  * | 'ERR_NO_SHOWCASE'
@@ -161,6 +163,10 @@ export const ERROR_CODES = Object.freeze({
161
163
  ERR_UNKNOWN_CODEMOD: 'ERR_UNKNOWN_CODEMOD',
162
164
  /** One or more codemods failed during an upgrade run. */
163
165
  ERR_CODEMOD_FAILED: 'ERR_CODEMOD_FAILED',
166
+ /** A required codemod change remains blocked by a protected consumer file. */
167
+ ERR_CODEMOD_PROTECTED: 'ERR_CODEMOD_PROTECTED',
168
+ /** A working-tree protection declaration could not be read or parsed. */
169
+ ERR_CODEMOD_PROTECTION_SOURCE: 'ERR_CODEMOD_PROTECTION_SOURCE',
164
170
  /** A generic discover/lookup query matched nothing in any package. */
165
171
  ERR_NOT_FOUND: 'ERR_NOT_FOUND',
166
172
 
@@ -86,6 +86,8 @@ describe('error codes: shipped set', () => {
86
86
  'ERR_AMBIGUOUS_TEMPLATE',
87
87
  'ERR_AMBIGUOUS_THEME',
88
88
  'ERR_CODEMOD_FAILED',
89
+ 'ERR_CODEMOD_PROTECTED',
90
+ 'ERR_CODEMOD_PROTECTION_SOURCE',
89
91
  'ERR_CORE_INCOMPATIBLE',
90
92
  'ERR_CORE_NOT_FOUND',
91
93
  'ERR_DEP_MISSING',
@@ -135,25 +137,67 @@ describe('error codes: shipped set', () => {
135
137
  ];
136
138
 
137
139
  it('still carries every shipped code, spelled the same', () => {
138
- const missing = SHIPPED.filter(code => !isErrorCode(code) || ERROR_CODES[code] !== code);
140
+ const missing = SHIPPED.filter(
141
+ code => !isErrorCode(code) || ERROR_CODES[code] !== code,
142
+ );
139
143
  expect(missing, 'shipped codes removed or respelled').toEqual([]);
140
144
  });
141
145
  });
142
146
 
143
147
  describe('error codes: end-to-end JSON envelopes', () => {
144
148
  const cases = [
145
- {name: 'unknown component', args: ['component', 'Bogus', '--json'], code: 'ERR_UNKNOWN_COMPONENT'},
146
- {name: 'unknown hook', args: ['hook', 'bogusHook', '--json'], code: 'ERR_UNKNOWN_HOOK'},
147
- {name: 'unknown topic', args: ['docs', 'bogusTopic', '--json'], code: 'ERR_UNKNOWN_TOPIC'},
148
- {name: 'unknown template', args: ['template', 'bogusTemplate', '--json'], code: 'ERR_UNKNOWN_TEMPLATE'},
149
- {name: 'unknown command', args: ['bogus-cmd', '--json'], code: 'ERR_UNKNOWN_COMMAND'},
150
- {name: 'invalid --lang', args: ['docs', 'color', '--lang', 'fr', '--json'], code: 'ERR_INVALID_LANG'},
151
- {name: 'invalid --detail', args: ['docs', 'color', '--detail', 'bogus', '--json'], code: 'ERR_INVALID_DETAIL'},
152
- {name: 'unknown option', args: ['component', 'Button', '--bogus-flag', '--json'], code: 'ERR_INVALID_OPTION'},
153
- {name: 'missing argument', args: ['theme', 'build', '--json'], code: 'ERR_MISSING_ARGUMENT'},
149
+ {
150
+ name: 'unknown component',
151
+ args: ['component', 'Bogus', '--json'],
152
+ code: 'ERR_UNKNOWN_COMPONENT',
153
+ },
154
+ {
155
+ name: 'unknown hook',
156
+ args: ['hook', 'bogusHook', '--json'],
157
+ code: 'ERR_UNKNOWN_HOOK',
158
+ },
159
+ {
160
+ name: 'unknown topic',
161
+ args: ['docs', 'bogusTopic', '--json'],
162
+ code: 'ERR_UNKNOWN_TOPIC',
163
+ },
164
+ {
165
+ name: 'unknown template',
166
+ args: ['template', 'bogusTemplate', '--json'],
167
+ code: 'ERR_UNKNOWN_TEMPLATE',
168
+ },
169
+ {
170
+ name: 'unknown command',
171
+ args: ['bogus-cmd', '--json'],
172
+ code: 'ERR_UNKNOWN_COMMAND',
173
+ },
174
+ {
175
+ name: 'invalid --lang',
176
+ args: ['docs', 'color', '--lang', 'fr', '--json'],
177
+ code: 'ERR_INVALID_LANG',
178
+ },
179
+ {
180
+ name: 'invalid --detail',
181
+ args: ['docs', 'color', '--detail', 'bogus', '--json'],
182
+ code: 'ERR_INVALID_DETAIL',
183
+ },
184
+ {
185
+ name: 'unknown option',
186
+ args: ['component', 'Button', '--bogus-flag', '--json'],
187
+ code: 'ERR_INVALID_OPTION',
188
+ },
189
+ {
190
+ name: 'missing argument',
191
+ args: ['theme', 'build', '--json'],
192
+ code: 'ERR_MISSING_ARGUMENT',
193
+ },
154
194
  // `theme` is not on the --json allowlist, so --json on any theme subcommand
155
195
  // is rejected at the preAction gate with a stable invalid-option code.
156
- {name: 'json not supported', args: ['theme', 'bogus-sub', '--json'], code: 'ERR_INVALID_OPTION'},
196
+ {
197
+ name: 'json not supported',
198
+ args: ['theme', 'bogus-sub', '--json'],
199
+ code: 'ERR_INVALID_OPTION',
200
+ },
157
201
  ];
158
202
 
159
203
  for (const {name, args, code} of cases) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@astryxdesign/cli",
3
- "version": "0.6.3-canary.29be688",
3
+ "version": "0.6.3-canary.2bb99ed",
4
4
  "displayName": "CLI",
5
5
  "description": "Scaffold projects, browse templates, generate themes, and get agent-ready docs from the command line.",
6
6
  "author": "Meta Open Source",
@@ -91,6 +91,7 @@
91
91
  "@babel/types": "7.29.8",
92
92
  "ast-types": "0.16.3",
93
93
  "commander": "^12.1.0",
94
+ "ignore": "^7.0.5",
94
95
  "jiti": "^2.7.0",
95
96
  "jscodeshift": "^17.3.0",
96
97
  "node-diff3": "3.2.1",
@@ -100,10 +101,10 @@
100
101
  "zod": "^4.4.3"
101
102
  },
102
103
  "peerDependencies": {
103
- "@astryxdesign/charts": "0.6.3-canary.29be688",
104
- "@astryxdesign/core": "0.6.3-canary.29be688",
105
- "@astryxdesign/lab": "0.6.3-canary.29be688",
106
- "@astryxdesign/theme-neutral": "0.6.3-canary.29be688"
104
+ "@astryxdesign/charts": "0.6.3-canary.2bb99ed",
105
+ "@astryxdesign/core": "0.6.3-canary.2bb99ed",
106
+ "@astryxdesign/lab": "0.6.3-canary.2bb99ed",
107
+ "@astryxdesign/theme-neutral": "0.6.3-canary.2bb99ed"
107
108
  },
108
109
  "peerDependenciesMeta": {
109
110
  "@astryxdesign/charts": {
@@ -120,10 +121,10 @@
120
121
  }
121
122
  },
122
123
  "devDependencies": {
123
- "@astryxdesign/charts": "0.6.3-canary.29be688",
124
- "@astryxdesign/core": "0.6.3-canary.29be688",
125
- "@astryxdesign/lab": "0.6.3-canary.29be688",
126
- "@astryxdesign/theme-neutral": "0.6.3-canary.29be688",
124
+ "@astryxdesign/charts": "0.6.3-canary.2bb99ed",
125
+ "@astryxdesign/core": "0.6.3-canary.2bb99ed",
126
+ "@astryxdesign/lab": "0.6.3-canary.2bb99ed",
127
+ "@astryxdesign/theme-neutral": "0.6.3-canary.2bb99ed",
127
128
  "@heroicons/react": "^2.2.0",
128
129
  "@stylexjs/stylex": "^0.19.0",
129
130
  "@types/babel__core": "^7.20.5",