@mostok/codexes 0.1.0 → 0.2.0

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/README.md CHANGED
@@ -81,7 +81,7 @@ npm test
81
81
  npm publish --access public
82
82
  ```
83
83
 
84
- Or create a GitHub release and let `.github/workflows/publish-npm.yml` publish the package with repository secret `NPM_TOKEN`.
84
+ Or create a GitHub release and let `.github/workflows/publish-npm.yml` publish the package through npm trusted publishing via GitHub OIDC.
85
85
 
86
86
  ## License
87
87
 
package/dist/cli.js CHANGED
File without changes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mostok/codexes",
3
- "version": "0.1.0",
3
+ "version": "0.2.0",
4
4
  "description": "Transparent multi-account wrapper around the Codex CLI.",
5
5
  "type": "module",
6
6
  "bin": {
@@ -1,6 +0,0 @@
1
- import type { AccountRegistry, AccountRecord } from "./account-registry.js";
2
- import type { Logger } from "../logging/logger.js";
3
- export declare function resolveActiveAccount(input: {
4
- logger: Logger;
5
- registry: AccountRegistry;
6
- }): Promise<AccountRecord>;
@@ -1,32 +0,0 @@
1
- export async function resolveActiveAccount(input) {
2
- const accounts = await input.registry.listAccounts();
3
- if (accounts.length === 0) {
4
- input.logger.warn("active_account.none");
5
- throw new Error("No accounts configured. Add one with `codexes account add <label>`.");
6
- }
7
- const defaultAccount = await input.registry.getDefaultAccount();
8
- if (defaultAccount) {
9
- input.logger.info("active_account.default_selected", {
10
- accountId: defaultAccount.id,
11
- label: defaultAccount.label,
12
- accountCount: accounts.length,
13
- });
14
- return defaultAccount;
15
- }
16
- if (accounts.length === 1) {
17
- const [singleAccount] = accounts;
18
- if (!singleAccount) {
19
- throw new Error("No accounts configured.");
20
- }
21
- input.logger.info("active_account.single_account_selected", {
22
- accountId: singleAccount.id,
23
- label: singleAccount.label,
24
- });
25
- return input.registry.selectAccount(singleAccount.id);
26
- }
27
- input.logger.warn("active_account.missing_default", {
28
- accountCount: accounts.length,
29
- });
30
- throw new Error("Multiple accounts are configured but no default account is selected. Use `codexes account use <account-id-or-label>` first.");
31
- }
32
- //# sourceMappingURL=resolve-active-account.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"resolve-active-account.js","sourceRoot":"","sources":["../../src/accounts/resolve-active-account.ts"],"names":[],"mappings":"AAGA,MAAM,CAAC,KAAK,UAAU,oBAAoB,CAAC,KAG1C;IACC,MAAM,QAAQ,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,YAAY,EAAE,CAAC;IAErD,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,qBAAqB,CAAC,CAAC;QACzC,MAAM,IAAI,KAAK,CAAC,qEAAqE,CAAC,CAAC;IACzF,CAAC;IAED,MAAM,cAAc,GAAG,MAAM,KAAK,CAAC,QAAQ,CAAC,iBAAiB,EAAE,CAAC;IAChE,IAAI,cAAc,EAAE,CAAC;QACnB,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,iCAAiC,EAAE;YACnD,SAAS,EAAE,cAAc,CAAC,EAAE;YAC5B,KAAK,EAAE,cAAc,CAAC,KAAK;YAC3B,YAAY,EAAE,QAAQ,CAAC,MAAM;SAC9B,CAAC,CAAC;QACH,OAAO,cAAc,CAAC;IACxB,CAAC;IAED,IAAI,QAAQ,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC1B,MAAM,CAAC,aAAa,CAAC,GAAG,QAAQ,CAAC;QACjC,IAAI,CAAC,aAAa,EAAE,CAAC;YACnB,MAAM,IAAI,KAAK,CAAC,yBAAyB,CAAC,CAAC;QAC7C,CAAC;QAED,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,wCAAwC,EAAE;YAC1D,SAAS,EAAE,aAAa,CAAC,EAAE;YAC3B,KAAK,EAAE,aAAa,CAAC,KAAK;SAC3B,CAAC,CAAC;QAEH,OAAO,KAAK,CAAC,QAAQ,CAAC,aAAa,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IACxD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAI,CAAC,gCAAgC,EAAE;QAClD,YAAY,EAAE,QAAQ,CAAC,MAAM;KAC9B,CAAC,CAAC;IACH,MAAM,IAAI,KAAK,CACb,6HAA6H,CAC9H,CAAC;AACJ,CAAC"}