@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.
- package/LICENSE +21 -0
- package/README.md +139 -2
- package/dist/agents.js +35 -0
- package/dist/brief.js +104 -0
- package/dist/check.js +109 -0
- package/dist/claims.js +60 -0
- package/dist/cli.js +341 -0
- package/dist/cursor.js +65 -0
- package/dist/events.js +37 -0
- package/dist/hooks.js +68 -0
- package/dist/init.js +172 -0
- package/dist/paths.js +31 -0
- package/dist/prompt.js +63 -0
- package/dist/repo.js +93 -0
- package/dist/workspace.js +25 -0
- package/package.json +54 -4
- package/templates/.sddio/context/README.md +81 -0
- package/templates/.sddio/context/config.json +16 -0
- package/templates/.sddio/context/instructions/.schema/adr.md +28 -0
- package/templates/.sddio/context/instructions/.schema/discussion.md +16 -0
- package/templates/.sddio/context/instructions/.schema/spec.md +15 -0
- package/templates/.sddio/context/instructions/adr.md +43 -0
- package/templates/.sddio/context/instructions/bootstrap.md +54 -0
- package/templates/.sddio/context/instructions/discussion.md +31 -0
- package/templates/.sddio/context/instructions/entries.md +61 -0
- package/templates/.sddio/context/instructions/reconciliation.md +92 -0
- package/templates/.sddio/context/instructions/spec.md +50 -0
- package/templates/.sddio/context/instructions.md +64 -0
- package/templates/.sddio/context/preferences.md +16 -0
- package/templates/.sddio/context/roadmap.md +28 -0
- package/templates/.sddio/context/routes/routes.md +26 -0
- package/templates/.sddio/context/writing.md +80 -0
package/dist/paths.js
ADDED
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolve the package root and template location.
|
|
3
|
+
*
|
|
4
|
+
* Templates ship inside the published tarball, so they are always resolved
|
|
5
|
+
* relative to the package artefact — never to the consumer's repository
|
|
6
|
+
* (ADR-003). The executing file lives in `dist/`, which carries no
|
|
7
|
+
* `package.json`, so the root is found by walking up.
|
|
8
|
+
*/
|
|
9
|
+
import { existsSync } from 'node:fs';
|
|
10
|
+
import { dirname, join } from 'node:path';
|
|
11
|
+
import { fileURLToPath } from 'node:url';
|
|
12
|
+
const here = dirname(fileURLToPath(import.meta.url));
|
|
13
|
+
function findPackageRoot(start) {
|
|
14
|
+
let current = start;
|
|
15
|
+
for (;;) {
|
|
16
|
+
if (existsSync(join(current, 'package.json'))) {
|
|
17
|
+
return current;
|
|
18
|
+
}
|
|
19
|
+
const parent = dirname(current);
|
|
20
|
+
if (parent === current) {
|
|
21
|
+
return start;
|
|
22
|
+
}
|
|
23
|
+
current = parent;
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
export const packageRoot = findPackageRoot(here);
|
|
27
|
+
/**
|
|
28
|
+
* `templates/.sddio` — the context layer, generated at build time from the
|
|
29
|
+
* repository root `.sddio/` (ADR-005).
|
|
30
|
+
*/
|
|
31
|
+
export const contextTemplateRoot = join(packageRoot, 'templates', '.sddio');
|
package/dist/prompt.js
ADDED
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* What `init` leaves the user with.
|
|
3
|
+
*
|
|
4
|
+
* The file list is not the useful output — the next action is. `init` cannot
|
|
5
|
+
* perform it (the agent has to read and classify), so it hands over a prompt
|
|
6
|
+
* meant to be pasted verbatim into whatever coding agent is in use.
|
|
7
|
+
*
|
|
8
|
+
* Three outcomes, because the right next step differs:
|
|
9
|
+
* - `bootstrap` — this run created files, so the workspace is new.
|
|
10
|
+
* - `reconcile` — only `.sddio/` changed, i.e. an upgrade; knowledge may be stale.
|
|
11
|
+
* - `current` — nothing changed, so there is nothing to ask the agent to do.
|
|
12
|
+
*/
|
|
13
|
+
const RULE = '─'.repeat(64);
|
|
14
|
+
export const BOOTSTRAP_PROMPT = [
|
|
15
|
+
'Read `.sddio/context/instructions.md` and follow it.',
|
|
16
|
+
'',
|
|
17
|
+
'This project has just been initialised with sddio. Before any other work:',
|
|
18
|
+
'',
|
|
19
|
+
'1. Run the commit check in `.sddio/context/instructions/reconciliation.md`.',
|
|
20
|
+
' `config.json` has no baseline yet, so the state is `unknown`.',
|
|
21
|
+
'2. Bootstrap as described in `instructions/bootstrap.md`, but do not describe the',
|
|
22
|
+
' code back to me. Record only what the repository cannot say: a reversed',
|
|
23
|
+
' decision and why, an outside constraint and its deadline, an abandoned path.',
|
|
24
|
+
' At most six SPEC entries, each ending with `Not in the code:`.',
|
|
25
|
+
'3. Ask me up to three questions whose answers would change future work, and',
|
|
26
|
+
' record at least one DISCUSSION (SPEC-016) for what stays open.',
|
|
27
|
+
'4. Report what you recorded, then set `reconcileCursor.lastProcessedCommit` to',
|
|
28
|
+
' `HEAD` and `reconcileCursor.previousCommit` to `HEAD^` in',
|
|
29
|
+
' `.sddio/context/config.json` (`null` at a root commit).',
|
|
30
|
+
'',
|
|
31
|
+
'Then answer this: <your first task>',
|
|
32
|
+
].join('\n');
|
|
33
|
+
export const RECONCILE_PROMPT = [
|
|
34
|
+
'Read `.sddio/context/instructions.md` and follow it.',
|
|
35
|
+
'',
|
|
36
|
+
'The sddio context layer in `.sddio/` was just refreshed by a package upgrade,',
|
|
37
|
+
'and `config.json` now carries no baseline (`null`). Before any other work, run',
|
|
38
|
+
'the commit check and reconcile: `.sddio/context/instructions/reconciliation.md`.',
|
|
39
|
+
'',
|
|
40
|
+
'The cursor state is `unknown`, so there is no range to diff: verify the existing',
|
|
41
|
+
'artifacts against the current implementation. Do not rescan unrelated areas, and',
|
|
42
|
+
'do not rewrite artifacts that are still accurate.',
|
|
43
|
+
'',
|
|
44
|
+
'Report what you understood and what you changed, then set',
|
|
45
|
+
'`reconcileCursor.lastProcessedCommit` to `HEAD` and `reconcileCursor.previousCommit`',
|
|
46
|
+
'to `HEAD^` in `.sddio/context/config.json` (`null` at a root commit), so the next',
|
|
47
|
+
'session resumes from a baseline.',
|
|
48
|
+
'',
|
|
49
|
+
'Then answer this: <your first task>',
|
|
50
|
+
].join('\n');
|
|
51
|
+
export function selectNextStep(created, overwritten) {
|
|
52
|
+
if (created > 0) {
|
|
53
|
+
return 'bootstrap';
|
|
54
|
+
}
|
|
55
|
+
return overwritten > 0 ? 'reconcile' : 'current';
|
|
56
|
+
}
|
|
57
|
+
export function renderNextStep(step) {
|
|
58
|
+
if (step === 'current') {
|
|
59
|
+
return 'Already up to date. Nothing to hand to your agent until the next change.';
|
|
60
|
+
}
|
|
61
|
+
const prompt = step === 'bootstrap' ? BOOTSTRAP_PROMPT : RECONCILE_PROMPT;
|
|
62
|
+
return [RULE, 'Paste this into your coding agent', RULE, '', prompt].join('\n');
|
|
63
|
+
}
|
package/dist/repo.js
ADDED
|
@@ -0,0 +1,93 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Where the workspace is, and what is in it.
|
|
3
|
+
*
|
|
4
|
+
* Every read-side command needs the same three things: the repository root, the
|
|
5
|
+
* cursor, and the entries. They live here so `brief`, `check`, `diff` and `start`
|
|
6
|
+
* cannot disagree about what an entry is.
|
|
7
|
+
*/
|
|
8
|
+
import { existsSync, readdirSync, readFileSync } from 'node:fs';
|
|
9
|
+
import { dirname, join, resolve } from 'node:path';
|
|
10
|
+
import { WORKSPACE_ROOT } from './workspace.js';
|
|
11
|
+
const COLLECTIONS = [
|
|
12
|
+
{ dir: 'spec', kind: 'SPEC' },
|
|
13
|
+
{ dir: 'adr', kind: 'ADR' },
|
|
14
|
+
{ dir: 'discussions', kind: 'DISC' },
|
|
15
|
+
];
|
|
16
|
+
/** Walk up from `start` until a `.sddio/context/config.json` appears. */
|
|
17
|
+
export function findRoot(start) {
|
|
18
|
+
let current = resolve(start);
|
|
19
|
+
for (;;) {
|
|
20
|
+
if (existsSync(join(current, '.sddio', 'context', 'config.json'))) {
|
|
21
|
+
return current;
|
|
22
|
+
}
|
|
23
|
+
const parent = dirname(current);
|
|
24
|
+
if (parent === current) {
|
|
25
|
+
return null;
|
|
26
|
+
}
|
|
27
|
+
current = parent;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
export function readConfig(root) {
|
|
31
|
+
try {
|
|
32
|
+
return JSON.parse(readFileSync(join(root, '.sddio', 'context', 'config.json'), 'utf8'));
|
|
33
|
+
}
|
|
34
|
+
catch {
|
|
35
|
+
return {};
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function parseEntries(file, kind, text) {
|
|
39
|
+
const blocks = text.split(/^<!-- entry -->$/m).slice(1);
|
|
40
|
+
return blocks
|
|
41
|
+
.map((block) => {
|
|
42
|
+
const id = /^id:\s*(\S+)\s*$/m.exec(block)?.[1];
|
|
43
|
+
const title = /^##\s+(.+?)\s*$/m.exec(block)?.[1];
|
|
44
|
+
if (id === undefined || title === undefined) {
|
|
45
|
+
return null;
|
|
46
|
+
}
|
|
47
|
+
const start = block.indexOf('\n---', block.indexOf('---') + 1);
|
|
48
|
+
const after = block.slice(start + 4).trim();
|
|
49
|
+
const body = after.replace(/^##\s+.+?\s*$/m, '').trim();
|
|
50
|
+
const refs = (block.match(/^refs:\s*\[([^\]]*)\]/m)?.[1] ?? '')
|
|
51
|
+
.split(',')
|
|
52
|
+
.map((ref) => ref.trim())
|
|
53
|
+
.filter((ref) => ref !== '');
|
|
54
|
+
const status = block.match(/^status:\s*(\S+)/m)?.[1] ?? '';
|
|
55
|
+
return { id, kind, title, body, file, refs, status };
|
|
56
|
+
})
|
|
57
|
+
.filter((entry) => entry !== null);
|
|
58
|
+
}
|
|
59
|
+
/** Every entry, in collection order then file order. Unreadable files are skipped. */
|
|
60
|
+
export function readEntries(root) {
|
|
61
|
+
const entries = [];
|
|
62
|
+
for (const { dir, kind } of COLLECTIONS) {
|
|
63
|
+
const directory = join(root, WORKSPACE_ROOT, dir);
|
|
64
|
+
if (!existsSync(directory)) {
|
|
65
|
+
continue;
|
|
66
|
+
}
|
|
67
|
+
for (const name of readdirSync(directory).filter((file) => file.endsWith('.md')).sort()) {
|
|
68
|
+
const file = `${WORKSPACE_ROOT}/${dir}/${name}`;
|
|
69
|
+
try {
|
|
70
|
+
entries.push(...parseEntries(file, kind, readFileSync(join(root, file), 'utf8')));
|
|
71
|
+
}
|
|
72
|
+
catch {
|
|
73
|
+
// A collection that cannot be read is a missing collection, not a crash.
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return entries;
|
|
78
|
+
}
|
|
79
|
+
/** Path-like tokens an entry body names: `packages/cli/lib/init.ts`, `init.ts`, `lib/`. */
|
|
80
|
+
export function pathsIn(body) {
|
|
81
|
+
const tokens = body.match(/[\w./-]*[A-Za-z0-9_-]+\.[A-Za-z0-9]+|\b[\w.-]+\/[\w./-]+/g) ?? [];
|
|
82
|
+
return [...new Set(tokens.map((token) => token.replace(/[.,;:)]+$/, '')))].filter((token) => token.includes('.') || token.includes('/'));
|
|
83
|
+
}
|
|
84
|
+
/** Does `entry` name `target`? Full path, basename, or a directory prefix of it. */
|
|
85
|
+
export function entryNames(entry, target) {
|
|
86
|
+
const clean = target.replace(/^\.\//, '');
|
|
87
|
+
return pathsIn(entry.body).some((token) => {
|
|
88
|
+
if (clean === token || clean.endsWith(`/${token}`) || token.endsWith(`/${clean}`)) {
|
|
89
|
+
return true;
|
|
90
|
+
}
|
|
91
|
+
return token.endsWith('/') && clean.startsWith(token);
|
|
92
|
+
});
|
|
93
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `sddio_docs/` layout (ADR-001, ADR-005).
|
|
3
|
+
*
|
|
4
|
+
* The workspace is user-owned, so init reproduces the layout and nothing else:
|
|
5
|
+
* the directories plus empty seed files. Seeds ship empty on purpose — they
|
|
6
|
+
* are the user's project, not ours, and placeholder prose is immediately
|
|
7
|
+
* rewritten anyway.
|
|
8
|
+
*
|
|
9
|
+
* Empty directories cannot travel through `npm pack`, so the layout is
|
|
10
|
+
* declared here instead of being carried by the tarball.
|
|
11
|
+
*/
|
|
12
|
+
export const WORKSPACE_ROOT = 'sddio_docs';
|
|
13
|
+
/** Created unconditionally, including the empty ones a template cannot carry. */
|
|
14
|
+
export const WORKSPACE_DIRS = [
|
|
15
|
+
WORKSPACE_ROOT,
|
|
16
|
+
`${WORKSPACE_ROOT}/spec`,
|
|
17
|
+
`${WORKSPACE_ROOT}/adr`,
|
|
18
|
+
`${WORKSPACE_ROOT}/discussions`,
|
|
19
|
+
];
|
|
20
|
+
/** Entry home files: one numbered collection per artifact type (ADR-004). */
|
|
21
|
+
export const WORKSPACE_SEEDS = [
|
|
22
|
+
`${WORKSPACE_ROOT}/spec/spec_100.md`,
|
|
23
|
+
`${WORKSPACE_ROOT}/adr/adr_100.md`,
|
|
24
|
+
`${WORKSPACE_ROOT}/discussions/discussions_100.md`,
|
|
25
|
+
];
|
package/package.json
CHANGED
|
@@ -1,6 +1,56 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sddio/cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.2.0",
|
|
4
|
+
"description": "Spec-driven development for coding agents: keep SPEC, ADR and DISCUSSION in your repo so the reasoning survives session restarts.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"type": "module",
|
|
7
|
+
"bin": {
|
|
8
|
+
"sddio": "dist/cli.js"
|
|
9
|
+
},
|
|
10
|
+
"files": [
|
|
11
|
+
"dist",
|
|
12
|
+
"templates"
|
|
13
|
+
],
|
|
14
|
+
"engines": {
|
|
15
|
+
"node": ">=18.0.0"
|
|
16
|
+
},
|
|
17
|
+
"publishConfig": {
|
|
18
|
+
"access": "public"
|
|
19
|
+
},
|
|
20
|
+
"repository": {
|
|
21
|
+
"type": "git",
|
|
22
|
+
"url": "git+https://github.com/benxgao/sddio.git",
|
|
23
|
+
"directory": "packages/cli"
|
|
24
|
+
},
|
|
25
|
+
"homepage": "https://github.com/benxgao/sddio/tree/master/packages/cli",
|
|
26
|
+
"bugs": {
|
|
27
|
+
"url": "https://github.com/benxgao/sddio/issues"
|
|
28
|
+
},
|
|
29
|
+
"keywords": [
|
|
30
|
+
"sddio",
|
|
31
|
+
"spec-driven-development",
|
|
32
|
+
"spec-driven",
|
|
33
|
+
"coding-agents",
|
|
34
|
+
"ai-agents",
|
|
35
|
+
"context-engineering",
|
|
36
|
+
"claude-code",
|
|
37
|
+
"cursor",
|
|
38
|
+
"agents-md",
|
|
39
|
+
"adr",
|
|
40
|
+
"cli",
|
|
41
|
+
"scaffold"
|
|
42
|
+
],
|
|
43
|
+
"scripts": {
|
|
44
|
+
"sync": "node scripts/sync-templates.mjs",
|
|
45
|
+
"prebuild": "npm run clean && npm run sync",
|
|
46
|
+
"build": "tsc -p tsconfig.json",
|
|
47
|
+
"pretest": "npm run build",
|
|
48
|
+
"test": "node --test test/*.test.mjs",
|
|
49
|
+
"prepack": "npm run build",
|
|
50
|
+
"clean": "node -e \"require('node:fs').rmSync('dist',{recursive:true,force:true});require('node:fs').rmSync('templates',{recursive:true,force:true})\""
|
|
51
|
+
},
|
|
52
|
+
"devDependencies": {
|
|
53
|
+
"@types/node": "^20.14.0",
|
|
54
|
+
"typescript": "^5.5.0"
|
|
55
|
+
}
|
|
56
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
# sddio
|
|
2
|
+
|
|
3
|
+
sddio is a lightweight project context system for AI-assisted software development.
|
|
4
|
+
|
|
5
|
+
It keeps the project's **requirements, decisions, discussions, and development direction** in a small set of structured, human-readable Markdown files.
|
|
6
|
+
|
|
7
|
+
## Why
|
|
8
|
+
|
|
9
|
+
AI can write code quickly, but often lacks reliable project context.
|
|
10
|
+
|
|
11
|
+
Important context is usually scattered across:
|
|
12
|
+
|
|
13
|
+
- conversations
|
|
14
|
+
- code
|
|
15
|
+
- tickets
|
|
16
|
+
- documents
|
|
17
|
+
- decisions
|
|
18
|
+
- developer preferences
|
|
19
|
+
|
|
20
|
+
sddio provides a small, persistent layer of project context that AI can read and maintain.
|
|
21
|
+
|
|
22
|
+
## How it works
|
|
23
|
+
|
|
24
|
+
sddio separates project context into a few focused artifacts:
|
|
25
|
+
|
|
26
|
+
- **SPEC** — what the system should do
|
|
27
|
+
- **ADR** — why important technical decisions were made
|
|
28
|
+
- **DISCUSSION** — unresolved questions, concerns, suggestions, and ideas
|
|
29
|
+
- **ROADMAP** — future direction
|
|
30
|
+
- **PREFERENCES** — stable project or user context
|
|
31
|
+
|
|
32
|
+
AI uses these artifacts to:
|
|
33
|
+
|
|
34
|
+
1. understand the project
|
|
35
|
+
2. identify the user's intent
|
|
36
|
+
3. load only relevant context
|
|
37
|
+
4. create or update the appropriate artifact
|
|
38
|
+
5. keep project knowledge consistent over time
|
|
39
|
+
|
|
40
|
+
The goal is not to document everything.
|
|
41
|
+
|
|
42
|
+
The goal is to preserve the **smallest amount of context that meaningfully improves AI work**.
|
|
43
|
+
|
|
44
|
+
## Design Principles
|
|
45
|
+
|
|
46
|
+
sddio follows a few simple rules:
|
|
47
|
+
|
|
48
|
+
- Keep artifacts minimal.
|
|
49
|
+
- Prefer structure over prose.
|
|
50
|
+
- Make information easy for both humans and AI to parse.
|
|
51
|
+
- Keep each artifact focused on one purpose.
|
|
52
|
+
- Avoid unnecessary metadata, nesting, duplication, and abstraction.
|
|
53
|
+
- Load context only when it is relevant.
|
|
54
|
+
- Let AI maintain the context whenever possible.
|
|
55
|
+
- Prefer the smallest structure that works well for both humans and AI.
|
|
56
|
+
|
|
57
|
+
> **Do the least necessary.**
|
|
58
|
+
|
|
59
|
+
## What sddio Is Not
|
|
60
|
+
|
|
61
|
+
sddio is not:
|
|
62
|
+
|
|
63
|
+
- a replacement for Git
|
|
64
|
+
- a project management system
|
|
65
|
+
- a documentation platform
|
|
66
|
+
- a database of every AI conversation
|
|
67
|
+
- a requirement to document every change
|
|
68
|
+
|
|
69
|
+
It is a **context layer between the project and AI**.
|
|
70
|
+
|
|
71
|
+
## The Desired Experience
|
|
72
|
+
|
|
73
|
+
After sddio is installed, the developer should not need to manage the system manually.
|
|
74
|
+
|
|
75
|
+
AI should be able to discover the project context, maintain the relevant artifacts, and keep them useful as the project evolves.
|
|
76
|
+
|
|
77
|
+
The developer should primarily focus on the project itself.
|
|
78
|
+
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
sddio provides **just enough structure for AI to understand, remember, and evolve a project without creating another system to manage.**
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
<!-- schema version: 1.0.0 -->
|
|
2
|
+
|
|
3
|
+
<!-- Multiple entries allowed. Frontmatter belongs to the following entry. -->
|
|
4
|
+
|
|
5
|
+
<!-- entry -->
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
id: [ADR-ID]
|
|
10
|
+
|
|
11
|
+
status: <accepted|rejected|superseded>
|
|
12
|
+
|
|
13
|
+
refs: [SPEC-ID|DISC-ID]
|
|
14
|
+
|
|
15
|
+
---
|
|
16
|
+
|
|
17
|
+
## [Title]
|
|
18
|
+
|
|
19
|
+
- [Decision]
|
|
20
|
+
- [Key constraint or detail]
|
|
21
|
+
|
|
22
|
+
### Alternatives
|
|
23
|
+
|
|
24
|
+
- [Rejected option] — [reason]
|
|
25
|
+
|
|
26
|
+
### Consequences
|
|
27
|
+
|
|
28
|
+
- [Cost or gain]
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
<!-- schema version: 1.0.0 -->
|
|
2
|
+
<!-- Multiple entries allowed. Frontmatter belongs to the following entry. -->
|
|
3
|
+
|
|
4
|
+
<!-- entry -->
|
|
5
|
+
---
|
|
6
|
+
id: [DISC-ID]
|
|
7
|
+
type: <concern|question|suggestion|idea>
|
|
8
|
+
status: <open|resolved>
|
|
9
|
+
refs: [SPEC-ID|DISC-ID]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## [Title]
|
|
13
|
+
|
|
14
|
+
- [Point]
|
|
15
|
+
- [Option or recommendation]
|
|
16
|
+
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
<!-- schema version: 1.0.0 -->
|
|
2
|
+
<!-- Multiple entries allowed. Frontmatter belongs to the following entry. -->
|
|
3
|
+
|
|
4
|
+
<!-- entry -->
|
|
5
|
+
---
|
|
6
|
+
id: [SPEC-ID]
|
|
7
|
+
type: <requirement|constraint>
|
|
8
|
+
status: <active|deprecated>
|
|
9
|
+
refs: [SPEC-ID, DISC-ID, ADR-ID]
|
|
10
|
+
---
|
|
11
|
+
|
|
12
|
+
## [Title]
|
|
13
|
+
|
|
14
|
+
- [Requirement statement]
|
|
15
|
+
- [Requirement statement]
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
# ADR
|
|
2
|
+
|
|
3
|
+
`ADR` records important technical decisions with lasting consequences.
|
|
4
|
+
|
|
5
|
+
## Create
|
|
6
|
+
|
|
7
|
+
Create an `ADR` when a decision materially affects:
|
|
8
|
+
|
|
9
|
+
- architecture
|
|
10
|
+
- system boundaries
|
|
11
|
+
- major technology choices
|
|
12
|
+
- important constraints
|
|
13
|
+
- significant trade-offs
|
|
14
|
+
|
|
15
|
+
## Do Not Create
|
|
16
|
+
|
|
17
|
+
Do not create an `ADR` for:
|
|
18
|
+
|
|
19
|
+
- routine implementation choices
|
|
20
|
+
- temporary decisions
|
|
21
|
+
- obvious local changes
|
|
22
|
+
- decisions already captured by an existing ADR
|
|
23
|
+
|
|
24
|
+
## Shape
|
|
25
|
+
|
|
26
|
+
- Body: the decision as short bullets.
|
|
27
|
+
- `### Alternatives`: one rejected option per bullet, reason inline.
|
|
28
|
+
- `### Consequences`: costs and gains as short bullets.
|
|
29
|
+
- Omit any section that has nothing to say.
|
|
30
|
+
- Follow Entry Style in `instructions.md`.
|
|
31
|
+
|
|
32
|
+
## What belongs here
|
|
33
|
+
|
|
34
|
+
- A choice that was made, the option that lost, and what each cost.
|
|
35
|
+
- History the code cannot carry: what was tried, what failed, who asked, by when.
|
|
36
|
+
- Not falsifiable. An `ADR` is superseded, never corrected in place.
|
|
37
|
+
- If a command could prove it, it is a `SPEC`, and only the reason stays here.
|
|
38
|
+
|
|
39
|
+
## Rule
|
|
40
|
+
|
|
41
|
+
Record the decision and why it matters.
|
|
42
|
+
|
|
43
|
+
Do not use `ADR` to describe system requirements or implementation work.
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
# Bootstrap
|
|
2
|
+
|
|
3
|
+
Bootstrap establishes the smallest workspace an existing project can use. It is not a documentation
|
|
4
|
+
pass, and it does not describe the implementation back to the reader.
|
|
5
|
+
|
|
6
|
+
## What can be recovered
|
|
7
|
+
|
|
8
|
+
Only what the repository does not already say:
|
|
9
|
+
|
|
10
|
+
- a decision that was made and then reversed, and why
|
|
11
|
+
- a constraint imposed from outside: who asked, and by when
|
|
12
|
+
- a path that was tried and abandoned
|
|
13
|
+
|
|
14
|
+
## What cannot
|
|
15
|
+
|
|
16
|
+
Behaviour, layout, flags, file lists, and the shape of a module. Those are in the repository and will
|
|
17
|
+
be read there, cheaper and fresher than any summary.
|
|
18
|
+
|
|
19
|
+
## Process
|
|
20
|
+
|
|
21
|
+
1. Read history, not code: renames, deletions and rewrites (`git log --diff-filter=DR --name-status`).
|
|
22
|
+
2. Write at most six `SPEC` entries. Each is a requirement a command could falsify, and each ends with
|
|
23
|
+
`- Not in the code: <why the repository does not say it>`.
|
|
24
|
+
3. Write an `ADR` only for a reversal you can date and explain. Omit the rest.
|
|
25
|
+
4. Ask the user up to three questions — the ones whose answers would change future work, and which the
|
|
26
|
+
repository cannot answer.
|
|
27
|
+
5. Record at least one `DISCUSSION` for what stays open (SPEC-016).
|
|
28
|
+
6. Write the route table described below.
|
|
29
|
+
|
|
30
|
+
## Route Table
|
|
31
|
+
|
|
32
|
+
Bootstrap writes `sddio_docs/README.md`, the index that makes its own output findable.
|
|
33
|
+
|
|
34
|
+
- One row per area that has entries — not one row per entry.
|
|
35
|
+
- A row names the area, the `SPEC` range it holds, the `ADR` that governs it, and one sentence of scope.
|
|
36
|
+
- Rows only for entries that exist; a placeholder row teaches nothing.
|
|
37
|
+
- Regenerate the table when an entry is added or an area appears.
|
|
38
|
+
|
|
39
|
+
## Honest First Screen
|
|
40
|
+
|
|
41
|
+
Bootstrap writes a `SPEC` of claims, so it also writes the doubt that qualifies them.
|
|
42
|
+
|
|
43
|
+
- Always record at least one `DISCUSSION` entry; a bootstrapped workspace with none reads as complete.
|
|
44
|
+
- Record the single most material gap — the one whose answer would change future work.
|
|
45
|
+
- Prefer: intent behind the code, unverified external dependencies, competing interpretations of the same module.
|
|
46
|
+
- Add a second entry only when it changes a different decision; this is a floor, not a quota.
|
|
47
|
+
- Never record a decorative question to satisfy this rule.
|
|
48
|
+
|
|
49
|
+
## Limits
|
|
50
|
+
|
|
51
|
+
- A bootstrap that produces twenty entries has produced a paraphrase. Six is the ceiling, not the goal.
|
|
52
|
+
- Do not restate rules that `.sddio/context/instructions/` already ships.
|
|
53
|
+
- Do not repeatedly scan what is already captured in `SPEC`.
|
|
54
|
+
- A question is cheaper than a wrong claim; ask before inventing.
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
# DISCUSSION
|
|
2
|
+
|
|
3
|
+
`DISCUSSION` represents unresolved project knowledge.
|
|
4
|
+
|
|
5
|
+
## Create
|
|
6
|
+
|
|
7
|
+
Create a discussion when:
|
|
8
|
+
|
|
9
|
+
* required information is missing
|
|
10
|
+
* multiple valid interpretations exist
|
|
11
|
+
* user clarification is required
|
|
12
|
+
* an unresolved decision affects implementation
|
|
13
|
+
* a potential requirement needs confirmation
|
|
14
|
+
|
|
15
|
+
## Rule
|
|
16
|
+
|
|
17
|
+
Do not create a discussion for uncertainty that is:
|
|
18
|
+
|
|
19
|
+
* non-critical
|
|
20
|
+
* safely reversible
|
|
21
|
+
* irrelevant to future work
|
|
22
|
+
|
|
23
|
+
## Resolve Discussions
|
|
24
|
+
|
|
25
|
+
When resolve discussions:
|
|
26
|
+
|
|
27
|
+
- Record the durable outcome briefly in `SPEC` or `ADR` when appropriate, and avoid duplicating the same information.
|
|
28
|
+
- Delete the original discussion entry only after the ADR/SPEC is successfully created.
|
|
29
|
+
- Deleting a resolved entry is the one sanctioned removal; it is not a rewrite of history.
|
|
30
|
+
- The ID is not reused, including the ID just deleted.
|
|
31
|
+
- Leave unanswered discussions unchanged.
|
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# Entries
|
|
2
|
+
|
|
3
|
+
## Admission
|
|
4
|
+
|
|
5
|
+
An entry is written only for a fact that reading the implementation cannot give you.
|
|
6
|
+
|
|
7
|
+
- Answer one line before writing: `Not in the code: <why the repository does not say this>`.
|
|
8
|
+
- If that line cannot be written, there is no entry. Not a shorter one — none.
|
|
9
|
+
- A fact the code or a shipped instruction already states is a citation: point at it with `refs`, do not copy it.
|
|
10
|
+
- A fact that can be regenerated by reading one file is not knowledge; it is a second copy that will drift.
|
|
11
|
+
- History is admissible: what was tried, what failed, who asked, and by when.
|
|
12
|
+
|
|
13
|
+
## Schema
|
|
14
|
+
|
|
15
|
+
Before creating or modifying an `ADR`, `DISCUSSION`, or `SPEC` entry:
|
|
16
|
+
|
|
17
|
+
1. Read the corresponding schema in `.schema/`.
|
|
18
|
+
2. Follow its fields and structure.
|
|
19
|
+
3. Preserve its schema version.
|
|
20
|
+
|
|
21
|
+
Schema mapping:
|
|
22
|
+
|
|
23
|
+
- `ADR` → `.schema/adr.md`
|
|
24
|
+
- `DISCUSSION` → `.schema/discussion.md`
|
|
25
|
+
- `SPEC` → `.schema/spec.md`
|
|
26
|
+
|
|
27
|
+
Do not duplicate schema definitions in instruction files.
|
|
28
|
+
|
|
29
|
+
If the expected schema is missing:
|
|
30
|
+
|
|
31
|
+
1. Search `.schema/` for the closest matching schema.
|
|
32
|
+
2. Inspect existing entries for compatibility.
|
|
33
|
+
3. Do not invent a new schema unless required.
|
|
34
|
+
|
|
35
|
+
## Content
|
|
36
|
+
|
|
37
|
+
- Body content follows Entry Style in `instructions.md`.
|
|
38
|
+
- Frontmatter carries fields only, never prose.
|
|
39
|
+
|
|
40
|
+
## Entry Files
|
|
41
|
+
|
|
42
|
+
Entry collections use numbered Markdown files with a maximum of 100 entries.
|
|
43
|
+
|
|
44
|
+
Examples:
|
|
45
|
+
|
|
46
|
+
```text
|
|
47
|
+
adr_100.md → ADR 001–100
|
|
48
|
+
adr_200.md → ADR 101–200
|
|
49
|
+
|
|
50
|
+
discussions_100.md → DISC 001–100
|
|
51
|
+
discussions_200.md → DISC 101–200
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Rules:
|
|
55
|
+
|
|
56
|
+
1. Never exceed 100 entries.
|
|
57
|
+
2. Add to the current file while capacity remains.
|
|
58
|
+
3. When full, create the next numbered file before adding the next entry.
|
|
59
|
+
4. Preserve existing IDs and ordering.
|
|
60
|
+
5. New files use the same schema and structure.
|
|
61
|
+
6. Never move or split existing entries unless required by capacity.
|