@ghostpaw/questlog 0.10.1 → 0.11.0
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 +31 -5
- package/SKILL.md +69 -38
- package/dist/chunk-7KTRNXTU.js +21 -0
- package/dist/chunk-D6EGZCT7.js +23 -0
- package/dist/{chunk-D2W5MYNO.js → chunk-I2AMIXGP.js} +1 -1
- package/dist/{chunk-ZHTX64KD.js → chunk-IA2GVCZS.js} +11 -2
- package/dist/{chunk-55JAQORX.js → chunk-KOWIVBG6.js} +3 -1
- package/dist/chunk-NBCCA6AX.js +31 -0
- package/dist/chunk-QK3H2AL5.js +36 -0
- package/dist/{chunk-N7V7VUI5.js → chunk-RBGQK5WP.js} +54 -87
- package/dist/cli.js +1 -1
- package/dist/{cli_main-7AIEZV75.js → cli_main-TEG3QTDP.js} +78 -21
- package/dist/index.cjs +23 -6
- package/dist/index.js +23 -6
- package/dist/list_deliveries-WJEJUZIQ.js +2 -0
- package/dist/list_hooks-C5CAA2C7.js +2 -0
- package/dist/mcp-server.js +22 -5
- package/dist/mcp.cjs +21 -4
- package/dist/mcp.js +22 -5
- package/dist/open_questlog_db-6NS6BVBC.js +2 -0
- package/dist/{questlog_skill_spec-HEW2B6EB.js → questlog_skill_spec-ILTCTRYS.js} +15 -9
- package/dist/run_hook_command-BOENYNDT.js +155 -0
- package/dist/{serve_questlog_mcp-W3R63HW4.js → serve_questlog_mcp-X524X34F.js} +5 -3
- package/dist/{skill_markdown-HXYQ3K6U.js → skill_markdown-EGKYZ3W2.js} +4 -20
- package/dist/text_output-X7F3K23Q.js +2 -0
- package/package.json +1 -1
- package/skills/questlog/SKILL.md +69 -38
- package/skills/questlog/references/webhooks.md +3 -0
- package/dist/open_questlog_db-LAEH7UDM.js +0 -2
- package/dist/run_hook_command-C42BQC36.js +0 -95
package/skills/questlog/SKILL.md
CHANGED
|
@@ -28,15 +28,19 @@ Run tools as `ghostpaw-questlog ...`; use `~/.local/bin/ghostpaw-questlog` if it
|
|
|
28
28
|
`questlog` and `ghostpaw-questlog` are the same binary.
|
|
29
29
|
|
|
30
30
|
- `questlog search <words>` before `add` to avoid duplicates.
|
|
31
|
-
- `ghostpaw-questlog add "
|
|
31
|
+
- `ghostpaw-questlog add "Write the report" --tag work --due tomorrow`
|
|
32
32
|
- `questlog list [--view <view>]`: deliveries, questlines, quests.active, quests.available, quests.blocked, quests.deferred, quests.due_soon, quests.in_progress, quests.missed_scheduled, quests.open, quests.overdue, quests.resolved, quests.scheduled_for_day, quests.scheduled_now, repeatables.due_anchors, rumors.
|
|
33
|
-
- `questlog done
|
|
34
|
-
- `questlog search
|
|
35
|
-
- `questlog show
|
|
33
|
+
- `questlog done 12 --outcome "Report sent"`
|
|
34
|
+
- `questlog search "release"`
|
|
35
|
+
- `questlog show 12`
|
|
36
|
+
- `questlog list --view quests.available`
|
|
36
37
|
- Use `--json` on any plain command.
|
|
37
|
-
- Exit codes: 0 ok / 1 error / 2 usage / 3 needs input.
|
|
38
|
+
- Exit codes: 0 ok / 1 error / 2 usage / 3 needs input or hook target not found.
|
|
38
39
|
- Database: `~/.ghostpaw/questlog.db`; override with `--db` or `GHOSTPAW_QUESTLOG_DB`.
|
|
39
|
-
- Use one database per
|
|
40
|
+
- Use one database per project.
|
|
41
|
+
- `questlog --version` prints the installed version.
|
|
42
|
+
- `questlog skill --short` prints this compact cheat sheet.
|
|
43
|
+
- `questlog skill --list` lists guides; `questlog skill webhooks` reads one.
|
|
40
44
|
- Webhooks: `questlog hook add <url>`, `questlog tick --dry-run`, `questlog watch`. Read `questlog skill webhooks` for events, signing, verification, and cron setup.
|
|
41
45
|
|
|
42
46
|
## Appendix: MCP and tool calls
|
|
@@ -175,16 +179,39 @@ Writes: writes_state.
|
|
|
175
179
|
| action | string | yes | attach_quest_to_questline, create_quest, create_questline, detach_quest_from_questline, dismiss_rumor, reopen_rumor, settle_rumor, update_rumor. Action to perform. |
|
|
176
180
|
| questId | integer | no | Quest to attach or detach. |
|
|
177
181
|
| questlineId | integer | no | Questline that should receive the quest. |
|
|
178
|
-
| quest | object | no |
|
|
182
|
+
| quest | object | no | Object: title (required), objective (required), questlineId, tags, rewards, dueAt, notBeforeAt, scheduledStartAt, scheduledEndAt, allDay, estimateSeconds |
|
|
179
183
|
| quest.title | string | yes | Title for the new quest. |
|
|
180
184
|
| quest.objective | string | yes | Objective for the new quest. |
|
|
181
|
-
|
|
|
185
|
+
| quest.questlineId | integer | no | Optional questline to place the quest in. |
|
|
186
|
+
| quest.tags | array | no | Optional tags to apply at creation. |
|
|
187
|
+
| quest.rewards | array | no | Optional rewards to attach at creation. |
|
|
188
|
+
| quest.rewards[].kind | string | yes | Reward kind. |
|
|
189
|
+
| quest.rewards[].name | string | yes | Reward name. |
|
|
190
|
+
| quest.dueAt | integer | no | Optional latest acceptable completion timestamp. |
|
|
191
|
+
| quest.notBeforeAt | integer | no | Optional earliest actionable timestamp. |
|
|
192
|
+
| quest.scheduledStartAt | integer | no | Optional planned schedule window start. |
|
|
193
|
+
| quest.scheduledEndAt | integer | no | Optional planned schedule window end. |
|
|
194
|
+
| quest.allDay | boolean | no | Whether the scheduled window is all-day. |
|
|
195
|
+
| quest.estimateSeconds | integer | no | Optional active-effort estimate in seconds. |
|
|
196
|
+
| questline | object | no | Object: title (required), description |
|
|
182
197
|
| questline.title | string | yes | Questline title. |
|
|
183
198
|
| questline.description | string | no | Optional questline description. |
|
|
184
199
|
| rumorId | integer | no | Rumor to settle, dismiss, or reopen. |
|
|
185
200
|
| dismissedAt | integer | no | Optional dismissal timestamp. |
|
|
186
201
|
| settledAt | integer | no | Optional settlement timestamp. |
|
|
187
202
|
| quests | array | no | Quests to create during rumor settlement. Include timing and tags directly. |
|
|
203
|
+
| quests[].title | string | yes | Title for a created quest. |
|
|
204
|
+
| quests[].objective | string | yes | Objective for a created quest. |
|
|
205
|
+
| quests[].tags | array | no | Optional tags to apply at creation. |
|
|
206
|
+
| quests[].rewards | array | no | Optional rewards to attach at creation. |
|
|
207
|
+
| quests[].rewards[].kind | string | yes | Reward kind. |
|
|
208
|
+
| quests[].rewards[].name | string | yes | Reward name. |
|
|
209
|
+
| quests[].dueAt | integer | no | Optional latest acceptable completion timestamp. |
|
|
210
|
+
| quests[].notBeforeAt | integer | no | Optional earliest actionable timestamp. |
|
|
211
|
+
| quests[].scheduledStartAt | integer | no | Optional planned schedule window start. |
|
|
212
|
+
| quests[].scheduledEndAt | integer | no | Optional planned schedule window end. |
|
|
213
|
+
| quests[].allDay | boolean | no | Whether the scheduled window is all-day. |
|
|
214
|
+
| quests[].estimateSeconds | integer | no | Optional active-effort estimate in seconds. |
|
|
188
215
|
| now | integer | no | Optional timestamp for membership, reopen, or rumor update. |
|
|
189
216
|
| title | string | no | New title for the update_rumor action. |
|
|
190
217
|
| details | string | no | New or enriched context text for the update_rumor action. |
|
|
@@ -244,6 +271,8 @@ Writes: writes_state.
|
|
|
244
271
|
| outcome | string | no | Terminal outcome text. Required for finish, abandon, and abandon_and_spawn_followups. |
|
|
245
272
|
| resolvedAt | integer | no | Optional resolved timestamp for finish or abandon actions. |
|
|
246
273
|
| followups | array | no | Follow-up quests to create atomically. Required for abandon_and_spawn_followups. |
|
|
274
|
+
| followups[].title | string | yes | Title for a follow-up quest. |
|
|
275
|
+
| followups[].objective | string | yes | Objective for a follow-up quest. |
|
|
247
276
|
|
|
248
277
|
```sh
|
|
249
278
|
ghostpaw-questlog call run_quest '{"action":"start","questId":1}'
|
|
@@ -295,7 +324,7 @@ Writes: writes_state.
|
|
|
295
324
|
| --- | --- | --- | --- |
|
|
296
325
|
| action | string | yes | archive, create, preview_due, spawn_due, update. Action to perform. |
|
|
297
326
|
| repeatableQuestId | integer | no | Repeatable quest to archive or update. |
|
|
298
|
-
| repeatableQuest | object | no |
|
|
327
|
+
| repeatableQuest | object | no | Object: title (required), objective (required), rrule (required), anchorAt (required) |
|
|
299
328
|
| repeatableQuest.title | string | yes | Title for the new repeatable quest. |
|
|
300
329
|
| repeatableQuest.objective | string | yes | Objective for the new repeatable quest. |
|
|
301
330
|
| repeatableQuest.rrule | string | yes | RRULE describing recurrence. |
|
|
@@ -333,7 +362,7 @@ Writes: writes_state.
|
|
|
333
362
|
| Parameter | Type | Required | Values / description |
|
|
334
363
|
| --- | --- | --- | --- |
|
|
335
364
|
| action | string | yes | add, remove, replace. Action to perform. |
|
|
336
|
-
| target | object | yes |
|
|
365
|
+
| target | object | yes | Object: id (required), kind (required) |
|
|
337
366
|
| target.id | integer | yes | Target entity id. |
|
|
338
367
|
| target.kind | string | yes | quest, repeatable_quest. Target kind. |
|
|
339
368
|
| tagNames | array | yes | Tag names to add, remove, or replace. |
|
|
@@ -358,14 +387,16 @@ Writes: writes_state.
|
|
|
358
387
|
| Parameter | Type | Required | Values / description |
|
|
359
388
|
| --- | --- | --- | --- |
|
|
360
389
|
| action | string | yes | add, claim, remove, replace_repeatable_template, update. Action to perform. |
|
|
361
|
-
| target | object | yes |
|
|
390
|
+
| target | object | yes | Object: id (required), kind (required) |
|
|
362
391
|
| target.id | integer | yes | Target entity id. |
|
|
363
392
|
| target.kind | string | yes | quest, reward, repeatable_quest. Target kind. |
|
|
364
|
-
| reward | object | no |
|
|
393
|
+
| reward | object | no | Object: kind (required), name (required), now |
|
|
365
394
|
| reward.kind | string | yes | Reward kind. |
|
|
366
395
|
| reward.name | string | yes | Reward name. |
|
|
367
396
|
| reward.now | integer | no | Optional update timestamp for the update action. |
|
|
368
397
|
| rewards | array | no | Full future reward template set. Required for replace_repeatable_template. |
|
|
398
|
+
| rewards[].kind | string | yes | Reward kind. |
|
|
399
|
+
| rewards[].name | string | yes | Reward name. |
|
|
369
400
|
| claimedAt | integer | no | Optional claim timestamp. |
|
|
370
401
|
| now | integer | no | Optional timestamp for removal or template replacement. |
|
|
371
402
|
|
|
@@ -399,32 +430,32 @@ ghostpaw-questlog call retire_work '{"action":"hide","target":{"kind":"quest","i
|
|
|
399
430
|
|
|
400
431
|
### Workflow guides
|
|
401
432
|
|
|
402
|
-
- `ghostpaw-questlog skill webhooks
|
|
403
|
-
- `ghostpaw-questlog skill archive-delete-and-prune
|
|
404
|
-
- `ghostpaw-questlog skill choose-work-shape
|
|
405
|
-
- `ghostpaw-questlog skill clarify-ambiguous-requests
|
|
406
|
-
- `ghostpaw-questlog skill close-work-and-claim-outcomes
|
|
407
|
-
- `ghostpaw-questlog skill create-concrete-quest
|
|
408
|
-
- `ghostpaw-questlog skill detect-slips-and-staleness
|
|
409
|
-
- `ghostpaw-questlog skill escalate-and-unblock
|
|
410
|
-
- `ghostpaw-questlog skill frame-initiative-questline
|
|
411
|
-
- `ghostpaw-questlog skill handle-exceptions-and-weird-cases
|
|
412
|
-
- `ghostpaw-questlog skill intake-triage
|
|
413
|
-
- `ghostpaw-questlog skill maintain-clear-ownership
|
|
414
|
-
- `ghostpaw-questlog skill manage-approvals-and-promises
|
|
415
|
-
- `ghostpaw-questlog skill plan-successor-work
|
|
416
|
-
- `ghostpaw-questlog skill plan-time-correctly
|
|
417
|
-
- `ghostpaw-questlog skill prioritize-across-streams
|
|
418
|
-
- `ghostpaw-questlog skill protect-capacity-and-focus
|
|
419
|
-
- `ghostpaw-questlog skill recover-from-modeling-mistakes
|
|
420
|
-
- `ghostpaw-questlog skill report-status-and-manage-expectations
|
|
421
|
-
- `ghostpaw-questlog skill revise-or-reshape-commitment
|
|
422
|
-
- `ghostpaw-questlog skill run-operational-review
|
|
423
|
-
- `ghostpaw-questlog skill run-recurring-rhythms
|
|
424
|
-
- `ghostpaw-questlog skill search-and-retrieve-context
|
|
425
|
-
- `ghostpaw-questlog skill sequence-with-unlocks
|
|
426
|
-
- `ghostpaw-questlog skill settle-rumor-into-structure
|
|
427
|
-
- `ghostpaw-questlog skill tag-and-filter-portfolios
|
|
433
|
+
- `ghostpaw-questlog skill webhooks`: Configure signed outbound event webhooks and verify deliveries.
|
|
434
|
+
- `ghostpaw-questlog skill archive-delete-and-prune`: Choose the right retirement action for each kind of work so history stays honest and hiding does not get confused with archival or terminal execution truth.
|
|
435
|
+
- `ghostpaw-questlog skill choose-work-shape`: Choose the right structure for new work by separating uncertainty, one-shot execution, multi-step arcs, and recurring patterns.
|
|
436
|
+
- `ghostpaw-questlog skill clarify-ambiguous-requests`: Treat ambiguity as a real state, capture uncertainty honestly, and only commit work structure once the next executable shape is clear.
|
|
437
|
+
- `ghostpaw-questlog skill close-work-and-claim-outcomes`: Close work with the correct terminal lifecycle action, then handle any concrete reward claim as a separate explicit step.
|
|
438
|
+
- `ghostpaw-questlog skill create-concrete-quest`: Create real, bounded executable quests only when the objective is concrete enough to execute without interpretive guesswork.
|
|
439
|
+
- `ghostpaw-questlog skill detect-slips-and-staleness`: Detect work that is slipping or going stale by reading overdue, deferred, in-progress, and related operational views before choosing one recovery move.
|
|
440
|
+
- `ghostpaw-questlog skill escalate-and-unblock`: Diagnose blockers honestly, then remove or realign hard gates when the model is wrong instead of treating every delay as generic escalation theater.
|
|
441
|
+
- `ghostpaw-questlog skill frame-initiative-questline`: Use questlines for shared initiative context, then attach concrete quests and maintain the structure without confusing one quest with one arc.
|
|
442
|
+
- `ghostpaw-questlog skill handle-exceptions-and-weird-cases`: Handle weird cases by diagnosing the actual tool outcome, routing into clarification or recovery when needed, and refusing to fake a clean normal-state story.
|
|
443
|
+
- `ghostpaw-questlog skill intake-triage`: Triage new asks, ideas, and vague incoming work into the right next step without prematurely committing execution structure.
|
|
444
|
+
- `ghostpaw-questlog skill maintain-clear-ownership`: Keep ownership explicit through quest content and classification because Questlog does not provide a separate assignee field or ownership tool.
|
|
445
|
+
- `ghostpaw-questlog skill manage-approvals-and-promises`: Treat approvals and commitments as modeled work with timing and dependencies instead of burying them as vague narrative promises.
|
|
446
|
+
- `ghostpaw-questlog skill plan-successor-work`: Create explicit successor work after closure by spawning follow-ups or shaping new work, while keeping uncertain next steps in intake instead of faking certainty.
|
|
447
|
+
- `ghostpaw-questlog skill plan-time-correctly`: Use quest planning fields honestly so availability, due pressure, and schedule intent stay meaningful instead of getting collapsed into one generic date.
|
|
448
|
+
- `ghostpaw-questlog skill prioritize-across-streams`: Prioritize across competing work streams by reading real candidate sets, distinguishing available from blocked work, and then reflecting the choice in planning.
|
|
449
|
+
- `ghostpaw-questlog skill protect-capacity-and-focus`: Protect capacity and focus by reading the real in-progress and scheduled-now load, then using planning to rebalance instead of silently overcommitting.
|
|
450
|
+
- `ghostpaw-questlog skill recover-from-modeling-mistakes`: Recover from modeling mistakes by diagnosing the exact current state first, then applying the smallest honest corrective tool instead of rewriting history blindly.
|
|
451
|
+
- `ghostpaw-questlog skill report-status-and-manage-expectations`: Build status reporting from the real questlog state, separating available, blocked, in-progress, slipping, and resolved work without relying on memory.
|
|
452
|
+
- `ghostpaw-questlog skill revise-or-reshape-commitment`: Revise a quest objective before execution starts, but reshape commitments honestly with lifecycle tools once real execution history exists.
|
|
453
|
+
- `ghostpaw-questlog skill run-operational-review`: Drive daily or weekly operational review from structured list views, then move from diagnosis into actual planning or execution changes.
|
|
454
|
+
- `ghostpaw-questlog skill run-recurring-rhythms`: Model recurring work as repeatable definitions that spawn fresh concrete quests over time instead of living forever as one immortal task.
|
|
455
|
+
- `ghostpaw-questlog skill search-and-retrieve-context`: Find relevant questlog context quickly, then switch from discovery to exact inspection without confusing free-text search with structured review surfaces.
|
|
456
|
+
- `ghostpaw-questlog skill sequence-with-unlocks`: Model hard sequencing with unlocks between concrete quests so blocked and available work stay truthful and reviewable.
|
|
457
|
+
- `ghostpaw-questlog skill settle-rumor-into-structure`: Turn a ready rumor into committed quest or questline structure without losing provenance or pretending vague intake is settled.
|
|
458
|
+
- `ghostpaw-questlog skill tag-and-filter-portfolios`: Use tags for cross-cutting classification and portfolio filtering without confusing tags for status, timing, or dependency modeling.
|
|
428
459
|
|
|
429
460
|
### Principles
|
|
430
461
|
|
|
@@ -21,6 +21,9 @@ questlog hook remove 1
|
|
|
21
21
|
|
|
22
22
|
`hook add` prints its random 32-byte signing secret once, also as `secret` in `--json`.
|
|
23
23
|
Save it securely. `--secret-stdin` supplies one via stdin; there is no secret flag.
|
|
24
|
+
Secrets and custom header values are stored in the DB. New POSIX DB/WAL/SHM files use 0600 and created directories use 0700; existing DB modes are preserved. Windows uses existing access controls.
|
|
25
|
+
Use repeatable `--header "Name: value"` or `--header-stdin` (one line per header, avoiding shell history). Headers are sent on every delivery and test; output shows names with `***` values. HTTP token names are required; host, content-length, content-type, and x-questlog-* are reserved. Change headers by removing and adding the hook again. Use --header-stdin and --secret-stdin separately. URL userinfo is rejected; use a custom header or query key.
|
|
26
|
+
`questlog show d_…` displays delivery status, attempts, HTTP status, next attempt, redacted target URL and event ids. Text is the default; --json prints JSON. Missing hook remove/test targets exit 3; missing quests/deliveries exit 1. hook label names the database.
|
|
24
27
|
List output redacts userinfo/query strings. Removal deletes the target and deliveries.
|
|
25
28
|
Default scope is the database; `--tag` matches quest tags, never rumors.
|
|
26
29
|
`--events` defaults to all types. The DB label defaults to the filename without its
|
|
@@ -1,95 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
import { parseCliArgs } from './chunk-GVD6A3RR.js';
|
|
3
|
-
import { watchQuestlog, testHook, removeHook, hookLabel, listHooks, addHook } from './chunk-N7V7VUI5.js';
|
|
4
|
-
|
|
5
|
-
// src/surface/run_hook_command.ts
|
|
6
|
-
async function runHookCommand(command, args, io, open) {
|
|
7
|
-
let db;
|
|
8
|
-
try {
|
|
9
|
-
if (args.includes("--help") || args.includes("-h")) {
|
|
10
|
-
io.stdout.write(
|
|
11
|
-
"questlog hook add <url> [--tag name] [--events types] [--min-gap seconds] [--secret-stdin] [--json]\nquestlog hook list|remove <id>|test <id>|label [name]\nquestlog watch [--interval seconds] [--json]\n"
|
|
12
|
-
);
|
|
13
|
-
return 0;
|
|
14
|
-
}
|
|
15
|
-
const action = command === "watch" ? "watch" : args.shift();
|
|
16
|
-
if (!["add", "list", "remove", "test", "label", "watch"].includes(action ?? ""))
|
|
17
|
-
throw new Error("Expected hook add, list, remove, test, or label");
|
|
18
|
-
const values = parseCliArgs(args, {
|
|
19
|
-
command,
|
|
20
|
-
flags: [
|
|
21
|
-
{ name: "json", type: "boolean" },
|
|
22
|
-
...action === "add" ? [
|
|
23
|
-
{ name: "tag", type: "string" },
|
|
24
|
-
{ name: "events", type: "string" },
|
|
25
|
-
{ name: "min-gap", type: "integer" },
|
|
26
|
-
{ name: "secret-stdin", type: "boolean" }
|
|
27
|
-
] : action === "watch" ? [{ name: "interval", type: "number" }] : []
|
|
28
|
-
],
|
|
29
|
-
positionals: action === "add" ? [{ name: "url", type: "string", required: true }] : ["remove", "test"].includes(action ?? "") ? [{ name: "id", type: "integer", required: true }] : action === "label" ? [{ name: "name", type: "string" }] : []
|
|
30
|
-
});
|
|
31
|
-
if (action === "watch" && values.interval !== void 0 && Number(values.interval) < 5)
|
|
32
|
-
throw new Error("Interval must be at least 5 seconds");
|
|
33
|
-
db = await open();
|
|
34
|
-
let result;
|
|
35
|
-
switch (action) {
|
|
36
|
-
case "add": {
|
|
37
|
-
let secret;
|
|
38
|
-
if (values.secretStdin) {
|
|
39
|
-
secret = "";
|
|
40
|
-
for await (const chunk of io.stdin) secret += String(chunk);
|
|
41
|
-
secret = secret.replace(/\r?\n$/, "");
|
|
42
|
-
}
|
|
43
|
-
result = addHook(db, {
|
|
44
|
-
url: String(values.url),
|
|
45
|
-
...values.tag === void 0 ? {} : { tag: String(values.tag) },
|
|
46
|
-
...values.events === void 0 ? {} : { events: String(values.events).split(",") },
|
|
47
|
-
...values.minGap === void 0 ? {} : { minGap: Number(values.minGap) },
|
|
48
|
-
...secret === void 0 ? {} : { secret }
|
|
49
|
-
});
|
|
50
|
-
break;
|
|
51
|
-
}
|
|
52
|
-
case "list":
|
|
53
|
-
result = listHooks(db);
|
|
54
|
-
break;
|
|
55
|
-
case "label":
|
|
56
|
-
result = { label: hookLabel(db, values.name) };
|
|
57
|
-
break;
|
|
58
|
-
case "remove":
|
|
59
|
-
removeHook(db, Number(values.id));
|
|
60
|
-
result = { removed: Number(values.id) };
|
|
61
|
-
break;
|
|
62
|
-
case "test":
|
|
63
|
-
result = await testHook(db, Number(values.id));
|
|
64
|
-
break;
|
|
65
|
-
case "watch": {
|
|
66
|
-
const controller = new AbortController();
|
|
67
|
-
const stop = () => controller.abort();
|
|
68
|
-
process.on("SIGINT", stop);
|
|
69
|
-
process.on("SIGTERM", stop);
|
|
70
|
-
try {
|
|
71
|
-
await watchQuestlog(db, {
|
|
72
|
-
signal: controller.signal,
|
|
73
|
-
interval: Number(values.interval ?? 60),
|
|
74
|
-
onTick: (tick) => io.stdout.write(`${JSON.stringify(tick)}
|
|
75
|
-
`)
|
|
76
|
-
});
|
|
77
|
-
} finally {
|
|
78
|
-
process.off("SIGINT", stop);
|
|
79
|
-
process.off("SIGTERM", stop);
|
|
80
|
-
}
|
|
81
|
-
return 0;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
io.stdout.write(`${JSON.stringify(result, null, 2)}
|
|
85
|
-
`);
|
|
86
|
-
return 0;
|
|
87
|
-
} catch {
|
|
88
|
-
io.stderr.write("Invalid webhook command or unavailable target. Run questlog hook --help.\n");
|
|
89
|
-
return 2;
|
|
90
|
-
} finally {
|
|
91
|
-
db?.close();
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
export { runHookCommand };
|