@ghostpaw/questlog 0.9.2 → 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 +144 -4
- package/SKILL.md +95 -40
- package/dist/chunk-7KTRNXTU.js +21 -0
- package/dist/chunk-D6EGZCT7.js +23 -0
- package/dist/chunk-GVD6A3RR.js +108 -0
- package/dist/{chunk-6KTQK3ZE.js → chunk-I2AMIXGP.js} +8 -0
- package/dist/{chunk-3B6FMHZU.js → chunk-IA2GVCZS.js} +35 -2
- package/dist/{chunk-DKH623HU.js → chunk-IL2QRKZL.js} +1 -4
- package/dist/{chunk-UTUQPSGO.js → chunk-KOWIVBG6.js} +68 -588
- package/dist/chunk-NBCCA6AX.js +31 -0
- package/dist/chunk-QK3H2AL5.js +36 -0
- package/dist/chunk-RBGQK5WP.js +949 -0
- package/dist/cli.js +1 -1
- package/dist/{cli_main-XNZP4TY2.js → cli_main-TEG3QTDP.js} +147 -128
- package/dist/index.cjs +1152 -627
- package/dist/index.d.cts +142 -11
- package/dist/index.d.ts +142 -11
- package/dist/index.js +1152 -628
- package/dist/list_deliveries-WJEJUZIQ.js +2 -0
- package/dist/list_hooks-C5CAA2C7.js +2 -0
- package/dist/mcp-server.js +840 -389
- package/dist/mcp.cjs +709 -322
- package/dist/mcp.js +711 -324
- package/dist/open_questlog_db-6NS6BVBC.js +2 -0
- package/dist/{questlog_skill_spec-EM6DGGVN.js → questlog_skill_spec-ILTCTRYS.js} +16 -8
- package/dist/run_hook_command-BOENYNDT.js +155 -0
- package/dist/{serve_questlog_mcp-KFUYJB2P.js → serve_questlog_mcp-X524X34F.js} +6 -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 +95 -40
- package/skills/questlog/references/webhooks.md +94 -0
- package/dist/open_questlog_db-SH3DAU4C.js +0 -2
|
@@ -1,7 +1,10 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { questlogSkills } from './chunk-I2AMIXGP.js';
|
|
2
3
|
import { questlogMcpInstructions } from './chunk-SVWAEAKC.js';
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
4
|
+
import { reviewQuestlogTool, questlogSurfaceTools } from './chunk-KOWIVBG6.js';
|
|
5
|
+
import './chunk-RBGQK5WP.js';
|
|
6
|
+
import './chunk-D6EGZCT7.js';
|
|
7
|
+
import './chunk-NBCCA6AX.js';
|
|
5
8
|
import './chunk-QYSIJ2YN.js';
|
|
6
9
|
|
|
7
10
|
// src/soul.ts
|
|
@@ -49,15 +52,20 @@ var questlogSkillSpec = {
|
|
|
49
52
|
"`questlog` and `ghostpaw-questlog` are the same binary.",
|
|
50
53
|
"",
|
|
51
54
|
"- `questlog search <words>` before `add` to avoid duplicates.",
|
|
52
|
-
'- `ghostpaw-questlog add "
|
|
55
|
+
'- `ghostpaw-questlog add "Write the report" --tag work --due tomorrow`',
|
|
53
56
|
`- \`questlog list [--view <view>]\`: ${reviewQuestlogTool.inputSchema.properties?.view?.enum?.join(", ")}.`,
|
|
54
|
-
'- `questlog done
|
|
55
|
-
|
|
56
|
-
"- `questlog show
|
|
57
|
+
'- `questlog done 12 --outcome "Report sent"`',
|
|
58
|
+
'- `questlog search "release"`',
|
|
59
|
+
"- `questlog show 12`",
|
|
60
|
+
"- `questlog list --view quests.available`",
|
|
57
61
|
"- Use `--json` on any plain command.",
|
|
58
|
-
"- Exit codes: 0 ok / 1 error / 2 usage / 3 needs input.",
|
|
62
|
+
"- Exit codes: 0 ok / 1 error / 2 usage / 3 needs input or hook target not found.",
|
|
59
63
|
"- Database: `~/.ghostpaw/questlog.db`; override with `--db` or `GHOSTPAW_QUESTLOG_DB`.",
|
|
60
|
-
"- Use one database per
|
|
64
|
+
"- Use one database per project.",
|
|
65
|
+
"- `questlog --version` prints the installed version.",
|
|
66
|
+
"- `questlog skill --short` prints this compact cheat sheet.",
|
|
67
|
+
"- `questlog skill --list` lists guides; `questlog skill webhooks` reads one.",
|
|
68
|
+
"- Webhooks: `questlog hook add <url>`, `questlog tick --dry-run`, `questlog watch`. Read `questlog skill webhooks` for events, signing, verification, and cron setup."
|
|
61
69
|
].join("\n"),
|
|
62
70
|
description: "Use the release binary ghostpaw-questlog to manage local tasks, calendar commitments, and recurring work. Use when planning, executing, reviewing, or organizing work.",
|
|
63
71
|
license: "MIT",
|
|
@@ -0,0 +1,155 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { parseCliArgs } from './chunk-GVD6A3RR.js';
|
|
3
|
+
import { textOutput } from './chunk-QK3H2AL5.js';
|
|
4
|
+
import { watchQuestlog, testHook, removeHook, hookLabel, withTransaction, addHook } from './chunk-RBGQK5WP.js';
|
|
5
|
+
import './chunk-D6EGZCT7.js';
|
|
6
|
+
import { listHooks } from './chunk-NBCCA6AX.js';
|
|
7
|
+
|
|
8
|
+
// src/hooks/hook_headers.ts
|
|
9
|
+
function parseHookHeaders(lines) {
|
|
10
|
+
const headers = /* @__PURE__ */ Object.create(null);
|
|
11
|
+
for (const line of lines) {
|
|
12
|
+
const colon = line.indexOf(":");
|
|
13
|
+
const name = line.slice(0, colon).trim().toLowerCase();
|
|
14
|
+
if (colon < 1 || !/^[!#$%&'*+.^_`|~0-9a-z-]+$/.test(name))
|
|
15
|
+
throw new Error("Invalid header name; use Name: value");
|
|
16
|
+
if (["host", "content-length", "content-type"].includes(name) || name.startsWith("x-questlog-"))
|
|
17
|
+
throw new Error(`Reserved header name: ${name}`);
|
|
18
|
+
const value = line.slice(colon + 1).trim();
|
|
19
|
+
if (/[\r\n\0]/.test(value)) throw new Error("Invalid header value");
|
|
20
|
+
headers[name] = value;
|
|
21
|
+
}
|
|
22
|
+
return headers;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// src/surface/run_hook_command.ts
|
|
26
|
+
async function runHookCommand(command, args, io, open) {
|
|
27
|
+
let db;
|
|
28
|
+
try {
|
|
29
|
+
if (args.includes("--help") || args.includes("-h")) {
|
|
30
|
+
io.stdout.write(
|
|
31
|
+
'questlog hook add <url> [--tag name] [--events types] [--min-gap seconds] [--secret-stdin] [--header "Name: value"] [--header-stdin] [--json]\nquestlog hook list|remove <id>|test <id>|label [name]\nquestlog watch [--interval seconds] [--json]\n'
|
|
32
|
+
);
|
|
33
|
+
return 0;
|
|
34
|
+
}
|
|
35
|
+
const action = command === "watch" ? "watch" : args.shift();
|
|
36
|
+
if (!["add", "list", "remove", "test", "label", "watch"].includes(action ?? ""))
|
|
37
|
+
throw new Error("Expected hook add, list, remove, test, or label");
|
|
38
|
+
const values = parseCliArgs(args, {
|
|
39
|
+
command,
|
|
40
|
+
flags: [
|
|
41
|
+
{ name: "json", type: "boolean" },
|
|
42
|
+
...action === "add" ? [
|
|
43
|
+
{ name: "tag", type: "string" },
|
|
44
|
+
{ name: "events", type: "string" },
|
|
45
|
+
{ name: "min-gap", type: "integer" },
|
|
46
|
+
{ name: "secret-stdin", type: "boolean" },
|
|
47
|
+
{ name: "header", type: "array" },
|
|
48
|
+
{ name: "header-stdin", type: "boolean" }
|
|
49
|
+
] : action === "watch" ? [{ name: "interval", type: "number" }] : []
|
|
50
|
+
],
|
|
51
|
+
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" }] : []
|
|
52
|
+
});
|
|
53
|
+
if (action === "watch" && values.interval !== void 0 && Number(values.interval) < 5)
|
|
54
|
+
throw new Error(`--interval ${values.interval} is below the minimum of 5 seconds`);
|
|
55
|
+
db = await open();
|
|
56
|
+
let result;
|
|
57
|
+
switch (action) {
|
|
58
|
+
case "add": {
|
|
59
|
+
let secret;
|
|
60
|
+
if (values.secretStdin && values.headerStdin)
|
|
61
|
+
throw new Error("Use --secret-stdin and --header-stdin separately");
|
|
62
|
+
const headerLines = values.header ?? [];
|
|
63
|
+
if (values.headerStdin) {
|
|
64
|
+
let raw = "";
|
|
65
|
+
for await (const chunk of io.stdin) raw += String(chunk);
|
|
66
|
+
headerLines.push(...raw.split(/\r?\n/).filter(Boolean));
|
|
67
|
+
}
|
|
68
|
+
const headers = parseHookHeaders(headerLines);
|
|
69
|
+
if (values.secretStdin) {
|
|
70
|
+
secret = "";
|
|
71
|
+
for await (const chunk of io.stdin) secret += String(chunk);
|
|
72
|
+
secret = secret.replace(/\r?\n$/, "");
|
|
73
|
+
}
|
|
74
|
+
result = withTransaction(db, () => {
|
|
75
|
+
const created = addHook(db, {
|
|
76
|
+
url: String(values.url),
|
|
77
|
+
...values.tag === void 0 ? {} : { tag: String(values.tag) },
|
|
78
|
+
...values.events === void 0 ? {} : { events: String(values.events).split(",") },
|
|
79
|
+
...values.minGap === void 0 ? {} : { minGap: Number(values.minGap) },
|
|
80
|
+
...secret === void 0 ? {} : { secret }
|
|
81
|
+
});
|
|
82
|
+
db.prepare("UPDATE hook_targets SET headers = ? WHERE id = ?").run(JSON.stringify(headers), created.id);
|
|
83
|
+
return created;
|
|
84
|
+
});
|
|
85
|
+
break;
|
|
86
|
+
}
|
|
87
|
+
case "list":
|
|
88
|
+
result = listHooks(db);
|
|
89
|
+
break;
|
|
90
|
+
case "label":
|
|
91
|
+
result = { label: hookLabel(db, values.name) };
|
|
92
|
+
break;
|
|
93
|
+
case "remove":
|
|
94
|
+
if (!listHooks(db).some((hook) => hook.id === Number(values.id))) {
|
|
95
|
+
io.stderr.write(`Hook ${values.id} not found
|
|
96
|
+
`);
|
|
97
|
+
return 3;
|
|
98
|
+
}
|
|
99
|
+
removeHook(db, Number(values.id));
|
|
100
|
+
result = { removed: Number(values.id) };
|
|
101
|
+
break;
|
|
102
|
+
case "test":
|
|
103
|
+
if (!listHooks(db).some((hook) => hook.id === Number(values.id))) {
|
|
104
|
+
io.stderr.write(`Hook ${values.id} not found
|
|
105
|
+
`);
|
|
106
|
+
return 3;
|
|
107
|
+
}
|
|
108
|
+
result = await testHook(db, Number(values.id));
|
|
109
|
+
break;
|
|
110
|
+
case "watch": {
|
|
111
|
+
const controller = new AbortController();
|
|
112
|
+
const stop = () => controller.abort();
|
|
113
|
+
process.on("SIGINT", stop);
|
|
114
|
+
process.on("SIGTERM", stop);
|
|
115
|
+
try {
|
|
116
|
+
await watchQuestlog(db, {
|
|
117
|
+
signal: controller.signal,
|
|
118
|
+
interval: Number(values.interval ?? 60),
|
|
119
|
+
onTick: (tick) => io.stdout.write(
|
|
120
|
+
values.json ? `${JSON.stringify(tick)}
|
|
121
|
+
` : `${tick.events.length} events; ${tick.sent} sent, ${tick.queued} queued, ${tick.retrying} retrying, ${tick.failed} failed
|
|
122
|
+
`
|
|
123
|
+
)
|
|
124
|
+
});
|
|
125
|
+
} finally {
|
|
126
|
+
process.off("SIGINT", stop);
|
|
127
|
+
process.off("SIGTERM", stop);
|
|
128
|
+
}
|
|
129
|
+
return 0;
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
io.stdout.write(
|
|
133
|
+
values.json ? `${JSON.stringify(result, null, 2)}
|
|
134
|
+
` : action === "add" ? `Created hook ${result.id}
|
|
135
|
+
Secret (shown once): ${result.secret}
|
|
136
|
+
` : `${textOutput(result)}
|
|
137
|
+
`
|
|
138
|
+
);
|
|
139
|
+
return 0;
|
|
140
|
+
} catch (error) {
|
|
141
|
+
const message = error instanceof Error ? error.message : "";
|
|
142
|
+
const safe = /^(unsupported scheme |URL userinfo |unknown event |--interval |Invalid header |Reserved header |Use --secret-stdin|Expected |Min gap |Unknown event |Hook )/.test(
|
|
143
|
+
message
|
|
144
|
+
);
|
|
145
|
+
io.stderr.write(
|
|
146
|
+
`${safe ? message : "Invalid webhook command or unavailable target. Run questlog hook --help."}
|
|
147
|
+
`
|
|
148
|
+
);
|
|
149
|
+
return 2;
|
|
150
|
+
} finally {
|
|
151
|
+
db?.close();
|
|
152
|
+
}
|
|
153
|
+
}
|
|
154
|
+
|
|
155
|
+
export { runHookCommand };
|
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { openQuestlogDb } from './chunk-3B6FMHZU.js';
|
|
3
2
|
import { questlogMcpInstructions } from './chunk-SVWAEAKC.js';
|
|
4
|
-
import { isErrorResult,
|
|
5
|
-
import { validateInput, questlogSurfaceTools } from './chunk-
|
|
3
|
+
import { isErrorResult, resolveQuestlogDbPath } from './chunk-IL2QRKZL.js';
|
|
4
|
+
import { validateInput, questlogSurfaceTools } from './chunk-KOWIVBG6.js';
|
|
5
|
+
import { openQuestlogDb } from './chunk-IA2GVCZS.js';
|
|
6
|
+
import { questlogVersion } from './chunk-RBGQK5WP.js';
|
|
7
|
+
import './chunk-D6EGZCT7.js';
|
|
8
|
+
import './chunk-NBCCA6AX.js';
|
|
6
9
|
import { minimalInput } from './chunk-QYSIJ2YN.js';
|
|
7
10
|
|
|
8
11
|
// src/surfaces/mcp_server.ts
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
+
import { schemaRows } from './chunk-7KTRNXTU.js';
|
|
2
3
|
import { minimalInput } from './chunk-QYSIJ2YN.js';
|
|
3
4
|
|
|
4
5
|
// src/surfaces/skill_markdown.ts
|
|
5
|
-
function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
|
|
6
|
+
function renderSkillMarkdown(spec, { referencesBase: _referencesBase = "references" } = {}) {
|
|
6
7
|
if (!/^[a-z0-9]+(?:-[a-z0-9]+)*$/.test(spec.name) || spec.name.length > 64)
|
|
7
8
|
throw new Error("Invalid skill name");
|
|
8
9
|
if (!spec.description.trim() || spec.description.length > 1024 || !spec.description.includes("Use when"))
|
|
@@ -48,24 +49,7 @@ function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
|
|
|
48
49
|
"| Parameter | Type | Required | Values / description |",
|
|
49
50
|
"| --- | --- | --- | --- |"
|
|
50
51
|
);
|
|
51
|
-
|
|
52
|
-
const properties = { ...schema.properties };
|
|
53
|
-
const required = new Set(schema.required);
|
|
54
|
-
for (const branch of schema.oneOf ?? []) {
|
|
55
|
-
for (const [key, value] of Object.entries(branch.properties ?? {}))
|
|
56
|
-
properties[key] ??= value;
|
|
57
|
-
for (const key of branch.required ?? []) required.add(key);
|
|
58
|
-
}
|
|
59
|
-
for (const [name, property] of Object.entries(properties)) {
|
|
60
|
-
if (prefix && Object.keys(properties).length > 8 && !required.has(name)) continue;
|
|
61
|
-
const path = `${prefix}${name}`;
|
|
62
|
-
lines.push(
|
|
63
|
-
`| ${path} | ${property.type ?? property.oneOf?.map((branch) => branch.type).join(" / ") ?? "any"} | ${required.has(name) ? "yes" : "no"} | ${((property.enum ? `${property.enum.join(", ")}. ` : "") + (property.description ?? "")).replaceAll("|", "\\|").replaceAll("\n", " ")} |`
|
|
64
|
-
);
|
|
65
|
-
if (property.properties || property.oneOf) rows(property, `${path}.`);
|
|
66
|
-
}
|
|
67
|
-
};
|
|
68
|
-
rows(tool.inputSchema);
|
|
52
|
+
lines.push(...schemaRows(tool.inputSchema).map((row) => `| ${row} |`));
|
|
69
53
|
lines.push("", "```sh");
|
|
70
54
|
for (const action of tool.inputSchema.properties?.action?.enum?.slice(0, 3) ?? [void 0]) {
|
|
71
55
|
lines.push(
|
|
@@ -79,7 +63,7 @@ function renderSkillMarkdown(spec, { referencesBase = "references" } = {}) {
|
|
|
79
63
|
"## Workflow guides",
|
|
80
64
|
"",
|
|
81
65
|
...spec.workflows.map(
|
|
82
|
-
(workflow) => `- \`${spec.bin} skill ${workflow.name}
|
|
66
|
+
(workflow) => `- \`${spec.bin} skill ${workflow.name}\`: ${workflow.description}`
|
|
83
67
|
),
|
|
84
68
|
"",
|
|
85
69
|
"## Principles",
|
package/package.json
CHANGED
package/skills/questlog/SKILL.md
CHANGED
|
@@ -28,15 +28,20 @@ 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 "
|
|
32
|
-
- `questlog list [--view <view>]`: 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
|
|
31
|
+
- `ghostpaw-questlog add "Write the report" --tag work --due tomorrow`
|
|
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 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.
|
|
44
|
+
- Webhooks: `questlog hook add <url>`, `questlog tick --dry-run`, `questlog watch`. Read `questlog skill webhooks` for events, signing, verification, and cron setup.
|
|
40
45
|
|
|
41
46
|
## Appendix: MCP and tool calls
|
|
42
47
|
|
|
@@ -50,6 +55,28 @@ CLI: `ghostpaw-questlog call <tool> '<JSON object>'` or `ghostpaw-questlog <tool
|
|
|
50
55
|
|
|
51
56
|
Inspect schemas with `ghostpaw-questlog describe <tool>`. Use `--db <path>` to select a database.
|
|
52
57
|
|
|
58
|
+
### manage_hooks
|
|
59
|
+
|
|
60
|
+
List or remove outbound webhook targets, run a tick, or inspect pending and failed deliveries.
|
|
61
|
+
|
|
62
|
+
Use when: Use to operate configured outbound webhooks. Add and test targets with the CLI.
|
|
63
|
+
|
|
64
|
+
Not for: Use quest tools to change work itself.
|
|
65
|
+
|
|
66
|
+
Writes: writes_state.
|
|
67
|
+
|
|
68
|
+
| Parameter | Type | Required | Values / description |
|
|
69
|
+
| --- | --- | --- | --- |
|
|
70
|
+
| action | string | yes | list, remove, tick, deliveries. Operation. |
|
|
71
|
+
| id | integer | no | Target id. |
|
|
72
|
+
| dry_run | boolean | no | Preview only. |
|
|
73
|
+
|
|
74
|
+
```sh
|
|
75
|
+
ghostpaw-questlog call manage_hooks '{"action":"list"}'
|
|
76
|
+
ghostpaw-questlog call manage_hooks '{"action":"remove","id":1}'
|
|
77
|
+
ghostpaw-questlog call manage_hooks '{"action":"tick"}'
|
|
78
|
+
```
|
|
79
|
+
|
|
53
80
|
### search_questlog
|
|
54
81
|
|
|
55
82
|
Search quests and rumors by text when you need to find an existing item before inspecting or changing it.
|
|
@@ -83,7 +110,7 @@ Read-only.
|
|
|
83
110
|
|
|
84
111
|
| Parameter | Type | Required | Values / description |
|
|
85
112
|
| --- | --- | --- | --- |
|
|
86
|
-
| view | string | yes | 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. Which operational review surface to return. |
|
|
113
|
+
| view | string | yes | 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. Which operational review surface to return. |
|
|
87
114
|
| filters | object | no | Optional filters for supported review surfaces. |
|
|
88
115
|
| filters.questlineId | integer | no | Optional questline id used by quest views. |
|
|
89
116
|
| filters.tagNames | array | no | Optional tag names used by quest views. |
|
|
@@ -92,7 +119,7 @@ Read-only.
|
|
|
92
119
|
| now | integer | no | Optional evaluation timestamp for time-sensitive views. |
|
|
93
120
|
|
|
94
121
|
```sh
|
|
95
|
-
ghostpaw-questlog call review_questlog '{"view":"
|
|
122
|
+
ghostpaw-questlog call review_questlog '{"view":"deliveries"}'
|
|
96
123
|
```
|
|
97
124
|
|
|
98
125
|
### inspect_questlog_item
|
|
@@ -152,16 +179,39 @@ Writes: writes_state.
|
|
|
152
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. |
|
|
153
180
|
| questId | integer | no | Quest to attach or detach. |
|
|
154
181
|
| questlineId | integer | no | Questline that should receive the quest. |
|
|
155
|
-
| quest | object | no |
|
|
182
|
+
| quest | object | no | Object: title (required), objective (required), questlineId, tags, rewards, dueAt, notBeforeAt, scheduledStartAt, scheduledEndAt, allDay, estimateSeconds |
|
|
156
183
|
| quest.title | string | yes | Title for the new quest. |
|
|
157
184
|
| quest.objective | string | yes | Objective for the new quest. |
|
|
158
|
-
|
|
|
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 |
|
|
159
197
|
| questline.title | string | yes | Questline title. |
|
|
160
198
|
| questline.description | string | no | Optional questline description. |
|
|
161
199
|
| rumorId | integer | no | Rumor to settle, dismiss, or reopen. |
|
|
162
200
|
| dismissedAt | integer | no | Optional dismissal timestamp. |
|
|
163
201
|
| settledAt | integer | no | Optional settlement timestamp. |
|
|
164
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. |
|
|
165
215
|
| now | integer | no | Optional timestamp for membership, reopen, or rumor update. |
|
|
166
216
|
| title | string | no | New title for the update_rumor action. |
|
|
167
217
|
| details | string | no | New or enriched context text for the update_rumor action. |
|
|
@@ -221,6 +271,8 @@ Writes: writes_state.
|
|
|
221
271
|
| outcome | string | no | Terminal outcome text. Required for finish, abandon, and abandon_and_spawn_followups. |
|
|
222
272
|
| resolvedAt | integer | no | Optional resolved timestamp for finish or abandon actions. |
|
|
223
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. |
|
|
224
276
|
|
|
225
277
|
```sh
|
|
226
278
|
ghostpaw-questlog call run_quest '{"action":"start","questId":1}'
|
|
@@ -272,7 +324,7 @@ Writes: writes_state.
|
|
|
272
324
|
| --- | --- | --- | --- |
|
|
273
325
|
| action | string | yes | archive, create, preview_due, spawn_due, update. Action to perform. |
|
|
274
326
|
| repeatableQuestId | integer | no | Repeatable quest to archive or update. |
|
|
275
|
-
| repeatableQuest | object | no |
|
|
327
|
+
| repeatableQuest | object | no | Object: title (required), objective (required), rrule (required), anchorAt (required) |
|
|
276
328
|
| repeatableQuest.title | string | yes | Title for the new repeatable quest. |
|
|
277
329
|
| repeatableQuest.objective | string | yes | Objective for the new repeatable quest. |
|
|
278
330
|
| repeatableQuest.rrule | string | yes | RRULE describing recurrence. |
|
|
@@ -310,7 +362,7 @@ Writes: writes_state.
|
|
|
310
362
|
| Parameter | Type | Required | Values / description |
|
|
311
363
|
| --- | --- | --- | --- |
|
|
312
364
|
| action | string | yes | add, remove, replace. Action to perform. |
|
|
313
|
-
| target | object | yes |
|
|
365
|
+
| target | object | yes | Object: id (required), kind (required) |
|
|
314
366
|
| target.id | integer | yes | Target entity id. |
|
|
315
367
|
| target.kind | string | yes | quest, repeatable_quest. Target kind. |
|
|
316
368
|
| tagNames | array | yes | Tag names to add, remove, or replace. |
|
|
@@ -335,14 +387,16 @@ Writes: writes_state.
|
|
|
335
387
|
| Parameter | Type | Required | Values / description |
|
|
336
388
|
| --- | --- | --- | --- |
|
|
337
389
|
| action | string | yes | add, claim, remove, replace_repeatable_template, update. Action to perform. |
|
|
338
|
-
| target | object | yes |
|
|
390
|
+
| target | object | yes | Object: id (required), kind (required) |
|
|
339
391
|
| target.id | integer | yes | Target entity id. |
|
|
340
392
|
| target.kind | string | yes | quest, reward, repeatable_quest. Target kind. |
|
|
341
|
-
| reward | object | no |
|
|
393
|
+
| reward | object | no | Object: kind (required), name (required), now |
|
|
342
394
|
| reward.kind | string | yes | Reward kind. |
|
|
343
395
|
| reward.name | string | yes | Reward name. |
|
|
344
396
|
| reward.now | integer | no | Optional update timestamp for the update action. |
|
|
345
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. |
|
|
346
400
|
| claimedAt | integer | no | Optional claim timestamp. |
|
|
347
401
|
| now | integer | no | Optional timestamp for removal or template replacement. |
|
|
348
402
|
|
|
@@ -376,31 +430,32 @@ ghostpaw-questlog call retire_work '{"action":"hide","target":{"kind":"quest","i
|
|
|
376
430
|
|
|
377
431
|
### Workflow guides
|
|
378
432
|
|
|
379
|
-
- `ghostpaw-questlog skill
|
|
380
|
-
- `ghostpaw-questlog skill
|
|
381
|
-
- `ghostpaw-questlog skill
|
|
382
|
-
- `ghostpaw-questlog skill
|
|
383
|
-
- `ghostpaw-questlog skill
|
|
384
|
-
- `ghostpaw-questlog skill
|
|
385
|
-
- `ghostpaw-questlog skill
|
|
386
|
-
- `ghostpaw-questlog skill
|
|
387
|
-
- `ghostpaw-questlog skill
|
|
388
|
-
- `ghostpaw-questlog skill
|
|
389
|
-
- `ghostpaw-questlog skill
|
|
390
|
-
- `ghostpaw-questlog skill
|
|
391
|
-
- `ghostpaw-questlog skill
|
|
392
|
-
- `ghostpaw-questlog skill plan-
|
|
393
|
-
- `ghostpaw-questlog skill
|
|
394
|
-
- `ghostpaw-questlog skill
|
|
395
|
-
- `ghostpaw-questlog skill
|
|
396
|
-
- `ghostpaw-questlog skill
|
|
397
|
-
- `ghostpaw-questlog skill
|
|
398
|
-
- `ghostpaw-questlog skill
|
|
399
|
-
- `ghostpaw-questlog skill run-
|
|
400
|
-
- `ghostpaw-questlog skill
|
|
401
|
-
- `ghostpaw-questlog skill
|
|
402
|
-
- `ghostpaw-questlog skill
|
|
403
|
-
- `ghostpaw-questlog skill
|
|
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.
|
|
404
459
|
|
|
405
460
|
### Principles
|
|
406
461
|
|
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
# Webhooks
|
|
2
|
+
|
|
3
|
+
Use `questlog` to configure opt-in outbound automation. No server or scheduler is added.
|
|
4
|
+
No targets means no network calls. `manage_hooks` supports list, remove, tick with
|
|
5
|
+
`dry_run`, and deliveries; add/test are CLI-only. `review_questlog` view `deliveries`
|
|
6
|
+
and `questlog show <id>` expose pending/failed deliveries.
|
|
7
|
+
|
|
8
|
+
```sh
|
|
9
|
+
questlog hook add https://example.org/wake --min-gap 60
|
|
10
|
+
questlog hook add https://example.org/team --tag work --events quest.due,quest.overdue --secret-stdin
|
|
11
|
+
questlog hook label work
|
|
12
|
+
questlog hook list
|
|
13
|
+
questlog tick --dry-run
|
|
14
|
+
questlog tick
|
|
15
|
+
questlog watch --interval 60
|
|
16
|
+
questlog hook test 1
|
|
17
|
+
questlog review deliveries
|
|
18
|
+
questlog show 12
|
|
19
|
+
questlog hook remove 1
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
`hook add` prints its random 32-byte signing secret once, also as `secret` in `--json`.
|
|
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.
|
|
27
|
+
List output redacts userinfo/query strings. Removal deletes the target and deliveries.
|
|
28
|
+
Default scope is the database; `--tag` matches quest tags, never rumors.
|
|
29
|
+
`--events` defaults to all types. The DB label defaults to the filename without its
|
|
30
|
+
path/extension (`questlog` in memory); set it to a name suitable for disclosure.
|
|
31
|
+
|
|
32
|
+
```cron
|
|
33
|
+
* * * * * questlog tick
|
|
34
|
+
```
|
|
35
|
+
|
|
36
|
+
Cron's PATH may need `$HOME/.local/bin/questlog tick --db /path/to/quests.db`.
|
|
37
|
+
Watch defaults to 60 seconds (minimum 5); SIGINT/SIGTERM finishes the current tick.
|
|
38
|
+
Tick exits 0 even when deliveries need retries. Dry-run records nothing and sends nothing.
|
|
39
|
+
|
|
40
|
+
Events are detected from the model at tick time:
|
|
41
|
+
|
|
42
|
+
- `quest.due`: an unresolved, undeleted quest reaches its effective due time (own `due_at`, otherwise its undeleted questline's due time).
|
|
43
|
+
- `quest.overdue`: that effective deadline is strictly earlier than now and the quest remains unresolved.
|
|
44
|
+
- `quest.unblocked`: an unresolved quest is available, all active prerequisites have succeeded or been deleted, and at least one prerequisite succeeded after its unlock was installed. Occurrence time is the latest active prerequisite success or not-before time, whichever is later.
|
|
45
|
+
- `repeatable.spawned`: a concrete repeatable instance was created; occurrence time is its creation time. Tick first materializes due anchors through the existing spawn operation.
|
|
46
|
+
- `rumor.captured`: an undeleted rumor was created; occurrence time is its creation time, even if subsequently settled or dismissed.
|
|
47
|
+
|
|
48
|
+
Persistent event keys contain type, entity ids, and occurrence time. Restarts and repeated
|
|
49
|
+
ticks do not repeat occurrences. Removed transitions between ticks cannot be reconstructed.
|
|
50
|
+
Only occurrences at/after target creation are assigned; tags are evaluated at assignment.
|
|
51
|
+
Tick materializes due repeatables using the existing spawn path, including during preview
|
|
52
|
+
with rollback. Batches contain only ids, event types, timestamps, and the DB label:
|
|
53
|
+
|
|
54
|
+
```json
|
|
55
|
+
{"type":"questlog.events","db":"work","deliveryId":"d_…","sentAt":"2026-10-28T10:00:00.000Z","events":[{"id":"e_…","type":"quest.due","questId":12,"occurredAt":"2026-10-28T09:59:00.000Z"}]}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
Headers are `content-type: application/json`, `user-agent: questlog/<version>`,
|
|
59
|
+
`x-questlog-delivery: <deliveryId>`, `x-questlog-timestamp: <unix seconds>`, and
|
|
60
|
+
`x-questlog-signature: sha256=<hex HMAC-SHA256(secret, timestamp + "." + rawBody)>`.
|
|
61
|
+
No titles, objectives, details, or tag text are sent. `hook test` sends a logged `hook.test`
|
|
62
|
+
event immediately, ignoring the min gap. Add and test are CLI-only in the tool facade;
|
|
63
|
+
`manage_hooks` supports list, remove, tick (with `dry_run`), and deliveries.
|
|
64
|
+
|
|
65
|
+
2xx delivers. Timeout is 5 seconds. Failures retry after 30 s, 1 m, 2 m, 4 m, doubling
|
|
66
|
+
to 1 h plus <1 s jitter, subject to the target's min gap. Eight failures mark failed.
|
|
67
|
+
Retries keep the delivery id/events; new events queue behind them. Keep the last 500
|
|
68
|
+
delivered log entries per target and all pending/failed entries. Transactional claims
|
|
69
|
+
lease work for two minutes. A crash after receipt may retry: dedupe at the receiver.
|
|
70
|
+
|
|
71
|
+
### Verifying a delivery
|
|
72
|
+
|
|
73
|
+
Compute HMAC-SHA256 over `timestamp + "." + rawBody` with the secret and compare in constant
|
|
74
|
+
time. Reject timestamps older than 5 minutes (and timestamps too far in the future), then
|
|
75
|
+
dedupe on `x-questlog-delivery`. Use durable deduplication storage in a production receiver.
|
|
76
|
+
This 15-line Node example uses an in-memory set:
|
|
77
|
+
|
|
78
|
+
```js
|
|
79
|
+
import { createHmac, timingSafeEqual } from 'node:crypto';
|
|
80
|
+
import { createServer } from 'node:http';
|
|
81
|
+
const secret = process.env.WEBHOOK_SECRET, seen = new Set();
|
|
82
|
+
createServer(async (req, res) => {
|
|
83
|
+
const chunks = []; for await (const chunk of req) chunks.push(chunk);
|
|
84
|
+
const rawBody = Buffer.concat(chunks), h = req.headers;
|
|
85
|
+
const timestamp = h['x-questlog-timestamp'], id = h['x-questlog-delivery'];
|
|
86
|
+
const age = Date.now() / 1000 - Number(timestamp);
|
|
87
|
+
const expected = createHmac('sha256', secret).update(timestamp + '.').update(rawBody).digest();
|
|
88
|
+
const signature = String(h['x-questlog-signature'] || '');
|
|
89
|
+
const actual = Buffer.from(signature.slice(7), 'hex');
|
|
90
|
+
if (!id || !/^\d+$/.test(timestamp) || age > 300 || age < -300 || !/^sha256=[a-f0-9]{64}$/.test(signature) || actual.length !== expected.length || !timingSafeEqual(actual, expected)) { res.writeHead(401).end(); return; }
|
|
91
|
+
if (!seen.has(id)) { seen.add(id); console.log(JSON.parse(rawBody)); }
|
|
92
|
+
res.writeHead(204).end();
|
|
93
|
+
}).listen(8080, '127.0.0.1');
|
|
94
|
+
```
|