Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
145 commits
Select commit Hold shift + click to select a range
da1d321
feat: [ENG-2611] add analytics field to GlobalConfig
bao-byterover May 5, 2026
c2b5450
Merge branch 'feat/ENG-2611' into proj/analytics-system
bao-byterover May 5, 2026
21c1b2a
feat: [ENG-2612] add brv analytics status command
bao-byterover May 5, 2026
f864364
Merge branch 'feat/ENG-2612' into proj/analytics-system
bao-byterover May 5, 2026
ee1daae
feat: [ENG-2613] add brv analytics enable / disable commands
bao-byterover May 5, 2026
b4f0073
Merge branch 'feat/ENG-2613' into proj/analytics-system
bao-byterover May 6, 2026
482933c
feat: [ENG-2618] add disclosure UX wrapper to brv analytics enable
bao-byterover May 6, 2026
2e3520f
Merge branch 'feat/ENG-2618' into proj/analytics-system
bao-byterover May 6, 2026
ca2e715
feat: [ENG-2618] address review feedback on M1 analytics work
bao-byterover May 6, 2026
27de472
feat: [ENG-2623] add analytics domain types + IAnalyticsClient + no-op
bao-byterover May 6, 2026
94762a9
Merge branch 'feat/ENG-2623' into proj/analytics-system
bao-byterover May 6, 2026
9286c59
feat: [ENG-2624] add bounded analytics queue with drop-oldest semantics
bao-byterover May 6, 2026
9ec0ddf
Merge branch 'feat/ENG-2624' into proj/analytics-system
bao-byterover May 6, 2026
a27cd33
feat: [ENG-2625] add super-properties resolver
bao-byterover May 6, 2026
c92ec48
Merge branch 'feat/ENG-2625' into proj/analytics-system
bao-byterover May 6, 2026
2c055e7
feat: [ENG-2626] add identity resolver
bao-byterover May 6, 2026
72b9c4a
Merge branch 'feat/ENG-2626' into proj/analytics-system
bao-byterover May 6, 2026
05baa76
feat: [ENG-2627] add daemon analytics client + daemon_start sample
bao-byterover May 6, 2026
30a57b9
feat: [ENG-2627] address second-pass review on daemon analytics client
bao-byterover May 7, 2026
3aba6ba
Merge branch 'feat/ENG-2627' into proj/analytics-system
bao-byterover May 7, 2026
ff6453e
feat: [ENG-2628] add analytics:track transport event + handler + helper
bao-byterover May 7, 2026
aedbd7e
Merge branch 'feat/ENG-2628' into proj/analytics-system
bao-byterover May 7, 2026
34c8aa2
feat: [ENG-2686] add per-event analytics schema catalog (M2.8)
bao-byterover May 8, 2026
b69f226
feat: [ENG-2686] harden M2.8 catalog (Zod guards, typed emit, privacy…
bao-byterover May 8, 2026
fc1e982
Merge branch 'feat/ENG-2686' into proj/analytics-system
bao-byterover May 8, 2026
0530002
feat: [ENG-2723] add StoredAnalyticsRecord domain type for M9.1
bao-byterover May 10, 2026
b43b8e9
Merge branch 'feat/ENG-2723' into proj/analytics-system
bao-byterover May 10, 2026
caab092
feat: [ENG-2724] add JsonlAnalyticsStore for M9.2 durable persistence
bao-byterover May 10, 2026
d5cd676
Merge branch 'feat/ENG-2724' into proj/analytics-system
bao-byterover May 10, 2026
de4153e
feat: [ENG-2725] wire JsonlAnalyticsStore into AnalyticsClient.trackA…
bao-byterover May 10, 2026
6b0a043
Merge branch 'feat/ENG-2725' into proj/analytics-system
bao-byterover May 10, 2026
6f00cbf
fix: [ENG-2724] tighten JSONL=truth invariant via JsonlCapFullError
bao-byterover May 10, 2026
91246c6
feat: [ENG-2727] add IAnalyticsSender + NoOpAnalyticsSender (M10.1)
bao-byterover May 10, 2026
e50749c
Merge branch 'feat/ENG-2727' into proj/analytics-system
bao-byterover May 10, 2026
da71e34
feat: [ENG-2729] wire AnalyticsClient.flush to read from JSONL via se…
bao-byterover May 10, 2026
501e464
Merge branch 'feat/ENG-2729' into proj/analytics-system
bao-byterover May 10, 2026
6bc1573
feat: [ENG-2730] verify retry-cap composition end-to-end (M10.3)
bao-byterover May 10, 2026
8ac2e0c
Merge branch 'feat/ENG-2730' into proj/analytics-system
bao-byterover May 10, 2026
8d3e406
feat: [ENG-2726] add analytics:list transport event + Zod schemas (M1…
bao-byterover May 10, 2026
158c61e
Merge branch 'feat/ENG-2726' into proj/analytics-system
bao-byterover May 10, 2026
9af05c9
feat: [ENG-2728] add AnalyticsListHandler for analytics:list (M11.2)
bao-byterover May 10, 2026
dbe7877
Merge branch 'feat/ENG-2728' into proj/analytics-system
bao-byterover May 10, 2026
99ae29b
fix: [ENG-2729] single-flight guard for AnalyticsClient.flush
bao-byterover May 11, 2026
b384ba6
Merge branch 'main' into proj/analytics-system
bao-byterover May 11, 2026
12fe5d5
fix: address branch audit findings (D1 race + shared/server layering)
bao-byterover May 11, 2026
da09162
feat: [ENG-2770] M12.1 add curate_operation_applied + curate_run_comp…
bao-byterover May 12, 2026
bbdce90
Merge feat/ENG-2770 (M12.1) into proj/analytics-system
bao-byterover May 12, 2026
f4fcb20
feat: [ENG-2771] M12.2 add AnalyticsHook lifecycle hook + wire into d…
bao-byterover May 12, 2026
31a67d2
Merge feat/ENG-2771 (M12.2) into proj/analytics-system
bao-byterover May 12, 2026
0ddc33b
feat: [ENG-2772] M12.3 add daemon-side frontmatter harvest in Analyti…
bao-byterover May 12, 2026
1fae4c8
Merge feat/ENG-2772 (M12.3) into proj/analytics-system
bao-byterover May 12, 2026
9212ed3
fix: [ENG-2772] address CLAUDE.md compliance findings from M12 post-m…
bao-byterover May 13, 2026
e0cbf50
Merge fix/ENG-2772 (M12 post-merge cleanup) into proj/analytics-system
bao-byterover May 13, 2026
88a6756
feat: [ENG-2805] M13.1 Phase A: shared cli_metadata schema + buildCli…
bao-byterover May 13, 2026
f83aac0
feat: [ENG-2805] M13.1 Phase B: wire cli_metadata end-to-end on task:…
bao-byterover May 13, 2026
149632f
Merge feat/ENG-2805 (M13.1 Phase B: cli_metadata end-to-end on task:c…
bao-byterover May 13, 2026
3f30886
fix: [ENG-2805] roll back daemon-side cli_invocation emit (M13 scope:…
bao-byterover May 13, 2026
455b421
Merge fix/ENG-2805 (roll back daemon-side cli_invocation emit; M13 sc…
bao-byterover May 13, 2026
1d4578b
feat: [ENG-2806] M13.2 schema sweep — extend all client-originated re…
bao-byterover May 13, 2026
552d25a
Merge feat/ENG-2806 (M13.2 schema sweep — extend all client-originate…
bao-byterover May 13, 2026
cc14a76
feat: [ENG-2807] M13.3 batch 1 — attach cli_metadata to 4 top-level o…
bao-byterover May 13, 2026
62dd169
feat: [ENG-2807] M13.3 batch 2 — attach cli_metadata to dream + login
bao-byterover May 13, 2026
c4da6a4
Merge feat/ENG-2807 (M13.3 partial: 6/~78 oclif commands swept — top-…
bao-byterover May 13, 2026
4488ee5
fix: typed IAnalyticsClient.track + per-event wire Zod + non-null ass…
bao-byterover May 14, 2026
47abf81
fix: address review findings (compactRows O(n²), setAnalytics race, f…
bao-byterover May 18, 2026
4fd67d4
fix: async TaskLifecycleHook.onToolResult + per-task queue + two-pass…
bao-byterover May 18, 2026
0d6d7be
feat: [ENG-2621] add analytics settings panel to webui Configuration …
ncnthien May 18, 2026
2fcb6db
feat: [ENG-2621] address PR review feedback
ncnthien May 18, 2026
e48f833
feat: [ENG-2621] drop staleTime override on globalConfig query
ncnthien May 18, 2026
80a8172
Merge pull request #670 from campfirein/feat/ENG-2621
ncnthien May 19, 2026
c772e0d
feat: [ENG-2642] M4.1 clear analytics queue on auth identity transition
bao-byterover May 21, 2026
561a190
Merge branch 'feat/ENG-2642' into proj/analytics-system
bao-byterover May 21, 2026
a88c0cc
feat: [ENG-2643] M4.2 HTTP sender wires daemon flush to telemetry bac…
bao-byterover May 21, 2026
01b3018
Merge branch 'feat/ENG-2643' into proj/analytics-system
bao-byterover May 21, 2026
bc55a00
feat: [ENG-2645] M4.3 batched flush scheduler (30s / 20-event / shutd…
bao-byterover May 21, 2026
13fc250
fix: [ENG-2645] notifyPushed gates on queue-size delta, not absolute …
bao-byterover May 21, 2026
36f9003
Merge branch 'feat/ENG-2645' into proj/analytics-system
bao-byterover May 21, 2026
db2a2b5
feat: [ENG-2646] M4.4 auth-transition force-flush + disable aborts in…
bao-byterover May 21, 2026
b927c2c
Merge branch 'feat/ENG-2646' into proj/analytics-system
bao-byterover May 22, 2026
80c0243
feat: [ENG-2647] M4.5 exponential backoff + endpoint reachability cou…
bao-byterover May 22, 2026
650d33b
Merge branch 'feat/ENG-2647' into proj/analytics-system
bao-byterover May 22, 2026
b5b30af
feat: [ENG-2648] M4.6 brv analytics status surfaces operational metrics
bao-byterover May 22, 2026
40d1941
fix: [ENG-2648] humanize backoff line in `brv analytics status` text
bao-byterover May 22, 2026
409e5f1
Merge branch 'feat/ENG-2648' into proj/analytics-system
bao-byterover May 22, 2026
a264894
feat: [ENG-2649] M4.7 rewrite e2e analytics harness as single mocha file
bao-byterover May 24, 2026
62c71a2
feat: [ENG-2649] M4.7 scenario 5 backend recovery half via accept-proxy
bao-byterover May 25, 2026
b7feab4
Merge branch 'feat/ENG-2649' into proj/analytics-system
bao-byterover May 25, 2026
651beee
Merge branch 'main' into proj/analytics-system
bao-byterover May 25, 2026
785293f
chore: fix: conflict resolve proj/analytics-system
bao-byterover May 25, 2026
e3ffe58
Merge branch 'proj/analytics-system' into proj/analytics-system-tool-…
bao-byterover May 26, 2026
b09388b
feat: [ENG-2961] M15.1 foundation + lifecycle outcome taxonomy
bao-byterover May 27, 2026
25a3e52
fix: [ENG-2961] M15.1 review follow-ups + drop milestone markers
bao-byterover May 27, 2026
e5117f7
Merge branch 'feat/ENG-2961' into proj/analytics-system-tool-mode
bao-byterover May 27, 2026
da6abef
feat: [ENG-2966] M15.2 activation sweep — init + connectors + hub emits
bao-byterover May 27, 2026
daa552c
Merge branch 'feat/ENG-2966' into proj/analytics-system-tool-mode
bao-byterover May 27, 2026
3a297dc
feat: [ENG-2962] M15.3 VC + project-structure analytics sweep
bao-byterover May 27, 2026
ceb116b
Merge branch 'feat/ENG-2962' into proj/analytics-system-tool-mode
bao-byterover May 27, 2026
6f24ed9
feat: [ENG-2967] M15.4 HITL review + settings + context-tree + reset …
bao-byterover May 27, 2026
4449b45
Merge branch 'feat/ENG-2967' into proj/analytics-system-tool-mode
bao-byterover May 27, 2026
8061c94
feat: [ENG-2963] M15.5 WebUI session lifecycle emits
bao-byterover May 27, 2026
f7c691b
Feat/eng 2964 (#722)
cuongdo-byterover May 27, 2026
8445e7f
Merge branch 'feat/ENG-2963' into proj/analytics-system-tool-mode
bao-byterover May 27, 2026
9d09401
Merge branch 'proj/byterover-tool-mode' into proj/analytics-system-to…
bao-byterover May 27, 2026
2f418cc
Feat/eng 2964 (#725)
cuongdo-byterover May 28, 2026
25bf638
feat: [ENG-3001] M15.8 wire deferred-shipped analytics events
bao-byterover May 28, 2026
d4ea974
Merge branch 'feat/ENG-3001' into proj/analytics-system-tool-mode
bao-byterover May 28, 2026
0ef9088
Merge branch 'main' into proj/analytics-system-tool-mode
bao-byterover May 28, 2026
cfa89da
fix: fix lost analytics panel when merge
bao-byterover May 28, 2026
e3d5680
feat: [ENG-3003] add readonly-info descriptor variant to settings fra…
bao-byterover May 28, 2026
d53dd9b
feat: [ENG-3008] add migrate_run analytics event for brv migrate (#727)
bao-byterover May 28, 2026
2420a5b
Fix/eng 3011 (#728)
cuongdo-byterover May 28, 2026
f60e219
feat: [ENG-3005] expose analytics operational snapshot as brv setting…
bao-byterover May 28, 2026
8dc7d0b
Merge branch 'feat/ENG-3005' into proj/analytics-system-tool-mode
bao-byterover May 28, 2026
3120a17
feat: [ENG-2621] move AnalyticsPanel from General to a new Privacy tab
ncnthien May 28, 2026
59f3129
Merge pull request #729 from campfirein/feat/ENG-2621
ncnthien May 28, 2026
68b528e
feat: [ENG-3012] M16.8 add content_migrated analytics event schema
cuongdo-byterover May 28, 2026
4c32318
feat: [ENG-3015] M16.11 add swarm_onboarded analytics event schema
cuongdo-byterover May 28, 2026
cd33c75
feat: [ENG-3013] M16.9 add swarm_query_completed analytics event schema
cuongdo-byterover May 28, 2026
d2259b8
feat: [ENG-3014] M16.10 add swarm_store_completed analytics event schema
cuongdo-byterover May 28, 2026
88ad6e6
feat: [ENG-3013/3014/3015] add SwarmHandler daemon transport for swar…
cuongdo-byterover May 28, 2026
6e02664
Merge branch 'proj/analytics-system-tool-mode' into feat/ENG-3012
cuongdo-byterover May 28, 2026
39b6ee2
feat: [ENG-3006] no-fallback resolution for BRV_ANALYTICS_BASE_URL
bao-byterover May 28, 2026
b6204b7
Merge branch 'feat/ENG-3006' into proj/analytics-system-tool-mode
bao-byterover May 28, 2026
ecff891
fix: [ENG-3013/3014/3015] address PR #730 review on SwarmHandler
cuongdo-byterover May 28, 2026
e24c780
Merge branch 'feat/ENG-3012' of github.com:campfirein/byterover-cli i…
cuongdo-byterover May 28, 2026
d2fd66f
Merge branch 'proj/analytics-system-tool-mode' into feat/ENG-3012
cuongdo-byterover May 28, 2026
01a6390
Merge pull request #730 from campfirein/feat/ENG-3012
cuongdo-byterover May 28, 2026
88120b8
feat(ENG-2605): add post-tour analytics sharing opt-in
wzlng May 28, 2026
2e37fec
feat: [ENG-3010] replace wire timestamp with created_at (ISO 8601) (#…
bao-byterover May 29, 2026
b94829c
feat: [ENG-3020] stamp space_id on curate_run_completed + query_compl…
cuongdo-byterover May 29, 2026
4229052
fix: [ENG-3020] keep explicit return type on AnalyticsHook getSpaceId…
cuongdo-byterover May 29, 2026
1e035ff
Merge branch 'proj/analytics-system-tool-mode' into feat/onboarding-s…
wzlng May 29, 2026
bc713e4
Merge pull request #731 from campfirein/feat/onboarding-share-analyti…
wzlng May 29, 2026
3568d4b
Feat/eng 3010 (#737)
bao-byterover May 29, 2026
525ff57
feat: [ENG-3020] also stamp team_id on curate_run_completed + query_c…
cuongdo-byterover May 29, 2026
1eeaf8c
Merge branch 'proj/analytics-system-tool-mode' into feat/ENG-3020
cuongdo-byterover May 29, 2026
7c247e0
fix: [ENG-3020] address PR #739 review on AnalyticsHook structure
cuongdo-byterover May 29, 2026
bb97597
Merge pull request #739 from campfirein/feat/ENG-3020
cuongdo-byterover May 29, 2026
c6f7ccd
Feat/eng 3007 (#734)
bao-byterover May 29, 2026
6b7ee29
Feat/eng 3019 (#740)
bao-byterover May 29, 2026
5d96619
feat: [ENG-2621] open the analytics disclosure by default in the Priv…
ncnthien May 30, 2026
3263474
Feat/eng 2658 (#743)
bao-byterover May 30, 2026
28672fb
Merge branch 'main' into proj/analytics-system-tool-mode
bao-byterover May 30, 2026
5364e7d
fix: address PR #726 review — analytics settings category, wire .stri…
bao-byterover May 30, 2026
0f44a29
feat: [ENG-3035] rename user-facing analytics setting key analytics.e…
bao-byterover May 30, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
1 change: 1 addition & 0 deletions .env.example
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,5 @@ BRV_GIT_REMOTE_BASE_URL=http://localhost:8080
BRV_LLM_BASE_URL=http://localhost:3002
BRV_WEB_APP_URL=http://localhost:8080
BRV_BILLING_BASE_URL=http://localhost:3003
BRV_ANALYTICS_BASE_URL=http://localhost:3004
BRV_UI_SOURCE=lib
55 changes: 55 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -168,6 +168,61 @@ npm run dev:ui:package # Vite dev server resolving shared UI from
- **HTTP (nock)**: Must verify `.matchHeader('authorization', ...)` + `.matchHeader('x-byterover-session-id', ...)`
- **ES Modules**: Cannot stub ES exports with sinon; test utils with real filesystem (`tmpdir()`)

### M4.7 — analytics e2e against dev-beta (`test/e2e/analytics/dev-beta.e2e.ts`)

End-to-end smoke for the analytics pipeline (M4.1 -> M4.6). One mocha file that spins up an isolated daemon per scenario under a temp `BRV_DATA_DIR` plus a temp `HOME`, exercises one slice via the real `bin/run.js`, and asserts on JSONL `status` transitions plus scenario-specific runtime state. NOT picked up by `npm test` (glob is `test/**/*.test.ts`; this file is `.e2e.ts`).

**Run modes**:

```bash
npm run test:e2e:analytics # all auto scenarios (transition skipped by default)
npm run test:e2e:analytics -- --grep "1 happy" # single scenario
BRV_E2E_TRANSITION=1 npm run test:e2e:analytics -- --grep transition # interactive login scenario
BRV_ANALYTICS_BASE_URL=http://127.0.0.1:3001 npm run test:e2e:analytics # override backend (e.g. local telemetry)
```

The npm script chains `npm run build && mocha ...` so `dist/` is always fresh when the test starts.

Scenarios covered (`describe` names):

1. `happy` — opt in, emit 1 event, ship within 35s
2. `burst` — 25 events via `analytics:track`, 20-event threshold flush
3. `idle` — 1 event, wait 45s for the interval flush
4. `transition` — anon -> `brv login` -> authed; interactive, gated on `BRV_E2E_TRANSITION=1`
5. `down` — backend down via inline drop-proxy on a random port; failed flush + backoff counters move
6. `disable` — ship 1 baseline, disable, queue more, no further ships

**Prereqs**:

- `npm install` (so `bin/run.js` and `node_modules/.bin` are present). `npm link` is NOT required: the test spawns `node <repo>/bin/run.js` directly so it always exercises THIS checkout.
- `npm run build` is chained in front of mocha inside the npm script; you only need to run it manually if you invoke `mocha` directly without going through `npm run test:e2e:analytics`.
- Network access to `dev-beta-iam.byterover.dev` and `telemetry-dev.byterover.dev` (the test defaults `BRV_ANALYTICS_BASE_URL` + `BRV_IAM_BASE_URL` to those; override via env to point at a different backend).
- **Backend on the M4.x wire format**: this CLI sends each event's `created_at` as an ISO 8601 string with a timezone designator (e.g. `2026-05-28T21:32:11+07:00` or `...Z`), per the byterover-telemetry backend contract. The top-level `before()` runs one known-good POST and `this.skip()`s the entire suite with a clear reason if the backend rejects it. Last verified green against `https://telemetry-dev.byterover.dev` on 2026-05-29. If a future deployment regresses to the older numeric `timestamp` (epoch milliseconds) schema, every scenario would FAIL with retry-cap exhaustion - coordinate with the telemetry team before running.
- For scenario 4: a browser to complete the OAuth login flow.

**Test isolation**: each scenario builds a per-scenario `env` object with a temp `BRV_DATA_DIR` and a temp `HOME` and passes it to every `spawnSync(node, [bin/run.js, ...])`. That isolates the analytics JSONL queue, daemon log, auth token store, and the platform-derived global config path (`~/Library/Application Support/brv/config.json` on macOS) away from the developer's real profile. Teardown uses `brv restart` (with the scenario env) instead of `bin/kill-daemon.js` — `restart` properly cleans the SCENARIO's daemon + state files; calling `kill-daemon.js` without scoped env would read the user's real global `daemon.json` and leak the scenario daemon to the process table. The emit helper temporarily mutates `process.env.BRV_DATA_DIR` / `HOME` because `connectToDaemon` reads them for instance discovery, and restores in `finally` - safe because mocha runs scenarios sequentially. Do NOT pass `--parallel`.

**What "PASS" actually proves**:

The positive signal is `status: pending -> sent` in the JSONL for explicit post-enable test events. That flip happens only when the M4.2 `HttpAnalyticsSender` sees a 2xx response from the backend. So "PASS" means "the backend accepted the batch with 2xx" - sufficient for the M4.7 "events land within 30s" goal.

Scenario 5 covers both halves of the M4.7 "backend down -> recovery" test: Phase A boots a TCP drop-proxy on a random localhost port, points the CLI at it, and asserts `backoff.consecutive_failures > 0` after the first flush tick; Phase B closes the drop-proxy and brings up a HTTP accept-proxy on the SAME port, then polls (up to ~90s, since M4.5 exponential backoff delays the next retry) for `consecutive_failures` to drop back to 0 + at least one row to flip to `status=sent`.

**Postgres-side verification (DoD #7-8) is intentionally NOT in the auto path.** It needs ops-only read credentials that aren't available to the harness. The CLI-side proof (JSONL `status=sent` + backend 2xx) is sufficient for "the pipeline ships and the backend accepts" - asserting the row exists in dev-beta's `raw_events` is a separate ops/manual step. If you have those credentials, the manual SQL is:

```sql
-- replace device_id with the value from your test's $BRV_DATA_DIR/config.json
SELECT id, event_name, identity_user_id, identity_device_id, received_at
FROM raw_events
WHERE identity_device_id = '<your-device-id>'
ORDER BY received_at DESC
LIMIT 25;
```

**Scenario 4 operator step**: the test prints the exact `HOME=... BRV_DATA_DIR=... BRV_IAM_BASE_URL=... node <repo>/bin/run.js login` command to run in another terminal. Use that exact command so the login writes into the scenario's isolated token/config paths instead of your normal profile.

**Estimated runtime**: ~3 minutes for the auto suite (driven by the 30-45s interval windows in scenarios 3 + 5 + 6).

## Conventions

- ES modules with `.js` import extensions required
Expand Down
18 changes: 18 additions & 0 deletions eslint.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,24 @@ export default [
},
},
},
{
files: ['src/**/*.ts', 'src/**/*.tsx'],
ignores: ['src/server/infra/**'],
rules: {
'no-restricted-imports': [
'error',
{
patterns: [
{
group: ['**/analytics/i-analytics-client', '**/analytics/i-analytics-client.js'],
message:
'IAnalyticsClient is daemon-internal. Only code under src/server/infra/ may import it; other consumers should use the transport event analytics:track (M2.6).',
},
],
},
],
},
},
// Web UI (browser environment) — allow browser globals and React naming conventions
{
files: ['src/webui/**/*.ts', 'src/webui/**/*.tsx'],
Expand Down
19 changes: 4 additions & 15 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 5 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
"@ai-sdk/xai": "^2.0.57",
"@anthropic-ai/sdk": "^0.70.1",
"@campfirein/brv-transport-client": "github:campfirein/brv-transport-client#1.1.0",
"@campfirein/byterover-packages": "github:campfirein/byterover-packages#main",
"@campfirein/byterover-packages": "github:campfirein/byterover-packages#1.0.5",
"@codemirror/lang-html": "^6.4.11",
"@codemirror/lang-markdown": "^6.5.0",
"@codemirror/theme-one-dark": "^6.1.3",
Expand Down Expand Up @@ -206,7 +206,7 @@
},
"repository": "campfirein/byterover-cli",
"scripts": {
"build": "shx rm -rf dist && tsc -b && shx cp -r src/server/templates dist/server/templates && shx cp -r src/agent/resources dist/agent/resources && npm run build:ui",
"build": "shx rm -rf dist && tsc -b && shx cp -r src/server/templates dist/server/templates && shx cp -r src/agent/resources dist/agent/resources && shx cp -r src/shared/assets dist/shared/assets && npm run build:ui",
"build:ui": "vite build src/webui --mode package",
"build:ui:submodule": "node scripts/prepare-ui-submodule-links.mjs && vite build src/webui --mode submodule",
"dev": "node bin/kill-daemon.js && npm run build && ./bin/dev.js",
Expand All @@ -219,6 +219,9 @@
"prepack": "npm run build && BRV_ENV=production oclif manifest",
"prepare": "husky",
"test": "mocha --forbid-only \"test/**/*.test.ts\"",
"test:e2e:analytics": "npm run build && mocha --forbid-only --timeout 600000 \"test/e2e/analytics/dev-beta.e2e.ts\"",
"test:e2e:lifecycle": "npm run build && mocha --forbid-only --timeout 180000 \"test/e2e/analytics/lifecycle-wire.e2e.ts\"",
"test:e2e:db": "npm run build && mocha --forbid-only --timeout 300000 \"test/e2e/analytics/lifecycle-db.e2e.ts\"",
"typecheck": "tsc --noEmit && tsc --noEmit -p src/webui/tsconfig.json",
"version": "git add README.md"
},
Expand Down
24 changes: 19 additions & 5 deletions src/oclif/commands/locations.ts
Original file line number Diff line number Diff line change
@@ -1,9 +1,15 @@
/* eslint-disable camelcase */
import {Command, Flags} from '@oclif/core'
import chalk from 'chalk'

import type {ProjectLocationDTO} from '../../shared/transport/types/dto.js'

import {LocationsEvents, type LocationsGetResponse} from '../../shared/transport/events/locations-events.js'
import {
LocationsEvents,
type LocationsGetRequest,
type LocationsGetResponse,
} from '../../shared/transport/events/locations-events.js'
import {buildCliMetadata} from '../lib/build-cli-metadata.js'
import {type DaemonClientOptions, formatConnectionError, withDaemonRetry} from '../lib/daemon-client.js'
import {writeJsonResponse} from '../lib/json-response.js'

Expand All @@ -19,19 +25,27 @@ export default class Locations extends Command {
}),
}

protected async fetchLocations(options?: DaemonClientOptions): Promise<ProjectLocationDTO[]> {
protected async fetchLocations(
cliMetadata: ReturnType<typeof buildCliMetadata>,
options?: DaemonClientOptions,
): Promise<ProjectLocationDTO[]> {
return withDaemonRetry<ProjectLocationDTO[]>(async (client) => {
const response = await client.requestWithAck<LocationsGetResponse>(LocationsEvents.GET)
const request: LocationsGetRequest = {cli_metadata: cliMetadata}
const response = await client.requestWithAck<LocationsGetResponse, LocationsGetRequest>(
LocationsEvents.GET,
request,
)
return response.locations
}, options)
}

public async run(): Promise<void> {
const {flags} = await this.parse(Locations)
const {flags, metadata} = await this.parse(Locations)
const isJson = flags.format === 'json'
const cliMetadata = buildCliMetadata(this.id ?? 'locations', {flags, metadata})

try {
const locations = await this.fetchLocations({projectPath: process.cwd()})
const locations = await this.fetchLocations(cliMetadata, {projectPath: process.cwd()})

if (isJson) {
writeJsonResponse({command: 'locations', data: {locations}, success: true})
Expand Down
Loading
Loading