TabbyML / pochi

Home Page:https://docs.getpochi.com

Repository from Github https://github.comTabbyML/pochiRepository from Github https://github.comTabbyML/pochi

implement 'pochi auth' command

wsxiaoys opened this issue · comments

Is your feature request related to a problem? Please describe.
Currently, the CLI relies on a token being present in ~/.pochi/credentials.json or passed via the --token option or POCHI_SESSION_TOKEN environment variable. There is no user-friendly way to authenticate and obtain this token from the CLI itself.

Describe the solution you'd like
I would like to implement a pochi auth command in the CLI. This command would handle the authentication flow to obtain a session token and store it in the ~/.pochi/credentials.json file. This would be similar to how other CLIs like gh and gcloud handle authentication.

Describe alternatives you've considered
Continuing to rely on the user manually obtaining and setting the token, but this is not user-friendly.

Additional context
The implementation should follow the existing command structure in packages/cli/src/cli.ts.

It will need to interact with the Pochi API, likely using the client defined in packages/common/src/pochi-api.ts.

The authentication flow should be implemented, and the resulting token should be stored in ~/.pochi/credentials.json, which is handled by the CredentialStorage class in packages/common/src/tool-utils/fs.ts.

Relevant files:

🤖 Generated with Pochi