raise-cli 2.2.1__py3-none-any.whl

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 (264) hide show
  1. raise_cli/__init__.py +38 -0
  2. raise_cli/__main__.py +30 -0
  3. raise_cli/adapters/__init__.py +91 -0
  4. raise_cli/adapters/declarative/__init__.py +26 -0
  5. raise_cli/adapters/declarative/adapter.py +267 -0
  6. raise_cli/adapters/declarative/discovery.py +94 -0
  7. raise_cli/adapters/declarative/expressions.py +150 -0
  8. raise_cli/adapters/declarative/reference/__init__.py +1 -0
  9. raise_cli/adapters/declarative/reference/github.yaml +143 -0
  10. raise_cli/adapters/declarative/schema.py +98 -0
  11. raise_cli/adapters/filesystem.py +299 -0
  12. raise_cli/adapters/mcp_bridge.py +10 -0
  13. raise_cli/adapters/mcp_confluence.py +246 -0
  14. raise_cli/adapters/mcp_jira.py +405 -0
  15. raise_cli/adapters/models.py +205 -0
  16. raise_cli/adapters/protocols.py +180 -0
  17. raise_cli/adapters/registry.py +90 -0
  18. raise_cli/adapters/sync.py +149 -0
  19. raise_cli/agents/__init__.py +14 -0
  20. raise_cli/agents/antigravity.yaml +8 -0
  21. raise_cli/agents/claude.yaml +8 -0
  22. raise_cli/agents/copilot.yaml +8 -0
  23. raise_cli/agents/copilot_plugin.py +124 -0
  24. raise_cli/agents/cursor.yaml +7 -0
  25. raise_cli/agents/roo.yaml +8 -0
  26. raise_cli/agents/windsurf.yaml +8 -0
  27. raise_cli/artifacts/__init__.py +30 -0
  28. raise_cli/artifacts/models.py +43 -0
  29. raise_cli/artifacts/reader.py +55 -0
  30. raise_cli/artifacts/renderer.py +104 -0
  31. raise_cli/artifacts/story_design.py +69 -0
  32. raise_cli/artifacts/writer.py +45 -0
  33. raise_cli/backlog/__init__.py +1 -0
  34. raise_cli/backlog/sync.py +115 -0
  35. raise_cli/cli/__init__.py +3 -0
  36. raise_cli/cli/commands/__init__.py +3 -0
  37. raise_cli/cli/commands/_resolve.py +153 -0
  38. raise_cli/cli/commands/adapters.py +362 -0
  39. raise_cli/cli/commands/artifact.py +137 -0
  40. raise_cli/cli/commands/backlog.py +333 -0
  41. raise_cli/cli/commands/base.py +31 -0
  42. raise_cli/cli/commands/discover.py +551 -0
  43. raise_cli/cli/commands/docs.py +130 -0
  44. raise_cli/cli/commands/doctor.py +177 -0
  45. raise_cli/cli/commands/gate.py +223 -0
  46. raise_cli/cli/commands/graph.py +1086 -0
  47. raise_cli/cli/commands/info.py +81 -0
  48. raise_cli/cli/commands/init.py +746 -0
  49. raise_cli/cli/commands/journal.py +167 -0
  50. raise_cli/cli/commands/mcp.py +524 -0
  51. raise_cli/cli/commands/memory.py +467 -0
  52. raise_cli/cli/commands/pattern.py +348 -0
  53. raise_cli/cli/commands/profile.py +59 -0
  54. raise_cli/cli/commands/publish.py +80 -0
  55. raise_cli/cli/commands/release.py +338 -0
  56. raise_cli/cli/commands/session.py +528 -0
  57. raise_cli/cli/commands/signal.py +410 -0
  58. raise_cli/cli/commands/skill.py +350 -0
  59. raise_cli/cli/commands/skill_set.py +145 -0
  60. raise_cli/cli/error_handler.py +158 -0
  61. raise_cli/cli/main.py +163 -0
  62. raise_cli/compat.py +66 -0
  63. raise_cli/config/__init__.py +41 -0
  64. raise_cli/config/agent_plugin.py +105 -0
  65. raise_cli/config/agent_registry.py +233 -0
  66. raise_cli/config/agents.py +120 -0
  67. raise_cli/config/ide.py +32 -0
  68. raise_cli/config/paths.py +379 -0
  69. raise_cli/config/settings.py +180 -0
  70. raise_cli/context/__init__.py +42 -0
  71. raise_cli/context/analyzers/__init__.py +16 -0
  72. raise_cli/context/analyzers/models.py +36 -0
  73. raise_cli/context/analyzers/protocol.py +43 -0
  74. raise_cli/context/analyzers/python.py +292 -0
  75. raise_cli/context/builder.py +1569 -0
  76. raise_cli/context/diff.py +213 -0
  77. raise_cli/context/extractors/__init__.py +13 -0
  78. raise_cli/context/extractors/skills.py +121 -0
  79. raise_cli/core/__init__.py +37 -0
  80. raise_cli/core/files.py +66 -0
  81. raise_cli/core/text.py +174 -0
  82. raise_cli/core/tools.py +441 -0
  83. raise_cli/discovery/__init__.py +50 -0
  84. raise_cli/discovery/analyzer.py +691 -0
  85. raise_cli/discovery/drift.py +355 -0
  86. raise_cli/discovery/scanner.py +1687 -0
  87. raise_cli/doctor/__init__.py +4 -0
  88. raise_cli/doctor/checks/__init__.py +1 -0
  89. raise_cli/doctor/checks/environment.py +110 -0
  90. raise_cli/doctor/checks/project.py +238 -0
  91. raise_cli/doctor/fix.py +80 -0
  92. raise_cli/doctor/models.py +56 -0
  93. raise_cli/doctor/protocol.py +43 -0
  94. raise_cli/doctor/registry.py +100 -0
  95. raise_cli/doctor/report.py +141 -0
  96. raise_cli/doctor/runner.py +95 -0
  97. raise_cli/engines/__init__.py +3 -0
  98. raise_cli/exceptions.py +215 -0
  99. raise_cli/gates/__init__.py +19 -0
  100. raise_cli/gates/builtin/__init__.py +1 -0
  101. raise_cli/gates/builtin/coverage.py +52 -0
  102. raise_cli/gates/builtin/lint.py +48 -0
  103. raise_cli/gates/builtin/tests.py +48 -0
  104. raise_cli/gates/builtin/types.py +48 -0
  105. raise_cli/gates/models.py +40 -0
  106. raise_cli/gates/protocol.py +41 -0
  107. raise_cli/gates/registry.py +141 -0
  108. raise_cli/governance/__init__.py +11 -0
  109. raise_cli/governance/extractor.py +412 -0
  110. raise_cli/governance/models.py +134 -0
  111. raise_cli/governance/parsers/__init__.py +35 -0
  112. raise_cli/governance/parsers/_convert.py +38 -0
  113. raise_cli/governance/parsers/adr.py +274 -0
  114. raise_cli/governance/parsers/backlog.py +356 -0
  115. raise_cli/governance/parsers/constitution.py +119 -0
  116. raise_cli/governance/parsers/epic.py +323 -0
  117. raise_cli/governance/parsers/glossary.py +316 -0
  118. raise_cli/governance/parsers/guardrails.py +345 -0
  119. raise_cli/governance/parsers/prd.py +112 -0
  120. raise_cli/governance/parsers/roadmap.py +118 -0
  121. raise_cli/governance/parsers/vision.py +116 -0
  122. raise_cli/graph/__init__.py +1 -0
  123. raise_cli/graph/backends/__init__.py +57 -0
  124. raise_cli/graph/backends/api.py +137 -0
  125. raise_cli/graph/backends/dual.py +139 -0
  126. raise_cli/graph/backends/pending.py +84 -0
  127. raise_cli/handlers/__init__.py +3 -0
  128. raise_cli/hooks/__init__.py +54 -0
  129. raise_cli/hooks/builtin/__init__.py +1 -0
  130. raise_cli/hooks/builtin/backlog.py +216 -0
  131. raise_cli/hooks/builtin/gate_bridge.py +83 -0
  132. raise_cli/hooks/builtin/jira_sync.py +127 -0
  133. raise_cli/hooks/builtin/memory.py +117 -0
  134. raise_cli/hooks/builtin/telemetry.py +72 -0
  135. raise_cli/hooks/emitter.py +184 -0
  136. raise_cli/hooks/events.py +262 -0
  137. raise_cli/hooks/protocol.py +38 -0
  138. raise_cli/hooks/registry.py +117 -0
  139. raise_cli/mcp/__init__.py +33 -0
  140. raise_cli/mcp/bridge.py +218 -0
  141. raise_cli/mcp/models.py +43 -0
  142. raise_cli/mcp/registry.py +77 -0
  143. raise_cli/mcp/schema.py +41 -0
  144. raise_cli/memory/__init__.py +58 -0
  145. raise_cli/memory/loader.py +247 -0
  146. raise_cli/memory/migration.py +241 -0
  147. raise_cli/memory/models.py +169 -0
  148. raise_cli/memory/writer.py +598 -0
  149. raise_cli/onboarding/__init__.py +103 -0
  150. raise_cli/onboarding/bootstrap.py +324 -0
  151. raise_cli/onboarding/claudemd.py +17 -0
  152. raise_cli/onboarding/conventions.py +742 -0
  153. raise_cli/onboarding/detection.py +374 -0
  154. raise_cli/onboarding/governance.py +443 -0
  155. raise_cli/onboarding/instructions.py +672 -0
  156. raise_cli/onboarding/manifest.py +201 -0
  157. raise_cli/onboarding/memory_md.py +399 -0
  158. raise_cli/onboarding/migration.py +207 -0
  159. raise_cli/onboarding/profile.py +624 -0
  160. raise_cli/onboarding/skill_conflict.py +100 -0
  161. raise_cli/onboarding/skill_manifest.py +176 -0
  162. raise_cli/onboarding/skills.py +437 -0
  163. raise_cli/onboarding/workflows.py +101 -0
  164. raise_cli/output/__init__.py +28 -0
  165. raise_cli/output/console.py +394 -0
  166. raise_cli/output/formatters/__init__.py +9 -0
  167. raise_cli/output/formatters/adapters.py +135 -0
  168. raise_cli/output/formatters/discover.py +439 -0
  169. raise_cli/output/formatters/skill.py +298 -0
  170. raise_cli/publish/__init__.py +3 -0
  171. raise_cli/publish/changelog.py +80 -0
  172. raise_cli/publish/check.py +179 -0
  173. raise_cli/publish/version.py +172 -0
  174. raise_cli/rai_base/__init__.py +22 -0
  175. raise_cli/rai_base/framework/__init__.py +7 -0
  176. raise_cli/rai_base/framework/methodology.yaml +233 -0
  177. raise_cli/rai_base/governance/__init__.py +1 -0
  178. raise_cli/rai_base/governance/architecture/__init__.py +1 -0
  179. raise_cli/rai_base/governance/architecture/domain-model.md +20 -0
  180. raise_cli/rai_base/governance/architecture/system-context.md +34 -0
  181. raise_cli/rai_base/governance/architecture/system-design.md +24 -0
  182. raise_cli/rai_base/governance/backlog.md +8 -0
  183. raise_cli/rai_base/governance/guardrails.md +17 -0
  184. raise_cli/rai_base/governance/prd.md +25 -0
  185. raise_cli/rai_base/governance/vision.md +16 -0
  186. raise_cli/rai_base/identity/__init__.py +8 -0
  187. raise_cli/rai_base/identity/core.md +119 -0
  188. raise_cli/rai_base/identity/perspective.md +119 -0
  189. raise_cli/rai_base/memory/__init__.py +7 -0
  190. raise_cli/rai_base/memory/patterns-base.jsonl +55 -0
  191. raise_cli/schemas/__init__.py +3 -0
  192. raise_cli/schemas/journal.py +49 -0
  193. raise_cli/schemas/session_state.py +117 -0
  194. raise_cli/session/__init__.py +5 -0
  195. raise_cli/session/bundle.py +820 -0
  196. raise_cli/session/close.py +268 -0
  197. raise_cli/session/journal.py +119 -0
  198. raise_cli/session/resolver.py +126 -0
  199. raise_cli/session/state.py +187 -0
  200. raise_cli/skills/__init__.py +44 -0
  201. raise_cli/skills/locator.py +141 -0
  202. raise_cli/skills/name_checker.py +199 -0
  203. raise_cli/skills/parser.py +145 -0
  204. raise_cli/skills/scaffold.py +212 -0
  205. raise_cli/skills/schema.py +132 -0
  206. raise_cli/skills/skillsets.py +195 -0
  207. raise_cli/skills/validator.py +197 -0
  208. raise_cli/skills_base/__init__.py +80 -0
  209. raise_cli/skills_base/contract-template.md +60 -0
  210. raise_cli/skills_base/preamble.md +37 -0
  211. raise_cli/skills_base/rai-architecture-review/SKILL.md +137 -0
  212. raise_cli/skills_base/rai-debug/SKILL.md +171 -0
  213. raise_cli/skills_base/rai-discover/SKILL.md +167 -0
  214. raise_cli/skills_base/rai-discover-document/SKILL.md +128 -0
  215. raise_cli/skills_base/rai-discover-scan/SKILL.md +147 -0
  216. raise_cli/skills_base/rai-discover-start/SKILL.md +145 -0
  217. raise_cli/skills_base/rai-discover-validate/SKILL.md +142 -0
  218. raise_cli/skills_base/rai-docs-update/SKILL.md +142 -0
  219. raise_cli/skills_base/rai-doctor/SKILL.md +120 -0
  220. raise_cli/skills_base/rai-epic-close/SKILL.md +165 -0
  221. raise_cli/skills_base/rai-epic-close/templates/retrospective.md +68 -0
  222. raise_cli/skills_base/rai-epic-design/SKILL.md +146 -0
  223. raise_cli/skills_base/rai-epic-design/templates/design.md +24 -0
  224. raise_cli/skills_base/rai-epic-design/templates/scope.md +76 -0
  225. raise_cli/skills_base/rai-epic-plan/SKILL.md +153 -0
  226. raise_cli/skills_base/rai-epic-plan/_references/sequencing-strategies.md +67 -0
  227. raise_cli/skills_base/rai-epic-plan/templates/plan-section.md +49 -0
  228. raise_cli/skills_base/rai-epic-run/SKILL.md +208 -0
  229. raise_cli/skills_base/rai-epic-start/SKILL.md +136 -0
  230. raise_cli/skills_base/rai-epic-start/templates/brief.md +34 -0
  231. raise_cli/skills_base/rai-mcp-add/SKILL.md +176 -0
  232. raise_cli/skills_base/rai-mcp-remove/SKILL.md +120 -0
  233. raise_cli/skills_base/rai-mcp-status/SKILL.md +147 -0
  234. raise_cli/skills_base/rai-problem-shape/SKILL.md +138 -0
  235. raise_cli/skills_base/rai-project-create/SKILL.md +144 -0
  236. raise_cli/skills_base/rai-project-onboard/SKILL.md +162 -0
  237. raise_cli/skills_base/rai-quality-review/SKILL.md +189 -0
  238. raise_cli/skills_base/rai-research/SKILL.md +143 -0
  239. raise_cli/skills_base/rai-research/references/research-prompt-template.md +317 -0
  240. raise_cli/skills_base/rai-session-close/SKILL.md +176 -0
  241. raise_cli/skills_base/rai-session-start/SKILL.md +110 -0
  242. raise_cli/skills_base/rai-story-close/SKILL.md +198 -0
  243. raise_cli/skills_base/rai-story-design/SKILL.md +203 -0
  244. raise_cli/skills_base/rai-story-design/references/tech-design-story-v2.md +293 -0
  245. raise_cli/skills_base/rai-story-implement/SKILL.md +115 -0
  246. raise_cli/skills_base/rai-story-plan/SKILL.md +135 -0
  247. raise_cli/skills_base/rai-story-review/SKILL.md +178 -0
  248. raise_cli/skills_base/rai-story-run/SKILL.md +282 -0
  249. raise_cli/skills_base/rai-story-start/SKILL.md +166 -0
  250. raise_cli/skills_base/rai-story-start/templates/story.md +38 -0
  251. raise_cli/skills_base/rai-welcome/SKILL.md +134 -0
  252. raise_cli/telemetry/__init__.py +42 -0
  253. raise_cli/telemetry/schemas.py +285 -0
  254. raise_cli/telemetry/writer.py +217 -0
  255. raise_cli/tier/__init__.py +0 -0
  256. raise_cli/tier/context.py +134 -0
  257. raise_cli/viz/__init__.py +7 -0
  258. raise_cli/viz/generator.py +406 -0
  259. raise_cli-2.2.1.dist-info/METADATA +433 -0
  260. raise_cli-2.2.1.dist-info/RECORD +264 -0
  261. raise_cli-2.2.1.dist-info/WHEEL +4 -0
  262. raise_cli-2.2.1.dist-info/entry_points.txt +40 -0
  263. raise_cli-2.2.1.dist-info/licenses/LICENSE +190 -0
  264. raise_cli-2.2.1.dist-info/licenses/NOTICE +4 -0
@@ -0,0 +1,167 @@
1
+ ---
2
+ name: rai-discover
3
+ description: >
4
+ Run the full codebase discovery pipeline: detect languages, extract symbols,
5
+ describe components, generate architecture docs, and build the knowledge graph.
6
+
7
+ license: MIT
8
+
9
+ metadata:
10
+ raise.work_cycle: discovery
11
+ raise.frequency: per-project
12
+ raise.fase: ""
13
+ raise.prerequisites: "rai init --detect"
14
+ raise.next: "session-start"
15
+ raise.gate: ""
16
+ raise.adaptable: "true"
17
+ raise.version: "1.0.0"
18
+ raise.visibility: public
19
+ raise.inputs: |
20
+ - project_root: path, required, argument
21
+ - language: string, optional, argument (auto-detected if omitted)
22
+ raise.outputs: |
23
+ - context_yaml: file_path (work/discovery/context.yaml)
24
+ - components_validated: file_path (work/discovery/components-validated.json)
25
+ - module_docs: file_path[] (governance/architecture/modules/*.md)
26
+ - system_docs: file_path[] (governance/architecture/*.md)
27
+ - graph: side_effect (rai graph build)
28
+ ---
29
+
30
+ # Discover
31
+
32
+ ## Purpose
33
+
34
+ Run the full discovery pipeline in one pass: detect languages, extract and describe components, generate architecture docs, and build the knowledge graph.
35
+
36
+ ## Mastery Levels (ShuHaRi)
37
+
38
+ - **Shu**: Show each phase, explain results, pause after describe + document
39
+ - **Ha**: Auto-run detect + extract, pause at describe, auto-document if <10 modules
40
+ - **Ri**: Full pipeline with inline approve, minimal pauses
41
+
42
+ ## Context
43
+
44
+ **When to use:** After `rai init --detect` on an existing codebase, or when architecture changes significantly.
45
+
46
+ **When to skip:** Graph is current and no structural changes since last discovery.
47
+
48
+ **Inputs:** Project root with source code. Optionally specify language to limit scan.
49
+
50
+ | Condition | Action |
51
+ |-----------|--------|
52
+ | `rai init --detect` done | Continue |
53
+ | No `.raise/manifest.yaml` | Stop: run `rai init --detect` first |
54
+ | Only updating docs | Use `/rai-docs-update` instead |
55
+
56
+ ## Steps
57
+
58
+ ### Step 1: Detect (auto)
59
+
60
+ ```bash
61
+ rai discover scan . --output summary
62
+ ```
63
+
64
+ From summary, extract languages, source directories, entry points. Write `work/discovery/context.yaml` with project name (from `pyproject.toml` → `package.json` → directory), languages, root_dirs, entry_points, detected_at.
65
+
66
+ <verification>
67
+ `work/discovery/context.yaml` created.
68
+ </verification>
69
+
70
+ ### Step 2: Extract (auto)
71
+
72
+ For each detected language and root directory:
73
+
74
+ ```bash
75
+ rai discover scan {root_dir} --language {language} --output json | rai discover analyze --output human
76
+ ```
77
+
78
+ Produces `work/discovery/analysis.json` with confidence scores, auto-categorization, and module grouping.
79
+
80
+ <verification>
81
+ `work/discovery/analysis.json` exists.
82
+ </verification>
83
+
84
+ ### Step 3: Describe (HITL)
85
+
86
+ Handle components by confidence tier:
87
+
88
+ | Confidence | Action |
89
+ |-----------|--------|
90
+ | High (≥70) | Accept `auto_purpose` and `auto_category` silently — no human review |
91
+ | Medium (40-69) | Present by module batch with LLM-suggested descriptions |
92
+ | Low (<40) | Scale gate first, then review |
93
+
94
+ **Medium flow:** Present table per module (name, kind, category, suggested purpose, score). Ask: "Approve batch? [Approve all / Edit specific]"
95
+
96
+ **Low scale gate (all low AND >50):** Offer modes: A) by layer/namespace, B) user nominates key components + bulk-skip, C) auto-accept by naming pattern (`*Handler`, `*Repository`). Otherwise review individually.
97
+
98
+ Write `components-draft.yaml` and export to `components-validated.json` (graph node format).
99
+
100
+ <verification>
101
+ All components described. `components-validated.json` created.
102
+ </verification>
103
+
104
+ <if-blocked>
105
+ No symbols extracted → verify language is supported and path is correct.
106
+ </if-blocked>
107
+
108
+ ### Step 4: Document (HITL)
109
+
110
+ **Module docs:** For each module, write `governance/architecture/modules/{name}.md` with YAML frontmatter (type, name, purpose, status, depends_on, depended_by, components) and body (Purpose, Architecture, Key Files, Dependencies, Conventions). Detect modules by language: Python (`__init__.py`), C# (`.csproj` + namespaces), PHP (`composer.json` PSR-4).
111
+
112
+ **System docs:** Generate 4 docs from governance + discovery data:
113
+ - `system-context.md` — what, who, why, external systems (from `vision.md`)
114
+ - `system-design.md` — layers, data flows, constraints (from `guardrails.md` + module deps)
115
+ - `domain-model.md` — bounded contexts, context map (from module deps + components)
116
+ - `index.md` — compact overview <2K tokens (system overview, module map, key constraints)
117
+
118
+ Present for review.
119
+
120
+ <verification>
121
+ Module docs + system docs generated. Prose explains WHY, not just WHAT.
122
+ </verification>
123
+
124
+ ### Step 5: Build (auto)
125
+
126
+ ```bash
127
+ rai graph build
128
+ rai graph query "module dependencies"
129
+ ```
130
+
131
+ Verify module nodes in graph, no stale references. Present summary: project, components by tier, modules, graph node/edge counts.
132
+
133
+ <verification>
134
+ Graph built. Module nodes present.
135
+ </verification>
136
+
137
+ ## Output
138
+
139
+ | Item | Destination |
140
+ |------|-------------|
141
+ | Context file | `work/discovery/context.yaml` |
142
+ | Component catalog | `work/discovery/components-validated.json` |
143
+ | Module docs | `governance/architecture/modules/*.md` |
144
+ | System docs | `governance/architecture/*.md` |
145
+ | Knowledge graph | `.raise/rai/memory/index.json` |
146
+ | Next | `/rai-session-start` or `/rai-project-onboard` |
147
+
148
+ ## Quality Checklist
149
+
150
+ - [ ] All supported languages detected (not just primary)
151
+ - [ ] High-confidence components auto-accepted (no unnecessary HITL)
152
+ - [ ] Medium-confidence presented by module batch (not per-component)
153
+ - [ ] Scale gate applied for all-low large codebases (>50 components)
154
+ - [ ] Module frontmatter includes all required fields
155
+ - [ ] Module prose explains WHY, not just WHAT (new contributor test)
156
+ - [ ] Index under 2K tokens for session-loadable context
157
+ - [ ] Graph built and verified as final step
158
+ - [ ] NEVER include generated/build directories in root_dirs
159
+ - [ ] NEVER generate placeholder docs for modules with no real code
160
+
161
+ ## References
162
+
163
+ - CLI: `rai discover scan --help`, `rai discover analyze --help`
164
+ - Graph: `rai graph build`, `rai graph query`
165
+ - Categories: service, model, utility, handler, parser, builder, schema, command, test
166
+ - Confidence tiers: high ≥70, medium 40-69, low <40
167
+ - Replaces: `/rai-discover-start`, `/rai-discover-scan`, `/rai-discover-validate`, `/rai-discover-document`
@@ -0,0 +1,128 @@
1
+ ---
2
+ name: rai-discover-document
3
+ description: >
4
+ Generate architecture documentation from discovery data. Produces
5
+ system-level docs (C4 Context + Container), per-module docs with
6
+ YAML frontmatter, and a compact index for AI context loading.
7
+
8
+ license: MIT
9
+
10
+ metadata:
11
+ raise.work_cycle: discovery
12
+ raise.frequency: per-project
13
+ raise.fase: "5"
14
+ raise.prerequisites: discover-validate
15
+ raise.next: ""
16
+ raise.gate: ""
17
+ raise.adaptable: "true"
18
+ raise.version: "2.0.0"
19
+ raise.visibility: public
20
+ ---
21
+
22
+ # Discover Document
23
+
24
+ > **Deprecated:** Use `/rai-discover` instead, which runs the full pipeline (detect → extract → describe → document → build) in one pass. This skill is kept for backward compatibility.
25
+
26
+ ## Purpose
27
+
28
+ Generate architecture documentation from discovery data: system-level C4 docs, per-module docs with YAML frontmatter, domain model, and a compact index for AI context loading.
29
+
30
+ ## Mastery Levels (ShuHaRi)
31
+
32
+ - **Shu**: Generate all levels, explain each section
33
+ - **Ha**: Targeted updates for changed modules only
34
+ - **Ri**: Incremental regeneration, preserve human-written sections
35
+
36
+ ## Context
37
+
38
+ **When to use:** After discover-scan + discover-validate pipeline completes, or when architecture changes significantly.
39
+
40
+ **When to skip:** Minor code changes that don't affect module structure.
41
+
42
+ **Inputs:** `work/discovery/components-validated.json`, source tree, governance docs (`guardrails.md`, `vision.md`, optionally `constitution.md`).
43
+
44
+ ## Steps
45
+
46
+ ### Step 1: Analyze Module Structure
47
+
48
+ Check `work/discovery/context.yaml` for detected language, then for each module:
49
+
50
+ | Language | Module marker | Strategy |
51
+ |----------|--------------|----------|
52
+ | Python | `__init__.py` | Read docstring, scan `from pkg.X import` |
53
+ | C# | `.csproj` + namespaces | Group by top-level layer directory |
54
+ | PHP | `composer.json` PSR-4 | Group by namespace segment |
55
+
56
+ Per module: count components, build dependency map, identify entry points, list public API.
57
+
58
+ <verification>
59
+ All modules identified with dependency data.
60
+ </verification>
61
+
62
+ ### Step 2: Generate Module Docs
63
+
64
+ Write `governance/architecture/modules/{name}.md` per module:
65
+
66
+ **YAML frontmatter:** type, name, purpose, status, depends_on, depended_by, components.
67
+
68
+ **Body sections:** Purpose (2-3 sentences), Architecture, Key Files, Dependencies table, Conventions.
69
+
70
+ Write genuine explanatory prose — a new contributor should understand the module's role.
71
+
72
+ <verification>
73
+ All modules have docs with valid YAML frontmatter.
74
+ </verification>
75
+
76
+ ### Step 3: Generate System Docs & Index
77
+
78
+ **System Context** (`system-context.md`): From `governance/vision.md` — what, who, why, external systems, non-goals.
79
+
80
+ **System Design** (`system-design.md`): From `governance/guardrails.md` + module deps — layers, data flows, constraints, drift detection.
81
+
82
+ **Domain Model** (`domain-model.md`): From module deps + component catalog — bounded contexts, context map, design decision guidance.
83
+
84
+ **Index** (`index.md`): System overview, module map table, data flow diagram, key constraints. Target: <2K tokens.
85
+
86
+ <verification>
87
+ All 4 system-level docs exist. Index under 2K tokens.
88
+ </verification>
89
+
90
+ ### Step 4: Validate & Rebuild Graph
91
+
92
+ - All modules documented, frontmatter parses cleanly
93
+ - Dependency map matches actual imports
94
+ - Guardrails/constitution references are current
95
+
96
+ ```bash
97
+ rai graph build
98
+ rai graph query "module dependencies"
99
+ ```
100
+
101
+ <verification>
102
+ Module nodes appear in graph. No stale references.
103
+ </verification>
104
+
105
+ ## Output
106
+
107
+ | Item | Destination |
108
+ |------|-------------|
109
+ | Module docs | `governance/architecture/modules/*.md` |
110
+ | System context | `governance/architecture/system-context.md` |
111
+ | System design | `governance/architecture/system-design.md` |
112
+ | Domain model | `governance/architecture/domain-model.md` |
113
+ | Index | `governance/architecture/index.md` |
114
+
115
+ ## Quality Checklist
116
+
117
+ - [ ] Module frontmatter includes all required fields (type, name, purpose, depends_on)
118
+ - [ ] Prose explains WHY, not just WHAT (new contributor test)
119
+ - [ ] Index under 2K tokens for session-loadable context
120
+ - [ ] On re-run, preserve human-edited sections (append, don't overwrite)
121
+ - [ ] NEVER generate placeholder docs for modules with no real code
122
+
123
+ ## References
124
+
125
+ - Previous: `/rai-discover-validate`
126
+ - Graph builder: `src/raise_cli/context/builder.py` (`load_architecture()`)
127
+ - Components: `work/discovery/components-validated.json`
128
+ - Governance: `governance/guardrails.md`, `governance/vision.md`
@@ -0,0 +1,147 @@
1
+ ---
2
+ name: rai-discover-scan
3
+ description: >
4
+ Extract symbols from codebase using rai discover scan, then synthesize
5
+ meaningful descriptions for each component. Creates draft for human validation.
6
+
7
+ license: MIT
8
+
9
+ metadata:
10
+ raise.work_cycle: discovery
11
+ raise.frequency: per-project
12
+ raise.fase: "2"
13
+ raise.prerequisites: discover-start
14
+ raise.next: discover-validate
15
+ raise.gate: ""
16
+ raise.adaptable: "true"
17
+ raise.version: "2.0.0"
18
+ raise.visibility: public
19
+ ---
20
+
21
+ # Discovery Scan
22
+
23
+ > **Deprecated:** Use `/rai-discover` instead, which runs the full pipeline (detect → extract → describe → document → build) in one pass. This skill is kept for backward compatibility.
24
+
25
+ ## Purpose
26
+
27
+ Extract symbols from the codebase and synthesize meaningful descriptions for each component. Produces a draft component catalog ready for human validation.
28
+
29
+ ## Mastery Levels (ShuHaRi)
30
+
31
+ - **Shu**: Follow all steps, synthesize descriptions for all public symbols
32
+ - **Ha**: Filter to public APIs only; skip internal helpers automatically
33
+ - **Ri**: Custom synthesis prompts for domain-specific codebases
34
+
35
+ ## Context
36
+
37
+ **When to use:** After `/rai-discover-start` has created context, or for targeted scan of a specific directory.
38
+
39
+ **When to skip:** `work/discovery/components-draft.yaml` exists and is current.
40
+
41
+ **Inputs:** `work/discovery/context.yaml` from `/rai-discover-start`, OR explicit path argument.
42
+
43
+ ## Steps
44
+
45
+ ### Step 1: Extract Symbols
46
+
47
+ ```bash
48
+ rai discover scan {root_dir} --language {language} --output json
49
+ ```
50
+
51
+ <verification>
52
+ JSON output received with symbols array.
53
+ </verification>
54
+
55
+ <if-blocked>
56
+ Scan fails → check path exists and language is supported.
57
+ </if-blocked>
58
+
59
+ ### Step 2: Run Analysis
60
+
61
+ ```bash
62
+ rai discover scan {root_dir} --language {language} --output json | rai discover analyze --output human
63
+ ```
64
+
65
+ Produces `work/discovery/analysis.json` with:
66
+ - Confidence scores per component (high ≥70 / medium 40-69 / low <40)
67
+ - Auto-categorization from path conventions and naming patterns
68
+ - Hierarchical folding (methods grouped under parent classes)
69
+ - Module grouping (for parallel AI synthesis batches)
70
+
71
+ <verification>
72
+ `work/discovery/analysis.json` exists with components and module_groups.
73
+ </verification>
74
+
75
+ ### Step 3: Synthesize Descriptions
76
+
77
+ | Confidence | Action |
78
+ |-----------|--------|
79
+ | High (≥70) | Use `auto_purpose` and `auto_category` — no AI synthesis needed |
80
+ | Medium/Low | Synthesize per module group batch |
81
+
82
+ **Per component synthesis:**
83
+ 1. **Purpose** — What does it do? Why does it exist? (1-2 sentences, focus on reuse value)
84
+ 2. **Category** — Verify or correct auto_category
85
+ 3. **Dependencies** — Key types from signature (specific, not generic)
86
+
87
+ ### Step 4: Generate IDs & Write Draft
88
+
89
+ **ID pattern:** `comp-{module}-{name}` (lowercase, hyphens for underscores).
90
+
91
+ Write `work/discovery/components-draft.yaml`:
92
+
93
+ ```yaml
94
+ generated_at: {ISO_TIMESTAMP}
95
+ symbol_count: {N}
96
+ components:
97
+ - id: comp-scanner-symbol
98
+ name: Symbol
99
+ kind: class
100
+ file: src/raise_cli/discovery/scanner.py
101
+ line: 44
102
+ signature: "class Symbol(BaseModel)"
103
+ purpose: "Represents a code symbol extracted from source files."
104
+ category: model
105
+ depends_on: [pydantic.BaseModel]
106
+ internal: false
107
+ validated: false
108
+ ```
109
+
110
+ <verification>
111
+ File created at `work/discovery/components-draft.yaml`.
112
+ </verification>
113
+
114
+ ### Step 5: Display Summary
115
+
116
+ ```markdown
117
+ ## Discovery Scan Complete
118
+
119
+ **Scanned:** {path} | **Language:** {language} | **Symbols:** {total}
120
+ **Categories:** Models: {N}, Services: {N}, Utilities: {N}
121
+ **Output:** `work/discovery/components-draft.yaml`
122
+
123
+ **Next:** `/rai-discover-validate`
124
+ ```
125
+
126
+ ## Output
127
+
128
+ | Item | Destination |
129
+ |------|-------------|
130
+ | Analysis | `work/discovery/analysis.json` |
131
+ | Draft catalog | `work/discovery/components-draft.yaml` |
132
+ | Next | `/rai-discover-validate` |
133
+
134
+ ## Quality Checklist
135
+
136
+ - [ ] Synthesis focuses on reuse value (what/why, not how)
137
+ - [ ] Categories match symbol roles (see category table below)
138
+ - [ ] Dependencies are specific types, not generic packages
139
+ - [ ] Large codebases (>100 symbols): scan in chunks by directory
140
+ - [ ] NEVER describe implementation details in purpose ("Uses a loop to...")
141
+
142
+ ## References
143
+
144
+ - Previous: `/rai-discover-start`
145
+ - Next: `/rai-discover-validate`
146
+ - CLI: `rai discover scan --help`, `rai discover analyze --help`
147
+ - Categories: service, model, utility, handler, parser, builder, schema, command, test
@@ -0,0 +1,145 @@
1
+ ---
2
+ name: rai-discover-start
3
+ description: >
4
+ Initialize codebase discovery by detecting project type, languages, and
5
+ key directories. Creates context file for subsequent discovery skills.
6
+
7
+ license: MIT
8
+
9
+ metadata:
10
+ raise.work_cycle: discovery
11
+ raise.frequency: per-project
12
+ raise.fase: "1"
13
+ raise.prerequisites: ""
14
+ raise.next: discover-scan
15
+ raise.gate: ""
16
+ raise.adaptable: "true"
17
+ raise.version: "2.0.0"
18
+ raise.visibility: public
19
+ ---
20
+
21
+ # Discovery Start
22
+
23
+ > **Deprecated:** Use `/rai-discover` instead, which runs the full pipeline (detect → extract → describe → document → build) in one pass. This skill is kept for backward compatibility.
24
+
25
+ ## Purpose
26
+
27
+ Initialize codebase discovery by detecting languages, key directories, and entry points. Creates the context file that all subsequent discovery skills depend on.
28
+
29
+ ## Mastery Levels (ShuHaRi)
30
+
31
+ - **Shu**: Follow all steps, detect all languages, create complete context file
32
+ - **Ha**: Focus on primary language only for targeted discovery
33
+ - **Ri**: Integrate with monorepo structures or custom conventions
34
+
35
+ ## Context
36
+
37
+ **When to use:** Starting discovery on a new or significantly changed codebase.
38
+
39
+ **When to skip:** `work/discovery/context.yaml` already exists and is current. For targeted re-scan, use `/rai-discover-scan` directly with path.
40
+
41
+ **Inputs:** Access to project root directory.
42
+
43
+ ## Steps
44
+
45
+ ### Step 1: Detect Languages
46
+
47
+ Scan for source files by extension (exclude `.raise/`, `node_modules/`, `.git/`, `obj/`, `bin/`):
48
+
49
+ ```bash
50
+ find . -type f -name "*.py" ! -path "./.raise/*" ! -path "./node_modules/*" ! -path "./.git/*" | wc -l
51
+ # Repeat for: *.ts/*.tsx, *.js/*.jsx, *.cs/*.csproj, *.php, *.dart
52
+ ```
53
+
54
+ | Language | Extensions |
55
+ |----------|-----------|
56
+ | python | `.py` |
57
+ | typescript | `.ts`, `.tsx` |
58
+ | javascript | `.js`, `.jsx` |
59
+ | csharp | `.cs`, `.csproj` |
60
+ | php | `.php` |
61
+ | dart | `.dart` |
62
+
63
+ <verification>
64
+ At least one supported language detected.
65
+ </verification>
66
+
67
+ <if-blocked>
68
+ No supported languages → discovery not applicable to this codebase.
69
+ </if-blocked>
70
+
71
+ ### Step 2: Identify Directories & Entry Points
72
+
73
+ **Directories:** Check for `src/`, `lib/`, `app/`, `packages/`.
74
+
75
+ **Entry points** by language:
76
+
77
+ | Language | Entry points |
78
+ |----------|-------------|
79
+ | python | `src/*/cli/main.py`, `src/*/__main__.py`, `main.py` |
80
+ | typescript/js | `src/index.ts`, `src/main.ts`, `package.json` main field |
81
+ | csharp | `Program.cs`, `Startup.cs`, `*.sln` |
82
+ | php | `public/index.php`, `bin/console` |
83
+ | dart | `lib/main.dart` |
84
+
85
+ <verification>
86
+ At least one scannable directory identified.
87
+ </verification>
88
+
89
+ <if-blocked>
90
+ No clear source directory → ask user to specify.
91
+ </if-blocked>
92
+
93
+ ### Step 3: Create Context File
94
+
95
+ Write `work/discovery/context.yaml`:
96
+
97
+ ```yaml
98
+ project:
99
+ name: {from pyproject.toml/package.json/directory name}
100
+ languages: [python]
101
+ root_dirs: [src/raise_cli]
102
+ entry_points: [src/raise_cli/cli/main.py]
103
+ detected_at: {ISO_TIMESTAMP}
104
+ status: initialized
105
+ ```
106
+
107
+ Project name priority: `pyproject.toml` → `package.json` → directory name.
108
+
109
+ <verification>
110
+ File created at `work/discovery/context.yaml`.
111
+ </verification>
112
+
113
+ ### Step 4: Display Summary
114
+
115
+ ```markdown
116
+ ## Discovery Initialized
117
+
118
+ **Project:** {name}
119
+ **Languages:** {list}
120
+ **Directories:** {list}
121
+ **Entry Points:** {list}
122
+ **Context file:** `work/discovery/context.yaml`
123
+
124
+ **Next:** `/rai-discover-scan`
125
+ ```
126
+
127
+ ## Output
128
+
129
+ | Item | Destination |
130
+ |------|-------------|
131
+ | Context file | `work/discovery/context.yaml` |
132
+ | Next | `/rai-discover-scan` |
133
+
134
+ ## Quality Checklist
135
+
136
+ - [ ] All supported languages detected (not just primary)
137
+ - [ ] Generated directories exclude build/vendor paths
138
+ - [ ] Context file is valid YAML with all required fields
139
+ - [ ] Monorepo: each package listed as separate root_dir
140
+ - [ ] NEVER include generated/build directories in root_dirs
141
+
142
+ ## References
143
+
144
+ - Next: `/rai-discover-scan`
145
+ - Pipeline: discover-start → discover-scan → discover-validate → discover-document