yowtf 0.1.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/README.md ADDED
@@ -0,0 +1,1605 @@
1
+ <p align="center">
2
+ <img src="images/white-logo.png" alt="YOWTF — Your Operating Workstation Trouble Finder" width="500">
3
+ </p>
4
+
5
+ <p align="center">
6
+ <strong>Your Operating Workstation Trouble Finder
7
+ </p>
8
+
9
+ > **Yo, WTF is happening?**
10
+
11
+ YOWTF is a **local-first, read-only developer workstation and project health diagnostic CLI**.
12
+
13
+ It looks at your machine, development environment, project configuration, runtimes, tools, ports, dependencies, Git state, storage, and other developer-facing signals — then explains what may be wrong, why it matters, and where to look next.
14
+
15
+ No telemetry.
16
+ No cloud dashboard.
17
+ No AI required.
18
+ No automatic fixes.
19
+ No modifying your project.
20
+
21
+ Just run it.
22
+
23
+ ```bash
24
+ yowtf
25
+ ```
26
+
27
+ ---
28
+
29
+ ## Why YOWTF?
30
+
31
+ Every developer eventually hits one of these:
32
+
33
+ - "Why is Node using the wrong version?"
34
+ - "Why is this port already occupied?"
35
+ - "Why does this project work on my machine but not theirs?"
36
+ - "Why is my disk suddenly full?"
37
+ - "Which Node/Python/Git installation is actually being used?"
38
+ - "Why does this command work in one terminal but not another?"
39
+ - "Why is this project using a different package manager?"
40
+ - "Why did this build suddenly become painfully slow?"
41
+ - "What the hell is wrong with this machine?"
42
+
43
+ Usually, the answer is buried somewhere between:
44
+
45
+ ```text
46
+ PATH
47
+ environment variables
48
+ runtime versions
49
+ duplicate installations
50
+ ports
51
+ processes
52
+ disk usage
53
+ project configuration
54
+ dependency metadata
55
+ lockfiles
56
+ Git state
57
+ developer caches
58
+ ```
59
+
60
+ YOWTF brings those signals together into one deterministic diagnostic workflow.
61
+
62
+ ---
63
+
64
+ # ✨ What YOWTF Does
65
+
66
+ YOWTF follows a structured diagnostic pipeline:
67
+
68
+ ```text
69
+ DISCOVER
70
+
71
+ COLLECT
72
+
73
+ DETECT
74
+
75
+ EVALUATE
76
+
77
+ SCORE
78
+
79
+ EXPLAIN
80
+
81
+ REPORT
82
+ ```
83
+
84
+ It doesn't just dump system information.
85
+
86
+ It turns collected evidence into **findings**.
87
+
88
+ Each finding can contain:
89
+
90
+ - rule ID
91
+ - category
92
+ - status
93
+ - severity
94
+ - confidence
95
+ - explanation
96
+ - evidence
97
+ - impact
98
+ - remediation hint
99
+
100
+ The goal is simple:
101
+
102
+ > **Don't just tell the developer what exists. Tell them what deserves attention and why.**
103
+
104
+ ---
105
+
106
+ # 🚀 Features
107
+
108
+ ## 🖥️ Workstation Diagnostics
109
+
110
+ Inspect developer-facing system health:
111
+
112
+ - operating system
113
+ - architecture
114
+ - memory
115
+ - CPU pressure
116
+ - uptime
117
+ - disk space
118
+ - developer storage
119
+
120
+ ---
121
+
122
+ ## ⚙️ Process Diagnostics
123
+
124
+ Identify potentially problematic development processes:
125
+
126
+ - high CPU processes
127
+ - high memory processes
128
+ - zombie/defunct processes where supported
129
+ - suspicious duplicate development processes
130
+
131
+ YOWTF **never kills processes**.
132
+
133
+ ---
134
+
135
+ ## 🔌 Port Diagnostics
136
+
137
+ Understand what is listening on your machine:
138
+
139
+ - development port conflicts
140
+ - duplicate listeners
141
+ - unexpected development-service exposure
142
+ - ports whose owning process cannot be identified
143
+
144
+ YOWTF does not terminate anything.
145
+
146
+ ---
147
+
148
+ ## 🌐 Network Diagnostics
149
+
150
+ Inspect local network configuration relevant to development:
151
+
152
+ - network interface availability
153
+ - DNS configuration
154
+ - proxy configuration
155
+ - route information
156
+
157
+ YOWTF does not require a remote monitoring service.
158
+
159
+ ---
160
+
161
+ ## 🔐 Environment Diagnostics
162
+
163
+ Inspect environment metadata without dumping sensitive values.
164
+
165
+ Examples:
166
+
167
+ - empty PATH entries
168
+ - duplicate PATH entries
169
+ - shell/PATH mismatches
170
+ - suspicious secret-like environment variable names
171
+
172
+ ### Privacy by default
173
+
174
+ YOWTF does **not** need to print:
175
+
176
+ ```text
177
+ API_KEY=...
178
+ DATABASE_PASSWORD=...
179
+ TOKEN=...
180
+ SECRET=...
181
+ ```
182
+
183
+ When environment inspection is required, YOWTF works primarily with **names and metadata**, not secret values.
184
+
185
+ ---
186
+
187
+ ## 🧩 Runtime Diagnostics
188
+
189
+ Detect runtime-related problems across applicable projects:
190
+
191
+ - Node.js
192
+ - Python
193
+ - Java
194
+ - other supported runtime contexts defined by the V1 rule set
195
+
196
+ Examples:
197
+
198
+ ```text
199
+ runtime.version.mismatch
200
+ runtime.node.unpinned
201
+ runtime.python.unpinned
202
+ ```
203
+
204
+ ---
205
+
206
+ ## 🛠️ Developer Tool Diagnostics
207
+
208
+ Inspect important developer tooling:
209
+
210
+ - Git
211
+ - package managers
212
+ - Docker when relevant
213
+ - executable resolution
214
+ - tool conflicts
215
+
216
+ This is particularly useful when your machine has accumulated multiple installations over time.
217
+
218
+ ---
219
+
220
+ ## 🛣️ PATH Diagnostics
221
+
222
+ PATH problems are classic developer-machine problems.
223
+
224
+ YOWTF can identify:
225
+
226
+ - missing expected executables
227
+ - multiple executable installations
228
+ - invalid PATH entries
229
+ - PATH-order shadowing
230
+
231
+ For example:
232
+
233
+ ```text
234
+ node
235
+ ├── C:\Program Files\nodejs\node.exe
236
+ └── C:\Users\you\AppData\Roaming\npm\node.exe
237
+ ```
238
+
239
+ If PATH ordering means the wrong executable wins, YOWTF can surface that relationship.
240
+
241
+ ---
242
+
243
+ ## 📦 Project Diagnostics
244
+
245
+ YOWTF can inspect a project for issues involving:
246
+
247
+ - project manifests
248
+ - lockfiles
249
+ - runtime policies
250
+ - project-root ambiguity
251
+ - package-manager expectations
252
+ - environment configuration
253
+
254
+ Run against the current directory:
255
+
256
+ ```bash
257
+ yowtf project
258
+ ```
259
+
260
+ Or explicitly target another directory:
261
+
262
+ ```bash
263
+ yowtf --path ./my-project project
264
+ ```
265
+
266
+ ---
267
+
268
+ ## 📚 Dependency Diagnostics
269
+
270
+ YOWTF can detect problems such as:
271
+
272
+ - missing lockfiles
273
+ - dependency metadata mismatches
274
+ - package-manager mismatches
275
+ - inconsistent local dependency state
276
+
277
+ YOWTF does **not** reinstall dependencies for you.
278
+
279
+ ---
280
+
281
+ ## 🌿 Git Diagnostics
282
+
283
+ Inspect local Git state:
284
+
285
+ - repository availability
286
+ - dirty working tree
287
+ - untracked files
288
+ - branch divergence
289
+
290
+ YOWTF does not:
291
+
292
+ ```text
293
+ commit
294
+ reset
295
+ stash
296
+ checkout
297
+ pull
298
+ push
299
+ ```
300
+
301
+ It observes.
302
+
303
+ ---
304
+
305
+ ## 🧹 Cache & Storage Diagnostics
306
+
307
+ Find developer storage pressure caused by recognized:
308
+
309
+ - caches
310
+ - build artifacts
311
+ - dependency-related directories
312
+ - other supported developer storage locations
313
+
314
+ The `clean` command is intentionally diagnostic.
315
+
316
+ It helps you decide what is safe to review.
317
+
318
+ It does **not** silently delete things.
319
+
320
+ ---
321
+
322
+ # 📊 Health Score
323
+
324
+ YOWTF produces a health score from:
325
+
326
+ ```text
327
+ 0 → 100
328
+ ```
329
+
330
+ Higher is better.
331
+
332
+ The V1 scoring model starts at:
333
+
334
+ ```text
335
+ 100
336
+ ```
337
+
338
+ and applies penalties based on finding severity.
339
+
340
+ | Severity | Penalty |
341
+ | -------- | ------: |
342
+ | CRITICAL | 25 |
343
+ | HIGH | 15 |
344
+ | MEDIUM | 8 |
345
+ | LOW | 3 |
346
+ | INFO | 0 |
347
+
348
+ A `FAIL` finding receives its full severity penalty.
349
+
350
+ A `WARN` finding receives 50% of its severity penalty.
351
+
352
+ `PASS`, `SKIPPED`, `UNAVAILABLE`, and `ERROR` findings do not directly reduce the score.
353
+
354
+ The score is clamped to:
355
+
356
+ ```text
357
+ 0–100
358
+ ```
359
+
360
+ ### Score bands
361
+
362
+ | Score | Health |
363
+ | -----: | ------------ |
364
+ | 90–100 | 🟢 EXCELLENT |
365
+ | 75–89 | GOOD |
366
+ | 60–74 | FAIR |
367
+ | 40–59 | POOR |
368
+ | 0–39 | CRITICAL |
369
+
370
+ ### Important
371
+
372
+ The score is **not** a security rating.
373
+
374
+ It is a deterministic diagnostic health indicator for the scope YOWTF evaluated.
375
+
376
+ Coverage and score are separate concepts.
377
+
378
+ A partial scan may still have a valid score for its evaluated scope.
379
+
380
+ ---
381
+
382
+ # 🔎 Findings
383
+
384
+ A typical diagnostic finding is conceptually represented as:
385
+
386
+ ```text
387
+ Rule
388
+ ├── ID
389
+ ├── Category
390
+ ├── Status
391
+ ├── Severity
392
+ ├── Confidence
393
+ ├── Title
394
+ ├── Summary
395
+ ├── Evidence
396
+ ├── Impact
397
+ └── Remediation Hint
398
+ ```
399
+
400
+ Example:
401
+
402
+ ```text
403
+ [HIGH] runtime.version.mismatch
404
+
405
+ Node.js 18.x is active, but the project requires Node.js >=20.
406
+
407
+ Why it matters:
408
+ The project may fail to build or behave differently from
409
+ environments using the required runtime.
410
+
411
+ What to do:
412
+ Use the project's documented Node.js version.
413
+ ```
414
+
415
+ The exact terminal presentation is defined by the CLI/reporting specifications.
416
+
417
+ ---
418
+
419
+ # 🧠 Deterministic by Design
420
+
421
+ YOWTF does not ask an AI model:
422
+
423
+ > "Does this machine look healthy?"
424
+
425
+ The diagnostic engine uses explicit rules.
426
+
427
+ That means the same evidence should produce the same result.
428
+
429
+ ```text
430
+ Evidence
431
+
432
+ Rule
433
+
434
+ Finding
435
+
436
+ Score
437
+ ```
438
+
439
+ No hidden model.
440
+
441
+ No probabilistic health score.
442
+
443
+ No remote recommendation engine.
444
+
445
+ ---
446
+
447
+ # 🔒 Privacy
448
+
449
+ YOWTF is designed around data minimization.
450
+
451
+ ### By default
452
+
453
+ YOWTF:
454
+
455
+ - runs locally
456
+ - does not require an account
457
+ - does not require a backend
458
+ - does not send telemetry
459
+ - does not upload scan results
460
+ - does not require a cloud dashboard
461
+ - does not intentionally expose environment secret values
462
+
463
+ ### YOWTF does not silently collect:
464
+
465
+ ```text
466
+ telemetry
467
+ analytics
468
+ usage tracking
469
+ cloud diagnostics
470
+ remote machine inventory
471
+ ```
472
+
473
+ The product is intentionally local-first.
474
+
475
+ ---
476
+
477
+ # 🧱 Read-Only by Default
478
+
479
+ YOWTF is a diagnostic tool, not a repair tool.
480
+
481
+ It does not automatically:
482
+
483
+ ```text
484
+ delete files
485
+ install software
486
+ uninstall software
487
+ modify PATH
488
+ modify environment variables
489
+ kill processes
490
+ modify project files
491
+ modify dependencies
492
+ modify Git state
493
+ commit changes
494
+ reset repositories
495
+ ```
496
+
497
+ If YOWTF tells you:
498
+
499
+ ```text
500
+ Your cache is huge.
501
+ ```
502
+
503
+ it doesn't immediately delete the cache.
504
+
505
+ If it tells you:
506
+
507
+ ```text
508
+ Your Node version is wrong.
509
+ ```
510
+
511
+ it doesn't change your Node installation.
512
+
513
+ You stay in control.
514
+
515
+ ---
516
+
517
+ # 🌍 Cross-Platform
518
+
519
+ YOWTF is designed for multi-platform developer workstations:
520
+
521
+ - **Windows** (native PowerShell and cmd command execution)
522
+ - **macOS** (Darwin process and system introspection)
523
+ - **Linux** (POSIX and `/proc`-compatible metric gathering)
524
+
525
+ Not every operating system exposes identical diagnostic APIs or system utilities. YOWTF therefore distinguishes between:
526
+
527
+ ```text
528
+ PASS Condition verified healthy
529
+ FAIL Definite issue identified
530
+ WARN Condition requires developer attention
531
+ SKIPPED Diagnostic not applicable to this project or platform
532
+ UNAVAILABLE Platform metric or tool not available in this environment
533
+ ERROR Unexpected internal error during individual rule evaluation
534
+ ```
535
+
536
+ An unavailable platform capability is never treated as an execution failure. On unsupported platforms (e.g. BSD or Solaris), YOWTF gracefully skips platform-specific collectors and executes generic project diagnostics safely.
537
+
538
+ ---
539
+
540
+ # 📦 Installation
541
+
542
+ YOWTF is distributed through npm.
543
+
544
+ ### Run instantly with npx
545
+
546
+ You can run YOWTF without installing it globally:
547
+
548
+ ```bash
549
+ npx yowtf
550
+ ```
551
+
552
+ ### Or install globally
553
+
554
+ With npm:
555
+
556
+ ```bash
557
+ npm install -g yowtf
558
+ ```
559
+
560
+ Or with pnpm:
561
+
562
+ ```bash
563
+ pnpm add -g yowtf
564
+ ```
565
+
566
+ > **Note:** Public npm publication will occur in Phase 11. Until published to the npm registry, you can clone and run YOWTF locally from source (see [Development](#-development)).
567
+
568
+ Check the installed version:
569
+
570
+ ```bash
571
+ yowtf --version
572
+ ```
573
+
574
+ ---
575
+
576
+ # ⚡ Quick Start
577
+
578
+ From a project directory:
579
+
580
+ ```bash
581
+ yowtf
582
+ ```
583
+
584
+ For the full health-oriented diagnostic workflow:
585
+
586
+ ```bash
587
+ yowtf doctor
588
+ ```
589
+
590
+ Check the score:
591
+
592
+ ```bash
593
+ yowtf score
594
+ ```
595
+
596
+ Understand the findings:
597
+
598
+ ```bash
599
+ yowtf explain
600
+ ```
601
+
602
+ Inspect a specific area:
603
+
604
+ ```bash
605
+ yowtf runtimes
606
+ yowtf ports
607
+ yowtf processes
608
+ yowtf env
609
+ yowtf git
610
+ yowtf deps
611
+ ```
612
+
613
+ ---
614
+
615
+ # 🧰 Commands
616
+
617
+ YOWTF V1 exposes 20 canonical entry points (default full scan + 19 focused subcommands):
618
+
619
+ ```text
620
+ yowtf
621
+ yowtf doctor
622
+ yowtf score
623
+ yowtf explain
624
+
625
+ yowtf system
626
+ yowtf disk
627
+ yowtf processes
628
+ yowtf ports
629
+ yowtf network
630
+ yowtf env
631
+ yowtf runtimes
632
+ yowtf tools
633
+ yowtf paths
634
+ yowtf versions
635
+
636
+ yowtf project
637
+ yowtf deps
638
+ yowtf git
639
+ yowtf config
640
+
641
+ yowtf caches
642
+ yowtf clean
643
+ ```
644
+
645
+ ---
646
+
647
+ # 📖 Command Overview
648
+
649
+ | Command | Category | Purpose |
650
+ | :---------------- | :---------- | :----------------------------------------------------------------------------------- |
651
+ | `yowtf` | Core | Full workstation and project diagnostic scan |
652
+ | `yowtf doctor` | Core | Health-oriented diagnostic scan highlighting issues requiring attention |
653
+ | `yowtf score` | Core | Calculate and display the 0–100 workstation/project health score |
654
+ | `yowtf explain` | Core | Provide detailed explanations and next steps for detected findings |
655
+ | `yowtf system` | Workstation | Inspect OS, CPU architecture, memory pressure, and system uptime |
656
+ | `yowtf disk` | Workstation | Inspect disk space, storage pressure, and volume limits |
657
+ | `yowtf processes` | Workstation | Detect process resource hogs and duplicate dev processes (read-only) |
658
+ | `yowtf ports` | Workstation | Detect development port conflicts and listening sockets (read-only) |
659
+ | `yowtf network` | Workstation | Inspect network interfaces, DNS configuration, and proxy settings |
660
+ | `yowtf env` | Environment | Inspect environment variables, PATH entries, and configuration metadata safely |
661
+ | `yowtf runtimes` | Environment | Inspect installed and active runtimes (Node.js, Python, Java, etc.) |
662
+ | `yowtf tools` | Environment | Inspect developer tools (Git, package managers, Docker, etc.) |
663
+ | `yowtf paths` | Environment | Detect PATH-order shadowing, empty entries, and executable conflicts |
664
+ | `yowtf versions` | Environment | Diagnose version conflicts and requirement mismatches |
665
+ | `yowtf project` | Project | Diagnose project type, manifest health, and configuration |
666
+ | `yowtf deps` | Project | Diagnose project dependency health, lockfiles, and package manager consistency |
667
+ | `yowtf git` | Project | Inspect Git repository health, branch status, and working tree (read-only) |
668
+ | `yowtf config` | Project | Inspect project configuration files and environment definitions |
669
+ | `yowtf caches` | Maintenance | Identify developer caches and large storage consumers (read-only) |
670
+ | `yowtf clean` | Maintenance | Diagnostic cleanup candidate finder; `--preview` reports candidates without deleting |
671
+
672
+ > **Important:** `yowtf clean` (and `yowtf clean --preview`) is **strictly diagnostic**. It reports identified cleanup candidates and estimated sizes. It **never deletes any files**.
673
+
674
+ ---
675
+
676
+ # 🎛️ Global Options
677
+
678
+ All commands support the documented global options:
679
+
680
+ | Option | Purpose | Description |
681
+ | :-------------- | :--------------- | :-------------------------------------------------------------------------- |
682
+ | `-h, --help` | Help | Display help and usage information for YOWTF or a subcommand |
683
+ | `-V, --version` | Version | Display current version number |
684
+ | `--verbose` | Verbose mode | Enable detailed diagnostic output (without exposing secrets) |
685
+ | `--no-color` | Color toggle | Disable ANSI terminal colors for raw text pipelines |
686
+ | `--json` | Machine output | Output pure machine-readable JSON (suppresses spinners and decorations) |
687
+ | `--quiet` | Quiet mode | Reduce output noise; show only essential findings and summaries |
688
+ | `--path <dir>` | Target directory | Target a specific project directory (defaults to current working directory) |
689
+
690
+ ### Examples
691
+
692
+ JSON output:
693
+
694
+ ```bash
695
+ yowtf --json
696
+ ```
697
+
698
+ Verbose output:
699
+
700
+ ```bash
701
+ yowtf --verbose
702
+ ```
703
+
704
+ Disable colors:
705
+
706
+ ```bash
707
+ yowtf --no-color
708
+ ```
709
+
710
+ Quiet mode:
711
+
712
+ ```bash
713
+ yowtf --quiet
714
+ ```
715
+
716
+ Analyze another project:
717
+
718
+ ```bash
719
+ yowtf --path ./some-project
720
+ ```
721
+
722
+ ---
723
+
724
+ # 🤖 JSON Output
725
+
726
+ YOWTF supports pure machine-readable output:
727
+
728
+ ```bash
729
+ yowtf --json
730
+ ```
731
+
732
+ When `--json` is enabled:
733
+
734
+ - Interactive spinners and progress bars are disabled.
735
+ - ANSI color formatting sequences are suppressed.
736
+ - Informational banners and decoration are omitted.
737
+ - The output can be piped directly to tools like `jq` or captured by CI automation.
738
+
739
+ ---
740
+
741
+ # 🚦 Exit Codes
742
+
743
+ YOWTF defines strict, predictable exit code semantics:
744
+
745
+ | Exit Code | Classification | Meaning |
746
+ | :-------: | :---------------------- | :-------------------------------------------------------------------------------------------------------------------------------- |
747
+ | `0` | **Success** | Successful command execution. Findings with `FAIL`, `WARN`, or `PASS` status are valid diagnostic results and exit with code `0`. |
748
+ | `1` | **Application Failure** | Internal or fatal application error preventing completion of the diagnostic run. |
749
+ | `2` | **CLI Usage Error** | Unknown command, unrecognized option, missing required argument, or inaccessible project directory path. |
750
+
751
+ ---
752
+
753
+ # 🧪 Example Workflow
754
+
755
+ Imagine a project requiring Node.js 20.
756
+
757
+ Your machine resolves:
758
+
759
+ ```text
760
+ Node.js 18.20.x
761
+ ```
762
+
763
+ YOWTF might identify:
764
+
765
+ ```text
766
+ runtime.version.mismatch
767
+ ```
768
+
769
+ and explain:
770
+
771
+ ```text
772
+ Project requirement:
773
+ Node.js >= 20
774
+
775
+ Resolved runtime:
776
+ Node.js 18.20.x
777
+
778
+ Impact:
779
+ The project may fail to build or behave differently
780
+ from environments using the required runtime.
781
+ ```
782
+
783
+ Instead of blindly changing your environment, YOWTF gives you enough evidence to investigate.
784
+
785
+ ---
786
+
787
+ # 🧩 V1 Rule Catalogue
788
+
789
+ YOWTF V1 defines **60 diagnostic rules** across 15 categories.
790
+
791
+ ```text
792
+ System
793
+ Disk
794
+ Processes
795
+ Ports
796
+ Network
797
+ Environment
798
+ Runtimes
799
+ Tools
800
+ Paths
801
+ Versions
802
+ Project
803
+ Dependencies
804
+ Git
805
+ Configuration
806
+ Caches
807
+ ```
808
+
809
+ Examples include:
810
+
811
+ ```text
812
+ system.memory.pressure
813
+ disk.space.low
814
+ process.resource.hog
815
+ port.development.conflict
816
+ environment.path.empty-entry
817
+ runtime.node.unpinned
818
+ tool.executable.shadowing
819
+ path.order.shadowing
820
+ version.runtime.conflict
821
+ project.lockfile.missing
822
+ dependency.lockfile.mismatch
823
+ git.working-tree.dirty
824
+ config.required.value.missing
825
+ cache.storage.large
826
+ ```
827
+
828
+ The complete authoritative rule inventory is maintained in:
829
+
830
+ ```text
831
+ docs/RULE-CATALOGUE.md
832
+ ```
833
+
834
+ ---
835
+
836
+ # 🏗️ Architecture
837
+
838
+ YOWTF is structured as a layered diagnostic system.
839
+
840
+ ```text
841
+ ┌──────────────────────────────┐
842
+ │ CLI │
843
+ ├──────────────────────────────┤
844
+ │ Application │
845
+ ├──────────────────────────────┤
846
+ │ Domain │
847
+ ├──────────────────────────────┤
848
+ │ Collection │
849
+ ├──────────────────────────────┤
850
+ │ Platform │
851
+ ├──────────────────────────────┤
852
+ │ Detection │
853
+ ├──────────────────────────────┤
854
+ │ Scoring │
855
+ ├──────────────────────────────┤
856
+ │ Reporting │
857
+ └──────────────────────────────┘
858
+ ```
859
+
860
+ The conceptual flow is:
861
+
862
+ ```text
863
+ Discover
864
+
865
+ Collect
866
+
867
+ Detect
868
+
869
+ Evaluate
870
+
871
+ Score
872
+
873
+ Explain
874
+
875
+ Report
876
+ ```
877
+
878
+ The architecture is designed so that:
879
+
880
+ - collectors collect evidence
881
+ - rules evaluate evidence
882
+ - scoring calculates health
883
+ - reporting renders results
884
+ - CLI handles user interaction
885
+
886
+ These concerns remain separated.
887
+
888
+ ---
889
+
890
+ # 🛠️ Technology
891
+
892
+ YOWTF V1 uses:
893
+
894
+ - Node.js 20+
895
+ - TypeScript
896
+ - pnpm
897
+ - Commander
898
+ - Chalk
899
+ - Ora
900
+ - Boxen
901
+ - cli-table3
902
+ - tsup
903
+ - Vitest
904
+ - ESLint
905
+ - Prettier
906
+ - Git
907
+ - GitHub Actions
908
+ - npm
909
+
910
+ The project intentionally does **not** require:
911
+
912
+ - a database
913
+ - a backend
914
+ - a frontend framework
915
+ - a cloud service
916
+ - an AI service
917
+ - telemetry infrastructure
918
+ - a mandatory network service
919
+
920
+ ---
921
+
922
+ # 📁 Project Structure
923
+
924
+ The implementation follows the architecture specification.
925
+
926
+ Conceptually:
927
+
928
+ ```text
929
+ yowtf/
930
+ ├── docs/
931
+ │ ├── PRD.md
932
+ │ ├── ARCHITECTURE.md
933
+ │ ├── TECH-STACK.md
934
+ │ ├── CLI-SPEC.md
935
+ │ ├── DETECTION-ENGINE.md
936
+ │ ├── SCORING.md
937
+ │ ├── COMMANDS.md
938
+ │ └── RULE-CATALOGUE.md
939
+
940
+ ├── src/
941
+ │ ├── cli/
942
+ │ ├── application/
943
+ │ ├── domain/
944
+ │ ├── collection/
945
+ │ ├── platform/
946
+ │ ├── detection/
947
+ │ ├── scoring/
948
+ │ └── reporting/
949
+
950
+ ├── tests/
951
+ ├── package.json
952
+ ├── tsconfig.json
953
+ ├── tsup.config.ts
954
+ └── README.md
955
+ ```
956
+
957
+ The exact implementation structure is governed by:
958
+
959
+ ```text
960
+ docs/ARCHITECTURE.md
961
+ ```
962
+
963
+ ---
964
+
965
+ # 🔧 Troubleshooting
966
+
967
+ ### Unknown command or unrecognized option (Exit Code 2)
968
+
969
+ ```text
970
+ error: unknown command 'foo'
971
+ error: unknown option '--bar'
972
+ ```
973
+
974
+ **Cause:** Typographical error in command or option name.
975
+ **Resolution:** Run `yowtf --help` to list all 20 valid commands, or `yowtf <command> --help` to inspect command-specific flags.
976
+
977
+ ### Invalid or inaccessible path (Exit Code 2)
978
+
979
+ ```text
980
+ CLI Usage Error: Directory does not exist or is not accessible: ./non-existent-dir
981
+ ```
982
+
983
+ **Cause:** The directory passed to `--path <dir>` does not exist or lacks read permissions.
984
+ **Resolution:** Verify the target directory path spelling and ensure your user account has read access.
985
+
986
+ ### Tool or runtime shows `UNAVAILABLE` or `SKIPPED`
987
+
988
+ ```text
989
+ [SKIPPED] runtime.python.unpinned (Python not detected)
990
+ ```
991
+
992
+ **Cause:** The specified runtime (e.g. Python, Java, Docker) is not installed or not present in your system `PATH`.
993
+ **Resolution:** This is normal diagnostic behavior. YOWTF never crashes when an optional tool is absent; it records the evidence as unavailable and skips dependent checks.
994
+
995
+ ### Permission or access issues during collection
996
+
997
+ **Cause:** Certain system statistics (e.g. processes belonging to other users or privileged network sockets) may be restricted by the host OS.
998
+ **Resolution:** YOWTF runs without requiring root/administrator permissions. Restricted metrics are safely captured as `FAILED` or `UNAVAILABLE` collection evidence without halting the scan.
999
+
1000
+ ### Scripting with JSON output
1001
+
1002
+ **Cause:** Automated scripts encountering unexpected formatting in `--json` mode.
1003
+ **Resolution:** When `--json` is supplied, all interactive spinners, ANSI color escape sequences, and decorative banners are suppressed. The stdout output is strictly valid JSON:
1004
+
1005
+ ```bash
1006
+ yowtf --json | jq .healthScore
1007
+ ```
1008
+
1009
+ ### Unsupported platform handling
1010
+
1011
+ **Cause:** Executing YOWTF on an operating system outside Windows, macOS, or Linux (e.g. BSD or Solaris).
1012
+ **Resolution:** YOWTF safely handles unsupported platforms by skipping platform-specific collectors and running generic project-level diagnostics.
1013
+
1014
+ ---
1015
+
1016
+ # 🧪 Development
1017
+
1018
+ ### Prerequisites
1019
+
1020
+ - **Node.js**: `>= 20.0.0`
1021
+ - **pnpm**: `>= 9.0.0`
1022
+ - **Git**
1023
+
1024
+ ### Setup
1025
+
1026
+ Clone the repository and install dependencies:
1027
+
1028
+ ```bash
1029
+ git clone https://github.com/isthatpratham/yowtf.git
1030
+ cd yowtf
1031
+ pnpm install
1032
+ ```
1033
+
1034
+ ### Build & Run Locally
1035
+
1036
+ Compile TypeScript with `tsup`:
1037
+
1038
+ ```bash
1039
+ pnpm run build
1040
+ node dist/cli.js --help
1041
+ ```
1042
+
1043
+ To run continuously in watch mode:
1044
+
1045
+ ```bash
1046
+ pnpm dev
1047
+ ```
1048
+
1049
+ ### Testing & Validation
1050
+
1051
+ YOWTF enforces strict quality gates across testing, type safety, linting, and formatting:
1052
+
1053
+ ```bash
1054
+ # Run the complete test suite
1055
+ pnpm test
1056
+
1057
+ # Run tests in interactive watch mode
1058
+ pnpm run test:watch
1059
+
1060
+ # Verify TypeScript types without emitting
1061
+ pnpm run typecheck
1062
+
1063
+ # Check code with ESLint
1064
+ pnpm run lint
1065
+
1066
+ # Format code and verify formatting with Prettier
1067
+ pnpm run format
1068
+ pnpm run format:check
1069
+ ```
1070
+
1071
+ ### Mandatory Quality Gates
1072
+
1073
+ Before submitting any changes, ensure all 5 verification gates pass:
1074
+
1075
+ ```bash
1076
+ pnpm test
1077
+ pnpm run typecheck
1078
+ pnpm run lint
1079
+ pnpm run format:check
1080
+ pnpm run build
1081
+ ```
1082
+
1083
+ For complete architectural rules, contribution workflows, and rule authoring guidelines, see [CONTRIBUTING.md](CONTRIBUTING.md).
1084
+
1085
+ ---
1086
+
1087
+ # 🧬 Documentation
1088
+
1089
+ The `/docs` directory is the project's technical source of truth.
1090
+
1091
+ ### Product
1092
+
1093
+ ```text
1094
+ docs/PRD.md
1095
+ ```
1096
+
1097
+ Defines what YOWTF is, why it exists, scope, goals, non-goals, and V1 definition of done.
1098
+
1099
+ ### Architecture
1100
+
1101
+ ```text
1102
+ docs/ARCHITECTURE.md
1103
+ ```
1104
+
1105
+ Defines system structure, layers, boundaries, data flow, and architectural invariants.
1106
+
1107
+ ### Technology
1108
+
1109
+ ```text
1110
+ docs/TECH-STACK.md
1111
+ ```
1112
+
1113
+ Defines the approved technology stack and dependency policy.
1114
+
1115
+ ### CLI
1116
+
1117
+ ```text
1118
+ docs/CLI-SPEC.md
1119
+ ```
1120
+
1121
+ Defines public CLI behavior.
1122
+
1123
+ ### Detection
1124
+
1125
+ ```text
1126
+ docs/DETECTION-ENGINE.md
1127
+ ```
1128
+
1129
+ Defines evidence, collectors, rules, findings, applicability, evaluation, and detection behavior.
1130
+
1131
+ ### Scoring
1132
+
1133
+ ```text
1134
+ docs/SCORING.md
1135
+ ```
1136
+
1137
+ Defines the numerical health-score model.
1138
+
1139
+ ### Commands
1140
+
1141
+ ```text
1142
+ docs/COMMANDS.md
1143
+ ```
1144
+
1145
+ Defines the complete V1 command catalogue.
1146
+
1147
+ ### Rules
1148
+
1149
+ ```text
1150
+ docs/RULE-CATALOGUE.md
1151
+ ```
1152
+
1153
+ Defines the complete V1 diagnostic rule inventory.
1154
+
1155
+ ---
1156
+
1157
+ # 📜 Documentation Is the Source of Truth
1158
+
1159
+ YOWTF follows a strict documentation-first development model.
1160
+
1161
+ The hierarchy is:
1162
+
1163
+ ```text
1164
+ Specification
1165
+
1166
+ Implementation
1167
+
1168
+ Tests
1169
+
1170
+ README
1171
+ ```
1172
+
1173
+ If implementation conflicts with the specification:
1174
+
1175
+ > **The implementation is wrong.**
1176
+
1177
+ If README conflicts with the specification:
1178
+
1179
+ > **The README is wrong.**
1180
+
1181
+ If two specifications conflict:
1182
+
1183
+ > **Stop and resolve the conflict before implementation.**
1184
+
1185
+ Undocumented behavior is not automatically approved behavior.
1186
+
1187
+ ---
1188
+
1189
+ # 🤖 AI Coding Agent Policy
1190
+
1191
+ YOWTF is designed to be friendly to AI-assisted development without allowing AI to silently define the product.
1192
+
1193
+ AI coding agents must:
1194
+
1195
+ - read the relevant documentation first
1196
+ - follow the documented architecture
1197
+ - use only documented commands
1198
+ - use only documented rules
1199
+ - use documented thresholds
1200
+ - preserve stable rule IDs
1201
+ - add tests
1202
+ - avoid undocumented dependencies
1203
+ - avoid undocumented network behavior
1204
+ - avoid undocumented mutations
1205
+ - avoid silent scope expansion
1206
+
1207
+ The rule is simple:
1208
+
1209
+ > **AI may implement the specification. AI does not become the specification.**
1210
+
1211
+ ---
1212
+
1213
+ # 🧪 Testing Philosophy
1214
+
1215
+ Tests are part of the product contract.
1216
+
1217
+ YOWTF tests should cover:
1218
+
1219
+ - collectors
1220
+ - platform adapters
1221
+ - project discovery
1222
+ - rule evaluation
1223
+ - rule applicability
1224
+ - threshold boundaries
1225
+ - scoring
1226
+ - command behavior
1227
+ - output modes
1228
+ - error handling
1229
+ - privacy behavior
1230
+ - read-only guarantees
1231
+ - regression cases
1232
+
1233
+ For threshold-based rules, boundary cases matter.
1234
+
1235
+ For example:
1236
+
1237
+ ```text
1238
+ 79.9%
1239
+ 80.0%
1240
+ 80.1%
1241
+ ```
1242
+
1243
+ should not accidentally produce the same result when the specification defines different outcomes.
1244
+
1245
+ ---
1246
+
1247
+ # 🔐 Safety Philosophy
1248
+
1249
+ YOWTF is deliberately conservative.
1250
+
1251
+ When evidence is unavailable:
1252
+
1253
+ ```text
1254
+ don't invent
1255
+ ```
1256
+
1257
+ When applicability is uncertain:
1258
+
1259
+ ```text
1260
+ don't assume
1261
+ ```
1262
+
1263
+ When a condition cannot be proven:
1264
+
1265
+ ```text
1266
+ don't claim certainty
1267
+ ```
1268
+
1269
+ When a repair could alter user state:
1270
+
1271
+ ```text
1272
+ don't perform it
1273
+ ```
1274
+
1275
+ This makes YOWTF useful as a diagnostic layer without turning it into an unpredictable system-management tool.
1276
+
1277
+ ---
1278
+
1279
+ # 🚫 What YOWTF Is Not
1280
+
1281
+ YOWTF is **not**:
1282
+
1283
+ - an antivirus
1284
+ - a full security scanner
1285
+ - a system monitor
1286
+ - a process manager
1287
+ - a package manager
1288
+ - a cloud observability platform
1289
+ - a telemetry platform
1290
+ - an automatic repair utility
1291
+ - an AI assistant
1292
+ - a remote monitoring service
1293
+
1294
+ It is a **developer workstation and project diagnostic tool**.
1295
+
1296
+ ---
1297
+
1298
+ # 🌐 Network Philosophy
1299
+
1300
+ YOWTF is local-first.
1301
+
1302
+ The V1 diagnostic engine does not depend on a cloud backend.
1303
+
1304
+ Network-related diagnostics concern local configuration and developer-relevant network state where specified.
1305
+
1306
+ YOWTF does not silently turn a local scan into a remote data-upload operation.
1307
+
1308
+ ---
1309
+
1310
+ # 🐳 Docker
1311
+
1312
+ Docker is not a mandatory runtime dependency for YOWTF V1.
1313
+
1314
+ Docker-related diagnostics may be applicable when a project explicitly uses Docker/container metadata.
1315
+
1316
+ YOWTF does not require Docker merely to run.
1317
+
1318
+ ---
1319
+
1320
+ # 🗺️ Roadmap
1321
+
1322
+ The V1 foundation focuses on:
1323
+
1324
+ ```text
1325
+ Local diagnostics
1326
+ Read-only analysis
1327
+ Deterministic rules
1328
+ Cross-platform support
1329
+ Project health
1330
+ Workstation health
1331
+ Explainable findings
1332
+ Health scoring
1333
+ CLI usability
1334
+ ```
1335
+
1336
+ Future functionality may be considered independently, but new capabilities require explicit specification.
1337
+
1338
+ Potential future areas may include:
1339
+
1340
+ - additional diagnostic rules
1341
+ - broader ecosystem detection
1342
+ - richer machine-readable output
1343
+ - expanded platform coverage
1344
+ - additional project ecosystem support
1345
+ - optional integrations
1346
+
1347
+ Nothing becomes part of the product merely because it appears on a roadmap.
1348
+
1349
+ ---
1350
+
1351
+ # 🤝 Contributing
1352
+
1353
+ Contributions are welcome! Please review our detailed [CONTRIBUTING.md](CONTRIBUTING.md) guide before opening pull requests.
1354
+
1355
+ Before changing the code:
1356
+
1357
+ 1. Read the relevant documentation.
1358
+ 2. Understand the existing behavior.
1359
+ 3. Identify the owning specification.
1360
+ 4. Make the smallest appropriate change.
1361
+ 5. Add/update tests.
1362
+ 6. Run validation.
1363
+ 7. Update documentation when behavior changes.
1364
+
1365
+ For a new diagnostic rule:
1366
+
1367
+ ```text
1368
+ Requirement
1369
+
1370
+ RULE-CATALOGUE.md
1371
+
1372
+ Detection implementation
1373
+
1374
+ Tests
1375
+
1376
+ Registration
1377
+
1378
+ Command integration
1379
+
1380
+ Validation
1381
+ ```
1382
+
1383
+ Do not add hidden rules.
1384
+
1385
+ ---
1386
+
1387
+ # 📝 Commit Convention
1388
+
1389
+ The project follows Conventional Commits.
1390
+
1391
+ Examples:
1392
+
1393
+ ```text
1394
+ feat: add runtime diagnostics
1395
+ fix: correct PATH normalization
1396
+ docs: clarify scoring behavior
1397
+ test: add lockfile mismatch coverage
1398
+ refactor: simplify rule registry
1399
+ chore: update dependencies
1400
+ ```
1401
+
1402
+ Release behavior follows the project's semantic-versioning configuration.
1403
+
1404
+ ---
1405
+
1406
+ # 📦 Release Philosophy
1407
+
1408
+ YOWTF uses semantic versioning.
1409
+
1410
+ In general:
1411
+
1412
+ ```text
1413
+ MAJOR → breaking changes
1414
+ MINOR → new compatible functionality
1415
+ PATCH → compatible fixes
1416
+ ```
1417
+
1418
+ Rule IDs and documented behavior are treated as compatibility-sensitive surfaces.
1419
+
1420
+ ---
1421
+
1422
+ # 🧭 Design Principles
1423
+
1424
+ YOWTF is built around a small set of principles:
1425
+
1426
+ ### Local-first
1427
+
1428
+ Your machine is the primary source of diagnostic evidence.
1429
+
1430
+ ### Read-only
1431
+
1432
+ Diagnose first. Let the developer decide what to change.
1433
+
1434
+ ### Deterministic
1435
+
1436
+ The same evidence should produce the same result.
1437
+
1438
+ ### Evidence-based
1439
+
1440
+ Findings should be explainable from collected evidence.
1441
+
1442
+ ### Privacy by default
1443
+
1444
+ Collect the minimum information necessary.
1445
+
1446
+ ### Developer-oriented
1447
+
1448
+ Focus on problems developers actually encounter.
1449
+
1450
+ ### No silent magic
1451
+
1452
+ Undocumented behavior is not a feature.
1453
+
1454
+ ---
1455
+
1456
+ # 💬 Philosophy
1457
+
1458
+ A developer workstation is an ecosystem.
1459
+
1460
+ Over time it collects:
1461
+
1462
+ ```text
1463
+ runtimes
1464
+ tools
1465
+ PATH entries
1466
+ package managers
1467
+ dependencies
1468
+ caches
1469
+ ports
1470
+ processes
1471
+ environment variables
1472
+ configuration
1473
+ projects
1474
+ Git repositories
1475
+ ```
1476
+
1477
+ Eventually something breaks.
1478
+
1479
+ And when it does, developers often start checking random things manually.
1480
+
1481
+ YOWTF's job is to make that investigation structured.
1482
+
1483
+ Not:
1484
+
1485
+ > "Here are 400 lines of system information. Good luck."
1486
+
1487
+ But:
1488
+
1489
+ > **"Yo, WTF is happening?"**
1490
+
1491
+ followed by:
1492
+
1493
+ ```text
1494
+ What was detected.
1495
+ Why it matters.
1496
+ How confident we are.
1497
+ What evidence supports it.
1498
+ Where you should look next.
1499
+ ```
1500
+
1501
+ ---
1502
+
1503
+ # ⭐ Why the Name?
1504
+
1505
+ Because sometimes developer tooling needs to say what everyone is already thinking.
1506
+
1507
+ **YOWTF**
1508
+
1509
+ **Your Operating Workstation Trouble Finder**
1510
+
1511
+ ```text
1512
+ Yo, WTF is happening?
1513
+ ```
1514
+
1515
+ Serious diagnostics.
1516
+
1517
+ Questionable branding.
1518
+
1519
+ ---
1520
+
1521
+ # License
1522
+
1523
+ YOWTF is licensed under the MIT License.
1524
+
1525
+ See the [LICENSE](LICENSE) file for the full license text.
1526
+
1527
+ ---
1528
+
1529
+ # 🔗 Project
1530
+
1531
+ GitHub:
1532
+
1533
+ https://github.com/isthatpratham/yowtf
1534
+
1535
+ ---
1536
+
1537
+ # 📚 Documentation Map
1538
+
1539
+ ```text
1540
+ README.md
1541
+
1542
+ ├── docs/PRD.md
1543
+ │ Product requirements
1544
+
1545
+ ├── docs/ARCHITECTURE.md
1546
+ │ System architecture
1547
+
1548
+ ├── docs/TECH-STACK.md
1549
+ │ Technology contract
1550
+
1551
+ ├── docs/CLI-SPEC.md
1552
+ │ CLI behavior
1553
+
1554
+ ├── docs/DETECTION-ENGINE.md
1555
+ │ Detection architecture
1556
+
1557
+ ├── docs/SCORING.md
1558
+ │ Health scoring
1559
+
1560
+ ├── docs/COMMANDS.md
1561
+ │ Command catalogue
1562
+
1563
+ └── docs/RULE-CATALOGUE.md
1564
+ V1 diagnostic rules
1565
+ ```
1566
+
1567
+ ---
1568
+
1569
+ # 🧠 Final Word
1570
+
1571
+ YOWTF isn't trying to manage your machine.
1572
+
1573
+ It isn't trying to replace your package manager.
1574
+
1575
+ It isn't trying to be an antivirus.
1576
+
1577
+ It isn't trying to upload your workstation to some dashboard.
1578
+
1579
+ It simply asks:
1580
+
1581
+ ```text
1582
+ What is happening?
1583
+ What looks wrong?
1584
+ Why does it matter?
1585
+ How certain are we?
1586
+ What should I investigate?
1587
+ ```
1588
+
1589
+ And then gives you the evidence.
1590
+
1591
+ ```text
1592
+ ┌─────────────────────────────────────┐
1593
+ │ │
1594
+ │ YOWTF │
1595
+ │ Your Operating Workstation │
1596
+ │ Trouble Finder │
1597
+ │ │
1598
+ │ Yo, WTF is happening? │
1599
+ │ │
1600
+ └─────────────────────────────────────┘
1601
+ ```
1602
+
1603
+ **Local. Read-only. Deterministic. Developer-first.**
1604
+
1605
+ That's YOWTF.