Continue createCommand migration with ✨AI✨ #8966
Conversation
🦋 Changeset detectedLatest commit: 59c5886 The changes in this PR will be included in the next version bump. This PR includes changesets to release 2 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
createCommand migrationcreateCommand migration with ✨AI✨
|
Failed to automatically backport this PR's changes to Wrangler v3. Please manually create a PR targeting the Depending on your changes, running |
|
A Wrangler prerelease is available for testing. You can install this latest build in your project with: npm install --save-dev https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-wrangler-8966Prereleases for other packages:
wget https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-workers-bindings-extension-8966 -O ./cloudflare-workers-bindings-extension.0.0.0-v454b7082c.vsix && code --install-extension ./cloudflare-workers-bindings-extension.0.0.0-v454b7082c.vsix
npx https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-create-cloudflare-8966 --no-auto-update
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-kv-asset-handler-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-miniflare-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-pages-shared-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-unenv-preset-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-vite-plugin-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-vitest-pool-workers-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-workers-editor-shared-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-workers-shared-8966
npm install https://prerelease-registry.devprod.cloudflare.dev/workers-sdk/runs/14616902982/npm-package-cloudflare-workflows-shared-8966Note that these links will no longer work once the GitHub Actions artifact expires. |
|
👏 |
petebacondarwin
left a comment
There was a problem hiding this comment.
Nice work Claude! Since it is such a big mechanical PR, we should have just got an AI to review if for us 😜 .
Fun to backport this one...
There was a problem hiding this comment.
With createCommand, do we no longer get useful error messages saying what was wrong with the input?
There was a problem hiding this comment.
We do, but this (and a few other similar places), shouldn't have been errors. This is the output from running d1 migrations, which now just shows the help text. Previously it also showed an error because you hadn't specified a subcommand list/create/apply, which isn't how other commands work
There was a problem hiding this comment.
Is this test case no longer supported?
There was a problem hiding this comment.
This case was never hit, as far as I can tell, since the API never returned that error. I tested on an account without queues enabled, and this message wasn't displayed
There was a problem hiding this comment.
Do we still support the --depreacted-v1 flag?
There was a problem hiding this comment.
We do, but I've removed the vectorize GA banner that was printed at the end of all commands as an epilogue. Vectorize has been GA for a while, and no other GA commands follow this kind of pattern.
There was a problem hiding this comment.
Is this a shortcoming in the createCommand definition options, that we can't say this is an array of numbers?
There was a problem hiding this comment.
I think it's a bug in yargs, where if you pass array: true it's not reflected in the help text
packages/wrangler/src/d1/execute.ts
Outdated
There was a problem hiding this comment.
Feels like this should be the default for all commands?
There was a problem hiding this comment.
It should be. There was one command that used an argument called json for a different purpose, but we changed that in v4, so we should be able to make this printBanner option the default now. I can make that change in this PR?
There was a problem hiding this comment.
Actually, that seems like it should be done in a followup
packages/wrangler/src/d1/execute.ts
Outdated
There was a problem hiding this comment.
TODO (not in this PR): consolidate all the JSON logging aspects across the code base.
packages/wrangler/src/d1/export.ts
Outdated
There was a problem hiding this comment.
FUTURE: we should build this into the createCommand mechanism, so it doesn't need to be worked around in individual options/commands.
caca69f to
a0971d5
Compare
40cd2db to
59c5886
Compare
* wrangler init * wrangler delete * wrangler triggers * halfway through wrangler queues * complete queues migration * wrangler d1 * wrangler ai * hyperdrive & vectorize * pages * Fix AI code * Create thirty-apples-invite.md * more ai fixups * mtls-certificate * wrangler build * wrangler pipelines * wrangler dispatch-namespace * fix check * fix tests * cleanup * address comments * fix lint
This PR continues the
createCommandmigration for several new command families:Halway through the migration I realised that this would be the perfect test case for something like Claude Code (pretty simple refactoring), and so tested out Claude code for hyperdrive, vectorize, d1, ai, and pages. It did surprisingly well! It halway blew up when doing pages, because more of that change was novel, I guess?