mirror of
https://github.com/AgentSeal/codeburn.git
synced 2026-10-29 18:44:34 +00:00
* feat(app): transient project selector in the desktop top bar Scopes every report to one project path for the current session through the same narrowing the VS Code workspace scope uses. The saved project filter is never written; a restart is back on all projects. * fix(app): let the name pickers ellipsize before the top bar overflows * fix: key the daily project split per real path, not per label A project label can span several paths: every Claude session started from the home folder shares -Users-<name>, while its cwd puts it in a different project. The day rollup keyed by label kept the first path it saw, so a rooted --project headline took the whole label bucket on some days and missed it on others. Key per (label, path), read old label-keyed days unchanged, bump the daily cache to v68. * fix(app): list only selectable, non-zero projects in the top bar picker Rows with no session cwd (the Cursor and Grok Bot imports, provider label fallbacks) report their label as the path, so the picker offered names the bridge refuses and dash-to-slash guesses like eywa/lab. Keep only absolute paths, and drop rows whose lifetime cost rounds to $0.00. The old test that rooted a slashless Codex path is replaced: Codex now records the absolute cwd, and a slashless path is always the label fallback. * fix(app): show a toast when a project pick is refused The pick was dropped silently. Also pin that an encoded -Users-... label never reaches the picker list. * feat: group projects by git repository Clones and worktrees that share an origin remote are one project in every project list (report JSON, By Project, the top bar picker, the terminal dashboard), with the checkouts listed under the row. A --project path inside a checkout scopes to the whole repository; --exact-project keeps the old single-folder match. The origin is learned while the folder exists, kept in git-origins.json and on each day's project entry (daily cache v69), so a deleted scratch clone stays in its repository. The report JSON project list now comes from the durable day set, so a row costs what selecting it reports. * fix: a picked project row selects that row exactly The top bar pick sends =<path>: a checkout in a repository still selects the whole repository, and a plain folder selects itself without the folders under it, which are rows of their own. So the picker row and the headline it opens are the same set. Typed --project paths keep their prefix match. Days adopted from an older cache learn the origin of every checkout that still exists, and lookups outside a parse are saved on exit. * fix: key the status snapshot on --exact-project * feat: one Temporary folders row for scratch folders outside a repository Every project path under a temp root (os.tmpdir(), /tmp, /var/folders and their /private spellings) that is not a checkout of a known repository folds into one row, in the report JSON, By Project, the terminal dashboard, the top bar picker and the Settings Projects pane. Its pattern @temp selects or hides all of them. The Projects pane leaves out rows that round to $0.00 unless a saved pattern names them, and a saved pattern naming any checkout of a repository row now names the whole row in the renderer too. * fix(claude): attribute each call to the project of its own cwd * test: fold the temp roots the tests set, compare checkout ids as identities (Windows) * fix(claude): keep subfolder cwds in their project, count and show a split session once * fix: an exclude path hides that checkout only, repository rows count a session once * fix(claude): a deleted subfolder stays its own project
58 lines
2.7 KiB
TypeScript
58 lines
2.7 KiB
TypeScript
import { homedir } from 'node:os'
|
|
|
|
import { describe, expect, it } from 'vitest'
|
|
|
|
import { matchesProjectPattern } from '../src/parser.js'
|
|
|
|
import { projectMatches, projectPattern } from '../app/renderer/lib/projectMatch.js'
|
|
|
|
const PROJECTS = [
|
|
{ name: 'my-company', path: '/Users/me/work/my-company' },
|
|
{ name: 'my-company-kit', path: '/Users/me/work/my-company-kit' },
|
|
{ name: 'client', path: '/Users/me/work/my-company/packages/client' },
|
|
{ name: 'Vault', path: '/a/Vault' },
|
|
{ name: 'vault', path: '/a/vault' },
|
|
{ name: 'win', path: 'C:\\Work\\Vault' },
|
|
{ name: 'unc', path: '\\\\Server\\Share\\Vault' },
|
|
{ name: 'stripped', path: 'root/vault' },
|
|
{ name: 'stripped-ui', path: 'root/vault-ui' },
|
|
{ name: 'home-proj', path: `${homedir().replace(/\\/g, '/')}/work/my-company` },
|
|
{ name: 'encoded', path: '' },
|
|
{ name: '-Users-me-Web-thing', path: '' },
|
|
]
|
|
|
|
const PATTERNS = [
|
|
'/Users/me/work/my-company', '/Users/me/work/my-company/', 'my-company', 'MY-COMPANY',
|
|
'/a/Vault', '/a/vault', 'c:/work/vault', 'C:\\Work\\Vault', '//server/share', '/root/vault',
|
|
'root/vault', 'me/work', '/', '//', '', '-Users-me-Web', 'thing', '/nope',
|
|
'=/Users/me/work/my-company', '=/a/Vault', '=c:/work/vault', '=/root/vault',
|
|
]
|
|
|
|
// This parity test lives in the CLI suite, not beside the module it covers:
|
|
// it needs both halves, and the desktop CI job installs only app/ dependencies,
|
|
// so an app-side test importing src/parser.ts fails to resolve chalk there.
|
|
// A tilde is absent on purpose: the main process expands it on the way in and
|
|
// out of the filter file (see normalizePatterns), so a pattern reaching the
|
|
// renderer is already a path it can resolve.
|
|
describe('projectMatch parity with the CLI', () => {
|
|
it('agrees with matchesProjectPattern on every pattern and project', () => {
|
|
for (const project of PROJECTS) {
|
|
for (const pattern of PATTERNS) {
|
|
const cli = matchesProjectPattern({ project: project.name, projectPath: project.path }, pattern)
|
|
expect(projectMatches(project, pattern), `${pattern} vs ${project.path || project.name}`).toBe(cli)
|
|
}
|
|
}
|
|
})
|
|
|
|
it('anchors the pattern a switch writes, stripped absolute paths included', () => {
|
|
const stripped = PROJECTS.find(p => p.name === 'stripped')!
|
|
const pattern = projectPattern(stripped)
|
|
expect(pattern).toBe('/root/vault')
|
|
expect(matchesProjectPattern({ project: 'stripped', projectPath: 'root/vault' }, pattern)).toBe(true)
|
|
expect(matchesProjectPattern({ project: 'stripped-ui', projectPath: 'root/vault-ui' }, pattern)).toBe(false)
|
|
})
|
|
|
|
it('falls back to the name when no path was recorded', () => {
|
|
expect(projectPattern({ name: '-Users-me-Web-thing', path: '' })).toBe('-Users-me-Web-thing')
|
|
})
|
|
})
|