@theholocron/cli 5.0.0-alpha.415 → 5.0.0-alpha.417
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 +136 -53
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-system-CZVj19gs.mjs → config-system-c8Ngywp-.mjs} +1 -1
- package/dist/{index-C4pFARzT.d.mts → index-D3Y-Aa8T.d.mts} +5 -5
- package/dist/index.d.mts +34 -2
- package/dist/index.mjs +33 -2
- package/dist/plugin/capabilities.d.mts +1 -1
- package/dist/presets.d.mts +1 -1
- package/dist/presets.mjs +1 -1
- package/package.json +10 -10
package/dist/cli.mjs
CHANGED
|
@@ -14,7 +14,7 @@ import { ConfigError, ConfigError as ConfigError$1, createConfigSystem, lastWins
|
|
|
14
14
|
import { LoaderError, assertPluginsResolvable, createPluginSystem, isModuleNotFound, resolvePluginPackage } from "@theholocron/kyber/plugins";
|
|
15
15
|
import { DEFAULT_ORG, DOT_GITHUB_REPO, HOLOCRON_REPO, KNOWN_TASKS, KNOWN_WORKFLOWS, LEGACY_NAMES, PNPM_BUILTIN_COMMANDS, PRERELEASE_CHANNEL, RELEASE_BRANCHES, RESERVED_SCRIPT_NAMES, SUITES, TASKS, aggregateChecks, checkPackageScripts, createAlexignore, createAlexrc, createAstromech, createCommitMsg, createDco, createDependabot, createDevmoji, createEditorconfig, createEditorconfigChecker, createHeader, createLabeler, createPreCommit, createPrePush, createPrepareCommitMsg, createYamlignore, createYamllint, defaultListDirs, defaultPaths, defaultReadJson, deployOnRelease, describeTasks, extractPreviewConfig, frozenReusablePaths, generateThinCallerContent, hostedReusableWorkflows, isDeprecated, isTask, legacyCaller, legacyCallerFile, legacyGate, legacyWorkflowKey, localize, mergeScripts, readWorkspacePackages, resolveTaskName, reusableTemplates, scriptName, stampDeprecated, workflowFile, workflowKey, workflowKeys, workspacePackages } from "@theholocron/astromech";
|
|
16
16
|
import { loadTasksConfig } from "@theholocron/astromech/config";
|
|
17
|
-
import { readGitRemote, updateGitignore } from "@theholocron/git-utils";
|
|
17
|
+
import { readGitRemote, updateGitignore, upsertManagedBlock } from "@theholocron/git-utils";
|
|
18
18
|
import { bumpCatalogPins, discoverWorkspacePackages, parseCatalogs, readPackageJson, readPackageJsonSync, resolveWorkspaceGlobs } from "@theholocron/pkg-utils";
|
|
19
19
|
import { createCliLogger, createCliTelemetry } from "@theholocron/kyber/observability";
|
|
20
20
|
import { resolveAxiomFromEnv } from "@theholocron/observability/logger";
|
|
@@ -22,8 +22,8 @@ import { Entry, findCredentials } from "@napi-rs/keyring";
|
|
|
22
22
|
import { AuthError, DOTENV_FILE, copyToClipboard, createFeatureResolver, createKeyring, dotenvLine, findCredential, finishCredentialsFile, hasCredentials, isGitIgnored, readDotenvFile, resolveValue, resolveValue as resolveValue$2, setCredentials, writeCredentialsFile } from "@theholocron/kyber/secrets";
|
|
23
23
|
import { errorMessage } from "@theholocron/misc-utils";
|
|
24
24
|
import { runCheckAgainstUrl } from "@theholocron/kyber/checks";
|
|
25
|
-
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
26
25
|
import { copyFileSync, existsSync, fstatSync, mkdirSync, mkdtempSync, readFileSync, readdirSync, realpathSync, rmSync, statSync, writeFileSync } from "node:fs";
|
|
26
|
+
import { fileURLToPath, pathToFileURL } from "node:url";
|
|
27
27
|
import { DRY_RUN_NOOP_EXIT_CODE, createCommandRegistry, createMenu, numeric } from "@theholocron/kyber/menu";
|
|
28
28
|
import { promptForPositionals } from "@theholocron/kyber/prompts";
|
|
29
29
|
import { Separator, checkbox, confirm, input, select } from "@inquirer/prompts";
|
|
@@ -748,8 +748,7 @@ function environmentLayers(slug, layer) {
|
|
|
748
748
|
if (layer === "test") return [];
|
|
749
749
|
const candidate = (suffix, optional) => ({
|
|
750
750
|
name: layerEnvironment(slug, suffix),
|
|
751
|
-
optional
|
|
752
|
-
legacy: false
|
|
751
|
+
optional
|
|
753
752
|
});
|
|
754
753
|
return layer === "local" ? [candidate(SUFFIX.local, true), candidate(SUFFIX.development, false)] : [candidate(SUFFIX[layer], false)];
|
|
755
754
|
}
|
|
@@ -763,33 +762,21 @@ async function repoSlug(cwd, exec) {
|
|
|
763
762
|
if (!remote) throw new ConfigError(`cannot derive the 1Password Environment name: the \`origin\` remote of ${cwd} is missing or not an owner/repo URL. Give the \`credentials\` provider an \`environment\` option to name it.`);
|
|
764
763
|
return remote.slug;
|
|
765
764
|
}
|
|
766
|
-
// src/credentials-environments/legacy-environments/legacy-environments.ts
|
|
767
|
-
const OLD_NAMES = ["Holocron", "Holocron - GitHub Actions variables"];
|
|
768
|
-
/** The old Environment names, as candidates that are never reported when absent. */
|
|
769
|
-
function legacyEnvironments() {
|
|
770
|
-
return OLD_NAMES.map((name) => ({
|
|
771
|
-
name,
|
|
772
|
-
optional: true,
|
|
773
|
-
legacy: true
|
|
774
|
-
}));
|
|
775
|
-
}
|
|
776
765
|
// src/credentials-environments/resolve-environments/resolve-environments.ts
|
|
777
766
|
/**
|
|
778
767
|
* The Environments one `credentials` entry reads. An explicit name (the entry's `environment` option, else the shared
|
|
779
768
|
* `credentials.environment`) is the only candidate and wins. Otherwise a deriving provider gets the names of its layer
|
|
780
|
-
* (`environmentLayers()`) from the repo's `origin` and `detectEnvironment()
|
|
781
|
-
* Nothing is read from a provider here. An empty list means there is nothing to read (the `test` layer).
|
|
769
|
+
* (`environmentLayers()`) from the repo's `origin` and `detectEnvironment()`. Nothing is read from a provider here. An empty list means there is nothing to read (the `test` layer).
|
|
782
770
|
*/
|
|
783
771
|
async function resolveEnvironments(provider, explicit, input) {
|
|
784
772
|
if (explicit !== void 0) return [{
|
|
785
773
|
name: explicit,
|
|
786
|
-
optional: false
|
|
787
|
-
legacy: false
|
|
774
|
+
optional: false
|
|
788
775
|
}];
|
|
789
776
|
if (!derivesEnvironment(provider)) return [];
|
|
790
777
|
const layer = detectEnvironment(input.env);
|
|
791
778
|
if (layer === "test") return [];
|
|
792
|
-
return
|
|
779
|
+
return environmentLayers(await repoSlug(input.repoRoot, input.gitExec), layer);
|
|
793
780
|
}
|
|
794
781
|
// src/credentials-environments/try-environments/try-environments.ts
|
|
795
782
|
/** A provider's "no such Environment": its API error with status 404 (`ProviderApiError`, matched by shape). */
|
|
@@ -798,29 +785,19 @@ function isNotFound(err) {
|
|
|
798
785
|
}
|
|
799
786
|
/**
|
|
800
787
|
* Calls `attempt` for each candidate and sorts the answers into found and missing. A 404 is a miss; any other error
|
|
801
|
-
* is thrown. A missing optional Environment is silent
|
|
802
|
-
* (migration only, #2063) are tried too, and if one exists the miss is forgiven.
|
|
788
|
+
* is thrown. A missing optional Environment is silent; a missing required one is reported by name.
|
|
803
789
|
*/
|
|
804
790
|
async function tryEnvironments(candidates, attempt) {
|
|
805
791
|
const found = [];
|
|
806
792
|
const missing = [];
|
|
807
|
-
const
|
|
808
|
-
|
|
809
|
-
|
|
810
|
-
|
|
811
|
-
|
|
812
|
-
|
|
813
|
-
|
|
814
|
-
|
|
815
|
-
if (!isNotFound(err)) throw err;
|
|
816
|
-
if (!candidate.optional) missing.push(candidate.name);
|
|
817
|
-
}
|
|
818
|
-
};
|
|
819
|
-
for (const candidate of candidates.filter((c) => !c.legacy)) await ask(candidate);
|
|
820
|
-
if (missing.length > 0) {
|
|
821
|
-
const before = found.length;
|
|
822
|
-
for (const candidate of candidates.filter((c) => c.legacy)) await ask(candidate);
|
|
823
|
-
if (found.length > before) missing.length = 0;
|
|
793
|
+
for (const candidate of candidates) try {
|
|
794
|
+
found.push({
|
|
795
|
+
name: candidate.name,
|
|
796
|
+
result: await attempt(candidate.name)
|
|
797
|
+
});
|
|
798
|
+
} catch (err) {
|
|
799
|
+
if (!isNotFound(err)) throw err;
|
|
800
|
+
if (!candidate.optional) missing.push(candidate.name);
|
|
824
801
|
}
|
|
825
802
|
return {
|
|
826
803
|
found,
|
|
@@ -1423,6 +1400,48 @@ function actionsOf(plugin) {
|
|
|
1423
1400
|
...plugin.doctor ? { doctor: plugin.doctor } : {}
|
|
1424
1401
|
};
|
|
1425
1402
|
}
|
|
1403
|
+
// src/private-dir/ignore-advice/ignore-advice.ts
|
|
1404
|
+
/** The line that says how to fix a credentials path the version control ignore rules do not cover. */
|
|
1405
|
+
function ignoreAdvice(isDefault, choose) {
|
|
1406
|
+
return isDefault ? "the private directory's ignore rule is missing: run `holocron repo sync` to add it" : `add it to .gitignore, or ${choose}`;
|
|
1407
|
+
}
|
|
1408
|
+
// src/private-dir/private-dir.ts
|
|
1409
|
+
/** The directory, relative to the repository root, for files that hold secrets and must never be committed. */
|
|
1410
|
+
const PRIVATE_DIR = ".holocron/.private";
|
|
1411
|
+
/** The file `auth export` and `github-app create` write by default, relative to the repository root. */
|
|
1412
|
+
const PRIVATE_CREDENTIALS_FILE = `${PRIVATE_DIR}/.credentials`;
|
|
1413
|
+
/** The tracked file that keeps the otherwise ignored directory in the checkout. */
|
|
1414
|
+
const PRIVATE_KEEP_FILE = `${PRIVATE_DIR}/.gitkeep`;
|
|
1415
|
+
/**
|
|
1416
|
+
* The managed block `repo setup` and `repo sync` keep in `.gitignore`: everything in the private directory is ignored
|
|
1417
|
+
* except the `.gitkeep`. The start marker must not be a substring of the end marker.
|
|
1418
|
+
*/
|
|
1419
|
+
const PRIVATE_IGNORE_BLOCK = {
|
|
1420
|
+
start: "# managed by holocron setup — private directory",
|
|
1421
|
+
end: "# end managed by holocron setup — private directory",
|
|
1422
|
+
lines: [`${PRIVATE_DIR}/*`, `!${PRIVATE_KEEP_FILE}`]
|
|
1423
|
+
};
|
|
1424
|
+
// src/private-dir/resolve-credentials-file/resolve-credentials-file.ts
|
|
1425
|
+
/**
|
|
1426
|
+
* The credentials file for a command: `file` (relative to `base`) when given, else `.holocron/.private/.credentials`
|
|
1427
|
+
* under `base`. The default's directory is created when missing (owner-only), because the ignore check can only ask
|
|
1428
|
+
* about a path whose directory exists and the file cannot be written without it.
|
|
1429
|
+
*/
|
|
1430
|
+
function resolveCredentialsFile(base, file, makeDir = (dir) => void mkdirSync(dir, {
|
|
1431
|
+
recursive: true,
|
|
1432
|
+
mode: 448
|
|
1433
|
+
})) {
|
|
1434
|
+
if (file) return {
|
|
1435
|
+
path: resolve(base, file),
|
|
1436
|
+
isDefault: false
|
|
1437
|
+
};
|
|
1438
|
+
const path = resolve(base, PRIVATE_CREDENTIALS_FILE);
|
|
1439
|
+
makeDir(dirname(path));
|
|
1440
|
+
return {
|
|
1441
|
+
path,
|
|
1442
|
+
isDefault: true
|
|
1443
|
+
};
|
|
1444
|
+
}
|
|
1426
1445
|
// src/commands/auth/auth.ts
|
|
1427
1446
|
/**
|
|
1428
1447
|
* `holocron auth <subcommand>` — manage bootstrap credentials in the
|
|
@@ -1892,8 +1911,6 @@ const doctorTokensCommand = {
|
|
|
1892
1911
|
const COMMAND$8 = "auth export";
|
|
1893
1912
|
/** Plain code-unit order: the same on every machine, whatever its locale. The names it sorts are all different. */
|
|
1894
1913
|
const compare = (a, b) => a < b ? -1 : 1;
|
|
1895
|
-
/** The file the lines go to on a terminal when none is named. */
|
|
1896
|
-
const DEFAULT_FILE$1 = ".credentials";
|
|
1897
1914
|
/** What a variable can be called in a dotenv file and in a shell. */
|
|
1898
1915
|
const VARIABLE_NAME = /^[A-Za-z_][A-Za-z0-9_]*$/;
|
|
1899
1916
|
async function runAuthExport(input) {
|
|
@@ -2055,9 +2072,10 @@ async function runAuthExport(input) {
|
|
|
2055
2072
|
destination = "clipboard";
|
|
2056
2073
|
} else if (target === "file") {
|
|
2057
2074
|
if ((input.platform ?? process.platform) === "win32") return refuse("windows", "cannot make the file private on Windows: its mode bits are not enforced, so other users may read it", "use `holocron auth export --copy`, or pipe the output to a tool");
|
|
2058
|
-
|
|
2075
|
+
const target = resolveCredentialsFile(dirname(input.loaded.filepath), input.file, input.makeDir);
|
|
2076
|
+
file = target.path;
|
|
2059
2077
|
const git = (input.isIgnored ?? isGitIgnored)(file);
|
|
2060
|
-
if (git === "tracked" || git === "unknown") return refuse("not-ignored", git === "tracked" ? `refusing to write tokens to ${file}: git does not ignore it, so it could be committed` : `refusing to write tokens to ${file}: git could not say whether it ignores it`,
|
|
2078
|
+
if (git === "tracked" || git === "unknown") return refuse("not-ignored", git === "tracked" ? `refusing to write tokens to ${file}: git does not ignore it, so it could be committed` : `refusing to write tokens to ${file}: git could not say whether it ignores it`, ignoreAdvice(target.isDefault, "choose a path outside the repository with --file"));
|
|
2061
2079
|
try {
|
|
2062
2080
|
identity = (input.writeFile ?? writeCredentialsFile)(file, text, input.force === true);
|
|
2063
2081
|
} catch (err) {
|
|
@@ -2127,7 +2145,7 @@ const authExportArgs = (yy) => yy.option("from-env", {
|
|
|
2127
2145
|
describe: "Also take a token that is set in the environment (HOLOCRON_<X> or the vendor's name), ahead of the keyring"
|
|
2128
2146
|
}).option("file", {
|
|
2129
2147
|
type: "string",
|
|
2130
|
-
describe: "Write the tokens to this private file (mode 0600; default .credentials
|
|
2148
|
+
describe: "Write the tokens to this private file (mode 0600; default .holocron/.private/.credentials) instead of stdout; on a terminal this is the default"
|
|
2131
2149
|
}).option("only", {
|
|
2132
2150
|
type: "string",
|
|
2133
2151
|
array: true,
|
|
@@ -5370,7 +5388,7 @@ async function checkCredentials(input, loader) {
|
|
|
5370
5388
|
/**
|
|
5371
5389
|
* One row per expected variable, against the Environments the layer reads. A variable counts as present when any
|
|
5372
5390
|
* Environment found holds it (the first found wins, as in the credential store). A required Environment that does not
|
|
5373
|
-
* exist is a failing row of its own, by name; a missing `- local` is not mentioned
|
|
5391
|
+
* exist is a failing row of its own, by name; a missing `- local` is not mentioned.
|
|
5374
5392
|
*/
|
|
5375
5393
|
async function checkProvider(impl, candidates, expected) {
|
|
5376
5394
|
const provider = impl.providerName;
|
|
@@ -5383,7 +5401,6 @@ async function checkProvider(impl, candidates, expected) {
|
|
|
5383
5401
|
const rows = missing.map((name) => row$10(provider, "fail", `${provider} has no Environment named "${name}"`));
|
|
5384
5402
|
const labels = found.map(({ name, result }) => result.environment === name ? `"${name}"` : `"${result.environment}" (the config writes "${name}")`);
|
|
5385
5403
|
const where = labels.join(", ");
|
|
5386
|
-
for (const { name, legacy } of found) if (legacy) rows.push(row$10(provider, "skip", `read from the old Environment name "${name}"; rename it`));
|
|
5387
5404
|
if (found.length === 0) return rows;
|
|
5388
5405
|
for (const { name, optional } of expected) {
|
|
5389
5406
|
const at = found.findIndex((f) => f.result.names.includes(name));
|
|
@@ -12102,7 +12119,7 @@ const doctorCommand = {
|
|
|
12102
12119
|
// src/commands/github-app-create/github-app-create.ts
|
|
12103
12120
|
/**
|
|
12104
12121
|
* `holocron github-app create` — create a GitHub App from a manifest (GitHub's manifest flow), and keep its
|
|
12105
|
-
* credentials in the private `.credentials` file `auth export` uses, to import into a credentials environment.
|
|
12122
|
+
* credentials in the private `.holocron/.private/.credentials` file `auth export` uses, to import into a credentials environment.
|
|
12106
12123
|
*
|
|
12107
12124
|
* The flow has one click in it that cannot be done for you: a local page posts the manifest to GitHub, you press
|
|
12108
12125
|
* "Create GitHub App", GitHub redirects back to a one-shot server on the loopback address with a code, and the code is
|
|
@@ -12111,7 +12128,6 @@ const doctorCommand = {
|
|
|
12111
12128
|
* ever printed.
|
|
12112
12129
|
*/
|
|
12113
12130
|
const COMMAND$5 = "github-app create";
|
|
12114
|
-
const DEFAULT_FILE = ".credentials";
|
|
12115
12131
|
const DEFAULT_WEBHOOK_SECRET_VAR = "SENTINEL_WEBHOOK_SECRET";
|
|
12116
12132
|
async function runGithubAppCreate(input) {
|
|
12117
12133
|
const print = input.print ?? ((line) => console.error(line));
|
|
@@ -12141,9 +12157,10 @@ async function runGithubAppCreate(input) {
|
|
|
12141
12157
|
} catch (err) {
|
|
12142
12158
|
return refuse("manifest", errorMessage(err));
|
|
12143
12159
|
}
|
|
12144
|
-
const
|
|
12160
|
+
const target = resolveCredentialsFile(input.dir, input.file, input.makeDir);
|
|
12161
|
+
const file = target.path;
|
|
12145
12162
|
const git = (input.isIgnored ?? isGitIgnored)(file);
|
|
12146
|
-
if (git === "tracked" || git === "unknown") return refuse("not-ignored", git === "tracked" ? `refusing to write credentials to ${file}: git does not ignore it, so it could be committed` : `refusing to write credentials to ${file}: git could not say whether it ignores it`,
|
|
12163
|
+
if (git === "tracked" || git === "unknown") return refuse("not-ignored", git === "tracked" ? `refusing to write credentials to ${file}: git does not ignore it, so it could be committed` : `refusing to write credentials to ${file}: git could not say whether it ignores it`, ignoreAdvice(target.isDefault, "choose another path with --file"));
|
|
12147
12164
|
if (!input.force && (input.exists ?? existsSync)(file)) return refuse("exists", `${file} is already there and is never overwritten`, "delete it, or pass --force to replace it");
|
|
12148
12165
|
const state = input.state ?? randomBytes(16).toString("hex");
|
|
12149
12166
|
const action = input.org ? `https://github.com/organizations/${encodeURIComponent(input.org)}/settings/apps/new?state=${state}` : `https://github.com/settings/apps/new?state=${state}`;
|
|
@@ -12233,7 +12250,7 @@ const githubAppCreateArgs = (yy) => yy.option("name", {
|
|
|
12233
12250
|
describe: "The variable the webhook secret is written as"
|
|
12234
12251
|
}).option("file", {
|
|
12235
12252
|
type: "string",
|
|
12236
|
-
describe: "Write the credentials to this private file (mode 0600; default .credentials)"
|
|
12253
|
+
describe: "Write the credentials to this private file (mode 0600; default .holocron/.private/.credentials)"
|
|
12237
12254
|
}).option("keep", {
|
|
12238
12255
|
type: "boolean",
|
|
12239
12256
|
default: false,
|
|
@@ -17250,6 +17267,14 @@ const probeArgs = (y) => y.positional("provider", {
|
|
|
17250
17267
|
}).option("files", {
|
|
17251
17268
|
type: "boolean",
|
|
17252
17269
|
describe: "`tasks names`: also report old names that are part of a workflow file name (`delivery.build.yml`)"
|
|
17270
|
+
}).option("only", {
|
|
17271
|
+
type: "string",
|
|
17272
|
+
array: true,
|
|
17273
|
+
nargs: 1,
|
|
17274
|
+
describe: "`1password export-environment`: export only this variable; repeat for more"
|
|
17275
|
+
}).option("copy", {
|
|
17276
|
+
type: "boolean",
|
|
17277
|
+
describe: "`1password export-environment`: put the variables on the clipboard instead of a file"
|
|
17253
17278
|
}).option("yes", {
|
|
17254
17279
|
type: "boolean",
|
|
17255
17280
|
default: false,
|
|
@@ -18658,6 +18683,34 @@ async function generateConfigFiles(input) {
|
|
|
18658
18683
|
}
|
|
18659
18684
|
return entries;
|
|
18660
18685
|
}
|
|
18686
|
+
// src/commands/repo-files/generate-private-dir-files.ts
|
|
18687
|
+
/**
|
|
18688
|
+
* The private directory for files that hold secrets (`.holocron/.private/`): an empty tracked `.gitkeep` that keeps it
|
|
18689
|
+
* in the checkout, and the managed block in `.gitignore` that ignores everything else in it. The block is merged into
|
|
18690
|
+
* the `.gitignore` already on disk, so the rest of the file (and the skills blocks `repo setup` keeps) is untouched.
|
|
18691
|
+
* `repo setup` and `repo sync` both write what this returns, so the bytes are the same from either.
|
|
18692
|
+
*/
|
|
18693
|
+
async function generatePrivateDirFiles(input) {
|
|
18694
|
+
const existing = await readFile(join(input.repoRoot, ".gitignore"), "utf8").catch(() => "");
|
|
18695
|
+
return [{
|
|
18696
|
+
kind: "file",
|
|
18697
|
+
path: PRIVATE_KEEP_FILE,
|
|
18698
|
+
content: "",
|
|
18699
|
+
step: `write ${PRIVATE_KEEP_FILE}`,
|
|
18700
|
+
syncStep: `write ${PRIVATE_KEEP_FILE}`,
|
|
18701
|
+
note: "keeps the private directory in the checkout"
|
|
18702
|
+
}, {
|
|
18703
|
+
kind: "file",
|
|
18704
|
+
path: ".gitignore",
|
|
18705
|
+
content: upsertManagedBlock(existing, {
|
|
18706
|
+
...PRIVATE_IGNORE_BLOCK,
|
|
18707
|
+
lines: PRIVATE_IGNORE_BLOCK.lines
|
|
18708
|
+
}),
|
|
18709
|
+
step: "write .gitignore",
|
|
18710
|
+
syncStep: "write .gitignore",
|
|
18711
|
+
note: "private directory block"
|
|
18712
|
+
}];
|
|
18713
|
+
}
|
|
18661
18714
|
// src/commands/repo-files/generate-turbo-files.ts
|
|
18662
18715
|
/**
|
|
18663
18716
|
* `turbo.json`, and the two edits that go with it: `turbo.json` alone is inert unless the root is a workspace member
|
|
@@ -18962,7 +19015,8 @@ function generateWorkflowFiles(input) {
|
|
|
18962
19015
|
// src/commands/repo-files/generate-repo-files.ts
|
|
18963
19016
|
/**
|
|
18964
19017
|
* Every file `holocron repo setup` writes to disk from the config alone, in the order it writes them: the thin-caller
|
|
18965
|
-
* workflows, the config files,
|
|
19018
|
+
* workflows, the config files, the agent instructions block, the private directory (`.holocron/.private/.gitkeep` and its `.gitignore` block), then
|
|
19019
|
+
* `turbo.json` and its follow-up edits. No provider and no network, so a job without
|
|
18966
19020
|
* a token can produce them, and `repo sync` takes the files it shares from here too. What setup reads from a provider
|
|
18967
19021
|
* (CODEOWNERS, which needs the org, the installed skills, the agent prompts) is not here.
|
|
18968
19022
|
*/
|
|
@@ -18971,6 +19025,7 @@ async function generateRepoFiles(input) {
|
|
|
18971
19025
|
...generateWorkflowFiles(input),
|
|
18972
19026
|
...await generateConfigFiles(input),
|
|
18973
19027
|
...await generateAgentFiles(input),
|
|
19028
|
+
...await generatePrivateDirFiles(input),
|
|
18974
19029
|
...await generateTurboFiles(input)
|
|
18975
19030
|
];
|
|
18976
19031
|
}
|
|
@@ -19816,7 +19871,7 @@ async function runProbeCommand(input) {
|
|
|
19816
19871
|
dryRun: input.dryRun ?? false,
|
|
19817
19872
|
yes: input.yes ?? false,
|
|
19818
19873
|
secrets: tokens,
|
|
19819
|
-
print,
|
|
19874
|
+
print: input.print ?? (probe.reportsTo === "stderr" ? (line) => console.error(line) : print),
|
|
19820
19875
|
...input.interactive !== void 0 ? { interactive: input.interactive } : {},
|
|
19821
19876
|
...input.confirm ? { confirm: input.confirm } : {},
|
|
19822
19877
|
...input.onInterrupt ? { onInterrupt: input.onInterrupt } : {}
|
|
@@ -19835,7 +19890,9 @@ const probeCommand = {
|
|
|
19835
19890
|
const args = [
|
|
19836
19891
|
...(argv.args ?? []).map(String),
|
|
19837
19892
|
...argv.warn ? ["--warn"] : [],
|
|
19838
|
-
...argv.files ? ["--files"] : []
|
|
19893
|
+
...argv.files ? ["--files"] : [],
|
|
19894
|
+
...(argv.only ?? []).flatMap((name) => ["--only", String(name)]),
|
|
19895
|
+
...argv.copy ? ["--copy"] : []
|
|
19839
19896
|
];
|
|
19840
19897
|
if ((await runProbeCommand({
|
|
19841
19898
|
loaded,
|
|
@@ -23177,6 +23234,7 @@ const SYNC_STEPS = [
|
|
|
23177
23234
|
"scripts",
|
|
23178
23235
|
"turbo",
|
|
23179
23236
|
"agents",
|
|
23237
|
+
"private",
|
|
23180
23238
|
"wiki"
|
|
23181
23239
|
];
|
|
23182
23240
|
const LOCAL_STEPS = /* @__PURE__ */ new Set([
|
|
@@ -23188,6 +23246,7 @@ const LOCAL_STEPS = /* @__PURE__ */ new Set([
|
|
|
23188
23246
|
"scripts",
|
|
23189
23247
|
"turbo",
|
|
23190
23248
|
"agents",
|
|
23249
|
+
"private",
|
|
23191
23250
|
"wiki"
|
|
23192
23251
|
]);
|
|
23193
23252
|
async function runSync(input) {
|
|
@@ -23367,6 +23426,7 @@ async function runSync(input) {
|
|
|
23367
23426
|
"scripts",
|
|
23368
23427
|
"turbo",
|
|
23369
23428
|
"agents",
|
|
23429
|
+
"private",
|
|
23370
23430
|
"wiki"
|
|
23371
23431
|
]) {
|
|
23372
23432
|
if (requestedSteps !== void 0 && !requestedSteps.includes(stepName)) continue;
|
|
@@ -23568,6 +23628,29 @@ async function runSync(input) {
|
|
|
23568
23628
|
print(formatSyncStep(steps[steps.length - 1]));
|
|
23569
23629
|
}
|
|
23570
23630
|
}
|
|
23631
|
+
if (stepName === "private") {
|
|
23632
|
+
if (resolvedRepoRoot !== gitRoot) {
|
|
23633
|
+
steps.push({
|
|
23634
|
+
capability: "local",
|
|
23635
|
+
step: "sync private directory",
|
|
23636
|
+
status: "skip",
|
|
23637
|
+
message: "--cwd is a monorepo subpackage, not the git root — run from the root"
|
|
23638
|
+
});
|
|
23639
|
+
print(formatSyncStep(steps[steps.length - 1]));
|
|
23640
|
+
continue;
|
|
23641
|
+
}
|
|
23642
|
+
for (const entry of await generatePrivateDirFiles({
|
|
23643
|
+
loaded: input.loaded,
|
|
23644
|
+
repoRoot: input.context.repoRoot,
|
|
23645
|
+
logger
|
|
23646
|
+
})) {
|
|
23647
|
+
steps.push(await runSyncStep("local", entry.syncStep, dryRun, async () => {
|
|
23648
|
+
await mkdir(dirname(join(gitRoot, entry.path)), { recursive: true });
|
|
23649
|
+
await writeFile(join(gitRoot, entry.path), entry.content, "utf8");
|
|
23650
|
+
}));
|
|
23651
|
+
print(formatSyncStep(steps[steps.length - 1]));
|
|
23652
|
+
}
|
|
23653
|
+
}
|
|
23571
23654
|
if (stepName === "wiki") {
|
|
23572
23655
|
const result = await runSyncWiki({
|
|
23573
23656
|
loaded: input.loaded,
|