get-tbd 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.
- package/README.md +38 -6
- package/dist/bin.mjs +4036 -1074
- package/dist/bin.mjs.map +1 -1
- package/dist/cli.mjs +2505 -1585
- package/dist/cli.mjs.map +1 -1
- package/dist/{config-BJz1m9eN.mjs → config-B1w3pAkY.mjs} +142 -279
- package/dist/config-B1w3pAkY.mjs.map +1 -0
- package/dist/config-DXhifxOw.mjs +3 -0
- package/dist/doc-cache-CamtXfi4.mjs +1035 -0
- package/dist/doc-cache-CamtXfi4.mjs.map +1 -0
- package/dist/doc-cache-CiBwpDTf.mjs +3 -0
- package/dist/doc-fork-BMjqzfAs.mjs +3 -0
- package/dist/doc-fork-CoPi1G1N.mjs +304 -0
- package/dist/doc-fork-CoPi1G1N.mjs.map +1 -0
- package/dist/docref-C7g0sjvL.mjs +167 -0
- package/dist/docref-C7g0sjvL.mjs.map +1 -0
- package/dist/docs/README.md +38 -6
- package/dist/docs/SKILL.md +21 -5
- package/dist/docs/guidelines/backward-compatibility-rules.md +1 -0
- package/dist/docs/guidelines/bun-monorepo-patterns.md +1 -0
- package/dist/docs/guidelines/cli-agent-skill-patterns.md +228 -52
- package/dist/docs/guidelines/commit-conventions.md +1 -0
- package/dist/docs/guidelines/common-doc-guidelines.md +1 -0
- package/dist/docs/guidelines/convex-limits-best-practices.md +1 -0
- package/dist/docs/guidelines/convex-rules.md +1 -0
- package/dist/docs/guidelines/electron-app-development-patterns.md +1 -0
- package/dist/docs/guidelines/error-handling-rules.md +4 -0
- package/dist/docs/guidelines/general-coding-rules.md +3 -1
- package/dist/docs/guidelines/general-comment-rules.md +3 -1
- package/dist/docs/guidelines/general-eng-agent-principles.md +127 -0
- package/dist/docs/guidelines/general-tdd-guidelines.md +7 -0
- package/dist/docs/guidelines/general-testing-rules.md +5 -0
- package/dist/docs/guidelines/golden-testing-guidelines.md +1 -0
- package/dist/docs/guidelines/pnpm-monorepo-patterns.md +1 -0
- package/dist/docs/guidelines/python-cli-patterns.md +5 -0
- package/dist/docs/guidelines/python-modern-guidelines.md +4 -0
- package/dist/docs/guidelines/python-rules.md +7 -0
- package/dist/docs/guidelines/release-notes-guidelines.md +1 -0
- package/dist/docs/guidelines/supply-chain-hardening.md +3 -2
- package/dist/docs/guidelines/tbd-sync-troubleshooting.md +25 -2
- package/dist/docs/guidelines/typescript-cli-tool-rules.md +4 -3
- package/dist/docs/guidelines/typescript-code-coverage.md +7 -4
- package/dist/docs/guidelines/typescript-rules.md +8 -9
- package/dist/docs/guidelines/typescript-sorting-patterns.md +2 -1
- package/dist/docs/guidelines/typescript-yaml-handling-rules.md +6 -5
- package/dist/docs/references/docmap-format.md +64 -0
- package/dist/docs/references/docref-format.md +71 -0
- package/dist/docs/shortcuts/standard/checkout-third-party-repo.md +17 -4
- package/dist/docs/shortcuts/standard/new-shortcut.md +17 -3
- package/dist/docs/shortcuts/standard/plan-implementation-with-beads.md +1 -1
- package/dist/docs/shortcuts/standard/setup-github-cli.md +4 -1
- package/dist/docs/shortcuts/standard/suggest-upstream-improvements.md +69 -0
- package/dist/docs/shortcuts/standard/sync-failure-recovery.md +1 -1
- package/dist/docs/shortcuts/standard/welcome-user.md +28 -0
- package/dist/docs/shortcuts/system/shortcut-explanation.md +16 -1
- package/dist/docs/shortcuts/system/skill-baseline.md +21 -5
- package/dist/docs/tbd-design.md +144 -3
- package/dist/docs/tbd-docs.md +169 -5
- package/dist/docs/tbd-prime.md +0 -1
- package/dist/docs/templates/qa-playbook.md +3 -1
- package/dist/docs/templates/research-brief.md +2 -2
- package/dist/fork-manifest-ByU7U2do.mjs +253 -0
- package/dist/fork-manifest-ByU7U2do.mjs.map +1 -0
- package/dist/fork-manifest-C7lGRq-6.mjs +3 -0
- package/dist/{id-mapping-mtoSP9Qt.mjs → id-mapping-D0iitY-F.mjs} +1 -1
- package/dist/{id-mapping-687_UEsy.mjs → id-mapping-DAIeLKzm.mjs} +8 -200
- package/dist/id-mapping-DAIeLKzm.mjs.map +1 -0
- package/dist/index.d.mts +90 -13
- package/dist/index.mjs +3 -3
- package/dist/lockfile-BR0laSDy.mjs +198 -0
- package/dist/lockfile-BR0laSDy.mjs.map +1 -0
- package/dist/paths-C1DpnZJW.mjs +405 -0
- package/dist/paths-C1DpnZJW.mjs.map +1 -0
- package/dist/{schemas-f0EcuAVu.mjs → schemas-lCwRk30L.mjs} +19 -6
- package/dist/schemas-lCwRk30L.mjs.map +1 -0
- package/dist/{src-BpvcrLnq.mjs → src-CxKOynr1.mjs} +3 -3
- package/dist/src-CxKOynr1.mjs.map +1 -0
- package/dist/tbd +4036 -1074
- package/dist/yaml-utils-BPy991by.mjs.map +1 -1
- package/package.json +1 -1
- package/dist/config-BJz1m9eN.mjs.map +0 -1
- package/dist/config-DlCUMyCG.mjs +0 -3
- package/dist/docs/guidelines/general-eng-assistant-rules.md +0 -59
- package/dist/id-mapping-687_UEsy.mjs.map +0 -1
- package/dist/schemas-f0EcuAVu.mjs.map +0 -1
- package/dist/src-BpvcrLnq.mjs.map +0 -1
|
@@ -53,6 +53,20 @@ Examples: `code-review-and-commit`, `new-plan-spec`, `review-code-typescript`
|
|
|
53
53
|
- **Reference, don’t duplicate**: Point to `tbd shortcut/guidelines/template` commands
|
|
54
54
|
- **Trust the agent**: They’ll adapt to context
|
|
55
55
|
|
|
56
|
+
## Referencing Other Shortcuts
|
|
57
|
+
|
|
58
|
+
Refer to other shortcuts, guidelines, and templates by **name**, using the command that
|
|
59
|
+
surfaces them, never by file path:
|
|
60
|
+
|
|
61
|
+
- Another shortcut: `tbd shortcut <name>` (e.g. `tbd shortcut precommit-process`)
|
|
62
|
+
- A guideline: `tbd guidelines <name>` (e.g. `tbd guidelines typescript-rules`)
|
|
63
|
+
- A template: `tbd template <name>` (e.g. `tbd template plan-spec`)
|
|
64
|
+
|
|
65
|
+
The name stays valid wherever the file ends up: read directly, served via
|
|
66
|
+
`tbd shortcut`, or embedded in another tool.
|
|
67
|
+
File paths and relative markdown links break when shortcuts are flattened into the
|
|
68
|
+
`.tbd` cache or relocated, so don’t use them to point at other shortcuts.
|
|
69
|
+
|
|
56
70
|
## Testing
|
|
57
71
|
|
|
58
72
|
```bash
|
|
@@ -66,10 +80,10 @@ For official shortcuts: `pnpm build` in packages/tbd/
|
|
|
66
80
|
|
|
67
81
|
For official shortcuts added to `packages/tbd/docs/shortcuts/standard/`:
|
|
68
82
|
|
|
69
|
-
1. **Update root README.md
|
|
83
|
+
1. **Update root README.md:** Add to the “Available shortcuts” table (grouped by
|
|
70
84
|
category: Planning, Documentation, Review, Git, Cleanup, Session, Meta)
|
|
71
|
-
2. **Sync docs cache
|
|
72
|
-
3. **Rebuild
|
|
85
|
+
2. **Sync docs cache:** Run `tbd setup --auto` to update `.tbd/docs/`
|
|
86
|
+
3. **Rebuild:** `pnpm build` in packages/tbd/ (also copies README to package)
|
|
73
87
|
|
|
74
88
|
## Shortcuts vs Guidelines
|
|
75
89
|
|
|
@@ -48,7 +48,7 @@ If unclear, ask the user if they want you to create a spec first using
|
|
|
48
48
|
|
|
49
49
|
- **Parent/Child** (`--parent`): Hierarchical grouping.
|
|
50
50
|
All implementation beads should be children of the epic.
|
|
51
|
-
Children inherit context from their parent
|
|
51
|
+
Children inherit context from their parent; `tbd show` auto-displays the parent’s
|
|
52
52
|
details, so child descriptions don’t need to duplicate the parent’s context.
|
|
53
53
|
|
|
54
54
|
- **Blocker** (`tbd dep add`): Sequential ordering.
|
|
@@ -64,7 +64,10 @@ If this fails for any reason, follow the steps below.
|
|
|
64
64
|
|
|
65
65
|
Set `GH_TOKEN` environment variable with a GitHub personal access token **before**
|
|
66
66
|
starting the session.
|
|
67
|
-
|
|
67
|
+
Create a [Personal Access Token](https://github.com/settings/tokens?type=beta)
|
|
68
|
+
(fine-grained recommended) with **Contents** and **Pull requests** read/write
|
|
69
|
+
permissions, then export it (e.g. add `export GH_TOKEN=...` to your shell profile or set
|
|
70
|
+
it in your agent environment).
|
|
68
71
|
|
|
69
72
|
## Quick Reference
|
|
70
73
|
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: Suggest Upstream Improvements
|
|
3
|
+
description: Review local doc-fork customizations and contribute the generally useful changes back upstream
|
|
4
|
+
category: meta
|
|
5
|
+
author: Joshua Levy (github.com/jlevy) with LLM assistance
|
|
6
|
+
---
|
|
7
|
+
This shortcut reviews the docs this project has forked and customized (in `docs/tbd/`),
|
|
8
|
+
decides which changes generalize beyond this project, and proposes them upstream, to the
|
|
9
|
+
tbd repo for tbd’s bundled docs, or to your org’s docs repo for docs added by URL.
|
|
10
|
+
|
|
11
|
+
## When to Use
|
|
12
|
+
|
|
13
|
+
- Forked guidelines or shortcuts have accumulated edits that would help other projects.
|
|
14
|
+
- Before unforking: upstream the good parts first, so nothing is lost when the fork goes
|
|
15
|
+
away.
|
|
16
|
+
- After `tbd docs update` keeps producing the same conflict because upstream lacks an
|
|
17
|
+
improvement you made locally.
|
|
18
|
+
|
|
19
|
+
## Instructions
|
|
20
|
+
|
|
21
|
+
Create a to-do list with the following items then perform all of them:
|
|
22
|
+
|
|
23
|
+
1. **Collect customizations**: Run `tbd docs status --json` and collect every doc in
|
|
24
|
+
`customized` state (including customized docs that also have upstream updates
|
|
25
|
+
pending).
|
|
26
|
+
|
|
27
|
+
2. **Review each diff**: For each doc, run `tbd docs diff <name> --base` (your file vs
|
|
28
|
+
its recorded base, exactly what this project changed).
|
|
29
|
+
Classify each hunk:
|
|
30
|
+
- **Generally applicable**: fixes, clarifications, better examples, rules any project
|
|
31
|
+
would benefit from. Candidates for upstreaming.
|
|
32
|
+
- **Project-specific**: team conventions, internal links, stack-specific overrides.
|
|
33
|
+
These stay in the fork; do not propose them.
|
|
34
|
+
|
|
35
|
+
3. **Identify the upstream target** for each doc with generalizable hunks:
|
|
36
|
+
- Bundled docs (manifest `source` starts with `internal:`): the tbd repo
|
|
37
|
+
(`jlevy/tbd`), where doc sources live under `packages/tbd/docs/`.
|
|
38
|
+
- URL-added docs: the repo their docref points at (for example, your org’s shared
|
|
39
|
+
docs repo).
|
|
40
|
+
|
|
41
|
+
4. **Draft the proposal**: For each doc, draft an issue or PR body containing:
|
|
42
|
+
- Which doc (name and kind) and why the change is generally useful.
|
|
43
|
+
- Only the generalizable diff hunks, in fenced code blocks.
|
|
44
|
+
- Brief project context: what prompted the change here.
|
|
45
|
+
|
|
46
|
+
5. **Confirm, then file**: Show the draft to the user and get confirmation.
|
|
47
|
+
Then:
|
|
48
|
+
- Issue: `gh issue create -R jlevy/tbd` (or the org’s repo) with the drafted body.
|
|
49
|
+
- PR (preferred when the change is small and ready): apply the generalizable hunks to
|
|
50
|
+
the upstream source file on a branch and open a PR with `gh pr create`.
|
|
51
|
+
|
|
52
|
+
6. **Close the loop (after upstream merges)**: Once the change ships upstream and tbd is
|
|
53
|
+
upgraded, run `tbd docs update`. If upstream adopted the customization, the merge
|
|
54
|
+
converges and the doc returns to unmodified `forked` state, then a plain
|
|
55
|
+
`tbd docs unfork <name>` (no `--force` needed) completes the cleanup, or keep the
|
|
56
|
+
fork for future edits.
|
|
57
|
+
|
|
58
|
+
## Notes
|
|
59
|
+
|
|
60
|
+
- Only propose hunks you would accept as a maintainer: each should stand alone, with
|
|
61
|
+
rationale.
|
|
62
|
+
- Never file an issue or PR without showing the user the draft first.
|
|
63
|
+
- Diff views: `tbd docs diff <name>` (no flag) compares your copy against current
|
|
64
|
+
upstream; `--base` is the right view for “what did we change”; `--upstream` shows
|
|
65
|
+
incoming upstream changes.
|
|
66
|
+
|
|
67
|
+
<!-- This document follows common-doc-guidelines.md.
|
|
68
|
+
See github.com/jlevy/practical-prose and review guidelines before editing.
|
|
69
|
+
-->
|
|
@@ -31,7 +31,7 @@ git commit -m "tbd: save outbox"
|
|
|
31
31
|
git push
|
|
32
32
|
```
|
|
33
33
|
|
|
34
|
-
**Note:** Do not gitignore `.tbd/workspaces
|
|
34
|
+
**Note:** Do not gitignore `.tbd/workspaces/`; it must be committed to your working
|
|
35
35
|
branch.
|
|
36
36
|
|
|
37
37
|
## Later, When Sync Works
|
|
@@ -13,6 +13,33 @@ project.
|
|
|
13
13
|
First, run `tbd status` to check the current state.
|
|
14
14
|
Give a brief summary of the status (repository, sync status, integrations).
|
|
15
15
|
|
|
16
|
+
Then make the two-axis guidelines offer, one short question per axis:
|
|
17
|
+
|
|
18
|
+
1. **Scope:** keep **all** standard guidelines active (recommended), or just a subset
|
|
19
|
+
for this project’s languages and stack?
|
|
20
|
+
Give a few examples of what the standard set covers, such as Python guidelines,
|
|
21
|
+
TypeScript guidelines, documentation guidelines, testing guidelines, and commit
|
|
22
|
+
conventions. Note that `tbd guidelines --list` shows the full set.
|
|
23
|
+
2. **Visibility:** leave them in tbd’s hidden cache (the default, which just works), or
|
|
24
|
+
fork them into `docs/tbd/` so they are visible on GitHub, reviewable in PRs, and
|
|
25
|
+
editable (checked into git)?
|
|
26
|
+
|
|
27
|
+
When explaining visibility, give this guidance: for small repos or quick work, you
|
|
28
|
+
usually don’t want to fork.
|
|
29
|
+
Leaving the docs in tbd’s hidden cache is the simplest start and just works.
|
|
30
|
+
For larger projects with a lot of customization, forking can make sense: it gives you
|
|
31
|
+
maximum control to adapt, improve, and customize every guideline.
|
|
32
|
+
Either way the choice is reversible: you can tell tbd you want to fork the docs later,
|
|
33
|
+
so starting with the hidden cache loses nothing.
|
|
34
|
+
|
|
35
|
+
Explain that forking changes nothing about how guidelines work.
|
|
36
|
+
Both paths serve the same guidelines; forking only makes them visible and customizable.
|
|
37
|
+
If the user wants visible docs, the recommendation is to fork the general guidelines
|
|
38
|
+
plus the categories for the project’s languages and frameworks:
|
|
39
|
+
`tbd docs fork --category=general --category=<language>` (e.g. `--category=typescript`).
|
|
40
|
+
Use `tbd docs fork --all` for everything, or `tbd docs fork <name> [<name>...]` to fork
|
|
41
|
+
individual docs by name (preview with `--dry-run` first).
|
|
42
|
+
|
|
16
43
|
Then show the welcome message:
|
|
17
44
|
|
|
18
45
|
* * *
|
|
@@ -50,6 +77,7 @@ Here are examples of things you can say and what happens:
|
|
|
50
77
|
| “I’m building a TypeScript CLI” | Applies TypeScript CLI guidelines |
|
|
51
78
|
| “Help me set up better testing” | Applies testing guidelines |
|
|
52
79
|
| “What are the Python best practices?” | Applies Python guidelines |
|
|
80
|
+
| “Make the guidelines visible in my repo” | Forks them into `docs/tbd/` (`tbd docs fork --category=general --category=<lang>`, or `tbd docs fork --all`) |
|
|
53
81
|
|
|
54
82
|
**Tips:**
|
|
55
83
|
|
|
@@ -24,6 +24,20 @@ These may include:
|
|
|
24
24
|
- File operations and git workflows
|
|
25
25
|
- Prompts for gathering information from the user
|
|
26
26
|
|
|
27
|
+
## Referencing Other Shortcuts, Guidelines, and Templates
|
|
28
|
+
|
|
29
|
+
Shortcuts refer to each other by **name**, using the command that surfaces them:
|
|
30
|
+
|
|
31
|
+
- Another shortcut: `tbd shortcut <name>` (e.g. `tbd shortcut precommit-process`)
|
|
32
|
+
- A guideline: `tbd guidelines <name>` (e.g. `tbd guidelines typescript-rules`)
|
|
33
|
+
- A template: `tbd template <name>` (e.g. `tbd template plan-spec`)
|
|
34
|
+
|
|
35
|
+
Always reference by name, never by file path.
|
|
36
|
+
The name is stable wherever the shortcut lives, so the reference stays valid whether the
|
|
37
|
+
file is read directly, served via `tbd shortcut`, or embedded in another tool.
|
|
38
|
+
File paths (and relative markdown links) break when shortcuts are flattened into the
|
|
39
|
+
`.tbd` cache or relocated, so avoid them inside shortcut bodies.
|
|
40
|
+
|
|
27
41
|
## Example Workflow
|
|
28
42
|
|
|
29
43
|
User: “I want to create a new research brief”
|
|
@@ -37,7 +51,8 @@ Agent:
|
|
|
37
51
|
|
|
38
52
|
Shortcuts are loaded from directories in the doc path (searched in order):
|
|
39
53
|
|
|
40
|
-
- `.tbd/docs/shortcuts/system/` - Core system docs (skill
|
|
54
|
+
- `.tbd/docs/shortcuts/system/` - Core system docs (skill-baseline,
|
|
55
|
+
shortcut-explanation, etc.)
|
|
41
56
|
- `.tbd/docs/shortcuts/standard/` - Standard workflow shortcuts
|
|
42
57
|
|
|
43
58
|
Directories earlier in the doc path take precedence.
|
|
@@ -9,7 +9,7 @@ description: Full tbd workflow guide for agents
|
|
|
9
9
|
Drop-in replacement for `bd`.
|
|
10
10
|
2. **Spec-Driven Workflows**: Plan features → break into beads → implement
|
|
11
11
|
systematically.
|
|
12
|
-
3. **Knowledge Injection**:
|
|
12
|
+
3. **Knowledge Injection**: 25+ engineering guidelines (TypeScript, Python, TDD,
|
|
13
13
|
testing, Convex, monorepos) available on demand.
|
|
14
14
|
4. **Shortcuts**: Reusable instruction templates for common workflows (code review,
|
|
15
15
|
commits, PRs, cleanup, handoffs).
|
|
@@ -17,12 +17,15 @@ description: Full tbd workflow guide for agents
|
|
|
17
17
|
## Installation
|
|
18
18
|
|
|
19
19
|
```bash
|
|
20
|
-
npm install -g get-tbd@latest
|
|
20
|
+
npm install -g get-tbd@latest # Install or upgrade the CLI (same command for both)
|
|
21
21
|
tbd setup --auto --prefix=<name> # Fresh project (--prefix is REQUIRED: 2-8 alphabetic chars recommended. ALWAYS ASK THE USER FOR THE PREFIX; do not guess it)
|
|
22
|
-
tbd setup --auto # Existing tbd project (
|
|
22
|
+
tbd setup --auto # Existing tbd project — also the upgrade step (applies any format migration; commit the diff it reports)
|
|
23
23
|
tbd setup --from-beads # Migration from .beads/ if `bd` has been used
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
If tbd refuses with “This repository requires a newer version of tbd”, run the two
|
|
27
|
+
install/upgrade commands above.
|
|
28
|
+
|
|
26
29
|
## Routine Commands
|
|
27
30
|
|
|
28
31
|
```bash
|
|
@@ -34,7 +37,7 @@ tbd setup --auto # Run any time to refresh setup
|
|
|
34
37
|
tbd prime # Restore full context on tbd after compaction
|
|
35
38
|
```
|
|
36
39
|
|
|
37
|
-
## CRITICAL: You Operate tbd
|
|
40
|
+
## CRITICAL: You Operate tbd, the User Doesn’t
|
|
38
41
|
|
|
39
42
|
**You are the tbd operator:** Users talk naturally; you translate their requests to tbd
|
|
40
43
|
actions. DO NOT tell users to run tbd commands.
|
|
@@ -71,6 +74,7 @@ or want help → run `tbd shortcut welcome-user`
|
|
|
71
74
|
| “Create a PR” / “File a PR” | `tbd shortcut create-or-update-pr-simple` |
|
|
72
75
|
| “Merge main into my branch” | `tbd shortcut merge-upstream` |
|
|
73
76
|
| **Guidelines & Knowledge** | |
|
|
77
|
+
| *(any engineering work)* | Load the **General engineering** group first (see below) |
|
|
74
78
|
| “Use TypeScript best practices” | `tbd guidelines typescript-rules` |
|
|
75
79
|
| “Use Python best practices” | `tbd guidelines python-rules` |
|
|
76
80
|
| “Build a TypeScript CLI” | `tbd guidelines typescript-cli-tool-rules` |
|
|
@@ -81,6 +85,10 @@ or want help → run `tbd shortcut welcome-user`
|
|
|
81
85
|
| **Documentation** | |
|
|
82
86
|
| “Research this topic” | `tbd shortcut new-research-brief` |
|
|
83
87
|
| “Document architecture” | `tbd shortcut new-architecture-doc` |
|
|
88
|
+
| “What guidelines/docs are there?” | `tbd docs list` |
|
|
89
|
+
| “Make the guidelines visible / customize doc X” | `tbd docs fork --category=general --category=<lang>` (recommended: general + the repo’s languages), or `tbd docs fork <name>` / `--all`; then edit in `docs/tbd/` |
|
|
90
|
+
| “Update the guidelines to the latest” | `tbd docs update`; on conflicts ask the user, then `--merge` or `--keep-ours` |
|
|
91
|
+
| “I deleted a forked doc file” | `tbd docs status` shows it `missing`; restore with `tbd docs fork <name> --force` or finalize with `tbd docs unfork <name>` |
|
|
84
92
|
| **Cleanup & Maintenance** | |
|
|
85
93
|
| “Clean up this code” / “Remove dead code” | `tbd shortcut code-cleanup-all` |
|
|
86
94
|
| “Fix repository problems” | `tbd doctor --fix` |
|
|
@@ -89,7 +97,13 @@ or want help → run `tbd shortcut welcome-user`
|
|
|
89
97
|
| “Check out this library’s source” | `tbd shortcut checkout-third-party-repo` |
|
|
90
98
|
| *(your choice whenever appropriate)* | `tbd list`, `tbd dep add`, `tbd close`, `tbd sync`, etc. |
|
|
91
99
|
|
|
92
|
-
**
|
|
100
|
+
**Loading guidelines for engineering work:** Before writing or reviewing code, load the
|
|
101
|
+
**General engineering** group—the `general-*` rules plus `error-handling-rules`—since
|
|
102
|
+
these apply to all code regardless of language.
|
|
103
|
+
Then load the group for the language or framework in use (TypeScript, Python, Convex,
|
|
104
|
+
etc.). Run `tbd guidelines --list` to see all available guidelines.
|
|
105
|
+
|
|
106
|
+
**Note:** Never gitignore `.tbd/workspaces/`; the outbox must be committed to your
|
|
93
107
|
working branch. See `tbd guidelines tbd-sync-troubleshooting` for details.
|
|
94
108
|
|
|
95
109
|
## CRITICAL: Session Closing Protocol
|
|
@@ -164,6 +178,8 @@ working branch. See `tbd guidelines tbd-sync-troubleshooting` for details.
|
|
|
164
178
|
| `tbd guidelines <name>` | Load coding guidelines |
|
|
165
179
|
| `tbd guidelines --list` | List guidelines |
|
|
166
180
|
| `tbd template <name>` | Output a template |
|
|
181
|
+
| `tbd docs` / `tbd docs list` | Managed-docs overview / cross-kind list with state markers |
|
|
182
|
+
| `tbd docs fork/unfork/update <name>` | Fork docs into `docs/tbd/`, return to upstream, pull upstream updates |
|
|
167
183
|
|
|
168
184
|
## Quick Reference
|
|
169
185
|
|
package/dist/docs/tbd-design.md
CHANGED
|
@@ -18,8 +18,7 @@ agents.
|
|
|
18
18
|
- [1. Introduction](#1-introduction)
|
|
19
19
|
- [1.1 What is tbd?](#11-what-is-tbd)
|
|
20
20
|
- [1.2 When to Use tbd vs Beads](#12-when-to-use-tbd-vs-beads)
|
|
21
|
-
- [1.3 Why Replace Beads?
|
|
22
|
-
(Architecture Comparison)](#13-why-replace-beads-architecture-comparison)
|
|
21
|
+
- [1.3 Why Replace Beads? (Architecture Comparison)](#13-why-replace-beads-architecture-comparison)
|
|
23
22
|
- [1.4 Design Goals](#14-design-goals)
|
|
24
23
|
- [1.5 Design Principles](#15-design-principles)
|
|
25
24
|
- [1.6 Non-Goals](#16-non-goals)
|
|
@@ -72,6 +71,7 @@ agents.
|
|
|
72
71
|
- [2.8.5 Comparison with Beads](#285-comparison-with-beads)
|
|
73
72
|
- [2.8.6 Future Dependency Types](#286-future-dependency-types)
|
|
74
73
|
- [2.8.7 Future: Transitive Blocking Option](#287-future-transitive-blocking-option)
|
|
74
|
+
- [2.9 Managed Docs: Copies, Forks, and Synchronization](#29-managed-docs-copies-forks-and-synchronization)
|
|
75
75
|
- [3. Git Layer](#3-git-layer)
|
|
76
76
|
- [3.1 Overview](#31-overview)
|
|
77
77
|
- [3.2 Sync Branch Architecture](#32-sync-branch-architecture)
|
|
@@ -120,6 +120,7 @@ agents.
|
|
|
120
120
|
- [4.10 Global Options](#410-global-options)
|
|
121
121
|
- [4.11 Attic Commands](#411-attic-commands)
|
|
122
122
|
- [4.12 Output Formats](#412-output-formats)
|
|
123
|
+
- [4.13 Docs Commands](#413-docs-commands)
|
|
123
124
|
- [5. Beads Compatibility](#5-beads-compatibility)
|
|
124
125
|
- [5.1 Import Strategy](#51-import-strategy)
|
|
125
126
|
- [5.1.1 Import Command](#511-import-command)
|
|
@@ -659,6 +660,7 @@ serialization:
|
|
|
659
660
|
> directory.
|
|
660
661
|
|
|
661
662
|
> **Why canonical format?** Deterministic serialization ensures:
|
|
663
|
+
>
|
|
662
664
|
> 1. Git diffs show only actual content changes (no spurious whitespace/ordering noise)
|
|
663
665
|
> 2. Testing is reliable (same input produces same output)
|
|
664
666
|
> 3. Future caching/deduplication can use content hashes if needed
|
|
@@ -1968,6 +1970,107 @@ Add transitive blocking as an opt-in feature if users request it after real-worl
|
|
|
1968
1970
|
|
|
1969
1971
|
* * *
|
|
1970
1972
|
|
|
1973
|
+
### 2.9 Managed Docs: Copies, Forks, and Synchronization
|
|
1974
|
+
|
|
1975
|
+
tbd manages documentation (guidelines, shortcuts, templates) alongside issues.
|
|
1976
|
+
With forkable docs (format f05, `plan-2026-06-11-forkable-docs.md`), a doc can exist as
|
|
1977
|
+
up to **four copies plus a manifest**, each with a distinct owner and lifecycle.
|
|
1978
|
+
This section is the canonical statement of that model and the invariants that make every
|
|
1979
|
+
combination of user actions safe.
|
|
1980
|
+
|
|
1981
|
+
#### The copies
|
|
1982
|
+
|
|
1983
|
+
| Copy | Location | In git? | Written by | Role |
|
|
1984
|
+
| --- | --- | --- | --- | --- |
|
|
1985
|
+
| Bundled | npm package (`dist/docs/`) | n/a (per tbd version) | tbd releases | The upstream for `internal:` docs; immutable per installed version |
|
|
1986
|
+
| Cache | `.tbd/docs/` | gitignored | doc sync only | Complete, pristine, machine-local mirror of all upstream docs (bundled + URL sources); disposable |
|
|
1987
|
+
| Fork | `docs/tbd/<kind>/<name>.md` | tracked | `tbd docs fork/update` + the user/agent | The editable copy that tbd serves; optional, per-doc |
|
|
1988
|
+
| Base | `.tbd/doc-forks/base/<kind>/<name>.md` | tracked | `tbd docs fork/update` | Verbatim upstream snapshot at the fork point; the three-way merge base |
|
|
1989
|
+
| Manifest | `.tbd/doc-forks/forks.yml` | tracked | `tbd docs fork/unfork/update` | Provenance per fork: source docref, `base_hash` (LF-normalized sha256), `tbd_version` at fork point, `conflicted` flag |
|
|
1990
|
+
|
|
1991
|
+
A doc’s identity is **kind + name**; paths follow fixed conventions
|
|
1992
|
+
(`<kind-dir>/<name>.md`, flat; nested folders are not scanned).
|
|
1993
|
+
|
|
1994
|
+
The model follows one principle: **resolve by convention; track only what cannot be
|
|
1995
|
+
derived; publish the inventory as a generated view.** Lookup is a fixed search path over
|
|
1996
|
+
conventional locations; no registry that can drift from disk.
|
|
1997
|
+
The only stored tracking is the fork manifest, which records the one fact that cannot be
|
|
1998
|
+
recomputed from the files: each fork’s upstream source and base snapshot.
|
|
1999
|
+
The docmap that doc commands emit is a generated view of this state, never an input to
|
|
2000
|
+
resolution. (A copy-all-and-gitignore variant of the fork dir was considered and
|
|
2001
|
+
rejected: gitignored mirrors are invisible on GitHub and in PRs, and edits to them
|
|
2002
|
+
diverge silently with no team-visible artifact; `tbd docs fork --all` provides the
|
|
2003
|
+
all-visible posture in tracked form.
|
|
2004
|
+
See the spec’s Alternatives.)
|
|
2005
|
+
|
|
2006
|
+
#### Invariants
|
|
2007
|
+
|
|
2008
|
+
1. **Serving precedence**: the fork dir is prepended to every kind’s lookup path, so a
|
|
2009
|
+
forked (or hand-authored local) file shadows the cache copy by name.
|
|
2010
|
+
With nothing forked, lookup paths reduce to the cache and behavior is byte-identical
|
|
2011
|
+
to pre-f05.
|
|
2012
|
+
2. **Cache completeness**: doc sync always installs *all* upstream docs into the cache,
|
|
2013
|
+
including forked ones.
|
|
2014
|
+
The cache copy is the pristine reference: the staleness comparator, the “theirs” side
|
|
2015
|
+
of every update merge, and the fallback after unfork.
|
|
2016
|
+
3. **The cache is never authored**: only doc sync writes it, nothing else reads from
|
|
2017
|
+
anywhere else for upstream content, and deleting it is always safe (auto-sync
|
|
2018
|
+
regenerates it on the next doc access, including on fresh clones).
|
|
2019
|
+
4. **Tracked files mutate only via explicit `tbd docs` verbs** (fork/unfork/update).
|
|
2020
|
+
Setup, `tbd sync`, and background auto-sync refresh the cache and *report* drift but
|
|
2021
|
+
never write the fork dir, bases, or manifest.
|
|
2022
|
+
5. **Tracking is derived, not stored**: every doc state
|
|
2023
|
+
(`upstream/forked/customized/stale/conflicted/local/missing/orphaned`) is a pure
|
|
2024
|
+
function of (manifest entry present?, file hash, base hash, cache hash, conflicted
|
|
2025
|
+
flag, markers present).
|
|
2026
|
+
There is no hidden database, so no sequence of git operations (commit, pull, merge,
|
|
2027
|
+
revert, partial commits) can desynchronize tbd from the files: collaborators
|
|
2028
|
+
recompute identical states from identical content.
|
|
2029
|
+
6. **The base is the fork point**: advanced only by fork (refresh) and update; with the
|
|
2030
|
+
stored snapshot, `customized` (file ≠ base), `stale` (cache ≠ base), and three-way
|
|
2031
|
+
merging are exact, offline operations for every collaborator regardless of which tbd
|
|
2032
|
+
version created the fork.
|
|
2033
|
+
7. **The format gate**: forking bumps nothing at runtime, but the f05 `tbd_format` in
|
|
2034
|
+
`config.yml` (mirrored into the machine-local common-dir `layout.yml`) makes pre-f05
|
|
2035
|
+
clients refuse the repo; they would otherwise serve upstream copies of docs the team
|
|
2036
|
+
has customized. Within the f05 era, the manifest’s per-entry `tbd_version` guards the
|
|
2037
|
+
remaining skew: `tbd docs update` refuses to touch a doc whose fork point was
|
|
2038
|
+
advanced by a newer tbd than the one running, since that client’s bundled “upstream”
|
|
2039
|
+
is older than the fork point and updating would silently downgrade the doc.
|
|
2040
|
+
|
|
2041
|
+
#### Who writes what (synchronization flows)
|
|
2042
|
+
|
|
2043
|
+
| Flow | Reads | Writes | Tracked files touched |
|
|
2044
|
+
| --- | --- | --- | --- |
|
|
2045
|
+
| npm upgrade | — | bundle | none |
|
|
2046
|
+
| Doc sync (`tbd sync --docs`, auto-sync, setup) | bundle + URL sources | cache | none |
|
|
2047
|
+
| `tbd docs fork` | cache | fork file, base, manifest, fork-dir README | yes (explicit) |
|
|
2048
|
+
| `tbd docs update` | cache, base, fork file | fork file and/or base, manifest, README | yes (explicit) |
|
|
2049
|
+
| `tbd docs unfork` | base, fork file | removes fork artifacts, README | yes (explicit) |
|
|
2050
|
+
| User/agent edits | — | fork dir (any way they like) | yes (theirs) |
|
|
2051
|
+
| git operations | — | any tracked artifact | yes (theirs) |
|
|
2052
|
+
|
|
2053
|
+
Staleness appears exactly when doc sync moves the cache past a fork’s base; awareness
|
|
2054
|
+
surfaces (`tbd docs status`, the one-line `tbd sync` drift notice) report it, and only
|
|
2055
|
+
the explicit `tbd docs update` acts on it.
|
|
2056
|
+
|
|
2057
|
+
#### Drift and degraded modes
|
|
2058
|
+
|
|
2059
|
+
Because of invariant 5, arbitrary user actions in the fork dir resolve to defined
|
|
2060
|
+
states: edits → `customized`; deletion → `missing` (serving falls back to the cache);
|
|
2061
|
+
rename → `missing` + `local`; new files → `local` (served, no upstream); deleting the
|
|
2062
|
+
manifest → everything `local` (serving unaffected); moving into subfolders → not scanned
|
|
2063
|
+
(documented). Degraded modes fail soft: an unreachable URL source keeps serving the
|
|
2064
|
+
last-good cache copy; an empty cache self-heals via auto-sync; a deleted base blocks
|
|
2065
|
+
merging only for that doc (repairable via `update --keep-ours`); the upgrade abort path
|
|
2066
|
+
is specified in `tbd-docs.md` §Troubleshooting.
|
|
2067
|
+
The drift matrix with resolutions is user-facing in `tbd-docs.md` §“Forked Docs in Your
|
|
2068
|
+
Repo”; the state matrix, update decision table, and drift scenarios are pinned by
|
|
2069
|
+
`fork-manifest`/`fork-update`/`doc-fork` unit tests and the `cli-docs-fork`/
|
|
2070
|
+
`cli-docs-update` golden tryscripts.
|
|
2071
|
+
|
|
2072
|
+
* * *
|
|
2073
|
+
|
|
1971
2074
|
## 3. Git Layer
|
|
1972
2075
|
|
|
1973
2076
|
### 3.1 Overview
|
|
@@ -2034,6 +2137,8 @@ main branch: tbd-sync branch:
|
|
|
2034
2137
|
.tbd/.gitignore # Controls what's gitignored below
|
|
2035
2138
|
.tbd/.gitattributes # Merge strategies (merge=union for ids.yml)
|
|
2036
2139
|
.tbd/workspaces/ # Persistent state (outbox, named workspaces)
|
|
2140
|
+
.tbd/doc-forks/ # Fork manifest + base snapshots (see §2.9; f05+)
|
|
2141
|
+
docs/tbd/ # Forked docs, outside .tbd/ (see §2.9; only when fork is used)
|
|
2037
2142
|
```
|
|
2038
2143
|
|
|
2039
2144
|
#### Files Gitignored (local only)
|
|
@@ -2290,7 +2395,7 @@ const issueMergeRules: MergeRules<Issue> = {
|
|
|
2290
2395
|
created_by: { strategy: 'preserve_oldest' },
|
|
2291
2396
|
closed_at: { strategy: 'lww' }, // See status/closed_at rules below
|
|
2292
2397
|
close_reason: { strategy: 'lww' },
|
|
2293
|
-
child_order_hints: { strategy: '
|
|
2398
|
+
child_order_hints: { strategy: 'union' }, // Append-only set of child IDs; union (dedupe)
|
|
2294
2399
|
};
|
|
2295
2400
|
```
|
|
2296
2401
|
|
|
@@ -3660,6 +3765,42 @@ tbd attic restore proj-a1b2 2025-01-07T10-30-00Z
|
|
|
3660
3765
|
|
|
3661
3766
|
* * *
|
|
3662
3767
|
|
|
3768
|
+
### 4.13 Docs Commands
|
|
3769
|
+
|
|
3770
|
+
Operations on managed docs (see §2.9 for the data model) live under the noun-scoped
|
|
3771
|
+
`tbd docs` group, alongside the existing per-kind readers (`tbd guidelines`,
|
|
3772
|
+
`tbd shortcut`, `tbd template`, which serve forked copies transparently via lookup
|
|
3773
|
+
precedence):
|
|
3774
|
+
|
|
3775
|
+
```bash
|
|
3776
|
+
tbd docs fork [names...] [--kind] [--all] [--force] [--dry-run] # copy into docs/tbd/
|
|
3777
|
+
tbd docs unfork [names...] [--all] [--force] # back to upstream; refuses to drop edits
|
|
3778
|
+
tbd docs status [--json] # per-doc states + missing/local hints
|
|
3779
|
+
tbd docs update [names...] [--merge|--keep-ours] [--dry-run] # reconcile with upstream
|
|
3780
|
+
tbd docs diff <name> [--base|--upstream] # net fork / your changes / incoming
|
|
3781
|
+
tbd docs list [--kind] [--json] # cross-kind list with state markers
|
|
3782
|
+
```
|
|
3783
|
+
|
|
3784
|
+
tbd has three deliberately separate update surfaces; they differ in scope, risk, and
|
|
3785
|
+
failure mode, and doc updates are the only one that can merge and mutate tracked files:
|
|
3786
|
+
|
|
3787
|
+
| Command | Scope | Touches | Modifies tracked files? |
|
|
3788
|
+
| --- | --- | --- | --- |
|
|
3789
|
+
| `tbd sync` | project data (issues) | sync worktree + `tbd-sync` branch; refreshes the doc cache and *reports* fork drift | never |
|
|
3790
|
+
| `tbd setup --auto` | installation + integrations | skills, hooks, settings, `AGENTS.md`; invokes a docs-cache sync | only generated integration files |
|
|
3791
|
+
| `tbd docs update` | forked docs | fork dir + bases + manifest (offline, against the cache) | **yes, the only doc command that does** |
|
|
3792
|
+
|
|
3793
|
+
Update semantics (the full decision table is unit-tested row by row): an unmodified
|
|
3794
|
+
stale fork is replaced; a customized stale fork gets a `git merge-file` three-way merge
|
|
3795
|
+
that applies automatically when clean; conflicts are skipped by default and listed with
|
|
3796
|
+
the two explicit strategies: `--merge` (combine, standard conflict markers, sets the
|
|
3797
|
+
`conflicted` flag until markers are resolved) and `--keep-ours` (keep the local content,
|
|
3798
|
+
advance the fork point).
|
|
3799
|
+
Forked files are git-tracked, so every applied update is reviewable in `git diff` and
|
|
3800
|
+
revertible; git is the undo.
|
|
3801
|
+
|
|
3802
|
+
* * *
|
|
3803
|
+
|
|
3663
3804
|
## 5. Beads Compatibility
|
|
3664
3805
|
|
|
3665
3806
|
### 5.1 Import Strategy
|