Skip to content

fix(cli): make operate verify work in source checkouts#777

Open
inori-3333 wants to merge 2 commits intojackwener:mainfrom
inori-3333:main
Open

fix(cli): make operate verify work in source checkouts#777
inori-3333 wants to merge 2 commits intojackwener:mainfrom
inori-3333:main

Conversation

@inori-3333
Copy link
Copy Markdown
Contributor

Description

Fix opencli operate verify so it works correctly in source checkouts, including Windows.

This change:

  • replaces fragile file URL string handling with fileURLToPath(...)
  • stops hardcoding node dist/main.js when the project has not been built yet
  • prefers dist/main.js when available, and falls back to tsx src/main.ts in source checkouts
  • adds regression tests covering built and source-checkout execution paths

Related issue:

  • N/A

Type of Change

  • 🐛 Bug fix
  • ✨ New feature
  • 🌐 New site adapter
  • 📝 Documentation
  • ♻️ Refactor
  • 🔧 CI / build / tooling

Checklist

  • I ran the checks relevant to this PR
  • I updated tests or docs if needed
  • I included output or screenshots when useful

Documentation (if adding/modifying an adapter)

N/A — this PR does not add or modify an adapter.

  • Added doc page under docs/adapters/ (if new adapter)
  • Updated docs/adapters/index.md table (if new adapter)
  • Updated sidebar in docs/.vitepress/config.mts (if new adapter)
  • Updated README.md / README.zh-CN.md when command discoverability changed
  • Used positional args for the command's primary subject unless a named flag is clearly better
  • Normalized expected adapter failures to CliError subclasses instead of raw Error

Screenshots / Output

Checks run:

  • npx vitest run src/cli.test.ts
  • npm run typecheck
  • npm run build

Verification after this change:
1.npx vitest run src/cli.test.ts

 RUN  v4.1.1 E:/Inori_Code/Intrest/fromGit/opencli

 ✓  unit  src/cli.test.ts (8 tests) 35ms
   ✓ built-in browser commands verbose wiring (5)
     ✓ enables OPENCLI_VERBOSE for explore via the real CLI command 25ms
     ✓ enables OPENCLI_VERBOSE for generate via the real CLI command 2ms
     ✓ enables OPENCLI_VERBOSE for record via the real CLI command 2ms
     ✓ enables OPENCLI_VERBOSE for cascade via the real CLI command 2ms
     ✓ leaves OPENCLI_VERBOSE unset when verbose is omitted 1ms
   ✓ resolveOperateVerifyInvocation (3)
     ✓ prefers the built dist entry when available 1ms
     ✓ falls back to the local tsx binary in source checkouts on Windows 0ms
     ✓ falls back to npx tsx when local tsx is unavailable 0ms

 Test Files  1 passed (1)
      Tests  8 passed (8)
   Start at  22:31:36
   Duration  1.20s (transform 297ms, setup 0ms, import 975ms, tests 35ms, environment 0ms)

2.npm run typecheck

> @jackwener/opencli@1.6.1 typecheck
> tsc --noEmit

3.npm run build


> @jackwener/opencli@1.6.1 typecheck
> tsc --noEmit

PS E:\Inori_Code\Intrest\fromGit\opencli> npm run build

> @jackwener/opencli@1.6.1 build
> npm run clean-dist && tsc && npm run clean-yaml && npm run copy-yaml && npm run build-manifest


> @jackwener/opencli@1.6.1 clean-dist
> node scripts/clean-dist.cjs


> @jackwener/opencli@1.6.1 clean-yaml
> node scripts/clean-yaml.cjs


> @jackwener/opencli@1.6.1 copy-yaml
> node scripts/copy-yaml.cjs


> @jackwener/opencli@1.6.1 build-manifest
> node dist/build-manifest.js

✅ Manifest compiled: 479 entries (121 YAML, 358 TS) → E:\Inori_Code\Intrest\fromGit\opencli\dist\cli-manifest.json

@inori-3333 inori-3333 changed the title Fix opencli operate verify so it works correctly in source checkouts, including Windows. fix(cli): make operate verify work in source checkouts Apr 4, 2026
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.

1 participant