Add code quality tooling and workspace configuration#5
Add code quality tooling and workspace configuration#5pxlvre wants to merge 1 commit intodabit3:mainfrom
Conversation
- Add root package.json with workspace management for all three packages - Configure ESLint with TypeScript support and strict linting rules - Set up Prettier for consistent code formatting across the project - Add TypeDoc configuration for API documentation generation - Implement Commitizen for standardized conventional commit messages - Configure Husky git hooks for pre-commit linting and formatting - Add lint-staged to run tools only on changed files - Create shared root tsconfig.json with common TypeScript settings - Update individual tsconfig.json files to extend root configuration - Format all existing code with Prettier for consistency - Update repository URLs in package.json to point to correct GitHub repo This establishes a foundation for code quality, consistency, and maintainability across the entire project while preserving existing functionality and build processes.
| @@ -1,23 +1,9 @@ | |||
| { | |||
| "extends": "../tsconfig.json", | |||
There was a problem hiding this comment.
🔴 Inherited rootDir from root tsconfig resolves to repo root, breaking x402_a2a package build output structure
The x402_a2a/tsconfig.json now extends ../tsconfig.json which defines "rootDir": ".". Per TypeScript spec, relative paths in extended configs resolve relative to the config file they originate in — so rootDir resolves to the repo root, not x402_a2a/.
Root Cause and Impact
Previously, x402_a2a/tsconfig.json had its own "rootDir": "./" which resolved to x402_a2a/. The build configs (tsconfig.cjs.json, tsconfig.esm.json, tsconfig.types.json) extend ./tsconfig.json and override outDir but NOT rootDir.
With rootDir = repo root, TypeScript preserves the directory structure relative to rootDir in the output. So x402_a2a/index.ts would be compiled to x402_a2a/dist/cjs/x402_a2a/index.js instead of the expected x402_a2a/dist/cjs/index.js.
The package.json (x402_a2a/package.json:5) declares "main": "./dist/cjs/index.js" and exports map to ./dist/esm/index.js and ./dist/types/index.d.ts. These paths would all break because the actual files would be nested under an extra x402_a2a/ directory.
Impact: The a2a-x402 library build would produce files at the wrong paths, breaking all consumers that import from a2a-x402 — including both client-agent and merchant-agent.
Prompt for agents
In x402_a2a/tsconfig.json, add back the rootDir and outDir overrides that were removed during the refactor to extends. The file should look like:
{
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "commonjs",
"declaration": true,
"moduleResolution": "node",
"rootDir": "./",
"outDir": "./dist"
},
"include": ["**/*.ts"]
}
Similarly, in client-agent/tsconfig.json, add rootDir and outDir overrides:
"rootDir": ".",
"outDir": "./dist"
And in merchant-agent/tsconfig.json, add rootDir override:
"rootDir": "."
Alternatively, remove rootDir from the root tsconfig.json so child configs don't inherit a repo-root-relative rootDir.
Was this helpful? React with 👍 or 👎 to provide feedback.
| @@ -1,15 +1,7 @@ | |||
| { | |||
| "extends": "../tsconfig.json", | |||
There was a problem hiding this comment.
🔴 Inherited rootDir and outDir from root tsconfig changes client-agent build output location
The client-agent/tsconfig.json now extends ../tsconfig.json which defines "rootDir": "." and "outDir": "./dist". Both resolve to the repo root (not client-agent/), because TypeScript resolves relative paths in extended configs relative to the file they originate in.
Root Cause and Impact
Previously, client-agent/tsconfig.json had its own "outDir": "./dist" and "rootDir": "." which resolved to client-agent/dist/ and client-agent/ respectively.
Now:
outDirinherits as<repo-root>/dist/— compiled output goes to the wrong directoryrootDirinherits as<repo-root>/— output preserves theclient-agent/prefix in the directory structure
Impact: The client-agent build output goes to the wrong location, breaking any scripts or Docker configurations that expect compiled files in client-agent/dist/.
| "extends": "../tsconfig.json", | |
| "extends": "../tsconfig.json", | |
| "compilerOptions": { | |
| "module": "node16", | |
| "moduleResolution": "node16", | |
| "rootDir": ".", | |
| "outDir": "./dist", |
Was this helpful? React with 👍 or 👎 to provide feedback.
| @@ -1,32 +1,17 @@ | |||
| { | |||
| "extends": "../tsconfig.json", | |||
There was a problem hiding this comment.
🔴 Inherited rootDir from root tsconfig changes merchant-agent build output directory structure
The merchant-agent/tsconfig.json now extends ../tsconfig.json which defines "rootDir": ".". This resolves to the repo root, not merchant-agent/.
Root Cause and Impact
While merchant-agent/tsconfig.json correctly overrides outDir: "dist" (resolving to merchant-agent/dist/), it does NOT override rootDir, which inherits from the root tsconfig as <repo-root>/.
Previously, rootDir was "." relative to merchant-agent/ = merchant-agent/. Now it's the repo root. TypeScript preserves the directory structure relative to rootDir when outputting, so files like merchant-agent/agent.ts would be output as merchant-agent/dist/merchant-agent/agent.js instead of merchant-agent/dist/agent.js.
Impact: The merchant-agent build output has unexpected nested directory structure, breaking any runtime imports or Docker configurations.
| "extends": "../tsconfig.json", | |
| "extends": "../tsconfig.json", | |
| "compilerOptions": { | |
| "outDir": "dist", | |
| "rootDir": ".", |
Was this helpful? React with 👍 or 👎 to provide feedback.
Summary
This PR introduces code quality tooling and workspace management to improve development workflow, code consistency, and maintainability across the entire project.
Changes Made
Workspace Management
package.jsonwith workspace configuration for all three packagesCode Quality Tools
Development Workflow
TypeScript Configuration
tsconfig.jsonwith common compiler settingsCode Formatting
Available Scripts
After merging, the following commands will be available at the root level:
npm run lint/npm run lint:fix- ESLint checking and fixingnpm run format/npm run format:check- Prettier formattingnpm run docs- Generate TypeDoc documentationnpm run commit- Interactive conventional commit toolnpm run type-check- TypeScript compilation checkNotes
--no-verifyif needed during transitionTest Plan