Skip to content

fix(js): accept positional CLI URL arguments#69

Merged
konard merged 3 commits intomainfrom
issue-68-f537a341d162
Apr 16, 2026
Merged

fix(js): accept positional CLI URL arguments#69
konard merged 3 commits intomainfrom
issue-68-f537a341d162

Conversation

@konard
Copy link
Copy Markdown
Collaborator

@konard konard commented Apr 15, 2026

Summary

Fixes #68.

The JavaScript CLI now accepts capture URLs as positional arguments while keeping yargs strict option validation enabled.

Root Cause

js/bin/web-capture.js enabled .strict() without declaring the URL positional argument. yargs rejected web-capture https://example.com as an unknown argument before main() could run. The code also looked for config._[0], but lino-arguments drops yargs' _ array from the returned config object, so separator-based inputs like -- https://example.com could not be recovered there either.

Changes

  • Declared the default yargs command as $0 [url] so strict mode accepts the URL positional.
  • Read the parsed config.url field and added a narrow fallback for URLs passed after the -- separator.
  • Marked --output / -o with nargs: 1 so documented stdout output forms like --output - keep working under strict mode.
  • Added CLI regression tests for positional URLs, -- separator URLs, unknown-option rejection, and immediate invalid-URL validation.
  • Added a patch changeset for the JS package.

Reproduction and Regression Coverage

Before this fix, the new CLI tests failed for both:

web-capture http://127.0.0.1:<port>/article --format markdown --output -
web-capture --format markdown --output - -- http://127.0.0.1:<port>/article

After the fix, both forms capture content successfully, and strict mode still rejects unknown options.

Verification

  • npm test -- tests/unit/cli.test.js passes.
  • npm test -- tests/unit passes: 207 tests.
  • npm test -- --testPathIgnorePatterns="docker.test.js" passes: 245 tests, 16 skipped live Habr tests.
  • npm run lint passes with existing warnings only.
  • npm run format:check passes.
  • npm run check:duplication passes.
  • node scripts/validate-changeset.mjs passes.
  • Manual smoke test for --capture api --archive zip -- URL produced a non-empty ZIP.

Docker-specific tests were not run locally because Docker is not installed in this environment.

Adding .gitkeep for PR creation (default mode).
This file will be removed when the task is complete.

Issue: #68
@konard konard self-assigned this Apr 15, 2026
@konard konard changed the title [WIP] JS CLI: yargs .strict() rejects positional URL argument 'JS CLI: yargs .strict() rejects positional URL argument' Apr 15, 2026
@konard konard marked this pull request as ready for review April 15, 2026 16:32
@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 15, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: gpt-5.3-codex
  • Provider: OpenAI
  • Public pricing estimate: unknown
  • Token usage: 11,722 input, 71 output, 2,560 cache read, 0 cache write

📊 Context and tokens usage:

Total: (11.7K + 2.6K cached) input tokens, 71 output tokens

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.3-codex
  • Model: GPT-5.3 Codex (gpt-5.3-codex)

📎 Log file uploaded as Gist (363KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 15, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 16, 2026

🤖 AI Work Session Started

Starting automated work session at 2026-04-16T06:33:50.534Z

The PR has been converted to draft mode while work is in progress.

This comment marks the beginning of an AI work session. Please wait for the session to finish, and provide your feedback.

@konard konard changed the title 'JS CLI: yargs .strict() rejects positional URL argument' fix(js): accept positional CLI URL arguments Apr 16, 2026
@konard konard marked this pull request as ready for review April 16, 2026 06:43
@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 16, 2026

🤖 Solution Draft Log

This log file contains the complete execution trace of the AI solution draft process.

💰 Cost estimation:

  • Model: gpt-5.4
  • Provider: OpenAI
  • Public pricing estimate: unknown
  • Token usage: 120,830 input, 25,453 output, 7,159,936 cache read, 0 cache write

📊 Context and tokens usage:

Total: (120.8K + 7.2M cached) input tokens, 25.5K output tokens

🤖 Models used:

  • Tool: OpenAI Codex
  • Requested: gpt-5.4
  • Model: GPT-5.4 (gpt-5.4)

📎 Log file uploaded as Repository (30663KB)


Now working session is ended, feel free to review and add any feedback on the solution draft.

@konard
Copy link
Copy Markdown
Collaborator Author

konard commented Apr 16, 2026

✅ Ready to merge

This pull request is now ready to be merged:

  • All CI checks have passed
  • No merge conflicts
  • No pending changes

Monitored by hive-mind with --auto-restart-until-mergeable flag

@konard konard merged commit f941655 into main Apr 16, 2026
16 checks passed
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.

JS CLI: yargs .strict() rejects positional URL argument

1 participant