|
| 1 | +# Contributing to Devlog Tools |
| 2 | + |
| 3 | +This is a monorepo containing development logging tools and utilities. This document explains the project structure and development workflow. |
| 4 | + |
| 5 | +## Project Structure |
| 6 | + |
| 7 | +``` |
| 8 | +/ |
| 9 | +├── package.json # Root workspace configuration |
| 10 | +├── packages/ |
| 11 | +│ ├── mcp-server/ # MCP server for development logging |
| 12 | +│ │ ├── package.json # Package-specific dependencies and scripts |
| 13 | +│ │ ├── src/ # Source code |
| 14 | +│ │ └── build/ # Compiled output |
| 15 | +│ └── [future packages]/ # Space for additional packages |
| 16 | +├── .vscode/ # VS Code workspace configuration |
| 17 | +└── README.md # Main documentation |
| 18 | +``` |
| 19 | + |
| 20 | +## Development Workflow |
| 21 | + |
| 22 | +### Initial Setup |
| 23 | + |
| 24 | +```bash |
| 25 | +# Install all dependencies for all packages |
| 26 | +pnpm install |
| 27 | + |
| 28 | +# Build all packages |
| 29 | +pnpm build |
| 30 | +``` |
| 31 | + |
| 32 | +### Working with Packages |
| 33 | + |
| 34 | +```bash |
| 35 | +# Build all packages |
| 36 | +pnpm build |
| 37 | + |
| 38 | +# Build only the MCP server |
| 39 | +pnpm build:mcp |
| 40 | + |
| 41 | +# Build only the types package |
| 42 | +pnpm build:types |
| 43 | + |
| 44 | +# Start the MCP server |
| 45 | +pnpm start |
| 46 | + |
| 47 | +# Run the MCP server in development mode |
| 48 | +pnpm dev |
| 49 | + |
| 50 | +# Run tests for all packages |
| 51 | +pnpm test |
| 52 | + |
| 53 | +# Clean build artifacts from all packages |
| 54 | +pnpm clean |
| 55 | +``` |
| 56 | + |
| 57 | +### Working with Individual Packages |
| 58 | + |
| 59 | +You can also work directly with individual packages using pnpm filters: |
| 60 | + |
| 61 | +```bash |
| 62 | +# Work on the MCP server package |
| 63 | +pnpm --filter @devlog/mcp-server build |
| 64 | +pnpm --filter @devlog/mcp-server dev |
| 65 | + |
| 66 | +# Work on the types package |
| 67 | +pnpm --filter @devlog/types build |
| 68 | +pnpm --filter @devlog/types dev |
| 69 | + |
| 70 | +# Install dependencies for a specific package |
| 71 | +pnpm --filter @devlog/mcp-server add some-dependency |
| 72 | +``` |
| 73 | + |
| 74 | +## Adding New Packages |
| 75 | + |
| 76 | +When adding a new package to the monorepo: |
| 77 | + |
| 78 | +1. Create a new directory in `packages/` |
| 79 | +2. Add a `package.json` with a scoped name (e.g., `@devlog/package-name`) |
| 80 | +3. Add TypeScript configuration with `"composite": true` |
| 81 | +4. Update the root `tsconfig.json` to include the new package reference |
| 82 | +5. Update this document |
| 83 | + |
| 84 | +## Architecture Decisions |
| 85 | + |
| 86 | +### Monorepo Benefits |
| 87 | + |
| 88 | +- **Shared tooling**: Common TypeScript, linting, and build configurations |
| 89 | +- **Code sharing**: Easy to share types and utilities between packages |
| 90 | +- **Atomic changes**: Changes across multiple packages can be made in single commits |
| 91 | +- **Simplified dependency management**: Unified dependency resolution |
| 92 | + |
| 93 | +### Package Structure |
| 94 | + |
| 95 | +- `@devlog/mcp-server`: The main MCP server implementation |
| 96 | +- Future packages might include: |
| 97 | + - `@devlog/cli`: Command-line interface for devlog management |
| 98 | + - `@devlog/types`: Shared TypeScript types |
| 99 | + - `@devlog/web`: Web interface for browsing devlogs |
| 100 | + - `@devlog/utils`: Shared utilities |
| 101 | + |
| 102 | +## Build System |
| 103 | + |
| 104 | +The project uses pnpm workspaces with TypeScript project references for efficient builds: |
| 105 | + |
| 106 | +- `pnpm-workspace.yaml` defines the workspace structure |
| 107 | +- Root `tsconfig.json` references all packages |
| 108 | +- Each package has `"composite": true` for incremental builds |
| 109 | +- `pnpm` manages dependencies and scripts efficiently |
| 110 | + |
| 111 | +### pnpm Workspace Commands |
| 112 | + |
| 113 | +- `pnpm -r <command>` - Run command in all packages |
| 114 | +- `pnpm --filter <package> <command>` - Run command in specific package |
| 115 | +- `pnpm --filter <pattern> <command>` - Run command in packages matching pattern |
| 116 | + |
| 117 | +## Testing |
| 118 | + |
| 119 | +Each package should include its own tests. The root workspace provides commands to run tests across all packages. |
0 commit comments