tabstax-cli 0.1.0
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 +110 -0
- package/bin/hey.js +2 -0
- package/dist/__tests__/api.test.d.ts +6 -0
- package/dist/__tests__/api.test.d.ts.map +1 -0
- package/dist/__tests__/api.test.js +146 -0
- package/dist/__tests__/api.test.js.map +1 -0
- package/dist/__tests__/config.test.d.ts +6 -0
- package/dist/__tests__/config.test.d.ts.map +1 -0
- package/dist/__tests__/config.test.js +78 -0
- package/dist/__tests__/config.test.js.map +1 -0
- package/dist/__tests__/output.test.d.ts +6 -0
- package/dist/__tests__/output.test.d.ts.map +1 -0
- package/dist/__tests__/output.test.js +104 -0
- package/dist/__tests__/output.test.js.map +1 -0
- package/dist/commands/add.d.ts +12 -0
- package/dist/commands/add.d.ts.map +1 -0
- package/dist/commands/add.js +76 -0
- package/dist/commands/add.js.map +1 -0
- package/dist/commands/auth.d.ts +11 -0
- package/dist/commands/auth.d.ts.map +1 -0
- package/dist/commands/auth.js +135 -0
- package/dist/commands/auth.js.map +1 -0
- package/dist/commands/context.d.ts +15 -0
- package/dist/commands/context.d.ts.map +1 -0
- package/dist/commands/context.js +75 -0
- package/dist/commands/context.js.map +1 -0
- package/dist/commands/done.d.ts +13 -0
- package/dist/commands/done.d.ts.map +1 -0
- package/dist/commands/done.js +76 -0
- package/dist/commands/done.js.map +1 -0
- package/dist/commands/edit.d.ts +27 -0
- package/dist/commands/edit.d.ts.map +1 -0
- package/dist/commands/edit.js +170 -0
- package/dist/commands/edit.js.map +1 -0
- package/dist/commands/list.d.ts +11 -0
- package/dist/commands/list.d.ts.map +1 -0
- package/dist/commands/list.js +112 -0
- package/dist/commands/list.js.map +1 -0
- package/dist/commands/remove.d.ts +9 -0
- package/dist/commands/remove.d.ts.map +1 -0
- package/dist/commands/remove.js +69 -0
- package/dist/commands/remove.js.map +1 -0
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +113 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/api.d.ts +69 -0
- package/dist/lib/api.d.ts.map +1 -0
- package/dist/lib/api.js +303 -0
- package/dist/lib/api.js.map +1 -0
- package/dist/lib/config.d.ts +51 -0
- package/dist/lib/config.d.ts.map +1 -0
- package/dist/lib/config.js +131 -0
- package/dist/lib/config.js.map +1 -0
- package/dist/lib/output.d.ts +37 -0
- package/dist/lib/output.d.ts.map +1 -0
- package/dist/lib/output.js +209 -0
- package/dist/lib/output.js.map +1 -0
- package/package.json +64 -0
package/dist/lib/api.js
ADDED
|
@@ -0,0 +1,303 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Supabase API client for Hey CLI
|
|
3
|
+
* Handles all database operations
|
|
4
|
+
*/
|
|
5
|
+
import { createClient } from '@supabase/supabase-js';
|
|
6
|
+
import { config } from './config.js';
|
|
7
|
+
class ApiClient {
|
|
8
|
+
client = null;
|
|
9
|
+
getClient() {
|
|
10
|
+
if (!this.client) {
|
|
11
|
+
const auth = config.getAuth();
|
|
12
|
+
const url = config.getSupabaseUrl();
|
|
13
|
+
const anonKey = config.getSupabaseAnonKey();
|
|
14
|
+
this.client = createClient(url, anonKey, {
|
|
15
|
+
auth: {
|
|
16
|
+
autoRefreshToken: false,
|
|
17
|
+
persistSession: false,
|
|
18
|
+
},
|
|
19
|
+
global: {
|
|
20
|
+
headers: auth.accessToken
|
|
21
|
+
? { Authorization: `Bearer ${auth.accessToken}` }
|
|
22
|
+
: {},
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
return this.client;
|
|
27
|
+
}
|
|
28
|
+
// Reset client (call after login/logout)
|
|
29
|
+
resetClient() {
|
|
30
|
+
this.client = null;
|
|
31
|
+
}
|
|
32
|
+
// Auth methods
|
|
33
|
+
async signIn(email, password) {
|
|
34
|
+
const client = createClient(config.getSupabaseUrl(), config.getSupabaseAnonKey());
|
|
35
|
+
const { data, error } = await client.auth.signInWithPassword({
|
|
36
|
+
email,
|
|
37
|
+
password,
|
|
38
|
+
});
|
|
39
|
+
if (error) {
|
|
40
|
+
throw new Error(`Login failed: ${error.message}`);
|
|
41
|
+
}
|
|
42
|
+
if (!data.session || !data.user) {
|
|
43
|
+
throw new Error('Login failed: No session returned');
|
|
44
|
+
}
|
|
45
|
+
// Store tokens
|
|
46
|
+
config.setAuth({
|
|
47
|
+
accessToken: data.session.access_token,
|
|
48
|
+
refreshToken: data.session.refresh_token,
|
|
49
|
+
expiresAt: new Date(data.session.expires_at * 1000).toISOString(),
|
|
50
|
+
userEmail: data.user.email ?? null,
|
|
51
|
+
userId: data.user.id,
|
|
52
|
+
});
|
|
53
|
+
this.resetClient();
|
|
54
|
+
return {
|
|
55
|
+
userId: data.user.id,
|
|
56
|
+
email: data.user.email ?? email,
|
|
57
|
+
};
|
|
58
|
+
}
|
|
59
|
+
async signOut() {
|
|
60
|
+
config.clearAuth();
|
|
61
|
+
this.resetClient();
|
|
62
|
+
}
|
|
63
|
+
// Stax methods
|
|
64
|
+
async getAllStax() {
|
|
65
|
+
const auth = config.getAuth();
|
|
66
|
+
if (!auth.userId)
|
|
67
|
+
throw new Error('Not authenticated');
|
|
68
|
+
const { data, error } = await this.getClient()
|
|
69
|
+
.from('stax')
|
|
70
|
+
.select('*')
|
|
71
|
+
.eq('user_id', auth.userId)
|
|
72
|
+
.order('last_activity_at', { ascending: false, nullsFirst: false });
|
|
73
|
+
if (error)
|
|
74
|
+
throw new Error(`Failed to fetch stax: ${error.message}`);
|
|
75
|
+
return data ?? [];
|
|
76
|
+
}
|
|
77
|
+
async getStaxByName(name) {
|
|
78
|
+
const auth = config.getAuth();
|
|
79
|
+
if (!auth.userId)
|
|
80
|
+
throw new Error('Not authenticated');
|
|
81
|
+
const { data, error } = await this.getClient()
|
|
82
|
+
.from('stax')
|
|
83
|
+
.select('*')
|
|
84
|
+
.eq('user_id', auth.userId)
|
|
85
|
+
.ilike('name', name)
|
|
86
|
+
.limit(1)
|
|
87
|
+
.single();
|
|
88
|
+
if (error && error.code !== 'PGRST116') {
|
|
89
|
+
throw new Error(`Failed to fetch stax: ${error.message}`);
|
|
90
|
+
}
|
|
91
|
+
return data;
|
|
92
|
+
}
|
|
93
|
+
async fuzzyFindStax(query) {
|
|
94
|
+
const allStax = await this.getAllStax();
|
|
95
|
+
const lowerQuery = query.toLowerCase();
|
|
96
|
+
// Exact match first
|
|
97
|
+
const exact = allStax.find(s => s.name.toLowerCase() === lowerQuery);
|
|
98
|
+
if (exact)
|
|
99
|
+
return [exact];
|
|
100
|
+
// Starts with
|
|
101
|
+
const startsWith = allStax.filter(s => s.name.toLowerCase().startsWith(lowerQuery));
|
|
102
|
+
if (startsWith.length > 0)
|
|
103
|
+
return startsWith;
|
|
104
|
+
// Contains
|
|
105
|
+
const contains = allStax.filter(s => s.name.toLowerCase().includes(lowerQuery));
|
|
106
|
+
return contains;
|
|
107
|
+
}
|
|
108
|
+
// Next Actions methods
|
|
109
|
+
async getActions(staxId, includeCompleted = false) {
|
|
110
|
+
let query = this.getClient()
|
|
111
|
+
.from('next_actions')
|
|
112
|
+
.select('*')
|
|
113
|
+
.eq('stax_id', staxId)
|
|
114
|
+
.order('position', { ascending: true });
|
|
115
|
+
if (!includeCompleted) {
|
|
116
|
+
query = query.eq('done', false);
|
|
117
|
+
}
|
|
118
|
+
const { data, error } = await query;
|
|
119
|
+
if (error)
|
|
120
|
+
throw new Error(`Failed to fetch actions: ${error.message}`);
|
|
121
|
+
return data ?? [];
|
|
122
|
+
}
|
|
123
|
+
async getRecentBreadcrumbs(staxId, days = 7) {
|
|
124
|
+
const cutoff = new Date();
|
|
125
|
+
cutoff.setDate(cutoff.getDate() - days);
|
|
126
|
+
const { data, error } = await this.getClient()
|
|
127
|
+
.from('next_actions')
|
|
128
|
+
.select('*')
|
|
129
|
+
.eq('stax_id', staxId)
|
|
130
|
+
.eq('done', true)
|
|
131
|
+
.gte('completed_at', cutoff.toISOString())
|
|
132
|
+
.order('completed_at', { ascending: false });
|
|
133
|
+
if (error)
|
|
134
|
+
throw new Error(`Failed to fetch breadcrumbs: ${error.message}`);
|
|
135
|
+
return data ?? [];
|
|
136
|
+
}
|
|
137
|
+
async addAction(staxId, content, isCompleted = false) {
|
|
138
|
+
const auth = config.getAuth();
|
|
139
|
+
if (!auth.userId)
|
|
140
|
+
throw new Error('Not authenticated');
|
|
141
|
+
// Get current max position
|
|
142
|
+
const { data: existing } = await this.getClient()
|
|
143
|
+
.from('next_actions')
|
|
144
|
+
.select('position')
|
|
145
|
+
.eq('stax_id', staxId)
|
|
146
|
+
.eq('done', false)
|
|
147
|
+
.order('position', { ascending: false })
|
|
148
|
+
.limit(1);
|
|
149
|
+
const nextPosition = existing && existing.length > 0
|
|
150
|
+
? (existing[0].position ?? 0) + 1
|
|
151
|
+
: 0;
|
|
152
|
+
const payload = {
|
|
153
|
+
stax_id: staxId,
|
|
154
|
+
user_id: auth.userId,
|
|
155
|
+
created_by: auth.userId,
|
|
156
|
+
content,
|
|
157
|
+
done: isCompleted,
|
|
158
|
+
position: nextPosition,
|
|
159
|
+
completed_at: isCompleted ? new Date().toISOString() : null,
|
|
160
|
+
completed_by: isCompleted ? auth.userId : null,
|
|
161
|
+
};
|
|
162
|
+
const { data, error } = await this.getClient()
|
|
163
|
+
.from('next_actions')
|
|
164
|
+
.insert(payload)
|
|
165
|
+
.select()
|
|
166
|
+
.single();
|
|
167
|
+
if (error)
|
|
168
|
+
throw new Error(`Failed to add action: ${error.message}`);
|
|
169
|
+
// Update stax last_activity_at
|
|
170
|
+
await this.updateStaxActivity(staxId);
|
|
171
|
+
return data;
|
|
172
|
+
}
|
|
173
|
+
async completeAction(actionId) {
|
|
174
|
+
const auth = config.getAuth();
|
|
175
|
+
const { data, error } = await this.getClient()
|
|
176
|
+
.from('next_actions')
|
|
177
|
+
.update({
|
|
178
|
+
done: true,
|
|
179
|
+
completed_at: new Date().toISOString(),
|
|
180
|
+
completed_by: auth.userId,
|
|
181
|
+
})
|
|
182
|
+
.eq('id', actionId)
|
|
183
|
+
.select()
|
|
184
|
+
.single();
|
|
185
|
+
if (error)
|
|
186
|
+
throw new Error(`Failed to complete action: ${error.message}`);
|
|
187
|
+
// Update stax activity
|
|
188
|
+
if (data?.stax_id) {
|
|
189
|
+
await this.updateStaxActivity(data.stax_id);
|
|
190
|
+
}
|
|
191
|
+
return data;
|
|
192
|
+
}
|
|
193
|
+
async deleteAction(actionId) {
|
|
194
|
+
const { error } = await this.getClient()
|
|
195
|
+
.from('next_actions')
|
|
196
|
+
.delete()
|
|
197
|
+
.eq('id', actionId);
|
|
198
|
+
if (error)
|
|
199
|
+
throw new Error(`Failed to delete action: ${error.message}`);
|
|
200
|
+
}
|
|
201
|
+
async editAction(actionId, content) {
|
|
202
|
+
const { data, error } = await this.getClient()
|
|
203
|
+
.from('next_actions')
|
|
204
|
+
.update({ content })
|
|
205
|
+
.eq('id', actionId)
|
|
206
|
+
.select()
|
|
207
|
+
.single();
|
|
208
|
+
if (error)
|
|
209
|
+
throw new Error(`Failed to edit action: ${error.message}`);
|
|
210
|
+
return data;
|
|
211
|
+
}
|
|
212
|
+
async updateActionPosition(actionId, position) {
|
|
213
|
+
const { error } = await this.getClient()
|
|
214
|
+
.from('next_actions')
|
|
215
|
+
.update({ position })
|
|
216
|
+
.eq('id', actionId);
|
|
217
|
+
if (error)
|
|
218
|
+
throw new Error(`Failed to update position: ${error.message}`);
|
|
219
|
+
}
|
|
220
|
+
async countActiveActions(staxId) {
|
|
221
|
+
const { count, error } = await this.getClient()
|
|
222
|
+
.from('next_actions')
|
|
223
|
+
.select('*', { count: 'exact', head: true })
|
|
224
|
+
.eq('stax_id', staxId)
|
|
225
|
+
.eq('done', false);
|
|
226
|
+
if (error)
|
|
227
|
+
throw new Error(`Failed to count actions: ${error.message}`);
|
|
228
|
+
return count ?? 0;
|
|
229
|
+
}
|
|
230
|
+
// Attention blocks
|
|
231
|
+
async getAttentionBlock(staxId) {
|
|
232
|
+
const { data, error } = await this.getClient()
|
|
233
|
+
.from('attention_blocks')
|
|
234
|
+
.select('*')
|
|
235
|
+
.eq('stax_id', staxId)
|
|
236
|
+
.limit(1)
|
|
237
|
+
.maybeSingle();
|
|
238
|
+
if (error)
|
|
239
|
+
throw new Error(`Failed to fetch attention block: ${error.message}`);
|
|
240
|
+
return data;
|
|
241
|
+
}
|
|
242
|
+
async setAttentionBlock(staxId, priority) {
|
|
243
|
+
const auth = config.getAuth();
|
|
244
|
+
if (!auth.userId)
|
|
245
|
+
throw new Error('Not authenticated');
|
|
246
|
+
// Check if exists
|
|
247
|
+
const existing = await this.getAttentionBlock(staxId);
|
|
248
|
+
if (existing) {
|
|
249
|
+
// Update
|
|
250
|
+
const { data, error } = await this.getClient()
|
|
251
|
+
.from('attention_blocks')
|
|
252
|
+
.update({ priority })
|
|
253
|
+
.eq('id', existing.id)
|
|
254
|
+
.select()
|
|
255
|
+
.single();
|
|
256
|
+
if (error)
|
|
257
|
+
throw new Error(`Failed to set priority: ${error.message}`);
|
|
258
|
+
return data;
|
|
259
|
+
}
|
|
260
|
+
else {
|
|
261
|
+
// Insert
|
|
262
|
+
const { data, error } = await this.getClient()
|
|
263
|
+
.from('attention_blocks')
|
|
264
|
+
.insert({
|
|
265
|
+
stax_id: staxId,
|
|
266
|
+
user_id: auth.userId,
|
|
267
|
+
priority,
|
|
268
|
+
})
|
|
269
|
+
.select()
|
|
270
|
+
.single();
|
|
271
|
+
if (error)
|
|
272
|
+
throw new Error(`Failed to set priority: ${error.message}`);
|
|
273
|
+
return data;
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
// Combined queries
|
|
277
|
+
async getStaxWithActions() {
|
|
278
|
+
const stax = await this.getAllStax();
|
|
279
|
+
const results = [];
|
|
280
|
+
for (const s of stax) {
|
|
281
|
+
const actions = await this.getActions(s.id, false);
|
|
282
|
+
const attention = await this.getAttentionBlock(s.id);
|
|
283
|
+
results.push({
|
|
284
|
+
...s,
|
|
285
|
+
actions,
|
|
286
|
+
actionCount: actions.length,
|
|
287
|
+
completedCount: 0, // Could query if needed
|
|
288
|
+
priority: attention?.priority ?? null,
|
|
289
|
+
});
|
|
290
|
+
}
|
|
291
|
+
return results;
|
|
292
|
+
}
|
|
293
|
+
// Helper
|
|
294
|
+
async updateStaxActivity(staxId) {
|
|
295
|
+
await this.getClient()
|
|
296
|
+
.from('stax')
|
|
297
|
+
.update({ last_activity_at: new Date().toISOString() })
|
|
298
|
+
.eq('id', staxId);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
// Singleton
|
|
302
|
+
export const api = new ApiClient();
|
|
303
|
+
//# sourceMappingURL=api.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/lib/api.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,EAAE,YAAY,EAAkB,MAAM,uBAAuB,CAAA;AACpE,OAAO,EAAE,MAAM,EAAE,MAAM,aAAa,CAAA;AA2CpC,MAAM,SAAS;IACL,MAAM,GAA0B,IAAI,CAAA;IAEpC,SAAS;QACf,IAAI,CAAC,IAAI,CAAC,MAAM,EAAE,CAAC;YACjB,MAAM,IAAI,GAAG,MAAM,CAAC,OAAO,EAAE,CAAA;YAC7B,MAAM,GAAG,GAAG,MAAM,CAAC,cAAc,EAAE,CAAA;YACnC,MAAM,OAAO,GAAG,MAAM,CAAC,kBAAkB,EAAE,CAAA;YAE3C,IAAI,CAAC,MAAM,GAAG,YAAY,CAAC,GAAG,EAAE,OAAO,EAAE;gBACvC,IAAI,EAAE;oBACJ,gBAAgB,EAAE,KAAK;oBACvB,cAAc,EAAE,KAAK;iBACtB;gBACD,MAAM,EAAE;oBACN,OAAO,EAAE,IAAI,CAAC,WAAW;wBACvB,CAAC,CAAC,EAAE,aAAa,EAAE,UAAU,IAAI,CAAC,WAAW,EAAE,EAAE;wBACjD,CAAC,CAAC,EAAE;iBACP;aACF,CAAC,CAAA;QACJ,CAAC;QACD,OAAO,IA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
accessToken: string | null;
|
|
7
|
+
refreshToken: string | null;
|
|
8
|
+
expiresAt: string | null;
|
|
9
|
+
userEmail: string | null;
|
|
10
|
+
userId: string | null;
|
|
11
|
+
}
|
|
12
|
+
export interface ContextConfig {
|
|
13
|
+
lastProject: string | null;
|
|
14
|
+
lastProjectId: string | null;
|
|
15
|
+
}
|
|
16
|
+
export interface LimitsConfig {
|
|
17
|
+
maxActionsPerStax: number;
|
|
18
|
+
warnAt: number;
|
|
19
|
+
}
|
|
20
|
+
export interface DisplayConfig {
|
|
21
|
+
defaultListCount: number;
|
|
22
|
+
showBreadcrumbsDays: number;
|
|
23
|
+
}
|
|
24
|
+
export interface HeyConfig {
|
|
25
|
+
auth: AuthConfig;
|
|
26
|
+
context: ContextConfig;
|
|
27
|
+
limits: LimitsConfig;
|
|
28
|
+
display: DisplayConfig;
|
|
29
|
+
supabaseUrl: string;
|
|
30
|
+
supabaseAnonKey: string;
|
|
31
|
+
}
|
|
32
|
+
declare class ConfigManager {
|
|
33
|
+
private conf;
|
|
34
|
+
constructor();
|
|
35
|
+
get path(): string;
|
|
36
|
+
getAuth(): AuthConfig;
|
|
37
|
+
setAuth(auth: Partial<AuthConfig>): void;
|
|
38
|
+
clearAuth(): void;
|
|
39
|
+
isAuthenticated(): boolean;
|
|
40
|
+
getContext(): ContextConfig;
|
|
41
|
+
setLastProject(name: string, id: string): void;
|
|
42
|
+
getLimits(): LimitsConfig;
|
|
43
|
+
getDisplay(): DisplayConfig;
|
|
44
|
+
getSupabaseUrl(): string;
|
|
45
|
+
getSupabaseAnonKey(): string;
|
|
46
|
+
getAll(): HeyConfig;
|
|
47
|
+
reset(): void;
|
|
48
|
+
}
|
|
49
|
+
export declare const config: ConfigManager;
|
|
50
|
+
export {};
|
|
51
|
+
//# sourceMappingURL=config.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;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AK,IAAI,IAAI;CAGd;AAGD,eAAO,MAAM,MAAM,eAAsB,CAAA"}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration management for Hey CLI
|
|
3
|
+
* Stores auth tokens and user preferences in ~/.config/hey/
|
|
4
|
+
*/
|
|
5
|
+
import Conf from 'conf';
|
|
6
|
+
const DEFAULT_CONFIG = {
|
|
7
|
+
auth: {
|
|
8
|
+
accessToken: null,
|
|
9
|
+
refreshToken: null,
|
|
10
|
+
expiresAt: null,
|
|
11
|
+
userEmail: null,
|
|
12
|
+
userId: null,
|
|
13
|
+
},
|
|
14
|
+
context: {
|
|
15
|
+
lastProject: null,
|
|
16
|
+
lastProjectId: null,
|
|
17
|
+
},
|
|
18
|
+
limits: {
|
|
19
|
+
maxActionsPerStax: 7,
|
|
20
|
+
warnAt: 5,
|
|
21
|
+
},
|
|
22
|
+
display: {
|
|
23
|
+
defaultListCount: 10,
|
|
24
|
+
showBreadcrumbsDays: 7,
|
|
25
|
+
},
|
|
26
|
+
// TabStax Supabase credentials
|
|
27
|
+
supabaseUrl: 'https://ayfhqcwzdqakxgkbzdpn.supabase.co',
|
|
28
|
+
supabaseAnonKey: 'eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6ImF5ZmhxY3d6ZHFha3hna2J6ZHBuIiwicm9sZSI6ImFub24iLCJpYXQiOjE3NDMyODk0OTAsImV4cCI6MjA1ODg2NTQ5MH0.sGZcBOOmmOejn-_jcJ49xwW09HVtDKUyjWMXYSyziz8',
|
|
29
|
+
};
|
|
30
|
+
class ConfigManager {
|
|
31
|
+
conf;
|
|
32
|
+
constructor() {
|
|
33
|
+
this.conf = new Conf({
|
|
34
|
+
projectName: 'hey',
|
|
35
|
+
defaults: DEFAULT_CONFIG,
|
|
36
|
+
schema: {
|
|
37
|
+
auth: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
accessToken: { type: ['string', 'null'] },
|
|
41
|
+
refreshToken: { type: ['string', 'null'] },
|
|
42
|
+
expiresAt: { type: ['string', 'null'] },
|
|
43
|
+
userEmail: { type: ['string', 'null'] },
|
|
44
|
+
userId: { type: ['string', 'null'] },
|
|
45
|
+
},
|
|
46
|
+
},
|
|
47
|
+
context: {
|
|
48
|
+
type: 'object',
|
|
49
|
+
properties: {
|
|
50
|
+
lastProject: { type: ['string', 'null'] },
|
|
51
|
+
lastProjectId: { type: ['string', 'null'] },
|
|
52
|
+
},
|
|
53
|
+
},
|
|
54
|
+
limits: {
|
|
55
|
+
type: 'object',
|
|
56
|
+
properties: {
|
|
57
|
+
maxActionsPerStax: { type: 'number', minimum: 1, maximum: 50 },
|
|
58
|
+
warnAt: { type: 'number', minimum: 1 },
|
|
59
|
+
},
|
|
60
|
+
},
|
|
61
|
+
display: {
|
|
62
|
+
type: 'object',
|
|
63
|
+
properties: {
|
|
64
|
+
defaultListCount: { type: 'number', minimum: 1 },
|
|
65
|
+
showBreadcrumbsDays: { type: 'number', minimum: 1 },
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
supabaseUrl: { type: 'string' },
|
|
69
|
+
supabaseAnonKey: { type: 'string' },
|
|
70
|
+
},
|
|
71
|
+
});
|
|
72
|
+
}
|
|
73
|
+
get path() {
|
|
74
|
+
return this.conf.path;
|
|
75
|
+
}
|
|
76
|
+
// Auth methods
|
|
77
|
+
getAuth() {
|
|
78
|
+
return this.conf.get('auth');
|
|
79
|
+
}
|
|
80
|
+
setAuth(auth) {
|
|
81
|
+
const current = this.getAuth();
|
|
82
|
+
this.conf.set('auth', { ...current, ...auth });
|
|
83
|
+
}
|
|
84
|
+
clearAuth() {
|
|
85
|
+
this.conf.set('auth', DEFAULT_CONFIG.auth);
|
|
86
|
+
}
|
|
87
|
+
isAuthenticated() {
|
|
88
|
+
const auth = this.getAuth();
|
|
89
|
+
if (!auth.accessToken)
|
|
90
|
+
return false;
|
|
91
|
+
// Check expiry
|
|
92
|
+
if (auth.expiresAt) {
|
|
93
|
+
const expiry = new Date(auth.expiresAt).getTime();
|
|
94
|
+
if (Date.now() > expiry)
|
|
95
|
+
return false;
|
|
96
|
+
}
|
|
97
|
+
return true;
|
|
98
|
+
}
|
|
99
|
+
// Context methods
|
|
100
|
+
getContext() {
|
|
101
|
+
return this.conf.get('context');
|
|
102
|
+
}
|
|
103
|
+
setLastProject(name, id) {
|
|
104
|
+
this.conf.set('context', { lastProject: name, lastProjectId: id });
|
|
105
|
+
}
|
|
106
|
+
// Limits methods
|
|
107
|
+
getLimits() {
|
|
108
|
+
return this.conf.get('limits');
|
|
109
|
+
}
|
|
110
|
+
// Display methods
|
|
111
|
+
getDisplay() {
|
|
112
|
+
return this.conf.get('display');
|
|
113
|
+
}
|
|
114
|
+
// Supabase credentials
|
|
115
|
+
getSupabaseUrl() {
|
|
116
|
+
return this.conf.get('supabaseUrl');
|
|
117
|
+
}
|
|
118
|
+
getSupabaseAnonKey() {
|
|
119
|
+
return this.conf.get('supabaseAnonKey');
|
|
120
|
+
}
|
|
121
|
+
// Full config
|
|
122
|
+
getAll() {
|
|
123
|
+
return this.conf.store;
|
|
124
|
+
}
|
|
125
|
+
reset() {
|
|
126
|
+
this.conf.clear();
|
|
127
|
+
}
|
|
128
|
+
}
|
|
129
|
+
// Singleton instance
|
|
130
|
+
export const config = new ConfigManager();
|
|
131
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../../src/lib/config.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,OAAO,IAAI,MAAM,MAAM,CAAA;AAkCvB,MAAM,cAAc,GAAc;IAChC,IAAI,EAAE;QACJ,WAAW,EAAE,IAAI;QACjB,YAAY,EAAE,IAAI;QAClB,SAAS,EAAE,IAAI;QACf,SAAS,EAAE,IAAI;QACf,MAAM,EAAE,IAAI;KACb;IACD,OAAO,EAAE;QACP,WAA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A;YACjD,IAAI,IAAI,CAAC,GAAG,EAAE,GAAG,MAAM;gBAAE,OAAO,KAAK,CAAA;QACvC,CAAC;QAED,OAAO,IAAI,CAAA;IACb,CAAC;IAED,kBAAkB;IAClB,UAAU;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACjC,CAAC;IAED,cAAc,CAAC,IAAY,EAAE,EAAU;QACrC,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,EAAE,EAAE,WAAW,EAAE,IAAI,EAAE,aAAa,EAAE,EAAE,EAAE,CAAC,CAAA;IACpE,CAAC;IAED,iBAAiB;IACjB,SAAS;QACP,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAA;IAChC,CAAC;IAED,kBAAkB;IAClB,UAAU;QACR,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,SAAS,CAAC,CAAA;IACjC,CAAC;IAED,uBAAuB;IACvB,cAAc;QACZ,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,aAAa,CAAC,CAAA;IACrC,CAAC;IAED,kBAAkB;QAChB,OAAO,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,iBAAiB,CAAC,CAAA;IACzC,CAAC;IAED,cAAc;IACd,MAAM;QACJ,OAAO,IAAI,CAAC,IAAI,CAAC,KAAK,CAAA;IACxB,CAAC;IAED,KAAK;QACH,IAAI,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;IACnB,CAAC;CACF;AAED,qBAAqB;AACrB,MAAM,CAAC,MAAM,MAAM,GAAG,IAAI,aAAa,EAAE,CAAA"}
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Output formatting for Hey CLI
|
|
3
|
+
* Handles terminal colors and consistent formatting
|
|
4
|
+
*/
|
|
5
|
+
import type { Stax, NextAction, StaxWithActions } from './api.js';
|
|
6
|
+
export declare const PRIORITY_ICONS: {
|
|
7
|
+
readonly must: "★";
|
|
8
|
+
readonly should: "◆";
|
|
9
|
+
readonly good: "○";
|
|
10
|
+
readonly meh: "·";
|
|
11
|
+
readonly unset: "·";
|
|
12
|
+
};
|
|
13
|
+
export declare const PRIORITY_COLORS: {
|
|
14
|
+
readonly must: import("chalk").ChalkInstance;
|
|
15
|
+
readonly should: import("chalk").ChalkInstance;
|
|
16
|
+
readonly good: import("chalk").ChalkInstance;
|
|
17
|
+
readonly meh: import("chalk").ChalkInstance;
|
|
18
|
+
readonly unset: import("chalk").ChalkInstance;
|
|
19
|
+
};
|
|
20
|
+
export declare function formatPriority(priority: string | null | undefined): string;
|
|
21
|
+
export declare function formatPriorityWithLabel(priority: string | null | undefined): string;
|
|
22
|
+
export declare function formatRelativeTime(date: string | Date): string;
|
|
23
|
+
export declare function formatActionAge(date: string | Date): string;
|
|
24
|
+
export declare function formatLimitStatus(count: number, max?: number): string;
|
|
25
|
+
export declare function formatAction(action: NextAction, index: number): string;
|
|
26
|
+
export declare function formatBreadcrumb(action: NextAction): string;
|
|
27
|
+
export declare function formatStaxHeader(stax: Stax | StaxWithActions, priority?: string | null, actionCount?: number, maxActions?: number): string;
|
|
28
|
+
export declare function formatStaxListItem(stax: StaxWithActions, maxActions?: number): string;
|
|
29
|
+
export declare function printSuccess(message: string): void;
|
|
30
|
+
export declare function printError(message: string): void;
|
|
31
|
+
export declare function printWarning(message: string): void;
|
|
32
|
+
export declare function printInfo(message: string): void;
|
|
33
|
+
export declare function printActions(stax: Stax, actions: NextAction[], breadcrumbs?: NextAction[], priority?: string | null): void;
|
|
34
|
+
export declare function printStaxList(staxList: StaxWithActions[]): void;
|
|
35
|
+
export declare function printStaxExpanded(staxList: StaxWithActions[], actionsPerStax?: number): void;
|
|
36
|
+
export declare function printLimitWarning(stax: Stax, currentCount: number, maxCount: number): void;
|
|
37
|
+
//# sourceMappingURL=output.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"output.d.ts","sourceRoot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