@mariozechner/pi-coding-agent 0.57.1 → 0.58.1
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/CHANGELOG.md +64 -0
- package/README.md +10 -6
- package/dist/cli/args.d.ts.map +1 -1
- package/dist/cli/args.js +7 -6
- package/dist/cli/args.js.map +1 -1
- package/dist/core/agent-session.d.ts +9 -0
- package/dist/core/agent-session.d.ts.map +1 -1
- package/dist/core/agent-session.js +57 -9
- package/dist/core/agent-session.js.map +1 -1
- package/dist/core/extensions/index.d.ts +1 -1
- package/dist/core/extensions/index.d.ts.map +1 -1
- package/dist/core/extensions/index.js +1 -1
- package/dist/core/extensions/index.js.map +1 -1
- package/dist/core/extensions/wrapper.d.ts +4 -11
- package/dist/core/extensions/wrapper.d.ts.map +1 -1
- package/dist/core/extensions/wrapper.js +4 -78
- package/dist/core/extensions/wrapper.js.map +1 -1
- package/dist/core/index.d.ts +1 -1
- package/dist/core/index.d.ts.map +1 -1
- package/dist/core/index.js +1 -1
- package/dist/core/index.js.map +1 -1
- package/dist/core/model-registry.d.ts.map +1 -1
- package/dist/core/model-registry.js +26 -9
- package/dist/core/model-registry.js.map +1 -1
- package/dist/core/package-manager.d.ts +4 -0
- package/dist/core/package-manager.d.ts.map +1 -1
- package/dist/core/package-manager.js +60 -27
- package/dist/core/package-manager.js.map +1 -1
- package/dist/core/resolve-config-value.d.ts.map +1 -1
- package/dist/core/resolve-config-value.js +43 -8
- package/dist/core/resolve-config-value.js.map +1 -1
- package/dist/core/session-manager.d.ts +1 -0
- package/dist/core/session-manager.d.ts.map +1 -1
- package/dist/core/session-manager.js +1 -1
- package/dist/core/session-manager.js.map +1 -1
- package/dist/core/settings-manager.d.ts +3 -0
- package/dist/core/settings-manager.d.ts.map +1 -1
- package/dist/core/settings-manager.js +8 -0
- package/dist/core/settings-manager.js.map +1 -1
- package/dist/core/skills.d.ts +3 -2
- package/dist/core/skills.d.ts.map +1 -1
- package/dist/core/skills.js +29 -8
- package/dist/core/skills.js.map +1 -1
- package/dist/core/system-prompt.d.ts.map +1 -1
- package/dist/core/system-prompt.js +8 -17
- package/dist/core/system-prompt.js.map +1 -1
- package/dist/core/tools/find.d.ts.map +1 -1
- package/dist/core/tools/find.js +6 -3
- package/dist/core/tools/find.js.map +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +12 -3
- package/dist/main.js.map +1 -1
- package/dist/modes/interactive/interactive-mode.d.ts.map +1 -1
- package/dist/modes/interactive/interactive-mode.js +4 -4
- package/dist/modes/interactive/interactive-mode.js.map +1 -1
- package/dist/utils/clipboard-image.d.ts.map +1 -1
- package/dist/utils/clipboard-image.js +94 -11
- package/dist/utils/clipboard-image.js.map +1 -1
- package/dist/utils/clipboard.d.ts.map +1 -1
- package/dist/utils/clipboard.js +16 -15
- package/dist/utils/clipboard.js.map +1 -1
- package/dist/utils/exif-orientation.d.ts +5 -0
- package/dist/utils/exif-orientation.d.ts.map +1 -0
- package/dist/utils/exif-orientation.js +158 -0
- package/dist/utils/exif-orientation.js.map +1 -0
- package/dist/utils/image-convert.d.ts.map +1 -1
- package/dist/utils/image-convert.js +5 -1
- package/dist/utils/image-convert.js.map +1 -1
- package/dist/utils/image-resize.d.ts.map +1 -1
- package/dist/utils/image-resize.js +6 -1
- package/dist/utils/image-resize.js.map +1 -1
- package/dist/utils/tools-manager.d.ts.map +1 -1
- package/dist/utils/tools-manager.js +5 -4
- package/dist/utils/tools-manager.js.map +1 -1
- package/docs/custom-provider.md +6 -2
- package/docs/extensions.md +16 -5
- package/docs/models.md +13 -1
- package/docs/packages.md +9 -0
- package/docs/settings.md +9 -0
- package/docs/terminal-setup.md +10 -2
- package/examples/extensions/antigravity-image-gen.ts +5 -4
- package/examples/extensions/custom-provider-anthropic/package-lock.json +2 -2
- package/examples/extensions/custom-provider-anthropic/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/package.json +1 -1
- package/examples/extensions/custom-provider-gitlab-duo/test.ts +2 -2
- package/examples/extensions/custom-provider-qwen-cli/package.json +1 -1
- package/examples/extensions/preset.ts +2 -3
- package/examples/extensions/sandbox/index.ts +2 -3
- package/examples/extensions/tool-override.ts +2 -3
- package/examples/extensions/with-deps/package-lock.json +2 -2
- package/examples/extensions/with-deps/package.json +1 -1
- package/package.json +4 -4
|
@@ -25,6 +25,9 @@ const IGNORE_FILE_NAMES = [".gitignore", ".ignore", ".fdignore"];
|
|
|
25
25
|
function toPosixPath(p) {
|
|
26
26
|
return p.split(sep).join("/");
|
|
27
27
|
}
|
|
28
|
+
function getHomeDir() {
|
|
29
|
+
return process.env.HOME || homedir();
|
|
30
|
+
}
|
|
28
31
|
function prefixIgnorePattern(line, prefix) {
|
|
29
32
|
const trimmed = line.trim();
|
|
30
33
|
if (!trimmed)
|
|
@@ -383,43 +386,50 @@ function collectResourceFiles(dir, resourceType) {
|
|
|
383
386
|
return collectFiles(dir, FILE_PATTERNS[resourceType]);
|
|
384
387
|
}
|
|
385
388
|
function matchesAnyPattern(filePath, patterns, baseDir) {
|
|
386
|
-
const rel = relative(baseDir, filePath);
|
|
389
|
+
const rel = toPosixPath(relative(baseDir, filePath));
|
|
387
390
|
const name = basename(filePath);
|
|
391
|
+
const filePathPosix = toPosixPath(filePath);
|
|
388
392
|
const isSkillFile = name === "SKILL.md";
|
|
389
393
|
const parentDir = isSkillFile ? dirname(filePath) : undefined;
|
|
390
|
-
const parentRel = isSkillFile ? relative(baseDir, parentDir) : undefined;
|
|
394
|
+
const parentRel = isSkillFile ? toPosixPath(relative(baseDir, parentDir)) : undefined;
|
|
391
395
|
const parentName = isSkillFile ? basename(parentDir) : undefined;
|
|
396
|
+
const parentDirPosix = isSkillFile ? toPosixPath(parentDir) : undefined;
|
|
392
397
|
return patterns.some((pattern) => {
|
|
393
|
-
|
|
398
|
+
const normalizedPattern = toPosixPath(pattern);
|
|
399
|
+
if (minimatch(rel, normalizedPattern) ||
|
|
400
|
+
minimatch(name, normalizedPattern) ||
|
|
401
|
+
minimatch(filePathPosix, normalizedPattern)) {
|
|
394
402
|
return true;
|
|
395
403
|
}
|
|
396
404
|
if (!isSkillFile)
|
|
397
405
|
return false;
|
|
398
|
-
return minimatch(parentRel,
|
|
406
|
+
return (minimatch(parentRel, normalizedPattern) ||
|
|
407
|
+
minimatch(parentName, normalizedPattern) ||
|
|
408
|
+
minimatch(parentDirPosix, normalizedPattern));
|
|
399
409
|
});
|
|
400
410
|
}
|
|
401
411
|
function normalizeExactPattern(pattern) {
|
|
402
|
-
|
|
403
|
-
|
|
404
|
-
}
|
|
405
|
-
return pattern;
|
|
412
|
+
const normalized = pattern.startsWith("./") || pattern.startsWith(".\\") ? pattern.slice(2) : pattern;
|
|
413
|
+
return toPosixPath(normalized);
|
|
406
414
|
}
|
|
407
415
|
function matchesAnyExactPattern(filePath, patterns, baseDir) {
|
|
408
416
|
if (patterns.length === 0)
|
|
409
417
|
return false;
|
|
410
|
-
const rel = relative(baseDir, filePath);
|
|
418
|
+
const rel = toPosixPath(relative(baseDir, filePath));
|
|
411
419
|
const name = basename(filePath);
|
|
420
|
+
const filePathPosix = toPosixPath(filePath);
|
|
412
421
|
const isSkillFile = name === "SKILL.md";
|
|
413
422
|
const parentDir = isSkillFile ? dirname(filePath) : undefined;
|
|
414
|
-
const parentRel = isSkillFile ? relative(baseDir, parentDir) : undefined;
|
|
423
|
+
const parentRel = isSkillFile ? toPosixPath(relative(baseDir, parentDir)) : undefined;
|
|
424
|
+
const parentDirPosix = isSkillFile ? toPosixPath(parentDir) : undefined;
|
|
415
425
|
return patterns.some((pattern) => {
|
|
416
426
|
const normalized = normalizeExactPattern(pattern);
|
|
417
|
-
if (normalized === rel || normalized ===
|
|
427
|
+
if (normalized === rel || normalized === filePathPosix) {
|
|
418
428
|
return true;
|
|
419
429
|
}
|
|
420
430
|
if (!isSkillFile)
|
|
421
431
|
return false;
|
|
422
|
-
return normalized === parentRel || normalized ===
|
|
432
|
+
return normalized === parentRel || normalized === parentDirPosix;
|
|
423
433
|
});
|
|
424
434
|
}
|
|
425
435
|
function getOverridePatterns(entries) {
|
|
@@ -500,6 +510,7 @@ export class DefaultPackageManager {
|
|
|
500
510
|
agentDir;
|
|
501
511
|
settingsManager;
|
|
502
512
|
globalNpmRoot;
|
|
513
|
+
globalNpmRootCommandKey;
|
|
503
514
|
progressCallback;
|
|
504
515
|
constructor(options) {
|
|
505
516
|
this.cwd = options.cwd;
|
|
@@ -953,25 +964,44 @@ export class DefaultPackageManager {
|
|
|
953
964
|
const version = match[2];
|
|
954
965
|
return { name, version };
|
|
955
966
|
}
|
|
967
|
+
getNpmCommand() {
|
|
968
|
+
const configuredCommand = this.settingsManager.getNpmCommand();
|
|
969
|
+
if (!configuredCommand || configuredCommand.length === 0) {
|
|
970
|
+
return { command: "npm", args: [] };
|
|
971
|
+
}
|
|
972
|
+
const [command, ...args] = configuredCommand;
|
|
973
|
+
if (!command) {
|
|
974
|
+
throw new Error("Invalid npmCommand: first array entry must be a non-empty command");
|
|
975
|
+
}
|
|
976
|
+
return { command, args };
|
|
977
|
+
}
|
|
978
|
+
async runNpmCommand(args, options) {
|
|
979
|
+
const npmCommand = this.getNpmCommand();
|
|
980
|
+
await this.runCommand(npmCommand.command, [...npmCommand.args, ...args], options);
|
|
981
|
+
}
|
|
982
|
+
runNpmCommandSync(args) {
|
|
983
|
+
const npmCommand = this.getNpmCommand();
|
|
984
|
+
return this.runCommandSync(npmCommand.command, [...npmCommand.args, ...args]);
|
|
985
|
+
}
|
|
956
986
|
async installNpm(source, scope, temporary) {
|
|
957
987
|
if (scope === "user" && !temporary) {
|
|
958
|
-
await this.
|
|
988
|
+
await this.runNpmCommand(["install", "-g", source.spec]);
|
|
959
989
|
return;
|
|
960
990
|
}
|
|
961
991
|
const installRoot = this.getNpmInstallRoot(scope, temporary);
|
|
962
992
|
this.ensureNpmProject(installRoot);
|
|
963
|
-
await this.
|
|
993
|
+
await this.runNpmCommand(["install", source.spec, "--prefix", installRoot]);
|
|
964
994
|
}
|
|
965
995
|
async uninstallNpm(source, scope) {
|
|
966
996
|
if (scope === "user") {
|
|
967
|
-
await this.
|
|
997
|
+
await this.runNpmCommand(["uninstall", "-g", source.name]);
|
|
968
998
|
return;
|
|
969
999
|
}
|
|
970
1000
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
971
1001
|
if (!existsSync(installRoot)) {
|
|
972
1002
|
return;
|
|
973
1003
|
}
|
|
974
|
-
await this.
|
|
1004
|
+
await this.runNpmCommand(["uninstall", source.name, "--prefix", installRoot]);
|
|
975
1005
|
}
|
|
976
1006
|
async installGit(source, scope) {
|
|
977
1007
|
const targetDir = this.getGitInstallPath(source, scope);
|
|
@@ -989,7 +1019,7 @@ export class DefaultPackageManager {
|
|
|
989
1019
|
}
|
|
990
1020
|
const packageJsonPath = join(targetDir, "package.json");
|
|
991
1021
|
if (existsSync(packageJsonPath)) {
|
|
992
|
-
await this.
|
|
1022
|
+
await this.runNpmCommand(["install"], { cwd: targetDir });
|
|
993
1023
|
}
|
|
994
1024
|
}
|
|
995
1025
|
async updateGit(source, scope) {
|
|
@@ -1012,7 +1042,7 @@ export class DefaultPackageManager {
|
|
|
1012
1042
|
await this.runCommand("git", ["clean", "-fdx"], { cwd: targetDir });
|
|
1013
1043
|
const packageJsonPath = join(targetDir, "package.json");
|
|
1014
1044
|
if (existsSync(packageJsonPath)) {
|
|
1015
|
-
await this.
|
|
1045
|
+
await this.runNpmCommand(["install"], { cwd: targetDir });
|
|
1016
1046
|
}
|
|
1017
1047
|
}
|
|
1018
1048
|
async refreshTemporaryGitSource(source, sourceStr) {
|
|
@@ -1088,11 +1118,14 @@ export class DefaultPackageManager {
|
|
|
1088
1118
|
return join(this.getGlobalNpmRoot(), "..");
|
|
1089
1119
|
}
|
|
1090
1120
|
getGlobalNpmRoot() {
|
|
1091
|
-
|
|
1121
|
+
const npmCommand = this.getNpmCommand();
|
|
1122
|
+
const commandKey = [npmCommand.command, ...npmCommand.args].join("\0");
|
|
1123
|
+
if (this.globalNpmRoot && this.globalNpmRootCommandKey === commandKey) {
|
|
1092
1124
|
return this.globalNpmRoot;
|
|
1093
1125
|
}
|
|
1094
|
-
const result = this.
|
|
1126
|
+
const result = this.runNpmCommandSync(["root", "-g"]);
|
|
1095
1127
|
this.globalNpmRoot = result.trim();
|
|
1128
|
+
this.globalNpmRootCommandKey = commandKey;
|
|
1096
1129
|
return this.globalNpmRoot;
|
|
1097
1130
|
}
|
|
1098
1131
|
getNpmInstallPath(source, scope) {
|
|
@@ -1141,21 +1174,21 @@ export class DefaultPackageManager {
|
|
|
1141
1174
|
resolvePath(input) {
|
|
1142
1175
|
const trimmed = input.trim();
|
|
1143
1176
|
if (trimmed === "~")
|
|
1144
|
-
return
|
|
1177
|
+
return getHomeDir();
|
|
1145
1178
|
if (trimmed.startsWith("~/"))
|
|
1146
|
-
return join(
|
|
1179
|
+
return join(getHomeDir(), trimmed.slice(2));
|
|
1147
1180
|
if (trimmed.startsWith("~"))
|
|
1148
|
-
return join(
|
|
1181
|
+
return join(getHomeDir(), trimmed.slice(1));
|
|
1149
1182
|
return resolve(this.cwd, trimmed);
|
|
1150
1183
|
}
|
|
1151
1184
|
resolvePathFromBase(input, baseDir) {
|
|
1152
1185
|
const trimmed = input.trim();
|
|
1153
1186
|
if (trimmed === "~")
|
|
1154
|
-
return
|
|
1187
|
+
return getHomeDir();
|
|
1155
1188
|
if (trimmed.startsWith("~/"))
|
|
1156
|
-
return join(
|
|
1189
|
+
return join(getHomeDir(), trimmed.slice(2));
|
|
1157
1190
|
if (trimmed.startsWith("~"))
|
|
1158
|
-
return join(
|
|
1191
|
+
return join(getHomeDir(), trimmed.slice(1));
|
|
1159
1192
|
return resolve(baseDir, trimmed);
|
|
1160
1193
|
}
|
|
1161
1194
|
collectPackageResources(packageRoot, accumulator, filter, metadata) {
|
|
@@ -1329,7 +1362,7 @@ export class DefaultPackageManager {
|
|
|
1329
1362
|
prompts: join(projectBaseDir, "prompts"),
|
|
1330
1363
|
themes: join(projectBaseDir, "themes"),
|
|
1331
1364
|
};
|
|
1332
|
-
const userAgentsSkillsDir = join(
|
|
1365
|
+
const userAgentsSkillsDir = join(getHomeDir(), ".agents", "skills");
|
|
1333
1366
|
const projectAgentsSkillDirs = collectAncestorAgentsSkillDirs(this.cwd).filter((dir) => resolve(dir) !== resolve(userAgentsSkillsDir));
|
|
1334
1367
|
const addResources = (resourceType, paths, metadata, overrides, baseDir) => {
|
|
1335
1368
|
const target = this.getTargetMap(accumulator, resourceType);
|