@git.zone/tsdoc 1.10.0 → 1.10.2
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/aidocs_classes/commit.js +4 -4
- package/dist_ts/aidocs_classes/description.js +3 -3
- package/dist_ts/aidocs_classes/projectcontext.js +7 -7
- package/dist_ts/aidocs_classes/readme.js +4 -4
- package/dist_ts/classes.aidoc.js +15 -2
- package/dist_ts/classes.typedoc.js +5 -5
- package/dist_ts/cli.js +2 -2
- package/dist_ts/context/config-manager.js +8 -8
- package/dist_ts/context/context-analyzer.js +2 -2
- package/dist_ts/context/context-cache.js +5 -5
- package/dist_ts/context/enhanced-context.js +2 -2
- package/dist_ts/context/iterative-context-builder.js +2 -2
- package/dist_ts/context/lazy-file-loader.js +26 -8
- package/dist_ts/plugins.d.ts +4 -1
- package/dist_ts/plugins.js +8 -2
- package/package.json +12 -11
- package/readme.md +38 -227
- package/ts/aidocs_classes/commit.ts +3 -3
- package/ts/aidocs_classes/description.ts +2 -2
- package/ts/aidocs_classes/projectcontext.ts +8 -10
- package/ts/aidocs_classes/readme.ts +3 -3
- package/ts/classes.aidoc.ts +17 -1
- package/ts/classes.typedoc.ts +4 -4
- package/ts/cli.ts +1 -1
- package/ts/context/config-manager.ts +7 -7
- package/ts/context/context-analyzer.ts +1 -1
- package/ts/context/context-cache.ts +4 -4
- package/ts/context/enhanced-context.ts +1 -1
- package/ts/context/iterative-context-builder.ts +1 -1
- package/ts/context/lazy-file-loader.ts +23 -7
- package/ts/plugins.ts +9 -0
package/readme.md
CHANGED
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
# @git.zone/tsdoc 🚀
|
|
2
|
-
**AI-Powered Documentation for TypeScript Projects**
|
|
3
2
|
|
|
4
|
-
|
|
3
|
+
AI-Powered Documentation for TypeScript Projects
|
|
4
|
+
|
|
5
|
+
## Issue Reporting and Security
|
|
6
|
+
|
|
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.
|
|
5
8
|
|
|
6
9
|
## What is tsdoc?
|
|
7
10
|
|
|
8
|
-
`@git.zone/tsdoc` is a next-generation documentation 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.
|
|
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.
|
|
9
12
|
|
|
10
13
|
### ✨ Key Features
|
|
11
14
|
|
|
12
|
-
- **🤖 AI-Enhanced Documentation** - Leverages
|
|
15
|
+
- **🤖 AI-Enhanced Documentation** - Leverages AI to generate contextual READMEs
|
|
13
16
|
- **🧠 Smart Context Building** - Intelligent file prioritization with dependency analysis and caching
|
|
14
17
|
- **📚 TypeDoc Integration** - Classic API documentation generation when you need it
|
|
15
18
|
- **💬 Smart Commit Messages** - AI analyzes your changes and suggests meaningful commit messages
|
|
@@ -22,9 +25,6 @@
|
|
|
22
25
|
|
|
23
26
|
```bash
|
|
24
27
|
# Global installation (recommended)
|
|
25
|
-
npm install -g @git.zone/tsdoc
|
|
26
|
-
|
|
27
|
-
# Or with pnpm
|
|
28
28
|
pnpm add -g @git.zone/tsdoc
|
|
29
29
|
|
|
30
30
|
# Or use with npx
|
|
@@ -66,7 +66,6 @@ tsdoc commit
|
|
|
66
66
|
| `tsdoc typedoc` | Generate TypeDoc documentation |
|
|
67
67
|
| `tsdoc commit` | Generate smart commit message |
|
|
68
68
|
| `tsdoc tokens` | Analyze token usage for AI context |
|
|
69
|
-
| `tsdoc context` | Display context information |
|
|
70
69
|
|
|
71
70
|
### Token Analysis
|
|
72
71
|
|
|
@@ -79,91 +78,25 @@ tsdoc tokens
|
|
|
79
78
|
# Show detailed stats for all task types
|
|
80
79
|
tsdoc tokens --all
|
|
81
80
|
|
|
82
|
-
#
|
|
83
|
-
tsdoc tokens --
|
|
81
|
+
# Show detailed breakdown with file listing
|
|
82
|
+
tsdoc tokens --detailed --listFiles
|
|
84
83
|
```
|
|
85
84
|
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
### Generate Documentation Programmatically
|
|
89
|
-
|
|
90
|
-
```typescript
|
|
91
|
-
import { AiDoc } from '@git.zone/tsdoc';
|
|
92
|
-
|
|
93
|
-
const generateDocs = async () => {
|
|
94
|
-
const aiDoc = new AiDoc({ OPENAI_TOKEN: 'your-token' });
|
|
95
|
-
await aiDoc.start();
|
|
96
|
-
|
|
97
|
-
// Generate README
|
|
98
|
-
await aiDoc.buildReadme('./');
|
|
99
|
-
|
|
100
|
-
// Update package.json description
|
|
101
|
-
await aiDoc.buildDescription('./');
|
|
102
|
-
|
|
103
|
-
// Get smart commit message
|
|
104
|
-
const commit = await aiDoc.buildNextCommitObject('./');
|
|
105
|
-
console.log(commit.recommendedNextVersionMessage);
|
|
106
|
-
|
|
107
|
-
// Don't forget to stop when done
|
|
108
|
-
await aiDoc.stop();
|
|
109
|
-
};
|
|
110
|
-
```
|
|
85
|
+
### Command Options
|
|
111
86
|
|
|
112
|
-
|
|
87
|
+
#### tsdoc aidoc
|
|
88
|
+
- `--tokens` / `--showTokens` - Show token count before generating
|
|
89
|
+
- `--tokensOnly` - Only show token count, don't generate
|
|
113
90
|
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
const typeDoc = new TypeDoc(process.cwd());
|
|
118
|
-
await typeDoc.compile({ publicSubdir: 'docs' });
|
|
119
|
-
```
|
|
120
|
-
|
|
121
|
-
### Smart Context Management
|
|
122
|
-
|
|
123
|
-
Control how tsdoc processes your codebase with the new intelligent context system:
|
|
124
|
-
|
|
125
|
-
```typescript
|
|
126
|
-
import { EnhancedContext, ContextAnalyzer, LazyFileLoader, ContextCache } from '@git.zone/tsdoc';
|
|
127
|
-
|
|
128
|
-
const context = new EnhancedContext('./');
|
|
129
|
-
await context.initialize();
|
|
130
|
-
|
|
131
|
-
// Set token budget
|
|
132
|
-
context.setTokenBudget(100000);
|
|
133
|
-
|
|
134
|
-
// Choose context mode
|
|
135
|
-
context.setContextMode('trimmed'); // 'full' | 'trimmed' | 'summarized'
|
|
136
|
-
|
|
137
|
-
// Build optimized context with smart prioritization
|
|
138
|
-
const result = await context.buildContext('readme');
|
|
139
|
-
console.log(`Tokens used: ${result.tokenCount}`);
|
|
140
|
-
console.log(`Files included: ${result.includedFiles.length}`);
|
|
141
|
-
console.log(`Token savings: ${result.tokenSavings}`);
|
|
142
|
-
```
|
|
91
|
+
#### tsdoc typedoc
|
|
92
|
+
- `--publicSubdir <dir>` - Output subdirectory within public folder
|
|
143
93
|
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
const loader = new LazyFileLoader('./');
|
|
151
|
-
const metadata = await loader.scanFiles(['ts/**/*.ts']);
|
|
152
|
-
console.log(`Found ${metadata.length} files`);
|
|
153
|
-
|
|
154
|
-
// Analyze and prioritize files
|
|
155
|
-
const analyzer = new ContextAnalyzer('./');
|
|
156
|
-
const analysis = await analyzer.analyze(metadata, 'readme');
|
|
157
|
-
|
|
158
|
-
// Files are sorted by importance with dependency analysis
|
|
159
|
-
for (const file of analysis.files) {
|
|
160
|
-
console.log(`${file.path}: score ${file.importanceScore.toFixed(2)}, tier ${file.tier}`);
|
|
161
|
-
}
|
|
162
|
-
|
|
163
|
-
// Context caching for performance
|
|
164
|
-
const cache = new ContextCache('./', { enabled: true, ttl: 3600 });
|
|
165
|
-
await cache.init();
|
|
166
|
-
```
|
|
94
|
+
#### tsdoc tokens
|
|
95
|
+
- `--task <type>` - Specify task type: `readme`, `commit`, or `description`
|
|
96
|
+
- `--all` - Show stats for all task types
|
|
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`)
|
|
167
100
|
|
|
168
101
|
## Configuration
|
|
169
102
|
|
|
@@ -171,7 +104,8 @@ Configure tsdoc via `npmextra.json`:
|
|
|
171
104
|
|
|
172
105
|
```json
|
|
173
106
|
{
|
|
174
|
-
"tsdoc": {
|
|
107
|
+
"@git.zone/tsdoc": {
|
|
108
|
+
"legal": "## License and Legal Information\n\n...",
|
|
175
109
|
"context": {
|
|
176
110
|
"maxTokens": 190000,
|
|
177
111
|
"defaultMode": "trimmed",
|
|
@@ -181,7 +115,6 @@ Configure tsdoc via `npmextra.json`:
|
|
|
181
115
|
"maxSize": 100
|
|
182
116
|
},
|
|
183
117
|
"analyzer": {
|
|
184
|
-
"enabled": true,
|
|
185
118
|
"useAIRefinement": false
|
|
186
119
|
},
|
|
187
120
|
"prioritization": {
|
|
@@ -234,11 +167,6 @@ Configure tsdoc via `npmextra.json`:
|
|
|
234
167
|
- **maxSize** - Maximum cache size in MB (default: 100)
|
|
235
168
|
- **directory** - Cache directory path (default: .nogit/context-cache)
|
|
236
169
|
|
|
237
|
-
#### Analyzer Configuration
|
|
238
|
-
- **enabled** - Enable smart file analysis (default: true)
|
|
239
|
-
- **useAIRefinement** - Use AI for additional context refinement (default: false)
|
|
240
|
-
- **aiModel** - Model for AI refinement (default: 'haiku')
|
|
241
|
-
|
|
242
170
|
## How It Works
|
|
243
171
|
|
|
244
172
|
### 🚀 Smart Context Building Pipeline
|
|
@@ -270,21 +198,14 @@ The smart context system delivers significant improvements:
|
|
|
270
198
|
| **Relevance** | Alphabetical sorting | Smart scoring | 🎯 90%+ relevant |
|
|
271
199
|
| **Cache Hits** | None | 70-80% | 🚀 Major speedup |
|
|
272
200
|
|
|
273
|
-
### Traditional Context Optimization
|
|
274
|
-
|
|
275
|
-
For projects where the analyzer is disabled, tsdoc still employs:
|
|
276
|
-
|
|
277
|
-
- **Intelligent Trimming** - Removes implementation details while preserving signatures
|
|
278
|
-
- **JSDoc Preservation** - Keeps documentation comments
|
|
279
|
-
- **Interface Prioritization** - Type definitions always included
|
|
280
|
-
- **Token Budgeting** - Ensures optimal use of AI context windows
|
|
281
|
-
|
|
282
201
|
## Environment Variables
|
|
283
202
|
|
|
284
203
|
| Variable | Description |
|
|
285
204
|
|----------|-------------|
|
|
286
205
|
| `OPENAI_TOKEN` | Your OpenAI API key for AI features (required) |
|
|
287
206
|
|
|
207
|
+
The token can also be provided interactively on first run - it will be persisted in `~/.npmextra/kv/@git.zone/tsdoc.json`.
|
|
208
|
+
|
|
288
209
|
## Use Cases
|
|
289
210
|
|
|
290
211
|
### 🚀 Continuous Integration
|
|
@@ -336,103 +257,6 @@ tsdoc commit > .git/COMMIT_EDITMSG
|
|
|
336
257
|
}
|
|
337
258
|
```
|
|
338
259
|
|
|
339
|
-
## Advanced Features
|
|
340
|
-
|
|
341
|
-
### Multi-Module Projects
|
|
342
|
-
|
|
343
|
-
tsdoc automatically detects and documents multi-module projects:
|
|
344
|
-
|
|
345
|
-
```typescript
|
|
346
|
-
const aiDoc = new AiDoc();
|
|
347
|
-
await aiDoc.start();
|
|
348
|
-
|
|
349
|
-
// Process main project
|
|
350
|
-
await aiDoc.buildReadme('./');
|
|
351
|
-
|
|
352
|
-
// Process submodules
|
|
353
|
-
for (const module of ['packages/core', 'packages/cli']) {
|
|
354
|
-
await aiDoc.buildReadme(module);
|
|
355
|
-
}
|
|
356
|
-
|
|
357
|
-
await aiDoc.stop();
|
|
358
|
-
```
|
|
359
|
-
|
|
360
|
-
### Custom Context Building
|
|
361
|
-
|
|
362
|
-
Fine-tune what gets sent to AI with task-specific contexts:
|
|
363
|
-
|
|
364
|
-
```typescript
|
|
365
|
-
import { TaskContextFactory } from '@git.zone/tsdoc';
|
|
366
|
-
|
|
367
|
-
const factory = new TaskContextFactory('./');
|
|
368
|
-
await factory.initialize();
|
|
369
|
-
|
|
370
|
-
// Get optimized context for specific tasks
|
|
371
|
-
const readmeContext = await factory.createContextForReadme();
|
|
372
|
-
const commitContext = await factory.createContextForCommit();
|
|
373
|
-
const descContext = await factory.createContextForDescription();
|
|
374
|
-
```
|
|
375
|
-
|
|
376
|
-
### Dependency Graph Analysis
|
|
377
|
-
|
|
378
|
-
Understand your codebase structure:
|
|
379
|
-
|
|
380
|
-
```typescript
|
|
381
|
-
import { ContextAnalyzer } from '@git.zone/tsdoc';
|
|
382
|
-
|
|
383
|
-
const analyzer = new ContextAnalyzer('./');
|
|
384
|
-
const analysis = await analyzer.analyze(metadata, 'readme');
|
|
385
|
-
|
|
386
|
-
// Explore dependency graph
|
|
387
|
-
for (const [path, deps] of analysis.dependencyGraph) {
|
|
388
|
-
console.log(`${path}:`);
|
|
389
|
-
console.log(` Imports: ${deps.imports.length}`);
|
|
390
|
-
console.log(` Imported by: ${deps.importedBy.length}`);
|
|
391
|
-
console.log(` Centrality: ${deps.centrality.toFixed(3)}`);
|
|
392
|
-
}
|
|
393
|
-
```
|
|
394
|
-
|
|
395
|
-
## Performance & Optimization
|
|
396
|
-
|
|
397
|
-
### ⚡ Performance Features
|
|
398
|
-
|
|
399
|
-
- **Lazy Loading** - Files scanned for metadata before content loading
|
|
400
|
-
- **Parallel Processing** - Multiple files loaded simultaneously
|
|
401
|
-
- **Smart Caching** - Results cached with mtime-based invalidation
|
|
402
|
-
- **Incremental Updates** - Only reprocess changed files
|
|
403
|
-
- **Streaming** - Minimal memory footprint
|
|
404
|
-
|
|
405
|
-
### 💰 Cost Optimization
|
|
406
|
-
|
|
407
|
-
The smart context system significantly reduces AI API costs:
|
|
408
|
-
|
|
409
|
-
```typescript
|
|
410
|
-
// Check token usage before and after optimization
|
|
411
|
-
import { EnhancedContext } from '@git.zone/tsdoc';
|
|
412
|
-
|
|
413
|
-
const context = new EnhancedContext('./');
|
|
414
|
-
await context.initialize();
|
|
415
|
-
|
|
416
|
-
// Build with analyzer enabled
|
|
417
|
-
const result = await context.buildContext('readme');
|
|
418
|
-
console.log(`Tokens: ${result.tokenCount}`);
|
|
419
|
-
console.log(`Savings: ${result.tokenSavings} (${(result.tokenSavings/result.tokenCount*100).toFixed(1)}%)`);
|
|
420
|
-
```
|
|
421
|
-
|
|
422
|
-
### 📊 Token Analysis
|
|
423
|
-
|
|
424
|
-
Monitor and optimize your token usage:
|
|
425
|
-
|
|
426
|
-
```bash
|
|
427
|
-
# Analyze current token usage
|
|
428
|
-
tsdoc tokens
|
|
429
|
-
|
|
430
|
-
# Compare modes
|
|
431
|
-
tsdoc tokens --mode full # No optimization
|
|
432
|
-
tsdoc tokens --mode trimmed # Standard optimization
|
|
433
|
-
tsdoc tokens --analyze # With smart prioritization
|
|
434
|
-
```
|
|
435
|
-
|
|
436
260
|
## Requirements
|
|
437
261
|
|
|
438
262
|
- **Node.js** >= 18.0.0
|
|
@@ -446,21 +270,15 @@ tsdoc tokens --analyze # With smart prioritization
|
|
|
446
270
|
If you hit token limits, try:
|
|
447
271
|
|
|
448
272
|
```bash
|
|
449
|
-
# Enable smart analyzer (default)
|
|
450
|
-
tsdoc aidoc
|
|
451
|
-
|
|
452
|
-
# Use aggressive trimming
|
|
453
|
-
tsdoc aidoc --trim
|
|
454
|
-
|
|
455
273
|
# Check token usage details
|
|
456
|
-
tsdoc tokens --all --
|
|
274
|
+
tsdoc tokens --all --detailed
|
|
457
275
|
```
|
|
458
276
|
|
|
459
|
-
Or configure stricter limits
|
|
277
|
+
Or configure stricter limits in `npmextra.json`:
|
|
460
278
|
|
|
461
279
|
```json
|
|
462
280
|
{
|
|
463
|
-
"tsdoc": {
|
|
281
|
+
"@git.zone/tsdoc": {
|
|
464
282
|
"context": {
|
|
465
283
|
"maxTokens": 100000,
|
|
466
284
|
"tiers": {
|
|
@@ -484,19 +302,16 @@ tsdoc aidoc
|
|
|
484
302
|
|
|
485
303
|
### Slow Performance
|
|
486
304
|
|
|
487
|
-
Enable caching and adjust settings
|
|
305
|
+
Enable caching and adjust settings in `npmextra.json`:
|
|
488
306
|
|
|
489
307
|
```json
|
|
490
308
|
{
|
|
491
|
-
"tsdoc": {
|
|
309
|
+
"@git.zone/tsdoc": {
|
|
492
310
|
"context": {
|
|
493
311
|
"cache": {
|
|
494
312
|
"enabled": true,
|
|
495
313
|
"ttl": 7200,
|
|
496
314
|
"maxSize": 200
|
|
497
|
-
},
|
|
498
|
-
"analyzer": {
|
|
499
|
-
"enabled": true
|
|
500
315
|
}
|
|
501
316
|
}
|
|
502
317
|
}
|
|
@@ -525,9 +340,6 @@ Regenerate documentation with every change. Smart dependency analysis ensures no
|
|
|
525
340
|
### 🎨 Beautiful Output
|
|
526
341
|
Clean, professional documentation every time. AI understands your code's purpose and explains it clearly.
|
|
527
342
|
|
|
528
|
-
### 🛠️ Developer-Friendly
|
|
529
|
-
Built by developers, for developers. Sensible defaults, powerful configuration, and extensive programmatic API.
|
|
530
|
-
|
|
531
343
|
### 💰 Cost-Effective
|
|
532
344
|
Smart context optimization reduces AI API costs by 40-60% without sacrificing quality.
|
|
533
345
|
|
|
@@ -545,6 +357,7 @@ Smart context optimization reduces AI API costs by 40-60% without sacrificing qu
|
|
|
545
357
|
│ ├── ContextCache # Performance caching
|
|
546
358
|
│ ├── ContextAnalyzer # Intelligent file analysis
|
|
547
359
|
│ ├── ContextTrimmer # Adaptive code trimming
|
|
360
|
+
│ ├── DiffProcessor # Git diff optimization
|
|
548
361
|
│ ├── ConfigManager # Configuration management
|
|
549
362
|
│ └── TaskContextFactory # Task-specific contexts
|
|
550
363
|
└── CLI # Command-line interface
|
|
@@ -567,30 +380,28 @@ ContextTrimmer (tier-based)
|
|
|
567
380
|
↓
|
|
568
381
|
Token Budget (enforcement)
|
|
569
382
|
↓
|
|
570
|
-
AI Model
|
|
383
|
+
AI Model
|
|
571
384
|
↓
|
|
572
385
|
Generated Documentation
|
|
573
386
|
```
|
|
574
387
|
|
|
575
|
-
## Contributing
|
|
576
|
-
|
|
577
|
-
We appreciate your interest! However, we are not accepting external contributions at this time. If you find bugs or have feature requests, please open an issue.
|
|
578
|
-
|
|
579
388
|
## License and Legal Information
|
|
580
389
|
|
|
581
|
-
This repository contains open-source code
|
|
390
|
+
This repository contains open-source code licensed under the MIT License. A copy of the license can be found in the [LICENSE](./LICENSE) file.
|
|
582
391
|
|
|
583
392
|
**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.
|
|
584
393
|
|
|
585
394
|
### Trademarks
|
|
586
395
|
|
|
587
|
-
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.
|
|
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 or third parties, and are not included within the scope of the MIT license granted herein.
|
|
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.
|
|
588
399
|
|
|
589
400
|
### Company Information
|
|
590
401
|
|
|
591
402
|
Task Venture Capital GmbH
|
|
592
|
-
Registered at District
|
|
403
|
+
Registered at District Court Bremen HRB 35230 HB, Germany
|
|
593
404
|
|
|
594
|
-
For any legal inquiries or
|
|
405
|
+
For any legal inquiries or further information, please contact us via email at hello@task.vc.
|
|
595
406
|
|
|
596
407
|
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.
|
|
@@ -175,8 +175,8 @@ Never mention CLAUDE code, or codex.
|
|
|
175
175
|
|
|
176
176
|
const previousChangelogPath = plugins.path.join(this.projectDir, 'changelog.md');
|
|
177
177
|
let previousChangelog: plugins.smartfile.SmartFile;
|
|
178
|
-
if (await plugins.
|
|
179
|
-
previousChangelog = await plugins.
|
|
178
|
+
if (await plugins.fsInstance.file(previousChangelogPath).exists()) {
|
|
179
|
+
previousChangelog = await plugins.smartfileFactory.fromFilePath(previousChangelogPath);
|
|
180
180
|
}
|
|
181
181
|
|
|
182
182
|
if (!previousChangelog) {
|
|
@@ -207,7 +207,7 @@ ${JSON.stringify(commitMessages, null, 2)}
|
|
|
207
207
|
`,
|
|
208
208
|
});
|
|
209
209
|
|
|
210
|
-
previousChangelog =
|
|
210
|
+
previousChangelog = plugins.smartfileFactory.fromString(
|
|
211
211
|
previousChangelogPath,
|
|
212
212
|
result2.message.replaceAll('```markdown', '').replaceAll('```', ''),
|
|
213
213
|
'utf8'
|
|
@@ -65,8 +65,8 @@ Don't wrap the JSON in three ticks json!!!
|
|
|
65
65
|
const npmextraJson = files.smartfilesNpmextraJSON;
|
|
66
66
|
const npmextraJsonContent = JSON.parse(npmextraJson.contents.toString());
|
|
67
67
|
|
|
68
|
-
npmextraJsonContent.
|
|
69
|
-
npmextraJsonContent.
|
|
68
|
+
npmextraJsonContent['@git.zone/cli'].module.description = resultObject.description;
|
|
69
|
+
npmextraJsonContent['@git.zone/cli'].module.keywords = resultObject.keywords;
|
|
70
70
|
|
|
71
71
|
npmextraJson.contents = Buffer.from(JSON.stringify(npmextraJsonContent, null, 2));
|
|
72
72
|
await npmextraJson.write();
|
|
@@ -13,31 +13,29 @@ export class ProjectContext {
|
|
|
13
13
|
}
|
|
14
14
|
|
|
15
15
|
public async gatherFiles() {
|
|
16
|
-
const smartfilePackageJSON = await plugins.
|
|
16
|
+
const smartfilePackageJSON = await plugins.smartfileFactory.fromFilePath(
|
|
17
17
|
plugins.path.join(this.projectDir, 'package.json'),
|
|
18
18
|
this.projectDir,
|
|
19
19
|
);
|
|
20
|
-
const smartfilesReadme = await plugins.
|
|
20
|
+
const smartfilesReadme = await plugins.smartfileFactory.fromFilePath(
|
|
21
21
|
plugins.path.join(this.projectDir, 'readme.md'),
|
|
22
22
|
this.projectDir,
|
|
23
23
|
);
|
|
24
24
|
|
|
25
|
-
const smartfilesReadmeHints = await plugins.
|
|
25
|
+
const smartfilesReadmeHints = await plugins.smartfileFactory.fromFilePath(
|
|
26
26
|
plugins.path.join(this.projectDir, 'readme.hints.md'),
|
|
27
27
|
this.projectDir,
|
|
28
28
|
);
|
|
29
|
-
const smartfilesNpmextraJSON = await plugins.
|
|
29
|
+
const smartfilesNpmextraJSON = await plugins.smartfileFactory.fromFilePath(
|
|
30
30
|
plugins.path.join(this.projectDir, 'npmextra.json'),
|
|
31
31
|
this.projectDir,
|
|
32
32
|
);
|
|
33
|
-
const smartfilesMod = await plugins.
|
|
33
|
+
const smartfilesMod = await plugins.smartfileFactory.virtualDirectoryFromPath(
|
|
34
34
|
this.projectDir,
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
const smartfilesTest = await plugins.smartfile.fs.fileTreeToObject(
|
|
35
|
+
).then(vd => vd.filter(f => f.relative.startsWith('ts') && f.relative.endsWith('.ts')).listFiles());
|
|
36
|
+
const smartfilesTest = await plugins.smartfileFactory.virtualDirectoryFromPath(
|
|
38
37
|
this.projectDir,
|
|
39
|
-
|
|
40
|
-
);
|
|
38
|
+
).then(vd => vd.filter(f => f.relative.startsWith('test/') && f.relative.endsWith('.ts')).listFiles());
|
|
41
39
|
return {
|
|
42
40
|
smartfilePackageJSON,
|
|
43
41
|
smartfilesReadme,
|
|
@@ -36,7 +36,7 @@ export class Readme {
|
|
|
36
36
|
const npmExtraJson = JSON.parse(
|
|
37
37
|
(await projectContext.gatherFiles()).smartfilesNpmextraJSON.contents.toString()
|
|
38
38
|
);
|
|
39
|
-
const legalInfo = npmExtraJson?.tsdoc?.legal;
|
|
39
|
+
const legalInfo = npmExtraJson?.['@git.zone/tsdoc']?.legal;
|
|
40
40
|
if (!legalInfo) {
|
|
41
41
|
const error = new Error(`No legal information found in npmextra.json`);
|
|
42
42
|
console.log(error);
|
|
@@ -105,7 +105,7 @@ The Readme should follow the following template:
|
|
|
105
105
|
|
|
106
106
|
IMPORTANT: YOU ARE NOW CREATING THE README FOR THE FOLLOWING SUB MODULE: ${subModule} !!!!!!!!!!!
|
|
107
107
|
The Sub Module will be published with the following data:
|
|
108
|
-
${JSON.stringify(plugins.
|
|
108
|
+
${JSON.stringify(await plugins.fsInstance.file(plugins.path.join(paths.cwd, subModule, 'tspublish.json')).encoding('utf8').read(), null, 2)}
|
|
109
109
|
|
|
110
110
|
|
|
111
111
|
The Readme should follow the following template:
|
|
@@ -147,7 +147,7 @@ The Readme should follow the following template:
|
|
|
147
147
|
});
|
|
148
148
|
|
|
149
149
|
const subModuleReadmeString = result.message + '\n' + legalInfo;
|
|
150
|
-
await plugins.
|
|
150
|
+
await plugins.fsInstance.file(plugins.path.join(paths.cwd, subModule, 'readme.md')).encoding('utf8').write(subModuleReadmeString);
|
|
151
151
|
logger.log('success', `Built readme for ${subModule}`);
|
|
152
152
|
}
|
|
153
153
|
return result.message;
|
package/ts/classes.aidoc.ts
CHANGED
|
@@ -36,9 +36,25 @@ export class AiDoc {
|
|
|
36
36
|
this.aidocInteract = new plugins.smartinteract.SmartInteract();
|
|
37
37
|
this.qenvInstance = new plugins.qenv.Qenv();
|
|
38
38
|
if (!(await this.qenvInstance.getEnvVarOnDemand('OPENAI_TOKEN'))) {
|
|
39
|
+
// Migrate old KV store path to new path if needed
|
|
40
|
+
const homeDir = plugins.smartpath.get.home();
|
|
41
|
+
const oldKvPath = plugins.path.join(homeDir, '.npmextra/kv/tsdoc.json');
|
|
42
|
+
const newKvDir = plugins.path.join(homeDir, '.npmextra/kv/@git.zone');
|
|
43
|
+
const newKvPath = plugins.path.join(newKvDir, 'tsdoc.json');
|
|
44
|
+
if (
|
|
45
|
+
await plugins.fsInstance.file(oldKvPath).exists() &&
|
|
46
|
+
!(await plugins.fsInstance.file(newKvPath).exists())
|
|
47
|
+
) {
|
|
48
|
+
console.log('Migrating tsdoc KeyValueStore to @git.zone/tsdoc...');
|
|
49
|
+
await plugins.fsInstance.directory(newKvDir).recursive().create();
|
|
50
|
+
await plugins.fsInstance.file(oldKvPath).copy(newKvPath);
|
|
51
|
+
await plugins.fsInstance.file(oldKvPath).delete();
|
|
52
|
+
console.log('Migration complete: tsdoc.json -> @git.zone/tsdoc.json');
|
|
53
|
+
}
|
|
54
|
+
|
|
39
55
|
this.npmextraKV = new plugins.npmextra.KeyValueStore({
|
|
40
56
|
typeArg: 'userHomeDir',
|
|
41
|
-
identityArg: 'tsdoc',
|
|
57
|
+
identityArg: '@git.zone/tsdoc',
|
|
42
58
|
mandatoryKeys: ['OPENAI_TOKEN'],
|
|
43
59
|
});
|
|
44
60
|
|
package/ts/classes.typedoc.ts
CHANGED
|
@@ -33,19 +33,19 @@ export class TypeDoc {
|
|
|
33
33
|
include: [],
|
|
34
34
|
};
|
|
35
35
|
let startDirectory = '';
|
|
36
|
-
if (plugins.
|
|
36
|
+
if (await plugins.fsInstance.directory(plugins.path.join(paths.cwd, './ts')).exists()) {
|
|
37
37
|
data.include.push(plugins.path.join(paths.cwd, './ts/**/*'));
|
|
38
38
|
startDirectory = 'ts';
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
if (plugins.
|
|
41
|
+
if (await plugins.fsInstance.directory(plugins.path.join(paths.cwd, './ts_web')).exists()) {
|
|
42
42
|
data.include.push(plugins.path.join(paths.cwd, './ts_web/**/*'));
|
|
43
43
|
if (!startDirectory) {
|
|
44
44
|
startDirectory = 'ts_web';
|
|
45
45
|
}
|
|
46
46
|
}
|
|
47
47
|
|
|
48
|
-
await plugins.
|
|
48
|
+
await plugins.fsInstance.file(paths.tsconfigFile).encoding('utf8').write(JSON.stringify(data));
|
|
49
49
|
let targetDir = paths.publicDir;
|
|
50
50
|
if (options?.publicSubdir) {
|
|
51
51
|
targetDir = plugins.path.join(targetDir, options.publicSubdir);
|
|
@@ -53,6 +53,6 @@ export class TypeDoc {
|
|
|
53
53
|
await this.smartshellInstance.exec(
|
|
54
54
|
`typedoc --tsconfig ${paths.tsconfigFile} --out ${targetDir} ${startDirectory}/index.ts`,
|
|
55
55
|
);
|
|
56
|
-
plugins.
|
|
56
|
+
await plugins.fsInstance.file(paths.tsconfigFile).delete();
|
|
57
57
|
}
|
|
58
58
|
}
|
package/ts/cli.ts
CHANGED
|
@@ -152,7 +152,7 @@ export const run = async () => {
|
|
|
152
152
|
tsdocCli.addCommand('test').subscribe((argvArg) => {
|
|
153
153
|
tsdocCli.triggerCommand('typedoc', argvArg);
|
|
154
154
|
process.on('exit', async () => {
|
|
155
|
-
await plugins.
|
|
155
|
+
await plugins.fsInstance.directory(paths.publicDir).recursive().delete();
|
|
156
156
|
});
|
|
157
157
|
});
|
|
158
158
|
|
|
@@ -122,7 +122,7 @@ export class ConfigManager {
|
|
|
122
122
|
const npmextraJsonPath = plugins.path.join(this.projectDir, 'npmextra.json');
|
|
123
123
|
|
|
124
124
|
// Check if file exists
|
|
125
|
-
const fileExists = await plugins.
|
|
125
|
+
const fileExists = await plugins.fsInstance.file(npmextraJsonPath).exists();
|
|
126
126
|
if (!fileExists) {
|
|
127
127
|
return;
|
|
128
128
|
}
|
|
@@ -138,13 +138,13 @@ export class ConfigManager {
|
|
|
138
138
|
}
|
|
139
139
|
|
|
140
140
|
// Read the npmextra.json file
|
|
141
|
-
const npmextraJsonFile = await plugins.
|
|
141
|
+
const npmextraJsonFile = await plugins.smartfileFactory.fromFilePath(npmextraJsonPath);
|
|
142
142
|
const npmextraContent = JSON.parse(npmextraJsonFile.contents.toString());
|
|
143
143
|
|
|
144
144
|
// Check for tsdoc context configuration
|
|
145
|
-
if (npmextraContent?.tsdoc?.context) {
|
|
145
|
+
if (npmextraContent?.['@git.zone/tsdoc']?.context) {
|
|
146
146
|
// Merge with default config
|
|
147
|
-
this.config = this.mergeConfigs(this.config, npmextraContent.tsdoc.context);
|
|
147
|
+
this.config = this.mergeConfigs(this.config, npmextraContent['@git.zone/tsdoc'].context);
|
|
148
148
|
}
|
|
149
149
|
|
|
150
150
|
// Cache the config
|
|
@@ -292,8 +292,8 @@ export class ConfigManager {
|
|
|
292
292
|
const npmextraJsonPath = plugins.path.join(this.projectDir, 'npmextra.json');
|
|
293
293
|
let npmextraContent = {};
|
|
294
294
|
|
|
295
|
-
if (await plugins.
|
|
296
|
-
const npmextraJsonFile = await plugins.
|
|
295
|
+
if (await plugins.fsInstance.file(npmextraJsonPath).exists()) {
|
|
296
|
+
const npmextraJsonFile = await plugins.smartfileFactory.fromFilePath(npmextraJsonPath);
|
|
297
297
|
npmextraContent = JSON.parse(npmextraJsonFile.contents.toString()) || {};
|
|
298
298
|
}
|
|
299
299
|
|
|
@@ -304,7 +304,7 @@ export class ConfigManager {
|
|
|
304
304
|
|
|
305
305
|
// Write back to npmextra.json
|
|
306
306
|
const updatedContent = JSON.stringify(npmextraContent, null, 2);
|
|
307
|
-
await plugins.
|
|
307
|
+
await plugins.fsInstance.file(npmextraJsonPath).encoding('utf8').write(updatedContent);
|
|
308
308
|
} catch (error) {
|
|
309
309
|
console.error('Error updating context configuration:', error);
|
|
310
310
|
}
|
|
@@ -116,7 +116,7 @@ export class ContextAnalyzer {
|
|
|
116
116
|
// Parse imports from each file
|
|
117
117
|
for (const meta of metadata) {
|
|
118
118
|
try {
|
|
119
|
-
const contents = await plugins.
|
|
119
|
+
const contents = await plugins.fsInstance.file(meta.path).encoding('utf8').read() as string;
|
|
120
120
|
const imports = this.extractImports(contents, meta.path);
|
|
121
121
|
|
|
122
122
|
const deps = graph.get(meta.path)!;
|
|
@@ -39,13 +39,13 @@ export class ContextCache {
|
|
|
39
39
|
}
|
|
40
40
|
|
|
41
41
|
// Ensure cache directory exists
|
|
42
|
-
await plugins.
|
|
42
|
+
await plugins.fsInstance.directory(this.cacheDir).recursive().create();
|
|
43
43
|
|
|
44
44
|
// Load cache index if it exists
|
|
45
45
|
try {
|
|
46
|
-
const indexExists = await plugins.
|
|
46
|
+
const indexExists = await plugins.fsInstance.file(this.cacheIndexPath).exists();
|
|
47
47
|
if (indexExists) {
|
|
48
|
-
const indexContent = await plugins.
|
|
48
|
+
const indexContent = await plugins.fsInstance.file(this.cacheIndexPath).encoding('utf8').read() as string;
|
|
49
49
|
const indexData = JSON.parse(indexContent) as ICacheEntry[];
|
|
50
50
|
if (Array.isArray(indexData)) {
|
|
51
51
|
for (const entry of indexData) {
|
|
@@ -278,7 +278,7 @@ export class ContextCache {
|
|
|
278
278
|
try {
|
|
279
279
|
const entries = Array.from(this.cache.values());
|
|
280
280
|
const content = JSON.stringify(entries, null, 2);
|
|
281
|
-
await plugins.
|
|
281
|
+
await plugins.fsInstance.file(this.cacheIndexPath).encoding('utf8').write(content);
|
|
282
282
|
} catch (error) {
|
|
283
283
|
console.warn('Failed to persist cache index:', error.message);
|
|
284
284
|
}
|
|
@@ -120,7 +120,7 @@ export class EnhancedContext {
|
|
|
120
120
|
originalTokenCount = cached.tokenCount;
|
|
121
121
|
} else {
|
|
122
122
|
// Load file
|
|
123
|
-
const fileData = await plugins.
|
|
123
|
+
const fileData = await plugins.fsInstance.file(fileAnalysis.path).encoding('utf8').read() as string;
|
|
124
124
|
contents = fileData;
|
|
125
125
|
originalTokenCount = this.countTokens(contents);
|
|
126
126
|
|