@tdsoft-tech/aikit 0.1.31 → 0.1.33

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,263 @@
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' | 'cursor';
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", "cursor"]>>;
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
+ /**
246
+ * Enable Cursor platform support
247
+ * Default: false (opt-in)
248
+ */
249
+ cursor: z.ZodDefault<z.ZodBoolean>;
250
+ }, "strip", z.ZodTypeAny, {
251
+ opencode: boolean;
252
+ claude: boolean;
253
+ cursor: boolean;
254
+ primary: "opencode" | "claude" | "cursor";
255
+ }, {
256
+ opencode?: boolean | undefined;
257
+ claude?: boolean | undefined;
258
+ cursor?: boolean | undefined;
259
+ primary?: "opencode" | "claude" | "cursor" | undefined;
260
+ }>>;
8
261
  skills: z.ZodDefault<z.ZodObject<{
9
262
  enabled: z.ZodDefault<z.ZodBoolean>;
10
263
  directory: z.ZodOptional<z.ZodString>;
@@ -82,6 +335,16 @@ declare const ConfigSchema: z.ZodObject<{
82
335
  specFile?: string | undefined;
83
336
  reviewFile?: string | undefined;
84
337
  }>>;
338
+ database: z.ZodDefault<z.ZodObject<{
339
+ enabled: z.ZodDefault<z.ZodBoolean>;
340
+ path: z.ZodOptional<z.ZodString>;
341
+ }, "strip", z.ZodTypeAny, {
342
+ enabled: boolean;
343
+ path?: string | undefined;
344
+ }, {
345
+ path?: string | undefined;
346
+ enabled?: boolean | undefined;
347
+ }>>;
85
348
  mcp: z.ZodOptional<z.ZodObject<{
86
349
  context7: z.ZodDefault<z.ZodBoolean>;
87
350
  githubGrep: z.ZodDefault<z.ZodBoolean>;
@@ -120,6 +383,12 @@ declare const ConfigSchema: z.ZodObject<{
120
383
  maxSize?: number | undefined;
121
384
  };
122
385
  version: string;
386
+ platform: {
387
+ opencode: boolean;
388
+ claude: boolean;
389
+ cursor: boolean;
390
+ primary: "opencode" | "claude" | "cursor";
391
+ };
123
392
  beads: {
124
393
  enabled: boolean;
125
394
  autoInit: boolean;
@@ -129,6 +398,10 @@ declare const ConfigSchema: z.ZodObject<{
129
398
  specFile: string;
130
399
  reviewFile: string;
131
400
  };
401
+ database: {
402
+ enabled: boolean;
403
+ path?: string | undefined;
404
+ };
132
405
  mcp?: {
133
406
  context7: boolean;
134
407
  githubGrep: boolean;
@@ -159,6 +432,12 @@ declare const ConfigSchema: z.ZodObject<{
159
432
  enabled?: boolean | undefined;
160
433
  maxSize?: number | undefined;
161
434
  } | undefined;
435
+ platform?: {
436
+ opencode?: boolean | undefined;
437
+ claude?: boolean | undefined;
438
+ cursor?: boolean | undefined;
439
+ primary?: "opencode" | "claude" | "cursor" | undefined;
440
+ } | undefined;
162
441
  beads?: {
163
442
  enabled?: boolean | undefined;
164
443
  autoInit?: boolean | undefined;
@@ -168,6 +447,10 @@ declare const ConfigSchema: z.ZodObject<{
168
447
  specFile?: string | undefined;
169
448
  reviewFile?: string | undefined;
170
449
  } | undefined;
450
+ database?: {
451
+ path?: string | undefined;
452
+ enabled?: boolean | undefined;
453
+ } | undefined;
171
454
  mcp?: {
172
455
  context7?: boolean | undefined;
173
456
  githubGrep?: boolean | undefined;
@@ -217,13 +500,39 @@ declare class Config {
217
500
  specFile: string;
218
501
  reviewFile: string;
219
502
  };
503
+ get database(): {
504
+ enabled: boolean;
505
+ path?: string | undefined;
506
+ };
220
507
  get mode(): string | undefined;
508
+ get platform(): {
509
+ opencode: boolean;
510
+ claude: boolean;
511
+ cursor: boolean;
512
+ primary: "opencode" | "claude" | "cursor";
513
+ };
221
514
  get configPath(): string;
515
+ /**
516
+ * Check if a specific platform is enabled
517
+ */
518
+ isPlatformEnabled(platform: PlatformType): boolean;
519
+ /**
520
+ * Get the primary platform
521
+ */
522
+ getPrimaryPlatform(): PlatformType;
523
+ /**
524
+ * Get list of all enabled platforms
525
+ */
526
+ getEnabledPlatforms(): PlatformType[];
222
527
  get projectPath(): string;
223
528
  /**
224
529
  * Get path to a specific resource
225
530
  */
226
- getPath(resource: 'skills' | 'agents' | 'commands' | 'tools' | 'plugins' | 'memory'): string;
531
+ getPath(resource: 'skills' | 'agents' | 'commands' | 'tools' | 'plugins' | 'memory' | 'database'): string;
532
+ /**
533
+ * Get database instance
534
+ */
535
+ getDatabase(): FigmaDatabase;
227
536
  }
228
537
  /**
229
538
  * Load AIKit configuration
@@ -412,15 +721,15 @@ declare const ToolConfigSchema: z.ZodObject<{
412
721
  config: z.ZodOptional<z.ZodRecord<z.ZodString, z.ZodUnknown>>;
413
722
  errorMessage: z.ZodOptional<z.ZodString>;
414
723
  }, "strip", z.ZodTypeAny, {
415
- status: "ready" | "needs_config" | "error";
416
724
  name: string;
725
+ status: "ready" | "needs_config" | "error";
417
726
  description: string;
418
727
  configMethod: "oauth" | "manual" | "none";
419
728
  config?: Record<string, unknown> | undefined;
420
729
  errorMessage?: string | undefined;
421
730
  }, {
422
- status: "ready" | "needs_config" | "error";
423
731
  name: string;
732
+ status: "ready" | "needs_config" | "error";
424
733
  description: string;
425
734
  configMethod: "oauth" | "manual" | "none";
426
735
  config?: Record<string, unknown> | undefined;
@@ -464,12 +773,18 @@ declare class ToolConfigManager {
464
773
  private determineStatus;
465
774
  /**
466
775
  * Load saved configurations
776
+ * Checks both global and project configs, project takes precedence
467
777
  */
468
778
  private loadConfigs;
469
779
  /**
470
780
  * Save configurations
471
781
  */
472
782
  private saveConfigs;
783
+ /**
784
+ * Configure Claude Desktop MCP server for a tool
785
+ * This adds the MCP server configuration to Claude Desktop's config file
786
+ */
787
+ configureMcpServer(toolName: string, apiKey: string): Promise<void>;
473
788
  }
474
789
 
475
790
  /**
@@ -1035,6 +1350,22 @@ declare const paths: {
1035
1350
  * Get Claude Code CLI agents directory
1036
1351
  */
1037
1352
  claudeAgents(project?: boolean): string;
1353
+ /**
1354
+ * Get Cursor configuration directory
1355
+ */
1356
+ cursorConfig(scope?: "user" | "project"): string;
1357
+ /**
1358
+ * Get Cursor commands directory
1359
+ */
1360
+ cursorCommands(project?: boolean): string;
1361
+ /**
1362
+ * Get Cursor skills directory
1363
+ */
1364
+ cursorSkills(project?: boolean): string;
1365
+ /**
1366
+ * Get Cursor agents directory
1367
+ */
1368
+ cursorAgents(project?: boolean): string;
1038
1369
  };
1039
1370
 
1040
1371
  /**
@@ -1043,4 +1374,4 @@ declare const paths: {
1043
1374
  */
1044
1375
  declare function getVersion(): string;
1045
1376
 
1046
- 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, checkForUpdatesAsync, defineTool, loadConfig, logger, paths };
1377
+ 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 };