pi-usereq 0.4.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 (361) hide show
  1. package/.g.conf +20 -0
  2. package/.github/workflows/release-npm.yml +131 -0
  3. package/.gitignore +270 -0
  4. package/CHANGELOG.md +221 -0
  5. package/LICENSE +674 -0
  6. package/README.md +260 -0
  7. package/TODO.md +20 -0
  8. package/docs/pi.dev/agent-document-manifest.json +6399 -0
  9. package/docs/pi.dev/coding-agent-docs/compaction.md +394 -0
  10. package/docs/pi.dev/coding-agent-docs/custom-provider.md +596 -0
  11. package/docs/pi.dev/coding-agent-docs/development.md +71 -0
  12. package/docs/pi.dev/coding-agent-docs/extensions.md +2262 -0
  13. package/docs/pi.dev/coding-agent-docs/images/doom-extension.png +0 -0
  14. package/docs/pi.dev/coding-agent-docs/images/exy.png +0 -0
  15. package/docs/pi.dev/coding-agent-docs/images/interactive-mode.png +0 -0
  16. package/docs/pi.dev/coding-agent-docs/images/tree-view.png +0 -0
  17. package/docs/pi.dev/coding-agent-docs/json.md +82 -0
  18. package/docs/pi.dev/coding-agent-docs/keybindings.md +175 -0
  19. package/docs/pi.dev/coding-agent-docs/models.md +392 -0
  20. package/docs/pi.dev/coding-agent-docs/packages.md +218 -0
  21. package/docs/pi.dev/coding-agent-docs/prompt-templates.md +67 -0
  22. package/docs/pi.dev/coding-agent-docs/providers.md +195 -0
  23. package/docs/pi.dev/coding-agent-docs/rpc.md +1377 -0
  24. package/docs/pi.dev/coding-agent-docs/sdk.md +1124 -0
  25. package/docs/pi.dev/coding-agent-docs/session.md +412 -0
  26. package/docs/pi.dev/coding-agent-docs/settings.md +247 -0
  27. package/docs/pi.dev/coding-agent-docs/shell-aliases.md +13 -0
  28. package/docs/pi.dev/coding-agent-docs/skills.md +232 -0
  29. package/docs/pi.dev/coding-agent-docs/terminal-setup.md +106 -0
  30. package/docs/pi.dev/coding-agent-docs/termux.md +127 -0
  31. package/docs/pi.dev/coding-agent-docs/themes.md +295 -0
  32. package/docs/pi.dev/coding-agent-docs/tmux.md +61 -0
  33. package/docs/pi.dev/coding-agent-docs/tree.md +231 -0
  34. package/docs/pi.dev/coding-agent-docs/tui.md +887 -0
  35. package/docs/pi.dev/coding-agent-docs/windows.md +17 -0
  36. package/docs/pi.dev/mom-docs/artifacts-server.md +475 -0
  37. package/docs/pi.dev/mom-docs/events.md +307 -0
  38. package/docs/pi.dev/mom-docs/new.md +970 -0
  39. package/docs/pi.dev/mom-docs/sandbox.md +153 -0
  40. package/docs/pi.dev/mom-docs/slack-bot-minimal-guide.md +399 -0
  41. package/docs/pi.dev/mom-docs/v86.md +319 -0
  42. package/docs/pi.dev/pods-docs/gml-4.5.md +189 -0
  43. package/docs/pi.dev/pods-docs/gpt-oss.md +233 -0
  44. package/docs/pi.dev/pods-docs/implementation-plan.md +183 -0
  45. package/docs/pi.dev/pods-docs/kimi-k2.md +197 -0
  46. package/docs/pi.dev/pods-docs/models.md +116 -0
  47. package/docs/pi.dev/pods-docs/plan.md +166 -0
  48. package/docs/pi.dev/pods-docs/qwen3-coder.md +132 -0
  49. package/images/flowchart-bw.png +0 -0
  50. package/images/flowchart-bw.svg +102 -0
  51. package/images/flowchart.md +100 -0
  52. package/images/flowchart.png +0 -0
  53. package/images/flowchart.svg +3 -0
  54. package/package.json +46 -0
  55. package/req/docs/REFERENCES.md +4554 -0
  56. package/req/docs/REQUIREMENTS.md +475 -0
  57. package/req/docs/WORKFLOW.md +1059 -0
  58. package/scripts/debug-extension.ts +497 -0
  59. package/scripts/lib/extension-debug-harness.ts +450 -0
  60. package/scripts/lib/recording-extension-api.ts +786 -0
  61. package/scripts/lib/sdk-smoke.ts +503 -0
  62. package/scripts/pi-usereq-debug.sh +330 -0
  63. package/scripts/tool-args-to-params.ts +208 -0
  64. package/src/cli.ts +349 -0
  65. package/src/core/agent-tool-json.ts +621 -0
  66. package/src/core/compress-files.ts +72 -0
  67. package/src/core/compress-payload.ts +648 -0
  68. package/src/core/compress.ts +464 -0
  69. package/src/core/config.ts +272 -0
  70. package/src/core/doxygen-parser.ts +318 -0
  71. package/src/core/errors.ts +31 -0
  72. package/src/core/extension-status.ts +660 -0
  73. package/src/core/find-constructs.ts +319 -0
  74. package/src/core/find-payload.ts +915 -0
  75. package/src/core/generate-markdown.ts +120 -0
  76. package/src/core/path-context.ts +196 -0
  77. package/src/core/pi-notify.ts +430 -0
  78. package/src/core/pi-usereq-tools.ts +140 -0
  79. package/src/core/prompts.ts +184 -0
  80. package/src/core/reference-payload.ts +818 -0
  81. package/src/core/resources.ts +63 -0
  82. package/src/core/runtime-project-paths.ts +99 -0
  83. package/src/core/settings-menu.ts +233 -0
  84. package/src/core/source-analyzer.ts +1721 -0
  85. package/src/core/static-check.ts +674 -0
  86. package/src/core/token-counter.ts +729 -0
  87. package/src/core/tool-runner.ts +717 -0
  88. package/src/core/utils.ts +185 -0
  89. package/src/index.ts +2209 -0
  90. package/src/resources/guidelines/Google_C++_Style_Guide.md +3711 -0
  91. package/src/resources/guidelines/Google_Python_Style_Guide.md +3709 -0
  92. package/src/resources/prompts/analyze.md +130 -0
  93. package/src/resources/prompts/change.md +227 -0
  94. package/src/resources/prompts/check.md +139 -0
  95. package/src/resources/prompts/cover.md +219 -0
  96. package/src/resources/prompts/create.md +104 -0
  97. package/src/resources/prompts/fix.md +221 -0
  98. package/src/resources/prompts/flowchart.md +220 -0
  99. package/src/resources/prompts/implement.md +163 -0
  100. package/src/resources/prompts/new.md +226 -0
  101. package/src/resources/prompts/readme.md +182 -0
  102. package/src/resources/prompts/recreate.md +213 -0
  103. package/src/resources/prompts/refactor.md +213 -0
  104. package/src/resources/prompts/references.md +100 -0
  105. package/src/resources/prompts/renumber.md +119 -0
  106. package/src/resources/prompts/workflow.md +202 -0
  107. package/src/resources/prompts/write.md +99 -0
  108. package/src/resources/sounds/Machine-alert-beep-sound-effect.mp3 +0 -0
  109. package/src/resources/sounds/Soft-high-tech-notification-sound-effect.mp3 +0 -0
  110. package/src/resources/templates/Document_Source_Code_in_Doxygen_Style.md +130 -0
  111. package/src/resources/templates/HDT_Test_Authoring_Guide.md +318 -0
  112. package/src/resources/templates/Requirements_Template.md +78 -0
  113. package/tests/attended-results-scenarios.ts +758 -0
  114. package/tests/attended-results.test.ts +39 -0
  115. package/tests/cli-command-option-parity.test.ts +815 -0
  116. package/tests/debug-extension-harness.test.ts +463 -0
  117. package/tests/extension-registration.test.ts +2006 -0
  118. package/tests/fixtures/fixture_c.c +361 -0
  119. package/tests/fixtures/fixture_cpp.cpp +407 -0
  120. package/tests/fixtures/fixture_csharp.cs +411 -0
  121. package/tests/fixtures/fixture_elixir.ex +409 -0
  122. package/tests/fixtures/fixture_go.go +341 -0
  123. package/tests/fixtures/fixture_haskell.hs +250 -0
  124. package/tests/fixtures/fixture_java.java +430 -0
  125. package/tests/fixtures/fixture_javascript.js +383 -0
  126. package/tests/fixtures/fixture_kotlin.kt +451 -0
  127. package/tests/fixtures/fixture_lua.lua +276 -0
  128. package/tests/fixtures/fixture_perl.pl +310 -0
  129. package/tests/fixtures/fixture_php.php +433 -0
  130. package/tests/fixtures/fixture_python.py +502 -0
  131. package/tests/fixtures/fixture_ruby.rb +345 -0
  132. package/tests/fixtures/fixture_rust.rs +380 -0
  133. package/tests/fixtures/fixture_scala.scala +398 -0
  134. package/tests/fixtures/fixture_shell.sh +276 -0
  135. package/tests/fixtures/fixture_swift.swift +397 -0
  136. package/tests/fixtures/fixture_typescript.ts +434 -0
  137. package/tests/fixtures/fixture_zig.zig +295 -0
  138. package/tests/fixtures_attended_results/project/compress-line-numbers.json +5 -0
  139. package/tests/fixtures_attended_results/project/compress.json +5 -0
  140. package/tests/fixtures_attended_results/project/enable-static-check-invalid-command.json +5 -0
  141. package/tests/fixtures_attended_results/project/enable-static-check-valid.json +5 -0
  142. package/tests/fixtures_attended_results/project/files-static-check.json +5 -0
  143. package/tests/fixtures_attended_results/project/find-line-numbers.json +5 -0
  144. package/tests/fixtures_attended_results/project/find.json +5 -0
  145. package/tests/fixtures_attended_results/project/get-base-path.json +5 -0
  146. package/tests/fixtures_attended_results/project/git-check-clean.json +5 -0
  147. package/tests/fixtures_attended_results/project/git-check-dirty.json +5 -0
  148. package/tests/fixtures_attended_results/project/git-path.json +5 -0
  149. package/tests/fixtures_attended_results/project/git-wt-create-invalid.json +5 -0
  150. package/tests/fixtures_attended_results/project/git-wt-create-valid.json +5 -0
  151. package/tests/fixtures_attended_results/project/git-wt-delete-nonexistent.json +5 -0
  152. package/tests/fixtures_attended_results/project/git-wt-delete-valid.json +5 -0
  153. package/tests/fixtures_attended_results/project/git-wt-name.json +5 -0
  154. package/tests/fixtures_attended_results/project/references.json +5 -0
  155. package/tests/fixtures_attended_results/project/static-check.json +5 -0
  156. package/tests/fixtures_attended_results/project/tokens.json +5 -0
  157. package/tests/fixtures_attended_results/standalone/files-compress/fixture_c.c.json +5 -0
  158. package/tests/fixtures_attended_results/standalone/files-compress/fixture_cpp.cpp.json +5 -0
  159. package/tests/fixtures_attended_results/standalone/files-compress/fixture_csharp.cs.json +5 -0
  160. package/tests/fixtures_attended_results/standalone/files-compress/fixture_elixir.ex.json +5 -0
  161. package/tests/fixtures_attended_results/standalone/files-compress/fixture_go.go.json +5 -0
  162. package/tests/fixtures_attended_results/standalone/files-compress/fixture_haskell.hs.json +5 -0
  163. package/tests/fixtures_attended_results/standalone/files-compress/fixture_java.java.json +5 -0
  164. package/tests/fixtures_attended_results/standalone/files-compress/fixture_javascript.js.json +5 -0
  165. package/tests/fixtures_attended_results/standalone/files-compress/fixture_kotlin.kt.json +5 -0
  166. package/tests/fixtures_attended_results/standalone/files-compress/fixture_lua.lua.json +5 -0
  167. package/tests/fixtures_attended_results/standalone/files-compress/fixture_perl.pl.json +5 -0
  168. package/tests/fixtures_attended_results/standalone/files-compress/fixture_php.php.json +5 -0
  169. package/tests/fixtures_attended_results/standalone/files-compress/fixture_python.py.json +5 -0
  170. package/tests/fixtures_attended_results/standalone/files-compress/fixture_ruby.rb.json +5 -0
  171. package/tests/fixtures_attended_results/standalone/files-compress/fixture_rust.rs.json +5 -0
  172. package/tests/fixtures_attended_results/standalone/files-compress/fixture_scala.scala.json +5 -0
  173. package/tests/fixtures_attended_results/standalone/files-compress/fixture_shell.sh.json +5 -0
  174. package/tests/fixtures_attended_results/standalone/files-compress/fixture_swift.swift.json +5 -0
  175. package/tests/fixtures_attended_results/standalone/files-compress/fixture_typescript.ts.json +5 -0
  176. package/tests/fixtures_attended_results/standalone/files-compress/fixture_zig.zig.json +5 -0
  177. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_c.c.json +5 -0
  178. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_cpp.cpp.json +5 -0
  179. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_csharp.cs.json +5 -0
  180. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_elixir.ex.json +5 -0
  181. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_go.go.json +5 -0
  182. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_haskell.hs.json +5 -0
  183. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_java.java.json +5 -0
  184. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_javascript.js.json +5 -0
  185. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_kotlin.kt.json +5 -0
  186. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_lua.lua.json +5 -0
  187. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_perl.pl.json +5 -0
  188. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_php.php.json +5 -0
  189. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_python.py.json +5 -0
  190. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_ruby.rb.json +5 -0
  191. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_rust.rs.json +5 -0
  192. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_scala.scala.json +5 -0
  193. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_shell.sh.json +5 -0
  194. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_swift.swift.json +5 -0
  195. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_typescript.ts.json +5 -0
  196. package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_zig.zig.json +5 -0
  197. package/tests/fixtures_attended_results/standalone/files-find/fixture_c.c.json +5 -0
  198. package/tests/fixtures_attended_results/standalone/files-find/fixture_cpp.cpp.json +5 -0
  199. package/tests/fixtures_attended_results/standalone/files-find/fixture_csharp.cs.json +5 -0
  200. package/tests/fixtures_attended_results/standalone/files-find/fixture_elixir.ex.json +5 -0
  201. package/tests/fixtures_attended_results/standalone/files-find/fixture_go.go.json +5 -0
  202. package/tests/fixtures_attended_results/standalone/files-find/fixture_haskell.hs.json +5 -0
  203. package/tests/fixtures_attended_results/standalone/files-find/fixture_java.java.json +5 -0
  204. package/tests/fixtures_attended_results/standalone/files-find/fixture_javascript.js.json +5 -0
  205. package/tests/fixtures_attended_results/standalone/files-find/fixture_kotlin.kt.json +5 -0
  206. package/tests/fixtures_attended_results/standalone/files-find/fixture_lua.lua.json +5 -0
  207. package/tests/fixtures_attended_results/standalone/files-find/fixture_perl.pl.json +5 -0
  208. package/tests/fixtures_attended_results/standalone/files-find/fixture_php.php.json +5 -0
  209. package/tests/fixtures_attended_results/standalone/files-find/fixture_python.py.json +5 -0
  210. package/tests/fixtures_attended_results/standalone/files-find/fixture_ruby.rb.json +5 -0
  211. package/tests/fixtures_attended_results/standalone/files-find/fixture_rust.rs.json +5 -0
  212. package/tests/fixtures_attended_results/standalone/files-find/fixture_scala.scala.json +5 -0
  213. package/tests/fixtures_attended_results/standalone/files-find/fixture_shell.sh.json +5 -0
  214. package/tests/fixtures_attended_results/standalone/files-find/fixture_swift.swift.json +5 -0
  215. package/tests/fixtures_attended_results/standalone/files-find/fixture_typescript.ts.json +5 -0
  216. package/tests/fixtures_attended_results/standalone/files-find/fixture_zig.zig.json +5 -0
  217. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_c.c.json +5 -0
  218. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_cpp.cpp.json +5 -0
  219. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_csharp.cs.json +5 -0
  220. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_elixir.ex.json +5 -0
  221. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_go.go.json +5 -0
  222. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_haskell.hs.json +5 -0
  223. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_java.java.json +5 -0
  224. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_javascript.js.json +5 -0
  225. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_kotlin.kt.json +5 -0
  226. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_lua.lua.json +5 -0
  227. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_perl.pl.json +5 -0
  228. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_php.php.json +5 -0
  229. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_python.py.json +5 -0
  230. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_ruby.rb.json +5 -0
  231. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_rust.rs.json +5 -0
  232. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_scala.scala.json +5 -0
  233. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_shell.sh.json +5 -0
  234. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_swift.swift.json +5 -0
  235. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_typescript.ts.json +5 -0
  236. package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_zig.zig.json +5 -0
  237. package/tests/fixtures_attended_results/standalone/files-references/fixture_c.c.json +5 -0
  238. package/tests/fixtures_attended_results/standalone/files-references/fixture_cpp.cpp.json +5 -0
  239. package/tests/fixtures_attended_results/standalone/files-references/fixture_csharp.cs.json +5 -0
  240. package/tests/fixtures_attended_results/standalone/files-references/fixture_elixir.ex.json +5 -0
  241. package/tests/fixtures_attended_results/standalone/files-references/fixture_go.go.json +5 -0
  242. package/tests/fixtures_attended_results/standalone/files-references/fixture_haskell.hs.json +5 -0
  243. package/tests/fixtures_attended_results/standalone/files-references/fixture_java.java.json +5 -0
  244. package/tests/fixtures_attended_results/standalone/files-references/fixture_javascript.js.json +5 -0
  245. package/tests/fixtures_attended_results/standalone/files-references/fixture_kotlin.kt.json +5 -0
  246. package/tests/fixtures_attended_results/standalone/files-references/fixture_lua.lua.json +5 -0
  247. package/tests/fixtures_attended_results/standalone/files-references/fixture_perl.pl.json +5 -0
  248. package/tests/fixtures_attended_results/standalone/files-references/fixture_php.php.json +5 -0
  249. package/tests/fixtures_attended_results/standalone/files-references/fixture_python.py.json +5 -0
  250. package/tests/fixtures_attended_results/standalone/files-references/fixture_ruby.rb.json +5 -0
  251. package/tests/fixtures_attended_results/standalone/files-references/fixture_rust.rs.json +5 -0
  252. package/tests/fixtures_attended_results/standalone/files-references/fixture_scala.scala.json +5 -0
  253. package/tests/fixtures_attended_results/standalone/files-references/fixture_shell.sh.json +5 -0
  254. package/tests/fixtures_attended_results/standalone/files-references/fixture_swift.swift.json +5 -0
  255. package/tests/fixtures_attended_results/standalone/files-references/fixture_typescript.ts.json +5 -0
  256. package/tests/fixtures_attended_results/standalone/files-references/fixture_zig.zig.json +5 -0
  257. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_c.c.json +5 -0
  258. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_cpp.cpp.json +5 -0
  259. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_csharp.cs.json +5 -0
  260. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_elixir.ex.json +5 -0
  261. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_go.go.json +5 -0
  262. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_haskell.hs.json +5 -0
  263. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_java.java.json +5 -0
  264. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_javascript.js.json +5 -0
  265. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_kotlin.kt.json +5 -0
  266. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_lua.lua.json +5 -0
  267. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_perl.pl.json +5 -0
  268. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_php.php.json +5 -0
  269. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_python.py.json +5 -0
  270. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_ruby.rb.json +5 -0
  271. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_rust.rs.json +5 -0
  272. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_scala.scala.json +5 -0
  273. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_shell.sh.json +5 -0
  274. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_swift.swift.json +5 -0
  275. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_typescript.ts.json +5 -0
  276. package/tests/fixtures_attended_results/standalone/files-tokens/fixture_zig.zig.json +5 -0
  277. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_c.c.json +5 -0
  278. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_cpp.cpp.json +5 -0
  279. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_csharp.cs.json +5 -0
  280. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_elixir.ex.json +5 -0
  281. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_go.go.json +5 -0
  282. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_haskell.hs.json +5 -0
  283. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_java.java.json +5 -0
  284. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_javascript.js.json +5 -0
  285. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_kotlin.kt.json +5 -0
  286. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_lua.lua.json +5 -0
  287. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_perl.pl.json +5 -0
  288. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_php.php.json +5 -0
  289. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_python.py.json +5 -0
  290. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_ruby.rb.json +5 -0
  291. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_rust.rs.json +5 -0
  292. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_scala.scala.json +5 -0
  293. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_shell.sh.json +5 -0
  294. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_swift.swift.json +5 -0
  295. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_typescript.ts.json +5 -0
  296. package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_zig.zig.json +5 -0
  297. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_c.c.json +5 -0
  298. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_cpp.cpp.json +5 -0
  299. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_csharp.cs.json +5 -0
  300. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_elixir.ex.json +5 -0
  301. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_go.go.json +5 -0
  302. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_haskell.hs.json +5 -0
  303. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_java.java.json +5 -0
  304. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_javascript.js.json +5 -0
  305. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_kotlin.kt.json +5 -0
  306. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_lua.lua.json +5 -0
  307. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_perl.pl.json +5 -0
  308. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_php.php.json +5 -0
  309. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_python.py.json +5 -0
  310. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_ruby.rb.json +5 -0
  311. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_rust.rs.json +5 -0
  312. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_scala.scala.json +5 -0
  313. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_shell.sh.json +5 -0
  314. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_swift.swift.json +5 -0
  315. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_typescript.ts.json +5 -0
  316. package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_zig.zig.json +5 -0
  317. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_c.c.json +5 -0
  318. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_cpp.cpp.json +5 -0
  319. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_csharp.cs.json +5 -0
  320. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_elixir.ex.json +5 -0
  321. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_go.go.json +5 -0
  322. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_haskell.hs.json +5 -0
  323. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_java.java.json +5 -0
  324. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_javascript.js.json +5 -0
  325. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_kotlin.kt.json +5 -0
  326. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_lua.lua.json +5 -0
  327. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_perl.pl.json +5 -0
  328. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_php.php.json +5 -0
  329. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_python.py.json +5 -0
  330. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_ruby.rb.json +5 -0
  331. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_rust.rs.json +5 -0
  332. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_scala.scala.json +5 -0
  333. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_shell.sh.json +5 -0
  334. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_swift.swift.json +5 -0
  335. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_typescript.ts.json +5 -0
  336. package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_zig.zig.json +5 -0
  337. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_c.c.json +5 -0
  338. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_cpp.cpp.json +5 -0
  339. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_csharp.cs.json +5 -0
  340. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_elixir.ex.json +5 -0
  341. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_go.go.json +5 -0
  342. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_haskell.hs.json +5 -0
  343. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_java.java.json +5 -0
  344. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_javascript.js.json +5 -0
  345. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_kotlin.kt.json +5 -0
  346. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_lua.lua.json +5 -0
  347. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_perl.pl.json +5 -0
  348. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_php.php.json +5 -0
  349. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_python.py.json +5 -0
  350. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_ruby.rb.json +5 -0
  351. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_rust.rs.json +5 -0
  352. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_scala.scala.json +5 -0
  353. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_shell.sh.json +5 -0
  354. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_swift.swift.json +5 -0
  355. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_typescript.ts.json +5 -0
  356. package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_zig.zig.json +5 -0
  357. package/tests/helpers.ts +204 -0
  358. package/tests/oracle-project.test.ts +63 -0
  359. package/tests/oracle-standalone.test.ts +48 -0
  360. package/tests/prompt-rendering.test.ts +66 -0
  361. package/tests/release-workflow.test.ts +133 -0
@@ -0,0 +1,341 @@
1
+ // @file fixture_go.go
2
+ // @brief Go language test fixture.
3
+ // @details Parser validation constructs.
4
+
5
+ // Single line comment
6
+ /* Multi-line
7
+ comment */
8
+
9
+ // Package main is the entry point for the application.
10
+ // It demonstrates Go-specific constructs including generics,
11
+ // goroutines, channels, embedded structs, and type switches.
12
+ package main
13
+
14
+ import (
15
+ "context"
16
+ "fmt"
17
+ "io"
18
+ "sync"
19
+ )
20
+
21
+ /* ── Constants and variables ──────────────────────────────────────────── */
22
+
23
+ // MaxSize defines the upper bound for buffer allocation.
24
+ const MaxSize = 100
25
+
26
+ // globalVar is a package-level mutable counter.
27
+ var globalVar = 0
28
+
29
+ // Iota-based enum-like constants for log levels.
30
+ const (
31
+ // LogDebug is the most verbose logging level.
32
+ LogDebug = iota
33
+ // LogInfo is the standard informational level.
34
+ LogInfo
35
+ // LogError logs only error conditions.
36
+ LogError
37
+ )
38
+
39
+ /* ── Struct definitions ───────────────────────────────────────────────── */
40
+
41
+ // Server represents an HTTP server with host and port configuration.
42
+ // It embeds sync.Mutex for concurrent access protection.
43
+ type Server struct {
44
+ Port int // Port number the server listens on.
45
+ Host string // Hostname or IP address to bind to.
46
+ sync.Mutex // Embedded mutex for thread-safe operations.
47
+ handlers map[string]HandlerFunc // Route handler registry.
48
+ }
49
+
50
+ // HandlerFunc defines the signature for HTTP request handlers.
51
+ type HandlerFunc func(ctx context.Context, req []byte) ([]byte, error)
52
+
53
+ // Embedded struct demonstrating composition over inheritance.
54
+ type Address struct {
55
+ Street string // Street name and number.
56
+ City string // City name.
57
+ Zip string // Postal/ZIP code.
58
+ }
59
+
60
+ // Employee composes Person-like fields with an embedded Address.
61
+ type Employee struct {
62
+ Name string // Full name of the employee.
63
+ Age int // Age in years.
64
+ Address // Embedded address (promoted fields).
65
+ Manager *Employee // Optional reference to reporting manager.
66
+ }
67
+
68
+ /* ── Interface definitions ────────────────────────────────────────────── */
69
+
70
+ // Handler defines the interface for request processing components.
71
+ type Handler interface {
72
+ // Handle processes a request and returns a response.
73
+ Handle(ctx context.Context, data []byte) error
74
+ }
75
+
76
+ // ReadWriteCloser composes standard io interfaces.
77
+ type ReadWriteCloser interface {
78
+ io.Reader
79
+ io.Writer
80
+ io.Closer
81
+ }
82
+
83
+ /* ── Type aliases and definitions ─────────────────────────────────────── */
84
+
85
+ // MyInt is a custom integer type supporting additional methods.
86
+ type MyInt int
87
+
88
+ // String returns the string representation of MyInt.
89
+ func (m MyInt) String() string {
90
+ return fmt.Sprintf("MyInt(%d)", int(m))
91
+ }
92
+
93
+ /* ── Generic types (Go 1.18+) ─────────────────────────────────────────── */
94
+
95
+ // Pair holds two values of potentially different types.
96
+ // @tparam A The type of the first element.
97
+ // @tparam B The type of the second element.
98
+ type Pair[A any, B any] struct {
99
+ First A // First element of the pair.
100
+ Second B // Second element of the pair.
101
+ }
102
+
103
+ // Ordered constrains types that support comparison operators.
104
+ type Ordered interface {
105
+ ~int | ~float64 | ~string
106
+ }
107
+
108
+ /* ── Functions ────────────────────────────────────────────────────────── */
109
+
110
+ // main is the application entry point.
111
+ func main() {
112
+ fmt.Println("hello")
113
+ }
114
+
115
+ // init runs before main for package-level initialization.
116
+ func init() {
117
+ // Package initialization — set default global state
118
+ globalVar = 1
119
+ }
120
+
121
+ // Start begins listening on the configured host and port.
122
+ // @receiver s Pointer to Server instance.
123
+ func (s *Server) Start() error {
124
+ s.Lock()
125
+ defer s.Unlock()
126
+ // Validate port before binding
127
+ if s.Port <= 0 {
128
+ return fmt.Errorf("invalid port: %d", s.Port)
129
+ }
130
+ fmt.Printf("Starting on %s:%d\n", s.Host, s.Port)
131
+ return nil
132
+ }
133
+
134
+ // Register adds a handler function for a specific route path.
135
+ // @receiver s Pointer to Server.
136
+ // @param path The URL path to register.
137
+ // @param handler The function to invoke for this path.
138
+ func (s *Server) Register(path string, handler HandlerFunc) {
139
+ if s.handlers == nil {
140
+ s.handlers = make(map[string]HandlerFunc)
141
+ }
142
+ s.handlers[path] = handler
143
+ }
144
+
145
+ /* ── Generic function ─────────────────────────────────────────────────── */
146
+
147
+ // Max returns the larger of two ordered values.
148
+ // @tparam T Type constrained to Ordered interface.
149
+ // @param a First value.
150
+ // @param b Second value.
151
+ // @return The greater of a and b.
152
+ func Max[T Ordered](a, b T) T {
153
+ if a > b {
154
+ return a
155
+ }
156
+ return b
157
+ }
158
+
159
+ // Filter returns elements matching a predicate.
160
+ // @tparam T Element type (any).
161
+ // @param items Slice of items to filter.
162
+ // @param pred Predicate function returning true to keep element.
163
+ // @return Filtered slice.
164
+ func Filter[T any](items []T, pred func(T) bool) []T {
165
+ result := make([]T, 0)
166
+ for _, item := range items {
167
+ if pred(item) {
168
+ result = append(result, item)
169
+ }
170
+ }
171
+ return result
172
+ }
173
+
174
+ /* ── Multiple return values ───────────────────────────────────────────── */
175
+
176
+ // Divide performs safe integer division with error handling.
177
+ // @param a Dividend.
178
+ // @param b Divisor; must not be zero.
179
+ // @return Quotient and remainder, or error if b is zero.
180
+ func Divide(a, b int) (int, int, error) {
181
+ if b == 0 {
182
+ return 0, 0, fmt.Errorf("division by zero")
183
+ }
184
+ return a / b, a % b, nil
185
+ }
186
+
187
+ /* ── Named return values ──────────────────────────────────────────────── */
188
+
189
+ // ParseConfig extracts host and port from a config string.
190
+ // @param input Configuration string in "host:port" format.
191
+ // @return Named host and port values, or error.
192
+ func ParseConfig(input string) (host string, port int, err error) {
193
+ // Named returns allow bare return in simple cases
194
+ _, scanErr := fmt.Sscanf(input, "%s:%d", &host, &port)
195
+ if scanErr != nil {
196
+ err = scanErr
197
+ return
198
+ }
199
+ return
200
+ }
201
+
202
+ /* ── Closure ──────────────────────────────────────────────────────────── */
203
+
204
+ // Counter returns a closure that increments and returns a count.
205
+ // @return Closure yielding successive integer counts.
206
+ func Counter() func() int {
207
+ count := 0
208
+ return func() int {
209
+ // Capture count from enclosing scope
210
+ count++
211
+ return count
212
+ }
213
+ }
214
+
215
+ /* ── Goroutine and channels ───────────────────────────────────────────── */
216
+
217
+ // FanOut distributes work across n goroutines via channels.
218
+ // @param items Slice of strings to process.
219
+ // @param workers Number of concurrent worker goroutines.
220
+ // @return Channel delivering processed results.
221
+ func FanOut(items []string, workers int) <-chan string {
222
+ results := make(chan string, len(items))
223
+ var wg sync.WaitGroup
224
+
225
+ for i := 0; i < workers; i++ {
226
+ wg.Add(1)
227
+ go func(id int) {
228
+ defer wg.Done()
229
+ // Each worker processes items from the slice
230
+ for _, item := range items {
231
+ results <- fmt.Sprintf("[%d] %s", id, item)
232
+ }
233
+ }(i)
234
+ }
235
+
236
+ // Close channel when all workers finish
237
+ go func() {
238
+ wg.Wait()
239
+ close(results)
240
+ }()
241
+
242
+ return results
243
+ }
244
+
245
+ /* ── Type switch ──────────────────────────────────────────────────────── */
246
+
247
+ // Describe returns a description string for any value using type switch.
248
+ // @param v Any value to describe.
249
+ // @return Human-readable type description.
250
+ func Describe(v interface{}) string {
251
+ switch val := v.(type) {
252
+ case int:
253
+ return fmt.Sprintf("int: %d", val)
254
+ case string:
255
+ return fmt.Sprintf("string: %q", val)
256
+ case bool:
257
+ if val {
258
+ return "bool: true"
259
+ }
260
+ return "bool: false"
261
+ case nil:
262
+ return "nil"
263
+ default:
264
+ return fmt.Sprintf("unknown: %T", val)
265
+ }
266
+ }
267
+
268
+ /* ── Defer and panic recovery ─────────────────────────────────────────── */
269
+
270
+ // SafeExecute runs a function with panic recovery.
271
+ // @param fn The function to execute safely.
272
+ // @return Error if fn panicked, nil otherwise.
273
+ func SafeExecute(fn func()) (err error) {
274
+ defer func() {
275
+ if r := recover(); r != nil {
276
+ // Convert panic to error
277
+ err = fmt.Errorf("panic: %v", r)
278
+ }
279
+ }()
280
+ fn()
281
+ return nil
282
+ }
283
+
284
+ /* coverage extension block */
285
+ package utilx
286
+ package configx
287
+ package jobsx
288
+ package metricx
289
+ import "os"
290
+ import "time"
291
+ import "strings"
292
+ import "bytes"
293
+ func (s *Server) Stop() {}
294
+ func (s *Server) Reset() {}
295
+ type Session struct { Id string }
296
+ type Bucket struct { Name string }
297
+ type Closer interface { Close() error }
298
+ type Starter interface { Start() error }
299
+ type UserAlias string
300
+ type Amount int
301
+ type Resolver func(string) error
302
+ const RetryCount = 3
303
+ var LastError error
304
+
305
+ // REQ-COVER-SRS-231 START
306
+ // @REQ-COVER-SRS-231 block 1
307
+ // @brief Coverage helper construct 1.
308
+ // @details Provides deterministic fixture-level Doxygen coverage block 1.
309
+ // @param value Input value for helper construct 1.
310
+ // @return Output value for helper construct 1.
311
+ func reqCoverGo1(value int) int { return value + 1 }
312
+
313
+ // @REQ-COVER-SRS-231 block 2
314
+ // @brief Coverage helper construct 2.
315
+ // @details Provides deterministic fixture-level Doxygen coverage block 2.
316
+ // @param value Input value for helper construct 2.
317
+ // @return Output value for helper construct 2.
318
+ func reqCoverGo2(value int) int { return value + 2 }
319
+
320
+ // @REQ-COVER-SRS-231 block 3
321
+ // @brief Coverage helper construct 3.
322
+ // @details Provides deterministic fixture-level Doxygen coverage block 3.
323
+ // @param value Input value for helper construct 3.
324
+ // @return Output value for helper construct 3.
325
+ func reqCoverGo3(value int) int { return value + 3 }
326
+
327
+ // @REQ-COVER-SRS-231 block 4
328
+ // @brief Coverage helper construct 4.
329
+ // @details Provides deterministic fixture-level Doxygen coverage block 4.
330
+ // @param value Input value for helper construct 4.
331
+ // @return Output value for helper construct 4.
332
+ func reqCoverGo4(value int) int { return value + 4 }
333
+
334
+ // @REQ-COVER-SRS-231 block 5
335
+ // @brief Coverage helper construct 5.
336
+ // @details Provides deterministic fixture-level Doxygen coverage block 5.
337
+ // @param value Input value for helper construct 5.
338
+ // @return Output value for helper construct 5.
339
+ func reqCoverGo5(value int) int { return value + 5 }
340
+
341
+ // REQ-COVER-SRS-231 END
@@ -0,0 +1,250 @@
1
+ -- @file fixture_haskell.hs
2
+ -- @brief Comprehensive Haskell test fixture for parser validation.
3
+ -- @details Covers typeclasses with instances, GADTs, type families,
4
+ -- monadic computations, applicatives, pattern guards,
5
+ -- where clauses, let bindings, and deriving strategies.
6
+ -- Single line comment
7
+ {- Multi-line
8
+ comment -}
9
+
10
+ -- | Module declaration with explicit export list.
11
+ module MyModule
12
+ ( Name
13
+ , Person(..)
14
+ , Printable(..)
15
+ , Expr(..)
16
+ , greet
17
+ , safeDiv
18
+ , processList
19
+ , fibonacci
20
+ ) where
21
+
22
+ import Data.List (sort, nub, intercalate)
23
+ import Data.Maybe (fromMaybe, isJust)
24
+ import qualified Data.Map as Map
25
+ import Control.Monad (when, unless, forM_)
26
+
27
+ -- ── Type aliases ───────────────────────────────────────────────────────
28
+
29
+ -- | Simple alias for human-readable name strings.
30
+ type Name = String
31
+
32
+ -- | Mapping from string keys to integer values.
33
+ type Config = Map.Map String Int
34
+
35
+ -- | Function type alias for transformations.
36
+ type Transform a = a -> a
37
+
38
+ -- ── Data types ─────────────────────────────────────────────────────────
39
+
40
+ -- | Record type representing a person with name and age fields.
41
+ -- Used as the primary entity throughout this module.
42
+ data Person = Person
43
+ { personName :: String -- ^ Full name of the person.
44
+ , personAge :: Int -- ^ Age in years (non-negative).
45
+ } deriving (Show, Eq, Ord)
46
+
47
+ -- | Binary tree data structure with parameterized element type.
48
+ -- Supports insertion, lookup, and fold operations.
49
+ data Tree a
50
+ = Leaf -- ^ Empty tree (base case).
51
+ | Node a (Tree a) (Tree a) -- ^ Node with value and subtrees.
52
+ deriving (Show, Eq)
53
+
54
+ -- | Expression AST for a simple calculator language.
55
+ -- Demonstrates GADT-like pattern (standard ADT form).
56
+ data Expr
57
+ = Lit Double -- ^ Numeric literal.
58
+ | Add Expr Expr -- ^ Addition of two expressions.
59
+ | Mul Expr Expr -- ^ Multiplication of two expressions.
60
+ | Neg Expr -- ^ Negation of an expression.
61
+ deriving (Show)
62
+
63
+ -- | Result type for operations that may fail.
64
+ data Result a
65
+ = Ok a -- ^ Successful result carrying a value.
66
+ | Err String -- ^ Error result with message.
67
+ deriving (Show)
68
+
69
+ -- ── Typeclasses ────────────────────────────────────────────────────────
70
+
71
+ -- | Typeclass for types that can be printed as formatted strings.
72
+ class Printable a where
73
+ -- | Convert a value to its formatted string representation.
74
+ printIt :: a -> String
75
+
76
+ -- | Convert a value to a debug string (default implementation).
77
+ debugPrint :: a -> String
78
+ debugPrint x = "Debug: " ++ printIt x
79
+
80
+ -- | Typeclass for types that can be serialized to key-value pairs.
81
+ class Serializable a where
82
+ -- | Serialize a value to a list of key-value string pairs.
83
+ serialize :: a -> [(String, String)]
84
+
85
+ -- ── Typeclass instances ────────────────────────────────────────────────
86
+
87
+ -- | Printable instance for Person; formats as "Name (Age)".
88
+ instance Printable Person where
89
+ printIt p = personName p ++ " (" ++ show (personAge p) ++ ")"
90
+
91
+ -- | Serializable instance for Person.
92
+ instance Serializable Person where
93
+ serialize p =
94
+ [ ("name", personName p)
95
+ , ("age", show (personAge p))
96
+ ]
97
+
98
+ -- | Functor instance for Tree enabling fmap over tree nodes.
99
+ instance Functor Tree where
100
+ fmap _ Leaf = Leaf
101
+ fmap f (Node x l r) = Node (f x) (fmap f l) (fmap f r)
102
+
103
+ -- | Functor instance for Result.
104
+ instance Functor Result where
105
+ fmap f (Ok a) = Ok (f a)
106
+ fmap _ (Err e) = Err e
107
+
108
+ -- ── Functions ──────────────────────────────────────────────────────────
109
+
110
+ -- @brief Produce a greeting string for a given name. @details Uses string concatenation with the (++) operator. @param name Input name value. @return Greeting message.
111
+ -- Deterministic helper for basic string assembly.
112
+ greet :: String -> String
113
+ greet name = "Hello " ++ name
114
+
115
+ -- @brief Safe division returning Nothing on division by zero. @details Demonstrates pattern guards for conditional logic. @param x Numerator value. @return Maybe quotient.
116
+ -- Returns Nothing when the denominator equals zero.
117
+ safeDiv :: Double -> Double -> Maybe Double
118
+ safeDiv _ 0 = Nothing
119
+ safeDiv x y = Just (x / y)
120
+
121
+ -- @brief Evaluate an expression AST to its numeric result. @details Recursively traverses the expression tree. @param expr Expression to evaluate. @return Numeric result.
122
+ -- Handles literals, sums, products, and negations.
123
+ eval :: Expr -> Double
124
+ eval (Lit n) = n
125
+ eval (Add a b) = eval a + eval b
126
+ eval (Mul a b) = eval a * eval b
127
+ eval (Neg e) = -(eval e)
128
+
129
+ -- @brief Process a list of integers with multiple filter stages. @details Removes duplicates, sorts, and filters positive values. @param xs Input integer list. @return Processed integer list.
130
+ -- Preserves deterministic ordering and positivity constraint.
131
+ processList :: [Int] -> [Int]
132
+ processList xs = result
133
+ where
134
+ -- Remove duplicates first
135
+ unique = nub xs
136
+ -- Sort in ascending order
137
+ sorted = sort unique
138
+ -- Keep only positive values
139
+ result = filter (> 0) sorted
140
+
141
+ -- @brief Compute the nth Fibonacci number using pattern matching. @details Uses accumulator recursion for efficiency. @param n Sequence index. @return Fibonacci value at index n.
142
+ -- Rejects negative input through an explicit error branch.
143
+ fibonacci :: Int -> Integer
144
+ fibonacci n
145
+ | n < 0 = error "negative input"
146
+ | n == 0 = 0
147
+ | n == 1 = 1
148
+ | otherwise = go n 0 1
149
+ where
150
+ go 0 a _ = a
151
+ go k a b = go (k - 1) b (a + b)
152
+
153
+ -- | Insert a value into a binary search tree.
154
+ -- Maintains BST ordering invariant.
155
+ insertTree :: (Ord a) => a -> Tree a -> Tree a
156
+ insertTree x Leaf = Node x Leaf Leaf
157
+ insertTree x (Node y left right)
158
+ | x < y = Node y (insertTree x left) right
159
+ | x > y = Node y left (insertTree x right)
160
+ | otherwise = Node y left right
161
+
162
+ -- | Fold a tree to a single value using a combining function.
163
+ -- Performs an in-order traversal.
164
+ foldTree :: (b -> a -> b) -> b -> Tree a -> b
165
+ foldTree _ acc Leaf = acc
166
+ foldTree f acc (Node x l r) =
167
+ let leftAcc = foldTree f acc l
168
+ midAcc = f leftAcc x
169
+ in foldTree f midAcc r
170
+
171
+ -- | Lookup a value in a config map with a default fallback.
172
+ -- Demonstrates Maybe handling with fromMaybe.
173
+ lookupConfig :: Config -> String -> Int -> Int
174
+ lookupConfig cfg key def = fromMaybe def (Map.lookup key cfg)
175
+
176
+ -- | Apply a transformation function n times to an initial value.
177
+ -- Higher-order function with explicit recursion.
178
+ applyN :: Int -> Transform a -> a -> a
179
+ applyN 0 _ x = x
180
+ applyN n f x = applyN (n - 1) f (f x)
181
+
182
+ -- | Format a list of persons as a comma-separated string.
183
+ -- Combines typeclass method with list processing.
184
+ formatPersons :: (Printable a) => [a] -> String
185
+ formatPersons ps = intercalate ", " (map printIt ps)
186
+
187
+ -- | Monadic computation chaining multiple Maybe operations.
188
+ -- Returns Nothing if any step fails.
189
+ safeCompute :: Double -> Double -> Double -> Maybe Double
190
+ safeCompute x y z = do
191
+ -- Each step may fail (division by zero)
192
+ a <- safeDiv x y
193
+ b <- safeDiv a z
194
+ return (a + b)
195
+
196
+ {- coverage extension block -}
197
+ module Extra.One where
198
+ module Extra.Two where
199
+ module Extra.Three where
200
+ module Extra.Four where
201
+ import qualified Data.Set as Set
202
+ type RequestId = Int
203
+ type ResponseId = Int
204
+ class Renderable a where
205
+ class Parsable a where
206
+ class Executable a where
207
+ data Envelope = Envelope String
208
+
209
+ -- REQ-COVER-SRS-231 START
210
+ -- @REQ-COVER-SRS-231 block 1
211
+ -- @brief Coverage helper construct 1.
212
+ -- @details Provides deterministic fixture-level Doxygen coverage block 1.
213
+ -- @param value Input value for helper construct 1.
214
+ -- @return Output value for helper construct 1.
215
+ reqCoverHaskell1 :: Int -> Int
216
+ reqCoverHaskell1 value = value + 1
217
+
218
+ -- @REQ-COVER-SRS-231 block 2
219
+ -- @brief Coverage helper construct 2.
220
+ -- @details Provides deterministic fixture-level Doxygen coverage block 2.
221
+ -- @param value Input value for helper construct 2.
222
+ -- @return Output value for helper construct 2.
223
+ reqCoverHaskell2 :: Int -> Int
224
+ reqCoverHaskell2 value = value + 2
225
+
226
+ -- @REQ-COVER-SRS-231 block 3
227
+ -- @brief Coverage helper construct 3.
228
+ -- @details Provides deterministic fixture-level Doxygen coverage block 3.
229
+ -- @param value Input value for helper construct 3.
230
+ -- @return Output value for helper construct 3.
231
+ reqCoverHaskell3 :: Int -> Int
232
+ reqCoverHaskell3 value = value + 3
233
+
234
+ -- @REQ-COVER-SRS-231 block 4
235
+ -- @brief Coverage helper construct 4.
236
+ -- @details Provides deterministic fixture-level Doxygen coverage block 4.
237
+ -- @param value Input value for helper construct 4.
238
+ -- @return Output value for helper construct 4.
239
+ reqCoverHaskell4 :: Int -> Int
240
+ reqCoverHaskell4 value = value + 4
241
+
242
+ -- @REQ-COVER-SRS-231 block 5
243
+ -- @brief Coverage helper construct 5.
244
+ -- @details Provides deterministic fixture-level Doxygen coverage block 5.
245
+ -- @param value Input value for helper construct 5.
246
+ -- @return Output value for helper construct 5.
247
+ reqCoverHaskell5 :: Int -> Int
248
+ reqCoverHaskell5 value = value + 5
249
+
250
+ -- REQ-COVER-SRS-231 END