@getpochi/cli 0.5.24 → 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.
Files changed (2) hide show
  1. package/dist/cli.js +117 -107
  2. 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. Use batchCall to run the following commands in parallel, in order to understand the current state of the branch since it diverged from the main branch:
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 main...HEAD\` to understand the full commit history for the current branch (from the time it diverged from the \`main\` branch)
343808
-
343809
- 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.
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
- - View comments on a Github PR: gh api repos/foo/bar/pulls/123/comments
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."),
@@ -347679,7 +347665,7 @@ async function renewCredentials2(credentials) {
347679
347665
  async function fetchUserInfo2(_credentials) {
347680
347666
  return {
347681
347667
  email: "",
347682
- name: "Authenticated Account"
347668
+ name: "Logged-in"
347683
347669
  };
347684
347670
  }
347685
347671
  function generatePKCEParams2() {
@@ -352310,7 +352296,7 @@ var {
352310
352296
  // package.json
352311
352297
  var package_default = {
352312
352298
  name: "@getpochi/cli",
352313
- version: "0.5.24",
352299
+ version: "0.5.25",
352314
352300
  type: "module",
352315
352301
  bin: {
352316
352302
  pochi: "src/cli.ts"
@@ -353555,15 +353541,17 @@ async function selectVendor() {
353555
353541
  if (vendor3.authenticated) {
353556
353542
  try {
353557
353543
  const userInfo = await vendor3.getUserInfo();
353558
- description = `✓ Logged in as ${userInfo?.name || userInfo?.email || "authenticated user"}`;
353544
+ const name17 = userInfo?.name || "Unknown User";
353545
+ const email3 = userInfo?.email || "";
353546
+ description = email3 ? `${source_default2.bold(name17)} (${email3})` : source_default2.bold(name17);
353559
353547
  } catch {
353560
- description = " Authenticated";
353548
+ description = source_default2.bold("Unknown User");
353561
353549
  }
353562
353550
  } else {
353563
353551
  description = "Not logged in";
353564
353552
  }
353565
353553
  return {
353566
- name: `${vendorId.charAt(0).toUpperCase() + vendorId.slice(1)} ${source_default2.white("-")} ${vendor3.authenticated ? source_default2.green(description) : source_default2.gray(description)}`,
353554
+ name: `${vendorId} ${source_default2.white("-")} ${vendor3.authenticated ? source_default2.green(description) : source_default2.gray(description)}`,
353567
353555
  value: vendorId,
353568
353556
  description: `
353569
353557
  ${source_default2.gray("Current selection:")} ${source_default2.gray(description)}`
@@ -353595,8 +353583,11 @@ async function confirmVendorSelection(vendorId) {
353595
353583
  if (vendor3.authenticated) {
353596
353584
  try {
353597
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);
353598
353589
  const confirm = await esm_default3({
353599
- message: `You're already logged in to ${vendorId} as ${userInfo?.name || userInfo?.email}. Do you want to re-authenticate?`,
353590
+ message: `You're already logged in to ${vendorId} as ${source_default2.green(userDisplay)}. Do you want to re-authenticate?`,
353600
353591
  choices: [
353601
353592
  { name: "No, use existing authentication", value: false },
353602
353593
  { name: "Yes, re-authenticate", value: true }
@@ -353615,8 +353606,6 @@ function registerAuthCommand(program3) {
353615
353606
  const vendors = getVendors();
353616
353607
  const authCommand = program3.command("auth").description("Manage authentication for different AI vendors.").addHelpCommand(true);
353617
353608
  authCommand.command("status", { isDefault: true }).description("Check authentication status for all supported vendors.").action(async () => {
353618
- console.log(`Checking authentication status...
353619
- `);
353620
353609
  for (const [name17, auth] of Object.entries(vendors)) {
353621
353610
  console.log(`${name17}:`, auth.authenticated ? renderUser(await auth.getUserInfo()) : source_default2.gray("Not logged in"));
353622
353611
  }
@@ -353674,13 +353663,16 @@ function registerAuthCommand(program3) {
353674
353663
  const choices = await Promise.all(authenticatedVendors.map(async ([vendorId, vendor3]) => {
353675
353664
  try {
353676
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);
353677
353669
  return {
353678
- name: `${vendorId} - ${userInfo?.name || userInfo?.email || "authenticated user"}`,
353670
+ name: `${vendorId} ${source_default2.white("-")} ${source_default2.green(userDisplay)}`,
353679
353671
  value: vendorId
353680
353672
  };
353681
353673
  } catch {
353682
353674
  return {
353683
- name: `${vendorId} - authenticated user`,
353675
+ name: `${vendorId} ${source_default2.white("-")} ${source_default2.green("authenticated user")}`,
353684
353676
  value: vendorId
353685
353677
  };
353686
353678
  }
@@ -353703,12 +353695,14 @@ function registerAuthCommand(program3) {
353703
353695
  });
353704
353696
  }
353705
353697
  function renderUser(user) {
353706
- const name17 = source_default2.bold(user?.name);
353707
- const email3 = user?.email;
353698
+ if (!user)
353699
+ return source_default2.gray("Not logged in");
353700
+ const name17 = user.name || "Unknown User";
353701
+ const email3 = user.email;
353708
353702
  if (email3 && email3.trim() !== "") {
353709
- return `${name17} (${email3})`;
353703
+ return `${source_default2.bold(name17)} (${email3})`;
353710
353704
  }
353711
- return name17;
353705
+ return source_default2.bold(name17);
353712
353706
  }
353713
353707
  // src/lib/find-ripgrep.ts
353714
353708
  import { execSync } from "node:child_process";
@@ -390983,48 +390977,6 @@ function toError2(e11) {
390983
390977
  }
390984
390978
  return new Error(JSON.stringify(e11));
390985
390979
  }
390986
- // package.json
390987
- var package_default2 = {
390988
- name: "@getpochi/cli",
390989
- version: "0.5.24",
390990
- type: "module",
390991
- bin: {
390992
- pochi: "src/cli.ts"
390993
- },
390994
- files: ["dist/**", "README.md", "../../LICENSE"],
390995
- scripts: {
390996
- start: "bun run src/cli.ts",
390997
- tsc: "tsc",
390998
- test: "bun vitest --run",
390999
- build: "./scripts/build-cli.sh",
391000
- "build:all": "./scripts/build-platform-binary.sh",
391001
- "build:node": "TARGET=node bun run build",
391002
- release: "bunx bumpp --tag=cli@%s"
391003
- },
391004
- devDependencies: {
391005
- "@getpochi/tools": "workspace:*",
391006
- "@types/semver": "^7.5.8",
391007
- "@commander-js/extra-typings": "^14.0.0",
391008
- "@getpochi/common": "workspace:*",
391009
- "@getpochi/livekit": "workspace:*",
391010
- "@getpochi/vendor-claude-code": "workspace:*",
391011
- "@getpochi/vendor-gemini-cli": "workspace:*",
391012
- "@getpochi/vendor-pochi": "workspace:*",
391013
- "@livestore/adapter-node": "catalog:",
391014
- "@livestore/livestore": "catalog:",
391015
- "@livestore/utils": "catalog:",
391016
- "@livestore/wa-sqlite": "catalog:",
391017
- "@livestore/sync-cf": "catalog:",
391018
- "@preact/signals-core": "^1.6.2",
391019
- ai: "catalog:",
391020
- chalk: "^5.3.0",
391021
- commander: "^14.0.0",
391022
- listr2: "^9.0.3",
391023
- ora: "^8.2.0",
391024
- semver: "^7.6.3",
391025
- "@inquirer/select": "^4.3.2"
391026
- }
391027
- };
391028
390980
 
391029
390981
  // src/upgrade/binary-installer.ts
391030
390982
  import { execSync as execSync3 } from "node:child_process";
@@ -391035,8 +390987,7 @@ import {
391035
390987
  mkdirSync,
391036
390988
  readdirSync as readdirSync2,
391037
390989
  rmSync,
391038
- statSync as statSync3,
391039
- symlinkSync
390990
+ statSync as statSync3
391040
390991
  } from "node:fs";
391041
390992
  import { homedir as homedir5, tmpdir as tmpdir3 } from "node:os";
391042
390993
  import { extname as extname4, join as join22 } from "node:path";
@@ -391072,10 +391023,6 @@ function getPlatformBinaryName() {
391072
391023
  const extension2 = process.platform === "win32" ? ".zip" : ".tar.gz";
391073
391024
  return `pochi-${platformName}-${archName}${extension2}`;
391074
391025
  }
391075
- function getBinaryFileName(version5) {
391076
- const extension2 = process.platform === "win32" ? ".exe" : "";
391077
- return `pochi-${version5}${extension2}`;
391078
- }
391079
391026
  function getLatestBinaryFileName() {
391080
391027
  const extension2 = process.platform === "win32" ? ".exe" : "";
391081
391028
  return `pochi${extension2}`;
@@ -391184,11 +391131,9 @@ async function downloadAndInstall(release2) {
391184
391131
  console.log(`⬇️ Downloading ${asset.name}...`);
391185
391132
  const version5 = extractVersionFromTag(release2.tag_name);
391186
391133
  const binDir = getPochiDir();
391187
- const versionedBinaryName = getBinaryFileName(version5);
391188
391134
  const latestBinaryName = getLatestBinaryFileName();
391189
- const versionedBinaryPath = join22(binDir, versionedBinaryName);
391190
391135
  const latestBinaryPath = join22(binDir, latestBinaryName);
391191
- console.log(`⚙️ Installing to: ${binDir}`);
391136
+ console.log(`⚙️ Installing to: ${latestBinaryPath}`);
391192
391137
  const tempDir = join22(tmpdir3(), `pochi-upgrade-${Date.now()}`);
391193
391138
  mkdirSync(tempDir, { recursive: true });
391194
391139
  const archivePath = join22(tempDir, asset.name);
@@ -391202,28 +391147,16 @@ async function downloadAndInstall(release2) {
391202
391147
  }
391203
391148
  const extractedBinaryPath = await extractArchive(archivePath, tempDir);
391204
391149
  console.log(`\uD83D\uDD0D Found binary: ${extractedBinaryPath}`);
391205
- copyFileSync(extractedBinaryPath, versionedBinaryPath);
391206
- if (process.platform !== "win32") {
391207
- chmodSync(versionedBinaryPath, 493);
391208
- }
391209
391150
  if (existsSync7(latestBinaryPath)) {
391210
391151
  rmSync(latestBinaryPath);
391211
391152
  }
391212
- if (process.platform === "win32") {
391213
- copyFileSync(versionedBinaryPath, latestBinaryPath);
391214
- } else {
391215
- try {
391216
- symlinkSync(versionedBinaryName, latestBinaryPath);
391217
- } catch (error44) {
391218
- execSync3(`ln -s "${versionedBinaryName}" "${latestBinaryPath}"`, {
391219
- cwd: binDir
391220
- });
391221
- }
391153
+ copyFileSync(extractedBinaryPath, latestBinaryPath);
391154
+ if (process.platform !== "win32") {
391155
+ chmodSync(latestBinaryPath, 493);
391222
391156
  }
391223
391157
  rmSync(tempDir, { recursive: true, force: true });
391224
391158
  console.log(source_default2.green(`✅ Successfully installed Pochi v${version5}`));
391225
- console.log(source_default2.cyan(`\uD83D\uDCCD Installed to: ${versionedBinaryPath}`));
391226
- console.log(source_default2.cyan(`\uD83D\uDD17 Latest symlink: ${latestBinaryPath}`));
391159
+ console.log(source_default2.cyan(`\uD83D\uDCCD Installed to: ${latestBinaryPath}`));
391227
391160
  console.log();
391228
391161
  console.log(source_default2.yellow("To use the new version:"));
391229
391162
  console.log(source_default2.white(` ${latestBinaryPath} --version`));
@@ -391237,6 +391170,48 @@ async function downloadAndInstall(release2) {
391237
391170
  console.error(source_default2.red("Failed to install update:"), error44);
391238
391171
  }
391239
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
+ };
391240
391215
 
391241
391216
  // src/upgrade/release-fetcher.ts
391242
391217
  var GITHUB_REPO = "TabbyML/pochi";
@@ -391259,17 +391234,47 @@ async function fetchLatestCliRelease() {
391259
391234
  return cliReleases[0];
391260
391235
  }
391261
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
+
391262
391265
  // src/upgrade/cmd.ts
391263
391266
  function registerUpgradeCommand(program5) {
391264
391267
  program5.command("upgrade").description("Check for new releases and upgrade the Pochi CLI to the latest version.").action(async () => {
391265
391268
  console.log("Checking for updates...");
391266
391269
  try {
391267
- const latestRelease = await fetchLatestCliRelease();
391268
- const latestVersion = extractVersionFromTag(latestRelease.tag_name);
391269
- const currentVersion = package_default2.version;
391270
+ const {
391271
+ updateAvailable,
391272
+ latestVersion,
391273
+ latestRelease,
391274
+ currentVersion
391275
+ } = await returnVersionInfo({ timeoutMs: null });
391270
391276
  console.log(`Current version: ${currentVersion}`);
391271
- console.log(`Latest version: ${latestVersion}`);
391272
- if (isNewerVersion(latestVersion, currentVersion)) {
391277
+ if (updateAvailable) {
391273
391278
  console.log(source_default2.green(`A new version (${latestVersion}) is available!`));
391274
391279
  await downloadAndInstall(latestRelease);
391275
391280
  } else {
@@ -391334,6 +391339,11 @@ program5.optionsGroup(otherOptionsGroup).version(package_default.version, "-V, -
391334
391339
  }).showHelpAfterError().showSuggestionAfterError().configureOutput({
391335
391340
  outputError: (str, write5) => write5(source_default.red(str))
391336
391341
  });
391342
+ program5.hook("preAction", async () => {
391343
+ try {
391344
+ await checkForUpdates();
391345
+ } catch {}
391346
+ });
391337
391347
  registerAuthCommand(program5);
391338
391348
  registerModelCommand(program5);
391339
391349
  registerMcpCommand(program5);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@getpochi/cli",
3
- "version": "0.5.24",
3
+ "version": "0.5.25",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "pochi": "src/cli.ts"