@vttforge/cli 0.6.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 +51 -0
- package/README.md +1 -1
- package/dist/bin.mjs +1 -1
- package/dist/index.d.mts +106 -11
- package/dist/index.mjs +1 -1
- package/dist/{src-CHdyBA95.mjs → src-C2VIeKmf.mjs} +194 -10
- package/dist/src-C2VIeKmf.mjs.map +1 -0
- package/package.json +1 -1
- package/templates/module-js/package.json +2 -2
- package/templates/module-ts/package.json +2 -2
- package/templates/system-js/README.md +0 -1
- package/templates/system-js/package.json +3 -3
- package/templates/system-ts/README.md +0 -1
- package/templates/system-ts/package.json +3 -3
- package/dist/src-CHdyBA95.mjs.map +0 -1
- package/templates/system-js/template.json +0 -8
- package/templates/system-ts/template.json +0 -8
|
@@ -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.
|
|
13
|
+
var version = "0.7.1";
|
|
14
14
|
//#endregion
|
|
15
15
|
//#region src/audit/manifest-rules.ts
|
|
16
16
|
/**
|
|
@@ -24,6 +24,7 @@ var version = "0.6.0";
|
|
|
24
24
|
* VTTF-AUDIT-002 (MEDIUM): deprecated gridDistance/gridUnits
|
|
25
25
|
* VTTF-AUDIT-003 (LOW) : styles array of strings (v12 shape)
|
|
26
26
|
* VTTF-AUDIT-009 (MEDIUM): a documentTypes subtype with no TYPES label
|
|
27
|
+
* VTTF-AUDIT-010 (HIGH) : template.json erasing documentTypes metadata
|
|
27
28
|
*
|
|
28
29
|
* Each rule emits zero or more `RuleResult`s. Line numbers are looked up
|
|
29
30
|
* cheaply by scanning the raw JSON for the offending key. Accurate
|
|
@@ -257,6 +258,74 @@ function nestedExample(dotted) {
|
|
|
257
258
|
* Entry point: run every manifest rule against every manifest at the
|
|
258
259
|
* project root.
|
|
259
260
|
*/
|
|
261
|
+
/**
|
|
262
|
+
* VTTF-AUDIT-010 (HIGH) — `template.json` erases the metadata that
|
|
263
|
+
* `system.json` declares for the same type.
|
|
264
|
+
*
|
|
265
|
+
* On load, Foundry reads `template.json` and, for every type it lists,
|
|
266
|
+
* replaces that type's entry in `documentTypes` with a fresh object. Into the
|
|
267
|
+
* new object it copies only `htmlFields`, `filePathFields` and `gmOnlyFields`,
|
|
268
|
+
* and it reads them from the document level of `template.json`, not from the
|
|
269
|
+
* type. So this in `system.json`:
|
|
270
|
+
*
|
|
271
|
+
* ```json
|
|
272
|
+
* "documentTypes": { "Actor": { "character": { "htmlFields": ["biography"] } } }
|
|
273
|
+
* ```
|
|
274
|
+
*
|
|
275
|
+
* is thrown away the moment `template.json` lists `character` under `Actor`.
|
|
276
|
+
*
|
|
277
|
+
* Nothing errors, and the type still works. What is lost is every behaviour
|
|
278
|
+
* that keys off those lists: HTML sanitization, ProseMirror enrichment, asset
|
|
279
|
+
* path migration and search indexing. The field goes on saving and loading,
|
|
280
|
+
* so the loss is invisible until a value comes back stripped or a path fails
|
|
281
|
+
* to migrate.
|
|
282
|
+
*
|
|
283
|
+
* A system whose schemas come from `TypeDataModel` does not need
|
|
284
|
+
* `template.json` at all: `documentTypes` declares the types and the data
|
|
285
|
+
* model owns the shape.
|
|
286
|
+
*/
|
|
287
|
+
function ruleTemplateJsonShadowing(cwd, manifest) {
|
|
288
|
+
if (!manifest.path.endsWith("system.json")) return [];
|
|
289
|
+
const templatePath = join(cwd, "template.json");
|
|
290
|
+
if (!existsSync(templatePath)) return [];
|
|
291
|
+
const documentTypes = manifest.parsed.documentTypes;
|
|
292
|
+
if (documentTypes === null || typeof documentTypes !== "object") return [];
|
|
293
|
+
let template;
|
|
294
|
+
try {
|
|
295
|
+
template = JSON.parse(readFileSync(templatePath, "utf8"));
|
|
296
|
+
} catch {
|
|
297
|
+
return [];
|
|
298
|
+
}
|
|
299
|
+
const CARRIED = [
|
|
300
|
+
"htmlFields",
|
|
301
|
+
"filePathFields",
|
|
302
|
+
"gmOnlyFields"
|
|
303
|
+
];
|
|
304
|
+
const results = [];
|
|
305
|
+
for (const [documentName, declared] of Object.entries(documentTypes)) {
|
|
306
|
+
if (declared === null || typeof declared !== "object") continue;
|
|
307
|
+
const templateDoc = template[documentName];
|
|
308
|
+
if (templateDoc === null || typeof templateDoc !== "object") continue;
|
|
309
|
+
const listed = templateDoc.types;
|
|
310
|
+
if (!Array.isArray(listed)) continue;
|
|
311
|
+
for (const [type, meta] of Object.entries(declared)) {
|
|
312
|
+
if (!listed.includes(type)) continue;
|
|
313
|
+
if (meta === null || typeof meta !== "object") continue;
|
|
314
|
+
const lost = CARRIED.filter((key) => key in meta && !(key in templateDoc));
|
|
315
|
+
if (lost.length === 0) continue;
|
|
316
|
+
results.push({
|
|
317
|
+
ruleId: "VTTF-AUDIT-010",
|
|
318
|
+
title: "template.json erases documentTypes metadata",
|
|
319
|
+
severity: "HIGH",
|
|
320
|
+
filePath: "template.json",
|
|
321
|
+
line: findKeyLine(readFileSync(templatePath, "utf8"), documentName),
|
|
322
|
+
message: `template.json lists ${documentName} type "${type}", so Foundry replaces that type's documentTypes entry and drops ${lost.join(", ")} declared in system.json. Sanitization, enrichment and asset migration stop applying to those fields, silently.`,
|
|
323
|
+
remediation: "Delete template.json. Your types are declared in system.json under `documentTypes`, and the schema comes from the TypeDataModel registered on `CONFIG.<Document>.dataModels`. If you still need it, move the lost keys up to the document level of template.json instead of the type."
|
|
324
|
+
});
|
|
325
|
+
}
|
|
326
|
+
}
|
|
327
|
+
return results;
|
|
328
|
+
}
|
|
260
329
|
async function runManifestRules(cwd) {
|
|
261
330
|
const manifests = await loadManifests(cwd);
|
|
262
331
|
const results = [];
|
|
@@ -265,6 +334,7 @@ async function runManifestRules(cwd) {
|
|
|
265
334
|
results.push(...ruleGridShape(manifest));
|
|
266
335
|
results.push(...ruleStylesShape(manifest));
|
|
267
336
|
results.push(...await ruleTypeLabels(cwd, manifest));
|
|
337
|
+
results.push(...ruleTemplateJsonShadowing(cwd, manifest));
|
|
268
338
|
}
|
|
269
339
|
return results;
|
|
270
340
|
}
|
|
@@ -1280,6 +1350,10 @@ function relativizeIfBelow(filePath, cwd) {
|
|
|
1280
1350
|
* 0: clean run, or only MEDIUM/LOW findings (informational)
|
|
1281
1351
|
* 1: at least one HIGH finding (or any finding in `--strict` mode)
|
|
1282
1352
|
*/
|
|
1353
|
+
/**
|
|
1354
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
1355
|
+
* change in a minor.
|
|
1356
|
+
*/
|
|
1283
1357
|
async function runAuditCommand(options = {}) {
|
|
1284
1358
|
const cwd = resolve(options.cwd ?? process.cwd());
|
|
1285
1359
|
const format = options.format ?? "markdown";
|
|
@@ -1322,6 +1396,9 @@ const MANIFEST_VERSION_RE = /^[0-9A-Za-z._+-]+$/;
|
|
|
1322
1396
|
* Throws if neither file exists, required fields are missing/non-string,
|
|
1323
1397
|
* or the id/version contain characters that would let downstream `join()`
|
|
1324
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.
|
|
1325
1402
|
*/
|
|
1326
1403
|
async function readManifest(distDir) {
|
|
1327
1404
|
for (const { file, type } of MANIFEST_FILES) {
|
|
@@ -1362,6 +1439,10 @@ async function readManifest(distDir) {
|
|
|
1362
1439
|
* most common Foundry-developer choice, but any concrete signal in the
|
|
1363
1440
|
* environment wins over the default.
|
|
1364
1441
|
*/
|
|
1442
|
+
/**
|
|
1443
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
1444
|
+
* outside use, and going away in the next major.
|
|
1445
|
+
*/
|
|
1365
1446
|
function detectPackageManager(env = process.env) {
|
|
1366
1447
|
const ua = env.npm_config_user_agent;
|
|
1367
1448
|
if (typeof ua === "string" && ua.length > 0) {
|
|
@@ -1372,6 +1453,10 @@ function detectPackageManager(env = process.env) {
|
|
|
1372
1453
|
}
|
|
1373
1454
|
return "pnpm";
|
|
1374
1455
|
}
|
|
1456
|
+
/**
|
|
1457
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
1458
|
+
* outside use, and going away in the next major.
|
|
1459
|
+
*/
|
|
1375
1460
|
function installCommand(pm) {
|
|
1376
1461
|
return `${pm} install`;
|
|
1377
1462
|
}
|
|
@@ -1384,6 +1469,9 @@ function installCommand(pm) {
|
|
|
1384
1469
|
*
|
|
1385
1470
|
* Falls back to {@link detectPackageManager} for fresh checkouts that
|
|
1386
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.
|
|
1387
1475
|
*/
|
|
1388
1476
|
function detectProjectPackageManager(cwd, env = process.env) {
|
|
1389
1477
|
if (existsSync(join(cwd, "pnpm-lock.yaml"))) return "pnpm";
|
|
@@ -1399,6 +1487,9 @@ function detectProjectPackageManager(cwd, env = process.env) {
|
|
|
1399
1487
|
* Plug'n'Play, pnpm's symlinked layout, npm's flattened node_modules,
|
|
1400
1488
|
* Bun's symlinked node_modules. Each manager exposes a uniform "run a
|
|
1401
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.
|
|
1402
1493
|
*/
|
|
1403
1494
|
function execInvocation(pm, bin) {
|
|
1404
1495
|
switch (pm) {
|
|
@@ -1424,18 +1515,30 @@ function execInvocation(pm, bin) {
|
|
|
1424
1515
|
* binary on disk. The package-manager command always resolves the
|
|
1425
1516
|
* locally-installed vite correctly regardless of linker.
|
|
1426
1517
|
*/
|
|
1518
|
+
/**
|
|
1519
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
1520
|
+
* outside use, and going away in the next major.
|
|
1521
|
+
*/
|
|
1427
1522
|
var ViteNotInstalledError = class extends Error {
|
|
1428
1523
|
constructor(message) {
|
|
1429
1524
|
super(message);
|
|
1430
1525
|
this.name = "ViteNotInstalledError";
|
|
1431
1526
|
}
|
|
1432
1527
|
};
|
|
1433
|
-
/** 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
|
+
*/
|
|
1434
1533
|
function resolveViteInvocation(cwd) {
|
|
1435
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.`);
|
|
1436
1535
|
return execInvocation(detectProjectPackageManager(cwd), "vite");
|
|
1437
1536
|
}
|
|
1438
|
-
/** 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
|
+
*/
|
|
1439
1542
|
async function runViteBuildOnce(cwd) {
|
|
1440
1543
|
const [bin, baseArgs] = resolveViteInvocation(cwd);
|
|
1441
1544
|
await new Promise((resolveBuild, rejectBuild) => {
|
|
@@ -1459,6 +1562,9 @@ async function runViteBuildOnce(cwd) {
|
|
|
1459
1562
|
* Spawn `vite build --watch` and return the child process. The caller is
|
|
1460
1563
|
* responsible for waiting on it and tearing it down (the dev command kills
|
|
1461
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.
|
|
1462
1568
|
*/
|
|
1463
1569
|
function spawnViteWatch(cwd) {
|
|
1464
1570
|
const [bin, baseArgs] = resolveViteInvocation(cwd);
|
|
@@ -1487,6 +1593,10 @@ function spawnViteWatch(cwd) {
|
|
|
1487
1593
|
* Optional extras (LICENSE / README / CHANGELOG) ride along when present at
|
|
1488
1594
|
* the project root and not already inside `dist/`. We never duplicate.
|
|
1489
1595
|
*/
|
|
1596
|
+
/**
|
|
1597
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
1598
|
+
* change in a minor.
|
|
1599
|
+
*/
|
|
1490
1600
|
async function emitZip(opts) {
|
|
1491
1601
|
const { sourceDir, outFile, extras = [], extrasFrom } = opts;
|
|
1492
1602
|
if (!existsSync(sourceDir)) throw new Error(`emitZip: sourceDir does not exist: ${sourceDir}`);
|
|
@@ -1557,6 +1667,9 @@ function formatBytes(n) {
|
|
|
1557
1667
|
/**
|
|
1558
1668
|
* Internal building block exposed for tests: assumes dist/ is already
|
|
1559
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.
|
|
1560
1673
|
*/
|
|
1561
1674
|
async function emitReleaseZip(opts) {
|
|
1562
1675
|
const cwd = resolve(opts.cwd);
|
|
@@ -1576,6 +1689,10 @@ async function emitReleaseZip(opts) {
|
|
|
1576
1689
|
manifest
|
|
1577
1690
|
};
|
|
1578
1691
|
}
|
|
1692
|
+
/**
|
|
1693
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
1694
|
+
* change in a minor.
|
|
1695
|
+
*/
|
|
1579
1696
|
async function runBuild(options = {}) {
|
|
1580
1697
|
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
1581
1698
|
p.intro("🜲 vttforge build: release zip");
|
|
@@ -1615,6 +1732,9 @@ async function runBuild(options = {}) {
|
|
|
1615
1732
|
* `null` if `path` doesn't exist or isn't a symlink. Relative symlink
|
|
1616
1733
|
* targets are resolved against the link's own directory (matches the
|
|
1617
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.
|
|
1618
1738
|
*/
|
|
1619
1739
|
async function readLinkTarget(path) {
|
|
1620
1740
|
try {
|
|
@@ -1633,6 +1753,9 @@ async function readLinkTarget(path) {
|
|
|
1633
1753
|
* - target already points to source → no-op
|
|
1634
1754
|
* - target points elsewhere → throws unless `options.overwrite`
|
|
1635
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.
|
|
1636
1759
|
*/
|
|
1637
1760
|
async function createLink(target, source, options = {}) {
|
|
1638
1761
|
const absSource = resolve(source);
|
|
@@ -1666,6 +1789,9 @@ async function createLink(target, source, options = {}) {
|
|
|
1666
1789
|
* Remove a symlink at `path`. No-ops when the path doesn't exist. Throws
|
|
1667
1790
|
* when the path exists but isn't a symlink; we never unlink real files
|
|
1668
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.
|
|
1669
1795
|
*/
|
|
1670
1796
|
async function removeLink(path) {
|
|
1671
1797
|
let info;
|
|
@@ -2001,6 +2127,9 @@ function watchDist(options) {
|
|
|
2001
2127
|
* Return the OS-default Foundry user-data directory, or `null` on unknown
|
|
2002
2128
|
* platforms / missing platform-specific env vars. Does NOT check existence;
|
|
2003
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.
|
|
2004
2133
|
*/
|
|
2005
2134
|
function autoDetectFoundryDataDir(platform = process.platform, env = process.env, home = homedir()) {
|
|
2006
2135
|
switch (platform) {
|
|
@@ -2022,6 +2151,9 @@ function autoDetectFoundryDataDir(platform = process.platform, env = process.env
|
|
|
2022
2151
|
* Heuristic: a path looks like a Foundry user-data root if it contains a
|
|
2023
2152
|
* `Data/` subdirectory (canonical Foundry layout) OR if it already contains
|
|
2024
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.
|
|
2025
2157
|
*/
|
|
2026
2158
|
function looksLikeFoundryDataDir(path) {
|
|
2027
2159
|
if (!existsSync(path)) return false;
|
|
@@ -2029,11 +2161,19 @@ function looksLikeFoundryDataDir(path) {
|
|
|
2029
2161
|
}
|
|
2030
2162
|
const CONFIG_DIR = ".vttforge";
|
|
2031
2163
|
const CONFIG_FILE = "config.json";
|
|
2032
|
-
/** 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
|
+
*/
|
|
2033
2169
|
function configPath(cwd) {
|
|
2034
2170
|
return join(resolve(cwd), CONFIG_DIR, CONFIG_FILE);
|
|
2035
2171
|
}
|
|
2036
|
-
/** 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
|
+
*/
|
|
2037
2177
|
async function loadConfig(cwd) {
|
|
2038
2178
|
const path = configPath(cwd);
|
|
2039
2179
|
if (!existsSync(path)) return null;
|
|
@@ -2046,7 +2186,11 @@ async function loadConfig(cwd) {
|
|
|
2046
2186
|
return null;
|
|
2047
2187
|
}
|
|
2048
2188
|
}
|
|
2049
|
-
/** 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
|
+
*/
|
|
2050
2194
|
async function saveConfig(cwd, config) {
|
|
2051
2195
|
const path = configPath(cwd);
|
|
2052
2196
|
await mkdir(dirname(path), { recursive: true });
|
|
@@ -2075,6 +2219,9 @@ function isFoundryDataFolder(path) {
|
|
|
2075
2219
|
*
|
|
2076
2220
|
* The returned path is not guaranteed to exist yet; callers `mkdir -p` it
|
|
2077
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.
|
|
2078
2225
|
*/
|
|
2079
2226
|
function foundryPackagesDir(dataRoot, type) {
|
|
2080
2227
|
const subFolder = type === "system" ? "systems" : "modules";
|
|
@@ -2096,6 +2243,9 @@ function expandTilde(p, home) {
|
|
|
2096
2243
|
* Walk the precedence chain and return the chosen Foundry user-data path.
|
|
2097
2244
|
* Saves the user's choice to the project config on first interactive run so
|
|
2098
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.
|
|
2099
2249
|
*/
|
|
2100
2250
|
async function resolveFoundryDataDir(opts) {
|
|
2101
2251
|
const { cwd, override, prompt } = opts;
|
|
@@ -2216,6 +2366,10 @@ function installSignalHandlers(cleanup) {
|
|
|
2216
2366
|
process.removeListener("SIGTERM", handler);
|
|
2217
2367
|
};
|
|
2218
2368
|
}
|
|
2369
|
+
/**
|
|
2370
|
+
* @experimental Shape is unproven: no consumer has asked for this yet. It can
|
|
2371
|
+
* change in a minor.
|
|
2372
|
+
*/
|
|
2219
2373
|
async function runDev(options = {}) {
|
|
2220
2374
|
const cwd = options.cwd ? resolve(options.cwd) : process.cwd();
|
|
2221
2375
|
p.intro("🜲 vttforge dev: symlink + watch");
|
|
@@ -2281,6 +2435,9 @@ async function runDev(options = {}) {
|
|
|
2281
2435
|
* create the symlink and return the target path + manifest. Skips the
|
|
2282
2436
|
* vite spawn and the signal-loop, so tests can drive the orchestration
|
|
2283
2437
|
* deterministically.
|
|
2438
|
+
*
|
|
2439
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2440
|
+
* for outside use, and going away in the next major.
|
|
2284
2441
|
*/
|
|
2285
2442
|
async function setupDevSymlink(opts) {
|
|
2286
2443
|
const cwd = resolve(opts.cwd);
|
|
@@ -2299,6 +2456,9 @@ async function setupDevSymlink(opts) {
|
|
|
2299
2456
|
* Refuses to remove a symlink that another `vttforge dev` session (or a
|
|
2300
2457
|
* manual `ln -s`) has since redirected. That link doesn't belong to us
|
|
2301
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.
|
|
2302
2462
|
*/
|
|
2303
2463
|
async function cleanupDevSymlink(opts) {
|
|
2304
2464
|
if (await readLinkTarget(opts.target) === opts.expectedSource) await removeLink(opts.target);
|
|
@@ -2373,6 +2533,9 @@ const PLACEHOLDER_RE = /\{\{(\w+)\}\}/g;
|
|
|
2373
2533
|
* Unknown placeholders are passed through unchanged so partially-templated
|
|
2374
2534
|
* files (e.g. a snippet that contains `{{handlebarsLikeSyntax}}` as literal
|
|
2375
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.
|
|
2376
2539
|
*/
|
|
2377
2540
|
function substitute(content, vars) {
|
|
2378
2541
|
const lookup = vars;
|
|
@@ -2425,6 +2588,10 @@ function rewriteDestRelPath(relPath) {
|
|
|
2425
2588
|
if (replacement === void 0) return relPath;
|
|
2426
2589
|
return relPath.slice(0, relPath.length - base.length) + replacement;
|
|
2427
2590
|
}
|
|
2591
|
+
/**
|
|
2592
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported for
|
|
2593
|
+
* outside use, and going away in the next major.
|
|
2594
|
+
*/
|
|
2428
2595
|
async function scaffold({ templateDir, destDir, vars }) {
|
|
2429
2596
|
if (!existsSync(templateDir)) throw new Error(`[vttforge] template directory does not exist: ${templateDir}`);
|
|
2430
2597
|
if (!(await stat(templateDir)).isDirectory()) throw new Error(`[vttforge] template path is not a directory: ${templateDir}`);
|
|
@@ -2448,6 +2615,9 @@ async function scaffold({ templateDir, destDir, vars }) {
|
|
|
2448
2615
|
* emits `dist/scaffold.mjs`, so `import.meta.url` points there at runtime;
|
|
2449
2616
|
* we walk up two segments to land at the package root, then descend into
|
|
2450
2617
|
* `templates/`.
|
|
2618
|
+
*
|
|
2619
|
+
* @internal Implementation detail of the `vttforge` binary. Not supported
|
|
2620
|
+
* for outside use, and going away in the next major.
|
|
2451
2621
|
*/
|
|
2452
2622
|
function templatesRoot() {
|
|
2453
2623
|
const here = fileURLToPath(import.meta.url);
|
|
@@ -2723,12 +2893,26 @@ function runInstall(pm, cwd) {
|
|
|
2723
2893
|
/**
|
|
2724
2894
|
* @vttforge/cli: public library exports.
|
|
2725
2895
|
*
|
|
2726
|
-
* The
|
|
2727
|
-
*
|
|
2728
|
-
*
|
|
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.
|
|
2729
2913
|
*/
|
|
2730
2914
|
const VTTFORGE_CLI_VERSION = version;
|
|
2731
2915
|
//#endregion
|
|
2732
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 };
|
|
2733
2917
|
|
|
2734
|
-
//# sourceMappingURL=src-
|
|
2918
|
+
//# sourceMappingURL=src-C2VIeKmf.mjs.map
|