macrostates-cli 0.3.1__tar.gz → 0.4.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.
Files changed (47) hide show
  1. macrostates_cli-0.4.0/.macrostates/implementation/application.yaml +10 -0
  2. macrostates_cli-0.4.0/.macrostates/implementation/release.yaml +4 -0
  3. macrostates_cli-0.4.0/MANIFEST.in +2 -0
  4. macrostates_cli-0.4.0/PKG-INFO +335 -0
  5. macrostates_cli-0.4.0/README.md +320 -0
  6. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/pyproject.toml +1 -0
  7. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/__init__.py +10 -2
  8. macrostates_cli-0.4.0/src/macrostates/_build_version.py +140 -0
  9. macrostates_cli-0.4.0/src/macrostates/_changes.py +305 -0
  10. macrostates_cli-0.4.0/src/macrostates/_cli.py +294 -0
  11. macrostates_cli-0.4.0/src/macrostates/_deliverables.py +235 -0
  12. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_formats/common.py +14 -2
  13. macrostates_cli-0.4.0/src/macrostates/_git.py +139 -0
  14. macrostates_cli-0.4.0/src/macrostates/_integration.py +210 -0
  15. macrostates_cli-0.4.0/src/macrostates/_migration.py +96 -0
  16. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_project.py +170 -8
  17. macrostates_cli-0.4.0/src/macrostates/_release.py +851 -0
  18. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_sources.py +106 -1
  19. macrostates_cli-0.4.0/src/macrostates/_sync.py +65 -0
  20. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_validation.py +41 -1
  21. macrostates_cli-0.4.0/src/macrostates/_versioning.py +250 -0
  22. macrostates_cli-0.4.0/src/macrostates_cli.egg-info/PKG-INFO +335 -0
  23. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates_cli.egg-info/SOURCES.txt +9 -0
  24. macrostates_cli-0.3.1/.macrostates/implementation/release.yaml +0 -3
  25. macrostates_cli-0.3.1/MANIFEST.in +0 -1
  26. macrostates_cli-0.3.1/PKG-INFO +0 -259
  27. macrostates_cli-0.3.1/README.md +0 -244
  28. macrostates_cli-0.3.1/src/macrostates/_build_version.py +0 -56
  29. macrostates_cli-0.3.1/src/macrostates/_cli.py +0 -158
  30. macrostates_cli-0.3.1/src/macrostates_cli.egg-info/PKG-INFO +0 -259
  31. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/LICENSE +0 -0
  32. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/setup.cfg +0 -0
  33. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/__main__.py +0 -0
  34. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_formats/__init__.py +0 -0
  35. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_formats/v0.py +0 -0
  36. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_formats/v1.py +0 -0
  37. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_integrity.py +0 -0
  38. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_io.py +0 -0
  39. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_models.py +0 -0
  40. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_mutations.py +0 -0
  41. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_scopes.py +0 -0
  42. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/_staged.py +0 -0
  43. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates/py.typed +0 -0
  44. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates_cli.egg-info/dependency_links.txt +0 -0
  45. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates_cli.egg-info/entry_points.txt +0 -0
  46. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates_cli.egg-info/requires.txt +0 -0
  47. {macrostates_cli-0.3.1 → macrostates_cli-0.4.0}/src/macrostates_cli.egg-info/top_level.txt +0 -0
@@ -0,0 +1,10 @@
1
+ schema_version: 1
2
+ name: macrostates-cli
3
+ version: 0.4.0
4
+ status: candidate
5
+ specification: specs-1.0.0
6
+ implementation: imp-1.0.0
7
+ release_date: '2026-10-13'
8
+ source:
9
+ tag: v0.4.0
10
+ source_sha256: add414d530542993e6805a29a04e52c253e44bec69111d28bc6f887d19d19328
@@ -0,0 +1,4 @@
1
+ version: imp-1.0.0
2
+ specification: specs-1.0.0
3
+ release_date: '2026-10-13'
4
+ schema_version: 2
@@ -0,0 +1,2 @@
1
+ include .macrostates/implementation/release.yaml
2
+ include .macrostates/implementation/application.yaml
@@ -0,0 +1,335 @@
1
+ Metadata-Version: 2.4
2
+ Name: macrostates-cli
3
+ Version: 0.4.0
4
+ Summary: Compose, install and validate versioned Macrostates specification packages.
5
+ Author-email: Lucas Lopez <713375+lucaslopez@users.noreply.github.com>
6
+ License-Expression: MIT
7
+ Project-URL: Repository, https://github.com/Macrostates/macrostates-cli
8
+ Project-URL: Documentation, https://github.com/Macrostates/macrostates-cli#readme
9
+ Project-URL: Issues, https://github.com/Macrostates/macrostates-cli/issues
10
+ Requires-Python: >=3.12
11
+ Description-Content-Type: text/markdown
12
+ License-File: LICENSE
13
+ Requires-Dist: PyYAML<7,>=6.0.2
14
+ Dynamic: license-file
15
+
16
+ # Macrostates CLI
17
+
18
+ Install, inspect, and check reusable specification packages. Prepare development
19
+ change records, synchronize Git branches, and review integration and baseline
20
+ release readiness. Packages stay readable in numbered, version-controlled
21
+ directories such as `000_meta/` and `001_process/`.
22
+
23
+ The `macrostates` command and public `macrostates` Python API share the same
24
+ operations. Requires Python 3.12 or newer. Distribution name: `macrostates-cli`.
25
+ Import package and executable name: `macrostates`.
26
+ Licensed under [MIT](https://github.com/Macrostates/macrostates-cli/blob/main/LICENSE).
27
+
28
+ This release introduces application version `0.4.0` and support for the released
29
+ Meta 2.2, Process 5, Repository 4, Python 2.1.1 and Python-library 2 packages.
30
+ The CLI application version is independent from its Macrostates specification
31
+ and implementation baselines. Older projects retain their selected formats and
32
+ policies until explicitly adopted and migrated.
33
+
34
+ ## Installation
35
+
36
+ Install the published package from
37
+ [PyPI](https://pypi.org/project/macrostates-cli/) with pip in a Python 3.12 or
38
+ newer environment:
39
+
40
+ ```bash
41
+ python -m pip install "macrostates-cli>=0.4.0"
42
+ macrostates --help
43
+ ```
44
+
45
+ Use `python -m pip install macrostates-cli==0.4.0` to select this release, or
46
+ `python -m pip install --upgrade macrostates-cli` to update. The older `0.3.1`
47
+ release remains available for projects that deliberately retain it. A virtual environment can be created with
48
+ `python -m venv .venv`; activate it before installing when your environment
49
+ requires one. For a command outside a project environment, use
50
+ `pipx install macrostates-cli` or `uv tool install macrostates-cli`.
51
+
52
+ To work from source, clone the repository and run `uv sync --locked`.
53
+ Use `uv run macrostates ...` from that environment. Installed version reporting
54
+ uses distribution metadata; source development identities are inspected through
55
+ the separate `identity` command.
56
+
57
+ ## Start A Project
58
+
59
+ Supply a composition with explicit package versions, sources, authority, and
60
+ reading orders. The
61
+ [minimal composition](https://github.com/Macrostates/macrostates-cli/blob/main/examples/composition.yaml)
62
+ selects only Meta; add Process and the technology packages appropriate to your
63
+ project.
64
+
65
+ ```bash
66
+ macrostates init --from /path/to/composition.yaml
67
+ macrostates install
68
+ macrostates info
69
+ macrostates check
70
+ ```
71
+
72
+ The shorthand `macrostates init --name my-project --package meta@2.2.0`
73
+ creates a composition. Repeat `--package NAME@VERSION` for additional packages.
74
+ Input order supplies both reading order and authority, highest first; review them
75
+ before installation. No dependency or latest release is selected automatically.
76
+ Use `--from` for custom sources and deliberate orders.
77
+
78
+ The default layout is:
79
+
80
+ ```text
81
+ AGENTS.md
82
+ .macrostates/
83
+ specs/
84
+ main.md
85
+ composition.yaml
86
+ composition.lock.yaml
87
+ 000_meta/
88
+ ...
89
+ implementation/
90
+ main.md
91
+ ```
92
+
93
+ Commit the composition, lock, package copies, and local requirements. Initialization
94
+ preserves existing agent instructions, refuses overwrites, and creates
95
+ specification scaffolding. Process 5 initialization supplies a provisional
96
+ specification seed; it never invents an accepted implementation baseline. Establish
97
+ the first baseline explicitly under the selected Process policy before using
98
+ ordinary release planning.
99
+
100
+ The CLI is strongly recommended and optional. Structural checks and recorded
101
+ evidence assist specification reading; semantic requirements, truthful approval,
102
+ and implementation conformance still need review. Existing projects keep their
103
+ selected policies until deliberately adopted and migrated.
104
+
105
+ ## Package Commands
106
+
107
+ | Command | Purpose | Effects |
108
+ | --- | --- | --- |
109
+ | `init` | Prepare selected specification files | Local writes |
110
+ | `install` | Download and validate selected package releases | Source access and package/lock writes |
111
+ | `install --locked` | Restore an unchanged locked selection | Source access and package/lock writes |
112
+ | `lock` | Compare copies with canonical releases and record integrity | Source access and lock write |
113
+ | `verify` | Check external inventories and executable flags | Offline, read-only |
114
+ | `lint` | Check metadata, dependencies, orders, links, and selected policies | Offline, read-only |
115
+ | `info` | Inspect selections, provenance, dependencies, and scopes | Offline, read-only |
116
+ | `check` | Combine lint and integrity verification | Offline, read-only |
117
+ | `check --staged` | Check the exact Git index | Offline, read-only |
118
+
119
+ All commands accept `--project PATH` and `--json` before or after the command.
120
+ Discovery uses the nearest composition and stops at a Git root. Ambiguous
121
+ manifests/layouts fail clearly. Exit codes are **0** for success, **1** for failed
122
+ checks, and **2** for invalid input/operations. Usage errors retain standard text
123
+ help. Reports include diagnostic codes, messages, paths, and severity.
124
+
125
+ Local packages use `source: {type: local}`. They remain editable and linted;
126
+ external inventory checks exclude them. Exact composition selections and verified
127
+ locks preserve downloaded package identities.
128
+
129
+ ## Git Package Sources And Recovery
130
+
131
+ This version supports `source.type: git-archive` with an explicitly
132
+ configured Git URL, SSH remote, or local repository and an annotated
133
+ `vMAJOR.MINOR.PATCH` tag. It materializes the exact resolved commit as tracked
134
+ files, using externally configured Git authentication. Installed packages are
135
+ readable snapshots and do not contain upstream working clones.
136
+
137
+ The legacy `github-archive` transport and public `GitHubSource` provider remain
138
+ available for existing compositions. That provider retains explicit token,
139
+ `GH_TOKEN`/`GITHUB_TOKEN`, and existing GitHub CLI login authentication precedence.
140
+ The generic `GitSource` provider uses configured Git authentication. Credentials
141
+ are never stored in compositions/locks or echoed in transport errors.
142
+
143
+ For updates, deliberately change selected `version` and `source.tag`, review the
144
+ human entrypoint and dependencies, then run `install`. It replaces a previous
145
+ copy only when that copy matches its locked inventory. Modified content is
146
+ preserved. Use `install --locked` to restore a missing unchanged copy.
147
+
148
+ Locks record full commit IDs and SHA-256 inventories of bytes and executable
149
+ flags. Reinstallation refuses a tag moved to another commit. Offline `verify`
150
+ cannot discover remote tag movement or establish the trustworthiness of an edited
151
+ lock; review locks with their package changes.
152
+
153
+ Package and release preparation roll back ordinary replacement failures and
154
+ retain recovery data when rollback itself fails. Interrupted operations require
155
+ inspection before retrying. See
156
+ [recovery guidance](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/specs/051_cli/annex_recovery.md).
157
+
158
+ ## Development And Baseline Releases
159
+
160
+ The following development commands require explicit selection of supported
161
+ Process 5.0. `branch-status` and `branch-sync` also serve projects retaining older
162
+ version policies. Core operations work with Git refs and commits; your repository
163
+ policy defines the review/integration mechanism and required external checks.
164
+
165
+ New baseline tooling uses a shared composition at the Git repository root,
166
+ including monorepos with several applications. Independently composed nested
167
+ projects within another checkout keep existing package checks, but need separate
168
+ Git or manual procedures for independent baselines. Identity inspection explains
169
+ when computed source identity is unavailable.
170
+
171
+ | Command | Purpose |
172
+ | --- | --- |
173
+ | `start-work --id ID` | Capture starting commit and baseline provenance before development or synchronization |
174
+ | `identity --work ID` | Inspect the work's computed development identity |
175
+ | `deliverables` | Inspect optional application policies and effective default versions |
176
+ | `change-create` | Declare separate specification/implementation impact, coverage, evidence, and gaps |
177
+ | `change-check` | Check those records for readiness |
178
+ | `closure-request` | List workflows and produce a numbered request for definer-authorized closure |
179
+ | `branch-status --target REF` | Inspect divergence against cached target state |
180
+ | `branch-sync --target REF --strategy merge\|rebase` | Incorporate upstream changes on a safe development branch |
181
+ | `integration-check --target REF` | Validate exact proposed combined contents and local readiness |
182
+ | `release-plan --target REF` | Calculate a reviewed, target/tree-bound baseline plan |
183
+ | `release-prepare --plan PATH --date YYYY-MM-DD` | Prepare candidate declarations and consume included records |
184
+ | `release-check` | Check candidate consistency and baseline identities |
185
+ | `release-check --publication` | Additionally require integrated annotated baseline tags and declared release source identities |
186
+ | `migrate-versioning` | Explicitly convert legacy declarations and preserve original refs/provenance |
187
+
188
+ Create development and release branches through the repository's policy. The CLI
189
+ does not create branches, submit integration proposals, approve reviews, tag,
190
+ push, or upload artifacts. Synchronization may merge or rebase commits only when
191
+ explicitly requested. It refuses the primary branch, dirty/detached states, and
192
+ existing operations, and leaves conflicts for the implementer to resolve. Add
193
+ `--fetch-remote NAME` to explicitly fetch a configured remote first.
194
+
195
+ After creating a branch, capture work before adding commits:
196
+
197
+ ```bash
198
+ macrostates start-work --id offline-mode
199
+ macrostates identity --work offline-mode
200
+ ```
201
+
202
+ If work started earlier, use `--origin-commit` with its actual full original
203
+ commit ID. The original provenance remains unchanged when upstream updates are
204
+ incorporated. A computed identity can look like
205
+ `imp-0.3.1-branch.feature-x.gabc123`; it does not reserve the next release number.
206
+
207
+ When preparing completed work, declare its impact explicitly:
208
+
209
+ ```bash
210
+ macrostates change-create --id offline-mode --work offline-mode \
211
+ --summary "Support the specified offline operation" \
212
+ --specification-impact minor --implementation-impact minor \
213
+ --requirements /path/to/coverage.yaml \
214
+ --evidence "Offline behavior checks passed"
215
+ macrostates change-check
216
+ macrostates closure-request
217
+ ```
218
+
219
+ The coverage document contains a `requirements` list with `requirement`,
220
+ `implementation`, and `verification` entries. Use explicit `none` impacts for
221
+ tracking-only changes. Semantic classification remains the implementer's
222
+ responsibility. Obtain the definer's required closure authorization and record
223
+ it; the CLI never closes workflows automatically.
224
+
225
+ Commit the completed preparation, then run `integration-check` against the
226
+ current target. Optional `--expected-target` binds the check to a full target
227
+ commit. The combined result must have valid scope/evidence and no open or
228
+ unconfirmed workflows, including history. Required external reviews and CI may
229
+ begin after a proposal is created, but still block final integration.
230
+
231
+ Accepted change records accumulate on the primary branch as unreleased work.
232
+ When finalization is requested, create a release branch from current integrated
233
+ state, refresh and incorporate the authoritative target, and review
234
+ `release-plan --target origin/main` when that is the configured authoritative
235
+ ref. The command uses cached state without fetching automatically. Save its
236
+ output outside the checkout or in an
237
+ ignored location. `release-prepare` applies that exact plan without committing it.
238
+ Changed source, records, declarations, or target require reassessment. Close the
239
+ release-preparation workflow, commit and check the candidate, then follow the
240
+ project's reviewed integration procedure. Tagging and publication remain separate
241
+ authorized operations.
242
+
243
+ Applications can release independently of the shared `specs-*` and `imp-*`
244
+ baselines. Without an application policy, their stable version is the numeric
245
+ selected implementation version. Android can use that default version name and
246
+ retain its own increasing version code. A new repository baseline does not
247
+ automatically release every application. Preserve exact source and baseline
248
+ provenance for each published deliverable.
249
+
250
+ An application policy may permit a later release of identity metadata, such as its
251
+ version/date or an Android counter, against an existing finalized baseline.
252
+ Review a ready `none`/`none` change record with evidence and no gaps, close its
253
+ workflows, and validate that only permitted metadata/bookkeeping changed. The
254
+ record stays pending; the old baseline plan, consumed records, and tags remain
255
+ unchanged. The application release identifies its new source commit separately
256
+ from those exact baseline references. No no-bump baseline plan is created.
257
+ Runtime, contract, or build-logic changes require ordinary impact classification.
258
+
259
+ The application still needs a new identity accepted by its distribution policy.
260
+ The numeric implementation default cannot be reused to upload changed artifacts
261
+ under an already published immutable package version. Independent numbering or
262
+ a technology-specific additional identity distinguishes another release.
263
+
264
+ ## Python API
265
+
266
+ ```python
267
+ from macrostates import Project
268
+
269
+ project = Project.open("/path/to/project")
270
+ report = project.check()
271
+ for diagnostic in report.diagnostics:
272
+ print(diagnostic.code, diagnostic.message, diagnostic.path)
273
+ assert report.ok
274
+ ```
275
+
276
+ Supported root exports include `Project`, `Report`, `Diagnostic`,
277
+ `MacrostatesError`, `GitSource`, and `SourceProvider`, with the retained legacy
278
+ transport provider documented above. `Project.open` and `Project.initialize`
279
+ construct projects. The package and development operations in the tables have
280
+ matching public methods, including `start_work`, `create_change`, `sync_branch`,
281
+ `check_integration`, `plan_release`, and `prepare_release`.
282
+
283
+ Pass `source=GitSource()` or an injected `SourceProvider` for explicit transport
284
+ control. Report-returning checks return unsuccessful diagnostics rather than
285
+ terminating the caller. Invalid operations raise `MacrostatesError`; ordinary
286
+ file reads may raise `OSError`. Imports perform no project/network I/O or logging
287
+ configuration. Explicit `__version__` access reads installed distribution metadata.
288
+ See the
289
+ [public library contract](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/specs/051_cli/002_library.md)
290
+ for signatures and the
291
+ [development contract](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/specs/051_cli/008_development-and-releases.md)
292
+ for data and readiness boundaries.
293
+
294
+ ## Compatibility And Contributing
295
+
296
+ Retain composition formats 0/1, package metadata format 1, inventory lock format
297
+ 1, modern and legacy locations, and previously supported release-policy adapters.
298
+ New Process operations require deliberate policy adoption; reading an older
299
+ project never migrates it. Tagged legacy subtrees remain maintainable through Git
300
+ and canonical locking; archive installation does not convert them implicitly.
301
+ Unknown future formats/policies fail clearly.
302
+
303
+ ```bash
304
+ uv sync --locked
305
+ uv run ruff check .
306
+ uv run ruff format --check .
307
+ uv run pyright
308
+ uv run pytest --cov=macrostates --cov-report=term-missing
309
+ uv build
310
+ ```
311
+
312
+ Contributor dependencies are locked. Build output goes to ignored `dist/` and
313
+ temporary work to `tmp/<activity>/`. Optional hooks can run `check --staged`;
314
+ integration-preparation checks belong at their dedicated gate, since ordinary
315
+ development commits legitimately contain open workflows. Index checks preserve
316
+ partial staging, have documented resource limits, and exclude submodule contents.
317
+
318
+ The CLI tracks its own composition under `.macrostates/specs/`. Adoption of the
319
+ new official releases, exact selections, lock, and final baseline declarations
320
+ will be verified separately. This development branch uses an independent
321
+ [application declaration](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/implementation/application.yaml)
322
+ for independent build version `0.4.0`; the Macrostates implementation declaration is a
323
+ separate identity. Candidate/finalized builds bind verified shipped source and
324
+ rebuild from source distributions without Git. Builds do not mutate declarations
325
+ or publish artifacts.
326
+
327
+ See
328
+ [implementation documentation](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/implementation/main.md)
329
+ and
330
+ [conformance mapping](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/implementation/specification-conformance.md)
331
+ for architecture, current adoption state, evidence, and limitations.
332
+
333
+ ## AI Assistance
334
+
335
+ This project was developed with AI assistance.
@@ -0,0 +1,320 @@
1
+ # Macrostates CLI
2
+
3
+ Install, inspect, and check reusable specification packages. Prepare development
4
+ change records, synchronize Git branches, and review integration and baseline
5
+ release readiness. Packages stay readable in numbered, version-controlled
6
+ directories such as `000_meta/` and `001_process/`.
7
+
8
+ The `macrostates` command and public `macrostates` Python API share the same
9
+ operations. Requires Python 3.12 or newer. Distribution name: `macrostates-cli`.
10
+ Import package and executable name: `macrostates`.
11
+ Licensed under [MIT](https://github.com/Macrostates/macrostates-cli/blob/main/LICENSE).
12
+
13
+ This release introduces application version `0.4.0` and support for the released
14
+ Meta 2.2, Process 5, Repository 4, Python 2.1.1 and Python-library 2 packages.
15
+ The CLI application version is independent from its Macrostates specification
16
+ and implementation baselines. Older projects retain their selected formats and
17
+ policies until explicitly adopted and migrated.
18
+
19
+ ## Installation
20
+
21
+ Install the published package from
22
+ [PyPI](https://pypi.org/project/macrostates-cli/) with pip in a Python 3.12 or
23
+ newer environment:
24
+
25
+ ```bash
26
+ python -m pip install "macrostates-cli>=0.4.0"
27
+ macrostates --help
28
+ ```
29
+
30
+ Use `python -m pip install macrostates-cli==0.4.0` to select this release, or
31
+ `python -m pip install --upgrade macrostates-cli` to update. The older `0.3.1`
32
+ release remains available for projects that deliberately retain it. A virtual environment can be created with
33
+ `python -m venv .venv`; activate it before installing when your environment
34
+ requires one. For a command outside a project environment, use
35
+ `pipx install macrostates-cli` or `uv tool install macrostates-cli`.
36
+
37
+ To work from source, clone the repository and run `uv sync --locked`.
38
+ Use `uv run macrostates ...` from that environment. Installed version reporting
39
+ uses distribution metadata; source development identities are inspected through
40
+ the separate `identity` command.
41
+
42
+ ## Start A Project
43
+
44
+ Supply a composition with explicit package versions, sources, authority, and
45
+ reading orders. The
46
+ [minimal composition](https://github.com/Macrostates/macrostates-cli/blob/main/examples/composition.yaml)
47
+ selects only Meta; add Process and the technology packages appropriate to your
48
+ project.
49
+
50
+ ```bash
51
+ macrostates init --from /path/to/composition.yaml
52
+ macrostates install
53
+ macrostates info
54
+ macrostates check
55
+ ```
56
+
57
+ The shorthand `macrostates init --name my-project --package meta@2.2.0`
58
+ creates a composition. Repeat `--package NAME@VERSION` for additional packages.
59
+ Input order supplies both reading order and authority, highest first; review them
60
+ before installation. No dependency or latest release is selected automatically.
61
+ Use `--from` for custom sources and deliberate orders.
62
+
63
+ The default layout is:
64
+
65
+ ```text
66
+ AGENTS.md
67
+ .macrostates/
68
+ specs/
69
+ main.md
70
+ composition.yaml
71
+ composition.lock.yaml
72
+ 000_meta/
73
+ ...
74
+ implementation/
75
+ main.md
76
+ ```
77
+
78
+ Commit the composition, lock, package copies, and local requirements. Initialization
79
+ preserves existing agent instructions, refuses overwrites, and creates
80
+ specification scaffolding. Process 5 initialization supplies a provisional
81
+ specification seed; it never invents an accepted implementation baseline. Establish
82
+ the first baseline explicitly under the selected Process policy before using
83
+ ordinary release planning.
84
+
85
+ The CLI is strongly recommended and optional. Structural checks and recorded
86
+ evidence assist specification reading; semantic requirements, truthful approval,
87
+ and implementation conformance still need review. Existing projects keep their
88
+ selected policies until deliberately adopted and migrated.
89
+
90
+ ## Package Commands
91
+
92
+ | Command | Purpose | Effects |
93
+ | --- | --- | --- |
94
+ | `init` | Prepare selected specification files | Local writes |
95
+ | `install` | Download and validate selected package releases | Source access and package/lock writes |
96
+ | `install --locked` | Restore an unchanged locked selection | Source access and package/lock writes |
97
+ | `lock` | Compare copies with canonical releases and record integrity | Source access and lock write |
98
+ | `verify` | Check external inventories and executable flags | Offline, read-only |
99
+ | `lint` | Check metadata, dependencies, orders, links, and selected policies | Offline, read-only |
100
+ | `info` | Inspect selections, provenance, dependencies, and scopes | Offline, read-only |
101
+ | `check` | Combine lint and integrity verification | Offline, read-only |
102
+ | `check --staged` | Check the exact Git index | Offline, read-only |
103
+
104
+ All commands accept `--project PATH` and `--json` before or after the command.
105
+ Discovery uses the nearest composition and stops at a Git root. Ambiguous
106
+ manifests/layouts fail clearly. Exit codes are **0** for success, **1** for failed
107
+ checks, and **2** for invalid input/operations. Usage errors retain standard text
108
+ help. Reports include diagnostic codes, messages, paths, and severity.
109
+
110
+ Local packages use `source: {type: local}`. They remain editable and linted;
111
+ external inventory checks exclude them. Exact composition selections and verified
112
+ locks preserve downloaded package identities.
113
+
114
+ ## Git Package Sources And Recovery
115
+
116
+ This version supports `source.type: git-archive` with an explicitly
117
+ configured Git URL, SSH remote, or local repository and an annotated
118
+ `vMAJOR.MINOR.PATCH` tag. It materializes the exact resolved commit as tracked
119
+ files, using externally configured Git authentication. Installed packages are
120
+ readable snapshots and do not contain upstream working clones.
121
+
122
+ The legacy `github-archive` transport and public `GitHubSource` provider remain
123
+ available for existing compositions. That provider retains explicit token,
124
+ `GH_TOKEN`/`GITHUB_TOKEN`, and existing GitHub CLI login authentication precedence.
125
+ The generic `GitSource` provider uses configured Git authentication. Credentials
126
+ are never stored in compositions/locks or echoed in transport errors.
127
+
128
+ For updates, deliberately change selected `version` and `source.tag`, review the
129
+ human entrypoint and dependencies, then run `install`. It replaces a previous
130
+ copy only when that copy matches its locked inventory. Modified content is
131
+ preserved. Use `install --locked` to restore a missing unchanged copy.
132
+
133
+ Locks record full commit IDs and SHA-256 inventories of bytes and executable
134
+ flags. Reinstallation refuses a tag moved to another commit. Offline `verify`
135
+ cannot discover remote tag movement or establish the trustworthiness of an edited
136
+ lock; review locks with their package changes.
137
+
138
+ Package and release preparation roll back ordinary replacement failures and
139
+ retain recovery data when rollback itself fails. Interrupted operations require
140
+ inspection before retrying. See
141
+ [recovery guidance](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/specs/051_cli/annex_recovery.md).
142
+
143
+ ## Development And Baseline Releases
144
+
145
+ The following development commands require explicit selection of supported
146
+ Process 5.0. `branch-status` and `branch-sync` also serve projects retaining older
147
+ version policies. Core operations work with Git refs and commits; your repository
148
+ policy defines the review/integration mechanism and required external checks.
149
+
150
+ New baseline tooling uses a shared composition at the Git repository root,
151
+ including monorepos with several applications. Independently composed nested
152
+ projects within another checkout keep existing package checks, but need separate
153
+ Git or manual procedures for independent baselines. Identity inspection explains
154
+ when computed source identity is unavailable.
155
+
156
+ | Command | Purpose |
157
+ | --- | --- |
158
+ | `start-work --id ID` | Capture starting commit and baseline provenance before development or synchronization |
159
+ | `identity --work ID` | Inspect the work's computed development identity |
160
+ | `deliverables` | Inspect optional application policies and effective default versions |
161
+ | `change-create` | Declare separate specification/implementation impact, coverage, evidence, and gaps |
162
+ | `change-check` | Check those records for readiness |
163
+ | `closure-request` | List workflows and produce a numbered request for definer-authorized closure |
164
+ | `branch-status --target REF` | Inspect divergence against cached target state |
165
+ | `branch-sync --target REF --strategy merge\|rebase` | Incorporate upstream changes on a safe development branch |
166
+ | `integration-check --target REF` | Validate exact proposed combined contents and local readiness |
167
+ | `release-plan --target REF` | Calculate a reviewed, target/tree-bound baseline plan |
168
+ | `release-prepare --plan PATH --date YYYY-MM-DD` | Prepare candidate declarations and consume included records |
169
+ | `release-check` | Check candidate consistency and baseline identities |
170
+ | `release-check --publication` | Additionally require integrated annotated baseline tags and declared release source identities |
171
+ | `migrate-versioning` | Explicitly convert legacy declarations and preserve original refs/provenance |
172
+
173
+ Create development and release branches through the repository's policy. The CLI
174
+ does not create branches, submit integration proposals, approve reviews, tag,
175
+ push, or upload artifacts. Synchronization may merge or rebase commits only when
176
+ explicitly requested. It refuses the primary branch, dirty/detached states, and
177
+ existing operations, and leaves conflicts for the implementer to resolve. Add
178
+ `--fetch-remote NAME` to explicitly fetch a configured remote first.
179
+
180
+ After creating a branch, capture work before adding commits:
181
+
182
+ ```bash
183
+ macrostates start-work --id offline-mode
184
+ macrostates identity --work offline-mode
185
+ ```
186
+
187
+ If work started earlier, use `--origin-commit` with its actual full original
188
+ commit ID. The original provenance remains unchanged when upstream updates are
189
+ incorporated. A computed identity can look like
190
+ `imp-0.3.1-branch.feature-x.gabc123`; it does not reserve the next release number.
191
+
192
+ When preparing completed work, declare its impact explicitly:
193
+
194
+ ```bash
195
+ macrostates change-create --id offline-mode --work offline-mode \
196
+ --summary "Support the specified offline operation" \
197
+ --specification-impact minor --implementation-impact minor \
198
+ --requirements /path/to/coverage.yaml \
199
+ --evidence "Offline behavior checks passed"
200
+ macrostates change-check
201
+ macrostates closure-request
202
+ ```
203
+
204
+ The coverage document contains a `requirements` list with `requirement`,
205
+ `implementation`, and `verification` entries. Use explicit `none` impacts for
206
+ tracking-only changes. Semantic classification remains the implementer's
207
+ responsibility. Obtain the definer's required closure authorization and record
208
+ it; the CLI never closes workflows automatically.
209
+
210
+ Commit the completed preparation, then run `integration-check` against the
211
+ current target. Optional `--expected-target` binds the check to a full target
212
+ commit. The combined result must have valid scope/evidence and no open or
213
+ unconfirmed workflows, including history. Required external reviews and CI may
214
+ begin after a proposal is created, but still block final integration.
215
+
216
+ Accepted change records accumulate on the primary branch as unreleased work.
217
+ When finalization is requested, create a release branch from current integrated
218
+ state, refresh and incorporate the authoritative target, and review
219
+ `release-plan --target origin/main` when that is the configured authoritative
220
+ ref. The command uses cached state without fetching automatically. Save its
221
+ output outside the checkout or in an
222
+ ignored location. `release-prepare` applies that exact plan without committing it.
223
+ Changed source, records, declarations, or target require reassessment. Close the
224
+ release-preparation workflow, commit and check the candidate, then follow the
225
+ project's reviewed integration procedure. Tagging and publication remain separate
226
+ authorized operations.
227
+
228
+ Applications can release independently of the shared `specs-*` and `imp-*`
229
+ baselines. Without an application policy, their stable version is the numeric
230
+ selected implementation version. Android can use that default version name and
231
+ retain its own increasing version code. A new repository baseline does not
232
+ automatically release every application. Preserve exact source and baseline
233
+ provenance for each published deliverable.
234
+
235
+ An application policy may permit a later release of identity metadata, such as its
236
+ version/date or an Android counter, against an existing finalized baseline.
237
+ Review a ready `none`/`none` change record with evidence and no gaps, close its
238
+ workflows, and validate that only permitted metadata/bookkeeping changed. The
239
+ record stays pending; the old baseline plan, consumed records, and tags remain
240
+ unchanged. The application release identifies its new source commit separately
241
+ from those exact baseline references. No no-bump baseline plan is created.
242
+ Runtime, contract, or build-logic changes require ordinary impact classification.
243
+
244
+ The application still needs a new identity accepted by its distribution policy.
245
+ The numeric implementation default cannot be reused to upload changed artifacts
246
+ under an already published immutable package version. Independent numbering or
247
+ a technology-specific additional identity distinguishes another release.
248
+
249
+ ## Python API
250
+
251
+ ```python
252
+ from macrostates import Project
253
+
254
+ project = Project.open("/path/to/project")
255
+ report = project.check()
256
+ for diagnostic in report.diagnostics:
257
+ print(diagnostic.code, diagnostic.message, diagnostic.path)
258
+ assert report.ok
259
+ ```
260
+
261
+ Supported root exports include `Project`, `Report`, `Diagnostic`,
262
+ `MacrostatesError`, `GitSource`, and `SourceProvider`, with the retained legacy
263
+ transport provider documented above. `Project.open` and `Project.initialize`
264
+ construct projects. The package and development operations in the tables have
265
+ matching public methods, including `start_work`, `create_change`, `sync_branch`,
266
+ `check_integration`, `plan_release`, and `prepare_release`.
267
+
268
+ Pass `source=GitSource()` or an injected `SourceProvider` for explicit transport
269
+ control. Report-returning checks return unsuccessful diagnostics rather than
270
+ terminating the caller. Invalid operations raise `MacrostatesError`; ordinary
271
+ file reads may raise `OSError`. Imports perform no project/network I/O or logging
272
+ configuration. Explicit `__version__` access reads installed distribution metadata.
273
+ See the
274
+ [public library contract](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/specs/051_cli/002_library.md)
275
+ for signatures and the
276
+ [development contract](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/specs/051_cli/008_development-and-releases.md)
277
+ for data and readiness boundaries.
278
+
279
+ ## Compatibility And Contributing
280
+
281
+ Retain composition formats 0/1, package metadata format 1, inventory lock format
282
+ 1, modern and legacy locations, and previously supported release-policy adapters.
283
+ New Process operations require deliberate policy adoption; reading an older
284
+ project never migrates it. Tagged legacy subtrees remain maintainable through Git
285
+ and canonical locking; archive installation does not convert them implicitly.
286
+ Unknown future formats/policies fail clearly.
287
+
288
+ ```bash
289
+ uv sync --locked
290
+ uv run ruff check .
291
+ uv run ruff format --check .
292
+ uv run pyright
293
+ uv run pytest --cov=macrostates --cov-report=term-missing
294
+ uv build
295
+ ```
296
+
297
+ Contributor dependencies are locked. Build output goes to ignored `dist/` and
298
+ temporary work to `tmp/<activity>/`. Optional hooks can run `check --staged`;
299
+ integration-preparation checks belong at their dedicated gate, since ordinary
300
+ development commits legitimately contain open workflows. Index checks preserve
301
+ partial staging, have documented resource limits, and exclude submodule contents.
302
+
303
+ The CLI tracks its own composition under `.macrostates/specs/`. Adoption of the
304
+ new official releases, exact selections, lock, and final baseline declarations
305
+ will be verified separately. This development branch uses an independent
306
+ [application declaration](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/implementation/application.yaml)
307
+ for independent build version `0.4.0`; the Macrostates implementation declaration is a
308
+ separate identity. Candidate/finalized builds bind verified shipped source and
309
+ rebuild from source distributions without Git. Builds do not mutate declarations
310
+ or publish artifacts.
311
+
312
+ See
313
+ [implementation documentation](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/implementation/main.md)
314
+ and
315
+ [conformance mapping](https://github.com/Macrostates/macrostates-cli/blob/main/.macrostates/implementation/specification-conformance.md)
316
+ for architecture, current adoption state, evidence, and limitations.
317
+
318
+ ## AI Assistance
319
+
320
+ This project was developed with AI assistance.