@zhoubiao188/pi-scheduled-tasks 0.2.1 → 0.2.2

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 CHANGED
@@ -1,5 +1,7 @@
1
1
  # pi-scheduled-tasks
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@zhoubiao188/pi-scheduled-tasks.svg)](https://www.npmjs.com/package/@zhoubiao188/pi-scheduled-tasks)
4
+
3
5
  Scheduled tasks for [pi](https://github.com/earendil-works/pi) and
4
6
  [Pi Web](https://github.com/agegr/pi-web): cron expressions, intervals and
5
7
  one-off prompts, managed from a dialog-driven interface inside the session.
@@ -48,14 +50,20 @@ need reminders in the session you already have open, that package may be enough.
48
50
 
49
51
  ## Install
50
52
 
53
+ ```bash
54
+ pi install npm:@zhoubiao188/pi-scheduled-tasks
55
+ ```
56
+
57
+ From a git checkout instead:
58
+
51
59
  ```bash
52
60
  pi install git:github.com/zhoubiao188/pi-scheduled-tasks
53
61
  ```
54
62
 
55
- Or try it without installing:
63
+ To try it without installing:
56
64
 
57
65
  ```bash
58
- pi -e git:github.com/zhoubiao188/pi-scheduled-tasks
66
+ pi -e npm:@zhoubiao188/pi-scheduled-tasks
59
67
  ```
60
68
 
61
69
  Restart Pi Web after installing, or run `/reload` in a session. In Pi Web the
@@ -229,6 +237,8 @@ npm run typecheck
229
237
  and fake dialogs; `test/runner.test.mjs` runs a stand-in `pi` that speaks the
230
238
  JSON event protocol.
231
239
 
240
+ Releases go through npm Trusted Publishing; see [RELEASING.md](./RELEASING.md).
241
+
232
242
  ## License
233
243
 
234
244
  MIT. Not affiliated with the pi or Pi Web maintainers.
package/README.zh-CN.md CHANGED
@@ -1,5 +1,7 @@
1
1
  # pi-scheduled-tasks
2
2
 
3
+ [![npm](https://img.shields.io/npm/v/@zhoubiao188/pi-scheduled-tasks.svg)](https://www.npmjs.com/package/@zhoubiao188/pi-scheduled-tasks)
4
+
3
5
  为 [pi](https://github.com/earendil-works/pi) 和 [Pi Web](https://github.com/agegr/pi-web)
4
6
  提供定时任务:cron 表达式、固定间隔、一次性提醒,都在会话里用对话框管理。
5
7
 
@@ -43,6 +45,12 @@ npm 上的 `pi-scheduled-tasks`(作者 errfld)也提供定时提示词:它
43
45
 
44
46
  ## 安装
45
47
 
48
+ ```bash
49
+ pi install npm:@zhoubiao188/pi-scheduled-tasks
50
+ ```
51
+
52
+ 也可以从 git 安装:
53
+
46
54
  ```bash
47
55
  pi install git:github.com/zhoubiao188/pi-scheduled-tasks
48
56
  ```
@@ -50,7 +58,7 @@ pi install git:github.com/zhoubiao188/pi-scheduled-tasks
50
58
  不安装、先试用:
51
59
 
52
60
  ```bash
53
- pi -e git:github.com/zhoubiao188/pi-scheduled-tasks
61
+ pi -e npm:@zhoubiao188/pi-scheduled-tasks
54
62
  ```
55
63
 
56
64
  安装后重启 Pi Web,或在会话里执行 `/reload`。在 Pi Web 输入框里输入 `/` 就能补全
@@ -201,6 +209,8 @@ npm run typecheck
201
209
  `test/extension.test.mjs` 用假的 pi API 和假对话框直接驱动真实命令处理函数;
202
210
  `test/runner.test.mjs` 用一个会讲 JSON 事件协议的假 `pi` 验证执行路径。
203
211
 
212
+ 发布走 npm Trusted Publishing,见 [RELEASING.md](./RELEASING.md)。
213
+
204
214
  ## 许可
205
215
 
206
216
  MIT。与 pi、Pi Web 维护者无隶属关系。
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zhoubiao188/pi-scheduled-tasks",
3
- "version": "0.2.1",
3
+ "version": "0.2.2",
4
4
  "description": "Scheduled tasks for pi and Pi Web: cron, intervals and one-off prompts, each run in its own session.",
5
5
  "type": "module",
6
6
  "license": "MIT",
package/src/recipes.ts CHANGED
@@ -117,10 +117,10 @@ export function buildSchedule(
117
117
  return parseSchedule(`${minutes} ${hours} ${day} ${month} *`, now);
118
118
  }
119
119
  case "interval": {
120
- const raw = (input.interval ?? "").trim();
121
- const text = /^\d/.test(raw) ? raw : "";
122
- if (!text) throw new ScheduleError('Use an interval such as "30m" or "1h30m".');
123
- return parseSchedule(`every ${text}`, now);
120
+ // People type "30m" and "every 30m" for the same thing.
121
+ const raw = (input.interval ?? "").trim().replace(/^every\s+/i, "");
122
+ if (!/^\d/.test(raw)) throw new ScheduleError('Use an interval such as "30m" or "1h30m".');
123
+ return parseSchedule(`every ${raw}`, now);
124
124
  }
125
125
  case "once":
126
126
  return parseSchedule(`at ${input.at ?? ""}`, now);