faf-taf-git 2.0.4

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 (47) hide show
  1. package/.faf +126 -0
  2. package/.faf-dna +95 -0
  3. package/.fafignore +41 -0
  4. package/.taf +21 -0
  5. package/CHANGELOG.md +208 -0
  6. package/CLAUDE.md +30 -0
  7. package/CONTRIBUTING.md +286 -0
  8. package/LICENSE +21 -0
  9. package/README.md +496 -0
  10. package/action.yml +42 -0
  11. package/dist/bundle/index.js +36554 -0
  12. package/dist/cli.d.ts +31 -0
  13. package/dist/cli.d.ts.map +1 -0
  14. package/dist/cli.js +380 -0
  15. package/dist/cli.js.map +1 -0
  16. package/dist/index.d.ts +7 -0
  17. package/dist/index.d.ts.map +1 -0
  18. package/dist/index.js +36560 -0
  19. package/dist/index.js.map +1 -0
  20. package/dist/licenses.txt +148 -0
  21. package/dist/main.d.ts +7 -0
  22. package/dist/main.d.ts.map +1 -0
  23. package/dist/main.js +147 -0
  24. package/dist/main.js.map +1 -0
  25. package/dist/parsers/jest.d.ts +38 -0
  26. package/dist/parsers/jest.d.ts.map +1 -0
  27. package/dist/parsers/jest.js +87 -0
  28. package/dist/parsers/jest.js.map +1 -0
  29. package/dist/sourcemap-register.js +1 -0
  30. package/dist/taf-core.d.ts +12 -0
  31. package/dist/taf-core.d.ts.map +1 -0
  32. package/dist/taf-core.js +136 -0
  33. package/dist/taf-core.js.map +1 -0
  34. package/docs/RELEASE-NOTES.md +200 -0
  35. package/docs/USER-GUIDE.md +301 -0
  36. package/jest.config.js +13 -0
  37. package/package.json +47 -0
  38. package/project.faf +259 -0
  39. package/src/cli.ts +393 -0
  40. package/src/index.ts +131 -0
  41. package/src/parsers/jest.ts +104 -0
  42. package/src/taf-core.ts +139 -0
  43. package/test-mcp.ts +83 -0
  44. package/test-standalone.ts +87 -0
  45. package/tests/jest-parser.test.ts +122 -0
  46. package/tests/wjttc-taf.test.ts +470 -0
  47. package/tsconfig.json +18 -0
package/README.md ADDED
@@ -0,0 +1,496 @@
1
+ # faf-taf-git
2
+
3
+ **Platform-agnostic TAF (Testing Activity Feed) updater - works in ANY CI/CD**
4
+
5
+ Part of the Golden Triangle: `.faf` (what it is) + `repo` (implementation) + `.taf` (proof it works)
6
+
7
+ ---
8
+
9
+ ## 🎯 WHAT
10
+
11
+ **faf-taf-git** automatically generates `.taf` receipts from your test runs.
12
+
13
+ A `.taf` file is a git-tracked timeline of your testing history:
14
+ - Permanent proof of test quality
15
+ - Pass rate trends and failure patterns
16
+ - Integration with `.faf` project DNA
17
+ - Git-native accountability (no external services required)
18
+
19
+ **Example .taf entry:**
20
+ ```yaml
21
+ - timestamp: 2026-02-17T19:12:14.810Z
22
+ result: PASSED
23
+ tests:
24
+ total: 808
25
+ passed: 799
26
+ failed: 0
27
+ skipped: 9
28
+ trigger: github-actions
29
+ ```
30
+
31
+ ---
32
+
33
+ ## 👥 WHO
34
+
35
+ **For development teams who need:**
36
+ - Proof of testing over time (not just current state)
37
+ - Git-tracked test accountability (visible in PRs, commits, history)
38
+ - AI-readable test context (feeds into `.faf` project DNA)
39
+ - Platform-agnostic testing receipts (works in ANY CI/CD)
40
+
41
+ **Use cases:**
42
+ - Open source projects (prove your tests pass)
43
+ - Regulated industries (auditable test history)
44
+ - AI-augmented development (give AI your test timeline)
45
+ - Championship engineering (F1-grade accountability)
46
+
47
+ ---
48
+
49
+ ## 🤔 WHY
50
+
51
+ ### The Problem
52
+ Tests run, results disappear. No permanent record. No accountability.
53
+
54
+ **Before:**
55
+ ```
56
+ ✅ Tests passing (right now)
57
+ ❓ Were they passing yesterday?
58
+ ❓ When did that flaky test start failing?
59
+ ❓ What's the trend over time?
60
+ ```
61
+
62
+ **After (with .taf):**
63
+ ```
64
+ ✅ Tests passing (tracked in git)
65
+ ✅ History shows: 99% pass rate over 30 days
66
+ ✅ Flaky test identified: started failing Feb 10
67
+ ✅ Trend: improving (was 85%, now 99%)
68
+ ```
69
+
70
+ ### The Solution
71
+ **Git-native receipts.** Every test run becomes a permanent, auditable record.
72
+
73
+ `.taf` is software accountability - proof that your code works, tracked over time, visible to everyone.
74
+
75
+ ---
76
+
77
+ ## 📍 WHERE
78
+
79
+ Works in **ANY CI/CD** environment that runs Node.js:
80
+
81
+ | Platform | Status | Example |
82
+ |----------|--------|---------|
83
+ | **GitHub Actions** | ✅ Tested | See Quick Start |
84
+ | **GitLab CI** | ✅ Tested | `npx faf-taf-git --commit` |
85
+ | **Jenkins** | ✅ Compatible | `sh 'npx faf-taf-git --commit'` |
86
+ | **CircleCI** | ✅ Compatible | `run: npx faf-taf-git --commit` |
87
+ | **Bitbucket Pipelines** | ✅ Compatible | `npx faf-taf-git --commit` |
88
+ | **Travis CI** | ✅ Compatible | `npx faf-taf-git --commit` |
89
+ | **Azure Pipelines** | ✅ Compatible | `npx faf-taf-git --commit` |
90
+ | **Local development** | ✅ Works | `npm test && npx faf-taf-git` |
91
+ | **Pre-commit hooks** | ✅ Works | See Examples |
92
+
93
+ **Architecture:** Platform-agnostic core. No CI-specific dependencies. Pure functions.
94
+
95
+ ---
96
+
97
+ ## ⏰ WHEN
98
+
99
+ **Use faf-taf-git when you need:**
100
+
101
+ 1. **Proof of testing over time**
102
+ - Regulated industries (SOC 2, ISO, HIPAA)
103
+ - Open source credibility (show your tests pass)
104
+ - Client deliverables (prove quality)
105
+
106
+ 2. **AI-augmented development**
107
+ - Give AI your test history (feeds `.faf` format)
108
+ - AI can see: "Tests were 85% passing, now 99%"
109
+ - Better context = better AI assistance
110
+
111
+ 3. **Debugging flaky tests**
112
+ - Timeline shows when tests started failing
113
+ - Pattern detection (fails on Windows only, etc.)
114
+ - Root cause analysis with historical data
115
+
116
+ 4. **Team accountability**
117
+ - PRs show test impact (IMPROVED, DEGRADED, etc.)
118
+ - No hiding broken tests
119
+ - Git history = test history
120
+
121
+ **Don't use when:**
122
+ - You only need current test status (use a test reporter)
123
+ - You don't commit to git (TAF is git-native)
124
+ - You're not ready for accountability 😉
125
+
126
+ ---
127
+
128
+ ## 🚀 HOW
129
+
130
+ ### Quick Start (GitHub Actions)
131
+
132
+ **Step 1:** Create `.taf` file
133
+ ```bash
134
+ npm install -g faf-cli
135
+ faf taf init
136
+ ```
137
+
138
+ **Step 2:** Add to CI workflow
139
+ ```yaml
140
+ name: Tests
141
+
142
+ on:
143
+ push:
144
+ branches: [main]
145
+
146
+ jobs:
147
+ test:
148
+ runs-on: ubuntu-latest
149
+ permissions:
150
+ contents: write # Required for auto-commit
151
+
152
+ steps:
153
+ - uses: actions/checkout@v6
154
+
155
+ - name: Setup Node.js
156
+ uses: actions/setup-node@v6
157
+ with:
158
+ node-version: '20.x'
159
+
160
+ - name: Install dependencies
161
+ run: npm ci
162
+
163
+ - name: Build
164
+ run: npm run build
165
+
166
+ - name: Run Tests and Capture Output
167
+ run: npm test 2>&1 | tee test-output.txt
168
+
169
+ - name: Generate TAF Receipt
170
+ uses: Wolfe-Jam/faf-taf-git@v2.0.4
171
+ with:
172
+ test-output-file: test-output.txt
173
+ auto-commit: 'true'
174
+ commit-message: 'chore(taf): update .taf receipt [skip ci]'
175
+ ```
176
+
177
+ **Step 3:** Push and watch
178
+ - Tests run automatically
179
+ - `.taf` file updates with new entry
180
+ - Changes committed back to repo
181
+ - History tracked in git
182
+
183
+ ### Standalone CLI (Any Platform)
184
+
185
+ ```bash
186
+ # Run tests and update .taf
187
+ npm test 2>&1 | tee test-output.txt
188
+ npx faf-taf-git --file test-output.txt --commit
189
+
190
+ # Or in one command (legacy v1.x CLI)
191
+ npx faf-taf-git --command "npm test" --commit
192
+ ```
193
+
194
+ ### GitLab CI
195
+
196
+ ```yaml
197
+ test:
198
+ script:
199
+ - npm ci
200
+ - npm test 2>&1 | tee test-output.txt
201
+ - npx faf-taf-git --file test-output.txt --commit --message "ci: update .taf [skip ci]"
202
+ ```
203
+
204
+ ### Jenkins
205
+
206
+ ```groovy
207
+ stage('Test') {
208
+ steps {
209
+ sh 'npm ci'
210
+ sh 'npm test 2>&1 | tee test-output.txt'
211
+ sh 'npx faf-taf-git --file test-output.txt --commit'
212
+ }
213
+ }
214
+ ```
215
+
216
+ ### Local Development
217
+
218
+ ```bash
219
+ # Run tests and update .taf (no commit)
220
+ npm test 2>&1 | tee test-output.txt
221
+ npx faf-taf-git --file test-output.txt --verbose
222
+
223
+ # Pre-commit hook
224
+ #!/bin/bash
225
+ npm test 2>&1 | tee test-output.txt && npx faf-taf-git --file test-output.txt
226
+ ```
227
+
228
+ ---
229
+
230
+ ## 🎨 HOW IT WORKS
231
+
232
+ ### v2.0.0+ Architecture (Pre-Capture Pattern)
233
+
234
+ ```
235
+ Step 1: Run Tests Step 2: Generate Receipt
236
+ ┌─────────────────────┐ ┌──────────────────────┐
237
+ │ npm test 2>&1 | │ │ faf-taf-git reads │
238
+ │ tee test-output.txt │───────▶│ test-output.txt and │
239
+ │ │ │ updates .taf file │
240
+ └─────────────────────┘ └──────────────────────┘
241
+ ```
242
+
243
+ **Why separate steps?**
244
+ - Avoids GitHub Actions execution context corruption
245
+ - More reliable (tested 19 methods before this breakthrough)
246
+ - Platform-agnostic (works in ANY CI/CD)
247
+ - Simpler architecture (400+ lines removed)
248
+
249
+ **Process:**
250
+ 1. **Capture output** - `npm test 2>&1 | tee test-output.txt`
251
+ 2. **Parse results** - Extracts test counts from Jest output
252
+ 3. **Update .taf** - Appends new test run to timeline
253
+ 4. **Commit** - Optionally commits changes to git
254
+
255
+ ---
256
+
257
+ ## 📋 API
258
+
259
+ ### GitHub Action Inputs
260
+
261
+ | Input | Description | Default | Required |
262
+ |-------|-------------|---------|----------|
263
+ | `test-output-file` | Path to file containing test output | - | ✅ Yes |
264
+ | `auto-commit` | Automatically commit .taf updates | `true` | No |
265
+ | `commit-message` | Custom commit message | `chore(taf): update .taf receipt [skip ci]` | No |
266
+
267
+ ### GitHub Action Outputs
268
+
269
+ | Output | Description | Example |
270
+ |--------|-------------|---------|
271
+ | `result` | Test result | `PASSED`, `FAILED`, `IMPROVED`, `DEGRADED` |
272
+ | `passed` | Number of tests passed | `799` |
273
+ | `failed` | Number of tests failed | `0` |
274
+ | `total` | Total number of tests | `808` |
275
+ | `skipped` | Number of skipped tests | `9` |
276
+ | `taf-updated` | Whether .taf was updated | `true` or `false` |
277
+
278
+ ### CLI Options
279
+
280
+ ```bash
281
+ npx faf-taf-git [options]
282
+
283
+ Options:
284
+ --file <path> Path to test output file (v2.0.0+)
285
+ --command <cmd> Test command to run (legacy v1.x)
286
+ --commit Auto-commit .taf changes
287
+ --message <msg> Custom commit message
288
+ --cwd <dir> Working directory
289
+ --verbose, -v Verbose output
290
+ --help, -h Show help
291
+ ```
292
+
293
+ ---
294
+
295
+ ## 🧪 Test Framework Support
296
+
297
+ | Framework | Status | Notes |
298
+ |-----------|--------|-------|
299
+ | **Jest** | ✅ Fully supported | All output formats |
300
+ | Mocha | ⏳ Planned | - |
301
+ | Vitest | ⏳ Planned | - |
302
+ | Pytest | ⏳ Planned | - |
303
+ | Go test | ⏳ Planned | - |
304
+ | Rust cargo test | ⏳ Planned | - |
305
+
306
+ ---
307
+
308
+ ## 🎓 Examples
309
+
310
+ ### Using Outputs
311
+
312
+ ```yaml
313
+ - name: Generate TAF Receipt
314
+ id: taf
315
+ uses: Wolfe-Jam/faf-taf-git@v2.0.4
316
+ with:
317
+ test-output-file: test-output.txt
318
+
319
+ - name: Check Results
320
+ run: |
321
+ echo "Result: ${{ steps.taf.outputs.result }}"
322
+ echo "Tests: ${{ steps.taf.outputs.passed }}/${{ steps.taf.outputs.total }} passing"
323
+ if [ "${{ steps.taf.outputs.result }}" == "DEGRADED" ]; then
324
+ echo "⚠️ Test quality degraded!"
325
+ exit 1
326
+ fi
327
+ ```
328
+
329
+ ### CircleCI
330
+
331
+ ```yaml
332
+ version: 2.1
333
+
334
+ jobs:
335
+ test:
336
+ docker:
337
+ - image: node:20
338
+ steps:
339
+ - checkout
340
+ - run: npm ci
341
+ - run: npm test 2>&1 | tee test-output.txt
342
+ - run: npx faf-taf-git --file test-output.txt --commit
343
+ ```
344
+
345
+ ### Pre-commit Hook
346
+
347
+ ```bash
348
+ #!/bin/bash
349
+ # .git/hooks/pre-commit
350
+
351
+ # Run tests and capture output
352
+ npm test 2>&1 | tee test-output.txt
353
+ TEST_EXIT=$?
354
+
355
+ # Update .taf (don't commit yet - that's what the commit is for!)
356
+ npx faf-taf-git --file test-output.txt
357
+
358
+ # Exit with test status
359
+ exit $TEST_EXIT
360
+ ```
361
+
362
+ ---
363
+
364
+ ## 🏆 The Golden Triangle
365
+
366
+ Projects with `.faf` + `repo` + `.taf` are **engineered to succeed**:
367
+
368
+ ```
369
+ .faf
370
+ (WHAT IT IS)
371
+ / \
372
+ / \
373
+ / \
374
+ repo ←→ .taf
375
+ (IMPLEMENTATION) (PROOF IT WORKS)
376
+ ```
377
+
378
+ - **.faf** - Tells AI what the repo is (better than prose)
379
+ - **repo** - The implementation (code doesn't lie)
380
+ - **.taf** - Proves it works (receipts don't negotiate)
381
+
382
+ **Why this matters:**
383
+ - AI reads `.faf` to understand your project
384
+ - AI reads `.taf` to understand test quality
385
+ - Better context = better AI assistance
386
+ - Accountability built in
387
+
388
+ ---
389
+
390
+ ## 🔧 Development
391
+
392
+ ### Build
393
+ ```bash
394
+ npm run build
395
+ ```
396
+
397
+ ### Test
398
+ ```bash
399
+ npm test
400
+ ```
401
+
402
+ ### Package (GitHub Action)
403
+ ```bash
404
+ npm run package # Creates bundled dist/index.js
405
+ ```
406
+
407
+ ### Test Locally
408
+ ```bash
409
+ npm run build
410
+ node dist/cli.js --help
411
+ ```
412
+
413
+ ---
414
+
415
+ ## 📖 Migration from v1.x
416
+
417
+ **v2.0.0 is a breaking change** - the architecture was redesigned for reliability.
418
+
419
+ ### What Changed
420
+
421
+ **v1.x (test-command):**
422
+ ```yaml
423
+ - uses: Wolfe-Jam/faf-taf-git@v1
424
+ with:
425
+ test-command: npm test
426
+ ```
427
+
428
+ **v2.x (test-output-file):**
429
+ ```yaml
430
+ - run: npm test 2>&1 | tee test-output.txt
431
+
432
+ - uses: Wolfe-Jam/faf-taf-git@v2.0.4
433
+ with:
434
+ test-output-file: test-output.txt
435
+ ```
436
+
437
+ ### Why the Change
438
+
439
+ v1.x ran tests inside the action using `@actions/exec`. This caused:
440
+ - GitHub Actions execution context corruption
441
+ - Logging failures (tested 19 different methods)
442
+ - Filesystem operations failing silently
443
+ - Unreliable receipt generation
444
+
445
+ v2.0.0 uses **pre-capture pattern** - separate test execution from receipt generation. This is:
446
+ - ✅ More reliable (no execution context issues)
447
+ - ✅ Platform-agnostic (works everywhere)
448
+ - ✅ Simpler (400+ lines removed, 11KB smaller)
449
+ - ✅ Production-ready (tested thoroughly)
450
+
451
+ ### Migration Steps
452
+
453
+ 1. Update workflow to use `test-output-file` instead of `test-command`
454
+ 2. Add test output capture step: `npm test 2>&1 | tee test-output.txt`
455
+ 3. Update version to `@v2.0.4`
456
+
457
+ See [CHANGELOG.md](CHANGELOG.md) for complete version history.
458
+
459
+ ---
460
+
461
+ ## 🤝 Contributing
462
+
463
+ See [CONTRIBUTING.md](CONTRIBUTING.md) for development guidelines.
464
+
465
+ ---
466
+
467
+ ## 📚 Learn More
468
+
469
+ - [FAF CLI](https://npmjs.com/package/faf-cli) - Create and manage `.faf` files
470
+ - [MCP Server](https://npmjs.com/package/claude-faf-mcp) - Claude MCP integration
471
+ - [Website](https://faf.one) - Official FAF website
472
+ - [GitHub Discussions](https://github.com/Wolfe-Jam/faf/discussions) - Ask questions
473
+
474
+ ---
475
+
476
+ ## 📄 License
477
+
478
+ MIT - FREE FOREVER
479
+
480
+ ---
481
+
482
+ ## 💎 Philosophy
483
+
484
+ **Software Accountability**
485
+
486
+ This tool implements a paradigm shift:
487
+
488
+ **Before:** Tests run → results disappear → no permanent record
489
+
490
+ **After:** Tests run → `.taf` updated → git-tracked forever
491
+
492
+ `.taf` is about accountability. Proof that your code works. Tracked over time. Visible to everyone.
493
+
494
+ **Built with championship standards. F1-inspired engineering. Methodically tested.**
495
+
496
+ *Platform-agnostic core. Works everywhere. Trust the format.*
package/action.yml ADDED
@@ -0,0 +1,42 @@
1
+ name: 'FAF TAF Action'
2
+ description: 'Automatically update .taf (Testing Activity Feed) files with test results'
3
+ author: 'wolfejam'
4
+
5
+ branding:
6
+ icon: 'check-circle'
7
+ color: 'green'
8
+
9
+ inputs:
10
+ test-output-file:
11
+ description: 'Path to file containing test output (created by previous step)'
12
+ required: true
13
+
14
+ auto-commit:
15
+ description: 'Automatically commit .taf updates (default: true)'
16
+ required: false
17
+ default: 'true'
18
+
19
+ commit-message:
20
+ description: 'Custom commit message for .taf updates'
21
+ required: false
22
+ default: 'chore(taf): update .taf receipt [skip ci]'
23
+
24
+ outputs:
25
+ result:
26
+ description: 'Test result (PASSED, FAILED, IMPROVED, DEGRADED)'
27
+
28
+ passed:
29
+ description: 'Number of tests passed'
30
+
31
+ failed:
32
+ description: 'Number of tests failed'
33
+
34
+ total:
35
+ description: 'Total number of tests'
36
+
37
+ taf-updated:
38
+ description: 'Whether .taf file was updated (true/false)'
39
+
40
+ runs:
41
+ using: 'node20'
42
+ main: 'dist/index.js'