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,276 @@
|
|
|
1
|
+
--- @file fixture_lua.lua
|
|
2
|
+
--- @brief Comprehensive Lua test fixture for parser validation.
|
|
3
|
+
--- @details Covers metatables, coroutines, closures, OOP patterns,
|
|
4
|
+
--- module pattern, varargs, error handling, and table constructors.
|
|
5
|
+
-- Single line comment
|
|
6
|
+
--[[ Multi-line
|
|
7
|
+
comment ]]
|
|
8
|
+
|
|
9
|
+
-- ── Standard functions ─────────────────────────────────────────────────
|
|
10
|
+
|
|
11
|
+
--- Compute the successor of a number.
|
|
12
|
+
--- @param x number The input value.
|
|
13
|
+
--- @return number The input incremented by one.
|
|
14
|
+
function globalFunc(x)
|
|
15
|
+
return x + 1
|
|
16
|
+
end
|
|
17
|
+
|
|
18
|
+
--- Multiply a value by two with validation.
|
|
19
|
+
--- @param y number The input value; must be a number.
|
|
20
|
+
--- @return number The doubled value.
|
|
21
|
+
--- @raise error If y is not a number.
|
|
22
|
+
local function localFunc(y)
|
|
23
|
+
if type(y) ~= "number" then
|
|
24
|
+
error("expected number, got " .. type(y))
|
|
25
|
+
end
|
|
26
|
+
-- Perform the multiplication
|
|
27
|
+
return y * 2
|
|
28
|
+
end
|
|
29
|
+
|
|
30
|
+
--- Variadic function summing all arguments.
|
|
31
|
+
--- @param ... number Variable number of numeric arguments.
|
|
32
|
+
--- @return number Sum of all provided values.
|
|
33
|
+
local function sumAll(...)
|
|
34
|
+
local total = 0
|
|
35
|
+
local args = {...}
|
|
36
|
+
for _, v in ipairs(args) do
|
|
37
|
+
-- Accumulate each argument
|
|
38
|
+
total = total + v
|
|
39
|
+
end
|
|
40
|
+
return total
|
|
41
|
+
end
|
|
42
|
+
|
|
43
|
+
-- ── Variables and constants ────────────────────────────────────────────
|
|
44
|
+
|
|
45
|
+
--- @brief Module-level constant for retry limits.
|
|
46
|
+
local myVar = 42
|
|
47
|
+
|
|
48
|
+
--- @brief Configuration table with default settings.
|
|
49
|
+
local config = {
|
|
50
|
+
debug = false,
|
|
51
|
+
maxRetries = 3,
|
|
52
|
+
timeout = 30.0,
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
-- ── Function assigned to variable ──────────────────────────────────────
|
|
56
|
+
|
|
57
|
+
--- Event handler for UI callbacks.
|
|
58
|
+
--- @param event table Event object containing type and data fields.
|
|
59
|
+
local handler = function(event)
|
|
60
|
+
-- Dispatch based on event type
|
|
61
|
+
if event.type == "click" then
|
|
62
|
+
print("clicked at " .. event.x .. "," .. event.y)
|
|
63
|
+
else
|
|
64
|
+
print("event: " .. event.type)
|
|
65
|
+
end
|
|
66
|
+
end
|
|
67
|
+
|
|
68
|
+
-- ── Module method pattern ──────────────────────────────────────────────
|
|
69
|
+
|
|
70
|
+
--- @class MyModule
|
|
71
|
+
--- @brief Table-based module using method syntax.
|
|
72
|
+
local MyModule = {}
|
|
73
|
+
MyModule.__index = MyModule
|
|
74
|
+
|
|
75
|
+
--- Create a new module instance with a name.
|
|
76
|
+
--- @param name string Instance identifier.
|
|
77
|
+
--- @return table New MyModule instance.
|
|
78
|
+
function MyModule.new(name)
|
|
79
|
+
local self = setmetatable({}, MyModule)
|
|
80
|
+
self.name = name
|
|
81
|
+
self._items = {}
|
|
82
|
+
return self
|
|
83
|
+
end
|
|
84
|
+
|
|
85
|
+
--- Get the module instance name using colon method syntax.
|
|
86
|
+
--- @param self table The MyModule instance.
|
|
87
|
+
--- @return string The instance name.
|
|
88
|
+
MyModule.method = function(self)
|
|
89
|
+
return self.name
|
|
90
|
+
end
|
|
91
|
+
|
|
92
|
+
--- Add an item to the internal collection.
|
|
93
|
+
--- @param item any The item to store.
|
|
94
|
+
function MyModule:addItem(item)
|
|
95
|
+
-- Append to internal list
|
|
96
|
+
table.insert(self._items, item)
|
|
97
|
+
end
|
|
98
|
+
|
|
99
|
+
--- Get count of stored items.
|
|
100
|
+
--- @return number Number of items.
|
|
101
|
+
function MyModule:count()
|
|
102
|
+
return #self._items
|
|
103
|
+
end
|
|
104
|
+
|
|
105
|
+
-- ── Metatable-based OOP ────────────────────────────────────────────────
|
|
106
|
+
|
|
107
|
+
--- @class Animal
|
|
108
|
+
--- @brief Base class using metatables for inheritance.
|
|
109
|
+
local Animal = {}
|
|
110
|
+
Animal.__index = Animal
|
|
111
|
+
|
|
112
|
+
--- Create a new Animal with a species name.
|
|
113
|
+
--- @param species string The animal's species.
|
|
114
|
+
--- @return table New Animal instance.
|
|
115
|
+
function Animal.new(species)
|
|
116
|
+
local self = setmetatable({}, Animal)
|
|
117
|
+
self.species = species
|
|
118
|
+
return self
|
|
119
|
+
end
|
|
120
|
+
|
|
121
|
+
--- Produce the animal's sound.
|
|
122
|
+
--- @return string Sound description.
|
|
123
|
+
function Animal:speak()
|
|
124
|
+
return self.species .. " says ..."
|
|
125
|
+
end
|
|
126
|
+
|
|
127
|
+
--- @class Dog
|
|
128
|
+
--- @brief Dog subclass inheriting from Animal.
|
|
129
|
+
local Dog = setmetatable({}, { __index = Animal })
|
|
130
|
+
Dog.__index = Dog
|
|
131
|
+
|
|
132
|
+
--- Create a new Dog instance.
|
|
133
|
+
--- @param name string The dog's name.
|
|
134
|
+
--- @return table New Dog instance.
|
|
135
|
+
function Dog.new(name)
|
|
136
|
+
local self = Animal.new("Dog")
|
|
137
|
+
setmetatable(self, Dog)
|
|
138
|
+
self.dogName = name
|
|
139
|
+
return self
|
|
140
|
+
end
|
|
141
|
+
|
|
142
|
+
--- Override speak for dog-specific behavior.
|
|
143
|
+
--- @return string The dog's vocalization.
|
|
144
|
+
function Dog:speak()
|
|
145
|
+
return self.dogName .. " says Woof!"
|
|
146
|
+
end
|
|
147
|
+
|
|
148
|
+
-- ── Closure factory ────────────────────────────────────────────────────
|
|
149
|
+
|
|
150
|
+
--- Create a counter closure with step increment.
|
|
151
|
+
--- @param step number Increment amount per call.
|
|
152
|
+
--- @return function Closure returning successive counts.
|
|
153
|
+
local function makeCounter(step)
|
|
154
|
+
local count = 0
|
|
155
|
+
return function()
|
|
156
|
+
-- Capture and mutate the upvalue
|
|
157
|
+
count = count + step
|
|
158
|
+
return count
|
|
159
|
+
end
|
|
160
|
+
end
|
|
161
|
+
|
|
162
|
+
-- ── Coroutine ──────────────────────────────────────────────────────────
|
|
163
|
+
|
|
164
|
+
--- Generator coroutine yielding Fibonacci numbers.
|
|
165
|
+
--- @param limit number Maximum number of values to yield.
|
|
166
|
+
--- @return function Coroutine wrap function.
|
|
167
|
+
local function fibonacci(limit)
|
|
168
|
+
return coroutine.wrap(function()
|
|
169
|
+
local a, b = 0, 1
|
|
170
|
+
for _ = 1, limit do
|
|
171
|
+
coroutine.yield(a)
|
|
172
|
+
-- Advance to next Fibonacci number
|
|
173
|
+
a, b = b, a + b
|
|
174
|
+
end
|
|
175
|
+
end)
|
|
176
|
+
end
|
|
177
|
+
|
|
178
|
+
-- ── Error handling with pcall ──────────────────────────────────────────
|
|
179
|
+
|
|
180
|
+
--- Safely execute a function, catching any errors.
|
|
181
|
+
--- @param fn function The function to execute.
|
|
182
|
+
--- @param ... any Arguments to pass to fn.
|
|
183
|
+
--- @return boolean, any Success flag and result or error message.
|
|
184
|
+
local function safeCall(fn, ...)
|
|
185
|
+
local ok, result = pcall(fn, ...)
|
|
186
|
+
if not ok then
|
|
187
|
+
-- Log error and return nil
|
|
188
|
+
print("Error: " .. tostring(result))
|
|
189
|
+
return false, nil
|
|
190
|
+
end
|
|
191
|
+
return true, result
|
|
192
|
+
end
|
|
193
|
+
|
|
194
|
+
-- ── Table constructor with mixed keys ──────────────────────────────────
|
|
195
|
+
|
|
196
|
+
--- @brief Complex table demonstrating all key types.
|
|
197
|
+
local mixedTable = {
|
|
198
|
+
-- Array part
|
|
199
|
+
"first",
|
|
200
|
+
"second",
|
|
201
|
+
-- Hash part with string keys
|
|
202
|
+
name = "test",
|
|
203
|
+
count = 42,
|
|
204
|
+
-- Computed key
|
|
205
|
+
[math.pi] = "pi",
|
|
206
|
+
-- Nested table
|
|
207
|
+
nested = {
|
|
208
|
+
x = 1,
|
|
209
|
+
y = 2,
|
|
210
|
+
},
|
|
211
|
+
}
|
|
212
|
+
|
|
213
|
+
-- ── Iterator pattern ───────────────────────────────────────────────────
|
|
214
|
+
|
|
215
|
+
--- Create a stateful iterator over a range.
|
|
216
|
+
--- @param from number Start of range (inclusive).
|
|
217
|
+
--- @param to number End of range (inclusive).
|
|
218
|
+
--- @return function Iterator function.
|
|
219
|
+
local function range(from, to)
|
|
220
|
+
local i = from - 1
|
|
221
|
+
return function()
|
|
222
|
+
i = i + 1
|
|
223
|
+
if i <= to then
|
|
224
|
+
return i
|
|
225
|
+
end
|
|
226
|
+
-- Implicit nil return terminates iteration
|
|
227
|
+
end
|
|
228
|
+
end
|
|
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
|
+
function req_cover_lua_1(value)
|
|
237
|
+
return value + 1
|
|
238
|
+
end
|
|
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
|
+
function req_cover_lua_2(value)
|
|
246
|
+
return value + 2
|
|
247
|
+
end
|
|
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
|
+
function req_cover_lua_3(value)
|
|
255
|
+
return value + 3
|
|
256
|
+
end
|
|
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
|
+
function req_cover_lua_4(value)
|
|
264
|
+
return value + 4
|
|
265
|
+
end
|
|
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
|
+
function req_cover_lua_5(value)
|
|
273
|
+
return value + 5
|
|
274
|
+
end
|
|
275
|
+
|
|
276
|
+
-- REQ-COVER-SRS-231 END
|
|
@@ -0,0 +1,310 @@
|
|
|
1
|
+
#!/usr/bin/perl
|
|
2
|
+
# @file fixture_perl.pl
|
|
3
|
+
# @brief Comprehensive Perl test fixture for parser validation.
|
|
4
|
+
# @details Covers OOP with bless, Moose-like attributes, closures,
|
|
5
|
+
# here-docs, wantarray, dispatch tables, prototypes, AUTOLOAD,
|
|
6
|
+
# and regular expressions.
|
|
7
|
+
# Single line comment
|
|
8
|
+
=pod
|
|
9
|
+
|
|
10
|
+
@brief Documentation block for the fixture module.
|
|
11
|
+
@details This module demonstrates advanced Perl constructs including
|
|
12
|
+
object-oriented patterns, closures, and metaprogramming.
|
|
13
|
+
|
|
14
|
+
=cut
|
|
15
|
+
|
|
16
|
+
package MyPackage;
|
|
17
|
+
|
|
18
|
+
use strict;
|
|
19
|
+
use warnings;
|
|
20
|
+
use Carp qw(croak confess);
|
|
21
|
+
require Exporter;
|
|
22
|
+
use constant MAX_SIZE => 100;
|
|
23
|
+
use constant {
|
|
24
|
+
MIN_SIZE => 1,
|
|
25
|
+
DEFAULT_NAME => 'unnamed',
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
# @brief Module version string.
|
|
29
|
+
our $VERSION = '1.0.0';
|
|
30
|
+
|
|
31
|
+
# @brief Symbols exported by default.
|
|
32
|
+
our @EXPORT = qw(greet process);
|
|
33
|
+
|
|
34
|
+
# @brief Symbols available on request.
|
|
35
|
+
our @EXPORT_OK = qw(helper format_output);
|
|
36
|
+
|
|
37
|
+
# ── Constructor and OOP ──────────────────────────────────────────────
|
|
38
|
+
|
|
39
|
+
=pod
|
|
40
|
+
|
|
41
|
+
@brief Create a new MyPackage instance.
|
|
42
|
+
@param class The class name (implicit first argument).
|
|
43
|
+
@param %args Named arguments: name (required), age (optional).
|
|
44
|
+
@return Blessed hashref instance.
|
|
45
|
+
|
|
46
|
+
=cut
|
|
47
|
+
|
|
48
|
+
sub new {
|
|
49
|
+
my ($class, %args) = @_;
|
|
50
|
+
croak "name is required" unless $args{name};
|
|
51
|
+
my $self = bless {
|
|
52
|
+
name => $args{name},
|
|
53
|
+
age => $args{age} || 0,
|
|
54
|
+
_items => [],
|
|
55
|
+
_cache => {},
|
|
56
|
+
}, $class;
|
|
57
|
+
return $self;
|
|
58
|
+
}
|
|
59
|
+
|
|
60
|
+
# @brief Accessor for the name attribute.
|
|
61
|
+
# @return The instance name string.
|
|
62
|
+
sub name {
|
|
63
|
+
my ($self, $val) = @_;
|
|
64
|
+
if (defined $val) {
|
|
65
|
+
# Setter mode
|
|
66
|
+
$self->{name} = $val;
|
|
67
|
+
return $self;
|
|
68
|
+
}
|
|
69
|
+
return $self->{name};
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
# @brief Check if the instance is in a valid state.
|
|
73
|
+
# @return 1 if valid, 0 otherwise.
|
|
74
|
+
sub is_valid {
|
|
75
|
+
my ($self) = @_;
|
|
76
|
+
return defined($self->{name}) && length($self->{name}) > 0 ? 1 : 0;
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
# ── Functions ────────────────────────────────────────────────────────
|
|
80
|
+
|
|
81
|
+
# @brief Print a greeting to stdout.
|
|
82
|
+
# @param $name The person's name.
|
|
83
|
+
sub greet {
|
|
84
|
+
my ($name) = @_;
|
|
85
|
+
# Validate input before printing
|
|
86
|
+
unless (defined $name) {
|
|
87
|
+
warn "greet called without name";
|
|
88
|
+
return;
|
|
89
|
+
}
|
|
90
|
+
print "Hello $name\n";
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
# @brief Process data and return result.
|
|
94
|
+
# @return 1 indicating success.
|
|
95
|
+
sub process {
|
|
96
|
+
return 1;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
# @brief Format output depending on context (list vs scalar).
|
|
100
|
+
# @param @items List of items to format.
|
|
101
|
+
# @return In list context: formatted items. In scalar: count.
|
|
102
|
+
sub format_output {
|
|
103
|
+
my (@items) = @_;
|
|
104
|
+
if (wantarray()) {
|
|
105
|
+
# List context — return formatted items
|
|
106
|
+
return map { uc($_) } @items;
|
|
107
|
+
} else {
|
|
108
|
+
# Scalar context — return count
|
|
109
|
+
return scalar @items;
|
|
110
|
+
}
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
# @brief Standalone helper for internal use.
|
|
114
|
+
# @return Always returns "ok".
|
|
115
|
+
sub helper {
|
|
116
|
+
return "ok";
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
# ── Regular expression functions ─────────────────────────────────────
|
|
120
|
+
|
|
121
|
+
# @brief Extract all email addresses from text.
|
|
122
|
+
# @param $text Input text to scan.
|
|
123
|
+
# @return List of matched email addresses.
|
|
124
|
+
sub extract_emails {
|
|
125
|
+
my ($text) = @_;
|
|
126
|
+
my @emails;
|
|
127
|
+
# Match standard email pattern
|
|
128
|
+
while ($text =~ /\b([\w.+-]+@[\w-]+\.[\w.]+)\b/g) {
|
|
129
|
+
push @emails, $1;
|
|
130
|
+
}
|
|
131
|
+
return @emails;
|
|
132
|
+
}
|
|
133
|
+
|
|
134
|
+
# @brief Replace all occurrences of a pattern in text.
|
|
135
|
+
# @param $text Input text.
|
|
136
|
+
# @param $pattern Regex pattern to find.
|
|
137
|
+
# @param $replacement Replacement string.
|
|
138
|
+
# @return Modified text with substitutions applied.
|
|
139
|
+
sub replace_all {
|
|
140
|
+
my ($text, $pattern, $replacement) = @_;
|
|
141
|
+
$text =~ s/$pattern/$replacement/g;
|
|
142
|
+
return $text;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
# ── Closure factory ──────────────────────────────────────────────────
|
|
146
|
+
|
|
147
|
+
# @brief Create a multiplier closure.
|
|
148
|
+
# @param $factor The multiplication factor.
|
|
149
|
+
# @return Coderef that multiplies its argument by factor.
|
|
150
|
+
sub make_multiplier {
|
|
151
|
+
my ($factor) = @_;
|
|
152
|
+
# Capture $factor in the returned closure
|
|
153
|
+
return sub {
|
|
154
|
+
my ($x) = @_;
|
|
155
|
+
return $x * $factor;
|
|
156
|
+
};
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
# ── Dispatch table ───────────────────────────────────────────────────
|
|
160
|
+
|
|
161
|
+
# @brief Command dispatch table mapping names to handler coderefs.
|
|
162
|
+
my %dispatch = (
|
|
163
|
+
add => sub { $_[0] + $_[1] },
|
|
164
|
+
sub => sub { $_[0] - $_[1] },
|
|
165
|
+
mul => sub { $_[0] * $_[1] },
|
|
166
|
+
div => sub {
|
|
167
|
+
croak "Division by zero" if $_[1] == 0;
|
|
168
|
+
return $_[0] / $_[1];
|
|
169
|
+
},
|
|
170
|
+
);
|
|
171
|
+
|
|
172
|
+
# @brief Execute a named operation from the dispatch table.
|
|
173
|
+
# @param $op Operation name (add, sub, mul, div).
|
|
174
|
+
# @param $a First operand.
|
|
175
|
+
# @param $b Second operand.
|
|
176
|
+
# @return Result of the operation.
|
|
177
|
+
# @raise Croaks if operation is unknown.
|
|
178
|
+
sub dispatch {
|
|
179
|
+
my ($op, $a, $b) = @_;
|
|
180
|
+
my $handler = $dispatch{$op}
|
|
181
|
+
or croak "Unknown operation: $op";
|
|
182
|
+
return $handler->($a, $b);
|
|
183
|
+
}
|
|
184
|
+
|
|
185
|
+
# ── Here-doc ─────────────────────────────────────────────────────────
|
|
186
|
+
|
|
187
|
+
# @brief Generate a template string using a here-document.
|
|
188
|
+
# @param $name Name to insert into the template.
|
|
189
|
+
# @return Formatted multi-line string.
|
|
190
|
+
sub generate_template {
|
|
191
|
+
my ($name) = @_;
|
|
192
|
+
return <<END_TEMPLATE;
|
|
193
|
+
Dear $name,
|
|
194
|
+
|
|
195
|
+
This is a generated template.
|
|
196
|
+
Version: $VERSION
|
|
197
|
+
Max size: @{[ MAX_SIZE ]}
|
|
198
|
+
|
|
199
|
+
Regards,
|
|
200
|
+
The System
|
|
201
|
+
END_TEMPLATE
|
|
202
|
+
}
|
|
203
|
+
|
|
204
|
+
# ── AUTOLOAD for dynamic dispatch ────────────────────────────────────
|
|
205
|
+
|
|
206
|
+
# @brief Handle undefined method calls dynamically.
|
|
207
|
+
# @details Methods named get_* return the corresponding attribute.
|
|
208
|
+
# @param @args Arguments passed to the auto-loaded method.
|
|
209
|
+
# @return The attribute value or undef.
|
|
210
|
+
sub AUTOLOAD {
|
|
211
|
+
my ($self, @args) = @_;
|
|
212
|
+
our $AUTOLOAD;
|
|
213
|
+
# Extract method name from fully qualified AUTOLOAD
|
|
214
|
+
my $method = $AUTOLOAD;
|
|
215
|
+
$method =~ s/.*:://;
|
|
216
|
+
return if $method eq 'DESTROY';
|
|
217
|
+
|
|
218
|
+
if ($method =~ /^get_(\w+)$/) {
|
|
219
|
+
my $attr = $1;
|
|
220
|
+
return $self->{$attr};
|
|
221
|
+
}
|
|
222
|
+
croak "Undefined method: $method";
|
|
223
|
+
}
|
|
224
|
+
|
|
225
|
+
# ── Error handling ───────────────────────────────────────────────────
|
|
226
|
+
|
|
227
|
+
# @brief Execute a block with error trapping.
|
|
228
|
+
# @param $code Coderef to execute.
|
|
229
|
+
# @return Result of execution or undef on error.
|
|
230
|
+
sub safe_execute {
|
|
231
|
+
my ($code) = @_;
|
|
232
|
+
my $result = eval {
|
|
233
|
+
$code->();
|
|
234
|
+
};
|
|
235
|
+
if ($@) {
|
|
236
|
+
# Log and suppress error
|
|
237
|
+
warn "Caught error: $@";
|
|
238
|
+
return undef;
|
|
239
|
+
}
|
|
240
|
+
return $result;
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
1; # Module must return true
|
|
244
|
+
|
|
245
|
+
=pod
|
|
246
|
+
coverage extension block
|
|
247
|
+
=cut
|
|
248
|
+
package Extra::One;
|
|
249
|
+
package Extra::Two;
|
|
250
|
+
package Extra::Three;
|
|
251
|
+
package Extra::Four;
|
|
252
|
+
use constant RETRY_LIMIT => 5;
|
|
253
|
+
use constant API_HOST => 'localhost';
|
|
254
|
+
use constant FEATURE_FLAG => 1;
|
|
255
|
+
use constant CACHE_SIZE => 256;
|
|
256
|
+
use constant DEFAULT_USER => 'guest';
|
|
257
|
+
use lib 'lib';
|
|
258
|
+
|
|
259
|
+
# REQ-COVER-SRS-231 START
|
|
260
|
+
# @REQ-COVER-SRS-231 block 1
|
|
261
|
+
# @brief Coverage helper construct 1.
|
|
262
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 1.
|
|
263
|
+
# @param value Input value for helper construct 1.
|
|
264
|
+
# @return Output value for helper construct 1.
|
|
265
|
+
sub req_cover_perl_1 {
|
|
266
|
+
my ($value) = @_;
|
|
267
|
+
return $value + 1;
|
|
268
|
+
}
|
|
269
|
+
|
|
270
|
+
# @REQ-COVER-SRS-231 block 2
|
|
271
|
+
# @brief Coverage helper construct 2.
|
|
272
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 2.
|
|
273
|
+
# @param value Input value for helper construct 2.
|
|
274
|
+
# @return Output value for helper construct 2.
|
|
275
|
+
sub req_cover_perl_2 {
|
|
276
|
+
my ($value) = @_;
|
|
277
|
+
return $value + 2;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
# @REQ-COVER-SRS-231 block 3
|
|
281
|
+
# @brief Coverage helper construct 3.
|
|
282
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 3.
|
|
283
|
+
# @param value Input value for helper construct 3.
|
|
284
|
+
# @return Output value for helper construct 3.
|
|
285
|
+
sub req_cover_perl_3 {
|
|
286
|
+
my ($value) = @_;
|
|
287
|
+
return $value + 3;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
# @REQ-COVER-SRS-231 block 4
|
|
291
|
+
# @brief Coverage helper construct 4.
|
|
292
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 4.
|
|
293
|
+
# @param value Input value for helper construct 4.
|
|
294
|
+
# @return Output value for helper construct 4.
|
|
295
|
+
sub req_cover_perl_4 {
|
|
296
|
+
my ($value) = @_;
|
|
297
|
+
return $value + 4;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
# @REQ-COVER-SRS-231 block 5
|
|
301
|
+
# @brief Coverage helper construct 5.
|
|
302
|
+
# @details Provides deterministic fixture-level Doxygen coverage block 5.
|
|
303
|
+
# @param value Input value for helper construct 5.
|
|
304
|
+
# @return Output value for helper construct 5.
|
|
305
|
+
sub req_cover_perl_5 {
|
|
306
|
+
my ($value) = @_;
|
|
307
|
+
return $value + 5;
|
|
308
|
+
}
|
|
309
|
+
|
|
310
|
+
# REQ-COVER-SRS-231 END
|