@mriekki/lean 0.3.1 → 0.4.0

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.
package/README.md CHANGED
@@ -6,12 +6,7 @@ Canonical engineering remains in the private platform repositories. Before publi
6
6
 
7
7
  ## Current `greenfield-poc` profile
8
8
 
9
- The current profile bundles:
10
-
11
- - Lean Agentic Core `1.11.1` from commit `e3a8a994d1e95923d629af7640d3b3a0a4f098d4`, distribution `greenfield-workspace`;
12
- - Lean POC Deployment Kit commit `4c23140576b39608a3ef285cad4abe53dccb9c47`, distribution `greenfield-poc`.
13
-
14
- Core `1.11.1` tightens `/lean-update` for Bootstrap-generated package-managed consumers: it keeps `POC_BOOTSTRAP.json`, umbrella/component baselines, exact registry integrity, and generated package-verification surfaces coherent while retaining `/core-sync` as the compatibility/router path for component-only Core consumers.
9
+ The profile bundles Lean Agentic Core's `greenfield-workspace` distribution and the Lean POC Deployment Kit's `greenfield-poc` distribution. The package version and exact canonical component commits are recorded in [`assets/components.json`](./assets/components.json), which is the source of truth for each release.
15
10
 
16
11
  ## Developer experience
17
12
 
@@ -38,7 +33,7 @@ npx @mriekki/lean@latest status
38
33
  npx @mriekki/lean@latest check
39
34
  ```
40
35
 
41
- The umbrella package writes `LEAN_BASELINE.json` while preserving component-native `CORE_BASELINE.json` and `DEPLOYMENT_BASELINE.json` ledgers. Updates refuse managed drift/conflicts before modifying any component. Core retired paths require explicit ownership transfer with `--accept-retired core:<path>`; unchanged Deployment Kit retirements may be removed under its existing ownership contract.
36
+ The umbrella package writes `LEAN_BASELINE.json` while preserving component-native `CORE_BASELINE.json` and `DEPLOYMENT_BASELINE.json` ledgers. Updates refuse managed drift/conflicts before modifying any component. An unchanged retired managed path can be removed safely; a locally modified retired Core path stops the update until the operator explicitly transfers ownership with `--accept-retired core:<path>`.
42
37
 
43
38
  ## Safety and ownership
44
39
 
@@ -58,16 +53,16 @@ The package currently starts with the `greenfield-poc` consumer profile. Existin
58
53
  For normal releases in the Lean Platform VS Code workspace, use:
59
54
 
60
55
  ```text
61
- /release-lean [version | patch | minor | major]
56
+ /release-lean
62
57
  ```
63
58
 
64
- The repo-local skill resolves accepted component commits, prepares the version/pin/descriptor update, runs local verification, creates the release PR, waits for the package-PR merge gate, verifies post-merge `main` CI, then stops once at the exact npm publication gate.
59
+ The repo-local skill resolves accepted component commits, automatically selects the package version from the observed consumer-visible changes, prepares the version/pin/descriptor update, runs local verification, creates the release PR, waits for the package-PR merge gate, verifies post-merge `main` CI, then stops once at the exact npm publication gate. Explicit bump or exact-version arguments remain available only as unusual overrides.
65
60
 
66
61
  After publication approval it triggers `.github/workflows/npm-publish.yml`. The workflow reconstructs the package from the exact private component pins, runs the deterministic release preparation, publishes the exact tarball directly with npm Trusted Publishing (OIDC), and automatically verifies the registry identity plus a neutral-directory `npx` smoke check.
67
62
 
68
63
  The normal flow does not use staged npm publication or a long-lived npm publish token. An existing stage-only trusted publisher must be migrated once to allow direct `npm publish` from `npm-publish.yml`; `/release-lean` guides that bounded one-time setup.
69
64
 
70
- Before merging a release PR, verify the local npm maintainer login and trusted-publisher relationship; the release skill explains npm's browser/2FA reauthorization if `npm trust list` returns `EOTP`. GitHub Actions publication uses OIDC, not a manually managed npm token. See `docs/RELEASE_PROCESS.md` for the operator setup.
65
+ Routine releases do not require local npm authentication: GitHub Actions publishes through OIDC. npm login and trusted-publisher inspection are only needed for initial setup, migration, or troubleshooting a trust error. See `docs/RELEASE_PROCESS.md` for details.
71
66
 
72
67
  The underlying release-candidate command remains available for diagnostics:
73
68
 
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@mriekki/lean",
4
- "version": "0.3.1",
4
+ "version": "0.4.0",
5
5
  "defaultProfile": "greenfield-poc",
6
6
  "profiles": {
7
7
  "greenfield-poc": {
@@ -14,8 +14,8 @@
14
14
  "components": {
15
15
  "core": {
16
16
  "repository": "mriekki/lean-agentic-core",
17
- "commit": "009572aa4c61ad9a45ec5473b6affc984d6faac0",
18
- "version": "1.12.0",
17
+ "commit": "7d6b6ce00d83063775d7491626fe6b253b9c51c8",
18
+ "version": "1.13.0",
19
19
  "distribution": "greenfield-workspace",
20
20
  "descriptor": "assets/core/distribution.json",
21
21
  "sourceRoot": "assets/generated/core",
@@ -1,12 +1,12 @@
1
1
  {
2
2
  "schemaVersion": 1,
3
3
  "package": "@mriekki/lean",
4
- "version": "0.3.1",
4
+ "version": "0.4.0",
5
5
  "components": {
6
6
  "core": {
7
7
  "repository": "mriekki/lean-agentic-core",
8
- "commit": "009572aa4c61ad9a45ec5473b6affc984d6faac0",
9
- "version": "1.12.0",
8
+ "commit": "7d6b6ce00d83063775d7491626fe6b253b9c51c8",
9
+ "version": "1.13.0",
10
10
  "distribution": "greenfield-workspace",
11
11
  "files": [
12
12
  {
@@ -17,7 +17,7 @@
17
17
  {
18
18
  "source": "core/agents/reviewer.agent.md",
19
19
  "destination": ".github/agents/reviewer.agent.md",
20
- "sha256": "c999281aeab6fd17ea308d581a7e931a06d7b93f33871915605956643c7b22ff"
20
+ "sha256": "2534ef7f1001da725a503874859c84945586c4f2aed9aec0fe3e04bc24de14c3"
21
21
  },
22
22
  {
23
23
  "source": "core/agents/coach.agent.md",
@@ -57,17 +57,17 @@
57
57
  {
58
58
  "source": "core/skills/start-work/SKILL.md",
59
59
  "destination": ".github/skills/start-work/SKILL.md",
60
- "sha256": "43c10278bd715ec95f3aa8d4ed4a2a4b51aa9fc6484e1fda572037381e663de4"
60
+ "sha256": "4d2805305424942c8aa7184d82578e59af1785cfd5b89c9d7314f3a1ffef4027"
61
61
  },
62
62
  {
63
63
  "source": "core/skills/next-step/SKILL.md",
64
64
  "destination": ".github/skills/next-step/SKILL.md",
65
- "sha256": "0fac7b36f62039341c7536ff1516387efd4b6b32885dceb58d59510480ff9d6b"
65
+ "sha256": "6fb5275cc098f3124c85bb20ccf713affac23ebd5b96962558504936f2b891d4"
66
66
  },
67
67
  {
68
68
  "source": "core/skills/deliver/SKILL.md",
69
69
  "destination": ".github/skills/deliver/SKILL.md",
70
- "sha256": "bb31e292a57372c6f64f627035652632b474f1ebcaab604eded57d730825af8a"
70
+ "sha256": "2c97f86bedf4baf1fb287cdc7b509975bd556861e9739713db85f1c5ee87c6eb"
71
71
  },
72
72
  {
73
73
  "source": "core/skills/cleanup-branches/SKILL.md",
@@ -82,7 +82,7 @@
82
82
  {
83
83
  "source": "core/skills/lean-update/SKILL.md",
84
84
  "destination": ".github/skills/lean-update/SKILL.md",
85
- "sha256": "8b4bce53b109a5959e862924b0a4afd931233a5094a1aef43c2f3672199108bb"
85
+ "sha256": "50bfa181bb9a6abc1d0bb6533ef0b29fe729a8a96924a34a7796c0cbb80061fc"
86
86
  },
87
87
  {
88
88
  "source": "core/skills/core-sync/SKILL.md",
@@ -102,12 +102,12 @@
102
102
  {
103
103
  "source": "core/skills/deployment-readiness/SKILL.md",
104
104
  "destination": ".github/skills/deployment-readiness/SKILL.md",
105
- "sha256": "5e4f50c9ab696b16e677fc6e4be3f581ac912e7b15c077b376457d00c01c1623"
105
+ "sha256": "02a58ae52cab8b6b11734a8d4217bf7f7c9b11bcd7b35e4a2e16dfb8af8bce34"
106
106
  },
107
107
  {
108
108
  "source": "core/skills/deploy/SKILL.md",
109
109
  "destination": ".github/skills/deploy/SKILL.md",
110
- "sha256": "e34b29d3d19945b6317adb9e5796895dc75f249015ec9708fd256ab7e0ca0c5f"
110
+ "sha256": "259c0091672d79b7bc799f92cb21a4143af2951a4f2556794263237dfb7e7d7b"
111
111
  },
112
112
  {
113
113
  "source": "core/skills/tear-down/SKILL.md",
@@ -142,7 +142,7 @@
142
142
  {
143
143
  "source": "core/process/DEPLOYMENT_ENABLEMENT.md",
144
144
  "destination": "docs/process/DEPLOYMENT_ENABLEMENT.md",
145
- "sha256": "a57819ce9e52227df8260d789fb6911721aac0e391a53e711fbb27d7a17b3245"
145
+ "sha256": "3b59c5984ecb51ac48efb40e7e2e24c1971db947d6eefa5dc3671254ca984af7"
146
146
  },
147
147
  {
148
148
  "source": "core/process/HUMAN_GATES.md",
@@ -82,4 +82,4 @@ When implementation is READY and the human accepts the meaningful local diff, ex
82
82
 
83
83
  Do not vaguely say `merge when ready`.
84
84
 
85
- If the delivered work item owns deployment engineering, successful engineering delivery may later hand off to `/deployment-readiness <deployment-enabler-ID> enable [environment]`; Reviewer readiness never authorizes remote or production deployment.
85
+ If the delivered work item owns deployment engineering, successful engineering delivery may later hand off to `/deployment-readiness <environment>` for state-driven environment preparation; Reviewer readiness never authorizes remote or production deployment.
@@ -4,28 +4,24 @@ Deployment enablement is the guided operational lane between delivered deploymen
4
4
 
5
5
  A repository may have multiple named deployment environments, such as Staging and Production. Each environment owns its own confirmed machine/target binding, readiness evidence, data/backup state, credentials, and deployment policy.
6
6
 
7
- Use:
7
+ The normal human-facing entry point is state-driven:
8
8
 
9
9
  ```text
10
- /deployment-readiness [deployment-enabler-ID] discovery [environment]
10
+ /deployment-readiness <environment>
11
11
  ```
12
12
 
13
- to discover environment setup early, and:
14
-
15
- ```text
16
- /deployment-readiness [deployment-enabler-ID] enable [environment]
17
- ```
18
-
19
- after deployment engineering is reviewed, delivered, merged, and applicable default-branch CI/policy evidence is satisfactory.
13
+ The workflow discovers current state and continues from the furthest safe point. The human does not need to choose separate `discovery`, `enable`, or `resume` modes.
20
14
 
21
15
  For a read-only local overview use:
22
16
 
23
17
  ```text
24
- /deployment-readiness [deployment-enabler-ID] status [environment]
18
+ /deployment-readiness status [environment]
25
19
  ```
26
20
 
27
21
  Omit the environment from `status` to summarize all configured named environments without automatically probing every remote machine.
28
22
 
23
+ Older invocations that include a deployment-enabler ID and/or `discovery`, `enable`, or `resume` may be normalized for compatibility, but they are not the normal interface.
24
+
29
25
  ## Human-facing readiness model
30
26
 
31
27
  The workflow should ask about simple environment-machine facts before exposing deployment-tool internals.
@@ -46,7 +42,7 @@ If setup is partial, show what is known and ask only for the smallest missing fa
46
42
 
47
43
  If setup is absent, start with the selected machine's hostname or IP address, then ask one additional simple fact at a time only when required.
48
44
 
49
- ## Discover, confirm, verify
45
+ ## Discover, confirm, verify, continue
50
46
 
51
47
  Normal readiness cadence is:
52
48
 
@@ -58,15 +54,54 @@ select environment
58
54
  → authorize read-only connectivity/identity verification
59
55
  → run repository/Deployment-Kit doctor/verify checks
60
56
  → reuse working access OR repair only missing setup OR onboard a new workstation
61
- → verify remaining runtime/security/data/release prerequisites
62
- → environment READY
57
+ → verify target/platform/security/artifact/registry/data prerequisites
58
+ → ENVIRONMENT READY TO DEPLOY
63
59
  → /deploy <environment>
64
60
  ```
65
61
 
62
+ The next readiness invocation re-discovers current state and resumes automatically. It does not require a new mode word after discovery or repair.
63
+
66
64
  Remote probing does not occur merely to build the initial local summary.
67
65
 
68
66
  Address discovery is not host trust. When SSH is used, unknown or changed host identity stops access; readiness must not recover by disabling host-key verification, silently enrolling new trust, scanning/selecting another host, weakening network controls, or redirecting to another environment.
69
67
 
68
+ ## Readiness writes versus deployment writes
69
+
70
+ Readiness may perform bounded prerequisite/setup writes when separately authorized and supported by repository tooling, such as:
71
+
72
+ - local environment binding;
73
+ - key/agent/trust setup;
74
+ - target-side access setup;
75
+ - runtime/platform prerequisite setup;
76
+ - data/backup directory preparation;
77
+ - firewall preparation;
78
+ - registry credential setup.
79
+
80
+ Readiness does **not** hide application deployment inside environment preparation.
81
+
82
+ Application container/process deployment, release-specific migration, application route registration, live application health/readiness, live smoke validation, and release-specific deployment/rollback evidence belong to `/deploy` when the repository's deployment contract includes them.
83
+
84
+ This distinction prevents a first-deploy deadlock: readiness proves that the environment can safely accept the selected artifact; `/deploy` creates and validates the live application state.
85
+
86
+ ## Pre-deploy versus post-deploy evidence
87
+
88
+ Pre-deploy readiness may require:
89
+
90
+ - verified machine/target binding and host identity;
91
+ - actual target OS/architecture and supported runtime/platform;
92
+ - validated/available route names and collision checks;
93
+ - approved immutable artifact identity;
94
+ - registry/artifact access readiness;
95
+ - persistence/data/backup prerequisites;
96
+ - migration capability;
97
+ - deployment locking capability;
98
+ - rollback/recovery capability and boundaries;
99
+ - stronger Production backup/recovery prerequisites when applicable.
100
+
101
+ Do not require first-deploy evidence that can only exist after the selected artifact is deployed, such as live route resolution, live application health, smoke success, deployed release identity, or execution-backed rollback evidence for that release.
102
+
103
+ `/deploy` establishes those post-deploy facts and reports them from repository/tool evidence.
104
+
70
105
  ## Existing and new workstations
71
106
 
72
107
  On an already-configured workstation, successful strict verification means onboarding/setup questions are skipped.
@@ -81,13 +116,13 @@ Readiness is environment-specific. Readiness of Staging does not prove Productio
81
116
 
82
117
  Production remains a role with stronger deployment, artifact, backup, recovery, and Human-in-the-Loop policy where required. It does not use a separate readiness command.
83
118
 
84
- Once the selected environment is ready, the repeatable deployment entry point is:
119
+ Once the selected environment is ready to deploy, the repeatable deployment entry point is:
85
120
 
86
121
  ```text
87
122
  /deploy <environment>
88
123
  ```
89
124
 
90
- `/deploy` verifies the selected environment/target/artifact evidence, dispatches to repository-provided tooling, and presents the applicable write gate immediately before execution.
125
+ `/deploy` verifies the selected environment/target/artifact evidence, presents the applicable write gate immediately before execution, delegates deterministic deployment mechanics, and then verifies repository-defined live route/readiness/smoke/deployment evidence.
91
126
 
92
127
  A Production deployment remains separately authorized and never becomes implicit because readiness passed. A non-production remote deployment still requires the repository/tool's bounded remote-write authorization.
93
128
 
@@ -304,12 +304,14 @@ and preserve the branch.
304
304
 
305
305
  ## 12. Deployment handoff
306
306
 
307
- If the delivered work item owns release/deployment engineering, successful engineering delivery may hand off to:
307
+ If the delivered work item owns release/deployment engineering, successful engineering delivery may hand off to the selected environment's state-driven readiness workflow:
308
308
 
309
309
  ```text
310
- /deployment-readiness <deployment-enabler-ID> enable [environment]
310
+ /deployment-readiness <environment>
311
311
  ```
312
312
 
313
+ Readiness re-discovers current state and continues from the furthest safe point; do not ask the human to choose `discovery`, `enable`, or `resume` merely because engineering delivery just completed.
314
+
313
315
  The readiness workflow is environment-generic. Production remains an environment role with stronger policy; merge approval never implies remote or production-deployment authorization.
314
316
 
315
317
  ## 13. Relationship to /start-work, /next-step, and /cleanup-branches
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: deploy
3
- description: "Guided deployment orchestration for a configured named environment. Verifies package/deployment provenance, selects the exact target/artifact, preserves tool-specific authorization, and delegates deterministic execution to repository-provided deployment tooling."
3
+ description: "Guided deployment orchestration for a configured named environment. Verifies pre-deploy readiness, selects the exact target/artifact, preserves tool-specific authorization, delegates deterministic execution, and validates the resulting live deployment."
4
4
  argument-hint: "[environment] [release-or-artifact]"
5
5
  user-invocable: true
6
6
  disable-model-invocation: true
@@ -8,9 +8,9 @@ disable-model-invocation: true
8
8
 
9
9
  # Deploy
10
10
 
11
- `/deploy` is the normal human-facing deployment interface once deployment engineering and the selected environment are ready.
11
+ `/deploy` is the normal human-facing deployment interface once deployment engineering is delivered and the selected environment is **ready to deploy**.
12
12
 
13
- Core owns interaction, validation, target safety, and Human-in-the-Loop authorization. Repository-provided deployment tooling owns deployment mechanics.
13
+ Core owns interaction, validation, target safety, Human-in-the-Loop authorization, and evidence-oriented orchestration. Repository-provided deployment tooling owns deployment mechanics.
14
14
 
15
15
  Do not implement Docker, SSH, route, migration, or application deployment logic directly in this skill when an approved repository command exists.
16
16
 
@@ -24,7 +24,7 @@ Read only the minimum repository context needed to identify:
24
24
  - `DEPLOYMENT_BASELINE.json` when present;
25
25
  - approved deployment/release requirements;
26
26
  - configured named environments and checkout-local target bindings;
27
- - selected environment readiness evidence;
27
+ - selected environment pre-deploy readiness evidence;
28
28
  - approved release/artifact policy;
29
29
  - repository-provided deployment entry point and its authorization contract;
30
30
  - expected developer-workstation and target operating systems.
@@ -39,7 +39,9 @@ tools/lean-deployment/lean-poc-deploy.py
39
39
 
40
40
  over reconstructing Deployment Kit commands by hand or requiring a separate Kit checkout.
41
41
 
42
- If package/component baseline integrity is already known to be drifted, or deployment engineering/readiness is incomplete, stop and route to `/lean-update`, `/upstream-fix`, the deployment work item, or `/deployment-readiness` as appropriate.
42
+ If package/component baseline integrity is known to be drifted, deployment engineering is incomplete, or a selected environment has unresolved **pre-deploy** blockers, stop and route to `/lean-update`, `/upstream-fix`, the deployment work item, or `/deployment-readiness <environment>` as appropriate.
43
+
44
+ Do not block a first deployment merely because live route resolution, application health, smoke results, deployed-release identity, or release-specific rollback evidence do not exist yet. Those are produced by this deployment flow.
43
45
 
44
46
  ## 2. Select an environment explicitly
45
47
 
@@ -52,7 +54,7 @@ Rules:
52
54
  - never silently default to `production`;
53
55
  - never use a remembered prior selection as implicit production authorization;
54
56
  - never fall back from one environment to another because discovery, access, readiness, or deployment failed;
55
- - if a named environment is not configured, fail explicitly and route to `/deployment-readiness`;
57
+ - if a named environment is not configured, fail explicitly and route to `/deployment-readiness <environment>`;
56
58
  - selecting an environment chooses scope but does not authorize the deployment write.
57
59
 
58
60
  ## 3. Resolve and verify the machine/target binding
@@ -105,7 +107,31 @@ For non-production, use only the broader artifact policy explicitly allowed by t
105
107
 
106
108
  When promoting a tested artifact to production, prefer the exact same immutable artifact/digest rather than rebuilding it.
107
109
 
108
- ## 6. Preserve the deployment tool's exact authorization contract
110
+ If readiness was completed before the final release/artifact existed, re-check the selected artifact and any artifact-specific pre-deploy prerequisites now. Do not force a separate readiness ceremony when the remaining check can be performed read-only and the environment facts have not materially changed.
111
+
112
+ ## 6. Build the deterministic deployment plan
113
+
114
+ Use repository-provided tooling to construct or inspect the exact plan when supported.
115
+
116
+ The plan may include, according to the repository contract:
117
+
118
+ ```text
119
+ pre-deploy backup or safety check
120
+ → release-specific migration
121
+ → application/container deployment
122
+ → application route registration/update
123
+ → health/readiness verification
124
+ → smoke validation
125
+ → deployment evidence capture
126
+ ```
127
+
128
+ Do not add operations the repository/tool does not define.
129
+
130
+ Route registration, migration, and other application/release-specific writes are deployment operations when they are part of the repository's deterministic deployment contract. They are not hidden `/deployment-readiness` side effects.
131
+
132
+ Application rollback execution, database restore/destructive recovery, target rebinding, unrelated host provisioning, and environment tear-down remain separate decisions unless the approved deployment contract explicitly defines a safe bounded automatic rollback for the failed deployment itself.
133
+
134
+ ## 7. Preserve the deployment tool's exact authorization contract
109
135
 
110
136
  Core may describe consequence classes using labels such as `[REMOTE WRITE]` and `[PRODUCTION WRITE]`, but those labels do not replace a stricter exact authorization phrase required by the repository-provided deployment tool.
111
137
 
@@ -122,7 +148,7 @@ Authorization applies only to the exact environment, verified target, artifact,
122
148
 
123
149
  No requirements approval, code review, PR merge, CI pass, environment selection, prior deployment, or readiness result implicitly authorizes a deployment write.
124
150
 
125
- ## 7. Present the deployment preview and gate
151
+ ## 8. Present the deployment preview and gate
126
152
 
127
153
  Before the modifying command show the resolved non-secret facts:
128
154
 
@@ -136,8 +162,10 @@ Target OS: <verified>
136
162
  Launcher: <repository-provided command>
137
163
  Deployment baseline: <exact commit/distribution when present>
138
164
  Release/artifact: <verified immutable identity>
165
+ Pre-deploy readiness blockers: NONE
166
+ Planned deployment operations: <repository/tool-defined summary>
139
167
  Required authorization: <exact tool phrase or repository gate>
140
- Readiness blockers: NONE
168
+ Post-deploy validation: route/health/smoke/evidence checks that will run after the write
141
169
  ```
142
170
 
143
171
  Include an internal target/profile label only when it materially helps disambiguate the exact machine or tool plan. Do not make that identifier the primary human-facing identity.
@@ -152,7 +180,7 @@ For production require the project's explicit production deployment gate and the
152
180
 
153
181
  Do not translate a generic `approve` into a broader tool-specific phrase unless the user clearly authorized the exact reviewed deployment operation represented by that phrase.
154
182
 
155
- ## 8. Execute only the approved script contract
183
+ ## 9. Execute only the approved script contract
156
184
 
157
185
  After authorization invoke only the repository-provided launcher with the explicitly selected environment and approved artifact inputs.
158
186
 
@@ -160,9 +188,22 @@ Do not perform unrelated host provisioning, target rebinding, firewall changes,
160
188
 
161
189
  If the script reports missing prerequisites, identity mismatch, unexpected target OS, lock contention, migration failure, readiness failure, stale plan/evidence, or another blocker, stop according to the repository contract. Never redirect to another environment or host.
162
190
 
163
- ## 9. Verify and record outcome
191
+ If a failure occurs after a partial deployment, use only repository/tool-defined safe failure handling. Do not improvise destructive rollback or database recovery.
164
192
 
165
- After execution, use repository-provided readiness/smoke/evidence commands when available.
193
+ ## 10. Verify live deployment and record outcome
194
+
195
+ After execution, use repository-provided inventory, route, readiness, health, smoke, and evidence commands when available.
196
+
197
+ For a first deployment, this is where evidence such as the following becomes meaningful:
198
+
199
+ - application route registration and client-resolvable route behavior when verifiable from the approved surface;
200
+ - exact deployed release/artifact identity;
201
+ - container/process running state;
202
+ - application readiness/health result;
203
+ - smoke-test result;
204
+ - release-specific migration outcome;
205
+ - deployment evidence/current-release identity;
206
+ - rollback/recovery compatibility evidence when the repository contract can establish it non-destructively.
166
207
 
167
208
  Report only evidence-backed outcomes:
168
209
 
@@ -171,9 +212,26 @@ Report only evidence-backed outcomes:
171
212
  - deployment baseline/tool identity when relevant;
172
213
  - release/artifact identity;
173
214
  - deployment result;
174
- - readiness/smoke result;
175
- - rollback/recovery outcome when applicable.
215
+ - route result when applicable;
216
+ - readiness/health/smoke result;
217
+ - migration result when applicable;
218
+ - rollback/recovery capability/evidence when applicable.
176
219
 
177
220
  Do not report success merely because a command returned or a container/process started if stronger readiness evidence is required.
178
221
 
179
- Application rollback, database restore, destructive recovery, and environment tear-down remain separate decisions when the repository contract makes them separate.
222
+ A successful deployment may be summarized as:
223
+
224
+ ```text
225
+ DEPLOYMENT VALIDATED
226
+
227
+ Environment: <name>
228
+ Artifact: <exact immutable identity>
229
+ Route: READY / NOT APPLICABLE
230
+ Application health: READY
231
+ Smoke: PASSED
232
+ Deployment evidence: RECORDED / VERIFIED
233
+ ```
234
+
235
+ For a Staging-to-Production promotion flow, the repository may require a human Staging validation/attestation after this technical validation. That validation is evidence for later Production promotion; it does not itself authorize Production deployment.
236
+
237
+ Application rollback execution, database restore/destructive recovery, and environment tear-down remain separate decisions when the repository contract makes them separate.
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: deployment-readiness
3
- description: Guided readiness for any named deployment environment. Discovers and confirms simple machine facts first, verifies access/trust safely, repairs only missing setup, and hands ready environments to /deploy.
4
- argument-hint: "[deployment-enabler-ID] [status|discovery|enable|resume] [environment]"
3
+ description: Guided readiness for any named deployment environment. Discovers current state, verifies access and pre-deploy prerequisites, repairs only missing setup, and hands environments that are ready to deploy to /deploy.
4
+ argument-hint: "[environment] | status [environment]"
5
5
  user-invocable: true
6
6
  disable-model-invocation: true
7
7
  ---
@@ -10,17 +10,24 @@ disable-model-invocation: true
10
10
 
11
11
  `/deployment-readiness` is the reusable operational workflow for preparing named deployment environments such as Staging, Production, test, demo, or another repository-approved environment.
12
12
 
13
- It is not a deployment executor and it is not a production-only workflow. Production is an environment role/policy with stronger gates, not a separate readiness mechanism.
13
+ It is not the application deployment executor and it is not production-only. Production is an environment role/policy with stronger gates, not a separate readiness mechanism.
14
14
 
15
- Modes:
15
+ The normal human-facing invocation is:
16
16
 
17
17
  ```text
18
- status
19
- discovery
20
- enable
21
- resume
18
+ /deployment-readiness <environment>
22
19
  ```
23
20
 
21
+ The workflow is state-driven and resumable. It discovers whether the environment is unconfigured, partially configured, access-ready, platform-ready, or ready to deploy, then continues from the furthest safe observed state. Do not require the human to choose `discovery`, `enable`, or `resume` modes.
22
+
23
+ For a read-only overview, support:
24
+
25
+ ```text
26
+ /deployment-readiness status [environment]
27
+ ```
28
+
29
+ For compatibility, if an older invocation includes a deployment-enabler ID and/or the legacy `discovery`, `enable`, or `resume` token, normalize it to the same state-driven workflow rather than forcing the human to restart. Do not advertise those legacy forms as the normal interface.
30
+
24
31
  ## 1. Resolve minimum context
25
32
 
26
33
  Read `.github/lean-workspace.json` when present plus only the relevant deployment enabler requirements/decisions/readiness record, release/deployment guidance, environment configuration contract, current package/deployment baselines, and repository-provided deployment tooling.
@@ -36,6 +43,8 @@ Do not assume:
36
43
  - SSH alias or discovery mechanism;
37
44
  - certificate model or hosting environment.
38
45
 
46
+ If the invocation does not name an environment and more than one configured environment exists, ask the human to select one. Never silently default to Production.
47
+
39
48
  ## 2. Human-facing information model
40
49
 
41
50
  Keep the interaction centered on facts a person normally knows about the selected environment's machine:
@@ -56,6 +65,40 @@ Do not lead with questions such as `What is the logical target name?`. If an int
56
65
 
57
66
  Never use an application-specific example to imply that a reusable machine identity belongs to one POC. A machine/profile may legitimately be reused by multiple POCs while each POC keeps independent environment bindings, application state, data, routes, and deployment evidence.
58
67
 
68
+ ### Application route/address defaults
69
+
70
+ Keep the machine's hostname/address separate from the application's route hostname. A target such as `server.local` may host many POCs, while each application owns its own route aliases.
71
+
72
+ When the repository or installed deployment tooling defines a deterministic application-route convention from stable inputs such as `appSlug + environment`, derive and present that exact conventional set before asking for a free-form hostname. Treat the derived values as recommended defaults for confirmation, not as permission to register or change a route.
73
+
74
+ For example, if the installed trusted-LAN deployment contract defines environment-scoped aliases such as:
75
+
76
+ ```text
77
+ <app-slug>-<environment>.local
78
+ <app-slug>.<environment>.local
79
+ ```
80
+
81
+ present the concrete derived values in plain language:
82
+
83
+ ```text
84
+ STAGING APPLICATION ADDRESS
85
+
86
+ Recommended defaults:
87
+ <derived alias 1>
88
+ <derived alias 2>
89
+
90
+ 1. Use these defaults — recommended
91
+ 2. Choose different hostnames
92
+ ```
93
+
94
+ Do not ask `What route hostname(s) should this environment use?` while a repository/tool-owned deterministic default is available and no collision or policy conflict has been observed.
95
+
96
+ If the installed convention requires multiple compatibility aliases, preserve the complete default set. Do not silently drop one alias. If the convention defines an optional short alias with a larger collision surface, do not infer or add it; present it only when the repository/tool contract calls for an explicit opt-in.
97
+
98
+ If the user rejects the defaults, or a read-only collision/policy check shows they cannot be used, ask for the smallest unresolved custom value and validate it through the installed tool's hostname contract.
99
+
100
+ Selecting or confirming application route hostnames is configuration/readiness work only. It never authorizes DNS changes, route registration, Caddy changes, or another remote write; those retain their repository/tool-specific write gate.
101
+
59
102
  ## 3. Discover first, then ask only for missing facts
60
103
 
61
104
  Invocation begins read-only.
@@ -141,54 +184,45 @@ Then ask one material fact at a time, such as the SSH/deployment user, only when
141
184
 
142
185
  Once the human-facing machine facts are known, use repository/Deployment-Kit tooling to create the required internal profile/binding. Prefer deriving/reusing a stable internal identifier from confirmed state when the installed tooling supports it. Surface that identifier only when ambiguity or troubleshooting makes it useful.
143
186
 
144
- ## 4. Mode boundaries
187
+ ## 4. State-driven progression
145
188
 
146
- ### status
147
-
148
- Read-only overview.
149
-
150
- With an environment, summarize that environment's local configuration/readiness state.
151
-
152
- Without an environment, summarize all configured named deployment environments without remotely probing every machine:
189
+ Normal readiness cadence is:
153
190
 
154
191
  ```text
155
- Environment Role Local setup Last readiness
156
- Staging non-production CONFIGURED READY / STALE / UNKNOWN
157
- Production production PARTIAL NOT READY
192
+ select environment
193
+ → rediscover current local state
194
+ → show/confirm known simple facts
195
+ → verify/reuse access
196
+ → repair only missing setup when authorized
197
+ → verify target OS/platform/security prerequisites
198
+ → verify artifact/registry/data/migration/rollback capability prerequisites
199
+ → ENVIRONMENT READY TO DEPLOY
200
+ → /deploy <environment>
158
201
  ```
159
202
 
160
- Use only evidence that actually exists. `status` does not authorize remote checks or writes.
161
-
162
- ### discovery
203
+ Each invocation resumes from observed evidence. Do not make the human rerun the command with a different mode merely because discovery completed or a prerequisite was repaired.
163
204
 
164
- May begin early after the application's foundation/walking skeleton is proven.
205
+ Readiness may perform bounded environment-enablement writes when they are necessary and separately authorized, such as local profile/key/trust setup, target-side access setup, runtime/platform prerequisite setup, data/backup directory preparation, firewall preparation, or registry credential setup. These are readiness/setup operations, not application deployment.
165
206
 
166
- Purpose:
207
+ Application deployment remains owned by `/deploy`.
167
208
 
168
- - identify intended named deployment environments and their roles;
169
- - discover/reuse existing workstation setup before asking questions;
170
- - confirm simple machine facts with the human;
171
- - discover each selected environment's real target and expected target OS;
172
- - identify access/security/network/TLS/certificate dependencies;
173
- - establish the environment-to-target readiness contract without embedding secrets in reusable source;
174
- - record non-secret facts in the repository-approved place;
175
- - surface blockers early.
209
+ ### Read-only status
176
210
 
177
- Discovery does not authorize remote writes or application deployment.
211
+ `/deployment-readiness status [environment]` is a read-only overview.
178
212
 
179
- ### enable
213
+ With an environment, summarize that environment's local configuration/readiness state. Without an environment, summarize all configured named deployment environments without remotely probing every machine:
180
214
 
181
- Require evidence that deployment engineering completed the normal delivery path, including applicable requirements/review/merge/default-branch CI and repository-policy evidence.
182
-
183
- Enablement prepares the selected environment so `/deploy` can safely use it. It does not itself authorize application deployment.
184
-
185
- ### resume
215
+ ```text
216
+ Environment Role Local setup Last readiness
217
+ Staging non-production CONFIGURED READY TO DEPLOY / STALE / UNKNOWN
218
+ Production production PARTIAL NOT READY
219
+ ```
186
220
 
187
- Continue from existing environment-specific readiness evidence. Re-discover current local state first and do not re-ask facts that remain valid.
221
+ Use only evidence that actually exists. `status` does not authorize remote checks or writes.
188
222
 
189
223
  ## 5. Select the environment before environment-specific readiness
190
224
 
191
- When more than one configured deployment environment exists, select the environment being discovered or enabled before environment-specific questions or remote checks.
225
+ When more than one configured deployment environment exists, select the environment before environment-specific questions or remote checks.
192
226
 
193
227
  Keep these concepts separate internally even when the human-facing interaction stays simple:
194
228
 
@@ -218,7 +252,7 @@ discover existing state
218
252
  → ask one missing material fact
219
253
  → record permitted non-secret fact
220
254
  → explain impact/blocker
221
- → continue
255
+ → continue from the resulting state
222
256
  ```
223
257
 
224
258
  Use concise choices for bounded decisions. Ask factual values such as hostname/IP, username, port, OS/version, path, or observed system state as direct free-form/confirmation questions.
@@ -272,27 +306,39 @@ Possible missing state includes profile/binding, key, SSH-agent membership, inde
272
306
 
273
307
  Do not create duplicate credentials merely because another POC uses the same machine. Reuse an already-valid developer-to-machine relationship when the installed tooling and policy allow it.
274
308
 
275
- ## 9. Network, security, DNS, TLS, runtime, and storage
309
+ ## 9. Pre-deploy readiness versus post-deploy validation
310
+
311
+ Readiness answers: **can `/deploy` safely perform the selected environment's deployment now?**
276
312
 
277
- After basic machine/access facts are established, discover/verify only what the selected environment's approved role requires, such as:
313
+ Before declaring the selected environment ready to deploy, verify only evidence that can exist before the deployment of the selected artifact, such as:
314
+
315
+ - selected environment and confirmed machine/target binding;
316
+ - strict connectivity/host-identity verification;
317
+ - supported developer-workstation launcher;
318
+ - expected target OS matches actual target OS;
319
+ - shared runtime/platform prerequisites;
320
+ - approved release/artifact policy;
321
+ - immutable artifact/image digest when applicable;
322
+ - artifact/registry accessibility or credential readiness;
323
+ - route names validated and collision-free when the installed routing contract supports read-only inventory/plan checks;
324
+ - independent environment data/backup paths or the approved ability to create/use them;
325
+ - migration capability and prerequisites;
326
+ - deployment lock capability;
327
+ - rollback/recovery capability and required boundaries;
328
+ - production-specific backup/recovery prerequisites when applicable;
329
+ - unresolved security blockers = none.
278
330
 
279
- - actual target OS/version/architecture;
280
- - runtime/container support;
281
- - storage/data/backup paths;
282
- - inbound/outbound network dependencies;
283
- - firewall/security approvals;
284
- - DNS/server name;
285
- - HTTP/HTTPS and TLS/certificate model;
286
- - registry/artifact access;
287
- - migration/readiness/smoke/rollback/recovery prerequisites.
331
+ Do **not** require evidence that can only be produced by deploying the exact selected artifact. On a first deployment, live application route resolution, application health/readiness, smoke results, deployed-release identity, and execution-backed rollback evidence are post-deploy validation, not pre-deploy blockers.
288
332
 
289
- Do not front-load these questions before basic environment/machine identity is understood.
333
+ A previously deployed environment may have historical live evidence, but stale evidence for an older artifact does not prove the new artifact's post-deploy behavior.
334
+
335
+ A non-production environment may use a less restrictive artifact policy only when approved requirements say so. Do not infer relaxed Staging behavior.
290
336
 
291
337
  ## 10. Bounded setup/provisioning writes
292
338
 
293
339
  A missing prerequisite is not authorization to change it.
294
340
 
295
- Examples of bounded actions include:
341
+ Examples of bounded readiness actions include:
296
342
 
297
343
  ```text
298
344
  Create/update local environment binding [LOCAL CONFIG WRITE]
@@ -309,45 +355,30 @@ Set source-hosting environment variable/secret [SOURCE-HOSTING WRITE]
309
355
 
310
356
  Use the installed repository/tool's exact authorization phrase when it defines one. Do not weaken or replace that contract with a generic label.
311
357
 
312
- ## 11. Environment deployment readiness
358
+ Do not register the application route, deploy the application container/process, migrate the selected release, or run release-specific live smoke validation as a hidden readiness side effect. Those belong to `/deploy` when the repository deployment contract includes them.
313
359
 
314
- Before declaring the selected environment ready for `/deploy`, verify the evidence required by its approved role/policy.
360
+ ## 11. Readiness handoff
315
361
 
316
- Common evidence includes:
317
-
318
- - selected environment and confirmed machine/target binding;
319
- - strict connectivity/host-identity verification;
320
- - supported developer-workstation launcher;
321
- - expected target OS matches actual target OS;
322
- - approved release/artifact policy;
323
- - immutable artifact/image digest when applicable;
324
- - artifact/registry access;
325
- - independent environment data/backup paths;
326
- - migration path;
327
- - deployment lock behavior;
328
- - readiness and smoke checks;
329
- - application rollback;
330
- - explicit database-restore/recovery boundary;
331
- - unresolved security blockers = none.
332
-
333
- A non-production environment may use a less restrictive artifact policy only when approved requirements say so. Do not infer relaxed Staging behavior.
334
-
335
- ## 12. Readiness handoff
336
-
337
- For any selected environment that is ready:
362
+ For any selected environment that has satisfied its pre-deploy requirements:
338
363
 
339
364
  ```text
340
- ENVIRONMENT READY FOR DEPLOYMENT WORKFLOW
365
+ ENVIRONMENT READY TO DEPLOY
341
366
 
342
367
  Environment: <name>
343
368
  Role: <role>
344
369
  Hostname/address: <confirmed non-secret value when appropriate>
345
370
  Target OS/architecture: <verified>
346
371
  Access/host identity: VERIFIED
347
- Release/artifact policy: <verified>
372
+ Platform prerequisites: READY
373
+ Route identity/plan: VALID / AVAILABLE when applicable
374
+ Release/artifact: <verified immutable identity when required>
375
+ Registry/artifact access: READY when applicable
376
+ Persistence/migration capability: READY
377
+ Rollback/recovery capability: READY
348
378
  Security blockers: NONE
349
- Readiness/Smoke: READY
350
- Rollback: READY
379
+
380
+ POST-DEPLOY VALIDATION PENDING
381
+ Live route/health/smoke/release-specific rollback evidence is established by /deploy.
351
382
 
352
383
  NEXT
353
384
  /deploy <environment>
@@ -355,15 +386,15 @@ NEXT
355
386
 
356
387
  For a production-role environment, include the additional production policy/backup/recovery evidence required by the project, but do not change the readiness mechanism or command name.
357
388
 
358
- This is readiness evidence, not deployment authorization. `/deploy` owns the actual deployment write gate for the exact environment, verified target, artifact, and current evidence.
389
+ This is pre-deploy readiness evidence, not deployment authorization. `/deploy` owns the actual deployment write gate for the exact environment, verified target, artifact, and current evidence.
359
390
 
360
- ## 13. Post-readiness
391
+ ## 12. Post-readiness
361
392
 
362
- Once an environment is ready:
393
+ Once an environment is ready to deploy:
363
394
 
364
- - record non-secret readiness evidence in the repository-approved place;
395
+ - record non-secret readiness evidence in the repository-approved place when useful;
365
396
  - keep readiness independent from other environments;
366
- - use `/deploy [environment]` for repeatable deployment;
367
- - return to `/deployment-readiness` when machine binding, address, expected OS/runtime, security posture, credentials, or another material prerequisite changes.
397
+ - use `/deploy <environment>` for the application deployment and release-specific live validation;
398
+ - return to `/deployment-readiness <environment>` when machine binding, address, expected OS/runtime, security posture, credentials, registry access, data prerequisites, or another material pre-deploy prerequisite changes.
368
399
 
369
- Application rollback, database restore/destructive recovery, and environment tear-down remain separately governed when data safety warrants it.
400
+ Application rollback execution, database restore/destructive recovery, and environment tear-down remain separately governed when data safety warrants it.
@@ -109,9 +109,11 @@ Stop on unsafe states such as:
109
109
  - `LOCAL_MISSING`;
110
110
  - `UNTRACKED_CONFLICT`;
111
111
  - path collisions/conflicts;
112
- - unaccepted Core `RETIRED_PATH`.
112
+ - Core `RETIRED_DRIFT` when the retired file no longer matches its recorded managed hash.
113
113
 
114
- Core retired paths are an ownership-transfer decision. Never auto-add `--accept-retired core:<path>` merely to make the update pass. Explain the retired path and require a separate explicit ownership decision before re-previewing it.
114
+ A package-managed retired path that is unchanged from its recorded baseline may be classified as `REMOVE` and deleted safely; an already-missing retired path may be classified as `RETIRED_MISSING`. These states do not require a separate ownership decision because the baseline proves there is no consumer edit to preserve.
115
+
116
+ A modified retired Core path is different: never auto-add `--accept-retired core:<path>` merely to make the update pass. Explain that the file differs from its recorded Core-managed hash and require a separate explicit ownership-transfer decision before re-previewing it. When that exact transfer is accepted, the package updater preserves the file as consumer-owned content and drops it from the new Core baseline.
115
117
 
116
118
  For a Bootstrap-generated consumer, also preview the companion generated-consumer changes:
117
119
 
@@ -145,6 +147,7 @@ Choosing option 1 authorizes only:
145
147
 
146
148
  - creation/switch to one repository-appropriate short-lived update branch when needed;
147
149
  - exact target package apply;
150
+ - removal of unchanged retired package-managed files that the reviewed preview classified as `REMOVE`;
148
151
  - when `POC_BOOTSTRAP.json` is present, update of its exact `generation.lean.version` and `generation.lean.integrity` to the reviewed target while preserving package/profile;
149
152
  - migration of a recognized Bootstrap-generated package-verification block from duplicated current literals to the accepted manifest-driven form, only when the existing block still exactly matches the current approved metadata;
150
153
  - package/baseline/generated-consumer verification;
@@ -168,7 +171,7 @@ Apply using the same exact package version that was previewed, for example:
168
171
  npx --yes @mriekki/lean@<target-version> update --apply
169
172
  ```
170
173
 
171
- If explicit Core retired-path ownership transfer was separately approved, pass only the exact reviewed paths using the package's `--accept-retired core:<path>` contract. Never widen that set implicitly.
174
+ If explicit Core retired-path ownership transfer was separately approved, pass only the exact reviewed modified paths using the package's `--accept-retired core:<path>` contract. Never widen that set implicitly. Unchanged retired managed paths do not need this flag; the package updater removes them according to the reviewed `REMOVE` plan.
172
175
 
173
176
  For a Bootstrap-generated consumer, complete the reviewed companion metadata changes in the same bounded update before declaring success. Preserve every unrelated `POC_BOOTSTRAP.json` field. Never change package identity or profile as an incidental version update.
174
177
 
@@ -195,11 +198,12 @@ Confirm:
195
198
  - `LEAN_BASELINE.json` records the exact target package/version/profile;
196
199
  - component baseline commits/distributions match the umbrella baseline;
197
200
  - package check passes for the whole profile;
201
+ - unchanged retired managed files shown as `REMOVE` in the preview are actually absent after apply, while any explicitly transferred modified retired Core file remains present and is no longer Core-managed;
198
202
  - when `POC_BOOTSTRAP.json` exists, its package/version/profile agree with `LEAN_BASELINE.json` and its integrity equals the exact reviewed target registry integrity;
199
203
  - when the repository contains `tools/lean-package/check-managed-baselines.py`, that generated baseline checker passes after all companion metadata changes;
200
204
  - generated package-verification surfaces no longer contradict the approved manifest metadata;
201
205
  - consumer-owned content was not overwritten;
202
- - only intended package-managed changes, reviewed generated-consumer companion changes, and reviewed ownership transfers occurred.
206
+ - only intended package-managed changes, reviewed generated-consumer companion changes, reviewed removals, and reviewed ownership transfers occurred.
203
207
 
204
208
  If generated CI still embeds a different package version/integrity after the update, report `GENERATED LEAN VERIFICATION DRIFT` and stop before delivery.
205
209
 
@@ -213,7 +217,7 @@ Present the meaningful diff for human review. After acceptance, recommend `/deli
213
217
  - uses a different package version for apply than the reviewed preview;
214
218
  - performs a downgrade/rollback as an ordinary update;
215
219
  - overwrites unexplained managed drift;
216
- - auto-accepts Core retired-path ownership transfer;
220
+ - auto-accepts Core retired-path ownership transfer for a modified retired file;
217
221
  - silently repairs a pre-existing mismatch between `POC_BOOTSTRAP.json` and `LEAN_BASELINE.json`;
218
222
  - changes a generated consumer's package identity/profile or regenerates the repository as an incidental version update;
219
223
  - guesses at locally modified/unrecognized Bootstrap-generated verification logic;
@@ -60,7 +60,8 @@ MERGED_DEFAULT_BRANCH_CI_PENDING
60
60
  MERGED_DEFAULT_BRANCH_CI_FAILED
61
61
  DELIVERY_COMPLETE
62
62
  ENVIRONMENT_READINESS_PENDING
63
- ENVIRONMENT_READY
63
+ ENVIRONMENT_READY_TO_DEPLOY
64
+ DEPLOYMENT_VALIDATION_PENDING
64
65
  ```
65
66
 
66
67
  Use only states supported by observed evidence.
@@ -143,26 +144,28 @@ After merge:
143
144
 
144
145
  ## 6. Deployment handoff
145
146
 
146
- For a release/deployment engineering enabler after engineering delivery is complete, recommend:
147
+ For release/deployment engineering after engineering delivery is complete, recommend the selected environment's state-driven readiness workflow:
147
148
 
148
149
  ```text
149
- /deployment-readiness <deployment-enabler-ID> enable [environment]
150
+ /deployment-readiness <environment>
150
151
  ```
151
152
 
152
- when the selected environment still needs operational discovery/enablement.
153
+ Use the same command whether the environment still needs initial discovery, prerequisite setup, repair, or final pre-deploy verification. Readiness re-discovers current state and resumes automatically; do not tell the human to choose `discovery`, `enable`, or `resume` modes.
153
154
 
154
- When evidence shows a configured named environment is ready for deployment, recommend:
155
+ When evidence shows a configured named environment is ready to deploy, recommend:
155
156
 
156
157
  ```text
157
- /deploy [environment]
158
+ /deploy <environment>
158
159
  ```
159
160
 
160
- rather than treating `/deployment-readiness` as the application-deployment executor.
161
+ `ENVIRONMENT_READY_TO_DEPLOY` means pre-deploy prerequisites are satisfied. It does not require live application health, smoke, route resolution, or release-specific rollback evidence that can only be established by deploying the selected artifact.
162
+
163
+ After `/deploy`, use repository/tool evidence to distinguish a successfully validated deployment from `DEPLOYMENT_VALIDATION_PENDING` or a deployment failure.
161
164
 
162
165
  When the user asks for readiness across configured environments, recommend the read-only overview:
163
166
 
164
167
  ```text
165
- /deployment-readiness <deployment-enabler-ID> status
168
+ /deployment-readiness status
166
169
  ```
167
170
 
168
171
  Do not infer readiness of one environment from another. Production is never an implicit/default environment, and `/next-step` never authorizes a remote or production deployment merely by recommending `/deploy`.
@@ -159,20 +159,22 @@ For LIGHT work, branch setup is part of the human-selected implementation action
159
159
 
160
160
  When a work item owns release/deployment engineering or environment enablement, classify it ELEVATED when the change materially affects deployment/recovery/security behavior.
161
161
 
162
- Environment discovery may begin early with:
162
+ Environment readiness may begin early with the normal state-driven interface:
163
163
 
164
164
  ```text
165
- /deployment-readiness <deployment-enabler-ID> discovery [environment]
165
+ /deployment-readiness <environment>
166
166
  ```
167
167
 
168
- Discovery begins with existing local/repository configuration, shows simple known machine facts for confirmation, and does not authorize remote writes or deployment.
168
+ It begins with existing local/repository configuration, shows simple known machine facts for confirmation, and continues only as far as current engineering/evidence safely allows. It does not authorize application deployment.
169
169
 
170
- After implementation review/local acceptance, use `/deliver`. After `/deliver` reports the merge, default-branch CI, and applicable repository-policy evidence satisfied, hand off to:
170
+ After implementation review/local acceptance, use `/deliver`. After `/deliver` reports the merge, default-branch CI, and applicable repository-policy evidence satisfied, return to the same state-driven readiness command for the selected environment:
171
171
 
172
172
  ```text
173
- /deployment-readiness <deployment-enabler-ID> enable [environment]
173
+ /deployment-readiness <environment>
174
174
  ```
175
175
 
176
+ The workflow re-discovers state and continues from the furthest safe point; do not require the human to switch from a discovery mode to an enable mode.
177
+
176
178
  Production remains a role with stronger policy and deployment authorization; it does not use a separate readiness workflow.
177
179
 
178
180
  ## 8. Guided ending
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@mriekki/lean",
3
- "version": "0.3.1",
3
+ "version": "0.4.0",
4
4
  "description": "Public consumer distribution and updater for Lean engineering assets.",
5
5
  "type": "module",
6
6
  "bin": {
package/src/cli.mjs CHANGED
@@ -11,7 +11,8 @@ function parseArgs(argv) {
11
11
  const positional = [];
12
12
  for (let i = 0; i < argv.length; i += 1) {
13
13
  const arg = argv[i];
14
- if (arg === '--apply' || arg === '--yes') options.apply = true;
14
+ if (arg === '--help' || arg === '-h') options.help = true;
15
+ else if (arg === '--apply' || arg === '--yes') options.apply = true;
15
16
  else if (arg === '--root') options.root = argv[++i];
16
17
  else if (arg === '--profile') options.profile = argv[++i];
17
18
  else if (arg === '--consumer') options.consumer = argv[++i];
@@ -65,13 +66,31 @@ async function shouldApply(options) {
65
66
  }
66
67
  }
67
68
 
68
- function usage() {
69
- console.log(`@mriekki/lean\n\nCommands:\n install Preview/install bundled Lean assets\n update Preview/update to this package's bundled Lean assets\n status Show installed umbrella/component provenance\n check Verify managed files and baselines exactly match this package\n version Show package version\n\nCommon options:\n --root PATH\n --profile greenfield-poc\n --apply | --yes\n --consumer NAME\n --consumer-baseline LABEL\n --accept-retired core:path\n`);
69
+ function usage(command) {
70
+ const commandUsage = {
71
+ install: 'lean install [--root PATH] [--profile NAME] [--apply|--yes] [--consumer NAME] [--consumer-baseline LABEL] [--accept-retired component:path]',
72
+ update: 'lean update [--root PATH] [--profile NAME] [--apply|--yes] [--accept-retired component:path]',
73
+ status: 'lean status [--root PATH] [--profile NAME]',
74
+ check: 'lean check [--root PATH] [--profile NAME]',
75
+ version: 'lean version'
76
+ };
77
+
78
+ if (commandUsage[command]) {
79
+ console.log(`@mriekki/lean\n\nUsage:\n ${commandUsage[command]}\n`);
80
+ return;
81
+ }
82
+
83
+ console.log(`@mriekki/lean\n\nCommands:\n install Preview/install bundled Lean assets\n update Preview/update to this package's bundled Lean assets\n status Show installed umbrella/component provenance\n check Verify managed files and baselines exactly match this package\n version Show package version\n\nCommon options:\n --root PATH\n --profile greenfield-poc\n --apply | --yes\n --consumer NAME\n --consumer-baseline LABEL\n --accept-retired core:path\n -h, --help\n`);
70
84
  }
71
85
 
72
86
  export async function run(argv = process.argv.slice(2), packageData = loadPackageData()) {
73
87
  const { command, options } = parseArgs(argv);
74
- if (command === 'help' || command === '--help') { usage(); return 0; }
88
+ if (command === 'help') { usage(); return 0; }
89
+ if (options.help) {
90
+ if (!['install', 'update', 'status', 'check', 'version'].includes(command)) throw new Error(`Unknown command: ${command}`);
91
+ usage(command);
92
+ return 0;
93
+ }
75
94
  if (command === 'version') { console.log(`${packageData.pkg.name} ${packageData.pkg.version}`); return 0; }
76
95
  const root = path.resolve(options.root ?? process.cwd());
77
96
  if (!fs.existsSync(root) || !fs.statSync(root).isDirectory()) throw new Error(`Repository root not found: ${root}`);
package/src/engine.mjs CHANGED
@@ -3,7 +3,7 @@ import fs from 'node:fs';
3
3
  import path from 'node:path';
4
4
  import { readJson } from './package-data.mjs';
5
5
 
6
- const CORE_SAFE = new Set(['SAME', 'ADD', 'CORE_UPDATE', 'UNTRACKED_MATCH', 'BASELINE_STALE']);
6
+ const CORE_SAFE = new Set(['SAME', 'ADD', 'CORE_UPDATE', 'UNTRACKED_MATCH', 'BASELINE_STALE', 'REMOVE', 'RETIRED_MISSING']);
7
7
  const DEPLOYMENT_SAFE = new Set(['SAME', 'ADD', 'KIT_UPDATE', 'UNTRACKED_MATCH', 'BASELINE_STALE', 'REMOVE', 'RETIRED_MISSING']);
8
8
 
9
9
  export function safeRelative(value, label = 'path') {
@@ -123,22 +123,24 @@ export function planComponent(packageData, componentId, targetRoot, acceptedReti
123
123
  for (const [retiredPath, item] of [...baseMap.entries()].sort(([a], [b]) => a.localeCompare(b))) {
124
124
  if (desired.has(retiredPath)) continue;
125
125
  const dst = resolveUnder(targetRoot, retiredPath, 'retired destination');
126
- if (componentId === 'core') {
127
- retired.push({ path: retiredPath, item, state: acceptedRetired.has(retiredPath) ? 'RETIRED_ACCEPTED' : 'RETIRED_PATH' });
128
- continue;
129
- }
130
126
  if (!fs.existsSync(dst)) {
131
127
  retired.push({ path: retiredPath, item, state: 'RETIRED_MISSING' });
128
+ continue;
129
+ }
130
+ const stat = fs.lstatSync(dst);
131
+ const currentHash = stat.isFile() && !stat.isSymbolicLink() ? sha256File(dst) : null;
132
+ if (currentHash === item.sha256) {
133
+ retired.push({ path: retiredPath, item, currentHash, state: 'REMOVE' });
134
+ } else if (componentId === 'core' && acceptedRetired.has(retiredPath)) {
135
+ retired.push({ path: retiredPath, item, currentHash, state: 'RETIRED_ACCEPTED' });
132
136
  } else {
133
- const stat = fs.lstatSync(dst);
134
- const currentHash = stat.isFile() && !stat.isSymbolicLink() ? sha256File(dst) : null;
135
- retired.push({ path: retiredPath, item, currentHash, state: currentHash === item.sha256 ? 'REMOVE' : 'RETIRED_DRIFT' });
137
+ retired.push({ path: retiredPath, item, currentHash, state: 'RETIRED_DRIFT' });
136
138
  }
137
139
  }
138
140
  const safe = componentId === 'core' ? CORE_SAFE : DEPLOYMENT_SAFE;
139
141
  const unsafe = rows.filter((row) => !safe.has(row.state)).map((row) => ({ state: row.state, path: row.path }));
140
142
  for (const item of retired) {
141
- const isSafe = componentId === 'core' ? item.state === 'RETIRED_ACCEPTED' : safe.has(item.state);
143
+ const isSafe = item.state === 'RETIRED_ACCEPTED' || safe.has(item.state);
142
144
  if (!isSafe) unsafe.push({ state: item.state, path: item.path });
143
145
  }
144
146
  return {
@@ -202,10 +204,8 @@ export function applyProfile(packageData, profilePlan, targetRoot, consumer, con
202
204
  fs.mkdirSync(path.dirname(dst), { recursive: true });
203
205
  fs.copyFileSync(row.bundlePath, dst);
204
206
  }
205
- if (plan.componentId === 'deployment') {
206
- for (const retired of plan.retired) {
207
- if (retired.state === 'REMOVE') fs.unlinkSync(resolveUnder(targetRoot, retired.path, 'retired destination'));
208
- }
207
+ for (const retired of plan.retired) {
208
+ if (retired.state === 'REMOVE') fs.unlinkSync(resolveUnder(targetRoot, retired.path, 'retired destination'));
209
209
  }
210
210
  }
211
211
  for (const plan of profilePlan.plans) {