@theholocron/cli 5.0.0-alpha.170 → 5.0.0-alpha.172
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/cli.mjs +35 -22
- package/dist/cli.mjs.map +1 -1
- package/package.json +3 -3
package/dist/cli.mjs
CHANGED
|
@@ -5316,6 +5316,35 @@ function resolvePkgRelPath(gitRoot, configFilepath) {
|
|
|
5316
5316
|
if (/[\r\n]/.test(pkgRelPath)) throw new Error(`refusing to use a package path containing a line break: ${JSON.stringify(pkgRelPath)}`);
|
|
5317
5317
|
return pkgRelPath;
|
|
5318
5318
|
}
|
|
5319
|
+
/**
|
|
5320
|
+
* Two different monorepo packages opting into the same generic task name
|
|
5321
|
+
* (e.g. both `apps/sentinel` and some future `apps/other` configuring
|
|
5322
|
+
* `delivery.previewDeploy`) would otherwise overwrite each other's
|
|
5323
|
+
* `.github/workflows/<task>.yml` on whichever package's write ran last —
|
|
5324
|
+
* only one package's behavior would ever actually run in CI, with no
|
|
5325
|
+
* signal that the other's was silently dropped (holocron#1026).
|
|
5326
|
+
*
|
|
5327
|
+
* Shared by both `holocron repo sync` (reads the file straight off local
|
|
5328
|
+
* disk) and `holocron repo setup` (reads it through the loaded `Source`
|
|
5329
|
+
* capability, which happens to be local disk too for the github plugin
|
|
5330
|
+
* today, but the interface doesn't promise that for every provider —
|
|
5331
|
+
* holocron#1068). The marker-parsing and error message are identical
|
|
5332
|
+
* either way; `readExisting` is how the two callers differ.
|
|
5333
|
+
*
|
|
5334
|
+
* A file with no marker at all predates this check (or was written before
|
|
5335
|
+
* #1026) and is never flagged — only a marker that's present AND disagrees
|
|
5336
|
+
* with the current run's own package is a real collision. `readExisting`
|
|
5337
|
+
* returning `null` means "nothing there," not "unreadable" — a caller
|
|
5338
|
+
* whose underlying read can fail for reasons other than "doesn't exist"
|
|
5339
|
+
* (e.g. local fs EISDIR) is expected to let that error propagate out of
|
|
5340
|
+
* `readExisting` itself rather than mapping it to `null`.
|
|
5341
|
+
*/
|
|
5342
|
+
async function assertNoPackageCollision(taskName, pkgRelPath, filename, readExisting) {
|
|
5343
|
+
const existing = await readExisting();
|
|
5344
|
+
if (existing === null) return;
|
|
5345
|
+
const previousPkg = SOURCE_PACKAGE_MARKER.exec(existing)?.[1];
|
|
5346
|
+
if (previousPkg !== void 0 && previousPkg !== pkgRelPath) throw new Error(`task "${taskName}" would overwrite .github/workflows/${filename}, already generated for package "${sanitizeForDisplay(previousPkg)}" — the same task name can't be used by two different packages (holocron#1026). If "${sanitizeForDisplay(previousPkg)}" moved or was renamed to this path, delete .github/workflows/${filename} first and re-run this command; otherwise rename one or give it a different thin-caller filename.`);
|
|
5347
|
+
}
|
|
5319
5348
|
//#endregion
|
|
5320
5349
|
//#region src/commands/setup/agent-prompts-data.ts
|
|
5321
5350
|
/**
|
|
@@ -6245,6 +6274,7 @@ async function runSetup(input) {
|
|
|
6245
6274
|
if (content === void 0) continue;
|
|
6246
6275
|
const step = content.includes("workflows/preview.yml@main") ? `write workflow ${name} (with preview)` : `write workflow ${name}`;
|
|
6247
6276
|
steps.push(await runStep("source", step, dryRun, async () => {
|
|
6277
|
+
await assertNoPackageCollision(name, setupPkgRelPath, filename, () => source.readWorkflowFile(filename));
|
|
6248
6278
|
await source.writeWorkflowFile(filename, `${thinCallerHeader()}# Source package: ${setupPkgRelPath}\n\n${content}`);
|
|
6249
6279
|
}));
|
|
6250
6280
|
print(formatStep(steps[steps.length - 1]));
|
|
@@ -7627,7 +7657,7 @@ async function runSync(input) {
|
|
|
7627
7657
|
if (content === void 0) continue;
|
|
7628
7658
|
const step = `sync workflow ${name}${content.includes("workflows/preview.yml@main") ? " (with preview)" : ""}`;
|
|
7629
7659
|
steps.push(await runSyncStep("local", step, dryRun, async () => {
|
|
7630
|
-
await assertNoPackageCollision(
|
|
7660
|
+
await assertNoPackageCollision(name, pkgRelPath, filename, () => readExistingWorkflowFile(gitRoot, filename));
|
|
7631
7661
|
await writeWorkflowFile(gitRoot, filename, `${workflowHeader()}# Source package: ${pkgRelPath}\n\n${content}`);
|
|
7632
7662
|
}));
|
|
7633
7663
|
print(formatSyncStep(steps[steps.length - 1]));
|
|
@@ -7891,31 +7921,14 @@ async function writeWorkflowFile(repoRoot, filename, content) {
|
|
|
7891
7921
|
await writeFile(tmpPath, content, "utf8");
|
|
7892
7922
|
await rename(tmpPath, join(dir, filename));
|
|
7893
7923
|
}
|
|
7894
|
-
/**
|
|
7895
|
-
|
|
7896
|
-
* (e.g. both `apps/sentinel` and some future `apps/other` configuring
|
|
7897
|
-
* `delivery.previewDeploy`) would otherwise overwrite each other's
|
|
7898
|
-
* `.github/workflows/<task>.yml` on whichever package's `holocron repo sync`
|
|
7899
|
-
* ran last — only one package's behavior would ever actually run in CI,
|
|
7900
|
-
* with no signal that the other's was silently dropped (holocron#1026).
|
|
7901
|
-
*
|
|
7902
|
-
* A file with no marker at all predates this check (or was written before
|
|
7903
|
-
* #1026) and is never flagged — only a marker that's present AND disagrees
|
|
7904
|
-
* with the current run's own package is a real collision. Any read error
|
|
7905
|
-
* other than "file doesn't exist" propagates rather than being treated as
|
|
7906
|
-
* "nothing to collide with" — the file may genuinely be unreadable, not
|
|
7907
|
-
* missing.
|
|
7908
|
-
*/
|
|
7909
|
-
async function assertNoPackageCollision(repoRoot, filename, taskName, pkgRelPath) {
|
|
7910
|
-
let existing;
|
|
7924
|
+
/** `assertNoPackageCollision`'s local-disk read, with ENOENT mapped to "nothing there." */
|
|
7925
|
+
async function readExistingWorkflowFile(repoRoot, filename) {
|
|
7911
7926
|
try {
|
|
7912
|
-
|
|
7927
|
+
return await readFile(join(repoRoot, ".github", "workflows", filename), "utf8");
|
|
7913
7928
|
} catch (err) {
|
|
7914
|
-
if (err.code === "ENOENT") return;
|
|
7929
|
+
if (err.code === "ENOENT") return null;
|
|
7915
7930
|
throw err;
|
|
7916
7931
|
}
|
|
7917
|
-
const previousPkg = SOURCE_PACKAGE_MARKER.exec(existing)?.[1];
|
|
7918
|
-
if (previousPkg !== void 0 && previousPkg !== pkgRelPath) throw new Error(`task "${taskName}" would overwrite .github/workflows/${filename}, already generated for package "${sanitizeForDisplay(previousPkg)}" — the same task name can't be used by two different packages (holocron#1026). If "${sanitizeForDisplay(previousPkg)}" moved or was renamed to this path, delete .github/workflows/${filename} first and re-run sync; otherwise rename one or give it a different thin-caller filename.`);
|
|
7919
7932
|
}
|
|
7920
7933
|
//#endregion
|
|
7921
7934
|
//#region src/observability/resolve-telemetry/resolve-telemetry.ts
|