skema-core 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 +116 -0
- package/dist/cli.js +37 -0
- package/dist/index.d.mts +356 -0
- package/dist/index.d.ts +356 -0
- package/dist/index.js +2334 -0
- package/dist/index.js.map +1 -0
- package/dist/index.mjs +2307 -0
- package/dist/index.mjs.map +1 -0
- package/dist/server.d.mts +260 -0
- package/dist/server.d.ts +260 -0
- package/dist/server.js +476 -0
- package/dist/server.js.map +1 -0
- package/dist/server.mjs +465 -0
- package/dist/server.mjs.map +1 -0
- package/package.json +76 -0
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { ChildProcess } from 'child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single DOM element in a selection
|
|
5
|
+
*/
|
|
6
|
+
interface DOMElement {
|
|
7
|
+
selector: string;
|
|
8
|
+
tagName: string;
|
|
9
|
+
elementPath: string;
|
|
10
|
+
text: string;
|
|
11
|
+
boundingBox: BoundingBox;
|
|
12
|
+
cssClasses?: string;
|
|
13
|
+
attributes?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a DOM element selection (can contain one or more elements)
|
|
17
|
+
*/
|
|
18
|
+
interface DOMSelection {
|
|
19
|
+
id: string;
|
|
20
|
+
selector: string;
|
|
21
|
+
tagName: string;
|
|
22
|
+
elementPath: string;
|
|
23
|
+
text: string;
|
|
24
|
+
boundingBox: BoundingBox;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
pathname: string;
|
|
27
|
+
cssClasses?: string;
|
|
28
|
+
attributes?: Record<string, string>;
|
|
29
|
+
/** User annotation comment */
|
|
30
|
+
comment?: string;
|
|
31
|
+
/** Whether this is a multi-element selection */
|
|
32
|
+
isMultiSelect?: boolean;
|
|
33
|
+
/** Individual elements when this is a grouped selection */
|
|
34
|
+
elements?: DOMElement[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Bounding box for element positioning
|
|
38
|
+
*/
|
|
39
|
+
interface BoundingBox {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Viewport information for coordinate calculations
|
|
47
|
+
*/
|
|
48
|
+
interface ViewportInfo {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
scrollX: number;
|
|
52
|
+
scrollY: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Computed styles for an element
|
|
56
|
+
*/
|
|
57
|
+
interface ElementStyles {
|
|
58
|
+
fontFamily?: string;
|
|
59
|
+
fontSize?: string;
|
|
60
|
+
fontWeight?: string;
|
|
61
|
+
lineHeight?: string;
|
|
62
|
+
letterSpacing?: string;
|
|
63
|
+
textAlign?: string;
|
|
64
|
+
color?: string;
|
|
65
|
+
padding?: string;
|
|
66
|
+
margin?: string;
|
|
67
|
+
gap?: string;
|
|
68
|
+
display?: string;
|
|
69
|
+
flexDirection?: string;
|
|
70
|
+
alignItems?: string;
|
|
71
|
+
justifyContent?: string;
|
|
72
|
+
backgroundColor?: string;
|
|
73
|
+
borderRadius?: string;
|
|
74
|
+
border?: string;
|
|
75
|
+
boxShadow?: string;
|
|
76
|
+
width?: string;
|
|
77
|
+
height?: string;
|
|
78
|
+
maxWidth?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Nearby element with style context for AI
|
|
82
|
+
*/
|
|
83
|
+
interface NearbyElement {
|
|
84
|
+
selector: string;
|
|
85
|
+
tagName: string;
|
|
86
|
+
text?: string;
|
|
87
|
+
className?: string;
|
|
88
|
+
styles?: ElementStyles;
|
|
89
|
+
tailwindClasses?: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Project-level style context
|
|
93
|
+
*/
|
|
94
|
+
interface ProjectStyleContext {
|
|
95
|
+
cssFramework?: 'tailwind' | 'bootstrap' | 'material-ui' | 'chakra' | 'vanilla' | 'css-modules' | 'styled-components' | 'unknown';
|
|
96
|
+
cssVariables?: Record<string, string>;
|
|
97
|
+
colorPalette?: string[];
|
|
98
|
+
baseFontFamily?: string;
|
|
99
|
+
baseFontSize?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Drawing annotation from tldraw
|
|
103
|
+
*/
|
|
104
|
+
interface DrawingAnnotation {
|
|
105
|
+
id: string;
|
|
106
|
+
type: 'drawing';
|
|
107
|
+
tool: string;
|
|
108
|
+
shapes: unknown[];
|
|
109
|
+
boundingBox: BoundingBox;
|
|
110
|
+
relatedTo?: string;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
/** User annotation comment describing what to build */
|
|
113
|
+
comment?: string;
|
|
114
|
+
/** SVG representation of the drawing for AI processing */
|
|
115
|
+
drawingSvg?: string;
|
|
116
|
+
/** Base64 PNG image of the drawing for vision AI */
|
|
117
|
+
drawingImage?: string;
|
|
118
|
+
/** Extracted text content from text shapes in the drawing */
|
|
119
|
+
extractedText?: string;
|
|
120
|
+
/** Grid configuration used for positioning reference */
|
|
121
|
+
gridConfig?: {
|
|
122
|
+
color: string;
|
|
123
|
+
size: number;
|
|
124
|
+
labels: boolean;
|
|
125
|
+
};
|
|
126
|
+
/** Viewport info for relative sizing context */
|
|
127
|
+
viewport?: ViewportInfo;
|
|
128
|
+
/** Project-level style context */
|
|
129
|
+
projectStyles?: ProjectStyleContext;
|
|
130
|
+
/** Nearby DOM elements that the drawing may relate to */
|
|
131
|
+
nearbyElements?: NearbyElement[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Gesture action annotation
|
|
135
|
+
*/
|
|
136
|
+
interface GestureAnnotation {
|
|
137
|
+
id: string;
|
|
138
|
+
type: 'gesture';
|
|
139
|
+
gesture: 'scribble_delete' | 'circle' | 'rectangle' | 'arrow';
|
|
140
|
+
target?: string;
|
|
141
|
+
boundingBox: BoundingBox;
|
|
142
|
+
timestamp: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Union type for all annotation types
|
|
146
|
+
*/
|
|
147
|
+
type Annotation = {
|
|
148
|
+
type: 'dom_selection';
|
|
149
|
+
} & DOMSelection | DrawingAnnotation | GestureAnnotation;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Revert changes for an annotation by restoring from snapshot
|
|
153
|
+
*/
|
|
154
|
+
declare function revertAnnotation(annotationId: string, cwd?: string): {
|
|
155
|
+
success: boolean;
|
|
156
|
+
message: string;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Get all tracked annotation IDs
|
|
160
|
+
*/
|
|
161
|
+
declare function getTrackedAnnotations(): string[];
|
|
162
|
+
interface GeminiCLIOptions {
|
|
163
|
+
/** Working directory for Gemini CLI */
|
|
164
|
+
cwd?: string;
|
|
165
|
+
/** API key (defaults to GEMINI_API_KEY env var) */
|
|
166
|
+
apiKey?: string;
|
|
167
|
+
/** Auto-approve all tool calls (default: true) */
|
|
168
|
+
yolo?: boolean;
|
|
169
|
+
/** Output format (default: 'stream-json') */
|
|
170
|
+
outputFormat?: 'text' | 'json' | 'stream-json';
|
|
171
|
+
/** Model to use (default: 'gemini-2.5-flash' for speed) */
|
|
172
|
+
model?: string;
|
|
173
|
+
/** Use minimal/fast prompt (default: true) */
|
|
174
|
+
fastMode?: boolean;
|
|
175
|
+
}
|
|
176
|
+
interface ProjectContext {
|
|
177
|
+
pathname?: string;
|
|
178
|
+
viewport?: {
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
interface GeminiCLIEvent {
|
|
184
|
+
type: 'init' | 'message' | 'tool_use' | 'tool_result' | 'error' | 'result' | 'done' | 'debug';
|
|
185
|
+
timestamp?: string;
|
|
186
|
+
content?: string;
|
|
187
|
+
role?: 'user' | 'assistant';
|
|
188
|
+
tool_name?: string;
|
|
189
|
+
tool_id?: string;
|
|
190
|
+
status?: 'success' | 'error';
|
|
191
|
+
code?: number;
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Build a prompt for Gemini CLI from an annotation
|
|
196
|
+
*/
|
|
197
|
+
declare function buildPromptFromAnnotation(annotation: Partial<Annotation> & {
|
|
198
|
+
comment?: string;
|
|
199
|
+
}, projectContext?: ProjectContext, options?: {
|
|
200
|
+
fastMode?: boolean;
|
|
201
|
+
visionDescription?: string;
|
|
202
|
+
}): string;
|
|
203
|
+
/**
|
|
204
|
+
* Spawn Gemini CLI and return an async iterator of events
|
|
205
|
+
*/
|
|
206
|
+
declare function spawnGeminiCLI(prompt: string, options?: GeminiCLIOptions): {
|
|
207
|
+
process: ChildProcess;
|
|
208
|
+
events: AsyncIterable<GeminiCLIEvent>;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Create a streaming response for use in API routes (Next.js, Express, etc.)
|
|
212
|
+
*/
|
|
213
|
+
declare function createGeminiCLIStream(annotation: Partial<Annotation> & {
|
|
214
|
+
comment?: string;
|
|
215
|
+
}, projectContext?: ProjectContext, options?: GeminiCLIOptions): ReadableStream<Uint8Array>;
|
|
216
|
+
/**
|
|
217
|
+
* Run Gemini CLI and wait for completion
|
|
218
|
+
*/
|
|
219
|
+
declare function runGeminiCLI(annotation: Partial<Annotation> & {
|
|
220
|
+
comment?: string;
|
|
221
|
+
}, projectContext?: ProjectContext, options?: GeminiCLIOptions): Promise<{
|
|
222
|
+
success: boolean;
|
|
223
|
+
response: string;
|
|
224
|
+
events: GeminiCLIEvent[];
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Next.js App Router POST handler for Gemini CLI
|
|
228
|
+
*
|
|
229
|
+
* Usage in your app/api/gemini/route.ts:
|
|
230
|
+
* ```typescript
|
|
231
|
+
* export { POST, DELETE } from 'skema-core/server';
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* Or with custom options:
|
|
235
|
+
* ```typescript
|
|
236
|
+
* import { createGeminiRouteHandler, createRevertRouteHandler } from 'skema-core/server';
|
|
237
|
+
* export const POST = createGeminiRouteHandler({ cwd: '/custom/path' });
|
|
238
|
+
* export const DELETE = createRevertRouteHandler({ cwd: '/custom/path' });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
declare function createGeminiRouteHandler(defaultOptions?: GeminiCLIOptions): (request: Request) => Promise<Response>;
|
|
242
|
+
/**
|
|
243
|
+
* Next.js App Router DELETE handler for reverting Gemini changes
|
|
244
|
+
*/
|
|
245
|
+
declare function createRevertRouteHandler(defaultOptions?: {
|
|
246
|
+
cwd?: string;
|
|
247
|
+
}): (request: Request) => Promise<Response>;
|
|
248
|
+
/**
|
|
249
|
+
* Default POST handler - ready to use in Next.js App Router
|
|
250
|
+
*
|
|
251
|
+
* Usage:
|
|
252
|
+
* ```typescript
|
|
253
|
+
* // app/api/gemini/route.ts
|
|
254
|
+
* export { POST, DELETE } from 'skema-core/server';
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
declare const POST: (request: Request) => Promise<Response>;
|
|
258
|
+
declare const DELETE: (request: Request) => Promise<Response>;
|
|
259
|
+
|
|
260
|
+
export { DELETE, type GeminiCLIEvent, type GeminiCLIOptions, POST, type ProjectContext, buildPromptFromAnnotation, createGeminiCLIStream, createGeminiRouteHandler, createRevertRouteHandler, getTrackedAnnotations, revertAnnotation, runGeminiCLI, spawnGeminiCLI };
|
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,260 @@
|
|
|
1
|
+
import { ChildProcess } from 'child_process';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Represents a single DOM element in a selection
|
|
5
|
+
*/
|
|
6
|
+
interface DOMElement {
|
|
7
|
+
selector: string;
|
|
8
|
+
tagName: string;
|
|
9
|
+
elementPath: string;
|
|
10
|
+
text: string;
|
|
11
|
+
boundingBox: BoundingBox;
|
|
12
|
+
cssClasses?: string;
|
|
13
|
+
attributes?: Record<string, string>;
|
|
14
|
+
}
|
|
15
|
+
/**
|
|
16
|
+
* Represents a DOM element selection (can contain one or more elements)
|
|
17
|
+
*/
|
|
18
|
+
interface DOMSelection {
|
|
19
|
+
id: string;
|
|
20
|
+
selector: string;
|
|
21
|
+
tagName: string;
|
|
22
|
+
elementPath: string;
|
|
23
|
+
text: string;
|
|
24
|
+
boundingBox: BoundingBox;
|
|
25
|
+
timestamp: number;
|
|
26
|
+
pathname: string;
|
|
27
|
+
cssClasses?: string;
|
|
28
|
+
attributes?: Record<string, string>;
|
|
29
|
+
/** User annotation comment */
|
|
30
|
+
comment?: string;
|
|
31
|
+
/** Whether this is a multi-element selection */
|
|
32
|
+
isMultiSelect?: boolean;
|
|
33
|
+
/** Individual elements when this is a grouped selection */
|
|
34
|
+
elements?: DOMElement[];
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Bounding box for element positioning
|
|
38
|
+
*/
|
|
39
|
+
interface BoundingBox {
|
|
40
|
+
x: number;
|
|
41
|
+
y: number;
|
|
42
|
+
width: number;
|
|
43
|
+
height: number;
|
|
44
|
+
}
|
|
45
|
+
/**
|
|
46
|
+
* Viewport information for coordinate calculations
|
|
47
|
+
*/
|
|
48
|
+
interface ViewportInfo {
|
|
49
|
+
width: number;
|
|
50
|
+
height: number;
|
|
51
|
+
scrollX: number;
|
|
52
|
+
scrollY: number;
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Computed styles for an element
|
|
56
|
+
*/
|
|
57
|
+
interface ElementStyles {
|
|
58
|
+
fontFamily?: string;
|
|
59
|
+
fontSize?: string;
|
|
60
|
+
fontWeight?: string;
|
|
61
|
+
lineHeight?: string;
|
|
62
|
+
letterSpacing?: string;
|
|
63
|
+
textAlign?: string;
|
|
64
|
+
color?: string;
|
|
65
|
+
padding?: string;
|
|
66
|
+
margin?: string;
|
|
67
|
+
gap?: string;
|
|
68
|
+
display?: string;
|
|
69
|
+
flexDirection?: string;
|
|
70
|
+
alignItems?: string;
|
|
71
|
+
justifyContent?: string;
|
|
72
|
+
backgroundColor?: string;
|
|
73
|
+
borderRadius?: string;
|
|
74
|
+
border?: string;
|
|
75
|
+
boxShadow?: string;
|
|
76
|
+
width?: string;
|
|
77
|
+
height?: string;
|
|
78
|
+
maxWidth?: string;
|
|
79
|
+
}
|
|
80
|
+
/**
|
|
81
|
+
* Nearby element with style context for AI
|
|
82
|
+
*/
|
|
83
|
+
interface NearbyElement {
|
|
84
|
+
selector: string;
|
|
85
|
+
tagName: string;
|
|
86
|
+
text?: string;
|
|
87
|
+
className?: string;
|
|
88
|
+
styles?: ElementStyles;
|
|
89
|
+
tailwindClasses?: string[];
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Project-level style context
|
|
93
|
+
*/
|
|
94
|
+
interface ProjectStyleContext {
|
|
95
|
+
cssFramework?: 'tailwind' | 'bootstrap' | 'material-ui' | 'chakra' | 'vanilla' | 'css-modules' | 'styled-components' | 'unknown';
|
|
96
|
+
cssVariables?: Record<string, string>;
|
|
97
|
+
colorPalette?: string[];
|
|
98
|
+
baseFontFamily?: string;
|
|
99
|
+
baseFontSize?: string;
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Drawing annotation from tldraw
|
|
103
|
+
*/
|
|
104
|
+
interface DrawingAnnotation {
|
|
105
|
+
id: string;
|
|
106
|
+
type: 'drawing';
|
|
107
|
+
tool: string;
|
|
108
|
+
shapes: unknown[];
|
|
109
|
+
boundingBox: BoundingBox;
|
|
110
|
+
relatedTo?: string;
|
|
111
|
+
timestamp: number;
|
|
112
|
+
/** User annotation comment describing what to build */
|
|
113
|
+
comment?: string;
|
|
114
|
+
/** SVG representation of the drawing for AI processing */
|
|
115
|
+
drawingSvg?: string;
|
|
116
|
+
/** Base64 PNG image of the drawing for vision AI */
|
|
117
|
+
drawingImage?: string;
|
|
118
|
+
/** Extracted text content from text shapes in the drawing */
|
|
119
|
+
extractedText?: string;
|
|
120
|
+
/** Grid configuration used for positioning reference */
|
|
121
|
+
gridConfig?: {
|
|
122
|
+
color: string;
|
|
123
|
+
size: number;
|
|
124
|
+
labels: boolean;
|
|
125
|
+
};
|
|
126
|
+
/** Viewport info for relative sizing context */
|
|
127
|
+
viewport?: ViewportInfo;
|
|
128
|
+
/** Project-level style context */
|
|
129
|
+
projectStyles?: ProjectStyleContext;
|
|
130
|
+
/** Nearby DOM elements that the drawing may relate to */
|
|
131
|
+
nearbyElements?: NearbyElement[];
|
|
132
|
+
}
|
|
133
|
+
/**
|
|
134
|
+
* Gesture action annotation
|
|
135
|
+
*/
|
|
136
|
+
interface GestureAnnotation {
|
|
137
|
+
id: string;
|
|
138
|
+
type: 'gesture';
|
|
139
|
+
gesture: 'scribble_delete' | 'circle' | 'rectangle' | 'arrow';
|
|
140
|
+
target?: string;
|
|
141
|
+
boundingBox: BoundingBox;
|
|
142
|
+
timestamp: number;
|
|
143
|
+
}
|
|
144
|
+
/**
|
|
145
|
+
* Union type for all annotation types
|
|
146
|
+
*/
|
|
147
|
+
type Annotation = {
|
|
148
|
+
type: 'dom_selection';
|
|
149
|
+
} & DOMSelection | DrawingAnnotation | GestureAnnotation;
|
|
150
|
+
|
|
151
|
+
/**
|
|
152
|
+
* Revert changes for an annotation by restoring from snapshot
|
|
153
|
+
*/
|
|
154
|
+
declare function revertAnnotation(annotationId: string, cwd?: string): {
|
|
155
|
+
success: boolean;
|
|
156
|
+
message: string;
|
|
157
|
+
};
|
|
158
|
+
/**
|
|
159
|
+
* Get all tracked annotation IDs
|
|
160
|
+
*/
|
|
161
|
+
declare function getTrackedAnnotations(): string[];
|
|
162
|
+
interface GeminiCLIOptions {
|
|
163
|
+
/** Working directory for Gemini CLI */
|
|
164
|
+
cwd?: string;
|
|
165
|
+
/** API key (defaults to GEMINI_API_KEY env var) */
|
|
166
|
+
apiKey?: string;
|
|
167
|
+
/** Auto-approve all tool calls (default: true) */
|
|
168
|
+
yolo?: boolean;
|
|
169
|
+
/** Output format (default: 'stream-json') */
|
|
170
|
+
outputFormat?: 'text' | 'json' | 'stream-json';
|
|
171
|
+
/** Model to use (default: 'gemini-2.5-flash' for speed) */
|
|
172
|
+
model?: string;
|
|
173
|
+
/** Use minimal/fast prompt (default: true) */
|
|
174
|
+
fastMode?: boolean;
|
|
175
|
+
}
|
|
176
|
+
interface ProjectContext {
|
|
177
|
+
pathname?: string;
|
|
178
|
+
viewport?: {
|
|
179
|
+
width: number;
|
|
180
|
+
height: number;
|
|
181
|
+
};
|
|
182
|
+
}
|
|
183
|
+
interface GeminiCLIEvent {
|
|
184
|
+
type: 'init' | 'message' | 'tool_use' | 'tool_result' | 'error' | 'result' | 'done' | 'debug';
|
|
185
|
+
timestamp?: string;
|
|
186
|
+
content?: string;
|
|
187
|
+
role?: 'user' | 'assistant';
|
|
188
|
+
tool_name?: string;
|
|
189
|
+
tool_id?: string;
|
|
190
|
+
status?: 'success' | 'error';
|
|
191
|
+
code?: number;
|
|
192
|
+
[key: string]: unknown;
|
|
193
|
+
}
|
|
194
|
+
/**
|
|
195
|
+
* Build a prompt for Gemini CLI from an annotation
|
|
196
|
+
*/
|
|
197
|
+
declare function buildPromptFromAnnotation(annotation: Partial<Annotation> & {
|
|
198
|
+
comment?: string;
|
|
199
|
+
}, projectContext?: ProjectContext, options?: {
|
|
200
|
+
fastMode?: boolean;
|
|
201
|
+
visionDescription?: string;
|
|
202
|
+
}): string;
|
|
203
|
+
/**
|
|
204
|
+
* Spawn Gemini CLI and return an async iterator of events
|
|
205
|
+
*/
|
|
206
|
+
declare function spawnGeminiCLI(prompt: string, options?: GeminiCLIOptions): {
|
|
207
|
+
process: ChildProcess;
|
|
208
|
+
events: AsyncIterable<GeminiCLIEvent>;
|
|
209
|
+
};
|
|
210
|
+
/**
|
|
211
|
+
* Create a streaming response for use in API routes (Next.js, Express, etc.)
|
|
212
|
+
*/
|
|
213
|
+
declare function createGeminiCLIStream(annotation: Partial<Annotation> & {
|
|
214
|
+
comment?: string;
|
|
215
|
+
}, projectContext?: ProjectContext, options?: GeminiCLIOptions): ReadableStream<Uint8Array>;
|
|
216
|
+
/**
|
|
217
|
+
* Run Gemini CLI and wait for completion
|
|
218
|
+
*/
|
|
219
|
+
declare function runGeminiCLI(annotation: Partial<Annotation> & {
|
|
220
|
+
comment?: string;
|
|
221
|
+
}, projectContext?: ProjectContext, options?: GeminiCLIOptions): Promise<{
|
|
222
|
+
success: boolean;
|
|
223
|
+
response: string;
|
|
224
|
+
events: GeminiCLIEvent[];
|
|
225
|
+
}>;
|
|
226
|
+
/**
|
|
227
|
+
* Next.js App Router POST handler for Gemini CLI
|
|
228
|
+
*
|
|
229
|
+
* Usage in your app/api/gemini/route.ts:
|
|
230
|
+
* ```typescript
|
|
231
|
+
* export { POST, DELETE } from 'skema-core/server';
|
|
232
|
+
* ```
|
|
233
|
+
*
|
|
234
|
+
* Or with custom options:
|
|
235
|
+
* ```typescript
|
|
236
|
+
* import { createGeminiRouteHandler, createRevertRouteHandler } from 'skema-core/server';
|
|
237
|
+
* export const POST = createGeminiRouteHandler({ cwd: '/custom/path' });
|
|
238
|
+
* export const DELETE = createRevertRouteHandler({ cwd: '/custom/path' });
|
|
239
|
+
* ```
|
|
240
|
+
*/
|
|
241
|
+
declare function createGeminiRouteHandler(defaultOptions?: GeminiCLIOptions): (request: Request) => Promise<Response>;
|
|
242
|
+
/**
|
|
243
|
+
* Next.js App Router DELETE handler for reverting Gemini changes
|
|
244
|
+
*/
|
|
245
|
+
declare function createRevertRouteHandler(defaultOptions?: {
|
|
246
|
+
cwd?: string;
|
|
247
|
+
}): (request: Request) => Promise<Response>;
|
|
248
|
+
/**
|
|
249
|
+
* Default POST handler - ready to use in Next.js App Router
|
|
250
|
+
*
|
|
251
|
+
* Usage:
|
|
252
|
+
* ```typescript
|
|
253
|
+
* // app/api/gemini/route.ts
|
|
254
|
+
* export { POST, DELETE } from 'skema-core/server';
|
|
255
|
+
* ```
|
|
256
|
+
*/
|
|
257
|
+
declare const POST: (request: Request) => Promise<Response>;
|
|
258
|
+
declare const DELETE: (request: Request) => Promise<Response>;
|
|
259
|
+
|
|
260
|
+
export { DELETE, type GeminiCLIEvent, type GeminiCLIOptions, POST, type ProjectContext, buildPromptFromAnnotation, createGeminiCLIStream, createGeminiRouteHandler, createRevertRouteHandler, getTrackedAnnotations, revertAnnotation, runGeminiCLI, spawnGeminiCLI };
|