@ghostpaw/questlog 0.1.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/LICENSE +21 -0
- package/README.md +241 -0
- package/dist/index.cjs +5920 -0
- package/dist/index.d.cts +1688 -0
- package/dist/index.d.ts +1688 -0
- package/dist/index.js +5912 -0
- package/package.json +90 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 GhostPaw
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,241 @@
|
|
|
1
|
+
# @ghostpaw/questlog
|
|
2
|
+
|
|
3
|
+
A unified task and calendar model for Node.js, built on SQLite.
|
|
4
|
+
|
|
5
|
+
Questlog treats tasks, events, deadlines, recurring commitments, and loose intake as one coherent data model instead of separate systems. It ships as a single prebundled blob with zero runtime dependencies, designed for two audiences at once: human developers working directly in code, and LLM agents operating through a structured tool facade.
|
|
6
|
+
|
|
7
|
+
## Install
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
npm install @ghostpaw/questlog
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
Requires **Node.js 24+** (uses the built-in `node:sqlite` module).
|
|
14
|
+
|
|
15
|
+
## Quick Start
|
|
16
|
+
|
|
17
|
+
```ts
|
|
18
|
+
import { DatabaseSync } from 'node:sqlite';
|
|
19
|
+
import { initQuestlogTables, read, write } from '@ghostpaw/questlog';
|
|
20
|
+
|
|
21
|
+
const db = new DatabaseSync(':memory:');
|
|
22
|
+
initQuestlogTables(db);
|
|
23
|
+
|
|
24
|
+
// Capture incoming work as a rumor before committing to shape
|
|
25
|
+
const rumor = write.captureRumor(db, {
|
|
26
|
+
title: 'Legal says the vendor terms changed',
|
|
27
|
+
details: 'Need to understand pricing delta and termination clause.',
|
|
28
|
+
});
|
|
29
|
+
|
|
30
|
+
// Settle the rumor into real work once the shape is clear
|
|
31
|
+
write.settleRumor(db, rumor.id, {
|
|
32
|
+
settledAt: Date.now(),
|
|
33
|
+
questline: {
|
|
34
|
+
title: 'Vendor Renewal',
|
|
35
|
+
description: 'Commercial, legal, and approval work.',
|
|
36
|
+
},
|
|
37
|
+
quests: [
|
|
38
|
+
{ title: 'Collect redlines', objective: 'Obtain the latest legal markup.' },
|
|
39
|
+
{ title: 'Review pricing delta', objective: 'Compare current vs. proposed cost.' },
|
|
40
|
+
],
|
|
41
|
+
});
|
|
42
|
+
|
|
43
|
+
// Drive the day from derived views, not from memory
|
|
44
|
+
const available = read.listAvailableQuests(db);
|
|
45
|
+
const dueSoon = read.listDueSoonQuests(db, 7 * 24 * 60 * 60 * 1000);
|
|
46
|
+
const results = read.searchQuestlog(db, 'vendor');
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
## The Model
|
|
50
|
+
|
|
51
|
+
Seven concepts, strict separation of concerns:
|
|
52
|
+
|
|
53
|
+
| Concept | Purpose |
|
|
54
|
+
|---|---|
|
|
55
|
+
| **Rumor** | Incoming signal that may or may not become real work |
|
|
56
|
+
| **Questline** | Shared context and rollup for a group of related quests |
|
|
57
|
+
| **Quest** | One concrete commitment with lifecycle, timing, and outcome |
|
|
58
|
+
| **Repeatable Quest** | Recurring template that spawns fresh quests on a schedule |
|
|
59
|
+
| **Unlock** | Hard prerequisite: quest B stays blocked until quest A succeeds |
|
|
60
|
+
| **Reward** | Descriptive outcome attached to completed work, with a claim lifecycle |
|
|
61
|
+
| **Tag** | Cross-cutting label for filtering and reporting |
|
|
62
|
+
|
|
63
|
+
The unified model means one entity type covers every temporal intention:
|
|
64
|
+
|
|
65
|
+
| What it looks like | What it actually is |
|
|
66
|
+
|---|---|
|
|
67
|
+
| A todo item | A quest with no temporal metadata |
|
|
68
|
+
| A deadline | A quest with `dueAt` |
|
|
69
|
+
| A calendar event | A quest with `scheduledStartAt` and `scheduledEndAt` |
|
|
70
|
+
| A recurring commitment | A repeatable quest with an RRULE |
|
|
71
|
+
| A completed action | A quest resolved via `finishQuest` |
|
|
72
|
+
|
|
73
|
+
State is derived, not toggled. A quest's availability comes from its lifecycle, timing fields, and unlock graph — computed at read time, never stored as a status flag.
|
|
74
|
+
|
|
75
|
+
### Lifecycle at a glance
|
|
76
|
+
|
|
77
|
+
Questlog computes WoW-style markers on every read. They change as work moves through its lifecycle:
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
> **Intake**
|
|
82
|
+
>
|
|
83
|
+
> | | | |
|
|
84
|
+
> |:---:|---|---|
|
|
85
|
+
> | $\color{Goldenrod}{\textsf{❗}}$ | *Legal says the vendor terms changed* | `rumor · open` |
|
|
86
|
+
> | | ↓   settle into questline + quests | |
|
|
87
|
+
>
|
|
88
|
+
> **Quest progression**
|
|
89
|
+
>
|
|
90
|
+
> | | | |
|
|
91
|
+
> |:---:|---|---|
|
|
92
|
+
> | $\color{Goldenrod}{\textsf{❗}}$ | *Review pricing delta* | `open · available` |
|
|
93
|
+
> | $\color{Gray}{\textsf{❓}}$ | *Review pricing delta* | `in progress` |
|
|
94
|
+
> | $\color{Goldenrod}{\textsf{❓}}$ | *Review pricing delta* | `done · reward unclaimed` |
|
|
95
|
+
> |   ✓   | *Review pricing delta* | `done · reward claimed` |
|
|
96
|
+
>
|
|
97
|
+
> **Other markers**
|
|
98
|
+
>
|
|
99
|
+
> | | | |
|
|
100
|
+
> |:---:|---|---|
|
|
101
|
+
> | $\color{CornflowerBlue}{\textsf{❗}}$ | *Weekly standup notes* | `repeatable · due` |
|
|
102
|
+
> | $\color{Gray}{\textsf{❗}}$ | *Plan Q3 roadmap* | `open · deferred` |
|
|
103
|
+
> | $\color{Gray}{\textsf{❓}}$ | *Obtain finance approval* | `open · blocked` |
|
|
104
|
+
|
|
105
|
+
|
|
106
|
+
|
|
107
|
+
Marker IDs are semantic strings (`attention.available`, `progress.complete`, ...) computed at read time, never stored. The `markers` namespace maps each to its symbol, color, label, and CSS class for consistent rendering across HTML, TTY, and plain text.
|
|
108
|
+
|
|
109
|
+
## Two Audiences
|
|
110
|
+
|
|
111
|
+
### Human developers
|
|
112
|
+
|
|
113
|
+
Use the `read` and `write` namespaces for direct-code access to every domain operation:
|
|
114
|
+
|
|
115
|
+
```ts
|
|
116
|
+
import { read, write } from '@ghostpaw/questlog';
|
|
117
|
+
|
|
118
|
+
write.createQuest(db, { title: 'Ship release notes', objective: 'Draft and publish.' });
|
|
119
|
+
write.startQuest(db, questId);
|
|
120
|
+
write.finishQuest(db, questId, 'Published to blog and changelog.');
|
|
121
|
+
|
|
122
|
+
const blocked = read.listBlockedQuests(db);
|
|
123
|
+
const overdue = read.listOverdueQuests(db);
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
See [HUMAN.md](docs/HUMAN.md) for the full human-facing guide with worked examples.
|
|
127
|
+
|
|
128
|
+
### LLM agents
|
|
129
|
+
|
|
130
|
+
Use the `tools`, `skills`, and `soul` namespaces for a structured runtime surface designed to minimize LLM cognitive load:
|
|
131
|
+
|
|
132
|
+
```ts
|
|
133
|
+
import { tools, skills, soul } from '@ghostpaw/questlog';
|
|
134
|
+
|
|
135
|
+
// 12 intent-shaped tools with JSON Schema inputs and structured results
|
|
136
|
+
const allTools = tools.questlogTools;
|
|
137
|
+
const searchTool = tools.getQuestlogToolByName('search_questlog')!;
|
|
138
|
+
const result = searchTool.handler(db, { query: 'vendor', mode: 'browse' });
|
|
139
|
+
|
|
140
|
+
// 25 reusable workflow skills for common multi-step scenarios
|
|
141
|
+
const allSkills = skills.questlogSkills;
|
|
142
|
+
|
|
143
|
+
// Thinking foundation for system prompts
|
|
144
|
+
const prompt = soul.renderQuestlogSoulPromptFoundation();
|
|
145
|
+
```
|
|
146
|
+
|
|
147
|
+
Every tool returns a discriminated result with `outcome: 'success' | 'no_op' | 'needs_clarification' | 'error'`, structured entities, next-step hints, and actionable recovery advice. No thrown exceptions to parse, no ambiguous prose.
|
|
148
|
+
|
|
149
|
+
See [LLM.md](docs/LLM.md) for the full AI-facing guide covering soul, tools, and skills.
|
|
150
|
+
|
|
151
|
+
## Tools
|
|
152
|
+
|
|
153
|
+
Twelve tools shaped around operator intent, not raw storage operations:
|
|
154
|
+
|
|
155
|
+
| Tool | What it does |
|
|
156
|
+
|---|---|
|
|
157
|
+
| `search_questlog` | Cross-entity full-text search |
|
|
158
|
+
| `review_questlog` | Filtered list views (available, overdue, due soon, ...) |
|
|
159
|
+
| `inspect_questlog_item` | Detailed inspection of any single entity |
|
|
160
|
+
| `capture_rumor` | Record incoming work before committing to shape |
|
|
161
|
+
| `shape_work` | Create quests, questlines, settle rumors into structure |
|
|
162
|
+
| `plan_quest` | Set timing: due dates, defer dates, scheduled windows |
|
|
163
|
+
| `run_quest` | Start, finish, abandon, log effort |
|
|
164
|
+
| `organize_work` | Move quests between questlines, manage questline lifecycle |
|
|
165
|
+
| `manage_repeatable` | Create and maintain recurring quest templates |
|
|
166
|
+
| `tag_work` | Classify quests and repeatables with tags |
|
|
167
|
+
| `reward_work` | Attach, update, claim, or remove rewards |
|
|
168
|
+
| `retire_work` | Soft-delete or archive things that should leave the active surface |
|
|
169
|
+
|
|
170
|
+
Each tool exports runtime metadata — name, description, JSON Schema, input descriptions, side-effect level — so agent harnesses can wire them without reading docs.
|
|
171
|
+
|
|
172
|
+
## Key Properties
|
|
173
|
+
|
|
174
|
+
- **Zero runtime dependencies.** Only `node:sqlite` (built into Node 24+).
|
|
175
|
+
- **Single prebundled blob.** One ESM + one CJS entry in `dist/`. No subpath exports, no code splitting.
|
|
176
|
+
- **Pure SQLite storage.** FTS5 full-text search, CHECK-constrained state transitions, trigger-maintained indexes. Bring your own `DatabaseSync` instance.
|
|
177
|
+
- **Derived state.** Availability, blocking, deferral, overdue, and markers are computed at read time from fields and relationships, never stored as flags.
|
|
178
|
+
- **Intention-shaped writes.** `captureRumor`, `settleRumor`, `startQuest`, `finishQuest`, `abandonQuest` — operations that say what happened, not generic CRUD.
|
|
179
|
+
- **RFC 5545 recurrence.** Standard RRULE strings for recurring work. No custom recurrence format.
|
|
180
|
+
- **WoW-style markers.** Semantic marker IDs (`attention.available`, `progress.complete`, ...) computed on every read, renderable to any channel.
|
|
181
|
+
- **Colocated tests.** Every non-type module has a colocated `.test.ts` file. The behavior described in docs is backed by executable coverage.
|
|
182
|
+
|
|
183
|
+
## Package Surface
|
|
184
|
+
|
|
185
|
+
```ts
|
|
186
|
+
import {
|
|
187
|
+
initQuestlogTables, // schema setup
|
|
188
|
+
read, // all query functions
|
|
189
|
+
write, // all mutation functions
|
|
190
|
+
tools, // LLM tool definitions + registry
|
|
191
|
+
skills, // LLM workflow skills + registry
|
|
192
|
+
soul, // thinking foundation for system prompts
|
|
193
|
+
markers, // marker derivation and lookup
|
|
194
|
+
} from '@ghostpaw/questlog';
|
|
195
|
+
```
|
|
196
|
+
|
|
197
|
+
All domain types are also available at the root for TypeScript consumers:
|
|
198
|
+
|
|
199
|
+
```ts
|
|
200
|
+
import type {
|
|
201
|
+
QuestlogDb,
|
|
202
|
+
QuestState,
|
|
203
|
+
QuestDetailRecord,
|
|
204
|
+
CreateQuestInput,
|
|
205
|
+
QuestlogSearchResult,
|
|
206
|
+
QuestlogToolDefinition,
|
|
207
|
+
QuestlogSkill,
|
|
208
|
+
QuestlogSoul,
|
|
209
|
+
} from '@ghostpaw/questlog';
|
|
210
|
+
```
|
|
211
|
+
|
|
212
|
+
## Documentation
|
|
213
|
+
|
|
214
|
+
| Document | Audience |
|
|
215
|
+
|---|---|
|
|
216
|
+
| [HUMAN.md](docs/HUMAN.md) | Human developers using the low-level `read`/`write` API |
|
|
217
|
+
| [LLM.md](docs/LLM.md) | Agent builders wiring tools, skills, and soul into LLM systems |
|
|
218
|
+
| [docs/README.md](docs/README.md) | Architecture overview: model, invariants, lifecycle, markers |
|
|
219
|
+
| [docs/entities/](docs/entities/) | Per-entity manuals with exact public API listings |
|
|
220
|
+
|
|
221
|
+
## Development
|
|
222
|
+
|
|
223
|
+
```bash
|
|
224
|
+
npm install
|
|
225
|
+
npm test # node:test runner
|
|
226
|
+
npm run typecheck # tsc --noEmit
|
|
227
|
+
npm run lint # biome check
|
|
228
|
+
npm run build # ESM + CJS + declarations via tsup
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
The repo is pinned to **Node 24.14.0** via `.nvmrc` / `.node-version` / `.tool-versions` / `mise.toml` / Volta. Use whichever version manager you prefer.
|
|
232
|
+
|
|
233
|
+
### Support
|
|
234
|
+
|
|
235
|
+
If this package helps your project, consider sponsoring its maintenance:
|
|
236
|
+
|
|
237
|
+
[](https://github.com/sponsors/Anonyfox)
|
|
238
|
+
|
|
239
|
+
---
|
|
240
|
+
|
|
241
|
+
**[Anonyfox](https://anonyfox.com) • [MIT License](LICENSE)**
|