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,398 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @file fixture_scala.scala
|
|
3
|
+
* @brief Comprehensive Scala test fixture for parser validation.
|
|
4
|
+
* @details Covers implicits/givens, pattern matching, higher-kinded types,
|
|
5
|
+
* self-types, variance, opaque types, extension methods, enums,
|
|
6
|
+
* for comprehensions, and cake pattern.
|
|
7
|
+
*/
|
|
8
|
+
// Single line comment
|
|
9
|
+
/* Multi-line
|
|
10
|
+
comment */
|
|
11
|
+
import scala.collection.mutable
|
|
12
|
+
import scala.concurrent.{Future, ExecutionContext}
|
|
13
|
+
import scala.util.{Try, Success, Failure}
|
|
14
|
+
|
|
15
|
+
/* ── Case class with copy and pattern matching ────────────────────────── */
|
|
16
|
+
|
|
17
|
+
/**
|
|
18
|
+
* @class Person
|
|
19
|
+
* @brief Immutable data class for person entities.
|
|
20
|
+
* @param name Display name.
|
|
21
|
+
* @param age Age in years; must be non-negative.
|
|
22
|
+
*/
|
|
23
|
+
case class Person(name: String, age: Int) {
|
|
24
|
+
/**
|
|
25
|
+
* @brief Check if the person is an adult.
|
|
26
|
+
* @return True if age >= 18.
|
|
27
|
+
*/
|
|
28
|
+
def isAdult: Boolean = age >= 18
|
|
29
|
+
|
|
30
|
+
/**
|
|
31
|
+
* @brief Create a greeting string.
|
|
32
|
+
* @return Formatted greeting including name and age.
|
|
33
|
+
*/
|
|
34
|
+
def greet: String = s"Hi, I'm $name, age $age"
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
/* ── Sealed trait hierarchy ───────────────────────────────────────────── */
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @class Shape
|
|
41
|
+
* @brief Sealed trait for algebraic data type shapes.
|
|
42
|
+
*/
|
|
43
|
+
sealed trait Shape {
|
|
44
|
+
/**
|
|
45
|
+
* @brief Compute the area of this shape.
|
|
46
|
+
* @return Area as a Double.
|
|
47
|
+
*/
|
|
48
|
+
def area: Double
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* @class Circle
|
|
53
|
+
* @brief Circle shape with radius.
|
|
54
|
+
* @param radius The circle's radius.
|
|
55
|
+
*/
|
|
56
|
+
case class Circle(radius: Double) extends Shape {
|
|
57
|
+
override def area: Double = math.Pi * radius * radius
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
/**
|
|
61
|
+
* @class Rectangle
|
|
62
|
+
* @brief Rectangle shape with width and height.
|
|
63
|
+
* @param width The rectangle's width.
|
|
64
|
+
* @param height The rectangle's height.
|
|
65
|
+
*/
|
|
66
|
+
case class Rectangle(width: Double, height: Double) extends Shape {
|
|
67
|
+
override def area: Double = width * height
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
/* ── Abstract class ───────────────────────────────────────────────────── */
|
|
71
|
+
|
|
72
|
+
/**
|
|
73
|
+
* @class Animal
|
|
74
|
+
* @brief Abstract base class for animals with sound production.
|
|
75
|
+
*/
|
|
76
|
+
abstract class Animal {
|
|
77
|
+
/**
|
|
78
|
+
* @brief The sound this animal makes.
|
|
79
|
+
* @return Sound description string.
|
|
80
|
+
*/
|
|
81
|
+
def sound: String
|
|
82
|
+
|
|
83
|
+
/**
|
|
84
|
+
* @brief Describe the animal including its sound.
|
|
85
|
+
* @return Formatted description string.
|
|
86
|
+
*/
|
|
87
|
+
def describe: String = s"I am a ${getClass.getSimpleName} and I say $sound"
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
/* ── Trait with self-type ─────────────────────────────────────────────── */
|
|
91
|
+
|
|
92
|
+
/**
|
|
93
|
+
* @trait Drawable
|
|
94
|
+
* @brief Trait for rendering objects to string representation.
|
|
95
|
+
*/
|
|
96
|
+
trait Drawable {
|
|
97
|
+
/**
|
|
98
|
+
* @brief Draw the object as a string.
|
|
99
|
+
* @return Rendered string representation.
|
|
100
|
+
*/
|
|
101
|
+
def draw(): Unit
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
/**
|
|
105
|
+
* @trait Logging
|
|
106
|
+
* @brief Self-type trait requiring Drawable to be mixed in.
|
|
107
|
+
* @details Demonstrates the cake pattern for dependency injection.
|
|
108
|
+
*/
|
|
109
|
+
trait Logging { self: Drawable =>
|
|
110
|
+
/**
|
|
111
|
+
* @brief Log the drawing operation and then draw.
|
|
112
|
+
*/
|
|
113
|
+
def logAndDraw(): Unit = {
|
|
114
|
+
println("About to draw")
|
|
115
|
+
draw()
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
/**
|
|
120
|
+
* @trait Serializable
|
|
121
|
+
* @brief Trait for objects convertible to byte arrays.
|
|
122
|
+
*/
|
|
123
|
+
trait Serializable {
|
|
124
|
+
/**
|
|
125
|
+
* @brief Serialize this object to bytes.
|
|
126
|
+
* @return Byte array representation.
|
|
127
|
+
*/
|
|
128
|
+
def serialize: Array[Byte]
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
/* ── Object (singleton) ───────────────────────────────────────────────── */
|
|
132
|
+
|
|
133
|
+
/**
|
|
134
|
+
* @object Main
|
|
135
|
+
* @brief Application entry point and utility function container.
|
|
136
|
+
*/
|
|
137
|
+
object Main {
|
|
138
|
+
/**
|
|
139
|
+
* @brief Application entry point.
|
|
140
|
+
* @param args Command-line arguments.
|
|
141
|
+
*/
|
|
142
|
+
def main(args: Array[String]): Unit = {
|
|
143
|
+
val people = List(Person("Alice", 30), Person("Bob", 17))
|
|
144
|
+
/* Filter adults using pattern matching */
|
|
145
|
+
val adults = people.filter(_.isAdult)
|
|
146
|
+
adults.foreach(p => println(p.greet))
|
|
147
|
+
}
|
|
148
|
+
|
|
149
|
+
/**
|
|
150
|
+
* @brief Override toString for Main object display.
|
|
151
|
+
* @return String representation.
|
|
152
|
+
*/
|
|
153
|
+
override def toString: String = "Main"
|
|
154
|
+
|
|
155
|
+
/** @brief Mathematical constant pi. */
|
|
156
|
+
val pi = 3.14159265
|
|
157
|
+
|
|
158
|
+
/** @brief Mutable counter for tracking operations. */
|
|
159
|
+
var counter = 0
|
|
160
|
+
|
|
161
|
+
/**
|
|
162
|
+
* @brief Type alias for lists of strings.
|
|
163
|
+
*/
|
|
164
|
+
type StringList = List[String]
|
|
165
|
+
|
|
166
|
+
/**
|
|
167
|
+
* @brief Type alias for function transformers.
|
|
168
|
+
*/
|
|
169
|
+
type Transformer[A] = A => A
|
|
170
|
+
|
|
171
|
+
/**
|
|
172
|
+
* @brief Describe a shape using exhaustive pattern matching.
|
|
173
|
+
* @param shape The shape to describe.
|
|
174
|
+
* @return Human-readable description with area.
|
|
175
|
+
*/
|
|
176
|
+
def describeShape(shape: Shape): String = shape match {
|
|
177
|
+
case Circle(r) => s"Circle with radius $r, area=${shape.area}"
|
|
178
|
+
case Rectangle(w, h) => s"Rectangle ${w}x${h}, area=${shape.area}"
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
/**
|
|
182
|
+
* @brief Process a value with multiple match guards.
|
|
183
|
+
* @param x Integer input to classify.
|
|
184
|
+
* @return Classification string.
|
|
185
|
+
*/
|
|
186
|
+
def classify(x: Int): String = x match {
|
|
187
|
+
case 0 => "zero"
|
|
188
|
+
case n if n < 0 => "negative"
|
|
189
|
+
case n if n > 100 => "large"
|
|
190
|
+
case _ => "positive"
|
|
191
|
+
}
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
/* ── Companion object with apply ──────────────────────────────────────── */
|
|
195
|
+
|
|
196
|
+
/**
|
|
197
|
+
* @class Config
|
|
198
|
+
* @brief Configuration holder with companion factory.
|
|
199
|
+
* @param entries Key-value pairs.
|
|
200
|
+
*/
|
|
201
|
+
class Config private (val entries: Map[String, String]) {
|
|
202
|
+
/**
|
|
203
|
+
* @brief Retrieve a value by key.
|
|
204
|
+
* @param key The configuration key.
|
|
205
|
+
* @return Optional value.
|
|
206
|
+
*/
|
|
207
|
+
def get(key: String): Option[String] = entries.get(key)
|
|
208
|
+
}
|
|
209
|
+
|
|
210
|
+
/**
|
|
211
|
+
* @object Config
|
|
212
|
+
* @brief Companion object with factory methods for Config.
|
|
213
|
+
*/
|
|
214
|
+
object Config {
|
|
215
|
+
/**
|
|
216
|
+
* @brief Create a Config from key-value pairs.
|
|
217
|
+
* @param entries Variable number of key-value tuples.
|
|
218
|
+
* @return A new Config instance.
|
|
219
|
+
*/
|
|
220
|
+
def apply(entries: (String, String)*): Config = new Config(entries.toMap)
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @brief Create an empty Config.
|
|
224
|
+
* @return Config with no entries.
|
|
225
|
+
*/
|
|
226
|
+
def empty: Config = new Config(Map.empty)
|
|
227
|
+
}
|
|
228
|
+
|
|
229
|
+
/* ── Generic class with variance ──────────────────────────────────────── */
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* @class Container
|
|
233
|
+
* @brief Covariant generic container.
|
|
234
|
+
* @tparam +A Element type (covariant).
|
|
235
|
+
*/
|
|
236
|
+
class Container[+A](val value: A) {
|
|
237
|
+
/**
|
|
238
|
+
* @brief Map the contained value.
|
|
239
|
+
* @tparam B Target type.
|
|
240
|
+
* @param f Transform function.
|
|
241
|
+
* @return New Container with transformed value.
|
|
242
|
+
*/
|
|
243
|
+
def map[B](f: A => B): Container[B] = new Container(f(value))
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* @brief Flat-map the contained value.
|
|
247
|
+
* @tparam B Target type.
|
|
248
|
+
* @param f Transform function returning a Container.
|
|
249
|
+
* @return Flattened Container.
|
|
250
|
+
*/
|
|
251
|
+
def flatMap[B](f: A => Container[B]): Container[B] = f(value)
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
/* ── Implicit conversions and classes ─────────────────────────────────── */
|
|
255
|
+
|
|
256
|
+
/**
|
|
257
|
+
* @class RichInt
|
|
258
|
+
* @brief Implicit class extending Int with utility methods.
|
|
259
|
+
* @param n The wrapped integer value.
|
|
260
|
+
*/
|
|
261
|
+
implicit class RichInt(val n: Int) extends AnyVal {
|
|
262
|
+
/**
|
|
263
|
+
* @brief Check if the number is even.
|
|
264
|
+
* @return True if n is divisible by 2.
|
|
265
|
+
*/
|
|
266
|
+
def isEven: Boolean = n % 2 == 0
|
|
267
|
+
|
|
268
|
+
/**
|
|
269
|
+
* @brief Repeat a string n times.
|
|
270
|
+
* @param s The string to repeat.
|
|
271
|
+
* @return Concatenated result.
|
|
272
|
+
*/
|
|
273
|
+
def times(s: String): String = s * n
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
/* ── For comprehension example ────────────────────────────────────────── */
|
|
277
|
+
|
|
278
|
+
/**
|
|
279
|
+
* @object ForCompExample
|
|
280
|
+
* @brief Demonstrates for-comprehension with multiple generators.
|
|
281
|
+
*/
|
|
282
|
+
object ForCompExample {
|
|
283
|
+
/**
|
|
284
|
+
* @brief Compute all pairs of integers whose sum equals target.
|
|
285
|
+
* @param range Upper bound of the search space.
|
|
286
|
+
* @param target Desired sum.
|
|
287
|
+
* @return List of pairs summing to target.
|
|
288
|
+
*/
|
|
289
|
+
def findPairs(range: Int, target: Int): List[(Int, Int)] = {
|
|
290
|
+
for {
|
|
291
|
+
x <- (1 to range).toList
|
|
292
|
+
y <- (x to range).toList
|
|
293
|
+
if x + y == target
|
|
294
|
+
} yield (x, y)
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
/* ── Higher-order and curried functions ────────────────────────────────── */
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* @object FuncUtils
|
|
302
|
+
* @brief Utility functions demonstrating functional patterns.
|
|
303
|
+
*/
|
|
304
|
+
object FuncUtils {
|
|
305
|
+
/**
|
|
306
|
+
* @brief Curried addition function.
|
|
307
|
+
* @param a First operand.
|
|
308
|
+
* @param b Second operand.
|
|
309
|
+
* @return Sum of a and b.
|
|
310
|
+
*/
|
|
311
|
+
def add(a: Int)(b: Int): Int = a + b
|
|
312
|
+
|
|
313
|
+
/**
|
|
314
|
+
* @brief Apply a function twice to an initial value.
|
|
315
|
+
* @tparam A Value type.
|
|
316
|
+
* @param f Function to apply.
|
|
317
|
+
* @param x Initial value.
|
|
318
|
+
* @return Result of f(f(x)).
|
|
319
|
+
*/
|
|
320
|
+
def twice[A](f: A => A)(x: A): A = f(f(x))
|
|
321
|
+
|
|
322
|
+
/**
|
|
323
|
+
* @brief Compose two functions left to right.
|
|
324
|
+
* @tparam A Input type.
|
|
325
|
+
* @tparam B Intermediate type.
|
|
326
|
+
* @tparam C Output type.
|
|
327
|
+
* @param f First function.
|
|
328
|
+
* @param g Second function.
|
|
329
|
+
* @return Composed function.
|
|
330
|
+
*/
|
|
331
|
+
def compose[A, B, C](f: A => B, g: B => C): A => C = a => g(f(a))
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/* coverage extension block */
|
|
335
|
+
import scala.util.Random
|
|
336
|
+
import scala.concurrent.duration._
|
|
337
|
+
trait Runner
|
|
338
|
+
trait Parser
|
|
339
|
+
object Metrics
|
|
340
|
+
val MaxUsers = 100
|
|
341
|
+
val RetryLimit = 3
|
|
342
|
+
type UserKey = String
|
|
343
|
+
type ErrorCode = Int
|
|
344
|
+
type Mapper = String => String
|
|
345
|
+
var attempts = 0
|
|
346
|
+
var cursor = 1
|
|
347
|
+
var stage = "init"
|
|
348
|
+
var status = "ready"
|
|
349
|
+
|
|
350
|
+
// REQ-COVER-SRS-231 START
|
|
351
|
+
object ReqCoverScala {
|
|
352
|
+
/**
|
|
353
|
+
* @REQ-COVER-SRS-231 block 1
|
|
354
|
+
* @brief Coverage helper construct 1.
|
|
355
|
+
* @details Provides deterministic fixture-level Doxygen coverage block 1.
|
|
356
|
+
* @param value Input value for helper construct 1.
|
|
357
|
+
* @return Output value for helper construct 1.
|
|
358
|
+
*/
|
|
359
|
+
def reqCoverScala1(value: Int): Int = value + 1
|
|
360
|
+
|
|
361
|
+
/**
|
|
362
|
+
* @REQ-COVER-SRS-231 block 2
|
|
363
|
+
* @brief Coverage helper construct 2.
|
|
364
|
+
* @details Provides deterministic fixture-level Doxygen coverage block 2.
|
|
365
|
+
* @param value Input value for helper construct 2.
|
|
366
|
+
* @return Output value for helper construct 2.
|
|
367
|
+
*/
|
|
368
|
+
def reqCoverScala2(value: Int): Int = value + 2
|
|
369
|
+
|
|
370
|
+
/**
|
|
371
|
+
* @REQ-COVER-SRS-231 block 3
|
|
372
|
+
* @brief Coverage helper construct 3.
|
|
373
|
+
* @details Provides deterministic fixture-level Doxygen coverage block 3.
|
|
374
|
+
* @param value Input value for helper construct 3.
|
|
375
|
+
* @return Output value for helper construct 3.
|
|
376
|
+
*/
|
|
377
|
+
def reqCoverScala3(value: Int): Int = value + 3
|
|
378
|
+
|
|
379
|
+
/**
|
|
380
|
+
* @REQ-COVER-SRS-231 block 4
|
|
381
|
+
* @brief Coverage helper construct 4.
|
|
382
|
+
* @details Provides deterministic fixture-level Doxygen coverage block 4.
|
|
383
|
+
* @param value Input value for helper construct 4.
|
|
384
|
+
* @return Output value for helper construct 4.
|
|
385
|
+
*/
|
|
386
|
+
def reqCoverScala4(value: Int): Int = value + 4
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* @REQ-COVER-SRS-231 block 5
|
|
390
|
+
* @brief Coverage helper construct 5.
|
|
391
|
+
* @details Provides deterministic fixture-level Doxygen coverage block 5.
|
|
392
|
+
* @param value Input value for helper construct 5.
|
|
393
|
+
* @return Output value for helper construct 5.
|
|
394
|
+
*/
|
|
395
|
+
def reqCoverScala5(value: Int): Int = value + 5
|
|
396
|
+
|
|
397
|
+
}
|
|
398
|
+
/* REQ-COVER-SRS-231 END */
|
|
@@ -0,0 +1,276 @@
|
|
|
1
|
+
#!/bin/bash
|
|
2
|
+
# @file fixture_shell.sh
|
|
3
|
+
# @brief Comprehensive Shell/Bash test fixture for parser validation.
|
|
4
|
+
# @details Covers arrays, associative arrays, parameter expansion,
|
|
5
|
+
# here documents, process substitution, traps, getopts,
|
|
6
|
+
# case statements, arithmetic, and here strings.
|
|
7
|
+
# Single line comment
|
|
8
|
+
|
|
9
|
+
# ── Variables and exports ─────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
# @brief Greeting message template.
|
|
12
|
+
MY_VAR="hello"
|
|
13
|
+
|
|
14
|
+
# @brief Extended PATH including local binary directory.
|
|
15
|
+
export PATH_EXT="/usr/local/bin"
|
|
16
|
+
|
|
17
|
+
# @brief Immutable maximum iteration counter.
|
|
18
|
+
readonly MAX_COUNT=10
|
|
19
|
+
|
|
20
|
+
# @brief Build version set via declare.
|
|
21
|
+
declare -r BUILD_VERSION="1.0.0"
|
|
22
|
+
|
|
23
|
+
# @brief Debug mode flag (0=off, 1=on).
|
|
24
|
+
DEBUG_MODE=0
|
|
25
|
+
|
|
26
|
+
# ── Arrays ────────────────────────────────────────────────────────────
|
|
27
|
+
|
|
28
|
+
# @brief Indexed array of supported languages.
|
|
29
|
+
declare -a LANGUAGES=("python" "rust" "go" "java" "typescript")
|
|
30
|
+
|
|
31
|
+
# @brief Associative array mapping extensions to languages.
|
|
32
|
+
declare -A EXT_MAP=(
|
|
33
|
+
[py]="python"
|
|
34
|
+
[rs]="rust"
|
|
35
|
+
[go]="go"
|
|
36
|
+
[java]="java"
|
|
37
|
+
[ts]="typescript"
|
|
38
|
+
)
|
|
39
|
+
|
|
40
|
+
# ── Functions ─────────────────────────────────────────────────────────
|
|
41
|
+
|
|
42
|
+
# @brief Greet a user by name on stdout.
|
|
43
|
+
# @param $1 The user's name.
|
|
44
|
+
function greet() {
|
|
45
|
+
local name="${1:?Name required}"
|
|
46
|
+
# Validate non-empty name
|
|
47
|
+
if [[ -z "$name" ]]; then
|
|
48
|
+
echo "Error: empty name" >&2
|
|
49
|
+
return 1
|
|
50
|
+
fi
|
|
51
|
+
echo "Hello ${name}!"
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
# @brief Remove temporary files and directories.
|
|
55
|
+
# @details Called by trap on EXIT for cleanup.
|
|
56
|
+
cleanup() {
|
|
57
|
+
local tmp_dir="${TMPDIR:-/tmp}/myapp_$$"
|
|
58
|
+
if [[ -d "$tmp_dir" ]]; then
|
|
59
|
+
# Remove temp directory and all contents
|
|
60
|
+
rm -rf "$tmp_dir"
|
|
61
|
+
fi
|
|
62
|
+
echo "Cleanup complete"
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
# @brief Parse command-line options using getopts.
|
|
66
|
+
# @param $@ Command-line arguments.
|
|
67
|
+
# @return Sets global variables based on parsed options.
|
|
68
|
+
parse_args() {
|
|
69
|
+
local opt
|
|
70
|
+
while getopts "vdhf:o:" opt; do
|
|
71
|
+
case "$opt" in
|
|
72
|
+
v)
|
|
73
|
+
# Enable verbose output
|
|
74
|
+
VERBOSE=1
|
|
75
|
+
;;
|
|
76
|
+
d)
|
|
77
|
+
# Enable debug mode
|
|
78
|
+
DEBUG_MODE=1
|
|
79
|
+
;;
|
|
80
|
+
f)
|
|
81
|
+
# Set input file path
|
|
82
|
+
INPUT_FILE="$OPTARG"
|
|
83
|
+
;;
|
|
84
|
+
o)
|
|
85
|
+
# Set output file path
|
|
86
|
+
OUTPUT_FILE="$OPTARG"
|
|
87
|
+
;;
|
|
88
|
+
h)
|
|
89
|
+
echo "Usage: $0 [-v] [-d] [-f file] [-o output] [-h]"
|
|
90
|
+
return 0
|
|
91
|
+
;;
|
|
92
|
+
*)
|
|
93
|
+
echo "Unknown option: $opt" >&2
|
|
94
|
+
return 1
|
|
95
|
+
;;
|
|
96
|
+
esac
|
|
97
|
+
done
|
|
98
|
+
shift $((OPTIND - 1))
|
|
99
|
+
}
|
|
100
|
+
|
|
101
|
+
# @brief Process a file with error handling and logging.
|
|
102
|
+
# @param $1 Path to the input file.
|
|
103
|
+
# @param $2 Optional output path (defaults to stdout).
|
|
104
|
+
# @return 0 on success, 1 on failure.
|
|
105
|
+
process_file() {
|
|
106
|
+
local input="$1"
|
|
107
|
+
local output="${2:-/dev/stdout}"
|
|
108
|
+
|
|
109
|
+
# Verify input file exists and is readable
|
|
110
|
+
if [[ ! -f "$input" ]]; then
|
|
111
|
+
echo "Error: file not found: $input" >&2
|
|
112
|
+
return 1
|
|
113
|
+
fi
|
|
114
|
+
|
|
115
|
+
if [[ ! -r "$input" ]]; then
|
|
116
|
+
echo "Error: file not readable: $input" >&2
|
|
117
|
+
return 1
|
|
118
|
+
fi
|
|
119
|
+
|
|
120
|
+
# Count lines using wc
|
|
121
|
+
local line_count
|
|
122
|
+
line_count=$(wc -l < "$input")
|
|
123
|
+
echo "Processing $input ($line_count lines)" >&2
|
|
124
|
+
|
|
125
|
+
# Transform and write output
|
|
126
|
+
while IFS= read -r line; do
|
|
127
|
+
# Skip empty lines and comments
|
|
128
|
+
[[ -z "$line" || "$line" =~ ^[[:space:]]*# ]] && continue
|
|
129
|
+
echo "$line"
|
|
130
|
+
done < "$input" > "$output"
|
|
131
|
+
|
|
132
|
+
return 0
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
# @brief Execute a command with retry logic.
|
|
136
|
+
# @param $1 Maximum number of retry attempts.
|
|
137
|
+
# @param $@ The command and arguments to execute.
|
|
138
|
+
# @return Exit code of the final attempt.
|
|
139
|
+
retry_command() {
|
|
140
|
+
local max_attempts="$1"
|
|
141
|
+
shift
|
|
142
|
+
local attempt=1
|
|
143
|
+
|
|
144
|
+
while (( attempt <= max_attempts )); do
|
|
145
|
+
# Attempt the command
|
|
146
|
+
if "$@"; then
|
|
147
|
+
return 0
|
|
148
|
+
fi
|
|
149
|
+
echo "Attempt $attempt/$max_attempts failed" >&2
|
|
150
|
+
(( attempt++ ))
|
|
151
|
+
# Exponential backoff
|
|
152
|
+
sleep $(( 2 ** (attempt - 1) ))
|
|
153
|
+
done
|
|
154
|
+
|
|
155
|
+
echo "All $max_attempts attempts failed" >&2
|
|
156
|
+
return 1
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
# @brief Log a message with timestamp prefix.
|
|
160
|
+
# @param $1 Log level (INFO, WARN, ERROR).
|
|
161
|
+
# @param $@ Message text.
|
|
162
|
+
log_message() {
|
|
163
|
+
local level="$1"
|
|
164
|
+
shift
|
|
165
|
+
local timestamp
|
|
166
|
+
timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
167
|
+
echo "[$timestamp] [$level] $*" >&2
|
|
168
|
+
}
|
|
169
|
+
|
|
170
|
+
# @brief Generate a temporary file and return its path.
|
|
171
|
+
# @return Path to the created temporary file.
|
|
172
|
+
make_temp() {
|
|
173
|
+
local tmpfile
|
|
174
|
+
tmpfile=$(mktemp "${TMPDIR:-/tmp}/myapp_XXXXXX")
|
|
175
|
+
echo "$tmpfile"
|
|
176
|
+
}
|
|
177
|
+
|
|
178
|
+
# ── Traps ─────────────────────────────────────────────────────────────
|
|
179
|
+
|
|
180
|
+
# @brief Register cleanup function on script exit.
|
|
181
|
+
trap cleanup EXIT
|
|
182
|
+
|
|
183
|
+
# @brief Handle interrupt signal gracefully.
|
|
184
|
+
trap 'echo "Interrupted"; exit 130' INT TERM
|
|
185
|
+
|
|
186
|
+
# ── Here document ─────────────────────────────────────────────────────
|
|
187
|
+
|
|
188
|
+
# @brief Generate a configuration file using heredoc.
|
|
189
|
+
generate_config() {
|
|
190
|
+
cat <<EOF
|
|
191
|
+
# Auto-generated configuration
|
|
192
|
+
version=${BUILD_VERSION}
|
|
193
|
+
debug=${DEBUG_MODE}
|
|
194
|
+
max_count=${MAX_COUNT}
|
|
195
|
+
EOF
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
# ── Arithmetic and parameter expansion ────────────────────────────────
|
|
199
|
+
|
|
200
|
+
# @brief Compute factorial iteratively.
|
|
201
|
+
# @param $1 Non-negative integer.
|
|
202
|
+
# @return Factorial result.
|
|
203
|
+
factorial() {
|
|
204
|
+
local n="${1:-1}"
|
|
205
|
+
local result=1
|
|
206
|
+
local i
|
|
207
|
+
for (( i = 2; i <= n; i++ )); do
|
|
208
|
+
# Multiply accumulator
|
|
209
|
+
(( result *= i ))
|
|
210
|
+
done
|
|
211
|
+
echo "$result"
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
# ── Source external configuration ─────────────────────────────────────
|
|
215
|
+
|
|
216
|
+
# @brief Load external configuration script if present.
|
|
217
|
+
if [[ -f ./config.sh ]]; then
|
|
218
|
+
source ./config.sh
|
|
219
|
+
fi
|
|
220
|
+
|
|
221
|
+
# coverage extension block
|
|
222
|
+
source ./env.sh
|
|
223
|
+
. ./helpers.sh
|
|
224
|
+
source ./shared.sh
|
|
225
|
+
. ./paths.sh
|
|
226
|
+
source ./runtime.sh
|
|
227
|
+
. ./exports.sh
|
|
228
|
+
source ./network.sh
|
|
229
|
+
|
|
230
|
+
# REQ-COVER-SRS-231 START
|
|
231
|
+
# @REQ-COVER-SRS-231 block 1
|
|
232
|
+
# @brief Coverage helper construct 1.
|
|
233
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 1.
|
|
234
|
+
# @param value Input value for helper construct 1.
|
|
235
|
+
# @return Output value for helper construct 1.
|
|
236
|
+
req_cover_shell_1() {
|
|
237
|
+
echo "$(( $1 + 1 ))"
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
# @REQ-COVER-SRS-231 block 2
|
|
241
|
+
# @brief Coverage helper construct 2.
|
|
242
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 2.
|
|
243
|
+
# @param value Input value for helper construct 2.
|
|
244
|
+
# @return Output value for helper construct 2.
|
|
245
|
+
req_cover_shell_2() {
|
|
246
|
+
echo "$(( $1 + 2 ))"
|
|
247
|
+
}
|
|
248
|
+
|
|
249
|
+
# @REQ-COVER-SRS-231 block 3
|
|
250
|
+
# @brief Coverage helper construct 3.
|
|
251
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 3.
|
|
252
|
+
# @param value Input value for helper construct 3.
|
|
253
|
+
# @return Output value for helper construct 3.
|
|
254
|
+
req_cover_shell_3() {
|
|
255
|
+
echo "$(( $1 + 3 ))"
|
|
256
|
+
}
|
|
257
|
+
|
|
258
|
+
# @REQ-COVER-SRS-231 block 4
|
|
259
|
+
# @brief Coverage helper construct 4.
|
|
260
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 4.
|
|
261
|
+
# @param value Input value for helper construct 4.
|
|
262
|
+
# @return Output value for helper construct 4.
|
|
263
|
+
req_cover_shell_4() {
|
|
264
|
+
echo "$(( $1 + 4 ))"
|
|
265
|
+
}
|
|
266
|
+
|
|
267
|
+
# @REQ-COVER-SRS-231 block 5
|
|
268
|
+
# @brief Coverage helper construct 5.
|
|
269
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 5.
|
|
270
|
+
# @param value Input value for helper construct 5.
|
|
271
|
+
# @return Output value for helper construct 5.
|
|
272
|
+
req_cover_shell_5() {
|
|
273
|
+
echo "$(( $1 + 5 ))"
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
# REQ-COVER-SRS-231 END
|