@tduyng/pi-devos 0.0.0-stage → 0.13.6

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 (138) hide show
  1. package/CHANGELOG.md +1398 -0
  2. package/LICENSE +201 -0
  3. package/README.md +213 -2
  4. package/package.json +45 -4
  5. package/plugins/devos/agents/reader.md +27 -0
  6. package/plugins/devos/agents/verifier.md +181 -0
  7. package/plugins/devos/pi/extension/devos.ts +615 -0
  8. package/plugins/devos/scripts/check-evidence-router.sh +134 -0
  9. package/plugins/devos/scripts/evidence-router.py +252 -0
  10. package/plugins/devos/scripts/gates/check-dod-core.sh +283 -0
  11. package/plugins/devos/scripts/gates/check-dod.sh +38 -0
  12. package/plugins/devos/scripts/gates/check-handoff.sh +215 -0
  13. package/plugins/devos/scripts/gates/check-implementation-boundary.sh +99 -0
  14. package/plugins/devos/scripts/gates/check-port-source.sh +134 -0
  15. package/plugins/devos/scripts/gates/check-report-locations.sh +148 -0
  16. package/plugins/devos/scripts/gates/check-scenario-coverage.sh +102 -0
  17. package/plugins/devos/scripts/gates/gate-check.mjs +204 -0
  18. package/plugins/devos/scripts/gates/phase-gate.sh +208 -0
  19. package/plugins/devos/scripts/gates/plan-template-check.py +147 -0
  20. package/plugins/devos/scripts/gates/run-gate.sh +148 -0
  21. package/plugins/devos/scripts/gates/spec-template-check.py +165 -0
  22. package/plugins/devos/scripts/gates/test-gates.sh +4306 -0
  23. package/plugins/devos/scripts/gates/test-integrity-rubric.sh +152 -0
  24. package/plugins/devos/scripts/gates/test-phase-gate.sh +116 -0
  25. package/plugins/devos/skills/absorb/SKILL.md +75 -0
  26. package/plugins/devos/skills/absorb/references/distill.md +67 -0
  27. package/plugins/devos/skills/absorb/scripts/check-refs.sh +108 -0
  28. package/plugins/devos/skills/absorb/scripts/knowledge.py +258 -0
  29. package/plugins/devos/skills/build/SKILL.md +71 -0
  30. package/plugins/devos/skills/build/references/advanced-routing.md +19 -0
  31. package/plugins/devos/skills/build/references/defect.md +17 -0
  32. package/plugins/devos/skills/build/references/exposure.md +28 -0
  33. package/plugins/devos/skills/build/references/hard.md +39 -0
  34. package/plugins/devos/skills/build/references/refactor.md +66 -0
  35. package/plugins/devos/skills/build/references/routes.md +56 -0
  36. package/plugins/devos/skills/build/references/scale.md +84 -0
  37. package/plugins/devos/skills/build/references/spike.md +19 -0
  38. package/plugins/devos/skills/build/scripts/construct-census.py +204 -0
  39. package/plugins/devos/skills/build/scripts/dep-order.py +297 -0
  40. package/plugins/devos/skills/build/scripts/ledger.sh +228 -0
  41. package/plugins/devos/skills/build/scripts/route.sh +5 -0
  42. package/plugins/devos/skills/build/scripts/secret-scan.sh +121 -0
  43. package/plugins/devos/skills/build/scripts/toolchain-preflight.py +302 -0
  44. package/plugins/devos/skills/design-taste/SKILL.md +55 -0
  45. package/plugins/devos/skills/design-taste/references/tells.md +85 -0
  46. package/plugins/devos/skills/design-taste/scripts/slop-scan.py +305 -0
  47. package/plugins/devos/skills/docs/SKILL.md +22 -0
  48. package/plugins/devos/skills/docs/references/backfill.md +54 -0
  49. package/plugins/devos/skills/docs/references/init.md +43 -0
  50. package/plugins/devos/skills/docs/references/status.md +71 -0
  51. package/plugins/devos/skills/docs/references/update.md +80 -0
  52. package/plugins/devos/skills/explain/SKILL.md +45 -0
  53. package/plugins/devos/skills/explain/references/quiz.md +21 -0
  54. package/plugins/devos/skills/frame/SKILL.md +71 -0
  55. package/plugins/devos/skills/frame/references/boundaries.md +53 -0
  56. package/plugins/devos/skills/frame/references/decompose.md +96 -0
  57. package/plugins/devos/skills/frame/references/impact.md +43 -0
  58. package/plugins/devos/skills/frame/references/interrogate.md +68 -0
  59. package/plugins/devos/skills/frame/scripts/survey.sh +44 -0
  60. package/plugins/devos/skills/implement/SKILL.md +36 -0
  61. package/plugins/devos/skills/implement/references/conditional-plan.md +17 -0
  62. package/plugins/devos/skills/implement/references/debug-loop.md +7 -0
  63. package/plugins/devos/skills/implement/references/dod.md +32 -0
  64. package/plugins/devos/skills/implement/references/implement.md +52 -0
  65. package/plugins/devos/skills/implement/references/manual-gates.md +16 -0
  66. package/plugins/devos/skills/implement/references/plan.md +160 -0
  67. package/plugins/devos/skills/implement/references/resume.md +9 -0
  68. package/plugins/devos/skills/implement/references/scale.md +86 -0
  69. package/plugins/devos/skills/implement/references/verify-close.md +61 -0
  70. package/plugins/devos/skills/implement/references/visual-verification.md +7 -0
  71. package/plugins/devos/skills/implement/scripts/check-converge.sh +147 -0
  72. package/plugins/devos/skills/implement/scripts/equivalence-check.sh +140 -0
  73. package/plugins/devos/skills/implement/scripts/manifest-queue.sh +185 -0
  74. package/plugins/devos/skills/implement/scripts/ops-log.sh +58 -0
  75. package/plugins/devos/skills/implement/scripts/pilot-consistency.py +173 -0
  76. package/plugins/devos/skills/implement/scripts/validate-spec.sh +268 -0
  77. package/plugins/devos/skills/init/SKILL.md +100 -0
  78. package/plugins/devos/skills/init/references/archetype-sections.md +15 -0
  79. package/plugins/devos/skills/init/references/context.md +42 -0
  80. package/plugins/devos/skills/init/references/conventions-template.md +153 -0
  81. package/plugins/devos/skills/init/references/reverse-engineer.md +3 -0
  82. package/plugins/devos/skills/init/references/rule-format.md +58 -0
  83. package/plugins/devos/skills/init/references/shape-model.md +29 -0
  84. package/plugins/devos/skills/init/scripts/detect-archetype.py +461 -0
  85. package/plugins/devos/skills/init/scripts/render-rule.py +114 -0
  86. package/plugins/devos/skills/init/scripts/reverse-engineer.sh +162 -0
  87. package/plugins/devos/skills/learn/SKILL.md +29 -0
  88. package/plugins/devos/skills/learn/references/destinations.md +43 -0
  89. package/plugins/devos/skills/learn/references/scoring.md +26 -0
  90. package/plugins/devos/skills/product/SKILL.md +40 -0
  91. package/plugins/devos/skills/product/references/planner.md +54 -0
  92. package/plugins/devos/skills/review/SKILL.md +77 -0
  93. package/plugins/devos/skills/review/references/gaps.md +26 -0
  94. package/plugins/devos/skills/spec/SKILL.md +58 -0
  95. package/plugins/devos/skills/spec/references/prototype.md +21 -0
  96. package/plugins/devos/skills/spec/references/question-craft.md +47 -0
  97. package/plugins/devos/skills/spec/references/roadmap-link.md +5 -0
  98. package/plugins/devos/skills/spec/references/write-spec.md +143 -0
  99. package/plugins/devos/skills/spec/scripts/clarify.sh +173 -0
  100. package/plugins/devos/skills/status/SKILL.md +67 -0
  101. package/plugins/devos/skills/status/references/cost.md +38 -0
  102. package/plugins/devos/skills/status/scripts/artifact-budgets.sh +88 -0
  103. package/plugins/devos/skills/status/scripts/check-requires.py +556 -0
  104. package/plugins/devos/skills/status/scripts/context-cost.sh +89 -0
  105. package/plugins/devos/skills/status/scripts/convention-usage.sh +184 -0
  106. package/plugins/devos/skills/status/scripts/findings-summary.sh +112 -0
  107. package/plugins/devos/skills/status/scripts/quality-correlation.sh +282 -0
  108. package/plugins/devos/skills/status/scripts/sizing-calibration.sh +71 -0
  109. package/plugins/devos/skills/status/scripts/spec-diff.sh +137 -0
  110. package/plugins/devos/skills/surgical-diff/SKILL.md +23 -0
  111. package/plugins/devos/skills/test-integrity/SKILL.md +26 -0
  112. package/plugins/devos/skills/verification-evidence/SKILL.md +17 -0
  113. package/plugins/devos/workflows/common/backlog-file-structure.md +44 -0
  114. package/plugins/devos/workflows/common/category-file-structure.md +41 -0
  115. package/plugins/devos/workflows/common/feature-line-format.md +10 -0
  116. package/plugins/devos/workflows/common/roadmap-file-structure.md +51 -0
  117. package/plugins/devos/workflows/common/suggest-categories.md +76 -0
  118. package/plugins/devos/workflows/common/suggest-milestones.md +92 -0
  119. package/plugins/devos/workflows/doc/doc-health.md +137 -0
  120. package/plugins/devos/workflows/doc/doc-writer.md +44 -0
  121. package/plugins/devos/workflows/doc/init-documentation.md +196 -0
  122. package/plugins/devos/workflows/doc/retro-documentation.md +304 -0
  123. package/plugins/devos/workflows/doc/templates/library.md +58 -0
  124. package/plugins/devos/workflows/doc/templates/service.md +61 -0
  125. package/plugins/devos/workflows/doc/update-documentation.md +194 -0
  126. package/plugins/devos/workflows/doc/write-documentation.md +137 -0
  127. package/plugins/devos/workflows/product/create-product-mission.md +45 -0
  128. package/plugins/devos/workflows/product/create-product-roadmap.md +106 -0
  129. package/plugins/devos/workflows/product/create-product-tech-stack.md +19 -0
  130. package/plugins/devos/workflows/product/gather-product-info.md +25 -0
  131. package/plugins/devos/workflows/product/resume-detection.md +70 -0
  132. package/plugins/devos/workflows/product/reverse-backlog.md +118 -0
  133. package/plugins/devos/workflows/product/reverse-domain-model.md +86 -0
  134. package/plugins/devos/workflows/product/reverse-product-plan.md +81 -0
  135. package/plugins/devos/workflows/product/reverse-tech-stack.md +73 -0
  136. package/plugins/devos/workflows/product/scan-deep.md +113 -0
  137. package/plugins/devos/workflows/product/scan-git.md +122 -0
  138. package/plugins/devos/workflows/product/scan-light.md +154 -0
@@ -0,0 +1,118 @@
1
+ # Workflow: Reverse Backlog (Phase 3)
2
+
3
+ **Goal:** Classify the project's existing functionality into a backlog structured by domain. Generate `backlog.md`, the category files `backlog/*.md`, and an empty `roadmap.md`. Reverse equivalent of `/devos:product` (phase 3).
4
+
5
+ **Input:** Consolidated findings, reconstructed domain model
6
+
7
+ **Output:** `devos/product/backlog.md`, `devos/product/backlog/*.md`, `devos/product/roadmap.md`
8
+
9
+ ---
10
+
11
+ ## Step 1: Identify Existing Features
12
+
13
+ From the findings:
14
+ 1. Each **service** or coherent **set of services** = a potential feature
15
+ 2. Each **group of API endpoints** = a potential feature
16
+ 3. Each **functional domain** with entities and business rules = a category
17
+
18
+ For each identified feature:
19
+ - Name (kebab-case)
20
+ - Description (1-2 lines)
21
+ - Domain/category
22
+ - Estimated size (XS/S/M/L/XL based on file count and complexity)
23
+
24
+ ---
25
+
26
+ ## Step 2: Organize by Category
27
+
28
+ Group features by functional domain (from the domain model):
29
+
30
+ | Category | Features |
31
+ |----------|----------|
32
+ | [domain-1] | feature-a, feature-b, feature-c |
33
+ | [domain-2] | feature-d, feature-e |
34
+
35
+ ---
36
+
37
+ ## Step 3: Build the Drafts
38
+
39
+ ### 3.1 Category files (`backlog/[category-id].md`)
40
+
41
+ For each category:
42
+
43
+ ```yaml
44
+ ---
45
+ category_id: [kebab-case]
46
+ name: [Domain name]
47
+ features:
48
+ - feature_id: [kebab-case]
49
+ name: [Feature name]
50
+ description: |
51
+ [Description inferred from the code]
52
+ size: [XS|S|M|L|XL]
53
+ milestone: null
54
+ spec: null
55
+ finalized: true
56
+ ---
57
+ ```
58
+
59
+ All features are marked `finalized: true` (they already exist in the code).
60
+
61
+ ### 3.2 Backlog index (`backlog.md`)
62
+
63
+ ```markdown
64
+ ## Category: [Domain name]
65
+ [category-id](backlog/category-id.md)
66
+ - [x] Feature A [M] - [category-id](backlog/category-id.md) - No spec yet
67
+ - [x] Feature B [S] - [category-id](backlog/category-id.md) - No spec yet
68
+ ```
69
+
70
+ Finalized features are checked `[x]`.
71
+
72
+ ### 3.3 Empty Roadmap (`roadmap.md`)
73
+
74
+ ```yaml
75
+ ---
76
+ milestones: []
77
+ ---
78
+ ```
79
+
80
+ ```markdown
81
+ # Product Roadmap
82
+
83
+ _Roadmap initialized by /devos:init. Edit roadmap.md directly (or re-run /devos:product) to plan upcoming features._
84
+ ```
85
+
86
+ If planning data was found via MCP, pre-fill with the detected milestones.
87
+
88
+ ---
89
+
90
+ ## Step 4: Interactive Validation
91
+
92
+ Present the draft to you:
93
+
94
+ ```
95
+ Backlog reconstructed from the code:
96
+
97
+ Categories: [N]
98
+ Features: [N] (all marked finalized)
99
+
100
+ [Summary table by category]
101
+
102
+ Does this backlog look correct?
103
+ - Validate as-is
104
+ - Rename categories or features
105
+ - Add/remove features
106
+ - Change estimated sizes
107
+ ```
108
+
109
+ **WAIT** for validation. Iterate until validated.
110
+
111
+ ---
112
+
113
+ ## Step 5: Write
114
+
115
+ 1. `mkdir -p devos/product/backlog/`
116
+ 2. `Write` each category file
117
+ 3. `Write` the `backlog.md` file
118
+ 4. `Write` the `roadmap.md` file
@@ -0,0 +1,86 @@
1
+ # Workflow: Reverse Domain Model (Phase 3)
2
+
3
+ **Goal:** Extract entities and relationships from the findings to generate `domain-model.md` in the standard DevOS format. Reverse equivalent of `/devos:init`.
4
+
5
+ **Input:** Consolidated findings (`devos/onboarding/findings/*.md`)
6
+
7
+ **Output:** `devos/product/domain-model.md`
8
+
9
+ ---
10
+
11
+ ## Step 1: Extract Entities
12
+
13
+ 1. `Read` each findings file
14
+ 2. Collect all identified business entities (not technical entities like Repository, Service, Controller)
15
+ 3. For each entity:
16
+ - Name (normalized to singular, PascalCase)
17
+ - Description inferred from the code
18
+ - Main attributes
19
+ - Domain it belongs to
20
+
21
+ ---
22
+
23
+ ## Step 2: Extract Relationships
24
+
25
+ From the findings:
26
+ 1. Import and reference relationships between entities
27
+ 2. Composition/aggregation relationships (has many, belongs to)
28
+ 3. Association relationships (links X and Y)
29
+ 4. Deduplication (same entity found in multiple domains)
30
+
31
+ ---
32
+
33
+ ## Step 3: Build the Draft
34
+
35
+ ```markdown
36
+ # Domain Model
37
+
38
+ ## Entities
39
+
40
+ ### [EntityName]
41
+ [Natural-language description of the entity and its role in the system.]
42
+
43
+ ### [AnotherEntity]
44
+ [Natural-language description.]
45
+
46
+ ## Relationships
47
+
48
+ - [Entity1] has many [Entity2]
49
+ - [Entity2] belongs to [Entity1]
50
+ - [Entity3] links [Entity1] and [Entity4]
51
+ ```
52
+
53
+ **Rules:**
54
+ - Singular names: `User`, not `Users`
55
+ - Natural language: understandable by non-technical people
56
+ - Conceptual relationships, no technical details (no FKs, no DB types)
57
+ - No YAML frontmatter
58
+
59
+ ---
60
+
61
+ ## Step 4: Interactive Validation
62
+
63
+ Present the draft to you:
64
+
65
+ ```
66
+ Domain model reconstructed from the code:
67
+
68
+ Entities: [N]
69
+ Relationships: [N]
70
+
71
+ [show the content]
72
+
73
+ Does this model look correct?
74
+ - Validate as-is
75
+ - Add missing entities
76
+ - Fix names or descriptions
77
+ - Start over
78
+ ```
79
+
80
+ **WAIT** for validation. Iterate until validated.
81
+
82
+ ---
83
+
84
+ ## Step 5: Write
85
+
86
+ `Write` the file `devos/product/domain-model.md` with the validated content.
@@ -0,0 +1,81 @@
1
+ # Workflow: Reverse Product Plan (Phase 3)
2
+
3
+ **Goal:** Consolidate the deep-scan findings to generate `mission.md` in the standard DevOS format. Reverse equivalent of `/devos:product` (phases 1-2).
4
+
5
+ **Input:** Consolidated findings (`devos/onboarding/findings/*.md`), MCP data (optional)
6
+
7
+ **Output:** `devos/product/mission.md`
8
+
9
+ ---
10
+
11
+ ## Step 1: Read the Findings
12
+
13
+ 1. `Glob devos/onboarding/findings/*.md`
14
+ 2. `Read` each findings file
15
+ 3. Extract from each findings file:
16
+ - Identified business entities → indicators of users and domain
17
+ - Services and their responsibilities → indicators of features
18
+ - Architectural patterns → indicators of technical choices
19
+ - APIs and interactions → indicators of functional scope
20
+
21
+ ---
22
+
23
+ ## Step 2: Reconstruct the Mission
24
+
25
+ From the consolidated findings, produce a `mission.md` draft in the standard format:
26
+
27
+ ```markdown
28
+ # Product Mission
29
+
30
+ ## Pitch
31
+ [Product] is a [application type] that [description of the main purpose inferred from the code].
32
+
33
+ ## Users
34
+
35
+ ### Primary Customers
36
+ [Inferred from user entities, roles, and permissions found in the code]
37
+
38
+ ## The Problem
39
+ [Inferred from the business domain, business rules, identified services]
40
+
41
+ ## Differentiators
42
+ [Inferred from architectural patterns, technical choices, unique features]
43
+
44
+ ## Key Features
45
+
46
+ ### Core Features
47
+ [Inferred from main services, endpoints, key features]
48
+
49
+ ### Advanced Features
50
+ [Inferred from secondary features]
51
+ ```
52
+
53
+ **Writing rules:**
54
+ - Base it on **facts observed in the code** (no invention)
55
+ - Use a factual tone: "The system manages..." rather than "The system could manage..."
56
+ - Flag uncertainties: "[To confirm]" when the analysis is ambiguous
57
+
58
+ ---
59
+
60
+ ## Step 3: Interactive Validation
61
+
62
+ Present the draft to you:
63
+
64
+ ```
65
+ Product mission reconstructed from the code:
66
+
67
+ [show the draft content]
68
+
69
+ Does this reconstruction look correct?
70
+ - Validate as-is
71
+ - Modify (specify the corrections)
72
+ - Start over (give guidance)
73
+ ```
74
+
75
+ **WAIT** for validation. Apply corrections if requested. Iterate until validated.
76
+
77
+ ---
78
+
79
+ ## Step 4: Write
80
+
81
+ `Write` the file `devos/product/mission.md` with the validated content.
@@ -0,0 +1,73 @@
1
+ # Workflow: Reverse Tech Stack (Phase 3)
2
+
3
+ **Goal:** Consolidate tech stack detection to generate `tech-stack.md` in the standard DevOS format. Reverse equivalent of `/devos:product` (phase 4).
4
+
5
+ **Input:** Tech stack detection (Phase 1), consolidated findings
6
+
7
+ **Output:** `devos/product/tech-stack.md`
8
+
9
+ ---
10
+
11
+ ## Step 1: Consolidation
12
+
13
+ From the light scan (Phase 1) and findings (Phase 2):
14
+ 1. Detected languages with versions
15
+ 2. Frameworks with versions
16
+ 3. Build tools
17
+ 4. Test frameworks
18
+ 5. Databases
19
+ 6. Infrastructure (Docker, CI, etc.)
20
+ 7. Main libraries
21
+
22
+ ---
23
+
24
+ ## Step 2: Build the Draft
25
+
26
+ ```markdown
27
+ # Tech Stack
28
+
29
+ ## Overview
30
+ [General description of the project and its main technologies]
31
+
32
+ ## Core Technologies
33
+
34
+ ### [Language/Framework]
35
+ - **Version:** [version]
36
+ - **Purpose:** [usage in the project]
37
+ - **Key Libraries:** [main libs]
38
+
39
+ ### [Database]
40
+ - **Type:** [SQL/NoSQL/...]
41
+ - **ORM:** [if applicable]
42
+
43
+ ## Testing Framework
44
+ - **Unit:** [framework]
45
+ - **Integration:** [framework]
46
+ - **E2E:** [framework]
47
+
48
+ ## Development Environment
49
+
50
+ ### Runtime Requirements
51
+ | Requirement | Version | Notes |
52
+ |-------------|---------|-------|
53
+ | [tech] | [version] | [notes] |
54
+
55
+ ### Build & Deploy
56
+ - **Build:** [tool]
57
+ - **CI/CD:** [tool]
58
+ - **Container:** [Docker/etc.]
59
+ ```
60
+
61
+ ---
62
+
63
+ ## Step 3: Interactive Validation
64
+
65
+ Present the draft to you for validation. You can correct versions, add missing technologies, or clarify usages.
66
+
67
+ **WAIT** for validation.
68
+
69
+ ---
70
+
71
+ ## Step 4: Write
72
+
73
+ `Write` the file `devos/product/tech-stack.md` with the validated content.
@@ -0,0 +1,113 @@
1
+ # Workflow: Deep Scan (Phase 2: Agent)
2
+
3
+ **Goal:** Deep-analyze a specific domain/layer of the project. Extract architectural patterns, business entities, business rules, and test-derived information. A read-only scan prompt.
4
+
5
+ **Role:** read-only domain scanner
6
+
7
+ **Input:** Scope (paths), Git hotspots, doc-confrontation option
8
+
9
+ **Output:** Findings file in `devos/onboarding/findings/`
10
+
11
+ ---
12
+
13
+ ## Step 1: Map the scope
14
+
15
+ 1. `Glob` to list all source files in the assigned paths
16
+ 2. Classify by type:
17
+
18
+ | Type | Extensions |
19
+ |------|-----------|
20
+ | Source | `.ts`, `.tsx`, `.js`, `.jsx`, `.py`, `.go`, `.java`, `.kt`, `.swift`, `.rb`, `.rs`, `.php` |
21
+ | Test | `*.test.*`, `*.spec.*`, `*_test.*`, `test_*.*`, `*Test.*` |
22
+ | Config | `*.config.*`, `*.json`, `*.yml`, `*.yaml`, `*.toml` |
23
+ | Types | `*.d.ts`, `*.types.*`, `**/types/`, `**/interfaces/` |
24
+
25
+ 3. Prioritize Git hotspot files (if provided)
26
+
27
+ ---
28
+
29
+ ## Step 2: Detect architectural patterns
30
+
31
+ `Grep` and `Read` to detect patterns:
32
+
33
+ | Pattern | Clues |
34
+ |---------|-------|
35
+ | **MVC** | `controllers/`, `models/`, `views/` folders |
36
+ | **Clean Architecture** | `use-cases/`, `repositories/`, `entities/`, `adapters/` |
37
+ | **Hexagonal** | `ports/`, `adapters/`, `domain/` |
38
+ | **CQRS** | `commands/`, `queries/`, `handlers/` |
39
+ | **Event-driven** | `events/`, `listeners/`, `subscribers/`, `sagas/` |
40
+ | **Layered** | `api/`, `service/`, `dao/`, `repository/` |
41
+
42
+ Analyze folder structure, naming conventions, and imports.
43
+
44
+ ---
45
+
46
+ ## Step 3: Extract business entities
47
+
48
+ 1. `Grep` for class/interface/type definitions:
49
+ - TypeScript/JS: `class`, `interface`, `type`, `enum`
50
+ - Python: `class`, `dataclass`, `TypedDict`
51
+ - Java/Kotlin: `class`, `interface`, `enum`, `record`
52
+ - Go: `type ... struct`
53
+ 2. For each entity found, `Read` the file and extract:
54
+ - Name and description (comments, docstrings)
55
+ - Attributes/fields
56
+ - Relations (imports, references to other entities)
57
+ 3. Distinguish business entities (User, Order, Invoice) from technical ones (Repository, Service, Controller)
58
+
59
+ ---
60
+
61
+ ## Step 4: Business rules
62
+
63
+ ### 4.1 From source code
64
+
65
+ `Grep` for business-rule patterns:
66
+ - Validations: `validate`, `check`, `assert`, `require`, `guard`
67
+ - Business conditions: `if`, `switch` in services/use cases
68
+ - Constraints: min/max, formats, permissions
69
+
70
+ ### 4.2 From tests
71
+
72
+ `Grep` for test descriptions:
73
+ - `describe(`, `it(`, `test(`, `@Test`, `def test_`
74
+ - `Read` test files to extract:
75
+ - Expected behaviors (assertions)
76
+ - Tested edge cases
77
+ - Fixtures and test data (reveal entities and their states)
78
+
79
+ ---
80
+
81
+ ## Step 5: Services and interactions
82
+
83
+ 1. Identify services/controllers and their responsibilities
84
+ 2. Detect APIs:
85
+ - HTTP routes: `@Get`, `@Post`, `app.get`, `router.`
86
+ - GraphQL: `@Query`, `@Mutation`, `@Resolver`
87
+ - Events: `emit`, `publish`, `dispatch`, `on(`
88
+ 3. Map inter-component dependencies via imports
89
+
90
+ ---
91
+
92
+ ## Step 6: Doc vs code confrontation (conditional)
93
+
94
+ **Run only if CONFRONT_DOC=true.**
95
+
96
+ 1. `Read` the provided documentation (DOC_PATH)
97
+ 2. For each documented element:
98
+ - Find the corresponding implementation in the code
99
+ - Mark: Confirmed / Obsolete / Undocumented
100
+ 3. For each undocumented code element:
101
+ - Add to the "Undocumented" section
102
+
103
+ ---
104
+
105
+ ## Step 7: Produce the findings file
106
+
107
+ Write the file in the format defined below:
108
+ - `devos/onboarding/findings/domain-[DOMAIN].md`
109
+
110
+ The file must be:
111
+ - Structured and parseable (headings, tables)
112
+ - Concise (respect size limits)
113
+ - Usable by Phase 3 reverse workflows
@@ -0,0 +1,122 @@
1
+ # Workflow: Git Scan (Phase 1)
2
+
3
+ **Goal:** Analyze the project's Git history to identify hot zones, contributors per area, and evolution patterns. Runs alongside the structural scan.
4
+
5
+ **Role:** Git scan
6
+
7
+ **Input:** Project Git repository
8
+
9
+ **Output:** Structured Git report (hot zones, contributors, evolution)
10
+
11
+ ---
12
+
13
+ ## Step 1: Git check
14
+
15
+ ```bash
16
+ git rev-parse --is-inside-work-tree 2>/dev/null && echo "GIT_OK" || echo "NO_GIT"
17
+ ```
18
+
19
+ If no Git repo: return an empty report with a "No Git repository detected" note.
20
+
21
+ ---
22
+
23
+ ## Step 2: Hot zones (most modified files)
24
+
25
+ ### 2.1 Top modified files (last 6 months)
26
+
27
+ ```bash
28
+ git log --since="6 months ago" --pretty=format: --name-only | sort | uniq -c | sort -rn | head -50
29
+ ```
30
+
31
+ ### 2.2 Top modified files (all history)
32
+
33
+ ```bash
34
+ git log --pretty=format: --name-only | sort | uniq -c | sort -rn | head -30
35
+ ```
36
+
37
+ ### 2.3 Files with the most contributors
38
+
39
+ ```bash
40
+ git log --pretty=format:"%an" --name-only | awk '/^$/{next} /^[^[:space:]]/{author=$0; next} {print $0 "|" author}' | sort -u | awk -F'|' '{files[$1]++} END {for (f in files) print files[f], f}' | sort -rn | head -30
41
+ ```
42
+
43
+ ---
44
+
45
+ ## Step 3: Contributors per area
46
+
47
+ ### 3.1 Contributors per top-level folder
48
+
49
+ ```bash
50
+ for dir in $(find . -maxdepth 2 -type d -not -path './.git*' -not -path './node_modules*' | head -20); do
51
+ echo "=== $dir ==="
52
+ git log --pretty=format:"%an" -- "$dir" | sort | uniq -c | sort -rn | head -5
53
+ done
54
+ ```
55
+
56
+ ### 3.2 Commits per contributor
57
+
58
+ ```bash
59
+ git shortlog -sn --no-merges | head -15
60
+ ```
61
+
62
+ ---
63
+
64
+ ## Step 4: Evolution patterns
65
+
66
+ ### 4.1 Activity per month (last 12 months)
67
+
68
+ ```bash
69
+ git log --since="12 months ago" --pretty=format:"%ad" --date=format:"%Y-%m" | sort | uniq -c
70
+ ```
71
+
72
+ ### 4.2 Recently active folders
73
+
74
+ ```bash
75
+ git log --since="3 months ago" --pretty=format: --name-only | sed 's|/[^/]*$||' | sort | uniq -c | sort -rn | head -20
76
+ ```
77
+
78
+ ### 4.3 Stable folders (few recent changes)
79
+
80
+ Compare recent activity (3 months) vs total history to identify stable areas.
81
+
82
+ ---
83
+
84
+ ## Step 5: Output
85
+
86
+ Produce a structured report:
87
+
88
+ ```markdown
89
+ # Git Analysis
90
+
91
+ > Repository: [name] | Commits: [N] | Contributors: [N] | Period: [first-commit] to [last-commit]
92
+
93
+ ## Hot zones (last 6 months)
94
+
95
+ | # | File | Commits | Contributors |
96
+ |---|------|---------|--------------|
97
+ | 1 | [path] | [N] | [N] |
98
+
99
+ ## Contributors per area
100
+
101
+ | Area | Main contributor | Others | Total commits |
102
+ |------|-----------------|--------|---------------|
103
+ | [dir] | [name] ([N]) | [name] ([N]) | [N] |
104
+
105
+ ## Evolution
106
+
107
+ | Month | Commits |
108
+ |-------|---------|
109
+ | [YYYY-MM] | [N] |
110
+
111
+ ## Stable areas (little recent activity)
112
+
113
+ | Area | Last modified | Total historical commits |
114
+ |------|---------------|--------------------------|
115
+ | [dir] | [date] | [N] |
116
+
117
+ ## Prioritization recommendations
118
+
119
+ These areas deserve deep analysis first:
120
+ 1. [area]: [N] recent commits, [N] contributors (very active)
121
+ 2. [area]: [N] recent commits (evolving)
122
+ ```