Skip to content

Commit f95648e

Browse files
committed
feat: integrate mycoder-docs repository into monorepo
- Added documentation site as packages/docs - Updated GitHub Action to deploy on docs-release branch - Removed eslint configuration from docs package - Created docs-release branch for deployment - Updated README to include docs package Closes #253
1 parent 1bffa4d commit f95648e

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

56 files changed

+16825
-3356
lines changed

.github/workflows/deploy-docs.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: Deploy Documentation to Cloud Run
2+
3+
on:
4+
push:
5+
branches:
6+
- docs-release
7+
workflow_dispatch:
8+
9+
env:
10+
REGION: us-central1
11+
GAR_HOSTNAME: us-central1-docker.pkg.dev
12+
PROJECT_ID: drivecore-primary
13+
SERVICE_NAME: mycoder-docs
14+
15+
jobs:
16+
deploy:
17+
name: Deploy to Cloud Run
18+
runs-on: ubuntu-latest
19+
permissions:
20+
contents: read
21+
id-token: write
22+
23+
steps:
24+
- name: Checkout code
25+
uses: actions/checkout@v4
26+
27+
- name: Google Auth
28+
id: auth
29+
uses: google-github-actions/auth@v2
30+
with:
31+
credentials_json: ${{ secrets.GCP_SA_KEY }}
32+
33+
- name: Set up Cloud SDK
34+
uses: google-github-actions/setup-gcloud@v2
35+
36+
- name: Configure Docker for GCP
37+
run: |
38+
gcloud auth configure-docker $GAR_HOSTNAME --quiet
39+
40+
- name: Set image path
41+
run: echo "IMAGE_PATH=$GAR_HOSTNAME/$PROJECT_ID/shared-docker-registry/$SERVICE_NAME:${{ github.sha }}" >> $GITHUB_ENV
42+
43+
- name: Build and push Docker container
44+
run: |
45+
cd packages/docs
46+
docker build -t ${{ env.IMAGE_PATH }} .
47+
docker push ${{ env.IMAGE_PATH }}
48+
49+
- name: Deploy to Cloud Run
50+
id: deploy
51+
uses: google-github-actions/deploy-cloudrun@v2
52+
with:
53+
service: ${{ env.SERVICE_NAME }}
54+
region: ${{ env.REGION }}
55+
image: ${{ env.IMAGE_PATH }}
56+
flags: '--allow-unauthenticated'
57+
58+
- name: Show Output
59+
run: echo ${{ steps.deploy.outputs.url }}

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -103,6 +103,7 @@ Examples:
103103

104104
- [mycoder](packages/cli) - Command-line interface for MyCoder
105105
- [mycoder-agent](packages/agent) - Agent module for MyCoder
106+
- [mycoder-docs](packages/docs) - Documentation website for MyCoder
106107

107108
## Development
108109

packages/docs/.dockerignore

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
# Dependencies
2+
node_modules
3+
.pnp
4+
.pnp.js
5+
6+
# Build outputs
7+
build
8+
.docusaurus
9+
dist
10+
coverage
11+
12+
# Git and GitHub
13+
.git
14+
.github
15+
16+
# Misc
17+
.DS_Store
18+
.env.local
19+
.env.development.local
20+
.env.test.local
21+
.env.production.local
22+
23+
# Logs
24+
npm-debug.log*
25+
yarn-debug.log*
26+
yarn-error.log*
27+
pnpm-debug.log*
28+
29+
# Docker
30+
Dockerfile
31+
.dockerignore
32+
33+
# Editor directories and files
34+
.idea
35+
.vscode
36+
*.suo
37+
*.ntvs*
38+
*.njsproj
39+
*.sln
40+
*.sw?

packages/docs/Dockerfile

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
FROM node:20-alpine
2+
3+
WORKDIR /app
4+
5+
# Install pnpm
6+
RUN npm install -g pnpm
7+
8+
# Copy package.json and lock files
9+
COPY package.json pnpm-lock.yaml ./
10+
11+
# Install dependencies
12+
RUN pnpm install --frozen-lockfile
13+
14+
# Copy the rest of the application
15+
COPY . .
16+
17+
# Build the Docusaurus site
18+
ENV NODE_ENV=production
19+
RUN pnpm build
20+
21+
# Expose the port the app will run on
22+
ENV PORT=8080
23+
EXPOSE ${PORT}
24+
25+
# Command to run the application
26+
CMD ["pnpm", "serve", "--port", "8080", "--no-open"]

packages/docs/README.md

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# MyCoder Documentation
2+
3+
This package contains the official documentation for MyCoder, an AI-powered coding assistant. The documentation is built using [Docusaurus](https://docusaurus.io/), a modern static website generator.
4+
5+
## What's Inside
6+
7+
- **Product Documentation**: Comprehensive guides on how to use MyCoder
8+
- **Getting Started**: Platform-specific setup instructions for Windows, macOS, and Linux
9+
- **Usage Guides**: Detailed information on features and capabilities
10+
- **Blog**: Updates, tutorials, and insights about MyCoder
11+
12+
## Development
13+
14+
### Prerequisites
15+
16+
- Node.js version 18.0 or above
17+
- pnpm (recommended)
18+
19+
### Local Development
20+
21+
```bash
22+
# Navigate to the docs package
23+
cd packages/docs
24+
25+
# Start the development server
26+
pnpm start
27+
```
28+
29+
This command starts a local development server and opens up a browser window. Most changes are reflected live without having to restart the server.
30+
31+
### Build
32+
33+
```bash
34+
# Generate static content
35+
pnpm build
36+
```
37+
38+
This command generates static content into the `build` directory and can be served using any static contents hosting service.
39+
40+
### Deployment
41+
42+
The documentation site is automatically deployed when changes are pushed to the `docs-release` branch.
43+
44+
## Contributing
45+
46+
We welcome contributions to improve the documentation:
47+
48+
1. Create a feature branch (`git checkout -b feature/amazing-improvement`)
49+
2. Make your changes
50+
3. Commit your changes (`git commit -m 'Add some amazing improvement'`)
51+
4. Push to the branch (`git push origin feature/amazing-improvement`)
52+
5. Open a Pull Request
53+
54+
## License
55+
56+
This project is licensed under the MIT License - see the LICENSE file for details.
57+
58+
## Contact
59+
60+
If you have questions or feedback, please join our [Discord community](https://discord.gg/5K6TYrHGHt).
Lines changed: 174 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,174 @@
1+
---
2+
title: Best Practices for Efficient Agentic Coding
3+
shortTitle: Agentic Coding Best Practices
4+
date: 2025-03-06
5+
authors: [ben]
6+
tags: [ai, coding]
7+
---
8+
9+
As AI coding assistants become more capable, developers are discovering new workflows that maximize their effectiveness. This post outlines best practices for organizing your codebase to work efficiently with AI agents like MyCoder.
10+
11+
<!-- truncate -->
12+
13+
As AI-based coding agents like [mycoder.ai](https://mycoder.ai) become increasingly capable, adopting structured, clear, and AI-friendly coding practices will enhance efficiency for both humans and AI agents. Here are ten best practices for efficient agentic coding:
14+
15+
## 1. Documentation as Code
16+
17+
Keep comprehensive documentation directly in your codebase:
18+
19+
- Place detailed `README.md` files at the root and within individual packages.
20+
- Include a clear `CONTRIBUTING.md` outlining coding conventions and workflows.
21+
- Add inline documentation for complex logic or non-obvious code.
22+
23+
**Example README.md:**
24+
25+
```markdown
26+
# Frontend Package
27+
28+
This package contains the React frontend application.
29+
30+
## Directory Structure
31+
32+
- `src/components`: Reusable UI components
33+
- `src/pages`: Page components corresponding to routes
34+
- `src/hooks`: Custom React hooks
35+
- `src/utils`: Utility functions
36+
37+
## Development Workflow
38+
39+
1. Run `npm run dev` to start the development server
40+
2. Follow the component pattern in `src/components/Button.tsx` for new components
41+
3. All new components must have corresponding test files
42+
43+
## Testing
44+
45+
We use Jest and React Testing Library. Run tests with `npm test`.
46+
```
47+
48+
## 2. Minimize Package Explosion
49+
50+
Use fewer packages with clear boundaries. Only create separate packages for code shared across multiple applications.
51+
52+
**Preferred Structure:**
53+
54+
```
55+
my-project/
56+
packages/
57+
frontend/
58+
backend/
59+
shared/
60+
```
61+
62+
## 3. Simplify Project Structure
63+
64+
Favor flatter directory structures with semantically meaningful names to avoid deep nesting.
65+
66+
**Preferred Structure:**
67+
68+
```
69+
src/
70+
auth/
71+
LoginForm.tsx
72+
SignupForm.tsx
73+
useAuth.ts
74+
validation.ts
75+
auth.types.ts
76+
```
77+
78+
## 4. Avoid Re-exports and Indirection
79+
80+
Limit the use of re-exported modules to reduce confusion. Import components directly:
81+
82+
**Recommended import:**
83+
84+
```typescript
85+
import { TextInput } from 'src/components/forms/inputs/TextInput';
86+
```
87+
88+
## 5. Prefer Compile-Time Validation Over Runtime Checks
89+
90+
Use strong typing and compile-time validation instead of relying heavily on runtime validation:
91+
92+
**Type-safe approach:**
93+
94+
```typescript
95+
import { createRoute, json } from 'some-router-lib';
96+
97+
export const userRoute = createRoute({
98+
path: '/users/:id',
99+
loader: async ({ params }) => json(await getUserDetails(params.id)),
100+
action: async ({ request }) =>
101+
json(await updateUser(await request.formData())),
102+
meta: () => ({ title: 'User Details' }),
103+
});
104+
```
105+
106+
## 6. Consolidate Linting and Formatting at Root Level
107+
108+
Centralize linting and formatting configurations at the monorepo root to ensure consistency.
109+
110+
**Example root-level package.json scripts:**
111+
112+
```json
113+
"scripts": {
114+
"lint": "eslint . --fix",
115+
"format": "prettier . --write"
116+
}
117+
```
118+
119+
## 7. Avoid Overly Interdependent Configuration Systems
120+
121+
Favor self-contained, independent configuration files per package rather than complex inheritance:
122+
123+
```
124+
root/
125+
packages/
126+
frontend/
127+
tsconfig.json
128+
backend/
129+
tsconfig.json
130+
shared/
131+
tsconfig.json
132+
```
133+
134+
## 8. Type-Driven Development
135+
136+
Use comprehensive, precise types to enforce correctness at compile-time rather than relying on runtime validation.
137+
138+
Example:
139+
140+
```typescript
141+
type User = {
142+
id: string;
143+
name: string;
144+
role: 'admin' | 'user' | 'guest';
145+
};
146+
```
147+
148+
## 9. Consistent, Predictable File Organization
149+
150+
Maintain consistent file structures for components:
151+
152+
```
153+
components/
154+
Button/
155+
Button.tsx
156+
Button.test.tsx
157+
Button.module.css
158+
index.ts
159+
```
160+
161+
## 10. Test-Case Driven Documentation
162+
163+
Write clear, self-explanatory tests that also serve as documentation:
164+
165+
```typescript
166+
test('calculateDiscount applies discounts correctly', () => {
167+
const cart = [{ price: 100, eligible: true }];
168+
expect(calculateDiscount(cart)).toEqual([{ price: 90, eligible: true }]);
169+
});
170+
```
171+
172+
By adopting these agentic coding practices, your codebase will be optimized for clarity, maintainability, and efficient collaboration with AI coding agents.
173+
174+
_(This article is a summary of the personal blog post "[Stop Writing Code for Humans - The Future Belongs to AI Agents](https://benhouston3d.com/blog/agentic-coding-best-practices)" by Ben Houston.)_

packages/docs/blog/authors.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
ben:
2+
name: Ben Houston
3+
title: Founder of DriveCore
4+
url: https://github.com/bhouston
5+
image_url: https://github.com/bhouston.png
6+
socials:
7+
github: bhouston
8+
x: BenHouston3D # Updated from twitter
9+
bluesky: benhouston3d.com
10+
mastodon: 'BenHouston3D@mastodon.gamedev.place'
11+
12+
mycoder_team:
13+
name: MyCoder Team
14+
title: MyCoder Development Team
15+
url: https://github.com/drivecore
16+
image_url: https://github.com/drivecore.png
17+
socials:
18+
github: drivecore
19+
x: BenHouston3D

0 commit comments

Comments
 (0)