@pikaa-ai/pikaa 0.3.7 → 0.3.8
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/pikaa.js +3 -3
- package/dist/cli.js +113 -108
- package/package.json +1 -1
package/bin/pikaa.js
CHANGED
|
@@ -26,10 +26,10 @@ const rootDir = join(__dirname, "..");
|
|
|
26
26
|
const platform = process.platform;
|
|
27
27
|
const arch = process.arch;
|
|
28
28
|
|
|
29
|
-
let version = "
|
|
29
|
+
let version = "";
|
|
30
30
|
try {
|
|
31
31
|
const pkg = JSON.parse(readFileSync(join(rootDir, "package.json"), "utf8"));
|
|
32
|
-
version = pkg.version;
|
|
32
|
+
version = pkg.version || "";
|
|
33
33
|
} catch {}
|
|
34
34
|
|
|
35
35
|
function getBinaryName() {
|
|
@@ -41,7 +41,7 @@ function getBinaryName() {
|
|
|
41
41
|
|
|
42
42
|
const binaryName = getBinaryName();
|
|
43
43
|
const userBinDir = join(homedir(), ".pikaa", "bin");
|
|
44
|
-
const userBinaryPath = binaryName ? join(userBinDir, `pikaa-v${version}-${binaryName}`) : null;
|
|
44
|
+
const userBinaryPath = binaryName && version ? join(userBinDir, `pikaa-v${version}-${binaryName}`) : null;
|
|
45
45
|
|
|
46
46
|
// Look in package directory or user cache directory
|
|
47
47
|
function findExistingBinary() {
|
package/dist/cli.js
CHANGED
|
@@ -2,8 +2,8 @@
|
|
|
2
2
|
// @bun
|
|
3
3
|
|
|
4
4
|
// src/cli/index.ts
|
|
5
|
-
import { resolve as
|
|
6
|
-
import { existsSync as
|
|
5
|
+
import { resolve as resolve21 } from "path";
|
|
6
|
+
import { existsSync as existsSync19 } from "fs";
|
|
7
7
|
import { createInterface } from "readline";
|
|
8
8
|
|
|
9
9
|
// src/auth/store.ts
|
|
@@ -6030,12 +6030,63 @@ function parsePatch(oldSrc, newSrc, contextLines = 3) {
|
|
|
6030
6030
|
}
|
|
6031
6031
|
return result;
|
|
6032
6032
|
}
|
|
6033
|
+
// package.json
|
|
6034
|
+
var package_default = {
|
|
6035
|
+
name: "@pikaa-ai/pikaa",
|
|
6036
|
+
version: "0.3.8",
|
|
6037
|
+
description: "PIKAA CLI - AI coding agent that runs locally in your terminal.",
|
|
6038
|
+
main: "./dist/index.js",
|
|
6039
|
+
module: "./dist/index.js",
|
|
6040
|
+
types: "./dist/index.d.ts",
|
|
6041
|
+
bin: {
|
|
6042
|
+
pikaa: "./bin/pikaa.js",
|
|
6043
|
+
groupy: "./bin/pikaa.js"
|
|
6044
|
+
},
|
|
6045
|
+
type: "module",
|
|
6046
|
+
files: [
|
|
6047
|
+
"dist/index.js",
|
|
6048
|
+
"dist/cli.js",
|
|
6049
|
+
"bin",
|
|
6050
|
+
"templates",
|
|
6051
|
+
"assets",
|
|
6052
|
+
"skills/**/SKILL.md",
|
|
6053
|
+
"README.md",
|
|
6054
|
+
"LICENSE"
|
|
6055
|
+
],
|
|
6056
|
+
scripts: {
|
|
6057
|
+
start: "bun run src/cli/index.ts",
|
|
6058
|
+
test: "bun test --timeout 30000",
|
|
6059
|
+
typecheck: "tsc --noEmit",
|
|
6060
|
+
"build:js": "bun build ./src/index.ts --outdir ./dist --target=bun && bun build ./src/cli/index.ts --outfile ./dist/cli.js --target=bun",
|
|
6061
|
+
"build:exe": "bun build ./src/cli/index.ts --compile --outfile pikaa.exe",
|
|
6062
|
+
"build:binaries": "bun run scripts/build-binaries.ts",
|
|
6063
|
+
"release:prepare": "bun run scripts/prepare-release.ts",
|
|
6064
|
+
build: "bun run build:js && bun run build:exe",
|
|
6065
|
+
prepublishOnly: "bun run build:js"
|
|
6066
|
+
},
|
|
6067
|
+
keywords: [
|
|
6068
|
+
"ai",
|
|
6069
|
+
"coding-agent",
|
|
6070
|
+
"codex",
|
|
6071
|
+
"claude-code",
|
|
6072
|
+
"cli",
|
|
6073
|
+
"agentic",
|
|
6074
|
+
"sub-agents",
|
|
6075
|
+
"mcp",
|
|
6076
|
+
"worktree"
|
|
6077
|
+
],
|
|
6078
|
+
author: "Mesosfer",
|
|
6079
|
+
license: "MIT",
|
|
6080
|
+
devDependencies: {
|
|
6081
|
+
"@types/bun": "latest",
|
|
6082
|
+
"@types/node": "^22.0.0",
|
|
6083
|
+
"@types/react": "^19.2.18",
|
|
6084
|
+
react: "^19.2.8",
|
|
6085
|
+
typescript: "^5.7.0"
|
|
6086
|
+
}
|
|
6087
|
+
};
|
|
6033
6088
|
|
|
6034
6089
|
// src/cli/version.ts
|
|
6035
|
-
import { existsSync as existsSync17, readFileSync as readFileSync12 } from "fs";
|
|
6036
|
-
import { dirname as dirname8, join as join8, resolve as resolve17 } from "path";
|
|
6037
|
-
import { fileURLToPath } from "url";
|
|
6038
|
-
var __dirname = "/home/runner/work/agent-cli/agent-cli/src/cli";
|
|
6039
6090
|
var cachedMetadata = null;
|
|
6040
6091
|
function getPackageMetadata() {
|
|
6041
6092
|
if (cachedMetadata) {
|
|
@@ -6043,59 +6094,13 @@ function getPackageMetadata() {
|
|
|
6043
6094
|
}
|
|
6044
6095
|
const envVersion = process.env.PIKAA_VERSION || process.env.GROUPY_VERSION;
|
|
6045
6096
|
const envName = process.env.PIKAA_NAME || process.env.GROUPY_NAME;
|
|
6046
|
-
|
|
6047
|
-
|
|
6048
|
-
|
|
6049
|
-
version: envVersion
|
|
6050
|
-
};
|
|
6051
|
-
return cachedMetadata;
|
|
6052
|
-
}
|
|
6053
|
-
const searchDirs = [];
|
|
6054
|
-
try {
|
|
6055
|
-
const currentDir = typeof __dirname !== "undefined" ? __dirname : dirname8(fileURLToPath(import.meta.url));
|
|
6056
|
-
searchDirs.push(currentDir);
|
|
6057
|
-
} catch {}
|
|
6058
|
-
for (const startDir of searchDirs) {
|
|
6059
|
-
let current = resolve17(startDir);
|
|
6060
|
-
for (let depth = 0;depth < 5; depth++) {
|
|
6061
|
-
const candidate = join8(current, "package.json");
|
|
6062
|
-
if (existsSync17(candidate)) {
|
|
6063
|
-
try {
|
|
6064
|
-
const content = JSON.parse(readFileSync12(candidate, "utf8"));
|
|
6065
|
-
if (content && typeof content.version === "string" && (content.name === "@pikaa-ai/pikaa" || content.name === "pikaa" || content.bin?.pikaa || content.bin?.groupy)) {
|
|
6066
|
-
const cleanName = content.name?.startsWith("@") ? content.name.split("/")[1] || content.name : content.name || "pikaa";
|
|
6067
|
-
cachedMetadata = {
|
|
6068
|
-
name: cleanName,
|
|
6069
|
-
version: content.version,
|
|
6070
|
-
description: content.description
|
|
6071
|
-
};
|
|
6072
|
-
return cachedMetadata;
|
|
6073
|
-
}
|
|
6074
|
-
} catch {}
|
|
6075
|
-
}
|
|
6076
|
-
const parent = dirname8(current);
|
|
6077
|
-
if (parent === current)
|
|
6078
|
-
break;
|
|
6079
|
-
current = parent;
|
|
6080
|
-
}
|
|
6081
|
-
}
|
|
6082
|
-
try {
|
|
6083
|
-
const cwdCandidate = join8(process.cwd(), "package.json");
|
|
6084
|
-
if (existsSync17(cwdCandidate)) {
|
|
6085
|
-
const content = JSON.parse(readFileSync12(cwdCandidate, "utf8"));
|
|
6086
|
-
if (content && typeof content.version === "string" && (content.name === "@pikaa-ai/pikaa" || content.name === "pikaa" || content.bin?.pikaa || content.bin?.groupy)) {
|
|
6087
|
-
cachedMetadata = {
|
|
6088
|
-
name: "pikaa",
|
|
6089
|
-
version: content.version,
|
|
6090
|
-
description: content.description
|
|
6091
|
-
};
|
|
6092
|
-
return cachedMetadata;
|
|
6093
|
-
}
|
|
6094
|
-
}
|
|
6095
|
-
} catch {}
|
|
6097
|
+
const rawName = package_default?.name || "pikaa";
|
|
6098
|
+
const cleanName = rawName.startsWith("@") ? rawName.split("/")[1] || rawName : rawName;
|
|
6099
|
+
const autoVersion = package_default && typeof package_default.version === "string" ? package_default.version : "0.0.0";
|
|
6096
6100
|
cachedMetadata = {
|
|
6097
|
-
name:
|
|
6098
|
-
version:
|
|
6101
|
+
name: envName || cleanName,
|
|
6102
|
+
version: envVersion || autoVersion,
|
|
6103
|
+
description: package_default?.description
|
|
6099
6104
|
};
|
|
6100
6105
|
return cachedMetadata;
|
|
6101
6106
|
}
|
|
@@ -6650,16 +6655,16 @@ class InteractiveLineEditor {
|
|
|
6650
6655
|
}
|
|
6651
6656
|
async readLine() {
|
|
6652
6657
|
if (!process.stdin.isTTY) {
|
|
6653
|
-
return new Promise((
|
|
6658
|
+
return new Promise((resolve17) => {
|
|
6654
6659
|
const rl = readline.createInterface({ input: process.stdin, output: process.stdout });
|
|
6655
6660
|
rl.question(this.promptSymbol, (answer) => {
|
|
6656
6661
|
rl.close();
|
|
6657
|
-
|
|
6662
|
+
resolve17(answer);
|
|
6658
6663
|
});
|
|
6659
6664
|
});
|
|
6660
6665
|
}
|
|
6661
6666
|
ensureKeypressInitialized();
|
|
6662
|
-
return new Promise((
|
|
6667
|
+
return new Promise((resolve17) => {
|
|
6663
6668
|
let buffer = "";
|
|
6664
6669
|
let cursor = 0;
|
|
6665
6670
|
let selectedIndex = 0;
|
|
@@ -6856,7 +6861,7 @@ class InteractiveLineEditor {
|
|
|
6856
6861
|
process.stdout.write(`\x1B[1A\r\x1B[2K
|
|
6857
6862
|
`);
|
|
6858
6863
|
}
|
|
6859
|
-
|
|
6864
|
+
resolve17(result);
|
|
6860
6865
|
};
|
|
6861
6866
|
const onKeypress = (_str, key) => {
|
|
6862
6867
|
if (!key)
|
|
@@ -7040,7 +7045,7 @@ async function promptChoice(config) {
|
|
|
7040
7045
|
if (!process.stdin.readable) {
|
|
7041
7046
|
return choices[defaultIndex]?.value ?? choices[0].value;
|
|
7042
7047
|
}
|
|
7043
|
-
return new Promise((
|
|
7048
|
+
return new Promise((resolve17) => {
|
|
7044
7049
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
7045
7050
|
const hint = choices.map((c3) => c3.isDefault ? `[${c3.key.toUpperCase()}]` : `[${c3.key}]`).join("/");
|
|
7046
7051
|
let resolved = false;
|
|
@@ -7048,7 +7053,7 @@ async function promptChoice(config) {
|
|
|
7048
7053
|
if (!resolved) {
|
|
7049
7054
|
resolved = true;
|
|
7050
7055
|
rl.close();
|
|
7051
|
-
|
|
7056
|
+
resolve17(val);
|
|
7052
7057
|
}
|
|
7053
7058
|
};
|
|
7054
7059
|
rl.question(`${message} ${hint}: `, (answer) => {
|
|
@@ -7061,7 +7066,7 @@ async function promptChoice(config) {
|
|
|
7061
7066
|
});
|
|
7062
7067
|
});
|
|
7063
7068
|
}
|
|
7064
|
-
return new Promise((
|
|
7069
|
+
return new Promise((resolve17) => {
|
|
7065
7070
|
let selectedIndex = defaultIndex;
|
|
7066
7071
|
if (selectedIndex < 0 || selectedIndex >= choices.length)
|
|
7067
7072
|
selectedIndex = 0;
|
|
@@ -7090,7 +7095,7 @@ async function promptChoice(config) {
|
|
|
7090
7095
|
} catch {}
|
|
7091
7096
|
process.stdout.write(`\r\x1B[1A\r\x1B[2K ${style.bold(message)} ${style.cyan(`[${confirmedChoice.key}] ${confirmedChoice.label}`)}
|
|
7092
7097
|
\r\x1B[2K`);
|
|
7093
|
-
|
|
7098
|
+
resolve17(confirmedChoice.value);
|
|
7094
7099
|
};
|
|
7095
7100
|
const onKeypress = (_str, key) => {
|
|
7096
7101
|
if (!key)
|
|
@@ -7165,7 +7170,7 @@ async function promptToolApproval(params) {
|
|
|
7165
7170
|
renderCard(1);
|
|
7166
7171
|
return "yes";
|
|
7167
7172
|
}
|
|
7168
|
-
return new Promise((
|
|
7173
|
+
return new Promise((resolve17) => {
|
|
7169
7174
|
let selectedIndex = 1;
|
|
7170
7175
|
readline2.emitKeypressEvents(process.stdin);
|
|
7171
7176
|
const wasRaw = process.stdin.isRaw;
|
|
@@ -7182,7 +7187,7 @@ async function promptToolApproval(params) {
|
|
|
7182
7187
|
process.stdin.setRawMode(wasRaw ?? false);
|
|
7183
7188
|
} catch {}
|
|
7184
7189
|
console.log();
|
|
7185
|
-
|
|
7190
|
+
resolve17(val);
|
|
7186
7191
|
};
|
|
7187
7192
|
const onKeypress = (_str, key) => {
|
|
7188
7193
|
if (!key)
|
|
@@ -7265,7 +7270,7 @@ async function promptUserQuestion(params) {
|
|
|
7265
7270
|
if (!process.stdin.isTTY || false || !process.stdin.readable) {
|
|
7266
7271
|
return options[0] || "yes";
|
|
7267
7272
|
}
|
|
7268
|
-
return new Promise((
|
|
7273
|
+
return new Promise((resolve17) => {
|
|
7269
7274
|
const rl = readline2.createInterface({ input: process.stdin, output: process.stdout });
|
|
7270
7275
|
const promptLabel = options.length > 0 ? `Select [1-${options.length}] or type custom response: ` : `Your response: `;
|
|
7271
7276
|
rl.question(` ${style.bold(promptLabel)}`, (answer) => {
|
|
@@ -7275,7 +7280,7 @@ async function promptUserQuestion(params) {
|
|
|
7275
7280
|
const fallback = options[0] || "";
|
|
7276
7281
|
console.log(style.dim(` \u21B3 Default: ${fallback || "(empty)"}
|
|
7277
7282
|
`));
|
|
7278
|
-
|
|
7283
|
+
resolve17(fallback);
|
|
7279
7284
|
return;
|
|
7280
7285
|
}
|
|
7281
7286
|
const num = parseInt(trimmed, 10);
|
|
@@ -7283,26 +7288,26 @@ async function promptUserQuestion(params) {
|
|
|
7283
7288
|
const picked = options[num - 1];
|
|
7284
7289
|
console.log(style.green(` \u2714 Selected: ${picked}
|
|
7285
7290
|
`));
|
|
7286
|
-
|
|
7291
|
+
resolve17(picked);
|
|
7287
7292
|
return;
|
|
7288
7293
|
}
|
|
7289
7294
|
if (options.length === 2) {
|
|
7290
7295
|
if (/^(y|yes)$/i.test(trimmed)) {
|
|
7291
7296
|
console.log(style.green(` \u2714 Selected: ${options[0]}
|
|
7292
7297
|
`));
|
|
7293
|
-
|
|
7298
|
+
resolve17(options[0]);
|
|
7294
7299
|
return;
|
|
7295
7300
|
}
|
|
7296
7301
|
if (/^(n|no)$/i.test(trimmed)) {
|
|
7297
7302
|
console.log(style.green(` \u2714 Selected: ${options[1]}
|
|
7298
7303
|
`));
|
|
7299
|
-
|
|
7304
|
+
resolve17(options[1]);
|
|
7300
7305
|
return;
|
|
7301
7306
|
}
|
|
7302
7307
|
}
|
|
7303
7308
|
console.log(style.green(` \u2714 Answer: ${trimmed}
|
|
7304
7309
|
`));
|
|
7305
|
-
|
|
7310
|
+
resolve17(trimmed);
|
|
7306
7311
|
});
|
|
7307
7312
|
});
|
|
7308
7313
|
}
|
|
@@ -7331,7 +7336,7 @@ async function promptInteractiveList(config) {
|
|
|
7331
7336
|
`);
|
|
7332
7337
|
return { selectedIndex: -1, action: "close" };
|
|
7333
7338
|
}
|
|
7334
|
-
return new Promise((
|
|
7339
|
+
return new Promise((resolve17) => {
|
|
7335
7340
|
let selectedIndex = Math.max(0, Math.min(defaultIndex, items.length - 1));
|
|
7336
7341
|
let scrollTop = 0;
|
|
7337
7342
|
let renderedLines = 0;
|
|
@@ -7423,7 +7428,7 @@ async function promptInteractiveList(config) {
|
|
|
7423
7428
|
try {
|
|
7424
7429
|
process.stdin.setRawMode(wasRaw ?? false);
|
|
7425
7430
|
} catch {}
|
|
7426
|
-
|
|
7431
|
+
resolve17(res);
|
|
7427
7432
|
};
|
|
7428
7433
|
const onKeypress = async (_str, key) => {
|
|
7429
7434
|
if (!key)
|
|
@@ -7494,8 +7499,8 @@ async function promptInteractiveList(config) {
|
|
|
7494
7499
|
}
|
|
7495
7500
|
|
|
7496
7501
|
// src/security/scanner.ts
|
|
7497
|
-
import { existsSync as
|
|
7498
|
-
import { join as
|
|
7502
|
+
import { existsSync as existsSync17, readdirSync as readdirSync5, readFileSync as readFileSync12, statSync as statSync3 } from "fs";
|
|
7503
|
+
import { join as join8, relative as relative2, resolve as resolve17 } from "path";
|
|
7499
7504
|
var SECURITY_RULES = [
|
|
7500
7505
|
{
|
|
7501
7506
|
id: "SEC-001",
|
|
@@ -7627,13 +7632,13 @@ var IGNORED_FILES = new Set([
|
|
|
7627
7632
|
]);
|
|
7628
7633
|
async function runSecurityScan(targetDir, options = {}) {
|
|
7629
7634
|
const startTime = performance.now();
|
|
7630
|
-
const root =
|
|
7635
|
+
const root = resolve17(targetDir);
|
|
7631
7636
|
const isDirectTestDir = targetDir.includes("test") || Boolean(options.includeTests);
|
|
7632
7637
|
const maxFiles = options.maxFiles || 2000;
|
|
7633
7638
|
const findings = [];
|
|
7634
7639
|
let scannedCount = 0;
|
|
7635
7640
|
function walk(current) {
|
|
7636
|
-
if (scannedCount >= maxFiles || !
|
|
7641
|
+
if (scannedCount >= maxFiles || !existsSync17(current))
|
|
7637
7642
|
return;
|
|
7638
7643
|
let entries;
|
|
7639
7644
|
try {
|
|
@@ -7644,7 +7649,7 @@ async function runSecurityScan(targetDir, options = {}) {
|
|
|
7644
7649
|
for (const entry of entries) {
|
|
7645
7650
|
if (scannedCount >= maxFiles)
|
|
7646
7651
|
break;
|
|
7647
|
-
const fullPath =
|
|
7652
|
+
const fullPath = join8(current, entry);
|
|
7648
7653
|
let stat;
|
|
7649
7654
|
try {
|
|
7650
7655
|
stat = statSync3(fullPath);
|
|
@@ -7675,7 +7680,7 @@ async function runSecurityScan(targetDir, options = {}) {
|
|
|
7675
7680
|
function scanFile(filePath, baseRoot, ext, out) {
|
|
7676
7681
|
let content;
|
|
7677
7682
|
try {
|
|
7678
|
-
content =
|
|
7683
|
+
content = readFileSync12(filePath, "utf8");
|
|
7679
7684
|
} catch {
|
|
7680
7685
|
return;
|
|
7681
7686
|
}
|
|
@@ -7722,34 +7727,34 @@ async function runSecurityScan(targetDir, options = {}) {
|
|
|
7722
7727
|
}
|
|
7723
7728
|
|
|
7724
7729
|
// src/mcp/servers/chrome-devtools/index.ts
|
|
7725
|
-
import { resolve as
|
|
7730
|
+
import { resolve as resolve18 } from "path";
|
|
7726
7731
|
|
|
7727
7732
|
// src/mcp/servers/chrome-devtools/server.ts
|
|
7728
7733
|
if (false) {}
|
|
7729
7734
|
|
|
7730
7735
|
// src/mcp/servers/chrome-devtools/index.ts
|
|
7731
7736
|
var __dirname = "/home/runner/work/agent-cli/agent-cli/src/mcp/servers/chrome-devtools";
|
|
7732
|
-
var CHROME_DEVTOOLS_MCP_SERVER_PATH =
|
|
7737
|
+
var CHROME_DEVTOOLS_MCP_SERVER_PATH = resolve18(__dirname, "server.ts");
|
|
7733
7738
|
|
|
7734
7739
|
// src/mcp/servers/web-search/index.ts
|
|
7735
|
-
import { resolve as
|
|
7740
|
+
import { resolve as resolve19 } from "path";
|
|
7736
7741
|
|
|
7737
7742
|
// src/mcp/servers/web-search/server.ts
|
|
7738
7743
|
if (false) {}
|
|
7739
7744
|
|
|
7740
7745
|
// src/mcp/servers/web-search/index.ts
|
|
7741
7746
|
var __dirname = "/home/runner/work/agent-cli/agent-cli/src/mcp/servers/web-search";
|
|
7742
|
-
var WEB_SEARCH_MCP_SERVER_PATH =
|
|
7747
|
+
var WEB_SEARCH_MCP_SERVER_PATH = resolve19(__dirname, "server.ts");
|
|
7743
7748
|
|
|
7744
7749
|
// src/mcp/servers/sqlite/index.ts
|
|
7745
|
-
import { resolve as
|
|
7750
|
+
import { resolve as resolve20 } from "path";
|
|
7746
7751
|
|
|
7747
7752
|
// src/mcp/servers/sqlite/server.ts
|
|
7748
7753
|
if (false) {}
|
|
7749
7754
|
|
|
7750
7755
|
// src/mcp/servers/sqlite/index.ts
|
|
7751
7756
|
var __dirname = "/home/runner/work/agent-cli/agent-cli/src/mcp/servers/sqlite";
|
|
7752
|
-
var SQLITE_MCP_SERVER_PATH =
|
|
7757
|
+
var SQLITE_MCP_SERVER_PATH = resolve20(__dirname, "server.ts");
|
|
7753
7758
|
|
|
7754
7759
|
// src/cli/commands.ts
|
|
7755
7760
|
var AVAILABLE_SLASH_COMMANDS = [
|
|
@@ -9111,9 +9116,9 @@ class MarkdownHighlighter {
|
|
|
9111
9116
|
}
|
|
9112
9117
|
|
|
9113
9118
|
// src/cli/update-checker.ts
|
|
9114
|
-
import { existsSync as
|
|
9119
|
+
import { existsSync as existsSync18, mkdirSync as mkdirSync10, readFileSync as readFileSync13, writeFileSync as writeFileSync7 } from "fs";
|
|
9115
9120
|
import { homedir as homedir9 } from "os";
|
|
9116
|
-
import { join as
|
|
9121
|
+
import { join as join9 } from "path";
|
|
9117
9122
|
var CHECK_INTERVAL_MS = 12 * 60 * 60 * 1000;
|
|
9118
9123
|
function parseSemver(v) {
|
|
9119
9124
|
const clean = v.replace(/^v/, "").trim();
|
|
@@ -9134,8 +9139,8 @@ function isNewerVersion(current, remote) {
|
|
|
9134
9139
|
return remPatch > curPatch;
|
|
9135
9140
|
}
|
|
9136
9141
|
function getUpdateCachePath() {
|
|
9137
|
-
const baseDir = process.env.PIKAA_HOME || process.env.GROUPY_HOME ||
|
|
9138
|
-
return
|
|
9142
|
+
const baseDir = process.env.PIKAA_HOME || process.env.GROUPY_HOME || join9(homedir9(), ".pikaa");
|
|
9143
|
+
return join9(baseDir, "update-cache.json");
|
|
9139
9144
|
}
|
|
9140
9145
|
async function fetchLatestNpmVersion(packageName, timeoutMs = 1500) {
|
|
9141
9146
|
const url = `https://registry.npmjs.org/${encodeURIComponent(packageName)}/latest`;
|
|
@@ -9168,9 +9173,9 @@ async function checkForUpdates(options = {}) {
|
|
|
9168
9173
|
const cachePath = options.cachePath || getUpdateCachePath();
|
|
9169
9174
|
const now = Date.now();
|
|
9170
9175
|
let cached = null;
|
|
9171
|
-
if (!options.force &&
|
|
9176
|
+
if (!options.force && existsSync18(cachePath)) {
|
|
9172
9177
|
try {
|
|
9173
|
-
const raw = JSON.parse(
|
|
9178
|
+
const raw = JSON.parse(readFileSync13(cachePath, "utf8"));
|
|
9174
9179
|
if (raw && typeof raw.lastChecked === "number" && typeof raw.latestVersion === "string") {
|
|
9175
9180
|
cached = raw;
|
|
9176
9181
|
if (now - cached.lastChecked < CHECK_INTERVAL_MS) {
|
|
@@ -9198,8 +9203,8 @@ async function checkForUpdates(options = {}) {
|
|
|
9198
9203
|
return null;
|
|
9199
9204
|
}
|
|
9200
9205
|
try {
|
|
9201
|
-
const parentDir =
|
|
9202
|
-
if (!
|
|
9206
|
+
const parentDir = join9(cachePath, "..");
|
|
9207
|
+
if (!existsSync18(parentDir)) {
|
|
9203
9208
|
mkdirSync10(parentDir, { recursive: true });
|
|
9204
9209
|
}
|
|
9205
9210
|
const cacheData = {
|
|
@@ -9372,9 +9377,9 @@ class CliRepl {
|
|
|
9372
9377
|
filesModified: Array.from(this.turnFilesModified)
|
|
9373
9378
|
});
|
|
9374
9379
|
if (this.turnDoneResolver) {
|
|
9375
|
-
const
|
|
9380
|
+
const resolve21 = this.turnDoneResolver;
|
|
9376
9381
|
this.turnDoneResolver = undefined;
|
|
9377
|
-
|
|
9382
|
+
resolve21();
|
|
9378
9383
|
}
|
|
9379
9384
|
break;
|
|
9380
9385
|
case "Error":
|
|
@@ -9390,9 +9395,9 @@ class CliRepl {
|
|
|
9390
9395
|
console.error(style.red(`Error: ${msg.message}
|
|
9391
9396
|
`));
|
|
9392
9397
|
if (this.turnDoneResolver) {
|
|
9393
|
-
const
|
|
9398
|
+
const resolve21 = this.turnDoneResolver;
|
|
9394
9399
|
this.turnDoneResolver = undefined;
|
|
9395
|
-
|
|
9400
|
+
resolve21();
|
|
9396
9401
|
}
|
|
9397
9402
|
break;
|
|
9398
9403
|
}
|
|
@@ -9462,9 +9467,9 @@ class CliRepl {
|
|
|
9462
9467
|
`));
|
|
9463
9468
|
this.isProcessing = false;
|
|
9464
9469
|
if (this.turnDoneResolver) {
|
|
9465
|
-
const
|
|
9470
|
+
const resolve21 = this.turnDoneResolver;
|
|
9466
9471
|
this.turnDoneResolver = undefined;
|
|
9467
|
-
|
|
9472
|
+
resolve21();
|
|
9468
9473
|
}
|
|
9469
9474
|
}
|
|
9470
9475
|
}
|
|
@@ -9496,8 +9501,8 @@ class CliRepl {
|
|
|
9496
9501
|
}
|
|
9497
9502
|
}
|
|
9498
9503
|
try {
|
|
9499
|
-
const turnPromise = new Promise((
|
|
9500
|
-
this.turnDoneResolver =
|
|
9504
|
+
const turnPromise = new Promise((resolve21) => {
|
|
9505
|
+
this.turnDoneResolver = resolve21;
|
|
9501
9506
|
});
|
|
9502
9507
|
await this.session.submit({
|
|
9503
9508
|
type: "TurnInput",
|
|
@@ -9585,7 +9590,7 @@ async function main() {
|
|
|
9585
9590
|
explicitApiKey = args[++i];
|
|
9586
9591
|
apiKey = explicitApiKey || apiKey;
|
|
9587
9592
|
} else if (arg === "--cwd" || arg === "-C") {
|
|
9588
|
-
cwd =
|
|
9593
|
+
cwd = resolve21(args[++i] || cwd);
|
|
9589
9594
|
} else if (arg === "--role" || arg === "-r") {
|
|
9590
9595
|
role = args[++i] || role;
|
|
9591
9596
|
} else if (arg === "--mcp") {
|
|
@@ -9611,11 +9616,11 @@ async function main() {
|
|
|
9611
9616
|
const mcpManager = new McpManager;
|
|
9612
9617
|
const candidateConfigs = [
|
|
9613
9618
|
mcpConfigFile,
|
|
9614
|
-
|
|
9615
|
-
|
|
9619
|
+
resolve21(cwd, ".mcp.json"),
|
|
9620
|
+
resolve21(cwd, "mcp_config.json")
|
|
9616
9621
|
].filter(Boolean);
|
|
9617
9622
|
for (const cfg of candidateConfigs) {
|
|
9618
|
-
if (
|
|
9623
|
+
if (existsSync19(cfg)) {
|
|
9619
9624
|
try {
|
|
9620
9625
|
await mcpManager.loadConfigFile(cfg);
|
|
9621
9626
|
mcpManager.registerToolsIntoRouter(tools4);
|