@getpochi/cli 0.5.23 → 0.5.25
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.js +173 -125
- package/package.json +1 -1
package/dist/cli.js
CHANGED
|
@@ -343800,29 +343800,13 @@ Use the gh command via the executeCommand tool for ALL GitHub-related tasks incl
|
|
|
343800
343800
|
|
|
343801
343801
|
IMPORTANT: When the user asks you to create a pull request, follow these steps carefully:
|
|
343802
343802
|
|
|
343803
|
-
1.
|
|
343803
|
+
1. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following bash commands in parallel using the executeCommand tool, in order to understand the current state of the branch since it diverged from the main branch:
|
|
343804
343804
|
- Run a git status command to see all untracked files
|
|
343805
343805
|
- Run a git diff command to see both staged and unstaged changes that will be committed
|
|
343806
343806
|
- Check if the current branch tracks a remote branch and is up to date with the remote, so you know if you need to push to the remote
|
|
343807
|
-
- Run a git log command and \`git diff
|
|
343808
|
-
|
|
343809
|
-
|
|
343810
|
-
|
|
343811
|
-
- List the commits since diverging from the main branch
|
|
343812
|
-
- Summarize the nature of the changes (eg. new feature, enhancement to an existing feature, bug fix, refactoring, test, docs, etc.)
|
|
343813
|
-
- Brainstorm the purpose or motivation behind these changes
|
|
343814
|
-
- Assess the impact of these changes on the overall project
|
|
343815
|
-
- Do not use tools to explore code, beyond what is available in the git context
|
|
343816
|
-
- Check for any sensitive information that shouldn't be committed
|
|
343817
|
-
- Draft a concise (1-2 bullet points) pull request summary that focuses on the "why" rather than the "what"
|
|
343818
|
-
- Ensure the summary accurately reflects all changes since diverging from the main branch
|
|
343819
|
-
- Ensure your language is clear, concise, and to the point
|
|
343820
|
-
- Ensure the summary accurately reflects the changes and their purpose (ie. "add" means a wholly new feature, "update" means an enhancement to an existing feature, "fix" means a bug fix, etc.)
|
|
343821
|
-
- Ensure the summary is not generic (avoid words like "Update" or "Fix" without context)
|
|
343822
|
-
- Review the draft summary to ensure it accurately reflects the changes and their purpose
|
|
343823
|
-
- Note unlike creating a git message, you don't need to include the Co-Authored-By line in PR body
|
|
343824
|
-
|
|
343825
|
-
3. Use batchCall to run the following commands in parallel:
|
|
343807
|
+
- Run a git log command and \`git diff [base-branch]...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the base branch)
|
|
343808
|
+
2. Analyze all changes that will be included in the pull request, making sure to look at all relevant commits (NOT just the latest commit, but ALL commits that will be included in the pull request!!!), and draft a pull request summary
|
|
343809
|
+
3. You have the capability to call multiple tools in a single response. When multiple independent pieces of information are requested, batch your tool calls together for optimal performance. ALWAYS run the following commands in parallel:
|
|
343826
343810
|
- Create new branch if needed
|
|
343827
343811
|
- Push to remote with -u flag if needed
|
|
343828
343812
|
- Create PR using gh pr create with the format below. Use a HEREDOC to pass the body to ensure correct formatting.
|
|
@@ -343844,7 +343828,9 @@ Important:
|
|
|
343844
343828
|
- Return the PR URL when you're done, so the user can see it
|
|
343845
343829
|
|
|
343846
343830
|
# Other common operations
|
|
343847
|
-
|
|
343831
|
+
1. View comments on a Github PR, you should run following commands
|
|
343832
|
+
- gh api repos/foo/bar/pulls/123/comments
|
|
343833
|
+
- gh pr view --comments
|
|
343848
343834
|
`.trim(),
|
|
343849
343835
|
inputSchema: exports_external2.object({
|
|
343850
343836
|
command: exports_external2.string().describe("The CLI command to execute. This should be valid for the current operating system."),
|
|
@@ -345418,6 +345404,8 @@ class VendorBase {
|
|
|
345418
345404
|
vendorId;
|
|
345419
345405
|
constructor(vendorId) {
|
|
345420
345406
|
this.vendorId = vendorId;
|
|
345407
|
+
this.getCredentials = this.getCredentials.bind(this);
|
|
345408
|
+
this.getUserInfo = this.getUserInfo.bind(this);
|
|
345421
345409
|
}
|
|
345422
345410
|
getCredentials = runExclusive.buildMethod(async () => {
|
|
345423
345411
|
const { credentials } = this.getVendorConfig();
|
|
@@ -347677,7 +347665,7 @@ async function renewCredentials2(credentials) {
|
|
|
347677
347665
|
async function fetchUserInfo2(_credentials) {
|
|
347678
347666
|
return {
|
|
347679
347667
|
email: "",
|
|
347680
|
-
name: "
|
|
347668
|
+
name: "Logged-in"
|
|
347681
347669
|
};
|
|
347682
347670
|
}
|
|
347683
347671
|
function generatePKCEParams2() {
|
|
@@ -352308,7 +352296,7 @@ var {
|
|
|
352308
352296
|
// package.json
|
|
352309
352297
|
var package_default = {
|
|
352310
352298
|
name: "@getpochi/cli",
|
|
352311
|
-
version: "0.5.
|
|
352299
|
+
version: "0.5.25",
|
|
352312
352300
|
type: "module",
|
|
352313
352301
|
bin: {
|
|
352314
352302
|
pochi: "src/cli.ts"
|
|
@@ -353553,15 +353541,17 @@ async function selectVendor() {
|
|
|
353553
353541
|
if (vendor3.authenticated) {
|
|
353554
353542
|
try {
|
|
353555
353543
|
const userInfo = await vendor3.getUserInfo();
|
|
353556
|
-
|
|
353544
|
+
const name17 = userInfo?.name || "Unknown User";
|
|
353545
|
+
const email3 = userInfo?.email || "";
|
|
353546
|
+
description = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
|
|
353557
353547
|
} catch {
|
|
353558
|
-
description = "
|
|
353548
|
+
description = source_default2.bold("Unknown User");
|
|
353559
353549
|
}
|
|
353560
353550
|
} else {
|
|
353561
353551
|
description = "Not logged in";
|
|
353562
353552
|
}
|
|
353563
353553
|
return {
|
|
353564
|
-
name: `${vendorId
|
|
353554
|
+
name: `${vendorId} ${source_default2.white("-")} ${vendor3.authenticated ? source_default2.green(description) : source_default2.gray(description)}`,
|
|
353565
353555
|
value: vendorId,
|
|
353566
353556
|
description: `
|
|
353567
353557
|
${source_default2.gray("Current selection:")} ${source_default2.gray(description)}`
|
|
@@ -353593,8 +353583,11 @@ async function confirmVendorSelection(vendorId) {
|
|
|
353593
353583
|
if (vendor3.authenticated) {
|
|
353594
353584
|
try {
|
|
353595
353585
|
const userInfo = await vendor3.getUserInfo();
|
|
353586
|
+
const name17 = userInfo?.name || "Unknown User";
|
|
353587
|
+
const email3 = userInfo?.email || "";
|
|
353588
|
+
const userDisplay = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
|
|
353596
353589
|
const confirm = await esm_default3({
|
|
353597
|
-
message: `You're already logged in to ${vendorId} as ${
|
|
353590
|
+
message: `You're already logged in to ${vendorId} as ${source_default2.green(userDisplay)}. Do you want to re-authenticate?`,
|
|
353598
353591
|
choices: [
|
|
353599
353592
|
{ name: "No, use existing authentication", value: false },
|
|
353600
353593
|
{ name: "Yes, re-authenticate", value: true }
|
|
@@ -353613,8 +353606,6 @@ function registerAuthCommand(program3) {
|
|
|
353613
353606
|
const vendors = getVendors();
|
|
353614
353607
|
const authCommand = program3.command("auth").description("Manage authentication for different AI vendors.").addHelpCommand(true);
|
|
353615
353608
|
authCommand.command("status", { isDefault: true }).description("Check authentication status for all supported vendors.").action(async () => {
|
|
353616
|
-
console.log(`Checking authentication status...
|
|
353617
|
-
`);
|
|
353618
353609
|
for (const [name17, auth] of Object.entries(vendors)) {
|
|
353619
353610
|
console.log(`${name17}:`, auth.authenticated ? renderUser(await auth.getUserInfo()) : source_default2.gray("Not logged in"));
|
|
353620
353611
|
}
|
|
@@ -353672,13 +353663,16 @@ function registerAuthCommand(program3) {
|
|
|
353672
353663
|
const choices = await Promise.all(authenticatedVendors.map(async ([vendorId, vendor3]) => {
|
|
353673
353664
|
try {
|
|
353674
353665
|
const userInfo = await vendor3.getUserInfo();
|
|
353666
|
+
const name17 = userInfo?.name || "Unknown User";
|
|
353667
|
+
const email3 = userInfo?.email || "";
|
|
353668
|
+
const userDisplay = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
|
|
353675
353669
|
return {
|
|
353676
|
-
name: `${vendorId}
|
|
353670
|
+
name: `${vendorId} ${source_default2.white("-")} ${source_default2.green(userDisplay)}`,
|
|
353677
353671
|
value: vendorId
|
|
353678
353672
|
};
|
|
353679
353673
|
} catch {
|
|
353680
353674
|
return {
|
|
353681
|
-
name: `${vendorId} - authenticated user`,
|
|
353675
|
+
name: `${vendorId} ${source_default2.white("-")} ${source_default2.green("authenticated user")}`,
|
|
353682
353676
|
value: vendorId
|
|
353683
353677
|
};
|
|
353684
353678
|
}
|
|
@@ -353701,12 +353695,14 @@ function registerAuthCommand(program3) {
|
|
|
353701
353695
|
});
|
|
353702
353696
|
}
|
|
353703
353697
|
function renderUser(user) {
|
|
353704
|
-
|
|
353705
|
-
|
|
353698
|
+
if (!user)
|
|
353699
|
+
return source_default2.gray("Not logged in");
|
|
353700
|
+
const name17 = user.name || "Unknown User";
|
|
353701
|
+
const email3 = user.email;
|
|
353706
353702
|
if (email3 && email3.trim() !== "") {
|
|
353707
|
-
return `${name17} (${email3})`;
|
|
353703
|
+
return `${source_default2.bold(name17)} (${email3})`;
|
|
353708
353704
|
}
|
|
353709
|
-
return name17;
|
|
353705
|
+
return source_default2.bold(name17);
|
|
353710
353706
|
}
|
|
353711
353707
|
// src/lib/find-ripgrep.ts
|
|
353712
353708
|
import { execSync } from "node:child_process";
|
|
@@ -365689,7 +365685,7 @@ var createStorePromise = async ({ signal, otelOptions, ...options4 }) => exports
|
|
|
365689
365685
|
return yield* createStore2({ ...options4 }).pipe(exports_Scope.extend(scope5));
|
|
365690
365686
|
}).pipe(exports_Effect2.withSpan("createStore", {
|
|
365691
365687
|
attributes: { storeId: options4.storeId, disableDevtools: options4.disableDevtools }
|
|
365692
|
-
}), provideOtel(omitUndefineds({ parentSpanContext: otelOptions?.rootSpanContext, otelTracer: otelOptions?.tracer })), exports_Effect2.tapCauseLogPretty, exports_Effect2.annotateLogs({ thread: "window" }), exports_Effect2.provide(exports_Logger2.prettyWithThread("window")), exports_Logger2.withMinimumLogLevel(exports_LogLevel.
|
|
365688
|
+
}), provideOtel(omitUndefineds({ parentSpanContext: otelOptions?.rootSpanContext, otelTracer: otelOptions?.tracer })), exports_Effect2.tapCauseLogPretty, exports_Effect2.annotateLogs({ thread: "window" }), exports_Effect2.provide(exports_Logger2.prettyWithThread("window")), exports_Logger2.withMinimumLogLevel(exports_LogLevel.Error), exports_Effect2.runPromise);
|
|
365693
365689
|
var createStore2 = ({ schema: schema5, adapter: adapter4, storeId, context: context15 = {}, boot, batchUpdates, disableDevtools, onBootStatus, shutdownDeferred, params: params2, debug: debug3, confirmUnsavedChanges = true, syncPayload }) => exports_Effect2.gen(function* () {
|
|
365694
365690
|
const lifetimeScope = yield* exports_Scope.make();
|
|
365695
365691
|
yield* validateStoreId(storeId);
|
|
@@ -387500,7 +387496,7 @@ class Chat extends AbstractChat {
|
|
|
387500
387496
|
}
|
|
387501
387497
|
// src/task/list.ts
|
|
387502
387498
|
function registerTaskListCommand(taskCommand) {
|
|
387503
|
-
taskCommand.command("list", { isDefault: true }).description("List all recent tasks, showing their status and IDs.").option("-n, --limit <number>", "The maximum number of tasks to display.", "
|
|
387499
|
+
taskCommand.command("list", { isDefault: true }).description("List all recent tasks, showing their status and IDs.").option("-n, --limit <number>", "The maximum number of tasks to display.", "100").action(async (options4) => {
|
|
387504
387500
|
const limit = Number.parseInt(options4.limit, 10);
|
|
387505
387501
|
if (Number.isNaN(limit) || limit <= 0) {
|
|
387506
387502
|
return taskCommand.error("Limit must be a positive number");
|
|
@@ -387517,28 +387513,59 @@ function registerTaskListCommand(taskCommand) {
|
|
|
387517
387513
|
console.log(source_default2.white(` pochi -p "<your task description>"`));
|
|
387518
387514
|
return;
|
|
387519
387515
|
}
|
|
387520
|
-
|
|
387521
|
-
|
|
387522
|
-
|
|
387523
|
-
|
|
387524
|
-
|
|
387525
|
-
|
|
387526
|
-
|
|
387527
|
-
|
|
387528
|
-
|
|
387529
|
-
|
|
387530
|
-
|
|
387531
|
-
|
|
387516
|
+
const taskId = await esm_default3({
|
|
387517
|
+
message: `Showing the last ${source_default2.bold(limit)} tasks:`,
|
|
387518
|
+
choices: tasks.map((task2) => ({
|
|
387519
|
+
name: formatTaskForSelect(task2),
|
|
387520
|
+
short: task2.id,
|
|
387521
|
+
value: task2.id,
|
|
387522
|
+
description: formatTaskDescription(task2),
|
|
387523
|
+
disabled: !task2.shareId
|
|
387524
|
+
})),
|
|
387525
|
+
pageSize: 10,
|
|
387526
|
+
theme: {
|
|
387527
|
+
style: {
|
|
387528
|
+
description: (text12) => text12
|
|
387529
|
+
},
|
|
387530
|
+
helpMode: "never",
|
|
387531
|
+
indexMode: "number"
|
|
387532
387532
|
}
|
|
387533
|
-
|
|
387533
|
+
});
|
|
387534
|
+
const task = tasks.find((t8) => t8.id === taskId);
|
|
387535
|
+
if (task) {
|
|
387536
|
+
console.log(`
|
|
387537
|
+
${formatTaskForSelect(task)}
|
|
387538
|
+
${formatTaskDescription(task, false)}`);
|
|
387534
387539
|
}
|
|
387535
387540
|
} catch (error44) {
|
|
387536
|
-
|
|
387541
|
+
if (error44 instanceof Error && error44.message.includes("SIGINT")) {} else {
|
|
387542
|
+
return taskCommand.error(`Failed to list tasks: ${error44 instanceof Error ? error44.message : "Unknown error"}`);
|
|
387543
|
+
}
|
|
387537
387544
|
} finally {
|
|
387538
387545
|
await store.shutdown();
|
|
387539
387546
|
}
|
|
387540
387547
|
});
|
|
387541
387548
|
}
|
|
387549
|
+
function formatTaskForSelect(task) {
|
|
387550
|
+
const statusColor = getStatusColor(task.status);
|
|
387551
|
+
const title = clipTitle(task.title || task.id.substring(0, 8), 75);
|
|
387552
|
+
return `${statusColor(getStatusIcon(task.status))} ${source_default2.bold(title)}`;
|
|
387553
|
+
}
|
|
387554
|
+
function formatTaskDescription(task, includeID = true) {
|
|
387555
|
+
const timeAgo = getTimeAgo(task.updatedAt);
|
|
387556
|
+
let description = "";
|
|
387557
|
+
if (includeID) {
|
|
387558
|
+
description += `
|
|
387559
|
+
ID: ${source_default2.cyan(task.id)}`;
|
|
387560
|
+
}
|
|
387561
|
+
description += `
|
|
387562
|
+
Last Updated: ${source_default2.gray(timeAgo)}`;
|
|
387563
|
+
if (task.shareId) {
|
|
387564
|
+
description += `
|
|
387565
|
+
Share URL: ${source_default2.underline(`https://app.getpochi.com/share/${task.shareId}`)}`;
|
|
387566
|
+
}
|
|
387567
|
+
return description;
|
|
387568
|
+
}
|
|
387542
387569
|
function getStatusColor(status3) {
|
|
387543
387570
|
switch (status3) {
|
|
387544
387571
|
case "completed":
|
|
@@ -387583,19 +387610,24 @@ function getTimeAgo(date8) {
|
|
|
387583
387610
|
return `${diffDays}d ago`;
|
|
387584
387611
|
return date8.toLocaleDateString();
|
|
387585
387612
|
}
|
|
387613
|
+
function clipTitle(title, maxLength2) {
|
|
387614
|
+
if (title.length <= maxLength2)
|
|
387615
|
+
return title;
|
|
387616
|
+
return `${title.substring(0, maxLength2 - 3)}...`;
|
|
387617
|
+
}
|
|
387586
387618
|
|
|
387587
387619
|
// src/task/share.ts
|
|
387588
387620
|
function registerTaskShareCommand(taskCommand) {
|
|
387589
387621
|
taskCommand.command("get-share-url").description("Get the shareable URL for a specific task by its ID.").argument("<task-id>", "The ID of the task to get the share URL for.").action(async (taskId) => {
|
|
387590
387622
|
const store = await createStore4(process.cwd());
|
|
387591
|
-
const shareId = store.query(exports_livestore.queries.makeTaskQuery(taskId))
|
|
387623
|
+
const { shareId } = store.query(exports_livestore.queries.makeTaskQuery(taskId)) || {};
|
|
387592
387624
|
if (shareId) {
|
|
387593
387625
|
const shareUrl = `https://app.getpochi.com/share/${shareId}`;
|
|
387594
387626
|
console.log(`${source_default2.bold("\uD83D\uDCCE Share URL:")} ${source_default2.underline(shareUrl)}`);
|
|
387595
387627
|
} else {
|
|
387596
387628
|
console.log(source_default2.red("❌ No share URL found for this task"));
|
|
387597
387629
|
}
|
|
387598
|
-
store.shutdown();
|
|
387630
|
+
await store.shutdown();
|
|
387599
387631
|
});
|
|
387600
387632
|
}
|
|
387601
387633
|
|
|
@@ -390945,48 +390977,6 @@ function toError2(e11) {
|
|
|
390945
390977
|
}
|
|
390946
390978
|
return new Error(JSON.stringify(e11));
|
|
390947
390979
|
}
|
|
390948
|
-
// package.json
|
|
390949
|
-
var package_default2 = {
|
|
390950
|
-
name: "@getpochi/cli",
|
|
390951
|
-
version: "0.5.23",
|
|
390952
|
-
type: "module",
|
|
390953
|
-
bin: {
|
|
390954
|
-
pochi: "src/cli.ts"
|
|
390955
|
-
},
|
|
390956
|
-
files: ["dist/**", "README.md", "../../LICENSE"],
|
|
390957
|
-
scripts: {
|
|
390958
|
-
start: "bun run src/cli.ts",
|
|
390959
|
-
tsc: "tsc",
|
|
390960
|
-
test: "bun vitest --run",
|
|
390961
|
-
build: "./scripts/build-cli.sh",
|
|
390962
|
-
"build:all": "./scripts/build-platform-binary.sh",
|
|
390963
|
-
"build:node": "TARGET=node bun run build",
|
|
390964
|
-
release: "bunx bumpp --tag=cli@%s"
|
|
390965
|
-
},
|
|
390966
|
-
devDependencies: {
|
|
390967
|
-
"@getpochi/tools": "workspace:*",
|
|
390968
|
-
"@types/semver": "^7.5.8",
|
|
390969
|
-
"@commander-js/extra-typings": "^14.0.0",
|
|
390970
|
-
"@getpochi/common": "workspace:*",
|
|
390971
|
-
"@getpochi/livekit": "workspace:*",
|
|
390972
|
-
"@getpochi/vendor-claude-code": "workspace:*",
|
|
390973
|
-
"@getpochi/vendor-gemini-cli": "workspace:*",
|
|
390974
|
-
"@getpochi/vendor-pochi": "workspace:*",
|
|
390975
|
-
"@livestore/adapter-node": "catalog:",
|
|
390976
|
-
"@livestore/livestore": "catalog:",
|
|
390977
|
-
"@livestore/utils": "catalog:",
|
|
390978
|
-
"@livestore/wa-sqlite": "catalog:",
|
|
390979
|
-
"@livestore/sync-cf": "catalog:",
|
|
390980
|
-
"@preact/signals-core": "^1.6.2",
|
|
390981
|
-
ai: "catalog:",
|
|
390982
|
-
chalk: "^5.3.0",
|
|
390983
|
-
commander: "^14.0.0",
|
|
390984
|
-
listr2: "^9.0.3",
|
|
390985
|
-
ora: "^8.2.0",
|
|
390986
|
-
semver: "^7.6.3",
|
|
390987
|
-
"@inquirer/select": "^4.3.2"
|
|
390988
|
-
}
|
|
390989
|
-
};
|
|
390990
390980
|
|
|
390991
390981
|
// src/upgrade/binary-installer.ts
|
|
390992
390982
|
import { execSync as execSync3 } from "node:child_process";
|
|
@@ -390997,8 +390987,7 @@ import {
|
|
|
390997
390987
|
mkdirSync,
|
|
390998
390988
|
readdirSync as readdirSync2,
|
|
390999
390989
|
rmSync,
|
|
391000
|
-
statSync as statSync3
|
|
391001
|
-
symlinkSync
|
|
390990
|
+
statSync as statSync3
|
|
391002
390991
|
} from "node:fs";
|
|
391003
390992
|
import { homedir as homedir5, tmpdir as tmpdir3 } from "node:os";
|
|
391004
390993
|
import { extname as extname4, join as join22 } from "node:path";
|
|
@@ -391034,10 +391023,6 @@ function getPlatformBinaryName() {
|
|
|
391034
391023
|
const extension2 = process.platform === "win32" ? ".zip" : ".tar.gz";
|
|
391035
391024
|
return `pochi-${platformName}-${archName}${extension2}`;
|
|
391036
391025
|
}
|
|
391037
|
-
function getBinaryFileName(version5) {
|
|
391038
|
-
const extension2 = process.platform === "win32" ? ".exe" : "";
|
|
391039
|
-
return `pochi-${version5}${extension2}`;
|
|
391040
|
-
}
|
|
391041
391026
|
function getLatestBinaryFileName() {
|
|
391042
391027
|
const extension2 = process.platform === "win32" ? ".exe" : "";
|
|
391043
391028
|
return `pochi${extension2}`;
|
|
@@ -391146,11 +391131,9 @@ async function downloadAndInstall(release2) {
|
|
|
391146
391131
|
console.log(`⬇️ Downloading ${asset.name}...`);
|
|
391147
391132
|
const version5 = extractVersionFromTag(release2.tag_name);
|
|
391148
391133
|
const binDir = getPochiDir();
|
|
391149
|
-
const versionedBinaryName = getBinaryFileName(version5);
|
|
391150
391134
|
const latestBinaryName = getLatestBinaryFileName();
|
|
391151
|
-
const versionedBinaryPath = join22(binDir, versionedBinaryName);
|
|
391152
391135
|
const latestBinaryPath = join22(binDir, latestBinaryName);
|
|
391153
|
-
console.log(`⚙️ Installing to: ${
|
|
391136
|
+
console.log(`⚙️ Installing to: ${latestBinaryPath}`);
|
|
391154
391137
|
const tempDir = join22(tmpdir3(), `pochi-upgrade-${Date.now()}`);
|
|
391155
391138
|
mkdirSync(tempDir, { recursive: true });
|
|
391156
391139
|
const archivePath = join22(tempDir, asset.name);
|
|
@@ -391164,28 +391147,16 @@ async function downloadAndInstall(release2) {
|
|
|
391164
391147
|
}
|
|
391165
391148
|
const extractedBinaryPath = await extractArchive(archivePath, tempDir);
|
|
391166
391149
|
console.log(`\uD83D\uDD0D Found binary: ${extractedBinaryPath}`);
|
|
391167
|
-
copyFileSync(extractedBinaryPath, versionedBinaryPath);
|
|
391168
|
-
if (process.platform !== "win32") {
|
|
391169
|
-
chmodSync(versionedBinaryPath, 493);
|
|
391170
|
-
}
|
|
391171
391150
|
if (existsSync7(latestBinaryPath)) {
|
|
391172
391151
|
rmSync(latestBinaryPath);
|
|
391173
391152
|
}
|
|
391174
|
-
|
|
391175
|
-
|
|
391176
|
-
|
|
391177
|
-
try {
|
|
391178
|
-
symlinkSync(versionedBinaryName, latestBinaryPath);
|
|
391179
|
-
} catch (error44) {
|
|
391180
|
-
execSync3(`ln -s "${versionedBinaryName}" "${latestBinaryPath}"`, {
|
|
391181
|
-
cwd: binDir
|
|
391182
|
-
});
|
|
391183
|
-
}
|
|
391153
|
+
copyFileSync(extractedBinaryPath, latestBinaryPath);
|
|
391154
|
+
if (process.platform !== "win32") {
|
|
391155
|
+
chmodSync(latestBinaryPath, 493);
|
|
391184
391156
|
}
|
|
391185
391157
|
rmSync(tempDir, { recursive: true, force: true });
|
|
391186
391158
|
console.log(source_default2.green(`✅ Successfully installed Pochi v${version5}`));
|
|
391187
|
-
console.log(source_default2.cyan(`\uD83D\uDCCD Installed to: ${
|
|
391188
|
-
console.log(source_default2.cyan(`\uD83D\uDD17 Latest symlink: ${latestBinaryPath}`));
|
|
391159
|
+
console.log(source_default2.cyan(`\uD83D\uDCCD Installed to: ${latestBinaryPath}`));
|
|
391189
391160
|
console.log();
|
|
391190
391161
|
console.log(source_default2.yellow("To use the new version:"));
|
|
391191
391162
|
console.log(source_default2.white(` ${latestBinaryPath} --version`));
|
|
@@ -391199,6 +391170,48 @@ async function downloadAndInstall(release2) {
|
|
|
391199
391170
|
console.error(source_default2.red("Failed to install update:"), error44);
|
|
391200
391171
|
}
|
|
391201
391172
|
}
|
|
391173
|
+
// package.json
|
|
391174
|
+
var package_default2 = {
|
|
391175
|
+
name: "@getpochi/cli",
|
|
391176
|
+
version: "0.5.25",
|
|
391177
|
+
type: "module",
|
|
391178
|
+
bin: {
|
|
391179
|
+
pochi: "src/cli.ts"
|
|
391180
|
+
},
|
|
391181
|
+
files: ["dist/**", "README.md", "../../LICENSE"],
|
|
391182
|
+
scripts: {
|
|
391183
|
+
start: "bun run src/cli.ts",
|
|
391184
|
+
tsc: "tsc",
|
|
391185
|
+
test: "bun vitest --run",
|
|
391186
|
+
build: "./scripts/build-cli.sh",
|
|
391187
|
+
"build:all": "./scripts/build-platform-binary.sh",
|
|
391188
|
+
"build:node": "TARGET=node bun run build",
|
|
391189
|
+
release: "bunx bumpp --tag=cli@%s"
|
|
391190
|
+
},
|
|
391191
|
+
devDependencies: {
|
|
391192
|
+
"@getpochi/tools": "workspace:*",
|
|
391193
|
+
"@types/semver": "^7.5.8",
|
|
391194
|
+
"@commander-js/extra-typings": "^14.0.0",
|
|
391195
|
+
"@getpochi/common": "workspace:*",
|
|
391196
|
+
"@getpochi/livekit": "workspace:*",
|
|
391197
|
+
"@getpochi/vendor-claude-code": "workspace:*",
|
|
391198
|
+
"@getpochi/vendor-gemini-cli": "workspace:*",
|
|
391199
|
+
"@getpochi/vendor-pochi": "workspace:*",
|
|
391200
|
+
"@livestore/adapter-node": "catalog:",
|
|
391201
|
+
"@livestore/livestore": "catalog:",
|
|
391202
|
+
"@livestore/utils": "catalog:",
|
|
391203
|
+
"@livestore/wa-sqlite": "catalog:",
|
|
391204
|
+
"@livestore/sync-cf": "catalog:",
|
|
391205
|
+
"@preact/signals-core": "^1.6.2",
|
|
391206
|
+
ai: "catalog:",
|
|
391207
|
+
chalk: "^5.3.0",
|
|
391208
|
+
commander: "^14.0.0",
|
|
391209
|
+
listr2: "^9.0.3",
|
|
391210
|
+
ora: "^8.2.0",
|
|
391211
|
+
semver: "^7.6.3",
|
|
391212
|
+
"@inquirer/select": "^4.3.2"
|
|
391213
|
+
}
|
|
391214
|
+
};
|
|
391202
391215
|
|
|
391203
391216
|
// src/upgrade/release-fetcher.ts
|
|
391204
391217
|
var GITHUB_REPO = "TabbyML/pochi";
|
|
@@ -391221,17 +391234,47 @@ async function fetchLatestCliRelease() {
|
|
|
391221
391234
|
return cliReleases[0];
|
|
391222
391235
|
}
|
|
391223
391236
|
|
|
391237
|
+
// src/upgrade/version-check.ts
|
|
391238
|
+
async function returnVersionInfo(options4) {
|
|
391239
|
+
const { timeoutMs } = options4 ?? {};
|
|
391240
|
+
const latestReleasePromise = fetchLatestCliRelease();
|
|
391241
|
+
const latestRelease = await (timeoutMs != null ? Promise.race([
|
|
391242
|
+
latestReleasePromise,
|
|
391243
|
+
new Promise((_8, reject3) => setTimeout(() => reject3(new Error("version check timeout")), timeoutMs))
|
|
391244
|
+
]) : latestReleasePromise);
|
|
391245
|
+
const latestVersion = extractVersionFromTag(latestRelease.tag_name);
|
|
391246
|
+
return {
|
|
391247
|
+
updateAvailable: isNewerVersion(latestVersion, package_default2.version),
|
|
391248
|
+
currentVersion: package_default2.version,
|
|
391249
|
+
latestVersion,
|
|
391250
|
+
latestRelease
|
|
391251
|
+
};
|
|
391252
|
+
}
|
|
391253
|
+
async function checkForUpdates() {
|
|
391254
|
+
const { updateAvailable, currentVersion, latestVersion } = await returnVersionInfo({ timeoutMs: 300 });
|
|
391255
|
+
const header = `
|
|
391256
|
+
${source_default2.bold("Pochi")} ${source_default2.white(currentVersion)}`;
|
|
391257
|
+
if (updateAvailable) {
|
|
391258
|
+
console.log(`${header} ${source_default2.dim("(update available")} ${source_default2.green(latestVersion)}${source_default2.dim(")")}`);
|
|
391259
|
+
const columns = process.stdout.columns || 80;
|
|
391260
|
+
const width = Math.max(Math.min(columns, 100), 20);
|
|
391261
|
+
console.log(source_default2.yellow("─".repeat(width)));
|
|
391262
|
+
}
|
|
391263
|
+
}
|
|
391264
|
+
|
|
391224
391265
|
// src/upgrade/cmd.ts
|
|
391225
391266
|
function registerUpgradeCommand(program5) {
|
|
391226
391267
|
program5.command("upgrade").description("Check for new releases and upgrade the Pochi CLI to the latest version.").action(async () => {
|
|
391227
391268
|
console.log("Checking for updates...");
|
|
391228
391269
|
try {
|
|
391229
|
-
const
|
|
391230
|
-
|
|
391231
|
-
|
|
391270
|
+
const {
|
|
391271
|
+
updateAvailable,
|
|
391272
|
+
latestVersion,
|
|
391273
|
+
latestRelease,
|
|
391274
|
+
currentVersion
|
|
391275
|
+
} = await returnVersionInfo({ timeoutMs: null });
|
|
391232
391276
|
console.log(`Current version: ${currentVersion}`);
|
|
391233
|
-
|
|
391234
|
-
if (isNewerVersion(latestVersion, currentVersion)) {
|
|
391277
|
+
if (updateAvailable) {
|
|
391235
391278
|
console.log(source_default2.green(`A new version (${latestVersion}) is available!`));
|
|
391236
391279
|
await downloadAndInstall(latestRelease);
|
|
391237
391280
|
} else {
|
|
@@ -391296,6 +391339,11 @@ program5.optionsGroup(otherOptionsGroup).version(package_default.version, "-V, -
|
|
|
391296
391339
|
}).showHelpAfterError().showSuggestionAfterError().configureOutput({
|
|
391297
391340
|
outputError: (str, write5) => write5(source_default.red(str))
|
|
391298
391341
|
});
|
|
391342
|
+
program5.hook("preAction", async () => {
|
|
391343
|
+
try {
|
|
391344
|
+
await checkForUpdates();
|
|
391345
|
+
} catch {}
|
|
391346
|
+
});
|
|
391299
391347
|
registerAuthCommand(program5);
|
|
391300
391348
|
registerModelCommand(program5);
|
|
391301
391349
|
registerMcpCommand(program5);
|