An open source design system that's fully customizable and agent ready
TypeScript
fix(cli): say when a command did nothing (upgrade sourcePathFound, doctor validated) (#6618)
Joey6e564091ee63
diff --git a/.changeset/cli-report-when-nothing-was-checked.md b/.changeset/cli-report-when-nothing-was-checked.mdnew file mode 100644index 0000000000..d30ebe1ed7--- /dev/null+++ b/.changeset/cli-report-when-nothing-was-checked.md@@ -0,0 +1,22 @@+---+'@astryxdesign/cli': patch+---++[fix] Say when a command did nothing: `upgrade` reports `sourcePathFound`, the integration checks report `validated`.++Two commands could legitimately do nothing and produce an envelope identical to+a clean success. Both now carry the fact in a field of their own response+instead of only in human text.++`astryx upgrade` defaults `--path` to `./src`. A project laid out as `app/` (or+a typo) skipped every code codemod and still reported exit 0, `filesChanged: 0`,+`errors: []` and "Upgrade complete". The only warning was a log line `--json`+suppresses by design. `upgrade.run` now carries `sourcePathFound`, and the+human completion line names the directory it did not find.++`astryx doctor integration validate|components|docs|templates` returned+`{name: null, version: null, issues: []}` and exit 0 when no integration+manifest was found — the same shape as a validated, healthy integration. All+four envelopes now carry `validated`, false only when nothing was inspected.++@josephfarinadiff --git a/packages/cli/README.md b/packages/cli/README.mdindex a1b340b38a..1fce6a13f9 100644--- a/packages/cli/README.md+++ b/packages/cli/README.md@@ -468,17 +468,17 @@ Every response has a `type` discriminant. The full set is below (generated from| `upgrade.list` | Every available codemod, oldest→newest, as {name, title, version, optional}; returned for --list without running anything. || `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. || `upgrade.status` | A short-circuit outcome with no codemods run (up_to_date, no_codemods, or config_fixable), each carrying the agent-docs summary. |-| `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. |+| `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. || `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. || `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. || `version` | The CLI version, for `astryx --version --json`: {version}. || `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. || `integration.add` | A contribution-writer receipt: kind, name, optional root {path, created}, integration-manifest path, every affected project-relative path, written, and dryRun. || `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}]. |-| `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}. |-| `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}. |-| `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. |-| `integration.doc-conflicts` | The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` \| `error`) and `relationship` (`replaces` \| `extends` \| `accidental`). |+| `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}. |+| `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}. |+| `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. |+| `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`). || `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). || `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). || `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. |diff --git a/packages/cli/api/integration/authoring-checks.mjs b/packages/cli/api/integration/authoring-checks.mjsindex 2328b174dc..e4e6a4efd4 100644--- a/packages/cli/api/integration/authoring-checks.mjs+++ b/packages/cli/api/integration/authoring-checks.mjs@@ -92,6 +92,7 @@ function addErrors(issues, errors, code) {export async function integrationTemplateConflicts(pkg, options = {}) {const {cwd = process.cwd()} = options;const resolved = await resolveIntegration(pkg, cwd);+ const validated = resolved.found;const name = resolved.found ? (resolved.name ?? null) : null;const version = resolved.found ? (resolved.version ?? null) : null;const issues = [...resolved.issues];@@ -99,7 +100,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {if (!resolved.integration || name == null) {return {type: 'integration.template-conflicts',- data: {name, version, conflicts: [], issues},+ data: {validated, name, version, conflicts: [], issues},};}@@ -215,7 +216,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {return {type: 'integration.template-conflicts',- data: {name, version, conflicts, issues},+ data: {validated, name, version, conflicts, issues},};}@@ -228,6 +229,7 @@ export async function integrationTemplateConflicts(pkg, options = {}) {export async function integrationComponentConflicts(pkg, options = {}) {const {cwd = process.cwd()} = options;const resolved = await resolveIntegration(pkg, cwd);+ const validated = resolved.found;const name = resolved.found ? (resolved.name ?? null) : null;const version = resolved.found ? (resolved.version ?? null) : null;const issues = [...resolved.issues];@@ -235,7 +237,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {if (!resolved.integration?.components || name == null) {return {type: 'integration.component-conflicts',- data: {name, version, conflicts: [], issues},+ data: {validated, name, version, conflicts: [], issues},};}@@ -249,7 +251,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {});return {type: 'integration.component-conflicts',- data: {name, version, conflicts: [], issues},+ data: {validated, name, version, conflicts: [], issues},};}@@ -274,7 +276,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {return {type: 'integration.component-conflicts',- data: {name, version, conflicts, issues},+ data: {validated, name, version, conflicts, issues},};}@@ -287,6 +289,7 @@ export async function integrationComponentConflicts(pkg, options = {}) {export async function integrationDocConflicts(pkg, options = {}) {const {cwd = process.cwd()} = options;const resolved = await resolveIntegration(pkg, cwd);+ const validated = resolved.found;const name = resolved.found ? (resolved.name ?? null) : null;const version = resolved.found ? (resolved.version ?? null) : null;const issues = [...resolved.issues];@@ -294,7 +297,7 @@ export async function integrationDocConflicts(pkg, options = {}) {if (!resolved.integration?.docs || name == null) {return {type: 'integration.doc-conflicts',- data: {name, version, findings: [], issues},+ data: {validated, name, version, findings: [], issues},};}@@ -388,6 +391,6 @@ export async function integrationDocConflicts(pkg, options = {}) {return {type: 'integration.doc-conflicts',- data: {name, version, findings, issues},+ data: {validated, name, version, findings, issues},};}diff --git a/packages/cli/api/integration/authoring-checks.type.mjs b/packages/cli/api/integration/authoring-checks.type.mjsindex 3343705108..70031f800c 100644--- a/packages/cli/api/integration/authoring-checks.type.mjs+++ b/packages/cli/api/integration/authoring-checks.type.mjs@@ -49,21 +49,25 @@*//**+ * Each of the three authoring checks reports `validated`: false means no+ * integration manifest was found, so nothing was inspected and the empty+ * conflicts/findings list carries no information about the package.+ ** @typedef {object} IntegrationTemplateConflictResponse* @property {'integration.template-conflicts'} type- * @property {{name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data+ * @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationTemplateConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data*//*** @typedef {object} IntegrationComponentConflictResponse* @property {'integration.component-conflicts'} type- * @property {{name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data+ * @property {{validated: boolean, name: string | null, version: string | null, conflicts: IntegrationComponentConflict[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data*//*** @typedef {object} IntegrationDocConflictResponse* @property {'integration.doc-conflicts'} type- * @property {{name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data+ * @property {{validated: boolean, name: string | null, version: string | null, findings: IntegrationDocFinding[], issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data*/export {};diff --git a/packages/cli/api/integration/integrationComponentConflicts.doc.mjs b/packages/cli/api/integration/integrationComponentConflicts.doc.mjsindex 9cfacd8d74..f2bfc8e707 100644--- a/packages/cli/api/integration/integrationComponentConflicts.doc.mjs+++ b/packages/cli/api/integration/integrationComponentConflicts.doc.mjs@@ -26,7 +26,7 @@ export const doc = {{type: 'integration.component-conflicts',description:- 'Integration identity, structural issues, and Core component-name conflicts with package-qualified commands.',+ '`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.',},],examples: [diff --git a/packages/cli/api/integration/integrationDocConflicts.doc.mjs b/packages/cli/api/integration/integrationDocConflicts.doc.mjsindex e14b42573b..2b4a4c8a4f 100644--- a/packages/cli/api/integration/integrationDocConflicts.doc.mjs+++ b/packages/cli/api/integration/integrationDocConflicts.doc.mjs@@ -26,7 +26,7 @@ export const doc = {{type: 'integration.doc-conflicts',description:- 'Integration identity, structural issues, and classified Core doc relationships.',+ '`validated` (false when no integration manifest was found, so nothing was inspected), integration identity, structural issues, and classified Core doc relationships.',},],examples: [diff --git a/packages/cli/api/integration/integrationTemplateConflicts.doc.mjs b/packages/cli/api/integration/integrationTemplateConflicts.doc.mjsindex a94eb2aa26..413ec9eeea 100644--- a/packages/cli/api/integration/integrationTemplateConflicts.doc.mjs+++ b/packages/cli/api/integration/integrationTemplateConflicts.doc.mjs@@ -41,7 +41,7 @@ export const doc = {{type: 'integration.template-conflicts',description:- 'The integration identity, structural issues, and every Core template-id conflict with a package-qualified command.',+ '`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.',},],examples: [diff --git a/packages/cli/api/integration/validate-integration.mjs b/packages/cli/api/integration/validate-integration.mjsindex 3a4c99f155..cc4712c10e 100644--- a/packages/cli/api/integration/validate-integration.mjs+++ b/packages/cli/api/integration/validate-integration.mjs@@ -427,8 +427,10 @@ export async function validateInstalledIntegration(spec, cwd = process.cwd()) {/*** Unified entry: validate the LOCAL integration (no `pkg`) or an INSTALLED one* (`pkg` given) and return the `integration.validate` envelope. The no-manifest- * local case is guidance, not an error — it comes back with `name: null` and no- * issues so the CLI can print a hint and stay exit-0.+ * local case is guidance, not an error — it comes back with `validated: false`,+ * `name: null` and no issues so the CLI can print a hint and stay exit-0.+ * `validated` is what tells a machine consumer that empty `issues` means+ * "nothing was checked" rather than "checked and healthy".** This is the seam that keeps the CLI a thin wrapper: the command handler calls* this and only chooses how to render (human vs --json) + the exit code.@@ -445,6 +447,9 @@ export async function validateIntegration(pkg, options = {}) {return {type: 'integration.validate',data: {+ // The one bit that separates "checked and clean" from "never checked":+ // with no manifest there is nothing to validate, and issues stays [].+ validated: result.found,name: result.found ? (result.name ?? null) : null,version: result.found ? (result.version ?? null) : null,issues: result.issues,diff --git a/packages/cli/api/integration/validate-integration.test.mjs b/packages/cli/api/integration/validate-integration.test.mjsindex 81df01fd16..88e20833be 100644--- a/packages/cli/api/integration/validate-integration.test.mjs+++ b/packages/cli/api/integration/validate-integration.test.mjs@@ -625,3 +625,58 @@ describe('integration diagnostics are read-only', () => {expect({pkg: snapshot(pkgDir), consumer: snapshot(consumer)}).toEqual(before);});});++describe('validated separates "checked and clean" from "never checked"', () => {+ // `doctor integration validate --json` from a directory with no manifest+ // returned {name: null, version: null, issues: []} and exit 0 — the same+ // envelope a healthy, fully validated integration produces. Wire that into+ // CI from the wrong directory and it is green forever.+ it('is false for every check when no manifest is found', async () => {+ const dir = path.join(tmpDir, 'plain');+ fs.mkdirSync(dir, {recursive: true});+ fs.writeFileSync(+ path.join(dir, 'package.json'),+ JSON.stringify({name: 'plain-app', version: '1.0.0'}),+ );++ const validate = await validateIntegration(undefined, {cwd: dir});+ expect(validate.data.validated).toBe(false);+ expect(validate.data.issues).toEqual([]);++ const templates = await integrationTemplateConflicts(undefined, {cwd: dir});+ const components = await integrationComponentConflicts(undefined, {cwd: dir});+ const docs = await integrationDocConflicts(undefined, {cwd: dir});+ expect(templates.data.validated).toBe(false);+ expect(components.data.validated).toBe(false);+ expect(docs.data.validated).toBe(false);+ });++ it('is true for a real integration, whose empty issue list then means healthy', async () => {+ const dir = path.join(tmpDir, 'integration');+ writePackage(dir, {manifest: 'export default {};\n'});++ const validate = await validateIntegration(undefined, {cwd: dir});+ expect(validate.data.validated).toBe(true);+ expect(validate.data.name).toBe('@acme/widgets');++ const templates = await integrationTemplateConflicts(undefined, {cwd: dir});+ const components = await integrationComponentConflicts(undefined, {cwd: dir});+ const docs = await integrationDocConflicts(undefined, {cwd: dir});+ expect(templates.data.validated).toBe(true);+ expect(components.data.validated).toBe(true);+ expect(docs.data.validated).toBe(true);+ });++ it('is true for an installed package that could not be found — that is a real finding', async () => {+ const consumer = path.join(tmpDir, 'consumer');+ fs.mkdirSync(consumer, {recursive: true});+ fs.writeFileSync(+ path.join(consumer, 'package.json'),+ JSON.stringify({name: 'consumer', version: '1.0.0'}),+ );++ const res = await validateIntegration('@acme/nope', {cwd: consumer});+ expect(res.data.validated).toBe(true);+ expect(summarizeIssues(res.data.issues).errors).toBeGreaterThan(0);+ });+});diff --git a/packages/cli/api/integration/validate-integration.type.mjs b/packages/cli/api/integration/validate-integration.type.mjsindex 5c4a5b8bdd..749e61c732 100644--- a/packages/cli/api/integration/validate-integration.type.mjs+++ b/packages/cli/api/integration/validate-integration.type.mjs@@ -32,9 +32,13 @@/*** `astryx --json doctor integration validate [package]`.+ *+ * `validated` is false in exactly one case: no integration manifest was found,+ * so nothing was checked. An empty `issues` then means "not looked at", not+ * "healthy" — the two are otherwise byte-identical.* @typedef {object} ValidateIntegrationResponse* @property {'integration.validate'} type- * @property {{name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data+ * @property {{validated: boolean, name: string | null, version: string | null, issues: import('../../foundation/integrations/issue').AstryxIntegrationIssue[]}} data*/export {};diff --git a/packages/cli/api/integration/validateIntegration.doc.mjs b/packages/cli/api/integration/validateIntegration.doc.mjsindex 74b160cf6f..abbf94d50d 100644--- a/packages/cli/api/integration/validateIntegration.doc.mjs+++ b/packages/cli/api/integration/validateIntegration.doc.mjs@@ -46,7 +46,7 @@ export const doc = {{type: 'integration.validate',description:- '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}.',+ '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}.',},],examples: [diff --git a/packages/cli/api/upgrade/run/run.mjs b/packages/cli/api/upgrade/run/run.mjsindex 12273ce6e8..3c3a8f2262 100644--- a/packages/cli/api/upgrade/run/run.mjs+++ b/packages/cli/api/upgrade/run/run.mjs@@ -137,6 +137,12 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {}const apply = options.apply ?? false;+ // One fact about the resolved source directory, captured before anything+ // runs. `--path` defaults to `./src`, so a project laid out as `app/` (or a+ // typo) skips every code codemod; without this the receipt is byte-identical+ // to a clean, fully migrated project.+ const sourcePathFound = fs.existsSync(path_);+const currentVersion = /** @type {string} */ (options.from);const installed = detectInstalledTargetVersion(cwd);if (!installed) {@@ -282,6 +288,7 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {refreshed: false,action: 'none',},+ sourcePathFound,filesChanged: coreResult?.totalFilesChanged ?? 0,transformsApplied: coreResult?.totalTransformsApplied ?? 0,modifiedFiles: uniqueFiles(coreResult?.changedFiles).map(file =>@@ -407,6 +414,12 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {refreshed: false,action: 'none',}),+ // A missing source directory is the one way this command can migrate+ // nothing and still look complete: every codemod is skipped, filesChanged+ // stays 0, and errors stays empty. The receipt carries the fact so a+ // machine consumer can tell "nothing needed changing" from "nothing was+ // ever read" — the human text says so via the runner's own error line.+ sourcePathFound,};let integrationResult = null;@@ -642,12 +655,16 @@ export async function run(options = {}, {cwd = process.cwd()} = {}) {}const registryOk = receipt.registryCompositions?.ok ?? true;+ const done = apply ? 'Upgrade complete' : 'Dry run complete';logger.log(protectedFiles.length > 0? 'Upgrade incomplete: protected changes remain\n'- : registryOk- ? (apply ? 'Upgrade complete' : 'Dry run complete') + '\n'- : 'Upgrade finished with unresolved registry items\n',+ : !registryOk+ ? 'Upgrade finished with unresolved registry items\n'+ : sourcePathFound+ ? done + '\n'+ : `${done}, but ${path.relative(cwd, path_) || '.'} does not exist, so no source files were scanned. ` ++ `Pass --path <your source directory> if your code does not live in ./src.\n`,);return {type: 'upgrade.run',diff --git a/packages/cli/api/upgrade/run/run.test.mjs b/packages/cli/api/upgrade/run/run.test.mjsindex c5cd018b55..5664de3a91 100644--- a/packages/cli/api/upgrade/run/run.test.mjs+++ b/packages/cli/api/upgrade/run/run.test.mjs@@ -3,7 +3,8 @@/*** @file Colocated tests for the upgrade.run leaf — the --path scan dir must be* confined to cwd (upgrade rewrites source in place with --apply, so an escaping- * or out-of-tree path must be rejected).+ * or out-of-tree path must be rejected), and the receipt must say whether that+ * dir existed at all.*/import {describe, it, expect, beforeEach, afterEach} from 'vitest';@@ -51,3 +52,46 @@ describe('upgrade.run — --path confinement', () => {).rejects.toMatchObject({code: 'ERR_PATH_TRAVERSAL'});}, SLOW);});++describe('upgrade.run — sourcePathFound', () => {+ let dir;+ beforeEach(() => {+ dir = fs.mkdtempSync(path.join(os.tmpdir(), 'upg-srcpath-'));+ seedProject(dir);+ });+ afterEach(() => fs.rmSync(dir, {recursive: true, force: true}));++ // The receipt for a project whose source lives somewhere other than ./src was+ // byte-identical to a fully migrated one: exit 0, filesChanged 0, errors [].+ // The only signal was a human log line --json suppresses by design.+ it('reports false when the resolved source directory is missing, and still counts nothing', async () => {+ fs.rmSync(path.join(dir, 'src'), {recursive: true, force: true});+ fs.mkdirSync(path.join(dir, 'app'), {recursive: true});+ fs.writeFileSync(path.join(dir, 'app', 'index.ts'), 'const x = 1;\n');++ const res = await upgrade({from: '0.0.1', apply: true}, {cwd: dir});++ expect(res.type).toBe('upgrade.run');+ expect(res.data.sourcePathFound).toBe(false);+ expect(res.data.filesChanged).toBe(0);+ expect(res.data.errors).toEqual([]);+ }, SLOW);++ it('reports true for a source directory that exists', async () => {+ const res = await upgrade({from: '0.0.1', apply: true}, {cwd: dir});++ expect(res.type).toBe('upgrade.run');+ expect(res.data.sourcePathFound).toBe(true);+ }, SLOW);++ it('follows --path, so the right directory under another name reports true', async () => {+ fs.rmSync(path.join(dir, 'src'), {recursive: true, force: true});+ fs.mkdirSync(path.join(dir, 'app'), {recursive: true});+ fs.writeFileSync(path.join(dir, 'app', 'index.ts'), 'const x = 1;\n');++ const res = await upgrade({from: '0.0.1', path: 'app'}, {cwd: dir});++ expect(res.type).toBe('upgrade.run');+ expect(res.data.sourcePathFound).toBe(true);+ }, SLOW);+});diff --git a/packages/cli/api/upgrade/upgrade.doc.mjs b/packages/cli/api/upgrade/upgrade.doc.mjsindex e9f0971e9d..812ac40aa6 100644--- a/packages/cli/api/upgrade/upgrade.doc.mjs+++ b/packages/cli/api/upgrade/upgrade.doc.mjs@@ -123,7 +123,7 @@ export const doc = {{type: 'upgrade.run',description:- 'The terminal run receipt: from, to, codemods (count), integrations, agentDocs, agentDocsRefreshed, registryCompositions (when receipts are found), filesChanged, transformsApplied, modifiedFiles, protectedFiles, declinedCandidates, errors, and complete. When a protected file still requires a change, complete is false and errorCode is ERR_CODEMOD_PROTECTED; the CLI exits nonzero while preserving the structured receipt.',+ 'The terminal run receipt: from, to, codemods (count), integrations, agentDocs, agentDocsRefreshed, registryCompositions (when receipts are found), sourcePathFound (false when the resolved `path` does not exist, so nothing was scanned), filesChanged, transformsApplied, modifiedFiles, protectedFiles, declinedCandidates, errors, and complete. When a protected file still requires a change, complete is false and errorCode is ERR_CODEMOD_PROTECTED; the CLI exits nonzero while preserving the structured receipt.',},],throws: [diff --git a/packages/cli/api/upgrade/upgrade.type.mjs b/packages/cli/api/upgrade/upgrade.type.mjsindex 07da1f1e83..0f7a6419ae 100644--- a/packages/cli/api/upgrade/upgrade.type.mjs+++ b/packages/cli/api/upgrade/upgrade.type.mjs@@ -116,6 +116,7 @@* @property {string[]} data.integrations Integration packages processed in this upgrade (by name/spec).* @property {boolean} data.agentDocsRefreshed* @property {AgentDocsSummary} data.agentDocs+ * @property {boolean} data.sourcePathFound Whether the resolved source directory (`path`, default `./src`) exists. False means no source file was read, so a zero `filesChanged` says nothing about the project being migrated.* @property {RegistryCompositionSummary} [data.registryCompositions]* @property {boolean} [data.complete] False when protected required changes remain.* @property {'ERR_CODEMOD_PROTECTED'} [data.errorCode] Stable incomplete-result code when complete is false.diff --git a/packages/cli/clients/cli/commands/doctor.mjs b/packages/cli/clients/cli/commands/doctor.mjsindex 547a583bff..dadb0cea1f 100644--- a/packages/cli/clients/cli/commands/doctor.mjs+++ b/packages/cli/clients/cli/commands/doctor.mjs@@ -258,10 +258,10 @@ async function runProjectDoctor(program) {async function runIntegrationValidation(program, pkg) {const result = await validateIntegration(pkg);if (program.opts().json) jsonOut(result);- else if (result.data.name === null) {+ else if (!result.data.validated) {emit(text(- 'No astryx.integration.* found next to package.json. ' ++ 'Nothing was validated: no astryx.integration.* found next to package.json. ' +'To validate an installed integration: astryx doctor integration validate <package>',),);@@ -284,10 +284,10 @@ async function runAuthoringCheck(program, pkg, kind) {: await integrationDocConflicts(pkg);if (program.opts().json) jsonOut(result);- else if (result.data.name === null) {+ else if (!result.data.validated) {emit(text(- 'No astryx.integration.* found next to package.json. ' ++ 'Nothing was checked: no astryx.integration.* found next to package.json. ' +`To check an installed integration: astryx doctor integration ${kind} <package>`,),);diff --git a/packages/cli/clients/cli/commands/upgrade.ascii-output.test.mjs b/packages/cli/clients/cli/commands/upgrade.ascii-output.test.mjsindex d85c397d32..da80914b7f 100644--- a/packages/cli/clients/cli/commands/upgrade.ascii-output.test.mjs+++ b/packages/cli/clients/cli/commands/upgrade.ascii-output.test.mjs@@ -84,4 +84,18 @@ describe('upgrade human output is ASCII', () => {'minSize: 200',);});++ // Every fixture above has a real src/, so the completion line for a project+ // whose source is somewhere else was never reached — this suite was green on+ // that path by luck, not by coverage.+ it('reports a source directory that does not exist', async () => {+ fs.rmSync(path.join(tmpDir, 'src'), {recursive: true, force: true});+ fs.mkdirSync(path.join(tmpDir, 'app'), {recursive: true});+ write('app/panel.tsx', 'export const x = 1;\n');++ expect(await nonAsciiLines(['upgrade', '--from', '0.5.0'])).toEqual([]);+ expect(+ await nonAsciiLines(['upgrade', '--from', '0.5.0', '--apply']),+ ).toEqual([]);+ });});diff --git a/packages/cli/foundation/response/response-types.doc.mjs b/packages/cli/foundation/response/response-types.doc.mjsindex 4fd8b3eca0..20ece7cb0f 100644--- a/packages/cli/foundation/response/response-types.doc.mjs+++ b/packages/cli/foundation/response/response-types.doc.mjs@@ -276,7 +276,7 @@ export const doc = {{value: 'upgrade.run',description:- 'The run receipt: from/to versions, codemod count, integrations processed, the agent-docs summary, and (apply mode) filesChanged, transformsApplied, and per-codemod errors.',+ '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.',},// manifest@@ -320,22 +320,22 @@ export const doc = {{value: 'integration.validate',description:- '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}.',+ '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}.',},{value: 'integration.template-conflicts',description:- 'The integration identity, structural issues, and non-blocking Core template-id conflicts as {id, severity: warning, integrationPackage, integrationType, integrationName, coreMatches, message, command}.',+ '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}.',},{value: 'integration.component-conflicts',description:- '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.',+ '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.',},{value: 'integration.doc-conflicts',description:- 'The integration identity, structural issues, and Core doc overlaps. Each finding includes `severity` (`info` | `error`) and `relationship` (`replaces` | `extends` | `accidental`).',+ '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`).',},// layout (XLE/XLO)