Repository navigation
Expand file tree
/
Copy pathprd.json
More file actions
115 lines (115 loc) · 6.29 KB
/
Copy pathprd.json
File metadata and controls
115 lines (115 loc) · 6.29 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
{
"project": "ClaudeUsage",
"branchName": "feat/multi-account",
"description": "Add multi-account support to the Claude Usage menu bar app. Users can manage multiple Claude accounts, switch between them, and configure each independently.",
"userStories": [
{
"id": "US-001",
"title": "Account data model",
"description": "Create an Account struct and AccountStore class to manage multiple accounts. Account has id (UUID), email (String), sessionKey (String?), orgId (String?). AccountStore manages the list of accounts, active selection, and persistence to UserDefaults (metadata) + Keychain (secrets). Include migration logic: on init, if old-style single credentials exist in KeychainService, create a default Account with email 'Account 1', migrate the credentials, set as active, and delete old keys.",
"acceptanceCriteria": [
"Account struct exists in Models/Account.swift with id, email, sessionKey, orgId, and computed isConfigured property",
"AccountStore class exists in Services/AccountStore.swift as ObservableObject with accounts array and activeAccountId",
"AccountStore has add(email:), remove(id:), setActive(id:), update(_:) methods",
"Account session keys stored in Keychain scoped by account UUID",
"Account metadata (id, email, orgId) persisted in UserDefaults",
"Migration from old single-account credentials works on first launch",
"Typecheck passes"
],
"priority": 1,
"passes": true,
"notes": ""
},
{
"id": "US-002",
"title": "KeychainService multi-account support",
"description": "Extend KeychainService to support account-scoped credential storage. Add methods that take an account UUID to save/read/delete session keys per account. Keep backward compatibility for migration (old methods still work to read existing credentials). The keychain account key format should be '{accountId}-sessionKey'.",
"acceptanceCriteria": [
"KeychainService has save(key:accountId:value:), read(key:accountId:), delete(key:accountId:) methods",
"Old single-account methods still work for migration reads",
"Cache is scoped per account",
"Typecheck passes"
],
"priority": 2,
"passes": true,
"notes": ""
},
{
"id": "US-003",
"title": "UsageViewModel uses AccountStore",
"description": "Refactor UsageViewModel to depend on AccountStore instead of reading Keychain directly. It should poll only the active account. When activeAccountId changes, cancel current polling and start polling the new account. Expose activeEmail for display.",
"acceptanceCriteria": [
"UsageViewModel takes AccountStore as init parameter",
"Polling uses active account's credentials from AccountStore",
"Switching active account cancels old polling and starts new",
"activeEmail computed property returns current account's email",
"Typecheck passes"
],
"priority": 3,
"passes": true,
"notes": ""
},
{
"id": "US-004",
"title": "App entry point wiring",
"description": "Update ClaudeUsageApp.swift to create AccountStore as a @StateObject and inject it into UsageViewModel and views. Both ContentView and SettingsView should receive the AccountStore.",
"acceptanceCriteria": [
"AccountStore created as @StateObject in ClaudeUsageApp",
"AccountStore passed to UsageViewModel",
"AccountStore passed to ContentView and SettingsView",
"App builds and runs with no regressions for single-account usage",
"Typecheck passes"
],
"priority": 4,
"passes": true,
"notes": ""
},
{
"id": "US-005",
"title": "Account switcher in dropdown",
"description": "Add an account picker at the top of the ContentView popover, above the usage bars. Use a Picker or Menu showing each account's email. Selecting a different account calls accountStore.setActive(id:). Only show the picker when multiple accounts exist. When one account, hide it entirely.",
"acceptanceCriteria": [
"Account picker appears at top of popover when 2+ accounts exist",
"Picker shows each account's email as label",
"Selecting account switches active account in AccountStore",
"Picker hidden when only one account exists",
"Typecheck passes"
],
"priority": 5,
"passes": true,
"notes": ""
},
{
"id": "US-006",
"title": "Add Account button and flow",
"description": "Add a '+' (plus) icon button in the bottom toolbar of ContentView as the first icon in the right-side icon group (before refresh, gear, quit). Clicking it shows a small popover or sheet with an email text field and Add/Cancel buttons. On Add, create a new unconfigured Account with that email, switch to it, and the main view shows 'Not configured' with Open Settings button.",
"acceptanceCriteria": [
"Plus icon button appears as first icon in bottom toolbar icon group: + ⟳ ⚙ ⏻",
"Clicking + shows add-account popover/sheet with email field",
"Entering email and clicking Add creates new account and switches to it",
"New unconfigured account shows 'Not configured' state in main view",
"Cancel dismisses without adding",
"Typecheck passes"
],
"priority": 6,
"passes": true,
"notes": ""
},
{
"id": "US-007",
"title": "Settings scoped to active account",
"description": "Update SettingsView to configure the active account from AccountStore. Show the active account's email as a header. Session key and org ID fields load/save for the active account. Add an 'Accounts' section at the bottom listing all accounts with delete (trash) buttons. Cannot delete the last account. Deleting active account switches to next available.",
"acceptanceCriteria": [
"Settings header shows active account email",
"Session key and org ID fields load from and save to active account",
"Accounts list section shows all accounts with delete buttons",
"Cannot delete last remaining account (button disabled or hidden)",
"Deleting active account auto-switches to another account",
"Typecheck passes"
],
"priority": 7,
"passes": true,
"notes": ""
}
]
}