thuban 0.3.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/LICENSE +21 -0
- package/README.md +150 -0
- package/cli.js +1902 -0
- package/package.json +49 -0
- package/packages/scanner/ai-confidence-scorer.js +260 -0
- package/packages/scanner/alert-manager.js +398 -0
- package/packages/scanner/baseline-manager.js +109 -0
- package/packages/scanner/code-scanner.js +712 -0
- package/packages/scanner/codebase-passport.js +299 -0
- package/packages/scanner/copy-paste-detector.js +250 -0
- package/packages/scanner/dependency-graph.js +539 -0
- package/packages/scanner/drift-detector.js +425 -0
- package/packages/scanner/executive-report.js +774 -0
- package/packages/scanner/file-watcher.js +323 -0
- package/packages/scanner/ghost-code-detector.js +226 -0
- package/packages/scanner/hallucination-detector.js +507 -0
- package/packages/scanner/health-checker.js +586 -0
- package/packages/scanner/html-report.js +634 -0
- package/packages/scanner/index.js +92 -0
- package/packages/scanner/license-manager.js +318 -0
- package/packages/scanner/master-health-checker.js +513 -0
- package/packages/scanner/pre-commit-gate.js +216 -0
- package/packages/scanner/sentinel-core.js +608 -0
- package/packages/scanner/sentinel-knowledge.js +322 -0
- package/packages/scanner/tech-debt-analyzer.js +483 -0
- package/packages/scanner/tech-debt-cost.js +194 -0
- package/packages/scanner/widget-generator.js +415 -0
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Silverwings Benefits Ltd
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
ADDED
|
@@ -0,0 +1,150 @@
|
|
|
1
|
+
# Thuban — Code Health Engine
|
|
2
|
+
|
|
3
|
+
**The safety layer for AI-coded software.**
|
|
4
|
+
|
|
5
|
+
Scan your codebase for hallucinated APIs, ghost code, architecture drift, and tech debt. Fix what can be fixed automatically. One command. Zero dependencies. Zero config.
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
npx thuban scan .
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
---
|
|
12
|
+
|
|
13
|
+
## Why Thuban?
|
|
14
|
+
|
|
15
|
+
AI coding tools (Copilot, Cursor, Claude, ChatGPT) generate code that **looks correct but isn't**. They invent API methods that don't exist. They paste helper functions nobody calls. They use deprecated patterns from their training data.
|
|
16
|
+
|
|
17
|
+
Linters don't catch this. Code review misses it. Thuban was built specifically for it.
|
|
18
|
+
|
|
19
|
+
---
|
|
20
|
+
|
|
21
|
+
## What It Does
|
|
22
|
+
|
|
23
|
+
| Command | What it does |
|
|
24
|
+
|---------|-------------|
|
|
25
|
+
| `thuban scan [path]` | Full codebase health scan with score (A-F) |
|
|
26
|
+
| `thuban fix [path] --fix` | Auto-fix all fixable issues |
|
|
27
|
+
| `thuban hallucinate [path]` | Detect AI hallucinated APIs |
|
|
28
|
+
| `thuban gate` | Pre-commit hook — blocks hallucinated code in 3 seconds |
|
|
29
|
+
| `thuban gate --fix` | Install the pre-commit gate |
|
|
30
|
+
| `thuban cost [path]` | Tech debt cost calculator (hours + pounds) |
|
|
31
|
+
| `thuban ghosts [path]` | Find dead functions never called |
|
|
32
|
+
| `thuban ai-score [path]` | AI risk score per function (0-100%) |
|
|
33
|
+
| `thuban clones [path]` | Copy-paste drift detection |
|
|
34
|
+
| `thuban passport [path]` | Generate codebase identity file |
|
|
35
|
+
| `thuban executive [path]` | CTO-ready PDF report |
|
|
36
|
+
| `thuban dashboard [path]` | Visual HTML dashboard |
|
|
37
|
+
| `thuban watch [path]` | Live sentinel monitoring |
|
|
38
|
+
| `thuban diff [path]` | Scan only git-changed files |
|
|
39
|
+
| `thuban drift [path]` | Detect annotation/purpose drift |
|
|
40
|
+
| `thuban deps [path]` | Dependency graph + circular detection |
|
|
41
|
+
| `thuban status` | Show license and usage info |
|
|
42
|
+
| `thuban upgrade` | View pricing and subscribe |
|
|
43
|
+
| `thuban activate [key]` | Activate a license key |
|
|
44
|
+
|
|
45
|
+
---
|
|
46
|
+
|
|
47
|
+
## Quick Start
|
|
48
|
+
|
|
49
|
+
### Scan your project
|
|
50
|
+
```bash
|
|
51
|
+
npx thuban scan .
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
### See what it costs you
|
|
55
|
+
```bash
|
|
56
|
+
npx thuban cost .
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### Find ghost code
|
|
60
|
+
```bash
|
|
61
|
+
npx thuban ghosts .
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
### Block hallucinations on every commit
|
|
65
|
+
```bash
|
|
66
|
+
npx thuban gate --fix
|
|
67
|
+
```
|
|
68
|
+
|
|
69
|
+
### Generate a CTO report
|
|
70
|
+
```bash
|
|
71
|
+
npx thuban executive .
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
---
|
|
75
|
+
|
|
76
|
+
## Example Output
|
|
77
|
+
|
|
78
|
+
```
|
|
79
|
+
THUBAN — Code Health Report
|
|
80
|
+
|
|
81
|
+
Score: D+ (38/100)
|
|
82
|
+
|
|
83
|
+
CRITICAL: 3 Hallucinated APIs
|
|
84
|
+
src/api/payments.js:47
|
|
85
|
+
stripe.charges.createImmediate()
|
|
86
|
+
^^^ This method does not exist in Stripe SDK.
|
|
87
|
+
|
|
88
|
+
GHOST CODE: 16 functions exist but are never called
|
|
89
|
+
407 wasted lines (1.9% of codebase)
|
|
90
|
+
|
|
91
|
+
TECH DEBT COST:
|
|
92
|
+
Manual fix: 47 hours (£3,760 at £80/hr)
|
|
93
|
+
With Thuban: 4 hours
|
|
94
|
+
You save: £3,440 (91%)
|
|
95
|
+
|
|
96
|
+
Run: thuban fix . --fix
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
---
|
|
100
|
+
|
|
101
|
+
## Features
|
|
102
|
+
|
|
103
|
+
- **AI Hallucination Detection** — finds phantom imports and invented APIs
|
|
104
|
+
- **Pre-Commit Gate** — 3-second check blocks bad code before it enters your repo
|
|
105
|
+
- **Ghost Code Detection** — finds functions that exist but are never called
|
|
106
|
+
- **AI Risk Score** — per-function assessment of AI-generated code
|
|
107
|
+
- **Tech Debt Cost Calculator** — translates debt into hours and pounds
|
|
108
|
+
- **Copy-Paste Drift** — finds duplicated code drifting apart across files
|
|
109
|
+
- **Codebase Passport** — one JSON file describing your entire project
|
|
110
|
+
- **Mother Code DNA** — contextual annotations that make your codebase self-aware
|
|
111
|
+
- **Executive Report** — board-ready HTML report (print to PDF)
|
|
112
|
+
- **Auto-Fix** — one command fixes hundreds of issues automatically
|
|
113
|
+
- **Live Sentinel** — real-time monitoring on file save
|
|
114
|
+
- **Visual Dashboard** — HTML reports with score rings and category breakdowns
|
|
115
|
+
- **GitHub CI Action** — grade every PR, block merges below threshold
|
|
116
|
+
|
|
117
|
+
---
|
|
118
|
+
|
|
119
|
+
## Pricing
|
|
120
|
+
|
|
121
|
+
| Tier | Price | What you get |
|
|
122
|
+
|------|-------|-------------|
|
|
123
|
+
| **Free** | £0 | 5 scans/month, 100 files, summary output |
|
|
124
|
+
| **Pro** | £19/mo | Unlimited scans, full details, auto-fix, all features |
|
|
125
|
+
| **Team** | £99/mo | 5 seats, CI Action, team reports |
|
|
126
|
+
| **Enterprise** | Custom | Unlimited seats, self-hosted, SLA, SSO |
|
|
127
|
+
|
|
128
|
+
---
|
|
129
|
+
|
|
130
|
+
## Requirements
|
|
131
|
+
|
|
132
|
+
- Node.js 16+
|
|
133
|
+
- Works on Windows, macOS, Linux
|
|
134
|
+
- Zero npm dependencies — runs with just Node.js built-ins
|
|
135
|
+
|
|
136
|
+
---
|
|
137
|
+
|
|
138
|
+
## How It Works
|
|
139
|
+
|
|
140
|
+
Thuban runs entirely locally. Your code never leaves your machine. It uses static analysis, pattern matching, and heuristic detection — no API calls, no cloud, no telemetry.
|
|
141
|
+
|
|
142
|
+
---
|
|
143
|
+
|
|
144
|
+
## License
|
|
145
|
+
|
|
146
|
+
Proprietary. Free tier available. See [thuban.dev](https://thuban.dev) for details.
|
|
147
|
+
|
|
148
|
+
---
|
|
149
|
+
|
|
150
|
+
Built by [Silverwings](https://silverwingsbenefits.com)
|