create-op-node 0.11.0 → 0.11.2
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.js +41 -7
- package/dist/cli.js.map +1 -1
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -444,6 +444,16 @@ async function createRepoFromTemplate(input) {
|
|
|
444
444
|
defaultBranch: res.data.default_branch ?? "main"
|
|
445
445
|
};
|
|
446
446
|
}
|
|
447
|
+
async function getRepoDefaultBranch(input) {
|
|
448
|
+
const parsed = parseRepoSlug(input.repo);
|
|
449
|
+
if (!parsed) return null;
|
|
450
|
+
try {
|
|
451
|
+
const res = await client(input.token).repos.get({ owner: parsed.owner, repo: parsed.repo });
|
|
452
|
+
return res.data.default_branch ?? null;
|
|
453
|
+
} catch {
|
|
454
|
+
return null;
|
|
455
|
+
}
|
|
456
|
+
}
|
|
447
457
|
function parseRepoSlug(repo) {
|
|
448
458
|
const slash = repo.indexOf("/");
|
|
449
459
|
if (slash <= 0 || slash === repo.length - 1 || repo.indexOf("/", slash + 1) !== -1) return null;
|
|
@@ -915,7 +925,16 @@ async function createRegionRepo(args) {
|
|
|
915
925
|
);
|
|
916
926
|
process.exit(0);
|
|
917
927
|
}
|
|
918
|
-
|
|
928
|
+
const fetched = await getRepoDefaultBranch({ token: ghToken, repo: newRepoFull });
|
|
929
|
+
if (fetched === null) {
|
|
930
|
+
p3.note(
|
|
931
|
+
pc2.yellow(
|
|
932
|
+
`\u26A0 Couldn't read ${newRepoFull}'s default branch \u2014 assuming "main". If the branch/PR steps fail, check the repo's default branch on GitHub.`
|
|
933
|
+
),
|
|
934
|
+
"Notice"
|
|
935
|
+
);
|
|
936
|
+
}
|
|
937
|
+
return { fullName: newRepoFull, defaultBranch: fetched ?? "main" };
|
|
919
938
|
}
|
|
920
939
|
}
|
|
921
940
|
async function seedRepoSecrets(args) {
|
|
@@ -1509,7 +1528,11 @@ function validatePlistInput(input) {
|
|
|
1509
1528
|
}
|
|
1510
1529
|
function buildSetenvCommand(input) {
|
|
1511
1530
|
return [
|
|
1512
|
-
`
|
|
1531
|
+
// Quote the path inside `cat` so a space-containing keyFilePath (allowed by
|
|
1532
|
+
// SAFE_PATH_RE) doesn't word-split and leave PGSODIUM_ROOT_KEY empty. The
|
|
1533
|
+
// regex rejects `"`/`$`/backticks, so the inner quotes can't be broken out
|
|
1534
|
+
// of — this is word-split safety, not new injection surface. (#36)
|
|
1535
|
+
`launchctl setenv PGSODIUM_ROOT_KEY "$(cat "${input.keyFilePath}")"`,
|
|
1513
1536
|
...input.tunnelToken !== void 0 ? [`launchctl setenv TUNNEL_TOKEN "${input.tunnelToken}"`] : [],
|
|
1514
1537
|
...input.llmModel !== void 0 ? [`launchctl setenv LLM_MODEL "${input.llmModel}"`] : [],
|
|
1515
1538
|
...input.embeddingModel !== void 0 ? [`launchctl setenv EMBEDDINGS_MODEL "${input.embeddingModel}"`] : [],
|
|
@@ -1586,7 +1609,7 @@ async function teardownLaunchAgent(paths, opts = {}) {
|
|
|
1586
1609
|
const unload = await safeExeca("launchctl", ["unload", paths.plistFile]);
|
|
1587
1610
|
steps.push({
|
|
1588
1611
|
step: "unload",
|
|
1589
|
-
ok:
|
|
1612
|
+
ok: unload !== null,
|
|
1590
1613
|
...unload === null ? { reason: "`launchctl` not on PATH" } : {}
|
|
1591
1614
|
});
|
|
1592
1615
|
try {
|
|
@@ -4963,8 +4986,18 @@ async function looksLikeRegionsRepo(dir) {
|
|
|
4963
4986
|
return hasSchema && hasRegions;
|
|
4964
4987
|
}
|
|
4965
4988
|
|
|
4989
|
+
// src/lib/cli-args.ts
|
|
4990
|
+
var GLOBAL_FLAGS = /* @__PURE__ */ new Set(["-v", "--version", "-h", "--help"]);
|
|
4991
|
+
function withDefaultSubcommand(argv, known) {
|
|
4992
|
+
const first2 = argv[2];
|
|
4993
|
+
if (first2 !== void 0 && (known.includes(first2) || GLOBAL_FLAGS.has(first2))) {
|
|
4994
|
+
return argv;
|
|
4995
|
+
}
|
|
4996
|
+
return [...argv.slice(0, 2), "init", ...argv.slice(2)];
|
|
4997
|
+
}
|
|
4998
|
+
|
|
4966
4999
|
// src/cli.ts
|
|
4967
|
-
var VERSION = "0.11.
|
|
5000
|
+
var VERSION = "0.11.2";
|
|
4968
5001
|
var program = new Command();
|
|
4969
5002
|
program.name("create-op-node").description(
|
|
4970
5003
|
"Interactive bootstrap for an Opus Populi federation node.\nCloudflare infrastructure \u2192 Mac Studio \u2192 live public API."
|
|
@@ -4974,9 +5007,10 @@ program.addCommand(bootstrapCommand);
|
|
|
4974
5007
|
program.addCommand(resetCommand);
|
|
4975
5008
|
program.addCommand(verifyCommand);
|
|
4976
5009
|
program.addCommand(regionCommand);
|
|
4977
|
-
|
|
4978
|
-
process.argv
|
|
4979
|
-
|
|
5010
|
+
process.argv = withDefaultSubcommand(
|
|
5011
|
+
process.argv,
|
|
5012
|
+
program.commands.map((c) => c.name())
|
|
5013
|
+
);
|
|
4980
5014
|
await program.parseAsync(process.argv).catch((err) => {
|
|
4981
5015
|
const msg = err instanceof Error ? err.message : String(err);
|
|
4982
5016
|
console.error(`
|