Skip to content

feat(curl,task): add nuxt curl, nuxt task list and nuxt task run - #1417

Open
danielroe wants to merge 7 commits into
feat/dev-takeoverfrom
feat/task-curl
Open

feat(curl,task): add nuxt curl, nuxt task list and nuxt task run#1417
danielroe wants to merge 7 commits into
feat/dev-takeoverfrom
feat/task-curl

Conversation

@danielroe

@danielroe danielroe commented Jul 31, 2026

Copy link
Copy Markdown
Member

🔗 Linked issue

closes #353

📚 Description

this picks up on the lockfile support added in #1414 to add two more commands that use the lock file to find the running server:

Video preview

Screen.Recording.2026-07-31.at.23.00.53.mov

nuxt curl

sends requests to your dev server without needing to know the port

nuxt curl /api/hello
nuxt curl /api/users -X POST -d '{"name":"daniel"}'
nuxt curl /api/data -H "Authorization: Bearer token"

it auto-detects JSON bodies, pretty-prints JSON responses in a TTY, and exits 22 on HTTP errors (matching real curl's --fail).

nuxt task list and nuxt task run

these commands talk to Nitro's task runner

# shows descriptions and any scheduled crons
nuxt task list

# prints the task's result and exits non-zero with the server's error when the task fails
nuxt task run db:migrate --payload.force=true
nuxt task run db:migrate --payload '{"force":true}'

Important

--payload.key=value pairs are always strings, as they are when Nitro reads them from the query string, so the JSON form is an escape hatch.

Note

nuxt task works with nitropack 2 (nuxt 4) and Nitro 3 (nuxt 5)

behind the scenes, both commands resolve the server in this order:

source when
--url flag always wins
lock file (nuxt.lock) if a dev server is running
Nitro dev worker socket nuxt task only, when there is no lock†

† the worker fallback means nuxt task works even when the dev server was started by something other than nuxt dev (for example, programmatically from nuxt/kit).

@pkg-pr-new

pkg-pr-new Bot commented Jul 31, 2026

Copy link
Copy Markdown
  • nuxt-cli-playground

    npm i https://pkg.pr.new/create-nuxt@1417
    
    npm i https://pkg.pr.new/nuxi@1417
    
    npm i https://pkg.pr.new/@nuxt/cli@1417
    

commit: c2bcb18

@codspeed-hq

codspeed-hq Bot commented Jul 31, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 2 untouched benchmarks


Comparing feat/task-curl (c2bcb18) with feat/dev-takeover (06d47a7)

Open in CodSpeed

@danielroe
danielroe requested review from atinux and pi0 July 31, 2026 16:27
@danielroe
danielroe force-pushed the feat/task-curl branch 2 times, most recently from 16813ee to 7c46daf Compare July 31, 2026 21:43
@TheAlexLichter

TheAlexLichter commented Jul 31, 2026

Copy link
Copy Markdown
Member

Somewhat (un)related note as I saw nuxt.lock: Vite might get a lockfile themselves (vitejs/vite#23065 (comment))

@danielroe

Copy link
Copy Markdown
Member Author

nice! it makes sense.

I am assuming vite wouldn't write a lockfile if it's being used programmatically by something like nuxt

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.

Integrate with Nitro Tasks

2 participants