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