@astryxdesign/cli 0.6.5-canary.eb58bba → 0.6.5-canary.f261d2f

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 (41) hide show
  1. package/README.md +11 -12
  2. package/api/error.d.mts +0 -22
  3. package/api/error.mjs +0 -42
  4. package/api/integration/authoring-checks.mjs +7 -10
  5. package/api/integration/authoring-checks.type.d.mts +0 -8
  6. package/api/integration/authoring-checks.type.mjs +3 -7
  7. package/api/integration/integrationComponentConflicts.doc.mjs +1 -1
  8. package/api/integration/integrationDocConflicts.doc.mjs +1 -1
  9. package/api/integration/integrationTemplateConflicts.doc.mjs +1 -1
  10. package/api/integration/validate-integration.d.mts +2 -4
  11. package/api/integration/validate-integration.mjs +2 -7
  12. package/api/integration/validate-integration.test.mjs +0 -55
  13. package/api/integration/validate-integration.type.d.mts +0 -5
  14. package/api/integration/validate-integration.type.mjs +1 -5
  15. package/api/integration/validateIntegration.doc.mjs +1 -1
  16. package/api/swizzle/copy/copy.mjs +3 -66
  17. package/api/swizzle/swizzle.doc.mjs +0 -4
  18. package/api/template/copy/copy.mjs +5 -9
  19. package/api/template/show/show.mjs +4 -15
  20. package/api/template/template.doc.mjs +1 -5
  21. package/api/template/template.type.d.mts +0 -1
  22. package/api/template/template.type.mjs +0 -1
  23. package/api/upgrade/run/run.mjs +3 -20
  24. package/api/upgrade/run/run.test.mjs +1 -45
  25. package/api/upgrade/upgrade.doc.mjs +1 -1
  26. package/api/upgrade/upgrade.type.d.mts +0 -1
  27. package/api/upgrade/upgrade.type.mjs +0 -1
  28. package/clients/cli/commands/doctor.mjs +4 -4
  29. package/clients/cli/commands/template.mjs +2 -11
  30. package/clients/cli/commands/upgrade.ascii-output.test.mjs +0 -14
  31. package/clients/cli/lib/manifest.mjs +165 -44
  32. package/clients/cli/lib/manifest.test.mjs +7 -98
  33. package/foundation/discovery/template-adapter.d.mts +0 -13
  34. package/foundation/discovery/template-adapter.fixture-refs.test.mjs +1 -37
  35. package/foundation/discovery/template-adapter.mjs +1 -16
  36. package/foundation/response/response-types.doc.d.mts +5 -5
  37. package/foundation/response/response-types.doc.mjs +11 -11
  38. package/package.json +9 -9
  39. package/api/template/show/show.test.mjs +0 -76
  40. package/clients/cli/commands/template.show-media.test.mjs +0 -62
  41. package/clients/cli/commands/write-failure.test.mjs +0 -175
package/README.md CHANGED
@@ -303,12 +303,11 @@ Shape:
303
303
  ```
304
304
 
305
305
  The manifest is **derived from Commander metadata** (commands, arguments, options)
306
- so it can't drift from the real command definitions. The facts Commander doesn't
307
- track come from each command's docs: examples from its CommandDoc, and emitted
308
- response types from the returns of the FunctionDoc it wraps (plus the few
309
- envelopes the CLI layer builds itself). `--json` support comes from the
310
- `JSON_SUPPORTED` allowlist. Drift tests (`manifest.test.mjs`) fail CI when a
311
- command is added without describing it.
306
+ so it can't drift from the real command definitions. The two facts Commander
307
+ doesn't track (`--json` support and emitted response types) are layered on from
308
+ the `JSON_SUPPORTED` allowlist and a small declarative `RESPONSE_TYPES` map in
309
+ `src/lib/manifest.mjs`, guarded by a drift test (`manifest.test.mjs`) so adding a
310
+ command without describing it fails CI.
312
311
 
313
312
  **Backwards-compat:** the bare `astryx --json` envelope keeps `type: "help"` and its
314
313
  original shallow fields (`name`, `version`, `commands` as a `string[]` of names,
@@ -451,7 +450,7 @@ Every response has a `type` discriminant. The full set is below (generated from
451
450
  | `gap-report.categories` | The fixed gap category values and human-readable labels. |
452
451
  | `gap-report.file` | An aggregate receipt: overall status, the selected package, issuesUrl (or null), deliveries in handler order, each {handlerType: project \| integration \| fallback, handler, audience, status, url, message}, and filedCount/routedOnlyCount totals. |
453
452
  | `template.list` | The effective discovered TemplateListEntry[] for pages and blocks. A winning replacement entry includes optional `replaces`, naming the Core id omitted from the default list. |
454
- | `template.show` | The resolved template's source, exactly as a copy writes it, plus its description, kind, the component names it composes, and demoMediaReplaced (how many Astryx demo media references were replaced with placeholders for you to swap for your own media). |
453
+ | `template.show` | The resolved template's raw source plus its description, kind, and the component names it composes. |
455
454
  | `template.skeleton` | A layout skeleton (structural tags with spatial annotations) plus the template's description and the components it composes. |
456
455
  | `template.copy` | A scaffold receipt: template id, output directory, written file name, and file count. |
457
456
  | `template.cdn` | A write receipt for the no-build-step CDN starter page: the path (relative to cwd), the Astryx version every CDN URL was pinned to, whether it was written, and the reason it was not. `exists` when a file was already there, which is a success. |
@@ -469,17 +468,17 @@ Every response has a `type` discriminant. The full set is below (generated from
469
468
  | `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. |
470
469
  | `upgrade.registry` | The copied-composition receipt for --registry: applied, ok, the counts (found, current, wouldUpdate, updated, wouldMerge, merged, wouldRefreshReceipt, receiptsRefreshed, conflicts, missing, invalid, failed), and items. |
471
470
  | `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |
472
- | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, sourcePathFound (false when the resolved source directory does not exist, so no source file was read), and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
471
+ | `upgrade.run` | The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and per-codemod errors. |
473
472
  | `manifest` | The CLI capability manifest: name, version, apiVersion, description, globalOptions, commands (each name, description, arguments, options, json, aliases?, responseTypes?, examples?, exitCodes? as [{code, when}], subcommands?), jsonSupported, and the flat responseTypes index. |
474
473
  | `help` | Help, in one of two shapes. A bare `astryx --json` returns the root manifest: name, version, commands (the command names), jsonSupported, and manifest (the full payload `astryx manifest --json` returns). `--help --json` on any command, or `astryx help [command] --json`, returns that command's help: command, description, usage, options (each flags, description, and defaultValue and choices when set), and subcommands (each name and description). data.manifest marks the first shape; data.usage marks the second. |
475
474
  | `version` | The CLI version, for `astryx --version --json`: {version}. |
476
475
  | `doctor` | The health-check report: `checks` (each with id, label, status: pass \| warn \| fail \| info, a message, and an optional fix, always present on warn and fail) plus a `summary` of counts per status. |
477
476
  | `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. |
478
477
  | `integration.pack-check` | The packed-package check: name, version, packable, tarball {filename, fileCount, size, unpackedSize} or null, inventory {manifest, roots [{kind, path, expectedFiles, missingFiles, complete}], expectedFiles, packedFiles}, contributions {local, packed}, each null or {themes [{slug, exportName}], components, templates [{id, type, name}], codemods [{version, id}], docs, agentDocsAppend}, and issues [{code, severity, message}]. |
479
- | `integration.validate` | The validation result: validated (false when no integration manifest was found, so nothing was checked and the empty issues list proves nothing), the package name and version (both null when validated is false) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
480
- | `integration.template-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
481
- | `integration.component-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
482
- | `integration.doc-conflicts` | validated (false when no integration manifest was found, so nothing was inspected), the integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
478
+ | `integration.validate` | The validation result: the package name and version (both null when no local manifest is found) plus issues, an AstryxIntegrationIssue[] of {code, severity: warning \| error, message}. |
479
+ | `integration.template-conflicts` | The integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}. |
480
+ | `integration.component-conflicts` | The integration identity, structural issues, and non-blocking conflicts where an integration component name is also owned by Core; each conflict includes the exact package-qualified command. |
481
+ | `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |
483
482
  | `layout.expand` | The expansion: parsed form, generated TSX code, componentsUsed, states (count of useState hooks scaffolded), todos, blocksReferenced (each {name, mode}), warnings, and written (the output path, or null when nothing was written). |
484
483
  | `layout.check` | The validation result: a valid flag, the detected form, errors (each with line/col, message, formatted text, and suggestions), warnings, and the expression re-printed in both canonical surfaces (compact and outline). |
485
484
  | `layout.grammar` | The XLE/XLO grammar cheatsheet: a text field with the full reference plus an aliases map (short name → canonical component) generated from this install's registry. |
package/api/error.d.mts CHANGED
@@ -1,28 +1,6 @@
1
1
  // @generated by scripts/sync-api-types.mjs from the JSDoc in api/**/*.mjs.
2
2
  // DO NOT EDIT — run `pnpm sync:api-types` to regenerate.
3
3
 
4
- /**
5
- * The error for a write that failed on the filesystem: no permission, a
6
- * read-only mount, a full disk, a path component that is not a directory.
7
- *
8
- * A raw Node errno error reached the envelope as
9
- * `{"error": "EACCES: permission denied, open '/home/you/p/readonly/x.tsx'",
10
- * "code": "ERR_UNKNOWN"}` — the wrong code (ERR_WRITE_FAILED is in the frozen
11
- * registry for exactly this) and an absolute host path in the message. This
12
- * keeps the errno, which is the part that tells you what to fix, and reports
13
- * the target the way every other Astryx message does: relative to the project.
14
- *
15
- * A caller that wrote files before the failure must undo them first and pass
16
- * the ones it could not restore as `unrestored`, so the message never says
17
- * nothing was written when something was.
18
- *
19
- * @param {string} target absolute path the write was aimed at
20
- * @param {string} cwd project root, for the relative form
21
- * @param {unknown} cause the error the filesystem call threw
22
- * @param {string[]} [unrestored] absolute paths an undo could not put back
23
- * @returns {AstryxError}
24
- */
25
- export function writeFailed(target: string, cwd: string, cause: unknown, unrestored?: string[]): AstryxError;
26
4
  export class AstryxError extends Error {
27
5
  /**
28
6
  * @param {string} message
package/api/error.mjs CHANGED
@@ -12,7 +12,6 @@
12
12
  */
13
13
 
14
14
  import {ERROR_CODES} from '../foundation/response/error-codes.mjs';
15
- import * as path from 'node:path';
16
15
 
17
16
  export class AstryxError extends Error {
18
17
  /** @type {import('../foundation/response/base').Suggestion[] | undefined} */
@@ -37,44 +36,3 @@ export class AstryxError extends Error {
37
36
  if (Array.isArray(suggestions) && suggestions.length) this.suggestions = suggestions;
38
37
  }
39
38
  }
40
-
41
- /**
42
- * The error for a write that failed on the filesystem: no permission, a
43
- * read-only mount, a full disk, a path component that is not a directory.
44
- *
45
- * A raw Node errno error reached the envelope as
46
- * `{"error": "EACCES: permission denied, open '/home/you/p/readonly/x.tsx'",
47
- * "code": "ERR_UNKNOWN"}` — the wrong code (ERR_WRITE_FAILED is in the frozen
48
- * registry for exactly this) and an absolute host path in the message. This
49
- * keeps the errno, which is the part that tells you what to fix, and reports
50
- * the target the way every other Astryx message does: relative to the project.
51
- *
52
- * A caller that wrote files before the failure must undo them first and pass
53
- * the ones it could not restore as `unrestored`, so the message never says
54
- * nothing was written when something was.
55
- *
56
- * @param {string} target absolute path the write was aimed at
57
- * @param {string} cwd project root, for the relative form
58
- * @param {unknown} cause the error the filesystem call threw
59
- * @param {string[]} [unrestored] absolute paths an undo could not put back
60
- * @returns {AstryxError}
61
- */
62
- export function writeFailed(target, cwd, cause, unrestored = []) {
63
- const rel = path.relative(cwd, target) || target;
64
- const errno =
65
- typeof (/** @type {any} */ (cause)?.code) === 'string'
66
- ? /** @type {any} */ (cause).code
67
- : null;
68
- const why = errno === 'EACCES' || errno === 'EPERM' ? ' (no permission)' : '';
69
- const outcome =
70
- unrestored.length === 0
71
- ? 'Nothing was written.'
72
- : `Earlier writes could not all be undone: ${unrestored
73
- .map(file => path.relative(cwd, file) || file)
74
- .join(', ')}.`;
75
- return new AstryxError(
76
- `Could not write ${rel}${errno ? `: ${errno}` : ''}${why}. ${outcome}`,
77
- undefined,
78
- ERROR_CODES.ERR_WRITE_FAILED,
79
- );
80
- }
@@ -92,7 +92,6 @@ function addErrors(issues, errors, code) {
92
92
  export async function integrationTemplateConflicts(pkg, options = {}) {
93
93
  const {cwd = process.cwd()} = options;
94
94
  const resolved = await resolveIntegration(pkg, cwd);
95
- const validated = resolved.found;
96
95
  const name = resolved.found ? (resolved.name ?? null) : null;
97
96
  const version = resolved.found ? (resolved.version ?? null) : null;
98
97
  const issues = [...resolved.issues];
@@ -100,7 +99,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
100
99
  if (!resolved.integration || name == null) {
101
100
  return {
102
101
  type: 'integration.template-conflicts',
103
- data: {validated, name, version, conflicts: [], issues},
102
+ data: {name, version, conflicts: [], issues},
104
103
  };
105
104
  }
106
105
 
@@ -216,7 +215,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
216
215
 
217
216
  return {
218
217
  type: 'integration.template-conflicts',
219
- data: {validated, name, version, conflicts, issues},
218
+ data: {name, version, conflicts, issues},
220
219
  };
221
220
  }
222
221
 
@@ -229,7 +228,6 @@ export async function integrationTemplateConflicts(pkg, options = {}) {
229
228
  export async function integrationComponentConflicts(pkg, options = {}) {
230
229
  const {cwd = process.cwd()} = options;
231
230
  const resolved = await resolveIntegration(pkg, cwd);
232
- const validated = resolved.found;
233
231
  const name = resolved.found ? (resolved.name ?? null) : null;
234
232
  const version = resolved.found ? (resolved.version ?? null) : null;
235
233
  const issues = [...resolved.issues];
@@ -237,7 +235,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
237
235
  if (!resolved.integration?.components || name == null) {
238
236
  return {
239
237
  type: 'integration.component-conflicts',
240
- data: {validated, name, version, conflicts: [], issues},
238
+ data: {name, version, conflicts: [], issues},
241
239
  };
242
240
  }
243
241
 
@@ -251,7 +249,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
251
249
  });
252
250
  return {
253
251
  type: 'integration.component-conflicts',
254
- data: {validated, name, version, conflicts: [], issues},
252
+ data: {name, version, conflicts: [], issues},
255
253
  };
256
254
  }
257
255
 
@@ -276,7 +274,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {
276
274
 
277
275
  return {
278
276
  type: 'integration.component-conflicts',
279
- data: {validated, name, version, conflicts, issues},
277
+ data: {name, version, conflicts, issues},
280
278
  };
281
279
  }
282
280
 
@@ -289,7 +287,6 @@ export async function integrationComponentConflicts(pkg, options = {}) {
289
287
  export async function integrationDocConflicts(pkg, options = {}) {
290
288
  const {cwd = process.cwd()} = options;
291
289
  const resolved = await resolveIntegration(pkg, cwd);
292
- const validated = resolved.found;
293
290
  const name = resolved.found ? (resolved.name ?? null) : null;
294
291
  const version = resolved.found ? (resolved.version ?? null) : null;
295
292
  const issues = [...resolved.issues];
@@ -297,7 +294,7 @@ export async function integrationDocConflicts(pkg, options = {}) {
297
294
  if (!resolved.integration?.docs || name == null) {
298
295
  return {
299
296
  type: 'integration.doc-conflicts',
300
- data: {validated, name, version, findings: [], issues},
297
+ data: {name, version, findings: [], issues},
301
298
  };
302
299
  }
303
300
 
@@ -391,6 +388,6 @@ export async function integrationDocConflicts(pkg, options = {}) {
391
388
 
392
389
  return {
393
390
  type: 'integration.doc-conflicts',
394
- data: {validated, name, version, findings, issues},
391
+ data: {name, version, findings, issues},
395
392
  };
396
393
  }
@@ -32,15 +32,9 @@ export type IntegrationDocFinding = {
32
32
  coreTopic: string;
33
33
  message: string;
34
34
  };
35
- /**
36
- * Each of the three authoring checks reports `validated`: false means no
37
- * integration manifest was found, so nothing was inspected and the empty
38
- * conflicts/findings list carries no information about the package.
39
- */
40
35
  export type IntegrationTemplateConflictResponse = {
41
36
  type: "integration.template-conflicts";
42
37
  data: {
43
- validated: boolean;
44
38
  name: string | null;
45
39
  version: string | null;
46
40
  conflicts: IntegrationTemplateConflict[];
@@ -50,7 +44,6 @@ export type IntegrationTemplateConflictResponse = {
50
44
  export type IntegrationComponentConflictResponse = {
51
45
  type: "integration.component-conflicts";
52
46
  data: {
53
- validated: boolean;
54
47
  name: string | null;
55
48
  version: string | null;
56
49
  conflicts: IntegrationComponentConflict[];
@@ -60,7 +53,6 @@ export type IntegrationComponentConflictResponse = {
60
53
  export type IntegrationDocConflictResponse = {
61
54
  type: "integration.doc-conflicts";
62
55
  data: {
63
- validated: boolean;
64
56
  name: string | null;
65
57
  version: string | null;
66
58
  findings: IntegrationDocFinding[];
@@ -49,25 +49,21 @@
49
49
  */
50
50
 
51
51
  /**
52
- * Each of the three authoring checks reports `validated`: false means no
53
- * integration manifest was found, so nothing was inspected and the empty
54
- * conflicts/findings list carries no information about the package.
55
- *
56
52
  * @typedef {object} IntegrationTemplateConflictResponse
57
53
  * @property {'integration.template-conflicts'} type
58
- * @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
54
+ * @property {{name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
59
55
  */
60
56
 
61
57
  /**
62
58
  * @typedef {object} IntegrationComponentConflictResponse
63
59
  * @property {'integration.component-conflicts'} type
64
- * @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
60
+ * @property {{name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
65
61
  */
66
62
 
67
63
  /**
68
64
  * @typedef {object} IntegrationDocConflictResponse
69
65
  * @property {'integration.doc-conflicts'} type
70
- * @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
66
+ * @property {{name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
71
67
  */
72
68
 
73
69
  export {};
@@ -26,7 +26,7 @@ export const doc = {
26
26
  {
27
27
  type: 'integration.component-conflicts',
28
28
  description:
29
- '`validated` (false when no integration manifest was found, so nothing was inspected), integration identity, structural issues, and Core component-name conflicts with package-qualified commands.',
29
+ 'Integration identity, structural issues, and Core component-name conflicts with package-qualified commands.',
30
30
  },
31
31
  ],
32
32
  examples: [
@@ -26,7 +26,7 @@ export const doc = {
26
26
  {
27
27
  type: 'integration.doc-conflicts',
28
28
  description:
29
- '`validated` (false when no integration manifest was found, so nothing was inspected), integration identity, structural issues, and classified Core doc relationships.',
29
+ 'Integration identity, structural issues, and classified Core doc relationships.',
30
30
  },
31
31
  ],
32
32
  examples: [
@@ -41,7 +41,7 @@ export const doc = {
41
41
  {
42
42
  type: 'integration.template-conflicts',
43
43
  description:
44
- '`validated` (false when no integration manifest was found, so nothing was inspected and the empty conflict list carries no information), the integration identity, structural issues, and every Core template-id conflict with a package-qualified command.',
44
+ 'The integration identity, structural issues, and every Core template-id conflict with a package-qualified command.',
45
45
  },
46
46
  ],
47
47
  examples: [
@@ -19,10 +19,8 @@ export function validateInstalledIntegration(spec: string, cwd?: string): Promis
19
19
  /**
20
20
  * Unified entry: validate the LOCAL integration (no `pkg`) or an INSTALLED one
21
21
  * (`pkg` given) and return the `integration.validate` envelope. The no-manifest
22
- * local case is guidance, not an error — it comes back with `validated: false`,
23
- * `name: null` and no issues so the CLI can print a hint and stay exit-0.
24
- * `validated` is what tells a machine consumer that empty `issues` means
25
- * "nothing was checked" rather than "checked and healthy".
22
+ * local case is guidance, not an error — it comes back with `name: null` and no
23
+ * issues so the CLI can print a hint and stay exit-0.
26
24
  *
27
25
  * This is the seam that keeps the CLI a thin wrapper: the command handler calls
28
26
  * this and only chooses how to render (human vs --json) + the exit code.
@@ -427,10 +427,8 @@ export async function validateInstalledIntegration(spec, cwd = process.cwd()) {
427
427
  /**
428
428
  * Unified entry: validate the LOCAL integration (no `pkg`) or an INSTALLED one
429
429
  * (`pkg` given) and return the `integration.validate` envelope. The no-manifest
430
- * local case is guidance, not an error — it comes back with `validated: false`,
431
- * `name: null` and no issues so the CLI can print a hint and stay exit-0.
432
- * `validated` is what tells a machine consumer that empty `issues` means
433
- * "nothing was checked" rather than "checked and healthy".
430
+ * local case is guidance, not an error — it comes back with `name: null` and no
431
+ * issues so the CLI can print a hint and stay exit-0.
434
432
  *
435
433
  * This is the seam that keeps the CLI a thin wrapper: the command handler calls
436
434
  * this and only chooses how to render (human vs --json) + the exit code.
@@ -447,9 +445,6 @@ export async function validateIntegration(pkg, options = {}) {
447
445
  return {
448
446
  type: 'integration.validate',
449
447
  data: {
450
- // The one bit that separates "checked and clean" from "never checked":
451
- // with no manifest there is nothing to validate, and issues stays [].
452
- validated: result.found,
453
448
  name: result.found ? (result.name ?? null) : null,
454
449
  version: result.found ? (result.version ?? null) : null,
455
450
  issues: result.issues,
@@ -625,58 +625,3 @@ describe('integration diagnostics are read-only', () => {
625
625
  expect({pkg: snapshot(pkgDir), consumer: snapshot(consumer)}).toEqual(before);
626
626
  });
627
627
  });
628
-
629
- describe('validated separates "checked and clean" from "never checked"', () => {
630
- // `doctor integration validate --json` from a directory with no manifest
631
- // returned {name: null, version: null, issues: []} and exit 0 — the same
632
- // envelope a healthy, fully validated integration produces. Wire that into
633
- // CI from the wrong directory and it is green forever.
634
- it('is false for every check when no manifest is found', async () => {
635
- const dir = path.join(tmpDir, 'plain');
636
- fs.mkdirSync(dir, {recursive: true});
637
- fs.writeFileSync(
638
- path.join(dir, 'package.json'),
639
- JSON.stringify({name: 'plain-app', version: '1.0.0'}),
640
- );
641
-
642
- const validate = await validateIntegration(undefined, {cwd: dir});
643
- expect(validate.data.validated).toBe(false);
644
- expect(validate.data.issues).toEqual([]);
645
-
646
- const templates = await integrationTemplateConflicts(undefined, {cwd: dir});
647
- const components = await integrationComponentConflicts(undefined, {cwd: dir});
648
- const docs = await integrationDocConflicts(undefined, {cwd: dir});
649
- expect(templates.data.validated).toBe(false);
650
- expect(components.data.validated).toBe(false);
651
- expect(docs.data.validated).toBe(false);
652
- });
653
-
654
- it('is true for a real integration, whose empty issue list then means healthy', async () => {
655
- const dir = path.join(tmpDir, 'integration');
656
- writePackage(dir, {manifest: 'export default {};\n'});
657
-
658
- const validate = await validateIntegration(undefined, {cwd: dir});
659
- expect(validate.data.validated).toBe(true);
660
- expect(validate.data.name).toBe('@acme/widgets');
661
-
662
- const templates = await integrationTemplateConflicts(undefined, {cwd: dir});
663
- const components = await integrationComponentConflicts(undefined, {cwd: dir});
664
- const docs = await integrationDocConflicts(undefined, {cwd: dir});
665
- expect(templates.data.validated).toBe(true);
666
- expect(components.data.validated).toBe(true);
667
- expect(docs.data.validated).toBe(true);
668
- });
669
-
670
- it('is true for an installed package that could not be found — that is a real finding', async () => {
671
- const consumer = path.join(tmpDir, 'consumer');
672
- fs.mkdirSync(consumer, {recursive: true});
673
- fs.writeFileSync(
674
- path.join(consumer, 'package.json'),
675
- JSON.stringify({name: 'consumer', version: '1.0.0'}),
676
- );
677
-
678
- const res = await validateIntegration('@acme/nope', {cwd: consumer});
679
- expect(res.data.validated).toBe(true);
680
- expect(summarizeIssues(res.data.issues).errors).toBeGreaterThan(0);
681
- });
682
- });
@@ -27,15 +27,10 @@ export type ValidateIntegrationOptions = {
27
27
  };
28
28
  /**
29
29
  * `astryx --json doctor integration validate [package]`.
30
- *
31
- * `validated` is false in exactly one case: no integration manifest was found,
32
- * so nothing was checked. An empty `issues` then means "not looked at", not
33
- * "healthy" — the two are otherwise byte-identical.
34
30
  */
35
31
  export type ValidateIntegrationResponse = {
36
32
  type: "integration.validate";
37
33
  data: {
38
- validated: boolean;
39
34
  name: string | null;
40
35
  version: string | null;
41
36
  issues: import("../../foundation/integrations/issue").AstryxIntegrationIssue[];
@@ -32,13 +32,9 @@
32
32
 
33
33
  /**
34
34
  * `astryx --json doctor integration validate [package]`.
35
- *
36
- * `validated` is false in exactly one case: no integration manifest was found,
37
- * so nothing was checked. An empty `issues` then means "not looked at", not
38
- * "healthy" — the two are otherwise byte-identical.
39
35
  * @typedef {object} ValidateIntegrationResponse
40
36
  * @property {'integration.validate'} type
41
- * @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
37
+ * @property {{name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data
42
38
  */
43
39
 
44
40
  export {};
@@ -46,7 +46,7 @@ export const doc = {
46
46
  {
47
47
  type: 'integration.validate',
48
48
  description:
49
- 'The result envelope: `data.validated`, false only when no integration manifest was found — nothing was checked, so the empty `data.issues` means "not looked at", not "healthy"; `data.name` and `data.version` of the validated package (both null when `data.validated` is false; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message}.',
49
+ 'The result envelope: `data.name` and `data.version` of the validated package (both null only when no local manifest is found; `data.name` is `(local package)` when the local package.json has no readable name), plus `data.issues`, an AstryxIntegrationIssue[] of {code, severity: `warning` | `error`, message}.',
50
50
  },
51
51
  ],
52
52
  examples: [
@@ -25,7 +25,7 @@ import {
25
25
  findIntegrationComponentSource,
26
26
  } from '../../../foundation/discovery/component-discovery.mjs';
27
27
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
28
- import {AstryxError, writeFailed} from '../../error.mjs';
28
+ import {AstryxError} from '../../error.mjs';
29
29
 
30
30
  /** Default issue tracker for maintainer feedback after swizzling. */
31
31
  const DEFAULT_ISSUES_URL = 'https://github.com/facebook/astryx/issues/new';
@@ -290,21 +290,11 @@ export async function swizzleCopy(component, options = {}) {
290
290
  );
291
291
  }
292
292
 
293
- const outputDirExisted = fs.existsSync(outputDir);
294
- try {
295
- fs.mkdirSync(outputDir, {recursive: true});
296
- } catch (err) {
297
- throw writeFailed(outputDir, cwd, err);
298
- }
293
+ fs.mkdirSync(outputDir, {recursive: true});
299
294
 
300
295
  const files = fs.readdirSync(componentDir);
301
296
  let copied = 0;
302
297
  let usesStyleX = false;
303
- // A copy that fails part-way undoes what it already wrote, so the report is
304
- // true and a retry does not trip over half a component. Each entry keeps
305
- // the bytes the file had before this run (null when the copy created it).
306
- /** @type {Array<{dest: string, original: Buffer|null}>} */
307
- const written = [];
308
298
  for (const file of files) {
309
299
  if (isExcludedFromCopy(file)) continue;
310
300
  const srcPath = path.join(componentDir, file);
@@ -319,25 +309,7 @@ export async function swizzleCopy(component, options = {}) {
319
309
  ) {
320
310
  usesStyleX = true;
321
311
  }
322
- const dest = path.join(outputDir, file);
323
- try {
324
- // The snapshot read is guarded too: a destination that cannot be read
325
- // back (no permission, or a directory with this name) must still undo
326
- // the earlier writes and report ERR_WRITE_FAILED.
327
- const original = fs.existsSync(dest) ? fs.readFileSync(dest) : null;
328
- written.push({dest, original});
329
- fs.writeFileSync(dest, content);
330
- } catch (err) {
331
- const unrestored = undoCopy(written);
332
- if (!outputDirExisted) {
333
- try {
334
- fs.rmdirSync(outputDir);
335
- } catch {
336
- // Not empty (something could not be undone), or already gone.
337
- }
338
- }
339
- throw writeFailed(dest, cwd, err, unrestored);
340
- }
312
+ fs.writeFileSync(path.join(outputDir, file), content);
341
313
  copied++;
342
314
  }
343
315
 
@@ -361,38 +333,3 @@ export async function swizzleCopy(component, options = {}) {
361
333
  if (feedback) data.feedback = feedback;
362
334
  return {type: 'swizzle.copy', data};
363
335
  }
364
-
365
- /**
366
- * Undo the writes of a copy that failed part-way, newest first: delete the
367
- * files the copy created and put back the bytes of the files it replaced. A
368
- * file whose bytes are already the original ones is left alone, so a write
369
- * that failed before changing anything is not reported as unrestored.
370
- *
371
- * @param {Array<{dest: string, original: Buffer|null}>} written
372
- * @returns {string[]} the files it could not restore
373
- */
374
- function undoCopy(written) {
375
- /** @type {string[]} */
376
- const unrestored = [];
377
- for (const {dest, original} of [...written].reverse()) {
378
- try {
379
- if (original == null) {
380
- fs.rmSync(dest, {force: true});
381
- continue;
382
- }
383
- /** @type {Buffer|null} */
384
- let current = null;
385
- try {
386
- current = fs.readFileSync(dest);
387
- } catch {
388
- current = null;
389
- }
390
- if (current == null || !current.equals(original)) {
391
- fs.writeFileSync(dest, original);
392
- }
393
- } catch {
394
- unrestored.push(dest);
395
- }
396
- }
397
- return unrestored;
398
- }
@@ -101,10 +101,6 @@ export const doc = {
101
101
  code: 'ERR_FILE_EXISTS',
102
102
  when: 'copying would overwrite existing files and overwrite is not set',
103
103
  },
104
- {
105
- code: 'ERR_WRITE_FAILED',
106
- when: 'the output directory or a copied file could not be written (no permission, read-only mount, full disk)',
107
- },
108
104
  ],
109
105
  examples: [
110
106
  {
@@ -16,7 +16,7 @@ import {
16
16
  isFilePathArg,
17
17
  PathSafetyError,
18
18
  } from '../../../foundation/fs/path-safety.mjs';
19
- import {AstryxError, writeFailed} from '../../error.mjs';
19
+ import {AstryxError} from '../../error.mjs';
20
20
  import {ERROR_CODES} from '../../../foundation/response/error-codes.mjs';
21
21
  import {stripTemplateAssetRefs} from '../../../foundation/discovery/template-adapter.mjs';
22
22
 
@@ -80,17 +80,13 @@ export function templateCopy(match, {targetPath, cwd, overwrite = false}) {
80
80
  );
81
81
  }
82
82
 
83
+ fs.mkdirSync(outputDir, {recursive: true});
84
+
83
85
  // Strip demo image references so the scaffolded file renders without a
84
- // Meta-only network dependency. Read before any write, so a failure below
85
- // leaves nothing behind.
86
+ // Meta-only network dependency.
86
87
  const source = fs.readFileSync(match.filePath, 'utf-8');
87
88
  const outputSource = stripTemplateAssetRefs(source);
88
- try {
89
- fs.mkdirSync(outputDir, {recursive: true});
90
- fs.writeFileSync(outputFilePath, outputSource);
91
- } catch (err) {
92
- throw writeFailed(outputFilePath, cwd, err);
93
- }
89
+ fs.writeFileSync(outputFilePath, outputSource);
94
90
 
95
91
  const relOutput = path.relative(cwd, outputDir) || '.';
96
92
  return {