git-agent for TypeScript

Atomic conventional commits for TypeScript codebases

git-agent splits TypeScript changes across types, implementation, and tests into separate atomic commits, generating precise conventional messages that reflect your type-safe refactors and feature additions.

diff --git a/src/services/auth.ts b/src/services/auth.ts index c2d4f1a..9e8b3c2 100644 --- a/src/services/auth.ts +++ b/src/services/auth.ts @@ -1,5 +1,6 @@ import { sign, verify } from "jsonwebtoken"; import { config } from "../config"; +import { TokenExpiredError } from "../errors"; -export function verifyToken(token: string): { userId: string } { - return verify(token, config.jwtSecret) as { userId: string }; +export interface TokenPayload { + userId: string; + iat: number; + exp: number; +} + +export function verifyToken(token: string): TokenPayload { + try { + return verify(token, config.jwtSecret) as TokenPayload; + } catch (err) { + if (err instanceof Error && err.name === "TokenExpiredError") { + throw new TokenExpiredError(token); + } + throw err; + } }
git-agent output
refactor(auth): strengthen verifyToken return type and error handling - export TokenPayload interface with iat/exp fields for downstream consumers - wrap jsonwebtoken errors so callers receive domain-specific TokenExpiredError - remove unsafe cast in favour of typed return signature Eliminates the implicit any in callers that previously destructured the return value without type guards; downstream middleware can now distinguish expired tokens from malformed ones.
  • Separates type definition changes from implementation changes into distinct commits
  • Recognizes tsconfig.json project structure for accurate scope inference
  • Works with NestJS, Express, and tRPC project layouts
  • Handles .d.ts declaration file changes independently
brew install gitagenthq/tap/git-agent # in your TypeScript repo git-agent init # reads tsconfig.json paths to suggest scopes
Will git-agent split my TypeScript and JavaScript files into separate commits?
git-agent groups changes by logical concern, not file extension. If a .ts file and a .js file are part of the same feature, they stay in one commit.
Does git-agent understand TypeScript decorators and metadata?
git-agent sends the raw diff to the LLM, which understands decorator syntax. NestJS controller diffs and Angular component changes are handled correctly.
Can I configure scopes to match my TypeScript path aliases?
Yes. Run git-agent init and it will read your tsconfig paths to suggest scopes. You can then edit .git-agent/project.yml to fine-tune them.