Skip to content

Commit 43ce799

Browse files
committed
first commit
0 parents  commit 43ce799

File tree

113 files changed

+30120
-0
lines changed

Some content is hidden

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

113 files changed

+30120
-0
lines changed

.eslintrc.js

Lines changed: 49 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
module.exports = {
2+
root: true,
3+
parser: '@typescript-eslint/parser',
4+
plugins: ['@typescript-eslint', 'jest', 'react-hooks'],
5+
extends: [
6+
'eslint:recommended',
7+
'plugin:@typescript-eslint/recommended',
8+
'plugin:jest/recommended',
9+
'plugin:react-hooks/recommended',
10+
'next/core-web-vitals',
11+
],
12+
env: {
13+
browser: true,
14+
es2021: true,
15+
node: true,
16+
jest: true,
17+
},
18+
rules: {
19+
'@typescript-eslint/explicit-function-return-type': 'off',
20+
'@typescript-eslint/explicit-module-boundary-types': 'off',
21+
'@typescript-eslint/no-explicit-any': 'warn',
22+
'@typescript-eslint/no-unused-vars': ['error', { argsIgnorePattern: '^_' }],
23+
'@typescript-eslint/no-non-null-assertion': 'warn',
24+
25+
'react-hooks/rules-of-hooks': 'error',
26+
'react-hooks/exhaustive-deps': 'warn',
27+
'react/prop-types': 'off',
28+
'react/react-in-jsx-scope': 'off',
29+
30+
'no-console': ['warn', { allow: ['warn', 'error'] }],
31+
'no-debugger': 'warn',
32+
'no-duplicate-imports': 'error',
33+
'no-unused-vars': 'off',
34+
},
35+
settings: {
36+
react: {
37+
version: 'detect',
38+
},
39+
},
40+
ignorePatterns: [
41+
'node_modules/',
42+
'.next/',
43+
'out/',
44+
'dist/',
45+
'build/',
46+
'*.config.js',
47+
'*.setup.js',
48+
],
49+
};

.github/workflows/ci.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: CI/CD
2+
3+
on:
4+
push:
5+
branches: [ main ]
6+
pull_request:
7+
branches: [ main ]
8+
9+
jobs:
10+
test:
11+
runs-on: ubuntu-latest
12+
13+
strategy:
14+
matrix:
15+
node-version: [18.x]
16+
17+
steps:
18+
- uses: actions/checkout@v3
19+
20+
- name: Use Node.js ${{ matrix.node-version }}
21+
uses: actions/setup-node@v3
22+
with:
23+
node-version: ${{ matrix.node-version }}
24+
cache: 'npm'
25+
26+
- name: Install dependencies
27+
run: npm ci
28+
29+
- name: Run linting
30+
run: npm run lint
31+
32+
- name: Run tests
33+
run: npm test
34+
env:
35+
CI: true
36+
37+
deploy:
38+
needs: test
39+
runs-on: ubuntu-latest
40+
if: github.ref == 'refs/heads/main'
41+
42+
steps:
43+
- uses: actions/checkout@v3
44+
45+
- name: Use Node.js 18.x
46+
uses: actions/setup-node@v3
47+
with:
48+
node-version: 18.x
49+
cache: 'npm'
50+
51+
- name: Install dependencies
52+
run: npm ci
53+
54+
- name: Build
55+
run: npm run build
56+
env:
57+
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }}
58+
SUPABASE_URL: ${{ secrets.SUPABASE_URL }}
59+
SUPABASE_SERVICE_ROLE_KEY: ${{ secrets.SUPABASE_SERVICE_ROLE_KEY }}
60+
61+
- name: Deploy Web App
62+
run: npm run deploy:web
63+
env:
64+
VERCEL_TOKEN: ${{ secrets.VERCEL_TOKEN }}
65+
66+
- name: Deploy Worker
67+
run: npm run deploy:worker
68+
env:
69+
CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }}

.gitignore

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
# Node modules
2+
node_modules/
3+
4+
# Logs
5+
npm-debug.log*
6+
yarn-debug.log*
7+
pnpm-debug.log*
8+
9+
# Next.js build output
10+
.next/
11+
out/
12+
13+
# TypeScript build output
14+
dist/
15+
16+
# Generated docs
17+
docs/
18+
19+
# Worker build
20+
apps/worker/dist/
21+
22+
# VSCode
23+
.vscode/
24+
25+
# Environment files
26+
.env
27+
.env.local
28+
.env.*.local
29+
30+
# Mac
31+
.DS_Store
32+
33+
# Yarn
34+
yarn-error.log

.prettierrc

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
{
2+
"semi": true,
3+
"trailingComma": "es5",
4+
"singleQuote": true,
5+
"printWidth": 100,
6+
"tabWidth": 2,
7+
"useTabs": false,
8+
"bracketSpacing": true,
9+
"arrowParens": "avoid",
10+
"endOfLine": "lf"
11+
}

Dockerfile

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Build stage
2+
FROM node:18-alpine AS builder
3+
4+
WORKDIR /app
5+
6+
7+
COPY package*.json ./
8+
COPY apps/web/package*.json ./apps/web/
9+
COPY apps/api/package*.json ./apps/api/
10+
COPY packages/core/package*.json ./packages/core/
11+
COPY packages/llm/package*.json ./packages/llm/
12+
COPY packages/storage/package*.json ./packages/storage/
13+
14+
RUN npm install
15+
16+
COPY . .
17+
18+
RUN npm run build
19+
20+
FROM node:18-alpine
21+
22+
WORKDIR /app
23+
24+
COPY --from=builder /app/dist ./dist
25+
COPY --from=builder /app/node_modules ./node_modules
26+
COPY --from=builder /app/package*.json ./
27+
ENV NODE_ENV=production
28+
ENV PORT=3000
29+
30+
EXPOSE 3000
31+
32+
CMD ["npm", "start"]

README.md

Lines changed: 151 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,151 @@
1+
# TypeScript Documentation Generator
2+
3+
A powerful tool that automatically generates documentation for your TypeScript code using AI-powered docstring generation and TypeDoc.
4+
5+
## Features
6+
7+
- 🚀 AI-powered docstring generation using OpenAI/Anthropic/Gemini
8+
- 📝 Automatic TypeScript documentation generation
9+
- 💻 Modern web interface with Monaco Editor
10+
- 📁 File upload and processing
11+
- 📊 Real-time progress tracking
12+
- 📦 Multiple output formats (HTML/Markdown)
13+
- 🎨 Customizable documentation templates
14+
15+
## Getting Started
16+
17+
### Prerequisites
18+
19+
- Node.js 18+ and npm/yarn
20+
- OpenAI/Anthropic/Gemini API key (for AI docstring generation)
21+
22+
### Installation
23+
24+
1. Clone the repository:
25+
```bash
26+
git clone https://github.com/yourusername/ts-docgen.git
27+
cd ts-docgen
28+
```
29+
30+
2. Install dependencies:
31+
```bash
32+
npm install
33+
```
34+
35+
3. Set up environment variables:
36+
```bash
37+
cp .env.example .env
38+
# Edit .env with your API keys and configuration
39+
```
40+
41+
4. Start the development server:
42+
```bash
43+
npm run dev:web
44+
```
45+
46+
```bash
47+
cd ..
48+
```
49+
```bash
50+
cd worker
51+
```
52+
```bash
53+
npm run dev:worker
54+
```
55+
56+
## Usage
57+
58+
1. Open the web interface at `http://localhost:3000`
59+
2. Upload your TypeScript files or paste code directly
60+
3. Configure documentation settings
61+
4. Generate documentation
62+
5. Download or preview the results
63+
64+
## API Documentation
65+
66+
### Endpoints
67+
68+
#### POST /api/upload
69+
Upload TypeScript files for documentation generation.
70+
71+
**Request Body:**
72+
```typescript
73+
{
74+
files: File[]
75+
}
76+
```
77+
78+
79+
80+
#### GET /api/status/:key
81+
Get the status of a documentation generation job.
82+
83+
84+
**Response:**
85+
Documentation file (HTML/Markdown)
86+
87+
## Services
88+
89+
### VersioningService
90+
91+
The VersioningService provides version control functionality for documentation files, allowing you to track changes, compare versions, and manage documentation history.
92+
93+
#### Features
94+
95+
- Create and manage versions of documentation files
96+
- Track changes and authors for each version
97+
- Compare different versions of documentation
98+
- Tag versions for better organization
99+
- Retrieve specific versions or the latest version
100+
101+
102+
## Configuration
103+
104+
The application can be configured through environment variables:
105+
106+
- `OPENAI_API_KEY`: OpenAI API key
107+
- `ANTHROPIC_API_KEY`: Anthropic API key
108+
- `GEMINI_API_KEY`: Gemini API key
109+
- `SUPABASE_URL`: Supabase project URL
110+
- `SUPABASE_SERVICE_ROLE_KEY`: Supabase service role key for storage access
111+
112+
## Development
113+
114+
115+
116+
### Running Tests
117+
118+
```bash
119+
npm test
120+
```
121+
122+
### Building for Production
123+
124+
```bash
125+
npm run build
126+
```
127+
128+
## Deployment
129+
130+
### Production Deployment
131+
132+
1. Build the application:
133+
```bash
134+
npm run build
135+
```
136+
137+
2. Start the production server:
138+
```bash
139+
npm start
140+
```
141+
142+
143+
144+
## Contributing
145+
146+
1. Fork the repository
147+
2. Create your feature branch (`git checkout -b feature/amazing-feature`)
148+
3. Commit your changes (`git commit -m 'Add some amazing feature'`)
149+
4. Push to the branch (`git push origin feature/amazing-feature`)
150+
5. Open a Pull Request
151+

apps/web/.gitignore

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
# See https://help.github.com/articles/ignoring-files/ for more about ignoring files.
2+
3+
# dependencies
4+
/node_modules
5+
/.pnp
6+
.pnp.*
7+
.yarn/*
8+
!.yarn/patches
9+
!.yarn/plugins
10+
!.yarn/releases
11+
!.yarn/versions
12+
13+
# testing
14+
/coverage
15+
16+
# next.js
17+
/.next/
18+
/out/
19+
20+
# production
21+
/build
22+
23+
# misc
24+
.DS_Store
25+
*.pem
26+
27+
# debug
28+
npm-debug.log*
29+
yarn-debug.log*
30+
yarn-error.log*
31+
.pnpm-debug.log*
32+
33+
# env files (can opt-in for committing if needed)
34+
.env*
35+
36+
# vercel
37+
.vercel
38+
39+
# typescript
40+
*.tsbuildinfo
41+
next-env.d.ts

0 commit comments

Comments
 (0)