@vttforge/cli 0.18.7 → 0.18.9

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/index.d.mts CHANGED
@@ -1,4 +1,25 @@
1
- //#region src/audit/types.d.ts
1
+ /**
2
+ * @vttforge/cli: public library exports.
3
+ *
4
+ * The product here is the `vttforge` binary. These exports exist so another
5
+ * tool can drive the same work without shelling out, and they fall into three
6
+ * groups, marked per export below.
7
+ *
8
+ * **Supported.** `runInit` and the audit surface. `create-vttforge` calls
9
+ * `runInit`, and the audit rules are a documented extension point: a project
10
+ * can write its own `RuleFn` and hand it to the same reporter the CLI uses.
11
+ * These follow the deprecation policy.
12
+ *
13
+ * **`@experimental`.** Plausibly useful to a tool author, but no consumer has
14
+ * ever asked for them, so the shape is a guess. They can change in a minor.
15
+ *
16
+ * **`@internal`.** Implementation detail of the binary that reached the index
17
+ * by accident. Nothing outside this package imports them. They are staying
18
+ * only until the next major, and importing one is not supported today.
19
+ *
20
+ * See apps/docs/stability.md for what each tag promises.
21
+ */
22
+ /** Supported: run every audit rule over a project root. */
2
23
  /**
3
24
  * Shared types for the `vttforge audit` rule engine.
4
25
  *
@@ -47,24 +68,14 @@ export declare const SEVERITY_RANK: Record<Severity, number>;
47
68
  * together. Pure functions over the filesystem so tests inject tmp dirs.
48
69
  */
49
70
  type RuleFn = (cwd: string) => Promise<RuleResult[]> | RuleResult[];
50
- //#endregion
51
- //#region src/audit/index.d.ts
52
71
  interface RunAuditOptions {
53
72
  cwd: string;
54
73
  }
55
74
  export declare function runAudit(options: RunAuditOptions): Promise<AuditReport>;
56
- //#endregion
57
- //#region src/audit/manifest-rules.d.ts
58
75
  export declare function runManifestRules(cwd: string): Promise<RuleResult[]>;
59
- //#endregion
60
- //#region src/audit/reporter.d.ts
61
76
  type ReportFormat = 'json' | 'markdown';
62
77
  export declare function formatReport(report: AuditReport, format: ReportFormat): string;
63
- //#endregion
64
- //#region src/audit/source-rules.d.ts
65
78
  export declare function runSourceRules(cwd: string): Promise<RuleResult[]>;
66
- //#endregion
67
- //#region src/commands/audit.d.ts
68
79
  interface AuditOptions {
69
80
  /** Project root to scan. Defaults to `process.cwd()`. */
70
81
  cwd?: string;
@@ -88,8 +99,6 @@ interface AuditResult {
88
99
  * change in a minor.
89
100
  */
90
101
  export declare function runAuditCommand(options?: AuditOptions): Promise<AuditResult>;
91
- //#endregion
92
- //#region src/manifest.d.ts
93
102
  /**
94
103
  * Read a built manifest (`dist/system.json` or `dist/module.json`).
95
104
  *
@@ -123,8 +132,6 @@ interface FoundryManifest {
123
132
  * It can change in a minor.
124
133
  */
125
134
  export declare function readManifest(distDir: string): Promise<FoundryManifest>;
126
- //#endregion
127
- //#region src/commands/build.d.ts
128
135
  interface BuildOptions {
129
136
  /** Override the project root. Defaults to `process.cwd()`. */
130
137
  cwd?: string;
@@ -148,8 +155,6 @@ export declare function emitReleaseZip(opts: {
148
155
  * change in a minor.
149
156
  */
150
157
  export declare function runBuild(options?: BuildOptions): Promise<void>;
151
- //#endregion
152
- //#region src/commands/dev.d.ts
153
158
  interface DevOptions {
154
159
  /** Override the project root. Defaults to `process.cwd()`. */
155
160
  cwd?: string;
@@ -163,8 +168,6 @@ interface DevOptions {
163
168
  * change in a minor.
164
169
  */
165
170
  export declare function runDev(options?: DevOptions): Promise<void>;
166
- //#endregion
167
- //#region src/commands/init.d.ts
168
171
  /**
169
172
  * `vttforge init`: interactive scaffolder.
170
173
  *
@@ -222,8 +225,6 @@ export declare class ScaffoldError extends Error {
222
225
  constructor(message: string);
223
226
  }
224
227
  export declare function runInit(options?: InitOptions): Promise<void>;
225
- //#endregion
226
- //#region src/commands/lint.d.ts
227
228
  /**
228
229
  * `vttforge lint`: Biome over the project, then the v14 audit.
229
230
  *
@@ -265,8 +266,6 @@ interface LintResult {
265
266
  * change in a minor.
266
267
  */
267
268
  export declare function runLintCommand(options?: LintOptions): Promise<LintResult>;
268
- //#endregion
269
- //#region src/zip.d.ts
270
269
  /**
271
270
  * Emit a foundryvtt.com-compatible release zip.
272
271
  *
@@ -298,9 +297,5 @@ interface EmitZipResult {
298
297
  * change in a minor.
299
298
  */
300
299
  export declare function emitZip(opts: EmitZipOptions): Promise<EmitZipResult>;
301
- //#endregion
302
- //#region src/index.d.ts
303
300
  export declare const VTTFORGE_CLI_VERSION: string;
304
- //#endregion
305
- export type { AuditOptions, AuditReport, AuditResult, BuildOptions, DevOptions, EmitZipOptions, EmitZipResult, FoundryManifest, InitOptions, LintOptions, LintResult, PackageType, ReportFormat, ResolvedInitOptions, RuleFn, RuleResult, RunAuditOptions, Severity, TemplateVariant };
306
- //# sourceMappingURL=index.d.mts.map
301
+ export type { AuditOptions, AuditReport, AuditResult, BuildOptions, DevOptions, EmitZipOptions, EmitZipResult, FoundryManifest, InitOptions, LintOptions, LintResult, PackageType, ReportFormat, ResolvedInitOptions, RuleFn, RuleResult, RunAuditOptions, Severity, TemplateVariant };
package/dist/index.mjs CHANGED
@@ -1,2 +1 @@
1
- import { S as runManifestRules, _ as SEVERITY_RANK, a as runDev, c as emitZip, d as formatReport, f as runAudit, i as runInit, l as readManifest, n as runLintCommand, o as emitReleaseZip, r as ScaffoldError, s as runBuild, t as VTTFORGE_CLI_VERSION, u as runAuditCommand, y as runSourceRules } from "./src-DE_Jtt_1.mjs";
2
- export { SEVERITY_RANK, ScaffoldError, VTTFORGE_CLI_VERSION, emitReleaseZip, emitZip, formatReport, readManifest, runAudit, runAuditCommand, runBuild, runDev, runInit, runLintCommand, runManifestRules, runSourceRules };
1
+ export { _ as SEVERITY_RANK, r as ScaffoldError, t as VTTFORGE_CLI_VERSION, o as emitReleaseZip, c as emitZip, d as formatReport, l as readManifest, f as runAudit, u as runAuditCommand, s as runBuild, a as runDev, i as runInit, n as runLintCommand, S as runManifestRules, y as runSourceRules } from "./src-BXQZFdDl.mjs";
@@ -1,4 +1,3 @@
1
- import { createRequire } from "node:module";
2
1
  import { createWriteStream, existsSync, readFileSync, readdirSync, statSync, watch } from "node:fs";
3
2
  import { basename, dirname, extname, join, posix, relative, resolve, sep } from "node:path";
4
3
  import { lstat, mkdir, readFile, readdir, readlink, rm, stat, symlink, unlink, writeFile } from "node:fs/promises";
@@ -10,10 +9,10 @@ import { createHash } from "node:crypto";
10
9
  import { createServer } from "node:http";
11
10
  import { homedir } from "node:os";
12
11
  import { promisify } from "node:util";
13
- //#region package.json
14
- var version = "0.18.7";
15
- //#endregion
16
- //#region src/audit/manifest-rules.ts
12
+ import { createRequire } from "node:module";
13
+ // package.json
14
+ var version = "0.18.9";
15
+ // src/audit/manifest-rules.ts
17
16
  /**
18
17
  * Manifest-scope audit rules.
19
18
  *
@@ -339,8 +338,7 @@ async function runManifestRules(cwd) {
339
338
  }
340
339
  return results;
341
340
  }
342
- //#endregion
343
- //#region src/audit/release-rules.ts
341
+ // src/audit/release-rules.ts
344
342
  /**
345
343
  * VTTF-AUDIT-020 (HIGH): the release workflow ships the checkout, but the
346
344
  * project builds to `dist/`.
@@ -547,8 +545,7 @@ function maskComments(source, { strings = false } = {}) {
547
545
  function startsRegex(lastCode) {
548
546
  return lastCode === "" || "(,=:[!&|?{};+-*%<>~^".includes(lastCode);
549
547
  }
550
- //#endregion
551
- //#region src/audit/source-rules.ts
548
+ // src/audit/source-rules.ts
552
549
  /**
553
550
  * Source-tree audit rules.
554
551
  *
@@ -1449,8 +1446,7 @@ const _internal = {
1449
1446
  findClassRanges,
1450
1447
  EXCLUDED_DIRS
1451
1448
  };
1452
- //#endregion
1453
- //#region src/audit/template-rules.ts
1449
+ // src/audit/template-rules.ts
1454
1450
  /**
1455
1451
  * Template-scope audit rules.
1456
1452
  *
@@ -1593,16 +1589,14 @@ async function runTemplateRules(cwd) {
1593
1589
  }
1594
1590
  return [...results, ...removedHelpers];
1595
1591
  }
1596
- //#endregion
1597
- //#region src/audit/types.ts
1592
+ // src/audit/types.ts
1598
1593
  /** Severity rank for sorting (HIGH first). */
1599
1594
  const SEVERITY_RANK = {
1600
1595
  HIGH: 0,
1601
1596
  MEDIUM: 1,
1602
1597
  LOW: 2
1603
1598
  };
1604
- //#endregion
1605
- //#region src/audit/legacy-globals.ts
1599
+ // src/audit/legacy-globals.ts
1606
1600
  /**
1607
1601
  * The bare globals v13 turned into aliases of a `foundry.*` path.
1608
1602
  *
@@ -1740,8 +1734,7 @@ function definesName(source, name) {
1740
1734
  function bareUsePattern(name) {
1741
1735
  return new RegExp(`(?<![\\w$.])${name}\\b(?!\\s*:(?!:))(?=[\\s.(,;)\\]}]|$)`, "gm");
1742
1736
  }
1743
- //#endregion
1744
- //#region src/audit/v14-rules.ts
1737
+ // src/audit/v14-rules.ts
1745
1738
  /**
1746
1739
  * Source rules for the v13 code that v14 broke or deprecated.
1747
1740
  *
@@ -2023,8 +2016,7 @@ async function runV14Rules(cwd) {
2023
2016
  }
2024
2017
  return results;
2025
2018
  }
2026
- //#endregion
2027
- //#region src/audit/index.ts
2019
+ // src/audit/index.ts
2028
2020
  /**
2029
2021
  * Audit orchestrator: runs every rule against a project root and
2030
2022
  * aggregates the findings into an `AuditReport`.
@@ -2092,8 +2084,7 @@ function countBySeverity(findings) {
2092
2084
  for (const f of findings) counts[f.severity] += 1;
2093
2085
  return counts;
2094
2086
  }
2095
- //#endregion
2096
- //#region src/audit/reporter.ts
2087
+ // src/audit/reporter.ts
2097
2088
  /**
2098
2089
  * Render an `AuditReport` as JSON (machine-readable, stable schema) or
2099
2090
  * markdown (terminal-friendly, sectioned by severity).
@@ -2163,8 +2154,7 @@ function relativizeIfBelow(filePath, cwd) {
2163
2154
  if (rel === "" || rel.startsWith("..") || rel.startsWith("/")) return filePath;
2164
2155
  return rel;
2165
2156
  }
2166
- //#endregion
2167
- //#region src/commands/audit.ts
2157
+ // src/commands/audit.ts
2168
2158
  /**
2169
2159
  * `vttforge audit`: scan a system/module project against the VTTForge
2170
2160
  * audit catalog (the v14 manifest, source and template breakages that fail quietly).
@@ -2194,8 +2184,7 @@ async function runAuditCommand(options = {}) {
2194
2184
  exitCode: report.counts.HIGH > 0 || strict && (report.counts.MEDIUM > 0 || report.counts.LOW > 0) ? 1 : 0
2195
2185
  };
2196
2186
  }
2197
- //#endregion
2198
- //#region src/manifest.ts
2187
+ // src/manifest.ts
2199
2188
  /**
2200
2189
  * Read a built manifest (`dist/system.json` or `dist/module.json`).
2201
2190
  *
@@ -2253,17 +2242,17 @@ async function readManifest(distDir) {
2253
2242
  }
2254
2243
  throw new Error(`No Foundry manifest found in ${distDir}. Expected system.json or module.json. Did you run \`vite build\` first?`);
2255
2244
  }
2256
- //#endregion
2257
- //#region src/package-manager.ts
2245
+ // src/package-manager.ts
2258
2246
  /**
2259
2247
  * Detect which package manager invoked the CLI so we can run the right
2260
2248
  * `install` command after scaffolding.
2261
2249
  *
2262
2250
  * Strategy: read `npm_config_user_agent`, which pnpm/npm/bun/yarn all set when
2263
2251
  * they spawn a child process (including `pnpm dlx`, `pnpm create`, etc.).
2264
- * Falls back to `pnpm` because that's the VTTForge house default and the
2265
- * most common Foundry-developer choice, but any concrete signal in the
2266
- * environment wins over the default.
2252
+ * Falls back to `pnpm` because that's the most common Foundry-developer
2253
+ * choice, but any concrete signal in the environment wins over the default.
2254
+ * (VTTForge's own tooling runs on Bun; this default is about the ecosystem
2255
+ * this CLI scaffolds into, not about VTTForge itself.)
2267
2256
  */
2268
2257
  /**
2269
2258
  * @internal Implementation detail of the `vttforge` binary. Not supported for
@@ -2329,8 +2318,7 @@ function execInvocation(pm, bin) {
2329
2318
  case "npm": return ["npx", ["--no-install", bin]];
2330
2319
  }
2331
2320
  }
2332
- //#endregion
2333
- //#region src/vite-runner.ts
2321
+ // src/vite-runner.ts
2334
2322
  /**
2335
2323
  * Spawn the user's project-local `vite` through their package manager.
2336
2324
  *
@@ -2405,8 +2393,7 @@ function spawnViteWatch(cwd) {
2405
2393
  shell: false
2406
2394
  });
2407
2395
  }
2408
- //#endregion
2409
- //#region src/zip.ts
2396
+ // src/zip.ts
2410
2397
  /**
2411
2398
  * Emit a foundryvtt.com-compatible release zip.
2412
2399
  *
@@ -2452,8 +2439,7 @@ async function emitZip(opts) {
2452
2439
  byteSize: (await stat(outFile)).size
2453
2440
  };
2454
2441
  }
2455
- //#endregion
2456
- //#region src/commands/build.ts
2442
+ // src/commands/build.ts
2457
2443
  /**
2458
2444
  * `vttforge build`: emit a foundryvtt.com-ready release zip.
2459
2445
  *
@@ -2540,8 +2526,7 @@ async function runBuild(options = {}) {
2540
2526
  p.note(`${zipFile}\n${formatBytes(byteSize)}`, "Release artifact");
2541
2527
  p.outro(`Upload this zip to your release. The release workflow shipped with the template handles tag→GitHub Release → foundryvtt.com manifest update.`);
2542
2528
  }
2543
- //#endregion
2544
- //#region src/symlink.ts
2529
+ // src/symlink.ts
2545
2530
  /**
2546
2531
  * Cross-platform symlink helpers for `vttforge dev`.
2547
2532
  *
@@ -2633,8 +2618,7 @@ async function removeLink(path) {
2633
2618
  }
2634
2619
  await unlink(path);
2635
2620
  }
2636
- //#endregion
2637
- //#region src/dev-module-install.ts
2621
+ // src/dev-module-install.ts
2638
2622
  /**
2639
2623
  * Put `@vttforge/dev-module` where Foundry will find it.
2640
2624
  *
@@ -2678,8 +2662,7 @@ async function installDevModule(modulesDir, packageDir) {
2678
2662
  function composeMountLine(packageDir) {
2679
2663
  return `- ${packageDir}:/data/Data/modules/${DEV_MODULE_ID}:ro`;
2680
2664
  }
2681
- //#endregion
2682
- //#region src/dev-server.ts
2665
+ // src/dev-server.ts
2683
2666
  /**
2684
2667
  * A one-way WebSocket server: `vttforge dev` pushes, the dev module listens.
2685
2668
  *
@@ -2792,8 +2775,7 @@ async function startDevServer(options) {
2792
2775
  port: typeof address === "object" && address ? address.port : options.port
2793
2776
  };
2794
2777
  }
2795
- //#endregion
2796
- //#region src/dev-watcher.ts
2778
+ // src/dev-watcher.ts
2797
2779
  /**
2798
2780
  * Watch the build output and turn each change into a reload payload.
2799
2781
  *
@@ -2927,8 +2909,7 @@ function watchDist(options) {
2927
2909
  watcher.close();
2928
2910
  } };
2929
2911
  }
2930
- //#endregion
2931
- //#region src/foundry-data-dir.ts
2912
+ // src/foundry-data-dir.ts
2932
2913
  /**
2933
2914
  * Foundry user-data directory discovery + persistence.
2934
2915
  *
@@ -3255,8 +3236,7 @@ async function runDev(options = {}) {
3255
3236
  async function cleanupDevSymlink(opts) {
3256
3237
  if (await readLinkTarget(opts.target) === opts.expectedSource) await removeLink(opts.target);
3257
3238
  }
3258
- //#endregion
3259
- //#region src/git.ts
3239
+ // src/git.ts
3260
3240
  /**
3261
3241
  * Git helpers for the init scaffolder. Optional: every step degrades to a
3262
3242
  * warning, never throws. The scaffold completes even if git is missing or
@@ -3303,8 +3283,7 @@ async function initGitRepo(cwd) {
3303
3283
  };
3304
3284
  }
3305
3285
  }
3306
- //#endregion
3307
- //#region src/scaffold.ts
3286
+ // src/scaffold.ts
3308
3287
  /**
3309
3288
  * Template copy with `{{var}}` placeholder substitution.
3310
3289
  *
@@ -3415,8 +3394,7 @@ function templatesRoot() {
3415
3394
  const here = fileURLToPath(import.meta.url);
3416
3395
  return resolve(here, "..", "..", "templates");
3417
3396
  }
3418
- //#endregion
3419
- //#region src/commands/init.ts
3397
+ // src/commands/init.ts
3420
3398
  /**
3421
3399
  * `vttforge init`: interactive scaffolder.
3422
3400
  *
@@ -3684,8 +3662,7 @@ function runInstall(pm, cwd) {
3684
3662
  });
3685
3663
  });
3686
3664
  }
3687
- //#endregion
3688
- //#region src/commands/lint.ts
3665
+ // src/commands/lint.ts
3689
3666
  /**
3690
3667
  * `vttforge lint`: Biome over the project, then the v14 audit.
3691
3668
  *
@@ -3788,8 +3765,7 @@ async function runLintCommand(options = {}) {
3788
3765
  configPath
3789
3766
  };
3790
3767
  }
3791
- //#endregion
3792
- //#region src/index.ts
3768
+ // src/index.ts
3793
3769
  /**
3794
3770
  * @vttforge/cli: public library exports.
3795
3771
  *
@@ -3812,7 +3788,6 @@ async function runLintCommand(options = {}) {
3812
3788
  * See apps/docs/stability.md for what each tag promises.
3813
3789
  */
3814
3790
  const VTTFORGE_CLI_VERSION = version;
3815
- //#endregion
3816
3791
  export { runManifestRules as S, SEVERITY_RANK as _, runDev as a, maskComments as b, emitZip as c, formatReport as d, runAudit as f, definesName as g, bareUsePattern as h, runInit as i, readManifest as l, LEGACY_GLOBALS as m, runLintCommand as n, emitReleaseZip as o, REMOVED_UTILS as p, ScaffoldError as r, runBuild as s, VTTFORGE_CLI_VERSION as t, runAuditCommand as u, _internal as v, runReleaseRules as x, runSourceRules as y };
3817
3792
 
3818
- //# sourceMappingURL=src-DE_Jtt_1.mjs.map
3793
+ //# sourceMappingURL=src-BXQZFdDl.mjs.map