This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.
bun install- Install dependenciesbun run src/index.ts- Run the CLI tool with no arguments to see help
bun run src/index.ts service-glide <repo-path>- Main command to clean up indirect imports in Glide monorepobun run src/index.ts fix-package-use <directory>- Remove unused packages from package.json (use-fflag to actually fix)bun run src/index.ts move-file-package <source-file> <target-directory>- Move files between packages with proper re-exportsbun run src/index.ts barrel-export <package-dir> <source-paths...>- Generate barrel exports for packagesbun run src/index.ts rewrite-imports <name> <from-path> <to-path> <source-paths...>- Change import paths for symbolsbun run src/index.ts dedup-imports <source-paths...>- Combine duplicate imports into single statementsbun run src/index.ts resolve-imports <packages-path> <source-paths...>- Resolve re-exported symbol importsbun run src/index.ts find-unused-exports <repo-path>- Find exported symbols that aren't imported
- Tests are in
src/*.test.tsfiles - Run with
bun testorbun run test(check package.json for exact command)
This is a TypeScript CLI utility designed specifically for managing imports and exports in the Glide monorepo. The tool automates complex refactoring tasks related to package dependencies and import paths.
- Glide Import Paths: Special handling for
@glide/prefixed imports with package names and subpaths - Tree-sitter Integration: Uses tree-sitter-typescript for robust TypeScript AST parsing
- Concurrent Processing: Built-in concurrency controls for processing large codebases
- Prettier Integration: Automatic code formatting after modifications
src/glide.ts- Core Glide-specific utilities and path parsingsrc/service-glide.ts- Main orchestration command that runs multiple cleanup operationssrc/parse-imports.ts- TypeScript import/export parsing using tree-sittersrc/concurrent.ts- Concurrency utilities for batch operationssrc/prettier.ts- Code formatting integration
The tool expects Glide repositories to have:
.topological-packagesfile listing package names in dependency orderpackages/directory containing individual packagesfunctions/srcandapp/srcdirectories as additional source locations- Each package has its own
package.jsonandsrc/directory
- Parse TypeScript files using tree-sitter for accurate AST manipulation
- Analyze import/export relationships across packages
- Perform transformations (resolve imports, remove re-exports, fix dependencies)
- Run deduplication and cleanup passes
- Format modified files with Prettier
The service-glide command orchestrates the full cleanup process: resolve imports → remove re-exports → deduplicate imports → fix package dependencies → format code.