@vttforge/cli 0.5.3 → 0.5.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.
@@ -10,7 +10,7 @@ import { createServer } from "node:http";
10
10
  import { homedir } from "node:os";
11
11
  import { promisify } from "node:util";
12
12
  //#region package.json
13
- var version = "0.5.3";
13
+ var version = "0.5.5";
14
14
  //#endregion
15
15
  //#region src/audit/manifest-rules.ts
16
16
  /**
@@ -20,12 +20,12 @@ var version = "0.5.3";
20
20
  * `module.json` at the project root. They cover three v13 manifest
21
21
  * footguns from the VTTForge audit catalog:
22
22
  *
23
- * VTTF-AUDIT-001 (HIGH) — flags.hotReload shape
24
- * VTTF-AUDIT-002 (MEDIUM) — deprecated gridDistance/gridUnits
25
- * VTTF-AUDIT-003 (LOW) — styles array of strings (v12 shape)
23
+ * VTTF-AUDIT-001 (HIGH) : flags.hotReload shape
24
+ * VTTF-AUDIT-002 (MEDIUM): deprecated gridDistance/gridUnits
25
+ * VTTF-AUDIT-003 (LOW) : styles array of strings (v12 shape)
26
26
  *
27
27
  * Each rule emits zero or more `RuleResult`s. Line numbers are looked up
28
- * cheaply by scanning the raw JSON for the offending key — accurate
28
+ * cheaply by scanning the raw JSON for the offending key. Accurate
29
29
  * enough for navigation, no AST dependency.
30
30
  */
31
31
  const MANIFEST_FILES$1 = ["system.json", "module.json"];
@@ -63,7 +63,7 @@ async function loadManifests(cwd) {
63
63
  }
64
64
  /**
65
65
  * Find the 1-based line number of the first `"key":` occurrence in JSON
66
- * source. Good enough for navigation — JSON keys are usually unique at
66
+ * source. Good enough for navigation: JSON keys are usually unique at
67
67
  * the level we report on, and even when nested duplicates exist the
68
68
  * first occurrence points at the right region of the file.
69
69
  */
@@ -76,7 +76,7 @@ function findKeyLine(raw, key) {
76
76
  return line;
77
77
  }
78
78
  /**
79
- * VTTF-AUDIT-001 (HIGH) — flags.hotReload shape.
79
+ * VTTF-AUDIT-001 (HIGH): flags.hotReload shape.
80
80
  *
81
81
  * v12 accepted `"hotReload": ["css", "hbs", ...]` (array). v13 expects
82
82
  * `"hotReload": { "extensions": [...], "paths": [...] }` (object at the
@@ -115,18 +115,18 @@ function ruleHotReload(manifest) {
115
115
  severity: "HIGH",
116
116
  filePath: manifest.path,
117
117
  line,
118
- message: "flags.hotReload must declare an `extensions` array — Foundry has no default and the watcher silently does nothing without it.",
118
+ message: "flags.hotReload must declare an `extensions` array. Foundry has no default and the watcher silently does nothing without it.",
119
119
  remediation: "Add `extensions`: `\"hotReload\": { \"extensions\": [\"css\", \"hbs\", \"json\"], \"paths\": [\"styles\", \"templates\", \"lang\"] }`. `paths` is optional (defaults to the package root) but recommended."
120
120
  }];
121
121
  return [];
122
122
  }
123
123
  /**
124
- * VTTF-AUDIT-002 (MEDIUM) — deprecated top-level grid fields.
124
+ * VTTF-AUDIT-002 (MEDIUM): deprecated top-level grid fields.
125
125
  *
126
126
  * v12 used flat `gridDistance` + `gridUnits`. v13 wants
127
127
  * `grid: { type, distance, units, diagonals }`. The legacy keys still
128
128
  * work today (Foundry auto-migrates and warns) but will be removed in
129
- * v14 — flag them now so the project is forward-compatible.
129
+ * v14. Flag them now so the project is forward-compatible.
130
130
  */
131
131
  function ruleGridShape(manifest) {
132
132
  const hasLegacyDistance = "gridDistance" in manifest.parsed;
@@ -144,7 +144,7 @@ function ruleGridShape(manifest) {
144
144
  }];
145
145
  }
146
146
  /**
147
- * VTTF-AUDIT-003 (LOW) — styles array of strings.
147
+ * VTTF-AUDIT-003 (LOW): styles array of strings.
148
148
  *
149
149
  * v12 took `styles: ["styles/foo.css"]`. v13 expects `styles: [{ src,
150
150
  * layer? }]` so cascade-layer ordering can be declared in the manifest.
@@ -188,10 +188,10 @@ async function runManifestRules(cwd) {
188
188
  * project root (excluding common build/dependency dirs) and apply regex
189
189
  * heuristics to spot four v13 footguns from the VTTForge audit catalog:
190
190
  *
191
- * VTTF-AUDIT-004 (MEDIUM) — HTMLField/FilePathField missing manifest declaration
192
- * VTTF-AUDIT-005 (MEDIUM) — extends TypeDataModel without prepareBaseData stub
193
- * VTTF-AUDIT-006 (LOW) — `_addDataFieldMigrations` override (wrong signature)
194
- * VTTF-AUDIT-007 (MEDIUM) — manifest primary/secondaryTokenAttribute not matched
191
+ * VTTF-AUDIT-004 (MEDIUM): HTMLField/FilePathField missing manifest declaration
192
+ * VTTF-AUDIT-005 (MEDIUM): extends TypeDataModel without prepareBaseData stub
193
+ * VTTF-AUDIT-006 (LOW) : `_addDataFieldMigrations` override (wrong signature)
194
+ * VTTF-AUDIT-007 (MEDIUM): manifest primary/secondaryTokenAttribute not matched
195
195
  * by a `value`/`max` SchemaField in source
196
196
  *
197
197
  * Regex-based on purpose: avoids pulling in a TypeScript AST dependency
@@ -199,7 +199,7 @@ async function runManifestRules(cwd) {
199
199
  * false negatives on heavily-formatted code; the alternative would be a
200
200
  * 30MB+ runtime dep for marginal gains.
201
201
  */
202
- /** Directories we never descend into — they're not user source. */
202
+ /** Directories we never descend into; they are not user source. */
203
203
  const EXCLUDED_DIRS = /* @__PURE__ */ new Set([
204
204
  "node_modules",
205
205
  "dist",
@@ -242,7 +242,7 @@ function lineOf(content, needle) {
242
242
  for (let i = 0; i < idx; i += 1) if (content[i] === "\n") line += 1;
243
243
  return line;
244
244
  }
245
- /** VTTF-AUDIT-005 — `extends TypeDataModel` without a `prepareBaseData(...)` method. */
245
+ /** VTTF-AUDIT-005: `extends TypeDataModel` without a `prepareBaseData(...)` method. */
246
246
  function rule005(filePath, content) {
247
247
  const out = [];
248
248
  const directClasses = findDirectTypeDataModelClasses(content);
@@ -295,7 +295,7 @@ function findDirectTypeDataModelClasses(content) {
295
295
  }
296
296
  return out;
297
297
  }
298
- /** VTTF-AUDIT-006 — `_addDataFieldMigrations(` override on a TypeDataModel subclass. */
298
+ /** VTTF-AUDIT-006: `_addDataFieldMigrations(` override on a TypeDataModel subclass. */
299
299
  function rule006(filePath, content) {
300
300
  if (!/_addDataFieldMigrations\s*\(/.test(content)) return [];
301
301
  if (!/extends\s+(?:[\w.]+\.)?(?:Base)?TypeDataModel\b/.test(content)) return [];
@@ -500,7 +500,7 @@ function findConfigMappings(content) {
500
500
  * Match `<name>: new (f|fields|foundry.data.fields).HTMLField(` or
501
501
  * `.FilePathField(`. We capture the field name, the field type, the
502
502
  * enclosing class, AND the dot-path through any enclosing SchemaField
503
- * wrappers — so rule 004 compares against the FULL manifest declaration
503
+ * wrappers, so rule 004 compares against the FULL manifest declaration
504
504
  * path (`profile.bio`), not just the leaf segment (`bio`).
505
505
  */
506
506
  const RICH_FIELD_RE = /(\w+)\s*:\s*new\s+(?:[\w.]+\.)?(HTMLField|FilePathField)\s*\(/g;
@@ -567,7 +567,7 @@ function normalizeDeclaredPath(path) {
567
567
  * Find one subtype's declarations, accounting for the module prefix.
568
568
  *
569
569
  * A system declares `character` in the manifest and registers `character`
570
- * in source — the two match directly. A module declares `vehicle` but
570
+ * in source, so the two match directly. A module declares `vehicle` but
571
571
  * Foundry registers it as `my-module.vehicle`, and that prefixed form is
572
572
  * what appears in source. Comparing the two verbatim reports every
573
573
  * correctly declared module field as missing, so fall back to the bare key
@@ -584,13 +584,13 @@ function lookupSubtype(declared, doc, subtype) {
584
584
  return declared.perSubtype.get(`${doc}.${subtype.slice(prefix.length)}`);
585
585
  }
586
586
  /**
587
- * VTTF-AUDIT-004 — cross-check source HTMLField/FilePathField usages
587
+ * VTTF-AUDIT-004: cross-check source HTMLField/FilePathField usages
588
588
  * against the manifest's documentTypes declarations.
589
589
  *
590
590
  * Subtype-aware: if the enclosing class is registered on
591
591
  * `CONFIG.<Doc>.dataModels.<subtype>`, the field must be declared in
592
- * THAT subtype's htmlFields / filePathFields. Otherwise — class
593
- * unregistered, registration spread across files, dynamic registration —
592
+ * THAT subtype's htmlFields / filePathFields. Otherwise (class
593
+ * unregistered, registration spread across files, dynamic registration)
594
594
  * we fall back to the global union check (catches the common "forgot to
595
595
  * declare anything" case without false positives on advanced setups).
596
596
  */
@@ -634,14 +634,14 @@ function rule004(filePath, content, declared, classToSubtypes) {
634
634
  return out;
635
635
  }
636
636
  /**
637
- * VTTF-AUDIT-007 — manifest's `primaryTokenAttribute` /
637
+ * VTTF-AUDIT-007: manifest's `primaryTokenAttribute` /
638
638
  * `secondaryTokenAttribute` must point at a SchemaField with `value` +
639
639
  * `max` keys. If not, Foundry's `getBarAttribute` silently degrades to
640
640
  * value-only rendering (no bar at all).
641
641
  *
642
642
  * Cross-check walks the source for every SchemaField declaration paired
643
643
  * with its full schema path (`buildSchemaPath`). The manifest path is
644
- * matched EXACTLY — `primaryTokenAttribute: 'health'` does not accept a
644
+ * matched EXACTLY: `primaryTokenAttribute: 'health'` does not accept a
645
645
  * nested `attributes.health` SchemaField, and a nested path like
646
646
  * `attributes.hp` is resolved by finding the declaration at that exact
647
647
  * dot-path. No more "verify manually" branch; either the path resolves
@@ -684,7 +684,7 @@ function lineOfInRaw(raw, key) {
684
684
  * Why exact path: an unqualified `health: new SchemaField(...)` inside
685
685
  * `attributes: new SchemaField({...})` has schema path `attributes.health`.
686
686
  * Manifest `primaryTokenAttribute: 'health'` should NOT resolve to that
687
- * nested declaration — Foundry walks the document path structurally and
687
+ * nested declaration. Foundry walks the document path structurally and
688
688
  * would look for `health.value` at the top of `system`, not under
689
689
  * `attributes`.
690
690
  */
@@ -738,7 +738,7 @@ function findAllSchemaFields(content) {
738
738
  * Extract identifier keys declared at depth 0 of an object-literal body.
739
739
  *
740
740
  * The naive `value:`/`max:` regex check matches nested constructor options
741
- * too — `value: new NumberField({ max: 100 })` looked to a flat regex like
741
+ * too: `value: new NumberField({ max: 100 })` looked to a flat regex like
742
742
  * both keys were SchemaField siblings. Walking the body byte-by-byte with
743
743
  * depth tracking + string-boundary handling correctly distinguishes
744
744
  * top-level keys from nested ones.
@@ -942,7 +942,7 @@ const SEVERITY_RANK = {
942
942
  //#endregion
943
943
  //#region src/audit/index.ts
944
944
  /**
945
- * Audit orchestrator — runs every rule against a project root and
945
+ * Audit orchestrator: runs every rule against a project root and
946
946
  * aggregates the findings into an `AuditReport`.
947
947
  *
948
948
  * Rule organisation:
@@ -950,7 +950,7 @@ const SEVERITY_RANK = {
950
950
  * - source-rules.ts → VTTF-AUDIT-004, 005, 006, 007 (source walker
951
951
  * + cross-check with manifest where needed)
952
952
  *
953
- * The orchestrator stays minimal — it knows which rule sets exist, but
953
+ * The orchestrator stays minimal. It knows which rule sets exist, but
954
954
  * the rules themselves are responsible for their own file IO. This keeps
955
955
  * the individual rule files testable in isolation.
956
956
  */
@@ -1040,7 +1040,7 @@ function formatMarkdown(report) {
1040
1040
  function formatFinding(finding, cwd) {
1041
1041
  const location = formatLocation(finding, cwd);
1042
1042
  const lines = [];
1043
- lines.push(`### \`${finding.ruleId}\` — ${finding.title}`);
1043
+ lines.push(`### \`${finding.ruleId}\`: ${finding.title}`);
1044
1044
  lines.push("");
1045
1045
  lines.push(`- file: ${location}`);
1046
1046
  lines.push(`- message: ${finding.message}`);
@@ -1064,7 +1064,7 @@ function relativizeIfBelow(filePath, cwd) {
1064
1064
  //#endregion
1065
1065
  //#region src/commands/audit.ts
1066
1066
  /**
1067
- * `vttforge audit` — scan a system/module project against the VTTForge
1067
+ * `vttforge audit`: scan a system/module project against the VTTForge
1068
1068
  * audit catalog (seven v13 manifest + code footguns).
1069
1069
  *
1070
1070
  * The seven rules (VTTF-AUDIT-001 through 007) live in
@@ -1072,8 +1072,8 @@ function relativizeIfBelow(filePath, cwd) {
1072
1072
  * CLI surface that orchestrates them and prints the report.
1073
1073
  *
1074
1074
  * Exit codes:
1075
- * 0 — clean run, or only MEDIUM/LOW findings (informational)
1076
- * 1 — at least one HIGH finding (or any finding in `--strict` mode)
1075
+ * 0: clean run, or only MEDIUM/LOW findings (informational)
1076
+ * 1: at least one HIGH finding (or any finding in `--strict` mode)
1077
1077
  */
1078
1078
  async function runAuditCommand(options = {}) {
1079
1079
  const cwd = resolve(options.cwd ?? process.cwd());
@@ -1097,7 +1097,7 @@ async function runAuditCommand(options = {}) {
1097
1097
  * The vite plugin emits the manifest into `dist/` during build, so the CLI
1098
1098
  * commands that come after a build (dev's initial symlink, build's release
1099
1099
  * zip) read from there rather than walking source. This file is intentionally
1100
- * tiny — we extract just the fields the CLI cares about and surface the
1100
+ * tiny: we extract just the fields the CLI cares about and surface the
1101
1101
  * rest as `raw` for any consumer that wants more.
1102
1102
  */
1103
1103
  const MANIFEST_FILES = [{
@@ -1112,7 +1112,7 @@ const MANIFEST_VERSION_RE = /^[0-9A-Za-z._+-]+$/;
1112
1112
  /**
1113
1113
  * Locate and parse the Foundry manifest inside the given dist directory.
1114
1114
  * Prefers `system.json`, falls back to `module.json` (a single dist can't
1115
- * be both — the vite plugin emits exactly one based on the project type).
1115
+ * be both; the vite plugin emits exactly one based on the project type).
1116
1116
  *
1117
1117
  * Throws if neither file exists, required fields are missing/non-string,
1118
1118
  * or the id/version contain characters that would let downstream `join()`
@@ -1133,7 +1133,7 @@ async function readManifest(distDir) {
1133
1133
  const id = raw.id;
1134
1134
  const version = raw.version;
1135
1135
  if (typeof id !== "string" || id.length === 0) throw new Error(`Manifest at ${path} is missing a non-empty "id" field.`);
1136
- if (!MANIFEST_ID_RE.test(id)) throw new Error(`Manifest at ${path} has an invalid "id" (${JSON.stringify(id)}). Foundry package ids must match ${MANIFEST_ID_RE} — lowercase letters, digits, dashes, dots, underscores; must start with a letter.`);
1136
+ if (!MANIFEST_ID_RE.test(id)) throw new Error(`Manifest at ${path} has an invalid "id" (${JSON.stringify(id)}). Foundry package ids must match ${MANIFEST_ID_RE}: lowercase letters, digits, dashes, dots, underscores; must start with a letter.`);
1137
1137
  if (typeof version !== "string" || version.length === 0) throw new Error(`Manifest at ${path} is missing a non-empty "version" field.`);
1138
1138
  if (!MANIFEST_VERSION_RE.test(version)) throw new Error(`Manifest at ${path} has an invalid "version" (${JSON.stringify(version)}). Use a semver-ish string with letters, digits, dots, dashes, plus, or underscore.`);
1139
1139
  return {
@@ -1143,7 +1143,7 @@ async function readManifest(distDir) {
1143
1143
  raw
1144
1144
  };
1145
1145
  }
1146
- throw new Error(`No Foundry manifest found in ${distDir}. Expected system.json or module.json — did you run \`vite build\` first?`);
1146
+ throw new Error(`No Foundry manifest found in ${distDir}. Expected system.json or module.json. Did you run \`vite build\` first?`);
1147
1147
  }
1148
1148
  //#endregion
1149
1149
  //#region src/package-manager.ts
@@ -1154,7 +1154,7 @@ async function readManifest(distDir) {
1154
1154
  * Strategy: read `npm_config_user_agent`, which pnpm/npm/bun/yarn all set when
1155
1155
  * they spawn a child process (including `pnpm dlx`, `pnpm create`, etc.).
1156
1156
  * Falls back to `pnpm` because that's the VTTForge house default and the
1157
- * most common Foundry-developer choice — but any concrete signal in the
1157
+ * most common Foundry-developer choice, but any concrete signal in the
1158
1158
  * environment wins over the default.
1159
1159
  */
1160
1160
  function detectPackageManager(env = process.env) {
@@ -1172,7 +1172,7 @@ function installCommand(pm) {
1172
1172
  }
1173
1173
  /**
1174
1174
  * Detect a project's package manager by looking at which lockfile it
1175
- * ships. `dev` and `build` need this — by the time the user runs
1175
+ * ships. `dev` and `build` need this: by the time the user runs
1176
1176
  * `vttforge dev`, npm_config_user_agent reflects whatever shell launched
1177
1177
  * the binary (often nothing in a global install), not how the project
1178
1178
  * was bootstrapped. The lockfile is the project's own contract.
@@ -1190,7 +1190,7 @@ function detectProjectPackageManager(cwd, env = process.env) {
1190
1190
  /**
1191
1191
  * Argument vector to invoke `vite` (or any other locally-installed CLI)
1192
1192
  * via the project's package manager. We always shell out through `<pm>
1193
- * exec` so the call works regardless of the linker's choices — Yarn 4
1193
+ * exec` so the call works regardless of the linker's choices. Yarn 4
1194
1194
  * Plug'n'Play, pnpm's symlinked layout, npm's flattened node_modules,
1195
1195
  * Bun's symlinked node_modules. Each manager exposes a uniform "run a
1196
1196
  * locally-resolved binary in the project's dependency graph" command.
@@ -1314,7 +1314,7 @@ async function emitZip(opts) {
1314
1314
  //#endregion
1315
1315
  //#region src/commands/build.ts
1316
1316
  /**
1317
- * `vttforge build` — emit a foundryvtt.com-ready release zip.
1317
+ * `vttforge build`: emit a foundryvtt.com-ready release zip.
1318
1318
  *
1319
1319
  * Flow:
1320
1320
  * 1. Clean dist/
@@ -1373,7 +1373,7 @@ async function emitReleaseZip(opts) {
1373
1373
  }
1374
1374
  async function runBuild(options = {}) {
1375
1375
  const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
1376
- p.intro("🜲 vttforge build — release zip");
1376
+ p.intro("🜲 vttforge build: release zip");
1377
1377
  const distDir = join(cwd, "dist");
1378
1378
  await rm(distDir, {
1379
1379
  recursive: true,
@@ -1401,7 +1401,7 @@ async function runBuild(options = {}) {
1401
1401
  * back to the project's `dist/` so Foundry serves freshly-built files as
1402
1402
  * vite writes them. The win32 path matters: with `type: 'junction'` the
1403
1403
  * operation works on standard Windows shells without Developer Mode, while
1404
- * `type: 'dir'` requires admin. We never silently fall back to copying —
1404
+ * `type: 'dir'` requires admin. We never silently fall back to copying;
1405
1405
  * Foundry's HMR relies on live file mutation, and a copy snapshot defeats
1406
1406
  * the loop. If the symlink fails, we surface the platform-specific fix.
1407
1407
  */
@@ -1459,7 +1459,7 @@ async function createLink(target, source, options = {}) {
1459
1459
  }
1460
1460
  /**
1461
1461
  * Remove a symlink at `path`. No-ops when the path doesn't exist. Throws
1462
- * when the path exists but isn't a symlink — we never unlink real files
1462
+ * when the path exists but isn't a symlink; we never unlink real files
1463
1463
  * or directories.
1464
1464
  */
1465
1465
  async function removeLink(path) {
@@ -1483,7 +1483,7 @@ async function removeLink(path) {
1483
1483
  *
1484
1484
  * Foundry loads a module from a directory under `Data/modules/<id>/` holding
1485
1485
  * `module.json` and the files it names. The published package already has
1486
- * exactly that shape, so the install is a link to the package root — no copy
1486
+ * exactly that shape, so the install is a link to the package root, no copy
1487
1487
  * to keep in step, and a `pnpm update` is picked up on the next reload.
1488
1488
  *
1489
1489
  * A container is the other case: it cannot follow a host symlink, so the
@@ -1495,7 +1495,7 @@ const DEV_MODULE_ID = "vttforge-dev";
1495
1495
  * Find the installed package directory.
1496
1496
  *
1497
1497
  * Resolved from the consumer's project so their `node_modules` answers,
1498
- * falling back to this CLI's own resolution — which is what makes it work
1498
+ * falling back to this CLI's own resolution, which is what makes it work
1499
1499
  * inside this repository, where the package is a workspace link.
1500
1500
  */
1501
1501
  function resolveDevModuleDir(cwd) {
@@ -1537,7 +1537,7 @@ const WS_GUID = "258EAFA5-E914-47DA-95CA-C5AB0DC85B11";
1537
1537
  /** Frame lengths above these switch to a wider length field. */
1538
1538
  const LEN_16_BIT = 126;
1539
1539
  const LEN_64_BIT = 65536;
1540
- /** Opcode 0x8 — the client is closing. */
1540
+ /** Opcode 0x8: the client is closing. */
1541
1541
  const OPCODE_CLOSE = 8;
1542
1542
  /**
1543
1543
  * Compute the handshake response header.
@@ -1553,7 +1553,7 @@ function acceptKey(clientKey) {
1553
1553
  *
1554
1554
  * Server frames are never masked. The payload length picks one of three
1555
1555
  * widths, and getting the boundary wrong corrupts the stream rather than
1556
- * failing loudly — hence the explicit constants and the tests around them.
1556
+ * failing loudly, hence the explicit constants and the tests around them.
1557
1557
  */
1558
1558
  function encodeTextFrame(message) {
1559
1559
  const payload = Buffer.from(message, "utf8");
@@ -1582,7 +1582,7 @@ async function startDevServer(options) {
1582
1582
  const sockets = /* @__PURE__ */ new Set();
1583
1583
  const server = createServer((_req, res) => {
1584
1584
  res.writeHead(426, { "Content-Type": "text/plain" });
1585
- res.end("This port speaks WebSocket only — it is the vttforge dev bridge.\n");
1585
+ res.end("This port speaks WebSocket only; it is the vttforge dev bridge.\n");
1586
1586
  });
1587
1587
  server.on("upgrade", (req, socket) => {
1588
1588
  const key = req.headers["sec-websocket-key"];
@@ -1642,7 +1642,7 @@ async function startDevServer(options) {
1642
1642
  *
1643
1643
  * Watching `dist/` rather than hooking into Vite is deliberate: Vite rebuilds
1644
1644
  * into that directory whatever its internals look like, so this stays correct
1645
- * across bundler versions and gives the served path directly — `dist/` is what
1645
+ * across bundler versions and gives the served path directly: `dist/` is what
1646
1646
  * Foundry mounts, so a file's position inside it is its position under
1647
1647
  * `/systems/<id>/`.
1648
1648
  */
@@ -1654,14 +1654,14 @@ const RELOADABLE = /* @__PURE__ */ new Set([
1654
1654
  "json"
1655
1655
  ]);
1656
1656
  /**
1657
- * Editors save in bursts — write, rename, truncate — and a burst should be
1657
+ * Editors save in bursts (write, rename, truncate) and a burst should be
1658
1658
  * one reload, not four.
1659
1659
  */
1660
1660
  const DEBOUNCE_MS = 40;
1661
1661
  /**
1662
1662
  * The path Foundry serves this file at.
1663
1663
  *
1664
- * Always POSIX separators — it becomes a URL, and a Windows backslash would
1664
+ * Always POSIX separators: it becomes a URL, and a Windows backslash would
1665
1665
  * not match the `<link>` the browser rendered.
1666
1666
  */
1667
1667
  function servedPath(relative, packageId, packageType) {
@@ -1717,7 +1717,7 @@ function watchDist(options) {
1717
1717
  *
1718
1718
  * A rebuild rewrites every output file, changed or not, so the filesystem
1719
1719
  * event alone says "the bundler ran", not "the developer edited this".
1720
- * Comparing content is what makes a reload mean the second thing — and it
1720
+ * Comparing content is what makes a reload mean the second thing, and it
1721
1721
  * matters: a language file rewritten untouched would redraw every open
1722
1722
  * window, undoing the scoped re-render on the file that did change.
1723
1723
  */
@@ -1743,7 +1743,7 @@ function watchDist(options) {
1743
1743
  }));
1744
1744
  };
1745
1745
  if (!existsSync(options.distDir)) {
1746
- options.onError?.(`Cannot watch ${options.distDir} — the directory does not exist.`);
1746
+ options.onError?.(`Cannot watch ${options.distDir}: the directory does not exist.`);
1747
1747
  return { close: () => void 0 };
1748
1748
  }
1749
1749
  let watcher;
@@ -1789,12 +1789,12 @@ function watchDist(options) {
1789
1789
  * The OS-default detection treats `XDG_DATA_HOME` (Linux) and `%LOCALAPPDATA%`
1790
1790
  * (Windows) as part of the OS convention, not as Foundry-specific overrides.
1791
1791
  *
1792
- * Everything here is pure — `platform`, `env`, and `home` flow through
1792
+ * Everything here is pure: `platform`, `env`, and `home` flow through
1793
1793
  * options so tests can drive every branch without monkey-patching globals.
1794
1794
  */
1795
1795
  /**
1796
1796
  * Return the OS-default Foundry user-data directory, or `null` on unknown
1797
- * platforms / missing platform-specific env vars. Does NOT check existence —
1797
+ * platforms / missing platform-specific env vars. Does NOT check existence;
1798
1798
  * callers prompt the user when the suggested path doesn't resolve.
1799
1799
  */
1800
1800
  function autoDetectFoundryDataDir(platform = process.platform, env = process.env, home = homedir()) {
@@ -1850,7 +1850,7 @@ async function saveConfig(cwd, config) {
1850
1850
  /**
1851
1851
  * Heuristic: is `path` already Foundry's `Data/` folder (vs. its parent)?
1852
1852
  * We treat the path as Data when:
1853
- * - basename is "Data" (case-insensitive — macOS/Windows file systems
1853
+ * - basename is "Data" (case-insensitive, since macOS/Windows file systems
1854
1854
  * are case-insensitive by default), OR
1855
1855
  * - any of `systems/`, `modules/`, `worlds/` exists inside (proof that
1856
1856
  * Foundry has previously written package folders here).
@@ -1866,7 +1866,7 @@ function isFoundryDataFolder(path) {
1866
1866
  * Resolve the packages directory (`Data/systems/` or `Data/modules/`) under
1867
1867
  * the given Foundry user-data root. Accepts the path Foundry itself runs
1868
1868
  * with (the user-data folder, which contains `Data/`) OR the `Data/` folder
1869
- * directly — both are common in muscle memory.
1869
+ * directly; both are common in muscle memory.
1870
1870
  *
1871
1871
  * The returned path is not guaranteed to exist yet; callers `mkdir -p` it
1872
1872
  * before creating the symlink.
@@ -1905,7 +1905,7 @@ async function resolveFoundryDataDir(opts) {
1905
1905
  const detected = autoDetectFoundryDataDir(platform, env, home);
1906
1906
  if (prompt) {
1907
1907
  const choice = await prompt(detected);
1908
- if (!choice) throw new Error("No Foundry data directory selected — aborting.");
1908
+ if (!choice) throw new Error("No Foundry data directory selected. Aborting.");
1909
1909
  const chosen = resolve(expandTilde(choice, home));
1910
1910
  await saveConfig(cwd, {
1911
1911
  ...config,
@@ -1922,7 +1922,7 @@ async function resolveFoundryDataDir(opts) {
1922
1922
  *
1923
1923
  * Every failure here returns null rather than throwing. A busy port or a
1924
1924
  * missing companion package should cost the developer hot reload, not the
1925
- * dev loop — the build and the symlink are the load-bearing parts, and they
1925
+ * dev loop: the build and the symlink are the load-bearing parts, and they
1926
1926
  * already succeeded by the time this runs.
1927
1927
  */
1928
1928
  async function startHotReloadBridge(opts) {
@@ -1935,7 +1935,7 @@ async function startHotReloadBridge(opts) {
1935
1935
  try {
1936
1936
  server = await startDevServer({ port: opts.port });
1937
1937
  } catch {
1938
- p.note(`Port ${opts.port} is in use — another \`vttforge dev\` is probably running.\nPass --hmr-port to use a different one.`, "Hot reload unavailable");
1938
+ p.note(`Port ${opts.port} is in use; another \`vttforge dev\` is probably running.\nPass --hmr-port to use a different one.`, "Hot reload unavailable");
1939
1939
  return null;
1940
1940
  }
1941
1941
  const modulesDir = foundryPackagesDir(opts.dataRoot, "module");
@@ -1972,7 +1972,7 @@ async function startHotReloadBridge(opts) {
1972
1972
  */
1973
1973
  function createDataDirPrompt() {
1974
1974
  return async (autoDetected) => {
1975
- p.note(autoDetected ? `Detected Foundry user-data directory:\n ${autoDetected}` : "Could not auto-detect a Foundry user-data directory on this OS — please type the path.", "First-run setup");
1975
+ p.note(autoDetected ? `Detected Foundry user-data directory:\n ${autoDetected}` : "Could not auto-detect a Foundry user-data directory on this OS. Please type the path.", "First-run setup");
1976
1976
  if (autoDetected) {
1977
1977
  const useDetected = await p.confirm({
1978
1978
  message: "Use detected directory?",
@@ -1995,7 +1995,7 @@ function createDataDirPrompt() {
1995
1995
  /**
1996
1996
  * Install signal handlers that fire once. We use `process.once` so a second
1997
1997
  * Ctrl-C while cleanup is in flight propagates as a hard exit instead of
1998
- * being swallowed (the user gave up on graceful shutdown — let them).
1998
+ * being swallowed (the user gave up on graceful shutdown; let them).
1999
1999
  */
2000
2000
  function installSignalHandlers(cleanup) {
2001
2001
  let invoked = false;
@@ -2013,7 +2013,7 @@ function installSignalHandlers(cleanup) {
2013
2013
  }
2014
2014
  async function runDev(options = {}) {
2015
2015
  const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
2016
- p.intro("🜲 vttforge dev — symlink + watch");
2016
+ p.intro("🜲 vttforge dev: symlink + watch");
2017
2017
  if (!existsSync(join(cwd, "package.json"))) {
2018
2018
  p.cancel(`No package.json at ${cwd}. Run \`vttforge dev\` from inside a scaffolded project.`);
2019
2019
  throw new Error("Missing package.json");
@@ -2048,7 +2048,7 @@ async function runDev(options = {}) {
2048
2048
  manifest,
2049
2049
  port: options.hmrPort ?? 31313
2050
2050
  });
2051
- p.note(`${bridge ? "Saves apply in place — no page refresh." : "Hot reload is off; saves need a page refresh."}\nCtrl-C to stop.`, "Watching");
2051
+ p.note(`${bridge ? "Saves apply in place, no page refresh." : "Hot reload is off; saves need a page refresh."}\nCtrl-C to stop.`, "Watching");
2052
2052
  const watcher = spawnViteWatch(cwd);
2053
2053
  await new Promise((resolveDev) => {
2054
2054
  const cleanup = async () => {
@@ -2092,7 +2092,7 @@ async function setupDevSymlink(opts) {
2092
2092
  /**
2093
2093
  * Tear down a dev symlink iff it still points at the expected source.
2094
2094
  * Refuses to remove a symlink that another `vttforge dev` session (or a
2095
- * manual `ln -s`) has since redirected — that link doesn't belong to us
2095
+ * manual `ln -s`) has since redirected. That link doesn't belong to us
2096
2096
  * and removing it would silently disconnect their setup.
2097
2097
  */
2098
2098
  async function cleanupDevSymlink(opts) {
@@ -2103,7 +2103,7 @@ async function cleanupDevSymlink(opts) {
2103
2103
  /**
2104
2104
  * Git helpers for the init scaffolder. Optional: every step degrades to a
2105
2105
  * warning, never throws. The scaffold completes even if git is missing or
2106
- * the user has no global git config — the user can still `git init`
2106
+ * the user has no global git config. The user can still `git init`
2107
2107
  * themselves later.
2108
2108
  */
2109
2109
  const execFileAsync = promisify(execFile);
@@ -2157,7 +2157,7 @@ async function initGitRepo(cwd) {
2157
2157
  * preserving the relative path. Directories are created lazily on first
2158
2158
  * write.
2159
2159
  *
2160
- * We intentionally avoid Handlebars or any other template engine — the
2160
+ * We intentionally avoid Handlebars or any other template engine. The
2161
2161
  * substitution surface is small (a flat string-to-string map), and bundling
2162
2162
  * a dependency for ten lines of regex would be wasteful in a tool whose
2163
2163
  * value is being fast to invoke.
@@ -2187,7 +2187,7 @@ async function* walkRelative(dir, base = dir) {
2187
2187
  /**
2188
2188
  * Files that should be substituted as text. Binary assets (.png, .ico, …)
2189
2189
  * bypass substitution and are copied byte-for-byte. The list of binary
2190
- * extensions is intentionally small — extend if we add real binary assets
2190
+ * extensions is intentionally small; extend if we add real binary assets
2191
2191
  * to templates.
2192
2192
  */
2193
2193
  const BINARY_EXTENSIONS = /* @__PURE__ */ new Set([
@@ -2251,7 +2251,7 @@ function templatesRoot() {
2251
2251
  //#endregion
2252
2252
  //#region src/commands/init.ts
2253
2253
  /**
2254
- * `vttforge init` — interactive scaffolder.
2254
+ * `vttforge init`: interactive scaffolder.
2255
2255
  *
2256
2256
  * Honors CLI flags first, prompts for everything missing, then copies the
2257
2257
  * matching template into the destination directory. Optionally `git init`s
@@ -2261,18 +2261,18 @@ const PACKAGE_ID_RE = /^[a-z][a-z0-9-]*$/;
2261
2261
  const UNSAFE_METADATA_CHARS_RE = /["\\\r\n\t]/;
2262
2262
  function validateMetadata(value) {
2263
2263
  if (!value) return void 0;
2264
- if (UNSAFE_METADATA_CHARS_RE.test(value)) return "Avoid backslashes, double quotes, and line breaks — they break the generated manifest.";
2265
- if (value.includes("*/")) return "Avoid `*/` — it closes block comments in the generated source headers.";
2264
+ if (UNSAFE_METADATA_CHARS_RE.test(value)) return "Avoid backslashes, double quotes, and line breaks; they break the generated manifest.";
2265
+ if (value.includes("*/")) return "Avoid `*/`; it closes block comments in the generated source headers.";
2266
2266
  }
2267
2267
  function validateRequiredMetadata(value) {
2268
- if (!value || value.trim().length === 0) return "Required — Foundry rejects packages with a blank title.";
2268
+ if (!value || value.trim().length === 0) return "Required: Foundry rejects packages with a blank title.";
2269
2269
  return validateMetadata(value);
2270
2270
  }
2271
2271
  function validatePackageId(value) {
2272
2272
  if (!PACKAGE_ID_RE.test(value ?? "")) return "Package id must start with a letter and contain only lowercase letters, digits, dashes";
2273
2273
  }
2274
2274
  /**
2275
- * Thrown when the scaffolder cannot continue — bad input, an existing
2275
+ * Thrown when the scaffolder cannot continue: bad input, an existing
2276
2276
  * destination, a cancelled prompt, etc. `runInit` propagates these instead
2277
2277
  * of calling `process.exit`, so library consumers (tests, other CLIs) can
2278
2278
  * catch and recover. The `vttforge` bin wraps `runInit` in a top-level
@@ -2304,7 +2304,7 @@ function titleCase(input) {
2304
2304
  * Whether we may ask the user anything at all.
2305
2305
  *
2306
2306
  * Clack reads from stdin. With no terminal attached there is nothing to read,
2307
- * and the prompt simply hangs — so a run that cannot ask has to be told every
2307
+ * and the prompt simply hangs. So a run that cannot ask has to be told every
2308
2308
  * answer up front, or be given `--yes` and take the defaults.
2309
2309
  */
2310
2310
  function canPrompt(yes) {
@@ -2316,7 +2316,7 @@ function templateVariantFor(type, lang) {
2316
2316
  async function runInit(options = {}) {
2317
2317
  const cwd = options.cwd ?? process.cwd();
2318
2318
  const interactive = canPrompt(options.yes);
2319
- p.intro("🜲 vttforge init — scaffold a Foundry v13+ system or module");
2319
+ p.intro("🜲 vttforge init: scaffold a Foundry v13+ system or module");
2320
2320
  let name = options.name?.trim();
2321
2321
  if (!name && !interactive) bail("A directory name is required when running without prompts. Pass it as the first argument: `vttforge init my-module --yes`.");
2322
2322
  if (!name) {
@@ -2341,10 +2341,10 @@ async function runInit(options = {}) {
2341
2341
  message: "What are you building?",
2342
2342
  options: [{
2343
2343
  value: "system",
2344
- label: "system — defines the game rules (Actor/Item types, sheets)"
2344
+ label: "system: defines the game rules (Actor/Item types, sheets)"
2345
2345
  }, {
2346
2346
  value: "module",
2347
- label: "module — extends an existing system or adds cross-system features"
2347
+ label: "module: extends an existing system or adds cross-system features"
2348
2348
  }],
2349
2349
  initialValue: "system"
2350
2350
  });
@@ -2516,7 +2516,7 @@ function runInstall(pm, cwd) {
2516
2516
  //#endregion
2517
2517
  //#region src/index.ts
2518
2518
  /**
2519
- * @vttforge/cli — public library exports.
2519
+ * @vttforge/cli: public library exports.
2520
2520
  *
2521
2521
  * The CLI is intended to be used as a bin (`vttforge` command). These
2522
2522
  * exports exist for consumers who want to programmatically invoke the
@@ -2526,4 +2526,4 @@ const VTTFORGE_CLI_VERSION = version;
2526
2526
  //#endregion
2527
2527
  export { installCommand as A, ViteNotInstalledError as C, detectPackageManager as D, spawnViteWatch as E, SEVERITY_RANK as F, runSourceRules as I, runManifestRules as L, runAuditCommand as M, formatReport as N, detectProjectPackageManager as O, runAudit as P, emitZip as S, runViteBuildOnce as T, createLink as _, substitute as a, emitReleaseZip as b, runDev as c, configPath as d, foundryPackagesDir as f, saveConfig as g, resolveFoundryDataDir as h, scaffold as i, readManifest as j, execInvocation as k, setupDevSymlink as l, looksLikeFoundryDataDir as m, ScaffoldError as n, templatesRoot as o, loadConfig as p, runInit as r, cleanupDevSymlink as s, VTTFORGE_CLI_VERSION as t, autoDetectFoundryDataDir as u, readLinkTarget as v, resolveViteInvocation as w, runBuild as x, removeLink as y };
2528
2528
 
2529
- //# sourceMappingURL=src-KI6RBaTd.mjs.map
2529
+ //# sourceMappingURL=src-C1qMqkzC.mjs.map