@getmonoceros/workbench 1.4.0 → 1.5.0

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
@@ -1816,18 +1816,28 @@ var ANSI_UNDERLINE2 = `${ESC}4m`;
1816
1816
  var ANSI_CYAN2 = `${ESC}36m`;
1817
1817
  var ANSI_GREY2 = `${ESC}90m`;
1818
1818
  var ANSI_RESET2 = `${ESC}0m`;
1819
- function isTty2() {
1820
- return process.stderr.isTTY ?? false;
1819
+ function makeWrap(isTty2) {
1820
+ return (s, ...codes) => isTty2 ? codes.join("") + s + ANSI_RESET2 : s;
1821
1821
  }
1822
- function wrap(s, ...codes) {
1823
- if (!isTty2()) return s;
1824
- return codes.join("") + s + ANSI_RESET2;
1822
+ function makePalette(isTty2) {
1823
+ const wrap = makeWrap(isTty2);
1824
+ return {
1825
+ bold: (s) => wrap(s, ANSI_BOLD2),
1826
+ underline: (s) => wrap(s, ANSI_UNDERLINE2),
1827
+ cyan: (s) => wrap(s, ANSI_CYAN2),
1828
+ dim: (s) => wrap(s, ANSI_GREY2),
1829
+ sectionLine: (label) => wrap(`\u25B8 ${label}`, ANSI_BOLD2, ANSI_UNDERLINE2)
1830
+ };
1825
1831
  }
1826
- var cyan2 = (s) => wrap(s, ANSI_CYAN2);
1827
- var dim = (s) => wrap(s, ANSI_GREY2);
1828
- function sectionLine(label) {
1829
- return wrap(`\u25B8 ${label}`, ANSI_BOLD2, ANSI_UNDERLINE2);
1832
+ function colorsFor(stream) {
1833
+ return makePalette(stream.isTTY ?? false);
1830
1834
  }
1835
+ var stderrPalette = makePalette(process.stderr.isTTY ?? false);
1836
+ var bold2 = stderrPalette.bold;
1837
+ var underline2 = stderrPalette.underline;
1838
+ var cyan2 = stderrPalette.cyan;
1839
+ var dim = stderrPalette.dim;
1840
+ var sectionLine = stderrPalette.sectionLine;
1831
1841
 
1832
1842
  // src/devcontainer/compose.ts
1833
1843
  import { spawn as spawn2 } from "child_process";
@@ -2418,7 +2428,7 @@ function warnOnDeprecatedFeatureRefs(containerFeatures, globalConfig, logger) {
2418
2428
  }
2419
2429
 
2420
2430
  // src/version.ts
2421
- var CLI_VERSION = "1.4.0";
2431
+ var CLI_VERSION = "1.5.0";
2422
2432
 
2423
2433
  // src/commands/_dispatch.ts
2424
2434
  import { consola as consola11 } from "consola";
@@ -3244,11 +3254,21 @@ function collectWithList(withArg, rawArgs) {
3244
3254
  // src/commands/list-components.ts
3245
3255
  import { defineCommand as defineCommand10 } from "citty";
3246
3256
  import { consola as consola14 } from "consola";
3257
+ var CATEGORY_LABELS = {
3258
+ language: "Languages",
3259
+ service: "Services",
3260
+ feature: "Features"
3261
+ };
3262
+ var CATEGORY_ORDER = [
3263
+ "language",
3264
+ "service",
3265
+ "feature"
3266
+ ];
3247
3267
  var listComponentsCommand = defineCommand10({
3248
3268
  meta: {
3249
3269
  name: "list-components",
3250
3270
  group: "discovery",
3251
- description: "Print the components catalog used by `monoceros init --with=\u2026`. Each line is `name<TAB>category<TAB>displayName`, grouped by category for readability."
3271
+ description: "Print the components catalog used by `monoceros init --with=\u2026`, grouped by category (Languages, Services, Features). Component names render in cyan, descriptions in default colour; when piped, the formatting drops out and lines become `name<TAB>description` for grep/awk-friendly consumption."
3252
3272
  },
3253
3273
  args: {},
3254
3274
  async run() {
@@ -3260,23 +3280,49 @@ var listComponentsCommand = defineCommand10({
3260
3280
  );
3261
3281
  process.exit(0);
3262
3282
  }
3263
- const sorted = [...catalog.values()].sort((a, b) => {
3264
- const order = { language: 0, service: 1, feature: 2 };
3265
- const ca = order[a.file.category];
3266
- const cb = order[b.file.category];
3267
- if (ca !== cb) return ca - cb;
3268
- return a.name.localeCompare(b.name);
3269
- });
3270
- let currentCategory = null;
3271
- for (const c of sorted) {
3272
- if (c.file.category !== currentCategory) {
3273
- if (currentCategory !== null) process.stdout.write("\n");
3274
- process.stdout.write(`# ${c.file.category}
3283
+ const fmt = colorsFor(process.stdout);
3284
+ const isTty2 = process.stdout.isTTY ?? false;
3285
+ const byCategory = /* @__PURE__ */ new Map();
3286
+ for (const c of catalog.values()) {
3287
+ const list = byCategory.get(c.file.category) ?? [];
3288
+ list.push({ name: c.name, desc: c.file.displayName });
3289
+ byCategory.set(c.file.category, list);
3290
+ }
3291
+ for (const list of byCategory.values()) {
3292
+ list.sort((a, b) => a.name.localeCompare(b.name));
3293
+ }
3294
+ if (!isTty2) {
3295
+ let first2 = true;
3296
+ for (const cat of CATEGORY_ORDER) {
3297
+ const items = byCategory.get(cat);
3298
+ if (!items || items.length === 0) continue;
3299
+ if (!first2) process.stdout.write("\n");
3300
+ first2 = false;
3301
+ process.stdout.write(`# ${cat}
3275
3302
  `);
3276
- currentCategory = c.file.category;
3303
+ for (const { name, desc } of items) {
3304
+ process.stdout.write(`${name} ${desc}
3305
+ `);
3306
+ }
3277
3307
  }
3278
- process.stdout.write(`${c.name} ${c.file.displayName}
3308
+ process.exit(0);
3309
+ }
3310
+ let first = true;
3311
+ for (const cat of CATEGORY_ORDER) {
3312
+ const items = byCategory.get(cat);
3313
+ if (!items || items.length === 0) continue;
3314
+ if (!first) process.stdout.write("\n");
3315
+ first = false;
3316
+ process.stdout.write(`${fmt.sectionLine(CATEGORY_LABELS[cat])}
3317
+
3318
+ `);
3319
+ const nameWidth = Math.max(...items.map((i) => i.name.length));
3320
+ const gutter = 2;
3321
+ for (const { name, desc } of items) {
3322
+ const pad = " ".repeat(nameWidth - name.length + gutter);
3323
+ process.stdout.write(` ${fmt.cyan(name)}${pad}${desc}
3279
3324
  `);
3325
+ }
3280
3326
  }
3281
3327
  process.exit(0);
3282
3328
  } catch (err) {