Skip to content

perf(cli): defer scan imports for version output - #876

Open
agentsope wants to merge 2 commits into
NVIDIA:mainfrom
agentsope:fix/865-cli-startup-imports
Open

agentsope wants to merge 2 commits into
NVIDIA:mainfrom
agentsope:fix/865-cli-startup-imports

Conversation

@agentsope

Copy link
Copy Markdown
Contributor

Scope

Partial contribution to #865 — intentionally does not close the issue.

Only the installed console script (skillspector --version / -v) is optimized. Static --no-llm scans, help commands, and direct imports of skillspector.cli still load the existing implementation; provider/constant import restructuring remains out of scope.

Change

  • Add a lightweight Typer entry point that defers command loading until needed.
  • Share root options and reuse existing command definitions, preserving parsing, help, and typo suggestions rather than scanning argv manually.
  • Keep the existing skillspector.cli app and exports available.

Validation

  • 21 new regression cases: fresh-process import guards for both version aliases with three provider configurations, plus 15 parser/output parity cases. Also compared these cases against the unchanged main implementation locally.
  • Full offline suite: 14,277 passed, 14 skipped, 250 deselected, 4 expected failures; no live-provider tests run.
  • Repository lint and format checks pass. New entry module passes mypy; the existing CLI has the same 9 baseline diagnostics.
  • Built wheel and installed console-entry smoke checks pass.

Local Python 3.12/macOS, five alternating fresh-process runs: median version-query wall time 1.1068s → 0.1204s. This is a local measurement, not a timing assertion or a claim about static-scan speed.

Partially address NVIDIA#865 with a lightweight Typer entry point. Reuse the existing command definitions and root callback so eager version options finish without loading scanner or provider implementations. Keep static scanning on the existing workflow. Add subprocess import guards and CLI parsing parity coverage.

Signed-off-by: Whj9283 <1621370123@qq.com>
Copilot AI balanced review requested due to automatic review settings October 19, 2026 08:05

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agentsope

Copy link
Copy Markdown
Contributor Author

CI failed only on the six existing binary-structure timing assertions tracked in #861; the same six fail on main (baseline run). All 21 new entry-point tests passed (PR run). Keeping this PR scoped to version-query startup; #862 addresses the timing guard separately.

Signed-off-by: Whj9283 <1621370123@qq.com>
Copilot AI balanced review requested due to automatic review settings October 23, 2026 15:07

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copilot was unable to review this pull request because the user who requested the review has reached their quota limit.

@agentsope

Copy link
Copy Markdown
Contributor Author

Merged current main d7338f5 into this branch in signed commit 2e667a3, incorporating #862 without rewriting history. The PR remains limited to console version-query startup; no additional production behavior changes.

Validation on this head: 15,421 offline tests passed, 14 skipped, 250 deselected, 4 expected failures. All nine binary-structure cases also passed separately with coverage enabled. CLI selection (460 tests), repository lint/format, entry-module mypy, wheel build and six installed-wheel version/import guards passed; wheel guards reused locked development dependencies. No live-provider tests run. Hosted CI is pending.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants