@getvitops/cli 8.0.0 → 8.0.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/CHANGELOG.md CHANGED
@@ -1,5 +1,19 @@
1
1
  # @getvitops/cli
2
2
 
3
+ ## 8.0.1
4
+
5
+ ### Patch Changes
6
+
7
+ - `vitops icons`'s `--site` flag is renamed to `--input`, matching `legal`/`robots`/`reviews` and
8
+ every other `Config`-anchored command. Same default (`./site.json`) and the same short flag
9
+ (`-i`); only the long name changes.
10
+
11
+ **Migration:** replace `vitops icons --site <path>` with `vitops icons --input <path>` (or `-i`).
12
+ Deferred out of 8.0.0 as a rename not worth a major bump on its own; landing now as a patch since
13
+ 8.0.0 has no adopters yet to carry the deprecated name for.
14
+ - @getvitops/generator@8.0.1
15
+ - @getvitops/utils@8.0.1
16
+
3
17
  ## 8.0.0
4
18
 
5
19
  ### Major Changes
package/dist/cli.mjs CHANGED
@@ -3,7 +3,7 @@ import { createRequire } from "node:module";
3
3
  import { parseArgs } from "node:util";
4
4
  import { existsSync, lstatSync, mkdirSync, readFileSync, readlinkSync, rmSync, symlinkSync, writeFileSync } from "node:fs";
5
5
  import { dirname, extname, join, parse, relative, resolve } from "node:path";
6
- import { JURISDICTION_COUNTRIES, NUMERIC_STEPS, SCHEMA_LOCAL_PATH, buildIconSprite, defaultConfig, enabledDocs, expandPalette, functionalRole, generate, generateDocs, generateLegal, isConfig, movedTokens, processorsMissingLocation, renderRobotsTxt, resolveConfig, resolveInput, resolveTheme, roleColorUtilities, roleHue, roleKind, validate } from "@getvitops/generator";
6
+ import { CONFIG_SCHEMA_LOCAL_PATH, JURISDICTION_COUNTRIES, NUMERIC_STEPS, SCHEMA_LOCAL_PATH, buildIconSprite, defaultConfig, defaultSiteConfig, enabledDocs, expandPalette, functionalRole, generate, generateDocs, generateLegal, isConfig, movedTokens, processorsMissingLocation, renderRobotsTxt, resolveConfig, resolveInput, resolveTheme, roleColorUtilities, roleHue, roleKind, validate } from "@getvitops/generator";
7
7
  import { collectIconRefs, generateFavicons, generateIconInclude, resolveIcon, scanFiles } from "@getvitops/utils";
8
8
  import { SCOPES, SNAPSHOT_PATH, adcCredentialsPath, adcQuotaProject, collectEntries, formatPlan, googleAccessToken, inspectUrl, keyFileContents, newKey, parseAdcUser, parseServiceAccount, plan, readSnapshot, resolveKeyLocation, resolveSitemapUrl, submitBatch, submitSitemap, toSnapshot, verifyKeyFile, writeSnapshot } from "@getvitops/utils/indexing";
9
9
  import { REVIEWS_CACHE_PATH, fetchReviews, formatPlan as formatPlan$1, mergeCache, plan as plan$1, readCache, selectReviews, toCache, writeCache } from "@getvitops/utils/reviews";
@@ -344,8 +344,15 @@ Generate options:
344
344
  --site-env <env> Environment whose A/B variant applies (default: production)
345
345
 
346
346
  Init options:
347
- -o, --out <path> Where to write (default: ./design-system.json)
347
+ -o, --out <path> Where to write (default: ./design-system.json, or
348
+ ./site.json with --site)
348
349
  --force Overwrite an existing file
350
+ --site Write a site config (Config) instead of a bare
351
+ design-system.json — embeds a starter design system at
352
+ designSystem.themes.default, since a Config can't
353
+ merely reference a sibling file
354
+ --name <name> organization.name, when --site is set
355
+ --url <url> site.environments.{production,dev}.url, when --site is set
349
356
 
350
357
  Validate options:
351
358
  <file> Config to check (default: ./design-system.json). Either
@@ -381,6 +388,7 @@ Docs options:
381
388
 
382
389
  Icons options:
383
390
  -i, --input <path> Site config carrying the "icons" block (default: ./site.json)
391
+ --site-env <env> Environment whose A/B variant applies (default: production)
384
392
  --src <dir> Source to scan for icon usage (default: ./src)
385
393
  --sprite Also build the SVG sprite
386
394
  -o, --out <dir> Where to write icons.svg with --sprite (default: ./dist)
@@ -2378,7 +2386,7 @@ function lintSource(files, v, format) {
2378
2386
  * `vitops` — CLI for the Vitops design-system generator.
2379
2387
  *
2380
2388
  * vitops generate --input <json> --format <bricks|css|tailwind|design[,…]> --out <dir>
2381
- * vitops init [--out design-system.json] [--force]
2389
+ * vitops init [--out design-system.json] [--force] [--site [--name <n>] [--url <u>]]
2382
2390
  * vitops validate <design-system.json|site.json>
2383
2391
  * vitops favicon --input <svg|png> --out <dir> [--low-res <svg|png>] [--background <hex>]
2384
2392
  * vitops agents [--input <json>] [--out AGENTS.md] [--docs-dir <dir>]
@@ -2464,27 +2472,53 @@ async function cmdGenerate(argv) {
2464
2472
  fail(msg(err));
2465
2473
  }
2466
2474
  }
2475
+ /**
2476
+ * `vitops init` writes a starter `design-system.json`; `--site` writes a starter
2477
+ * `site.json` instead — the umbrella `Config` that embeds the design system under
2478
+ * `designSystem.themes.default`, since there is no file-level `extends` and a
2479
+ * scaffolded config can't merely reference a sibling file (see `defaultSiteConfig`'s
2480
+ * docblock in `@getvitops/generator`). `--name`/`--url` fill the two facts a
2481
+ * consumer almost certainly has on hand; everything else stays the documented
2482
+ * placeholder, edited by hand or via `vitops setup` (see AGENTS.md's "Client
2483
+ * onboarding" section).
2484
+ */
2467
2485
  function cmdInit(argv) {
2468
2486
  const { values } = parseArgs({
2469
2487
  args: argv,
2470
2488
  options: {
2471
2489
  out: {
2472
2490
  type: "string",
2473
- short: "o",
2474
- default: "design-system.json"
2491
+ short: "o"
2475
2492
  },
2476
2493
  force: {
2477
2494
  type: "boolean",
2478
2495
  default: false
2479
- }
2496
+ },
2497
+ site: {
2498
+ type: "boolean",
2499
+ default: false
2500
+ },
2501
+ name: { type: "string" },
2502
+ url: { type: "string" }
2480
2503
  },
2481
2504
  allowPositionals: false
2482
2505
  });
2483
- const out = resolve(values.out);
2506
+ const out = resolve(values.out ?? (values.site ? "site.json" : "design-system.json"));
2484
2507
  if (existsSync(out) && !values.force) fail(`${out} already exists (use --force to overwrite)`);
2508
+ if (values.site) {
2509
+ const config = defaultSiteConfig({
2510
+ name: values.name,
2511
+ url: values.url
2512
+ });
2513
+ writeFileSync(out, JSON.stringify(config, null, 2) + "\n");
2514
+ console.log(`✓ wrote ${out}`);
2515
+ console.log(` Edit it, then: vitops validate ${relative(".", out)}`);
2516
+ console.log(` Editors read the "$schema" (${CONFIG_SCHEMA_LOCAL_PATH}) for autocomplete + validation — the installed copy, so it matches the toolchain you build with.`);
2517
+ return;
2518
+ }
2485
2519
  writeFileSync(out, JSON.stringify(defaultConfig(), null, 2) + "\n");
2486
2520
  console.log(`✓ wrote ${out}`);
2487
- console.log(` Edit it, then: vitops generate --input ${values.out} --format tailwind --out src/styles`);
2521
+ console.log(` Edit it, then: vitops generate --input ${relative(".", out)} --format tailwind --out src/styles`);
2488
2522
  console.log(` Editors read the "$schema" (${SCHEMA_LOCAL_PATH}) for autocomplete + validation — the installed copy, so it matches the toolchain you build with.`);
2489
2523
  }
2490
2524
  /**