@justestif/pk 0.2.2 → 0.3.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.
Files changed (4) hide show
  1. package/README.md +29 -20
  2. package/dist/index.js +1811 -6843
  3. package/package.json +2 -2
  4. package/skill/SKILL.md +67 -32
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@justestif/pk",
3
3
  "type": "module",
4
- "version": "0.2.2",
4
+ "version": "0.3.0",
5
5
  "description": "Project knowledge — structured intake, search, and recall",
6
6
  "bin": {
7
7
  "pk": "dist/index.js"
@@ -33,7 +33,7 @@
33
33
  },
34
34
  "devDependencies": {
35
35
  "@types/bun": "latest",
36
- "ajv": "6",
36
+ "fallow": "^2.67.0",
37
37
  "typescript": "latest",
38
38
  "xo": "^2.0.2"
39
39
  }
package/skill/SKILL.md CHANGED
@@ -7,48 +7,48 @@ description: "Load when maintaining project knowledge, capturing decisions or qu
7
7
 
8
8
  Structured project knowledge — intake, search, recall, and audit.
9
9
 
10
- **Search, synthesis, creation, and validation go through MCP tools. Writing note body content uses your standard file Edit tool but only on paths returned by `pk_new` or `pk_search`, never by navigating the filesystem yourself.**
10
+ Use the `pk` CLI for all knowledge operations. Every command supports `--json` for machine-readable output. Never read or write knowledge files directly always go through `pk`.
11
11
 
12
- ## Tools
12
+ ## Commands
13
13
 
14
- ### `pk_synthesize` — orient before any investigation
14
+ ### `pk synthesize` — orient before any investigation
15
15
 
16
- ```
17
- pk_synthesize({ sessionStart: true }) # open questions + accepted decisions + active notes
18
- pk_synthesize({ query: "auth flow" }) # ranked context for a topic
19
- pk_synthesize({ query: "auth", type: "decision", limit: 5 })
16
+ ```bash
17
+ pk synthesize --session-start # open questions + accepted decisions + active notes
18
+ pk synthesize "auth flow" # ranked context for a topic
19
+ pk synthesize "auth" --type decision --limit 5
20
20
  ```
21
21
 
22
- Returns formatted markdown with title, type, status, tags, and an excerpt per note. Use `sessionStart: true` at the start of every session.
22
+ Returns formatted markdown with title, type, status, tags, and an excerpt per note. Run `--session-start` at the start of every session.
23
23
 
24
- ### `pk_search` — locate notes by content
24
+ ### `pk search` — locate notes by content
25
25
 
26
- ```
27
- pk_search({ query: "database schema" })
28
- pk_search({ query: "api", type: "question", status: "open" })
29
- pk_search({ query: "deploy", tag: "infra", limit: 5 })
26
+ ```bash
27
+ pk search "database schema"
28
+ pk search "api" --type question --status open
29
+ pk search "deploy" --tag infra --limit 5
30
30
  ```
31
31
 
32
- Returns `[{ path, type, status, title, tags, snippet }]`. Always call before `pk_new` — duplicates erode trust faster than gaps do.
32
+ Returns path, type, status, title, tags, and snippet per match. Always search before creating — duplicates erode trust faster than gaps do.
33
33
 
34
- ### `pk_read` — full note body
34
+ ### `pk read` — full note body
35
35
 
36
- ```
37
- pk_read({ path: "/abs/path/returned/by/pk_search" })
36
+ ```bash
37
+ pk read /abs/path/from/search
38
38
  ```
39
39
 
40
- Returns complete file contents including frontmatter. Use paths from `pk_search` or `pk_synthesize` output.
40
+ Returns complete file contents including frontmatter. Use paths from `pk search` or `pk synthesize` output.
41
41
 
42
- ### `pk_new` — create a typed note skeleton
42
+ ### `pk new` — create a typed note skeleton
43
43
 
44
- ```
45
- pk_new({ type: "note", title: "Auth token expiry behaviour", tags: "auth,security" })
46
- pk_new({ type: "decision", title: "Use JWT over sessions" })
47
- pk_new({ type: "question", title: "Should we rate-limit the search endpoint?" })
48
- pk_new({ type: "source", title: "Meeting notes 2024-06-01" })
44
+ ```bash
45
+ pk new note "Auth token expiry behaviour" --tags auth,security
46
+ pk new decision "Use JWT over sessions"
47
+ pk new question "Should we rate-limit the search endpoint?"
48
+ pk new source "Meeting notes 2024-06-01"
49
49
  ```
50
50
 
51
- Returns the absolute path. Frontmatter (id, dates, status, tags as YAML array) is generated automatically from your inputs you don't edit frontmatter after creation. After receiving the path: call `pk_read` to see the skeleton, then use your standard file Edit tool to fill in the required sections.
51
+ Prints the absolute path. Frontmatter (id, dates, status, tags) is generated automatically — don't edit frontmatter after creation. After receiving the path: `pk read` to see the skeleton, then edit the file to fill in the required sections.
52
52
 
53
53
  **Required sections by type:**
54
54
  - `note` → `## Summary`, `## Details`, `## Evidence`, `## Related`
@@ -58,23 +58,58 @@ Returns the absolute path. Frontmatter (id, dates, status, tags as YAML array) i
58
58
 
59
59
  **`source` vs `note`:** `source` = raw/provenance-heavy input (meeting notes, transcripts, external docs, unprocessed data). `note` = stable synthesised fact or constraint you've derived. When synthesising across multiple sources into one insight: create a `note` and put source paths in `## Evidence`.
60
60
 
61
- ### `pk_lint` — validate before committing
61
+ ### `pk lint` — validate before committing
62
+
63
+ ```bash
64
+ pk lint # all notes
65
+ pk lint path1 path2 # specific notes
66
+ ```
67
+
68
+ **Errors block commits** (missing frontmatter, duplicate id, wrong folder, missing required sections). **Warnings are advisory** (empty tags, note too long) — fix when practical.
69
+
70
+ ### `pk history` — view knowledge operations
71
+
72
+ ```bash
73
+ pk history # last 20 operations
74
+ pk history --limit 50 --type commits # only CUD operations
75
+ pk history --filter-type decision # only decisions
76
+ pk history --filter-tag important # only tagged 'important'
77
+ pk history --filter-operation update # only updates
78
+ ```
79
+
80
+ ### `pk delete` — delete a note
62
81
 
82
+ ```bash
83
+ pk delete /abs/path/to/note.md --yes
63
84
  ```
64
- pk_lint({})
85
+
86
+ Deletes and commits. `--yes` skips confirmation (required in non-interactive mode).
87
+
88
+ ### `pk vocab` — list tags by frequency
89
+
90
+ ```bash
91
+ pk vocab
92
+ ```
93
+
94
+ Useful for orienting before searching.
95
+
96
+ ### `pk edit` — edit a note in $EDITOR
97
+
98
+ ```bash
99
+ pk edit /abs/path/to/note.md
65
100
  ```
66
101
 
67
- **Errors block commits** (missing frontmatter, duplicate id, wrong folder, missing required sections, broken links). **Warnings are advisory** (empty tags, note too long, source marked processed with no extracted items) — fix when practical, not required to commit.
102
+ Opens the note in `$EDITOR`, validates after save, commits changes. For agents: use `pk read` + file edit + `pk lint` instead.
68
103
 
69
104
  ### Status transitions
70
105
 
71
- No MCP tool for status changes. Use your file Edit tool directly on the frontmatter, fill in the resolution section, then lint.
106
+ No command for status changes. Edit the frontmatter `status` field directly, then `pk lint` to validate.
72
107
 
73
- **MANDATORY READ `references/knowledge-model.md`** when: creating a note type you haven't used before, unsure which folder a type belongs in, validating frontmatter fields, or unsure which status values are valid for a given type. (Read with your standard file Read tool — these are local skill files, not MCP-accessible.)
108
+ **MANDATORY READ `references/knowledge-model.md`** when: creating a note type you haven't used before, unsure which folder a type belongs in, validating frontmatter fields, or unsure which status values are valid for a given type.
74
109
 
75
110
  ## NEVER
76
111
 
77
- - **NEVER skip `pk_search` before `pk_new`**
112
+ - **NEVER skip `pk search` before `pk new`**
78
113
  **Why:** Duplicates silently fragment knowledge — two notes on the same topic never get reconciled, and future searches return noise.
79
114
  **Instead:** Search first; update the existing note if found, or create and link if genuinely different.
80
115
 
@@ -86,6 +121,6 @@ No MCP tool for status changes. Use your file Edit tool directly on the frontmat
86
121
  **Why:** Silent overwrites destroy the rationale trail — you lose why the old claim existed.
87
122
  **Instead:** Create a new note explaining the conflict, link both, and use `status: superseded` on the old one.
88
123
 
89
- - **NEVER commit when `pk_lint` returns errors or unrelated files are staged**
124
+ - **NEVER commit when `pk lint` returns errors or unrelated files are staged**
90
125
  **Why:** Lint errors mean required structure is broken; mixed commits make knowledge changes unauditable.
91
126
  **Instead:** Fix errors, unstage unrelated files, then commit.