agent-sdd 1.0.3

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 (304) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +1028 -0
  3. package/README.ru.md +1046 -0
  4. package/dist/cli.d.ts +3 -0
  5. package/dist/cli.js +867 -0
  6. package/dist/features/approve/adapters/inbound/CliApproveHandler.d.ts +17 -0
  7. package/dist/features/approve/adapters/inbound/CliApproveHandler.js +108 -0
  8. package/dist/features/approve/adapters/outbound/NodeApproveFileSystem.d.ts +8 -0
  9. package/dist/features/approve/adapters/outbound/NodeApproveFileSystem.js +147 -0
  10. package/dist/features/approve/adapters/outbound/NodePlanFileWriter.d.ts +6 -0
  11. package/dist/features/approve/adapters/outbound/NodePlanFileWriter.js +92 -0
  12. package/dist/features/approve/adapters/outbound/SystemApproveClock.d.ts +4 -0
  13. package/dist/features/approve/adapters/outbound/SystemApproveClock.js +5 -0
  14. package/dist/features/approve/application/ApplyApproval.d.ts +19 -0
  15. package/dist/features/approve/application/ApplyApproval.js +30 -0
  16. package/dist/features/approve/application/WriteAttestation.d.ts +19 -0
  17. package/dist/features/approve/application/WriteAttestation.js +23 -0
  18. package/dist/features/approve/domain/ApproveRequest.d.ts +24 -0
  19. package/dist/features/approve/domain/ApproveRequest.js +24 -0
  20. package/dist/features/approve/domain/Rewrite.d.ts +1 -0
  21. package/dist/features/approve/domain/Rewrite.js +6 -0
  22. package/dist/features/approve/ports/inbound/ApproveCommand.d.ts +10 -0
  23. package/dist/features/approve/ports/inbound/ApproveCommand.js +1 -0
  24. package/dist/features/approve/ports/outbound/ApproveClock.d.ts +3 -0
  25. package/dist/features/approve/ports/outbound/ApproveClock.js +1 -0
  26. package/dist/features/approve/ports/outbound/ApproveConfigPort.d.ts +4 -0
  27. package/dist/features/approve/ports/outbound/ApproveConfigPort.js +1 -0
  28. package/dist/features/approve/ports/outbound/ApproveFileSystem.d.ts +8 -0
  29. package/dist/features/approve/ports/outbound/ApproveFileSystem.js +1 -0
  30. package/dist/features/approve/ports/outbound/PlanFileWriter.d.ts +13 -0
  31. package/dist/features/approve/ports/outbound/PlanFileWriter.js +1 -0
  32. package/dist/features/check/adapters/inbound/CliCheckHandler.d.ts +8 -0
  33. package/dist/features/check/adapters/inbound/CliCheckHandler.js +62 -0
  34. package/dist/features/check/adapters/outbound/ChildProcessCheckGit.d.ts +8 -0
  35. package/dist/features/check/adapters/outbound/ChildProcessCheckGit.js +112 -0
  36. package/dist/features/check/adapters/outbound/NodeCheckFileReader.d.ts +7 -0
  37. package/dist/features/check/adapters/outbound/NodeCheckFileReader.js +44 -0
  38. package/dist/features/check/application/CheckBaseline.d.ts +28 -0
  39. package/dist/features/check/application/CheckBaseline.js +54 -0
  40. package/dist/features/check/domain/BaselineComparison.d.ts +1 -0
  41. package/dist/features/check/domain/BaselineComparison.js +2 -0
  42. package/dist/features/check/ports/inbound/CheckCommand.d.ts +4 -0
  43. package/dist/features/check/ports/inbound/CheckCommand.js +1 -0
  44. package/dist/features/check/ports/outbound/CheckConfigPort.d.ts +4 -0
  45. package/dist/features/check/ports/outbound/CheckConfigPort.js +1 -0
  46. package/dist/features/check/ports/outbound/CheckGitPort.d.ts +7 -0
  47. package/dist/features/check/ports/outbound/CheckGitPort.js +1 -0
  48. package/dist/features/check/ports/outbound/CheckSpecPort.d.ts +9 -0
  49. package/dist/features/check/ports/outbound/CheckSpecPort.js +1 -0
  50. package/dist/features/doctor/adapters/inbound/CliDoctorHandler.d.ts +8 -0
  51. package/dist/features/doctor/adapters/inbound/CliDoctorHandler.js +77 -0
  52. package/dist/features/doctor/adapters/outbound/NodeRegistryReader.d.ts +5 -0
  53. package/dist/features/doctor/adapters/outbound/NodeRegistryReader.js +40 -0
  54. package/dist/features/doctor/application/RunDoctor.d.ts +30 -0
  55. package/dist/features/doctor/application/RunDoctor.js +78 -0
  56. package/dist/features/doctor/domain/RegistryRow.d.ts +23 -0
  57. package/dist/features/doctor/domain/RegistryRow.js +114 -0
  58. package/dist/features/doctor/domain/SemverRange.d.ts +7 -0
  59. package/dist/features/doctor/domain/SemverRange.js +82 -0
  60. package/dist/features/doctor/ports/inbound/DoctorCommand.d.ts +8 -0
  61. package/dist/features/doctor/ports/inbound/DoctorCommand.js +1 -0
  62. package/dist/features/doctor/ports/outbound/RegistryReader.d.ts +12 -0
  63. package/dist/features/doctor/ports/outbound/RegistryReader.js +1 -0
  64. package/dist/features/finalize/adapters/inbound/CliFinalizeHandler.d.ts +8 -0
  65. package/dist/features/finalize/adapters/inbound/CliFinalizeHandler.js +80 -0
  66. package/dist/features/finalize/adapters/outbound/NodeFinalizeFileSystem.d.ts +11 -0
  67. package/dist/features/finalize/adapters/outbound/NodeFinalizeFileSystem.js +167 -0
  68. package/dist/features/finalize/adapters/outbound/NodePlanRepo.d.ts +7 -0
  69. package/dist/features/finalize/adapters/outbound/NodePlanRepo.js +82 -0
  70. package/dist/features/finalize/adapters/outbound/SystemFinalizeClock.d.ts +4 -0
  71. package/dist/features/finalize/adapters/outbound/SystemFinalizeClock.js +5 -0
  72. package/dist/features/finalize/application/RunFinalize.d.ts +34 -0
  73. package/dist/features/finalize/application/RunFinalize.js +98 -0
  74. package/dist/features/finalize/domain/ValidateFinalizeGraph.d.ts +9 -0
  75. package/dist/features/finalize/domain/ValidateFinalizeGraph.js +86 -0
  76. package/dist/features/finalize/ports/inbound/FinalizeCommand.d.ts +7 -0
  77. package/dist/features/finalize/ports/inbound/FinalizeCommand.js +1 -0
  78. package/dist/features/finalize/ports/outbound/FinalizeClock.d.ts +3 -0
  79. package/dist/features/finalize/ports/outbound/FinalizeClock.js +1 -0
  80. package/dist/features/finalize/ports/outbound/FinalizeConfigPort.d.ts +4 -0
  81. package/dist/features/finalize/ports/outbound/FinalizeConfigPort.js +1 -0
  82. package/dist/features/finalize/ports/outbound/FinalizeFileSystem.d.ts +14 -0
  83. package/dist/features/finalize/ports/outbound/FinalizeFileSystem.js +1 -0
  84. package/dist/features/finalize/ports/outbound/PlanRepo.d.ts +21 -0
  85. package/dist/features/finalize/ports/outbound/PlanRepo.js +1 -0
  86. package/dist/features/install/adapters/inbound/CliInstallHandler.d.ts +8 -0
  87. package/dist/features/install/adapters/inbound/CliInstallHandler.js +54 -0
  88. package/dist/features/install/adapters/outbound/NodeInstallSource.d.ts +7 -0
  89. package/dist/features/install/adapters/outbound/NodeInstallSource.js +24 -0
  90. package/dist/features/install/adapters/outbound/NodeInstallTargetFs.d.ts +7 -0
  91. package/dist/features/install/adapters/outbound/NodeInstallTargetFs.js +30 -0
  92. package/dist/features/install/application/InstallRules.d.ts +10 -0
  93. package/dist/features/install/application/InstallRules.js +73 -0
  94. package/dist/features/install/domain/InstallPlan.d.ts +27 -0
  95. package/dist/features/install/domain/InstallPlan.js +168 -0
  96. package/dist/features/install/domain/InstallResult.d.ts +23 -0
  97. package/dist/features/install/domain/InstallResult.js +1 -0
  98. package/dist/features/install/domain/InstallTarget.d.ts +6 -0
  99. package/dist/features/install/domain/InstallTarget.js +7 -0
  100. package/dist/features/install/domain/ManagedBlock.d.ts +3 -0
  101. package/dist/features/install/domain/ManagedBlock.js +20 -0
  102. package/dist/features/install/domain/RuleManifest.d.ts +17 -0
  103. package/dist/features/install/domain/RuleManifest.js +69 -0
  104. package/dist/features/install/domain/SettingsMerge.d.ts +5 -0
  105. package/dist/features/install/domain/SettingsMerge.js +43 -0
  106. package/dist/features/install/ports/inbound/InstallCommand.d.ts +10 -0
  107. package/dist/features/install/ports/inbound/InstallCommand.js +1 -0
  108. package/dist/features/install/ports/outbound/InstallSource.d.ts +4 -0
  109. package/dist/features/install/ports/outbound/InstallSource.js +1 -0
  110. package/dist/features/install/ports/outbound/InstallTargetFs.d.ts +6 -0
  111. package/dist/features/install/ports/outbound/InstallTargetFs.js +1 -0
  112. package/dist/features/lint/adapters/inbound/CliLintHandler.d.ts +8 -0
  113. package/dist/features/lint/adapters/inbound/CliLintHandler.js +61 -0
  114. package/dist/features/lint/adapters/outbound/NodeLintFileReader.d.ts +7 -0
  115. package/dist/features/lint/adapters/outbound/NodeLintFileReader.js +165 -0
  116. package/dist/features/lint/application/RunLint.d.ts +10 -0
  117. package/dist/features/lint/application/RunLint.js +100 -0
  118. package/dist/features/lint/domain/Diagnostic.d.ts +1 -0
  119. package/dist/features/lint/domain/Diagnostic.js +2 -0
  120. package/dist/features/lint/domain/Record.d.ts +1 -0
  121. package/dist/features/lint/domain/Record.js +5 -0
  122. package/dist/features/lint/domain/Rules.d.ts +1 -0
  123. package/dist/features/lint/domain/Rules.js +2 -0
  124. package/dist/features/lint/domain/SpecParser.d.ts +1 -0
  125. package/dist/features/lint/domain/SpecParser.js +2 -0
  126. package/dist/features/lint/ports/inbound/LintCommand.d.ts +4 -0
  127. package/dist/features/lint/ports/inbound/LintCommand.js +1 -0
  128. package/dist/features/lint/ports/outbound/LintConfigPort.d.ts +4 -0
  129. package/dist/features/lint/ports/outbound/LintConfigPort.js +1 -0
  130. package/dist/features/lint/ports/outbound/LintFileReader.d.ts +10 -0
  131. package/dist/features/lint/ports/outbound/LintFileReader.js +1 -0
  132. package/dist/features/plan/adapters/inbound/CliPlanShowHandler.d.ts +8 -0
  133. package/dist/features/plan/adapters/inbound/CliPlanShowHandler.js +73 -0
  134. package/dist/features/plan/adapters/outbound/NodePlanReader.d.ts +7 -0
  135. package/dist/features/plan/adapters/outbound/NodePlanReader.js +68 -0
  136. package/dist/features/plan/application/ShowPlan.d.ts +7 -0
  137. package/dist/features/plan/application/ShowPlan.js +4 -0
  138. package/dist/features/plan/ports/inbound/PlanShowCommand.d.ts +7 -0
  139. package/dist/features/plan/ports/inbound/PlanShowCommand.js +1 -0
  140. package/dist/features/plan/ports/outbound/PlanConfigPort.d.ts +4 -0
  141. package/dist/features/plan/ports/outbound/PlanConfigPort.js +1 -0
  142. package/dist/features/plan/ports/outbound/PlanReader.d.ts +19 -0
  143. package/dist/features/plan/ports/outbound/PlanReader.js +1 -0
  144. package/dist/features/ready/adapters/inbound/CliReadyHandler.d.ts +8 -0
  145. package/dist/features/ready/adapters/inbound/CliReadyHandler.js +79 -0
  146. package/dist/features/ready/adapters/outbound/ChildProcessReadyGit.d.ts +9 -0
  147. package/dist/features/ready/adapters/outbound/ChildProcessReadyGit.js +113 -0
  148. package/dist/features/ready/adapters/outbound/NodeReadyFileSystem.d.ts +8 -0
  149. package/dist/features/ready/adapters/outbound/NodeReadyFileSystem.js +159 -0
  150. package/dist/features/ready/application/RunReady.d.ts +16 -0
  151. package/dist/features/ready/application/RunReady.js +572 -0
  152. package/dist/features/ready/domain/AggregatedRules.d.ts +16 -0
  153. package/dist/features/ready/domain/AggregatedRules.js +42 -0
  154. package/dist/features/ready/domain/MarkerParser.d.ts +17 -0
  155. package/dist/features/ready/domain/MarkerParser.js +108 -0
  156. package/dist/features/ready/domain/PartitionResolver.d.ts +1 -0
  157. package/dist/features/ready/domain/PartitionResolver.js +5 -0
  158. package/dist/features/ready/domain/ReadyInput.d.ts +6 -0
  159. package/dist/features/ready/domain/ReadyInput.js +1 -0
  160. package/dist/features/ready/domain/ReadyViolation.d.ts +38 -0
  161. package/dist/features/ready/domain/ReadyViolation.js +19 -0
  162. package/dist/features/ready/domain/Rules.d.ts +22 -0
  163. package/dist/features/ready/domain/Rules.js +243 -0
  164. package/dist/features/ready/domain/SpecDiff.d.ts +33 -0
  165. package/dist/features/ready/domain/SpecDiff.js +321 -0
  166. package/dist/features/ready/ports/inbound/ReadyCommand.d.ts +4 -0
  167. package/dist/features/ready/ports/inbound/ReadyCommand.js +1 -0
  168. package/dist/features/ready/ports/outbound/ReadyConfigPort.d.ts +4 -0
  169. package/dist/features/ready/ports/outbound/ReadyConfigPort.js +1 -0
  170. package/dist/features/ready/ports/outbound/ReadyFileReader.d.ts +12 -0
  171. package/dist/features/ready/ports/outbound/ReadyFileReader.js +1 -0
  172. package/dist/features/ready/ports/outbound/ReadyGitPort.d.ts +10 -0
  173. package/dist/features/ready/ports/outbound/ReadyGitPort.js +5 -0
  174. package/dist/features/record/adapters/inbound/CliRecordHandler.d.ts +10 -0
  175. package/dist/features/record/adapters/inbound/CliRecordHandler.js +111 -0
  176. package/dist/features/record/adapters/outbound/NodeRecordFileSystem.d.ts +9 -0
  177. package/dist/features/record/adapters/outbound/NodeRecordFileSystem.js +152 -0
  178. package/dist/features/record/application/AddRecord.d.ts +11 -0
  179. package/dist/features/record/application/AddRecord.js +84 -0
  180. package/dist/features/record/application/GetRecord.d.ts +8 -0
  181. package/dist/features/record/application/GetRecord.js +22 -0
  182. package/dist/features/record/application/ListRecords.d.ts +9 -0
  183. package/dist/features/record/application/ListRecords.js +24 -0
  184. package/dist/features/record/application/SetRecord.d.ts +11 -0
  185. package/dist/features/record/application/SetRecord.js +68 -0
  186. package/dist/features/record/domain/RecordBody.d.ts +12 -0
  187. package/dist/features/record/domain/RecordBody.js +66 -0
  188. package/dist/features/record/domain/RecordPartition.d.ts +1 -0
  189. package/dist/features/record/domain/RecordPartition.js +7 -0
  190. package/dist/features/record/domain/RecordSlice.d.ts +7 -0
  191. package/dist/features/record/domain/RecordSlice.js +1 -0
  192. package/dist/features/record/domain/RecordSummary.d.ts +11 -0
  193. package/dist/features/record/domain/RecordSummary.js +13 -0
  194. package/dist/features/record/domain/RecordWrite.d.ts +14 -0
  195. package/dist/features/record/domain/RecordWrite.js +8 -0
  196. package/dist/features/record/ports/inbound/RecordCommand.d.ts +19 -0
  197. package/dist/features/record/ports/inbound/RecordCommand.js +1 -0
  198. package/dist/features/record/ports/outbound/RecordConfigPort.d.ts +4 -0
  199. package/dist/features/record/ports/outbound/RecordConfigPort.js +1 -0
  200. package/dist/features/record/ports/outbound/RecordFileReader.d.ts +10 -0
  201. package/dist/features/record/ports/outbound/RecordFileReader.js +1 -0
  202. package/dist/features/record/ports/outbound/RecordFileWriter.d.ts +6 -0
  203. package/dist/features/record/ports/outbound/RecordFileWriter.js +1 -0
  204. package/dist/features/refresh/adapters/inbound/CliRefreshHandler.d.ts +8 -0
  205. package/dist/features/refresh/adapters/inbound/CliRefreshHandler.js +24 -0
  206. package/dist/features/refresh/adapters/outbound/ChildProcessRefreshGit.d.ts +8 -0
  207. package/dist/features/refresh/adapters/outbound/ChildProcessRefreshGit.js +118 -0
  208. package/dist/features/refresh/adapters/outbound/NodeRefreshFileReader.d.ts +7 -0
  209. package/dist/features/refresh/adapters/outbound/NodeRefreshFileReader.js +44 -0
  210. package/dist/features/refresh/adapters/outbound/SystemRefreshClock.d.ts +4 -0
  211. package/dist/features/refresh/adapters/outbound/SystemRefreshClock.js +5 -0
  212. package/dist/features/refresh/application/BuildRefreshStubs.d.ts +25 -0
  213. package/dist/features/refresh/application/BuildRefreshStubs.js +43 -0
  214. package/dist/features/refresh/domain/DiffStubs.d.ts +24 -0
  215. package/dist/features/refresh/domain/DiffStubs.js +81 -0
  216. package/dist/features/refresh/domain/Footprint.d.ts +14 -0
  217. package/dist/features/refresh/domain/Footprint.js +45 -0
  218. package/dist/features/refresh/ports/inbound/RefreshCommand.d.ts +4 -0
  219. package/dist/features/refresh/ports/inbound/RefreshCommand.js +1 -0
  220. package/dist/features/refresh/ports/outbound/RefreshClockPort.d.ts +3 -0
  221. package/dist/features/refresh/ports/outbound/RefreshClockPort.js +1 -0
  222. package/dist/features/refresh/ports/outbound/RefreshConfigPort.d.ts +4 -0
  223. package/dist/features/refresh/ports/outbound/RefreshConfigPort.js +1 -0
  224. package/dist/features/refresh/ports/outbound/RefreshGitPort.d.ts +7 -0
  225. package/dist/features/refresh/ports/outbound/RefreshGitPort.js +1 -0
  226. package/dist/features/refresh/ports/outbound/RefreshSpecPort.d.ts +9 -0
  227. package/dist/features/refresh/ports/outbound/RefreshSpecPort.js +1 -0
  228. package/dist/features/report/adapters/inbound/CliReportHandler.d.ts +8 -0
  229. package/dist/features/report/adapters/inbound/CliReportHandler.js +35 -0
  230. package/dist/features/report/adapters/outbound/NodeReportFileSystem.d.ts +7 -0
  231. package/dist/features/report/adapters/outbound/NodeReportFileSystem.js +128 -0
  232. package/dist/features/report/application/RunReport.d.ts +19 -0
  233. package/dist/features/report/application/RunReport.js +161 -0
  234. package/dist/features/report/ports/inbound/ReportCommand.d.ts +8 -0
  235. package/dist/features/report/ports/inbound/ReportCommand.js +1 -0
  236. package/dist/features/report/ports/outbound/ReportConfigPort.d.ts +4 -0
  237. package/dist/features/report/ports/outbound/ReportConfigPort.js +1 -0
  238. package/dist/features/report/ports/outbound/ReportFileReader.d.ts +7 -0
  239. package/dist/features/report/ports/outbound/ReportFileReader.js +1 -0
  240. package/dist/features/token/adapters/inbound/CliTokenHandler.d.ts +8 -0
  241. package/dist/features/token/adapters/inbound/CliTokenHandler.js +53 -0
  242. package/dist/features/token/adapters/outbound/ChildProcessTokenGit.d.ts +8 -0
  243. package/dist/features/token/adapters/outbound/ChildProcessTokenGit.js +112 -0
  244. package/dist/features/token/adapters/outbound/NodeTokenConfigReader.d.ts +5 -0
  245. package/dist/features/token/adapters/outbound/NodeTokenConfigReader.js +41 -0
  246. package/dist/features/token/application/ComputeToken.d.ts +18 -0
  247. package/dist/features/token/application/ComputeToken.js +27 -0
  248. package/dist/features/token/ports/inbound/TokenCommand.d.ts +4 -0
  249. package/dist/features/token/ports/inbound/TokenCommand.js +1 -0
  250. package/dist/features/token/ports/outbound/TokenConfigPort.d.ts +4 -0
  251. package/dist/features/token/ports/outbound/TokenConfigPort.js +1 -0
  252. package/dist/features/token/ports/outbound/TokenGitPort.d.ts +7 -0
  253. package/dist/features/token/ports/outbound/TokenGitPort.js +1 -0
  254. package/dist/shared/domain/AgentBlocklist.d.ts +5 -0
  255. package/dist/shared/domain/AgentBlocklist.js +28 -0
  256. package/dist/shared/domain/BoundaryReachability.d.ts +5 -0
  257. package/dist/shared/domain/BoundaryReachability.js +71 -0
  258. package/dist/shared/domain/CheckOutcome.d.ts +10 -0
  259. package/dist/shared/domain/CheckOutcome.js +7 -0
  260. package/dist/shared/domain/CliOutput.d.ts +10 -0
  261. package/dist/shared/domain/CliOutput.js +29 -0
  262. package/dist/shared/domain/Config.d.ts +29 -0
  263. package/dist/shared/domain/Config.js +201 -0
  264. package/dist/shared/domain/DiagnosticRegistry.d.ts +8 -0
  265. package/dist/shared/domain/DiagnosticRegistry.js +71 -0
  266. package/dist/shared/domain/Errors.d.ts +12 -0
  267. package/dist/shared/domain/Errors.js +23 -0
  268. package/dist/shared/domain/GlobMatch.d.ts +2 -0
  269. package/dist/shared/domain/GlobMatch.js +58 -0
  270. package/dist/shared/domain/LintReport.d.ts +16 -0
  271. package/dist/shared/domain/LintReport.js +11 -0
  272. package/dist/shared/domain/LintRules.d.ts +67 -0
  273. package/dist/shared/domain/LintRules.js +956 -0
  274. package/dist/shared/domain/PartitionGrammar.d.ts +4 -0
  275. package/dist/shared/domain/PartitionGrammar.js +16 -0
  276. package/dist/shared/domain/PlanFile.d.ts +28 -0
  277. package/dist/shared/domain/PlanFile.js +112 -0
  278. package/dist/shared/domain/Scope.d.ts +1 -0
  279. package/dist/shared/domain/Scope.js +3 -0
  280. package/dist/shared/domain/SpecApprovalRewrite.d.ts +23 -0
  281. package/dist/shared/domain/SpecApprovalRewrite.js +254 -0
  282. package/dist/shared/domain/SpecBlocks.d.ts +12 -0
  283. package/dist/shared/domain/SpecBlocks.js +96 -0
  284. package/dist/shared/domain/SpecRecord.d.ts +17 -0
  285. package/dist/shared/domain/SpecRecord.js +208 -0
  286. package/dist/shared/domain/TemplateFieldMetadata.d.ts +2 -0
  287. package/dist/shared/domain/TemplateFieldMetadata.js +177 -0
  288. package/dist/shared/domain/Token.d.ts +2 -0
  289. package/dist/shared/domain/Token.js +5 -0
  290. package/dist/shared/domain/WeaselWords.d.ts +3 -0
  291. package/dist/shared/domain/WeaselWords.js +32 -0
  292. package/package.json +71 -0
  293. package/rules/enforcement_registry.md +126 -0
  294. package/rules/hooks/sdd-lint-reminder.sh +33 -0
  295. package/rules/hooks/sdd-spec-read-guard.sh +73 -0
  296. package/rules/manifest.json +15 -0
  297. package/rules/review-sdd.md +9 -0
  298. package/rules/sdd-cli-usage.md +91 -0
  299. package/rules/skills/spec-driven-development/SKILL.md +554 -0
  300. package/rules/skills/spec-driven-development/data/weasel-words.json +22 -0
  301. package/rules/spec-driven-development.md +69 -0
  302. package/rules/tdd-sdd.md +127 -0
  303. package/rules/workflow-sdd.md +56 -0
  304. package/schema/sdd.config.schema.json +104 -0
@@ -0,0 +1,69 @@
1
+ # Spec-Driven Development
2
+
3
+ Spec is the single source of truth for code generation. Change the spec first, then generate code. Behavior in code that is not in the spec is either lifted into the spec or removed; never legitimized silently.
4
+
5
+ ## Atomic unit: typed normative ID
6
+
7
+ Every normative statement is an ID-element with one of these templates:
8
+ `Behavior`, `Invariant`, `Contract`, `Scenario`, `NFR`, `Constraint`, `Policy`, `Migration`, `Delta`, `GeneratedArtifact`, `ExternalDependency`, `LocalizationContract`, `Surface`, `Partition`, `ImplementationBinding`, `Open-Q`, `ASSUMPTION`.
9
+
10
+ - IDs are semantically neutral and partition-scoped: `<partition>:<neutral>` (e.g. `billing:REQ-017`). Numbers are never reused.
11
+ - Each field is typed: `enum | scalar_with_unit | range_with_unit | schema_dsl | predicate_dsl | reference | bounded_free_text_with_review`.
12
+ - Required fields take a typed value or explicit `not_applicable + reason`. Empty = invalid.
13
+ - Predicates must be checkable from observable inputs/outputs/state. `Invariant` may use `evidence ∈ {public_api, test_probe, db_constraint, operational_signal}` + `stability ∈ {contractual, internal}` — only `public_api` and `contractual` operational signals are external contract.
14
+
15
+ ## What spec MUST fix
16
+ External behavior · `Surface`/`Contract` boundaries · `Invariant` · external identifiers (API fields, events, CLI, public DB columns, error codes, message_ids) · `ExternalDependency` (third-party providers) · `Policy` (authz/tenant/PII/audit/rate-limit) · `Migration` (data at-rest) · `applicability` (feature_flag, tenant, locale, env, plan_tier, api_version) · `concurrency_model` on boundaries.
17
+
18
+ ## What spec MUST NOT fix
19
+ Internal file/module/class/function names · library/framework choice (unless a `Constraint` with external rationale) · directory layout · internal layering not observable from outside · estimates, schedules, owners.
20
+
21
+ The agent decides everything not normatively fixed. The agent MUST list its internal decisions in the PR as candidates for new `REQ`/`Constraint`/`Policy`/`ASSUMPTION`.
22
+
23
+ ## Lifecycle and approval
24
+
25
+ - `lifecycle.status ∈ {draft, proposed, approved, deprecated, removed}` — for every normative template.
26
+ - `draft` — sandbox only (`spike/`). `proposed` — spec-valid, not mergeable. `approved` — implementable. `deprecated` — has `sunset_version` + `replacement_id`. `removed` — has `compatibility_action ∈ {reject, ignore, migrate, no_longer_guaranteed}`.
27
+ - `approval_record` (owner_role, approver_identity, timestamp, change_request) is required for `approved`/`deprecated`/`removed`. **Self-approval by the code-gen agent is forbidden** — also for downgrading `ASSUMPTION` `blocking → advisory`.
28
+ - Approving a Surface requires every referenced normative ID to be `≥ approved` already.
29
+ - Approval is a two-step process. Step 1 records a `pending_approval_record` in a plan-namespace artefact (no change to `lifecycle.status`); step 2 validates the resulting reference graph and atomically materialises `lifecycle.status=approved` plus an ID-level `approval_record`. Between steps the invariant «`approved` ⇒ graph-consistent» is preserved by construction. Self-approval ban applies to step 1 (the attestation), not just to step 2. See `rules/enforcement_registry.md#ENF-002`.
30
+ - `Surface` is the unit of semver. Bumping `Policy` or `Invariant(stability=contractual)` cascades to every referencing Surface: content change ⇒ ≥minor; predicate change ⇒ major.
31
+
32
+ ## Three gates (per partition)
33
+
34
+ 1. **`baseline-valid`** — `Discovery scope` is covered by `coverage_evidence`; `freshness_token` matches input sources. Each `Delta`/`Migration` pins to a `baseline_version`. Stale baseline blocks only the move into `implementation-valid`, not authoring of new `Delta`/`Open-Q`. `baseline_refresh` MUST emit `diff(old, new)` and auto-open `Delta`-stub or `Open-Q` for any change crossing a normative ID footprint.
35
+ 2. **`spec-valid`** — structure, Template Requiredness Matrix, field types, no weasel words in normative sections, two-way `ID ↔ Test obligation`, semver per Surface, `approval_record` present, no self-approval, no unresolved `Open-Q.blocking=yes`.
36
+ 3. **`implementation-valid`** — every `Test obligation` materialized as ≥1 executable test with `@covers <partition>:<id>`; all `approved` IDs green; `removed` IDs have tests for their `compatibility_action`; agent's internal decisions listed in PR. **Signal, not proof** — for major-bump `Surface`, human review of the test (oracle/assertion summary, input classes, negative oracle) is required.
37
+
38
+ ## Brownfield rules
39
+
40
+ - `Brownfield baseline` is non-normative until a `REQ`/`Invariant`/`Contract` references it as preserved.
41
+ - Anything outside `Discovery scope` is `unmodeled` — never silently deleted, renamed or rewritten. Expanding scope requires recon.
42
+ - Every behavior change → `Delta` (with `kind`, `compatibility_action`, `tests_old_behavior`, `tests_new_behavior`, `baseline_version`).
43
+ - Data-at-rest changes → `Migration`. Two orthogonal axes: spec-lifecycle `{draft..removed}` (governance) and runtime-state `{pre_cutover, in_progress, cutover_done, rolled_back}` (operational evidence). Cross-partition migrations use `partition_slice[]` + `coordinator_id`, not joint approval.
44
+ - `Invariant`/`Contract` with `data_scope=post_migration:<MIG-ID>` MUST carry `enforcement_stage` pointing to a **deterministic test-controllable marker in the repo** (feature flag, completion sentinel, `cutover_marker`) — never a live deployment signal. CI runs pre/during/post tests by toggling the marker.
45
+ - `implementation-valid` only checks tests applicable to the current Migration runtime-state.
46
+ - Iterative debt budget: each partition tracks `unmodeled` / legitimate-debt that shrinks per PR/sprint. "Bring as-is to target in one PR" is not required.
47
+
48
+ ## Stop conditions (agent MUST raise `Open-Q`, not guess)
49
+
50
+ Term not in `Glossary` · behavior outside `Discovery scope` · code↔spec contradiction without `Delta` · weasel word in a normative section · removal without `compatibility_action` · missing `Policy`-ref on a boundary · missing `applicability` when an axis variable is detectable · missing `concurrency_model` on a boundary · missing `data_scope` on persistent state · provider-owned behavior without `ExternalDependency` · generated output without `GeneratedArtifact` · text-as-contract without `LocalizationContract` · missing `baseline_version` on `Delta`/`Migration` · `proposed → approved` Surface while a referenced Policy/Contract is not yet approved · `Migration` runtime-state change without updating dependent `enforcement_stage` · structural-breaking diff in `GeneratedArtifact(published_surface=yes)` without major bump.
51
+
52
+ Stop conditions split by enforcement class: `agent-halt` (reflex on a closed condition — term not in `Glossary`, code↔spec contradiction without `Delta`, removal without `compatibility_action`, missing `Policy`-ref / `applicability` / `concurrency_model` / `data_scope` / `baseline_version` on declared boundaries) and `agent-judgment` (semantic classification — provider-owned → `ExternalDependency`, generated output → `GeneratedArtifact`, text-as-contract → `LocalizationContract`). The split is normative for the PR-report shape: `agent-halt` produces a list of raised `Open-Q`s with trigger references; `agent-judgment` produces a list of classification decisions with rationale. Full mapping in `rules/enforcement_registry.md` rows ENF-005, ENF-006, ENF-023..ENF-034.
53
+
54
+ ## Forbidden in normative sections
55
+ Canonical list lives at `skills/spec-driven-development/data/weasel-words.json`. Two classes: `absolute` (blocked in any normative section) and `modal_in_normative` (`may be`, `might be` — blocked only in template fields marked `is_normative=true`; allowed in `Context`, `Glossary`, comments, and in `Scenario`-prose where the alternative is captured by an explicit `options[]`/branching). See `rules/enforcement_registry.md#ENF-001`. Conditional fields take a value from a closed enum; `not_applicable` requires `reason`.
56
+
57
+ ## PR report (every change)
58
+ - Closed `Test obligation`s and the tests that close them (with oracle/assertion summary, input classes, negative oracle for major-bump).
59
+ - Internal decisions taken (names, structure, libraries) — candidates for new `Constraint`/`Policy`/`ASSUMPTION`.
60
+ - `ASSUMPTION`s used and their `review_by`.
61
+ - Remaining `Open-Q`s and why they don't block this PR.
62
+ - Reduction of `unmodeled` / legitimate-debt budget vs previous PR.
63
+
64
+ ## Agent flow on existing code
65
+ 1. Read-only recon → `Discovery scope` + `Brownfield baseline` + `coverage_evidence`. No `Delta`/`Migration` until `baseline-valid`.
66
+ 2. Author target → `Surface`/`Contract`/`Policy`/`Constraint`/`Delta`/`Migration` against the baseline.
67
+ 3. Make tests fail (red) per `Test obligation` before implementing.
68
+ 4. Implement; only modify what the spec authorizes.
69
+ 5. Self-review against this rule and `review.md` before presenting.
@@ -0,0 +1,127 @@
1
+ # TDD — SDD Addendum
2
+
3
+ Extends `@rules/tdd.md` for projects that carry `.sdd/config.json`.
4
+ The Red→Green→Refactor cycle still holds, but the **source of the Red test**
5
+ and the **definition of done** are anchored to the spec.
6
+
7
+ ## Where Red comes from
8
+
9
+ Red tests are not invented from intuition. Each Red test closes a
10
+ `Test obligation` declared on a normative ID (`Behavior` / `Invariant` /
11
+ `Contract` / `Migration` / `Delta`). One ID may declare several obligations
12
+ (happy path, boundary, negative) — each is its own Red test, written one at
13
+ a time.
14
+
15
+ If you can't trace a test to a `Test obligation`, the test doesn't belong.
16
+ Either raise an `Open-Q` to extend the spec, or skip the test. Tests that
17
+ don't trace to a normative ID become candidates for new
18
+ `Constraint` / `Policy` / `ASSUMPTION` — raise them, don't smuggle them in
19
+ as silent green-keepers.
20
+
21
+ ## The full SDD-TDD chain
22
+
23
+ For every change:
24
+
25
+ 1. **Spec** — author / amend the relevant ID(s) and their `Test obligation`s.
26
+ 2. **Spec-lint** — `sdd lint` exit 0 (gate `spec-valid`).
27
+ 3. **Red** — for each open `Test obligation`, write one failing test
28
+ carrying `@covers <partition>:<id>`. Test fails on assertion, not on a
29
+ missing import. One Red at a time.
30
+ 4. **Green** — minimum code to turn the current Red green. Only what the
31
+ spec authorizes — no behavior outside an approved ID.
32
+ 5. **Refactor** — structure only, tests stay green, observable behavior
33
+ on `approved` IDs unchanged.
34
+ 6. **Implementation-valid** — `sdd ready` exit 0
35
+ (gate `implementation-valid`). Coverage holes surface here.
36
+
37
+ Skipping any step (writing code before Red, committing on `sdd ready`
38
+ exit 1, etc.) violates the SDD invariant "spec is the source of truth".
39
+ See `@sdd/sdd-cli-usage.md` for command-by-command gate mapping.
40
+
41
+ ## `@covers` markers
42
+
43
+ Every Red test that closes a `Test obligation` must carry
44
+ `@covers <partition>:<id>` (in a comment, or the language-equivalent
45
+ location `sdd ready` reads in this project). Missing markers surface as
46
+ `[uncovered]` even if the test exists and passes.
47
+
48
+ If a `Test obligation` is `not_applicable`, the spec must carry an explicit
49
+ `not_applicable + reason`. No `@covers` and no Red test in that case — do
50
+ not fabricate a trivial test to silence the gate
51
+ (see `@rules/tdd.md` → Anti-patterns: TDD theatre).
52
+
53
+ ## Migration runtime-state
54
+
55
+ `Migration` carries two orthogonal axes — spec-lifecycle (`draft..removed`)
56
+ governs `sdd lint`; `runtime_state ∈ {pre_cutover, in_progress,
57
+ cutover_done, rolled_back}` governs which tests are applicable.
58
+
59
+ Tests for `Invariant` / `Contract` with `data_scope = post_migration:<MIG-ID>`
60
+ must be wired to the `enforcement_stage` marker (feature flag, completion
61
+ sentinel, `cutover_marker`) so CI can deterministically toggle pre / during
62
+ / post. Live deployment signals as the marker are forbidden
63
+ (see `@sdd/spec-driven-development.md` → Brownfield rules).
64
+
65
+ `sdd ready` only checks tests applicable to the current `runtime_state`.
66
+ A pre-cutover test that's red after `runtime_state=cutover_done` is not a
67
+ gate failure — it's an obsolete test. Re-scope via spec or delete as part
68
+ of cutover.
69
+
70
+ ## Removed IDs — replace, don't drop
71
+
72
+ When an ID transitions to `removed`, do not silently delete its tests.
73
+ Replace each test with one that verifies the declared `compatibility_action`:
74
+
75
+ - `reject` → old input now produces the typed error.
76
+ - `ignore` → old input is accepted but produces no effect.
77
+ - `migrate` → old input is transformed per spec.
78
+ - `no_longer_guaranteed` → test removed; document the gap in PR
79
+ (ENF-007B).
80
+
81
+ Removing a test without replacing it is a coverage drop and `sdd ready`
82
+ will flag it.
83
+
84
+ ## Major-bump Surface
85
+
86
+ For a Surface with a major bump (predicate change on `Policy` or
87
+ `Invariant(stability=contractual)`) the Red test alone is signal, not
88
+ proof. `implementation-valid` passes mechanically, but ENF-004B requires
89
+ human review of:
90
+
91
+ - input classes the test covers,
92
+ - negative oracle (what must NOT pass),
93
+ - assertion summary.
94
+
95
+ When the agent writes a major-bump Red, name these three explicitly in the
96
+ test docstring or PR description. The reviewer needs them to validate
97
+ oracle quality.
98
+
99
+ ## Halt mid-Red
100
+
101
+ While writing a Red test, halt and raise `Open-Q` if you hit:
102
+
103
+ - a term not in `Glossary`,
104
+ - behavior outside `Discovery scope`,
105
+ - code↔spec contradiction without a `Delta`,
106
+ - missing `Policy` ref, `applicability`, `concurrency_model`, or
107
+ `data_scope` on a boundary the test exercises,
108
+ - missing `baseline_version` on the `Delta` / `Migration` you're closing.
109
+
110
+ Do not improvise the test to "make progress". Full stop-condition list:
111
+ `@sdd/spec-driven-development.md` → Stop conditions.
112
+
113
+ ## Refactor under SDD
114
+
115
+ Refactor must keep tests green **and** preserve every observable behavior
116
+ declared on `approved` IDs:
117
+
118
+ - Internal renaming, extraction, dedup → fine.
119
+ - Updating an `ImplementationBinding` target (file / class / function) →
120
+ fine, as long as the binding is updated in lockstep.
121
+ - Renaming a public `Surface` field, changing a `Contract` shape, altering
122
+ an `Invariant` predicate → **not refactor**. That's a `Delta` —
123
+ stop, edit spec, re-lint, re-Red.
124
+
125
+ If you discover a missing `Test obligation` mid-refactor, finish the
126
+ refactor commit, then go back to Spec → Red. Don't extend the obligation
127
+ list inside a refactor commit (see `@rules/commits.md` → Granularity).
@@ -0,0 +1,56 @@
1
+ # Workflow — SDD Addendum
2
+
3
+ Extends `@rules/workflow.md` for projects that use Spec-Driven Development.
4
+ When the project carries `.sdd/config.json`, the steps below are mandatory
5
+ and override the trivial-task exception in `@rules/workflow.md`.
6
+
7
+ ## Specification-First Development
8
+ If the project has a specification (e.g. `/spec` folder):
9
+ 1. **Read spec first** — before any code changes, review the relevant spec files
10
+ 2. **Update spec** — make all changes in the specification first
11
+ 3. **Lint spec** — `sdd lint` MUST exit 0 before proceeding (see `sdd-cli-usage.md`)
12
+ 4. **Get approval** — confirm spec changes with the user before touching code; for `proposed → approved` use `sdd approve` (attestation) + `sdd finalize` (atomic flip)
13
+ 5. **Implement** — write code that matches the updated specification
14
+ 6. **Ready check** — `sdd ready` MUST exit 0 before proposing commit
15
+ - Code MUST stay in sync with the spec at all times
16
+ - Never change code without a corresponding spec update
17
+ - Never bypass `sdd ready` exit 1 to land a commit
18
+
19
+ ### Preflight before any Edit/Write to code
20
+ Before the first `Edit`/`Write`/`MultiEdit` on a non-spec file in a session,
21
+ explicitly verify:
22
+ 1. Does this project have a specification directory (`/spec` or equivalent)?
23
+ 2. If yes — name the exact spec file(s) that govern the change and confirm
24
+ they are already updated and approved for this task. If they are not,
25
+ STOP and go back to step Spec.
26
+ 3. State both answers in chat before the tool call. Silent skipping is the
27
+ failure mode this rule exists to prevent.
28
+
29
+ This preflight applies even in Auto mode and even on tasks that look trivial.
30
+ Spec-presence overrides the "trivial task" exception in `@rules/workflow.md`.
31
+
32
+ ## SDD-augmented Development Workflow
33
+ The numbered steps from `@rules/workflow.md` are extended as follows when
34
+ the project has a specification:
35
+
36
+ 1. **Understand** — read the task, explore relevant code
37
+ 2. **Clarify** — ask questions if requirements are ambiguous
38
+ 3. **Spec** — update the specification first (see above)
39
+ 3a. **Spec-lint** — run `sdd lint`; do not proceed until exit 0 (only when project carries `.sdd/config.json`)
40
+ 4. **Implement** — write code following the conventions above
41
+ 5. **Review** — self-review changes against CLAUDE.md rules before presenting
42
+ 5a. **Ready** — run `sdd ready`; do not commit until exit 0 (only when project carries `.sdd/config.json`)
43
+ 6. **Commit** — create a commit only when user approves
44
+ 7. **Push** — push only when user explicitly asks
45
+
46
+ Pause-for-approval rule is widened: pause between **Spec → Implement** and
47
+ between **Review → Commit** (instead of just the second).
48
+
49
+ ## sdd-cli integration
50
+
51
+ The `sdd` CLI is part of the SDD workflow when the project carries
52
+ `.sdd/config.json` and a `BrownfieldBaseline` block. Operational rules,
53
+ phase-to-command mapping, and troubleshooting are in
54
+ `@sdd/sdd-cli-usage.md`. The lint reminder is wired via
55
+ `sdd/hooks/sdd-lint-reminder.sh` (PreToolUse on Edit/Write/MultiEdit for
56
+ spec files).
@@ -0,0 +1,104 @@
1
+ {
2
+ "$schema": "https://json-schema.org/draft/2020-12/schema",
3
+ "$id": "https://github.com/cyberash-dev/sdd-cli/blob/main/schema/sdd.config.schema.json",
4
+ "type": "object",
5
+ "additionalProperties": false,
6
+ "required": ["spec_file", "baseline_id", "discovery_scope", "mechanism"],
7
+ "properties": {
8
+ "$schema": {
9
+ "type": "string"
10
+ },
11
+ "spec_file": {
12
+ "type": "string",
13
+ "minLength": 1
14
+ },
15
+ "baseline_id": {
16
+ "type": "string",
17
+ "pattern": "^[a-z][a-z0-9-]*(:[a-z][a-z0-9-]*)*:[A-Z]+-[0-9]+$"
18
+ },
19
+ "discovery_scope": {
20
+ "type": "array",
21
+ "minItems": 1,
22
+ "items": {
23
+ "type": "string",
24
+ "minLength": 1
25
+ }
26
+ },
27
+ "footprint": {
28
+ "type": "object",
29
+ "additionalProperties": false,
30
+ "properties": {
31
+ "binding_id_prefix": {
32
+ "type": "string",
33
+ "default": "IMP-"
34
+ },
35
+ "binding_field": {
36
+ "type": "string",
37
+ "default": "binding"
38
+ }
39
+ }
40
+ },
41
+ "mechanism": {
42
+ "type": "string",
43
+ "enum": ["git_tree_hash_v1"]
44
+ },
45
+ "lint": {
46
+ "type": "object",
47
+ "additionalProperties": false,
48
+ "properties": {
49
+ "spec_files": {
50
+ "type": "array",
51
+ "minItems": 1,
52
+ "items": { "type": "string", "minLength": 1 }
53
+ },
54
+ "approver_blocklist": {
55
+ "type": "array",
56
+ "items": { "type": "string", "minLength": 1 }
57
+ },
58
+ "partition_glob": {
59
+ "type": "array",
60
+ "items": { "type": "string", "minLength": 1 }
61
+ }
62
+ }
63
+ },
64
+ "partitions": {
65
+ "type": "object",
66
+ "patternProperties": {
67
+ "^[a-z][a-z0-9-]*(:[a-z][a-z0-9-]*)*$": {
68
+ "type": "object",
69
+ "additionalProperties": false,
70
+ "required": ["spec_paths"],
71
+ "properties": {
72
+ "spec_paths": {
73
+ "type": "array",
74
+ "minItems": 1,
75
+ "items": { "type": "string", "minLength": 1 }
76
+ },
77
+ "test_paths": {
78
+ "type": "array",
79
+ "items": { "type": "string", "minLength": 1 }
80
+ },
81
+ "sandbox_paths": {
82
+ "type": "array",
83
+ "items": { "type": "string", "minLength": 1 }
84
+ }
85
+ }
86
+ }
87
+ },
88
+ "additionalProperties": false
89
+ },
90
+ "test_paths": {
91
+ "type": "array",
92
+ "items": { "type": "string", "minLength": 1 }
93
+ },
94
+ "sandbox_paths": {
95
+ "type": "array",
96
+ "items": { "type": "string", "minLength": 1 }
97
+ },
98
+ "plans_dir": {
99
+ "type": "string",
100
+ "minLength": 1,
101
+ "default": ".sdd/plans"
102
+ }
103
+ }
104
+ }