Skip to content

Conversation

@infiton
Copy link
Contributor

@infiton infiton commented Nov 4, 2025

This PR adds the ggt debugger and goes with the monorepo PR https://github.com/gadget-inc/gadget/pull/18121

the idea is that the user will add a an item to their vscode launch config (and ggt debugger --configure vscode will accelerate that); that config will set up a task that runs ggt debugger as a background process

ggt debugger sets up a websocket server running on localhost:9229 which is that place that node debuggers are looking for CDP; it will also set up a remote debugging session for that environment and then proxy the debugger protocol messages through that session to the current sandbox process (that means DAP messages are doing 4 proxy hops though DAP <-> ggt debugger <-> api <-> reloader-proxy <-> sandbox; yikes)

cc @airhorns for vibes

@changeset-bot
Copy link

changeset-bot bot commented Nov 4, 2025

🦋 Changeset detected

Latest commit: 6019a7d

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
ggt Minor

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

@infiton infiton force-pushed the ggt-debug branch 28 times, most recently from bb9c5f5 to 80b5169 Compare November 5, 2025 14:53
@infiton infiton requested a review from alanko0511 November 5, 2025 15:03
@infiton infiton requested a review from scott-rc November 5, 2025 15:03
uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nock in node 18 was doing something really funky with websockets and the tests would just hang

node18 is out of LTS so I think its ok to put 20 as out min version

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 I was already planning on upgrading to Node.js 20 here: #1990

Mind if I merge that PR first and you rebase this one?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mind if I merge that PR first and you rebase this one?

yah go for it

You can now start debugging by running the "Gadget debugger" launch configuration.
`,
});
return;
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nit: what do you think of asking the user if they want to continue and start the debugger (or even just auto-run it)?

${configurator.launchJsonPath}
${configurator.tasksJsonPath}
You can now start debugging by running the "Gadget debugger" launch configuration.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

by running the "Gadget debugger" launch configuration in where? in the IDE?

Copy link
Collaborator

@scott-rc scott-rc left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wow 🤩

uses: actions/setup-node@v4
with:
node-version: 18
node-version: 20
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

😄 I was already planning on upgrading to Node.js 20 here: #1990

Mind if I merge that PR first and you rebase this one?

};

export const run: Run<DebuggerArgs> = async (ctx, args) => {
const directory = await loadSyncJsonDirectory(args._[0] || process.cwd());
Copy link
Collaborator

@scott-rc scott-rc Nov 6, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How do you feel about removing the [DIRECTORY] argument and forcing users to run ggt debugger inside a directory that's already been initialized with ggt dev.

We did this for ggt add, ggt open, and ggt status:

That way ggt debugger isn't responsible for initializing directories and removes a lot of edge cases. We can add the ability to initialize a directory later if needed.

@scott-rc
Copy link
Collaborator

scott-rc commented Nov 6, 2025

Also, don't forget to include a changeset!

  1. Create a markdown file inside of .changeset/ (e.g. .changeset/add-debugger.md)
  2. Write the semver change this PR is making be at the top of the file. (minor since this is adding new functionality)
  3. Describe the change. The first line is usually a statement of what's been changed/added then the rest of the lines describe why.

Here's an example for this PR:

---
ggt: minor
---

Add `ggt debugger` command.

... describe the `ggt debugger` command and how to use it ...

Here's an example of a previous changeset:

CleanShot 2025-11-05 at 20 09 24@2x CleanShot 2025-11-05 at 20 09 44@2x

@infiton infiton merged commit d3de39f into main Nov 6, 2025
12 checks passed
@infiton infiton deleted the ggt-debug branch November 6, 2025 19:33
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.

4 participants