u1s1-cli 0.16.4 → 0.16.5

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.
Files changed (2) hide show
  1. package/dist/loop.js +9 -5
  2. package/package.json +1 -1
package/dist/loop.js CHANGED
@@ -8,8 +8,9 @@
8
8
  * /loop 20m /review-pr 1234 循环里也能跑其他斜杠命令
9
9
  * /loop stop 停止当前循环
10
10
  *
11
- * 语义与 Claude Code 对齐:任务只活在当前会话,/clear 或退出即消失。
12
- * 实现核心是 pi.sendUserMessage():定时器到点就"替用户打字"发一轮,
11
+ * 语义与 Claude Code 对齐:任务只活在当前会话,/clear 或退出即消失;
12
+ * 启动时立刻跑第一轮,之后每隔一个间隔再跑。
13
+ * 实现核心是 pi.sendUserMessage():到点就"替用户打字"发一轮,
13
14
  * deliverAs: "followUp" 保证上一轮没跑完时排队等它结束,不硬插打断;
14
15
  * expandPromptTemplates: true 让 prompt 里的斜杠命令也能被展开执行。
15
16
  */
@@ -116,7 +117,7 @@ export function registerLoopCommand(pi) {
116
117
  stopLoop(ctx.ui);
117
118
  activePrompt = parsed.prompt;
118
119
  activeIntervalMs = parsed.intervalMs;
119
- timer = setInterval(() => {
120
+ const fire = () => {
120
121
  try {
121
122
  pi.sendUserMessage(activePrompt, {
122
123
  deliverAs: "followUp",
@@ -126,9 +127,12 @@ export function registerLoopCommand(pi) {
126
127
  catch (e) {
127
128
  ctx.ui.notify(`loop 执行失败: ${e instanceof Error ? e.message : String(e)}`, "error");
128
129
  }
129
- }, activeIntervalMs);
130
+ };
131
+ // 第一轮立刻跑:用户写完命令就想看到结果,不该干等一个间隔
132
+ fire();
133
+ timer = setInterval(fire, activeIntervalMs);
130
134
  ctx.ui.setStatus(STATUS_KEY, `🔁 每${formatInterval(activeIntervalMs)} · ${preview(activePrompt)}`);
131
- ctx.ui.notify(`🔁 已开始:每${formatInterval(activeIntervalMs)}执行一次「${preview(activePrompt)}」`, "info");
135
+ ctx.ui.notify(`🔁 已开始:现在先跑第一轮,之后每${formatInterval(activeIntervalMs)}一次「${preview(activePrompt)}」`, "info");
132
136
  },
133
137
  });
134
138
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "u1s1-cli",
3
- "version": "0.16.4",
3
+ "version": "0.16.5",
4
4
  "description": "u1s1 — 有一说一,最省心的 AI 编程搭子。终端里用中文说需求,AI 帮你读文件、改代码、跑命令。",
5
5
  "type": "module",
6
6
  "bin": {