@tdsoft-tech/aikit 0.1.30 → 0.1.32

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/dist/index.d.ts CHANGED
@@ -1,10 +1,256 @@
1
1
  import { z } from 'zod';
2
2
 
3
+ /**
4
+ * Database types for Figma data storage
5
+ */
6
+ /**
7
+ * Figma file record in database
8
+ */
9
+ interface FigmaFileRecord {
10
+ id: string;
11
+ url: string;
12
+ name?: string;
13
+ file_key: string;
14
+ last_analyzed?: Date;
15
+ created_at: Date;
16
+ updated_at: Date;
17
+ }
18
+ /**
19
+ * Figma screen/frame record in database
20
+ */
21
+ interface FigmaScreenRecord {
22
+ id: string;
23
+ file_id: string;
24
+ name: string;
25
+ width?: number;
26
+ height?: number;
27
+ type?: string;
28
+ description?: string;
29
+ children_count?: number;
30
+ }
31
+ /**
32
+ * Figma node (component/section) record in database
33
+ */
34
+ interface FigmaNodeRecord {
35
+ id: string;
36
+ file_id: string;
37
+ screen_id?: string;
38
+ parent_id?: string;
39
+ name: string;
40
+ type: string;
41
+ content?: string;
42
+ position_x?: number;
43
+ position_y?: number;
44
+ width?: number;
45
+ height?: number;
46
+ styles?: string;
47
+ children_ids?: string;
48
+ }
49
+ /**
50
+ * Design token record in database
51
+ */
52
+ interface DesignTokenRecord {
53
+ id?: number;
54
+ file_id: string;
55
+ type: 'color' | 'typography' | 'spacing' | 'component';
56
+ name: string;
57
+ value: string;
58
+ category?: string;
59
+ }
60
+ /**
61
+ * Figma asset record in database
62
+ */
63
+ interface FigmaAssetRecord {
64
+ id?: number;
65
+ file_id: string;
66
+ node_id: string;
67
+ node_name?: string;
68
+ node_type?: string;
69
+ format?: 'png' | 'svg' | 'jpg';
70
+ file_path?: string;
71
+ url?: string;
72
+ width?: number;
73
+ height?: number;
74
+ }
75
+ /**
76
+ * Query options for database operations
77
+ */
78
+ interface QueryOptions {
79
+ limit?: number;
80
+ offset?: number;
81
+ orderBy?: string;
82
+ orderDirection?: 'ASC' | 'DESC';
83
+ }
84
+ /**
85
+ * Upsert result
86
+ */
87
+ interface UpsertResult {
88
+ id: string;
89
+ created: boolean;
90
+ updated: boolean;
91
+ }
92
+ /**
93
+ * Database interface for Figma data
94
+ */
95
+ interface FigmaDatabase$1 {
96
+ upsertFile(file: Omit<FigmaFileRecord, 'created_at' | 'updated_at'>): Promise<UpsertResult>;
97
+ getFile(id: string): Promise<FigmaFileRecord | null>;
98
+ getFileByUrl(url: string): Promise<FigmaFileRecord | null>;
99
+ deleteFile(id: string): Promise<boolean>;
100
+ listFiles(options?: QueryOptions): Promise<FigmaFileRecord[]>;
101
+ upsertScreen(screen: FigmaScreenRecord): Promise<UpsertResult>;
102
+ getScreen(id: string): Promise<FigmaScreenRecord | null>;
103
+ getScreensByFile(fileId: string): Promise<FigmaScreenRecord[]>;
104
+ deleteScreen(id: string): Promise<boolean>;
105
+ upsertNode(node: FigmaNodeRecord): Promise<UpsertResult>;
106
+ getNode(id: string): Promise<FigmaNodeRecord | null>;
107
+ getNodesByScreen(screenId: string): Promise<FigmaNodeRecord[]>;
108
+ getNodesByFile(fileId: string): Promise<FigmaNodeRecord[]>;
109
+ deleteNode(id: string): Promise<boolean>;
110
+ upsertDesignToken(token: Omit<DesignTokenRecord, 'id'>): Promise<UpsertResult>;
111
+ getDesignTokensByFile(fileId: string, type?: string): Promise<DesignTokenRecord[]>;
112
+ deleteDesignTokensByFile(fileId: string): Promise<boolean>;
113
+ upsertAsset(asset: Omit<FigmaAssetRecord, 'id'>): Promise<UpsertResult>;
114
+ getAssetsByFile(fileId: string): Promise<FigmaAssetRecord[]>;
115
+ deleteAssetsByFile(fileId: string): Promise<boolean>;
116
+ close(): Promise<void>;
117
+ vacuum(): Promise<void>;
118
+ getStats(): Promise<{
119
+ files: number;
120
+ screens: number;
121
+ nodes: number;
122
+ tokens: number;
123
+ assets: number;
124
+ }>;
125
+ }
126
+
127
+ /**
128
+ * SQLite-based Figma database implementation
129
+ */
130
+ declare class FigmaDatabase implements FigmaDatabase$1 {
131
+ private db;
132
+ constructor(dbPath?: string);
133
+ /**
134
+ * Export database data to JSON
135
+ */
136
+ exportData(fileId?: string): Promise<{
137
+ files: FigmaFileRecord[];
138
+ screens: FigmaScreenRecord[];
139
+ nodes: FigmaNodeRecord[];
140
+ tokens: DesignTokenRecord[];
141
+ assets: FigmaAssetRecord[];
142
+ exported_at: string;
143
+ }>;
144
+ /**
145
+ * Import database data from JSON
146
+ */
147
+ importData(data: {
148
+ files: FigmaFileRecord[];
149
+ screens: FigmaScreenRecord[];
150
+ nodes: FigmaNodeRecord[];
151
+ tokens: DesignTokenRecord[];
152
+ assets: FigmaAssetRecord[];
153
+ }): Promise<{
154
+ files: number;
155
+ screens: number;
156
+ nodes: number;
157
+ tokens: number;
158
+ assets: number;
159
+ }>;
160
+ /**
161
+ * Utility Operations
162
+ */
163
+ upsertFile(file: Omit<FigmaFileRecord, 'created_at' | 'updated_at'>): Promise<UpsertResult>;
164
+ getFile(id: string): Promise<FigmaFileRecord | null>;
165
+ getFileByUrl(url: string): Promise<FigmaFileRecord | null>;
166
+ deleteFile(id: string): Promise<boolean>;
167
+ listFiles(options?: QueryOptions): Promise<FigmaFileRecord[]>;
168
+ /**
169
+ * Screen Operations
170
+ */
171
+ upsertScreen(screen: FigmaScreenRecord): Promise<UpsertResult>;
172
+ getScreen(id: string): Promise<FigmaScreenRecord | null>;
173
+ getScreensByFile(fileId: string): Promise<FigmaScreenRecord[]>;
174
+ deleteScreen(id: string): Promise<boolean>;
175
+ /**
176
+ * Node Operations
177
+ */
178
+ upsertNode(node: FigmaNodeRecord): Promise<UpsertResult>;
179
+ getNode(id: string): Promise<FigmaNodeRecord | null>;
180
+ getNodesByScreen(screenId: string): Promise<FigmaNodeRecord[]>;
181
+ getNodesByFile(fileId: string): Promise<FigmaNodeRecord[]>;
182
+ deleteNode(id: string): Promise<boolean>;
183
+ /**
184
+ * Design Token Operations
185
+ */
186
+ upsertDesignToken(token: Omit<DesignTokenRecord, 'id'>): Promise<UpsertResult>;
187
+ getDesignTokensByFile(fileId: string, type?: string): Promise<DesignTokenRecord[]>;
188
+ deleteDesignTokensByFile(fileId: string): Promise<boolean>;
189
+ /**
190
+ * Asset Operations
191
+ */
192
+ upsertAsset(asset: Omit<FigmaAssetRecord, 'id'>): Promise<UpsertResult>;
193
+ getAssetsByFile(fileId: string): Promise<FigmaAssetRecord[]>;
194
+ deleteAssetsByFile(fileId: string): Promise<boolean>;
195
+ /**
196
+ * Cache invalidation logic
197
+ */
198
+ isCacheValid(url: string, maxAgeHours?: number): Promise<boolean>;
199
+ /**
200
+ * Clear cache for a specific file
201
+ */
202
+ clearFileCache(url: string): Promise<boolean>;
203
+ /**
204
+ * Clear all expired cache entries
205
+ */
206
+ clearExpiredCache(maxAgeHours?: number): Promise<number>;
207
+ close(): Promise<void>;
208
+ vacuum(): Promise<void>;
209
+ getStats(): Promise<{
210
+ files: number;
211
+ screens: number;
212
+ nodes: number;
213
+ tokens: number;
214
+ assets: number;
215
+ }>;
216
+ }
217
+
218
+ /**
219
+ * Platform types supported by AIKit
220
+ */
221
+ type PlatformType = 'opencode' | 'claude';
3
222
  /**
4
223
  * AIKit Configuration Schema
5
224
  */
6
225
  declare const ConfigSchema: z.ZodObject<{
7
226
  version: z.ZodString;
227
+ /**
228
+ * Platform configuration - controls which platforms are active
229
+ */
230
+ platform: z.ZodDefault<z.ZodObject<{
231
+ /**
232
+ * Primary platform to use (affects default behavior)
233
+ */
234
+ primary: z.ZodDefault<z.ZodEnum<["opencode", "claude"]>>;
235
+ /**
236
+ * Enable OpenCode platform support
237
+ * Default: true (OpenCode is the primary focus)
238
+ */
239
+ opencode: z.ZodDefault<z.ZodBoolean>;
240
+ /**
241
+ * Enable Claude Code platform support
242
+ * Default: false (archived, can be re-enabled later)
243
+ */
244
+ claude: z.ZodDefault<z.ZodBoolean>;
245
+ }, "strip", z.ZodTypeAny, {
246
+ opencode: boolean;
247
+ claude: boolean;
248
+ primary: "opencode" | "claude";
249
+ }, {
250
+ opencode?: boolean | undefined;
251
+ claude?: boolean | undefined;
252
+ primary?: "opencode" | "claude" | undefined;
253
+ }>>;
8
254
  skills: z.ZodDefault<z.ZodObject<{
9
255
  enabled: z.ZodDefault<z.ZodBoolean>;
10
256
  directory: z.ZodOptional<z.ZodString>;
@@ -82,6 +328,16 @@ declare const ConfigSchema: z.ZodObject<{
82
328
  specFile?: string | undefined;
83
329
  reviewFile?: string | undefined;
84
330
  }>>;
331
+ database: z.ZodDefault<z.ZodObject<{
332
+ enabled: z.ZodDefault<z.ZodBoolean>;
333
+ path: z.ZodOptional<z.ZodString>;
334
+ }, "strip", z.ZodTypeAny, {
335
+ enabled: boolean;
336
+ path?: string | undefined;
337
+ }, {
338
+ path?: string | undefined;
339
+ enabled?: boolean | undefined;
340
+ }>>;
85
341
  mcp: z.ZodOptional<z.ZodObject<{
86
342
  context7: z.ZodDefault<z.ZodBoolean>;
87
343
  githubGrep: z.ZodDefault<z.ZodBoolean>;
@@ -120,6 +376,11 @@ declare const ConfigSchema: z.ZodObject<{
120
376
  maxSize?: number | undefined;
121
377
  };
122
378
  version: string;
379
+ platform: {
380
+ opencode: boolean;
381
+ claude: boolean;
382
+ primary: "opencode" | "claude";
383
+ };
123
384
  beads: {
124
385
  enabled: boolean;
125
386
  autoInit: boolean;
@@ -129,6 +390,10 @@ declare const ConfigSchema: z.ZodObject<{
129
390
  specFile: string;
130
391
  reviewFile: string;
131
392
  };
393
+ database: {
394
+ enabled: boolean;
395
+ path?: string | undefined;
396
+ };
132
397
  mcp?: {
133
398
  context7: boolean;
134
399
  githubGrep: boolean;
@@ -159,6 +424,11 @@ declare const ConfigSchema: z.ZodObject<{
159
424
  enabled?: boolean | undefined;
160
425
  maxSize?: number | undefined;
161
426
  } | undefined;
427
+ platform?: {
428
+ opencode?: boolean | undefined;
429
+ claude?: boolean | undefined;
430
+ primary?: "opencode" | "claude" | undefined;
431
+ } | undefined;
162
432
  beads?: {
163
433
  enabled?: boolean | undefined;
164
434
  autoInit?: boolean | undefined;
@@ -168,6 +438,10 @@ declare const ConfigSchema: z.ZodObject<{
168
438
  specFile?: string | undefined;
169
439
  reviewFile?: string | undefined;
170
440
  } | undefined;
441
+ database?: {
442
+ path?: string | undefined;
443
+ enabled?: boolean | undefined;
444
+ } | undefined;
171
445
  mcp?: {
172
446
  context7?: boolean | undefined;
173
447
  githubGrep?: boolean | undefined;
@@ -217,13 +491,38 @@ declare class Config {
217
491
  specFile: string;
218
492
  reviewFile: string;
219
493
  };
494
+ get database(): {
495
+ enabled: boolean;
496
+ path?: string | undefined;
497
+ };
220
498
  get mode(): string | undefined;
499
+ get platform(): {
500
+ opencode: boolean;
501
+ claude: boolean;
502
+ primary: "opencode" | "claude";
503
+ };
221
504
  get configPath(): string;
505
+ /**
506
+ * Check if a specific platform is enabled
507
+ */
508
+ isPlatformEnabled(platform: PlatformType): boolean;
509
+ /**
510
+ * Get the primary platform
511
+ */
512
+ getPrimaryPlatform(): PlatformType;
513
+ /**
514
+ * Get list of all enabled platforms
515
+ */
516
+ getEnabledPlatforms(): PlatformType[];
222
517
  get projectPath(): string;
223
518
  /**
224
519
  * Get path to a specific resource
225
520
  */
226
- getPath(resource: 'skills' | 'agents' | 'commands' | 'tools' | 'plugins' | 'memory'): string;
521
+ getPath(resource: 'skills' | 'agents' | 'commands' | 'tools' | 'plugins' | 'memory' | 'database'): string;
522
+ /**
523
+ * Get database instance
524
+ */
525
+ getDatabase(): FigmaDatabase;
227
526
  }
228
527
  /**
229
528
  * Load AIKit configuration
@@ -412,15 +711,15 @@ declare const ToolConfigSchema: z.ZodObject<{
412
711
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
413
712
  errorMessage: z.ZodOptional<z.ZodString>;
414
713
  }, "strip", z.ZodTypeAny, {
415
- status: "ready" | "needs_config" | "error";
416
714
  name: string;
715
+ status: "ready" | "needs_config" | "error";
417
716
  description: string;
418
717
  configMethod: "oauth" | "manual" | "none";
419
718
  config?: Record<string, unknown> | undefined;
420
719
  errorMessage?: string | undefined;
421
720
  }, {
422
- status: "ready" | "needs_config" | "error";
423
721
  name: string;
722
+ status: "ready" | "needs_config" | "error";
424
723
  description: string;
425
724
  configMethod: "oauth" | "manual" | "none";
426
725
  config?: Record<string, unknown> | undefined;
@@ -464,12 +763,18 @@ declare class ToolConfigManager {
464
763
  private determineStatus;
465
764
  /**
466
765
  * Load saved configurations
766
+ * Checks both global and project configs, project takes precedence
467
767
  */
468
768
  private loadConfigs;
469
769
  /**
470
770
  * Save configurations
471
771
  */
472
772
  private saveConfigs;
773
+ /**
774
+ * Configure Claude Desktop MCP server for a tool
775
+ * This adds the MCP server configuration to Claude Desktop's config file
776
+ */
777
+ configureMcpServer(toolName: string, apiKey: string): Promise<void>;
473
778
  }
474
779
 
475
780
  /**
@@ -943,6 +1248,11 @@ declare class AntiHallucination {
943
1248
  private patternToRegex;
944
1249
  }
945
1250
 
1251
+ /**
1252
+ * Non-blocking public API for CLI
1253
+ */
1254
+ declare function checkForUpdatesAsync(): Promise<void>;
1255
+
946
1256
  /**
947
1257
  * Simple logger with colored output
948
1258
  */
@@ -1038,4 +1348,4 @@ declare const paths: {
1038
1348
  */
1039
1349
  declare function getVersion(): string;
1040
1350
 
1041
- export { type AIKitConfig, type Agent, AgentManager, type AgentType, AntiHallucination, BeadsIntegration, type Command, CommandRunner, Config, type Memory, MemoryManager, type Plugin, type PluginEvent, PluginSystem, type Skill, SkillEngine, type Tool, ToolRegistry, getVersion as VERSION, defineTool, loadConfig, logger, paths };
1351
+ export { type AIKitConfig, type Agent, AgentManager, type AgentType, AntiHallucination, BeadsIntegration, type Command, CommandRunner, Config, type Memory, MemoryManager, type Plugin, type PluginEvent, PluginSystem, type Skill, SkillEngine, type Tool, type ToolConfig, ToolConfigManager, ToolRegistry, type ToolStatus, getVersion as VERSION, checkForUpdatesAsync, defineTool, loadConfig, logger, paths };