@inspecto-dev/types 0.2.0-alpha.3 → 0.3.0-alpha.1
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.cjs +50 -78
- package/dist/index.d.cts +200 -231
- package/dist/index.d.ts +200 -231
- package/dist/index.js +50 -78
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -27,83 +27,7 @@ __export(index_exports, {
|
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(index_exports);
|
|
29
29
|
|
|
30
|
-
// src/
|
|
31
|
-
var DEFAULT_INTENTS = [
|
|
32
|
-
// ── 1. Explain Component ─────────────────────────────────────────────────
|
|
33
|
-
// Frequency: ★★★★★ — Most common action when navigating unfamiliar codebases
|
|
34
|
-
{
|
|
35
|
-
id: "explain",
|
|
36
|
-
label: "Explain Component",
|
|
37
|
-
prompt: `The following is a {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
38
|
-
|
|
39
|
-
Please explain:
|
|
40
|
-
|
|
41
|
-
1. What this component does and its responsibility in the UI
|
|
42
|
-
2. Key props and their purpose
|
|
43
|
-
3. Important state or side effects (if applicable)
|
|
44
|
-
4. Any non-obvious logic or edge cases worth noting`
|
|
45
|
-
},
|
|
46
|
-
// ── 2. Fix Bug ───────────────────────────────────────────────────────────
|
|
47
|
-
// Frequency: ★★★★★ — Debugging is the highest time-cost activity in frontend dev
|
|
48
|
-
{
|
|
49
|
-
id: "fix-bug",
|
|
50
|
-
label: "Fix Bug",
|
|
51
|
-
prompt: `I found a bug in the following {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
52
|
-
|
|
53
|
-
Please:
|
|
54
|
-
|
|
55
|
-
1. Identify potential bugs or issues in this code
|
|
56
|
-
2. Explain the root cause of each issue
|
|
57
|
-
3. Provide a fixed version with minimal changes
|
|
58
|
-
|
|
59
|
-
If you need more context (e.g. parent component, API response shape),
|
|
60
|
-
please ask before suggesting a fix.`
|
|
61
|
-
},
|
|
62
|
-
// ── 3. Fix Styles ────────────────────────────────────────────────────────
|
|
63
|
-
// Frequency: ★★★★ — Styling issues are top-3 daily pain points for frontend devs
|
|
64
|
-
{
|
|
65
|
-
id: "fix-styles",
|
|
66
|
-
label: "Fix Styles",
|
|
67
|
-
prompt: `The following component from \`{{file}}\` (line {{line}}) has a styling issue.
|
|
68
|
-
|
|
69
|
-
Please:
|
|
70
|
-
|
|
71
|
-
1. Review the current styles (className / inline styles / CSS-in-JS / Style blocks)
|
|
72
|
-
2. Identify common issues: layout shifts, overflow, z-index conflicts,
|
|
73
|
-
responsive breakpoints, or visual inconsistencies
|
|
74
|
-
3. Suggest fixes using the same styling approach already in use
|
|
75
|
-
|
|
76
|
-
Note: Maintain the existing styling conventions (e.g. Tailwind, CSS Modules, scoped styles).`
|
|
77
|
-
},
|
|
78
|
-
// ── 4. Refactor Component ────────────────────────────────────────────────
|
|
79
|
-
// Frequency: ★★★★ — Sustained demand after features stabilize; large component splits
|
|
80
|
-
{
|
|
81
|
-
id: "refactor",
|
|
82
|
-
label: "Refactor Component",
|
|
83
|
-
prompt: `Please refactor the following {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
84
|
-
|
|
85
|
-
Refactoring goals (apply as relevant):
|
|
86
|
-
|
|
87
|
-
- Extract reusable sub-components or composables/hooks
|
|
88
|
-
- Improve readability and reduce complexity
|
|
89
|
-
- Remove redundant state or unnecessary re-renders
|
|
90
|
-
- Apply {{framework}} best practices
|
|
91
|
-
- Maintain existing behavior \u2014 no functional changes
|
|
92
|
-
|
|
93
|
-
Please show the refactored version with a brief explanation of each change.`
|
|
94
|
-
},
|
|
95
|
-
// ── 5. Open in Editor ────────────────────────────────────────────────────
|
|
96
|
-
// Type: local action (no AI prompt) — jumps directly to source in IDE
|
|
97
|
-
{
|
|
98
|
-
id: "open-in-editor",
|
|
99
|
-
label: "Open in Editor",
|
|
100
|
-
prompt: "",
|
|
101
|
-
// unused — isAction handles this
|
|
102
|
-
isAction: true
|
|
103
|
-
}
|
|
104
|
-
];
|
|
105
|
-
|
|
106
|
-
// src/index.ts
|
|
30
|
+
// src/providers.ts
|
|
107
31
|
var VALID_MODES = {
|
|
108
32
|
copilot: ["extension"],
|
|
109
33
|
"claude-code": ["extension", "cli"],
|
|
@@ -122,6 +46,8 @@ var DEFAULT_PROVIDER_MODE = {
|
|
|
122
46
|
trae: "builtin",
|
|
123
47
|
cursor: "builtin"
|
|
124
48
|
};
|
|
49
|
+
|
|
50
|
+
// src/api.ts
|
|
125
51
|
var INSPECTO_API_PATHS = {
|
|
126
52
|
HEALTH: "/inspecto/api/v1/health",
|
|
127
53
|
CLIENT_CONFIG: "/inspecto/api/v1/client/config",
|
|
@@ -129,9 +55,55 @@ var INSPECTO_API_PATHS = {
|
|
|
129
55
|
IDE_OPEN: "/inspecto/api/v1/ide/open",
|
|
130
56
|
PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet",
|
|
131
57
|
AI_DISPATCH: "/inspecto/api/v1/ai/dispatch",
|
|
58
|
+
AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations",
|
|
132
59
|
AI_TICKET: "/inspecto/api/v1/ai/ticket"
|
|
133
|
-
// Usage: /inspecto/api/v1/ai/ticket/:id
|
|
134
60
|
};
|
|
61
|
+
|
|
62
|
+
// src/intents.ts
|
|
63
|
+
var DEFAULT_INTENTS = [
|
|
64
|
+
{
|
|
65
|
+
id: "explain",
|
|
66
|
+
label: "Explain",
|
|
67
|
+
aiIntent: "ask",
|
|
68
|
+
prompt: `Explain what this {{framework}} component from \`{{file}}\` (line {{line}}) does.
|
|
69
|
+
|
|
70
|
+
Focus on:
|
|
71
|
+
- its UI responsibility
|
|
72
|
+
- key props, state, or side effects
|
|
73
|
+
- any non-obvious logic worth noticing`
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
id: "fix-bug",
|
|
77
|
+
label: "Fix Bug",
|
|
78
|
+
aiIntent: "fix",
|
|
79
|
+
prompt: `Help fix a bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
80
|
+
|
|
81
|
+
Please:
|
|
82
|
+
- identify the most likely root cause
|
|
83
|
+
- explain why it happens
|
|
84
|
+
- suggest the smallest safe fix
|
|
85
|
+
|
|
86
|
+
If important context is missing, ask for it before proposing broader changes.`
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
id: "fix-ui",
|
|
90
|
+
label: "Fix UI",
|
|
91
|
+
aiIntent: "fix",
|
|
92
|
+
prompt: `Help fix a UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
93
|
+
|
|
94
|
+
Please review layout, spacing, overflow, alignment, layering, and visual consistency,
|
|
95
|
+
then suggest fixes using the same styling approach already used in this codebase.`
|
|
96
|
+
},
|
|
97
|
+
{
|
|
98
|
+
id: "improve",
|
|
99
|
+
label: "Improve",
|
|
100
|
+
aiIntent: "review",
|
|
101
|
+
prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}) and suggest practical improvements.
|
|
102
|
+
|
|
103
|
+
Focus on readability, maintainability, and small structural cleanups.
|
|
104
|
+
Keep behavior unchanged unless a change is clearly justified.`
|
|
105
|
+
}
|
|
106
|
+
];
|
|
135
107
|
// Annotate the CommonJS export names for ESM import in node:
|
|
136
108
|
0 && (module.exports = {
|
|
137
109
|
DEFAULT_INTENTS,
|
package/dist/index.d.cts
CHANGED
|
@@ -1,119 +1,36 @@
|
|
|
1
|
-
declare const DEFAULT_INTENTS: ({
|
|
2
|
-
id: string;
|
|
3
|
-
label: string;
|
|
4
|
-
prompt: string;
|
|
5
|
-
isAction?: never;
|
|
6
|
-
} | {
|
|
7
|
-
id: string;
|
|
8
|
-
label: string;
|
|
9
|
-
prompt: string;
|
|
10
|
-
isAction: boolean;
|
|
11
|
-
})[];
|
|
12
|
-
|
|
13
|
-
/** Modifier keys that can be used as inspector activation hotkeys */
|
|
14
1
|
type HotKey = 'ctrlKey' | 'altKey' | 'metaKey' | 'shiftKey';
|
|
15
|
-
/**
|
|
16
|
-
* Hotkey configuration strings.
|
|
17
|
-
* E.g. "alt", "cmd+shift", or false to disable.
|
|
18
|
-
*/
|
|
19
2
|
type HotKeyString = 'alt' | 'shift' | 'ctrl' | 'meta' | 'cmd' | 'alt+shift' | 'ctrl+shift' | 'meta+shift' | 'cmd+shift';
|
|
20
|
-
/**
|
|
21
|
-
* Hotkey configuration.
|
|
22
|
-
* - String: modifier key or combo (e.g., "alt", "cmd+shift")
|
|
23
|
-
* - false: disable hotkey activation entirely
|
|
24
|
-
*/
|
|
25
3
|
type HotKeys = HotKeyString | false;
|
|
26
|
-
/** Parsed source location from the data-inspecto attribute */
|
|
27
4
|
interface SourceLocation {
|
|
28
|
-
/** Absolute or relative file path depending on pathType config */
|
|
29
5
|
file: string;
|
|
30
|
-
/** 1-based line number */
|
|
31
6
|
line: number;
|
|
32
|
-
/** 1-based column number */
|
|
33
7
|
column: number;
|
|
34
|
-
/** Optional: component or element name for display */
|
|
35
8
|
name?: string;
|
|
36
9
|
}
|
|
37
|
-
/** Format of the data-inspecto attribute value: "filepath:line:col" */
|
|
38
10
|
type SourceAttrValue = string;
|
|
39
|
-
/**
|
|
40
|
-
* Path type injected into data-inspecto attributes.
|
|
41
|
-
* - 'absolute': full filesystem path (default) — safe across monorepo aliases
|
|
42
|
-
* - 'relative': path relative to project root — shorter, but may break with pnpm virtual store
|
|
43
|
-
*/
|
|
44
11
|
type PathType = 'relative' | 'absolute';
|
|
45
|
-
|
|
12
|
+
type LogLevel = 'info' | 'warn' | 'error' | 'silent';
|
|
46
13
|
interface UnpluginOptions {
|
|
47
|
-
/**
|
|
48
|
-
* Additional file extensions to transform beyond .jsx/.tsx/.js/.ts
|
|
49
|
-
* @default []
|
|
50
|
-
*/
|
|
51
14
|
include?: string[];
|
|
52
|
-
/**
|
|
53
|
-
* File path patterns to exclude from transform
|
|
54
|
-
* Matched against absolute file path using picomatch
|
|
55
|
-
* node_modules and dist are always excluded
|
|
56
|
-
* @default []
|
|
57
|
-
*/
|
|
58
15
|
exclude?: string[];
|
|
59
|
-
/**
|
|
60
|
-
* Element tag names to skip source injection.
|
|
61
|
-
* Useful for framework-internal elements that should not carry source data.
|
|
62
|
-
* @default ['template', 'script', 'style', 'Transition', 'TransitionGroup',
|
|
63
|
-
* 'KeepAlive', 'Teleport', 'Suspense', 'Fragment']
|
|
64
|
-
*/
|
|
65
16
|
escapeTags?: string[];
|
|
66
|
-
/**
|
|
67
|
-
* Path type for the injected data-inspecto attribute value.
|
|
68
|
-
* Use 'absolute' (default) to avoid issues with monorepo path aliases
|
|
69
|
-
* and pnpm virtual store symlinks.
|
|
70
|
-
* @default 'absolute'
|
|
71
|
-
*/
|
|
72
17
|
pathType?: PathType;
|
|
73
|
-
/**
|
|
74
|
-
* The attribute name injected on JSX elements.
|
|
75
|
-
* Change only if 'data-inspecto' conflicts with another tool.
|
|
76
|
-
* @default 'data-inspecto'
|
|
77
|
-
*/
|
|
78
18
|
attributeName?: string;
|
|
79
|
-
/**
|
|
80
|
-
* Console log level for the plugin.
|
|
81
|
-
* - 'info': Print startup info, warnings, and errors
|
|
82
|
-
* - 'warn': Print warnings and errors only
|
|
83
|
-
* - 'error': Print errors only
|
|
84
|
-
* - 'silent': Disable all console output
|
|
85
|
-
* @default 'warn'
|
|
86
|
-
*/
|
|
87
19
|
logLevel?: LogLevel;
|
|
88
20
|
}
|
|
89
|
-
|
|
90
|
-
/** Supported IDEs */
|
|
21
|
+
|
|
91
22
|
type IdeType = 'vscode' | 'trae' | 'trae-cn' | 'cursor' | 'unknown';
|
|
92
|
-
/** All supported AI tool providers */
|
|
93
23
|
type Provider = 'copilot' | 'claude-code' | 'gemini' | 'codex' | 'coco' | 'trae' | 'cursor';
|
|
94
|
-
/** Whether the AI provider is an editor extension, CLI tool, or clipboard fallback */
|
|
95
24
|
type ProviderMode = 'extension' | 'cli' | 'clipboard' | 'builtin';
|
|
96
25
|
interface InspectoSettings {
|
|
97
26
|
ide?: IdeType;
|
|
98
|
-
/** Flat namespaced configuration (e.g. `provider.default`, `provider.claude-code.cli.bin`) */
|
|
99
27
|
[key: `provider.${string}`]: string | string[] | boolean | undefined;
|
|
100
28
|
'inspector.hotKey'?: HotKeys;
|
|
101
|
-
/**
|
|
102
|
-
* Theme for the inspector panel.
|
|
103
|
-
*/
|
|
104
29
|
'inspector.theme'?: 'light' | 'dark' | 'auto';
|
|
105
|
-
/**
|
|
106
|
-
* Whether to inject the raw code snippet into the prompt.
|
|
107
|
-
* Default is false (saves tokens, lets IDE AI read the file directly).
|
|
108
|
-
*/
|
|
109
30
|
'prompt.includeSnippet'?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Whether to automatically send the prompt when opened in the AI tool.
|
|
112
|
-
* Default is false (user must manually hit send).
|
|
113
|
-
*/
|
|
114
31
|
'prompt.autoSend'?: boolean;
|
|
32
|
+
'prompt.annotationResponseMode'?: 'unified' | 'per-annotation';
|
|
115
33
|
}
|
|
116
|
-
/** Static mapping: which modes each tool actually supports */
|
|
117
34
|
declare const VALID_MODES: Record<Provider, ProviderMode[]>;
|
|
118
35
|
declare const DEFAULT_PROVIDER_MODE: Record<Provider, ProviderMode>;
|
|
119
36
|
interface ToolOverrides {
|
|
@@ -132,208 +49,260 @@ interface AiPayload {
|
|
|
132
49
|
line?: number;
|
|
133
50
|
column?: number;
|
|
134
51
|
snippet?: string;
|
|
52
|
+
screenshotContext?: ScreenshotContext;
|
|
135
53
|
overrides?: ToolOverrides;
|
|
136
54
|
autoSend?: boolean;
|
|
137
|
-
/** Added in v2: Unique ticket ID for the IDE to fetch this payload from the local server to bypass URI length limits */
|
|
138
55
|
ticket?: string;
|
|
139
56
|
}
|
|
140
57
|
interface ChannelDef {
|
|
141
58
|
type: ProviderMode;
|
|
142
59
|
execute: (payload: AiPayload) => Promise<void>;
|
|
143
60
|
}
|
|
144
|
-
interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
61
|
+
interface ProviderInfo {
|
|
62
|
+
mode: ProviderMode;
|
|
63
|
+
installed: boolean;
|
|
64
|
+
}
|
|
65
|
+
interface IdeInfo {
|
|
66
|
+
ide: IdeType;
|
|
67
|
+
scheme: string;
|
|
68
|
+
workspaceRoot?: string;
|
|
69
|
+
providers: Record<Provider, ProviderInfo>;
|
|
70
|
+
}
|
|
71
|
+
interface InspectoConfig {
|
|
72
|
+
ide: IdeType;
|
|
73
|
+
providers?: Record<Provider, ProviderInfo>;
|
|
74
|
+
prompts?: IntentConfig[];
|
|
75
|
+
hotKeys?: HotKeys;
|
|
76
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
77
|
+
includeSnippet?: boolean;
|
|
78
|
+
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
79
|
+
runtimeContext?: RuntimeContextConfig;
|
|
80
|
+
screenshotContext?: ScreenshotContextConfig;
|
|
81
|
+
}
|
|
82
|
+
interface ServerState {
|
|
83
|
+
port: number | null;
|
|
84
|
+
running: boolean;
|
|
85
|
+
projectRoot: string;
|
|
86
|
+
configRoot: string;
|
|
87
|
+
cwd: string;
|
|
88
|
+
ideInfo?: IdeInfo | null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type AiIntent = 'ask' | 'fix' | 'review' | 'redesign';
|
|
92
|
+
type AnnotationIntent = AiIntent;
|
|
93
|
+
type IntentLabels = Partial<Record<Provider | 'clipboard', string>>;
|
|
94
|
+
interface IntentConfigBase {
|
|
95
|
+
id: string;
|
|
157
96
|
label?: string;
|
|
158
|
-
/**
|
|
159
|
-
* Prepend text to the prompt template.
|
|
160
|
-
* Useful for extending built-in prompts without rewriting the whole template.
|
|
161
|
-
*/
|
|
162
97
|
prependPrompt?: string;
|
|
163
|
-
/**
|
|
164
|
-
* Append text to the prompt template.
|
|
165
|
-
* Useful for extending built-in prompts (e.g. "Please reply in Chinese").
|
|
166
|
-
*/
|
|
167
98
|
appendPrompt?: string;
|
|
168
99
|
prompt?: string;
|
|
169
|
-
/**
|
|
170
|
-
* If true, this intent doesn't send a prompt to AI,
|
|
171
|
-
* but rather triggers a built-in action (like 'open-in-editor').
|
|
172
|
-
* @internal For built-in intents only.
|
|
173
|
-
*/
|
|
174
|
-
isAction?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Enabled status.
|
|
177
|
-
* If false, this item is explicitly hidden from the menu without having to remove its configuration.
|
|
178
|
-
*/
|
|
179
100
|
enabled?: boolean;
|
|
180
101
|
}
|
|
102
|
+
interface AiIntentConfig extends IntentConfigBase {
|
|
103
|
+
aiIntent: AiIntent;
|
|
104
|
+
}
|
|
105
|
+
type IntentConfig = AiIntentConfig;
|
|
181
106
|
type InspectoPromptsConfig = (string | IntentConfig)[] | {
|
|
182
107
|
$replace: true;
|
|
183
108
|
items: (string | IntentConfig)[];
|
|
184
109
|
};
|
|
185
|
-
/** Configuration for the browser-side inspector component */
|
|
186
110
|
interface InspectorOptions {
|
|
187
|
-
/**
|
|
188
|
-
* Hotkeys to hold while clicking to activate inspector.
|
|
189
|
-
* Pass false to disable hotkey activation.
|
|
190
|
-
* @default ['altKey']
|
|
191
|
-
*/
|
|
192
111
|
hotKeys?: HotKeys;
|
|
193
|
-
/**
|
|
194
|
-
* Custom labels for each AI target button.
|
|
195
|
-
* Useful for localization or branding.
|
|
196
|
-
*/
|
|
197
112
|
labels?: IntentLabels;
|
|
198
|
-
/**
|
|
199
|
-
* Placeholder text for the "Ask AI" input box.
|
|
200
|
-
*/
|
|
201
113
|
askPlaceholder?: string;
|
|
202
|
-
/**
|
|
203
|
-
* Base URL of the local HTTP server spun up by the unplugin.
|
|
204
|
-
* Usually auto-detected via the injected __AI_INSPECTOR_PORT__ global.
|
|
205
|
-
* Override only if running in a non-standard setup.
|
|
206
|
-
*/
|
|
207
114
|
serverUrl?: string;
|
|
208
|
-
/**
|
|
209
|
-
* Maximum number of lines to include in the extracted code snippet.
|
|
210
|
-
* Larger values provide more context but may hit AI token limits.
|
|
211
|
-
* @default 100
|
|
212
|
-
*/
|
|
213
115
|
maxSnippetLines?: number;
|
|
214
|
-
/**
|
|
215
|
-
* Whether the inspector panel is visible/active on mount.
|
|
216
|
-
* @default false
|
|
217
|
-
*/
|
|
218
116
|
defaultActive?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Theme for the inspector panel.
|
|
221
|
-
* If 'auto' or undefined, it relies on CSS media queries (prefers-color-scheme)
|
|
222
|
-
* or inherits from the host environment if manually managed.
|
|
223
|
-
*/
|
|
224
117
|
theme?: 'light' | 'dark' | 'auto';
|
|
225
|
-
/**
|
|
226
|
-
* Whether to inject the raw code snippet into the prompt.
|
|
227
|
-
* Default is false (saves tokens, lets IDE AI read the file directly).
|
|
228
|
-
*/
|
|
229
118
|
includeSnippet?: boolean;
|
|
119
|
+
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
120
|
+
runtimeContext?: RuntimeContextConfig;
|
|
121
|
+
screenshotContext?: ScreenshotContextConfig;
|
|
122
|
+
}
|
|
123
|
+
interface SendToAiRequest {
|
|
124
|
+
location: SourceLocation;
|
|
125
|
+
snippet: string;
|
|
126
|
+
prompt?: string;
|
|
127
|
+
target?: Provider;
|
|
128
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
129
|
+
screenshotContext?: ScreenshotContext;
|
|
130
|
+
}
|
|
131
|
+
interface SendToAiResponse {
|
|
132
|
+
success: boolean;
|
|
133
|
+
error?: string;
|
|
134
|
+
errorCode?: AiErrorCode;
|
|
135
|
+
fallbackPayload?: {
|
|
136
|
+
prompt: string;
|
|
137
|
+
file: string;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
interface AiStrategyContext {
|
|
141
|
+
location: SourceLocation;
|
|
142
|
+
snippet: string;
|
|
143
|
+
fileUri: string;
|
|
144
|
+
prompt: string;
|
|
145
|
+
}
|
|
146
|
+
interface AiStrategyResult {
|
|
147
|
+
success: boolean;
|
|
148
|
+
error?: string;
|
|
149
|
+
errorCode?: AiErrorCode;
|
|
230
150
|
}
|
|
231
151
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
152
|
+
type RuntimeEvidenceKind = 'runtime-error' | 'promise-rejection' | 'console-error' | 'failed-request';
|
|
153
|
+
type RuntimeEvidenceLevel = 'high' | 'medium' | 'low';
|
|
154
|
+
interface RuntimeEvidenceRecord {
|
|
155
|
+
id: string;
|
|
156
|
+
kind: RuntimeEvidenceKind;
|
|
157
|
+
timestamp: number;
|
|
158
|
+
message: string;
|
|
159
|
+
stack?: string;
|
|
160
|
+
sourceUrl?: string;
|
|
161
|
+
sourceFile?: string;
|
|
162
|
+
route?: string;
|
|
163
|
+
componentHints?: string[];
|
|
164
|
+
occurrenceCount: number;
|
|
165
|
+
relevanceScore: number;
|
|
166
|
+
relevanceLevel: RuntimeEvidenceLevel;
|
|
167
|
+
relevanceReasons: string[];
|
|
168
|
+
request?: {
|
|
169
|
+
method?: string;
|
|
170
|
+
url?: string;
|
|
171
|
+
pathname?: string;
|
|
172
|
+
status?: number;
|
|
173
|
+
responseSummary?: string;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
interface RuntimeContextSummary {
|
|
177
|
+
runtimeErrorCount: number;
|
|
178
|
+
failedRequestCount: number;
|
|
179
|
+
includedRecordIds: string[];
|
|
180
|
+
}
|
|
181
|
+
interface RuntimeContextEnvelope {
|
|
182
|
+
summary: RuntimeContextSummary;
|
|
183
|
+
records: RuntimeEvidenceRecord[];
|
|
184
|
+
}
|
|
185
|
+
interface RuntimeContextConfig {
|
|
186
|
+
enabled?: boolean;
|
|
187
|
+
preview?: boolean;
|
|
188
|
+
maxRuntimeErrors?: number;
|
|
189
|
+
maxFailedRequests?: number;
|
|
190
|
+
}
|
|
191
|
+
interface ScreenshotContext {
|
|
192
|
+
enabled: boolean;
|
|
193
|
+
capturedAt: string;
|
|
194
|
+
mimeType: string;
|
|
195
|
+
imageDataUrl?: string;
|
|
196
|
+
imageAssetId?: string;
|
|
197
|
+
}
|
|
198
|
+
interface ScreenshotContextConfig {
|
|
199
|
+
enabled?: boolean;
|
|
200
|
+
}
|
|
242
201
|
interface OpenFileRequest {
|
|
243
202
|
file: string;
|
|
244
203
|
line: number;
|
|
245
204
|
column: number;
|
|
246
205
|
}
|
|
247
|
-
/** GET /snippet — browser asks server for source code context */
|
|
248
206
|
interface SnippetRequest {
|
|
249
207
|
file: string;
|
|
250
208
|
line: number;
|
|
251
209
|
column: number;
|
|
252
|
-
/** Max lines to return in snippet, default 100 */
|
|
253
210
|
maxLines?: number;
|
|
254
211
|
}
|
|
255
212
|
interface SnippetResponse {
|
|
256
|
-
/** Extracted code snippet (trimmed to maxSnippetLines) */
|
|
257
213
|
snippet: string;
|
|
258
|
-
/** Actual start line of the returned snippet (1-based) */
|
|
259
214
|
startLine: number;
|
|
260
|
-
/** File path echoed back */
|
|
261
215
|
file: string;
|
|
262
|
-
/** Component or element name if detectable */
|
|
263
216
|
name?: string;
|
|
264
217
|
}
|
|
265
|
-
|
|
266
|
-
|
|
218
|
+
interface AnnotationTarget {
|
|
219
|
+
id: string;
|
|
267
220
|
location: SourceLocation;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
success: boolean;
|
|
276
|
-
error?: string;
|
|
277
|
-
/** Error code for structured error handling in the browser */
|
|
278
|
-
errorCode?: AiErrorCode;
|
|
279
|
-
/** Payload for client-side fallback (e.g. copying to clipboard if IDE fails to handle URI) */
|
|
280
|
-
fallbackPayload?: {
|
|
281
|
-
prompt: string;
|
|
282
|
-
file: string;
|
|
221
|
+
label: string;
|
|
222
|
+
selector?: string;
|
|
223
|
+
rect: {
|
|
224
|
+
x: number;
|
|
225
|
+
y: number;
|
|
226
|
+
width: number;
|
|
227
|
+
height: number;
|
|
283
228
|
};
|
|
229
|
+
snippet?: string;
|
|
284
230
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
231
|
+
interface FeedbackRecord {
|
|
232
|
+
id: string;
|
|
233
|
+
displayOrder: number;
|
|
234
|
+
target: AnnotationTarget;
|
|
235
|
+
note: string;
|
|
236
|
+
intent: AnnotationIntent;
|
|
237
|
+
cssContextEnabled?: boolean;
|
|
290
238
|
}
|
|
291
|
-
interface
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
239
|
+
interface FeedbackRecordDraft {
|
|
240
|
+
id: string;
|
|
241
|
+
displayOrder?: number;
|
|
242
|
+
target: AnnotationTarget | null;
|
|
243
|
+
note: string;
|
|
244
|
+
intent: AnnotationIntent;
|
|
245
|
+
cssContextEnabled?: boolean;
|
|
296
246
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
/** List of AI targets available in the environment to show/enable in UI */
|
|
301
|
-
providers: Record<Provider, ProviderInfo>;
|
|
302
|
-
/** Fully resolved and merged list of intent configurations for the UI to display */
|
|
303
|
-
prompts?: IntentConfig[];
|
|
304
|
-
hotKeys?: HotKeys;
|
|
305
|
-
theme?: 'light' | 'dark' | 'auto';
|
|
306
|
-
includeSnippet?: boolean;
|
|
247
|
+
interface FeedbackRecordSession {
|
|
248
|
+
current: FeedbackRecordDraft;
|
|
249
|
+
records: FeedbackRecord[];
|
|
307
250
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
running: boolean;
|
|
314
|
-
/** Absolute path to project root (from git rev-parse or process.cwd()) */
|
|
315
|
-
projectRoot: string;
|
|
316
|
-
/** Absolute path to the config root (where .inspecto lives) */
|
|
317
|
-
configRoot: string;
|
|
318
|
-
/** The directory where the bundler is running (process.cwd()) */
|
|
319
|
-
cwd: string;
|
|
320
|
-
/** Cached IDE info pushed from the extension */
|
|
321
|
-
ideInfo?: IdeInfo | null;
|
|
251
|
+
interface Annotation {
|
|
252
|
+
id: string;
|
|
253
|
+
note: string;
|
|
254
|
+
intent: AnnotationIntent;
|
|
255
|
+
targets: AnnotationTarget[];
|
|
322
256
|
}
|
|
323
|
-
|
|
324
|
-
|
|
257
|
+
interface AnnotationSession {
|
|
258
|
+
current: Annotation | null;
|
|
259
|
+
queue: Annotation[];
|
|
260
|
+
}
|
|
261
|
+
interface AnnotationTransportTarget {
|
|
325
262
|
location: SourceLocation;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
/** Human-readable prompt constructed from location + snippet */
|
|
330
|
-
prompt: string;
|
|
263
|
+
label?: string;
|
|
264
|
+
selector?: string;
|
|
265
|
+
snippet?: string;
|
|
331
266
|
}
|
|
332
|
-
|
|
333
|
-
|
|
267
|
+
interface AnnotationTransport {
|
|
268
|
+
note: string;
|
|
269
|
+
intent: AnnotationIntent;
|
|
270
|
+
targets: AnnotationTransportTarget[];
|
|
271
|
+
}
|
|
272
|
+
interface SendAnnotationsToAiRequest {
|
|
273
|
+
instruction?: string;
|
|
274
|
+
annotations: AnnotationTransport[];
|
|
275
|
+
responseMode?: 'unified' | 'per-annotation';
|
|
276
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
277
|
+
screenshotContext?: ScreenshotContext;
|
|
278
|
+
cssContextPrompt?: string;
|
|
279
|
+
}
|
|
280
|
+
interface SendAnnotationsToAiResponse {
|
|
334
281
|
success: boolean;
|
|
335
282
|
error?: string;
|
|
336
283
|
errorCode?: AiErrorCode;
|
|
284
|
+
fallbackPayload?: {
|
|
285
|
+
prompt: string;
|
|
286
|
+
};
|
|
337
287
|
}
|
|
288
|
+
type AiErrorCode = 'INVALID_REQUEST' | 'FORBIDDEN_PATH' | 'IDE_NOT_FOUND' | 'EXTENSION_NOT_INSTALLED' | 'CLIPBOARD_WRITE_FAILED' | 'SNIPPET_TOO_LARGE' | 'FILE_NOT_FOUND' | 'UNKNOWN';
|
|
289
|
+
|
|
290
|
+
declare const INSPECTO_API_PATHS: {
|
|
291
|
+
readonly HEALTH: "/inspecto/api/v1/health";
|
|
292
|
+
readonly CLIENT_CONFIG: "/inspecto/api/v1/client/config";
|
|
293
|
+
readonly IDE_INFO: "/inspecto/api/v1/ide/info";
|
|
294
|
+
readonly IDE_OPEN: "/inspecto/api/v1/ide/open";
|
|
295
|
+
readonly PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet";
|
|
296
|
+
readonly AI_DISPATCH: "/inspecto/api/v1/ai/dispatch";
|
|
297
|
+
readonly AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations";
|
|
298
|
+
readonly AI_TICKET: "/inspecto/api/v1/ai/ticket";
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
declare const DEFAULT_INTENTS: {
|
|
302
|
+
id: string;
|
|
303
|
+
label: string;
|
|
304
|
+
aiIntent: string;
|
|
305
|
+
prompt: string;
|
|
306
|
+
}[];
|
|
338
307
|
|
|
339
|
-
export { type AiErrorCode, type AiPayload, type AiStrategyContext, type AiStrategyResult, type ChannelDef, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentLabels, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type ToolOverrides, type UnpluginOptions, VALID_MODES };
|
|
308
|
+
export { type AiErrorCode, type AiIntent, type AiIntentConfig, type AiPayload, type AiStrategyContext, type AiStrategyResult, type Annotation, type AnnotationIntent, type AnnotationSession, type AnnotationTarget, type AnnotationTransport, type AnnotationTransportTarget, type ChannelDef, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, type FeedbackRecord, type FeedbackRecordDraft, type FeedbackRecordSession, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentConfigBase, type IntentLabels, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type RuntimeContextConfig, type RuntimeContextEnvelope, type RuntimeContextSummary, type RuntimeEvidenceKind, type RuntimeEvidenceLevel, type RuntimeEvidenceRecord, type ScreenshotContext, type ScreenshotContextConfig, type SendAnnotationsToAiRequest, type SendAnnotationsToAiResponse, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type ToolOverrides, type UnpluginOptions, VALID_MODES };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,119 +1,36 @@
|
|
|
1
|
-
declare const DEFAULT_INTENTS: ({
|
|
2
|
-
id: string;
|
|
3
|
-
label: string;
|
|
4
|
-
prompt: string;
|
|
5
|
-
isAction?: never;
|
|
6
|
-
} | {
|
|
7
|
-
id: string;
|
|
8
|
-
label: string;
|
|
9
|
-
prompt: string;
|
|
10
|
-
isAction: boolean;
|
|
11
|
-
})[];
|
|
12
|
-
|
|
13
|
-
/** Modifier keys that can be used as inspector activation hotkeys */
|
|
14
1
|
type HotKey = 'ctrlKey' | 'altKey' | 'metaKey' | 'shiftKey';
|
|
15
|
-
/**
|
|
16
|
-
* Hotkey configuration strings.
|
|
17
|
-
* E.g. "alt", "cmd+shift", or false to disable.
|
|
18
|
-
*/
|
|
19
2
|
type HotKeyString = 'alt' | 'shift' | 'ctrl' | 'meta' | 'cmd' | 'alt+shift' | 'ctrl+shift' | 'meta+shift' | 'cmd+shift';
|
|
20
|
-
/**
|
|
21
|
-
* Hotkey configuration.
|
|
22
|
-
* - String: modifier key or combo (e.g., "alt", "cmd+shift")
|
|
23
|
-
* - false: disable hotkey activation entirely
|
|
24
|
-
*/
|
|
25
3
|
type HotKeys = HotKeyString | false;
|
|
26
|
-
/** Parsed source location from the data-inspecto attribute */
|
|
27
4
|
interface SourceLocation {
|
|
28
|
-
/** Absolute or relative file path depending on pathType config */
|
|
29
5
|
file: string;
|
|
30
|
-
/** 1-based line number */
|
|
31
6
|
line: number;
|
|
32
|
-
/** 1-based column number */
|
|
33
7
|
column: number;
|
|
34
|
-
/** Optional: component or element name for display */
|
|
35
8
|
name?: string;
|
|
36
9
|
}
|
|
37
|
-
/** Format of the data-inspecto attribute value: "filepath:line:col" */
|
|
38
10
|
type SourceAttrValue = string;
|
|
39
|
-
/**
|
|
40
|
-
* Path type injected into data-inspecto attributes.
|
|
41
|
-
* - 'absolute': full filesystem path (default) — safe across monorepo aliases
|
|
42
|
-
* - 'relative': path relative to project root — shorter, but may break with pnpm virtual store
|
|
43
|
-
*/
|
|
44
11
|
type PathType = 'relative' | 'absolute';
|
|
45
|
-
|
|
12
|
+
type LogLevel = 'info' | 'warn' | 'error' | 'silent';
|
|
46
13
|
interface UnpluginOptions {
|
|
47
|
-
/**
|
|
48
|
-
* Additional file extensions to transform beyond .jsx/.tsx/.js/.ts
|
|
49
|
-
* @default []
|
|
50
|
-
*/
|
|
51
14
|
include?: string[];
|
|
52
|
-
/**
|
|
53
|
-
* File path patterns to exclude from transform
|
|
54
|
-
* Matched against absolute file path using picomatch
|
|
55
|
-
* node_modules and dist are always excluded
|
|
56
|
-
* @default []
|
|
57
|
-
*/
|
|
58
15
|
exclude?: string[];
|
|
59
|
-
/**
|
|
60
|
-
* Element tag names to skip source injection.
|
|
61
|
-
* Useful for framework-internal elements that should not carry source data.
|
|
62
|
-
* @default ['template', 'script', 'style', 'Transition', 'TransitionGroup',
|
|
63
|
-
* 'KeepAlive', 'Teleport', 'Suspense', 'Fragment']
|
|
64
|
-
*/
|
|
65
16
|
escapeTags?: string[];
|
|
66
|
-
/**
|
|
67
|
-
* Path type for the injected data-inspecto attribute value.
|
|
68
|
-
* Use 'absolute' (default) to avoid issues with monorepo path aliases
|
|
69
|
-
* and pnpm virtual store symlinks.
|
|
70
|
-
* @default 'absolute'
|
|
71
|
-
*/
|
|
72
17
|
pathType?: PathType;
|
|
73
|
-
/**
|
|
74
|
-
* The attribute name injected on JSX elements.
|
|
75
|
-
* Change only if 'data-inspecto' conflicts with another tool.
|
|
76
|
-
* @default 'data-inspecto'
|
|
77
|
-
*/
|
|
78
18
|
attributeName?: string;
|
|
79
|
-
/**
|
|
80
|
-
* Console log level for the plugin.
|
|
81
|
-
* - 'info': Print startup info, warnings, and errors
|
|
82
|
-
* - 'warn': Print warnings and errors only
|
|
83
|
-
* - 'error': Print errors only
|
|
84
|
-
* - 'silent': Disable all console output
|
|
85
|
-
* @default 'warn'
|
|
86
|
-
*/
|
|
87
19
|
logLevel?: LogLevel;
|
|
88
20
|
}
|
|
89
|
-
|
|
90
|
-
/** Supported IDEs */
|
|
21
|
+
|
|
91
22
|
type IdeType = 'vscode' | 'trae' | 'trae-cn' | 'cursor' | 'unknown';
|
|
92
|
-
/** All supported AI tool providers */
|
|
93
23
|
type Provider = 'copilot' | 'claude-code' | 'gemini' | 'codex' | 'coco' | 'trae' | 'cursor';
|
|
94
|
-
/** Whether the AI provider is an editor extension, CLI tool, or clipboard fallback */
|
|
95
24
|
type ProviderMode = 'extension' | 'cli' | 'clipboard' | 'builtin';
|
|
96
25
|
interface InspectoSettings {
|
|
97
26
|
ide?: IdeType;
|
|
98
|
-
/** Flat namespaced configuration (e.g. `provider.default`, `provider.claude-code.cli.bin`) */
|
|
99
27
|
[key: `provider.${string}`]: string | string[] | boolean | undefined;
|
|
100
28
|
'inspector.hotKey'?: HotKeys;
|
|
101
|
-
/**
|
|
102
|
-
* Theme for the inspector panel.
|
|
103
|
-
*/
|
|
104
29
|
'inspector.theme'?: 'light' | 'dark' | 'auto';
|
|
105
|
-
/**
|
|
106
|
-
* Whether to inject the raw code snippet into the prompt.
|
|
107
|
-
* Default is false (saves tokens, lets IDE AI read the file directly).
|
|
108
|
-
*/
|
|
109
30
|
'prompt.includeSnippet'?: boolean;
|
|
110
|
-
/**
|
|
111
|
-
* Whether to automatically send the prompt when opened in the AI tool.
|
|
112
|
-
* Default is false (user must manually hit send).
|
|
113
|
-
*/
|
|
114
31
|
'prompt.autoSend'?: boolean;
|
|
32
|
+
'prompt.annotationResponseMode'?: 'unified' | 'per-annotation';
|
|
115
33
|
}
|
|
116
|
-
/** Static mapping: which modes each tool actually supports */
|
|
117
34
|
declare const VALID_MODES: Record<Provider, ProviderMode[]>;
|
|
118
35
|
declare const DEFAULT_PROVIDER_MODE: Record<Provider, ProviderMode>;
|
|
119
36
|
interface ToolOverrides {
|
|
@@ -132,208 +49,260 @@ interface AiPayload {
|
|
|
132
49
|
line?: number;
|
|
133
50
|
column?: number;
|
|
134
51
|
snippet?: string;
|
|
52
|
+
screenshotContext?: ScreenshotContext;
|
|
135
53
|
overrides?: ToolOverrides;
|
|
136
54
|
autoSend?: boolean;
|
|
137
|
-
/** Added in v2: Unique ticket ID for the IDE to fetch this payload from the local server to bypass URI length limits */
|
|
138
55
|
ticket?: string;
|
|
139
56
|
}
|
|
140
57
|
interface ChannelDef {
|
|
141
58
|
type: ProviderMode;
|
|
142
59
|
execute: (payload: AiPayload) => Promise<void>;
|
|
143
60
|
}
|
|
144
|
-
interface
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
61
|
+
interface ProviderInfo {
|
|
62
|
+
mode: ProviderMode;
|
|
63
|
+
installed: boolean;
|
|
64
|
+
}
|
|
65
|
+
interface IdeInfo {
|
|
66
|
+
ide: IdeType;
|
|
67
|
+
scheme: string;
|
|
68
|
+
workspaceRoot?: string;
|
|
69
|
+
providers: Record<Provider, ProviderInfo>;
|
|
70
|
+
}
|
|
71
|
+
interface InspectoConfig {
|
|
72
|
+
ide: IdeType;
|
|
73
|
+
providers?: Record<Provider, ProviderInfo>;
|
|
74
|
+
prompts?: IntentConfig[];
|
|
75
|
+
hotKeys?: HotKeys;
|
|
76
|
+
theme?: 'light' | 'dark' | 'auto';
|
|
77
|
+
includeSnippet?: boolean;
|
|
78
|
+
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
79
|
+
runtimeContext?: RuntimeContextConfig;
|
|
80
|
+
screenshotContext?: ScreenshotContextConfig;
|
|
81
|
+
}
|
|
82
|
+
interface ServerState {
|
|
83
|
+
port: number | null;
|
|
84
|
+
running: boolean;
|
|
85
|
+
projectRoot: string;
|
|
86
|
+
configRoot: string;
|
|
87
|
+
cwd: string;
|
|
88
|
+
ideInfo?: IdeInfo | null;
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
type AiIntent = 'ask' | 'fix' | 'review' | 'redesign';
|
|
92
|
+
type AnnotationIntent = AiIntent;
|
|
93
|
+
type IntentLabels = Partial<Record<Provider | 'clipboard', string>>;
|
|
94
|
+
interface IntentConfigBase {
|
|
95
|
+
id: string;
|
|
157
96
|
label?: string;
|
|
158
|
-
/**
|
|
159
|
-
* Prepend text to the prompt template.
|
|
160
|
-
* Useful for extending built-in prompts without rewriting the whole template.
|
|
161
|
-
*/
|
|
162
97
|
prependPrompt?: string;
|
|
163
|
-
/**
|
|
164
|
-
* Append text to the prompt template.
|
|
165
|
-
* Useful for extending built-in prompts (e.g. "Please reply in Chinese").
|
|
166
|
-
*/
|
|
167
98
|
appendPrompt?: string;
|
|
168
99
|
prompt?: string;
|
|
169
|
-
/**
|
|
170
|
-
* If true, this intent doesn't send a prompt to AI,
|
|
171
|
-
* but rather triggers a built-in action (like 'open-in-editor').
|
|
172
|
-
* @internal For built-in intents only.
|
|
173
|
-
*/
|
|
174
|
-
isAction?: boolean;
|
|
175
|
-
/**
|
|
176
|
-
* Enabled status.
|
|
177
|
-
* If false, this item is explicitly hidden from the menu without having to remove its configuration.
|
|
178
|
-
*/
|
|
179
100
|
enabled?: boolean;
|
|
180
101
|
}
|
|
102
|
+
interface AiIntentConfig extends IntentConfigBase {
|
|
103
|
+
aiIntent: AiIntent;
|
|
104
|
+
}
|
|
105
|
+
type IntentConfig = AiIntentConfig;
|
|
181
106
|
type InspectoPromptsConfig = (string | IntentConfig)[] | {
|
|
182
107
|
$replace: true;
|
|
183
108
|
items: (string | IntentConfig)[];
|
|
184
109
|
};
|
|
185
|
-
/** Configuration for the browser-side inspector component */
|
|
186
110
|
interface InspectorOptions {
|
|
187
|
-
/**
|
|
188
|
-
* Hotkeys to hold while clicking to activate inspector.
|
|
189
|
-
* Pass false to disable hotkey activation.
|
|
190
|
-
* @default ['altKey']
|
|
191
|
-
*/
|
|
192
111
|
hotKeys?: HotKeys;
|
|
193
|
-
/**
|
|
194
|
-
* Custom labels for each AI target button.
|
|
195
|
-
* Useful for localization or branding.
|
|
196
|
-
*/
|
|
197
112
|
labels?: IntentLabels;
|
|
198
|
-
/**
|
|
199
|
-
* Placeholder text for the "Ask AI" input box.
|
|
200
|
-
*/
|
|
201
113
|
askPlaceholder?: string;
|
|
202
|
-
/**
|
|
203
|
-
* Base URL of the local HTTP server spun up by the unplugin.
|
|
204
|
-
* Usually auto-detected via the injected __AI_INSPECTOR_PORT__ global.
|
|
205
|
-
* Override only if running in a non-standard setup.
|
|
206
|
-
*/
|
|
207
114
|
serverUrl?: string;
|
|
208
|
-
/**
|
|
209
|
-
* Maximum number of lines to include in the extracted code snippet.
|
|
210
|
-
* Larger values provide more context but may hit AI token limits.
|
|
211
|
-
* @default 100
|
|
212
|
-
*/
|
|
213
115
|
maxSnippetLines?: number;
|
|
214
|
-
/**
|
|
215
|
-
* Whether the inspector panel is visible/active on mount.
|
|
216
|
-
* @default false
|
|
217
|
-
*/
|
|
218
116
|
defaultActive?: boolean;
|
|
219
|
-
/**
|
|
220
|
-
* Theme for the inspector panel.
|
|
221
|
-
* If 'auto' or undefined, it relies on CSS media queries (prefers-color-scheme)
|
|
222
|
-
* or inherits from the host environment if manually managed.
|
|
223
|
-
*/
|
|
224
117
|
theme?: 'light' | 'dark' | 'auto';
|
|
225
|
-
/**
|
|
226
|
-
* Whether to inject the raw code snippet into the prompt.
|
|
227
|
-
* Default is false (saves tokens, lets IDE AI read the file directly).
|
|
228
|
-
*/
|
|
229
118
|
includeSnippet?: boolean;
|
|
119
|
+
annotationResponseMode?: 'unified' | 'per-annotation';
|
|
120
|
+
runtimeContext?: RuntimeContextConfig;
|
|
121
|
+
screenshotContext?: ScreenshotContextConfig;
|
|
122
|
+
}
|
|
123
|
+
interface SendToAiRequest {
|
|
124
|
+
location: SourceLocation;
|
|
125
|
+
snippet: string;
|
|
126
|
+
prompt?: string;
|
|
127
|
+
target?: Provider;
|
|
128
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
129
|
+
screenshotContext?: ScreenshotContext;
|
|
130
|
+
}
|
|
131
|
+
interface SendToAiResponse {
|
|
132
|
+
success: boolean;
|
|
133
|
+
error?: string;
|
|
134
|
+
errorCode?: AiErrorCode;
|
|
135
|
+
fallbackPayload?: {
|
|
136
|
+
prompt: string;
|
|
137
|
+
file: string;
|
|
138
|
+
};
|
|
139
|
+
}
|
|
140
|
+
interface AiStrategyContext {
|
|
141
|
+
location: SourceLocation;
|
|
142
|
+
snippet: string;
|
|
143
|
+
fileUri: string;
|
|
144
|
+
prompt: string;
|
|
145
|
+
}
|
|
146
|
+
interface AiStrategyResult {
|
|
147
|
+
success: boolean;
|
|
148
|
+
error?: string;
|
|
149
|
+
errorCode?: AiErrorCode;
|
|
230
150
|
}
|
|
231
151
|
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
152
|
+
type RuntimeEvidenceKind = 'runtime-error' | 'promise-rejection' | 'console-error' | 'failed-request';
|
|
153
|
+
type RuntimeEvidenceLevel = 'high' | 'medium' | 'low';
|
|
154
|
+
interface RuntimeEvidenceRecord {
|
|
155
|
+
id: string;
|
|
156
|
+
kind: RuntimeEvidenceKind;
|
|
157
|
+
timestamp: number;
|
|
158
|
+
message: string;
|
|
159
|
+
stack?: string;
|
|
160
|
+
sourceUrl?: string;
|
|
161
|
+
sourceFile?: string;
|
|
162
|
+
route?: string;
|
|
163
|
+
componentHints?: string[];
|
|
164
|
+
occurrenceCount: number;
|
|
165
|
+
relevanceScore: number;
|
|
166
|
+
relevanceLevel: RuntimeEvidenceLevel;
|
|
167
|
+
relevanceReasons: string[];
|
|
168
|
+
request?: {
|
|
169
|
+
method?: string;
|
|
170
|
+
url?: string;
|
|
171
|
+
pathname?: string;
|
|
172
|
+
status?: number;
|
|
173
|
+
responseSummary?: string;
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
interface RuntimeContextSummary {
|
|
177
|
+
runtimeErrorCount: number;
|
|
178
|
+
failedRequestCount: number;
|
|
179
|
+
includedRecordIds: string[];
|
|
180
|
+
}
|
|
181
|
+
interface RuntimeContextEnvelope {
|
|
182
|
+
summary: RuntimeContextSummary;
|
|
183
|
+
records: RuntimeEvidenceRecord[];
|
|
184
|
+
}
|
|
185
|
+
interface RuntimeContextConfig {
|
|
186
|
+
enabled?: boolean;
|
|
187
|
+
preview?: boolean;
|
|
188
|
+
maxRuntimeErrors?: number;
|
|
189
|
+
maxFailedRequests?: number;
|
|
190
|
+
}
|
|
191
|
+
interface ScreenshotContext {
|
|
192
|
+
enabled: boolean;
|
|
193
|
+
capturedAt: string;
|
|
194
|
+
mimeType: string;
|
|
195
|
+
imageDataUrl?: string;
|
|
196
|
+
imageAssetId?: string;
|
|
197
|
+
}
|
|
198
|
+
interface ScreenshotContextConfig {
|
|
199
|
+
enabled?: boolean;
|
|
200
|
+
}
|
|
242
201
|
interface OpenFileRequest {
|
|
243
202
|
file: string;
|
|
244
203
|
line: number;
|
|
245
204
|
column: number;
|
|
246
205
|
}
|
|
247
|
-
/** GET /snippet — browser asks server for source code context */
|
|
248
206
|
interface SnippetRequest {
|
|
249
207
|
file: string;
|
|
250
208
|
line: number;
|
|
251
209
|
column: number;
|
|
252
|
-
/** Max lines to return in snippet, default 100 */
|
|
253
210
|
maxLines?: number;
|
|
254
211
|
}
|
|
255
212
|
interface SnippetResponse {
|
|
256
|
-
/** Extracted code snippet (trimmed to maxSnippetLines) */
|
|
257
213
|
snippet: string;
|
|
258
|
-
/** Actual start line of the returned snippet (1-based) */
|
|
259
214
|
startLine: number;
|
|
260
|
-
/** File path echoed back */
|
|
261
215
|
file: string;
|
|
262
|
-
/** Component or element name if detectable */
|
|
263
216
|
name?: string;
|
|
264
217
|
}
|
|
265
|
-
|
|
266
|
-
|
|
218
|
+
interface AnnotationTarget {
|
|
219
|
+
id: string;
|
|
267
220
|
location: SourceLocation;
|
|
268
|
-
|
|
269
|
-
|
|
270
|
-
|
|
271
|
-
|
|
272
|
-
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
success: boolean;
|
|
276
|
-
error?: string;
|
|
277
|
-
/** Error code for structured error handling in the browser */
|
|
278
|
-
errorCode?: AiErrorCode;
|
|
279
|
-
/** Payload for client-side fallback (e.g. copying to clipboard if IDE fails to handle URI) */
|
|
280
|
-
fallbackPayload?: {
|
|
281
|
-
prompt: string;
|
|
282
|
-
file: string;
|
|
221
|
+
label: string;
|
|
222
|
+
selector?: string;
|
|
223
|
+
rect: {
|
|
224
|
+
x: number;
|
|
225
|
+
y: number;
|
|
226
|
+
width: number;
|
|
227
|
+
height: number;
|
|
283
228
|
};
|
|
229
|
+
snippet?: string;
|
|
284
230
|
}
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
231
|
+
interface FeedbackRecord {
|
|
232
|
+
id: string;
|
|
233
|
+
displayOrder: number;
|
|
234
|
+
target: AnnotationTarget;
|
|
235
|
+
note: string;
|
|
236
|
+
intent: AnnotationIntent;
|
|
237
|
+
cssContextEnabled?: boolean;
|
|
290
238
|
}
|
|
291
|
-
interface
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
239
|
+
interface FeedbackRecordDraft {
|
|
240
|
+
id: string;
|
|
241
|
+
displayOrder?: number;
|
|
242
|
+
target: AnnotationTarget | null;
|
|
243
|
+
note: string;
|
|
244
|
+
intent: AnnotationIntent;
|
|
245
|
+
cssContextEnabled?: boolean;
|
|
296
246
|
}
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
/** List of AI targets available in the environment to show/enable in UI */
|
|
301
|
-
providers: Record<Provider, ProviderInfo>;
|
|
302
|
-
/** Fully resolved and merged list of intent configurations for the UI to display */
|
|
303
|
-
prompts?: IntentConfig[];
|
|
304
|
-
hotKeys?: HotKeys;
|
|
305
|
-
theme?: 'light' | 'dark' | 'auto';
|
|
306
|
-
includeSnippet?: boolean;
|
|
247
|
+
interface FeedbackRecordSession {
|
|
248
|
+
current: FeedbackRecordDraft;
|
|
249
|
+
records: FeedbackRecord[];
|
|
307
250
|
}
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
running: boolean;
|
|
314
|
-
/** Absolute path to project root (from git rev-parse or process.cwd()) */
|
|
315
|
-
projectRoot: string;
|
|
316
|
-
/** Absolute path to the config root (where .inspecto lives) */
|
|
317
|
-
configRoot: string;
|
|
318
|
-
/** The directory where the bundler is running (process.cwd()) */
|
|
319
|
-
cwd: string;
|
|
320
|
-
/** Cached IDE info pushed from the extension */
|
|
321
|
-
ideInfo?: IdeInfo | null;
|
|
251
|
+
interface Annotation {
|
|
252
|
+
id: string;
|
|
253
|
+
note: string;
|
|
254
|
+
intent: AnnotationIntent;
|
|
255
|
+
targets: AnnotationTarget[];
|
|
322
256
|
}
|
|
323
|
-
|
|
324
|
-
|
|
257
|
+
interface AnnotationSession {
|
|
258
|
+
current: Annotation | null;
|
|
259
|
+
queue: Annotation[];
|
|
260
|
+
}
|
|
261
|
+
interface AnnotationTransportTarget {
|
|
325
262
|
location: SourceLocation;
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
/** Human-readable prompt constructed from location + snippet */
|
|
330
|
-
prompt: string;
|
|
263
|
+
label?: string;
|
|
264
|
+
selector?: string;
|
|
265
|
+
snippet?: string;
|
|
331
266
|
}
|
|
332
|
-
|
|
333
|
-
|
|
267
|
+
interface AnnotationTransport {
|
|
268
|
+
note: string;
|
|
269
|
+
intent: AnnotationIntent;
|
|
270
|
+
targets: AnnotationTransportTarget[];
|
|
271
|
+
}
|
|
272
|
+
interface SendAnnotationsToAiRequest {
|
|
273
|
+
instruction?: string;
|
|
274
|
+
annotations: AnnotationTransport[];
|
|
275
|
+
responseMode?: 'unified' | 'per-annotation';
|
|
276
|
+
runtimeContext?: RuntimeContextEnvelope;
|
|
277
|
+
screenshotContext?: ScreenshotContext;
|
|
278
|
+
cssContextPrompt?: string;
|
|
279
|
+
}
|
|
280
|
+
interface SendAnnotationsToAiResponse {
|
|
334
281
|
success: boolean;
|
|
335
282
|
error?: string;
|
|
336
283
|
errorCode?: AiErrorCode;
|
|
284
|
+
fallbackPayload?: {
|
|
285
|
+
prompt: string;
|
|
286
|
+
};
|
|
337
287
|
}
|
|
288
|
+
type AiErrorCode = 'INVALID_REQUEST' | 'FORBIDDEN_PATH' | 'IDE_NOT_FOUND' | 'EXTENSION_NOT_INSTALLED' | 'CLIPBOARD_WRITE_FAILED' | 'SNIPPET_TOO_LARGE' | 'FILE_NOT_FOUND' | 'UNKNOWN';
|
|
289
|
+
|
|
290
|
+
declare const INSPECTO_API_PATHS: {
|
|
291
|
+
readonly HEALTH: "/inspecto/api/v1/health";
|
|
292
|
+
readonly CLIENT_CONFIG: "/inspecto/api/v1/client/config";
|
|
293
|
+
readonly IDE_INFO: "/inspecto/api/v1/ide/info";
|
|
294
|
+
readonly IDE_OPEN: "/inspecto/api/v1/ide/open";
|
|
295
|
+
readonly PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet";
|
|
296
|
+
readonly AI_DISPATCH: "/inspecto/api/v1/ai/dispatch";
|
|
297
|
+
readonly AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations";
|
|
298
|
+
readonly AI_TICKET: "/inspecto/api/v1/ai/ticket";
|
|
299
|
+
};
|
|
300
|
+
|
|
301
|
+
declare const DEFAULT_INTENTS: {
|
|
302
|
+
id: string;
|
|
303
|
+
label: string;
|
|
304
|
+
aiIntent: string;
|
|
305
|
+
prompt: string;
|
|
306
|
+
}[];
|
|
338
307
|
|
|
339
|
-
export { type AiErrorCode, type AiPayload, type AiStrategyContext, type AiStrategyResult, type ChannelDef, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentLabels, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type ToolOverrides, type UnpluginOptions, VALID_MODES };
|
|
308
|
+
export { type AiErrorCode, type AiIntent, type AiIntentConfig, type AiPayload, type AiStrategyContext, type AiStrategyResult, type Annotation, type AnnotationIntent, type AnnotationSession, type AnnotationTarget, type AnnotationTransport, type AnnotationTransportTarget, type ChannelDef, DEFAULT_INTENTS, DEFAULT_PROVIDER_MODE, type FeedbackRecord, type FeedbackRecordDraft, type FeedbackRecordSession, type HotKey, type HotKeyString, type HotKeys, INSPECTO_API_PATHS, type IdeInfo, type IdeType, type InspectoConfig, type InspectoPromptsConfig, type InspectoSettings, type InspectorOptions, type IntentConfig, type IntentConfigBase, type IntentLabels, type LogLevel, type OpenFileRequest, type PathType, type Provider, type ProviderInfo, type ProviderMode, type RuntimeContextConfig, type RuntimeContextEnvelope, type RuntimeContextSummary, type RuntimeEvidenceKind, type RuntimeEvidenceLevel, type RuntimeEvidenceRecord, type ScreenshotContext, type ScreenshotContextConfig, type SendAnnotationsToAiRequest, type SendAnnotationsToAiResponse, type SendToAiRequest, type SendToAiResponse, type ServerState, type SnippetRequest, type SnippetResponse, type SourceAttrValue, type SourceLocation, type ToolOverrides, type UnpluginOptions, VALID_MODES };
|
package/dist/index.js
CHANGED
|
@@ -1,80 +1,4 @@
|
|
|
1
|
-
// src/
|
|
2
|
-
var DEFAULT_INTENTS = [
|
|
3
|
-
// ── 1. Explain Component ─────────────────────────────────────────────────
|
|
4
|
-
// Frequency: ★★★★★ — Most common action when navigating unfamiliar codebases
|
|
5
|
-
{
|
|
6
|
-
id: "explain",
|
|
7
|
-
label: "Explain Component",
|
|
8
|
-
prompt: `The following is a {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
9
|
-
|
|
10
|
-
Please explain:
|
|
11
|
-
|
|
12
|
-
1. What this component does and its responsibility in the UI
|
|
13
|
-
2. Key props and their purpose
|
|
14
|
-
3. Important state or side effects (if applicable)
|
|
15
|
-
4. Any non-obvious logic or edge cases worth noting`
|
|
16
|
-
},
|
|
17
|
-
// ── 2. Fix Bug ───────────────────────────────────────────────────────────
|
|
18
|
-
// Frequency: ★★★★★ — Debugging is the highest time-cost activity in frontend dev
|
|
19
|
-
{
|
|
20
|
-
id: "fix-bug",
|
|
21
|
-
label: "Fix Bug",
|
|
22
|
-
prompt: `I found a bug in the following {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
23
|
-
|
|
24
|
-
Please:
|
|
25
|
-
|
|
26
|
-
1. Identify potential bugs or issues in this code
|
|
27
|
-
2. Explain the root cause of each issue
|
|
28
|
-
3. Provide a fixed version with minimal changes
|
|
29
|
-
|
|
30
|
-
If you need more context (e.g. parent component, API response shape),
|
|
31
|
-
please ask before suggesting a fix.`
|
|
32
|
-
},
|
|
33
|
-
// ── 3. Fix Styles ────────────────────────────────────────────────────────
|
|
34
|
-
// Frequency: ★★★★ — Styling issues are top-3 daily pain points for frontend devs
|
|
35
|
-
{
|
|
36
|
-
id: "fix-styles",
|
|
37
|
-
label: "Fix Styles",
|
|
38
|
-
prompt: `The following component from \`{{file}}\` (line {{line}}) has a styling issue.
|
|
39
|
-
|
|
40
|
-
Please:
|
|
41
|
-
|
|
42
|
-
1. Review the current styles (className / inline styles / CSS-in-JS / Style blocks)
|
|
43
|
-
2. Identify common issues: layout shifts, overflow, z-index conflicts,
|
|
44
|
-
responsive breakpoints, or visual inconsistencies
|
|
45
|
-
3. Suggest fixes using the same styling approach already in use
|
|
46
|
-
|
|
47
|
-
Note: Maintain the existing styling conventions (e.g. Tailwind, CSS Modules, scoped styles).`
|
|
48
|
-
},
|
|
49
|
-
// ── 4. Refactor Component ────────────────────────────────────────────────
|
|
50
|
-
// Frequency: ★★★★ — Sustained demand after features stabilize; large component splits
|
|
51
|
-
{
|
|
52
|
-
id: "refactor",
|
|
53
|
-
label: "Refactor Component",
|
|
54
|
-
prompt: `Please refactor the following {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
55
|
-
|
|
56
|
-
Refactoring goals (apply as relevant):
|
|
57
|
-
|
|
58
|
-
- Extract reusable sub-components or composables/hooks
|
|
59
|
-
- Improve readability and reduce complexity
|
|
60
|
-
- Remove redundant state or unnecessary re-renders
|
|
61
|
-
- Apply {{framework}} best practices
|
|
62
|
-
- Maintain existing behavior \u2014 no functional changes
|
|
63
|
-
|
|
64
|
-
Please show the refactored version with a brief explanation of each change.`
|
|
65
|
-
},
|
|
66
|
-
// ── 5. Open in Editor ────────────────────────────────────────────────────
|
|
67
|
-
// Type: local action (no AI prompt) — jumps directly to source in IDE
|
|
68
|
-
{
|
|
69
|
-
id: "open-in-editor",
|
|
70
|
-
label: "Open in Editor",
|
|
71
|
-
prompt: "",
|
|
72
|
-
// unused — isAction handles this
|
|
73
|
-
isAction: true
|
|
74
|
-
}
|
|
75
|
-
];
|
|
76
|
-
|
|
77
|
-
// src/index.ts
|
|
1
|
+
// src/providers.ts
|
|
78
2
|
var VALID_MODES = {
|
|
79
3
|
copilot: ["extension"],
|
|
80
4
|
"claude-code": ["extension", "cli"],
|
|
@@ -93,6 +17,8 @@ var DEFAULT_PROVIDER_MODE = {
|
|
|
93
17
|
trae: "builtin",
|
|
94
18
|
cursor: "builtin"
|
|
95
19
|
};
|
|
20
|
+
|
|
21
|
+
// src/api.ts
|
|
96
22
|
var INSPECTO_API_PATHS = {
|
|
97
23
|
HEALTH: "/inspecto/api/v1/health",
|
|
98
24
|
CLIENT_CONFIG: "/inspecto/api/v1/client/config",
|
|
@@ -100,9 +26,55 @@ var INSPECTO_API_PATHS = {
|
|
|
100
26
|
IDE_OPEN: "/inspecto/api/v1/ide/open",
|
|
101
27
|
PROJECT_SNIPPET: "/inspecto/api/v1/project/snippet",
|
|
102
28
|
AI_DISPATCH: "/inspecto/api/v1/ai/dispatch",
|
|
29
|
+
AI_BATCH_DISPATCH: "/inspecto/api/v1/ai/dispatch/annotations",
|
|
103
30
|
AI_TICKET: "/inspecto/api/v1/ai/ticket"
|
|
104
|
-
// Usage: /inspecto/api/v1/ai/ticket/:id
|
|
105
31
|
};
|
|
32
|
+
|
|
33
|
+
// src/intents.ts
|
|
34
|
+
var DEFAULT_INTENTS = [
|
|
35
|
+
{
|
|
36
|
+
id: "explain",
|
|
37
|
+
label: "Explain",
|
|
38
|
+
aiIntent: "ask",
|
|
39
|
+
prompt: `Explain what this {{framework}} component from \`{{file}}\` (line {{line}}) does.
|
|
40
|
+
|
|
41
|
+
Focus on:
|
|
42
|
+
- its UI responsibility
|
|
43
|
+
- key props, state, or side effects
|
|
44
|
+
- any non-obvious logic worth noticing`
|
|
45
|
+
},
|
|
46
|
+
{
|
|
47
|
+
id: "fix-bug",
|
|
48
|
+
label: "Fix Bug",
|
|
49
|
+
aiIntent: "fix",
|
|
50
|
+
prompt: `Help fix a bug in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
51
|
+
|
|
52
|
+
Please:
|
|
53
|
+
- identify the most likely root cause
|
|
54
|
+
- explain why it happens
|
|
55
|
+
- suggest the smallest safe fix
|
|
56
|
+
|
|
57
|
+
If important context is missing, ask for it before proposing broader changes.`
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
id: "fix-ui",
|
|
61
|
+
label: "Fix UI",
|
|
62
|
+
aiIntent: "fix",
|
|
63
|
+
prompt: `Help fix a UI issue in this {{framework}} component from \`{{file}}\` (line {{line}}).
|
|
64
|
+
|
|
65
|
+
Please review layout, spacing, overflow, alignment, layering, and visual consistency,
|
|
66
|
+
then suggest fixes using the same styling approach already used in this codebase.`
|
|
67
|
+
},
|
|
68
|
+
{
|
|
69
|
+
id: "improve",
|
|
70
|
+
label: "Improve",
|
|
71
|
+
aiIntent: "review",
|
|
72
|
+
prompt: `Review this {{framework}} component from \`{{file}}\` (line {{line}}) and suggest practical improvements.
|
|
73
|
+
|
|
74
|
+
Focus on readability, maintainability, and small structural cleanups.
|
|
75
|
+
Keep behavior unchanged unless a change is clearly justified.`
|
|
76
|
+
}
|
|
77
|
+
];
|
|
106
78
|
export {
|
|
107
79
|
DEFAULT_INTENTS,
|
|
108
80
|
DEFAULT_PROVIDER_MODE,
|