@supacloud/cli 0.128.6 → 0.129.1

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.
package/README.md CHANGED
@@ -73,6 +73,10 @@ business policy remains explicit.
73
73
  never automatically migrates or seeds. The command recipe includes a durable host.
74
74
  `app verify-plan --target <module>` lists focused single-file tests without
75
75
  executing them; missing ownership or tests never falls back to the whole suite.
76
+ `app verify --changed --format json` reads the Git worktree, identifies affected
77
+ modules from the compiled graph, and runs only their colocated tests. It requires
78
+ `--changed`, skips tests after a compiler/artifact/database-source failure, and
79
+ returns machine-readable `next` repair commands instead of guessing a full suite.
76
80
 
77
81
  `app compile` and `app check` resolve `supacloud.config.ts` from `--root` (the
78
82
  project directory). `app check` runs the complete compiler and artifact-drift
package/dist/index.js CHANGED
@@ -11987,7 +11987,7 @@ var require_headers = __commonJS(function(exports) {
11987
11987
  b4a.write(buf, encodeOct(opts.uid, 6), 108);
11988
11988
  b4a.write(buf, encodeOct(opts.gid, 6), 116);
11989
11989
  encodeSize(opts.size, buf, 124);
11990
- b4a.write(buf, encodeOct(opts.mtime.getTime() / 1000 | 0, 11), 136);
11990
+ encodeSize(Math.floor(opts.mtime.getTime() / 1000) || 0, buf, 136);
11991
11991
  buf[156] = ZERO_OFFSET + toTypeflag(opts.type);
11992
11992
  if (opts.linkname)
11993
11993
  b4a.write(buf, opts.linkname, 157);
@@ -12144,14 +12144,14 @@ var require_headers = __commonJS(function(exports) {
12144
12144
  return ZEROS.slice(0, n - val.length) + val + " ";
12145
12145
  }
12146
12146
  function encodeSizeBin(num, buf, off) {
12147
- buf[off] = 128;
12147
+ buf[off] = num < 0 ? 255 : 128;
12148
12148
  for (let i = 11;i > 0; i--) {
12149
12149
  buf[off + i] = num & 255;
12150
12150
  num = Math.floor(num / 256);
12151
12151
  }
12152
12152
  }
12153
12153
  function encodeSize(num, buf, off) {
12154
- if (num.toString(8).length > 11) {
12154
+ if (num < 0 || num.toString(8).length > 11) {
12155
12155
  encodeSizeBin(num, buf, off);
12156
12156
  } else {
12157
12157
  b4a.write(buf, encodeOct(num, 11), off);
@@ -12179,7 +12179,7 @@ var require_headers = __commonJS(function(exports) {
12179
12179
  for (i = 0;i < l; i++) {
12180
12180
  sum += tuple[i] * Math.pow(256, i);
12181
12181
  }
12182
- return positive ? sum : -1 * sum;
12182
+ return positive ? sum : -(sum + 1);
12183
12183
  }
12184
12184
  function decodeOct(val, offset, length) {
12185
12185
  val = val.subarray(offset, offset + length);
@@ -12270,6 +12270,7 @@ var require_extract = __commonJS(function(exports, module) {
12270
12270
  this.header = header;
12271
12271
  this.offset = offset;
12272
12272
  this._parent = self;
12273
+ this.on("error", noop);
12273
12274
  }
12274
12275
  _read(cb) {
12275
12276
  if (this.header.size === 0) {
@@ -12309,6 +12310,7 @@ var require_extract = __commonJS(function(exports, module) {
12309
12310
  this._longHeader = false;
12310
12311
  this._callback = noop;
12311
12312
  this._locked = false;
12313
+ this._updating = false;
12312
12314
  this._finished = false;
12313
12315
  this._pax = null;
12314
12316
  this._paxGlobal = null;
@@ -12397,10 +12399,10 @@ var require_extract = __commonJS(function(exports, module) {
12397
12399
  this._gnuLongLinkPath = headers.decodeLongPath(buf, this._filenameEncoding);
12398
12400
  break;
12399
12401
  case "pax-global-header":
12400
- this._paxGlobal = headers.decodePax(buf);
12402
+ this._paxGlobal = validatePax(headers.decodePax(buf));
12401
12403
  break;
12402
12404
  case "pax-header":
12403
- this._pax = this._paxGlobal === null ? headers.decodePax(buf) : Object.assign({}, this._paxGlobal, headers.decodePax(buf));
12405
+ this._pax = this._paxGlobal === null ? validatePax(headers.decodePax(buf)) : Object.assign({}, this._paxGlobal, validatePax(headers.decodePax(buf)));
12404
12406
  break;
12405
12407
  }
12406
12408
  }
@@ -12434,11 +12436,20 @@ var require_extract = __commonJS(function(exports, module) {
12434
12436
  return new Source(this, this._header, this._offset);
12435
12437
  }
12436
12438
  _update() {
12439
+ if (this._updating)
12440
+ return;
12441
+ this._updating = true;
12442
+ const done = this._consume();
12443
+ this._updating = false;
12444
+ if (done)
12445
+ this._continueWrite(null);
12446
+ }
12447
+ _consume() {
12437
12448
  while (this._buffer.buffered > 0 && !this.destroying) {
12438
12449
  if (this._missing > 0) {
12439
12450
  if (this._stream !== null) {
12440
12451
  if (this._consumeStream() === false)
12441
- return;
12452
+ return false;
12442
12453
  continue;
12443
12454
  }
12444
12455
  if (this._longHeader === true) {
@@ -12456,9 +12467,9 @@ var require_extract = __commonJS(function(exports, module) {
12456
12467
  if (this._buffer.buffered < 512)
12457
12468
  break;
12458
12469
  if (this._stream !== null || this._consumeHeader() === false)
12459
- return;
12470
+ return false;
12460
12471
  }
12461
- this._continueWrite(null);
12472
+ return true;
12462
12473
  }
12463
12474
  _continueWrite(err) {
12464
12475
  const cb = this._callback;
@@ -12572,6 +12583,14 @@ var require_extract = __commonJS(function(exports, module) {
12572
12583
  return new Extract(opts);
12573
12584
  };
12574
12585
  function noop() {}
12586
+ function validatePax(pax) {
12587
+ if (hasNull(pax.path) || hasNull(pax.linkpath))
12588
+ throw new Error("Invalid tar header: pax path contains a null byte.");
12589
+ return pax;
12590
+ }
12591
+ function hasNull(str) {
12592
+ return typeof str === "string" && str.indexOf("\x00") !== -1;
12593
+ }
12575
12594
  function overflow(size) {
12576
12595
  size &= 511;
12577
12596
  return size && 512 - size;
@@ -12649,7 +12668,7 @@ var require_pack = __commonJS(function(exports, module) {
12649
12668
  if (!this._isLinkname) {
12650
12669
  this._pack._encode(this.header);
12651
12670
  }
12652
- if (this._isVoid) {
12671
+ if (this._isVoid && !this._isLinkname) {
12653
12672
  this._finish();
12654
12673
  this._continuePack(null);
12655
12674
  }
@@ -16657,7 +16676,7 @@ var init_developer_experience_tools = __esm(() => {
16657
16676
  });
16658
16677
 
16659
16678
  // src/shared/tools/deploy-tools.ts
16660
- import { access as access2, lstat as lstat8, mkdtemp as mkdtemp3, opendir as opendir2, readFile as readFile14, realpath as realpath6, rm as rm4, writeFile as writeFile13 } from "node:fs/promises";
16679
+ import { access as access2, lstat as lstat8, mkdtemp as mkdtemp3, opendir as opendir2, readFile as readFile14, realpath as realpath7, rm as rm4, writeFile as writeFile13 } from "node:fs/promises";
16661
16680
  import { spawn as spawn3 } from "node:child_process";
16662
16681
  import { createHash as createHash14 } from "node:crypto";
16663
16682
  import { tmpdir as tmpdir5 } from "node:os";
@@ -17015,9 +17034,9 @@ async function publishConfiguredFrontend2(http, projectRef, configRoot, target,
17015
17034
  if (!skipBuild) {
17016
17035
  await runBuild2(buildCommand, projectDirectory, build.env, json);
17017
17036
  }
17018
- const actualOutput = await realpath6(outputDirectory).catch(() => null);
17037
+ const actualOutput = await realpath7(outputDirectory).catch(() => null);
17019
17038
  if (actualOutput !== null)
17020
- resolveInsideProject2(await realpath6(projectDirectory), actualOutput);
17039
+ resolveInsideProject2(await realpath7(projectDirectory), actualOutput);
17021
17040
  const collected = await collectArchiveFiles2(outputDirectory);
17022
17041
  return publishFrontendRelease(http, projectRef, selected.id, () => createCollectedFrontendArchive2(outputDirectory, collected), collected.treeSha256);
17023
17042
  }
@@ -17069,12 +17088,12 @@ var init_deploy_tools = __esm(() => {
17069
17088
  });
17070
17089
 
17071
17090
  // src/shared/tools/workspace-plan.ts
17072
- import { execFile as execFile2 } from "node:child_process";
17091
+ import { execFile as execFile3 } from "node:child_process";
17073
17092
  import { createHash as createHash15 } from "node:crypto";
17074
17093
  import { constants as constants2 } from "node:fs";
17075
- import { lstat as lstat9, open as open4, readdir as readdir10, realpath as realpath7 } from "node:fs/promises";
17094
+ import { lstat as lstat9, open as open4, readdir as readdir10, realpath as realpath8 } from "node:fs/promises";
17076
17095
  import { isAbsolute as isAbsolute10, join as join27, relative as relative14, resolve as resolve34 } from "node:path";
17077
- import { promisify as promisify2 } from "node:util";
17096
+ import { promisify as promisify3 } from "node:util";
17078
17097
  function isNodeError(error, code) {
17079
17098
  return error instanceof Error && "code" in error && error.code === code;
17080
17099
  }
@@ -17335,11 +17354,11 @@ async function pathKind(rootReal, relativePath) {
17335
17354
  if (!isNodeError(error, "ENOENT"))
17336
17355
  throw error;
17337
17356
  const parent = index === 0 ? rootReal : join27(rootReal, segments.slice(0, index).join("/"));
17338
- const realParent = await realpath7(parent).catch(() => null);
17357
+ const realParent = await realpath8(parent).catch(() => null);
17339
17358
  return realParent && inside3(rootReal, realParent) ? "ok" : "outside";
17340
17359
  }
17341
17360
  }
17342
- const real = await realpath7(current).catch(() => null);
17361
+ const real = await realpath8(current).catch(() => null);
17343
17362
  return real && inside3(rootReal, real) ? "ok" : "outside";
17344
17363
  }
17345
17364
  async function listDirectories(rootReal) {
@@ -17404,7 +17423,7 @@ async function git(cwd, args) {
17404
17423
  env[key] = value;
17405
17424
  }
17406
17425
  env.GIT_OPTIONAL_LOCKS = "0";
17407
- const { stdout } = await execFileAsync2("git", ["-c", "core.fsmonitor=", "-c", "core.fsmonitorHookVersion=0", ...args], {
17426
+ const { stdout } = await execFileAsync3("git", ["-c", "core.fsmonitor=", "-c", "core.fsmonitorHookVersion=0", ...args], {
17408
17427
  cwd,
17409
17428
  encoding: "utf8",
17410
17429
  maxBuffer: 1024 * 1024,
@@ -17425,7 +17444,7 @@ async function workspaceTracksFile(root, path) {
17425
17444
  return (await git(root, ["cat-file", "-t", `HEAD:${path}`]).catch(() => "")).trim() === "blob";
17426
17445
  }
17427
17446
  async function readWorkspaceChangedList(root, changed) {
17428
- const rootReal = await realpath7(resolve34(root));
17447
+ const rootReal = await realpath8(resolve34(root));
17429
17448
  const listRelative = relative14(rootReal, resolve34(rootReal, changed)).replaceAll("\\", "/");
17430
17449
  if (!safeRelative(listRelative) || await pathKind(rootReal, listRelative) !== "ok") {
17431
17450
  throw new WorkspacePlanError("invalid-changed-path", "The changed-file list must be a regular file inside the workspace");
@@ -17762,7 +17781,7 @@ async function createWorkspacePlan(input) {
17762
17781
  return blockedPlan(null, "invalid-environment", "The selected environment is not a valid application environment id");
17763
17782
  let rootReal;
17764
17783
  try {
17765
- rootReal = await realpath7(resolve34(input.root));
17784
+ rootReal = await realpath8(resolve34(input.root));
17766
17785
  } catch {
17767
17786
  return blockedPlan(environment, "workspace-root-missing", "The workspace root does not exist");
17768
17787
  }
@@ -17997,14 +18016,14 @@ async function createWorkspacePlan(input) {
17997
18016
  limits: WORKSPACE_PLAN_LIMITS
17998
18017
  });
17999
18018
  }
18000
- var execFileAsync2, WORKSPACE_CONFIG_FILE = "supacloud.workspace.json", WORKSPACE_CONFIG_SCHEMA = "supacloud.workspace.v1", WORKSPACE_PLAN_SCHEMA = "supacloud.workspace-plan.v1", PROJECT_REF_PATTERN6, PACKAGE_NAME_PATTERN, BUILD_INTENT_PATTERN, GIT_REF_PATTERN, DEPENDENCY_FIELDS, WORKSPACE_PLAN_LIMITS, FORBIDDEN_KEYS, WorkspacePlanError, configSchema, workspaceToolSchema;
18019
+ var execFileAsync3, WORKSPACE_CONFIG_FILE = "supacloud.workspace.json", WORKSPACE_CONFIG_SCHEMA = "supacloud.workspace.v1", WORKSPACE_PLAN_SCHEMA = "supacloud.workspace-plan.v1", PROJECT_REF_PATTERN6, PACKAGE_NAME_PATTERN, BUILD_INTENT_PATTERN, GIT_REF_PATTERN, DEPENDENCY_FIELDS, WORKSPACE_PLAN_LIMITS, FORBIDDEN_KEYS, WorkspacePlanError, configSchema, workspaceToolSchema;
18001
18020
  var init_workspace_plan = __esm(() => {
18002
18021
  init_build();
18003
18022
  init_value2();
18004
18023
  init_src();
18005
18024
  init_schema7();
18006
18025
  init_tool_server();
18007
- execFileAsync2 = promisify2(execFile2);
18026
+ execFileAsync3 = promisify3(execFile3);
18008
18027
  PROJECT_REF_PATTERN6 = /^[a-z0-9-]{1,20}$/;
18009
18028
  PACKAGE_NAME_PATTERN = /^(?:@[a-z0-9._-]+\/)?[a-z0-9._-]+$/;
18010
18029
  BUILD_INTENT_PATTERN = /^[A-Za-z0-9 ._"':=,@/^~+-]+$/;
@@ -19546,7 +19565,7 @@ var ACTION_POLICY = {
19546
19565
  init: { local: ["init"] },
19547
19566
  env: { local: ["list", "check", "sync"] },
19548
19567
  app: {
19549
- local: ["init", "generate", "infer", "dev", "watch", "verify-plan", "compile", "check", "graph", "explain", "export-tools", "context", "lens", "doctor", "fix", "plan", "build"],
19568
+ local: ["init", "generate", "infer", "dev", "watch", "verify-plan", "verify", "compile", "check", "graph", "explain", "export-tools", "context", "lens", "doctor", "fix", "plan", "build"],
19550
19569
  read: ["status", "evidence", "logs", "transfer-plan", "promote-plan", "rollback-plan", "history", "deploy-plan", "diff", "promote-status", "preview-plan", "previews", "preview-list", "preview-status"],
19551
19570
  write: ["release", "upload", "configure", "transfer", "promote", "promote-reconcile", "deploy", "rollback", "reconcile", "retire", "preview", "preview-create", "preview-reconcile", "preview-cleanup", "preview-pr"]
19552
19571
  },
@@ -30008,8 +30027,10 @@ init_src();
30008
30027
  init_schema7();
30009
30028
  init_tool_server();
30010
30029
  import { existsSync as existsSync13, readFileSync as readFileSync10 } from "node:fs";
30011
- import { mkdir as mkdir6, readFile as readFile5, readdir as readdir5, writeFile as writeFile5 } from "node:fs/promises";
30030
+ import { mkdir as mkdir6, readFile as readFile5, readdir as readdir5, realpath as realpath5, writeFile as writeFile5 } from "node:fs/promises";
30031
+ import { execFile as execFile2 } from "node:child_process";
30012
30032
  import { basename as basename8, dirname as dirname9, isAbsolute as isAbsolute6, join as join15, relative as relative8, resolve as resolve20 } from "node:path";
30033
+ import { promisify as promisify2 } from "node:util";
30013
30034
  import {
30014
30035
  applyDiagnosticFix,
30015
30036
  buildDeliveryProject,
@@ -30156,25 +30177,25 @@ var starter_metadata_default = {
30156
30177
  generatedBy: "supacloud/starter-metadata-v1",
30157
30178
  packages: {
30158
30179
  compiler: {
30159
- version: "0.66.2"
30180
+ version: "0.67.0"
30160
30181
  },
30161
30182
  app: {
30162
- version: "0.39.5",
30183
+ version: "0.40.0",
30163
30184
  dependencies: {
30164
30185
  rxjs: "7.8.2"
30165
30186
  }
30166
30187
  },
30167
30188
  elysia: {
30168
- version: "0.42.6"
30189
+ version: "0.43.0"
30169
30190
  },
30170
30191
  commands: {
30171
- version: "0.12.1"
30192
+ version: "0.13.0"
30172
30193
  },
30173
30194
  contracts: {
30174
- version: "0.16.3"
30195
+ version: "0.17.0"
30175
30196
  },
30176
30197
  db: {
30177
- version: "0.26.1",
30198
+ version: "0.27.0",
30178
30199
  dependencies: {},
30179
30200
  devDependencies: {},
30180
30201
  peerDependencies: {
@@ -30199,7 +30220,7 @@ var starter_metadata_default = {
30199
30220
  }
30200
30221
  },
30201
30222
  sdk: {
30202
- version: "0.48.7",
30223
+ version: "0.49.0",
30203
30224
  peerDependencies: {
30204
30225
  "@supabase/supabase-js": "^2.118.0"
30205
30226
  }
@@ -30612,7 +30633,7 @@ function baseTemplateFiles(name, sdkDependencies) {
30612
30633
  scripts: {
30613
30634
  compile: "bun --no-env-file node_modules/@supacloud/compiler/dist/cli.js compile",
30614
30635
  "check:generated": "bun --no-env-file node_modules/@supacloud/compiler/dist/cli.js check",
30615
- typecheck: "tsc --noEmit",
30636
+ typecheck: "bun check --no-script",
30616
30637
  inspect: "bun --no-env-file node_modules/@supacloud/compiler/dist/cli.js graph --json",
30617
30638
  check: "bun run compile && bun run check:generated && bun run typecheck && bun run test",
30618
30639
  test: "bun run compile && bun --no-env-file scripts/environment.ts test bun test",
@@ -36922,6 +36943,17 @@ async function applyScaffoldWrites(plan) {
36922
36943
 
36923
36944
  // src/shared/tools/app-tools.ts
36924
36945
  init_configuration_tools();
36946
+ var execFileAsync2 = promisify2(execFile2);
36947
+ function readGitOutput(root, args) {
36948
+ const result = Bun.spawnSync(["git", "-C", root, ...args], {
36949
+ stdout: "pipe",
36950
+ stderr: "pipe"
36951
+ });
36952
+ if (result.exitCode !== 0) {
36953
+ throw new Error(result.stderr.toString().trim() || `git ${args.join(" ")} failed`);
36954
+ }
36955
+ return result.stdout.toString();
36956
+ }
36925
36957
  var REMOTE_APP_ACTIONS = {
36926
36958
  upload: "upload_release",
36927
36959
  "transfer-plan": "get_release_transfer_plan",
@@ -37358,6 +37390,51 @@ async function projectCompileConfig(args) {
37358
37390
  const result = await checkProject(compileOptions);
37359
37391
  return { root, sourceDir: compileOptions.rootDir, configFile, outDir, result };
37360
37392
  }
37393
+ function createVibecodingTaskPack(pack, verification) {
37394
+ const commands = pack.modules.flatMap((module) => module.commands);
37395
+ const jobs = pack.modules.flatMap((module) => module.jobs ?? []);
37396
+ const invariants = [
37397
+ "Edit only ownedFiles and keep generated artifacts read-only.",
37398
+ "Business permissions, tenant rules and persistence remain explicit application inputs.",
37399
+ "Write operations use Command governance; external side effects require receipt reconciliation.",
37400
+ ...commands.map((command) => `${command.name}: permission=${command.permission ?? "required-input"}, transaction=${command.transaction}, idempotency=${command.idempotency}`),
37401
+ ...jobs.map((job) => `${job.name}: background execution must declare its host and retry/idempotency policy.`)
37402
+ ];
37403
+ const requiredInputs = [
37404
+ ...commands.filter((command) => !command.permission).map((command) => `${command.name}: explicit permission`),
37405
+ ...commands.filter((command) => command.transaction === "required" && !command.rpc).map((command) => `${command.name}: persistent transaction adapter`),
37406
+ ...commands.filter((command) => command.rpc && command.transaction === "required").map((command) => `${command.name}: verify the named RPC transaction contract`)
37407
+ ];
37408
+ const next = [
37409
+ ["supacloud", "app", "doctor", "--target", pack.subject, "--format", "json"],
37410
+ ["supacloud", "app", "compile"],
37411
+ ...verification.commands
37412
+ ];
37413
+ return {
37414
+ schema: "supacloud.vibecoding-task.v1",
37415
+ intent: `Change the ${pack.subject} application boundary while preserving its declared contracts and governance.`,
37416
+ ownedFiles: verification.files,
37417
+ referenceFiles: pack.files,
37418
+ invariants,
37419
+ allowedCommands: [
37420
+ "supacloud app context --format json",
37421
+ "supacloud app generate",
37422
+ "supacloud app doctor",
37423
+ "supacloud app fix",
37424
+ "supacloud app compile",
37425
+ "supacloud app verify --changed",
37426
+ "bun test <focused-file>",
37427
+ "git diff --check"
37428
+ ],
37429
+ requiredInputs,
37430
+ verification: {
37431
+ tests: verification.tests,
37432
+ commands: verification.commands,
37433
+ releaseGates: verification.releaseOnly
37434
+ },
37435
+ next
37436
+ };
37437
+ }
37361
37438
  async function readAllowedDependencies(root) {
37362
37439
  const path = join15(root, "package.json");
37363
37440
  if (!existsSync13(path)) {
@@ -37401,6 +37478,7 @@ async function runContext(args) {
37401
37478
  const execution = args.events === undefined ? undefined : createExecutionContextPack({ ...result.graph, diagnostics: result.diagnostics }, subject, await readExecutionMetadata(resolve20(root, args.events)), args.request_id);
37402
37479
  const verification = await createVerificationPlan(root, result.graph, pack.subject, sourceDir);
37403
37480
  const repairs = createDiagnosticRepairPlan(pack.diagnostics);
37481
+ const task = createVibecodingTaskPack(pack, verification);
37404
37482
  const workflow = {
37405
37483
  root,
37406
37484
  sourceRoot: sourceDir,
@@ -37430,8 +37508,11 @@ async function runContext(args) {
37430
37508
  },
37431
37509
  executed: false
37432
37510
  };
37433
- return textResult2(args.format === "json" ? JSON.stringify({ ...pack, ...execution ? { execution } : {}, workflow }, null, 2) : [
37511
+ return textResult2(args.format === "json" ? JSON.stringify({ ...pack, ...execution ? { execution } : {}, task, workflow }, null, 2) : [
37434
37512
  formatModuleContextPack(pack),
37513
+ ` task: ${task.intent}`,
37514
+ ` owned files: ${task.ownedFiles.join(", ") || "-"}`,
37515
+ ` required inputs: ${task.requiredInputs.join(", ") || "-"}`,
37435
37516
  ` edit files (project-relative): ${workflow.editFiles.join(", ") || "-"}`,
37436
37517
  ` focused tests: ${verification.tests.join(", ") || "-"}`,
37437
37518
  ...verification.manual.map((item) => ` manual: ${item}`),
@@ -37988,6 +38069,123 @@ async function runCheck(args) {
37988
38069
  ].join(`
37989
38070
  `), hasError);
37990
38071
  }
38072
+ function projectRelativePath(root, path) {
38073
+ const value = relative8(root, path).replaceAll("\\", "/");
38074
+ return value === ".." || value.startsWith("../") || value.startsWith("/") ? undefined : value;
38075
+ }
38076
+ async function readChangedProjectFiles(root) {
38077
+ try {
38078
+ const repoRootOutput = readGitOutput(root, ["rev-parse", "--show-toplevel"]);
38079
+ const repoRoot = resolve20(repoRootOutput.trim());
38080
+ const [realRepoRoot, realProjectRoot] = await Promise.all([realpath5(repoRoot), realpath5(root)]);
38081
+ const diff = readGitOutput(repoRoot, ["diff", "--name-only", "HEAD", "--"]);
38082
+ const untracked = readGitOutput(repoRoot, ["ls-files", "--others", "--exclude-standard"]);
38083
+ const paths = `${diff}
38084
+ ${untracked}`.split(/\r?\n/).map((entry) => entry.trim()).filter(Boolean).map((entry) => projectRelativePath(realProjectRoot, resolve20(realRepoRoot, entry))).filter((entry) => entry !== undefined);
38085
+ return [...new Set(paths)].sort();
38086
+ } catch {
38087
+ throw new Error("app verify --changed requires a Git worktree with a readable HEAD");
38088
+ }
38089
+ }
38090
+ function moduleOwnsChangedPath(module, graph, projectRoot, sourceDir, changedPath) {
38091
+ const changed = resolve20(projectRoot, changedPath);
38092
+ const files = [
38093
+ module.file,
38094
+ ...module.providers.map((provider) => provider.file),
38095
+ ...module.controllers.map((controller) => controller.file),
38096
+ ...module.featureSpec?.file ? [module.featureSpec.file] : [],
38097
+ ...graph.moduleHandlerFiles?.[module.name] ?? []
38098
+ ].map((file) => resolve20(sourceDir, file));
38099
+ return files.some((file) => changed === file);
38100
+ }
38101
+ async function runFocusedVerificationTests(root, tests) {
38102
+ if (tests.length === 0)
38103
+ return { executed: false, ok: true, exitCode: null };
38104
+ const executable = process.versions.bun ? process.execPath : "bun";
38105
+ try {
38106
+ await execFileAsync2(executable, ["--no-env-file", "test", ...tests], {
38107
+ cwd: root,
38108
+ encoding: "utf8",
38109
+ maxBuffer: 2 * 1024 * 1024
38110
+ });
38111
+ return { executed: true, ok: true, exitCode: 0 };
38112
+ } catch (error) {
38113
+ const exitCode = error && typeof error === "object" && "code" in error && typeof error.code === "number" ? error.code : 1;
38114
+ return { executed: true, ok: false, exitCode };
38115
+ }
38116
+ }
38117
+ async function runDiffCheck(root) {
38118
+ try {
38119
+ await execFileAsync2("git", ["-C", root, "diff", "--check"], {
38120
+ encoding: "utf8",
38121
+ maxBuffer: 512 * 1024
38122
+ });
38123
+ return { ok: true, exitCode: 0 };
38124
+ } catch (error) {
38125
+ const exitCode = error && typeof error === "object" && "code" in error && typeof error.code === "number" ? error.code : 1;
38126
+ return { ok: false, exitCode };
38127
+ }
38128
+ }
38129
+ async function runVerify(args) {
38130
+ if (args.changed !== true) {
38131
+ throw new Error("app verify requires --changed; use app verify-plan --target <module> for a read-only plan");
38132
+ }
38133
+ const { root, sourceDir, outDir, result } = await projectCompileConfig(args);
38134
+ const changed = await readChangedProjectFiles(root);
38135
+ const affectedModules = result.graph.modules.filter((module) => changed.some((path) => moduleOwnsChangedPath(module, result.graph, root, sourceDir, path))).map((module) => module.name).sort();
38136
+ const plans = await Promise.all(affectedModules.map((target) => createVerificationPlan(root, result.graph, target, sourceDir)));
38137
+ const tests = [...new Set(plans.flatMap((plan) => plan.tests))].sort();
38138
+ const diagnosticError = result.diagnostics.some((diagnostic) => diagnostic.severity === "error");
38139
+ const artifactError = result.mismatches.length > 0;
38140
+ const database = checkAppDatabaseSources(root);
38141
+ const databaseError = database?.ok === false;
38142
+ const testsResult = diagnosticError || artifactError || databaseError ? { executed: false, ok: false, exitCode: null } : await runFocusedVerificationTests(root, tests);
38143
+ const diff = await runDiffCheck(root);
38144
+ const ok = !diagnosticError && !artifactError && !databaseError && testsResult.ok && diff.ok;
38145
+ const next = ok ? [["git", "diff", "--check"], ["supacloud", "app", "check", "--format", "json"]] : [["supacloud", "app", "doctor", "--format", "json"], ["supacloud", "app", "context", "--format", "json"]];
38146
+ const payload = {
38147
+ version: 1,
38148
+ schema: "supacloud.vibecoding-verification.v1",
38149
+ ok,
38150
+ root,
38151
+ sourceRoot: sourceDir,
38152
+ generatedDir: outDir,
38153
+ changed,
38154
+ affectedModules,
38155
+ tests,
38156
+ plans,
38157
+ diagnostics: result.diagnostics,
38158
+ mismatches: result.mismatches,
38159
+ ...database ? { database } : {},
38160
+ checks: {
38161
+ compiler: { ok: !diagnosticError },
38162
+ generatedArtifacts: { ok: !artifactError },
38163
+ database: database ? { ok: !databaseError } : { ok: true, skipped: true },
38164
+ focusedTests: testsResult,
38165
+ diffCheck: diff
38166
+ },
38167
+ next
38168
+ };
38169
+ if (args.format === "json")
38170
+ return textResult2(JSON.stringify(payload, null, 2), !ok);
38171
+ const lines = [
38172
+ `app verify --changed: ${ok ? "PASS" : "FAIL"}`,
38173
+ ` changed: ${changed.join(", ") || "-"}`,
38174
+ ` affected modules: ${affectedModules.join(", ") || "-"}`,
38175
+ ` focused tests: ${tests.join(", ") || "-"}`,
38176
+ ` compiler: ${diagnosticError ? "FAIL" : "OK"}`,
38177
+ ` generated artifacts: ${artifactError ? "FAIL" : "OK"}`,
38178
+ ` focused tests: ${testsResult.executed ? testsResult.ok ? "OK" : `FAIL (exit ${testsResult.exitCode ?? 1})` : "SKIPPED"}`,
38179
+ ` git diff --check: ${diff.ok ? "OK" : "FAIL"}`,
38180
+ ...result.diagnostics.map(formatDiagnostic),
38181
+ ...result.mismatches.map((path) => `generated artifact mismatch: ${path}`),
38182
+ ...plans.flatMap((plan) => plan.manual.map((item) => `manual: ${plan.target}: ${item}`)),
38183
+ "",
38184
+ ok ? "Changed-scope verification passed." : "Verification failed. Run app doctor/context for the next repair step."
38185
+ ];
38186
+ return textResult2(lines.join(`
38187
+ `), !ok);
38188
+ }
37991
38189
  async function readManifest(root, args) {
37992
38190
  const config = await loadSupacloudConfig(root);
37993
38191
  const outDir = args.out_dir ? resolve20(root, args.out_dir) : resolveSupacloudConfig(config, root).outDir;
@@ -38678,6 +38876,9 @@ async function runAppTool(request, options = {}) {
38678
38876
  if (request.database_url !== undefined && request.action !== "dev" && request.action !== "watch") {
38679
38877
  throw new ScaffoldError("SCAFFOLD_OPTION_INVALID", "--database-url applies only to app dev --profile integration");
38680
38878
  }
38879
+ if (request.changed !== undefined && request.action !== "verify") {
38880
+ throw new ScaffoldError("SCAFFOLD_OPTION_INVALID", "--changed applies only to app verify");
38881
+ }
38681
38882
  if (request.action === "promote") {
38682
38883
  const delegate = options.getApplications?.();
38683
38884
  if (!delegate)
@@ -38742,6 +38943,8 @@ async function runAppTool(request, options = {}) {
38742
38943
  }
38743
38944
  case "infer":
38744
38945
  return runInference(request);
38946
+ case "verify":
38947
+ return runVerify(request);
38745
38948
  case "dev":
38746
38949
  case "watch":
38747
38950
  return runAppDev(request, options);
@@ -38796,6 +38999,7 @@ function registerAppTools(server, options = {}) {
38796
38999
  "dev",
38797
39000
  "watch",
38798
39001
  "verify-plan",
39002
+ "verify",
38799
39003
  "compile",
38800
39004
  "check",
38801
39005
  "graph",
@@ -38862,6 +39066,7 @@ function registerAppTools(server, options = {}) {
38862
39066
  database_url: optional(String2(), "[dev] Explicit loopback integration URL; watch/once only inspect its shape"),
38863
39067
  target: optional(String2(), "[explain/context/lens/verify-plan] Provider class name / token name / command name / job name / module name"),
38864
39068
  detail: optional(Boolean2(), "[lens] Include the per-node value payload (larger output)"),
39069
+ changed: optional(Boolean2(), "[verify] Read changed files from Git and run only affected focused tests"),
38865
39070
  events: optional(String2(), "[context] Project-relative execution metadata JSON or generated JSON-lines file"),
38866
39071
  request_id: optional(String2(), "[context] Opaque request ID or Workflow run ID selected from --events"),
38867
39072
  fix: optional(String2(), "[fix] Path to a DiagnosticFix JSON file produced by `doctor --format json`"),
@@ -41745,7 +41950,7 @@ init_frontend_release_control();
41745
41950
  init_deployment_upgrade();
41746
41951
  init_project_deployment();
41747
41952
  init_developer_experience_tools();
41748
- import { access, lstat as lstat6, mkdtemp as mkdtemp2, opendir, readFile as readFile9, realpath as realpath5, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
41953
+ import { access, lstat as lstat6, mkdtemp as mkdtemp2, opendir, readFile as readFile9, realpath as realpath6, rm as rm3, writeFile as writeFile9 } from "node:fs/promises";
41749
41954
  import { spawn as spawn2 } from "node:child_process";
41750
41955
  import { createHash as createHash12 } from "node:crypto";
41751
41956
  import { tmpdir as tmpdir4 } from "node:os";
@@ -42186,9 +42391,9 @@ async function publishConfiguredFrontend(http, projectRef, configRoot, target, s
42186
42391
  if (!skipBuild) {
42187
42392
  await runBuild(buildCommand, projectDirectory, build.env, json);
42188
42393
  }
42189
- const actualOutput = await realpath5(outputDirectory).catch(() => null);
42394
+ const actualOutput = await realpath6(outputDirectory).catch(() => null);
42190
42395
  if (actualOutput !== null)
42191
- resolveInsideProject(await realpath5(projectDirectory), actualOutput);
42396
+ resolveInsideProject(await realpath6(projectDirectory), actualOutput);
42192
42397
  const collected = await collectArchiveFiles(outputDirectory);
42193
42398
  return publishFrontendRelease(http, projectRef, selected.id, () => createCollectedFrontendArchive(outputDirectory, collected), collected.treeSha256);
42194
42399
  }
@@ -43275,13 +43480,13 @@ init_value2();
43275
43480
  init_src();
43276
43481
  init_schema7();
43277
43482
  init_tool_server();
43278
- import { execFile as execFile3 } from "node:child_process";
43483
+ import { execFile as execFile4 } from "node:child_process";
43279
43484
  import { createHash as createHash17 } from "node:crypto";
43280
43485
  import { constants as constants3 } from "node:fs";
43281
- import { lstat as lstat10, open as open5, readdir as readdir11, realpath as realpath8 } from "node:fs/promises";
43486
+ import { lstat as lstat10, open as open5, readdir as readdir11, realpath as realpath9 } from "node:fs/promises";
43282
43487
  import { isAbsolute as isAbsolute11, join as join29, relative as relative15, resolve as resolve37 } from "node:path";
43283
- import { promisify as promisify3 } from "node:util";
43284
- var execFileAsync3 = promisify3(execFile3);
43488
+ import { promisify as promisify4 } from "node:util";
43489
+ var execFileAsync4 = promisify4(execFile4);
43285
43490
  var WORKSPACE_CONFIG_FILE2 = "supacloud.workspace.json";
43286
43491
  var WORKSPACE_CONFIG_SCHEMA2 = "supacloud.workspace.v1";
43287
43492
  var WORKSPACE_PLAN_SCHEMA2 = "supacloud.workspace-plan.v1";
@@ -43607,11 +43812,11 @@ async function pathKind2(rootReal, relativePath) {
43607
43812
  if (!isNodeError2(error, "ENOENT"))
43608
43813
  throw error;
43609
43814
  const parent = index === 0 ? rootReal : join29(rootReal, segments.slice(0, index).join("/"));
43610
- const realParent = await realpath8(parent).catch(() => null);
43815
+ const realParent = await realpath9(parent).catch(() => null);
43611
43816
  return realParent && inside4(rootReal, realParent) ? "ok" : "outside";
43612
43817
  }
43613
43818
  }
43614
- const real = await realpath8(current).catch(() => null);
43819
+ const real = await realpath9(current).catch(() => null);
43615
43820
  return real && inside4(rootReal, real) ? "ok" : "outside";
43616
43821
  }
43617
43822
  async function listDirectories2(rootReal) {
@@ -43676,7 +43881,7 @@ async function git2(cwd, args) {
43676
43881
  env[key] = value;
43677
43882
  }
43678
43883
  env.GIT_OPTIONAL_LOCKS = "0";
43679
- const { stdout } = await execFileAsync3("git", ["-c", "core.fsmonitor=", "-c", "core.fsmonitorHookVersion=0", ...args], {
43884
+ const { stdout } = await execFileAsync4("git", ["-c", "core.fsmonitor=", "-c", "core.fsmonitorHookVersion=0", ...args], {
43680
43885
  cwd,
43681
43886
  encoding: "utf8",
43682
43887
  maxBuffer: 1024 * 1024,
@@ -44014,7 +44219,7 @@ async function createWorkspacePlan2(input) {
44014
44219
  return blockedPlan2(null, "invalid-environment", "The selected environment is not a valid application environment id");
44015
44220
  let rootReal;
44016
44221
  try {
44017
- rootReal = await realpath8(resolve37(input.root));
44222
+ rootReal = await realpath9(resolve37(input.root));
44018
44223
  } catch {
44019
44224
  return blockedPlan2(environment, "workspace-root-missing", "The workspace root does not exist");
44020
44225
  }
@@ -44300,7 +44505,7 @@ async function runWorkspacePlan(args, cwd = process.cwd()) {
44300
44505
  const root = resolve37(typeof args.root === "string" ? args.root : cwd);
44301
44506
  try {
44302
44507
  if (hasChanged) {
44303
- const rootReal = await realpath8(root);
44508
+ const rootReal = await realpath9(root);
44304
44509
  const listRelative = relative15(rootReal, resolve37(rootReal, args.changed)).replaceAll("\\", "/");
44305
44510
  const environment = Check2(ApplicationIdSchema, args.environment) ? args.environment : null;
44306
44511
  if (!safeRelative2(listRelative) || await pathKind2(rootReal, listRelative) !== "ok") {
@@ -44481,7 +44686,7 @@ async function runProjectDeployment(http, args) {
44481
44686
  // package.json
44482
44687
  var package_default = {
44483
44688
  name: "@supacloud/cli",
44484
- version: "0.128.6",
44689
+ version: "0.129.1",
44485
44690
  description: "Project-scoped CLI for SupaCloud users",
44486
44691
  type: "module",
44487
44692
  main: "./dist/index.js",
@@ -44533,23 +44738,23 @@ var package_default = {
44533
44738
  directory: "packages/cli"
44534
44739
  },
44535
44740
  dependencies: {
44536
- "@supacloud/compiler": "^0.66.2",
44741
+ "@supacloud/compiler": "^0.67.0",
44537
44742
  "@supacloud/delivery": "0.30.0",
44538
- "@supacloud/db": "0.26.1",
44743
+ "@supacloud/db": "0.27.0",
44539
44744
  typebox: "1.4.3"
44540
44745
  },
44541
44746
  overrides: {
44542
- "@supacloud/contracts": "0.16.3",
44747
+ "@supacloud/contracts": "0.17.0",
44543
44748
  "@supacloud/delivery": "0.30.0",
44544
44749
  "@graphql-tools/utils": "^12.0.4",
44545
- "@supacloud/compiler": "^0.66.2",
44546
- "@supacloud/db": "0.26.1",
44750
+ "@supacloud/compiler": "^0.67.0",
44751
+ "@supacloud/db": "0.27.0",
44547
44752
  "deepmerge-ts": "8.0.2",
44548
44753
  prisma: "6.19.3"
44549
44754
  },
44550
44755
  devDependencies: {
44551
44756
  "@supabase/supabase-js": "2.118.0",
44552
- "@supacloud/elysia": "0.42.6",
44757
+ "@supacloud/elysia": "0.43.0",
44553
44758
  "@types/bun": "^1.4.5",
44554
44759
  effect: "4.0.5",
44555
44760
  elysia: "2.0.0-rc.4",
@@ -44866,6 +45071,7 @@ EXAMPLES
44866
45071
  ${preferredCommand} app rollback --ref abc123 --id orders --environment_id test --release_id <old-sha256> --configuration_id <uuid> --activation_id <new-uuid> --expected_activation_id <current-uuid>
44867
45072
  ${preferredCommand} app check --root . --strict
44868
45073
  ${preferredCommand} app infer --root . --format json
45074
+ ${preferredCommand} app verify --root . --changed
44869
45075
  ${preferredCommand} app graph --root . --format json
44870
45076
  ${preferredCommand} app explain --target CaseService
44871
45077
  ${preferredCommand} app context --root . --format json
@@ -40,7 +40,7 @@ export interface AppToolOptions {
40
40
  onDevProgress?: (result: ToolResult) => void;
41
41
  }
42
42
  export interface AppToolArguments {
43
- action: "init" | "generate" | "infer" | "dev" | "watch" | "verify-plan" | "compile" | "check" | "graph" | "explain" | "export-tools" | "context" | "lens" | "doctor" | "fix" | "plan" | "build" | "release" | "promote" | keyof typeof REMOTE_APP_ACTIONS;
43
+ action: "init" | "generate" | "infer" | "dev" | "watch" | "verify-plan" | "verify" | "compile" | "check" | "graph" | "explain" | "export-tools" | "context" | "lens" | "doctor" | "fix" | "plan" | "build" | "release" | "promote" | keyof typeof REMOTE_APP_ACTIONS;
44
44
  ref?: string;
45
45
  id?: string;
46
46
  environment_id?: string;
@@ -88,6 +88,8 @@ export interface AppToolArguments {
88
88
  format?: "text" | "json";
89
89
  target?: string;
90
90
  detail?: boolean;
91
+ /** `app verify`: select changed source files from Git and run affected tests. */
92
+ changed?: boolean;
91
93
  fix?: string;
92
94
  from_doctor?: string;
93
95
  fix_index?: number;
@@ -121,15 +123,23 @@ export interface ToolResult {
121
123
  declare function pascalName(name: string): string;
122
124
  /** kebab-case -> camelCase (semantic name suffix for command/query). */
123
125
  declare function camelName(name: string): string;
126
+ declare function readChangedProjectFiles(root: string): Promise<string[]>;
124
127
  declare function formatGraphText(manifest: AppManifest): string;
125
128
  /** token -> dependent provider/controller module and name (reverse index). */
126
129
  declare function reverseDependencies(manifest: AppManifest, token: string): string[];
127
130
  export declare function runAppTool(request: AppToolArguments, options?: AppToolOptions): Promise<ToolResult>;
128
131
  export declare function registerAppTools(server: ToolServer, options?: AppToolOptions): void;
132
+ /**
133
+ * Promotes the single-entry development verbs to top-level commands so an AI or
134
+ * developer does not need to remember the `app` namespace. The `app` tool and
135
+ * these aliases share one implementation and one execution-policy classification.
136
+ */
137
+ export declare function registerAppAliases(server: ToolServer): void;
129
138
  export declare const __internal: {
130
139
  pascalName: typeof pascalName;
131
140
  camelName: typeof camelName;
132
141
  formatGraphText: typeof formatGraphText;
133
142
  reverseDependencies: typeof reverseDependencies;
143
+ readChangedProjectFiles: typeof readChangedProjectFiles;
134
144
  };
135
145
  export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@supacloud/cli",
3
- "version": "0.128.6",
3
+ "version": "0.129.1",
4
4
  "description": "Project-scoped CLI for SupaCloud users",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -52,23 +52,23 @@
52
52
  "directory": "packages/cli"
53
53
  },
54
54
  "dependencies": {
55
- "@supacloud/compiler": "^0.66.2",
55
+ "@supacloud/compiler": "^0.67.0",
56
56
  "@supacloud/delivery": "0.30.0",
57
- "@supacloud/db": "0.26.1",
57
+ "@supacloud/db": "0.27.0",
58
58
  "typebox": "1.4.3"
59
59
  },
60
60
  "overrides": {
61
- "@supacloud/contracts": "0.16.3",
61
+ "@supacloud/contracts": "0.17.0",
62
62
  "@supacloud/delivery": "0.30.0",
63
63
  "@graphql-tools/utils": "^12.0.4",
64
- "@supacloud/compiler": "^0.66.2",
65
- "@supacloud/db": "0.26.1",
64
+ "@supacloud/compiler": "^0.67.0",
65
+ "@supacloud/db": "0.27.0",
66
66
  "deepmerge-ts": "8.0.2",
67
67
  "prisma": "6.19.3"
68
68
  },
69
69
  "devDependencies": {
70
70
  "@supabase/supabase-js": "2.118.0",
71
- "@supacloud/elysia": "0.42.6",
71
+ "@supacloud/elysia": "0.43.0",
72
72
  "@types/bun": "^1.4.5",
73
73
  "effect": "4.0.5",
74
74
  "elysia": "2.0.0-rc.4",