@git.zone/tsdoc 1.12.0 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist_ts/00_commitinfo_data.js +2 -2
- package/dist_ts/aidocs_classes/commit.js +53 -86
- package/dist_ts/aidocs_classes/description.js +29 -48
- package/dist_ts/aidocs_classes/readme.js +57 -95
- package/dist_ts/classes.aidoc.d.ts +1 -6
- package/dist_ts/classes.aidoc.js +7 -17
- package/dist_ts/plugins.d.ts +2 -1
- package/dist_ts/plugins.js +3 -2
- package/package.json +13 -13
- package/readme.md +137 -313
- package/ts/00_commitinfo_data.ts +1 -1
- package/ts/aidocs_classes/commit.ts +52 -88
- package/ts/aidocs_classes/description.ts +31 -51
- package/ts/aidocs_classes/readme.ts +57 -96
- package/ts/classes.aidoc.ts +10 -21
- package/ts/plugins.ts +2 -0
package/readme.md
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
# @git.zone/tsdoc
|
|
1
|
+
# @git.zone/tsdoc
|
|
2
2
|
|
|
3
3
|
AI-Powered Documentation for TypeScript Projects
|
|
4
4
|
|
|
@@ -6,402 +6,226 @@ AI-Powered Documentation for TypeScript Projects
|
|
|
6
6
|
|
|
7
7
|
For reporting bugs, issues, or security vulnerabilities, please visit [community.foss.global/](https://community.foss.global/). This is the central community hub for all issue reporting. Developers who sign and comply with our contribution agreement and go through identification can also get a [code.foss.global/](https://code.foss.global/) account to submit Pull Requests directly.
|
|
8
8
|
|
|
9
|
-
##
|
|
10
|
-
|
|
11
|
-
`@git.zone/tsdoc` is a next-generation documentation CLI tool that combines traditional TypeDoc generation with cutting-edge AI to create comprehensive, intelligent documentation for your TypeScript projects. It reads your code, understands it, and writes documentation that actually makes sense.
|
|
12
|
-
|
|
13
|
-
### ✨ Key Features
|
|
14
|
-
|
|
15
|
-
- **🤖 AI-Enhanced Documentation** - Leverages AI to generate contextual READMEs
|
|
16
|
-
- **🧠 Smart Context Building** - Intelligent file prioritization with dependency analysis and caching
|
|
17
|
-
- **📚 TypeDoc Integration** - Classic API documentation generation when you need it
|
|
18
|
-
- **💬 Smart Commit Messages** - AI analyzes your changes and suggests meaningful commit messages
|
|
19
|
-
- **🎯 Context Optimization** - Advanced token management with 40-60% reduction in usage
|
|
20
|
-
- **⚡ Performance Optimized** - 3-5x faster with lazy loading and parallel processing
|
|
21
|
-
- **📦 Zero Config** - Works out of the box with sensible defaults
|
|
22
|
-
- **🔧 Highly Configurable** - Customize every aspect when needed
|
|
23
|
-
|
|
24
|
-
## Installation
|
|
9
|
+
## Install
|
|
25
10
|
|
|
26
11
|
```bash
|
|
27
|
-
# Global installation (recommended)
|
|
12
|
+
# Global installation (recommended for CLI usage)
|
|
28
13
|
pnpm add -g @git.zone/tsdoc
|
|
29
14
|
|
|
30
15
|
# Or use with npx
|
|
31
16
|
npx @git.zone/tsdoc
|
|
17
|
+
|
|
18
|
+
# Or install locally as a dependency
|
|
19
|
+
pnpm add @git.zone/tsdoc
|
|
32
20
|
```
|
|
33
21
|
|
|
34
|
-
##
|
|
22
|
+
## Usage
|
|
23
|
+
|
|
24
|
+
`@git.zone/tsdoc` is a comprehensive TypeScript documentation tool that combines traditional TypeDoc API documentation generation with AI-powered documentation workflows. It uses OpenAI models via the Vercel AI SDK to generate READMEs, project descriptions, keywords, and semantic commit messages by intelligently exploring your project with agentic tool use.
|
|
25
|
+
|
|
26
|
+
### CLI Commands
|
|
27
|
+
|
|
28
|
+
| Command | Description |
|
|
29
|
+
|---------|-------------|
|
|
30
|
+
| `tsdoc` | Auto-detects project type and runs TypeDoc |
|
|
31
|
+
| `tsdoc aidoc` | Generates AI-powered README + description/keywords |
|
|
32
|
+
| `tsdoc readme` | Generates AI-powered README only |
|
|
33
|
+
| `tsdoc description` | Generates AI-powered description and keywords only |
|
|
34
|
+
| `tsdoc commit` | Generates a semantic commit message from uncommitted changes |
|
|
35
|
+
| `tsdoc typedoc` | Generates traditional TypeDoc API documentation |
|
|
35
36
|
|
|
36
|
-
###
|
|
37
|
+
### Generating AI-Powered Documentation
|
|
38
|
+
|
|
39
|
+
The `aidoc` command combines README generation and description/keyword generation in one step:
|
|
37
40
|
|
|
38
41
|
```bash
|
|
39
42
|
# In your project root
|
|
40
43
|
tsdoc aidoc
|
|
41
44
|
```
|
|
42
45
|
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
46
|
+
This will:
|
|
47
|
+
1. Analyze your codebase using an AI agent with filesystem access
|
|
48
|
+
2. Generate a comprehensive `readme.md`
|
|
49
|
+
3. Update `package.json` and `npmextra.json` with an AI-generated description and keywords
|
|
47
50
|
|
|
48
|
-
|
|
51
|
+
You can also run these separately:
|
|
49
52
|
|
|
50
53
|
```bash
|
|
51
|
-
|
|
52
|
-
|
|
54
|
+
# Generate only the README
|
|
55
|
+
tsdoc readme
|
|
53
56
|
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
```bash
|
|
57
|
-
tsdoc commit
|
|
57
|
+
# Generate only the description and keywords
|
|
58
|
+
tsdoc description
|
|
58
59
|
```
|
|
59
60
|
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
| Command | Description |
|
|
63
|
-
|---------|-------------|
|
|
64
|
-
| `tsdoc` | Auto-detects and runs appropriate documentation |
|
|
65
|
-
| `tsdoc aidoc` | Generate AI-enhanced documentation |
|
|
66
|
-
| `tsdoc typedoc` | Generate TypeDoc documentation |
|
|
67
|
-
| `tsdoc commit` | Generate smart commit message |
|
|
68
|
-
| `tsdoc tokens` | Analyze token usage for AI context |
|
|
69
|
-
|
|
70
|
-
### Token Analysis
|
|
61
|
+
### Generating Commit Messages
|
|
71
62
|
|
|
72
|
-
|
|
63
|
+
The `commit` command analyzes your uncommitted changes and produces a structured commit object:
|
|
73
64
|
|
|
74
65
|
```bash
|
|
75
|
-
|
|
76
|
-
|
|
66
|
+
tsdoc commit
|
|
67
|
+
```
|
|
77
68
|
|
|
78
|
-
|
|
79
|
-
tsdoc tokens --all
|
|
69
|
+
Output is a JSON object following conventional commits:
|
|
80
70
|
|
|
81
|
-
|
|
82
|
-
|
|
71
|
+
```json
|
|
72
|
+
{
|
|
73
|
+
"recommendedNextVersionLevel": "feat",
|
|
74
|
+
"recommendedNextVersionScope": "core",
|
|
75
|
+
"recommendedNextVersionMessage": "add new feature for better documentation",
|
|
76
|
+
"recommendedNextVersionDetails": [
|
|
77
|
+
"implemented X",
|
|
78
|
+
"refactored Y"
|
|
79
|
+
],
|
|
80
|
+
"recommendedNextVersion": "1.13.0",
|
|
81
|
+
"changelog": "# Changelog\n\n## 2026-03-11 - 1.13.0 - core\n..."
|
|
82
|
+
}
|
|
83
83
|
```
|
|
84
84
|
|
|
85
|
-
|
|
85
|
+
The commit command includes intelligent diff processing that:
|
|
86
|
+
- Excludes lock files, build artifacts, IDE directories, and caches from the diff
|
|
87
|
+
- Prioritizes source files over build artifacts
|
|
88
|
+
- Samples large diffs with head/tail extraction to stay within token budgets
|
|
89
|
+
- Automatically generates or updates the changelog
|
|
86
90
|
|
|
87
|
-
|
|
88
|
-
- `--tokens` / `--showTokens` - Show token count before generating
|
|
89
|
-
- `--tokensOnly` - Only show token count, don't generate
|
|
91
|
+
### Generating TypeDoc
|
|
90
92
|
|
|
91
|
-
|
|
92
|
-
- `--publicSubdir <dir>` - Output subdirectory within public folder
|
|
93
|
+
For traditional API documentation via TypeDoc:
|
|
93
94
|
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
- `--detailed` - Show detailed token usage and costs
|
|
98
|
-
- `--listFiles` - List all files included in context
|
|
99
|
-
- `--model <name>` - Show usage for specific model (`gpt4`, `gpt35`)
|
|
95
|
+
```bash
|
|
96
|
+
# Generate to default ./public directory
|
|
97
|
+
tsdoc typedoc
|
|
100
98
|
|
|
101
|
-
|
|
99
|
+
# Generate to a specific subdirectory
|
|
100
|
+
tsdoc typedoc --publicSubdir docs
|
|
101
|
+
```
|
|
102
102
|
|
|
103
|
-
|
|
103
|
+
### Monorepo Support
|
|
104
104
|
|
|
105
|
-
|
|
106
|
-
{
|
|
107
|
-
"@git.zone/tsdoc": {
|
|
108
|
-
"legal": "## License and Legal Information\n\n...",
|
|
109
|
-
"context": {
|
|
110
|
-
"maxTokens": 190000,
|
|
111
|
-
"defaultMode": "trimmed",
|
|
112
|
-
"cache": {
|
|
113
|
-
"enabled": true,
|
|
114
|
-
"ttl": 3600,
|
|
115
|
-
"maxSize": 100
|
|
116
|
-
},
|
|
117
|
-
"analyzer": {
|
|
118
|
-
"useAIRefinement": false
|
|
119
|
-
},
|
|
120
|
-
"prioritization": {
|
|
121
|
-
"dependencyWeight": 0.3,
|
|
122
|
-
"relevanceWeight": 0.4,
|
|
123
|
-
"efficiencyWeight": 0.2,
|
|
124
|
-
"recencyWeight": 0.1
|
|
125
|
-
},
|
|
126
|
-
"tiers": {
|
|
127
|
-
"essential": { "minScore": 0.8, "trimLevel": "none" },
|
|
128
|
-
"important": { "minScore": 0.5, "trimLevel": "light" },
|
|
129
|
-
"optional": { "minScore": 0.2, "trimLevel": "aggressive" }
|
|
130
|
-
},
|
|
131
|
-
"taskSpecificSettings": {
|
|
132
|
-
"readme": {
|
|
133
|
-
"mode": "trimmed",
|
|
134
|
-
"includePaths": ["ts/", "src/"],
|
|
135
|
-
"excludePaths": ["test/", "node_modules/"]
|
|
136
|
-
},
|
|
137
|
-
"commit": {
|
|
138
|
-
"mode": "trimmed",
|
|
139
|
-
"focusOnChangedFiles": true
|
|
140
|
-
}
|
|
141
|
-
},
|
|
142
|
-
"trimming": {
|
|
143
|
-
"removeImplementations": true,
|
|
144
|
-
"preserveInterfaces": true,
|
|
145
|
-
"preserveJSDoc": true,
|
|
146
|
-
"maxFunctionLines": 5,
|
|
147
|
-
"removeComments": true
|
|
148
|
-
}
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
```
|
|
105
|
+
When generating READMEs, tsdoc automatically detects monorepo submodules via `@git.zone/tspublish` conventions. Each submodule directory with a `tspublish.json` gets its own generated README.
|
|
153
106
|
|
|
154
|
-
###
|
|
155
|
-
|
|
156
|
-
#### Context Settings
|
|
157
|
-
- **maxTokens** - Maximum tokens for AI context (default: 190000)
|
|
158
|
-
- **defaultMode** - Default context mode: 'full', 'trimmed', or 'summarized'
|
|
159
|
-
- **cache** - Caching configuration for improved performance
|
|
160
|
-
- **analyzer** - Smart file analysis and prioritization settings
|
|
161
|
-
- **prioritization** - Weights for file importance scoring
|
|
162
|
-
- **tiers** - Tier thresholds and trimming levels
|
|
163
|
-
|
|
164
|
-
#### Cache Configuration
|
|
165
|
-
- **enabled** - Enable/disable file caching (default: true)
|
|
166
|
-
- **ttl** - Time-to-live in seconds (default: 3600)
|
|
167
|
-
- **maxSize** - Maximum cache size in MB (default: 100)
|
|
168
|
-
- **directory** - Cache directory path (default: .nogit/context-cache)
|
|
169
|
-
|
|
170
|
-
## How It Works
|
|
171
|
-
|
|
172
|
-
### 🚀 Smart Context Building Pipeline
|
|
173
|
-
|
|
174
|
-
1. **📊 Fast Metadata Scanning** - Lazy loading scans files without reading contents
|
|
175
|
-
2. **🧬 Dependency Analysis** - Builds dependency graph from import statements
|
|
176
|
-
3. **🎯 Intelligent Scoring** - Multi-factor importance scoring:
|
|
177
|
-
- **Relevance**: Task-specific file importance (e.g., index.ts for READMEs)
|
|
178
|
-
- **Centrality**: How many files depend on this file
|
|
179
|
-
- **Efficiency**: Information density (tokens vs. value)
|
|
180
|
-
- **Recency**: Recently changed files (for commits)
|
|
181
|
-
4. **🏆 Smart Prioritization** - Files sorted by combined importance score
|
|
182
|
-
5. **🎭 Tier-Based Trimming** - Adaptive trimming based on importance:
|
|
183
|
-
- **Essential** (score ≥ 0.8): No trimming
|
|
184
|
-
- **Important** (score ≥ 0.5): Light trimming
|
|
185
|
-
- **Optional** (score ≥ 0.2): Aggressive trimming
|
|
186
|
-
6. **💾 Intelligent Caching** - Cache results with file change detection
|
|
187
|
-
7. **🧠 AI Processing** - Send optimized context to AI for documentation
|
|
188
|
-
|
|
189
|
-
### Context Optimization Benefits
|
|
190
|
-
|
|
191
|
-
The smart context system delivers significant improvements:
|
|
192
|
-
|
|
193
|
-
| Metric | Before | After | Improvement |
|
|
194
|
-
|--------|--------|-------|-------------|
|
|
195
|
-
| **Token Usage** | ~190k (limit) | ~110-130k | ⬇️ 40-60% reduction |
|
|
196
|
-
| **Build Time** | 4-6 seconds | 1-2 seconds | ⚡ 3-5x faster |
|
|
197
|
-
| **Memory Usage** | All files loaded | Metadata + selected | 📉 80%+ reduction |
|
|
198
|
-
| **Relevance** | Alphabetical sorting | Smart scoring | 🎯 90%+ relevant |
|
|
199
|
-
| **Cache Hits** | None | 70-80% | 🚀 Major speedup |
|
|
200
|
-
|
|
201
|
-
## Environment Variables
|
|
202
|
-
|
|
203
|
-
| Variable | Description |
|
|
204
|
-
|----------|-------------|
|
|
205
|
-
| `OPENAI_TOKEN` | Your OpenAI API key for AI features (required) |
|
|
206
|
-
|
|
207
|
-
The token can also be provided interactively on first run - it will be persisted in `~/.npmextra/kv/@git.zone/tsdoc.json`.
|
|
208
|
-
|
|
209
|
-
## Use Cases
|
|
210
|
-
|
|
211
|
-
### 🚀 Continuous Integration
|
|
212
|
-
|
|
213
|
-
```yaml
|
|
214
|
-
# .github/workflows/docs.yml
|
|
215
|
-
name: Documentation
|
|
216
|
-
on: [push]
|
|
217
|
-
jobs:
|
|
218
|
-
docs:
|
|
219
|
-
runs-on: ubuntu-latest
|
|
220
|
-
steps:
|
|
221
|
-
- uses: actions/checkout@v3
|
|
222
|
-
- name: Setup Node
|
|
223
|
-
uses: actions/setup-node@v3
|
|
224
|
-
with:
|
|
225
|
-
node-version: '18'
|
|
226
|
-
- name: Generate Documentation
|
|
227
|
-
env:
|
|
228
|
-
OPENAI_TOKEN: ${{ secrets.OPENAI_TOKEN }}
|
|
229
|
-
run: |
|
|
230
|
-
npm install -g @git.zone/tsdoc
|
|
231
|
-
tsdoc aidoc
|
|
232
|
-
- name: Commit Changes
|
|
233
|
-
run: |
|
|
234
|
-
git config --local user.email "action@github.com"
|
|
235
|
-
git config --local user.name "GitHub Action"
|
|
236
|
-
git add readme.md package.json
|
|
237
|
-
git commit -m "docs: update documentation [skip ci]" || exit 0
|
|
238
|
-
git push
|
|
239
|
-
```
|
|
107
|
+
### Programmatic API
|
|
240
108
|
|
|
241
|
-
|
|
109
|
+
You can also use tsdoc programmatically:
|
|
242
110
|
|
|
243
|
-
```
|
|
244
|
-
|
|
245
|
-
#!/bin/bash
|
|
246
|
-
tsdoc commit > .git/COMMIT_EDITMSG
|
|
247
|
-
```
|
|
111
|
+
```typescript
|
|
112
|
+
import { AiDoc } from '@git.zone/tsdoc';
|
|
248
113
|
|
|
249
|
-
|
|
114
|
+
const aidoc = new AiDoc();
|
|
115
|
+
await aidoc.start(); // Initializes the AI model (prompts for OpenAI token if needed)
|
|
250
116
|
|
|
251
|
-
|
|
252
|
-
|
|
253
|
-
"scripts": {
|
|
254
|
-
"prepublishOnly": "tsdoc aidoc",
|
|
255
|
-
"version": "tsdoc aidoc && git add readme.md"
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
```
|
|
117
|
+
// Generate a README
|
|
118
|
+
await aidoc.buildReadme('/path/to/project');
|
|
259
119
|
|
|
260
|
-
|
|
120
|
+
// Generate description and keywords
|
|
121
|
+
await aidoc.buildDescription('/path/to/project');
|
|
261
122
|
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
123
|
+
// Generate a commit message object
|
|
124
|
+
const commitObj = await aidoc.buildNextCommitObject('/path/to/project');
|
|
125
|
+
console.log(commitObj);
|
|
265
126
|
|
|
266
|
-
|
|
127
|
+
// Get project context information
|
|
128
|
+
const context = await aidoc.getProjectContext('/path/to/project');
|
|
267
129
|
|
|
268
|
-
|
|
130
|
+
// Get token count for a project
|
|
131
|
+
const tokenCount = await aidoc.getProjectContextTokenCount('/path/to/project');
|
|
269
132
|
|
|
270
|
-
|
|
133
|
+
// Estimate tokens in arbitrary text
|
|
134
|
+
const tokens = aidoc.countTokens('some text here');
|
|
271
135
|
|
|
272
|
-
|
|
273
|
-
# Check token usage details
|
|
274
|
-
tsdoc tokens --all --detailed
|
|
136
|
+
await aidoc.stop();
|
|
275
137
|
```
|
|
276
138
|
|
|
277
|
-
|
|
139
|
+
## Configuration
|
|
278
140
|
|
|
279
|
-
|
|
280
|
-
{
|
|
281
|
-
"@git.zone/tsdoc": {
|
|
282
|
-
"context": {
|
|
283
|
-
"maxTokens": 100000,
|
|
284
|
-
"tiers": {
|
|
285
|
-
"essential": { "minScore": 0.9, "trimLevel": "none" },
|
|
286
|
-
"important": { "minScore": 0.7, "trimLevel": "aggressive" },
|
|
287
|
-
"optional": { "minScore": 0.5, "trimLevel": "aggressive" }
|
|
288
|
-
}
|
|
289
|
-
}
|
|
290
|
-
}
|
|
291
|
-
}
|
|
292
|
-
```
|
|
141
|
+
### OpenAI Token
|
|
293
142
|
|
|
294
|
-
|
|
143
|
+
An OpenAI API key is required for all AI features. It can be provided in three ways:
|
|
295
144
|
|
|
296
|
-
|
|
145
|
+
1. **Environment variable**: `OPENAI_TOKEN`
|
|
146
|
+
2. **Interactive prompt**: On first run, tsdoc will prompt for the token and persist it
|
|
147
|
+
3. **Constructor argument**: Pass `{ OPENAI_TOKEN: 'sk-...' }` to `new AiDoc()`
|
|
297
148
|
|
|
298
|
-
|
|
299
|
-
export OPENAI_TOKEN="your-key-here"
|
|
300
|
-
tsdoc aidoc
|
|
301
|
-
```
|
|
149
|
+
The token is persisted at `~/.npmextra/kv/@git.zone/tsdoc.json` for subsequent runs.
|
|
302
150
|
|
|
303
|
-
###
|
|
151
|
+
### npmextra.json
|
|
304
152
|
|
|
305
|
-
|
|
153
|
+
tsdoc uses `npmextra.json` for project metadata. The `tsdoc` key holds legal information that gets appended to generated READMEs:
|
|
306
154
|
|
|
307
155
|
```json
|
|
308
156
|
{
|
|
309
|
-
"
|
|
310
|
-
"
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
157
|
+
"tsdoc": {
|
|
158
|
+
"legal": "\n## License and Legal Information\n\n..."
|
|
159
|
+
},
|
|
160
|
+
"gitzone": {
|
|
161
|
+
"module": {
|
|
162
|
+
"githost": "gitlab.com",
|
|
163
|
+
"gitscope": "gitzone",
|
|
164
|
+
"gitrepo": "tsdoc",
|
|
165
|
+
"npmPackagename": "@git.zone/tsdoc",
|
|
166
|
+
"description": "...",
|
|
167
|
+
"keywords": ["..."]
|
|
316
168
|
}
|
|
317
169
|
}
|
|
318
170
|
}
|
|
319
171
|
```
|
|
320
172
|
|
|
321
|
-
|
|
173
|
+
## Architecture
|
|
322
174
|
|
|
323
|
-
|
|
175
|
+
### Core Components
|
|
324
176
|
|
|
325
|
-
```
|
|
326
|
-
|
|
177
|
+
```
|
|
178
|
+
@git.zone/tsdoc
|
|
179
|
+
├── AiDoc # Main orchestrator - manages AI model and delegates to task classes
|
|
180
|
+
├── TypeDoc # Traditional TypeDoc API documentation generation
|
|
181
|
+
├── ProjectContext # Gathers project files for context (package.json, ts/, test/)
|
|
182
|
+
├── DiffProcessor # Intelligent git diff processing with prioritization and sampling
|
|
183
|
+
├── Readme # AI-powered README generation using runAgent with filesystem tools
|
|
184
|
+
├── Commit # AI-powered commit message generation with diff analysis
|
|
185
|
+
├── Description # AI-powered description and keyword generation
|
|
186
|
+
└── CLI # Command-line interface built on @push.rocks/smartcli
|
|
327
187
|
```
|
|
328
188
|
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
### 🎯 Actually Understands Your Code
|
|
332
|
-
Not just parsing, but real comprehension through AI. The smart context system ensures AI sees the most relevant parts of your codebase.
|
|
333
|
-
|
|
334
|
-
### ⏱️ Saves Hours
|
|
335
|
-
Generate complete, accurate documentation in seconds. The intelligent caching system makes subsequent runs even faster.
|
|
189
|
+
### AI Agent Architecture
|
|
336
190
|
|
|
337
|
-
|
|
338
|
-
Regenerate documentation with every change. Smart dependency analysis ensures nothing important is missed.
|
|
191
|
+
tsdoc uses `@push.rocks/smartagent`'s `runAgent()` function with `@push.rocks/smartai`'s `getModel()` for all AI tasks. Each documentation task (readme, commit, description) runs an autonomous AI agent that:
|
|
339
192
|
|
|
340
|
-
|
|
341
|
-
|
|
193
|
+
1. Receives a system prompt defining its role and constraints
|
|
194
|
+
2. Gets access to scoped filesystem tools (read-only, limited to project directory)
|
|
195
|
+
3. Explores the project structure autonomously using tool calls
|
|
196
|
+
4. Produces the final output (README markdown, commit JSON, or description JSON)
|
|
342
197
|
|
|
343
|
-
###
|
|
344
|
-
Smart context optimization reduces AI API costs by 40-60% without sacrificing quality.
|
|
198
|
+
### Diff Processing
|
|
345
199
|
|
|
346
|
-
|
|
200
|
+
The `DiffProcessor` class handles large git diffs intelligently:
|
|
347
201
|
|
|
348
|
-
|
|
202
|
+
- **Small files** (< 300 lines): Included in full
|
|
203
|
+
- **Medium files** (< 800 lines): Head/tail sampling with context
|
|
204
|
+
- **Large files**: Metadata only (filepath, lines added/removed)
|
|
205
|
+
- Files are prioritized by importance: source > test > config > docs > build artifacts
|
|
206
|
+
- Token budget is enforced dynamically based on OpenAI's context limits
|
|
349
207
|
|
|
350
|
-
|
|
351
|
-
@git.zone/tsdoc
|
|
352
|
-
├── AiDoc # Main AI documentation orchestrator
|
|
353
|
-
├── TypeDoc # Traditional TypeDoc integration
|
|
354
|
-
├── Context System # Smart context building
|
|
355
|
-
│ ├── EnhancedContext # Main context builder
|
|
356
|
-
│ ├── LazyFileLoader # Efficient file loading
|
|
357
|
-
│ ├── ContextCache # Performance caching
|
|
358
|
-
│ ├── ContextAnalyzer # Intelligent file analysis
|
|
359
|
-
│ ├── ContextTrimmer # Adaptive code trimming
|
|
360
|
-
│ ├── DiffProcessor # Git diff optimization
|
|
361
|
-
│ ├── ConfigManager # Configuration management
|
|
362
|
-
│ └── TaskContextFactory # Task-specific contexts
|
|
363
|
-
└── CLI # Command-line interface
|
|
364
|
-
```
|
|
365
|
-
|
|
366
|
-
### Data Flow
|
|
208
|
+
## Requirements
|
|
367
209
|
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
LazyFileLoader (metadata scan)
|
|
372
|
-
↓
|
|
373
|
-
ContextAnalyzer (scoring & prioritization)
|
|
374
|
-
↓
|
|
375
|
-
ContextCache (check cache)
|
|
376
|
-
↓
|
|
377
|
-
File Loading (parallel, on-demand)
|
|
378
|
-
↓
|
|
379
|
-
ContextTrimmer (tier-based)
|
|
380
|
-
↓
|
|
381
|
-
Token Budget (enforcement)
|
|
382
|
-
↓
|
|
383
|
-
AI Model
|
|
384
|
-
↓
|
|
385
|
-
Generated Documentation
|
|
386
|
-
```
|
|
210
|
+
- **Node.js** >= 18.0.0
|
|
211
|
+
- **TypeScript** project with `ts/` source directory
|
|
212
|
+
- **OpenAI API key** (for AI features)
|
|
387
213
|
|
|
388
214
|
## License and Legal Information
|
|
389
215
|
|
|
390
|
-
This repository contains open-source code licensed under the MIT License. A copy of the
|
|
216
|
+
This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository.
|
|
391
217
|
|
|
392
218
|
**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.
|
|
393
219
|
|
|
394
220
|
### Trademarks
|
|
395
221
|
|
|
396
|
-
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH
|
|
397
|
-
|
|
398
|
-
Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines or the guidelines of the respective third-party owners, and any usage must be approved in writing. Third-party trademarks used herein are the property of their respective owners and used only in a descriptive manner, e.g. for an implementation of an API or similar.
|
|
222
|
+
This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.
|
|
399
223
|
|
|
400
224
|
### Company Information
|
|
401
225
|
|
|
402
226
|
Task Venture Capital GmbH
|
|
403
|
-
Registered at District
|
|
227
|
+
Registered at District court Bremen HRB 35230 HB, Germany
|
|
404
228
|
|
|
405
|
-
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
229
|
+
For any legal inquiries or if you require further information, please contact us via email at hello@task.vc.
|
|
406
230
|
|
|
407
231
|
By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.
|
package/ts/00_commitinfo_data.ts
CHANGED
|
@@ -3,6 +3,6 @@
|
|
|
3
3
|
*/
|
|
4
4
|
export const commitinfo = {
|
|
5
5
|
name: '@git.zone/tsdoc',
|
|
6
|
-
version: '
|
|
6
|
+
version: '2.0.0',
|
|
7
7
|
description: 'A comprehensive TypeScript documentation tool that leverages AI to generate and enhance project documentation, including dynamic README creation, API docs via TypeDoc, and smart commit message generation.'
|
|
8
8
|
}
|