patchcord 0.5.13 → 0.5.14
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/.claude-plugin/plugin.json +1 -1
- package/bin/patchcord.mjs +14 -3
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -366,12 +366,23 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
366
366
|
}
|
|
367
367
|
rl.close();
|
|
368
368
|
} else {
|
|
369
|
-
// Check if patchcord is already configured — offer to update URL without re-auth
|
|
369
|
+
// Check if patchcord is already configured — offer to update URL without re-auth.
|
|
370
|
+
// When --tool=<slug> is set, we ONLY look at the config file that <slug>
|
|
371
|
+
// would itself write to. Other tools' existing configs in the same project
|
|
372
|
+
// are not a "we already have patchcord here" signal — the user is explicit
|
|
373
|
+
// about which tool they're setting up, the question "Add another agent?"
|
|
374
|
+
// makes no sense across tool boundaries (claude_code already configured
|
|
375
|
+
// doesn't change anything about installing codex).
|
|
370
376
|
let existingToken = "";
|
|
371
377
|
let existingConfigFile = "";
|
|
372
378
|
const mcpJsonPath = join(cwd, ".mcp.json");
|
|
373
379
|
const codexTomlPath = join(cwd, ".codex", "config.toml");
|
|
374
|
-
|
|
380
|
+
|
|
381
|
+
const slugForCheck = toolSlug ? toolSlug.replace(/-/g, "_") : "";
|
|
382
|
+
const checkMcpJson = !slugForCheck || slugForCheck === "claude_code";
|
|
383
|
+
const checkCodexToml = !slugForCheck || slugForCheck === "codex";
|
|
384
|
+
|
|
385
|
+
if (checkMcpJson && existsSync(mcpJsonPath)) {
|
|
375
386
|
try {
|
|
376
387
|
const existing = JSON.parse(readFileSync(mcpJsonPath, "utf-8"));
|
|
377
388
|
const pt = existing?.mcpServers?.patchcord;
|
|
@@ -381,7 +392,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
381
392
|
}
|
|
382
393
|
} catch {}
|
|
383
394
|
}
|
|
384
|
-
if (!existingToken && existsSync(codexTomlPath)) {
|
|
395
|
+
if (!existingToken && checkCodexToml && existsSync(codexTomlPath)) {
|
|
385
396
|
try {
|
|
386
397
|
const content = readFileSync(codexTomlPath, "utf-8");
|
|
387
398
|
const match = content.match(/Bearer\s+([^\s"]+)/);
|