Skip to content

Conversation

@mfbx9da4
Copy link
Contributor

@mfbx9da4 mfbx9da4 commented Nov 3, 2025

Adds a hidden debug command to find generated files that exist on disk but are not tracked in gen.lock files.

Changes

  • Added cmd/debug.go with the debug command group containing find-orphaned-files subcommand
  • Integrated the script from ~/scripts/find_orphaned_files.go into the CLI
  • Registered the debug command group in cmd/root.go

Command Usage

speakeasy debug find-orphaned-files [--dir <directory>] [--verbose] [--skip-md]

The command:

  • Recursively searches for gen.lock files
  • Parses generatedFiles entries from gen.lock
  • Scans directories for files containing 'speakeasy.com'
  • Reports files that exist but aren't in gen.lock

Flags

  • --dir, -d: directory to check for generated files (default: .)
  • --verbose, -v: show detailed output
  • --skip-md: skip markdown files (default: true)

The command is hidden and won't appear in normal help output.

Adds a hidden debug command to find generated files that exist on disk
but are not tracked in gen.lock files. This helps identify orphaned
generated files that should be cleaned up.

The command:
- Recursively searches for gen.lock files
- Parses generatedFiles entries from gen.lock
- Scans directories for files containing 'speakeasy.com'
- Reports files that exist but aren't in gen.lock
Replace manual YAML parsing with gopkg.in/yaml.v3 for better
maintainability and reliability. The function now unmarshals the
gen.lock file structure and extracts the generatedFiles field.

Tested with:
/Users/da/code/speakeasy-openapi-generation/zSDKs/snapshot-executor/dwolla-typescript/
- Verified identical output before/after refactoring
- Found 1418 files in gen.lock
- Identified same 3 orphaned files
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.

2 participants