@getmonoceros/workbench 1.37.1 → 1.37.3

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/bin.js CHANGED
@@ -1184,6 +1184,7 @@ function makePalette(isTty2) {
1184
1184
  cyan: (s) => wrap(s, ANSI_CYAN2),
1185
1185
  green: (s) => wrap(s, ANSI_GREEN),
1186
1186
  yellow: (s) => wrap(s, ANSI_YELLOW),
1187
+ red: (s) => wrap(s, ANSI_RED),
1187
1188
  dim: (s) => wrap(s, ANSI_GREY2),
1188
1189
  sectionLine: (label) => wrap(`\u25B8 ${label}`, ANSI_BOLD2, ANSI_UNDERLINE2)
1189
1190
  };
@@ -1191,7 +1192,7 @@ function makePalette(isTty2) {
1191
1192
  function colorsFor(stream) {
1192
1193
  return makePalette(stream.isTTY ?? false);
1193
1194
  }
1194
- var ESC, ANSI_BOLD2, ANSI_UNDERLINE2, ANSI_CYAN2, ANSI_GREEN, ANSI_YELLOW, ANSI_GREY2, ANSI_RESET2, ANSI_RE2, stderrPalette, bold2, underline2, cyan2, green, yellow, dim, sectionLine;
1195
+ var ESC, ANSI_BOLD2, ANSI_UNDERLINE2, ANSI_CYAN2, ANSI_GREEN, ANSI_YELLOW, ANSI_RED, ANSI_GREY2, ANSI_RESET2, ANSI_RE2, stderrPalette, bold2, underline2, cyan2, green, yellow, red, dim, sectionLine;
1195
1196
  var init_format = __esm({
1196
1197
  "src/util/format.ts"() {
1197
1198
  "use strict";
@@ -1201,6 +1202,7 @@ var init_format = __esm({
1201
1202
  ANSI_CYAN2 = `${ESC}36m`;
1202
1203
  ANSI_GREEN = `${ESC}32m`;
1203
1204
  ANSI_YELLOW = `${ESC}33m`;
1205
+ ANSI_RED = `${ESC}31m`;
1204
1206
  ANSI_GREY2 = `${ESC}90m`;
1205
1207
  ANSI_RESET2 = `${ESC}0m`;
1206
1208
  ANSI_RE2 = /\x1b\[[0-9;]*m/g;
@@ -1210,6 +1212,7 @@ var init_format = __esm({
1210
1212
  cyan2 = stderrPalette.cyan;
1211
1213
  green = stderrPalette.green;
1212
1214
  yellow = stderrPalette.yellow;
1215
+ red = stderrPalette.red;
1213
1216
  dim = stderrPalette.dim;
1214
1217
  sectionLine = stderrPalette.sectionLine;
1215
1218
  }
@@ -5436,7 +5439,6 @@ var init_yml = __esm({
5436
5439
  // src/modify/index.ts
5437
5440
  import { promises as fs11 } from "fs";
5438
5441
  import { consola as consola2 } from "consola";
5439
- import { createPatch } from "diff";
5440
5442
  import path13 from "path";
5441
5443
  function runAddLanguage(input) {
5442
5444
  const spec = parseLanguageSpec(input.language);
@@ -5669,22 +5671,20 @@ async function tryCloneInRunningContainer(input, entry2) {
5669
5671
  );
5670
5672
  return;
5671
5673
  }
5674
+ let noToken;
5672
5675
  try {
5673
- const { hostTokens } = await resolveContainerRepoTokens(
5676
+ const { hostTokens, missing } = await resolveContainerRepoTokens(
5674
5677
  input.name,
5675
5678
  home,
5676
5679
  await loadComponentCatalog()
5677
5680
  );
5678
- if (hostTokens.get(urlHost)) {
5681
+ noToken = missing.find((m) => m.host === urlHost);
5682
+ if (!noToken) {
5679
5683
  await collectGitCredentials(root, [{ host: urlHost, provider }], {
5680
5684
  patByHost: hostTokens,
5681
5685
  logger: { info: () => {
5682
5686
  }, warn: (m) => logger.warn(m) }
5683
5687
  });
5684
- } else {
5685
- logger.warn(
5686
- `No access token set for ${urlHost} \u2014 cloning will fail if this repo is private. Set one (see ${REPO_DOCS_URL}) and re-run.`
5687
- );
5688
5688
  }
5689
5689
  } catch (err) {
5690
5690
  logger.warn(
@@ -5724,14 +5724,27 @@ async function tryCloneInRunningContainer(input, entry2) {
5724
5724
  return;
5725
5725
  }
5726
5726
  if (exit.exitCode !== 0) {
5727
- logger.warn(
5728
- `In-container clone for ${entry2.url} exited ${exit.exitCode}. The yml is updated; \`monoceros apply ${input.name}\` retries.`
5729
- );
5727
+ if (noToken) {
5728
+ process.stderr.write(
5729
+ `
5730
+ ${formatUnauthenticatedRepos([noToken], input.name)}
5731
+ `
5732
+ );
5733
+ } else {
5734
+ logger.warn(
5735
+ `In-container clone for ${entry2.url} exited ${exit.exitCode}. The yml is updated; \`monoceros apply ${input.name}\` retries.`
5736
+ );
5737
+ }
5730
5738
  return;
5731
5739
  }
5732
5740
  logger.info(
5733
5741
  `Cloned ${entry2.url} into /workspaces/${containerName2}/${targetRel} inside the running container.`
5734
5742
  );
5743
+ if (noToken) {
5744
+ logger.warn(
5745
+ `No token set for ${urlHost}: the clone worked (public), but gh/glab aren't logged in and pushing needs a token. See ${REPO_DOCS_URL}.`
5746
+ );
5747
+ }
5735
5748
  void path13;
5736
5749
  }
5737
5750
  function shquote(value) {
@@ -5967,16 +5980,6 @@ async function mutate(opts, apply) {
5967
5980
  relocateLeakedSectionComments(parsed.doc);
5968
5981
  const newText = stringifyConfig(parsed.doc);
5969
5982
  parseConfig(newText, ymlPath);
5970
- const out = opts.output ?? ((line) => process.stdout.write(line + "\n"));
5971
- out(createPatch(ymlPath, oldText, newText, "before", "after"));
5972
- if (!opts.yes) {
5973
- const confirm = opts.confirm ?? defaultConfirm;
5974
- const ok = await confirm("Apply these changes to the yml?");
5975
- if (!ok) {
5976
- logger.warn("Aborted by user. The yml was not modified.");
5977
- return { status: "aborted" };
5978
- }
5979
- }
5980
5983
  await fs11.writeFile(ymlPath, newText, "utf8");
5981
5984
  logger.success(`Updated ${ymlPath}.`);
5982
5985
  logger.info(
@@ -6046,7 +6049,6 @@ ${lines.join("\n")}`);
6046
6049
  );
6047
6050
  }
6048
6051
  }
6049
- var defaultConfirm;
6050
6052
  var init_modify = __esm({
6051
6053
  "src/modify/index.ts"() {
6052
6054
  "use strict";
@@ -6071,13 +6073,6 @@ var init_modify = __esm({
6071
6073
  init_transform();
6072
6074
  init_briefing();
6073
6075
  init_yml();
6074
- defaultConfirm = async (message) => {
6075
- const result = await consola2.prompt(message, {
6076
- type: "confirm",
6077
- initial: false
6078
- });
6079
- return result === true;
6080
- };
6081
6076
  }
6082
6077
  });
6083
6078
 
@@ -7530,6 +7525,12 @@ var init_apply_log = __esm({
7530
7525
 
7531
7526
  // src/apply/apply-progress.ts
7532
7527
  import { Writable as Writable3 } from "stream";
7528
+ function isNoiseTailLine(line) {
7529
+ const t = line.trim();
7530
+ return /^at\s/.test(t) || // JS stack frame
7531
+ t.startsWith('{"outcome":') || // devcontainer-cli result blob
7532
+ /^Error: Command failed: \/bin\/sh -c/.test(t);
7533
+ }
7533
7534
  function createApplyProgress(opts) {
7534
7535
  const out = opts.out;
7535
7536
  const now = opts.now ?? (() => Date.now());
@@ -7601,17 +7602,19 @@ function createApplyProgress(opts) {
7601
7602
  const line = lineBuf.slice(0, nl);
7602
7603
  lineBuf = lineBuf.slice(nl + 1);
7603
7604
  if (line.length === 0) continue;
7604
- tail.push(line);
7605
- if (tail.length > TAIL_LINES) tail.shift();
7606
7605
  for (const trig of PHASE_TRIGGERS) {
7607
7606
  const m = line.match(trig.pattern);
7608
7607
  if (m) {
7609
- setPhase(
7610
- typeof trig.label === "function" ? trig.label(m) : trig.label
7611
- );
7608
+ const label = typeof trig.label === "function" ? trig.label(m) : trig.label;
7609
+ if (label !== phase) tail.length = 0;
7610
+ setPhase(label);
7612
7611
  break;
7613
7612
  }
7614
7613
  }
7614
+ if (!isNoiseTailLine(line)) {
7615
+ tail.push(line);
7616
+ if (tail.length > TAIL_LINES) tail.shift();
7617
+ }
7615
7618
  }
7616
7619
  cb();
7617
7620
  }
@@ -8445,7 +8448,7 @@ Fix the value in the env file (or the yml).`
8445
8448
  } else {
8446
8449
  const { tailLines } = progress.fail();
8447
8450
  progressOut.write(`
8448
- \u2718 apply failed (exit ${exitCode})
8451
+ ${red(`\u2718 apply failed (exit ${exitCode})`)}
8449
8452
 
8450
8453
  `);
8451
8454
  for (const line of tailLines) {
@@ -8842,7 +8845,7 @@ var CLI_VERSION;
8842
8845
  var init_version = __esm({
8843
8846
  "src/version.ts"() {
8844
8847
  "use strict";
8845
- CLI_VERSION = true ? "1.37.1" : "dev";
8848
+ CLI_VERSION = true ? "1.37.3" : "dev";
8846
8849
  }
8847
8850
  });
8848
8851