task-summary-extractor 8.3.0 → 9.0.1

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.
Files changed (46) hide show
  1. package/.env.example +38 -0
  2. package/ARCHITECTURE.md +99 -3
  3. package/EXPLORATION.md +148 -89
  4. package/QUICK_START.md +5 -2
  5. package/README.md +51 -7
  6. package/bin/taskex.js +11 -4
  7. package/package.json +38 -5
  8. package/prompt.json +2 -2
  9. package/src/config.js +52 -3
  10. package/src/logger.js +7 -4
  11. package/src/modes/focused-reanalysis.js +2 -1
  12. package/src/modes/progress-updater.js +1 -1
  13. package/src/phases/_shared.js +43 -0
  14. package/src/phases/compile.js +101 -0
  15. package/src/phases/deep-dive.js +118 -0
  16. package/src/phases/discover.js +178 -0
  17. package/src/phases/init.js +199 -0
  18. package/src/phases/output.js +238 -0
  19. package/src/phases/process-media.js +633 -0
  20. package/src/phases/services.js +104 -0
  21. package/src/phases/summary.js +86 -0
  22. package/src/pipeline.js +432 -1464
  23. package/src/renderers/docx.js +531 -0
  24. package/src/renderers/html.js +672 -0
  25. package/src/renderers/markdown.js +15 -183
  26. package/src/renderers/pdf.js +90 -0
  27. package/src/renderers/shared.js +215 -0
  28. package/src/schemas/analysis-compiled.schema.json +381 -0
  29. package/src/schemas/analysis-segment.schema.json +380 -0
  30. package/src/services/doc-parser.js +346 -0
  31. package/src/services/gemini.js +118 -45
  32. package/src/services/video.js +123 -8
  33. package/src/utils/adaptive-budget.js +6 -4
  34. package/src/utils/checkpoint.js +2 -1
  35. package/src/utils/cli.js +132 -111
  36. package/src/utils/colors.js +83 -0
  37. package/src/utils/confidence-filter.js +139 -0
  38. package/src/utils/diff-engine.js +2 -1
  39. package/src/utils/global-config.js +6 -5
  40. package/src/utils/health-dashboard.js +11 -9
  41. package/src/utils/json-parser.js +4 -2
  42. package/src/utils/learning-loop.js +3 -2
  43. package/src/utils/progress-bar.js +286 -0
  44. package/src/utils/quality-gate.js +10 -8
  45. package/src/utils/retry.js +3 -1
  46. package/src/utils/schema-validator.js +314 -0
package/.env.example ADDED
@@ -0,0 +1,38 @@
1
+ # ======================== FIREBASE ========================
2
+ FIREBASE_API_KEY=your_firebase_api_key
3
+ FIREBASE_AUTH_DOMAIN=your-project.firebaseapp.com
4
+ FIREBASE_PROJECT_ID=your-project
5
+ FIREBASE_STORAGE_BUCKET=your-project.appspot.com
6
+ FIREBASE_MESSAGING_SENDER_ID=1234567890
7
+ FIREBASE_APP_ID=1:1234567890:web:abc123
8
+ FIREBASE_MEASUREMENT_ID=G-XXXXXXXXXX
9
+
10
+ # ======================== GEMINI AI ========================
11
+ GEMINI_API_KEY=your_gemini_api_key
12
+ GEMINI_MODEL=gemini-2.5-flash
13
+
14
+ # ======================== VIDEO PROCESSING ========================
15
+ # Speed multiplier (default: 1.5)
16
+ VIDEO_SPEED=1.5
17
+ # Segment duration in seconds (default: 280)
18
+ VIDEO_SEGMENT_TIME=280
19
+ # ffmpeg preset: ultrafast, superfast, veryfast, faster, fast, medium, slow, slower, veryslow
20
+ VIDEO_PRESET=slow
21
+
22
+ # ======================== PIPELINE ========================
23
+ # Log level: debug, info, warn, error (default: info)
24
+ LOG_LEVEL=info
25
+ # Max concurrent uploads (default: 3)
26
+ MAX_PARALLEL_UPLOADS=3
27
+ # Max retries for API calls (default: 3)
28
+ MAX_RETRIES=3
29
+ # Retry base delay in ms (default: 2000)
30
+ RETRY_BASE_DELAY_MS=2000
31
+
32
+ # ======================== GEMINI TUNING ========================
33
+ # Thinking token budget per segment analysis (default: 24576)
34
+ THINKING_BUDGET=24576
35
+ # Thinking token budget for final compilation (default: 10240)
36
+ COMPILATION_THINKING_BUDGET=10240
37
+ # Max polling time for Gemini File API processing in ms (default: 300000 = 5 min)
38
+ GEMINI_POLL_TIMEOUT_MS=300000
package/ARCHITECTURE.md CHANGED
@@ -74,6 +74,7 @@ flowchart TB
74
74
  FB["firebase.js"]
75
75
  VID["video.js"]
76
76
  GIT["git.js"]
77
+ DP["doc-parser.js"]
77
78
  end
78
79
 
79
80
  subgraph Utils["Utilities"]
@@ -97,6 +98,10 @@ flowchart TB
97
98
 
98
99
  subgraph Renderers["Renderers"]
99
100
  MD["markdown.js"]
101
+ HTML["html.js"]
102
+ PDF["pdf.js"]
103
+ DOCX["docx.js"]
104
+ SHARED["shared.js"]
100
105
  end
101
106
 
102
107
  EP --> Pipeline
@@ -123,7 +128,7 @@ flowchart TB
123
128
  | 3 | **Services** | Firebase auth, Gemini init, prepare document parts |
124
129
  | 4 | **Process** | Compress → Upload → Analyze → Quality Gate → Retry → Focused Pass |
125
130
  | 5 | **Compile** | Cross-segment compilation, diff engine comparison |
126
- | 6 | **Output** | Write JSON, render Markdown, upload to Firebase |
131
+ | 6 | **Output** | Write JSON, render Markdown + HTML, upload to Firebase |
127
132
  | 7 | **Health** | Quality metrics dashboard, cost breakdown |
128
133
  | 8 | **Summary** | Save learning history, print run summary |
129
134
  | 9 | **Deep Dive** | (optional, `--deep-dive`) Topic discovery + explanatory document generation |
@@ -170,6 +175,7 @@ flowchart LR
170
175
  subgraph P6["Phase 6: Output"]
171
176
  JSON["results.json"]
172
177
  MDR["results.md"]
178
+ HTMLR["results.html"]
173
179
  FBU["Firebase upload"]
174
180
  end
175
181
 
@@ -505,7 +511,10 @@ taskex --dynamic --request "Document this microservices architecture"
505
511
  | `.vtt` `.srt` `.txt` `.md` `.csv` | Inline text | Read and passed directly as text parts |
506
512
  | `.pdf` | Gemini File API | Uploaded as binary, Gemini processes natively |
507
513
  | `.mp3` `.wav` `.ogg` `.m4a` | Gemini File API | Uploaded as audio, Gemini processes natively |
508
- | `.docx` `.doc` | Firebase only | Uploaded for archival, not processable by Gemini |
514
+ | `.docx` | Doc parser (mammoth) | Converted to plain text, sent as inline text |
515
+ | `.xlsx` `.xls` | Doc parser (xlsx) | Converted to pipe-delimited tables, sent as inline text |
516
+ | `.doc` `.pptx` `.ppt` `.odt` `.odp` `.ods` `.rtf` `.epub` | Doc parser (officeparser) | Converted to plain text, sent as inline text |
517
+ | `.html` `.htm` | Doc parser (built-in) | HTML tags stripped, sent as inline text |
509
518
 
510
519
  Directories skipped during recursive discovery: `node_modules`, `.git`, `compressed`, `logs`, `gemini_runs`, `runs`
511
520
 
@@ -546,10 +555,15 @@ JSONL structured format includes phase spans with timing metrics for observabili
546
555
  | **Gemini AI** | `@google/genai@^1.42.0` | Video analysis, File API, 1M context window |
547
556
  | **Firebase** | `firebase@^12.9.0` | Anonymous auth + Cloud Storage uploads |
548
557
  | **dotenv** | `dotenv@^17.3.1` | Environment variable loading |
558
+ | **puppeteer** | `puppeteer` | HTML → PDF conversion for PDF output format |
559
+ | **docx** | `docx` | Programmatic Word document generation for DOCX output format |
560
+ | **mammoth** | `mammoth` | DOCX → plain text conversion |
561
+ | **xlsx** | `xlsx` | Excel spreadsheet parsing (XLSX/XLS) |
562
+ | **officeparser** | `officeparser` | DOC, PPTX, ODT, RTF, EPUB text extraction |
549
563
  | **ffmpeg** | System binary | H.264 video compression + segmentation |
550
564
  | **Git** | System binary | Change detection for progress tracking |
551
565
 
552
- **Codebase: 31 files · ~10,300 lines** · npm package: `task-summary-extractor` · CLI: `taskex`
566
+ **Codebase: ~45 files · ~13,000+ lines** · npm package: `task-summary-extractor` · CLI: `taskex`
553
567
 
554
568
  ---
555
569
 
@@ -601,6 +615,47 @@ When `usedExternalUrl` is `true`, the `fileUri` contains the Firebase Storage do
601
615
 
602
616
  ---
603
617
 
618
+ ## JSON Schema Validation
619
+
620
+ All AI output is validated against JSON Schema definitions in `src/schemas/`:
621
+
622
+ | Schema | File | Purpose |
623
+ |--------|------|---------|
624
+ | Segment analysis | `analysis-segment.schema.json` | Validates each segment's extracted data |
625
+ | Compiled analysis | `analysis-compiled.schema.json` | Validates the final cross-segment compilation |
626
+
627
+ Validation is performed by `src/utils/schema-validator.js` using [ajv](https://ajv.js.org/). Validation errors are reported as warnings with contextual hints for the retry/focused-pass cycle — they do not hard-fail the pipeline but are injected as corrective hints when the quality gate triggers a retry.
628
+
629
+ ---
630
+
631
+ ## Test Suite
632
+
633
+ The project includes a comprehensive test suite using [vitest](https://vitest.dev/):
634
+
635
+ | Metric | Value |
636
+ |--------|-------|
637
+ | Test files | 13 |
638
+ | Total tests | 285 |
639
+ | Framework | vitest v4.x |
640
+ | Coverage | `@vitest/coverage-v8` |
641
+
642
+ **Test categories:**
643
+
644
+ | Directory | What's Tested |
645
+ |-----------|---------------|
646
+ | `tests/utils/` | Utility modules: adaptive-budget, cli, confidence-filter, context-manager, diff-engine, format, json-parser, progress-bar, quality-gate, retry, schema-validator |
647
+ | `tests/renderers/` | Renderer modules: html, markdown |
648
+
649
+ **Commands:**
650
+
651
+ ```bash
652
+ npm test # Run all tests
653
+ npm run test:watch # Watch mode
654
+ npm run test:coverage # Coverage report
655
+ ```
656
+
657
+ ---
658
+
604
659
  ## See Also
605
660
 
606
661
  | Doc | What's In It |
@@ -608,3 +663,44 @@ When `usedExternalUrl` is `true`, the `fileUri` contains the Firebase Storage do
608
663
  | 📖 [README.md](README.md) | Setup, CLI flags, configuration, features |
609
664
  | 📖 [QUICK_START.md](QUICK_START.md) | Step-by-step first-time walkthrough |
610
665
  | 🔭 [EXPLORATION.md](EXPLORATION.md) | Module map, line counts, future roadmap |
666
+
667
+ ---
668
+
669
+ ## JSON Schema Validation
670
+
671
+ All AI output is validated against JSON Schema definitions in `src/schemas/`:
672
+
673
+ | Schema | File | Purpose |
674
+ |--------|------|---------|
675
+ | Segment analysis | `analysis-segment.schema.json` | Validates each segment's extracted data |
676
+ | Compiled analysis | `analysis-compiled.schema.json` | Validates the final cross-segment compilation |
677
+
678
+ Validation is performed by `src/utils/schema-validator.js` using [ajv](https://ajv.js.org/). Validation errors are reported as warnings with contextual hints for the retry/focused-pass cycle — they do not hard-fail the pipeline but are injected as corrective hints when the quality gate triggers a retry.
679
+
680
+ ---
681
+
682
+ ## Test Suite
683
+
684
+ The project includes a comprehensive test suite using [vitest](https://vitest.dev/):
685
+
686
+ | Metric | Value |
687
+ |--------|-------|
688
+ | Test files | 13 |
689
+ | Total tests | 285 |
690
+ | Framework | vitest v4.x |
691
+ | Coverage | `@vitest/coverage-v8` |
692
+
693
+ **Test categories:**
694
+
695
+ | Directory | What's Tested |
696
+ |-----------|---------------|
697
+ | `tests/utils/` | Utility modules: adaptive-budget, cli, confidence-filter, context-manager, diff-engine, format, json-parser, progress-bar, quality-gate, retry, schema-validator |
698
+ | `tests/renderers/` | Renderer modules: html, markdown |
699
+
700
+ **Commands:**
701
+
702
+ ```bash
703
+ npm test # Run all tests
704
+ npm run test:watch # Watch mode
705
+ npm run test:coverage # Coverage report
706
+ ```