@vttforge/cli 0.7.0 → 0.7.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 +18 -0
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +105 -5
- package/dist/index.mjs +1 -1
- package/dist/{src-4Yg6Ycyo.mjs → src-C2VIeKmf.mjs} +124 -10
- package/dist/src-C2VIeKmf.mjs.map +1 -0
- package/package.json +1 -1
- package/dist/src-4Yg6Ycyo.mjs.map +0 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,23 @@
|
|
|
1
1
|
# @vttforge/cli
|
|
2
2
|
|
|
3
|
+
## 0.7.1
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- 7920fa2: Say which exports are supported, which are experimental, and which are internal.
|
|
8
|
+
|
|
9
|
+
This package's product is the `vttforge` binary, and its index had grown to re-export the pieces the commands are built from. 60 exports, of which 33 were reachable only by importing them directly. Nothing outside the package imports them.
|
|
10
|
+
|
|
11
|
+
They are now tagged where they are defined, so the tag reaches the published types and your editor shows it:
|
|
12
|
+
|
|
13
|
+
- **Supported**, under the deprecation policy: `runInit` and the audit surface (`runAudit`, `runManifestRules`, `runSourceRules`, `formatReport`, and the `RuleFn` / `RuleResult` / `Severity` types). `create-vttforge` calls `runInit`, and the audit rules are a deliberate extension point.
|
|
14
|
+
- **`@experimental`**: plausibly useful to a tool author, but nobody has asked, so the shape is a guess. Can change in a minor.
|
|
15
|
+
- **`@internal`**: implementation detail (`substitute`, `templatesRoot`, `configPath`, the symlink and Vite-spawning helpers, and the rest). They keep working until the next major, and importing one is not supported today.
|
|
16
|
+
|
|
17
|
+
Nothing is removed and no signature changed. If you are importing something tagged `@internal` and it is the only way to do what you need, open an issue.
|
|
18
|
+
|
|
19
|
+
The other four packages came out clean: every export in `core`, `testing`, `vite-plugin` and `types` is reachable through the documented API.
|
|
20
|
+
|
|
3
21
|
## 0.7.0
|
|
4
22
|
|
|
5
23
|
### Minor Changes
|
package/dist/bin.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { M as runAuditCommand, c as runDev, n as ScaffoldError, r as runInit, t as VTTFORGE_CLI_VERSION, x as runBuild } from "./src-
|
|
2
|
+
import { M as runAuditCommand, c as runDev, n as ScaffoldError, r as runInit, t as VTTFORGE_CLI_VERSION, x as runBuild } from "./src-C2VIeKmf.mjs";
|
|
3
3
|
import { defineCommand, runMain } from "citty";
|
|
4
4
|
//#region src/cli.ts
|
|
5
5
|
/**
|
package/dist/index.d.mts
CHANGED
|
@@ -85,6 +85,10 @@ interface AuditResult {
|
|
|
85
85
|
/** Suggested exit code under the current strictness setting. */
|
|
86
86
|
exitCode: 0 | 1;
|
|
87
87
|
}
|
|
88
|
+
/**
|
|
89
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
90
|
+
* change in a minor.
|
|
91
|
+
*/
|
|
88
92
|
declare function runAuditCommand(options?: AuditOptions): Promise<AuditResult>;
|
|
89
93
|
//#endregion
|
|
90
94
|
//#region src/manifest.d.ts
|
|
@@ -116,6 +120,9 @@ interface FoundryManifest {
|
|
|
116
120
|
* Throws if neither file exists, required fields are missing/non-string,
|
|
117
121
|
* or the id/version contain characters that would let downstream `join()`
|
|
118
122
|
* calls escape their intended directory.
|
|
123
|
+
*
|
|
124
|
+
* @experimental Shape is unproven: no consumer has asked for this yet.
|
|
125
|
+
* It can change in a minor.
|
|
119
126
|
*/
|
|
120
127
|
declare function readManifest(distDir: string): Promise<FoundryManifest>;
|
|
121
128
|
//#endregion
|
|
@@ -127,6 +134,9 @@ interface BuildOptions {
|
|
|
127
134
|
/**
|
|
128
135
|
* Internal building block exposed for tests: assumes dist/ is already
|
|
129
136
|
* populated (vite has run, manifest is present) and just emits the zip.
|
|
137
|
+
*
|
|
138
|
+
* @experimental Shape is unproven: no consumer has asked for this yet.
|
|
139
|
+
* It can change in a minor.
|
|
130
140
|
*/
|
|
131
141
|
declare function emitReleaseZip(opts: {
|
|
132
142
|
cwd: string;
|
|
@@ -135,6 +145,10 @@ declare function emitReleaseZip(opts: {
|
|
|
135
145
|
byteSize: number;
|
|
136
146
|
manifest: FoundryManifest;
|
|
137
147
|
}>;
|
|
148
|
+
/**
|
|
149
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
150
|
+
* change in a minor.
|
|
151
|
+
*/
|
|
138
152
|
declare function runBuild(options?: BuildOptions): Promise<void>;
|
|
139
153
|
//#endregion
|
|
140
154
|
//#region src/commands/dev.d.ts
|
|
@@ -146,6 +160,10 @@ interface DevOptions {
|
|
|
146
160
|
/** Port for the hot reload bridge. */
|
|
147
161
|
hmrPort?: number;
|
|
148
162
|
}
|
|
163
|
+
/**
|
|
164
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
165
|
+
* change in a minor.
|
|
166
|
+
*/
|
|
149
167
|
declare function runDev(options?: DevOptions): Promise<void>;
|
|
150
168
|
/**
|
|
151
169
|
* Internal building block exposed for tests: given an already-built `dist/`
|
|
@@ -153,6 +171,9 @@ declare function runDev(options?: DevOptions): Promise<void>;
|
|
|
153
171
|
* create the symlink and return the target path + manifest. Skips the
|
|
154
172
|
* vite spawn and the signal-loop, so tests can drive the orchestration
|
|
155
173
|
* deterministically.
|
|
174
|
+
*
|
|
175
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
176
|
+
* for outside use, and going away in the next major.
|
|
156
177
|
*/
|
|
157
178
|
declare function setupDevSymlink(opts: {
|
|
158
179
|
cwd: string;
|
|
@@ -167,6 +188,9 @@ declare function setupDevSymlink(opts: {
|
|
|
167
188
|
* Refuses to remove a symlink that another `vttforge dev` session (or a
|
|
168
189
|
* manual `ln -s`) has since redirected. That link doesn't belong to us
|
|
169
190
|
* and removing it would silently disconnect their setup.
|
|
191
|
+
*
|
|
192
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
193
|
+
* for outside use, and going away in the next major.
|
|
170
194
|
*/
|
|
171
195
|
declare function cleanupDevSymlink(opts: {
|
|
172
196
|
target: string;
|
|
@@ -261,19 +285,37 @@ interface VTTForgeConfig {
|
|
|
261
285
|
* Return the OS-default Foundry user-data directory, or `null` on unknown
|
|
262
286
|
* platforms / missing platform-specific env vars. Does NOT check existence;
|
|
263
287
|
* callers prompt the user when the suggested path doesn't resolve.
|
|
288
|
+
*
|
|
289
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
290
|
+
* for outside use, and going away in the next major.
|
|
264
291
|
*/
|
|
265
292
|
declare function autoDetectFoundryDataDir(platform?: NodeJS.Platform, env?: NodeJS.ProcessEnv, home?: string): string | null;
|
|
266
293
|
/**
|
|
267
294
|
* Heuristic: a path looks like a Foundry user-data root if it contains a
|
|
268
295
|
* `Data/` subdirectory (canonical Foundry layout) OR if it already contains
|
|
269
296
|
* `systems/` or `modules/` (the path is already the Data folder itself).
|
|
297
|
+
*
|
|
298
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
299
|
+
* for outside use, and going away in the next major.
|
|
270
300
|
*/
|
|
271
301
|
declare function looksLikeFoundryDataDir(path: string): boolean;
|
|
272
|
-
/** Absolute path to the project-local config file (whether or not it exists).
|
|
302
|
+
/** Absolute path to the project-local config file (whether or not it exists).
|
|
303
|
+
*
|
|
304
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
305
|
+
* for outside use, and going away in the next major.
|
|
306
|
+
*/
|
|
273
307
|
declare function configPath(cwd: string): string;
|
|
274
|
-
/** Load `<cwd>/.vttforge/config.json` if it exists and is valid JSON.
|
|
308
|
+
/** Load `<cwd>/.vttforge/config.json` if it exists and is valid JSON.
|
|
309
|
+
*
|
|
310
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
311
|
+
* for outside use, and going away in the next major.
|
|
312
|
+
*/
|
|
275
313
|
declare function loadConfig(cwd: string): Promise<VTTForgeConfig | null>;
|
|
276
|
-
/** Persist `<cwd>/.vttforge/config.json`. Creates the `.vttforge/` dir as needed.
|
|
314
|
+
/** Persist `<cwd>/.vttforge/config.json`. Creates the `.vttforge/` dir as needed.
|
|
315
|
+
*
|
|
316
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
317
|
+
* for outside use, and going away in the next major.
|
|
318
|
+
*/
|
|
277
319
|
declare function saveConfig(cwd: string, config: VTTForgeConfig): Promise<void>;
|
|
278
320
|
/**
|
|
279
321
|
* Resolve the packages directory (`Data/systems/` or `Data/modules/`) under
|
|
@@ -283,6 +325,9 @@ declare function saveConfig(cwd: string, config: VTTForgeConfig): Promise<void>;
|
|
|
283
325
|
*
|
|
284
326
|
* The returned path is not guaranteed to exist yet; callers `mkdir -p` it
|
|
285
327
|
* before creating the symlink.
|
|
328
|
+
*
|
|
329
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
330
|
+
* for outside use, and going away in the next major.
|
|
286
331
|
*/
|
|
287
332
|
declare function foundryPackagesDir(dataRoot: string, type: 'system' | 'module'): string;
|
|
288
333
|
interface ResolveDataDirOptions {
|
|
@@ -308,6 +353,9 @@ interface ResolveDataDirOptions {
|
|
|
308
353
|
* Walk the precedence chain and return the chosen Foundry user-data path.
|
|
309
354
|
* Saves the user's choice to the project config on first interactive run so
|
|
310
355
|
* subsequent invocations skip the prompt.
|
|
356
|
+
*
|
|
357
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
358
|
+
* for outside use, and going away in the next major.
|
|
311
359
|
*/
|
|
312
360
|
declare function resolveFoundryDataDir(opts: ResolveDataDirOptions): Promise<string>;
|
|
313
361
|
//#endregion
|
|
@@ -323,7 +371,15 @@ declare function resolveFoundryDataDir(opts: ResolveDataDirOptions): Promise<str
|
|
|
323
371
|
* environment wins over the default.
|
|
324
372
|
*/
|
|
325
373
|
type PackageManager = 'pnpm' | 'npm' | 'bun' | 'yarn';
|
|
374
|
+
/**
|
|
375
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
376
|
+
* outside use, and going away in the next major.
|
|
377
|
+
*/
|
|
326
378
|
declare function detectPackageManager(env?: NodeJS.ProcessEnv): PackageManager;
|
|
379
|
+
/**
|
|
380
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
381
|
+
* outside use, and going away in the next major.
|
|
382
|
+
*/
|
|
327
383
|
declare function installCommand(pm: PackageManager): string;
|
|
328
384
|
/**
|
|
329
385
|
* Detect a project's package manager by looking at which lockfile it
|
|
@@ -334,6 +390,9 @@ declare function installCommand(pm: PackageManager): string;
|
|
|
334
390
|
*
|
|
335
391
|
* Falls back to {@link detectPackageManager} for fresh checkouts that
|
|
336
392
|
* haven't been installed yet.
|
|
393
|
+
*
|
|
394
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
395
|
+
* for outside use, and going away in the next major.
|
|
337
396
|
*/
|
|
338
397
|
declare function detectProjectPackageManager(cwd: string, env?: NodeJS.ProcessEnv): PackageManager;
|
|
339
398
|
/**
|
|
@@ -343,6 +402,9 @@ declare function detectProjectPackageManager(cwd: string, env?: NodeJS.ProcessEn
|
|
|
343
402
|
* Plug'n'Play, pnpm's symlinked layout, npm's flattened node_modules,
|
|
344
403
|
* Bun's symlinked node_modules. Each manager exposes a uniform "run a
|
|
345
404
|
* locally-resolved binary in the project's dependency graph" command.
|
|
405
|
+
*
|
|
406
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
407
|
+
* for outside use, and going away in the next major.
|
|
346
408
|
*/
|
|
347
409
|
declare function execInvocation(pm: PackageManager, bin: string): [string, string[]];
|
|
348
410
|
//#endregion
|
|
@@ -385,14 +447,24 @@ interface ScaffoldOptions {
|
|
|
385
447
|
* Unknown placeholders are passed through unchanged so partially-templated
|
|
386
448
|
* files (e.g. a snippet that contains `{{handlebarsLikeSyntax}}` as literal
|
|
387
449
|
* content) still scaffold without surprises.
|
|
450
|
+
*
|
|
451
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
452
|
+
* for outside use, and going away in the next major.
|
|
388
453
|
*/
|
|
389
454
|
declare function substitute(content: string, vars: ScaffoldVars): string;
|
|
455
|
+
/**
|
|
456
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
457
|
+
* outside use, and going away in the next major.
|
|
458
|
+
*/
|
|
390
459
|
declare function scaffold({ templateDir, destDir, vars }: ScaffoldOptions): Promise<void>;
|
|
391
460
|
/**
|
|
392
461
|
* Resolve the templates directory relative to this module's file URL. tsdown
|
|
393
462
|
* emits `dist/scaffold.mjs`, so `import.meta.url` points there at runtime;
|
|
394
463
|
* we walk up two segments to land at the package root, then descend into
|
|
395
464
|
* `templates/`.
|
|
465
|
+
*
|
|
466
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
467
|
+
* for outside use, and going away in the next major.
|
|
396
468
|
*/
|
|
397
469
|
declare function templatesRoot(): string;
|
|
398
470
|
//#endregion
|
|
@@ -421,6 +493,9 @@ interface CreateLinkOptions {
|
|
|
421
493
|
* `null` if `path` doesn't exist or isn't a symlink. Relative symlink
|
|
422
494
|
* targets are resolved against the link's own directory (matches the
|
|
423
495
|
* semantics callers expect when comparing to a known absolute source).
|
|
496
|
+
*
|
|
497
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
498
|
+
* for outside use, and going away in the next major.
|
|
424
499
|
*/
|
|
425
500
|
declare function readLinkTarget(path: string): Promise<string | null>;
|
|
426
501
|
/**
|
|
@@ -431,27 +506,48 @@ declare function readLinkTarget(path: string): Promise<string | null>;
|
|
|
431
506
|
* - target already points to source → no-op
|
|
432
507
|
* - target points elsewhere → throws unless `options.overwrite`
|
|
433
508
|
* - target is a real file/dir → throws unconditionally
|
|
509
|
+
*
|
|
510
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
511
|
+
* for outside use, and going away in the next major.
|
|
434
512
|
*/
|
|
435
513
|
declare function createLink(target: string, source: string, options?: CreateLinkOptions): Promise<void>;
|
|
436
514
|
/**
|
|
437
515
|
* Remove a symlink at `path`. No-ops when the path doesn't exist. Throws
|
|
438
516
|
* when the path exists but isn't a symlink; we never unlink real files
|
|
439
517
|
* or directories.
|
|
518
|
+
*
|
|
519
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
520
|
+
* for outside use, and going away in the next major.
|
|
440
521
|
*/
|
|
441
522
|
declare function removeLink(path: string): Promise<void>;
|
|
442
523
|
//#endregion
|
|
443
524
|
//#region src/vite-runner.d.ts
|
|
525
|
+
/**
|
|
526
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
527
|
+
* outside use, and going away in the next major.
|
|
528
|
+
*/
|
|
444
529
|
declare class ViteNotInstalledError extends Error {
|
|
445
530
|
constructor(message: string);
|
|
446
531
|
}
|
|
447
|
-
/** Spawn args for invoking the user's vite (e.g. `["pnpm", ["exec", "vite"]]`).
|
|
532
|
+
/** Spawn args for invoking the user's vite (e.g. `["pnpm", ["exec", "vite"]]`).
|
|
533
|
+
*
|
|
534
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
535
|
+
* for outside use, and going away in the next major.
|
|
536
|
+
*/
|
|
448
537
|
declare function resolveViteInvocation(cwd: string): [string, string[]];
|
|
449
|
-
/** Run `vite build` once and wait for it to exit. Throws on non-zero exit.
|
|
538
|
+
/** Run `vite build` once and wait for it to exit. Throws on non-zero exit.
|
|
539
|
+
*
|
|
540
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
541
|
+
* for outside use, and going away in the next major.
|
|
542
|
+
*/
|
|
450
543
|
declare function runViteBuildOnce(cwd: string): Promise<void>;
|
|
451
544
|
/**
|
|
452
545
|
* Spawn `vite build --watch` and return the child process. The caller is
|
|
453
546
|
* responsible for waiting on it and tearing it down (the dev command kills
|
|
454
547
|
* it on SIGINT).
|
|
548
|
+
*
|
|
549
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
550
|
+
* for outside use, and going away in the next major.
|
|
455
551
|
*/
|
|
456
552
|
declare function spawnViteWatch(cwd: string): ChildProcess;
|
|
457
553
|
//#endregion
|
|
@@ -482,6 +578,10 @@ interface EmitZipResult {
|
|
|
482
578
|
outFile: string;
|
|
483
579
|
byteSize: number;
|
|
484
580
|
}
|
|
581
|
+
/**
|
|
582
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
583
|
+
* change in a minor.
|
|
584
|
+
*/
|
|
485
585
|
declare function emitZip(opts: EmitZipOptions): Promise<EmitZipResult>;
|
|
486
586
|
//#endregion
|
|
487
587
|
//#region src/index.d.ts
|
package/dist/index.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { A as installCommand, C as ViteNotInstalledError, D as detectPackageManager, E as spawnViteWatch, F as SEVERITY_RANK, I as runSourceRules, L as runManifestRules, M as runAuditCommand, N as formatReport, O as detectProjectPackageManager, P as runAudit, S as emitZip, T as runViteBuildOnce, _ as createLink, a as substitute, b as emitReleaseZip, c as runDev, d as configPath, f as foundryPackagesDir, g as saveConfig, h as resolveFoundryDataDir, i as scaffold, j as readManifest, k as execInvocation, l as setupDevSymlink, m as looksLikeFoundryDataDir, n as ScaffoldError, o as templatesRoot, p as loadConfig, r as runInit, s as cleanupDevSymlink, t as VTTFORGE_CLI_VERSION, u as autoDetectFoundryDataDir, v as readLinkTarget, w as resolveViteInvocation, x as runBuild, y as removeLink } from "./src-
|
|
1
|
+
import { A as installCommand, C as ViteNotInstalledError, D as detectPackageManager, E as spawnViteWatch, F as SEVERITY_RANK, I as runSourceRules, L as runManifestRules, M as runAuditCommand, N as formatReport, O as detectProjectPackageManager, P as runAudit, S as emitZip, T as runViteBuildOnce, _ as createLink, a as substitute, b as emitReleaseZip, c as runDev, d as configPath, f as foundryPackagesDir, g as saveConfig, h as resolveFoundryDataDir, i as scaffold, j as readManifest, k as execInvocation, l as setupDevSymlink, m as looksLikeFoundryDataDir, n as ScaffoldError, o as templatesRoot, p as loadConfig, r as runInit, s as cleanupDevSymlink, t as VTTFORGE_CLI_VERSION, u as autoDetectFoundryDataDir, v as readLinkTarget, w as resolveViteInvocation, x as runBuild, y as removeLink } from "./src-C2VIeKmf.mjs";
|
|
2
2
|
export { SEVERITY_RANK, ScaffoldError, VTTFORGE_CLI_VERSION, ViteNotInstalledError, autoDetectFoundryDataDir, cleanupDevSymlink, configPath, createLink, detectPackageManager, detectProjectPackageManager, emitReleaseZip, emitZip, execInvocation, formatReport, foundryPackagesDir, installCommand, loadConfig, looksLikeFoundryDataDir, readLinkTarget, readManifest, removeLink, resolveFoundryDataDir, resolveViteInvocation, runAudit, runAuditCommand, runBuild, runDev, runInit, runManifestRules, runSourceRules, runViteBuildOnce, saveConfig, scaffold, setupDevSymlink, spawnViteWatch, substitute, templatesRoot };
|
|
@@ -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.7.
|
|
13
|
+
var version = "0.7.1";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/audit/manifest-rules.ts
|
|
16
16
|
/**
|
|
@@ -1350,6 +1350,10 @@ function relativizeIfBelow(filePath, cwd) {
|
|
|
1350
1350
|
* 0: clean run, or only MEDIUM/LOW findings (informational)
|
|
1351
1351
|
* 1: at least one HIGH finding (or any finding in `--strict` mode)
|
|
1352
1352
|
*/
|
|
1353
|
+
/**
|
|
1354
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
1355
|
+
* change in a minor.
|
|
1356
|
+
*/
|
|
1353
1357
|
async function runAuditCommand(options = {}) {
|
|
1354
1358
|
const cwd = resolve(options.cwd ?? process.cwd());
|
|
1355
1359
|
const format = options.format ?? "markdown";
|
|
@@ -1392,6 +1396,9 @@ const MANIFEST_VERSION_RE = /^[0-9A-Za-z._+-]+$/;
|
|
|
1392
1396
|
* Throws if neither file exists, required fields are missing/non-string,
|
|
1393
1397
|
* or the id/version contain characters that would let downstream `join()`
|
|
1394
1398
|
* calls escape their intended directory.
|
|
1399
|
+
*
|
|
1400
|
+
* @experimental Shape is unproven: no consumer has asked for this yet.
|
|
1401
|
+
* It can change in a minor.
|
|
1395
1402
|
*/
|
|
1396
1403
|
async function readManifest(distDir) {
|
|
1397
1404
|
for (const { file, type } of MANIFEST_FILES) {
|
|
@@ -1432,6 +1439,10 @@ async function readManifest(distDir) {
|
|
|
1432
1439
|
* most common Foundry-developer choice, but any concrete signal in the
|
|
1433
1440
|
* environment wins over the default.
|
|
1434
1441
|
*/
|
|
1442
|
+
/**
|
|
1443
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
1444
|
+
* outside use, and going away in the next major.
|
|
1445
|
+
*/
|
|
1435
1446
|
function detectPackageManager(env = process.env) {
|
|
1436
1447
|
const ua = env.npm_config_user_agent;
|
|
1437
1448
|
if (typeof ua === "string" && ua.length > 0) {
|
|
@@ -1442,6 +1453,10 @@ function detectPackageManager(env = process.env) {
|
|
|
1442
1453
|
}
|
|
1443
1454
|
return "pnpm";
|
|
1444
1455
|
}
|
|
1456
|
+
/**
|
|
1457
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
1458
|
+
* outside use, and going away in the next major.
|
|
1459
|
+
*/
|
|
1445
1460
|
function installCommand(pm) {
|
|
1446
1461
|
return `${pm} install`;
|
|
1447
1462
|
}
|
|
@@ -1454,6 +1469,9 @@ function installCommand(pm) {
|
|
|
1454
1469
|
*
|
|
1455
1470
|
* Falls back to {@link detectPackageManager} for fresh checkouts that
|
|
1456
1471
|
* haven't been installed yet.
|
|
1472
|
+
*
|
|
1473
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1474
|
+
* for outside use, and going away in the next major.
|
|
1457
1475
|
*/
|
|
1458
1476
|
function detectProjectPackageManager(cwd, env = process.env) {
|
|
1459
1477
|
if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
@@ -1469,6 +1487,9 @@ function detectProjectPackageManager(cwd, env = process.env) {
|
|
|
1469
1487
|
* Plug'n'Play, pnpm's symlinked layout, npm's flattened node_modules,
|
|
1470
1488
|
* Bun's symlinked node_modules. Each manager exposes a uniform "run a
|
|
1471
1489
|
* locally-resolved binary in the project's dependency graph" command.
|
|
1490
|
+
*
|
|
1491
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1492
|
+
* for outside use, and going away in the next major.
|
|
1472
1493
|
*/
|
|
1473
1494
|
function execInvocation(pm, bin) {
|
|
1474
1495
|
switch (pm) {
|
|
@@ -1494,18 +1515,30 @@ function execInvocation(pm, bin) {
|
|
|
1494
1515
|
* binary on disk. The package-manager command always resolves the
|
|
1495
1516
|
* locally-installed vite correctly regardless of linker.
|
|
1496
1517
|
*/
|
|
1518
|
+
/**
|
|
1519
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
1520
|
+
* outside use, and going away in the next major.
|
|
1521
|
+
*/
|
|
1497
1522
|
var ViteNotInstalledError = class extends Error {
|
|
1498
1523
|
constructor(message) {
|
|
1499
1524
|
super(message);
|
|
1500
1525
|
this.name = "ViteNotInstalledError";
|
|
1501
1526
|
}
|
|
1502
1527
|
};
|
|
1503
|
-
/** Spawn args for invoking the user's vite (e.g. `["pnpm", ["exec", "vite"]]`).
|
|
1528
|
+
/** Spawn args for invoking the user's vite (e.g. `["pnpm", ["exec", "vite"]]`).
|
|
1529
|
+
*
|
|
1530
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1531
|
+
* for outside use, and going away in the next major.
|
|
1532
|
+
*/
|
|
1504
1533
|
function resolveViteInvocation(cwd) {
|
|
1505
1534
|
if (!existsSync(join(cwd, "package.json"))) throw new ViteNotInstalledError(`No package.json found at ${cwd}. Run \`vttforge dev\` / \`vttforge build\` from inside a scaffolded project.`);
|
|
1506
1535
|
return execInvocation(detectProjectPackageManager(cwd), "vite");
|
|
1507
1536
|
}
|
|
1508
|
-
/** Run `vite build` once and wait for it to exit. Throws on non-zero exit.
|
|
1537
|
+
/** Run `vite build` once and wait for it to exit. Throws on non-zero exit.
|
|
1538
|
+
*
|
|
1539
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1540
|
+
* for outside use, and going away in the next major.
|
|
1541
|
+
*/
|
|
1509
1542
|
async function runViteBuildOnce(cwd) {
|
|
1510
1543
|
const [bin, baseArgs] = resolveViteInvocation(cwd);
|
|
1511
1544
|
await new Promise((resolveBuild, rejectBuild) => {
|
|
@@ -1529,6 +1562,9 @@ async function runViteBuildOnce(cwd) {
|
|
|
1529
1562
|
* Spawn `vite build --watch` and return the child process. The caller is
|
|
1530
1563
|
* responsible for waiting on it and tearing it down (the dev command kills
|
|
1531
1564
|
* it on SIGINT).
|
|
1565
|
+
*
|
|
1566
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1567
|
+
* for outside use, and going away in the next major.
|
|
1532
1568
|
*/
|
|
1533
1569
|
function spawnViteWatch(cwd) {
|
|
1534
1570
|
const [bin, baseArgs] = resolveViteInvocation(cwd);
|
|
@@ -1557,6 +1593,10 @@ function spawnViteWatch(cwd) {
|
|
|
1557
1593
|
* Optional extras (LICENSE / README / CHANGELOG) ride along when present at
|
|
1558
1594
|
* the project root and not already inside `dist/`. We never duplicate.
|
|
1559
1595
|
*/
|
|
1596
|
+
/**
|
|
1597
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
1598
|
+
* change in a minor.
|
|
1599
|
+
*/
|
|
1560
1600
|
async function emitZip(opts) {
|
|
1561
1601
|
const { sourceDir, outFile, extras = [], extrasFrom } = opts;
|
|
1562
1602
|
if (!existsSync(sourceDir)) throw new Error(`emitZip: sourceDir does not exist: ${sourceDir}`);
|
|
@@ -1627,6 +1667,9 @@ function formatBytes(n) {
|
|
|
1627
1667
|
/**
|
|
1628
1668
|
* Internal building block exposed for tests: assumes dist/ is already
|
|
1629
1669
|
* populated (vite has run, manifest is present) and just emits the zip.
|
|
1670
|
+
*
|
|
1671
|
+
* @experimental Shape is unproven: no consumer has asked for this yet.
|
|
1672
|
+
* It can change in a minor.
|
|
1630
1673
|
*/
|
|
1631
1674
|
async function emitReleaseZip(opts) {
|
|
1632
1675
|
const cwd = resolve(opts.cwd);
|
|
@@ -1646,6 +1689,10 @@ async function emitReleaseZip(opts) {
|
|
|
1646
1689
|
manifest
|
|
1647
1690
|
};
|
|
1648
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
1694
|
+
* change in a minor.
|
|
1695
|
+
*/
|
|
1649
1696
|
async function runBuild(options = {}) {
|
|
1650
1697
|
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
1651
1698
|
p.intro("🜲 vttforge build: release zip");
|
|
@@ -1685,6 +1732,9 @@ async function runBuild(options = {}) {
|
|
|
1685
1732
|
* `null` if `path` doesn't exist or isn't a symlink. Relative symlink
|
|
1686
1733
|
* targets are resolved against the link's own directory (matches the
|
|
1687
1734
|
* semantics callers expect when comparing to a known absolute source).
|
|
1735
|
+
*
|
|
1736
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1737
|
+
* for outside use, and going away in the next major.
|
|
1688
1738
|
*/
|
|
1689
1739
|
async function readLinkTarget(path) {
|
|
1690
1740
|
try {
|
|
@@ -1703,6 +1753,9 @@ async function readLinkTarget(path) {
|
|
|
1703
1753
|
* - target already points to source → no-op
|
|
1704
1754
|
* - target points elsewhere → throws unless `options.overwrite`
|
|
1705
1755
|
* - target is a real file/dir → throws unconditionally
|
|
1756
|
+
*
|
|
1757
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1758
|
+
* for outside use, and going away in the next major.
|
|
1706
1759
|
*/
|
|
1707
1760
|
async function createLink(target, source, options = {}) {
|
|
1708
1761
|
const absSource = resolve(source);
|
|
@@ -1736,6 +1789,9 @@ async function createLink(target, source, options = {}) {
|
|
|
1736
1789
|
* Remove a symlink at `path`. No-ops when the path doesn't exist. Throws
|
|
1737
1790
|
* when the path exists but isn't a symlink; we never unlink real files
|
|
1738
1791
|
* or directories.
|
|
1792
|
+
*
|
|
1793
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
1794
|
+
* for outside use, and going away in the next major.
|
|
1739
1795
|
*/
|
|
1740
1796
|
async function removeLink(path) {
|
|
1741
1797
|
let info;
|
|
@@ -2071,6 +2127,9 @@ function watchDist(options) {
|
|
|
2071
2127
|
* Return the OS-default Foundry user-data directory, or `null` on unknown
|
|
2072
2128
|
* platforms / missing platform-specific env vars. Does NOT check existence;
|
|
2073
2129
|
* callers prompt the user when the suggested path doesn't resolve.
|
|
2130
|
+
*
|
|
2131
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2132
|
+
* for outside use, and going away in the next major.
|
|
2074
2133
|
*/
|
|
2075
2134
|
function autoDetectFoundryDataDir(platform = process.platform, env = process.env, home = homedir()) {
|
|
2076
2135
|
switch (platform) {
|
|
@@ -2092,6 +2151,9 @@ function autoDetectFoundryDataDir(platform = process.platform, env = process.env
|
|
|
2092
2151
|
* Heuristic: a path looks like a Foundry user-data root if it contains a
|
|
2093
2152
|
* `Data/` subdirectory (canonical Foundry layout) OR if it already contains
|
|
2094
2153
|
* `systems/` or `modules/` (the path is already the Data folder itself).
|
|
2154
|
+
*
|
|
2155
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2156
|
+
* for outside use, and going away in the next major.
|
|
2095
2157
|
*/
|
|
2096
2158
|
function looksLikeFoundryDataDir(path) {
|
|
2097
2159
|
if (!existsSync(path)) return false;
|
|
@@ -2099,11 +2161,19 @@ function looksLikeFoundryDataDir(path) {
|
|
|
2099
2161
|
}
|
|
2100
2162
|
const CONFIG_DIR = ".vttforge";
|
|
2101
2163
|
const CONFIG_FILE = "config.json";
|
|
2102
|
-
/** Absolute path to the project-local config file (whether or not it exists).
|
|
2164
|
+
/** Absolute path to the project-local config file (whether or not it exists).
|
|
2165
|
+
*
|
|
2166
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2167
|
+
* for outside use, and going away in the next major.
|
|
2168
|
+
*/
|
|
2103
2169
|
function configPath(cwd) {
|
|
2104
2170
|
return join(resolve(cwd), CONFIG_DIR, CONFIG_FILE);
|
|
2105
2171
|
}
|
|
2106
|
-
/** Load `<cwd>/.vttforge/config.json` if it exists and is valid JSON.
|
|
2172
|
+
/** Load `<cwd>/.vttforge/config.json` if it exists and is valid JSON.
|
|
2173
|
+
*
|
|
2174
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2175
|
+
* for outside use, and going away in the next major.
|
|
2176
|
+
*/
|
|
2107
2177
|
async function loadConfig(cwd) {
|
|
2108
2178
|
const path = configPath(cwd);
|
|
2109
2179
|
if (!existsSync(path)) return null;
|
|
@@ -2116,7 +2186,11 @@ async function loadConfig(cwd) {
|
|
|
2116
2186
|
return null;
|
|
2117
2187
|
}
|
|
2118
2188
|
}
|
|
2119
|
-
/** Persist `<cwd>/.vttforge/config.json`. Creates the `.vttforge/` dir as needed.
|
|
2189
|
+
/** Persist `<cwd>/.vttforge/config.json`. Creates the `.vttforge/` dir as needed.
|
|
2190
|
+
*
|
|
2191
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2192
|
+
* for outside use, and going away in the next major.
|
|
2193
|
+
*/
|
|
2120
2194
|
async function saveConfig(cwd, config) {
|
|
2121
2195
|
const path = configPath(cwd);
|
|
2122
2196
|
await mkdir(dirname(path), { recursive: true });
|
|
@@ -2145,6 +2219,9 @@ function isFoundryDataFolder(path) {
|
|
|
2145
2219
|
*
|
|
2146
2220
|
* The returned path is not guaranteed to exist yet; callers `mkdir -p` it
|
|
2147
2221
|
* before creating the symlink.
|
|
2222
|
+
*
|
|
2223
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2224
|
+
* for outside use, and going away in the next major.
|
|
2148
2225
|
*/
|
|
2149
2226
|
function foundryPackagesDir(dataRoot, type) {
|
|
2150
2227
|
const subFolder = type === "system" ? "systems" : "modules";
|
|
@@ -2166,6 +2243,9 @@ function expandTilde(p, home) {
|
|
|
2166
2243
|
* Walk the precedence chain and return the chosen Foundry user-data path.
|
|
2167
2244
|
* Saves the user's choice to the project config on first interactive run so
|
|
2168
2245
|
* subsequent invocations skip the prompt.
|
|
2246
|
+
*
|
|
2247
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2248
|
+
* for outside use, and going away in the next major.
|
|
2169
2249
|
*/
|
|
2170
2250
|
async function resolveFoundryDataDir(opts) {
|
|
2171
2251
|
const { cwd, override, prompt } = opts;
|
|
@@ -2286,6 +2366,10 @@ function installSignalHandlers(cleanup) {
|
|
|
2286
2366
|
process.removeListener("SIGTERM", handler);
|
|
2287
2367
|
};
|
|
2288
2368
|
}
|
|
2369
|
+
/**
|
|
2370
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
2371
|
+
* change in a minor.
|
|
2372
|
+
*/
|
|
2289
2373
|
async function runDev(options = {}) {
|
|
2290
2374
|
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
2291
2375
|
p.intro("🜲 vttforge dev: symlink + watch");
|
|
@@ -2351,6 +2435,9 @@ async function runDev(options = {}) {
|
|
|
2351
2435
|
* create the symlink and return the target path + manifest. Skips the
|
|
2352
2436
|
* vite spawn and the signal-loop, so tests can drive the orchestration
|
|
2353
2437
|
* deterministically.
|
|
2438
|
+
*
|
|
2439
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2440
|
+
* for outside use, and going away in the next major.
|
|
2354
2441
|
*/
|
|
2355
2442
|
async function setupDevSymlink(opts) {
|
|
2356
2443
|
const cwd = resolve(opts.cwd);
|
|
@@ -2369,6 +2456,9 @@ async function setupDevSymlink(opts) {
|
|
|
2369
2456
|
* Refuses to remove a symlink that another `vttforge dev` session (or a
|
|
2370
2457
|
* manual `ln -s`) has since redirected. That link doesn't belong to us
|
|
2371
2458
|
* and removing it would silently disconnect their setup.
|
|
2459
|
+
*
|
|
2460
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2461
|
+
* for outside use, and going away in the next major.
|
|
2372
2462
|
*/
|
|
2373
2463
|
async function cleanupDevSymlink(opts) {
|
|
2374
2464
|
if (await readLinkTarget(opts.target) === opts.expectedSource) await removeLink(opts.target);
|
|
@@ -2443,6 +2533,9 @@ const PLACEHOLDER_RE = /\{\{(\w+)\}\}/g;
|
|
|
2443
2533
|
* Unknown placeholders are passed through unchanged so partially-templated
|
|
2444
2534
|
* files (e.g. a snippet that contains `{{handlebarsLikeSyntax}}` as literal
|
|
2445
2535
|
* content) still scaffold without surprises.
|
|
2536
|
+
*
|
|
2537
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2538
|
+
* for outside use, and going away in the next major.
|
|
2446
2539
|
*/
|
|
2447
2540
|
function substitute(content, vars) {
|
|
2448
2541
|
const lookup = vars;
|
|
@@ -2495,6 +2588,10 @@ function rewriteDestRelPath(relPath) {
|
|
|
2495
2588
|
if (replacement === void 0) return relPath;
|
|
2496
2589
|
return relPath.slice(0, relPath.length - base.length) + replacement;
|
|
2497
2590
|
}
|
|
2591
|
+
/**
|
|
2592
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
2593
|
+
* outside use, and going away in the next major.
|
|
2594
|
+
*/
|
|
2498
2595
|
async function scaffold({ templateDir, destDir, vars }) {
|
|
2499
2596
|
if (!existsSync(templateDir)) throw new Error(`[vttforge] template directory does not exist: ${templateDir}`);
|
|
2500
2597
|
if (!(await stat(templateDir)).isDirectory()) throw new Error(`[vttforge] template path is not a directory: ${templateDir}`);
|
|
@@ -2518,6 +2615,9 @@ async function scaffold({ templateDir, destDir, vars }) {
|
|
|
2518
2615
|
* emits `dist/scaffold.mjs`, so `import.meta.url` points there at runtime;
|
|
2519
2616
|
* we walk up two segments to land at the package root, then descend into
|
|
2520
2617
|
* `templates/`.
|
|
2618
|
+
*
|
|
2619
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2620
|
+
* for outside use, and going away in the next major.
|
|
2521
2621
|
*/
|
|
2522
2622
|
function templatesRoot() {
|
|
2523
2623
|
const here = fileURLToPath(import.meta.url);
|
|
@@ -2793,12 +2893,26 @@ function runInstall(pm, cwd) {
|
|
|
2793
2893
|
/**
|
|
2794
2894
|
* @vttforge/cli: public library exports.
|
|
2795
2895
|
*
|
|
2796
|
-
* The
|
|
2797
|
-
*
|
|
2798
|
-
*
|
|
2896
|
+
* The product here is the `vttforge` binary. These exports exist so another
|
|
2897
|
+
* tool can drive the same work without shelling out, and they fall into three
|
|
2898
|
+
* groups, marked per export below.
|
|
2899
|
+
*
|
|
2900
|
+
* **Supported.** `runInit` and the audit surface. `create-vttforge` calls
|
|
2901
|
+
* `runInit`, and the audit rules are a documented extension point: a project
|
|
2902
|
+
* can write its own `RuleFn` and hand it to the same reporter the CLI uses.
|
|
2903
|
+
* These follow the deprecation policy.
|
|
2904
|
+
*
|
|
2905
|
+
* **`@experimental`.** Plausibly useful to a tool author, but no consumer has
|
|
2906
|
+
* ever asked for them, so the shape is a guess. They can change in a minor.
|
|
2907
|
+
*
|
|
2908
|
+
* **`@internal`.** Implementation detail of the binary that reached the index
|
|
2909
|
+
* by accident. Nothing outside this package imports them. They are staying
|
|
2910
|
+
* only until the next major, and importing one is not supported today.
|
|
2911
|
+
*
|
|
2912
|
+
* See apps/docs/stability.md for what each tag promises.
|
|
2799
2913
|
*/
|
|
2800
2914
|
const VTTFORGE_CLI_VERSION = version;
|
|
2801
2915
|
//#endregion
|
|
2802
2916
|
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 };
|
|
2803
2917
|
|
|
2804
|
-
//# sourceMappingURL=src-
|
|
2918
|
+
//# sourceMappingURL=src-C2VIeKmf.mjs.map
|