@ghostpaw/questlog 0.7.0 → 0.9.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.
@@ -0,0 +1,58 @@
1
+ #!/usr/bin/env node
2
+ import { homedir } from 'node:os';
3
+ import { join } from 'node:path';
4
+
5
+ function resolveQuestlogDbPath(options = {}) {
6
+ return options.flag ?? ((options.env ?? process.env).GHOSTPAW_QUESTLOG_DB || join(homedir(), ".ghostpaw", "questlog.db"));
7
+ }
8
+
9
+ // src/version.ts
10
+ var questlogVersion = "0.9.0";
11
+
12
+ // src/surfaces/surface_types.ts
13
+ function isErrorResult(result) {
14
+ return typeof result === "object" && result !== null && "ok" in result && result.ok === false;
15
+ }
16
+
17
+ // src/surfaces/validate_input.ts
18
+ function validateInput(schema, input, path = "$") {
19
+ const errors = [];
20
+ const matchesType = (type) => {
21
+ switch (type) {
22
+ case "object":
23
+ return typeof input === "object" && input !== null && !Array.isArray(input);
24
+ case "array":
25
+ return Array.isArray(input);
26
+ case "integer":
27
+ return typeof input === "number" && Number.isInteger(input);
28
+ case "number":
29
+ return typeof input === "number" && Number.isFinite(input);
30
+ case "null":
31
+ return input === null;
32
+ default:
33
+ return typeof input === type;
34
+ }
35
+ };
36
+ if (schema.type && !(Array.isArray(schema.type) ? schema.type : [schema.type]).some(matchesType)) {
37
+ return [`${path}: expected ${String(schema.type)}`];
38
+ }
39
+ if (schema.enum && !schema.enum.some((value) => JSON.stringify(value) === JSON.stringify(input)))
40
+ errors.push(`${path}: expected one of ${JSON.stringify(schema.enum)}`);
41
+ if (schema.oneOf && !schema.oneOf.some((branch) => validateInput(branch, input, path).length === 0))
42
+ errors.push(`${path}: must match at least one schema branch`);
43
+ if (typeof input === "object" && input !== null && !Array.isArray(input)) {
44
+ const record = input;
45
+ for (const name of schema.required ?? [])
46
+ if (!Object.hasOwn(record, name)) errors.push(`${path}.${name}: required`);
47
+ for (const [name, property] of Object.entries(schema.properties ?? {}))
48
+ if (Object.hasOwn(record, name))
49
+ errors.push(...validateInput(property, record[name], `${path}.${name}`));
50
+ }
51
+ if (Array.isArray(input) && schema.items)
52
+ input.forEach((value, index) => {
53
+ errors.push(...validateInput(schema.items, value, `${path}[${index}]`));
54
+ });
55
+ return errors;
56
+ }
57
+
58
+ export { isErrorResult, questlogVersion, resolveQuestlogDbPath, validateInput };
@@ -0,0 +1,5 @@
1
+ #!/usr/bin/env node
2
+ // src/surface/questlog_mcp_instructions.ts
3
+ var questlogMcpInstructions = "Questlog manages local tasks, calendar commitments, and recurring work. Search before creating work, inspect before changing it, and keep uncertain work as rumors. Use unlock prerequisites to sequence work. run_quest refuses blocked starts unless force is true. Review commitments and resolve work with an honest outcome.";
4
+
5
+ export { questlogMcpInstructions };