@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,32 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { mkdirSync } from 'node:fs';
|
|
2
|
+
import { mkdirSync, closeSync, openSync } from 'node:fs';
|
|
3
3
|
import { dirname } from 'node:path';
|
|
4
4
|
|
|
5
|
+
// src/hooks/init_hook_tables.ts
|
|
6
|
+
function initHookTables(db) {
|
|
7
|
+
db.exec(`
|
|
8
|
+
CREATE TABLE IF NOT EXISTS hook_targets (
|
|
9
|
+
id INTEGER PRIMARY KEY AUTOINCREMENT, url TEXT NOT NULL, secret TEXT NOT NULL,
|
|
10
|
+
tag TEXT, events TEXT NOT NULL, min_gap INTEGER NOT NULL, created_at INTEGER NOT NULL,
|
|
11
|
+
last_wake INTEGER, lease_until INTEGER, claim TEXT);
|
|
12
|
+
CREATE TABLE IF NOT EXISTS hook_events (
|
|
13
|
+
id TEXT PRIMARY KEY, occurred_at INTEGER NOT NULL, event TEXT NOT NULL);
|
|
14
|
+
CREATE TABLE IF NOT EXISTS hook_assignments (
|
|
15
|
+
target_id INTEGER NOT NULL REFERENCES hook_targets(id) ON DELETE CASCADE,
|
|
16
|
+
event_id TEXT NOT NULL REFERENCES hook_events(id), delivery_id TEXT,
|
|
17
|
+
PRIMARY KEY(target_id, event_id));
|
|
18
|
+
CREATE TABLE IF NOT EXISTS hook_deliveries (
|
|
19
|
+
id TEXT PRIMARY KEY, target_id INTEGER NOT NULL REFERENCES hook_targets(id) ON DELETE CASCADE,
|
|
20
|
+
events TEXT NOT NULL, status TEXT NOT NULL, attempts INTEGER NOT NULL DEFAULT 0,
|
|
21
|
+
last_attempt_at INTEGER, http_status INTEGER, error_class TEXT,
|
|
22
|
+
next_attempt_at INTEGER NOT NULL);
|
|
23
|
+
CREATE INDEX IF NOT EXISTS idx_hook_deliveries_target ON hook_deliveries(target_id, status, next_attempt_at);
|
|
24
|
+
CREATE TABLE IF NOT EXISTS hook_settings (id INTEGER PRIMARY KEY CHECK(id = 1), label TEXT NOT NULL);
|
|
25
|
+
`);
|
|
26
|
+
if (!db.prepare("PRAGMA table_info(hook_targets)").all().some((row) => row.name === "headers"))
|
|
27
|
+
db.exec("ALTER TABLE hook_targets ADD COLUMN headers TEXT NOT NULL DEFAULT '{}'");
|
|
28
|
+
}
|
|
29
|
+
|
|
5
30
|
// src/questlines/init_questline_tables.ts
|
|
6
31
|
function initQuestlineTables(db) {
|
|
7
32
|
db.exec(`
|
|
@@ -350,6 +375,7 @@ function initQuestlogTables(db) {
|
|
|
350
375
|
initTagTables(db);
|
|
351
376
|
initQuestSearch(db);
|
|
352
377
|
initRumorSearch(db);
|
|
378
|
+
initHookTables(db);
|
|
353
379
|
}
|
|
354
380
|
|
|
355
381
|
// src/surface/open_questlog_db.ts
|
|
@@ -368,7 +394,14 @@ async function openQuestlogDb(path) {
|
|
|
368
394
|
} finally {
|
|
369
395
|
process.emitWarning = original;
|
|
370
396
|
}
|
|
371
|
-
if (path !== ":memory:")
|
|
397
|
+
if (path !== ":memory:") {
|
|
398
|
+
mkdirSync(dirname(path), { recursive: true, mode: 448 });
|
|
399
|
+
try {
|
|
400
|
+
closeSync(openSync(path, "wx", 384));
|
|
401
|
+
} catch (error) {
|
|
402
|
+
if (error.code !== "EEXIST") throw error;
|
|
403
|
+
}
|
|
404
|
+
}
|
|
372
405
|
const db = new sqlite.DatabaseSync(path);
|
|
373
406
|
try {
|
|
374
407
|
db.exec("PRAGMA journal_mode=WAL; PRAGMA busy_timeout=5000;");
|
|
@@ -6,12 +6,9 @@ function resolveQuestlogDbPath(options = {}) {
|
|
|
6
6
|
return options.flag ?? ((options.env ?? process.env).GHOSTPAW_QUESTLOG_DB || join(homedir(), ".ghostpaw", "questlog.db"));
|
|
7
7
|
}
|
|
8
8
|
|
|
9
|
-
// src/version.ts
|
|
10
|
-
var questlogVersion = "0.9.2";
|
|
11
|
-
|
|
12
9
|
// src/surfaces/surface_types.ts
|
|
13
10
|
function isErrorResult(result) {
|
|
14
11
|
return typeof result === "object" && result !== null && "ok" in result && result.ok === false;
|
|
15
12
|
}
|
|
16
13
|
|
|
17
|
-
export { isErrorResult,
|
|
14
|
+
export { isErrorResult, resolveQuestlogDbPath };
|