@atlasnomos/atlas 1.1.3 → 1.1.8
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/atlas.js +17 -1
- package/package.json +2 -1
- package/src/interface/cli/commands/InitCommand.js +100 -28
package/atlas.js
CHANGED
|
@@ -115,7 +115,23 @@ const { ModelsCommand } = require('./src/interface/cli/commands/ModelsCommand');
|
|
|
115
115
|
console.error('\n⚠️ DRY-RUN MODE ACTIVE: No changes will be persisted.\n');
|
|
116
116
|
}
|
|
117
117
|
|
|
118
|
-
|
|
118
|
+
// PHASE 4: Setup Flow Interception
|
|
119
|
+
const command = rawArgs[0] || 'doctor';
|
|
120
|
+
const isSetupCommand = ['init', 'help', '--help', '-h', '--version', '-v', 'config'].includes(command);
|
|
121
|
+
|
|
122
|
+
let context;
|
|
123
|
+
if (isSetupCommand) {
|
|
124
|
+
// Use minimal context for setup commands to bypass Ring-1 validation
|
|
125
|
+
context = {
|
|
126
|
+
tierManager: { getTier: () => 'DEV', displayBanner: () => { } },
|
|
127
|
+
trace: { log: () => { } },
|
|
128
|
+
auditSink: { log: () => { } },
|
|
129
|
+
costTracker: { log: () => { } }
|
|
130
|
+
};
|
|
131
|
+
} else {
|
|
132
|
+
// Full kernel boot for governed commands
|
|
133
|
+
context = await bootstrap.boot();
|
|
134
|
+
}
|
|
119
135
|
|
|
120
136
|
const dispatcher = new CommandDispatcher(context);
|
|
121
137
|
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atlasnomos/atlas",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.8",
|
|
4
4
|
"description": "Production-grade AI governance kernel for autonomous agents with fail-closed security and cryptographic audit trails",
|
|
5
5
|
"main": "atlas.js",
|
|
6
6
|
"bin": {
|
|
@@ -80,6 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"devDependencies": {
|
|
82
82
|
"@types/express": "5.0.6",
|
|
83
|
+
"@types/node": "^18.19.74",
|
|
83
84
|
"@types/node-fetch": "2.6.13",
|
|
84
85
|
"axios-mock-adapter": "1.22.0",
|
|
85
86
|
"chai": "4.3.10",
|
|
@@ -1,49 +1,121 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* ATLAS V1 — Init Command
|
|
3
|
-
* Initialized Model Configuration Plane
|
|
2
|
+
* ATLAS V1 — Init Command (Interactive)
|
|
3
|
+
* Initialized Model Configuration Plane and Environment setup
|
|
4
4
|
*/
|
|
5
5
|
|
|
6
6
|
const fs = require('fs');
|
|
7
7
|
const path = require('path');
|
|
8
|
+
const { Input, Password } = require('enquirer');
|
|
8
9
|
|
|
9
10
|
class InitCommand {
|
|
10
11
|
constructor() { }
|
|
11
12
|
|
|
12
13
|
async execute(args) {
|
|
13
|
-
console.log('
|
|
14
|
+
console.log('\n╔═══════════════════════════════════════════════════════════════╗');
|
|
15
|
+
console.log('║ ATLAS Governance Kernel — Setup Wizard ║');
|
|
16
|
+
console.log('╚═══════════════════════════════════════════════════════════════╝\n');
|
|
14
17
|
|
|
15
|
-
const
|
|
18
|
+
const envPath = path.join(process.cwd(), '.env');
|
|
19
|
+
const modelsPath = path.join(process.cwd(), 'atlas.models.json');
|
|
16
20
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
21
|
+
// 1. Collect API Keys
|
|
22
|
+
console.log(' [1/3] Configuring Provider Credentials...');
|
|
23
|
+
|
|
24
|
+
let existingEnv = {};
|
|
25
|
+
if (fs.existsSync(envPath)) {
|
|
26
|
+
const content = fs.readFileSync(envPath, 'utf8');
|
|
27
|
+
content.split('\n').forEach(line => {
|
|
28
|
+
const [k, v] = line.split('=');
|
|
29
|
+
if (k) existingEnv[k.trim()] = (v || '').trim();
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
const keys = {
|
|
34
|
+
OPENROUTER_API_KEY: await new Password({
|
|
35
|
+
message: 'Enter OpenRouter API Key (Recommended)',
|
|
36
|
+
initial: existingEnv.OPENROUTER_API_KEY || ''
|
|
37
|
+
}).run(),
|
|
38
|
+
ANTHROPIC_API_KEY: await new Password({
|
|
39
|
+
message: 'Enter Anthropic API Key (Optional)',
|
|
40
|
+
initial: existingEnv.ANTHROPIC_API_KEY || ''
|
|
41
|
+
}).run(),
|
|
42
|
+
OPENAI_API_KEY: await new Password({
|
|
43
|
+
message: 'Enter OpenAI API Key (Optional)',
|
|
44
|
+
initial: existingEnv.OPENAI_API_KEY || ''
|
|
45
|
+
}).run()
|
|
46
|
+
};
|
|
47
|
+
|
|
48
|
+
// 2. Save .env
|
|
49
|
+
let envContent = '# ATLAS Environment Configuration\n';
|
|
50
|
+
for (const [k, v] of Object.entries(keys)) {
|
|
51
|
+
if (v) envContent += `${k}=${v}\n`;
|
|
52
|
+
}
|
|
53
|
+
|
|
54
|
+
// Preserve other env vars
|
|
55
|
+
for (const [k, v] of Object.entries(existingEnv)) {
|
|
56
|
+
if (!keys.hasOwnProperty(k)) {
|
|
57
|
+
envContent += `${k}=${v}\n`;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
fs.writeFileSync(envPath, envContent, 'utf8');
|
|
62
|
+
console.log(' ✓ Saved .env');
|
|
63
|
+
|
|
64
|
+
// 3. Configure Roles
|
|
65
|
+
console.log('\n [2/3] Initializing Mandatory Role Bindings...');
|
|
66
|
+
|
|
67
|
+
const template = {
|
|
68
|
+
"version": "1.0",
|
|
69
|
+
"default_provider": keys.OPENROUTER_API_KEY ? "openrouter" : "anthropic",
|
|
70
|
+
"roles": {
|
|
71
|
+
"planner": {
|
|
72
|
+
"model": "anthropic/claude-3-sonnet",
|
|
73
|
+
"temperature": 0.1,
|
|
74
|
+
"max_tokens": 4096,
|
|
75
|
+
"risk_limit": 1
|
|
76
|
+
},
|
|
77
|
+
"generator": {
|
|
78
|
+
"model": "anthropic/claude-3-sonnet",
|
|
79
|
+
"temperature": 0.2,
|
|
80
|
+
"max_tokens": 4096,
|
|
81
|
+
"risk_limit": 2
|
|
82
|
+
},
|
|
83
|
+
"reviewer": {
|
|
84
|
+
"model": "openai/gpt-4o",
|
|
85
|
+
"temperature": 0.1,
|
|
86
|
+
"max_tokens": 2048,
|
|
87
|
+
"risk_limit": 1
|
|
36
88
|
},
|
|
37
|
-
"
|
|
38
|
-
"
|
|
89
|
+
"fixer": {
|
|
90
|
+
"model": "anthropic/claude-3-sonnet",
|
|
91
|
+
"temperature": 0.1,
|
|
92
|
+
"max_tokens": 4096,
|
|
93
|
+
"risk_limit": 1
|
|
39
94
|
}
|
|
40
|
-
}
|
|
95
|
+
},
|
|
96
|
+
"overrides": {
|
|
97
|
+
"ENV_DEVELOPMENT": true
|
|
98
|
+
}
|
|
99
|
+
};
|
|
41
100
|
|
|
42
|
-
|
|
101
|
+
if (fs.existsSync(modelsPath)) {
|
|
102
|
+
console.log(' ⚠ atlas.models.json already exists. Merge not supported yet. skipping.');
|
|
103
|
+
} else {
|
|
104
|
+
fs.writeFileSync(modelsPath, JSON.stringify(template, null, 4), 'utf8');
|
|
43
105
|
console.log(' ✓ Created atlas.models.json');
|
|
44
106
|
}
|
|
45
107
|
|
|
46
|
-
|
|
108
|
+
// 4. Finalize
|
|
109
|
+
console.log('\n [3/3] Finalizing Workspace...');
|
|
110
|
+
const logsDir = path.join(process.cwd(), '.atlas', 'logs');
|
|
111
|
+
if (!fs.existsSync(logsDir)) {
|
|
112
|
+
fs.mkdirSync(logsDir, { recursive: true });
|
|
113
|
+
}
|
|
114
|
+
console.log(' ✓ Initialized .atlas/ directory');
|
|
115
|
+
|
|
116
|
+
console.log('\n ✨ ATLAS Initialization Complete!');
|
|
117
|
+
console.log(' Run "atlas doctor" to verify your connection.\n');
|
|
118
|
+
|
|
47
119
|
return true;
|
|
48
120
|
}
|
|
49
121
|
}
|