@skylandnpm/octopus-proxy 0.1.19 → 0.1.21
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.
|
@@ -7481,6 +7481,7 @@ function daemonEntryPath() {
|
|
|
7481
7481
|
|
|
7482
7482
|
// src/config.ts
|
|
7483
7483
|
import { readFile, stat } from "node:fs/promises";
|
|
7484
|
+
import { randomBytes } from "node:crypto";
|
|
7484
7485
|
import { isAbsolute } from "node:path";
|
|
7485
7486
|
|
|
7486
7487
|
// ../../node_modules/.pnpm/zod@3.24.2/node_modules/zod/lib/index.mjs
|
|
@@ -11619,7 +11620,7 @@ var ConfigSchema = z.object({
|
|
|
11619
11620
|
projects: z.array(z.object({ id: z.string().regex(/^[a-zA-Z0-9_-]+$/), name: z.string().min(1), directory: z.string().min(1), specDirectories: z.array(z.string()).default(["specs", "docs"]) })).min(1),
|
|
11620
11621
|
tool: ToolSchema.default({ kind: "opencode" })
|
|
11621
11622
|
});
|
|
11622
|
-
async function loadConfig(path) {
|
|
11623
|
+
async function loadConfig(path, options = {}) {
|
|
11623
11624
|
try {
|
|
11624
11625
|
const info = await stat(path).catch((error) => {
|
|
11625
11626
|
if (error.code === "ENOENT") throw new Error(`Configuration not found: ${path}`);
|
|
@@ -11627,6 +11628,10 @@ async function loadConfig(path) {
|
|
|
11627
11628
|
});
|
|
11628
11629
|
if ((info.mode & 63) !== 0) throw new Error("Proxy configuration contains a secret; run chmod 600 on it");
|
|
11629
11630
|
const raw = JSON.parse(await readFile(path, "utf8"));
|
|
11631
|
+
if (options.provisionOpenCodePassword) {
|
|
11632
|
+
const tool = raw.tool && typeof raw.tool === "object" && !Array.isArray(raw.tool) ? raw.tool : void 0;
|
|
11633
|
+
if ((!tool || tool.kind === void 0 || tool.kind === "opencode") && !tool?.password) raw.tool = { ...tool ?? {}, kind: "opencode", password: randomBytes(32).toString("base64url") };
|
|
11634
|
+
}
|
|
11630
11635
|
const config = ConfigSchema.parse(raw);
|
|
11631
11636
|
config.stateDirectory = expandHome(config.stateDirectory);
|
|
11632
11637
|
config.tool.command = expandHome(config.tool.command || describeTool(config.tool.kind).defaultCommand);
|
package/dist/cli.js
CHANGED
|
@@ -22,7 +22,7 @@ import {
|
|
|
22
22
|
runDaemon,
|
|
23
23
|
supportedPlatform,
|
|
24
24
|
systemdUnitPath
|
|
25
|
-
} from "./chunk-
|
|
25
|
+
} from "./chunk-TXFPGQ4Z.js";
|
|
26
26
|
|
|
27
27
|
// src/cli.ts
|
|
28
28
|
import { spawn } from "node:child_process";
|
|
@@ -502,7 +502,7 @@ async function runOnboard(opts) {
|
|
|
502
502
|
if (error.code === "ENOENT") return false;
|
|
503
503
|
throw error;
|
|
504
504
|
});
|
|
505
|
-
const existing = opts.interactive && configExists ? await loadConfig(opts.configPath) : void 0;
|
|
505
|
+
const existing = opts.interactive && configExists ? await loadConfig(opts.configPath, { provisionOpenCodePassword: true }) : void 0;
|
|
506
506
|
let hubUrl = opts.hubUrl || existing?.hubUrl || DEFAULT_HUB_URL, botId = opts.botId ?? existing?.botId ?? "", secretKey = opts.secretKey ?? existing?.secretKey ?? "", stateDirectory = opts.stateDirectory ?? existing?.stateDirectory ?? defaultStateDirectory();
|
|
507
507
|
let toolKind = opts.toolKind ?? existing?.tool.kind ?? "opencode";
|
|
508
508
|
let toolCommand = opts.toolCommand ?? (toolKind === existing?.tool.kind ? existing.tool.command : "");
|
package/dist/main.js
CHANGED