patchcord 0.5.12 → 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 +19 -4
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -77,7 +77,11 @@ if (cmd === "plugin-path") {
|
|
|
77
77
|
}
|
|
78
78
|
|
|
79
79
|
// ── main flow: global setup + project setup (or just install/agent for back-compat) ──
|
|
80
|
-
|
|
80
|
+
// Any --flag enters this branch so equals-form (--token=foo, --tool=foo, --server=foo)
|
|
81
|
+
// works the same as the space-form (--token foo). The internal flag parsing below
|
|
82
|
+
// supports both. Non-flag commands (channel, init, skill, help, plugin-path) have
|
|
83
|
+
// their own branches above and below.
|
|
84
|
+
if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
81
85
|
const flags = cmd?.startsWith("--") ? process.argv.slice(2) : process.argv.slice(3);
|
|
82
86
|
const fullStatusline = flags.includes("--full");
|
|
83
87
|
let wasPluginInstalled = false;
|
|
@@ -362,12 +366,23 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
362
366
|
}
|
|
363
367
|
rl.close();
|
|
364
368
|
} else {
|
|
365
|
-
// 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).
|
|
366
376
|
let existingToken = "";
|
|
367
377
|
let existingConfigFile = "";
|
|
368
378
|
const mcpJsonPath = join(cwd, ".mcp.json");
|
|
369
379
|
const codexTomlPath = join(cwd, ".codex", "config.toml");
|
|
370
|
-
|
|
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)) {
|
|
371
386
|
try {
|
|
372
387
|
const existing = JSON.parse(readFileSync(mcpJsonPath, "utf-8"));
|
|
373
388
|
const pt = existing?.mcpServers?.patchcord;
|
|
@@ -377,7 +392,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd === "--token" || cmd ===
|
|
|
377
392
|
}
|
|
378
393
|
} catch {}
|
|
379
394
|
}
|
|
380
|
-
if (!existingToken && existsSync(codexTomlPath)) {
|
|
395
|
+
if (!existingToken && checkCodexToml && existsSync(codexTomlPath)) {
|
|
381
396
|
try {
|
|
382
397
|
const content = readFileSync(codexTomlPath, "utf-8");
|
|
383
398
|
const match = content.match(/Bearer\s+([^\s"]+)/);
|