patchcord 0.5.70 → 0.5.72
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/bin/patchcord.mjs +12 -5
- package/package.json +1 -1
package/bin/patchcord.mjs
CHANGED
|
@@ -1367,7 +1367,8 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1367
1367
|
// Create session
|
|
1368
1368
|
let sessionId = "";
|
|
1369
1369
|
try {
|
|
1370
|
-
const
|
|
1370
|
+
const folder = basename(process.cwd());
|
|
1371
|
+
const resp = run(`curl -sf --max-time 10 -X POST "${apiUrl}/api/connect/session" -H "Content-Type: application/json" -d '{"tool":"${choice}","folder":"${folder}"}'`);
|
|
1371
1372
|
if (resp) {
|
|
1372
1373
|
const data = JSON.parse(resp);
|
|
1373
1374
|
sessionId = data.session_id || "";
|
|
@@ -1405,8 +1406,7 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1405
1406
|
// page skips its type picker (the user already chose on the
|
|
1406
1407
|
// dashboard tile).
|
|
1407
1408
|
const toolParam = toolSlug ? `&tool=${encodeURIComponent(toolSlug)}` : "";
|
|
1408
|
-
const
|
|
1409
|
-
const connectUrl = `https://patchcord.dev/connect?session=${sessionId}${toolParam}${cwdParam}`;
|
|
1409
|
+
const connectUrl = `https://patchcord.dev/connect?session=${sessionId}${toolParam}`;
|
|
1410
1410
|
|
|
1411
1411
|
if (canOpenBrowser()) {
|
|
1412
1412
|
const opened = openBrowser(connectUrl);
|
|
@@ -1801,10 +1801,14 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1801
1801
|
const primaryRc = shellRcCandidates[0];
|
|
1802
1802
|
const primaryName = basename(primaryRc);
|
|
1803
1803
|
let aliasInstalled = false;
|
|
1804
|
+
let aliasAlreadyPresent = false;
|
|
1804
1805
|
for (const rcFile of shellRcCandidates) {
|
|
1805
1806
|
if (!existsSync(rcFile)) continue;
|
|
1806
1807
|
const rcContent = readFileSync(rcFile, "utf-8");
|
|
1807
|
-
if (rcContent.includes("alias kimi-pc="))
|
|
1808
|
+
if (rcContent.includes("alias kimi-pc=")) {
|
|
1809
|
+
aliasAlreadyPresent = true;
|
|
1810
|
+
continue;
|
|
1811
|
+
}
|
|
1808
1812
|
writeFileSync(
|
|
1809
1813
|
rcFile,
|
|
1810
1814
|
rcContent.trimEnd() + `\n\n${aliasComment}\n${aliasLine}\n`
|
|
@@ -1815,8 +1819,11 @@ if (!cmd || cmd === "install" || cmd === "agent" || cmd?.startsWith("--")) {
|
|
|
1815
1819
|
console.log(`\n ${green}✓${r} Alias installed in ${primaryName}`);
|
|
1816
1820
|
console.log(` ${dim}Run ${bold}kimi-pc${r}${dim} instead of ${bold}kimi${r}${dim} in project directories.${r}`);
|
|
1817
1821
|
console.log(` ${dim}Reload your shell or run ${cyan}source ~/${primaryName}${r}${dim} to use it now.${r}`);
|
|
1822
|
+
} else if (aliasAlreadyPresent) {
|
|
1823
|
+
console.log(`\n ${green}✓${r} Alias already present in shell config`);
|
|
1824
|
+
console.log(` ${dim}Run ${bold}kimi-pc${r}${dim} instead of ${bold}kimi${r}${dim} in project directories.${r}`);
|
|
1818
1825
|
} else {
|
|
1819
|
-
console.log(`\n ${yellow}⚠${r}
|
|
1826
|
+
console.log(`\n ${yellow}⚠${r} No shell config found (~/.bashrc or ~/.zshrc).`);
|
|
1820
1827
|
console.log(` ${dim}Add this to your ~/${primaryName} manually:${r}`);
|
|
1821
1828
|
console.log(` ${cyan}${aliasLine}${r}`);
|
|
1822
1829
|
}
|