@m8t-stack/cli 0.2.91 → 0.2.94

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/dist/cli.js CHANGED
@@ -1487,7 +1487,7 @@ function installFoundryDnsShim() {
1487
1487
  }
1488
1488
 
1489
1489
  // src/lib/package-version.ts
1490
- var CLI_VERSION = "0.2.91";
1490
+ var CLI_VERSION = "0.2.94";
1491
1491
 
1492
1492
  // src/lib/render-error.ts
1493
1493
  init_errors();
@@ -20983,6 +20983,7 @@ import * as os10 from "os";
20983
20983
  import * as path26 from "path";
20984
20984
  init_errors();
20985
20985
  var FOUNDRY_TRACING_MODES = ["project", "account", "skip"];
20986
+ var DEFAULT_FOUNDRY_TRACING = "project";
20986
20987
  function parseFoundryTracingMode(v) {
20987
20988
  if (v === void 0) return void 0;
20988
20989
  if (!FOUNDRY_TRACING_MODES.includes(v)) {
@@ -24270,10 +24271,10 @@ var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
24270
24271
  description: "Release-channel URL the updater job polls (bicep default applies when omitted)."
24271
24272
  });
24272
24273
  location = Option40.String("--location", {
24273
- description: "Region for the updater identity + job. Defaults to the resource group's existing resources."
24274
+ description: "Region for the updater identity + job. Defaults to this install's stamped region, then to the resource group's existing resources."
24274
24275
  });
24275
24276
  foundryTracing = Option40.String("--foundry-tracing", {
24276
- description: "project | account | skip. Pass the value the install was deployed with \u2014 omitting it lets the bicep default (project) switch tracing on."
24277
+ description: "project | account | skip. Omitting it keeps the value already stamped on this install; only an install with nothing stamped falls through to the default (project)."
24277
24278
  });
24278
24279
  endpoint = Option40.String("--endpoint", {
24279
24280
  description: "Foundry project endpoint URL. Disambiguates the project in a multi-project subscription."
@@ -24344,7 +24345,8 @@ var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
24344
24345
  resourceGroup,
24345
24346
  subscriptionId
24346
24347
  });
24347
- const location = typeof this.location === "string" && this.location.length > 0 ? this.location : (await runAz(["resource", "list", "-g", resourceGroup, "--subscription", subscriptionId, "--query", "[0].location", "-o", "tsv"])).trim();
24348
+ const stampedLocation = stampedParams?.bicep.location;
24349
+ const location = typeof this.location === "string" && this.location.length > 0 ? this.location : stampedLocation !== void 0 && stampedLocation.length > 0 ? stampedLocation : (await runAz(["resource", "list", "-g", resourceGroup, "--subscription", subscriptionId, "--query", "[0].location", "-o", "tsv"])).trim();
24348
24350
  if (!location) {
24349
24351
  throw new LocalCliError({
24350
24352
  code: "PLATFORM_ENABLE_AUTO_UPDATE_NO_LOCATION",
@@ -24352,8 +24354,9 @@ var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
24352
24354
  });
24353
24355
  }
24354
24356
  const foundryResourceId = await resolveFoundryResourceId(project.endpoint);
24355
- const acrPullIdentityResourceId = resolveAcrPullIdentity({});
24356
- const acrResourceId = acrPullIdentityResourceId ? "" : await resolveAcrResourceId({ imageRef });
24357
+ const resolvedAcrPullIdentity = resolveAcrPullIdentity({});
24358
+ const acrPullIdentityResourceId = resolvedAcrPullIdentity !== "" ? resolvedAcrPullIdentity : stampedParams?.bicep.acrPullIdentityResourceId ?? "";
24359
+ const acrResourceId = await resolveAcrResourceId({ imageRef });
24357
24360
  const recoveredParams = {
24358
24361
  location,
24359
24362
  suffix,
@@ -24364,8 +24367,49 @@ var PlatformEnableAutoUpdateCommand = class extends M8tCommand {
24364
24367
  foundryProjectEndpoint: project.endpoint,
24365
24368
  acrPullIdentityResourceId,
24366
24369
  acrResourceId,
24367
- ...parseFoundryTracingMode(this.foundryTracing) ? { foundryTracingMode: parseFoundryTracingMode(this.foundryTracing) } : {},
24368
- ...typeof this.channelUrl === "string" && this.channelUrl.length > 0 ? { channelUrl: this.channelUrl } : {}
24370
+ // This row is REPLACED wholesale, so an absent flag must INHERIT the stamped
24371
+ // value rather than drop it. Both optional fields need this, for the same
24372
+ // reason and with the same consequence:
24373
+ //
24374
+ // foundryTracingMode — dropping it re-applied main.bicep's `project`
24375
+ // default, so an install that deliberately opted out of tracing had it
24376
+ // switched back on by an unrelated re-run of this command. That is
24377
+ // exactly the silent posture change we refuse to make for a customer.
24378
+ // channelUrl — dropping it re-applied bicep's empty default, so the
24379
+ // gateway and updater job lost their release channel and the install
24380
+ // silently stopped polling for updates. The field exists in InfraParams
24381
+ // precisely so a converge re-emits it; dropping it defeats its purpose.
24382
+ //
24383
+ // The stamped value is re-validated rather than cast: the row is typed
24384
+ // `string` and JSON-parsed unchecked, so a bad value would otherwise reach
24385
+ // ARM and come back as an opaque InvalidTemplate instead of a local refusal.
24386
+ //
24387
+ // An unrecognised stamped mode REFUSES rather than dropping to the bicep
24388
+ // default. Dropping would resolve to `project` and switch tracing ON for an
24389
+ // install whose stored configuration said something else — the silent
24390
+ // posture change this whole block exists to prevent. It also covers the
24391
+ // forward case: a newer CLI stamping a mode this build does not know should
24392
+ // not be clobbered by this build. An explicit flag rescues it either way,
24393
+ // which is why the flag is parsed FIRST and the stamp only read if absent.
24394
+ ...(() => {
24395
+ const explicit = parseFoundryTracingMode(this.foundryTracing);
24396
+ if (explicit) return { foundryTracingMode: explicit };
24397
+ const raw = stampedParams?.bicep.foundryTracingMode;
24398
+ if (raw === void 0) return {};
24399
+ try {
24400
+ return { foundryTracingMode: parseFoundryTracingMode(raw) };
24401
+ } catch {
24402
+ throw new LocalCliError({
24403
+ code: "PLATFORM_ENABLE_AUTO_UPDATE_UNKNOWN_STAMPED_TRACING",
24404
+ message: `This install's stored configuration records a Foundry tracing mode this version does not recognise: '${raw}'.`,
24405
+ hint: "Pass --foundry-tracing project|account|skip to replace it. It is not dropped automatically, because that would re-enable tracing on an install whose configuration says otherwise."
24406
+ });
24407
+ }
24408
+ })(),
24409
+ ...(() => {
24410
+ const url = typeof this.channelUrl === "string" && this.channelUrl.length > 0 ? this.channelUrl : stampedParams?.bicep.channelUrl;
24411
+ return url ? { channelUrl: url } : {};
24412
+ })()
24369
24413
  };
24370
24414
  onProgress("running Bicep deployment to provision the updater (~2-4 min)\u2026");
24371
24415
  const repoRoot = await resolveRepoRoot2();
@@ -24829,7 +24873,7 @@ function reportWhatIf(r, opts) {
24829
24873
  const exitCode = r.unexpected.length === 0 ? 0 : 1;
24830
24874
  if (opts.redact) {
24831
24875
  const output = opts.json ? JSON.stringify({ summary: redactForReport(r), exitCode }, null, 2) : redactForLog(r);
24832
- return { output, exitCode };
24876
+ return { output, exitCode, ...opts.json ? { diagnostic: redactForLog(r) } : {} };
24833
24877
  }
24834
24878
  if (opts.json) {
24835
24879
  return { output: JSON.stringify({ summary: { noise: r.noise.length, pending: r.pending.length, unexpected: r.unexpected.length }, pending: r.pending, unexpected: r.unexpected, exitCode }, null, 2), exitCode };
@@ -25096,8 +25140,9 @@ var DeployCommand = class extends M8tCommand {
25096
25140
  });
25097
25141
  const changes = await runWhatIf({ resourceGroup: this.resourceGroup, repoRoot: repoRoot2, params: params2 });
25098
25142
  const classified = classifyWhatIf(changes);
25099
- const { output, exitCode } = reportWhatIf(classified, { json: mode === "json", redact: this.redact });
25143
+ const { output, exitCode, diagnostic } = reportWhatIf(classified, { json: mode === "json", redact: this.redact });
25100
25144
  this.context.stdout.write(output + "\n");
25145
+ if (diagnostic) this.context.stderr.write(diagnostic + "\n");
25101
25146
  return exitCode;
25102
25147
  } catch (e) {
25103
25148
  const { output, exitCode } = reportWhatIfFailure(e, { json: mode === "json", redact: this.redact });
@@ -31570,7 +31615,7 @@ ${colors.error("\u2717")} The GitHub App on disk is installed on ${colors.field(
31570
31615
  // src/commands/bootstrap/launch.ts
31571
31616
  var DEFAULT_RG = "rg-m8t-stack";
31572
31617
  var DEFAULT_INSTALLER = "ghcr.io/m8t-labs/m8t-installer";
31573
- var DEFAULT_INSTALLER_TAG = "v0.1.63";
31618
+ var DEFAULT_INSTALLER_TAG = "v0.1.65";
31574
31619
  var ACI_NAME = "m8t-installer";
31575
31620
  var MI_NAME = "m8t-installer-mi";
31576
31621
  var BootstrapLaunchCommand = class extends M8tCommand {
@@ -31606,6 +31651,11 @@ var BootstrapLaunchCommand = class extends M8tCommand {
31606
31651
  reinstallInto = Option56.String("--reinstall-into", { description: "Consent to installing into --resource-group even though it already holds resources. Must match the target group's name." });
31607
31652
  org = Option56.String("--org", { description: "Assert the GitHub App on disk is installed on this org; refuses on a mismatch." });
31608
31653
  noBrains = Option56.Boolean("--no-brains", false, { description: "Install without brain-backed workers. For test and CI rigs; the supported install creates brains." });
31654
+ // The opt-out TELEMETRY.md names. Without it there is no way to decline at
31655
+ // install time — the ACI env is built entirely from these options, so a
31656
+ // founder setting FOUNDRY_TRACING in their own shell reaches nothing. A
31657
+ // privacy notice that documents a control has to be a control that exists.
31658
+ foundryTracing = Option56.String("--foundry-tracing", { description: "Where agent traces go: project (default, your own App Insights) | account (legacy shared) | skip (no tracing \u2014 you lose the record of what your agents did)." });
31609
31659
  async executeCommand() {
31610
31660
  const location = typeof this.location === "string" ? this.location : void 0;
31611
31661
  if (!location) {
@@ -31618,6 +31668,7 @@ var BootstrapLaunchCommand = class extends M8tCommand {
31618
31668
  const installerImageOverride = typeof this.installerImage === "string" ? this.installerImage : void 0;
31619
31669
  const installerImage = installerImageOverride ?? `${DEFAULT_INSTALLER}:${installerTag}`;
31620
31670
  const gatewayImageRef = typeof this.gatewayImageRef === "string" ? this.gatewayImageRef : void 0;
31671
+ const foundryTracing = parseFoundryTracingMode(typeof this.foundryTracing === "string" ? this.foundryTracing : void 0) ?? DEFAULT_FOUNDRY_TRACING;
31621
31672
  const account = await getAzAccount();
31622
31673
  const subscriptionId = (typeof this.subscription === "string" ? this.subscription : void 0) ?? account.subscriptionId;
31623
31674
  const out = (m) => this.context.stderr.write(` ${colors.dim(m)}
@@ -31745,7 +31796,7 @@ var BootstrapLaunchCommand = class extends M8tCommand {
31745
31796
  appRegClientId: appReg.clientId,
31746
31797
  image: installerImage,
31747
31798
  gatewayImageRef,
31748
- foundryTracing: "skip",
31799
+ foundryTracing,
31749
31800
  githubApp,
31750
31801
  ...founderObjectId ? { founderObjectId } : {},
31751
31802
  ...skipBrains ? { skipBrains: true } : {},