@sddio/cli 0.0.0-stage → 0.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,92 @@
1
+ # Reconciliation
2
+
3
+ Reconciliation keeps durable project knowledge consistent with implementation.
4
+
5
+ ## Trigger
6
+
7
+ - **Startup** — the commit check runs on every session, before any work.
8
+ - **After work** — after meaningful implementation changes.
9
+ - **Hook** — when a hook declared in `config.json` covers `knowledge.reconcile`.
10
+ - **Conflict** — when implementation and artifacts disagree.
11
+
12
+ ## Commit Check
13
+
14
+ Read `reconcileCursor` in `.sddio/context/config.json`, then resolve it with git.
15
+
16
+ - `HEAD` — `git rev-parse HEAD`
17
+ - Exists — `git cat-file -e <sha>^{commit}`
18
+ - Ancestor — `git merge-base --is-ancestor <sha> HEAD`
19
+
20
+ Evaluate in order; stop at the first match.
21
+
22
+ | State | Condition | Range |
23
+ | --------- | ------------------------------------------------ | ---------------- |
24
+ | current | `reconcileCursor.lastProcessedCommit` equals `HEAD` | none |
25
+ | ahead | it is an ancestor of `HEAD` | `last..HEAD` |
26
+ | rewritten | it exists, is not an ancestor | `last...HEAD` |
27
+ | lost | it is gone, `previousCommit` is an ancestor | `previous..HEAD` |
28
+ | unknown | `null`, absent, or unresolvable | current state |
29
+
30
+ - `current` — no reconciliation; continue with the request.
31
+ - `ahead` — reconcile only the new commits.
32
+ - `rewritten` — amended, rebased, or reset history; reconcile both sides.
33
+ - `lost` — the anchor survives but the tip does not; reconcile from the anchor.
34
+ - `unknown` — verify artifacts against the current implementation, not the whole repository.
35
+ - A shallow clone with a missing cursor commit is `unknown`, never `rewritten`.
36
+ - No git repository, or no git binary — skip the check, leave the cursor untouched.
37
+ - Report the state and the reconciled range; do not reconcile silently.
38
+
39
+ ## Cursor Update
40
+
41
+ After reconciliation completes:
42
+
43
+ 1. `reconcileCursor.previousCommit` ← `HEAD^`; `null` at a root commit.
44
+ 2. `reconcileCursor.lastProcessedCommit` ← `HEAD`.
45
+ 3. Preserve `schemaVersion` and `hooks`.
46
+ 4. Write nothing when the state was `current`.
47
+
48
+ - Write only after the artifacts are updated.
49
+ - Do not advance the cursor when reconciliation is skipped, partial, or abandoned.
50
+ - The cursor holds commits only; uncommitted work is re-examined on the next run.
51
+
52
+ ## Process
53
+
54
+ ```text
55
+ Observe
56
+ → Compare
57
+ → Identify affected artifacts
58
+ → Reconcile
59
+ → Advance cursor
60
+ ```
61
+
62
+ Check only affected:
63
+
64
+ - `SPEC`
65
+ - `ADR`
66
+ - `DISCUSSION`
67
+
68
+ Both sides of the range, by name:
69
+
70
+ ```bash
71
+ git diff --name-only <range>
72
+ ```
73
+
74
+ A changed file matters only if it is named by an entry body in `SPEC`, `ADR`, or `DISCUSSION`. A file no
75
+ entry names is not this layer's problem.
76
+
77
+ ## Rules
78
+
79
+ - Do not rescan unrelated project areas.
80
+ - Do not rewrite accurate artifacts.
81
+ - Do not create artifacts merely because implementation changed.
82
+ - Update the smallest affected artifact.
83
+ - Remove or resolve stale information when appropriate.
84
+
85
+ ## Conflict
86
+
87
+ When implementation and project artifacts disagree:
88
+
89
+ 1. Determine whether the implementation or artifact is stale.
90
+ 2. Preserve the confirmed requirement.
91
+ 3. Update the stale representation.
92
+ 4. If intent cannot be determined, create `DISCUSSION`.
@@ -0,0 +1,50 @@
1
+ # SPEC
2
+
3
+ `SPEC` contains confirmed, durable system requirements.
4
+
5
+ ## Create
6
+
7
+ Create or update `SPEC` when:
8
+
9
+ - a new requirement is confirmed
10
+ - an existing requirement changes
11
+ - implementation reveals a durable requirement
12
+
13
+ ## Shape
14
+
15
+ - One requirement per bullet.
16
+ - Short statements, not paragraphs.
17
+ - The title names the requirement; the body does not repeat it.
18
+ - Follow Entry Style in `instructions.md`.
19
+
20
+ ## What belongs here
21
+
22
+ - A requirement a command could falsify. If no command could fail, it is an `ADR`.
23
+ - The smallest statement a test could assert, and the check that asserts it.
24
+ - What must stay true when the code changes — not a description of how it works now.
25
+ - Not a copy of a rule that `.sddio/context/instructions/` already ships.
26
+ - Not a layout, a file list, or a flag's behaviour: those are read from the repository.
27
+
28
+ ## Claims
29
+
30
+ - A bullet may carry one line: `- Check: <command> → <expected substring>`.
31
+ - `sddio check --claims` runs it at the repository root and compares the output.
32
+ - A claim whose command fails, or whose output misses the text, is drift — reported, not crashed.
33
+ - A bullet without a claim is acceptable. A claim nobody can run is not.
34
+
35
+ ## Rules
36
+
37
+ - Record what the system must do, not how it is implemented.
38
+ - A requirement that can be checked names the command that checks it, and the value it must return.
39
+ - A requirement that cannot be checked says it is judgement, instead of inventing a check.
40
+ - Prefer existing entries over duplicates.
41
+ - Keep requirements independently understandable.
42
+ - Do not record assumptions or temporary behavior.
43
+
44
+ ## Source of Truth
45
+
46
+ `SPEC` describes confirmed requirements.
47
+
48
+ The repository describes actual implementation behavior.
49
+
50
+ If they conflict, use Reconciliation to determine which is stale.
@@ -0,0 +1,64 @@
1
+ # Instructions
2
+
3
+ ## Startup
4
+
5
+ 1. Run `npx sddio start`, and read what it prints.
6
+ 2. Read `preferences.md`.
7
+ 3. Read `writing.md` when you are about to create or change an entry — not before.
8
+ 4. Load `instructions/<artifact>.md` only for the artifact you are writing.
9
+
10
+ If no usable `SPEC` exists, load `instructions/bootstrap.md`.
11
+
12
+ ## The cursor
13
+
14
+ `config.json` holds `reconcileCursor` and `hooks`. `start` resolves the first and prints the
15
+ second's effect. States, ranges and edge cases: `instructions/reconciliation.md`.
16
+
17
+ - Behind or rewritten — reconcile before the next decision, not after the next commit.
18
+ - The cursor records commits, not uncommitted work.
19
+ - A hook is a declaration. sddio never calls one.
20
+
21
+ ## Finding things
22
+
23
+ - `sddio brief <path>` — entries that name those paths, titles only.
24
+ - `sddio show <id>` — one entry, body included.
25
+ - `sddio diff` — which entries a moved file touches, and which files nobody named.
26
+ - No command? `grep -rn "^## " sddio_docs/*/` lists the whole index.
27
+
28
+ ## Classify
29
+
30
+ ```text
31
+ Requirement → SPEC a command could falsify it
32
+ Decision → ADR only a person can be told why
33
+ Uncertainty → DISCUSSION
34
+ Transient → nothing
35
+ ```
36
+
37
+ Work in progress is not a classification. Plans belong to `flow-trail`.
38
+
39
+ ## Entry style
40
+
41
+ One idea per line. Bullets over paragraphs. Under ~100 characters. Facts only, no history.
42
+ Do not restate the title. Reference by ID; never repeat content. One level of nesting.
43
+ Omit a section that has nothing to say. Two sentences are two bullets.
44
+
45
+ Shape test: every line is readable and actionable on its own.
46
+
47
+ ## Where the detail lives
48
+
49
+ | Need | File |
50
+ | --- | --- |
51
+ | Writing an entry | `writing.md` |
52
+ | SPEC, ADR, DISCUSSION shape | `instructions/spec.md`, `adr.md`, `discussion.md` |
53
+ | Schema and IDs | `instructions/entries.md` |
54
+ | Reconciliation | `instructions/reconciliation.md` |
55
+ | Bootstrap | `instructions/bootstrap.md` |
56
+
57
+ ## Rules that apply everywhere
58
+
59
+ - Do not invent requirements, create artifacts for completeness, or duplicate existing knowledge.
60
+ - Do not load unrelated context, rewrite accurate artifacts, or record transient details.
61
+ - A rule that can be checked names the command; one that cannot says it is judgement.
62
+ - Write a fact where it is read, and nowhere else.
63
+ - Prefer automatic, minimal, reversible actions.
64
+ - When intent cannot be determined safely, use `DISCUSSION`.
@@ -0,0 +1,16 @@
1
+ # Preferences
2
+
3
+ ## Preferences
4
+
5
+ - Documentation: concise
6
+ - Code style: minimal
7
+ - Dependencies: avoid unnecessary dependencies
8
+ - Communication: direct
9
+ - Planning: incremental
10
+ - Context: prefer targeted retrieval
11
+
12
+ ## Project
13
+
14
+ - Package manager: pnpm (not now, preferred later)
15
+ - Architecture: monorepo (not now, preferred later)
16
+ - Source of truth: repository artifacts
@@ -0,0 +1,28 @@
1
+ # Roadmap
2
+
3
+ <!--
4
+ Possible future directions, not current requirements or commitments.
5
+
6
+ When working on current tasks:
7
+ - Do not implement roadmap items unless explicitly requested.
8
+ - Do not treat roadmap items as requirements.
9
+ - Avoid decisions that unnecessarily block roadmap directions.
10
+ - Ask before adding extension points solely for roadmap directions.
11
+ - Do not add abstractions solely for speculative roadmap items.
12
+ - Before implementing a roadmap item, create the required discussion and ADR.
13
+ - Remove the roadmap item once it becomes an active requirement.
14
+ -->
15
+
16
+ ## Near
17
+
18
+ * Local UI for browsing and querying project knowledge.
19
+ * MCP-based retrieval of project context.
20
+
21
+ ## Later
22
+
23
+ * Cross-repository knowledge.
24
+
25
+ ## Explore
26
+
27
+ * Automatic reconciliation between git history and project records.
28
+ * Evaluation of SDD effectiveness over time.
@@ -0,0 +1,26 @@
1
+ # Routes
2
+
3
+ ## Core
4
+
5
+ | Type | Path | Purpose |
6
+ | ---------- | -------------- | -------------- |
7
+ | SPEC | `spec/` | Requirements |
8
+ | ADR | `adr/` | Decisions |
9
+ | DISCUSSION | `discussions/` | Open questions |
10
+ | INDEX | `README.md` | Route table |
11
+
12
+ Work in progress is not routed here. sddio stores knowledge, not plans; a rollout belongs to
13
+ `flow-trail` or to the board the team already reads — see `ADR-011`.
14
+
15
+ ## Lookup
16
+
17
+ - SPEC → `spec/`
18
+ - ADR → `adr/`
19
+ - DISCUSSION → `discussions/`
20
+ - Unknown area → `sddio_docs/README.md`
21
+
22
+ ## ID Routing
23
+
24
+ - `SPEC-*` → `spec/`
25
+ - `ADR-*` → `adr/`
26
+ - `DISC-*` → `discussions/`
@@ -0,0 +1,80 @@
1
+ # Writing
2
+
3
+ Load this when an entry is about to be created or changed. Everything else is in
4
+ `instructions.md`, and reading it twice a session buys nothing.
5
+
6
+ ## Admission
7
+
8
+ An entry is written only for a fact that reading the implementation cannot give you.
9
+
10
+ - Answer one line in the entry: `- Not in the code: <why the repository does not say this>`.
11
+ - If that line cannot be written, there is no entry. Not a shorter one — none.
12
+ - A fact the code or a shipped instruction already states is a citation: point at it with `refs`.
13
+ - A fact that can be regenerated by reading one file is not knowledge; it is a second copy that drifts.
14
+ - History is admissible: what was tried, what failed, who asked, and by when.
15
+
16
+ ## Artifact roles
17
+
18
+ - `SPEC` — confirmed requirements. A command could falsify them.
19
+ - `ADR` — important technical decisions, the option that lost, and what each cost.
20
+ - `DISCUSSION` — unresolved knowledge; promoted into `SPEC` or `ADR`, then deleted.
21
+
22
+ Keep these roles distinct. Requirement or decision is settled by falsifiability: if a command could
23
+ fail, it is a `SPEC`; if only a person can be told why, it is an `ADR`.
24
+
25
+ ## Classification
26
+
27
+ ```text
28
+ Requirement → SPEC
29
+ Decision → ADR
30
+ Uncertainty → DISCUSSION
31
+ Transient → nothing
32
+ ```
33
+
34
+ If several apply, create only the artifacts that are necessary.
35
+
36
+ ## Entry style
37
+
38
+ 1. One idea per line.
39
+ 2. Bullets over paragraphs.
40
+ 3. Keep lines under ~100 characters.
41
+ 4. Facts only — no background, motivation, or history.
42
+ 5. No filler: "clearly", "simply", "note that", "it is important".
43
+ 6. Do not restate the title in the first bullet.
44
+ 7. Reference other artifacts by ID; never repeat their content.
45
+ 8. One level of nesting at most.
46
+ 9. Omit a section that has nothing to say.
47
+ 10. If a bullet needs two sentences, it is two bullets.
48
+
49
+ Shape test: every line is readable and actionable on its own.
50
+
51
+ ## Detailed instructions
52
+
53
+ | Need | File |
54
+ | --- | --- |
55
+ | SPEC | `instructions/spec.md` |
56
+ | ADR | `instructions/adr.md` |
57
+ | DISCUSSION | `instructions/discussion.md` |
58
+ | Schema and IDs | `instructions/entries.md` |
59
+ | Reconciliation | `instructions/reconciliation.md` |
60
+
61
+ ## General rules
62
+
63
+ - Do not invent requirements.
64
+ - Do not create artifacts for completeness.
65
+ - Do not duplicate existing knowledge.
66
+ - Do not rewrite accurate artifacts.
67
+ - Do not record transient implementation details.
68
+ - Write every entry body in Entry style.
69
+ - A rule that can be checked names the command that checks it; a rule that cannot says it is judgement.
70
+ - Write a fact where it is read, and nowhere else.
71
+ - Prefer automatic, minimal, reversible actions.
72
+ - When intent cannot be determined safely, use `DISCUSSION`.
73
+
74
+ ## Restraint
75
+
76
+ - Do the least necessary.
77
+ - Add structure only when it provides clear value.
78
+ - Prefer the smaller solution when multiple solutions work.
79
+ - A rule is removed when it is measured as unfollowed, not when it feels unfollowed.
80
+ - Apply the last rule to the last three reconciled ranges; measure with the `grep` the rule names.