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.
- package/.g.conf +20 -0
- package/.github/workflows/release-npm.yml +131 -0
- package/.gitignore +270 -0
- package/CHANGELOG.md +221 -0
- package/LICENSE +674 -0
- package/README.md +260 -0
- package/TODO.md +20 -0
- package/docs/pi.dev/agent-document-manifest.json +6399 -0
- package/docs/pi.dev/coding-agent-docs/compaction.md +394 -0
- package/docs/pi.dev/coding-agent-docs/custom-provider.md +596 -0
- package/docs/pi.dev/coding-agent-docs/development.md +71 -0
- package/docs/pi.dev/coding-agent-docs/extensions.md +2262 -0
- package/docs/pi.dev/coding-agent-docs/images/doom-extension.png +0 -0
- package/docs/pi.dev/coding-agent-docs/images/exy.png +0 -0
- package/docs/pi.dev/coding-agent-docs/images/interactive-mode.png +0 -0
- package/docs/pi.dev/coding-agent-docs/images/tree-view.png +0 -0
- package/docs/pi.dev/coding-agent-docs/json.md +82 -0
- package/docs/pi.dev/coding-agent-docs/keybindings.md +175 -0
- package/docs/pi.dev/coding-agent-docs/models.md +392 -0
- package/docs/pi.dev/coding-agent-docs/packages.md +218 -0
- package/docs/pi.dev/coding-agent-docs/prompt-templates.md +67 -0
- package/docs/pi.dev/coding-agent-docs/providers.md +195 -0
- package/docs/pi.dev/coding-agent-docs/rpc.md +1377 -0
- package/docs/pi.dev/coding-agent-docs/sdk.md +1124 -0
- package/docs/pi.dev/coding-agent-docs/session.md +412 -0
- package/docs/pi.dev/coding-agent-docs/settings.md +247 -0
- package/docs/pi.dev/coding-agent-docs/shell-aliases.md +13 -0
- package/docs/pi.dev/coding-agent-docs/skills.md +232 -0
- package/docs/pi.dev/coding-agent-docs/terminal-setup.md +106 -0
- package/docs/pi.dev/coding-agent-docs/termux.md +127 -0
- package/docs/pi.dev/coding-agent-docs/themes.md +295 -0
- package/docs/pi.dev/coding-agent-docs/tmux.md +61 -0
- package/docs/pi.dev/coding-agent-docs/tree.md +231 -0
- package/docs/pi.dev/coding-agent-docs/tui.md +887 -0
- package/docs/pi.dev/coding-agent-docs/windows.md +17 -0
- package/docs/pi.dev/mom-docs/artifacts-server.md +475 -0
- package/docs/pi.dev/mom-docs/events.md +307 -0
- package/docs/pi.dev/mom-docs/new.md +970 -0
- package/docs/pi.dev/mom-docs/sandbox.md +153 -0
- package/docs/pi.dev/mom-docs/slack-bot-minimal-guide.md +399 -0
- package/docs/pi.dev/mom-docs/v86.md +319 -0
- package/docs/pi.dev/pods-docs/gml-4.5.md +189 -0
- package/docs/pi.dev/pods-docs/gpt-oss.md +233 -0
- package/docs/pi.dev/pods-docs/implementation-plan.md +183 -0
- package/docs/pi.dev/pods-docs/kimi-k2.md +197 -0
- package/docs/pi.dev/pods-docs/models.md +116 -0
- package/docs/pi.dev/pods-docs/plan.md +166 -0
- package/docs/pi.dev/pods-docs/qwen3-coder.md +132 -0
- package/images/flowchart-bw.png +0 -0
- package/images/flowchart-bw.svg +102 -0
- package/images/flowchart.md +100 -0
- package/images/flowchart.png +0 -0
- package/images/flowchart.svg +3 -0
- package/package.json +46 -0
- package/req/docs/REFERENCES.md +4554 -0
- package/req/docs/REQUIREMENTS.md +475 -0
- package/req/docs/WORKFLOW.md +1059 -0
- package/scripts/debug-extension.ts +497 -0
- package/scripts/lib/extension-debug-harness.ts +450 -0
- package/scripts/lib/recording-extension-api.ts +786 -0
- package/scripts/lib/sdk-smoke.ts +503 -0
- package/scripts/pi-usereq-debug.sh +330 -0
- package/scripts/tool-args-to-params.ts +208 -0
- package/src/cli.ts +349 -0
- package/src/core/agent-tool-json.ts +621 -0
- package/src/core/compress-files.ts +72 -0
- package/src/core/compress-payload.ts +648 -0
- package/src/core/compress.ts +464 -0
- package/src/core/config.ts +272 -0
- package/src/core/doxygen-parser.ts +318 -0
- package/src/core/errors.ts +31 -0
- package/src/core/extension-status.ts +660 -0
- package/src/core/find-constructs.ts +319 -0
- package/src/core/find-payload.ts +915 -0
- package/src/core/generate-markdown.ts +120 -0
- package/src/core/path-context.ts +196 -0
- package/src/core/pi-notify.ts +430 -0
- package/src/core/pi-usereq-tools.ts +140 -0
- package/src/core/prompts.ts +184 -0
- package/src/core/reference-payload.ts +818 -0
- package/src/core/resources.ts +63 -0
- package/src/core/runtime-project-paths.ts +99 -0
- package/src/core/settings-menu.ts +233 -0
- package/src/core/source-analyzer.ts +1721 -0
- package/src/core/static-check.ts +674 -0
- package/src/core/token-counter.ts +729 -0
- package/src/core/tool-runner.ts +717 -0
- package/src/core/utils.ts +185 -0
- package/src/index.ts +2209 -0
- package/src/resources/guidelines/Google_C++_Style_Guide.md +3711 -0
- package/src/resources/guidelines/Google_Python_Style_Guide.md +3709 -0
- package/src/resources/prompts/analyze.md +130 -0
- package/src/resources/prompts/change.md +227 -0
- package/src/resources/prompts/check.md +139 -0
- package/src/resources/prompts/cover.md +219 -0
- package/src/resources/prompts/create.md +104 -0
- package/src/resources/prompts/fix.md +221 -0
- package/src/resources/prompts/flowchart.md +220 -0
- package/src/resources/prompts/implement.md +163 -0
- package/src/resources/prompts/new.md +226 -0
- package/src/resources/prompts/readme.md +182 -0
- package/src/resources/prompts/recreate.md +213 -0
- package/src/resources/prompts/refactor.md +213 -0
- package/src/resources/prompts/references.md +100 -0
- package/src/resources/prompts/renumber.md +119 -0
- package/src/resources/prompts/workflow.md +202 -0
- package/src/resources/prompts/write.md +99 -0
- package/src/resources/sounds/Machine-alert-beep-sound-effect.mp3 +0 -0
- package/src/resources/sounds/Soft-high-tech-notification-sound-effect.mp3 +0 -0
- package/src/resources/templates/Document_Source_Code_in_Doxygen_Style.md +130 -0
- package/src/resources/templates/HDT_Test_Authoring_Guide.md +318 -0
- package/src/resources/templates/Requirements_Template.md +78 -0
- package/tests/attended-results-scenarios.ts +758 -0
- package/tests/attended-results.test.ts +39 -0
- package/tests/cli-command-option-parity.test.ts +815 -0
- package/tests/debug-extension-harness.test.ts +463 -0
- package/tests/extension-registration.test.ts +2006 -0
- package/tests/fixtures/fixture_c.c +361 -0
- package/tests/fixtures/fixture_cpp.cpp +407 -0
- package/tests/fixtures/fixture_csharp.cs +411 -0
- package/tests/fixtures/fixture_elixir.ex +409 -0
- package/tests/fixtures/fixture_go.go +341 -0
- package/tests/fixtures/fixture_haskell.hs +250 -0
- package/tests/fixtures/fixture_java.java +430 -0
- package/tests/fixtures/fixture_javascript.js +383 -0
- package/tests/fixtures/fixture_kotlin.kt +451 -0
- package/tests/fixtures/fixture_lua.lua +276 -0
- package/tests/fixtures/fixture_perl.pl +310 -0
- package/tests/fixtures/fixture_php.php +433 -0
- package/tests/fixtures/fixture_python.py +502 -0
- package/tests/fixtures/fixture_ruby.rb +345 -0
- package/tests/fixtures/fixture_rust.rs +380 -0
- package/tests/fixtures/fixture_scala.scala +398 -0
- package/tests/fixtures/fixture_shell.sh +276 -0
- package/tests/fixtures/fixture_swift.swift +397 -0
- package/tests/fixtures/fixture_typescript.ts +434 -0
- package/tests/fixtures/fixture_zig.zig +295 -0
- package/tests/fixtures_attended_results/project/compress-line-numbers.json +5 -0
- package/tests/fixtures_attended_results/project/compress.json +5 -0
- package/tests/fixtures_attended_results/project/enable-static-check-invalid-command.json +5 -0
- package/tests/fixtures_attended_results/project/enable-static-check-valid.json +5 -0
- package/tests/fixtures_attended_results/project/files-static-check.json +5 -0
- package/tests/fixtures_attended_results/project/find-line-numbers.json +5 -0
- package/tests/fixtures_attended_results/project/find.json +5 -0
- package/tests/fixtures_attended_results/project/get-base-path.json +5 -0
- package/tests/fixtures_attended_results/project/git-check-clean.json +5 -0
- package/tests/fixtures_attended_results/project/git-check-dirty.json +5 -0
- package/tests/fixtures_attended_results/project/git-path.json +5 -0
- package/tests/fixtures_attended_results/project/git-wt-create-invalid.json +5 -0
- package/tests/fixtures_attended_results/project/git-wt-create-valid.json +5 -0
- package/tests/fixtures_attended_results/project/git-wt-delete-nonexistent.json +5 -0
- package/tests/fixtures_attended_results/project/git-wt-delete-valid.json +5 -0
- package/tests/fixtures_attended_results/project/git-wt-name.json +5 -0
- package/tests/fixtures_attended_results/project/references.json +5 -0
- package/tests/fixtures_attended_results/project/static-check.json +5 -0
- package/tests/fixtures_attended_results/project/tokens.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-compress-line-numbers/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-find-line-numbers/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-references/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/files-tokens/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-command/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-dummy/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-pylance/fixture_zig.zig.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_c.c.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_cpp.cpp.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_csharp.cs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_elixir.ex.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_go.go.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_haskell.hs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_java.java.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_javascript.js.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_kotlin.kt.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_lua.lua.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_perl.pl.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_php.php.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_python.py.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_ruby.rb.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_rust.rs.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_scala.scala.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_shell.sh.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_swift.swift.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_typescript.ts.json +5 -0
- package/tests/fixtures_attended_results/standalone/test-static-check-ruff/fixture_zig.zig.json +5 -0
- package/tests/helpers.ts +204 -0
- package/tests/oracle-project.test.ts +63 -0
- package/tests/oracle-standalone.test.ts +48 -0
- package/tests/prompt-rendering.test.ts +66 -0
- package/tests/release-workflow.test.ts +133 -0
|
@@ -0,0 +1,318 @@
|
|
|
1
|
+
# HDT Unit Test Authoring Guide (for LLM Agents)
|
|
2
|
+
**Version:** 1.0
|
|
3
|
+
**Audience:** LLM agents that *author or modify* unit tests in the HDT style
|
|
4
|
+
**Source Prompt Cards:** Generator + Refactorer modes
|
|
5
|
+
|
|
6
|
+
---
|
|
7
|
+
|
|
8
|
+
## 1) Purpose and Non‑Negotiables
|
|
9
|
+
When you decide you must **write new unit tests** or **modify existing tests**, this document is the single reference for *how* to do so.
|
|
10
|
+
|
|
11
|
+
All HDT unit tests MUST be:
|
|
12
|
+
|
|
13
|
+
- **Deterministic**: 100% reproducible across runs and environments.
|
|
14
|
+
- **Isolated**: no real network / filesystem / database / clock / unseeded randomness.
|
|
15
|
+
- **Dependency‑aware**: tests are organized and executed by **levels** (Level 0 → Level N) derived from the call graph.
|
|
16
|
+
- **Framework‑native**: no custom gating logic embedded in test bodies.
|
|
17
|
+
- **CI‑gated**: higher levels are blocked if lower levels fail (via CI stages, not `if/return` in tests).
|
|
18
|
+
- **Signal‑rich for developers**: support dev runs that collect multiple failures when useful.
|
|
19
|
+
|
|
20
|
+
Guiding principle: **maximize diagnostic value and maintainability without proceduralizing the suite.**
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## 2) Choose the Mode: Generator vs Refactorer
|
|
25
|
+
You MUST explicitly choose one of these modes before authoring.
|
|
26
|
+
|
|
27
|
+
### Mode A — **Generator** (Create New Tests)
|
|
28
|
+
Use **Generator** when:
|
|
29
|
+
- No tests exist for the target scope, OR
|
|
30
|
+
- You are adding coverage for **new units** / **new behavior**, OR
|
|
31
|
+
- You are building a suite from source code (or a new module) and need a baseline.
|
|
32
|
+
|
|
33
|
+
Primary deliverable shape:
|
|
34
|
+
1) Static analysis (UUTs + call graph + levels + deps)
|
|
35
|
+
2) Test matrix (happy/boundary/error)
|
|
36
|
+
3) New test code (level‑ordered)
|
|
37
|
+
4) Execution plan (CI gating + dev signal)
|
|
38
|
+
5) Quality checklist
|
|
39
|
+
|
|
40
|
+
### Mode B — **Refactorer** (Improve Existing Tests)
|
|
41
|
+
Use **Refactorer** when:
|
|
42
|
+
- A test suite already exists, and you must **fix flakiness**, **reduce brittleness**, **restructure levels**, or **improve coverage**.
|
|
43
|
+
- You are modifying tests to align with HDT rules (determinism, isolation, leveling, CI gating).
|
|
44
|
+
|
|
45
|
+
Primary deliverable shape:
|
|
46
|
+
1) Audit (what’s wrong & why)
|
|
47
|
+
2) Static analysis (UUTs + call graph + levels + deps)
|
|
48
|
+
3) Refactor plan (stepwise)
|
|
49
|
+
4) Updated test matrix
|
|
50
|
+
5) Refactored test code (or patches)
|
|
51
|
+
6) Execution plan (CI gating + dev signal)
|
|
52
|
+
7) Quality checklist
|
|
53
|
+
|
|
54
|
+
---
|
|
55
|
+
|
|
56
|
+
## 3) Mode Selection Heuristic (Decision Checklist)
|
|
57
|
+
If ANY of the following is true, pick **Refactorer**:
|
|
58
|
+
- Tests exist for the scope.
|
|
59
|
+
- Failures are flaky/intermittent.
|
|
60
|
+
- Tests touch real I/O or time.
|
|
61
|
+
- Tests rely on order or shared state.
|
|
62
|
+
- Assertions are brittle (implementation details, snapshots that break frequently).
|
|
63
|
+
|
|
64
|
+
Pick **Generator** only when you are genuinely producing **new tests** from source (or for uncovered code).
|
|
65
|
+
|
|
66
|
+
If ambiguous, default to **Refactorer** (changing existing suites is higher risk; start by auditing).
|
|
67
|
+
|
|
68
|
+
---
|
|
69
|
+
|
|
70
|
+
## 4) Universal HDT Test Principles (apply in BOTH modes)
|
|
71
|
+
|
|
72
|
+
### 4.1 Determinism Requirements
|
|
73
|
+
Tests MUST NOT depend on:
|
|
74
|
+
- Real wall clock time (use time freezing, dependency injection, or fakes)
|
|
75
|
+
- Unseeded randomness (seed or inject deterministic generators)
|
|
76
|
+
- Unordered collection iteration (normalize or compare as sets where appropriate)
|
|
77
|
+
- Locale/timezone/environment (explicitly set or normalize)
|
|
78
|
+
- Global mutable state shared across tests
|
|
79
|
+
|
|
80
|
+
### 4.2 Isolation Requirements
|
|
81
|
+
You MUST isolate:
|
|
82
|
+
- **Network** calls (mock/stub)
|
|
83
|
+
- **Filesystem** access (use temp fakes or mock; never touch real user paths)
|
|
84
|
+
- **Databases** (use in‑memory fakes or mocks; never real DB)
|
|
85
|
+
- **External services** (always mock)
|
|
86
|
+
- **OS / process** state (env vars, cwd, etc.) where relevant
|
|
87
|
+
|
|
88
|
+
No test may rely on state left behind by another test.
|
|
89
|
+
|
|
90
|
+
### 4.3 Behavior over Implementation
|
|
91
|
+
- Prefer **behavioral assertions** (inputs → outputs / observable effects).
|
|
92
|
+
- Avoid asserting internal calls unless that is the behavior contract.
|
|
93
|
+
- Avoid brittle snapshot asserts unless the snapshot is *truly* a stable contract.
|
|
94
|
+
- Prefer explicit expected values/exceptions.
|
|
95
|
+
|
|
96
|
+
### 4.4 AAA Structure
|
|
97
|
+
Use **Arrange – Act – Assert** in every test. Make the Act step obvious.
|
|
98
|
+
|
|
99
|
+
### 4.5 Explicit Expected Outcomes
|
|
100
|
+
Every test MUST declare either:
|
|
101
|
+
- `expected_output`, OR
|
|
102
|
+
- `expected_exception` (type; message only if stable and intentional)
|
|
103
|
+
|
|
104
|
+
---
|
|
105
|
+
|
|
106
|
+
## 5) Dependency Awareness: Levels and the Call Graph
|
|
107
|
+
HDT uses levels to ensure fast, reliable diagnosis and CI gating.
|
|
108
|
+
|
|
109
|
+
### 5.1 Definitions
|
|
110
|
+
- **UUT (Unit Under Test):** a function/class/module boundary you are testing.
|
|
111
|
+
- **Level 0 (Atomic):** leaf units with no internal dependencies (or only trivial pure helpers).
|
|
112
|
+
- **Level 1..N (Composed):** units that depend on lower-level units (directly or indirectly).
|
|
113
|
+
|
|
114
|
+
### 5.2 Required Static Analysis Artifact
|
|
115
|
+
Before writing or refactoring tests, you MUST produce:
|
|
116
|
+
1) **UUT list**
|
|
117
|
+
2) **Call graph** (approximate is acceptable; must be explicit)
|
|
118
|
+
3) **Level classification table**
|
|
119
|
+
4) **External dependencies to isolate**
|
|
120
|
+
|
|
121
|
+
### 5.3 Leveling Rules of Thumb
|
|
122
|
+
- If a unit calls another project unit: it is *higher level* than the callee.
|
|
123
|
+
- If a unit calls an external dependency: it is higher level, and that dependency must be isolated.
|
|
124
|
+
- Keep Level 0 tests small and precise; they are your CI gate.
|
|
125
|
+
|
|
126
|
+
---
|
|
127
|
+
|
|
128
|
+
## 6) Repo Layout and Naming Conventions
|
|
129
|
+
### 6.1 Recommended Layout
|
|
130
|
+
```
|
|
131
|
+
tests/
|
|
132
|
+
unit/
|
|
133
|
+
atomic/
|
|
134
|
+
composed/
|
|
135
|
+
module/ # optional; only if your project meaningfully benefits
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
### 6.2 Naming Convention
|
|
139
|
+
Use clear test names:
|
|
140
|
+
- `test_<scenario>_<expected_behavior>`
|
|
141
|
+
- Prefer descriptive scenario labels (happy/boundary/error).
|
|
142
|
+
|
|
143
|
+
---
|
|
144
|
+
|
|
145
|
+
## 7) Generator Mode: Required Workflow and Output Contract
|
|
146
|
+
When in **Generator** mode, you MUST deliver the following artifacts **in this exact order**.
|
|
147
|
+
|
|
148
|
+
### 7.1 Static Analysis Artifact
|
|
149
|
+
Include:
|
|
150
|
+
- UUT list
|
|
151
|
+
- Call graph
|
|
152
|
+
- Levels table
|
|
153
|
+
- External deps to isolate
|
|
154
|
+
|
|
155
|
+
### 7.2 Test Matrix Artifact (minimum cases per UUT)
|
|
156
|
+
For each UUT, define at least:
|
|
157
|
+
- **Happy path**
|
|
158
|
+
- **Boundary case(s)**
|
|
159
|
+
- **Error case(s)** (if applicable)
|
|
160
|
+
|
|
161
|
+
Matrix columns SHOULD include:
|
|
162
|
+
- UUT, Level, Scenario, Arrange (inputs), Act, Assert (expected), Mocks
|
|
163
|
+
|
|
164
|
+
### 7.3 Test Code (Framework‑Native)
|
|
165
|
+
- Write tests starting from **Level 0**, then Level 1..N.
|
|
166
|
+
- Use AAA.
|
|
167
|
+
- No real I/O.
|
|
168
|
+
- Explicit expected outcomes.
|
|
169
|
+
- Use per-framework best practices (fixtures, parametrization, setup/teardown) *without* creating cross-test coupling.
|
|
170
|
+
|
|
171
|
+
### 7.4 Execution Plan
|
|
172
|
+
Provide:
|
|
173
|
+
- **CI plan**: staged gating (atomic → composed → module)
|
|
174
|
+
- **Dev plan**: how to run signal‑rich (collect multiple failures)
|
|
175
|
+
|
|
176
|
+
### 7.5 Quality Checklist
|
|
177
|
+
At minimum:
|
|
178
|
+
- Deterministic
|
|
179
|
+
- Isolated
|
|
180
|
+
- Explicit expected outcomes
|
|
181
|
+
- Correct levels (atomic first)
|
|
182
|
+
- Happy + boundary + error coverage
|
|
183
|
+
- Non‑brittle asserts
|
|
184
|
+
- Clear naming
|
|
185
|
+
|
|
186
|
+
---
|
|
187
|
+
|
|
188
|
+
## 8) Refactorer Mode: Required Workflow and Output Contract
|
|
189
|
+
When in **Refactorer** mode, you MUST deliver the following artifacts **in this exact order**.
|
|
190
|
+
|
|
191
|
+
### 8.1 Audit Artifact (what’s wrong & why)
|
|
192
|
+
Identify:
|
|
193
|
+
1) **Flakiness sources** (time, random, I/O, shared state, order dependence)
|
|
194
|
+
2) **Brittleness sources** (over-mocking, impl-detail asserts, fragile snapshots)
|
|
195
|
+
3) **Dependency structure gaps** (missing leaf tests, misleveled tests)
|
|
196
|
+
4) **Coverage gaps** (missing happy/boundary/error)
|
|
197
|
+
|
|
198
|
+
### 8.2 Static Analysis Artifact
|
|
199
|
+
Same requirements as Generator:
|
|
200
|
+
- UUT list
|
|
201
|
+
- Call graph
|
|
202
|
+
- Levels table
|
|
203
|
+
- External deps to isolate
|
|
204
|
+
|
|
205
|
+
### 8.3 Refactor Plan (stepwise)
|
|
206
|
+
Provide a numbered plan that:
|
|
207
|
+
- Stabilizes determinism (freeze time, seed random, inject deps, fakes)
|
|
208
|
+
- Removes real I/O
|
|
209
|
+
- Re-levels tests and reorganizes files
|
|
210
|
+
- Replaces brittle asserts with behavioral asserts
|
|
211
|
+
- Adds missing cases minimally
|
|
212
|
+
|
|
213
|
+
### 8.4 Updated Test Matrix Artifact
|
|
214
|
+
Refresh the matrix to ensure:
|
|
215
|
+
- Each UUT has happy + boundary + error (if applicable)
|
|
216
|
+
- Correct level assignment
|
|
217
|
+
- Mocking strategy is explicit and minimal
|
|
218
|
+
|
|
219
|
+
### 8.5 Refactored Test Code
|
|
220
|
+
- Provide updated files (or patches) in separate fenced blocks per file.
|
|
221
|
+
- Preserve original behavioral intent unless it is clearly incorrect; if you change behavior, document why.
|
|
222
|
+
|
|
223
|
+
### 8.6 Execution Plan
|
|
224
|
+
- CI (gated fail-fast by stage)
|
|
225
|
+
- Dev (signal‑rich, optionally include framework-native triage commands)
|
|
226
|
+
|
|
227
|
+
### 8.7 Quality Checklist (Refactor‑specific additions)
|
|
228
|
+
Also confirm:
|
|
229
|
+
- No sleeps/retries to hide flakes
|
|
230
|
+
- No hidden cross-test dependencies
|
|
231
|
+
- Brittle mocks removed where a fake is simpler
|
|
232
|
+
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## 9) CI Gating vs Test Logic (Critical Rule)
|
|
236
|
+
**Gating belongs to CI**, not to test bodies.
|
|
237
|
+
|
|
238
|
+
### 9.1 CI (Strict Gated Fail‑Fast)
|
|
239
|
+
Run stages and block next stage if previous fails. Example:
|
|
240
|
+
- Stage 1: `tests/unit/atomic` (fail-fast)
|
|
241
|
+
- Stage 2: `tests/unit/composed` (fail-fast; only if Stage 1 green)
|
|
242
|
+
- Stage 3: `tests/unit/module` (optional; only if Stage 2 green)
|
|
243
|
+
|
|
244
|
+
### 9.2 Dev (Signal‑Rich)
|
|
245
|
+
- Run full suite without fail-fast to gather multiple failures.
|
|
246
|
+
- Use fail-fast only for focused debugging.
|
|
247
|
+
|
|
248
|
+
---
|
|
249
|
+
|
|
250
|
+
## 10) Assumptions You MUST Actively Challenge (Pre‑Flight)
|
|
251
|
+
Before writing or changing tests, challenge these common failure modes:
|
|
252
|
+
|
|
253
|
+
1) **Leaf identification:** Did you misread the call graph or miss a dependency?
|
|
254
|
+
2) **Expected errors:** Is the exception type correct? Is message stable enough to assert?
|
|
255
|
+
3) **Boundaries:** Null/empty, max size, negative, overflow, encoding, and type errors.
|
|
256
|
+
4) **Determinism risks:** timestamps, UUIDs, randomness, unordered structures.
|
|
257
|
+
5) **Coupling:** Are you asserting behavior, or implementation details?
|
|
258
|
+
|
|
259
|
+
If uncertain:
|
|
260
|
+
- State the uncertainty explicitly in your artifacts.
|
|
261
|
+
- Choose robust techniques (freeze time, seed random, normalize outputs).
|
|
262
|
+
- Avoid overly specific assertions until justified.
|
|
263
|
+
|
|
264
|
+
---
|
|
265
|
+
|
|
266
|
+
## 11) Fine‑Grained Test Dependencies (Rare Exception)
|
|
267
|
+
Avoid “Test B depends on Test A”.
|
|
268
|
+
|
|
269
|
+
Only if truly necessary:
|
|
270
|
+
- Make dependency explicit and documented.
|
|
271
|
+
- Prefer framework support (markers/plugins) or CI staging.
|
|
272
|
+
- Justify why level-based staging is insufficient.
|
|
273
|
+
- Avoid long chains; improve leaf tests instead.
|
|
274
|
+
|
|
275
|
+
---
|
|
276
|
+
|
|
277
|
+
## 12) Operational Templates (Copy/Paste Prompts)
|
|
278
|
+
|
|
279
|
+
### 12.1 Generator Mode Prompt Template
|
|
280
|
+
**Task:** Create HDT unit tests (Generator mode)
|
|
281
|
+
**Lang/Framework:** `{{LANG}} / {{TEST_FRAMEWORK}}`
|
|
282
|
+
**Scope:** `{{TARGET_SCOPE}}`
|
|
283
|
+
**Constraints:** `{{CONSTRAINTS}}`
|
|
284
|
+
**Source Code:**
|
|
285
|
+
```text
|
|
286
|
+
{{SOURCE_CODE}}
|
|
287
|
+
```
|
|
288
|
+
**Required output:** Follow the Generator workflow and artifact order in Sections 7 and 5.
|
|
289
|
+
|
|
290
|
+
### 12.2 Refactorer Mode Prompt Template
|
|
291
|
+
**Task:** Refactor HDT unit tests (Refactorer mode)
|
|
292
|
+
**Lang/Framework:** `{{LANG}} / {{TEST_FRAMEWORK}}`
|
|
293
|
+
**Scope:** `{{TARGET_SCOPE}}`
|
|
294
|
+
**Constraints:** `{{CONSTRAINTS}}`
|
|
295
|
+
**Source Code:**
|
|
296
|
+
```text
|
|
297
|
+
{{SOURCE_CODE}}
|
|
298
|
+
```
|
|
299
|
+
**Existing Tests:**
|
|
300
|
+
```text
|
|
301
|
+
{{EXISTING_TESTS}}
|
|
302
|
+
```
|
|
303
|
+
**Required output:** Follow the Refactorer workflow and artifact order in Sections 8 and 5.
|
|
304
|
+
|
|
305
|
+
---
|
|
306
|
+
|
|
307
|
+
## 13) Final Self‑Check (Mandatory)
|
|
308
|
+
Before outputting test code, verify:
|
|
309
|
+
|
|
310
|
+
- [ ] Mode correctly chosen (Generator vs Refactorer)
|
|
311
|
+
- [ ] Static analysis completed (UUTs, call graph, levels, external deps)
|
|
312
|
+
- [ ] Tests are deterministic (no time/random/env nondeterminism)
|
|
313
|
+
- [ ] Tests are isolated (no real I/O)
|
|
314
|
+
- [ ] Level 0 exists and runs first
|
|
315
|
+
- [ ] Each UUT has happy + boundary + error (if applicable)
|
|
316
|
+
- [ ] Assertions are behavioral and explicit
|
|
317
|
+
- [ ] CI gating is described outside of test bodies
|
|
318
|
+
- [ ] Repo layout and naming are consistent
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
---
|
|
2
|
+
title: "{{project name}} Requirements"
|
|
3
|
+
description: Software requirements specification
|
|
4
|
+
version: "{{version}}"
|
|
5
|
+
date: "{{date_modified}}"
|
|
6
|
+
author: "{{author}}"
|
|
7
|
+
scope:
|
|
8
|
+
paths:
|
|
9
|
+
- "**/*.py"
|
|
10
|
+
- "**/*.ipynb"
|
|
11
|
+
- "**/*.c"
|
|
12
|
+
- "**/*.h"
|
|
13
|
+
- "**/*.cpp"
|
|
14
|
+
excludes:
|
|
15
|
+
- ".*/**"
|
|
16
|
+
visibility: "draft"
|
|
17
|
+
tags: ["markdown", "requirements", "example"]
|
|
18
|
+
---
|
|
19
|
+
|
|
20
|
+
# {{project name}} Requirements
|
|
21
|
+
<!-- Metadata is in the YAML front matter; do not duplicate it in the body. -->
|
|
22
|
+
|
|
23
|
+
<!-- Optional: omit a Table of Contents to reduce token footprint for LLM agents. If a TOC is included, it MUST be auto-generated and kept minimal. -->
|
|
24
|
+
|
|
25
|
+
## 1. Introduction
|
|
26
|
+
<!-- Overview of the SRS: purpose, scope, audience, and document organization. Avoid detailed requirements here. -->
|
|
27
|
+
|
|
28
|
+
### 1.1 Document Rules
|
|
29
|
+
This document MUST follow these authoring rules (LLM-first, normative SRS):
|
|
30
|
+
- This document MUST be written and maintained in English.
|
|
31
|
+
- Use RFC 2119 keywords exclusively (MUST, MUST NOT, SHOULD, SHOULD NOT, MAY). Do not use "shall".
|
|
32
|
+
- In requirements sections, every bullet MUST be a requirement and MUST start with a unique, stable Requirement ID (e.g., **REQ-001**).
|
|
33
|
+
- Requirement IDs MUST be stable: never renumber, reuse, or repurpose an ID. Only the dedicated reorganization workflow may renumber and it MUST emit an old→new ID mapping.
|
|
34
|
+
- Requirement ID prefixes MUST be consistent; if additional prefixes are needed beyond PRJ/CTN/DES/REQ/TST, they MUST be defined once in this section before first use.
|
|
35
|
+
- Each requirement MUST be atomic, single-sentence, and testable; target <= 35 words per requirement; split any compound behavior into separate IDs.
|
|
36
|
+
- Write for other LLM Agents and automated parsers (high semantic density; no filler).
|
|
37
|
+
- On every change to this document:
|
|
38
|
+
- Update `date` and `version` in the YAML front matter only (avoid duplicating metadata in the body).
|
|
39
|
+
- Do NOT maintain an in-document revision history; use git history / CHANGELOG.md for change tracking.
|
|
40
|
+
|
|
41
|
+
### 1.2 Project Scope
|
|
42
|
+
<!-- The project (name/version), primary purpose, key capabilities, and boundaries. Keep brief and focus on the "what" and "why", not the "how". Avoid detailed requirements here. -->
|
|
43
|
+
|
|
44
|
+
## 2. Project Requirements
|
|
45
|
+
<!-- Background and context that shape the project's requirements. Avoid detailed requirements here. -->
|
|
46
|
+
|
|
47
|
+
### 2.1 Project Functions
|
|
48
|
+
<!-- Major functional areas or features of the project -->
|
|
49
|
+
- **PRJ-001**: MUST <single-sentence project function (<= 35 words)>.
|
|
50
|
+
- **PRJ-002**: Requirement description of project function 2
|
|
51
|
+
<!-- add here other project function requirements -->
|
|
52
|
+
|
|
53
|
+
### 2.2 Project Constraints
|
|
54
|
+
<!-- Design and implementation constraints that affect the solution of the project -->
|
|
55
|
+
- **CTN-001**: MUST <single-sentence constraint (<= 35 words)>.
|
|
56
|
+
- **CTN-002**: Requirement description of project constraint 2
|
|
57
|
+
<!-- add here other project constraint requirements -->
|
|
58
|
+
|
|
59
|
+
## 3. Requirements
|
|
60
|
+
<!-- Identifiable, verifiable, and testable requirements. Avoid implementation details. -->
|
|
61
|
+
|
|
62
|
+
### 3.1 Design and Implementation
|
|
63
|
+
<!-- Constraints and mandates on design, deployment, and maintenance -->
|
|
64
|
+
- **DES-001**: Requirement description of design constraint 1
|
|
65
|
+
- **DES-002**: MUST <single-sentence design constraint (<= 35 words)>.
|
|
66
|
+
<!-- add here other design constraint requirements -->
|
|
67
|
+
### 3.2 Functions
|
|
68
|
+
<!-- Externally observable behaviors organized by feature or use case -->
|
|
69
|
+
- **REQ-001**: MUST <single observable behavior with explicit trigger and expected outcome>.
|
|
70
|
+
- **REQ-002**: Requirement description of function 2
|
|
71
|
+
<!-- add here other function requirements -->
|
|
72
|
+
|
|
73
|
+
## 4. Test Requirements
|
|
74
|
+
<!-- Define the test requirements linked to functional/non-functional requirements (or to a verification context) and specify a clear, reproducible test procedure with explicit pass/fail criteria. -->
|
|
75
|
+
|
|
76
|
+
- **TST-001**: MUST verify <requirement-id> using <reproducible procedure> with explicit pass/fail criteria.
|
|
77
|
+
|
|
78
|
+
<!-- Do not add a revision history section here; use git history / CHANGELOG.md instead. -->
|