@vite-plugin-opencode-assistant/opencode 1.0.22 → 1.0.24
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/es/plugins/page-context.js +145 -110
- package/lib/plugins/page-context.js +55 -12
- package/package.json +2 -2
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
const
|
|
2
|
-
var
|
|
3
|
-
for (var
|
|
4
|
-
C.call(
|
|
5
|
-
if (
|
|
6
|
-
for (var
|
|
7
|
-
S.call(
|
|
8
|
-
return
|
|
9
|
-
}, p = (
|
|
1
|
+
const _ = "[vite-plugin-opencode]";
|
|
2
|
+
var b = Object.defineProperty, w = Object.defineProperties, E = Object.getOwnPropertyDescriptors, P = Object.getOwnPropertySymbols, C = Object.prototype.hasOwnProperty, S = Object.prototype.propertyIsEnumerable, y = (e, t, r) => t in e ? b(e, t, { enumerable: !0, configurable: !0, writable: !0, value: r }) : e[t] = r, u = (e, t) => {
|
|
3
|
+
for (var r in t || (t = {}))
|
|
4
|
+
C.call(t, r) && y(e, r, t[r]);
|
|
5
|
+
if (P)
|
|
6
|
+
for (var r of P(t))
|
|
7
|
+
S.call(t, r) && y(e, r, t[r]);
|
|
8
|
+
return e;
|
|
9
|
+
}, p = (e, t) => w(e, E(t)), O = (e, t, r) => y(e, typeof t != "symbol" ? t + "" : t, r);
|
|
10
10
|
const s = {
|
|
11
11
|
reset: "\x1B[0m",
|
|
12
12
|
dim: "\x1B[2m",
|
|
@@ -22,140 +22,163 @@ const s = {
|
|
|
22
22
|
2: s.yellow,
|
|
23
23
|
3: s.red,
|
|
24
24
|
4: s.reset
|
|
25
|
-
},
|
|
25
|
+
}, x = {
|
|
26
26
|
0: "DEBUG",
|
|
27
27
|
1: "INFO",
|
|
28
28
|
2: "WARN",
|
|
29
29
|
3: "ERROR",
|
|
30
30
|
4: "NONE"
|
|
31
31
|
};
|
|
32
|
-
let
|
|
32
|
+
let L = {
|
|
33
33
|
level: 1
|
|
34
34
|
/* INFO */
|
|
35
35
|
};
|
|
36
|
-
function
|
|
37
|
-
const
|
|
38
|
-
return `${
|
|
36
|
+
function N() {
|
|
37
|
+
const e = /* @__PURE__ */ new Date(), t = String(e.getHours()).padStart(2, "0"), r = String(e.getMinutes()).padStart(2, "0"), n = String(e.getSeconds()).padStart(2, "0"), o = String(e.getMilliseconds()).padStart(3, "0");
|
|
38
|
+
return `${t}:${r}:${n}.${o}`;
|
|
39
39
|
}
|
|
40
|
-
function R(
|
|
41
|
-
const
|
|
42
|
-
if (!
|
|
43
|
-
const n =
|
|
44
|
-
`)[
|
|
40
|
+
function R(e = 3) {
|
|
41
|
+
const t = new Error().stack;
|
|
42
|
+
if (!t) return "";
|
|
43
|
+
const n = t.split(`
|
|
44
|
+
`)[e];
|
|
45
45
|
if (!n) return "";
|
|
46
46
|
const o = n.match(/at\s+(?:(.+?)\s+\()?(.+?):(\d+):(\d+)\)?/);
|
|
47
47
|
if (!o) return "";
|
|
48
|
-
const [,
|
|
49
|
-
return `${m.split("/").pop() || m}:${l} ${
|
|
48
|
+
const [, i, m, l] = o;
|
|
49
|
+
return `${m.split("/").pop() || m}:${l} ${i || "<anonymous>"}`;
|
|
50
50
|
}
|
|
51
|
-
function
|
|
52
|
-
if (
|
|
53
|
-
if (
|
|
54
|
-
if (
|
|
55
|
-
if (typeof
|
|
56
|
-
if (typeof
|
|
57
|
-
if (
|
|
58
|
-
return `${
|
|
59
|
-
${
|
|
60
|
-
if (Array.isArray(
|
|
61
|
-
return
|
|
62
|
-
if (typeof
|
|
63
|
-
const
|
|
64
|
-
return
|
|
51
|
+
function f(e, t = 0) {
|
|
52
|
+
if (t > 3) return "...";
|
|
53
|
+
if (e === null) return "null";
|
|
54
|
+
if (e === void 0) return "undefined";
|
|
55
|
+
if (typeof e == "string") return t > 0 ? `"${e}"` : e;
|
|
56
|
+
if (typeof e == "number" || typeof e == "boolean") return String(e);
|
|
57
|
+
if (e instanceof Error)
|
|
58
|
+
return `${e.name}: ${e.message}${e.stack ? `
|
|
59
|
+
${e.stack}` : ""}`;
|
|
60
|
+
if (Array.isArray(e))
|
|
61
|
+
return e.length === 0 ? "[]" : e.length > 5 ? `[${e.slice(0, 3).map((o) => f(o, t + 1)).join(", ")}, ... ${e.length - 3} more items]` : `[${e.map((n) => f(n, t + 1)).join(", ")}]`;
|
|
62
|
+
if (typeof e == "object") {
|
|
63
|
+
const r = Object.entries(e);
|
|
64
|
+
return r.length === 0 ? "{}" : r.length > 5 ? `{${r.slice(0, 3).map(([i, m]) => `${i}: ${f(m, t + 1)}`).join(", ")}, ... ${r.length - 3} more keys}` : `{${r.map(([o, i]) => `${o}: ${f(i, t + 1)}`).join(", ")}}`;
|
|
65
65
|
}
|
|
66
|
-
return String(
|
|
66
|
+
return String(e);
|
|
67
67
|
}
|
|
68
|
-
function T(
|
|
69
|
-
if (!
|
|
70
|
-
const
|
|
71
|
-
|
|
72
|
-
const
|
|
68
|
+
function T(e) {
|
|
69
|
+
if (!e || Object.keys(e).length === 0) return "";
|
|
70
|
+
const t = [];
|
|
71
|
+
e.module && t.push(`[${e.module}]`), e.operation && t.push(`(${e.operation})`), e.traceId && t.push(`trace:${e.traceId}`), e.duration !== void 0 && t.push(`${e.duration}ms`);
|
|
72
|
+
const r = Object.keys(e).filter(
|
|
73
73
|
(n) => !["module", "operation", "traceId", "duration", "error"].includes(n)
|
|
74
74
|
);
|
|
75
|
-
if (
|
|
75
|
+
if (r.length > 0) {
|
|
76
76
|
const n = {};
|
|
77
|
-
|
|
77
|
+
r.forEach((o) => n[o] = e[o]), t.push(f(n));
|
|
78
78
|
}
|
|
79
|
-
return
|
|
79
|
+
return t.join(" ");
|
|
80
80
|
}
|
|
81
|
-
function
|
|
82
|
-
if (
|
|
81
|
+
function h(e, t, r, ...n) {
|
|
82
|
+
if (e < L.level) return;
|
|
83
83
|
const o = [];
|
|
84
|
-
o.push(`${s.dim}[${process.pid}]${s.reset}`), o.push(`${s.dim}${
|
|
85
|
-
const
|
|
86
|
-
o.push(`${
|
|
87
|
-
const l = T(
|
|
88
|
-
if (l && o.push(`${s.magenta}${l}${s.reset}`), o.push(
|
|
89
|
-
const
|
|
90
|
-
|
|
84
|
+
o.push(`${s.dim}[${process.pid}]${s.reset}`), o.push(`${s.dim}${N()}${s.reset}`);
|
|
85
|
+
const i = j[e], m = x[e].padEnd(5);
|
|
86
|
+
o.push(`${i}${m}${s.reset}`), o.push(`${s.bright}${_}${s.reset}`);
|
|
87
|
+
const l = T(r);
|
|
88
|
+
if (l && o.push(`${s.magenta}${l}${s.reset}`), o.push(t), e >= 2) {
|
|
89
|
+
const a = R(4);
|
|
90
|
+
a && o.push(`${s.dim}(${a})${s.reset}`);
|
|
91
91
|
}
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
const
|
|
95
|
-
|
|
92
|
+
const $ = n.map((a) => f(a)).join(" ");
|
|
93
|
+
if ($ && o.push($), r != null && r.error) {
|
|
94
|
+
const a = r.error;
|
|
95
|
+
a instanceof Error ? o.push(`${s.red}Error: ${a.message}${s.reset}`) : o.push(`${s.red}Error: ${f(a)}${s.reset}`);
|
|
96
96
|
}
|
|
97
97
|
const d = o.join(" ");
|
|
98
|
-
|
|
98
|
+
e >= 3 ? console.error(d) : e === 2 ? console.warn(d) : console.log(d);
|
|
99
99
|
}
|
|
100
|
-
const
|
|
101
|
-
debug(
|
|
102
|
-
|
|
100
|
+
const g = {
|
|
101
|
+
debug(e, t, ...r) {
|
|
102
|
+
h(0, e, t, ...r);
|
|
103
103
|
},
|
|
104
|
-
info(
|
|
105
|
-
|
|
104
|
+
info(e, t, ...r) {
|
|
105
|
+
h(1, e, t, ...r);
|
|
106
106
|
},
|
|
107
|
-
warn(
|
|
108
|
-
|
|
107
|
+
warn(e, t, ...r) {
|
|
108
|
+
h(2, e, t, ...r);
|
|
109
109
|
},
|
|
110
|
-
error(
|
|
111
|
-
|
|
110
|
+
error(e, t, ...r) {
|
|
111
|
+
h(3, e, t, ...r);
|
|
112
112
|
},
|
|
113
|
-
group(
|
|
113
|
+
group(e, t) {
|
|
114
114
|
},
|
|
115
115
|
groupEnd() {
|
|
116
116
|
}
|
|
117
117
|
};
|
|
118
118
|
class I {
|
|
119
|
-
constructor(
|
|
120
|
-
O(this, "startTime"), O(this, "context"), O(this, "operation"), this.operation =
|
|
119
|
+
constructor(t, r) {
|
|
120
|
+
O(this, "startTime"), O(this, "context"), O(this, "operation"), this.operation = t, this.context = r || {}, this.startTime = performance.now(), g.debug(`⏱️ Starting: ${t}`, this.context);
|
|
121
121
|
}
|
|
122
|
-
end(
|
|
123
|
-
const
|
|
124
|
-
return
|
|
122
|
+
end(t) {
|
|
123
|
+
const r = Math.round(performance.now() - this.startTime), n = t || `✓ Completed: ${this.operation}`;
|
|
124
|
+
return g.debug(n, p(u({}, this.context), { duration: r })), r;
|
|
125
125
|
}
|
|
126
|
-
checkpoint(
|
|
127
|
-
const
|
|
128
|
-
return
|
|
126
|
+
checkpoint(t) {
|
|
127
|
+
const r = Math.round(performance.now() - this.startTime);
|
|
128
|
+
return g.debug(` ↳ ${t}`, p(u({}, this.context), { duration: r })), r;
|
|
129
129
|
}
|
|
130
130
|
}
|
|
131
|
-
function B(
|
|
131
|
+
function B(e) {
|
|
132
132
|
return {
|
|
133
|
-
debug(
|
|
134
|
-
|
|
133
|
+
debug(t, r, ...n) {
|
|
134
|
+
g.debug(t, p(u({}, r), { module: e }), ...n);
|
|
135
135
|
},
|
|
136
|
-
info(
|
|
137
|
-
|
|
136
|
+
info(t, r, ...n) {
|
|
137
|
+
g.info(t, p(u({}, r), { module: e }), ...n);
|
|
138
138
|
},
|
|
139
|
-
warn(
|
|
140
|
-
|
|
139
|
+
warn(t, r, ...n) {
|
|
140
|
+
g.warn(t, p(u({}, r), { module: e }), ...n);
|
|
141
141
|
},
|
|
142
|
-
error(
|
|
143
|
-
|
|
142
|
+
error(t, r, ...n) {
|
|
143
|
+
g.error(t, p(u({}, r), { module: e }), ...n);
|
|
144
144
|
},
|
|
145
|
-
timer(
|
|
146
|
-
return new I(
|
|
145
|
+
timer(t, r) {
|
|
146
|
+
return new I(t, p(u({}, r), { module: e }));
|
|
147
147
|
}
|
|
148
148
|
};
|
|
149
149
|
}
|
|
150
|
-
const
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
150
|
+
const c = B("OpenCodePluginPageContext");
|
|
151
|
+
async function D(e) {
|
|
152
|
+
try {
|
|
153
|
+
const t = await fetch(e, {
|
|
154
|
+
method: "GET",
|
|
155
|
+
headers: { "Content-Type": "application/json" }
|
|
156
|
+
});
|
|
157
|
+
return t.ok ? await t.json() : (c.debug("Failed to fetch page context", { status: t.status }), null);
|
|
158
|
+
} catch (t) {
|
|
159
|
+
return c.debug("Error fetching page context", { error: t }), null;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
const A = async () => {
|
|
163
|
+
c.info("PageContextPlugin loading...");
|
|
164
|
+
const e = process.env.OPENCODE_CONTEXT_API_URL;
|
|
165
|
+
return c.debug("Context API URL:", { contextApiUrl: e }), e ? (c.info("Plugin initialized successfully"), {
|
|
166
|
+
"experimental.chat.system.transform": async (t, r) => {
|
|
167
|
+
c.debug("System transform hook called");
|
|
168
|
+
const n = await D(e);
|
|
169
|
+
c.debug("Page context fetched", { pageContext: n });
|
|
170
|
+
let o = "";
|
|
171
|
+
n && (o = `
|
|
172
|
+
## 用户当前浏览的页面
|
|
158
173
|
|
|
174
|
+
**这里的上下文为最高优先级,任何情况下都不能被覆盖**
|
|
175
|
+
|
|
176
|
+
- **页面 URL**: ${n.url || "未知"}
|
|
177
|
+
- **页面标题**: ${n.title || "未知"}
|
|
178
|
+
`);
|
|
179
|
+
const i = `
|
|
180
|
+
你是一个专业的前端开发助手,运行在 **OpenCode** 平台中,并通过 **vite-plugin-opencode-assistant** 插件集成到用户的 Vite 开发环境。
|
|
181
|
+
${o}
|
|
159
182
|
## 你的工作环境
|
|
160
183
|
|
|
161
184
|
### 架构说明
|
|
@@ -176,29 +199,41 @@ const g = B("OpenCodePluginPageContext"), D = async () => {
|
|
|
176
199
|
└─────────────────────────────────────────────────────────────┘
|
|
177
200
|
\`\`\`
|
|
178
201
|
|
|
179
|
-
|
|
202
|
+
## 工作流程
|
|
203
|
+
|
|
204
|
+
请严格按以下顺序处理用户请求:
|
|
205
|
+
|
|
206
|
+
### 1. 定位节点位置(强制)
|
|
207
|
+
|
|
208
|
+
当用户选中了页面节点时,**在处理用户请求之前**,你必须先找到这些节点在当前项目上下文中的位置:
|
|
209
|
+
|
|
210
|
+
- 利用提供的文件路径、CSS 选择器、元素文本等信息
|
|
211
|
+
- 通过文件搜索、DOM 分析等方式定位到具体代码位置
|
|
212
|
+
- 明确知道节点在哪里被定义/使用后,再处理用户请求
|
|
213
|
+
|
|
214
|
+
### 2. 理解上下文
|
|
215
|
+
|
|
216
|
+
将页面 URL、标题和选中节点信息作为用户请求的背景,帮助理解用户的真实意图。
|
|
180
217
|
|
|
181
|
-
|
|
182
|
-
当用户选中了页面节点时,**在处理用户请求之前**,你必须先找到这些节点在当前项目上下文中的位置。
|
|
183
|
-
- 利用提供的文件路径、CSS 选择器、元素文本等信息
|
|
184
|
-
- 通过文件搜索、DOM 分析等方式定位到具体代码位置
|
|
185
|
-
- 明确知道节点在哪里被定义/使用后,再处理用户请求
|
|
218
|
+
### 3. 直接行动
|
|
186
219
|
|
|
187
|
-
|
|
220
|
+
在明确节点位置后,针对用户的实际请求给出清晰、可执行的方案。
|
|
188
221
|
|
|
189
|
-
|
|
222
|
+
## 工具使用指南
|
|
190
223
|
|
|
191
|
-
|
|
224
|
+
### Chrome DevTools Mcp
|
|
192
225
|
|
|
193
|
-
|
|
226
|
+
1. **确保操作正确页面(强制)**
|
|
227
|
+
在使用 Chrome DevTools Mcp 执行任何与用户正在浏览的页面相关的任务之前,必须先确认当前操作的页面就是用户正在浏览的页面。如果不确定,应先获取当前页面 URL 并与上下文中的页面 URL 进行比对。
|
|
194
228
|
|
|
195
|
-
|
|
229
|
+
2. **快照获取**
|
|
230
|
+
在没有获取到需要的节点信息时,使用 verbose 参数来获取更详细的节点信息。如果设置了 verbose 参数还是没有获取到节点信息,再尝试考虑其他方案。
|
|
196
231
|
`.trim();
|
|
197
|
-
|
|
232
|
+
r.system.push(i);
|
|
198
233
|
}
|
|
199
|
-
}) : (
|
|
234
|
+
}) : (c.warn("OPENCODE_CONTEXT_API_URL is not set, page context plugin will not work"), {});
|
|
200
235
|
};
|
|
201
236
|
export {
|
|
202
|
-
|
|
203
|
-
|
|
237
|
+
A as PageContextPlugin,
|
|
238
|
+
A as default
|
|
204
239
|
};
|
|
@@ -43,6 +43,24 @@ __export(page_context_exports, {
|
|
|
43
43
|
module.exports = __toCommonJS(page_context_exports);
|
|
44
44
|
var import_shared = require("@vite-plugin-opencode-assistant/shared");
|
|
45
45
|
const log = (0, import_shared.createLogger)("OpenCodePluginPageContext");
|
|
46
|
+
function fetchPageContext(contextApiUrl) {
|
|
47
|
+
return __async(this, null, function* () {
|
|
48
|
+
try {
|
|
49
|
+
const response = yield fetch(contextApiUrl, {
|
|
50
|
+
method: "GET",
|
|
51
|
+
headers: { "Content-Type": "application/json" }
|
|
52
|
+
});
|
|
53
|
+
if (!response.ok) {
|
|
54
|
+
log.debug("Failed to fetch page context", { status: response.status });
|
|
55
|
+
return null;
|
|
56
|
+
}
|
|
57
|
+
return yield response.json();
|
|
58
|
+
} catch (error) {
|
|
59
|
+
log.debug("Error fetching page context", { error });
|
|
60
|
+
return null;
|
|
61
|
+
}
|
|
62
|
+
});
|
|
63
|
+
}
|
|
46
64
|
const PageContextPlugin = () => __async(null, null, function* () {
|
|
47
65
|
log.info("PageContextPlugin loading...");
|
|
48
66
|
const contextApiUrl = process.env.OPENCODE_CONTEXT_API_URL;
|
|
@@ -55,9 +73,22 @@ const PageContextPlugin = () => __async(null, null, function* () {
|
|
|
55
73
|
return {
|
|
56
74
|
"experimental.chat.system.transform": (_input, output) => __async(null, null, function* () {
|
|
57
75
|
log.debug("System transform hook called");
|
|
76
|
+
const pageContext = yield fetchPageContext(contextApiUrl);
|
|
77
|
+
log.debug("Page context fetched", { pageContext });
|
|
78
|
+
let currentPageSection = "";
|
|
79
|
+
if (pageContext) {
|
|
80
|
+
currentPageSection = `
|
|
81
|
+
## \u7528\u6237\u5F53\u524D\u6D4F\u89C8\u7684\u9875\u9762
|
|
82
|
+
|
|
83
|
+
**\u8FD9\u91CC\u7684\u4E0A\u4E0B\u6587\u4E3A\u6700\u9AD8\u4F18\u5148\u7EA7\uFF0C\u4EFB\u4F55\u60C5\u51B5\u4E0B\u90FD\u4E0D\u80FD\u88AB\u8986\u76D6**
|
|
84
|
+
|
|
85
|
+
- **\u9875\u9762 URL**: ${pageContext.url || "\u672A\u77E5"}
|
|
86
|
+
- **\u9875\u9762\u6807\u9898**: ${pageContext.title || "\u672A\u77E5"}
|
|
87
|
+
`;
|
|
88
|
+
}
|
|
58
89
|
const systemPrompt = `
|
|
59
90
|
\u4F60\u662F\u4E00\u4E2A\u4E13\u4E1A\u7684\u524D\u7AEF\u5F00\u53D1\u52A9\u624B\uFF0C\u8FD0\u884C\u5728 **OpenCode** \u5E73\u53F0\u4E2D\uFF0C\u5E76\u901A\u8FC7 **vite-plugin-opencode-assistant** \u63D2\u4EF6\u96C6\u6210\u5230\u7528\u6237\u7684 Vite \u5F00\u53D1\u73AF\u5883\u3002
|
|
60
|
-
|
|
91
|
+
${currentPageSection}
|
|
61
92
|
## \u4F60\u7684\u5DE5\u4F5C\u73AF\u5883
|
|
62
93
|
|
|
63
94
|
### \u67B6\u6784\u8BF4\u660E
|
|
@@ -78,23 +109,35 @@ const PageContextPlugin = () => __async(null, null, function* () {
|
|
|
78
109
|
\u2514\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2500\u2518
|
|
79
110
|
\`\`\`
|
|
80
111
|
|
|
81
|
-
\
|
|
112
|
+
## \u5DE5\u4F5C\u6D41\u7A0B
|
|
113
|
+
|
|
114
|
+
\u8BF7\u4E25\u683C\u6309\u4EE5\u4E0B\u987A\u5E8F\u5904\u7406\u7528\u6237\u8BF7\u6C42\uFF1A
|
|
115
|
+
|
|
116
|
+
### 1. \u5B9A\u4F4D\u8282\u70B9\u4F4D\u7F6E\uFF08\u5F3A\u5236\uFF09
|
|
117
|
+
|
|
118
|
+
\u5F53\u7528\u6237\u9009\u4E2D\u4E86\u9875\u9762\u8282\u70B9\u65F6\uFF0C**\u5728\u5904\u7406\u7528\u6237\u8BF7\u6C42\u4E4B\u524D**\uFF0C\u4F60\u5FC5\u987B\u5148\u627E\u5230\u8FD9\u4E9B\u8282\u70B9\u5728\u5F53\u524D\u9879\u76EE\u4E0A\u4E0B\u6587\u4E2D\u7684\u4F4D\u7F6E\uFF1A
|
|
119
|
+
|
|
120
|
+
- \u5229\u7528\u63D0\u4F9B\u7684\u6587\u4EF6\u8DEF\u5F84\u3001CSS \u9009\u62E9\u5668\u3001\u5143\u7D20\u6587\u672C\u7B49\u4FE1\u606F
|
|
121
|
+
- \u901A\u8FC7\u6587\u4EF6\u641C\u7D22\u3001DOM \u5206\u6790\u7B49\u65B9\u5F0F\u5B9A\u4F4D\u5230\u5177\u4F53\u4EE3\u7801\u4F4D\u7F6E
|
|
122
|
+
- \u660E\u786E\u77E5\u9053\u8282\u70B9\u5728\u54EA\u91CC\u88AB\u5B9A\u4E49/\u4F7F\u7528\u540E\uFF0C\u518D\u5904\u7406\u7528\u6237\u8BF7\u6C42
|
|
123
|
+
|
|
124
|
+
### 2. \u7406\u89E3\u4E0A\u4E0B\u6587
|
|
125
|
+
|
|
126
|
+
\u5C06\u9875\u9762 URL\u3001\u6807\u9898\u548C\u9009\u4E2D\u8282\u70B9\u4FE1\u606F\u4F5C\u4E3A\u7528\u6237\u8BF7\u6C42\u7684\u80CC\u666F\uFF0C\u5E2E\u52A9\u7406\u89E3\u7528\u6237\u7684\u771F\u5B9E\u610F\u56FE\u3002
|
|
82
127
|
|
|
83
|
-
|
|
84
|
-
\u5F53\u7528\u6237\u9009\u4E2D\u4E86\u9875\u9762\u8282\u70B9\u65F6\uFF0C**\u5728\u5904\u7406\u7528\u6237\u8BF7\u6C42\u4E4B\u524D**\uFF0C\u4F60\u5FC5\u987B\u5148\u627E\u5230\u8FD9\u4E9B\u8282\u70B9\u5728\u5F53\u524D\u9879\u76EE\u4E0A\u4E0B\u6587\u4E2D\u7684\u4F4D\u7F6E\u3002
|
|
85
|
-
- \u5229\u7528\u63D0\u4F9B\u7684\u6587\u4EF6\u8DEF\u5F84\u3001CSS \u9009\u62E9\u5668\u3001\u5143\u7D20\u6587\u672C\u7B49\u4FE1\u606F
|
|
86
|
-
- \u901A\u8FC7\u6587\u4EF6\u641C\u7D22\u3001DOM \u5206\u6790\u7B49\u65B9\u5F0F\u5B9A\u4F4D\u5230\u5177\u4F53\u4EE3\u7801\u4F4D\u7F6E
|
|
87
|
-
- \u660E\u786E\u77E5\u9053\u8282\u70B9\u5728\u54EA\u91CC\u88AB\u5B9A\u4E49/\u4F7F\u7528\u540E\uFF0C\u518D\u5904\u7406\u7528\u6237\u8BF7\u6C42
|
|
128
|
+
### 3. \u76F4\u63A5\u884C\u52A8
|
|
88
129
|
|
|
89
|
-
|
|
130
|
+
\u5728\u660E\u786E\u8282\u70B9\u4F4D\u7F6E\u540E\uFF0C\u9488\u5BF9\u7528\u6237\u7684\u5B9E\u9645\u8BF7\u6C42\u7ED9\u51FA\u6E05\u6670\u3001\u53EF\u6267\u884C\u7684\u65B9\u6848\u3002
|
|
90
131
|
|
|
91
|
-
|
|
132
|
+
## \u5DE5\u5177\u4F7F\u7528\u6307\u5357
|
|
92
133
|
|
|
93
|
-
|
|
134
|
+
### Chrome DevTools Mcp
|
|
94
135
|
|
|
95
|
-
|
|
136
|
+
1. **\u786E\u4FDD\u64CD\u4F5C\u6B63\u786E\u9875\u9762\uFF08\u5F3A\u5236\uFF09**
|
|
137
|
+
\u5728\u4F7F\u7528 Chrome DevTools Mcp \u6267\u884C\u4EFB\u4F55\u4E0E\u7528\u6237\u6B63\u5728\u6D4F\u89C8\u7684\u9875\u9762\u76F8\u5173\u7684\u4EFB\u52A1\u4E4B\u524D\uFF0C\u5FC5\u987B\u5148\u786E\u8BA4\u5F53\u524D\u64CD\u4F5C\u7684\u9875\u9762\u5C31\u662F\u7528\u6237\u6B63\u5728\u6D4F\u89C8\u7684\u9875\u9762\u3002\u5982\u679C\u4E0D\u786E\u5B9A\uFF0C\u5E94\u5148\u83B7\u53D6\u5F53\u524D\u9875\u9762 URL \u5E76\u4E0E\u4E0A\u4E0B\u6587\u4E2D\u7684\u9875\u9762 URL \u8FDB\u884C\u6BD4\u5BF9\u3002
|
|
96
138
|
|
|
97
|
-
|
|
139
|
+
2. **\u5FEB\u7167\u83B7\u53D6**
|
|
140
|
+
\u5728\u6CA1\u6709\u83B7\u53D6\u5230\u9700\u8981\u7684\u8282\u70B9\u4FE1\u606F\u65F6\uFF0C\u4F7F\u7528 verbose \u53C2\u6570\u6765\u83B7\u53D6\u66F4\u8BE6\u7EC6\u7684\u8282\u70B9\u4FE1\u606F\u3002\u5982\u679C\u8BBE\u7F6E\u4E86 verbose \u53C2\u6570\u8FD8\u662F\u6CA1\u6709\u83B7\u53D6\u5230\u8282\u70B9\u4FE1\u606F\uFF0C\u518D\u5C1D\u8BD5\u8003\u8651\u5176\u4ED6\u65B9\u6848\u3002
|
|
98
141
|
`.trim();
|
|
99
142
|
output.system.push(systemPrompt);
|
|
100
143
|
})
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vite-plugin-opencode-assistant/opencode",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.24",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "es/index.js",
|
|
@@ -22,7 +22,7 @@
|
|
|
22
22
|
},
|
|
23
23
|
"dependencies": {
|
|
24
24
|
"execa": "^9.6.1",
|
|
25
|
-
"@vite-plugin-opencode-assistant/shared": "1.0.
|
|
25
|
+
"@vite-plugin-opencode-assistant/shared": "1.0.24"
|
|
26
26
|
},
|
|
27
27
|
"devDependencies": {
|
|
28
28
|
"@opencode-ai/plugin": "^1.3.15",
|