@getmonoceros/workbench 1.9.3 → 1.9.5

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
@@ -2453,8 +2453,9 @@ function addInstallUrlToDoc(doc, url) {
2453
2453
  seq.add(url);
2454
2454
  return true;
2455
2455
  }
2456
- function addFeatureToDoc(doc, ref, options = {}) {
2456
+ function addFeatureToDoc(doc, ref, options = {}, displayName) {
2457
2457
  const seq = ensureSeq(doc, "features");
2458
+ const label = displayName ?? ref;
2458
2459
  for (const item of seq.items) {
2459
2460
  if (!isMap2(item)) continue;
2460
2461
  const itemRef = item.get("ref");
@@ -2465,7 +2466,7 @@ function addFeatureToDoc(doc, ref, options = {}) {
2465
2466
  return false;
2466
2467
  }
2467
2468
  throw new Error(
2468
- `Feature ${ref} is already configured with different options. Remove it first (\`monoceros remove-feature ${ref}\`) before re-adding.`
2469
+ `Feature ${label} is already configured with different options. Remove it first (\`monoceros remove-feature ${label}\`) before re-adding.`
2469
2470
  );
2470
2471
  }
2471
2472
  const entry2 = new YAMLMap2();
@@ -2511,7 +2512,6 @@ function addRepoToDoc(doc, repo) {
2511
2512
  } else {
2512
2513
  item.delete("provider");
2513
2514
  }
2514
- relocateLeakedSectionComments(doc);
2515
2515
  return true;
2516
2516
  }
2517
2517
  const entry2 = new YAMLMap2();
@@ -2544,7 +2544,6 @@ function addRepoToDoc(doc, repo) {
2544
2544
  entry2.comment = hintLines.join("\n");
2545
2545
  }
2546
2546
  seq.add(entry2);
2547
- relocateLeakedSectionComments(doc);
2548
2547
  return true;
2549
2548
  }
2550
2549
  function removeLanguageFromDoc(doc, lang) {
@@ -2855,7 +2854,10 @@ async function runAddFeature(input) {
2855
2854
  ...resolved.defaultOptions,
2856
2855
  ...input.options ?? {}
2857
2856
  };
2858
- return mutate(input, (doc) => addFeatureToDoc(doc, resolved.ref, merged));
2857
+ return mutate(
2858
+ input,
2859
+ (doc) => addFeatureToDoc(doc, resolved.ref, merged, raw)
2860
+ );
2859
2861
  }
2860
2862
  async function resolveFeatureRefOrShortname(input) {
2861
2863
  if (REGEX.featureRef.test(input)) {
@@ -2908,14 +2910,15 @@ function runRemoveAptPackages(input) {
2908
2910
  }
2909
2911
  return mutate(input, (doc) => removeAptPackagesFromDoc(doc, input.packages));
2910
2912
  }
2911
- function runRemoveFeature(input) {
2912
- const ref = input.ref.trim();
2913
- if (ref.length === 0) {
2913
+ async function runRemoveFeature(input) {
2914
+ const raw = input.ref.trim();
2915
+ if (raw.length === 0) {
2914
2916
  throw new Error(
2915
- "Missing feature ref. Usage: monoceros remove-feature <containername> <ref>."
2917
+ "Missing feature ref. Usage: monoceros remove-feature <containername> <feature>."
2916
2918
  );
2917
2919
  }
2918
- return mutate(input, (doc) => removeFeatureFromDoc(doc, ref));
2920
+ const resolved = await resolveFeatureRefOrShortname(raw);
2921
+ return mutate(input, (doc) => removeFeatureFromDoc(doc, resolved.ref));
2919
2922
  }
2920
2923
  function runRemoveFromUrl(input) {
2921
2924
  const url = input.url.trim();
@@ -2971,6 +2974,7 @@ async function mutate(opts, apply) {
2971
2974
  logger.info("No changes \u2014 yml is already in the desired state.");
2972
2975
  return { status: "no-change" };
2973
2976
  }
2977
+ relocateLeakedSectionComments(parsed.doc);
2974
2978
  const newText = stringifyConfig(parsed.doc);
2975
2979
  parseConfig(newText, ymlPath);
2976
2980
  const out = opts.output ?? ((line) => process.stdout.write(line + "\n"));
@@ -4428,7 +4432,7 @@ async function persistPromptedIdentity(prompted, ymlPath, home, logger) {
4428
4432
  }
4429
4433
 
4430
4434
  // src/version.ts
4431
- var CLI_VERSION = true ? "1.9.3" : "dev";
4435
+ var CLI_VERSION = true ? "1.9.5" : "dev";
4432
4436
 
4433
4437
  // src/commands/_dispatch.ts
4434
4438
  import { consola as consola12 } from "consola";
@@ -5947,7 +5951,7 @@ var removeFeatureCommand = defineCommand16({
5947
5951
  meta: {
5948
5952
  name: "remove-feature",
5949
5953
  group: "edit",
5950
- description: "Remove a devcontainer feature from the container config (by its OCI ref). Idempotent, prints a diff before writing."
5954
+ description: "Remove a devcontainer feature from the container config. Accepts either a Monoceros catalog short-name (e.g. `atlassian`, `claude`) or a full OCI ref. Idempotent, prints a diff before writing."
5951
5955
  },
5952
5956
  args: {
5953
5957
  name: {
@@ -5957,7 +5961,7 @@ var removeFeatureCommand = defineCommand16({
5957
5961
  },
5958
5962
  ref: {
5959
5963
  type: "positional",
5960
- description: "Feature ref (e.g. ghcr.io/devcontainers/features/docker-in-docker:2).",
5964
+ description: "Feature to remove. Either a Monoceros catalog short-name (e.g. `atlassian`, `atlassian/twg`, `claude` \u2014 see `monoceros list-components`) or a full OCI feature ref (e.g. `ghcr.io/devcontainers/features/docker-in-docker:2`).",
5961
5965
  required: true
5962
5966
  },
5963
5967
  yes: {