u1s1-cli 1.2.9 → 1.3.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/api.d.ts +8 -0
- package/dist/api.js +130 -22
- package/dist/bench.js +23 -6
- package/dist/deploy.d.ts +6 -0
- package/dist/deploy.js +41 -9
- package/dist/device-auth.d.ts +5 -1
- package/dist/device-auth.js +79 -28
- package/dist/index.js +8 -4
- package/dist/login.js +49 -15
- package/dist/model.d.ts +6 -0
- package/dist/model.js +24 -5
- package/dist/search-tools.js +15 -2
- package/dist/subagent.d.ts +14 -0
- package/dist/subagent.js +47 -11
- package/dist/tools.d.ts +4 -0
- package/dist/tools.js +84 -16
- package/dist/update.js +19 -7
- package/dist/web.js +4 -2
- package/dist/workflow/runner.d.ts +17 -0
- package/dist/workflow/runner.js +6 -7
- package/dist/workflow/templates.js +4 -4
- package/package.json +1 -1
|
@@ -127,14 +127,14 @@ return { synthesis };
|
|
|
127
127
|
},
|
|
128
128
|
refactor: {
|
|
129
129
|
name: "refactor",
|
|
130
|
-
description: "批量重构/迁移:先由一个 agent 读代表文件制定统一规则,然后每个文件一个子 agent
|
|
130
|
+
description: "批量重构/迁移:先由一个 agent 读代表文件制定统一规则,然后每个文件一个子 agent 在当前工作区套用规则",
|
|
131
131
|
inputHint: '{ "instruction": "把所有 var 改为 const", "files": ["src/a.ts", ...] } — files 省略时用 git diff 改动文件',
|
|
132
132
|
build(input) {
|
|
133
133
|
const instruction = str(input.instruction);
|
|
134
134
|
if (!instruction)
|
|
135
135
|
throw new Error('refactor 模板需要 instruction,例如 { "instruction": "把 var 全部改为 const" }');
|
|
136
136
|
// 与 review 模板一致:构建期取 git 改动文件,不花一个 subagent 在沙箱里跑 git
|
|
137
|
-
let files = strArray(input.files);
|
|
137
|
+
let files = [...new Set(strArray(input.files))];
|
|
138
138
|
if (files.length === 0)
|
|
139
139
|
files = gitDiffFiles();
|
|
140
140
|
if (files.length === 0)
|
|
@@ -150,8 +150,8 @@ const rule = await subagent({
|
|
|
150
150
|
});
|
|
151
151
|
const results = await parallel(targetFiles.map(f => () =>
|
|
152
152
|
subagent({
|
|
153
|
-
task: "按以下重构规则处理文件 " + f + "
|
|
154
|
-
|
|
153
|
+
task: "按以下重构规则处理文件 " + f + "。只修改这个目标文件,不要改动其他文件,避免与并行任务冲突。" +
|
|
154
|
+
"改完检查该文件语法正确(必要时运行 tsc 或构建验证)。\\n\\n重构规则:\\n" + rule
|
|
155
155
|
})
|
|
156
156
|
));
|
|
157
157
|
const done = targetFiles.filter((_, i) => results[i] !== null);
|