@hasna/statusline 0.0.4 → 0.0.5
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 +25 -15
- package/dist/accounts.d.ts +4 -2
- package/dist/cli.js +27 -11
- package/dist/index.js +21 -5
- package/dist/mcp/index.js +21 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
Tiny, composable statusline CLI for AI coding agents. Pre-built segments you toggle
|
|
4
4
|
on and off — machine name, project + branch, model, context remaining, session cost,
|
|
5
|
-
and more — rendered as
|
|
5
|
+
and more — rendered as one or more rows in your agent's status bar.
|
|
6
6
|
|
|
7
7
|
```
|
|
8
8
|
apple03 · statusline (main) · 12h · 1.2k · fable 5 [1m] · 90% left · $0.04
|
|
@@ -14,7 +14,7 @@ Built with [Bun](https://bun.sh) + TypeScript. The CLI renderer is dependency-li
|
|
|
14
14
|
|
|
15
15
|
```bash
|
|
16
16
|
bun install -g @hasna/statusline
|
|
17
|
-
statusline install claude # wires it into
|
|
17
|
+
statusline install claude # wires it into the active Claude config dir
|
|
18
18
|
```
|
|
19
19
|
|
|
20
20
|
That's it — Claude Code picks it up on the next status refresh (no restart needed).
|
|
@@ -22,7 +22,7 @@ That's it — Claude Code picks it up on the next status refresh (no restart nee
|
|
|
22
22
|
## Segments
|
|
23
23
|
|
|
24
24
|
`statusline list` shows a compact, enabled-first summary of your segments (use
|
|
25
|
-
`statusline list --all` for every row). The table below is the full catalog — all
|
|
25
|
+
`statusline list --all` for every row). The table below is the full catalog — all 26
|
|
26
26
|
segment ids from `src/segments/index.ts`.
|
|
27
27
|
|
|
28
28
|
`renderLine` walks your configured segment order, renders each one, and **drops**
|
|
@@ -39,7 +39,8 @@ anything that returns `null` or throws. A failed segment never breaks the host U
|
|
|
39
39
|
| `current-dir` | off | Current working directory (basename) | `StatusContext.cwd` | never (always renders basename) | `open-statusline` |
|
|
40
40
|
| `model` | off | Current model name (no context tag) | `StatusContext.model.id` via friendly formatter | no model id | `fable 5` |
|
|
41
41
|
| `model-context` | on | Model name with context-size tag | same formatter, keeps `[tag]` suffix | no model id | `fable 5 [1m]` |
|
|
42
|
-
| `model-with-reasoning` | off | Model name with its reasoning effort | `model.display_name` (or friendly id) + `effort.level`; falls back to `thinking.enabled
|
|
42
|
+
| `model-with-reasoning` | off | Model name with its reasoning effort | lowercased `model.display_name` (or friendly id) + `effort.level`; falls back to `thinking.enabled` when on | no model | `fable (xhigh)` |
|
|
43
|
+
| `fast-mode` | off | Fast-mode indicator | `fastMode` in this session's Claude config-dir `settings.json` | fast mode is off or settings are unavailable | `fast` |
|
|
43
44
|
| `auth-profile` | off | Account profile this session runs as | this process's `CLAUDE_CONFIG_DIR`, resolved against the accounts registry | config dir is unmanaged and has no login | `account001` |
|
|
44
45
|
| `auth-email` | off | Account email this session is logged in as | the agent's own login record for this config dir, else the registry | no login recorded | `dev@example.com` |
|
|
45
46
|
| `five-hour-limit` | off | Percentage of the 5-hour rate limit used | `rate_limits.five_hour.used_percentage` | host reports no limit data | `5h:42%` |
|
|
@@ -49,11 +50,12 @@ anything that returns `null` or throws. A failed segment never breaks the host U
|
|
|
49
50
|
| `context-remaining` | on | Percentage of context window remaining | transcript via `contextUsage` | transcript missing/unreadable | `90% left` |
|
|
50
51
|
| `used-tokens` | off | Total tokens in the context window | transcript usage block (input + output) | transcript missing/unreadable | `102k tok` |
|
|
51
52
|
| `cost` | on | Session cost in USD | `StatusContext.cost.totalCostUsd` | cost is zero or missing | `$1,234.50` |
|
|
52
|
-
| `duration` | off | Session wall-clock duration | `StatusContext.cost.totalDurationMs` | duration missing | `1h30m` |
|
|
53
|
+
| `duration` | off | Session wall-clock duration | `StatusContext.cost.totalDurationMs` | duration is zero or missing | `1h30m` |
|
|
53
54
|
| `lines-changed` | off | Lines added/removed this session | `cost.totalLinesAdded/Removed` | both zero | `+142/-18` |
|
|
54
55
|
| `output-style` | off | Active output style | `StatusContext.outputStyle` | style is `default` or missing | `concise` |
|
|
55
56
|
| `agent-version` | off | Host agent version | `StatusContext.version` | version missing | `v2.1.39` |
|
|
56
57
|
| `session-id` | off | Session identifier (short) | first UUID segment of `sessionId` | no session id | `abc12345` |
|
|
58
|
+
| `newline` | off | Row break | renderer starts a new output row | always (the segment emits no text itself) | line break |
|
|
57
59
|
|
|
58
60
|
### Context segments and transcripts
|
|
59
61
|
|
|
@@ -103,7 +105,7 @@ registry knows about always wins.
|
|
|
103
105
|
### Colours
|
|
104
106
|
|
|
105
107
|
Segments may declare a colour, applied by `renderLine` when colours are on
|
|
106
|
-
(the default). The rate-limit segments escalate from yellow to red
|
|
108
|
+
(the default). The rate-limit segments escalate from yellow to red at 80%.
|
|
107
109
|
|
|
108
110
|
```bash
|
|
109
111
|
statusline colors off # or set "colors": false in the config
|
|
@@ -117,7 +119,7 @@ statusline colors off # or set "colors": false in the config
|
|
|
117
119
|
enabled segments first, capped rows, and hints for the detail paths:
|
|
118
120
|
|
|
119
121
|
```
|
|
120
|
-
Segments: 7 enabled /
|
|
122
|
+
Segments: 7 enabled / 26 total (showing 12 of 26)
|
|
121
123
|
state default id
|
|
122
124
|
on yes machine
|
|
123
125
|
on yes project
|
|
@@ -130,7 +132,7 @@ off no project-name
|
|
|
130
132
|
off no git-branch
|
|
131
133
|
off no current-dir
|
|
132
134
|
off no model
|
|
133
|
-
off no
|
|
135
|
+
off no model-with-reasoning
|
|
134
136
|
Hint: use `--all` for all matching rows, `statusline show <id>` for details, `--verbose` for descriptions, `--json` for machines.
|
|
135
137
|
```
|
|
136
138
|
|
|
@@ -158,6 +160,8 @@ statusbar width.
|
|
|
158
160
|
|
|
159
161
|
```bash
|
|
160
162
|
statusline list # compact segment summary
|
|
163
|
+
statusline search token --json # search ids/descriptions; list flags apply
|
|
164
|
+
statusline show model-context # show one segment in detail
|
|
161
165
|
statusline enable used-tokens duration # turn segments on (appended at the end)
|
|
162
166
|
statusline disable loc # turn segments off
|
|
163
167
|
statusline colors off # drop ANSI colours
|
|
@@ -165,6 +169,8 @@ statusline order machine project model-context cost # exact order = enabled se
|
|
|
165
169
|
statusline separator " | " # change the separator
|
|
166
170
|
statusline preview # render a sample line from the current dir
|
|
167
171
|
statusline reset # back to defaults
|
|
172
|
+
statusline install claude # update the active Claude settings file
|
|
173
|
+
statusline version # print the package version
|
|
168
174
|
```
|
|
169
175
|
|
|
170
176
|
Config lives at `~/.config/statusline/config.json` (override with `$STATUSLINE_CONFIG`):
|
|
@@ -172,6 +178,7 @@ Config lives at `~/.config/statusline/config.json` (override with `$STATUSLINE_C
|
|
|
172
178
|
```json
|
|
173
179
|
{
|
|
174
180
|
"separator": " · ",
|
|
181
|
+
"colors": true,
|
|
175
182
|
"segments": ["machine", "project", "commit-age", "loc", "model-context", "context-remaining", "cost"]
|
|
176
183
|
}
|
|
177
184
|
```
|
|
@@ -197,7 +204,8 @@ ids to the end; `statusline disable` removes them.
|
|
|
197
204
|
|
|
198
205
|
Claude Code pipes a JSON payload (cwd, model, session cost, transcript path, …) to the
|
|
199
206
|
configured `statusLine` command on every status refresh. `statusline render` parses it,
|
|
200
|
-
renders each enabled segment, drops anything unavailable, and prints one
|
|
207
|
+
renders each enabled segment, drops anything unavailable, and prints one or more rows.
|
|
208
|
+
The `newline` segment starts a new row; empty rows are removed. Segments
|
|
201
209
|
that need more than the payload offers (e.g. `context-remaining`) read the session
|
|
202
210
|
transcript to compute it. A segment failure is never fatal — it's simply omitted.
|
|
203
211
|
|
|
@@ -220,9 +228,10 @@ const next = enableSegments(["duration"], config).config;
|
|
|
220
228
|
saveConfig(next);
|
|
221
229
|
```
|
|
222
230
|
|
|
223
|
-
Useful exports include `parseClaudeInput`, `renderLine`, `
|
|
224
|
-
`defaultConfig`, `loadConfig`, `saveConfig`, `configPath`,
|
|
225
|
-
`
|
|
231
|
+
Useful exports include `parseClaudeInput`, `renderLine`, `renderStatusline`, `segments`,
|
|
232
|
+
`getSegment`, `listSegments`, `defaultConfig`, `loadConfig`, `saveConfig`, `configPath`,
|
|
233
|
+
`previewStatusline`, `enableSegments`, `disableSegments`, `orderSegments`,
|
|
234
|
+
`setSeparator`, `setColors`, `installClaude`, and the account, context, format, and Git helpers.
|
|
226
235
|
|
|
227
236
|
## MCP
|
|
228
237
|
|
|
@@ -232,7 +241,7 @@ Useful exports include `parseClaudeInput`, `renderLine`, `segments`, `getSegment
|
|
|
232
241
|
statusline-mcp
|
|
233
242
|
```
|
|
234
243
|
|
|
235
|
-
It exposes safe tools for `render_statusline`, `preview_statusline`,
|
|
244
|
+
It exposes safe tools for `statusline_health`, `render_statusline`, `preview_statusline`,
|
|
236
245
|
`list_segments`, `get_config`, `update_config`, `enable_segments`,
|
|
237
246
|
`disable_segments`, `order_segments`, and `reset_config`. Config mutation tools
|
|
238
247
|
require `confirm_write: true`; every mutation tool supports `dry_run: true`.
|
|
@@ -250,8 +259,9 @@ bun install -g @hasna/statusline
|
|
|
250
259
|
statusline install claude
|
|
251
260
|
```
|
|
252
261
|
|
|
253
|
-
`installClaude()` writes to `$CLAUDE_CONFIG_DIR/settings.json
|
|
254
|
-
`~/.claude/settings.json`.
|
|
262
|
+
`installClaude()` writes to `$CLAUDE_CONFIG_DIR/settings.json` when the variable is
|
|
263
|
+
non-blank, falling back to `~/.claude/settings.json`. A leading `~/` in
|
|
264
|
+
`CLAUDE_CONFIG_DIR` is expanded against `$HOME`. This matters for multi-account setups: when a session is
|
|
255
265
|
bound to an isolated config dir, `~/.claude/settings.json` is never read, so
|
|
256
266
|
installing there wires up a statusline that silently never runs.
|
|
257
267
|
|
package/dist/accounts.d.ts
CHANGED
|
@@ -23,9 +23,11 @@ export interface SessionAccount {
|
|
|
23
23
|
/**
|
|
24
24
|
* How `profile` was resolved. `"layout"` means it was read off the dir path
|
|
25
25
|
* rather than the registry, which is authoritative about the dir but can lag
|
|
26
|
-
* a rename — see `layoutProfile`.
|
|
26
|
+
* a rename — see `layoutProfile`. `"switched"` means an in-place
|
|
27
|
+
* `switch-account` marker named another profile's account as the dir's
|
|
28
|
+
* current occupant. Surfaced for diagnostics, not for display.
|
|
27
29
|
*/
|
|
28
|
-
source: "registry" | "layout" | null;
|
|
30
|
+
source: "registry" | "layout" | "switched" | null;
|
|
29
31
|
}
|
|
30
32
|
type Env = Record<string, string | undefined>;
|
|
31
33
|
/** Config dir the current process is bound to, for settings and registry lookup. */
|
package/dist/cli.js
CHANGED
|
@@ -243,6 +243,8 @@ var ACCOUNTS_HOME_ENV = "ACCOUNTS_HOME";
|
|
|
243
243
|
var DEFAULT_ACCOUNTS_HOME = [".hasna", "accounts"];
|
|
244
244
|
var STORE_FILE = "accounts.json";
|
|
245
245
|
var PROFILES_SUBDIR = "profiles";
|
|
246
|
+
var AUTH_STATE_SUBDIR = ".accounts-auth";
|
|
247
|
+
var SWITCHED_ACCOUNT_MARKER_FILE = "switched-account.json";
|
|
246
248
|
var STATE_FILE_PREFERRED = ".config.json";
|
|
247
249
|
var STATE_FILE_PREFIX = ".claude";
|
|
248
250
|
var STATE_FILE_SUFFIX = ".json";
|
|
@@ -329,6 +331,14 @@ function layoutProfile(profilesRoot, configDir, env) {
|
|
|
329
331
|
return null;
|
|
330
332
|
return { configDir, profile, tool, source: "layout" };
|
|
331
333
|
}
|
|
334
|
+
function switchedOccupant(configDir) {
|
|
335
|
+
const raw = readJson(join2(configDir, AUTH_STATE_SUBDIR, SWITCHED_ACCOUNT_MARKER_FILE));
|
|
336
|
+
if (!raw)
|
|
337
|
+
return null;
|
|
338
|
+
const profile = str(raw.profile);
|
|
339
|
+
const email = str(raw.email);
|
|
340
|
+
return profile || email ? { profile, email } : null;
|
|
341
|
+
}
|
|
332
342
|
function sessionConfigDir(env = process.env) {
|
|
333
343
|
return canonical(str(env[CONFIG_DIR_ENV]) ?? join2(home(env), DEFAULT_CONFIG_SUBDIR), env);
|
|
334
344
|
}
|
|
@@ -352,9 +362,11 @@ async function sessionAccount(env = process.env, tool) {
|
|
|
352
362
|
const paths = await accountsPaths(env);
|
|
353
363
|
const entry = registryEntry(paths.store, configDir, env, tool);
|
|
354
364
|
const name = str(entry?.name);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
365
|
+
const owner = name ? { configDir, profile: name, tool: str(entry?.tool), source: "registry" } : layoutProfile(paths.profiles, configDir, env) ?? unresolved;
|
|
366
|
+
const occupant = switchedOccupant(configDir);
|
|
367
|
+
if (occupant)
|
|
368
|
+
return { configDir, profile: occupant.profile, tool: owner.tool, source: "switched" };
|
|
369
|
+
return owner;
|
|
358
370
|
} catch {
|
|
359
371
|
return unresolved;
|
|
360
372
|
}
|
|
@@ -365,8 +377,12 @@ async function sessionAccountEmail(env = process.env, tool) {
|
|
|
365
377
|
const live = stateFile ? str(readJson(stateFile)?.oauthAccount?.emailAddress) : null;
|
|
366
378
|
if (live)
|
|
367
379
|
return live;
|
|
380
|
+
const configDir = sessionConfigDir(env);
|
|
381
|
+
const occupant = switchedOccupant(configDir);
|
|
382
|
+
if (occupant)
|
|
383
|
+
return occupant.email;
|
|
368
384
|
const paths = await accountsPaths(env);
|
|
369
|
-
return str(registryEntry(paths.store,
|
|
385
|
+
return str(registryEntry(paths.store, configDir, env, tool)?.email);
|
|
370
386
|
} catch {
|
|
371
387
|
return null;
|
|
372
388
|
}
|
|
@@ -694,7 +710,7 @@ async function renderLine(ctx, cfg) {
|
|
|
694
710
|
// package.json
|
|
695
711
|
var package_default = {
|
|
696
712
|
name: "@hasna/statusline",
|
|
697
|
-
version: "0.0.
|
|
713
|
+
version: "0.0.5",
|
|
698
714
|
description: "Tiny composable statusline CLI for AI coding agents \u2014 pre-built toggleable segments for Claude Code, with a provider model for others",
|
|
699
715
|
license: "Apache-2.0",
|
|
700
716
|
type: "module",
|
|
@@ -906,11 +922,11 @@ run \`statusline list\` to see available segments`);
|
|
|
906
922
|
process.exitCode = 1;
|
|
907
923
|
}
|
|
908
924
|
function help() {
|
|
909
|
-
return `statusline ${statuslineVersion} \u2014 composable
|
|
925
|
+
return `statusline ${statuslineVersion} \u2014 composable status rows for AI coding agents
|
|
910
926
|
|
|
911
927
|
usage:
|
|
912
|
-
statusline render read agent JSON on stdin, print
|
|
913
|
-
statusline list
|
|
928
|
+
statusline render read agent JSON on stdin, print status rows (default)
|
|
929
|
+
statusline list [search text] compact segment list (default limit: ${DEFAULT_LIST_LIMIT})
|
|
914
930
|
statusline list --verbose include descriptions
|
|
915
931
|
statusline list --all show all rows
|
|
916
932
|
statusline list --json machine-readable segment list
|
|
@@ -918,8 +934,8 @@ usage:
|
|
|
918
934
|
statusline list --enabled show only enabled segments
|
|
919
935
|
statusline list --disabled show only disabled segments
|
|
920
936
|
statusline list --search text filter by id or description
|
|
921
|
-
statusline search <text> alias for list --search
|
|
922
|
-
statusline show <id> show one segment in detail
|
|
937
|
+
statusline search <text> alias for list --search (accepts list options)
|
|
938
|
+
statusline show <id> show one segment in detail (--json supported)
|
|
923
939
|
statusline show <id> --json machine-readable segment detail
|
|
924
940
|
statusline inspect <id> alias for show
|
|
925
941
|
statusline enable <id...> enable segments (appended to the end)
|
|
@@ -929,7 +945,7 @@ usage:
|
|
|
929
945
|
statusline colors <on|off> toggle segment colours (default on)
|
|
930
946
|
statusline preview render with a sample payload from the current directory
|
|
931
947
|
statusline reset restore default config
|
|
932
|
-
statusline install [claude] wire into Claude Code
|
|
948
|
+
statusline install [claude] wire into the active Claude Code settings file
|
|
933
949
|
statusline version print version
|
|
934
950
|
|
|
935
951
|
config: ${configPath()}`;
|
package/dist/index.js
CHANGED
|
@@ -242,6 +242,8 @@ var ACCOUNTS_HOME_ENV = "ACCOUNTS_HOME";
|
|
|
242
242
|
var DEFAULT_ACCOUNTS_HOME = [".hasna", "accounts"];
|
|
243
243
|
var STORE_FILE = "accounts.json";
|
|
244
244
|
var PROFILES_SUBDIR = "profiles";
|
|
245
|
+
var AUTH_STATE_SUBDIR = ".accounts-auth";
|
|
246
|
+
var SWITCHED_ACCOUNT_MARKER_FILE = "switched-account.json";
|
|
245
247
|
var STATE_FILE_PREFERRED = ".config.json";
|
|
246
248
|
var STATE_FILE_PREFIX = ".claude";
|
|
247
249
|
var STATE_FILE_SUFFIX = ".json";
|
|
@@ -328,6 +330,14 @@ function layoutProfile(profilesRoot, configDir, env) {
|
|
|
328
330
|
return null;
|
|
329
331
|
return { configDir, profile, tool, source: "layout" };
|
|
330
332
|
}
|
|
333
|
+
function switchedOccupant(configDir) {
|
|
334
|
+
const raw = readJson(join2(configDir, AUTH_STATE_SUBDIR, SWITCHED_ACCOUNT_MARKER_FILE));
|
|
335
|
+
if (!raw)
|
|
336
|
+
return null;
|
|
337
|
+
const profile = str(raw.profile);
|
|
338
|
+
const email = str(raw.email);
|
|
339
|
+
return profile || email ? { profile, email } : null;
|
|
340
|
+
}
|
|
331
341
|
function sessionConfigDir(env = process.env) {
|
|
332
342
|
return canonical(str(env[CONFIG_DIR_ENV]) ?? join2(home(env), DEFAULT_CONFIG_SUBDIR), env);
|
|
333
343
|
}
|
|
@@ -351,9 +361,11 @@ async function sessionAccount(env = process.env, tool) {
|
|
|
351
361
|
const paths = await accountsPaths(env);
|
|
352
362
|
const entry = registryEntry(paths.store, configDir, env, tool);
|
|
353
363
|
const name = str(entry?.name);
|
|
354
|
-
|
|
355
|
-
|
|
356
|
-
|
|
364
|
+
const owner = name ? { configDir, profile: name, tool: str(entry?.tool), source: "registry" } : layoutProfile(paths.profiles, configDir, env) ?? unresolved;
|
|
365
|
+
const occupant = switchedOccupant(configDir);
|
|
366
|
+
if (occupant)
|
|
367
|
+
return { configDir, profile: occupant.profile, tool: owner.tool, source: "switched" };
|
|
368
|
+
return owner;
|
|
357
369
|
} catch {
|
|
358
370
|
return unresolved;
|
|
359
371
|
}
|
|
@@ -364,8 +376,12 @@ async function sessionAccountEmail(env = process.env, tool) {
|
|
|
364
376
|
const live = stateFile ? str(readJson(stateFile)?.oauthAccount?.emailAddress) : null;
|
|
365
377
|
if (live)
|
|
366
378
|
return live;
|
|
379
|
+
const configDir = sessionConfigDir(env);
|
|
380
|
+
const occupant = switchedOccupant(configDir);
|
|
381
|
+
if (occupant)
|
|
382
|
+
return occupant.email;
|
|
367
383
|
const paths = await accountsPaths(env);
|
|
368
|
-
return str(registryEntry(paths.store,
|
|
384
|
+
return str(registryEntry(paths.store, configDir, env, tool)?.email);
|
|
369
385
|
} catch {
|
|
370
386
|
return null;
|
|
371
387
|
}
|
|
@@ -693,7 +709,7 @@ async function renderLine(ctx, cfg) {
|
|
|
693
709
|
// package.json
|
|
694
710
|
var package_default = {
|
|
695
711
|
name: "@hasna/statusline",
|
|
696
|
-
version: "0.0.
|
|
712
|
+
version: "0.0.5",
|
|
697
713
|
description: "Tiny composable statusline CLI for AI coding agents \u2014 pre-built toggleable segments for Claude Code, with a provider model for others",
|
|
698
714
|
license: "Apache-2.0",
|
|
699
715
|
type: "module",
|
package/dist/mcp/index.js
CHANGED
|
@@ -243,6 +243,8 @@ var ACCOUNTS_HOME_ENV = "ACCOUNTS_HOME";
|
|
|
243
243
|
var DEFAULT_ACCOUNTS_HOME = [".hasna", "accounts"];
|
|
244
244
|
var STORE_FILE = "accounts.json";
|
|
245
245
|
var PROFILES_SUBDIR = "profiles";
|
|
246
|
+
var AUTH_STATE_SUBDIR = ".accounts-auth";
|
|
247
|
+
var SWITCHED_ACCOUNT_MARKER_FILE = "switched-account.json";
|
|
246
248
|
var STATE_FILE_PREFERRED = ".config.json";
|
|
247
249
|
var STATE_FILE_PREFIX = ".claude";
|
|
248
250
|
var STATE_FILE_SUFFIX = ".json";
|
|
@@ -329,6 +331,14 @@ function layoutProfile(profilesRoot, configDir, env) {
|
|
|
329
331
|
return null;
|
|
330
332
|
return { configDir, profile, tool, source: "layout" };
|
|
331
333
|
}
|
|
334
|
+
function switchedOccupant(configDir) {
|
|
335
|
+
const raw = readJson(join2(configDir, AUTH_STATE_SUBDIR, SWITCHED_ACCOUNT_MARKER_FILE));
|
|
336
|
+
if (!raw)
|
|
337
|
+
return null;
|
|
338
|
+
const profile = str(raw.profile);
|
|
339
|
+
const email = str(raw.email);
|
|
340
|
+
return profile || email ? { profile, email } : null;
|
|
341
|
+
}
|
|
332
342
|
function sessionConfigDir(env = process.env) {
|
|
333
343
|
return canonical(str(env[CONFIG_DIR_ENV]) ?? join2(home(env), DEFAULT_CONFIG_SUBDIR), env);
|
|
334
344
|
}
|
|
@@ -352,9 +362,11 @@ async function sessionAccount(env = process.env, tool) {
|
|
|
352
362
|
const paths = await accountsPaths(env);
|
|
353
363
|
const entry = registryEntry(paths.store, configDir, env, tool);
|
|
354
364
|
const name = str(entry?.name);
|
|
355
|
-
|
|
356
|
-
|
|
357
|
-
|
|
365
|
+
const owner = name ? { configDir, profile: name, tool: str(entry?.tool), source: "registry" } : layoutProfile(paths.profiles, configDir, env) ?? unresolved;
|
|
366
|
+
const occupant = switchedOccupant(configDir);
|
|
367
|
+
if (occupant)
|
|
368
|
+
return { configDir, profile: occupant.profile, tool: owner.tool, source: "switched" };
|
|
369
|
+
return owner;
|
|
358
370
|
} catch {
|
|
359
371
|
return unresolved;
|
|
360
372
|
}
|
|
@@ -365,8 +377,12 @@ async function sessionAccountEmail(env = process.env, tool) {
|
|
|
365
377
|
const live = stateFile ? str(readJson(stateFile)?.oauthAccount?.emailAddress) : null;
|
|
366
378
|
if (live)
|
|
367
379
|
return live;
|
|
380
|
+
const configDir = sessionConfigDir(env);
|
|
381
|
+
const occupant = switchedOccupant(configDir);
|
|
382
|
+
if (occupant)
|
|
383
|
+
return occupant.email;
|
|
368
384
|
const paths = await accountsPaths(env);
|
|
369
|
-
return str(registryEntry(paths.store,
|
|
385
|
+
return str(registryEntry(paths.store, configDir, env, tool)?.email);
|
|
370
386
|
} catch {
|
|
371
387
|
return null;
|
|
372
388
|
}
|
|
@@ -694,7 +710,7 @@ async function renderLine(ctx, cfg) {
|
|
|
694
710
|
// package.json
|
|
695
711
|
var package_default = {
|
|
696
712
|
name: "@hasna/statusline",
|
|
697
|
-
version: "0.0.
|
|
713
|
+
version: "0.0.5",
|
|
698
714
|
description: "Tiny composable statusline CLI for AI coding agents \u2014 pre-built toggleable segments for Claude Code, with a provider model for others",
|
|
699
715
|
license: "Apache-2.0",
|
|
700
716
|
type: "module",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hasna/statusline",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.5",
|
|
4
4
|
"description": "Tiny composable statusline CLI for AI coding agents \u2014 pre-built toggleable segments for Claude Code, with a provider model for others",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|