@cmetech/otto 1.0.8 → 1.0.9
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/dist/cli-args.d.ts +2 -0
- package/dist/cli-args.js +6 -0
- package/dist/cli.js +27 -0
- package/dist/help-text.js +15 -0
- package/dist/onboarding.d.ts +19 -0
- package/dist/onboarding.js +133 -1
- package/dist/resources/.managed-resources-content-hash +1 -1
- package/dist/resources/extensions/otto/commands/release-notes/_data.js +155 -0
- package/dist/resources/extensions/otto/commands/release-notes/command.js +114 -0
- package/dist/resources/extensions/otto/extension-manifest.json +1 -1
- package/dist/resources/extensions/otto/index.js +3 -0
- package/dist/seed-defaults.d.ts +50 -0
- package/dist/seed-defaults.js +226 -0
- package/package.json +8 -7
- package/packages/contracts/package.json +1 -1
- package/packages/daemon/package.json +3 -3
- package/packages/mcp-server/package.json +3 -3
- package/packages/native/package.json +1 -1
- package/packages/pi-agent-core/package.json +1 -1
- package/packages/pi-ai/package.json +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/agent-session.js +3 -0
- package/packages/pi-coding-agent/dist/core/agent-session.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts +17 -0
- package/packages/pi-coding-agent/dist/core/extensions/runner.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js +89 -1
- package/packages/pi-coding-agent/dist/core/extensions/runner.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts +9 -0
- package/packages/pi-coding-agent/dist/core/package-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/package-manager.js +105 -67
- package/packages/pi-coding-agent/dist/core/package-manager.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/resolve-config-value.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js +20 -2
- package/packages/pi-coding-agent/dist/core/resolve-config-value.js.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts +25 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.d.ts.map +1 -1
- package/packages/pi-coding-agent/dist/core/settings-manager.js +41 -0
- package/packages/pi-coding-agent/dist/core/settings-manager.js.map +1 -1
- package/packages/pi-coding-agent/package.json +2 -2
- package/packages/pi-coding-agent/src/core/agent-session.ts +3 -0
- package/packages/pi-coding-agent/src/core/extensions/runner.ts +90 -1
- package/packages/pi-coding-agent/src/core/package-manager.ts +131 -64
- package/packages/pi-coding-agent/src/core/resolve-config-value.ts +20 -2
- package/packages/pi-coding-agent/src/core/settings-manager.ts +56 -0
- package/packages/pi-coding-agent/tsconfig.tsbuildinfo +1 -1
- package/packages/pi-tui/package.json +1 -1
- package/packages/rpc-client/package.json +2 -2
- package/pkg/package.json +1 -1
- package/src/resources/extensions/otto/commands/release-notes/_data.ts +171 -0
- package/src/resources/extensions/otto/commands/release-notes/command.ts +141 -0
- package/src/resources/extensions/otto/extension-manifest.json +1 -1
- package/src/resources/extensions/otto/index.ts +4 -0
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"package-manager.d.ts","sourceRoot":"","sources":["../../src/core/package-manager.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAiB,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAU5E,MAAM,WAAW,YAAY;IAC5B,MAAM,EAAE,MAAM,CAAC;IACf,KAAK,EAAE,WAAW,CAAC;IACnB,MAAM,EAAE,SAAS,GAAG,WAAW,CAAC;IAChC,OAAO,CAAC,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,gBAAgB;IAChC,IAAI,EAAE,MAAM,CAAC;IACb,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,YAAY,CAAC;CACvB;AAED,MAAM,WAAW,aAAa;IAC7B,UAAU,EAAE,gBAAgB,EAAE,CAAC;IAC/B,MAAM,EAAE,gBAAgB,EAAE,CAAC;IAC3B,OAAO,EAAE,g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B;IAsB/B,OAAO,CAAC,kBAAkB;IA0B1B;;;;OAIG;IACH,OAAO,CAAC,oBAAoB;IAsB5B,OAAO,CAAC,cAAc;IAiBtB,OAAO,CAAC,kBAAkB;IAoB1B,OAAO,CAAC,+BAA+B;IAMvC,OAAO,CAAC,mBAAmB;IAuB3B;;;;OAIG;IACH,OAAO,CAAC,uBAAuB;IAe/B,OAAO,CAAC,0BAA0B;IA4JlC,OAAO,CAAC,qBAAqB;IAmB7B,OAAO,CAAC,YAAY;IAkBpB,OAAO,CAAC,WAAW;IAYnB,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,eAAe;IAiBvB;;;;;;;OAOG;IACH,OAAO,CAAC,UAAU;IAqClB,OAAO,CAAC,cAAc;CAWtB"}
|
|
@@ -632,12 +632,13 @@ export class DefaultPackageManager {
|
|
|
632
632
|
const parsed = this.parseSource(source);
|
|
633
633
|
const scope = options?.local ? "project" : "user";
|
|
634
634
|
await this.withProgress("install", source, `Installing ${source}...`, async () => {
|
|
635
|
+
// Explicit user-initiated install — stream npm/git progress to the terminal.
|
|
635
636
|
if (parsed.type === "npm") {
|
|
636
|
-
await this.installNpm(parsed, scope, false);
|
|
637
|
+
await this.installNpm(parsed, scope, false, true);
|
|
637
638
|
return;
|
|
638
639
|
}
|
|
639
640
|
if (parsed.type === "git") {
|
|
640
|
-
await this.installGit(parsed, scope);
|
|
641
|
+
await this.installGit(parsed, scope, true);
|
|
641
642
|
return;
|
|
642
643
|
}
|
|
643
644
|
if (parsed.type === "local") {
|
|
@@ -655,7 +656,7 @@ export class DefaultPackageManager {
|
|
|
655
656
|
const scope = options?.local ? "project" : "user";
|
|
656
657
|
await this.withProgress("remove", source, `Removing ${source}...`, async () => {
|
|
657
658
|
if (parsed.type === "npm") {
|
|
658
|
-
await this.uninstallNpm(parsed, scope);
|
|
659
|
+
await this.uninstallNpm(parsed, scope, true);
|
|
659
660
|
return;
|
|
660
661
|
}
|
|
661
662
|
if (parsed.type === "git") {
|
|
@@ -693,8 +694,9 @@ export class DefaultPackageManager {
|
|
|
693
694
|
if (parsed.type === "npm") {
|
|
694
695
|
if (parsed.pinned)
|
|
695
696
|
return;
|
|
697
|
+
// Explicit `pi package update` — stream npm progress to terminal.
|
|
696
698
|
await this.withProgress("update", source, `Updating ${source}...`, async () => {
|
|
697
|
-
await this.installNpm(parsed, scope, false);
|
|
699
|
+
await this.installNpm(parsed, scope, false, true);
|
|
698
700
|
});
|
|
699
701
|
return;
|
|
700
702
|
}
|
|
@@ -702,7 +704,7 @@ export class DefaultPackageManager {
|
|
|
702
704
|
if (parsed.pinned)
|
|
703
705
|
return;
|
|
704
706
|
await this.withProgress("update", source, `Updating ${source}...`, async () => {
|
|
705
|
-
await this.updateGit(parsed, scope);
|
|
707
|
+
await this.updateGit(parsed, scope, true);
|
|
706
708
|
});
|
|
707
709
|
return;
|
|
708
710
|
}
|
|
@@ -710,55 +712,69 @@ export class DefaultPackageManager {
|
|
|
710
712
|
async resolvePackageSources(sources, accumulator, onMissing) {
|
|
711
713
|
for (const { pkg, scope } of sources) {
|
|
712
714
|
const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
|
|
713
|
-
|
|
714
|
-
|
|
715
|
-
const metadata = { source: sourceStr, scope, origin: "package" };
|
|
716
|
-
if (parsed.type === "local") {
|
|
717
|
-
const baseDir = this.getBaseDirForScope(scope);
|
|
718
|
-
this.resolveLocalExtensionSource(parsed, accumulator, filter, metadata, baseDir);
|
|
719
|
-
continue;
|
|
715
|
+
try {
|
|
716
|
+
await this.resolveOnePackageSource(pkg, scope, accumulator, onMissing);
|
|
720
717
|
}
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
|
|
732
|
-
|
|
733
|
-
|
|
718
|
+
catch (error) {
|
|
719
|
+
// One bad source (typo, 404, network glitch, unreachable git host)
|
|
720
|
+
// must not abort startup or block resolution of the remaining
|
|
721
|
+
// packages. Warn loudly so the user knows, then continue.
|
|
722
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
723
|
+
process.stderr.write(`[pi] Skipping package "${sourceStr}" — ${message}. ` +
|
|
724
|
+
`Run \`pi remove ${sourceStr}\` if you want to drop it permanently.\n`);
|
|
725
|
+
}
|
|
726
|
+
}
|
|
727
|
+
}
|
|
728
|
+
async resolveOnePackageSource(pkg, scope, accumulator, onMissing) {
|
|
729
|
+
const sourceStr = typeof pkg === "string" ? pkg : pkg.source;
|
|
730
|
+
const filter = typeof pkg === "object" ? pkg : undefined;
|
|
731
|
+
const parsed = this.parseSource(sourceStr);
|
|
732
|
+
const metadata = { source: sourceStr, scope, origin: "package" };
|
|
733
|
+
if (parsed.type === "local") {
|
|
734
|
+
const baseDir = this.getBaseDirForScope(scope);
|
|
735
|
+
this.resolveLocalExtensionSource(parsed, accumulator, filter, metadata, baseDir);
|
|
736
|
+
return;
|
|
737
|
+
}
|
|
738
|
+
const installMissing = async () => {
|
|
739
|
+
if (isOfflineModeEnabled()) {
|
|
740
|
+
return false;
|
|
741
|
+
}
|
|
742
|
+
if (!onMissing) {
|
|
734
743
|
await this.installParsedSource(parsed, scope);
|
|
735
744
|
return true;
|
|
736
|
-
};
|
|
737
|
-
if (parsed.type === "npm") {
|
|
738
|
-
const installedPath = this.getNpmInstallPath(parsed, scope);
|
|
739
|
-
const needsInstall = !existsSync(installedPath) || (await this.npmNeedsUpdate(parsed, installedPath));
|
|
740
|
-
if (needsInstall) {
|
|
741
|
-
const installed = await installMissing();
|
|
742
|
-
if (!installed)
|
|
743
|
-
continue;
|
|
744
|
-
}
|
|
745
|
-
metadata.baseDir = installedPath;
|
|
746
|
-
this.collectPackageResources(installedPath, accumulator, filter, metadata);
|
|
747
|
-
continue;
|
|
748
745
|
}
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
746
|
+
const action = await onMissing(sourceStr);
|
|
747
|
+
if (action === "skip")
|
|
748
|
+
return false;
|
|
749
|
+
if (action === "error")
|
|
750
|
+
throw new Error(`Missing source: ${sourceStr}`);
|
|
751
|
+
await this.installParsedSource(parsed, scope);
|
|
752
|
+
return true;
|
|
753
|
+
};
|
|
754
|
+
if (parsed.type === "npm") {
|
|
755
|
+
const installedPath = this.getNpmInstallPath(parsed, scope);
|
|
756
|
+
const needsInstall = !existsSync(installedPath) || (await this.npmNeedsUpdate(parsed, installedPath));
|
|
757
|
+
if (needsInstall) {
|
|
758
|
+
const installed = await installMissing();
|
|
759
|
+
if (!installed)
|
|
760
|
+
return;
|
|
761
761
|
}
|
|
762
|
+
metadata.baseDir = installedPath;
|
|
763
|
+
this.collectPackageResources(installedPath, accumulator, filter, metadata);
|
|
764
|
+
return;
|
|
765
|
+
}
|
|
766
|
+
if (parsed.type === "git") {
|
|
767
|
+
const installedPath = this.getGitInstallPath(parsed, scope);
|
|
768
|
+
if (!existsSync(installedPath)) {
|
|
769
|
+
const installed = await installMissing();
|
|
770
|
+
if (!installed)
|
|
771
|
+
return;
|
|
772
|
+
}
|
|
773
|
+
else if (scope === "temporary" && !parsed.pinned && !isOfflineModeEnabled()) {
|
|
774
|
+
await this.refreshTemporaryGitSource(parsed, sourceStr);
|
|
775
|
+
}
|
|
776
|
+
metadata.baseDir = installedPath;
|
|
777
|
+
this.collectPackageResources(installedPath, accumulator, filter, metadata);
|
|
762
778
|
}
|
|
763
779
|
}
|
|
764
780
|
resolveLocalExtensionSource(source, accumulator, filter, metadata, baseDir) {
|
|
@@ -963,19 +979,19 @@ export class DefaultPackageManager {
|
|
|
963
979
|
const version = match[2];
|
|
964
980
|
return { name, version };
|
|
965
981
|
}
|
|
966
|
-
async installNpm(source, scope, temporary) {
|
|
982
|
+
async installNpm(source, scope, temporary, interactive = false) {
|
|
967
983
|
const installRoot = this.getNpmInstallRoot(scope, temporary);
|
|
968
984
|
this.ensureNpmProject(installRoot);
|
|
969
|
-
await this.runCommand("npm", ["install", source.spec, "--prefix", installRoot]);
|
|
985
|
+
await this.runCommand("npm", ["install", source.spec, "--prefix", installRoot], { interactive });
|
|
970
986
|
}
|
|
971
|
-
async uninstallNpm(source, scope) {
|
|
987
|
+
async uninstallNpm(source, scope, interactive = false) {
|
|
972
988
|
const installRoot = this.getNpmInstallRoot(scope, false);
|
|
973
989
|
if (!existsSync(installRoot)) {
|
|
974
990
|
return;
|
|
975
991
|
}
|
|
976
|
-
await this.runCommand("npm", ["uninstall", source.name, "--prefix", installRoot]);
|
|
992
|
+
await this.runCommand("npm", ["uninstall", source.name, "--prefix", installRoot], { interactive });
|
|
977
993
|
}
|
|
978
|
-
async installGit(source, scope) {
|
|
994
|
+
async installGit(source, scope, interactive = false) {
|
|
979
995
|
const targetDir = this.getGitInstallPath(source, scope);
|
|
980
996
|
if (existsSync(targetDir)) {
|
|
981
997
|
return;
|
|
@@ -985,36 +1001,36 @@ export class DefaultPackageManager {
|
|
|
985
1001
|
this.ensureGitIgnore(gitRoot);
|
|
986
1002
|
}
|
|
987
1003
|
mkdirSync(dirname(targetDir), { recursive: true });
|
|
988
|
-
await this.runCommand("git", ["clone", source.repo, targetDir]);
|
|
1004
|
+
await this.runCommand("git", ["clone", source.repo, targetDir], { interactive });
|
|
989
1005
|
if (source.ref) {
|
|
990
|
-
await this.runCommand("git", ["checkout", source.ref], { cwd: targetDir });
|
|
1006
|
+
await this.runCommand("git", ["checkout", source.ref], { cwd: targetDir, interactive });
|
|
991
1007
|
}
|
|
992
1008
|
const packageJsonPath = join(targetDir, "package.json");
|
|
993
1009
|
if (existsSync(packageJsonPath)) {
|
|
994
|
-
await this.runCommand("npm", ["install"], { cwd: targetDir });
|
|
1010
|
+
await this.runCommand("npm", ["install"], { cwd: targetDir, interactive });
|
|
995
1011
|
}
|
|
996
1012
|
}
|
|
997
|
-
async updateGit(source, scope) {
|
|
1013
|
+
async updateGit(source, scope, interactive = false) {
|
|
998
1014
|
const targetDir = this.getGitInstallPath(source, scope);
|
|
999
1015
|
if (!existsSync(targetDir)) {
|
|
1000
|
-
await this.installGit(source, scope);
|
|
1016
|
+
await this.installGit(source, scope, interactive);
|
|
1001
1017
|
return;
|
|
1002
1018
|
}
|
|
1003
1019
|
// Fetch latest from remote (handles force-push by getting new history)
|
|
1004
|
-
await this.runCommand("git", ["fetch", "--prune", "origin"], { cwd: targetDir });
|
|
1020
|
+
await this.runCommand("git", ["fetch", "--prune", "origin"], { cwd: targetDir, interactive });
|
|
1005
1021
|
// Reset to tracking branch. Fall back to origin/HEAD when no upstream is configured.
|
|
1006
1022
|
try {
|
|
1007
|
-
await this.runCommand("git", ["reset", "--hard", "@{upstream}"], { cwd: targetDir });
|
|
1023
|
+
await this.runCommand("git", ["reset", "--hard", "@{upstream}"], { cwd: targetDir, interactive });
|
|
1008
1024
|
}
|
|
1009
1025
|
catch {
|
|
1010
|
-
await this.runCommand("git", ["remote", "set-head", "origin", "-a"], { cwd: targetDir }).catch(() => { });
|
|
1011
|
-
await this.runCommand("git", ["reset", "--hard", "origin/HEAD"], { cwd: targetDir });
|
|
1026
|
+
await this.runCommand("git", ["remote", "set-head", "origin", "-a"], { cwd: targetDir, interactive }).catch(() => { });
|
|
1027
|
+
await this.runCommand("git", ["reset", "--hard", "origin/HEAD"], { cwd: targetDir, interactive });
|
|
1012
1028
|
}
|
|
1013
1029
|
// Clean untracked files (extensions should be pristine)
|
|
1014
|
-
await this.runCommand("git", ["clean", "-fdx"], { cwd: targetDir });
|
|
1030
|
+
await this.runCommand("git", ["clean", "-fdx"], { cwd: targetDir, interactive });
|
|
1015
1031
|
const packageJsonPath = join(targetDir, "package.json");
|
|
1016
1032
|
if (existsSync(packageJsonPath)) {
|
|
1017
|
-
await this.runCommand("npm", ["install"], { cwd: targetDir });
|
|
1033
|
+
await this.runCommand("npm", ["install"], { cwd: targetDir, interactive });
|
|
1018
1034
|
}
|
|
1019
1035
|
}
|
|
1020
1036
|
async refreshTemporaryGitSource(source, sourceStr) {
|
|
@@ -1479,20 +1495,42 @@ export class DefaultPackageManager {
|
|
|
1479
1495
|
themes: toResolved(accumulator.themes),
|
|
1480
1496
|
};
|
|
1481
1497
|
}
|
|
1498
|
+
/**
|
|
1499
|
+
* Run a child process. When `interactive` is true (the explicit user-facing
|
|
1500
|
+
* install/update path), stdio is inherited so npm/git progress shows in the
|
|
1501
|
+
* terminal. When false (the default — auto-resolve during launch), stdout
|
|
1502
|
+
* and stderr are captured. The captured stderr is appended to the failure
|
|
1503
|
+
* error so callers can surface the underlying cause without polluting the
|
|
1504
|
+
* TUI during startup.
|
|
1505
|
+
*/
|
|
1482
1506
|
runCommand(command, args, options) {
|
|
1507
|
+
const interactive = options?.interactive === true;
|
|
1483
1508
|
return new Promise((resolvePromise, reject) => {
|
|
1484
1509
|
const child = spawn(command, args, {
|
|
1485
1510
|
cwd: options?.cwd,
|
|
1486
|
-
stdio: "inherit",
|
|
1511
|
+
stdio: interactive ? "inherit" : ["ignore", "pipe", "pipe"],
|
|
1487
1512
|
shell: process.platform === "win32",
|
|
1488
1513
|
});
|
|
1514
|
+
let stderr = "";
|
|
1515
|
+
if (!interactive) {
|
|
1516
|
+
child.stdout?.on("data", () => { });
|
|
1517
|
+
child.stderr?.on("data", (chunk) => {
|
|
1518
|
+
stderr += typeof chunk === "string" ? chunk : chunk.toString("utf-8");
|
|
1519
|
+
// Cap to avoid unbounded growth on chatty failures.
|
|
1520
|
+
if (stderr.length > 4_000)
|
|
1521
|
+
stderr = stderr.slice(-4_000);
|
|
1522
|
+
});
|
|
1523
|
+
}
|
|
1489
1524
|
child.on("error", reject);
|
|
1490
1525
|
child.on("exit", (code) => {
|
|
1491
1526
|
if (code === 0) {
|
|
1492
1527
|
resolvePromise();
|
|
1493
1528
|
}
|
|
1494
1529
|
else {
|
|
1495
|
-
|
|
1530
|
+
const detail = !interactive && stderr.trim().length > 0
|
|
1531
|
+
? `: ${stderr.trim().split("\n").slice(-3).join(" ").slice(0, 500)}`
|
|
1532
|
+
: "";
|
|
1533
|
+
reject(new Error(`${command} ${args.join(" ")} failed with code ${code}${detail}`));
|
|
1496
1534
|
}
|
|
1497
1535
|
});
|
|
1498
1536
|
});
|