Repository navigation
Conversation
Config moves to a versioned schema holding every registered account plus the default. Version 1 files convert in memory, save atomically with a .bak copy, and never block a command if the save fails. Tokens are stored per login (base URL + user) and the pre-upgrade keyring entry is copied, not moved.
A leading @name selects an account by name or unique prefix. -a takes a name too, and a number still means that account ID on the default login. Global flags with values no longer break the id-first rewrite.
auth login takes an optional URL (bare host or any dashboard link), asks only for the token, and registers every account the user can see. New commands: accounts (list, --refresh, rename), use, and auth logout <url>. An unknown @name refreshes saved logins once before failing.
A dashboard link can replace the noun and id: conversation links (plain or inbox/label/team/mention/custom-view scoped), contact links, and inbox links map to conv, contact, and inbox. The link's account overrides any other selector. A link to an instance without a login offers to log in when run in a terminal and explains how otherwise.
… writes The first run after upgrading names the migrated account and lists the user's other accounts once (stderr, terminals only). Writes to a non-default account print the target to stderr, a 401 explains how to log in again, and conversation locks are scoped per account.
config view only showed the default account. It now shows the config path, the default, and each account with its instance, user, credential status, and help center default, as text or JSON. With accounts but no default it lists them instead of saying no configuration exists.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 64956571f4
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Covers every SDK service endpoint (method, path, body, decoding) and error path, all output formats and escape-sequence branches, and the lock's config-dir path and filesystem failures.
On Chatwoot versions whose profile omits the accounts list, login merged the typed account ID as if it were the full membership list and removed the user's other accounts. It now adds it without removing anything. Base URLs are stored and compared with a lowercase scheme and host, so a v1 config or keyring entry written with uppercase host characters still matches pasted links and resolves its token.
Runs every list, view, and write command end to end against a fake Chatwoot API in text, JSON, and quiet modes, including empty results and API failures. Also covers version --check, api request bodies, logout, the default-account prompt, and help center defaults. latestReleaseURL becomes a var so version --check can be pointed at a test server.
|
@codex review |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 29349b33bc
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
On Chatwoot versions without an accounts list, logging in after an upgrade added a duplicate beside the migrated account (saved without a user ID) and left the unusable one as the default. MergeAccounts now adopts it, like SyncAccounts does. A config written by a newer CLI version is now refused with an upgrade hint instead of being read as version 2, which dropped unknown fields that the next save would then lose.
Merging this branch will increase overall coverage
Coverage by fileChanged files (no unit tests)
Please note that the "Total", "Covered", and "Missed" counts above refer to code statements instead of lines of code. The value in brackets refers to the test coverage of that file in the old version of the code. Changed unit test files
|
Adds support for multiple accounts and multiple Chatwoot instances (production, staging, self-hosted). Log in once per instance and every account you belong to is registered under a short name.
What's new
auth login [url]accepts a bare host, a base URL, or any dashboard link, asks only for the token, and registers each account from the profile'saccountslist. The account ID prompt remains only for Chatwoot versions whose profile doesn't list accounts.globex-inc). When a name is taken, the host is added for another instance (chatwoot-staging) and the user's name for a second user on the same instance (acme-test-agent). Names never change once given.@nameor-a name(unique prefixes work), thenCHATWOOT_ACCOUNT, then the default.-a <number>still means that account ID on the default's instance.conv,contactandinbox. A link to an instance you aren't logged in to offers to log in when run in a terminal.accounts(with--refreshandrename),use, andauth logout <url>.config viewnow shows every account.→ <name>to stderr first.@namerefreshes accounts once before failing.Upgrading needs no action
config.yaml.bak. If that save fails, the command still runs and the next run retries.--jsonor--quietoutput.Downgrading: v0.7.0 can't read the new config format. Restoring
config.yaml.bakgoes back.Also fixed
-a acme conv 123 reply …) no longer break the id-first grammar.-a <id>works with keyring logins. Previously the saved token was tied to one account ID, so it only worked withCHATWOOT_API_KEY.Testing
go test ./...passes, as do the config tests with-tags dev.main()end to end against local fake Chatwoot servers with a mock keyring: login to two instances,accounts,use,@name, upgrading from an old config, the→ nameline, the 401 hint and link routing.Docs: chatwoot/docs#584 (new "Multiple accounts" page plus updates across the CLI pages).