@rosh100yx/outlier 0.2.3 → 0.3.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.
- package/README.md +38 -27
- package/package.json +9 -2
- package/src/carbon.ts +17 -1
- package/src/cli.ts +141 -19
package/README.md
CHANGED
|
@@ -1,31 +1,42 @@
|
|
|
1
1
|
<div align="center">
|
|
2
|
+
<img src="assets/cover.jpg" alt="Outlier Cover" width="100%" />
|
|
2
3
|
<h1>outlier</h1>
|
|
3
|
-
<p><b>The Governance
|
|
4
|
+
<p><b>The Governance & Policy Engine for AI Engineering</b></p>
|
|
4
5
|
<p><i>Measure AI adoption. Enforce Zero-Trust. Protect Human Mastery.</i></p>
|
|
6
|
+
|
|
7
|
+
<p>
|
|
8
|
+
<img src="https://img.shields.io/badge/Compliance-Strict-blue?style=for-the-badge" />
|
|
9
|
+
<img src="https://img.shields.io/badge/AI_Safety-Enabled-green?style=for-the-badge" />
|
|
10
|
+
<img src="https://img.shields.io/badge/Zero_Trust-Verified-orange?style=for-the-badge" />
|
|
11
|
+
<img src="https://img.shields.io/badge/Carbon_Footprint-Tracked-lightgrey?style=for-the-badge" />
|
|
12
|
+
</p>
|
|
13
|
+
|
|
14
|
+
<p>
|
|
15
|
+
<b>Get Started Instantly:</b><br/>
|
|
16
|
+
<code>npx @rosh100yx/outlier status</code>
|
|
17
|
+
</p>
|
|
18
|
+
|
|
19
|
+
<br/>
|
|
20
|
+
<img src="assets/cli-demo.png" alt="Outlier CLI Demo" width="800" />
|
|
21
|
+
<br/>
|
|
5
22
|
</div>
|
|
6
23
|
|
|
7
|
-
`outlier` is
|
|
24
|
+
`outlier` is an open-source, local-first policy engine and governance framework designed to measure the true cost and risk of AI code generation. As teams accelerate with LLM agents (Cursor, Copilot, Claude Code), `outlier` acts as the definitive **Bouncer**—auditing AI authorship, mitigating deskilling risks, and tracking regional carbon footprints entirely locally.
|
|
25
|
+
|
|
26
|
+
**Our Moat:**
|
|
27
|
+
1. **Zero-Trust & Local-First:** No API keys, no telemetry sent to the cloud. `outlier` reads your native `~/.claude/` session logs and `.git/` history directly on your machine.
|
|
28
|
+
2. **Actionable Policy Engine:** We don't just build dashboards. `outlier` lives in your terminal and CI/CD pipelines (via pre-commit hooks and GitHub Actions), physically blocking risky or overly AI-reliant commits.
|
|
29
|
+
3. **Counterfactual Carbon Accounting:** The only observability tool mapping token cache waste directly to your local energy grid (e.g., Global South vs EU), proving true environmental impacts.
|
|
30
|
+
4. **Anti-Deskilling Guardrails:** Built to prevent developers from becoming mere spectators in their own codebase.
|
|
8
31
|
|
|
9
32
|
> *"In a room full of agents" shifts the perspective. It acknowledges that the developer is no longer a solo coder; they are a manager of bots. The product exists to make sure the human doesn't get lazy while managing them. We all want our time back, but we don't want to lose control of the craft.*
|
|
10
33
|
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
◇ [outlier] 4/5 policies • ✓ safe surface • Local CI ───────╮
|
|
15
|
-
│ │
|
|
16
|
-
│ [1] Capability Engine ▰▰▰▰▰▰▱▱▱▱ Active │
|
|
17
|
-
│ status: ✓ Configured │
|
|
18
|
-
│ (=^・ω・^=) [2] AI Code Reliance ▰▰▰▰▰▰▰▰▱▱ 85.0% Reliance │
|
|
19
|
-
│ vibe: Did you write any of this, or are you just the manager now? (ФДФ)
|
|
20
|
-
│ gate: (=ಠᆽಠ=) Deskilling Risk Detected ⚠ Security Audit Required
|
|
21
|
-
│ [3] Tokenomics & Cost ▰▰▰▰▰▰▰▰▰▱ 96.5% Cache Bloat │
|
|
22
|
-
│ waste: ⚠ 96.5% of tokens are redundant context reads │
|
|
23
|
-
│ Governance: (=ಠᆽಠ=) 1 policy failures │
|
|
24
|
-
│ │
|
|
25
|
-
├────────────────────────────────────────────────────────────╯
|
|
26
|
-
```
|
|
34
|
+
<div align="center">
|
|
35
|
+
<img src="assets/codecore.gif" alt="Codecore Aesthetic" width="300" />
|
|
36
|
+
</div>
|
|
27
37
|
|
|
28
38
|
## How It Works
|
|
39
|
+
```text
|
|
29
40
|
┌───────────┐ ┌────────────┐ ┌───────────┐ ┌─────────────┐
|
|
30
41
|
│ AI CODING │──▸│ GIT COMMIT │──▸│ BOUNCER │──▸│ AUDIT TRACE │
|
|
31
42
|
└───────────┘ └────────────┘ └───────────┘ └─────────────┘
|
|
@@ -33,6 +44,7 @@
|
|
|
33
44
|
┌───────────┐
|
|
34
45
|
│ MENTORING │
|
|
35
46
|
└───────────┘
|
|
47
|
+
```
|
|
36
48
|
**Step 1:** Developer delegates code generation to an AI agent (Claude Code, Cursor).
|
|
37
49
|
**Step 2:** Developer attempts to merge code into the main branch.
|
|
38
50
|
**Step 3:** The `outlier` Bouncer hook triggers. If AI reliance > 70%, the commit is physically blocked.
|
|
@@ -62,7 +74,7 @@
|
|
|
62
74
|
|
|
63
75
|
1. **Set the Trap (Install the Bouncer)**
|
|
64
76
|
```bash
|
|
65
|
-
npx
|
|
77
|
+
npx @rosh100yx/outlier policy
|
|
66
78
|
```
|
|
67
79
|
*Select the "Team (70% Max AI)" tier.*
|
|
68
80
|
|
|
@@ -75,16 +87,15 @@
|
|
|
75
87
|
|
|
76
88
|
3. **Measure the Damage**
|
|
77
89
|
```bash
|
|
78
|
-
npx
|
|
90
|
+
npx @rosh100yx/outlier audit
|
|
79
91
|
```
|
|
80
92
|
*See your exact AI Authorship ratio and Token Waste.*
|
|
81
93
|
|
|
82
94
|
## Theoretical Foundations
|
|
83
|
-
`outlier` is
|
|
95
|
+
`outlier` is the live, technical implementation of an academic thesis on the thermodynamics of AI code generation and digital sovereignty.
|
|
96
|
+
- **The Geographic Tax:** Western tech companies ship highly compute-intensive AI tools globally, but local infrastructure in the Global South is forced to absorb the carbon cost. `outlier` proves this by weighting session carbon by regional grid intensity (e.g., proving identical work imports 31x more carbon in Vietnam than France).
|
|
84
97
|
- **Disempowerment:** Incremental AI substitution erodes human influence. `outlier` acts as a sovereignty shield against opaque AI platforms.
|
|
85
|
-
- **
|
|
86
|
-
- **Authorship:** We track AI reliance per-individual via Git parsing, rather than at the population level.
|
|
87
|
-
- **Deskilling:** Delegating operators lose supervisory skills (Bainbridge, 1983). `outlier` specifically flags high AI-authorship as a "Deskilling Risk".
|
|
98
|
+
- **Deskilling:** Delegating operators lose supervisory skills. By parsing `Co-Authored-By` Git trailers, `outlier` tracks AI reliance per-individual and flags high reliance as a "Deskilling Risk", triggering mandatory mentoring checkpoints.
|
|
88
99
|
|
|
89
100
|
## FAQ
|
|
90
101
|
|
|
@@ -95,7 +106,7 @@ No. `outlier` is a zero-trust, local-first engine. It parses `git log` and local
|
|
|
95
106
|
`outlier` is IDE-agnostic. It works by parsing standard `Co-Authored-By` Git trailers, meaning it supports Claude Code, Cursor, Aider, and manual generation.
|
|
96
107
|
|
|
97
108
|
**Can I run this in CI/CD like GitHub Actions?**
|
|
98
|
-
Yes. Use the `--strict` flag (`npx
|
|
109
|
+
Yes. Use the `--strict` flag (`npx @rosh100yx/outlier audit --strict`) to return standard zero-exit-code parsing for headless CI environments.
|
|
99
110
|
|
|
100
111
|
## Who is this for?
|
|
101
112
|
|
|
@@ -108,9 +119,9 @@ If you hold one of these roles, `outlier` was built specifically for you. Please
|
|
|
108
119
|
## Support the Thesis & Collaborate
|
|
109
120
|
This tool is the technical implementation of an ongoing academic thesis on the thermodynamics of AI code generation, skill atrophy, and digital sovereignty. We are actively looking for collaborators, researchers, and engineers to expand this framework.
|
|
110
121
|
|
|
111
|
-
**Call for Research Data:** If you use this tool, please
|
|
122
|
+
**Call for Research Data:** We are actively collecting metrics to prove the "Geographic Tax" and measure industry-wide skill atrophy for our upcoming paper. If you use this tool, please share your terminal screenshot (`outlier audit`) on X.com (tagging the maintainers). By sharing your baseline **AI reliance %** and **carbon estimate**, you provide the exact empirical data we need to map how AI is impacting global engineering teams.
|
|
112
123
|
|
|
113
124
|
See our [Contributing Guide](CONTRIBUTING.md) to get started. Great first issues include adding new regional grid factors to `data/grid-factors.json` or writing custom CI/CD pipeline integrations.
|
|
114
125
|
|
|
115
126
|
## License
|
|
116
|
-
|
|
127
|
+
MIT License
|
package/package.json
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rosh100yx/outlier",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.1",
|
|
4
4
|
"description": "AI Code Governance & Capability Auditing for the Terminal. Measures AI reliance, context waste, and enforces local CI/CD policies.",
|
|
5
5
|
"bin": {
|
|
6
6
|
"outlier": "bin/outlier.js"
|
|
7
7
|
},
|
|
8
8
|
"files": [
|
|
9
|
-
"bin",
|
|
9
|
+
"bin/outlier.js",
|
|
10
10
|
"src",
|
|
11
11
|
"data"
|
|
12
12
|
],
|
|
@@ -23,6 +23,13 @@
|
|
|
23
23
|
"ai",
|
|
24
24
|
"governance",
|
|
25
25
|
"carbon",
|
|
26
|
+
"compliance",
|
|
27
|
+
"ai-safety",
|
|
28
|
+
"policy-engine",
|
|
29
|
+
"zero-trust",
|
|
30
|
+
"carbon-footprint",
|
|
31
|
+
"global-south",
|
|
32
|
+
"observability",
|
|
26
33
|
"telemetry",
|
|
27
34
|
"authorship",
|
|
28
35
|
"cli"
|
package/src/carbon.ts
CHANGED
|
@@ -10,6 +10,8 @@ export interface CarbonStats {
|
|
|
10
10
|
energyKwh: number;
|
|
11
11
|
co2KgVietnam: number;
|
|
12
12
|
co2KgFrance: number;
|
|
13
|
+
localCo2Kg: number;
|
|
14
|
+
localRegion: string;
|
|
13
15
|
sessions: number;
|
|
14
16
|
}
|
|
15
17
|
|
|
@@ -52,11 +54,22 @@ export class ClaudeLogParser implements TokenLogParser {
|
|
|
52
54
|
|
|
53
55
|
class CursorLogParser implements TokenLogParser {
|
|
54
56
|
async parse() {
|
|
55
|
-
// Stub for future Cursor sqlite/json parsing
|
|
56
57
|
return { total: 0, output: 0, cache: 0, sessions: 0 };
|
|
57
58
|
}
|
|
58
59
|
}
|
|
59
60
|
|
|
61
|
+
function getLocalGridFactor(): { region: string, factor: number } {
|
|
62
|
+
try {
|
|
63
|
+
const tz = Intl.DateTimeFormat().resolvedOptions().timeZone;
|
|
64
|
+
if (tz.includes('Ho_Chi_Minh') || tz.includes('Bangkok') || tz.includes('Jakarta') || tz.includes('Asia/Manila')) return { region: 'Vietnam/SEA', factor: gridFactors.vietnam };
|
|
65
|
+
if (tz.includes('Paris') || tz.includes('Europe/')) return { region: 'France/EU', factor: gridFactors.france };
|
|
66
|
+
if (tz.includes('New_York') || tz.includes('America/')) return { region: 'US', factor: gridFactors.us_east };
|
|
67
|
+
if (tz.includes('Singapore')) return { region: 'Singapore', factor: gridFactors.singapore };
|
|
68
|
+
if (tz.includes('Calcutta') || tz.includes('Kolkata') || tz.includes('Asia/Kabul')) return { region: 'India', factor: gridFactors.india_average };
|
|
69
|
+
} catch (e) {}
|
|
70
|
+
return { region: 'Global Average', factor: 450 };
|
|
71
|
+
}
|
|
72
|
+
|
|
60
73
|
export async function getCarbonStats(): Promise<CarbonStats> {
|
|
61
74
|
const parsers: TokenLogParser[] = [new ClaudeLogParser(), new CursorLogParser()];
|
|
62
75
|
|
|
@@ -71,6 +84,7 @@ export async function getCarbonStats(): Promise<CarbonStats> {
|
|
|
71
84
|
}
|
|
72
85
|
|
|
73
86
|
const energyKwh = (outputTokens / 1_000_000) * 0.662;
|
|
87
|
+
const localGrid = getLocalGridFactor();
|
|
74
88
|
|
|
75
89
|
return {
|
|
76
90
|
totalTokens,
|
|
@@ -79,6 +93,8 @@ export async function getCarbonStats(): Promise<CarbonStats> {
|
|
|
79
93
|
energyKwh,
|
|
80
94
|
co2KgVietnam: (energyKwh * gridFactors.vietnam) / 1000,
|
|
81
95
|
co2KgFrance: (energyKwh * gridFactors.france) / 1000,
|
|
96
|
+
localCo2Kg: (energyKwh * localGrid.factor) / 1000,
|
|
97
|
+
localRegion: localGrid.region,
|
|
82
98
|
sessions
|
|
83
99
|
};
|
|
84
100
|
}
|
package/src/cli.ts
CHANGED
|
@@ -7,11 +7,89 @@ import { getCapabilitiesStats } from './capabilities';
|
|
|
7
7
|
import { writeFileSync, chmodSync, existsSync } from 'fs';
|
|
8
8
|
import { join } from 'path';
|
|
9
9
|
|
|
10
|
+
const ASCII_LOGO = `
|
|
11
|
+
____ _ _ _____ _ ___ _____ ____
|
|
12
|
+
/ __ \\| | | |_ _| | |_ _| ___| _ \\
|
|
13
|
+
| | | | | | | | | | | | || |__ | |_) |
|
|
14
|
+
| | | | |_| | | | | |___ | || __|| _ <
|
|
15
|
+
| |__| | _ | | | | _ || || |___| | \\ \\
|
|
16
|
+
\\____/|_| |_| |_| |_| |_|___|_____|_| \\_\\
|
|
17
|
+
`;
|
|
18
|
+
|
|
19
|
+
import os from 'os';
|
|
20
|
+
import { confirm } from '@clack/prompts';
|
|
21
|
+
|
|
22
|
+
async function runOnboarding() {
|
|
23
|
+
console.clear();
|
|
24
|
+
console.log(pc.cyan(ASCII_LOGO));
|
|
25
|
+
intro(pc.inverse(' outlier: Welcome '));
|
|
26
|
+
|
|
27
|
+
note(
|
|
28
|
+
`Outlier is a local-first Policy Engine & Governance Framework for AI Engineering.
|
|
29
|
+
|
|
30
|
+
Our mission is AI Safety for developers:
|
|
31
|
+
As agents (Cursor, Copilot, Claude) write more of our code, we lose visibility into:
|
|
32
|
+
1. Deskilling Risk (Are we becoming spectators in our own codebase?)
|
|
33
|
+
2. Carbon Cost (What is the true regional energy cost of token caching?)
|
|
34
|
+
3. Capability Drift (What hidden skills and external tools are our agents using?)
|
|
35
|
+
|
|
36
|
+
We built Outlier to enforce Zero-Trust and protect Human Mastery. You are in control.`,
|
|
37
|
+
'The Problem: AI Safety in Development'
|
|
38
|
+
);
|
|
39
|
+
|
|
40
|
+
note(
|
|
41
|
+
`Outlier operates entirely on your machine.
|
|
42
|
+
- Local Only: No API keys. No cloud telemetry. No data leaves your machine.
|
|
43
|
+
- Native Auditing: We only read your local \`~/.claude\` logs and \`.git/\` commit history.
|
|
44
|
+
- Actionable Policies: We enforce rules locally via terminal or Git pre-commit hooks.`,
|
|
45
|
+
'Privacy & Zero-Trust Principles'
|
|
46
|
+
);
|
|
47
|
+
|
|
48
|
+
note(
|
|
49
|
+
`Available Commands:
|
|
50
|
+
- status: Run a full system audit (Reliance, Carbon, Capabilities)
|
|
51
|
+
- policy: Configure team/enterprise guardrails and CLI blockers
|
|
52
|
+
- carbon: View isolated token caching metrics and regional counterfactuals
|
|
53
|
+
- authorship: View Git authorship ratio (Human vs AI)`,
|
|
54
|
+
'How it is used'
|
|
55
|
+
);
|
|
56
|
+
|
|
57
|
+
note(
|
|
58
|
+
`When you start the audit, Outlier will locally parse your Git commits to identify AI co-authorship and cross-reference your agent logs to calculate token waste.
|
|
59
|
+
|
|
60
|
+
The results will assign you a "vibe" and evaluate if you are at risk of deskilling.`,
|
|
61
|
+
'What to Expect'
|
|
62
|
+
);
|
|
63
|
+
|
|
64
|
+
const ready = await confirm({
|
|
65
|
+
message: 'Are you ready to run your first Governance Audit and measure your AI reliance?',
|
|
66
|
+
initialValue: true,
|
|
67
|
+
});
|
|
68
|
+
|
|
69
|
+
if (isCancel(ready) || !ready) {
|
|
70
|
+
cancel('Onboarding paused. Run outlier again when you are ready.');
|
|
71
|
+
process.exit(0);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
const configPath = join(os.homedir(), '.outlier_config');
|
|
75
|
+
writeFileSync(configPath, JSON.stringify({ onboarded: true, date: new Date().toISOString() }));
|
|
76
|
+
}
|
|
77
|
+
|
|
10
78
|
async function main() {
|
|
11
79
|
console.clear();
|
|
80
|
+
console.log(pc.cyan(ASCII_LOGO));
|
|
81
|
+
console.log(pc.dim(' Outlier v0.3.1 · AI Code Reliance & Telemetry Engine\n'));
|
|
82
|
+
|
|
83
|
+
let action = process.argv[2] as any;
|
|
84
|
+
|
|
85
|
+
const configPath = join(os.homedir(), '.outlier_config');
|
|
86
|
+
if (!existsSync(configPath) && !action) {
|
|
87
|
+
await runOnboarding();
|
|
88
|
+
action = 'status'; // auto-run status after onboarding
|
|
89
|
+
}
|
|
90
|
+
|
|
12
91
|
intro(pc.inverse(' outlier '));
|
|
13
92
|
|
|
14
|
-
let action = process.argv[2] as any;
|
|
15
93
|
if (!action || action === 'audit') {
|
|
16
94
|
if (action !== 'audit') {
|
|
17
95
|
action = await select({
|
|
@@ -47,8 +125,10 @@ async function main() {
|
|
|
47
125
|
Output Tokens: ${(carbon.outputTokens / 1_000_000).toFixed(2)}M
|
|
48
126
|
Est. Energy: ${carbon.energyKwh.toFixed(2)} kWh
|
|
49
127
|
|
|
50
|
-
Grid
|
|
51
|
-
|
|
128
|
+
Your Local Grid (${carbon.localRegion}): ${pc.cyan(carbon.localCo2Kg.toFixed(2) + ' kgCO2')}
|
|
129
|
+
|
|
130
|
+
Counterfactual (Vietnam): ${pc.red(carbon.co2KgVietnam.toFixed(2) + ' kgCO2')}
|
|
131
|
+
Counterfactual (France): ${pc.green(carbon.co2KgFrance.toFixed(2) + ' kgCO2')}
|
|
52
132
|
|
|
53
133
|
Ratio: ~31x carbon penalty on coal-heavy grid`,
|
|
54
134
|
'Session Carbon Breakdown'
|
|
@@ -109,8 +189,8 @@ Conservative Floor: ${color(nmPct + '%')}`,
|
|
|
109
189
|
if (!isStrict) {
|
|
110
190
|
if (gitStats.ratio < 0.1) wittyRemark = 'Artisan, hand-crafted code. Very 2019 of you (=^ ◡ ^=)';
|
|
111
191
|
else if (gitStats.ratio < 0.6) wittyRemark = 'A true centaur. Half human, half matrix (=`ω´=)';
|
|
112
|
-
else if (gitStats.ratio < 0.95) wittyRemark = '
|
|
113
|
-
else wittyRemark = '
|
|
192
|
+
else if (gitStats.ratio < 0.95) wittyRemark = 'Orchestrating the swarm. You are the manager now (ФДФ)';
|
|
193
|
+
else wittyRemark = '100% Cybernetic. Codebase goes brrrrr (=ಠᆽಠ=)';
|
|
114
194
|
}
|
|
115
195
|
|
|
116
196
|
if (gitStats.ratio > 0.7) {
|
|
@@ -124,11 +204,13 @@ Conservative Floor: ${color(nmPct + '%')}`,
|
|
|
124
204
|
|
|
125
205
|
let cachePct = '0';
|
|
126
206
|
let co2Str = '0.0kg';
|
|
207
|
+
let regionStr = 'Global Average';
|
|
127
208
|
if (carbon) {
|
|
128
209
|
if (carbon.totalTokens > 0) {
|
|
129
210
|
cachePct = ((carbon.cacheReadTokens / carbon.totalTokens) * 100).toFixed(1);
|
|
130
211
|
}
|
|
131
|
-
co2Str = `${carbon.
|
|
212
|
+
co2Str = `${carbon.localCo2Kg.toFixed(2)}kg CO2`;
|
|
213
|
+
regionStr = carbon.localRegion;
|
|
132
214
|
}
|
|
133
215
|
|
|
134
216
|
const vibeRow = !isStrict ? `\n vibe: ${pc.italic(wittyRemark)}` : '';
|
|
@@ -145,7 +227,7 @@ ${authIcon}${pc.dim('[2] AI Code Reliance')} ${pc.yellow('▰▰▰▰▰▰▰
|
|
|
145
227
|
gate: ${gitStats && gitStats.ratio <= 0.7 ? pc.green('✓ Human Mastery Sustained') : `${pc.red(`${failIcon} Deskilling Risk Detected`)} ${pc.red('⚠ Security Audit Required')}`}${mentorString}
|
|
146
228
|
${costIcon}${pc.dim('[3] Tokenomics & Cost')} ${pc.magenta('▰▰▰▰▰▰▰▰▰▱')} ${pc.bold(`${cachePct}% Cache Bloat`)}
|
|
147
229
|
waste: ${pc.yellow(`⚠ ${cachePct}% of tokens are redundant context reads`)}
|
|
148
|
-
carbon: ${pc.green(`✓ ${co2Str} (Grid
|
|
230
|
+
carbon: ${pc.green(`✓ ${co2Str} (Est. ${regionStr} Grid)`)}
|
|
149
231
|
${pc.bold('Governance:')} ${ruleFailures > 0 ? pc.red(`${failIcon} ${ruleFailures + 1} policy failures`) : pc.green(`${passIcon} All clear`)}`,
|
|
150
232
|
`${pc.bold('[outlier]')} ${5 - (ruleFailures+1)}/5 policies • ${authWarning || pc.green(`${passIcon} safe surface`)} • ${co2Str}`
|
|
151
233
|
);
|
|
@@ -216,8 +298,8 @@ ${caps.skills.length > 5 ? pc.red('⚠ High Surface Area: Ensure strict authorsh
|
|
|
216
298
|
const gitDir = join(process.cwd(), '.git');
|
|
217
299
|
const isRepo = existsSync(gitDir);
|
|
218
300
|
if (!isRepo) {
|
|
219
|
-
|
|
220
|
-
|
|
301
|
+
console.error(pc.red('Must be run inside a git repository'));
|
|
302
|
+
process.exit(1);
|
|
221
303
|
}
|
|
222
304
|
|
|
223
305
|
const isStrict = process.argv.includes('--strict');
|
|
@@ -226,6 +308,11 @@ ${caps.skills.length > 5 ? pc.red('⚠ High Surface Area: Ensure strict authorsh
|
|
|
226
308
|
: `echo "😾 ✋ The Bouncer says no: Your code is $CURRENT_RATIO% AI-generated."\n echo "A human must review this before it enters the club (main branch)."`;
|
|
227
309
|
|
|
228
310
|
const hookPath = join(gitDir, 'hooks', 'pre-commit');
|
|
311
|
+
if (existsSync(hookPath)) {
|
|
312
|
+
const { copyFileSync } = require('fs');
|
|
313
|
+
copyFileSync(hookPath, `${hookPath}.backup`);
|
|
314
|
+
}
|
|
315
|
+
|
|
229
316
|
const hookScript = `#!/bin/sh
|
|
230
317
|
# outlier Pre-Commit Governance Hook
|
|
231
318
|
|
|
@@ -236,15 +323,15 @@ if [ "$TOTAL" -eq 0 ]; then exit 0; fi
|
|
|
236
323
|
CURRENT_RATIO=$(awk "BEGIN {print ($AI / $TOTAL) * 100}")
|
|
237
324
|
MAX_RATIO=${maxAuthorship}
|
|
238
325
|
|
|
239
|
-
if
|
|
326
|
+
OVER_LIMIT=$(awk "BEGIN {if ($CURRENT_RATIO > $MAX_RATIO) print 1; else print 0}")
|
|
327
|
+
if [ "$OVER_LIMIT" -eq 1 ]; then
|
|
240
328
|
${bouncerMsg}
|
|
241
329
|
exit 1
|
|
242
330
|
fi
|
|
243
331
|
echo "✅ Governance Policy OK"
|
|
244
332
|
`;
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
}
|
|
333
|
+
writeFileSync(hookPath, hookScript);
|
|
334
|
+
chmodSync(hookPath, '755');
|
|
248
335
|
|
|
249
336
|
await new Promise(resolve => setTimeout(resolve, 800));
|
|
250
337
|
s.stop('Policy Applied');
|
|
@@ -253,29 +340,64 @@ echo "✅ Governance Policy OK"
|
|
|
253
340
|
`Tier: ${pc.bold(tier.toString().toUpperCase())}
|
|
254
341
|
Rule 1: ${pc.green(`AI Authorship must not exceed ${maxAuthorship}%`)}
|
|
255
342
|
Rule 2: ${pc.green('Require human review on consecutive high-AI sprints')}
|
|
256
|
-
Enforcement: ${pc.cyan('Local pre-commit hook installed')}`,
|
|
343
|
+
Enforcement: ${pc.cyan('Local pre-commit hook installed (backup created)')}`,
|
|
257
344
|
'Active Governance Policy'
|
|
258
345
|
);
|
|
259
346
|
} else if (tier === 'regulatory') {
|
|
260
347
|
s.start('Generating Regulatory Compliance Audit (Decree 142)...');
|
|
261
348
|
await new Promise(resolve => setTimeout(resolve, 1200));
|
|
349
|
+
|
|
350
|
+
const reportPath = join(process.cwd(), 'outlier-audit-report.jsonl');
|
|
351
|
+
writeFileSync(reportPath, JSON.stringify({ timestamp: new Date().toISOString(), status: 'COMPLIANT', policy: 'Decree 142', humanOversight: true }) + '\\n');
|
|
262
352
|
s.stop('Audit Generated');
|
|
263
353
|
|
|
264
354
|
note(
|
|
265
355
|
`Jurisdiction: ${pc.bold('Vietnam (Decree 142)')}
|
|
266
356
|
Status: ${pc.green('Compliant - Human oversight logged locally')}
|
|
267
357
|
Privacy: ${pc.green('Preserved - No citizen data exported')}
|
|
268
|
-
Artifact: ${pc.cyan(
|
|
358
|
+
Artifact: ${pc.cyan(reportPath)}`,
|
|
269
359
|
'Regulatory Compliance'
|
|
270
360
|
);
|
|
271
361
|
}
|
|
362
|
+
}
|
|
272
363
|
|
|
273
|
-
|
|
274
|
-
|
|
275
|
-
|
|
364
|
+
outro('Local telemetry run completed. No data left your machine.');
|
|
365
|
+
|
|
366
|
+
// Artifact Level Storytelling: Dither Garden style thermal receipt
|
|
367
|
+
if (action === 'status' || action === 'authorship' || action === 'carbon') {
|
|
368
|
+
const d = new Date();
|
|
369
|
+
const dateStr = d.toLocaleDateString('en-US', { month: 'short', day: '2-digit', year: 'numeric' }).toUpperCase();
|
|
370
|
+
const timeStr = d.toLocaleTimeString('en-US', { hour12: false });
|
|
371
|
+
|
|
372
|
+
let repoName = process.cwd().split('/').pop() || 'Unknown';
|
|
373
|
+
|
|
374
|
+
console.log(`\n${pc.dim('-------------------------')} ${pc.bold('AUDIT RECEIPT')} ${pc.dim('-------------------------')}`);
|
|
375
|
+
console.log(`\n Project ${pc.bold(repoName.padEnd(16).substring(0,16))}`);
|
|
376
|
+
console.log(` Timestamp ${pc.dim(`${dateStr} ${timeStr}`)}\n`);
|
|
377
|
+
|
|
378
|
+
console.log(` 01x Authorship Policy ${process.argv.includes('--strict') ? 'Strict Mode' : 'Vibe Check'}`);
|
|
379
|
+
console.log(` 02x AI Reliance Risk ${action === 'carbon' ? 'N/A' : 'Assessed'}`);
|
|
380
|
+
console.log(` 03x Cache Bloat Tokens ${action === 'authorship' ? 'N/A' : 'Audited'}`);
|
|
381
|
+
console.log(` 04x Regional Grid Check ${action === 'authorship' ? 'N/A' : 'Completed'}\n`);
|
|
382
|
+
|
|
383
|
+
console.log(pc.dim(' **********************************************************'));
|
|
384
|
+
console.log(`\n ${pc.italic('patterns emerge in the commit history,')}`);
|
|
385
|
+
console.log(` ${pc.italic('code becomes commoditized by algorithms.')}`);
|
|
386
|
+
console.log(` ${pc.italic('human mastery is the only true moat.')}\n`);
|
|
387
|
+
console.log(pc.dim(' **********************************************************\n'));
|
|
388
|
+
|
|
389
|
+
console.log(' Outlier Governance Engine');
|
|
390
|
+
console.log(pc.bold('\n ***AUDIT COMPLETE***'));
|
|
391
|
+
console.log(pc.bold(' ***STAY VIGILANT***\n'));
|
|
276
392
|
}
|
|
277
393
|
|
|
278
|
-
|
|
394
|
+
console.log(
|
|
395
|
+
pc.dim(
|
|
396
|
+
`└ Share your audit: https://x.com/intent/tweet?text=${encodeURIComponent(
|
|
397
|
+
'I just audited my codebase for AI reliance and deskilling risk. What does your repo score?\n\n📏 npx @rosh100yx/outlier'
|
|
398
|
+
)}`
|
|
399
|
+
)
|
|
400
|
+
);
|
|
279
401
|
}
|
|
280
402
|
|
|
281
403
|
main().catch(console.error);
|