@mriekki/lean 0.4.3 → 0.4.5

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 (35) hide show
  1. package/assets/components.json +3 -3
  2. package/assets/core/distribution.json +8 -0
  3. package/assets/deployment/distribution.json +2 -0
  4. package/assets/generated/ASSEMBLY.json +73 -23
  5. package/assets/generated/core/core/instructions/lean-docs.instructions.md +33 -2
  6. package/assets/generated/core/core/instructions/lean-workflow.instructions.md +42 -0
  7. package/assets/generated/core/core/learning/DIAGRAM_GUIDE.md +46 -6
  8. package/assets/generated/core/core/learning/ENGINEERING_LEARNING_WORKBOOK.md +29 -6
  9. package/assets/generated/core/core/learning/LEARNING_MAP.md +37 -2
  10. package/assets/generated/core/core/learning/LEARNING_PROGRESS.md +15 -7
  11. package/assets/generated/core/core/learning/SYSTEM_DESIGN_DRILLS.md +299 -19
  12. package/assets/generated/core/core/process/COACHING_GUIDE.md +35 -2
  13. package/assets/generated/core/core/process/DATABASE_LEARNING_WORKBENCH.md +153 -102
  14. package/assets/generated/core/core/process/DEPLOYMENT_ENABLEMENT.md +108 -71
  15. package/assets/generated/core/core/process/LEAN_ENGINEERING_GUIDE.md +317 -0
  16. package/assets/generated/core/core/process/PROJECT_DOCUMENTATION_FRAMEWORK.md +324 -0
  17. package/assets/generated/core/core/process/SYSTEM_DESIGN_LEARNING_WORKBENCH.md +520 -0
  18. package/assets/generated/core/core/skills/coach/SKILL.md +31 -4
  19. package/assets/generated/core/core/skills/db-lab/SKILL.md +59 -16
  20. package/assets/generated/core/core/skills/deliver/SKILL.md +77 -5
  21. package/assets/generated/core/core/skills/deploy/SKILL.md +164 -121
  22. package/assets/generated/core/core/skills/deployment-readiness/SKILL.md +223 -250
  23. package/assets/generated/core/core/skills/docs/SKILL.md +116 -0
  24. package/assets/generated/core/core/skills/next-step/SKILL.md +21 -6
  25. package/assets/generated/core/core/skills/system-lab/SKILL.md +333 -0
  26. package/assets/generated/core/core/skills/tear-down/SKILL.md +101 -61
  27. package/assets/generated/core/core/templates/ADR_TEMPLATE.md +41 -0
  28. package/assets/generated/core/tools/docs_site/docs_site.py +382 -0
  29. package/assets/generated/core/tools/system_lab/system_workbench.py +243 -0
  30. package/assets/generated/deployment/src/lean_poc_deployment/entrypoint.py +5 -1
  31. package/assets/generated/deployment/src/lean_poc_deployment/local_cli.py +112 -0
  32. package/assets/generated/deployment/src/lean_poc_deployment/local_runtime.py +523 -0
  33. package/assets/generated/deployment/src/lean_poc_deployment/teardown.py +49 -35
  34. package/assets/generated/deployment/src/lean_poc_deployment/teardown_cli.py +31 -12
  35. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  name: db-lab
3
- description: "Optional project-aware database learning lab using actual schema, ORM, migration, query, and query-plan evidence for SQL, relational design, debugging, and interview practice."
4
- argument-hint: "[schema|trace|plan|debug|migration|interview|topic] [light|focused|deep]"
3
+ description: "Optional project-aware database learning lab using actual schema, ORM, migration, query, and query-plan evidence for SQL, relational design, debugging, change exploration, and interview practice."
4
+ argument-hint: "[schema|changes|trace|plan|debug|migration|interview|topic] [work-item] [light|focused|deep]"
5
5
  user-invocable: true
6
6
  disable-model-invocation: true
7
7
  ---
@@ -14,12 +14,13 @@ For detailed usage and examples, read `docs/process/DATABASE_LEARNING_WORKBENCH.
14
14
 
15
15
  ## 1. Boundaries
16
16
 
17
- - Start from the actual repository and its documented development/test database configuration.
17
+ - Start from the **current** repository and its documented development/test database configuration.
18
+ - Re-discover relevant database evidence whenever the lab is invoked. Running `/db-lab` means inspect current evidence and show the current view; do not make the human remember to refresh/rebuild an ERD.
18
19
  - Prefer read-only inspection. Do not mutate application data, apply migrations, add/drop indexes, or change production code while in Database Lab mode.
19
20
  - Never inspect Production credentials or Production data.
20
21
  - Do not invent schema, SQL, query-plan behavior, ORM translation, or index usage. Distinguish inferred behavior from captured evidence.
21
22
  - If safe local database/runtime evidence is unavailable, fall back to repository artifacts and say what could not be verified.
22
- - Generated learning artifacts are allowed only as disposable local output from read-only evidence; do not commit them unless the human explicitly asks for a durable artifact.
23
+ - Generated learning artifacts are disposable projections of current evidence. Generate in temp/cache output and do not commit them unless explicitly requested.
23
24
  - Discovered implementation defects return to the normal engineering workflow; do not silently fix them here.
24
25
  - Learning is optional and never blocks delivery.
25
26
 
@@ -45,7 +46,7 @@ Do not collapse these into one generic "SQL level". A developer may be strong in
45
46
 
46
47
  ## 3. Schema mode
47
48
 
48
- Build an evidence-backed view from the best available sources:
49
+ Build an evidence-backed current view from the best available sources:
49
50
 
50
51
  ```text
51
52
  physical database metadata
@@ -65,7 +66,25 @@ ORM MODEL — what the ORM maps and tracks
65
66
  PHYSICAL MODEL — what the relational database actually stores/enforces
66
67
  ```
67
68
 
68
- ## 4. Query trace mode
69
+ ## 4. Change-focused mode
70
+
71
+ `/db-lab changes <work-item>` should focus on the accepted/delivered change set when evidence is available.
72
+
73
+ Show relevant changes to:
74
+
75
+ - entities/tables and columns;
76
+ - keys, constraints, relationships and cascade behavior;
77
+ - indexes/access paths;
78
+ - ORM mappings and generated SQL behavior;
79
+ - migrations/schema evolution;
80
+ - affected query paths;
81
+ - transaction/concurrency assumptions.
82
+
83
+ Connect each material change to the learning implication. A changed ORM/model file is evidence that persistence code was touched, not proof that the physical database changed; verify against migrations/schema/database evidence.
84
+
85
+ When a previous disposable workbench snapshot exists, it may be used as a comparison aid. The current database/repository evidence remains authoritative.
86
+
87
+ ## 5. Query trace mode
69
88
 
70
89
  Trace a real application query without guessing:
71
90
 
@@ -82,7 +101,7 @@ application/ORM expression
82
101
 
83
102
  Keep translation preview and actual executed command distinct when the framework exposes both.
84
103
 
85
- ## 5. Query-to-ERD highlighting
104
+ ## 6. Query-to-ERD highlighting
86
105
 
87
106
  When the distributed SQLite workbench or another compatible viewer is available, a selected query should drive a linked ERD view:
88
107
 
@@ -97,7 +116,7 @@ Never claim the planner used an index merely because it exists or looks relevant
97
116
 
98
117
  If no interactive viewer is available, provide a temporary Mermaid/text diagram using the same evidence and clearly label it as a fallback rather than a live ERD.
99
118
 
100
- ## 6. SQLite workbench
119
+ ## 7. SQLite workbench
101
120
 
102
121
  When `tools/lean-db-lab/sqlite-workbench.py` exists and a safe local development/test SQLite database is known, prefer it for physical-schema and query-plan evidence.
103
122
 
@@ -110,11 +129,11 @@ The tool:
110
129
  - generates self-contained `index.html` plus `workbench.json` learning artifacts;
111
130
  - supports interactive table/index inspection and query-to-ERD highlighting.
112
131
 
113
- Generate output in an explicitly selected disposable/temp location. Do not write it into tracked project paths by default.
132
+ Generate output in a stable per-repository disposable/temp location when practical. Running the lab should regenerate the current view; an already-open older browser tab is not authoritative.
114
133
 
115
134
  The workbench analyzes captured SQL; it does not itself capture Entity Framework commands. Obtain translation/execution evidence through supported framework mechanisms first, then pass the captured SQL into the workbench when useful.
116
135
 
117
- ## 7. Query-plan/performance mode
136
+ ## 8. Query-plan/performance mode
118
137
 
119
138
  Use provider-native plan evidence where safely available. Ask the developer to predict likely scans/searches/joins/index behavior before revealing the plan when that improves learning.
120
139
 
@@ -130,7 +149,7 @@ query/access pattern
130
149
 
131
150
  Do not teach "add an index" without connecting it to a concrete access pattern, selectivity/order needs, write cost, and plan evidence.
132
151
 
133
- ## 8. Debug mode
152
+ ## 9. Debug mode
134
153
 
135
154
  ```text
136
155
  symptom
@@ -145,7 +164,7 @@ symptom
145
164
 
146
165
  The human should diagnose before the lab reveals the answer unless they explicitly request explanation-first coaching.
147
166
 
148
- ## 9. Migration mode
167
+ ## 10. Migration mode
149
168
 
150
169
  Connect:
151
170
 
@@ -159,7 +178,7 @@ ORM migration/change
159
178
 
160
179
  Ask the developer to predict effects before showing generated SQL when useful. Discuss destructive changes, nullability transitions, backfills, constraint creation, and rollback limitations without applying migrations in learning mode.
161
180
 
162
- ## 10. Interview/design mode
181
+ ## 11. Interview/design mode
163
182
 
164
183
  Use the active project domain as context, but perturb requirements so the developer must reason rather than reproduce the existing schema.
165
184
 
@@ -181,7 +200,7 @@ requirements clarification
181
200
 
182
201
  Challenge unsupported choices. Ask why a junction table exists, why a key was selected, what deletion means historically, which queries justify an index, and how changed requirements alter the design.
183
202
 
184
- ## 11. ORM-specific evidence
203
+ ## 12. ORM-specific evidence
185
204
 
186
205
  When Entity Framework Core is present, distinguish:
187
206
 
@@ -195,8 +214,32 @@ Do not present a translation preview as proof of the exact command that executed
195
214
 
196
215
  For other ORMs, apply the same principle using framework-supported evidence instead of guessing.
197
216
 
198
- ## 12. Tooling
217
+ ## 13. Cross-lab navigation
218
+
219
+ Database Lab owns database depth; System Lab owns end-to-end system context.
220
+
221
+ When database exploration reaches service boundaries, request/event flow, traffic, availability, security, deployment, or system-wide failure behavior, offer `/system-lab` when installed.
222
+
223
+ When `/system-lab` reaches a database node and the learner needs schema/query/index/ORM/plan depth, return to `/db-lab`.
224
+
225
+ ## 14. Delivery-completion visibility
226
+
227
+ After successful delivery, Lean may visibly recommend `/db-lab` while the change is fresh when the accepted diff changed database-related evidence such as entities, migrations, schema, SQL/query code, repository/persistence behavior, indexes, constraints, or transaction logic.
228
+
229
+ Prefer learner-facing wording such as:
230
+
231
+ ```text
232
+ ★ /db-lab changes WI-24
233
+ This work changed database structure or behavior.
234
+ Explore affected relationships, queries, indexes, constraints, and ORM behavior.
235
+ ```
236
+
237
+ Do **not** say "rebuild the database diagram" or "refresh the model". Current evidence is part of invoking the lab.
238
+
239
+ Best-effort disposable workbench generation after delivery is allowed only when a safe development/test database is already known. Do not guess a database path, create/apply migrations, or touch Production just to generate a learning artifact. Generation failure never changes delivery state.
240
+
241
+ ## 15. Tooling
199
242
 
200
243
  Optional IDE/database extensions may improve exploration but are not workflow authority and must not become a required dependency unless the project explicitly owns that requirement.
201
244
 
202
- Prefer provider/framework-native inspection plus repository evidence. The SQLite workbench is a reusable read-only learning aid; future provider/ORM adapters should preserve the same evidence and safety contract.
245
+ Prefer provider/framework-native inspection plus repository evidence. The SQLite workbench is a reusable read-only learning aid; future provider/ORM adapters should preserve the same evidence, current-by-default behavior, and safety contract.
@@ -1,6 +1,6 @@
1
1
  ---
2
2
  name: deliver
3
- description: "Streamlined delivery after implementation review/approval: short-lived branch recovery/setup, selective commit/push/PR/CI mechanics, one explicit merge/finalize gate, post-merge CI, and safe delivered-branch cleanup."
3
+ description: "Streamlined delivery after implementation review/approval: short-lived branch recovery/setup, selective commit/push/PR/CI mechanics, one explicit merge/finalize gate, post-merge CI, safe delivered-branch cleanup, and optional non-blocking learning handoff."
4
4
  argument-hint: "[optional work-item ID or external key]"
5
5
  user-invocable: true
6
6
  disable-model-invocation: true
@@ -49,8 +49,11 @@ D. MERGE + FINALIZE DECISION — one human gate
49
49
  E. POST-MERGE DEFAULT-BRANCH CI — automatic observation
50
50
  F. DELIVERED-BRANCH FINALIZATION — automatic when authorized and safe
51
51
  G. DELIVERY COMPLETE
52
+ H. OPTIONAL LEARNING HANDOFF — visible, read-only/non-blocking
52
53
  ```
53
54
 
55
+ Phase H never changes whether engineering delivery is complete.
56
+
54
57
  ## 3. Resume-aware initial inspection
55
58
 
56
59
  Inspect only what is needed to determine the furthest safe delivery state, such as:
@@ -281,9 +284,9 @@ Never use force deletion merely to bypass uncertainty.
281
284
 
282
285
  If any safety condition fails, preserve the branch and report `BRANCH CLEANUP PENDING` with the exact reason instead of asking repetitive yes/no questions.
283
286
 
284
- ## 11. Delivery completion
287
+ ## 11. Delivery completion and optional learning handoff
285
288
 
286
- Report the observed outcome:
289
+ First report the observed engineering outcome:
287
290
 
288
291
  ```text
289
292
  DELIVERY COMPLETE
@@ -302,6 +305,73 @@ DELIVERY COMPLETE — BRANCH CLEANUP PENDING
302
305
 
303
306
  and preserve the branch.
304
307
 
308
+ After engineering delivery is complete, use the accepted PR/work-item diff to classify optional learning relevance. This classification is read-only and does not create another delivery state.
309
+
310
+ Database relevance can include observed changes to entities/models, migrations, DDL/schema, SQL/query/repository/persistence code, indexes/constraints, ORM mappings, or transaction/concurrency behavior.
311
+
312
+ System-design relevance can include observed changes to APIs/contracts, service/module boundaries, cross-component dependencies, external integrations, messaging/events, caches, security/auth boundaries, observability, deployment/runtime topology, infrastructure, scaling/performance behavior, or failure handling.
313
+
314
+ A changed file proves that evidence was touched; it does not by itself prove a physical-schema or runtime-behavior change. Use `changed`/`affected` wording conservatively and verify deeper claims through the corresponding lab.
315
+
316
+ ### Best-effort disposable workbench preparation
317
+
318
+ After merge, satisfactory post-merge/default-branch evidence, and update to the delivered default-branch checkout, `/deliver` may prepare current disposable learning artifacts automatically when all prerequisites are already safe and unambiguous.
319
+
320
+ System Lab:
321
+ - when system-design relevance is present and `tools/lean-system-lab/system-workbench.py` exists, it may run the exporter against the current repository;
322
+ - use a stable per-repository temp/cache output directory so an older disposable `workbench.json` can be compared before replacement;
323
+ - pass the accepted changed-file list via `--changed-file` when practical;
324
+ - never write generated workbench output into tracked project paths by default.
325
+
326
+ Database Lab:
327
+ - when database relevance is present, `tools/lean-db-lab/sqlite-workbench.py` exists, and a safe local development/test SQLite database path is already known from project setup/configuration/evidence, it may generate the current DB workbench;
328
+ - do not guess a database path;
329
+ - do not create a database, apply migrations, mutate data, inspect Production, or change code merely to prepare a learning artifact.
330
+
331
+ For either lab:
332
+ - artifact generation is read-only/best-effort;
333
+ - failure/unavailability is reported briefly and never changes `DELIVERY COMPLETE`;
334
+ - generation does not mean the human performed the learning activity or demonstrated understanding;
335
+ - do not open browser/UI automatically unless normal repository/local-workflow conventions make that expected and non-disruptive.
336
+
337
+ ### Visible optional learning reminder
338
+
339
+ Keep learning visible while the change is fresh. Prefer this order:
340
+
341
+ ```text
342
+ OPTIONAL LEARNING — recommended while this change is fresh
343
+
344
+ ★ /db-lab changes <work-item>
345
+ This work changed database structure or behavior.
346
+ Explore affected relationships, queries, indexes, constraints, and ORM behavior.
347
+
348
+ ★ /system-lab changes <work-item>
349
+ This work changed system structure or runtime behavior.
350
+ Explore affected components, flows, dependencies, tradeoffs, and failure modes.
351
+
352
+ ○ /code-walkthrough <work-item>
353
+ Walk through the implementation and changed-file flow.
354
+
355
+ ○ /learning-review <work-item>
356
+ Test your understanding.
357
+
358
+ Learning is optional and does not affect delivery state.
359
+ ```
360
+
361
+ Only use `★` for a lab supported by the accepted change evidence. If a lab is not especially relevant, keep it visible as an available option when useful, for example:
362
+
363
+ ```text
364
+ ○ /db-lab
365
+ Explore the current database schema, relationships, queries, indexes, and ORM behavior.
366
+
367
+ ○ /system-lab
368
+ Explore the current architecture, runtime flows, dependencies, scaling, and failure behavior.
369
+ ```
370
+
371
+ Do not tell the human to "rebuild", "refresh", or maintain a generated diagram. Invoking a lab means inspect current evidence and generate/show the current view.
372
+
373
+ Do not turn these reminders into approval prompts. The human may invoke one, continue to deployment work, start another work item, or do nothing.
374
+
305
375
  ## 12. Deployment handoff
306
376
 
307
377
  If the delivered work item owns release/deployment engineering, successful engineering delivery may hand off to the selected environment's state-driven readiness workflow:
@@ -314,12 +384,14 @@ Readiness re-discovers current state and continues from the furthest safe point;
314
384
 
315
385
  The readiness workflow is environment-generic. Production remains an environment role with stronger policy; merge approval never implies remote or production-deployment authorization.
316
386
 
387
+ The optional learning handoff does not block or replace deployment readiness when deployment is the sensible next engineering action.
388
+
317
389
  ## 13. Relationship to /start-work, /next-step, and /cleanup-branches
318
390
 
319
391
  `/start-work` establishes the short-lived work branch as routine implementation setup once implementation is actually authorized.
320
392
 
321
- `/next-step` answers `Where am I?`.
393
+ `/next-step` answers `Where am I?` and may surface optional learning choices without creating learning-only workflow states.
322
394
 
323
- `/deliver` takes reviewed/accepted work through routine branch/commit/push/PR/CI mechanics automatically, then stops once for the merge-and-finalize decision.
395
+ `/deliver` takes reviewed/accepted work through routine branch/commit/push/PR/CI mechanics automatically, then stops once for the merge-and-finalize decision. After successful engineering completion it may prepare disposable learning workbenches and shows an optional learning handoff without creating another gate.
324
396
 
325
397
  `/cleanup-branches` is the standalone preview-first path for accumulated, previously retained, unrelated, or otherwise out-of-band branch housekeeping.