Skip to content

Commit 571dedb

Browse files
committed
fix(slice-59): align public docs contract
1 parent 5e0af8b commit 571dedb

3 files changed

Lines changed: 48 additions & 20 deletions

File tree

README.md

Lines changed: 32 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,15 @@ dead-ends inside them never compile into anything the next session can
1818
reference. CodeAlmanac is that reference layer: a wiki that lives in your
1919
repository, written for your agents, and kept up to date from the work itself.
2020

21+
## At a glance
22+
23+
- Public command: `codealmanac`
24+
- Python 3.12+
25+
- Default repo wiki root: `almanac/`
26+
- Custom repo wiki roots: any safe repo-relative directory via `--root`
27+
- User state root: `~/.codealmanac/`
28+
- Cloud commands: `setup`, `login`, `whoami`, `logout`, `capture`.
29+
2130
## Get started
2231

2332
Install the CLI (Python 3.12+):
@@ -32,6 +41,8 @@ uv tool install codealmanac
3241
```bash
3342
codealmanac init # build the first wiki for this repo
3443
codealmanac local setup # keep it updating from your commits
44+
codealmanac search "getting"
45+
codealmanac show getting-started
3546
```
3647

3748
**With your team (cloud)** — one shared wiki, updated from everyone's
@@ -55,10 +66,11 @@ your-repo/
5566
|-- almanac/
5667
| |-- README.md # this repo's notability bar and conventions
5768
| |-- topics.yaml # topic graph
58-
| `-- pages/
59-
| |-- checkout-flow.md
60-
| |-- stripe-webhook-deadlock.md
61-
| `-- jwt-vs-sessions.md
69+
| |-- manual/ # packaged guidance copied for agents
70+
| |-- pages/
71+
| | |-- checkout-flow.md
72+
| | |-- stripe-webhook-deadlock.md
73+
| | `-- jwt-vs-sessions.md
6274
|-- src/
6375
`-- ...
6476
```
@@ -67,6 +79,10 @@ Every page is one stable concept — a flow, a decision, a gotcha — linked int
6779
a topic graph with `[[wikilinks]]`. Browse it locally with `codealmanac
6880
serve`, or in the cloud with `codealmanac open`.
6981

82+
A folder counts as a CodeAlmanac wiki only when it has both `topics.yaml` and `pages/`.
83+
Derived local state appears when commands need it: `index.db` and
84+
user-level job records are runtime state, not part of the init scaffold.
85+
7086
## Principles
7187

7288
1. **Written for your agents.** The primary reader is the AI agent working in
@@ -104,17 +120,27 @@ model and need no credentials.
104120
|---|---|
105121
| `codealmanac init` | Build the first wiki for the current repo. |
106122
| `codealmanac local setup` | Configure local self-updating: branch policy + git hooks. |
123+
| `codealmanac local setup --branch main` | Configure a specific maintained branch locally. |
107124
| `codealmanac local update` | Run a local wiki update now. |
125+
| `codealmanac local update --using codex` | Run a local update with Codex. |
126+
| `codealmanac local triggers enable dev --delivery commit` | Maintain a branch locally. |
127+
| `codealmanac local jobs list` | Inspect local update jobs. |
108128
| `codealmanac search` / `show` / `topics` / `health` | Query the wiki. |
109129
| `codealmanac serve` | Local wiki viewer. |
110130
| `codealmanac setup` | Cloud sign-in plus agent instructions. |
111-
| `codealmanac capture enable\|status\|disable` | Manage session capture. |
131+
| `codealmanac login` / `whoami` / `logout` | Manage cloud auth. |
132+
| `codealmanac capture status` | Show capture status. |
133+
| `codealmanac capture enable --target codex` | Enable Codex session capture. |
134+
| `codealmanac capture disable` | Disable capture hooks. |
112135
| `codealmanac repo triggers enable <branch> --delivery pr\|commit` | Choose how cloud updates land. |
113136
| `codealmanac runs list\|show\|logs` | Inspect cloud update runs. |
114137
| `codealmanac doctor` | Check install, auth, and wiki health. |
115138

116139
Run `codealmanac <command> --help` for the full flag surface.
117-
`codealmanac uninstall --yes` removes setup-owned local artifacts.
140+
Local schedules stay behind explicit local or automation commands.
141+
`codealmanac uninstall --yes` removes setup-owned local artifacts;
142+
`codealmanac uninstall --yes --keep-automation` leaves local scheduled
143+
automation in place.
118144

119145
## Privacy
120146

docs/concepts.md

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -93,10 +93,12 @@ Command groups:
9393
|---|---|---|
9494
| Read | `list`, `search`, `show`, `topics`, `health`, `serve` | No |
9595
| Organize | `tag`, `untag`, `topics create/rename/delete/link` | No |
96-
| Lifecycle | `init`, `build`, `ingest`, `garden`, `sync`, `jobs` | `ingest`, `garden`, and write-capable `sync` |
97-
| Admin | `setup`, `login`, `whoami`, `logout`, `capture`, `uninstall`, `doctor`, `update`, `automation`, `reindex` | No |
96+
| Lifecycle | `init`, `sync`, `local update`, `jobs`, `local jobs` | `init`, `sync`, and `local update` |
97+
| Cloud | `setup`, `login`, `whoami`, `logout`, `capture`, `repo`, `runs`, `open` | No |
98+
| Admin | `local setup`, `local triggers`, `automation`, `uninstall`, `doctor`, `update`, `reindex` | No |
9899

99100
Scheduled automation is local scheduler state. It runs ordinary `codealmanac
100-
sync` or `codealmanac garden` commands; it is not hosted sync.
101-
`codealmanac setup --install-automation` can install those scheduler entries,
102-
and `codealmanac uninstall --keep-automation` leaves them in place.
101+
sync` jobs; it is not hosted sync. Root `codealmanac setup` is cloud setup and
102+
agent instructions only. Local schedules stay behind explicit local or
103+
automation commands, and `codealmanac uninstall --keep-automation` leaves them
104+
in place.

tests/test_public_contract.py

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@
4141
"codealmanac local update --using codex",
4242
"codealmanac local triggers enable dev --delivery commit",
4343
"codealmanac local jobs list",
44-
"## What Gets Created By Init",
44+
"## What gets created",
4545
"A folder counts as a CodeAlmanac wiki only when it has both",
4646
"`topics.yaml` and `pages/`",
4747
"Derived local state appears when commands need it:",
@@ -155,7 +155,7 @@ def test_default_user_state_paths_are_product_specific(isolated_home: Path):
155155
)
156156

157157

158-
def test_readme_documents_python_local_public_surface():
158+
def test_readme_documents_python_cloud_first_public_surface():
159159
readme = (PROJECT_ROOT / "README.md").read_text(encoding="utf-8")
160160

161161
for fragment in README_REQUIRED_FRAGMENTS:
@@ -178,7 +178,7 @@ def test_user_facing_docs_do_not_advertise_node_or_old_state_paths():
178178
assert "uv sync" in docs["CONTRIBUTING.md"]
179179
assert "uv run pytest" in docs["CONTRIBUTING.md"]
180180
assert "codealmanac init --root <path>" in docs["docs/concepts.md"]
181-
assert "codealmanac setup --install-automation" in docs["docs/concepts.md"]
181+
assert "Root `codealmanac setup` is cloud setup" in docs["docs/concepts.md"]
182182
assert "codealmanac uninstall --keep-automation" in docs["docs/concepts.md"]
183183
for body in docs.values():
184184
assert "npm install" not in body
@@ -191,7 +191,7 @@ def test_user_facing_docs_do_not_advertise_node_or_old_state_paths():
191191
def test_readme_keeps_init_scaffold_separate_from_runtime_state():
192192
readme = (PROJECT_ROOT / "README.md").read_text(encoding="utf-8")
193193

194-
init_section = readme_section(readme, "## What Gets Created By Init")
194+
init_section = readme_section(readme, "## What gets created")
195195

196196
assert "| |-- README.md" in init_section
197197
assert "| |-- topics.yaml" in init_section
@@ -205,7 +205,7 @@ def test_readme_keeps_init_scaffold_separate_from_runtime_state():
205205
def test_readme_quickstart_uses_search_that_works_after_init():
206206
readme = (PROJECT_ROOT / "README.md").read_text(encoding="utf-8")
207207

208-
quickstart = readme_section(readme, "## Quickstart")
208+
quickstart = readme_section(readme, "## Get started")
209209

210210
assert 'codealmanac search "getting"' in quickstart
211211
assert "codealmanac show getting-started" in quickstart
@@ -214,7 +214,7 @@ def test_readme_quickstart_uses_search_that_works_after_init():
214214

215215
def test_readme_lifecycle_examples_parse_public_local_commands():
216216
readme = (PROJECT_ROOT / "README.md").read_text(encoding="utf-8")
217-
updating = readme_section(readme, "## Updating The Wiki")
217+
commands = readme_section(readme, "## Commands")
218218
parser = build_parser()
219219

220220
parser.parse_args(("local", "setup", "--branch", "main"))
@@ -231,9 +231,9 @@ def test_readme_lifecycle_examples_parse_public_local_commands():
231231
)
232232
parser.parse_args(("local", "jobs", "list"))
233233

234-
assert "docs/adr.md" not in updating
235-
assert "codealmanac ingest" not in updating
236-
assert "codealmanac garden" not in updating
234+
assert "docs/adr.md" not in commands
235+
assert "codealmanac ingest" not in commands
236+
assert "codealmanac garden" not in commands
237237

238238

239239
def test_next_agent_brief_tracks_latest_python_port_slice():

0 commit comments

Comments
 (0)