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
package/src/cli.ts
ADDED
|
@@ -0,0 +1,349 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* @file
|
|
4
|
+
* @brief Implements the standalone pi-usereq command-line entry point.
|
|
5
|
+
* @details Parses CLI flags, resolves project configuration, dispatches tool-runner operations, and converts thrown `ReqError` instances into process-style stdout, stderr, and exit codes. Runtime is dominated by the selected subcommand. Side effects include stdout/stderr writes and any filesystem or git operations performed by delegated commands.
|
|
6
|
+
*/
|
|
7
|
+
|
|
8
|
+
import process from "node:process";
|
|
9
|
+
import { ReqError } from "./core/errors.js";
|
|
10
|
+
import { loadConfig, normalizeConfigPaths, saveConfig, type UseReqConfig } from "./core/config.js";
|
|
11
|
+
import {
|
|
12
|
+
loadAndRepairConfig,
|
|
13
|
+
resolveProjectBase,
|
|
14
|
+
runCompress,
|
|
15
|
+
runDocsCheck,
|
|
16
|
+
runFilesCompress,
|
|
17
|
+
runFilesFind,
|
|
18
|
+
runFilesReferences,
|
|
19
|
+
runFilesStaticCheck,
|
|
20
|
+
runFilesTokens,
|
|
21
|
+
runFind,
|
|
22
|
+
runGetBasePath,
|
|
23
|
+
runGitCheck,
|
|
24
|
+
runGitPath,
|
|
25
|
+
runGitWtCreate,
|
|
26
|
+
runGitWtDelete,
|
|
27
|
+
runGitWtName,
|
|
28
|
+
runProjectStaticCheck,
|
|
29
|
+
runReferences,
|
|
30
|
+
runTokens,
|
|
31
|
+
} from "./core/tool-runner.js";
|
|
32
|
+
import {
|
|
33
|
+
buildStaticCheckEntryIdentity,
|
|
34
|
+
parseEnableStaticCheck,
|
|
35
|
+
runStaticCheck,
|
|
36
|
+
validateStaticCheckEntry,
|
|
37
|
+
} from "./core/static-check.js";
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* @brief Represents the parsed CLI flag state for one invocation.
|
|
41
|
+
* @details The interface captures every supported command and option in a normalized shape consumed by `main`. It is compile-time only and introduces no runtime cost.
|
|
42
|
+
*/
|
|
43
|
+
interface ParsedArgs {
|
|
44
|
+
base?: string;
|
|
45
|
+
here?: boolean;
|
|
46
|
+
verbose?: boolean;
|
|
47
|
+
enableLineNumbers?: boolean;
|
|
48
|
+
enableStaticCheck?: string[];
|
|
49
|
+
filesTokens?: string[];
|
|
50
|
+
filesReferences?: string[];
|
|
51
|
+
filesCompress?: string[];
|
|
52
|
+
filesFind?: string[];
|
|
53
|
+
references?: boolean;
|
|
54
|
+
compress?: boolean;
|
|
55
|
+
find?: [string, string];
|
|
56
|
+
tokens?: boolean;
|
|
57
|
+
filesStaticCheck?: string[];
|
|
58
|
+
staticCheck?: boolean;
|
|
59
|
+
gitCheck?: boolean;
|
|
60
|
+
docsCheck?: boolean;
|
|
61
|
+
gitWtName?: boolean;
|
|
62
|
+
gitWtCreate?: string;
|
|
63
|
+
gitWtDelete?: string;
|
|
64
|
+
gitPath?: boolean;
|
|
65
|
+
getBasePath?: boolean;
|
|
66
|
+
testStaticCheck?: string[];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
/**
|
|
70
|
+
* @brief Parses raw CLI tokens into a normalized argument object.
|
|
71
|
+
* @details Performs a single left-to-right scan, supports options with variable-length value tails, and records only the last occurrence of scalar flags. Runtime is O(n) in argument count. No external state is mutated.
|
|
72
|
+
* @param[in] argv {string[]} Raw CLI arguments excluding the executable and script path.
|
|
73
|
+
* @return {ParsedArgs} Parsed flag object.
|
|
74
|
+
*/
|
|
75
|
+
function parseArgs(argv: string[]): ParsedArgs {
|
|
76
|
+
const parsed: ParsedArgs = {};
|
|
77
|
+
const takeUntilOption = (start: number): [string[], number] => {
|
|
78
|
+
const values: string[] = [];
|
|
79
|
+
let index = start;
|
|
80
|
+
while (index < argv.length && !argv[index]!.startsWith("--")) {
|
|
81
|
+
values.push(argv[index]!);
|
|
82
|
+
index += 1;
|
|
83
|
+
}
|
|
84
|
+
return [values, index];
|
|
85
|
+
};
|
|
86
|
+
|
|
87
|
+
let index = 0;
|
|
88
|
+
while (index < argv.length) {
|
|
89
|
+
const token = argv[index]!;
|
|
90
|
+
switch (token) {
|
|
91
|
+
case "--base":
|
|
92
|
+
parsed.base = argv[index + 1];
|
|
93
|
+
index += 2;
|
|
94
|
+
break;
|
|
95
|
+
case "--here":
|
|
96
|
+
parsed.here = true;
|
|
97
|
+
index += 1;
|
|
98
|
+
break;
|
|
99
|
+
case "--verbose":
|
|
100
|
+
parsed.verbose = true;
|
|
101
|
+
index += 1;
|
|
102
|
+
break;
|
|
103
|
+
case "--enable-line-numbers":
|
|
104
|
+
parsed.enableLineNumbers = true;
|
|
105
|
+
index += 1;
|
|
106
|
+
break;
|
|
107
|
+
case "--enable-static-check":
|
|
108
|
+
parsed.enableStaticCheck = [...(parsed.enableStaticCheck ?? []), argv[index + 1] ?? ""];
|
|
109
|
+
index += 2;
|
|
110
|
+
break;
|
|
111
|
+
case "--files-tokens": {
|
|
112
|
+
const [values, next] = takeUntilOption(index + 1);
|
|
113
|
+
parsed.filesTokens = values;
|
|
114
|
+
index = next;
|
|
115
|
+
break;
|
|
116
|
+
}
|
|
117
|
+
case "--files-references": {
|
|
118
|
+
const [values, next] = takeUntilOption(index + 1);
|
|
119
|
+
parsed.filesReferences = values;
|
|
120
|
+
index = next;
|
|
121
|
+
break;
|
|
122
|
+
}
|
|
123
|
+
case "--files-compress": {
|
|
124
|
+
const [values, next] = takeUntilOption(index + 1);
|
|
125
|
+
parsed.filesCompress = values;
|
|
126
|
+
index = next;
|
|
127
|
+
break;
|
|
128
|
+
}
|
|
129
|
+
case "--files-find": {
|
|
130
|
+
const [values, next] = takeUntilOption(index + 1);
|
|
131
|
+
parsed.filesFind = values;
|
|
132
|
+
index = next;
|
|
133
|
+
break;
|
|
134
|
+
}
|
|
135
|
+
case "--references":
|
|
136
|
+
parsed.references = true;
|
|
137
|
+
index += 1;
|
|
138
|
+
break;
|
|
139
|
+
case "--compress":
|
|
140
|
+
parsed.compress = true;
|
|
141
|
+
index += 1;
|
|
142
|
+
break;
|
|
143
|
+
case "--find":
|
|
144
|
+
parsed.find = [argv[index + 1]!, argv[index + 2]!];
|
|
145
|
+
index += 3;
|
|
146
|
+
break;
|
|
147
|
+
case "--tokens":
|
|
148
|
+
parsed.tokens = true;
|
|
149
|
+
index += 1;
|
|
150
|
+
break;
|
|
151
|
+
case "--files-static-check": {
|
|
152
|
+
const [values, next] = takeUntilOption(index + 1);
|
|
153
|
+
parsed.filesStaticCheck = values;
|
|
154
|
+
index = next;
|
|
155
|
+
break;
|
|
156
|
+
}
|
|
157
|
+
case "--static-check":
|
|
158
|
+
parsed.staticCheck = true;
|
|
159
|
+
index += 1;
|
|
160
|
+
break;
|
|
161
|
+
case "--git-check":
|
|
162
|
+
parsed.gitCheck = true;
|
|
163
|
+
index += 1;
|
|
164
|
+
break;
|
|
165
|
+
case "--docs-check":
|
|
166
|
+
parsed.docsCheck = true;
|
|
167
|
+
index += 1;
|
|
168
|
+
break;
|
|
169
|
+
case "--git-wt-name":
|
|
170
|
+
parsed.gitWtName = true;
|
|
171
|
+
index += 1;
|
|
172
|
+
break;
|
|
173
|
+
case "--git-wt-create":
|
|
174
|
+
parsed.gitWtCreate = argv[index + 1];
|
|
175
|
+
index += 2;
|
|
176
|
+
break;
|
|
177
|
+
case "--git-wt-delete":
|
|
178
|
+
parsed.gitWtDelete = argv[index + 1];
|
|
179
|
+
index += 2;
|
|
180
|
+
break;
|
|
181
|
+
case "--git-path":
|
|
182
|
+
parsed.gitPath = true;
|
|
183
|
+
index += 1;
|
|
184
|
+
break;
|
|
185
|
+
case "--get-base-path":
|
|
186
|
+
parsed.getBasePath = true;
|
|
187
|
+
index += 1;
|
|
188
|
+
break;
|
|
189
|
+
case "--test-static-check":
|
|
190
|
+
parsed.testStaticCheck = argv.slice(index + 1);
|
|
191
|
+
index = argv.length;
|
|
192
|
+
break;
|
|
193
|
+
default:
|
|
194
|
+
index += 1;
|
|
195
|
+
break;
|
|
196
|
+
}
|
|
197
|
+
}
|
|
198
|
+
return parsed;
|
|
199
|
+
}
|
|
200
|
+
|
|
201
|
+
/**
|
|
202
|
+
* @brief Writes text to stdout when non-empty.
|
|
203
|
+
* @details Avoids emitting zero-length writes so callers can compose result output safely. Runtime is O(n) in text length. Side effect: writes to `process.stdout`.
|
|
204
|
+
* @param[in] text {string} Text to emit.
|
|
205
|
+
* @return {void} No return value.
|
|
206
|
+
*/
|
|
207
|
+
function writeStdout(text: string): void {
|
|
208
|
+
if (text) process.stdout.write(text);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
/**
|
|
212
|
+
* @brief Writes text to stderr and ensures a trailing newline.
|
|
213
|
+
* @details Skips empty input, appends a newline when necessary, and emits the final text to `process.stderr`. Runtime is O(n) in text length. Side effect: writes to `process.stderr`.
|
|
214
|
+
* @param[in] text {string} Text to emit.
|
|
215
|
+
* @return {void} No return value.
|
|
216
|
+
*/
|
|
217
|
+
function writeStderr(text: string): void {
|
|
218
|
+
if (!text) return;
|
|
219
|
+
process.stderr.write(text.endsWith("\n") ? text : `${text}\n`);
|
|
220
|
+
}
|
|
221
|
+
|
|
222
|
+
/**
|
|
223
|
+
* @brief Emits a tool result object to process streams.
|
|
224
|
+
* @details Writes stdout first, then stderr, and returns the embedded exit code without modification. Runtime is O(n) in total emitted text size. Side effects are stdout/stderr writes.
|
|
225
|
+
* @param[in] result {{ stdout: string; stderr: string; code: number }} Command result payload.
|
|
226
|
+
* @return {number} Exit code to propagate from the invoked command.
|
|
227
|
+
*/
|
|
228
|
+
function writeResult(result: { stdout: string; stderr: string; code: number }): number {
|
|
229
|
+
writeStdout(result.stdout);
|
|
230
|
+
writeStderr(result.stderr);
|
|
231
|
+
return result.code;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @brief Loads mutable project config state without persisting runtime path metadata.
|
|
236
|
+
* @details Resolves the project base, loads existing config or defaults, normalizes persisted directory fields into project-relative form, and returns the in-memory pair used by CLI mutations. Runtime is dominated by config I/O. Side effects are limited to config reads.
|
|
237
|
+
* @param[in] projectBase {string} Candidate project root path.
|
|
238
|
+
* @return {{ base: string; config: UseReqConfig }} Validated project base and normalized in-memory config.
|
|
239
|
+
* @satisfies REQ-035, REQ-146
|
|
240
|
+
*/
|
|
241
|
+
function loadMutableProjectConfig(projectBase: string): { base: string; config: UseReqConfig } {
|
|
242
|
+
const base = resolveProjectBase(projectBase);
|
|
243
|
+
const config = normalizeConfigPaths(base, loadConfig(base));
|
|
244
|
+
return { base, config };
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
/**
|
|
248
|
+
* @brief Applies repeatable `--enable-static-check` specifications to project config.
|
|
249
|
+
* @details Parses each specification, validates command-backed entries before persistence, appends only non-duplicate identities in argument order, preserves existing entries, and writes the merged config once after all validations succeed. Runtime is O(s + e) plus PATH probing where s is spec count and e is existing entry count. Side effects include config writes.
|
|
250
|
+
* @param[in] projectBase {string} Candidate project root path.
|
|
251
|
+
* @param[in] specs {string[]} Raw `--enable-static-check` specifications in CLI order.
|
|
252
|
+
* @return {UseReqConfig} Persisted merged project configuration.
|
|
253
|
+
* @throws {ReqError} Throws when parsing or validation fails.
|
|
254
|
+
* @satisfies REQ-035, REQ-036, REQ-037
|
|
255
|
+
*/
|
|
256
|
+
function applyEnableStaticCheckSpecs(projectBase: string, specs: string[]): UseReqConfig {
|
|
257
|
+
const { base, config } = loadMutableProjectConfig(projectBase);
|
|
258
|
+
const seen = new Set<string>();
|
|
259
|
+
for (const [language, entries] of Object.entries(config["static-check"] ?? {})) {
|
|
260
|
+
for (const entry of entries) {
|
|
261
|
+
seen.add(buildStaticCheckEntryIdentity(language, entry));
|
|
262
|
+
}
|
|
263
|
+
}
|
|
264
|
+
config["static-check"] ??= {};
|
|
265
|
+
for (const spec of specs) {
|
|
266
|
+
const [language, entry] = parseEnableStaticCheck(spec);
|
|
267
|
+
validateStaticCheckEntry(entry);
|
|
268
|
+
const identity = buildStaticCheckEntryIdentity(language, entry);
|
|
269
|
+
if (seen.has(identity)) {
|
|
270
|
+
continue;
|
|
271
|
+
}
|
|
272
|
+
config["static-check"][language] ??= [];
|
|
273
|
+
config["static-check"][language]!.push(entry);
|
|
274
|
+
seen.add(identity);
|
|
275
|
+
}
|
|
276
|
+
saveConfig(base, config);
|
|
277
|
+
return config;
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
/**
|
|
281
|
+
* @brief Executes one pi-usereq CLI invocation.
|
|
282
|
+
* @details Parses arguments, enforces mutually exclusive project-selection rules, normalizes persisted config when needed, dispatches the first matching command handler, and converts thrown `ReqError` instances into stream output plus numeric exit codes. Runtime is O(n) in argument count plus delegated command cost. Side effects include config normalization writes and stdout/stderr output.
|
|
283
|
+
* @param[in] argv {string[]} Raw CLI arguments. Defaults to `process.argv.slice(2)`.
|
|
284
|
+
* @return {number} Process exit code for the invocation.
|
|
285
|
+
* @throws {ReqError} Internally catches `ReqError` and returns its code; other errors are coerced into exit code `1` with stderr output.
|
|
286
|
+
*/
|
|
287
|
+
export function main(argv = process.argv.slice(2)): number {
|
|
288
|
+
try {
|
|
289
|
+
if (argv.length === 0) {
|
|
290
|
+
return 0;
|
|
291
|
+
}
|
|
292
|
+
const args = parseArgs(argv);
|
|
293
|
+
const hereOnlyProjectCommand = !!(
|
|
294
|
+
args.references || args.compress || args.tokens || args.find || args.staticCheck ||
|
|
295
|
+
args.gitCheck || args.docsCheck || args.gitWtName || args.gitWtCreate || args.gitWtDelete ||
|
|
296
|
+
args.gitPath || args.getBasePath
|
|
297
|
+
);
|
|
298
|
+
if (hereOnlyProjectCommand) {
|
|
299
|
+
if (args.base) {
|
|
300
|
+
throw new ReqError(
|
|
301
|
+
"Error: --references, --compress, --tokens, --find, --static-check, --git-check, --docs-check, --git-wt-name, --git-wt-create, and --git-wt-delete, --git-path, and --get-base-path do not allow --base; use --here.",
|
|
302
|
+
1,
|
|
303
|
+
);
|
|
304
|
+
}
|
|
305
|
+
args.here = true;
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
const projectBase = args.base ? args.base : process.cwd();
|
|
309
|
+
let config: UseReqConfig;
|
|
310
|
+
if (args.enableStaticCheck && args.enableStaticCheck.length > 0) {
|
|
311
|
+
config = applyEnableStaticCheckSpecs(projectBase, args.enableStaticCheck);
|
|
312
|
+
} else {
|
|
313
|
+
if (args.here || args.base) {
|
|
314
|
+
loadAndRepairConfig(projectBase);
|
|
315
|
+
}
|
|
316
|
+
const resolvedBase = resolveProjectBase(projectBase);
|
|
317
|
+
config = normalizeConfigPaths(resolvedBase, loadConfig(resolvedBase));
|
|
318
|
+
}
|
|
319
|
+
|
|
320
|
+
if (args.filesTokens) return writeResult(runFilesTokens(args.filesTokens));
|
|
321
|
+
if (args.filesReferences) return writeResult(runFilesReferences(args.filesReferences, process.cwd(), args.verbose));
|
|
322
|
+
if (args.filesCompress) return writeResult(runFilesCompress(args.filesCompress, process.cwd(), args.enableLineNumbers, args.verbose));
|
|
323
|
+
if (args.filesFind) return writeResult(runFilesFind(args.filesFind, args.enableLineNumbers, args.verbose));
|
|
324
|
+
if (args.testStaticCheck) return runStaticCheck(args.testStaticCheck);
|
|
325
|
+
if (args.filesStaticCheck) return writeResult(runFilesStaticCheck(args.filesStaticCheck, projectBase, config));
|
|
326
|
+
if (args.references) return writeResult(runReferences(projectBase, config, args.verbose));
|
|
327
|
+
if (args.compress) return writeResult(runCompress(projectBase, config, args.enableLineNumbers, args.verbose));
|
|
328
|
+
if (args.find) return writeResult(runFind(projectBase, args.find[0], args.find[1], config, args.enableLineNumbers, args.verbose));
|
|
329
|
+
if (args.tokens) return writeResult(runTokens(projectBase, config));
|
|
330
|
+
if (args.staticCheck) return writeResult(runProjectStaticCheck(projectBase, config));
|
|
331
|
+
if (args.gitCheck) return writeResult(runGitCheck(projectBase, config));
|
|
332
|
+
if (args.docsCheck) return writeResult(runDocsCheck(projectBase, config));
|
|
333
|
+
if (args.gitWtName) return writeResult(runGitWtName(projectBase, config));
|
|
334
|
+
if (args.gitWtCreate) return writeResult(runGitWtCreate(projectBase, args.gitWtCreate, config));
|
|
335
|
+
if (args.gitWtDelete) return writeResult(runGitWtDelete(projectBase, args.gitWtDelete, config));
|
|
336
|
+
if (args.gitPath) return writeResult(runGitPath(projectBase, config));
|
|
337
|
+
if (args.getBasePath) return writeResult(runGetBasePath(projectBase, config));
|
|
338
|
+
return 0;
|
|
339
|
+
} catch (error) {
|
|
340
|
+
const err = error as ReqError & { stdout?: string; stderr?: string };
|
|
341
|
+
writeStdout(err.stdout ?? "");
|
|
342
|
+
writeStderr(err.stderr ?? err.message ?? String(error));
|
|
343
|
+
return err.code ?? 1;
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
|
|
347
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
348
|
+
process.exitCode = main();
|
|
349
|
+
}
|