scene-capability-engine 3.0.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.
Files changed (336) hide show
  1. package/CHANGELOG.md +2513 -0
  2. package/LICENSE +21 -0
  3. package/README.md +765 -0
  4. package/README.zh.md +630 -0
  5. package/bin/kiro-spec-engine.js +796 -0
  6. package/bin/kse.js +3 -0
  7. package/bin/sce.js +3 -0
  8. package/bin/sco.js +3 -0
  9. package/docs/331-poc-adaptation-roadmap.md +156 -0
  10. package/docs/331-poc-dual-track-integration-guide.md +120 -0
  11. package/docs/331-poc-weekly-delivery-checklist.md +52 -0
  12. package/docs/OFFLINE_INSTALL.md +96 -0
  13. package/docs/README.md +279 -0
  14. package/docs/adopt-migration-guide.md +599 -0
  15. package/docs/adoption-guide.md +616 -0
  16. package/docs/agent-hooks-analysis.md +815 -0
  17. package/docs/architecture.md +733 -0
  18. package/docs/articles/ai-driven-development-philosophy-and-practice-review.md +208 -0
  19. package/docs/articles/ai-driven-development-philosophy-and-practice.en.md +459 -0
  20. package/docs/articles/ai-driven-development-philosophy-and-practice.md +492 -0
  21. package/docs/autonomous-control-guide.md +851 -0
  22. package/docs/command-reference.md +1368 -0
  23. package/docs/community.md +115 -0
  24. package/docs/cross-tool-guide.md +555 -0
  25. package/docs/developer-guide.md +619 -0
  26. package/docs/document-governance.md +865 -0
  27. package/docs/environment-management-guide.md +526 -0
  28. package/docs/examples/add-export-command/design.md +194 -0
  29. package/docs/examples/add-export-command/requirements.md +110 -0
  30. package/docs/examples/add-export-command/tasks.md +88 -0
  31. package/docs/examples/add-rest-api/design.md +855 -0
  32. package/docs/examples/add-rest-api/requirements.md +323 -0
  33. package/docs/examples/add-rest-api/tasks.md +355 -0
  34. package/docs/examples/add-user-dashboard/design.md +192 -0
  35. package/docs/examples/add-user-dashboard/requirements.md +143 -0
  36. package/docs/examples/add-user-dashboard/tasks.md +91 -0
  37. package/docs/faq.md +697 -0
  38. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.json +156 -0
  39. package/docs/handoffs/evidence/ontology/moqui-template-baseline-2026-02-17-232922.md +24 -0
  40. package/docs/images/wechat-qr.png +0 -0
  41. package/docs/integration-modes.md +529 -0
  42. package/docs/integration-philosophy.md +313 -0
  43. package/docs/knowledge-management-guide.md +263 -0
  44. package/docs/manual-workflows-guide.md +418 -0
  45. package/docs/moqui-capability-matrix.md +73 -0
  46. package/docs/moqui-template-core-library-playbook.md +109 -0
  47. package/docs/multi-agent-coordination-guide.md +553 -0
  48. package/docs/multi-repo-management-guide.md +1344 -0
  49. package/docs/quick-start-with-ai-tools.md +375 -0
  50. package/docs/quick-start.md +146 -0
  51. package/docs/release-checklist.md +121 -0
  52. package/docs/releases/README.md +13 -0
  53. package/docs/releases/v1.46.2-validation.md +45 -0
  54. package/docs/releases/v1.46.2.md +50 -0
  55. package/docs/scene-runtime-guide.md +347 -0
  56. package/docs/spec-collaboration-guide.md +369 -0
  57. package/docs/spec-locking-guide.md +225 -0
  58. package/docs/spec-numbering-guide.md +348 -0
  59. package/docs/spec-workflow.md +519 -0
  60. package/docs/steering-strategy-guide.md +196 -0
  61. package/docs/team-collaboration-guide.md +465 -0
  62. package/docs/testing-strategy.md +272 -0
  63. package/docs/tools/claude-guide.md +654 -0
  64. package/docs/tools/cursor-guide.md +706 -0
  65. package/docs/tools/generic-guide.md +446 -0
  66. package/docs/tools/kiro-guide.md +308 -0
  67. package/docs/tools/vscode-guide.md +445 -0
  68. package/docs/tools/windsurf-guide.md +391 -0
  69. package/docs/troubleshooting.md +1135 -0
  70. package/docs/upgrade-guide.md +639 -0
  71. package/docs/value-observability-guide.md +127 -0
  72. package/docs/zh/README.md +341 -0
  73. package/docs/zh/quick-start.md +764 -0
  74. package/docs/zh/release-checklist.md +121 -0
  75. package/docs/zh/releases/README.md +13 -0
  76. package/docs/zh/releases/v1.46.2-validation.md +45 -0
  77. package/docs/zh/releases/v1.46.2.md +50 -0
  78. package/docs/zh/spec-numbering-guide.md +348 -0
  79. package/docs/zh/tools/claude-guide.md +349 -0
  80. package/docs/zh/tools/cursor-guide.md +281 -0
  81. package/docs/zh/tools/generic-guide.md +499 -0
  82. package/docs/zh/tools/kiro-guide.md +342 -0
  83. package/docs/zh/tools/vscode-guide.md +449 -0
  84. package/docs/zh/tools/windsurf-guide.md +378 -0
  85. package/docs/zh/value-observability-guide.md +127 -0
  86. package/docs//344/272/244/344/273/230/346/270/205/345/215/225.md +75 -0
  87. package/lib/adoption/adoption-logger.js +487 -0
  88. package/lib/adoption/adoption-strategy.js +538 -0
  89. package/lib/adoption/backup-manager.js +420 -0
  90. package/lib/adoption/conflict-resolver.js +410 -0
  91. package/lib/adoption/detection-engine.js +275 -0
  92. package/lib/adoption/diff-viewer.js +226 -0
  93. package/lib/adoption/error-formatter.js +509 -0
  94. package/lib/adoption/file-classifier.js +385 -0
  95. package/lib/adoption/progress-reporter.js +534 -0
  96. package/lib/adoption/smart-orchestrator.js +470 -0
  97. package/lib/adoption/strategy-selector.js +218 -0
  98. package/lib/adoption/summary-generator.js +493 -0
  99. package/lib/adoption/template-sync.js +605 -0
  100. package/lib/auto/autonomous-engine.js +485 -0
  101. package/lib/auto/checkpoint-manager.js +300 -0
  102. package/lib/auto/close-loop-runner.js +2476 -0
  103. package/lib/auto/config-schema.js +176 -0
  104. package/lib/auto/decision-engine.js +344 -0
  105. package/lib/auto/error-recovery-manager.js +580 -0
  106. package/lib/auto/goal-decomposer.js +278 -0
  107. package/lib/auto/progress-tracker.js +502 -0
  108. package/lib/auto/safety-manager.js +186 -0
  109. package/lib/auto/semantic-decomposer.js +137 -0
  110. package/lib/auto/state-manager.js +126 -0
  111. package/lib/auto/task-queue-manager.js +340 -0
  112. package/lib/backup/backup-system.js +372 -0
  113. package/lib/backup/selective-backup.js +207 -0
  114. package/lib/collab/agent-registry.js +240 -0
  115. package/lib/collab/collab-manager.js +285 -0
  116. package/lib/collab/contract-manager.js +320 -0
  117. package/lib/collab/coordinator.js +370 -0
  118. package/lib/collab/dependency-manager.js +280 -0
  119. package/lib/collab/index.js +20 -0
  120. package/lib/collab/integration-manager.js +202 -0
  121. package/lib/collab/merge-coordinator.js +252 -0
  122. package/lib/collab/metadata-manager.js +233 -0
  123. package/lib/collab/multi-agent-config.js +120 -0
  124. package/lib/collab/spec-lifecycle-manager.js +304 -0
  125. package/lib/collab/sync-barrier.js +88 -0
  126. package/lib/collab/visualizer.js +208 -0
  127. package/lib/commands/adopt.js +749 -0
  128. package/lib/commands/auto.js +19559 -0
  129. package/lib/commands/collab.js +275 -0
  130. package/lib/commands/context.js +99 -0
  131. package/lib/commands/docs.js +808 -0
  132. package/lib/commands/doctor.js +273 -0
  133. package/lib/commands/env.js +420 -0
  134. package/lib/commands/knowledge.js +309 -0
  135. package/lib/commands/lock.js +235 -0
  136. package/lib/commands/ops.js +409 -0
  137. package/lib/commands/orchestrate.js +446 -0
  138. package/lib/commands/prompt.js +105 -0
  139. package/lib/commands/repo.js +118 -0
  140. package/lib/commands/rollback.js +219 -0
  141. package/lib/commands/scene.js +15549 -0
  142. package/lib/commands/spec-bootstrap.js +147 -0
  143. package/lib/commands/spec-gate.js +157 -0
  144. package/lib/commands/spec-pipeline.js +205 -0
  145. package/lib/commands/status.js +321 -0
  146. package/lib/commands/task.js +199 -0
  147. package/lib/commands/templates.js +654 -0
  148. package/lib/commands/upgrade.js +231 -0
  149. package/lib/commands/value.js +569 -0
  150. package/lib/commands/watch.js +684 -0
  151. package/lib/commands/workflows.js +240 -0
  152. package/lib/commands/workspace-multi.js +325 -0
  153. package/lib/commands/workspace.js +189 -0
  154. package/lib/context/context-exporter.js +378 -0
  155. package/lib/context/prompt-generator.js +482 -0
  156. package/lib/data/moqui-capability-lexicon.json +45 -0
  157. package/lib/environment/backup-system.js +189 -0
  158. package/lib/environment/environment-manager.js +379 -0
  159. package/lib/environment/environment-registry.js +168 -0
  160. package/lib/gitignore/gitignore-backup.js +229 -0
  161. package/lib/gitignore/gitignore-detector.js +239 -0
  162. package/lib/gitignore/gitignore-integration.js +267 -0
  163. package/lib/gitignore/gitignore-transformer.js +193 -0
  164. package/lib/gitignore/layered-rules-template.js +42 -0
  165. package/lib/governance/archive-tool.js +284 -0
  166. package/lib/governance/cleanup-tool.js +237 -0
  167. package/lib/governance/config-manager.js +186 -0
  168. package/lib/governance/diagnostic-engine.js +271 -0
  169. package/lib/governance/doc-reference-checker.js +200 -0
  170. package/lib/governance/execution-logger.js +243 -0
  171. package/lib/governance/file-scanner.js +285 -0
  172. package/lib/governance/hooks-manager.js +333 -0
  173. package/lib/governance/reporter.js +337 -0
  174. package/lib/governance/validation-engine.js +181 -0
  175. package/lib/i18n.js +79 -0
  176. package/lib/knowledge/entry-manager.js +208 -0
  177. package/lib/knowledge/index-manager.js +261 -0
  178. package/lib/knowledge/knowledge-manager.js +273 -0
  179. package/lib/knowledge/template-manager.js +191 -0
  180. package/lib/lock/index.js +21 -0
  181. package/lib/lock/lock-file.js +192 -0
  182. package/lib/lock/lock-manager.js +321 -0
  183. package/lib/lock/machine-identifier.js +135 -0
  184. package/lib/lock/steering-file-lock.js +207 -0
  185. package/lib/lock/task-lock-manager.js +345 -0
  186. package/lib/operations/audit-logger.js +293 -0
  187. package/lib/operations/feedback-manager.js +1147 -0
  188. package/lib/operations/index.js +23 -0
  189. package/lib/operations/models/index.js +170 -0
  190. package/lib/operations/operations-manager.js +151 -0
  191. package/lib/operations/operations-validator.js +280 -0
  192. package/lib/operations/permission-manager.js +354 -0
  193. package/lib/operations/template-loader.js +143 -0
  194. package/lib/orchestrator/agent-spawner.js +629 -0
  195. package/lib/orchestrator/bootstrap-prompt-builder.js +236 -0
  196. package/lib/orchestrator/index.js +19 -0
  197. package/lib/orchestrator/orchestration-engine.js +1270 -0
  198. package/lib/orchestrator/orchestrator-config.js +173 -0
  199. package/lib/orchestrator/status-monitor.js +591 -0
  200. package/lib/python-checker.js +209 -0
  201. package/lib/repo/config-manager.js +580 -0
  202. package/lib/repo/errors/config-error.js +13 -0
  203. package/lib/repo/errors/git-error.js +15 -0
  204. package/lib/repo/errors/repo-error.js +14 -0
  205. package/lib/repo/git-operations.js +181 -0
  206. package/lib/repo/handlers/.gitkeep +1 -0
  207. package/lib/repo/handlers/exec-handler.js +155 -0
  208. package/lib/repo/handlers/health-handler.js +169 -0
  209. package/lib/repo/handlers/init-handler.js +197 -0
  210. package/lib/repo/handlers/status-handler.js +176 -0
  211. package/lib/repo/output-formatter.js +184 -0
  212. package/lib/repo/path-resolver.js +178 -0
  213. package/lib/repo/repo-manager.js +514 -0
  214. package/lib/scene-runtime/audit-emitter.js +59 -0
  215. package/lib/scene-runtime/binding-plugin-loader.js +351 -0
  216. package/lib/scene-runtime/binding-registry.js +349 -0
  217. package/lib/scene-runtime/eval-bridge.js +44 -0
  218. package/lib/scene-runtime/index.js +19 -0
  219. package/lib/scene-runtime/moqui-adapter.js +620 -0
  220. package/lib/scene-runtime/moqui-client.js +606 -0
  221. package/lib/scene-runtime/moqui-extractor.js +2029 -0
  222. package/lib/scene-runtime/plan-compiler.js +208 -0
  223. package/lib/scene-runtime/policy-gate.js +58 -0
  224. package/lib/scene-runtime/runtime-executor.js +358 -0
  225. package/lib/scene-runtime/scene-loader.js +96 -0
  226. package/lib/scene-runtime/scene-ontology.js +959 -0
  227. package/lib/scene-runtime/scene-template-linter.js +852 -0
  228. package/lib/scene-runtime/templates/scene-template-erp-query-v0.1.yaml +28 -0
  229. package/lib/scene-runtime/templates/scene-template-hybrid-shadow-v0.1.yaml +34 -0
  230. package/lib/spec/bootstrap/context-collector.js +48 -0
  231. package/lib/spec/bootstrap/draft-generator.js +158 -0
  232. package/lib/spec/bootstrap/questionnaire-engine.js +70 -0
  233. package/lib/spec/bootstrap/trace-emitter.js +59 -0
  234. package/lib/spec/multi-spec-orchestrate.js +93 -0
  235. package/lib/spec/pipeline/constants.js +6 -0
  236. package/lib/spec/pipeline/stage-adapters.js +118 -0
  237. package/lib/spec/pipeline/stage-runner.js +146 -0
  238. package/lib/spec/pipeline/state-store.js +119 -0
  239. package/lib/spec-gate/engine/gate-engine.js +165 -0
  240. package/lib/spec-gate/policy/default-policy.js +22 -0
  241. package/lib/spec-gate/policy/policy-loader.js +103 -0
  242. package/lib/spec-gate/result-emitter.js +81 -0
  243. package/lib/spec-gate/rules/default-rules.js +156 -0
  244. package/lib/spec-gate/rules/rule-registry.js +51 -0
  245. package/lib/steering/adoption-config.js +164 -0
  246. package/lib/steering/compliance-auto-fixer.js +204 -0
  247. package/lib/steering/compliance-cache.js +99 -0
  248. package/lib/steering/compliance-error-reporter.js +70 -0
  249. package/lib/steering/context-sync-manager.js +273 -0
  250. package/lib/steering/index.js +92 -0
  251. package/lib/steering/spec-steering.js +230 -0
  252. package/lib/steering/steering-compliance-checker.js +73 -0
  253. package/lib/steering/steering-loader.js +144 -0
  254. package/lib/steering/steering-manager.js +289 -0
  255. package/lib/task/index.js +12 -0
  256. package/lib/task/task-claimer.js +489 -0
  257. package/lib/task/task-status-store.js +418 -0
  258. package/lib/templates/cache-manager.js +440 -0
  259. package/lib/templates/content-generalizer.js +247 -0
  260. package/lib/templates/frontmatter-generator.js +128 -0
  261. package/lib/templates/git-handler.js +471 -0
  262. package/lib/templates/metadata-collector.js +328 -0
  263. package/lib/templates/path-utils.js +144 -0
  264. package/lib/templates/registry-parser.js +505 -0
  265. package/lib/templates/spec-reader.js +216 -0
  266. package/lib/templates/template-applicator.js +249 -0
  267. package/lib/templates/template-creator.js +256 -0
  268. package/lib/templates/template-error.js +143 -0
  269. package/lib/templates/template-exporter.js +502 -0
  270. package/lib/templates/template-manager.js +782 -0
  271. package/lib/templates/template-validator.js +361 -0
  272. package/lib/upgrade/migration-engine.js +382 -0
  273. package/lib/upgrade/migrations/.gitkeep +52 -0
  274. package/lib/upgrade/migrations/1.0.0-to-1.1.0.js +78 -0
  275. package/lib/utils/file-diff.js +177 -0
  276. package/lib/utils/fs-utils.js +274 -0
  277. package/lib/utils/tool-detector.js +383 -0
  278. package/lib/utils/validation.js +324 -0
  279. package/lib/value/gate-summary-emitter.js +99 -0
  280. package/lib/value/metric-contract-loader.js +210 -0
  281. package/lib/value/risk-evaluator.js +117 -0
  282. package/lib/value/weekly-snapshot-builder.js +61 -0
  283. package/lib/version/version-checker.js +156 -0
  284. package/lib/version/version-manager.js +327 -0
  285. package/lib/watch/action-executor.js +458 -0
  286. package/lib/watch/event-debouncer.js +323 -0
  287. package/lib/watch/execution-logger.js +550 -0
  288. package/lib/watch/file-watcher.js +499 -0
  289. package/lib/watch/presets.js +266 -0
  290. package/lib/watch/watch-manager.js +533 -0
  291. package/lib/workspace/multi/global-config.js +150 -0
  292. package/lib/workspace/multi/index.js +22 -0
  293. package/lib/workspace/multi/path-utils.js +173 -0
  294. package/lib/workspace/multi/workspace-context-resolver.js +244 -0
  295. package/lib/workspace/multi/workspace-registry.js +196 -0
  296. package/lib/workspace/multi/workspace-state-manager.js +537 -0
  297. package/lib/workspace/multi/workspace.js +90 -0
  298. package/lib/workspace/workspace-manager.js +370 -0
  299. package/lib/workspace/workspace-sync.js +356 -0
  300. package/locales/en.json +114 -0
  301. package/locales/zh.json +114 -0
  302. package/package.json +102 -0
  303. package/template/.kiro/README.md +247 -0
  304. package/template/.kiro/hooks/check-spec-on-create.kiro.hook +17 -0
  305. package/template/.kiro/hooks/run-tests-on-save.kiro.hook +13 -0
  306. package/template/.kiro/hooks/sync-tasks-on-edit.kiro.hook +16 -0
  307. package/template/.kiro/specs/SPEC_WORKFLOW_GUIDE.md +134 -0
  308. package/template/.kiro/steering/CORE_PRINCIPLES.md +133 -0
  309. package/template/.kiro/steering/CURRENT_CONTEXT.md +30 -0
  310. package/template/.kiro/steering/ENVIRONMENT.md +35 -0
  311. package/template/.kiro/steering/RULES_GUIDE.md +46 -0
  312. package/template/.kiro/templates/operations/default/change-impact.md +112 -0
  313. package/template/.kiro/templates/operations/default/deployment.md +91 -0
  314. package/template/.kiro/templates/operations/default/feedback-response.md +269 -0
  315. package/template/.kiro/templates/operations/default/migration-plan.md +172 -0
  316. package/template/.kiro/templates/operations/default/monitoring.md +135 -0
  317. package/template/.kiro/templates/operations/default/operations.md +135 -0
  318. package/template/.kiro/templates/operations/default/rollback.md +143 -0
  319. package/template/.kiro/templates/operations/default/tools.yaml +364 -0
  320. package/template/.kiro/templates/operations/default/troubleshooting.md +123 -0
  321. package/template/.kiro/tools/backup_manager.py +295 -0
  322. package/template/.kiro/tools/configuration_manager.py +218 -0
  323. package/template/.kiro/tools/document_evaluator.py +550 -0
  324. package/template/.kiro/tools/enhancement_logger.py +168 -0
  325. package/template/.kiro/tools/error_handler.py +335 -0
  326. package/template/.kiro/tools/improvement_identifier.py +444 -0
  327. package/template/.kiro/tools/modification_applicator.py +737 -0
  328. package/template/.kiro/tools/quality_gate_enforcer.py +207 -0
  329. package/template/.kiro/tools/quality_scorer.py +305 -0
  330. package/template/.kiro/tools/report_generator.py +154 -0
  331. package/template/.kiro/tools/ultrawork_enhancer.py +676 -0
  332. package/template/.kiro/tools/ultrawork_enhancer_refactored.py +0 -0
  333. package/template/.kiro/tools/ultrawork_enhancer_v2.py +463 -0
  334. package/template/.kiro/tools/ultrawork_enhancer_v3.py +606 -0
  335. package/template/.kiro/tools/workflow_quality_gate.py +100 -0
  336. package/template/README.md +111 -0
@@ -0,0 +1,1344 @@
1
+ # Multi-Repository Management Guide
2
+
3
+ ## Overview
4
+
5
+ The Multi-Repository Management feature enables you to manage multiple Git subrepositories within a single project through a unified command-line interface. This is particularly useful for projects that consist of multiple independent repositories (e.g., frontend, backend, shared libraries) that need to be coordinated together.
6
+
7
+ ## Quick Start
8
+
9
+ ### 1. Initialize Repository Configuration
10
+
11
+ Navigate to your project root and run:
12
+
13
+ ```bash
14
+ kse repo init
15
+ ```
16
+
17
+ This command:
18
+ - Scans your project directory for Git repositories
19
+ - Extracts remote URLs and current branches
20
+ - Creates `.kiro/project-repos.json` configuration file
21
+ - Excludes the `.kiro` directory from scanning
22
+
23
+ **Example output:**
24
+ ```
25
+ Scanning for Git repositories...
26
+ Found 3 repositories:
27
+ ✓ frontend (main) - https://github.com/user/frontend.git
28
+ ✓ backend (develop) - https://github.com/user/backend.git
29
+ ✓ shared (main) - https://github.com/user/shared.git
30
+
31
+ Configuration saved to .kiro/project-repos.json
32
+ ```
33
+
34
+ ### 2. Check Repository Status
35
+
36
+ View the status of all repositories at once:
37
+
38
+ ```bash
39
+ kse repo status
40
+ ```
41
+
42
+ **Example output:**
43
+ ```
44
+ ┌──────────┬─────────┬────────┬──────────┬───────┬────────┐
45
+ │ Name │ Branch │ Status │ Modified │ Ahead │ Behind │
46
+ ├──────────┼─────────┼────────┼──────────┼───────┼────────┤
47
+ │ frontend │ main │ Clean │ 0 │ 0 │ 0 │
48
+ │ backend │ develop │ Dirty │ 3 │ 2 │ 0 │
49
+ │ shared │ main │ Clean │ 0 │ 0 │ 1 │
50
+ └──────────┴─────────┴────────┴──────────┴───────┴────────┘
51
+ ```
52
+
53
+ For detailed file-level changes:
54
+
55
+ ```bash
56
+ kse repo status --verbose
57
+ ```
58
+
59
+ ### 3. Execute Commands Across Repositories
60
+
61
+ Run the same Git command in all repositories:
62
+
63
+ ```bash
64
+ kse repo exec "git pull"
65
+ ```
66
+
67
+ **Example output:**
68
+ ```
69
+ === frontend ===
70
+ Already up to date.
71
+
72
+ === backend ===
73
+ Updating abc123..def456
74
+ Fast-forward
75
+ src/api.js | 10 +++++-----
76
+ 1 file changed, 5 insertions(+), 5 deletions(-)
77
+
78
+ === shared ===
79
+ Already up to date.
80
+
81
+ Summary: 3 succeeded, 0 failed
82
+ ```
83
+
84
+ Preview commands without executing (dry-run):
85
+
86
+ ```bash
87
+ kse repo exec "git pull" --dry-run
88
+ ```
89
+
90
+ ### 4. Health Check
91
+
92
+ Verify that all repositories are properly configured:
93
+
94
+ ```bash
95
+ kse repo health
96
+ ```
97
+
98
+ **Example output:**
99
+ ```
100
+ ┌──────────┬──────────────┬────────────┬──────────────────┬───────────────┐
101
+ │ Name │ Path Exists │ Git Repo │ Remote Reachable │ Branch Exists │
102
+ ├──────────┼──────────────┼────────────┼──────────────────┼───────────────┤
103
+ │ frontend │ ✓ │ ✓ │ ✓ │ ✓ │
104
+ │ backend │ ✓ │ ✓ │ ✓ │ ✓ │
105
+ │ shared │ ✓ │ ✓ │ ✗ │ ✓ │
106
+ └──────────┴──────────────┴────────────┴──────────────────┴───────────────┘
107
+
108
+ Overall Health: 2 healthy, 1 unhealthy
109
+ ```
110
+
111
+ ## Configuration File Format
112
+
113
+ The configuration is stored in `.kiro/project-repos.json`:
114
+
115
+ ```json
116
+ {
117
+ "version": "1.0",
118
+ "repositories": [
119
+ {
120
+ "name": "frontend",
121
+ "path": "packages/frontend",
122
+ "remote": "https://github.com/user/frontend.git",
123
+ "defaultBranch": "main",
124
+ "description": "React frontend application",
125
+ "tags": ["ui", "react"],
126
+ "group": "client"
127
+ },
128
+ {
129
+ "name": "backend",
130
+ "path": "packages/backend",
131
+ "remote": "https://github.com/user/backend.git",
132
+ "defaultBranch": "develop",
133
+ "description": "Node.js API server",
134
+ "tags": ["api", "nodejs"],
135
+ "group": "server"
136
+ }
137
+ ],
138
+ "groups": {
139
+ "client": {
140
+ "description": "Client-side applications",
141
+ "color": "blue"
142
+ },
143
+ "server": {
144
+ "description": "Server-side services",
145
+ "color": "green"
146
+ }
147
+ },
148
+ "settings": {
149
+ "defaultRemote": "origin",
150
+ "scanDepth": 3
151
+ }
152
+ }
153
+ ```
154
+
155
+ ### Configuration Fields
156
+
157
+ #### Required Fields
158
+
159
+ - **name**: Unique identifier for the repository (alphanumeric, hyphens, underscores)
160
+ - **path**: Relative or absolute path to the repository
161
+ - **remote**: Git remote URL (can be `null` for local-only repos)
162
+ - **defaultBranch**: Default branch name (e.g., "main", "develop")
163
+
164
+ #### Optional Fields
165
+
166
+ - **description**: Human-readable description of the repository
167
+ - **tags**: Array of tags for categorization and filtering
168
+ - **group**: Group name for logical organization
169
+
170
+ #### Global Settings
171
+
172
+ - **version**: Configuration format version (currently "1.0")
173
+ - **groups**: Group definitions with descriptions and colors
174
+ - **settings**: Global settings like default remote name and scan depth
175
+
176
+ ### Path Resolution
177
+
178
+ Paths can be specified as:
179
+
180
+ - **Relative paths**: Resolved relative to project root
181
+ ```json
182
+ "path": "packages/frontend"
183
+ ```
184
+
185
+ - **Absolute paths**: Used as-is
186
+ ```json
187
+ "path": "/home/user/projects/frontend"
188
+ ```
189
+
190
+ - **Cross-platform**: Paths are normalized to use forward slashes internally
191
+ ```json
192
+ "path": "packages\\frontend" // Windows
193
+ "path": "packages/frontend" // Unix/Mac
194
+ ```
195
+
196
+ ## Manual Configuration
197
+
198
+ ### Overview
199
+
200
+ Starting with v1.21.0, you can manually create and edit the `.kiro/project-repos.json` configuration file without relying solely on `kse repo init`. This is useful for:
201
+
202
+ - Curating a specific list of repositories
203
+ - Removing false positives from auto-scan
204
+ - Adding repositories that weren't auto-detected
205
+ - Creating configurations for repositories that don't exist yet
206
+
207
+ ### Minimal Configuration Format
208
+
209
+ The simplest valid configuration requires only `name` and `path` for each repository:
210
+
211
+ ```json
212
+ {
213
+ "repositories": [
214
+ {
215
+ "name": "my-repo",
216
+ "path": "./my-repo"
217
+ },
218
+ {
219
+ "name": "another-repo",
220
+ "path": "./another-repo"
221
+ }
222
+ ]
223
+ }
224
+ ```
225
+
226
+ **Key points:**
227
+ - The `version` field is optional (defaults to "1.0")
228
+ - Only `name` and `path` are required for each repository
229
+ - All other fields (`remote`, `defaultBranch`, `description`, `tags`, `group`) are optional
230
+
231
+ ### Complete Configuration Example
232
+
233
+ For more detailed configurations, you can include all optional fields:
234
+
235
+ ```json
236
+ {
237
+ "version": "1.0",
238
+ "repositories": [
239
+ {
240
+ "name": "frontend",
241
+ "path": "./packages/frontend",
242
+ "remote": "https://github.com/user/frontend.git",
243
+ "defaultBranch": "main",
244
+ "description": "React frontend application",
245
+ "tags": ["ui", "react"],
246
+ "group": "client"
247
+ },
248
+ {
249
+ "name": "backend",
250
+ "path": "./packages/backend",
251
+ "remote": "https://github.com/user/backend.git",
252
+ "defaultBranch": "develop",
253
+ "description": "Node.js API server",
254
+ "tags": ["api", "nodejs"],
255
+ "group": "server"
256
+ },
257
+ {
258
+ "name": "local-only",
259
+ "path": "./local-repo"
260
+ }
261
+ ],
262
+ "groups": {
263
+ "client": {
264
+ "description": "Client-side applications"
265
+ },
266
+ "server": {
267
+ "description": "Server-side services"
268
+ }
269
+ }
270
+ }
271
+ ```
272
+
273
+ ### Field Requirements
274
+
275
+ #### Required Fields
276
+ - **name**: Unique identifier for the repository
277
+ - Must contain only alphanumeric characters, hyphens, underscores, and dots
278
+ - Examples: `"frontend"`, `"my-repo"`, `"repo.1"`, `".github"`
279
+
280
+ - **path**: Path to the repository directory
281
+ - Can be relative (e.g., `"./my-repo"`) or absolute (e.g., `"/home/user/my-repo"`)
282
+ - Must point to an existing directory containing a `.git` directory
283
+ - Cannot point to a Git worktree (`.git` file instead of directory)
284
+
285
+ #### Optional Fields
286
+ - **remote**: Git remote URL (can be omitted for local-only repositories)
287
+ - **defaultBranch**: Default branch name (e.g., `"main"`, `"develop"`)
288
+ - **description**: Human-readable description
289
+ - **tags**: Array of tags for categorization
290
+ - **group**: Group name for logical organization
291
+ - **parent**: Parent repository path (for nested repositories)
292
+
293
+ ### Validation Rules
294
+
295
+ When you manually create or edit the configuration, `kse` validates:
296
+
297
+ 1. **File Format**: Must be valid JSON
298
+ 2. **Structure**: Must have a `repositories` array
299
+ 3. **Required Fields**: Each repository must have `name` and `path`
300
+ 4. **Path Existence**: Each path must exist on the filesystem
301
+ 5. **Git Repository**: Each path must contain a `.git` directory (not file)
302
+ 6. **No Duplicates**: Repository names and paths must be unique
303
+ 7. **No Worktrees**: Paths cannot point to Git worktrees
304
+
305
+ ### Creating a Manual Configuration
306
+
307
+ **Step 1: Create the directory structure**
308
+
309
+ ```bash
310
+ mkdir -p .kiro
311
+ ```
312
+
313
+ **Step 2: Create the configuration file**
314
+
315
+ Create `.kiro/project-repos.json` with your repositories:
316
+
317
+ ```json
318
+ {
319
+ "repositories": [
320
+ {
321
+ "name": "repo1",
322
+ "path": "./repo1"
323
+ },
324
+ {
325
+ "name": "repo2",
326
+ "path": "./repo2"
327
+ }
328
+ ]
329
+ }
330
+ ```
331
+
332
+ **Step 3: Verify the configuration**
333
+
334
+ ```bash
335
+ kse repo status
336
+ ```
337
+
338
+ If there are validation errors, `kse` will display clear error messages:
339
+
340
+ ```
341
+ Error: Repository path validation failed
342
+ - Repository "repo1": path "./repo1" does not exist. Please check the path is correct.
343
+ - Repository "repo2": path "./repo2" is not a Git repository (no .git directory found). Please ensure this is a Git repository.
344
+ ```
345
+
346
+ ### Editing an Existing Configuration
347
+
348
+ You can manually edit the auto-generated configuration to:
349
+
350
+ **Remove repositories:**
351
+ ```json
352
+ {
353
+ "repositories": [
354
+ // Remove unwanted entries from this array
355
+ {
356
+ "name": "keep-this",
357
+ "path": "./keep-this"
358
+ }
359
+ // Deleted: { "name": "remove-this", "path": "./remove-this" }
360
+ ]
361
+ }
362
+ ```
363
+
364
+ **Add new repositories:**
365
+ ```json
366
+ {
367
+ "repositories": [
368
+ {
369
+ "name": "existing-repo",
370
+ "path": "./existing-repo"
371
+ },
372
+ {
373
+ "name": "new-repo",
374
+ "path": "./new-repo"
375
+ }
376
+ ]
377
+ }
378
+ ```
379
+
380
+ **Simplify to minimal format:**
381
+ ```json
382
+ {
383
+ "repositories": [
384
+ {
385
+ "name": "repo1",
386
+ "path": "./repo1"
387
+ // Removed: remote, defaultBranch, description, tags, group
388
+ }
389
+ ]
390
+ }
391
+ ```
392
+
393
+ ### Troubleshooting
394
+
395
+ #### Error: "path does not exist"
396
+
397
+ **Cause**: The specified path doesn't exist on the filesystem.
398
+
399
+ **Solution**: Check the path is correct and the directory exists:
400
+ ```bash
401
+ ls -la ./my-repo # Unix/Mac
402
+ dir .\my-repo # Windows
403
+ ```
404
+
405
+ #### Error: "is not a Git repository"
406
+
407
+ **Cause**: The path exists but doesn't contain a `.git` directory.
408
+
409
+ **Solution**: Initialize the directory as a Git repository:
410
+ ```bash
411
+ cd ./my-repo
412
+ git init
413
+ ```
414
+
415
+ #### Error: "appears to be a Git worktree"
416
+
417
+ **Cause**: The path contains a `.git` file instead of a directory (Git worktree).
418
+
419
+ **Solution**: Use the main repository path instead of the worktree path:
420
+ ```json
421
+ {
422
+ "name": "my-repo",
423
+ "path": "./main-repo" // Use main repo, not worktree
424
+ }
425
+ ```
426
+
427
+ #### Error: "Duplicate repository name"
428
+
429
+ **Cause**: Two repositories have the same name.
430
+
431
+ **Solution**: Ensure each repository has a unique name:
432
+ ```json
433
+ {
434
+ "repositories": [
435
+ { "name": "repo1", "path": "./path1" },
436
+ { "name": "repo2", "path": "./path2" } // Changed from "repo1"
437
+ ]
438
+ }
439
+ ```
440
+
441
+ #### Error: "Configuration file contains invalid JSON"
442
+
443
+ **Cause**: The JSON syntax is incorrect (missing comma, bracket, etc.).
444
+
445
+ **Solution**: Validate your JSON using a JSON validator or IDE:
446
+ - Check for missing commas between array elements
447
+ - Ensure all brackets and braces are properly closed
448
+ - Use a JSON formatter to identify syntax errors
449
+
450
+ ## Nested Repository Support
451
+
452
+ ### Overview
453
+
454
+ Nested repository support allows `kse` to discover and manage Git repositories that are nested inside other Git repositories. This is useful for projects with complex structures where components are organized as independent Git repositories within a parent repository.
455
+
456
+ **Example structure:**
457
+ ```
458
+ project-root/
459
+ ├── .git/ # Parent repository
460
+ ├── backend/
461
+ │ ├── .git/ # Backend repository
462
+ │ └── runtime/
463
+ │ └── component/
464
+ │ ├── HiveMind/
465
+ │ │ └── .git/ # Nested component repository
466
+ │ ├── mantle-udm/
467
+ │ │ └── .git/ # Nested component repository
468
+ │ └── MarbleERP/
469
+ │ └── .git/ # Nested component repository
470
+ └── frontend/
471
+ └── .git/ # Frontend repository
472
+ ```
473
+
474
+ ### Enabling Nested Scanning
475
+
476
+ Nested scanning is **enabled by default** in `kse repo init`. To explicitly control this behavior:
477
+
478
+ ```bash
479
+ # Enable nested scanning (default)
480
+ kse repo init --nested
481
+
482
+ # Disable nested scanning (stop at first repo)
483
+ kse repo init --no-nested
484
+ ```
485
+
486
+ ### Parent-Child Relationships
487
+
488
+ When nested repositories are discovered, `kse` tracks the parent-child relationship in the configuration file:
489
+
490
+ ```json
491
+ {
492
+ "version": "1.0",
493
+ "repositories": [
494
+ {
495
+ "name": "backend",
496
+ "path": "backend",
497
+ "remote": "https://github.com/user/backend.git",
498
+ "defaultBranch": "main",
499
+ "parent": null
500
+ },
501
+ {
502
+ "name": "HiveMind",
503
+ "path": "backend/runtime/component/HiveMind",
504
+ "remote": "https://github.com/user/HiveMind.git",
505
+ "defaultBranch": "master",
506
+ "parent": "backend"
507
+ },
508
+ {
509
+ "name": "mantle-udm",
510
+ "path": "backend/runtime/component/mantle-udm",
511
+ "remote": "https://github.com/moqui/mantle-udm.git",
512
+ "defaultBranch": "master",
513
+ "parent": "backend"
514
+ }
515
+ ]
516
+ }
517
+ ```
518
+
519
+ **Key points:**
520
+ - Top-level repositories have `parent: null`
521
+ - Nested repositories have `parent` set to the path of their parent repository
522
+ - The `parent` field is optional for backward compatibility
523
+
524
+ ### Display and Output
525
+
526
+ When nested repositories are present, commands display the parent-child relationship:
527
+
528
+ ```bash
529
+ $ kse repo status
530
+
531
+ ┌────────────┬─────────┬────────┬──────────┬───────┬────────┬─────────┐
532
+ │ Name │ Branch │ Status │ Modified │ Ahead │ Behind │ Parent │
533
+ ├────────────┼─────────┼────────┼──────────┼───────┼────────┼─────────┤
534
+ │ backend │ main │ Clean │ 0 │ 0 │ 0 │ - │
535
+ │ HiveMind │ master │ Dirty │ 2 │ 1 │ 0 │ backend │
536
+ │ mantle-udm │ master │ Clean │ 0 │ 0 │ 0 │ backend │
537
+ └────────────┴─────────┴────────┴──────────┴───────┴────────┴─────────┘
538
+ ```
539
+
540
+ The **Parent** column shows:
541
+ - `-` for top-level repositories
542
+ - Parent repository path for nested repositories
543
+
544
+ ### Use Cases
545
+
546
+ #### 1. Monorepo with Component Repositories
547
+
548
+ A monorepo that includes independent component repositories:
549
+
550
+ ```
551
+ monorepo/
552
+ ├── .git/ # Main monorepo
553
+ ├── packages/
554
+ │ ├── core/
555
+ │ │ └── .git/ # Core package as separate repo
556
+ │ └── plugins/
557
+ │ ├── plugin-a/
558
+ │ │ └── .git/ # Plugin A as separate repo
559
+ │ └── plugin-b/
560
+ │ └── .git/ # Plugin B as separate repo
561
+ ```
562
+
563
+ **Benefits:**
564
+ - Manage all repositories from the monorepo root
565
+ - Track status of all components at once
566
+ - Execute commands across all components
567
+
568
+ #### 2. Framework with Runtime Components
569
+
570
+ A framework that includes runtime components as separate repositories:
571
+
572
+ ```
573
+ framework/
574
+ ├── .git/ # Framework repository
575
+ └── runtime/
576
+ └── component/
577
+ ├── component-a/
578
+ │ └── .git/ # Component A
579
+ ├── component-b/
580
+ │ └── .git/ # Component B
581
+ └── component-c/
582
+ └── .git/ # Component C
583
+ ```
584
+
585
+ **Benefits:**
586
+ - Components can be developed independently
587
+ - Framework and components can have different release cycles
588
+ - Easy to update all components at once
589
+
590
+ #### 3. Multi-Tier Application
591
+
592
+ An application with frontend, backend, and shared libraries:
593
+
594
+ ```
595
+ app/
596
+ ├── .git/ # Application repository
597
+ ├── frontend/
598
+ │ └── .git/ # Frontend repository
599
+ ├── backend/
600
+ │ ├── .git/ # Backend repository
601
+ │ └── services/
602
+ │ ├── auth/
603
+ │ │ └── .git/ # Auth service
604
+ │ └── api/
605
+ │ └── .git/ # API service
606
+ └── shared/
607
+ └── .git/ # Shared libraries
608
+ ```
609
+
610
+ **Benefits:**
611
+ - Each tier can be developed by different teams
612
+ - Shared libraries can be versioned independently
613
+ - Unified management from application root
614
+
615
+ ### Directory Exclusions
616
+
617
+ To improve performance and avoid scanning unnecessary directories, `kse` automatically excludes common non-repository directories:
618
+
619
+ - `node_modules` - Node.js dependencies
620
+ - `.git` - Git metadata
621
+ - `build`, `dist`, `out` - Build outputs
622
+ - `target` - Java/Maven build output
623
+ - `.next`, `.nuxt` - Framework build caches
624
+ - `vendor` - PHP/Go dependencies
625
+
626
+ You can add custom exclusions using the `--exclude` option:
627
+
628
+ ```bash
629
+ kse repo init --exclude "node_modules,vendor,custom-dir"
630
+ ```
631
+
632
+ ### Circular Symlink Detection
633
+
634
+ `kse` automatically detects and skips circular symbolic links to prevent infinite loops during scanning:
635
+
636
+ ```bash
637
+ # This structure is handled safely
638
+ project/
639
+ ├── .git/
640
+ ├── link-to-parent -> ../project # Circular symlink
641
+ └── subdir/
642
+ └── .git/
643
+ ```
644
+
645
+ ### Performance Considerations
646
+
647
+ Nested scanning may take longer for large directory structures. To optimize:
648
+
649
+ 1. **Reduce scan depth**: Use `--max-depth` to limit how deep to scan
650
+ ```bash
651
+ kse repo init --max-depth 4
652
+ ```
653
+
654
+ 2. **Exclude directories**: Skip known non-repository directories
655
+ ```bash
656
+ kse repo init --exclude "node_modules,build,dist"
657
+ ```
658
+
659
+ 3. **Disable nested scanning**: If you only need top-level repositories
660
+ ```bash
661
+ kse repo init --no-nested
662
+ ```
663
+
664
+ ### Troubleshooting Nested Repositories
665
+
666
+ #### Missing Nested Repositories
667
+
668
+ If nested repositories are not discovered:
669
+
670
+ 1. **Check scan depth**: Increase `--max-depth` if repositories are deeply nested
671
+ ```bash
672
+ kse repo init --max-depth 5
673
+ ```
674
+
675
+ 2. **Verify nested scanning is enabled**: Ensure `--no-nested` is not used
676
+ ```bash
677
+ kse repo init --nested
678
+ ```
679
+
680
+ 3. **Check exclusions**: Ensure the directory is not excluded
681
+ ```bash
682
+ kse repo init --exclude "node_modules" # Don't exclude the parent directory
683
+ ```
684
+
685
+ #### Circular Reference Errors
686
+
687
+ If you see circular reference errors in health checks:
688
+
689
+ ```
690
+ Error: Circular parent reference detected: repo-a -> repo-b -> repo-a
691
+ ```
692
+
693
+ **Solution:**
694
+ 1. Open `.kiro/project-repos.json`
695
+ 2. Check the `parent` fields
696
+ 3. Remove or fix the circular reference
697
+ 4. Run `kse repo health` to verify
698
+
699
+ #### Parent Repository Not Found
700
+
701
+ If you see parent not found errors:
702
+
703
+ ```
704
+ Error: Parent repository not found: backend
705
+ ```
706
+
707
+ **Solution:**
708
+ 1. Ensure the parent repository is in the configuration
709
+ 2. Check that the `parent` field matches the parent's `path` field exactly
710
+ 3. Run `kse repo init` to regenerate the configuration
711
+
712
+ ### Backward Compatibility
713
+
714
+ Nested repository support is fully backward compatible:
715
+
716
+ - Existing configurations without `parent` fields work unchanged
717
+ - Repositories without `parent` are treated as top-level repositories
718
+ - The `parent` field is optional and can be omitted
719
+ - Old configurations can be upgraded by running `kse repo init`
720
+
721
+ ### Migration from Non-Nested to Nested
722
+
723
+ To migrate an existing configuration to use nested scanning:
724
+
725
+ ```bash
726
+ # Backup existing configuration
727
+ cp .kiro/project-repos.json .kiro/project-repos.json.backup
728
+
729
+ # Re-initialize with nested scanning
730
+ kse repo init --nested -y
731
+
732
+ # Verify the new configuration
733
+ kse repo status
734
+ kse repo health
735
+ ```
736
+
737
+ ## Commands
738
+
739
+ ### `kse repo init`
740
+
741
+ Initialize repository configuration by scanning the project directory.
742
+
743
+ **Usage:**
744
+ ```bash
745
+ kse repo init [options]
746
+ ```
747
+
748
+ **Options:**
749
+ - `-y, --yes`: Skip confirmation prompts
750
+ - `--max-depth <depth>`: Maximum directory depth to scan (default: 3)
751
+ - `--exclude <paths>`: Comma-separated paths to exclude from scanning
752
+ - `--nested`: Enable nested repository scanning (default)
753
+ - `--no-nested`: Disable nested repository scanning
754
+
755
+ **Behavior:**
756
+ - Scans project directory recursively for Git repositories
757
+ - Excludes `.kiro` directory and common build directories (node_modules, build, dist, etc.)
758
+ - Extracts remote URL from `origin` remote (or first available remote)
759
+ - Detects current branch
760
+ - Prompts for confirmation if configuration already exists
761
+ - **Nested scanning** (default): Continues scanning inside Git repositories to find nested subrepositories
762
+ - **Non-nested scanning**: Stops at the first Git repository found in each directory branch
763
+
764
+ **Example:**
765
+ ```bash
766
+ # Initialize with default settings (nested scanning enabled)
767
+ kse repo init
768
+
769
+ # Skip confirmation prompts
770
+ kse repo init -y
771
+
772
+ # Disable nested repository scanning
773
+ kse repo init --no-nested
774
+
775
+ # Scan deeper directory structure
776
+ kse repo init --max-depth 5
777
+
778
+ # Exclude specific directories
779
+ kse repo init --exclude "node_modules,vendor"
780
+ ```
781
+
782
+ ### `kse repo status`
783
+
784
+ Display the Git status of all repositories.
785
+
786
+ **Usage:**
787
+ ```bash
788
+ kse repo status [options]
789
+ ```
790
+
791
+ **Options:**
792
+ - `--verbose`: Show detailed file-level changes
793
+ - `--json`: Output in JSON format
794
+
795
+ **Output includes:**
796
+ - Current branch name
797
+ - Number of modified, added, and deleted files
798
+ - Commits ahead/behind remote
799
+ - Clean/dirty status
800
+ - Error status for inaccessible repositories
801
+
802
+ **Example:**
803
+ ```bash
804
+ # Basic status
805
+ kse repo status
806
+
807
+ # Detailed status with file changes
808
+ kse repo status --verbose
809
+
810
+ # JSON output for scripting
811
+ kse repo status --json
812
+ ```
813
+
814
+ ### `kse repo exec`
815
+
816
+ Execute a Git command in all repositories.
817
+
818
+ **Usage:**
819
+ ```bash
820
+ kse repo exec "<command>" [options]
821
+ ```
822
+
823
+ **Options:**
824
+ - `--dry-run`: Show commands without executing
825
+ - `--continue-on-error`: Continue even if commands fail (default: true)
826
+
827
+ **Behavior:**
828
+ - Executes command sequentially in each repository
829
+ - Displays output for each repository with clear separators
830
+ - Continues with remaining repositories if one fails
831
+ - Shows summary of successes and failures
832
+
833
+ **Example:**
834
+ ```bash
835
+ # Pull latest changes
836
+ kse repo exec "git pull"
837
+
838
+ # Create and checkout new branch
839
+ kse repo exec "git checkout -b feature/new-feature"
840
+
841
+ # Preview without executing
842
+ kse repo exec "git push" --dry-run
843
+
844
+ # Fetch all remotes
845
+ kse repo exec "git fetch --all"
846
+
847
+ # Show commit history
848
+ kse repo exec "git log --oneline -5"
849
+ ```
850
+
851
+ ### `kse repo health`
852
+
853
+ Perform health checks on all repositories.
854
+
855
+ **Usage:**
856
+ ```bash
857
+ kse repo health [options]
858
+ ```
859
+
860
+ **Options:**
861
+ - `--json`: Output in JSON format
862
+
863
+ **Checks performed:**
864
+ - Path exists and is accessible
865
+ - Directory is a valid Git repository
866
+ - Remote URL is reachable (network check)
867
+ - Default branch exists
868
+
869
+ **Output:**
870
+ - Individual check results for each repository
871
+ - Specific error messages for failures
872
+ - Overall health summary
873
+
874
+ **Example:**
875
+ ```bash
876
+ # Run health check
877
+ kse repo health
878
+
879
+ # JSON output for automation
880
+ kse repo health --json
881
+ ```
882
+
883
+ ## Common Workflows
884
+
885
+ ### Workflow 1: Daily Development Sync
886
+
887
+ Start your day by syncing all repositories:
888
+
889
+ ```bash
890
+ # Check status of all repos
891
+ kse repo status
892
+
893
+ # Pull latest changes
894
+ kse repo exec "git pull"
895
+
896
+ # Verify everything is healthy
897
+ kse repo health
898
+ ```
899
+
900
+ ### Workflow 2: Feature Branch Creation
901
+
902
+ Create a feature branch across all repositories:
903
+
904
+ ```bash
905
+ # Create and checkout feature branch
906
+ kse repo exec "git checkout -b feature/user-authentication"
907
+
908
+ # Verify all repos are on the new branch
909
+ kse repo status
910
+ ```
911
+
912
+ ### Workflow 3: Release Preparation
913
+
914
+ Prepare all repositories for a release:
915
+
916
+ ```bash
917
+ # Ensure all repos are clean
918
+ kse repo status
919
+
920
+ # Pull latest changes
921
+ kse repo exec "git pull"
922
+
923
+ # Create release branch
924
+ kse repo exec "git checkout -b release/v1.2.0"
925
+
926
+ # Tag the release
927
+ kse repo exec "git tag -a v1.2.0 -m 'Release v1.2.0'"
928
+
929
+ # Push branches and tags
930
+ kse repo exec "git push origin release/v1.2.0"
931
+ kse repo exec "git push --tags"
932
+ ```
933
+
934
+ ### Workflow 4: Troubleshooting
935
+
936
+ Diagnose issues across repositories:
937
+
938
+ ```bash
939
+ # Run health check
940
+ kse repo health
941
+
942
+ # Check detailed status
943
+ kse repo status --verbose
944
+
945
+ # Verify remote connectivity
946
+ kse repo exec "git remote -v"
947
+
948
+ # Check for uncommitted changes
949
+ kse repo exec "git status --short"
950
+ ```
951
+
952
+ ### Workflow 5: Bulk Updates
953
+
954
+ Update dependencies or configuration across all repos:
955
+
956
+ ```bash
957
+ # Update npm dependencies
958
+ kse repo exec "npm update"
959
+
960
+ # Run tests
961
+ kse repo exec "npm test"
962
+
963
+ # Commit changes
964
+ kse repo exec "git add ."
965
+ kse repo exec "git commit -m 'chore: update dependencies'"
966
+
967
+ # Push changes
968
+ kse repo exec "git push"
969
+ ```
970
+
971
+ ## Manual Configuration
972
+
973
+ You can manually edit `.kiro/project-repos.json` to:
974
+
975
+ ### Add a Repository
976
+
977
+ ```json
978
+ {
979
+ "repositories": [
980
+ {
981
+ "name": "new-service",
982
+ "path": "services/new-service",
983
+ "remote": "https://github.com/user/new-service.git",
984
+ "defaultBranch": "main",
985
+ "description": "New microservice",
986
+ "tags": ["service", "api"],
987
+ "group": "server"
988
+ }
989
+ ]
990
+ }
991
+ ```
992
+
993
+ ### Organize with Groups
994
+
995
+ ```json
996
+ {
997
+ "groups": {
998
+ "frontend": {
999
+ "description": "Frontend applications",
1000
+ "color": "blue"
1001
+ },
1002
+ "backend": {
1003
+ "description": "Backend services",
1004
+ "color": "green"
1005
+ },
1006
+ "infrastructure": {
1007
+ "description": "Infrastructure and DevOps",
1008
+ "color": "yellow"
1009
+ }
1010
+ }
1011
+ }
1012
+ ```
1013
+
1014
+ ### Add Metadata
1015
+
1016
+ ```json
1017
+ {
1018
+ "repositories": [
1019
+ {
1020
+ "name": "frontend",
1021
+ "path": "packages/frontend",
1022
+ "remote": "https://github.com/user/frontend.git",
1023
+ "defaultBranch": "main",
1024
+ "description": "React frontend with TypeScript",
1025
+ "tags": ["react", "typescript", "ui"],
1026
+ "group": "frontend",
1027
+ "metadata": {
1028
+ "maintainer": "frontend-team@example.com",
1029
+ "ci": "github-actions",
1030
+ "deployment": "vercel"
1031
+ }
1032
+ }
1033
+ ]
1034
+ }
1035
+ ```
1036
+
1037
+ ## Troubleshooting
1038
+
1039
+ ### Directory Not Detected as Repository
1040
+
1041
+ **Problem:**
1042
+ `kse repo init` doesn't detect a directory that you know contains a Git repository.
1043
+
1044
+ **Cause:**
1045
+ The scanner only identifies directories that contain a `.git` subdirectory. Regular subdirectories within a Git repository are not detected as separate repositories.
1046
+
1047
+ **Solution:**
1048
+ 1. Verify the directory has a `.git` subdirectory:
1049
+ ```bash
1050
+ ls -la your-directory/.git
1051
+ ```
1052
+ 2. If `.git` is missing, the directory is not a Git repository root. Initialize it:
1053
+ ```bash
1054
+ cd your-directory
1055
+ git init
1056
+ ```
1057
+ 3. If you're working with Git worktrees (where `.git` is a file, not a directory), note that worktrees are intentionally excluded from detection.
1058
+
1059
+ **Note:** This behavior was fixed in v1.20.5 to eliminate false positives where regular subdirectories were incorrectly identified as repositories.
1060
+
1061
+ ### Too Many Repositories Detected
1062
+
1063
+ **Problem:**
1064
+ `kse repo init` detects many more repositories than you actually have (e.g., 34 detected when you only have 8).
1065
+
1066
+ **Cause:**
1067
+ If you're using a version prior to v1.20.5, the scanner may incorrectly identify regular subdirectories as repositories.
1068
+
1069
+ **Solution:**
1070
+ 1. Upgrade to v1.20.5 or later:
1071
+ ```bash
1072
+ npm install -g kiro-spec-engine@latest
1073
+ ```
1074
+ 2. Re-run the initialization:
1075
+ ```bash
1076
+ kse repo init
1077
+ ```
1078
+ 3. The scanner will now only detect directories with `.git` subdirectories.
1079
+
1080
+ ### Configuration File Not Found
1081
+
1082
+ **Error:**
1083
+ ```
1084
+ Error: Configuration file not found at .kiro/project-repos.json
1085
+ ```
1086
+
1087
+ **Solution:**
1088
+ Run `kse repo init` to create the configuration file.
1089
+
1090
+ ### Repository Path Not Found
1091
+
1092
+ **Error:**
1093
+ ```
1094
+ Error: Repository path does not exist: packages/frontend
1095
+ ```
1096
+
1097
+ **Solution:**
1098
+ 1. Verify the path in `.kiro/project-repos.json`
1099
+ 2. Ensure the repository is cloned
1100
+ 3. Update the path if the repository moved
1101
+
1102
+ ### Remote Not Reachable
1103
+
1104
+ **Error:**
1105
+ ```
1106
+ Warning: Remote not reachable for repository: backend
1107
+ ```
1108
+
1109
+ **Solution:**
1110
+ 1. Check network connectivity
1111
+ 2. Verify remote URL: `git remote -v`
1112
+ 3. Check authentication (SSH keys, tokens)
1113
+ 4. Update remote URL if changed
1114
+
1115
+ ### Invalid Configuration
1116
+
1117
+ **Error:**
1118
+ ```
1119
+ Error: Configuration validation failed:
1120
+ - Duplicate repository name: frontend
1121
+ - Missing required field: path
1122
+ ```
1123
+
1124
+ **Solution:**
1125
+ 1. Open `.kiro/project-repos.json`
1126
+ 2. Fix validation errors
1127
+ 3. Ensure all required fields are present
1128
+ 4. Remove duplicate names
1129
+
1130
+ ### Git Command Failed
1131
+
1132
+ **Error:**
1133
+ ```
1134
+ Error in backend: fatal: not a git repository
1135
+ ```
1136
+
1137
+ **Solution:**
1138
+ 1. Verify the path is a Git repository
1139
+ 2. Run `git init` if needed
1140
+ 3. Check file permissions
1141
+ 4. Run `kse repo health` to diagnose
1142
+
1143
+ ### Permission Denied
1144
+
1145
+ **Error:**
1146
+ ```
1147
+ Error: Permission denied accessing repository: frontend
1148
+ ```
1149
+
1150
+ **Solution:**
1151
+ 1. Check file system permissions
1152
+ 2. Verify you have read/write access
1153
+ 3. Run as appropriate user
1154
+ 4. Check Git credentials
1155
+
1156
+ ## Best Practices
1157
+
1158
+ ### 1. Keep Configuration in Version Control
1159
+
1160
+ Add `.kiro/project-repos.json` to your main repository:
1161
+
1162
+ ```bash
1163
+ git add .kiro/project-repos.json
1164
+ git commit -m "docs: add multi-repo configuration"
1165
+ ```
1166
+
1167
+ ### 2. Use Descriptive Names
1168
+
1169
+ Choose clear, consistent repository names:
1170
+
1171
+ ```json
1172
+ {
1173
+ "name": "user-service", // ✓ Good
1174
+ "name": "us", // ✗ Too short
1175
+ "name": "the-user-service-api" // ✗ Too verbose
1176
+ }
1177
+ ```
1178
+
1179
+ ### 3. Organize with Groups
1180
+
1181
+ Group related repositories for better organization:
1182
+
1183
+ ```json
1184
+ {
1185
+ "groups": {
1186
+ "core": { "description": "Core services" },
1187
+ "tools": { "description": "Development tools" },
1188
+ "docs": { "description": "Documentation" }
1189
+ }
1190
+ }
1191
+ ```
1192
+
1193
+ ### 4. Add Meaningful Descriptions
1194
+
1195
+ Document each repository's purpose:
1196
+
1197
+ ```json
1198
+ {
1199
+ "name": "auth-service",
1200
+ "description": "OAuth2 authentication service with JWT support"
1201
+ }
1202
+ ```
1203
+
1204
+ ### 5. Use Tags for Filtering
1205
+
1206
+ Tag repositories for easy filtering (future feature):
1207
+
1208
+ ```json
1209
+ {
1210
+ "tags": ["microservice", "nodejs", "production"]
1211
+ }
1212
+ ```
1213
+
1214
+ ### 6. Regular Health Checks
1215
+
1216
+ Run health checks regularly:
1217
+
1218
+ ```bash
1219
+ # Add to your daily workflow
1220
+ kse repo health
1221
+ ```
1222
+
1223
+ ### 7. Dry-Run Before Bulk Operations
1224
+
1225
+ Always preview destructive operations:
1226
+
1227
+ ```bash
1228
+ # Preview before executing
1229
+ kse repo exec "git push --force" --dry-run
1230
+ ```
1231
+
1232
+ ### 8. Document Custom Workflows
1233
+
1234
+ Create scripts for common workflows:
1235
+
1236
+ ```bash
1237
+ #!/bin/bash
1238
+ # sync-all.sh - Sync all repositories
1239
+
1240
+ echo "Checking status..."
1241
+ kse repo status
1242
+
1243
+ echo "Pulling changes..."
1244
+ kse repo exec "git pull"
1245
+
1246
+ echo "Running health check..."
1247
+ kse repo health
1248
+ ```
1249
+
1250
+ ## Advanced Usage
1251
+
1252
+ ### Scripting with JSON Output
1253
+
1254
+ Use JSON output for automation:
1255
+
1256
+ ```bash
1257
+ # Get status as JSON
1258
+ kse repo status --json > status.json
1259
+
1260
+ # Parse with jq
1261
+ kse repo status --json | jq '.[] | select(.isClean == false)'
1262
+
1263
+ # Check health in CI/CD
1264
+ if kse repo health --json | jq -e '.[] | select(.healthy == false)' > /dev/null; then
1265
+ echo "Health check failed!"
1266
+ exit 1
1267
+ fi
1268
+ ```
1269
+
1270
+ ### Integration with CI/CD
1271
+
1272
+ Example GitHub Actions workflow:
1273
+
1274
+ ```yaml
1275
+ name: Multi-Repo Check
1276
+
1277
+ on: [push, pull_request]
1278
+
1279
+ jobs:
1280
+ check:
1281
+ runs-on: ubuntu-latest
1282
+ steps:
1283
+ - uses: actions/checkout@v2
1284
+
1285
+ - name: Install kse
1286
+ run: npm install -g kiro-spec-engine
1287
+
1288
+ - name: Check repository health
1289
+ run: kse repo health
1290
+
1291
+ - name: Check repository status
1292
+ run: kse repo status
1293
+ ```
1294
+
1295
+ ### Custom Configuration Validation
1296
+
1297
+ Validate configuration before committing:
1298
+
1299
+ ```bash
1300
+ # Add to pre-commit hook
1301
+ #!/bin/bash
1302
+ if [ -f .kiro/project-repos.json ]; then
1303
+ kse repo health || exit 1
1304
+ fi
1305
+ ```
1306
+
1307
+ ## Limitations and Future Enhancements
1308
+
1309
+ ### Current Limitations
1310
+
1311
+ - Sequential execution only (no parallel operations)
1312
+ - No filtering by group or tag
1313
+ - No support for nested submodules
1314
+ - Limited to Git repositories
1315
+
1316
+ ### Planned Enhancements (Phase 2)
1317
+
1318
+ - **Parallel Execution**: Execute commands in parallel for faster operations
1319
+ - **Filtering**: Filter operations by group, tag, or status
1320
+ - **Branch Management**: Dedicated commands for branch operations
1321
+ - **Tag Management**: Bulk tag creation and management
1322
+ - **Reporting**: HTML reports and export to CSV/JSON
1323
+ - **CI/CD Integration**: Pre-built integrations for popular CI/CD platforms
1324
+
1325
+ ## Related Documentation
1326
+
1327
+ - [Command Reference](command-reference.md) - Complete command documentation
1328
+ - [Spec Workflow](spec-workflow.md) - Understanding Specs
1329
+ - [Environment Management](environment-management-guide.md) - Environment configuration
1330
+ - [Workspace Management](workspace-management-guide.md) - Multi-workspace support
1331
+
1332
+ ## Support
1333
+
1334
+ If you encounter issues or have questions:
1335
+
1336
+ - 📖 Check the [Troubleshooting Guide](troubleshooting.md)
1337
+ - 🐛 Report bugs on [GitHub Issues](https://github.com/heguangyong/scene-capability-engine/issues)
1338
+ - 💬 Ask questions in [GitHub Discussions](https://github.com/heguangyong/scene-capability-engine/discussions)
1339
+
1340
+ ---
1341
+
1342
+ **Version**: 1.20.0
1343
+ **Last Updated**: 2026-02-01
1344
+ **Changes**: Added nested repository support documentation