Skip to content

Add code quality tooling and workspace configuration#5

Open
pxlvre wants to merge 1 commit intodabit3:mainfrom
pxlvre:feature/code-quality-tooling
Open

Add code quality tooling and workspace configuration#5
pxlvre wants to merge 1 commit intodabit3:mainfrom
pxlvre:feature/code-quality-tooling

Conversation

@pxlvre
Copy link
Copy Markdown

@pxlvre pxlvre commented Oct 25, 2025

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

  • Added root package.json with workspace configuration for all three packages
  • Consolidated dependency management and tooling at the repository level

Code Quality Tools

  • ESLint: Configured with TypeScript support and strict linting rules
  • Prettier: Set up for consistent code formatting across all files
  • TypeDoc: Added configuration for API documentation generation

Development Workflow

  • Commitizen: Implemented standardized conventional commit messages
  • Husky: Configured git hooks for automated code quality checks
  • lint-staged: Set up to run tools only on changed files during commits

TypeScript Configuration

  • Created shared root tsconfig.json with common compiler settings
  • Updated individual project configs to extend the root configuration
  • Maintains existing build processes while reducing duplication

Code Formatting

  • Applied Prettier formatting to all existing code for consistency
  • Updated repository URLs in package.json files to reference correct GitHub repository

Available Scripts

After merging, the following commands will be available at the root level:

  • npm run lint / npm run lint:fix - ESLint checking and fixing
  • npm run format / npm run format:check - Prettier formatting
  • npm run docs - Generate TypeDoc documentation
  • npm run commit - Interactive conventional commit tool
  • npm run type-check - TypeScript compilation check

Notes

  • All existing functionality and build processes are preserved
  • The strict ESLint configuration reveals existing code quality issues that can be addressed incrementally
  • Git hooks are configured but can be bypassed with --no-verify if needed during transition
  • This establishes the foundation for improved code quality without breaking existing workflows

Test Plan

  • Verify all three packages still build correctly
  • Test that existing development workflows continue to function
  • Confirm new tooling commands work as expected
  • Validate TypeScript compilation across all projects

Open with Devin

- 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.
Copy link
Copy Markdown

@devin-ai-integration devin-ai-integration bot left a comment

Choose a reason for hiding this comment

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

Devin Review found 3 potential issues.

View 5 additional findings in Devin Review.

Open in Devin Review

@@ -1,23 +1,9 @@
{
"extends": "../tsconfig.json",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 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.
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@@ -1,15 +1,7 @@
{
"extends": "../tsconfig.json",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 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:

  • outDir inherits as <repo-root>/dist/ — compiled output goes to the wrong directory
  • rootDir inherits as <repo-root>/ — output preserves the client-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/.

Suggested change
"extends": "../tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"module": "node16",
"moduleResolution": "node16",
"rootDir": ".",
"outDir": "./dist",
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

@@ -1,32 +1,17 @@
{
"extends": "../tsconfig.json",
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🔴 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.

Suggested change
"extends": "../tsconfig.json",
"extends": "../tsconfig.json",
"compilerOptions": {
"outDir": "dist",
"rootDir": ".",
Open in Devin Review

Was this helpful? React with 👍 or 👎 to provide feedback.

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.

1 participant