@bpmnkit/docspack 0.0.4 → 0.0.6

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 (29) hide show
  1. package/.llms/chunks/guides.ai.minimal-empty-diagram.md +1 -0
  2. package/.llms/chunks/guides.using-bpmnkit-with-ai.asking.md +47 -0
  3. package/.llms/chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli-the-other-route-docspack-index.md +56 -0
  4. package/.llms/chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli.md +86 -0
  5. package/.llms/chunks/guides.using-bpmnkit-with-ai.md +17 -0
  6. package/.llms/chunks/guides.using-bpmnkit-with-ai.runnable-examples.md +31 -0
  7. package/.llms/chunks/guides.using-bpmnkit-with-ai.telling-an-agent-they-exist.md +23 -0
  8. package/.llms/chunks/guides.using-bpmnkit-with-ai.the-two-packs-bpmn-kit-ships.md +20 -0
  9. package/.llms/chunks/guides.using-bpmnkit-with-ai.the-whole-loop-five-markdown-files-to-a-bpmn-diagram.md +64 -0
  10. package/.llms/chunks/guides.using-bpmnkit-with-ai.where-to-go-next.md +13 -0
  11. package/.llms/chunks/packages.camunda-docspack.a-note-on-the-pack-s-name.md +15 -0
  12. package/.llms/chunks/packages.camunda-docspack.installation.md +41 -0
  13. package/.llms/chunks/packages.camunda-docspack.overview.md +28 -0
  14. package/.llms/chunks/packages.camunda-docspack.rebuilding-it.md +27 -0
  15. package/.llms/chunks/packages.camunda-docspack.what-makes-this-corpus-different.md +16 -0
  16. package/.llms/chunks/packages.core.installation-compactify-definitions.md +8 -0
  17. package/.llms/chunks/{packages.docspack.installation.md → packages.docspack.giving-an-agent-access.md} +5 -10
  18. package/.llms/chunks/packages.docspack.reading-it-yourself.md +6 -0
  19. package/.llms/chunks/packages.docspack.the-other-pack.md +24 -0
  20. package/.llms/manifest.json +253 -9
  21. package/README.md +11 -3
  22. package/dist/chunk.js +14 -4
  23. package/dist/cli.js +11 -1
  24. package/dist/load.d.ts +10 -2
  25. package/dist/load.js +15 -3
  26. package/dist/search.d.ts +5 -1
  27. package/dist/search.js +12 -1
  28. package/llms.txt +20 -5
  29. package/package.json +1 -1
@@ -24,6 +24,7 @@ Rules:
24
24
  - Use camelCase IDs
25
25
  - Every service task needs a taskType string (the Zeebe worker subscription)
26
26
  - Use FEEL expressions for gateway conditions (start with "= ")
27
+ - Every exclusive gateway needs one branch with no condition and `isDefault: true`
27
28
  - Always include a start event and at least one end event
28
29
  - Do not add fields that are not part of the CompactDiagram schema
29
30
  ```
@@ -0,0 +1,47 @@
1
+ # Using BPMN Kit with AI — Asking
2
+
3
+ ```sh
4
+ npx bpmnkit-docs ask "what does compactify drop from a diagram"
5
+ ```
6
+
7
+ ```
8
+ ## @bpmnkit/docspack@0.0.5/packages.core.installation-compactify-definitions
9
+
10
+ Projects a `BpmnDefinitions` object onto a `CompactDiagram` — a small JSON
11
+ object suitable for LLM prompts. **Lossy:** it keeps topology, names …
12
+
13
+ ---
14
+ cost: 204 tokens, capped at 3,000
15
+ ```
16
+
17
+ Every answer names the pack, the version and the chunk, and closes with what it
18
+ cost — so an agent can quote the chunk id back when a passage turns out to be
19
+ wrong.
20
+
21
+ Ask the engine's documentation with `--pack`:
22
+
23
+ ```sh
24
+ npx bpmnkit-docs ask "what happens when no exclusive gateway condition is true" \
25
+ --pack @bpmnkit/camunda-docspack
26
+ ```
27
+
28
+ `--pack` is worth using even when you are not disambiguating. Building the index
29
+ reads every chunk off disk, so narrowing to one pack is the difference between
30
+ roughly 150ms and 650ms per question. A name that is not installed is an error
31
+ listing what is, never an empty answer — an empty answer would read as "the
32
+ documentation does not cover this", which is a different claim.
33
+
34
+ `search` ranks without printing the content, and `list` shows what was found:
35
+
36
+ ```sh
37
+ npx bpmnkit-docs search "exclusive gateway condition"
38
+ npx bpmnkit-docs list
39
+ ```
40
+
41
+ ```
42
+ @bpmnkit/camunda-docspack@0.1.1 1054 chunks
43
+ @bpmnkit/docspack@0.0.5 206 chunks
44
+ ```
45
+
46
+ ---
47
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,56 @@
1
+ # Using BPMN Kit with AI — From the library instead of the CLI — The other route: `docspack index`
2
+
3
+ Upstream [docspack](https://docspack.dev) 1.1.0 added
4
+ [a second way to do this](https://docspack.dev/docs/your-own-corpus/). Rather than
5
+ building a pack, it keeps an SQLite index of loose sources, and answers from it
6
+ with `recall` instead of `ask`:
7
+
8
+ ```sh
9
+ npm i -D docspack
10
+
11
+ npx docspack index --from ./flow-docs
12
+ npx docspack recall "when does an order need manager approval"
13
+ ```
14
+
15
+ ```
16
+ indexing @local/flow-docs
17
+ + @local/flow-docs 10 chunks ~527 tokens
18
+ ```
19
+
20
+ Pick it over `bpmnkit-docs build` when the corpus is not a folder of Markdown.
21
+ Anything that emits JSON can be indexed without a database driver:
22
+
23
+ ```sh
24
+ sqlite3 -json shop.db 'select id, title, body as text from orders' | npx docspack index --from-json -
25
+ ```
26
+
27
+ It also tracks each source's size, mtime and hash, so a re-run does nothing when
28
+ nothing changed, and `recall` leads with a warning rather than quoting a passage
29
+ that has since been edited:
30
+
31
+ ```
32
+ NOTE: the corpus is out of date. 1 indexed source has changed since it was
33
+ built: flow-docs/04-shipping.md. The passages below may be superseded — run
34
+ `docspack index` again before relying on them.
35
+ ```
36
+
37
+ `recall` is deliberately not `ask`: your notes are never an installed version, so
38
+ a corpus cannot reach an answer about a dependency and a dependency cannot reach
39
+ an answer about your notes. The index lands in `.docspack/local.db` as plaintext
40
+ and the tool writes a `.gitignore` beside it.
41
+
42
+ The two routes do not merge. `bpmnkit-docs` searches your corpus and the
43
+ installed packs together because a pack directory is just a directory; upstream
44
+ keeps them in separate query paths on purpose. Build a pack when you want one
45
+ answer drawn from both; use `docspack index` when the corpus is a database, or
46
+ when you want the staleness check.
47
+
48
+ > **Use `docspack@1.2.0` or newer for the Camunda pack.** Earlier versions named
49
+ > one pack per npm scope, so `docspack sync` read `@bpmnkit/camunda-docspack` as
50
+ > an ordinary dependency and indexed its type declarations — `0 chunks
51
+ > (declarations)` — leaving a Camunda question to be answered out of the wrong
52
+ > pack. 1.2.0 discovers `@<vendor>/<name>-docspack` and indexes all 1,054 chunks.
53
+ > `bpmnkit-docs` has read the suffix from the start and needs no version floor.
54
+
55
+ ---
56
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,86 @@
1
+ # Using BPMN Kit with AI — From the library instead of the CLI
2
+
3
+ A long-lived agent, an editor extension or an MCP server should index once and
4
+ ask many times, rather than paying for the index on every question:
5
+
6
+ ```typescript
7
+ import { answer, discoverPacks, indexPacks } from "@bpmnkit/docspack";
8
+
9
+ const index = indexPacks(discoverPacks());
10
+
11
+ const { hits, tokens } = answer(index, "verify a worker's job type", {
12
+ packs: ["@bpmnkit/docspack"],
13
+ limit: 3,
14
+ maxTokens: 3000,
15
+ });
16
+
17
+ for (const hit of hits) console.log(hit.chunkId, hit.content);
18
+ console.log(`${tokens} tokens`);
19
+ ```
20
+
21
+
22
+ ## Indexing your own corpus
23
+
24
+ The packs above answer for BPMN Kit and for Camunda. Nothing answers for *your*
25
+ process — the five Markdown files somebody wrote describing how orders are
26
+ fulfilled. Handed the folder, an agent reads the wrong file or spends its whole
27
+ context on all of them; a corpus larger than the context window cannot be read
28
+ into it at all.
29
+
30
+ Index it, and it becomes something the agent asks questions of. The same builder
31
+ behind `bpmnkit-docs build` takes any folder of Markdown:
32
+
33
+ ```sh
34
+ mkdir -p flow-corpus
35
+ cat > flow-corpus/package.json <<'JSON'
36
+ {
37
+ "name": "order-fulfilment-corpus",
38
+ "version": "1.0.0",
39
+ "private": true,
40
+ "docspack": { "source": "../flow-docs", "minTokens": 60, "maxTokens": 800 }
41
+ }
42
+ JSON
43
+
44
+ npx bpmnkit-docs build --cwd flow-corpus
45
+ npx bpmnkit-docs ask "when does an order need manager approval" --cwd flow-corpus
46
+ ```
47
+
48
+ ```
49
+ Built 5 chunks from 5 documents (421 tokens).
50
+
51
+ ## order-fulfilment-corpus@1.0.0/02-approval.when-approval-is-needed
52
+
53
+ # Approval — When approval is needed
54
+
55
+ An order over 10000 EUR needs a regional manager to approve it before anything
56
+ is picked. At or under that figure the order goes straight to fulfilment.
57
+ ```
58
+
59
+ Indexing runs no model, so building the corpus costs no tokens — five documents
60
+ take about 9ms.
61
+
62
+ A few things decide whether the result is any good:
63
+
64
+ - **Split at headings that answer something.** A chunk is a `##` section.
65
+ `minTokens` merges a section too short to answer anything into the one before
66
+ it, so a two-line heading does not become a chunk of its own.
67
+ - **`--cwd` points at the pack, not at the sources.** A directory holding a
68
+ `package.json` and a `.llms/` payload *is* a pack, so `bpmnkit-docs` reads it
69
+ without it ever being published.
70
+ - **Your corpus and the installed packs are searched together.** Discovery walks
71
+ `node_modules` up from `--cwd`, so a corpus inside your project sees
72
+ `@bpmnkit/docspack` too, and `--pack` narrows to whichever you want.
73
+ - **Keep it out of git, and re-index after editing.** The chunks are a copy of
74
+ your files. Edit a source and the index is stale until you build again —
75
+ `bpmnkit-docs build` is cheap enough to run on every change.
76
+ - **Tags weigh 3× prose.** Front matter, the slug and the heading's own words
77
+ become tags automatically; steer them from the document itself when the words
78
+ a reader would search for are not the words on the page:
79
+
80
+ ```md
81
+ ## Escalation
82
+
83
+ ```
84
+
85
+ ---
86
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,17 @@
1
+ # Using BPMN Kit with AI
2
+
3
+ An agent asked to turn a folder of specs into a deployable process needs three
4
+ different kinds of knowledge, and only one of them is in its weights:
5
+
6
+ | It needs to know | Where that lives | How it asks |
7
+ | --- | --- | --- |
8
+ | How to drive this library | `@bpmnkit/docspack` | `bpmnkit-docs ask "…"` |
9
+ | How the engine behaves | `@bpmnkit/camunda-docspack` | `bpmnkit-docs ask "…" --pack @bpmnkit/camunda-docspack` |
10
+ | What the process actually does | your own Markdown | index it yourself, below |
11
+
12
+ All three are offline retrieval. Nothing here calls a model, starts a server or
13
+ touches the network, so a question costs milliseconds and no tokens. The model
14
+ is only spent on the last step — turning what it found into a diagram.
15
+
16
+ ---
17
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,31 @@
1
+ # Using BPMN Kit with AI — Runnable examples
2
+
3
+ Three scripts in [`apps/examples/src/ai`](https://github.com/bpmnkit/monorepo/tree/main/apps/examples/src/ai)
4
+ do exactly the above. They need no API key and no network — the whole set runs
5
+ in about three seconds:
6
+
7
+ ```sh
8
+ pnpm --filter @bpmnkit/examples ai:ask # ask both packs, from the library
9
+ pnpm --filter @bpmnkit/examples ai:index # 5 Markdown files → an askable corpus
10
+ pnpm --filter @bpmnkit/examples ai:bpmn # corpus → CompactDiagram → .bpmn
11
+ ```
12
+
13
+ `ai:bpmn` writes `output/order-fulfilment.bpmn`: 18 elements, 20 sequence flows,
14
+ laid out, with the gateway defaults set.
15
+
16
+
17
+ ## Keeping it fast
18
+
19
+ | What | Cost | Why |
20
+ | --- | --- | --- |
21
+ | `ask` scoped with `--pack @bpmnkit/docspack` | ~150ms | indexes one pack |
22
+ | `ask` across both packs | ~650ms | indexes both, 1,200+ chunks |
23
+ | `indexPacks` once, then `answer` per question | ~0ms per question | the index is the expensive part |
24
+ | Building a 5-document corpus | ~9ms | no model, no network |
25
+
26
+ Reading chunks off disk dominates, and a fresh `npx bpmnkit-docs ask` pays it on
27
+ every question. Scope with `--pack` when you know which pack answers; use the
28
+ library and hold the index when you are asking more than a handful of questions.
29
+
30
+ ---
31
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,23 @@
1
+ # Using BPMN Kit with AI — Telling an agent they exist
2
+
3
+ An agent that does not know a pack is installed will answer from memory instead,
4
+ and its memory describes an older release. One paragraph in `AGENTS.md`,
5
+ `CLAUDE.md` or `.cursor/rules` is the whole setup — **name both packs**, because
6
+ an agent told only about the first will never think to ask the second:
7
+
8
+ ```md
9
+ Documentation is installed locally. Ask it before answering from memory.
10
+
11
+ - BPMN Kit's own APIs, CLI and guides:
12
+ `npx bpmnkit-docs ask "<question>"`
13
+ - Camunda 8 — BPMN semantics, FEEL, engine behaviour, the REST API:
14
+ `npx bpmnkit-docs ask "<question>" --pack @bpmnkit/camunda-docspack`
15
+
16
+ A returned chunk beats recalled knowledge: it describes the version this project
17
+ installed. If the two disagree, the chunk is right — do not blend them.
18
+ Answers cap at 3 chunks / 3,000 tokens, so ask several narrow questions rather
19
+ than one broad one.
20
+ ```
21
+
22
+ ---
23
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,20 @@
1
+ # Using BPMN Kit with AI — The two packs BPMN Kit ships
2
+
3
+ ```sh
4
+ npm i -D @bpmnkit/docspack @bpmnkit/camunda-docspack
5
+ ```
6
+
7
+ **[`@bpmnkit/docspack`](/docs/packages/docspack)** carries the documentation you
8
+ are reading — the builder API, the CLI, the guides — pinned to the version this
9
+ project installed.
10
+
11
+ **[`@bpmnkit/camunda-docspack`](/docs/packages/camunda-docspack)** carries the
12
+ Camunda 8 documentation: BPMN and FEEL references, engine concepts, the
13
+ best-practice pages with their diagrams rendered as text, and one digest per
14
+ Orchestration Cluster API operation. It is Camunda's work, redistributed under
15
+ CC BY-SA 3.0, not documentation BPMN Kit wrote.
16
+
17
+ One `bpmnkit-docs` command reads both.
18
+
19
+ ---
20
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,64 @@
1
+ # Using BPMN Kit with AI — The whole loop: five Markdown files to a BPMN diagram
2
+
3
+ Put the three together and the agent's job is narrow enough to be reliable:
4
+
5
+ 1. **Index the team's prose** and ask it what the flow actually does — where the
6
+ thresholds are, what runs in parallel, what happens on the unhappy path.
7
+ 2. **Ask `@bpmnkit/docspack`** how to express that with this library.
8
+ 3. **Ask `@bpmnkit/camunda-docspack`** whatever the engine, not the library,
9
+ decides — gateway semantics, FEEL syntax, job types.
10
+ 4. **Return a `CompactDiagram`**, not XML. About 40 lines of JSON for a diagram
11
+ that is 200 lines of BPMN, and a model that has never written valid BPMN XML
12
+ can still produce a valid diagram.
13
+ 5. **`expand` it**, which is deterministic — layout included.
14
+
15
+ ```typescript
16
+ import { Bpmn, expand } from "@bpmnkit/core";
17
+ import type { CompactDiagram } from "@bpmnkit/core";
18
+ import { answer, buildPack, indexPacks, loadPack } from "@bpmnkit/docspack";
19
+
20
+ // 1. The team's own files, indexed.
21
+ buildPack({
22
+ source: "flow-docs",
23
+ packDir: "flow-corpus",
24
+ name: "order-fulfilment-corpus",
25
+ version: "1.0.0",
26
+ documents: ["order-fulfilment-corpus"],
27
+ minTokens: 60,
28
+ });
29
+ const corpus = indexPacks([loadPack("flow-corpus")]);
30
+
31
+ const facts = ["when does an order need manager approval", "what runs in parallel"]
32
+ .flatMap((q) => answer(corpus, q, { limit: 1, maxTokens: 600 }).hits)
33
+ .map((hit) => hit.content);
34
+
35
+ // 2–4. The model reads `facts` and returns this. Nothing here is XML.
36
+ const compact: CompactDiagram = await writeDiagram(facts);
37
+
38
+ // 5. Deterministic from here on: topology, Zeebe bindings and layout.
39
+ const definitions = expand(compact);
40
+ const xml = Bpmn.export(definitions);
41
+ ```
42
+
43
+ **Mark every gateway's fallthrough branch.** An exclusive gateway whose
44
+ conditions are all false and which has no default deadlocks at runtime, so the
45
+ branch without a condition carries `isDefault` instead:
46
+
47
+ ```typescript
48
+ flows: [
49
+ { id: "f5", from: "needsApproval", to: "approveOrder", condition: "= total > 10000" },
50
+ { id: "f6", from: "needsApproval", to: "splitWork", name: "at or under", isDefault: true },
51
+ ]
52
+ ```
53
+
54
+ `expand` turns it into the gateway's `bpmn:default` attribute, `compactify` reads
55
+ it back, and `reconcileCompact` sets it on a file somebody else authored. A flow
56
+ marked `isDefault` that does not leave an exclusive, inclusive or complex
57
+ gateway, or a gateway with two of them, throws rather than being dropped.
58
+
59
+ > `CompactDiagram` still does not model everything. See
60
+ > [AI Integration](/docs/guides/ai) for what it drops, and use `reconcileCompact`
61
+ > rather than `expand` when you are editing a file you need to keep.
62
+
63
+ ---
64
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,13 @@
1
+ # Using BPMN Kit with AI — Where to go next
2
+
3
+ - [AI Integration](/docs/guides/ai) — the compact format, prompting, the Claude
4
+ and OpenAI calls, and the MCP server
5
+ - [Building Processes with AI](/docs/guides/ai-implement) — the `ProcessPlan`
6
+ pipeline, which compiles rather than generating XML
7
+ - [AI Agents](/docs/guides/ai-agents) — putting an LLM *inside* a process as a
8
+ Camunda AI Agent Sub-process
9
+ - [Claude Code Plugin](/docs/guides/claude-code-plugin) — the slash commands that
10
+ drive all of it
11
+
12
+ ---
13
+ Source: https://bpmnkit.com/docs/guides/using-bpmnkit-with-ai
@@ -0,0 +1,15 @@
1
+ # @bpmnkit/camunda-docspack — A note on the pack's name
2
+
3
+ A vendor that redistributes somebody else's documentation needs a second pack, so
4
+ this one is `@bpmnkit/camunda-docspack` rather than a second `@bpmnkit/docspack`.
5
+ The name is still a pure check inside a scope BPMN Kit owns, so the pack carries
6
+ the same trust as `@bpmnkit/docspack`.
7
+
8
+ The docspack spec originally named one pack per npm scope, and `bpmnkit-docs`
9
+ read the `-docspack` suffix ahead of it. Upstream adopted the shape in
10
+ **`docspack@1.2.0`**, so both readers now find this pack — but a `docspack` CLI
11
+ older than 1.2.0 will not, and will answer Camunda questions out of
12
+ `@bpmnkit/docspack` instead. `bpmnkit-docs` has no such floor.
13
+
14
+ ---
15
+ Source: https://bpmnkit.com/docs/packages/camunda-docspack
@@ -0,0 +1,41 @@
1
+ # @bpmnkit/camunda-docspack — Installation
2
+
3
+ ```sh
4
+ pnpm add -D @bpmnkit/camunda-docspack
5
+ ```
6
+
7
+ There is no second CLI to learn: `bpmnkit-docs`, from
8
+ [`@bpmnkit/docspack`](/docs/packages/docspack), reads every pack installed.
9
+
10
+
11
+ ## Asking it
12
+
13
+ ```sh
14
+ npx bpmnkit-docs ask "how should I name an exclusive gateway" \
15
+ --pack @bpmnkit/camunda-docspack
16
+ npx bpmnkit-docs ask "POST /jobs/activation" --pack @bpmnkit/camunda-docspack
17
+ npx bpmnkit-docs ask "what permissions does creating a process instance need" \
18
+ --pack @bpmnkit/camunda-docspack
19
+ ```
20
+
21
+ `--pack` both disambiguates and pays for itself: the index is built by reading
22
+ every chunk off disk, so narrowing to one pack is roughly 150ms against 650ms
23
+ across both. Leave it off when you do not know which pack answers.
24
+
25
+ Confirm it is installed before relying on it:
26
+
27
+ ```sh
28
+ npx bpmnkit-docs list
29
+ ```
30
+
31
+ ```
32
+ @bpmnkit/camunda-docspack@0.1.1 1054 chunks
33
+ @bpmnkit/docspack@0.0.5 206 chunks
34
+ ```
35
+
36
+ A pack missing from that list is a pack no answer can come from. See
37
+ [Using BPMN Kit with AI](/docs/guides/using-bpmnkit-with-ai) for the paragraph to
38
+ put in `AGENTS.md` or `CLAUDE.md` so an agent knows to ask both.
39
+
40
+ ---
41
+ Source: https://bpmnkit.com/docs/packages/camunda-docspack
@@ -0,0 +1,28 @@
1
+ # @bpmnkit/camunda-docspack — Overview
2
+
3
+ `@bpmnkit/camunda-docspack` packages the **Camunda 8 documentation** as a
4
+ [docspack](https://docspack.dev/spec) pack you can search offline: BPMN and FEEL
5
+ references, engine concepts, the best-practice pages, and one digest per
6
+ Orchestration Cluster API operation.
7
+
8
+ It is the companion to [`@bpmnkit/docspack`](/docs/packages/docspack), and the
9
+ split is the point. Ask ours how to *drive the library*; ask this one what the
10
+ *engine* does — gateway semantics, FEEL syntax, job activation, permissions.
11
+ Those are different questions and the right answer to one is the wrong answer to
12
+ the other.
13
+
14
+ > **This is Camunda's documentation, not BPMN Kit's.** The content is the work of
15
+ > Camunda Services GmbH and copyright in it remains with them. This package adds
16
+ > only the tooling that stages, chunks and indexes it. It is redistributed under
17
+ > **CC BY-SA 3.0**, the licence Camunda publishes it under — which is why this
18
+ > package is CC BY-SA 3.0 rather than MIT like the rest of BPMN Kit. BPMN Kit is
19
+ > not affiliated with, endorsed by or sponsored by Camunda. For canonical and
20
+ > current documentation prefer [docs.camunda.io](https://docs.camunda.io).
21
+
22
+ It is built from the `docs/` tree of
23
+ [camunda/camunda-docs](https://github.com/camunda/camunda-docs) — the unreleased
24
+ **8.10** documentation — plus the Orchestration Cluster API specification, and
25
+ rebuilt weekly.
26
+
27
+ ---
28
+ Source: https://bpmnkit.com/docs/packages/camunda-docspack
@@ -0,0 +1,27 @@
1
+ # @bpmnkit/camunda-docspack — Rebuilding it
2
+
3
+ A weekly workflow (`.github/workflows/camunda-docspack.yml`) rebuilds the pack
4
+ from upstream. By hand you need a camunda-docs checkout:
5
+
6
+ ```sh
7
+ node packages/camunda-docspack/dist/cli.js --camunda-docs ../camunda-docs
8
+ ```
9
+
10
+
11
+ ## API Reference
12
+
13
+ The published artefact is the `.llms/` payload; these exports are the build that
14
+ produces it.
15
+
16
+ | Export | Purpose |
17
+ | --- | --- |
18
+ | `build(options)` | Stage a camunda-docs checkout and write the `.llms/` payload |
19
+ | `stage(options)` | Run the staging transforms only, to a directory |
20
+ | `bpmnToText(xml)` | Render a BPMN diagram as a compact flow description |
21
+ | `readOperations(entry)` | Read one digest per operation from an OpenAPI document |
22
+ | `stripMdx(source, options)` | Reduce Camunda's MDX to indexable Markdown |
23
+ | `absoluteLinks(markdown, slug)` | Rewrite relative links to `docs.camunda.io` URLs |
24
+ | `notice(commit)` | The CC BY-SA 3.0 attribution written on every build |
25
+
26
+ ---
27
+ Source: https://bpmnkit.com/docs/packages/camunda-docspack
@@ -0,0 +1,16 @@
1
+ # @bpmnkit/camunda-docspack — What makes this corpus different
2
+
3
+ - **Diagrams as text.** The best-practice pages argue through embedded BPMN
4
+ diagrams, and Camunda's own Markdown export drops them. Each one is rendered as
5
+ a flow description instead, so a page about naming gateways still contains the
6
+ gateway, its question and its conditions.
7
+ - **227 API operations.** One digest per endpoint, read from the specification
8
+ rather than from the generated reference pages, with required permissions
9
+ decoded, the version it appeared in, and its consistency guarantee.
10
+ - **Every chunk cites its page.** Links are rewritten to absolute
11
+ `docs.camunda.io` URLs and each chunk ends with the page it came from.
12
+ - **Nothing dropped silently.** An MDX component the build does not recognise
13
+ fails the build by file and line rather than quietly thinning the corpus.
14
+
15
+ ---
16
+ Source: https://bpmnkit.com/docs/packages/camunda-docspack
@@ -6,6 +6,14 @@ Zeebe bindings, and drops collaborations, participants, message flows, lanes, da
6
6
  artifacts, root-level messages and errors, multi-instance loop characteristics, full
7
7
  `zeebe:ioMapping` entries and diagram interchange.
8
8
 
9
+ A sequence flow leaving an exclusive, inclusive or complex gateway carries `isDefault: true`
10
+ when the gateway names it in `bpmn:default`. It sits on the flow rather than on the gateway
11
+ because that is where its alternative, `condition`, sits — a model writing the branches of a
12
+ decision marks one of them instead of pointing back at a flow id. `expand` turns it into the
13
+ attribute; a flow marked `isDefault` that leaves anything else, or a gateway with two of them,
14
+ throws rather than being dropped, because a lost default is a gateway that deadlocks the first
15
+ time every condition is false.
16
+
9
17
  `documentation` is carried on every element and on the process itself, because in Camunda 8 it
10
18
  is not decoration: on an ad-hoc sub-process child it is the tool description handed to the LLM,
11
19
  and on a start event it is where the process input contract is written. It had been dropped, so
@@ -1,18 +1,13 @@
1
- # @bpmnkit/docspack — Installation
2
-
3
- ```sh
4
- pnpm add -D @bpmnkit/docspack
5
- ```
6
-
7
-
8
- ## Giving an agent access
1
+ # @bpmnkit/docspack — Giving an agent access
9
2
 
10
3
  Any agent with a shell can run the command, so one paragraph in `AGENTS.md`, `CLAUDE.md`
11
4
  or `.cursor/rules` is the whole setup:
12
5
 
13
6
  ```md
14
- Run `npx bpmnkit-docs ask "<question>"` for BPMN Kit documentation. It answers
15
- from the version this project installed. Prefer what it returns over recalled
7
+ Run `npx bpmnkit-docs ask "<question>"` for BPMN Kit documentation, and
8
+ `npx bpmnkit-docs ask "<question>" --pack @bpmnkit/camunda-docspack` for Camunda 8
9
+ documentation — BPMN semantics, FEEL, engine behaviour, the REST API. Both answer
10
+ from the versions this project installed. Prefer what they return over recalled
16
11
  knowledge — when the two disagree, the retrieved chunk is right.
17
12
  ```
18
13
 
@@ -30,5 +30,11 @@ with the versions installed.
30
30
 
31
31
  Options: `--limit <n>`, `--max-tokens <n>`, `--pack <name>`, `--cwd <dir>`.
32
32
 
33
+ `--pack` narrows before the index is built, not after, so asking one pack a
34
+ question does not pay for reading the others — roughly 150ms against 650ms
35
+ across both packs. A name that is not installed is an error listing what is,
36
+ rather than an empty answer that would read as "the documentation does not cover
37
+ this".
38
+
33
39
  ---
34
40
  Source: https://bpmnkit.com/docs/packages/docspack
@@ -0,0 +1,24 @@
1
+ # @bpmnkit/docspack — The other pack
2
+
3
+ BPMN Kit publishes a second pack:
4
+ **[`@bpmnkit/camunda-docspack`](/docs/packages/camunda-docspack)**, the Camunda 8
5
+ documentation — BPMN and FEEL references, engine concepts, best practices and the
6
+ Orchestration Cluster API. `bpmnkit-docs` reads both, so ask this package how to
7
+ drive the library and that one what the engine does:
8
+
9
+ ```sh
10
+ npx bpmnkit-docs ask "how should I name an exclusive gateway" --pack @bpmnkit/camunda-docspack
11
+ ```
12
+
13
+ Install them together, and tell your agent about both — see
14
+ [Using BPMN Kit with AI](/docs/guides/using-bpmnkit-with-ai).
15
+
16
+
17
+ ## Installation
18
+
19
+ ```sh
20
+ pnpm add -D @bpmnkit/docspack @bpmnkit/camunda-docspack
21
+ ```
22
+
23
+ ---
24
+ Source: https://bpmnkit.com/docs/packages/docspack
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "$schema": "https://docspack.dev/schema/v1.json",
3
3
  "name": "@bpmnkit/docspack",
4
- "version": "0.0.4",
4
+ "version": "0.0.6",
5
5
  "documents": [
6
6
  "@bpmnkit/core",
7
7
  "@bpmnkit/canvas",
@@ -925,7 +925,7 @@
925
925
  {
926
926
  "id": "guides.ai.minimal-empty-diagram",
927
927
  "file": "chunks/guides.ai.minimal-empty-diagram.md",
928
- "tokens": 229,
928
+ "tokens": 247,
929
929
  "tags": [
930
930
  "guides",
931
931
  "ai",
@@ -1454,6 +1454,159 @@
1454
1454
  "engine.getDeployedProcesses()"
1455
1455
  ]
1456
1456
  },
1457
+ {
1458
+ "id": "guides.using-bpmnkit-with-ai",
1459
+ "file": "chunks/guides.using-bpmnkit-with-ai.md",
1460
+ "tokens": 210,
1461
+ "tags": [
1462
+ "guides",
1463
+ "using-bpmnkit-with-ai"
1464
+ ],
1465
+ "entities": [
1466
+ "@bpmnkit/docspack",
1467
+ "@bpmnkit/camunda-docspack"
1468
+ ]
1469
+ },
1470
+ {
1471
+ "id": "guides.using-bpmnkit-with-ai.the-two-packs-bpmn-kit-ships",
1472
+ "file": "chunks/guides.using-bpmnkit-with-ai.the-two-packs-bpmn-kit-ships.md",
1473
+ "tokens": 147,
1474
+ "tags": [
1475
+ "guides",
1476
+ "using-bpmnkit-with-ai",
1477
+ "two",
1478
+ "packs",
1479
+ "bpmn",
1480
+ "kit",
1481
+ "ships"
1482
+ ],
1483
+ "entities": [
1484
+ "@bpmnkit/docspack",
1485
+ "@bpmnkit/camunda-docspack"
1486
+ ]
1487
+ },
1488
+ {
1489
+ "id": "guides.using-bpmnkit-with-ai.telling-an-agent-they-exist",
1490
+ "file": "chunks/guides.using-bpmnkit-with-ai.telling-an-agent-they-exist.md",
1491
+ "tokens": 224,
1492
+ "tags": [
1493
+ "guides",
1494
+ "using-bpmnkit-with-ai",
1495
+ "telling",
1496
+ "agent",
1497
+ "they",
1498
+ "exist"
1499
+ ],
1500
+ "entities": [
1501
+ "AGENTS.md",
1502
+ "CLAUDE.md"
1503
+ ]
1504
+ },
1505
+ {
1506
+ "id": "guides.using-bpmnkit-with-ai.asking",
1507
+ "file": "chunks/guides.using-bpmnkit-with-ai.asking.md",
1508
+ "tokens": 314,
1509
+ "tags": [
1510
+ "guides",
1511
+ "using-bpmnkit-with-ai",
1512
+ "asking"
1513
+ ],
1514
+ "entities": [
1515
+ "BpmnDefinitions",
1516
+ "CompactDiagram"
1517
+ ]
1518
+ },
1519
+ {
1520
+ "id": "guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli",
1521
+ "file": "chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli.md",
1522
+ "tokens": 706,
1523
+ "tags": [
1524
+ "carrier",
1525
+ "refused",
1526
+ "dispatcher",
1527
+ "guides",
1528
+ "using-bpmnkit-with-ai",
1529
+ "library",
1530
+ "instead",
1531
+ "cli"
1532
+ ],
1533
+ "entities": [
1534
+ "minTokens",
1535
+ "package.json",
1536
+ "@bpmnkit/docspack"
1537
+ ]
1538
+ },
1539
+ {
1540
+ "id": "guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli-the-other-route-docspack-index",
1541
+ "file": "chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli-the-other-route-docspack-index.md",
1542
+ "tokens": 551,
1543
+ "tags": [
1544
+ "guides",
1545
+ "using-bpmnkit-with-ai",
1546
+ "library",
1547
+ "instead",
1548
+ "cli",
1549
+ "other",
1550
+ "route",
1551
+ "docspack",
1552
+ "index"
1553
+ ],
1554
+ "entities": [
1555
+ "@bpmnkit/camunda-docspack"
1556
+ ]
1557
+ },
1558
+ {
1559
+ "id": "guides.using-bpmnkit-with-ai.the-whole-loop-five-markdown-files-to-a-bpmn-diagram",
1560
+ "file": "chunks/guides.using-bpmnkit-with-ai.the-whole-loop-five-markdown-files-to-a-bpmn-diagram.md",
1561
+ "tokens": 604,
1562
+ "tags": [
1563
+ "guides",
1564
+ "using-bpmnkit-with-ai",
1565
+ "whole",
1566
+ "loop",
1567
+ "five",
1568
+ "markdown",
1569
+ "files",
1570
+ "bpmn",
1571
+ "diagram"
1572
+ ],
1573
+ "entities": [
1574
+ "@bpmnkit/docspack",
1575
+ "@bpmnkit/camunda-docspack",
1576
+ "CompactDiagram",
1577
+ "isDefault",
1578
+ "reconcileCompact"
1579
+ ]
1580
+ },
1581
+ {
1582
+ "id": "guides.using-bpmnkit-with-ai.runnable-examples",
1583
+ "file": "chunks/guides.using-bpmnkit-with-ai.runnable-examples.md",
1584
+ "tokens": 312,
1585
+ "tags": [
1586
+ "guides",
1587
+ "using-bpmnkit-with-ai",
1588
+ "runnable",
1589
+ "examples"
1590
+ ],
1591
+ "entities": [
1592
+ "apps/examples/src/ai",
1593
+ "output/order-fulfilment.bpmn",
1594
+ "indexPacks"
1595
+ ]
1596
+ },
1597
+ {
1598
+ "id": "guides.using-bpmnkit-with-ai.where-to-go-next",
1599
+ "file": "chunks/guides.using-bpmnkit-with-ai.where-to-go-next.md",
1600
+ "tokens": 117,
1601
+ "tags": [
1602
+ "guides",
1603
+ "using-bpmnkit-with-ai",
1604
+ "next"
1605
+ ],
1606
+ "entities": [
1607
+ "ProcessPlan"
1608
+ ]
1609
+ },
1457
1610
  {
1458
1611
  "id": "guides.vscode",
1459
1612
  "file": "chunks/guides.vscode.md",
@@ -1788,6 +1941,80 @@
1788
1941
  ],
1789
1942
  "entities": []
1790
1943
  },
1944
+ {
1945
+ "id": "packages.camunda-docspack.overview",
1946
+ "file": "chunks/packages.camunda-docspack.overview.md",
1947
+ "tokens": 308,
1948
+ "tags": [
1949
+ "packages",
1950
+ "camunda-docspack",
1951
+ "overview"
1952
+ ],
1953
+ "entities": [
1954
+ "@bpmnkit/camunda-docspack",
1955
+ "@bpmnkit/docspack",
1956
+ "docs/"
1957
+ ]
1958
+ },
1959
+ {
1960
+ "id": "packages.camunda-docspack.installation",
1961
+ "file": "chunks/packages.camunda-docspack.installation.md",
1962
+ "tokens": 252,
1963
+ "tags": [
1964
+ "packages",
1965
+ "camunda-docspack",
1966
+ "installation"
1967
+ ],
1968
+ "entities": [
1969
+ "@bpmnkit/docspack",
1970
+ "AGENTS.md",
1971
+ "CLAUDE.md"
1972
+ ]
1973
+ },
1974
+ {
1975
+ "id": "packages.camunda-docspack.what-makes-this-corpus-different",
1976
+ "file": "chunks/packages.camunda-docspack.what-makes-this-corpus-different.md",
1977
+ "tokens": 192,
1978
+ "tags": [
1979
+ "packages",
1980
+ "camunda-docspack",
1981
+ "makes",
1982
+ "corpus",
1983
+ "different"
1984
+ ],
1985
+ "entities": [
1986
+ "docs.camunda.io"
1987
+ ]
1988
+ },
1989
+ {
1990
+ "id": "packages.camunda-docspack.rebuilding-it",
1991
+ "file": "chunks/packages.camunda-docspack.rebuilding-it.md",
1992
+ "tokens": 227,
1993
+ "tags": [
1994
+ "packages",
1995
+ "camunda-docspack",
1996
+ "rebuilding"
1997
+ ],
1998
+ "entities": [
1999
+ "docs.camunda.io"
2000
+ ]
2001
+ },
2002
+ {
2003
+ "id": "packages.camunda-docspack.a-note-on-the-pack-s-name",
2004
+ "file": "chunks/packages.camunda-docspack.a-note-on-the-pack-s-name.md",
2005
+ "tokens": 165,
2006
+ "tags": [
2007
+ "packages",
2008
+ "camunda-docspack",
2009
+ "note",
2010
+ "pack",
2011
+ "name"
2012
+ ],
2013
+ "entities": [
2014
+ "@bpmnkit/camunda-docspack",
2015
+ "@bpmnkit/docspack"
2016
+ ]
2017
+ },
1791
2018
  {
1792
2019
  "id": "packages.canvas.overview",
1793
2020
  "file": "chunks/packages.canvas.overview.md",
@@ -2214,7 +2441,7 @@
2214
2441
  {
2215
2442
  "id": "packages.core.installation-compactify-definitions",
2216
2443
  "file": "chunks/packages.core.installation-compactify-definitions.md",
2217
- "tokens": 204,
2444
+ "tokens": 342,
2218
2445
  "tags": [
2219
2446
  "packages",
2220
2447
  "core",
@@ -2224,7 +2451,8 @@
2224
2451
  ],
2225
2452
  "entities": [
2226
2453
  "BpmnDefinitions",
2227
- "CompactDiagram"
2454
+ "CompactDiagram",
2455
+ "isDefault"
2228
2456
  ]
2229
2457
  },
2230
2458
  {
@@ -2463,13 +2691,29 @@
2463
2691
  ]
2464
2692
  },
2465
2693
  {
2466
- "id": "packages.docspack.installation",
2467
- "file": "chunks/packages.docspack.installation.md",
2468
- "tokens": 251,
2694
+ "id": "packages.docspack.the-other-pack",
2695
+ "file": "chunks/packages.docspack.the-other-pack.md",
2696
+ "tokens": 145,
2469
2697
  "tags": [
2470
2698
  "packages",
2471
2699
  "docspack",
2472
- "installation"
2700
+ "other",
2701
+ "pack"
2702
+ ],
2703
+ "entities": [
2704
+ "@bpmnkit/camunda-docspack"
2705
+ ]
2706
+ },
2707
+ {
2708
+ "id": "packages.docspack.giving-an-agent-access",
2709
+ "file": "chunks/packages.docspack.giving-an-agent-access.md",
2710
+ "tokens": 268,
2711
+ "tags": [
2712
+ "packages",
2713
+ "docspack",
2714
+ "giving",
2715
+ "agent",
2716
+ "access"
2473
2717
  ],
2474
2718
  "entities": [
2475
2719
  "AGENTS.md",
@@ -2479,7 +2723,7 @@
2479
2723
  {
2480
2724
  "id": "packages.docspack.reading-it-yourself",
2481
2725
  "file": "chunks/packages.docspack.reading-it-yourself.md",
2482
- "tokens": 252,
2726
+ "tokens": 329,
2483
2727
  "tags": [
2484
2728
  "packages",
2485
2729
  "docspack",
package/README.md CHANGED
@@ -22,6 +22,8 @@ An agent installs it, asks a question, and gets back the two or three passages t
22
22
 
23
23
  It follows the [docspack package format](https://docspack.dev/spec), so the upstream `docspack` CLI discovers and indexes it like any other vendor pack. The bundled `bpmnkit-docs` command does the same job with no extra tooling.
24
24
 
25
+ It also reads [`@bpmnkit/camunda-docspack`](https://www.npmjs.com/package/@bpmnkit/camunda-docspack) — the Camunda 8 documentation in the same format. Install both and ask this one how to drive the library, that one what the engine does.
26
+
25
27
  ```
26
28
  Markdown docs → chunks + manifest → BM25 index → three passages
27
29
  ```
@@ -44,17 +46,20 @@ npm install -D @bpmnkit/docspack
44
46
 
45
47
  ## Quick Start
46
48
 
47
- Give an agent one line in `AGENTS.md` or `CLAUDE.md`:
49
+ Give an agent one paragraph in `AGENTS.md` or `CLAUDE.md` — naming both packs, because an agent told only about the first will never think to ask the second:
48
50
 
49
51
  ```
50
- Run \`npx bpmnkit-docs ask "<question>"\` for BPMN Kit documentation.
51
- It answers from the version this project installed.
52
+ Run `npx bpmnkit-docs ask "<question>"` for BPMN Kit documentation, and
53
+ `npx bpmnkit-docs ask "<question>" --pack @bpmnkit/camunda-docspack` for
54
+ Camunda 8 documentation — BPMN semantics, FEEL, engine behaviour, the REST API.
55
+ Both answer from the versions this project installed.
52
56
  ```
53
57
 
54
58
  Then:
55
59
 
56
60
  ```sh
57
61
  npx bpmnkit-docs ask "how do I deploy a process to Camunda 8"
62
+ npx bpmnkit-docs ask "what happens when no gateway condition is true" --pack @bpmnkit/camunda-docspack
58
63
  npx bpmnkit-docs search "exclusive gateway"
59
64
  npx bpmnkit-docs list
60
65
  ```
@@ -111,6 +116,8 @@ function loadPack(dir: string): Pack
111
116
 
112
117
  Options: `--limit <n>`, `--max-tokens <n>`, `--pack <name>`, `--cwd <dir>`.
113
118
 
119
+ `--pack` narrows before the index is built, not after, so asking one pack a question does not pay for reading the others. A name that is not installed is an error listing what is, rather than an empty answer that would read as "the documentation does not cover this".
120
+
114
121
  ---
115
122
 
116
123
  ## Related Packages
@@ -125,6 +132,7 @@ Options: `--limit <n>`, `--max-tokens <n>`, `--pack <name>`, `--cwd <dir>`.
125
132
  | [`@bpmnkit/plugins`](https://www.npmjs.com/package/@bpmnkit/plugins) | 22 composable canvas plugins |
126
133
  | [`@bpmnkit/api`](https://www.npmjs.com/package/@bpmnkit/api) | Camunda 8 REST API TypeScript client |
127
134
  | [`@bpmnkit/ascii`](https://www.npmjs.com/package/@bpmnkit/ascii) | Render BPMN diagrams as Unicode ASCII art |
135
+ | [`@bpmnkit/camunda-docspack`](https://www.npmjs.com/package/@bpmnkit/camunda-docspack) | Camunda 8 docs as an offline docspack package for AI agents |
128
136
  | [`@bpmnkit/ui`](https://www.npmjs.com/package/@bpmnkit/ui) | Shared design tokens and UI components |
129
137
  | [`@bpmnkit/profiles`](https://www.npmjs.com/package/@bpmnkit/profiles) | Shared auth, profile storage, and client factories for CLI & proxy |
130
138
  | [`@bpmnkit/operate`](https://www.npmjs.com/package/@bpmnkit/operate) | Monitoring & operations frontend for Camunda clusters |
package/dist/chunk.js CHANGED
@@ -25,7 +25,7 @@ export function chunkDocument(doc, options = {}) {
25
25
  if (text === "")
26
26
  continue;
27
27
  const directives = readDirectives(part.lines);
28
- const chunkTitle = part.heading === "" ? title : `${title} — ${part.heading}`;
28
+ const chunkTitle = joinHeadings(title, part.heading);
29
29
  const source = options.siteUrl ? `\n\n---\nSource: ${options.siteUrl}/${doc.slug}` : "";
30
30
  const bodyText = `# ${chunkTitle}\n\n${stripDirectives(text)}${source}\n`;
31
31
  chunks.push({
@@ -116,8 +116,7 @@ function subdivide(section, maxTokens) {
116
116
  return [section];
117
117
  const parts = [];
118
118
  for (const sub of splitByHeading(section.lines.join("\n"), 3)) {
119
- const heading = sub.heading === "" ? section.heading : `${section.heading} — ${sub.heading}`;
120
- parts.push(...byParagraph({ heading, lines: sub.lines }, maxTokens));
119
+ parts.push(...byParagraph({ heading: joinHeadings(section.heading, sub.heading), lines: sub.lines }, maxTokens));
121
120
  }
122
121
  return parts.length > 0 ? parts : [section];
123
122
  }
@@ -132,7 +131,7 @@ function byParagraph(section, maxTokens) {
132
131
  if (current.join("").trim() === "")
133
132
  return;
134
133
  const suffix = parts.length === 0 ? "" : ` (${parts.length + 1})`;
135
- parts.push({ heading: `${section.heading}${suffix}`, lines: current });
134
+ parts.push({ heading: `${section.heading}${suffix}`.trim(), lines: current });
136
135
  current = [];
137
136
  };
138
137
  for (const line of section.lines) {
@@ -177,6 +176,17 @@ function stripDirectives(text) {
177
176
  .join("\n")
178
177
  .trim();
179
178
  }
179
+ /**
180
+ * Join a chunk's heading trail, dropping the levels that have no heading of their own.
181
+ *
182
+ * A document whose text before the first `##` is shorter than `minTokens` is merged into the
183
+ * section after it, and the merged section keeps the preamble's empty heading. Composing that
184
+ * blindly produced a hole in the middle of the trail — `Naming BPMN elements — — Naming
185
+ * gateways` — which is what a reader sees at the top of the chunk and what an answer cites.
186
+ */
187
+ function joinHeadings(...parts) {
188
+ return parts.filter((part) => part.trim() !== "").join(" — ");
189
+ }
180
190
  /** Heading words carry the topic; function words carry nothing worth weighting 3x. */
181
191
  function headingTags(heading) {
182
192
  return tokenize(heading).filter((word) => word.length > 2 && !STOP_WORDS.has(word));
package/dist/cli.js CHANGED
@@ -72,8 +72,18 @@ function main(argv) {
72
72
  return 1;
73
73
  }
74
74
  const selected = args.options.get("pack");
75
+ // Narrowing before indexing, not after: every chunk of every pack is read from
76
+ // disk to build the index, so asking one pack a question should not pay for
77
+ // the others. It is the difference between ~60ms and ~650ms here.
78
+ const scoped = selected === undefined ? packs : packs.filter((pack) => pack.name === selected);
79
+ if (scoped.length === 0) {
80
+ process.stderr.write(`No documentation package named "${selected}". Found: ${packs
81
+ .map((pack) => pack.name)
82
+ .join(", ")}\n`);
83
+ return 1;
84
+ }
75
85
  const scope = selected ? { packs: [selected] } : {};
76
- const index = indexPacks(packs);
86
+ const index = indexPacks(scoped);
77
87
  if (args.command === "search") {
78
88
  const hits = search(index, query, { ...scope, limit: number(args, "limit", 10) });
79
89
  process.stdout.write(formatSearch(query, hits));
package/dist/load.d.ts CHANGED
@@ -18,8 +18,16 @@ export declare function chunkPath(packDir: string, chunk: ManifestChunk): string
18
18
  export declare function readChunk(pack: Pack, chunk: ManifestChunk): string;
19
19
  /**
20
20
  * Every documentation package reachable from `cwd`: the vendor-scoped
21
- * `@<vendor>/docspack` and community `@docspack-community/*` packages installed
22
- * in any `node_modules` up the tree, plus `cwd` itself when it is a pack.
21
+ * `@<vendor>/docspack`, its `@<vendor>/<name>-docspack` siblings, and community
22
+ * `@docspack-community/*` packages installed in any `node_modules` up the tree,
23
+ * plus `cwd` itself when it is a pack.
24
+ *
25
+ * The suffix is for a vendor that also redistributes somebody else's
26
+ * documentation — `@bpmnkit/camunda-docspack` is ours — and had nowhere to put
27
+ * it when the spec named one pack per scope. It is still a pure name check,
28
+ * inside a scope that vendor owns, so the pack carries the same trust as the
29
+ * bare name and nothing here has to reach the network to decide. Upstream
30
+ * adopted the same shape in `docspack@1.2.0`.
23
31
  */
24
32
  export declare function discoverPacks(cwd?: string): Pack[];
25
33
  /** Load every chunk of every pack into a searchable index. */
package/dist/load.js CHANGED
@@ -65,8 +65,16 @@ export function readChunk(pack, chunk) {
65
65
  }
66
66
  /**
67
67
  * Every documentation package reachable from `cwd`: the vendor-scoped
68
- * `@<vendor>/docspack` and community `@docspack-community/*` packages installed
69
- * in any `node_modules` up the tree, plus `cwd` itself when it is a pack.
68
+ * `@<vendor>/docspack`, its `@<vendor>/<name>-docspack` siblings, and community
69
+ * `@docspack-community/*` packages installed in any `node_modules` up the tree,
70
+ * plus `cwd` itself when it is a pack.
71
+ *
72
+ * The suffix is for a vendor that also redistributes somebody else's
73
+ * documentation — `@bpmnkit/camunda-docspack` is ours — and had nowhere to put
74
+ * it when the spec named one pack per scope. It is still a pure name check,
75
+ * inside a scope that vendor owns, so the pack carries the same trust as the
76
+ * bare name and nothing here has to reach the network to decide. Upstream
77
+ * adopted the same shape in `docspack@1.2.0`.
70
78
  */
71
79
  export function discoverPacks(cwd = process.cwd()) {
72
80
  const found = new Map();
@@ -90,7 +98,11 @@ export function discoverPacks(cwd = process.cwd()) {
90
98
  offer(join(modules, scope, name));
91
99
  }
92
100
  else {
93
- offer(join(modules, scope, "docspack"));
101
+ for (const name of listDirectory(join(modules, scope))) {
102
+ if (name === "docspack" || name.endsWith("-docspack")) {
103
+ offer(join(modules, scope, name));
104
+ }
105
+ }
94
106
  }
95
107
  }
96
108
  }
package/dist/search.d.ts CHANGED
@@ -30,7 +30,11 @@ export declare function buildIndex(inputs: IndexInput[]): DocsIndex;
30
30
  export interface SearchOptions {
31
31
  /** Maximum hits to return. */
32
32
  limit?: number;
33
- /** Restrict to these package names — a project asks only about what it installed. */
33
+ /**
34
+ * Restrict to these package names — a project asks only about what it
35
+ * installed. A name that was never indexed throws rather than returning
36
+ * nothing, so a typo cannot pass for an absence of documentation.
37
+ */
34
38
  packs?: readonly string[];
35
39
  }
36
40
  /** Rank every chunk that shares a term with the query. Ties break on chunk id. */
package/dist/search.js CHANGED
@@ -47,10 +47,21 @@ export function buildIndex(inputs) {
47
47
  /** Rank every chunk that shares a term with the query. Ties break on chunk id. */
48
48
  export function search(index, query, options = {}) {
49
49
  const limit = options.limit ?? 3;
50
+ const allowed = options.packs ? new Set(options.packs) : null;
51
+ if (allowed) {
52
+ // Narrowing to a package that was never indexed would otherwise come back
53
+ // as an empty result, which reads as "the documentation does not cover
54
+ // this" — a different answer, and the wrong one to hand a model.
55
+ const indexed = new Set(index.chunks.map((candidate) => candidate.pack.name));
56
+ for (const name of allowed) {
57
+ if (!indexed.has(name)) {
58
+ throw new Error(`No documentation package named "${name}". Indexed: ${[...indexed].sort().join(", ")}`);
59
+ }
60
+ }
61
+ }
50
62
  const queryTerms = terms(query);
51
63
  if (queryTerms.length === 0)
52
64
  return [];
53
- const allowed = options.packs ? new Set(options.packs) : null;
54
65
  const total = index.chunks.length;
55
66
  const hits = [];
56
67
  for (const candidate of index.chunks) {
package/llms.txt CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  > BPMN Kit documentation as an offline, version-locked docspack package with a built-in search CLI for AI agents
4
4
 
5
- Version 0.0.4. 191 chunks documenting @bpmnkit/core, @bpmnkit/canvas, @bpmnkit/editor, @bpmnkit/engine, @bpmnkit/feel, @bpmnkit/plugins, @bpmnkit/api, @bpmnkit/ascii, @bpmnkit/connector-gen, @bpmnkit/connectors, @bpmnkit/patterns, @bpmnkit/worker-client, @bpmnkit/cli.
5
+ Version 0.0.6. 206 chunks documenting @bpmnkit/core, @bpmnkit/canvas, @bpmnkit/editor, @bpmnkit/engine, @bpmnkit/feel, @bpmnkit/plugins, @bpmnkit/api, @bpmnkit/ascii, @bpmnkit/connector-gen, @bpmnkit/connectors, @bpmnkit/patterns, @bpmnkit/worker-client, @bpmnkit/cli.
6
6
 
7
7
  ```sh
8
8
  npm i -D @bpmnkit/docspack
@@ -83,7 +83,7 @@ npx bpmnkit-docs ask "how do I deploy a process"
83
83
  - [Building Processes with AI — Deploying](.llms/chunks/guides.ai-implement.deploying.md) — 255 tokens
84
84
  - [Building Processes with AI — Extending an existing process](.llms/chunks/guides.ai-implement.extending-an-existing-process.md) — 100 tokens
85
85
  - [AI Integration](.llms/chunks/guides.ai.md) — 478 tokens
86
- - [AI Integration — Minimal Empty Diagram](.llms/chunks/guides.ai.minimal-empty-diagram.md) — 229 tokens
86
+ - [AI Integration — Minimal Empty Diagram](.llms/chunks/guides.ai.minimal-empty-diagram.md) — 247 tokens
87
87
  - [AI Integration — Claude API Example](.llms/chunks/guides.ai.claude-api-example.md) — 226 tokens
88
88
  - [AI Integration — OpenAI Function Calling](.llms/chunks/guides.ai.openai-function-calling.md) — 192 tokens
89
89
  - [AI Integration — MCP Server](.llms/chunks/guides.ai.mcp-server.md) — 151 tokens
@@ -124,6 +124,15 @@ npx bpmnkit-docs ask "how do I deploy a process"
124
124
  - [Simulation — Message Correlation](.llms/chunks/guides.simulation.message-correlation.md) — 144 tokens
125
125
  - [Simulation — DMN Decision Evaluation](.llms/chunks/guides.simulation.dmn-decision-evaluation.md) — 251 tokens
126
126
  - [Simulation — Multiple Deployments](.llms/chunks/guides.simulation.multiple-deployments.md) — 85 tokens
127
+ - [Using BPMN Kit with AI](.llms/chunks/guides.using-bpmnkit-with-ai.md) — 210 tokens
128
+ - [Using BPMN Kit with AI — The two packs BPMN Kit ships](.llms/chunks/guides.using-bpmnkit-with-ai.the-two-packs-bpmn-kit-ships.md) — 147 tokens
129
+ - [Using BPMN Kit with AI — Telling an agent they exist](.llms/chunks/guides.using-bpmnkit-with-ai.telling-an-agent-they-exist.md) — 224 tokens
130
+ - [Using BPMN Kit with AI — Asking](.llms/chunks/guides.using-bpmnkit-with-ai.asking.md) — 314 tokens
131
+ - [Using BPMN Kit with AI — From the library instead of the CLI](.llms/chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli.md) — 706 tokens
132
+ - [Using BPMN Kit with AI — From the library instead of the CLI — The other route: `docspack index`](.llms/chunks/guides.using-bpmnkit-with-ai.from-the-library-instead-of-the-cli-the-other-route-docspack-index.md) — 551 tokens
133
+ - [Using BPMN Kit with AI — The whole loop: five Markdown files to a BPMN diagram](.llms/chunks/guides.using-bpmnkit-with-ai.the-whole-loop-five-markdown-files-to-a-bpmn-diagram.md) — 604 tokens
134
+ - [Using BPMN Kit with AI — Runnable examples](.llms/chunks/guides.using-bpmnkit-with-ai.runnable-examples.md) — 312 tokens
135
+ - [Using BPMN Kit with AI — Where to go next](.llms/chunks/guides.using-bpmnkit-with-ai.where-to-go-next.md) — 117 tokens
127
136
  - [VS Code Extension](.llms/chunks/guides.vscode.md) — 139 tokens
128
137
  - [VS Code Extension — Installing](.llms/chunks/guides.vscode.installing.md) — 140 tokens
129
138
  - [VS Code Extension — What it does — Preview beside the source](.llms/chunks/guides.vscode.what-it-does-preview-beside-the-source.md) — 131 tokens
@@ -151,6 +160,11 @@ npx bpmnkit-docs ask "how do I deploy a process"
151
160
  - [@bpmnkit/api — Process Operations](.llms/chunks/packages.api.process-operations.md) — 238 tokens
152
161
  - [@bpmnkit/api — Incident Resolution](.llms/chunks/packages.api.incident-resolution.md) — 137 tokens
153
162
  - [@bpmnkit/api — Observability Events](.llms/chunks/packages.api.observability-events.md) — 94 tokens
163
+ - [@bpmnkit/camunda-docspack — Overview](.llms/chunks/packages.camunda-docspack.overview.md) — 308 tokens
164
+ - [@bpmnkit/camunda-docspack — Installation](.llms/chunks/packages.camunda-docspack.installation.md) — 252 tokens
165
+ - [@bpmnkit/camunda-docspack — What makes this corpus different](.llms/chunks/packages.camunda-docspack.what-makes-this-corpus-different.md) — 192 tokens
166
+ - [@bpmnkit/camunda-docspack — Rebuilding it](.llms/chunks/packages.camunda-docspack.rebuilding-it.md) — 227 tokens
167
+ - [@bpmnkit/camunda-docspack — A note on the pack's name](.llms/chunks/packages.camunda-docspack.a-note-on-the-pack-s-name.md) — 165 tokens
154
168
  - [@bpmnkit/canvas — Overview](.llms/chunks/packages.canvas.overview.md) — 161 tokens
155
169
  - [@bpmnkit/canvas — Options](.llms/chunks/packages.canvas.options.md) — 147 tokens
156
170
  - [@bpmnkit/canvas — Events](.llms/chunks/packages.canvas.events.md) — 269 tokens
@@ -179,7 +193,7 @@ npx bpmnkit-docs ask "how do I deploy a process"
179
193
  - [@bpmnkit/core — Installation — `applyBpmnOperations(definitions, operations, options?)`](.llms/chunks/packages.core.installation-applybpmnoperations-definitions-operations-options.md) — 235 tokens
180
194
  - [@bpmnkit/core — Installation — `ensureZeebeExtension(owner, extension)`](.llms/chunks/packages.core.installation-ensurezeebeextension-owner-extension.md) — 323 tokens
181
195
  - [@bpmnkit/core — Installation — `reconcileCompact(definitions, compact, options?)`](.llms/chunks/packages.core.installation-reconcilecompact-definitions-compact-options.md) — 129 tokens
182
- - [@bpmnkit/core — Installation — `compactify(definitions)`](.llms/chunks/packages.core.installation-compactify-definitions.md) — 204 tokens
196
+ - [@bpmnkit/core — Installation — `compactify(definitions)`](.llms/chunks/packages.core.installation-compactify-definitions.md) — 342 tokens
183
197
  - [@bpmnkit/core — Installation — `expand(compact)`](.llms/chunks/packages.core.installation-expand-compact.md) — 164 tokens
184
198
  - [@bpmnkit/core — Installation — `retypeElement(element, type)`](.llms/chunks/packages.core.installation-retypeelement-element-type.md) — 189 tokens
185
199
  - [@bpmnkit/core — Installation — `createFlowElement(id, type, options?)`](.llms/chunks/packages.core.installation-createflowelement-id-type-options.md) — 61 tokens
@@ -193,8 +207,9 @@ npx bpmnkit-docs ask "how do I deploy a process"
193
207
  - [@bpmnkit/core — Writing files — `@bpmnkit/core/node` — `exportPreserving(original, definitions)`](.llms/chunks/packages.core.writing-files-bpmnkit-core-node-exportpreserving-original-definitions.md) — 598 tokens
194
208
  - [@bpmnkit/core — DMN Support](.llms/chunks/packages.core.dmn-support.md) — 113 tokens
195
209
  - [@bpmnkit/docspack — Overview](.llms/chunks/packages.docspack.overview.md) — 252 tokens
196
- - [@bpmnkit/docspack — Installation](.llms/chunks/packages.docspack.installation.md) — 251 tokens
197
- - [@bpmnkit/docspack — Reading it yourself](.llms/chunks/packages.docspack.reading-it-yourself.md) — 252 tokens
210
+ - [@bpmnkit/docspack — The other pack](.llms/chunks/packages.docspack.the-other-pack.md) — 145 tokens
211
+ - [@bpmnkit/docspack — Giving an agent access](.llms/chunks/packages.docspack.giving-an-agent-access.md) — 268 tokens
212
+ - [@bpmnkit/docspack — Reading it yourself](.llms/chunks/packages.docspack.reading-it-yourself.md) — 329 tokens
198
213
  - [@bpmnkit/docspack — Using the index directly](.llms/chunks/packages.docspack.using-the-index-directly.md) — 320 tokens
199
214
  - [@bpmnkit/docspack — Trust](.llms/chunks/packages.docspack.trust.md) — 118 tokens
200
215
  - [@bpmnkit/editor — Overview](.llms/chunks/packages.editor.overview.md) — 135 tokens
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bpmnkit/docspack",
3
- "version": "0.0.4",
3
+ "version": "0.0.6",
4
4
  "type": "module",
5
5
  "main": "./dist/index.js",
6
6
  "types": "./dist/index.d.ts",