specnest 1.0.0__tar.gz
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.
- specnest-1.0.0/.github/workflows/publish.yml +96 -0
- specnest-1.0.0/.gitignore +10 -0
- specnest-1.0.0/LICENSE +21 -0
- specnest-1.0.0/Makefile +45 -0
- specnest-1.0.0/PKG-INFO +363 -0
- specnest-1.0.0/README.md +352 -0
- specnest-1.0.0/docs/architecture.md +101 -0
- specnest-1.0.0/docs/release-management.md +68 -0
- specnest-1.0.0/pyproject.toml +25 -0
- specnest-1.0.0/src/specnest/__init__.py +7 -0
- specnest-1.0.0/src/specnest/__main__.py +4 -0
- specnest-1.0.0/src/specnest/cli.py +190 -0
- specnest-1.0.0/src/specnest/edits.py +122 -0
- specnest-1.0.0/src/specnest/model.py +169 -0
- specnest-1.0.0/src/specnest/parser.py +403 -0
- specnest-1.0.0/src/specnest/rules.py +480 -0
- specnest-1.0.0/src/specnest/seal.py +79 -0
- specnest-1.0.0/src/specnest/workflow.py +443 -0
- specnest-1.0.0/tests/__init__.py +0 -0
- specnest-1.0.0/tests/conftest.py +23 -0
- specnest-1.0.0/tests/fixtures/templates/adr.md +35 -0
- specnest-1.0.0/tests/fixtures/templates/plan.md +61 -0
- specnest-1.0.0/tests/helpers.py +134 -0
- specnest-1.0.0/tests/test_release.py +190 -0
- specnest-1.0.0/tests/test_rules.py +160 -0
- specnest-1.0.0/tests/test_workflow.py +348 -0
- specnest-1.0.0/uv.lock +156 -0
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
name: Publish
|
|
2
|
+
|
|
3
|
+
# Manual runs publish to TestPyPI only. Pushing a vX.Y.Z tag publishes to
|
|
4
|
+
# TestPyPI, verifies the install, then publishes the same files to PyPI.
|
|
5
|
+
on:
|
|
6
|
+
push:
|
|
7
|
+
tags: ["v*"]
|
|
8
|
+
workflow_dispatch:
|
|
9
|
+
|
|
10
|
+
permissions:
|
|
11
|
+
contents: read
|
|
12
|
+
|
|
13
|
+
concurrency:
|
|
14
|
+
group: publish-${{ github.ref }}
|
|
15
|
+
cancel-in-progress: false
|
|
16
|
+
|
|
17
|
+
jobs:
|
|
18
|
+
build:
|
|
19
|
+
runs-on: ubuntu-latest
|
|
20
|
+
steps:
|
|
21
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
22
|
+
with:
|
|
23
|
+
persist-credentials: false
|
|
24
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
25
|
+
- name: Check tag matches package version
|
|
26
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
27
|
+
run: |
|
|
28
|
+
version=$(uv version --short)
|
|
29
|
+
test "$GITHUB_REF_NAME" = "v$version" || {
|
|
30
|
+
echo "Tag $GITHUB_REF_NAME does not match package version $version" >&2
|
|
31
|
+
exit 1
|
|
32
|
+
}
|
|
33
|
+
- run: make build
|
|
34
|
+
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
|
|
35
|
+
with:
|
|
36
|
+
name: dist
|
|
37
|
+
path: dist/pypi/
|
|
38
|
+
if-no-files-found: error
|
|
39
|
+
|
|
40
|
+
publish-testpypi:
|
|
41
|
+
needs: build
|
|
42
|
+
runs-on: ubuntu-latest
|
|
43
|
+
environment:
|
|
44
|
+
name: testpypi
|
|
45
|
+
url: https://test.pypi.org/project/specnest/
|
|
46
|
+
permissions:
|
|
47
|
+
id-token: write
|
|
48
|
+
steps:
|
|
49
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
50
|
+
with:
|
|
51
|
+
name: dist
|
|
52
|
+
path: dist/pypi/
|
|
53
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
54
|
+
- run: >
|
|
55
|
+
uv publish --trusted-publishing always
|
|
56
|
+
--publish-url https://test.pypi.org/legacy/
|
|
57
|
+
--check-url https://test.pypi.org/simple/
|
|
58
|
+
dist/pypi/*
|
|
59
|
+
|
|
60
|
+
verify-testpypi:
|
|
61
|
+
needs: publish-testpypi
|
|
62
|
+
runs-on: ubuntu-latest
|
|
63
|
+
steps:
|
|
64
|
+
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
65
|
+
with:
|
|
66
|
+
persist-credentials: false
|
|
67
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
68
|
+
- name: Install from TestPyPI
|
|
69
|
+
run: |
|
|
70
|
+
for attempt in 1 2 3 4 5 6; do
|
|
71
|
+
make verify-test && exit 0
|
|
72
|
+
echo "TestPyPI not ready (attempt $attempt); retrying" >&2
|
|
73
|
+
sleep 20
|
|
74
|
+
done
|
|
75
|
+
exit 1
|
|
76
|
+
|
|
77
|
+
publish-pypi:
|
|
78
|
+
if: startsWith(github.ref, 'refs/tags/')
|
|
79
|
+
needs: verify-testpypi
|
|
80
|
+
runs-on: ubuntu-latest
|
|
81
|
+
environment:
|
|
82
|
+
name: pypi
|
|
83
|
+
url: https://pypi.org/project/specnest/
|
|
84
|
+
permissions:
|
|
85
|
+
id-token: write
|
|
86
|
+
steps:
|
|
87
|
+
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
|
|
88
|
+
with:
|
|
89
|
+
name: dist
|
|
90
|
+
path: dist/pypi/
|
|
91
|
+
- uses: astral-sh/setup-uv@1db35dd8eee11c5894872e0b383ae6c406cf738d # v10.4.0
|
|
92
|
+
- run: >
|
|
93
|
+
uv publish --trusted-publishing always
|
|
94
|
+
--publish-url https://upload.pypi.org/legacy/
|
|
95
|
+
--check-url https://pypi.org/simple/
|
|
96
|
+
dist/pypi/*
|
specnest-1.0.0/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2020 A42SS
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
specnest-1.0.0/Makefile
ADDED
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
.PHONY: test build publish-test verify-test publish
|
|
2
|
+
|
|
3
|
+
PACKAGE := specnest
|
|
4
|
+
DIST_DIR := dist/pypi
|
|
5
|
+
|
|
6
|
+
# PyPI's token upload API; "legacy" is the endpoint's current official name.
|
|
7
|
+
TESTPYPI_UPLOAD_URL := https://test.pypi.org/legacy/
|
|
8
|
+
TESTPYPI_INDEX_URL := https://test.pypi.org/simple/
|
|
9
|
+
TESTPYPI_JSON_URL := https://test.pypi.org/pypi
|
|
10
|
+
PYPI_UPLOAD_URL := https://upload.pypi.org/legacy/
|
|
11
|
+
PYPI_INDEX_URL := https://pypi.org/simple/
|
|
12
|
+
|
|
13
|
+
ARTIFACTS = "$(DIST_DIR)/$(PACKAGE)-$$version.tar.gz" \
|
|
14
|
+
"$(DIST_DIR)/$(PACKAGE)-$$version-py3-none-any.whl"
|
|
15
|
+
|
|
16
|
+
test:
|
|
17
|
+
uv run --locked python -m pytest -q
|
|
18
|
+
|
|
19
|
+
build: test
|
|
20
|
+
uv build --no-sources --out-dir $(DIST_DIR)
|
|
21
|
+
|
|
22
|
+
publish-test:
|
|
23
|
+
@test -n "$$TEST_PYPI_TOKEN" || { echo "TEST_PYPI_TOKEN is not set" >&2; exit 1; }
|
|
24
|
+
@$(MAKE) -f $(firstword $(MAKEFILE_LIST)) build
|
|
25
|
+
@version=$$(uv version --short) && \
|
|
26
|
+
UV_PUBLISH_TOKEN="$$TEST_PYPI_TOKEN" uv publish \
|
|
27
|
+
--publish-url $(TESTPYPI_UPLOAD_URL) --check-url $(TESTPYPI_INDEX_URL) \
|
|
28
|
+
$(ARTIFACTS)
|
|
29
|
+
|
|
30
|
+
verify-test:
|
|
31
|
+
@version=$$(uv version --short) && \
|
|
32
|
+
release=$$(curl -fsSL "$(TESTPYPI_JSON_URL)/$(PACKAGE)/$$version/json") && \
|
|
33
|
+
wheel_url=$$(printf '%s' "$$release" | uv run --no-project python -c 'import json, sys; print(next(f["url"] for f in json.load(sys.stdin)["urls"] if f["packagetype"] == "bdist_wheel"))') && \
|
|
34
|
+
installed=$$(uvx --refresh --from "$(PACKAGE) @ $$wheel_url" specnest --version) && \
|
|
35
|
+
echo "$$installed" && \
|
|
36
|
+
test "$$installed" = "specnest $$version" || \
|
|
37
|
+
{ echo "$(PACKAGE) $$version is not installable from TestPyPI; run make publish-test first" >&2; exit 1; }
|
|
38
|
+
|
|
39
|
+
publish:
|
|
40
|
+
@test -n "$$PYPI_TOKEN" || { echo "PYPI_TOKEN is not set" >&2; exit 1; }
|
|
41
|
+
@$(MAKE) -f $(firstword $(MAKEFILE_LIST)) build verify-test
|
|
42
|
+
@version=$$(uv version --short) && \
|
|
43
|
+
UV_PUBLISH_TOKEN="$$PYPI_TOKEN" uv publish \
|
|
44
|
+
--publish-url $(PYPI_UPLOAD_URL) --check-url $(PYPI_INDEX_URL) \
|
|
45
|
+
$(ARTIFACTS)
|
specnest-1.0.0/PKG-INFO
ADDED
|
@@ -0,0 +1,363 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: specnest
|
|
3
|
+
Version: 1.0.0
|
|
4
|
+
Summary: Reusable spec-driven workflow CLI
|
|
5
|
+
Author: A42SS
|
|
6
|
+
License-Expression: MIT
|
|
7
|
+
License-File: LICENSE
|
|
8
|
+
Requires-Python: >=3.11
|
|
9
|
+
Requires-Dist: pyyaml>=6.0.4
|
|
10
|
+
Description-Content-Type: text/markdown
|
|
11
|
+
|
|
12
|
+
# SpecNest
|
|
13
|
+
|
|
14
|
+
SpecNest is a CLI for validating and coordinating spec-driven development. It
|
|
15
|
+
stores plans, tasks, and architecture decision records (ADRs) as Markdown with
|
|
16
|
+
YAML metadata. Humans review and approve the specifications; implementers use
|
|
17
|
+
the CLI to find and update ready tasks.
|
|
18
|
+
|
|
19
|
+
The CLI uses a small, fixed documentation layout in the consuming project. It
|
|
20
|
+
does not install project-specific agent profiles or automation there.
|
|
21
|
+
|
|
22
|
+
## Installation
|
|
23
|
+
|
|
24
|
+
SpecNest requires Python 3.11 or newer. From a checkout of this repository,
|
|
25
|
+
install it into your Python environment:
|
|
26
|
+
|
|
27
|
+
```sh
|
|
28
|
+
python -m pip install .
|
|
29
|
+
specnest --version
|
|
30
|
+
```
|
|
31
|
+
|
|
32
|
+
PyYAML is installed as a dependency. `python -m specnest` is equivalent to
|
|
33
|
+
`specnest` if the environment's scripts directory is not on your PATH.
|
|
34
|
+
|
|
35
|
+
## Quick start
|
|
36
|
+
|
|
37
|
+
The following example is for a new or empty consuming project. If your project
|
|
38
|
+
already has these files, integrate the examples rather than overwriting them.
|
|
39
|
+
Run the commands from that project's root.
|
|
40
|
+
|
|
41
|
+
1. Create the directories:
|
|
42
|
+
|
|
43
|
+
```sh
|
|
44
|
+
mkdir -p docs/plans docs/architecture/decisions .github/agents
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
2. Create `docs/specs.config.yaml`, replacing `alice` with an approver's GitHub
|
|
48
|
+
handle. The list must not be empty; quote handles that start with `@`.
|
|
49
|
+
|
|
50
|
+
```yaml
|
|
51
|
+
approvers:
|
|
52
|
+
- alice
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
3. Create `.github/agents/implementer.agent.md`:
|
|
56
|
+
|
|
57
|
+
```markdown
|
|
58
|
+
---
|
|
59
|
+
description: Implements approved plan tasks.
|
|
60
|
+
---
|
|
61
|
+
|
|
62
|
+
Follow the task's acceptance criteria and the project's instructions.
|
|
63
|
+
```
|
|
64
|
+
|
|
65
|
+
SpecNest checks that the named agent file exists; it does not execute or
|
|
66
|
+
inspect the profile. Supply real instructions appropriate for your project.
|
|
67
|
+
|
|
68
|
+
4. Create `docs/architecture/decisions/ADR-0001-use-python.md`:
|
|
69
|
+
|
|
70
|
+
```markdown
|
|
71
|
+
---
|
|
72
|
+
id: ADR-0001
|
|
73
|
+
title: Use Python for the smoke check
|
|
74
|
+
status: proposed
|
|
75
|
+
owner: alice
|
|
76
|
+
created: 2025-01-01
|
|
77
|
+
updated: 2025-01-01
|
|
78
|
+
supersedes: []
|
|
79
|
+
---
|
|
80
|
+
|
|
81
|
+
# ADR-0001: Use Python for the smoke check
|
|
82
|
+
|
|
83
|
+
## Context
|
|
84
|
+
|
|
85
|
+
The example needs a portable command.
|
|
86
|
+
|
|
87
|
+
## Decision
|
|
88
|
+
|
|
89
|
+
Use Python to print a known string.
|
|
90
|
+
|
|
91
|
+
## Consequences
|
|
92
|
+
|
|
93
|
+
The check requires Python.
|
|
94
|
+
```
|
|
95
|
+
|
|
96
|
+
5. Create `docs/plans/PLAN-0001-add-a-smoke-check.md`:
|
|
97
|
+
|
|
98
|
+
````markdown
|
|
99
|
+
---
|
|
100
|
+
id: PLAN-0001
|
|
101
|
+
title: Add a smoke check
|
|
102
|
+
status: review
|
|
103
|
+
owner: alice
|
|
104
|
+
created: 2025-01-01
|
|
105
|
+
updated: 2025-01-01
|
|
106
|
+
adrs: [ADR-0001]
|
|
107
|
+
depends_on: []
|
|
108
|
+
---
|
|
109
|
+
|
|
110
|
+
# PLAN-0001: Add a smoke check
|
|
111
|
+
|
|
112
|
+
## Context
|
|
113
|
+
|
|
114
|
+
The example needs a repeatable smoke check.
|
|
115
|
+
|
|
116
|
+
## Goals
|
|
117
|
+
|
|
118
|
+
- Verify a simple Python command.
|
|
119
|
+
|
|
120
|
+
## Non-goals
|
|
121
|
+
|
|
122
|
+
- Monitor a production service.
|
|
123
|
+
|
|
124
|
+
## Approach
|
|
125
|
+
|
|
126
|
+
Follow ADR-0001 and verify the command's output.
|
|
127
|
+
|
|
128
|
+
## Tasks
|
|
129
|
+
|
|
130
|
+
### PLAN-0001-T01: Verify the smoke check
|
|
131
|
+
|
|
132
|
+
```yaml
|
|
133
|
+
status: todo
|
|
134
|
+
depends_on: []
|
|
135
|
+
agent: implementer
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
Run the command and check its output.
|
|
139
|
+
|
|
140
|
+
**Acceptance criteria**
|
|
141
|
+
|
|
142
|
+
- [ ] `python -c "print('ok')"` prints `ok`.
|
|
143
|
+
|
|
144
|
+
## Validation
|
|
145
|
+
|
|
146
|
+
Repeat the acceptance criterion.
|
|
147
|
+
|
|
148
|
+
## Risks
|
|
149
|
+
|
|
150
|
+
- This example does not check application behavior.
|
|
151
|
+
````
|
|
152
|
+
|
|
153
|
+
6. Validate, approve the ADR before the plan, and work through the task. Use
|
|
154
|
+
the configured approver's handle in place of `alice`:
|
|
155
|
+
|
|
156
|
+
```sh
|
|
157
|
+
specnest validate
|
|
158
|
+
specnest approve ADR-0001 --by alice
|
|
159
|
+
specnest approve PLAN-0001 --by alice
|
|
160
|
+
specnest list
|
|
161
|
+
specnest next --json
|
|
162
|
+
specnest show PLAN-0001-T01
|
|
163
|
+
specnest task PLAN-0001-T01 --status in-progress
|
|
164
|
+
python -c "print('ok')"
|
|
165
|
+
specnest task PLAN-0001-T01 --status done
|
|
166
|
+
specnest validate
|
|
167
|
+
```
|
|
168
|
+
|
|
169
|
+
Completing the last task automatically marks the plan `done`. SpecNest does
|
|
170
|
+
not run acceptance criteria or authenticate the person named by `--by`; use
|
|
171
|
+
your own review process and access controls.
|
|
172
|
+
|
|
173
|
+
## Commands
|
|
174
|
+
|
|
175
|
+
```bash
|
|
176
|
+
specnest --help
|
|
177
|
+
specnest <command> --help
|
|
178
|
+
```
|
|
179
|
+
|
|
180
|
+
| Command | Purpose |
|
|
181
|
+
| --- | --- |
|
|
182
|
+
| `specnest validate` | Report errors and warnings across all plans and ADRs. Warnings alone do not fail validation. |
|
|
183
|
+
| `specnest list` | List plans and ADRs, including task progress. |
|
|
184
|
+
| `specnest next [--plan PLAN-0001] [--json]` | Select a ready task from approved plans; resume an in-progress task before a new one within the same plan. |
|
|
185
|
+
| `specnest show ID` | Show a task brief or summarize a plan or ADR. |
|
|
186
|
+
| `specnest task ID --status STATUS [--reason TEXT]` | Update a task. Status is `todo`, `in-progress`, `done`, or `blocked`; a blocked task requires a reason. |
|
|
187
|
+
| `specnest approve ID --by HANDLE` | Record a human approval and seal the plan or ADR. |
|
|
188
|
+
| `specnest new {plan,adr} TITLE [--owner HANDLE]` | Create a draft from a project-supplied template. |
|
|
189
|
+
|
|
190
|
+
Without `--root`, SpecNest searches the current directory and its parents for
|
|
191
|
+
`docs/specs.config.yaml`. To operate elsewhere, put `--root` **before** the
|
|
192
|
+
command, for example `specnest --root /path/to/project validate`.
|
|
193
|
+
|
|
194
|
+
Exit codes are `0` for success, `1` for validation or workflow errors, `2` for
|
|
195
|
+
argument errors, and `3` when `next` finds no ready task. With `next --json`,
|
|
196
|
+
the success response contains `task`, `title`, `status`, `agent`, `plan`, and
|
|
197
|
+
`plan_path`; the no-task response contains `"task": null` and a list of
|
|
198
|
+
`"reasons"`.
|
|
199
|
+
|
|
200
|
+
## Repository format and workflow
|
|
201
|
+
|
|
202
|
+
SpecNest looks for files in these locations, relative to the project root:
|
|
203
|
+
|
|
204
|
+
```text
|
|
205
|
+
docs/specs.config.yaml # approvers
|
|
206
|
+
docs/plans/PLAN-0001-example.md # plans
|
|
207
|
+
docs/architecture/decisions/ADR-0001-example.md
|
|
208
|
+
docs/templates/plan.md # required only for "new plan"
|
|
209
|
+
docs/templates/adr.md # required only for "new adr"
|
|
210
|
+
.github/agents/implementer.agent.md # one file per referenced agent
|
|
211
|
+
```
|
|
212
|
+
|
|
213
|
+
Plan and ADR filenames must start with their ID; `PLAN-0001.md` and
|
|
214
|
+
`ADR-0001.md` are also accepted. Both types require `id`, `title`, `status`,
|
|
215
|
+
`owner`, `created`, and `updated` front matter; dates use `YYYY-MM-DD`. The H1
|
|
216
|
+
must be `# ID: Title`. Plans need Context, Goals, Non-goals, Approach, Tasks,
|
|
217
|
+
Validation, and Risks sections; ADRs need Context, Decision, and Consequences.
|
|
218
|
+
Incomplete sections and placeholders are warnings in drafts and errors when
|
|
219
|
+
the document is ready for review or approval.
|
|
220
|
+
|
|
221
|
+
Under a plan's `## Tasks` section, each task has a heading such as
|
|
222
|
+
`### PLAN-0001-T01: Title`, followed immediately (apart from blank lines) by a
|
|
223
|
+
fenced YAML metadata block and an **Acceptance criteria** list. The metadata
|
|
224
|
+
may contain `status`, `depends_on`, `agent`, and `blocked_reason`; task
|
|
225
|
+
dependencies are task ID lists, and the default agent is `implementer`.
|
|
226
|
+
Plan `depends_on` and `adrs` are lists of plan IDs and ADR IDs respectively.
|
|
227
|
+
The validator checks references, task and plan dependency cycles, agent files,
|
|
228
|
+
statuses, and approval seals.
|
|
229
|
+
|
|
230
|
+
A typical lifecycle is:
|
|
231
|
+
|
|
232
|
+
1. Write a `draft` plan or ADR, fill in its content, then set its status to
|
|
233
|
+
`review` (plan) or `proposed` (ADR).
|
|
234
|
+
2. Run `specnest validate`. A human approver accepts referenced ADRs and then
|
|
235
|
+
approves the plan. Approved plans may only rely on accepted ADRs.
|
|
236
|
+
3. Use `next`, `show`, and `task` to work in dependency order. A plan waits for
|
|
237
|
+
prerequisite plans to be `done`; a task waits for prerequisite tasks to be
|
|
238
|
+
`done`. Use `--status blocked --reason "..."` when work cannot proceed.
|
|
239
|
+
4. After the last task is done, the plan becomes `done`. Reopening a completed
|
|
240
|
+
task is rejected when dependent work has already started.
|
|
241
|
+
|
|
242
|
+
Approvals detect changes to sealed content. Task status and blocked reason,
|
|
243
|
+
along with selected administrative front matter, may change without breaking
|
|
244
|
+
the seal. To amend an approved plan, return it to `review`, remove its
|
|
245
|
+
`approval` block, make the changes, and have a human approve it again. A
|
|
246
|
+
deprecated or superseded ADR puts dependent approved plans on hold until they
|
|
247
|
+
are amended and re-approved. See [Architecture](docs/architecture.md) for
|
|
248
|
+
details and limitations.
|
|
249
|
+
|
|
250
|
+
### Scaffolding drafts
|
|
251
|
+
|
|
252
|
+
`new` needs `docs/templates/plan.md` or `docs/templates/adr.md` in the
|
|
253
|
+
consuming project; templates are not installed into your project automatically.
|
|
254
|
+
You can write your own or copy the example
|
|
255
|
+
[plan](tests/fixtures/templates/plan.md) and
|
|
256
|
+
[ADR](tests/fixtures/templates/adr.md) templates from this checkout:
|
|
257
|
+
|
|
258
|
+
```sh
|
|
259
|
+
mkdir -p docs/templates
|
|
260
|
+
cp "/path/to/SpecNest/tests/fixtures/templates/plan.md" docs/templates/plan.md
|
|
261
|
+
cp "/path/to/SpecNest/tests/fixtures/templates/adr.md" docs/templates/adr.md
|
|
262
|
+
specnest new plan "Improve the smoke check" --owner alice
|
|
263
|
+
specnest new adr "Choose a test runner" --owner alice
|
|
264
|
+
```
|
|
265
|
+
|
|
266
|
+
Replace `/path/to/SpecNest` with the checkout path. Templates use `{{id}}`,
|
|
267
|
+
`{{title}}`, `{{owner}}`, and `{{date}}` substitutions. The owner defaults to
|
|
268
|
+
the first configured approver. Fill in the resulting drafts and replace their
|
|
269
|
+
placeholders before review.
|
|
270
|
+
|
|
271
|
+
## Development
|
|
272
|
+
|
|
273
|
+
With [uv](https://docs.astral.sh/uv/) installed, set up the locked development
|
|
274
|
+
dependencies and run the test suite from this checkout:
|
|
275
|
+
|
|
276
|
+
```sh
|
|
277
|
+
uv sync --locked
|
|
278
|
+
make test
|
|
279
|
+
```
|
|
280
|
+
|
|
281
|
+
The tests use temporary project directories; they do not require a GitHub
|
|
282
|
+
account or modify a consuming project. Without Make, run
|
|
283
|
+
`uv run --locked python -m pytest -q` instead.
|
|
284
|
+
|
|
285
|
+
## Contributing
|
|
286
|
+
|
|
287
|
+
Issues and pull requests are welcome. Before opening a pull request, run
|
|
288
|
+
`make test` and describe the changes and their intended behavior.
|
|
289
|
+
|
|
290
|
+
By submitting a contribution, you confirm that you have the right to submit it
|
|
291
|
+
and agree to license it under the project's [MIT license](LICENSE).
|
|
292
|
+
|
|
293
|
+
## Publishing
|
|
294
|
+
|
|
295
|
+
Releases go to [TestPyPI](https://test.pypi.org/) first, then to PyPI:
|
|
296
|
+
|
|
297
|
+
| Command | What it does |
|
|
298
|
+
| --- | --- |
|
|
299
|
+
| `make publish-test` | Runs the tests, builds the sdist and wheel in `dist/pypi`, and uploads the current version to TestPyPI. |
|
|
300
|
+
| `make verify-test` | Installs the current version's wheel from TestPyPI in an isolated environment and checks `specnest --version`. |
|
|
301
|
+
| `make publish` | Runs the tests, builds, verifies the TestPyPI release, and uploads the same version to PyPI. |
|
|
302
|
+
|
|
303
|
+
`make publish` stops before uploading if the current version is not installable
|
|
304
|
+
from TestPyPI. PyPI and TestPyPI versions are immutable and public; use a new
|
|
305
|
+
version for every release and keep the version in `pyproject.toml` and
|
|
306
|
+
`src/specnest/__init__.py` in sync.
|
|
307
|
+
|
|
308
|
+
Uploads authenticate with API tokens, never with a username and password.
|
|
309
|
+
TestPyPI and PyPI are separate services, so create an account, enable 2FA, and
|
|
310
|
+
create an API token on each: [TestPyPI](https://test.pypi.org/manage/account/)
|
|
311
|
+
and [PyPI](https://pypi.org/manage/account/). The first upload of a new project
|
|
312
|
+
needs an account-scoped token; afterward, replace it with a project-scoped token.
|
|
313
|
+
Both registries upload through their `/legacy/` endpoint, which is PyPI's
|
|
314
|
+
current upload API despite its name.
|
|
315
|
+
|
|
316
|
+
In Bash or Zsh, enter each token without echoing it or saving it in shell
|
|
317
|
+
history:
|
|
318
|
+
|
|
319
|
+
```sh
|
|
320
|
+
printf 'TestPyPI token: '
|
|
321
|
+
read -rs TEST_PYPI_TOKEN; echo
|
|
322
|
+
export TEST_PYPI_TOKEN
|
|
323
|
+
make publish-test
|
|
324
|
+
make verify-test
|
|
325
|
+
unset TEST_PYPI_TOKEN
|
|
326
|
+
|
|
327
|
+
printf 'PyPI token: '
|
|
328
|
+
read -rs PYPI_TOKEN; echo
|
|
329
|
+
export PYPI_TOKEN
|
|
330
|
+
make publish
|
|
331
|
+
unset PYPI_TOKEN
|
|
332
|
+
```
|
|
333
|
+
|
|
334
|
+
Do not commit tokens.
|
|
335
|
+
|
|
336
|
+
### Publishing from GitHub Actions
|
|
337
|
+
|
|
338
|
+
[`.github/workflows/publish.yml`](.github/workflows/publish.yml) publishes with
|
|
339
|
+
[Trusted Publishing](https://docs.pypi.org/trusted-publishers/), so no tokens
|
|
340
|
+
are stored in GitHub:
|
|
341
|
+
|
|
342
|
+
- **Run workflow** (manual) runs the tests, builds, uploads to TestPyPI, and
|
|
343
|
+
verifies the install.
|
|
344
|
+
- **Pushing a `vX.Y.Z` tag** does the same, then uploads the same files to PyPI.
|
|
345
|
+
The tag must match the version in `pyproject.toml`.
|
|
346
|
+
|
|
347
|
+
See the [release management guide](docs/release-management.md) for one-time
|
|
348
|
+
setup, the complete release procedure, and local publishing details.
|
|
349
|
+
|
|
350
|
+
To release:
|
|
351
|
+
|
|
352
|
+
```sh
|
|
353
|
+
git tag vX.Y.Z
|
|
354
|
+
git push origin vX.Y.Z
|
|
355
|
+
```
|
|
356
|
+
|
|
357
|
+
## License
|
|
358
|
+
|
|
359
|
+
The package is distributed under the MIT license. The implementation and license
|
|
360
|
+
are attributed to A42SS; see [LICENSE](LICENSE) for the full terms.
|
|
361
|
+
|
|
362
|
+
The software is provided **as is**, without warranty. Use it at your own risk:
|
|
363
|
+
review changes and keep backups before running commands that modify files.
|