spaex 5.3.0__tar.gz → 5.3.2__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 (103) hide show
  1. {spaex-5.3.0 → spaex-5.3.2}/PKG-INFO +2 -2
  2. {spaex-5.3.0 → spaex-5.3.2}/README.md +1 -1
  3. {spaex-5.3.0 → spaex-5.3.2}/pyproject.toml +1 -1
  4. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/add.py +6 -40
  5. spaex-5.3.2/src/spaex/cli/reinstall_options.py +49 -0
  6. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/remove.py +6 -10
  7. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/integrations/runner.py +16 -0
  8. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/integrations/speckit.py +42 -2
  9. {spaex-5.3.0 → spaex-5.3.2}/src/spaex.egg-info/PKG-INFO +2 -2
  10. {spaex-5.3.0 → spaex-5.3.2}/src/spaex.egg-info/SOURCES.txt +1 -0
  11. {spaex-5.3.0 → spaex-5.3.2}/setup.cfg +0 -0
  12. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/__init__.py +0 -0
  13. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/__main__.py +0 -0
  14. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/__init__.py +0 -0
  15. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/bootstrap.py +0 -0
  16. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/clauses.py +0 -0
  17. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/__init__.py +0 -0
  18. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/batching.py +0 -0
  19. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/clarifications.py +0 -0
  20. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/clarify.py +0 -0
  21. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/completeness.py +0 -0
  22. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/failure.py +0 -0
  23. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/invoke.py +0 -0
  24. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/prompt.py +0 -0
  25. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/composer/reduce.py +0 -0
  26. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/emit.py +0 -0
  27. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/fragment.py +0 -0
  28. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/materialize.py +0 -0
  29. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/orchestrate.py +0 -0
  30. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/precheck.py +0 -0
  31. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/behavior/stale.py +0 -0
  32. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/__init__.py +0 -0
  33. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/behavior_commands.py +0 -0
  34. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/constitution.py +0 -0
  35. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/diagnostics.py +0 -0
  36. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/install.py +0 -0
  37. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/main.py +0 -0
  38. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/skills.py +0 -0
  39. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/cli/status.py +0 -0
  40. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/constitution/__init__.py +0 -0
  41. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/constitution/publish.py +0 -0
  42. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/constitution/resolve.py +0 -0
  43. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/constitution/safety.py +0 -0
  44. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/constitution/show.py +0 -0
  45. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/__init__.py +0 -0
  46. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/cache.py +0 -0
  47. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/molecule_store.py +0 -0
  48. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/publisher_fetch.py +0 -0
  49. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/remote.py +0 -0
  50. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/revparse.py +0 -0
  51. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/git/show.py +0 -0
  52. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/__init__.py +0 -0
  53. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/delta.py +0 -0
  54. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/errors.py +0 -0
  55. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/generation.py +0 -0
  56. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/generic_atoms.py +0 -0
  57. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/hook_runner.py +0 -0
  58. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/inflight.py +0 -0
  59. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/lock.py +0 -0
  60. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/manifest_lock.py +0 -0
  61. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/nix_packages.py +0 -0
  62. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/overlay.py +0 -0
  63. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/install/write_and_reinstall.py +0 -0
  64. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/integrations/__init__.py +0 -0
  65. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/io/__init__.py +0 -0
  66. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/io/atomic.py +0 -0
  67. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/io/json_deterministic.py +0 -0
  68. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/io/state.py +0 -0
  69. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/io/transaction.py +0 -0
  70. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/io/writer_lock.py +0 -0
  71. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/__init__.py +0 -0
  72. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/_immutable.py +0 -0
  73. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/atom_category.py +0 -0
  74. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/consumer_manifest.py +0 -0
  75. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/install_lock.py +0 -0
  76. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/molecule_id.py +0 -0
  77. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/molecule_manifest.py +0 -0
  78. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/publisher_manifest.py +0 -0
  79. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/repo_relative_path.py +0 -0
  80. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/source_url.py +0 -0
  81. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/model/version_constraint.py +0 -0
  82. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/paths.py +0 -0
  83. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/report/__init__.py +0 -0
  84. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/report/compose.py +0 -0
  85. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/report/staleness.py +0 -0
  86. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/report/trace.py +0 -0
  87. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/__init__.py +0 -0
  88. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/data/consumer-manifest.v4.schema.json +0 -0
  89. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/data/install-lock.v4.schema.json +0 -0
  90. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/data/molecule-manifest.v4.schema.json +0 -0
  91. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/data/publisher-manifest.v4.schema.json +0 -0
  92. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/loader.py +0 -0
  93. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/schema/validator.py +0 -0
  94. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/skills/__init__.py +0 -0
  95. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/skills/installer.py +0 -0
  96. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/util/__init__.py +0 -0
  97. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/util/errors.py +0 -0
  98. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/util/exit_codes.py +0 -0
  99. {spaex-5.3.0 → spaex-5.3.2}/src/spaex/util/path_containment.py +0 -0
  100. {spaex-5.3.0 → spaex-5.3.2}/src/spaex.egg-info/dependency_links.txt +0 -0
  101. {spaex-5.3.0 → spaex-5.3.2}/src/spaex.egg-info/entry_points.txt +0 -0
  102. {spaex-5.3.0 → spaex-5.3.2}/src/spaex.egg-info/requires.txt +0 -0
  103. {spaex-5.3.0 → spaex-5.3.2}/src/spaex.egg-info/top_level.txt +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spaex
3
- Version: 5.3.0
3
+ Version: 5.3.2
4
4
  Summary: spaex 4.0: reproducible coding harnesses for any repo. Compose skills, MCPs, constitutions, slash commands, and dev-environment files into a single project; add/remove/install/migrate/constitution show CLI.
5
5
  Author: spaex contributors
6
6
  License: Apache-2.0
@@ -38,7 +38,7 @@ spaex composes a coding harness for a single repo out of reusable pieces (MCPs,
38
38
 
39
39
  ## Molecule install-hooks
40
40
 
41
- A molecule may declare an optional `install_hook` in its `manifest.json`. `spaex install` invokes it as a normal subprocess (arbitrary code, consumer-user permissions, full environment inheritance) after any required atom materialization and before publishing the install.lock generation; hook-only molecules run without atom materialization. Per-molecule `on_failure: "abort" | "warn"` selects between transaction rollback and continue-with-`hook_status`-recorded. Consumers can opt out for a single invocation via `spaex install --no-install-hooks` (or `spaex add --no-install-hooks`). See [docs/install-hooks.md](docs/install-hooks.md) for the full contract: declaration schema, execution semantics, the four failure kinds, idempotency, non-reversibility, and the trust model.
41
+ A molecule may declare an optional `install_hook` in its `manifest.json`. `spaex install` invokes it as a normal subprocess (arbitrary code, consumer-user permissions, full environment inheritance) after any required atom materialization and before publishing the install.lock generation; hook-only molecules run without atom materialization. Per-molecule `on_failure: "abort" | "warn"` selects between transaction rollback and continue-with-`hook_status`-recorded. Consumers can opt out for a single invocation via `spaex install --no-install-hooks` (or `spaex add --no-install-hooks` / `spaex remove --no-install-hooks`; both also accept `--speckit-agents` and `--no-speckit-integrations` for their internal install). See [docs/install-hooks.md](docs/install-hooks.md) for the full contract: declaration schema, execution semantics, the four failure kinds, idempotency, non-reversibility, and the trust model.
42
42
 
43
43
  ## Atom-category conventions
44
44
 
@@ -19,7 +19,7 @@ spaex composes a coding harness for a single repo out of reusable pieces (MCPs,
19
19
 
20
20
  ## Molecule install-hooks
21
21
 
22
- A molecule may declare an optional `install_hook` in its `manifest.json`. `spaex install` invokes it as a normal subprocess (arbitrary code, consumer-user permissions, full environment inheritance) after any required atom materialization and before publishing the install.lock generation; hook-only molecules run without atom materialization. Per-molecule `on_failure: "abort" | "warn"` selects between transaction rollback and continue-with-`hook_status`-recorded. Consumers can opt out for a single invocation via `spaex install --no-install-hooks` (or `spaex add --no-install-hooks`). See [docs/install-hooks.md](docs/install-hooks.md) for the full contract: declaration schema, execution semantics, the four failure kinds, idempotency, non-reversibility, and the trust model.
22
+ A molecule may declare an optional `install_hook` in its `manifest.json`. `spaex install` invokes it as a normal subprocess (arbitrary code, consumer-user permissions, full environment inheritance) after any required atom materialization and before publishing the install.lock generation; hook-only molecules run without atom materialization. Per-molecule `on_failure: "abort" | "warn"` selects between transaction rollback and continue-with-`hook_status`-recorded. Consumers can opt out for a single invocation via `spaex install --no-install-hooks` (or `spaex add --no-install-hooks` / `spaex remove --no-install-hooks`; both also accept `--speckit-agents` and `--no-speckit-integrations` for their internal install). See [docs/install-hooks.md](docs/install-hooks.md) for the full contract: declaration schema, execution semantics, the four failure kinds, idempotency, non-reversibility, and the trust model.
23
23
 
24
24
  ## Atom-category conventions
25
25
 
@@ -4,7 +4,7 @@ build-backend = "setuptools.build_meta"
4
4
 
5
5
  [project]
6
6
  name = "spaex"
7
- version = "5.3.0"
7
+ version = "5.3.2"
8
8
  description = "spaex 4.0: reproducible coding harnesses for any repo. Compose skills, MCPs, constitutions, slash commands, and dev-environment files into a single project; add/remove/install/migrate/constitution show CLI."
9
9
  readme = "README.md"
10
10
  requires-python = ">=3.14,<3.15"
@@ -10,9 +10,11 @@ the full contract.
10
10
  from __future__ import annotations
11
11
 
12
12
  import argparse
13
+ import dataclasses
13
14
  import sys
14
15
  from pathlib import Path
15
16
 
17
+ from spaex.cli.reinstall_options import add_reinstall_arguments, reinstall_kwargs
16
18
  from spaex.git import publisher_fetch
17
19
  from spaex.git import show as git_show
18
20
  from spaex.install.manifest_lock import (
@@ -325,16 +327,8 @@ def _mutate_compounds(
325
327
  molecules=tuple(sorted(set(added_ids))),
326
328
  )
327
329
  )
328
- return ConsumerManifest(
329
- spaex_version=manifest.spaex_version,
330
- identity=manifest.identity,
331
- compounds=tuple(new_compounds),
332
- spaex_min_version=manifest.spaex_min_version,
333
- groups=manifest.groups,
334
- active_feature=manifest.active_feature,
335
- identity_note=manifest.identity_note,
336
- local_fragments=manifest.local_fragments,
337
- )
330
+ # replace() keeps every other top-level field, e.g. skill_installation.
331
+ return dataclasses.replace(manifest, compounds=tuple(new_compounds))
338
332
 
339
333
 
340
334
  def add_arguments(parser: argparse.ArgumentParser) -> None:
@@ -355,31 +349,7 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:
355
349
  default=DEFAULT_LOCK_TIMEOUT_SECONDS,
356
350
  help="Manifest-lock timeout in seconds (default 30; 0 = fail-fast)",
357
351
  )
358
- parser.add_argument(
359
- "--no-install-hooks",
360
- dest="skip_hooks",
361
- action="store_true",
362
- help=(
363
- "Skip per-molecule install_hook execution during the internal "
364
- "install triggered by this add. Every molecule declaring "
365
- "install_hook records hook_status='skipped' in install.lock; "
366
- "atoms still materialize. Per-invocation only; a later "
367
- "`spaex install` without this flag runs the hooks (Spec 016 "
368
- "FR-027)."
369
- ),
370
- )
371
- parser.add_argument(
372
- "--speckit-agents",
373
- dest="speckit_agents",
374
- default=None,
375
- help="Select declared Spec Kit integrations for the internal install.",
376
- )
377
- parser.add_argument(
378
- "--no-speckit-integrations",
379
- dest="no_speckit_integrations",
380
- action="store_true",
381
- help="Skip declared Spec Kit integrations for the internal install.",
382
- )
352
+ add_reinstall_arguments(parser, command="add")
383
353
 
384
354
 
385
355
  def run(args: argparse.Namespace) -> int:
@@ -440,11 +410,7 @@ def run(args: argparse.Namespace) -> int:
440
410
  repo_root,
441
411
  new_bytes,
442
412
  lock,
443
- skip_hooks=bool(getattr(args, "skip_hooks", False)),
444
- speckit_agents=getattr(args, "speckit_agents", None),
445
- no_speckit_integrations=bool(
446
- getattr(args, "no_speckit_integrations", False)
447
- ),
413
+ **reinstall_kwargs(args),
448
414
  # FR-024a: add-time plausibility check. A cross-molecule Composer
449
415
  # contradiction warns and marks `.spaex/.stale` instead of
450
416
  # aborting this `spaex add`; reconciliation is deferred to the
@@ -0,0 +1,49 @@
1
+ """Options `spaex add` and `spaex remove` forward to their internal install.
2
+
3
+ Both commands edit the manifest and then reinstall in-process via
4
+ `write_and_reinstall`, so they accept the same per-invocation install
5
+ controls as `spaex install` itself.
6
+ """
7
+
8
+ from __future__ import annotations
9
+
10
+ import argparse
11
+ from typing import Any
12
+
13
+
14
+ def add_reinstall_arguments(parser: argparse.ArgumentParser, *, command: str) -> None:
15
+ """Attach `--no-install-hooks`, `--speckit-agents` and `--no-speckit-integrations`."""
16
+ parser.add_argument(
17
+ "--no-install-hooks",
18
+ dest="skip_hooks",
19
+ action="store_true",
20
+ help=(
21
+ "Skip per-molecule install_hook execution during the internal "
22
+ f"install triggered by this {command}. Every molecule declaring "
23
+ "install_hook records hook_status='skipped' in install.lock; "
24
+ "atoms still materialize. Per-invocation only; a later "
25
+ "`spaex install` without this flag runs the hooks (Spec 016 "
26
+ "FR-027)."
27
+ ),
28
+ )
29
+ parser.add_argument(
30
+ "--speckit-agents",
31
+ dest="speckit_agents",
32
+ default=None,
33
+ help="Select declared Spec Kit integrations for the internal install.",
34
+ )
35
+ parser.add_argument(
36
+ "--no-speckit-integrations",
37
+ dest="no_speckit_integrations",
38
+ action="store_true",
39
+ help="Skip declared Spec Kit integrations for the internal install.",
40
+ )
41
+
42
+
43
+ def reinstall_kwargs(args: argparse.Namespace) -> dict[str, Any]:
44
+ """The `write_and_reinstall` keyword arguments selected on the command line."""
45
+ return {
46
+ "skip_hooks": bool(getattr(args, "skip_hooks", False)),
47
+ "speckit_agents": getattr(args, "speckit_agents", None),
48
+ "no_speckit_integrations": bool(getattr(args, "no_speckit_integrations", False)),
49
+ }
@@ -14,9 +14,11 @@ files the retracted molecules had previously contributed.
14
14
  from __future__ import annotations
15
15
 
16
16
  import argparse
17
+ import dataclasses
17
18
  import sys
18
19
  from pathlib import Path
19
20
 
21
+ from spaex.cli.reinstall_options import add_reinstall_arguments, reinstall_kwargs
20
22
  from spaex.install.manifest_lock import (
21
23
  DEFAULT_LOCK_TIMEOUT_SECONDS,
22
24
  ManifestLockContext,
@@ -87,16 +89,8 @@ def _apply_removal(
87
89
  config=new_config,
88
90
  )
89
91
  )
90
- return ConsumerManifest(
91
- spaex_version=manifest.spaex_version,
92
- identity=manifest.identity,
93
- compounds=tuple(new_compounds),
94
- spaex_min_version=manifest.spaex_min_version,
95
- groups=manifest.groups,
96
- active_feature=manifest.active_feature,
97
- identity_note=manifest.identity_note,
98
- local_fragments=manifest.local_fragments,
99
- )
92
+ # replace() keeps every other top-level field, e.g. skill_installation.
93
+ return dataclasses.replace(manifest, compounds=tuple(new_compounds))
100
94
 
101
95
 
102
96
  def _warn_external_carriers(repo_root: Path, remove_ids: tuple[str, ...]) -> None:
@@ -146,6 +140,7 @@ def add_arguments(parser: argparse.ArgumentParser) -> None:
146
140
  default=DEFAULT_LOCK_TIMEOUT_SECONDS,
147
141
  help="Manifest-lock timeout in seconds (default 30; 0 = fail-fast)",
148
142
  )
143
+ add_reinstall_arguments(parser, command="remove")
149
144
 
150
145
 
151
146
  def run(args: argparse.Namespace) -> int:
@@ -190,6 +185,7 @@ def run(args: argparse.Namespace) -> int:
190
185
  repo_root,
191
186
  new_bytes,
192
187
  lock,
188
+ **reinstall_kwargs(args),
193
189
  # FR-024a: add-time plausibility check, identical treatment to
194
190
  # `spaex add` (contracts/cli-surface.md §add/remove).
195
191
  abort_on_behavior_contradiction=False,
@@ -29,6 +29,22 @@ def build_install_argv(
29
29
  return argv
30
30
 
31
31
 
32
+ def build_init_argv(executable: CliExecutable, key: str, options: str) -> list[str]:
33
+ """Build a shell-free official project bootstrap invocation.
34
+
35
+ ``--here --force`` merges into the existing, non-empty consumer repo;
36
+ ``--non-interactive`` makes the CLI fail instead of hanging on a prompt.
37
+ """
38
+ argv = [executable] if isinstance(executable, str) else list(executable)
39
+ argv.extend(
40
+ ("init", "--here", "--force", "--non-interactive", "--ignore-agent-tools")
41
+ )
42
+ argv.extend(("--integration", key))
43
+ if options:
44
+ argv.append(f"--integration-options={options}")
45
+ return argv
46
+
47
+
32
48
  def resolve_cli_executable(
33
49
  declaration: SpeckitDeclaration,
34
50
  executable: CliExecutable | None = None,
@@ -21,6 +21,7 @@ from typing import TextIO
21
21
  from spaex.constitution.resolve import ResolvedMolecule
22
22
  from spaex.integrations.runner import (
23
23
  CliExecutable,
24
+ build_init_argv,
24
25
  build_install_argv,
25
26
  resolve_cli_executable,
26
27
  )
@@ -248,8 +249,14 @@ def verify_cli(
248
249
  *,
249
250
  repo_root: Path,
250
251
  executable: CliExecutable | None = None,
252
+ selected: Sequence[str] = (),
251
253
  ) -> tuple[str, tuple[str, ...]]:
252
- """Verify CLI version and supported keys before any install invocation."""
254
+ """Verify CLI version and supported keys before any install invocation.
255
+
256
+ The official CLI only answers ``integration list`` inside a Spec Kit
257
+ project, so a repo without ``.specify/`` is bootstrapped first with the
258
+ first selected integration (see ``_ensure_project_initialized``).
259
+ """
253
260
  executable_argv = resolve_cli_executable(declaration, executable)
254
261
  version_result = run_cli([*executable_argv, "version"], repo_root=repo_root)
255
262
  if version_result.returncode != 0:
@@ -271,6 +278,9 @@ def verify_cli(
271
278
  context={"installed": version_text, "required": _constraint_text(required)},
272
279
  )
273
280
 
281
+ _ensure_project_initialized(
282
+ declaration, selected, repo_root=repo_root, executable=executable_argv
283
+ )
274
284
  list_result = run_cli(
275
285
  [*executable_argv, "integration", "list"],
276
286
  repo_root=repo_root,
@@ -283,6 +293,34 @@ def verify_cli(
283
293
  return ".".join(str(part) for part in version), parse_supported_integrations(list_result.stdout)
284
294
 
285
295
 
296
+ def _ensure_project_initialized(
297
+ declaration: SpeckitDeclaration,
298
+ selected: Sequence[str],
299
+ *,
300
+ repo_root: Path,
301
+ executable: Sequence[str],
302
+ ) -> None:
303
+ """Run ``specify init`` once in a repo that is not yet a Spec Kit project.
304
+
305
+ ``init`` requires an integration, so the first selected key is used; its
306
+ follow-up ``integration install`` in ``install_selected`` is then a no-op
307
+ the official CLI reports as already installed.
308
+ """
309
+ if not selected or (repo_root / ".specify").is_dir():
310
+ return
311
+ key = sorted(selected)[0]
312
+ result = run_cli(
313
+ build_init_argv(executable, key, declaration.integrations[key]),
314
+ repo_root=repo_root,
315
+ capture_output=False,
316
+ )
317
+ if result.returncode != 0:
318
+ raise SpeckitCliFailedError(
319
+ message="official `specify init` failed",
320
+ context={"integration": key, "exit_code": str(result.returncode)},
321
+ )
322
+
323
+
286
324
  def _detect_drifted_keys(
287
325
  keys: Sequence[str],
288
326
  *,
@@ -519,7 +557,9 @@ def prepare_install(
519
557
  return SpeckitInstallRecords(skipped_records, skipped_records)
520
558
 
521
559
  cli_executable = resolve_cli_executable(first, executable)
522
- cli_version, supported = verify_cli(first, repo_root=repo_root, executable=cli_executable)
560
+ cli_version, supported = verify_cli(
561
+ first, repo_root=repo_root, executable=cli_executable, selected=selected
562
+ )
523
563
  ensure_supported(selected, supported)
524
564
  existing_for_first = existing_by_id.get(declarations[0].molecule_id)
525
565
  already_selected = (
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: spaex
3
- Version: 5.3.0
3
+ Version: 5.3.2
4
4
  Summary: spaex 4.0: reproducible coding harnesses for any repo. Compose skills, MCPs, constitutions, slash commands, and dev-environment files into a single project; add/remove/install/migrate/constitution show CLI.
5
5
  Author: spaex contributors
6
6
  License: Apache-2.0
@@ -38,7 +38,7 @@ spaex composes a coding harness for a single repo out of reusable pieces (MCPs,
38
38
 
39
39
  ## Molecule install-hooks
40
40
 
41
- A molecule may declare an optional `install_hook` in its `manifest.json`. `spaex install` invokes it as a normal subprocess (arbitrary code, consumer-user permissions, full environment inheritance) after any required atom materialization and before publishing the install.lock generation; hook-only molecules run without atom materialization. Per-molecule `on_failure: "abort" | "warn"` selects between transaction rollback and continue-with-`hook_status`-recorded. Consumers can opt out for a single invocation via `spaex install --no-install-hooks` (or `spaex add --no-install-hooks`). See [docs/install-hooks.md](docs/install-hooks.md) for the full contract: declaration schema, execution semantics, the four failure kinds, idempotency, non-reversibility, and the trust model.
41
+ A molecule may declare an optional `install_hook` in its `manifest.json`. `spaex install` invokes it as a normal subprocess (arbitrary code, consumer-user permissions, full environment inheritance) after any required atom materialization and before publishing the install.lock generation; hook-only molecules run without atom materialization. Per-molecule `on_failure: "abort" | "warn"` selects between transaction rollback and continue-with-`hook_status`-recorded. Consumers can opt out for a single invocation via `spaex install --no-install-hooks` (or `spaex add --no-install-hooks` / `spaex remove --no-install-hooks`; both also accept `--speckit-agents` and `--no-speckit-integrations` for their internal install). See [docs/install-hooks.md](docs/install-hooks.md) for the full contract: declaration schema, execution semantics, the four failure kinds, idempotency, non-reversibility, and the trust model.
42
42
 
43
43
  ## Atom-category conventions
44
44
 
@@ -34,6 +34,7 @@ src/spaex/cli/constitution.py
34
34
  src/spaex/cli/diagnostics.py
35
35
  src/spaex/cli/install.py
36
36
  src/spaex/cli/main.py
37
+ src/spaex/cli/reinstall_options.py
37
38
  src/spaex/cli/remove.py
38
39
  src/spaex/cli/skills.py
39
40
  src/spaex/cli/status.py
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes