mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-11-29 02:39:13 +00:00
Screen-sharing or demoing the app exposed every project on the machine, with no way to narrow it. Settings now has a Projects pane: one switch per detected project, plus a field for hiding a pattern that matches nothing detected yet. The filter lives in ~/.config/codeburn/app-filter.json rather than renderer storage, because the main process is where the CLI argv is assembled. No file, or empty lists, means no filter, so the default is unchanged for everyone who never opens the pane. CODEBURN_APP_FILTER overrides the path and an empty value disables it, which is what the app test suite sets so a real filter file cannot reach the assertions. Details worth knowing: - The pane's own project list is fetched WITHOUT the filter. Scoping it would hide the projects the checklist exists to switch back on. - Patterns are passed as --project=<value>, never as two argv entries. A Claude project directory is encoded as "-Users-me-Web-thing", and a leading dash in its own argv slot parses as a flag. - Combined scope and a project filter cannot both hold. The CLI rejects --scope combined next to --project/--exclude because paired devices report their usage unfiltered, and dropping the filter instead would put the hidden projects back inside the combined total, which is the one thing the pane exists to prevent. So the filter wins: Settings offers Local only while something is hidden (and says why), the renderer derives its effective scope from the filter so even the first poll of a filtered session is local, and buildOverviewArgs keeps the same rule as a guard for a stale caller. - A read that fails on an existing file keeps the last known filter instead of falling back to the empty one. Unhiding every project on a torn write or a typo mid-edit is the one failure mode this pane cannot have. Only a missing file means "show everything" again. - The pane's matcher lives in renderer/lib/projectMatch.ts, and projectMatch.test.ts pins it against the CLI's matchesProjectPattern over every pattern shape. A switch that disagrees with the argv it writes would lie about what is on screen. - Writes are serialized: every write is computed from the filter on screen, so a second click before the first landed would be built from the pre-click value and drop it. - export carries the filter too, since it writes project names into a file that gets shared. getPlans stays unfiltered, like combined scope: a plan is billed on every project, so scoping it would misreport the cycle.
15 lines
521 B
TypeScript
15 lines
521 B
TypeScript
import { defineConfig } from 'vitest/config'
|
|
import react from '@vitejs/plugin-react'
|
|
|
|
// Default env is node (for electron/cli tests). Renderer component tests opt
|
|
// into jsdom with a `// @vitest-environment jsdom` docblock.
|
|
export default defineConfig({
|
|
plugins: [react()],
|
|
test: {
|
|
environment: 'node',
|
|
env: { CODEBURN_APP_FILTER: '' },
|
|
globals: false,
|
|
setupFiles: ['./renderer/test/setup.ts'],
|
|
include: ['renderer/**/*.test.{ts,tsx}', 'electron/**/*.test.ts', 'scripts/**/*.test.ts'],
|
|
},
|
|
})
|