theclawbay 0.3.35 → 0.3.36
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/commands/setup.js +36 -0
- package/package.json +1 -1
package/dist/commands/setup.js
CHANGED
|
@@ -290,6 +290,28 @@ function xdgConfigHomeDir() {
|
|
|
290
290
|
return raw;
|
|
291
291
|
return node_path_1.default.join(node_os_1.default.homedir(), ".config");
|
|
292
292
|
}
|
|
293
|
+
function configFileCandidatesForDir(dir, basenames) {
|
|
294
|
+
return basenames.map((basename) => node_path_1.default.join(dir, basename));
|
|
295
|
+
}
|
|
296
|
+
function findProjectConfigFile(params) {
|
|
297
|
+
let current = node_path_1.default.resolve(params.startDir);
|
|
298
|
+
const root = node_path_1.default.parse(current).root;
|
|
299
|
+
while (true) {
|
|
300
|
+
for (const candidate of configFileCandidatesForDir(current, params.basenames)) {
|
|
301
|
+
if ((0, node_fs_1.existsSync)(candidate))
|
|
302
|
+
return candidate;
|
|
303
|
+
}
|
|
304
|
+
if ((0, node_fs_1.existsSync)(node_path_1.default.join(current, ".git"))) {
|
|
305
|
+
return null;
|
|
306
|
+
}
|
|
307
|
+
if (current === root)
|
|
308
|
+
return null;
|
|
309
|
+
const parent = node_path_1.default.dirname(current);
|
|
310
|
+
if (parent === current)
|
|
311
|
+
return null;
|
|
312
|
+
current = parent;
|
|
313
|
+
}
|
|
314
|
+
}
|
|
293
315
|
function configDirCandidates(appName) {
|
|
294
316
|
const home = node_os_1.default.homedir();
|
|
295
317
|
const dirs = [node_path_1.default.join(xdgConfigHomeDir(), appName)];
|
|
@@ -1204,6 +1226,12 @@ function openCodeConfigFileCandidates() {
|
|
|
1204
1226
|
candidates.push(node_path_1.default.join(home, ".opencode.json"));
|
|
1205
1227
|
return uniqueStrings(candidates);
|
|
1206
1228
|
}
|
|
1229
|
+
function findOpenCodeProjectConfigFile() {
|
|
1230
|
+
return findProjectConfigFile({
|
|
1231
|
+
startDir: process.cwd(),
|
|
1232
|
+
basenames: ["opencode.json", "opencode.jsonc", ".opencode.json", ".opencode.jsonc"],
|
|
1233
|
+
});
|
|
1234
|
+
}
|
|
1207
1235
|
function isOpenCodeAuthPlugin(value) {
|
|
1208
1236
|
if (typeof value !== "string")
|
|
1209
1237
|
return false;
|
|
@@ -1793,6 +1821,14 @@ class SetupCommand extends base_command_1.BaseCommand {
|
|
|
1793
1821
|
const openCodeDetected = setupClients.find((client) => client.id === "opencode")?.detected ?? false;
|
|
1794
1822
|
if (selectedSetupClients.has("opencode")) {
|
|
1795
1823
|
this.log(`- OpenCode: configured (${openCodeConfigPaths.join(", ")})`);
|
|
1824
|
+
const openCodeProjectConfig = findOpenCodeProjectConfigFile();
|
|
1825
|
+
const openCodeConfigEnv = process.env.OPENCODE_CONFIG?.trim() || "";
|
|
1826
|
+
if (openCodeConfigEnv) {
|
|
1827
|
+
this.log(`- OpenCode note: OPENCODE_CONFIG is set (${openCodeConfigEnv}). OpenCode may load that file and override your global config.`);
|
|
1828
|
+
}
|
|
1829
|
+
if (openCodeProjectConfig) {
|
|
1830
|
+
this.log(`- OpenCode note: found project-level ${node_path_1.default.basename(openCodeProjectConfig)} at ${openCodeProjectConfig} which overrides global config.`);
|
|
1831
|
+
}
|
|
1796
1832
|
}
|
|
1797
1833
|
else if (openCodeDetected) {
|
|
1798
1834
|
this.log("- OpenCode: detected but skipped");
|
package/package.json
CHANGED