Skip to content

DX: test the local-path vs --dir CLI error #9

Description

@cucuwang

Why

resolveTarget() in src/cli/index.ts throws when the argument looks like a local path without --dir:

"..." looks like a local path. Use --dir flag: npx aeoptimize scan <path> --dir

First-time npx users hit this. There is no test that the message stays stable.

Ask

Add a failing-then-passing test around resolveTarget (or the CLI entry) for:

  • ./dist or /tmp/site without --dir → error mentions --dir
  • https://example.com → treated as URL
  • example.com (bare domain) → treated as URL with https://

Do not change scoring. Keep the existing hint; only cover it with a test, unless the current wording is objectively wrong for one of those cases.

Pointers

  • src/cli/index.ts (resolveTarget)
  • existing CLI / core tests under src/

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions