@miller-tech/uap 1.133.1 → 1.134.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/dist/.tsbuildinfo +1 -1
- package/dist/bin/cli.js +4 -1
- package/dist/bin/cli.js.map +1 -1
- package/dist/cli/config-command.d.ts +49 -0
- package/dist/cli/config-command.d.ts.map +1 -0
- package/dist/cli/config-command.js +465 -0
- package/dist/cli/config-command.js.map +1 -0
- package/dist/cli/config-wizard.d.ts +13 -0
- package/dist/cli/config-wizard.d.ts.map +1 -0
- package/dist/cli/config-wizard.js +134 -0
- package/dist/cli/config-wizard.js.map +1 -0
- package/dist/cli/guided-setup.d.ts.map +1 -1
- package/dist/cli/guided-setup.js +11 -0
- package/dist/cli/guided-setup.js.map +1 -1
- package/dist/cli/policy.d.ts.map +1 -1
- package/dist/cli/policy.js +34 -0
- package/dist/cli/policy.js.map +1 -1
- package/dist/cli/setup.d.ts +1 -1
- package/dist/cli/setup.d.ts.map +1 -1
- package/dist/cli/setup.js +22 -0
- package/dist/cli/setup.js.map +1 -1
- package/dist/config/policy-recommendations.d.ts +29 -0
- package/dist/config/policy-recommendations.d.ts.map +1 -0
- package/dist/config/policy-recommendations.js +108 -0
- package/dist/config/policy-recommendations.js.map +1 -0
- package/dist/config/settings-registry.d.ts +65 -0
- package/dist/config/settings-registry.d.ts.map +1 -0
- package/dist/config/settings-registry.js +334 -0
- package/dist/config/settings-registry.js.map +1 -0
- package/dist/dashboard/server.d.ts +9 -0
- package/dist/dashboard/server.d.ts.map +1 -1
- package/dist/dashboard/server.js +21 -6
- package/dist/dashboard/server.js.map +1 -1
- package/docs/INDEX.md +2 -0
- package/docs/guides/POLICY_SELECTION.md +98 -0
- package/docs/reference/CONFIGURATION_REFERENCE.md +688 -0
- package/package.json +1 -1
- package/src/policies/enforcers/__pycache__/_common.cpython-312.pyc +0 -0
- package/tools/agents/scripts/__pycache__/toolcall_path_normalizer.cpython-312.pyc +0 -0
- package/tools/agents/scripts/anthropic_proxy.py +137 -12
|
@@ -0,0 +1,465 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `uap config` — inspect, learn, and set every UAP setting from one place.
|
|
3
|
+
*
|
|
4
|
+
* Driven entirely by the settings registry (src/config/settings-registry.ts):
|
|
5
|
+
* list — every setting, grouped by category, with current value + recommendation
|
|
6
|
+
* get — the current effective value of one setting
|
|
7
|
+
* set — write a setting (.uap.json for json-kind, .uap/proxy.env for
|
|
8
|
+
* proxyEnv-kind; shell-kind prints the export line to add)
|
|
9
|
+
* explain — what a setting does + how to pick a value + how to set it
|
|
10
|
+
* doctor — flag risky / sub-optimal / inconsistent settings for this project
|
|
11
|
+
*/
|
|
12
|
+
import chalk from 'chalk';
|
|
13
|
+
import { chmodSync, existsSync, mkdirSync, readFileSync, writeFileSync } from 'fs';
|
|
14
|
+
import { dirname, join } from 'path';
|
|
15
|
+
import { CATEGORIES, SETTINGS, findSettings, getSetting, settingsByCategory, } from '../config/settings-registry.js';
|
|
16
|
+
import { findUapConfigPath, loadUapConfigRaw, modifyUapConfig } from '../utils/config-loader.js';
|
|
17
|
+
// ── dotted-path helpers over the raw config object ──────────────────────────
|
|
18
|
+
function getPath(obj, path) {
|
|
19
|
+
if (!obj)
|
|
20
|
+
return undefined;
|
|
21
|
+
let cur = obj;
|
|
22
|
+
for (const part of path.split('.')) {
|
|
23
|
+
if (cur == null || typeof cur !== 'object')
|
|
24
|
+
return undefined;
|
|
25
|
+
cur = cur[part];
|
|
26
|
+
}
|
|
27
|
+
return cur;
|
|
28
|
+
}
|
|
29
|
+
function setPath(obj, path, value) {
|
|
30
|
+
const parts = path.split('.');
|
|
31
|
+
// Defense-in-depth: never walk into prototype chains (paths are registry
|
|
32
|
+
// constants today, but keep this a hard invariant).
|
|
33
|
+
if (parts.some((p) => p === '__proto__' || p === 'constructor' || p === 'prototype'))
|
|
34
|
+
return;
|
|
35
|
+
let cur = obj;
|
|
36
|
+
for (let i = 0; i < parts.length - 1; i++) {
|
|
37
|
+
const p = parts[i];
|
|
38
|
+
if (cur[p] == null || typeof cur[p] !== 'object')
|
|
39
|
+
cur[p] = {};
|
|
40
|
+
cur = cur[p];
|
|
41
|
+
}
|
|
42
|
+
cur[parts[parts.length - 1]] = value;
|
|
43
|
+
}
|
|
44
|
+
// ── .uap/proxy.env single-key upsert ────────────────────────────────────────
|
|
45
|
+
function proxyEnvPath(cwd) {
|
|
46
|
+
const cfg = findUapConfigPath(cwd);
|
|
47
|
+
const root = cfg ? dirname(cfg) : cwd;
|
|
48
|
+
return join(root, '.uap', 'proxy.env');
|
|
49
|
+
}
|
|
50
|
+
function readProxyEnv(cwd) {
|
|
51
|
+
const p = proxyEnvPath(cwd);
|
|
52
|
+
const map = new Map();
|
|
53
|
+
if (!existsSync(p))
|
|
54
|
+
return map;
|
|
55
|
+
for (const line of readFileSync(p, 'utf-8').split('\n')) {
|
|
56
|
+
const m = line.match(/^\s*([A-Za-z_][A-Za-z0-9_]*)=(.*)$/);
|
|
57
|
+
if (m)
|
|
58
|
+
map.set(m[1], m[2]);
|
|
59
|
+
}
|
|
60
|
+
return map;
|
|
61
|
+
}
|
|
62
|
+
function upsertProxyEnv(cwd, key, value, secret) {
|
|
63
|
+
const p = proxyEnvPath(cwd);
|
|
64
|
+
mkdirSync(dirname(p), { recursive: true });
|
|
65
|
+
const lines = existsSync(p) ? readFileSync(p, 'utf-8').split('\n') : [];
|
|
66
|
+
// Drop trailing blank lines so we append cleanly (no spurious gaps).
|
|
67
|
+
while (lines.length && lines[lines.length - 1].trim() === '')
|
|
68
|
+
lines.pop();
|
|
69
|
+
// Anchored, key-only match (keys are registry identifiers, so no regex-escape needed).
|
|
70
|
+
const idx = lines.findIndex((l) => l.startsWith(`${key}=`));
|
|
71
|
+
if (idx >= 0)
|
|
72
|
+
lines[idx] = `${key}=${value}`;
|
|
73
|
+
else
|
|
74
|
+
lines.push(`${key}=${value}`);
|
|
75
|
+
writeFileSync(p, lines.join('\n') + '\n');
|
|
76
|
+
if (secret) {
|
|
77
|
+
try {
|
|
78
|
+
chmodSync(p, 0o600);
|
|
79
|
+
}
|
|
80
|
+
catch {
|
|
81
|
+
/* best-effort */
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
return p;
|
|
85
|
+
}
|
|
86
|
+
// ── value read / coerce ─────────────────────────────────────────────────────
|
|
87
|
+
/** The current effective value of a setting (or its default), and where it came from. */
|
|
88
|
+
export function currentValue(cwd, s) {
|
|
89
|
+
if (s.kind === 'json') {
|
|
90
|
+
const raw = loadUapConfigRaw(cwd);
|
|
91
|
+
const v = getPath(raw, s.key);
|
|
92
|
+
return v === undefined ? { value: s.default, source: 'default' } : { value: v, source: '.uap.json' };
|
|
93
|
+
}
|
|
94
|
+
// env kinds
|
|
95
|
+
if (process.env[s.key] !== undefined)
|
|
96
|
+
return { value: process.env[s.key], source: 'env' };
|
|
97
|
+
if (s.target === 'proxyEnv') {
|
|
98
|
+
const v = readProxyEnv(cwd).get(s.key);
|
|
99
|
+
if (v !== undefined)
|
|
100
|
+
return { value: v, source: '.uap/proxy.env' };
|
|
101
|
+
}
|
|
102
|
+
return { value: s.default, source: 'default' };
|
|
103
|
+
}
|
|
104
|
+
function coerce(s, input) {
|
|
105
|
+
// A newline would inject an extra line into .uap/proxy.env (a second, unintended
|
|
106
|
+
// env var) or corrupt the file — reject it for every setting.
|
|
107
|
+
if (/[\r\n]/.test(input))
|
|
108
|
+
return { ok: false, error: 'value must not contain a newline' };
|
|
109
|
+
if (s.type === 'boolean') {
|
|
110
|
+
const t = input.toLowerCase();
|
|
111
|
+
if (['true', '1', 'yes', 'on'].includes(t))
|
|
112
|
+
return { ok: true, value: s.kind === 'env' ? '1' : true };
|
|
113
|
+
if (['false', '0', 'no', 'off'].includes(t))
|
|
114
|
+
return { ok: true, value: s.kind === 'env' ? '0' : false };
|
|
115
|
+
return { ok: false, error: `expected a boolean (true/false), got "${input}"` };
|
|
116
|
+
}
|
|
117
|
+
if (s.type === 'number') {
|
|
118
|
+
const n = Number(input);
|
|
119
|
+
if (!Number.isFinite(n))
|
|
120
|
+
return { ok: false, error: `expected a number, got "${input}"` };
|
|
121
|
+
if (s.int && !Number.isInteger(n))
|
|
122
|
+
return { ok: false, error: `expected an integer, got "${input}"` };
|
|
123
|
+
// Bounds mirror the .uap.json zod constraints — an out-of-range write would
|
|
124
|
+
// make strict config parse throw and silently reset the whole config.
|
|
125
|
+
if (s.min != null && n < s.min)
|
|
126
|
+
return { ok: false, error: `must be >= ${s.min}, got ${n}` };
|
|
127
|
+
if (s.max != null && n > s.max)
|
|
128
|
+
return { ok: false, error: `must be <= ${s.max}, got ${n}` };
|
|
129
|
+
return { ok: true, value: s.kind === 'env' ? String(n) : n };
|
|
130
|
+
}
|
|
131
|
+
if (s.type === 'enum') {
|
|
132
|
+
if (!s.enumValues?.includes(input)) {
|
|
133
|
+
return { ok: false, error: `expected one of ${s.enumValues?.join(' | ')}, got "${input}"` };
|
|
134
|
+
}
|
|
135
|
+
return { ok: true, value: input };
|
|
136
|
+
}
|
|
137
|
+
return { ok: true, value: input };
|
|
138
|
+
}
|
|
139
|
+
function fmt(v) {
|
|
140
|
+
if (v === null || v === undefined)
|
|
141
|
+
return chalk.dim('(unset)');
|
|
142
|
+
if (typeof v === 'boolean')
|
|
143
|
+
return v ? chalk.green('true') : chalk.red('false');
|
|
144
|
+
return String(v);
|
|
145
|
+
}
|
|
146
|
+
function fmtSecret(s, v) {
|
|
147
|
+
if (s.secret && v && v !== s.default)
|
|
148
|
+
return chalk.dim('••••••• (set)');
|
|
149
|
+
return fmt(v);
|
|
150
|
+
}
|
|
151
|
+
/** Machine-readable view of the settings, with secret VALUES masked to null. */
|
|
152
|
+
export function listSettingsJson(cwd, categoryFilter) {
|
|
153
|
+
return SETTINGS.filter((s) => !categoryFilter || s.category === categoryFilter).map((s) => {
|
|
154
|
+
const { value, source } = currentValue(cwd, s);
|
|
155
|
+
const isSet = value != null && value !== s.default;
|
|
156
|
+
// Never emit a secret's value in machine output (it lands in logs/CI).
|
|
157
|
+
const current = s.secret && isSet ? null : value;
|
|
158
|
+
return {
|
|
159
|
+
key: s.key,
|
|
160
|
+
kind: s.kind,
|
|
161
|
+
type: s.type,
|
|
162
|
+
category: s.category,
|
|
163
|
+
default: s.default,
|
|
164
|
+
current,
|
|
165
|
+
source,
|
|
166
|
+
secret: !!s.secret,
|
|
167
|
+
...(s.secret ? { isSet } : {}),
|
|
168
|
+
};
|
|
169
|
+
});
|
|
170
|
+
}
|
|
171
|
+
function doList(cwd, opts) {
|
|
172
|
+
const cats = opts.category
|
|
173
|
+
? CATEGORIES.filter((c) => c.id === opts.category)
|
|
174
|
+
: CATEGORIES;
|
|
175
|
+
if (opts.category && cats.length === 0) {
|
|
176
|
+
console.error(chalk.red(`Unknown category '${opts.category}'. Categories: ${CATEGORIES.map((c) => c.id).join(', ')}`));
|
|
177
|
+
process.exitCode = 2;
|
|
178
|
+
return;
|
|
179
|
+
}
|
|
180
|
+
if (opts.json) {
|
|
181
|
+
console.log(JSON.stringify(listSettingsJson(cwd, opts.category), null, 2));
|
|
182
|
+
return;
|
|
183
|
+
}
|
|
184
|
+
console.log(chalk.bold('\nUAP settings') + chalk.dim(' — uap config explain <key> to learn one; uap config set <key> <value> to change\n'));
|
|
185
|
+
for (const cat of cats) {
|
|
186
|
+
const items = settingsByCategory(cat.id);
|
|
187
|
+
if (!items.length)
|
|
188
|
+
continue;
|
|
189
|
+
console.log(chalk.bold.cyan(`▌ ${cat.title}`) + chalk.dim(` ${cat.blurb}`));
|
|
190
|
+
for (const s of items) {
|
|
191
|
+
const { value, source } = currentValue(cwd, s);
|
|
192
|
+
const tag = s.kind === 'env' ? chalk.dim(s.target === 'proxyEnv' ? '[proxy.env]' : '[env]') : '';
|
|
193
|
+
const val = fmtSecret(s, value);
|
|
194
|
+
const src = source === 'default' ? '' : chalk.dim(` ← ${source}`);
|
|
195
|
+
console.log(` ${chalk.yellow(s.key)} ${tag}`);
|
|
196
|
+
console.log(` ${val}${src} ${chalk.dim('default:')} ${fmt(s.default)}`);
|
|
197
|
+
console.log(` ${chalk.dim(s.recommendation)}`);
|
|
198
|
+
}
|
|
199
|
+
console.log('');
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
function resolveOne(key) {
|
|
203
|
+
const exact = getSetting(key);
|
|
204
|
+
if (exact)
|
|
205
|
+
return exact;
|
|
206
|
+
const matches = findSettings(key);
|
|
207
|
+
if (matches.length === 1)
|
|
208
|
+
return matches[0];
|
|
209
|
+
if (matches.length === 0) {
|
|
210
|
+
console.error(chalk.red(`No setting matches '${key}'. Try: uap config list`));
|
|
211
|
+
}
|
|
212
|
+
else {
|
|
213
|
+
console.error(chalk.red(`'${key}' is ambiguous — did you mean:`));
|
|
214
|
+
for (const m of matches.slice(0, 8))
|
|
215
|
+
console.error(` ${m.key}`);
|
|
216
|
+
}
|
|
217
|
+
return null;
|
|
218
|
+
}
|
|
219
|
+
function doGet(cwd, key) {
|
|
220
|
+
const s = resolveOne(key);
|
|
221
|
+
if (!s) {
|
|
222
|
+
process.exitCode = 2;
|
|
223
|
+
return;
|
|
224
|
+
}
|
|
225
|
+
const { value, source } = currentValue(cwd, s);
|
|
226
|
+
console.log(`${chalk.yellow(s.key)} = ${fmtSecret(s, value)} ${chalk.dim(`(${source})`)}`);
|
|
227
|
+
}
|
|
228
|
+
function doExplain(cwd, key) {
|
|
229
|
+
const s = resolveOne(key);
|
|
230
|
+
if (!s) {
|
|
231
|
+
process.exitCode = 2;
|
|
232
|
+
return;
|
|
233
|
+
}
|
|
234
|
+
const { value, source } = currentValue(cwd, s);
|
|
235
|
+
const cat = CATEGORIES.find((c) => c.id === s.category);
|
|
236
|
+
console.log('');
|
|
237
|
+
console.log(chalk.bold.yellow(s.key) + ' ' + chalk.dim(`(${cat?.title ?? s.category})`));
|
|
238
|
+
console.log('');
|
|
239
|
+
console.log(chalk.bold('What it does'));
|
|
240
|
+
console.log(' ' + s.description);
|
|
241
|
+
console.log('');
|
|
242
|
+
console.log(chalk.bold('Recommendation'));
|
|
243
|
+
console.log(' ' + s.recommendation);
|
|
244
|
+
console.log('');
|
|
245
|
+
console.log(chalk.bold('Current') + ` ${fmtSecret(s, value)} ${chalk.dim(`(${source})`)} ${chalk.dim('default:')} ${fmt(s.default)}`);
|
|
246
|
+
const type = s.type === 'enum' ? `enum: ${s.enumValues?.join(' | ')}` : s.type;
|
|
247
|
+
console.log(chalk.bold('Type') + ` ${type}`);
|
|
248
|
+
const where = s.kind === 'json'
|
|
249
|
+
? '.uap.json → ' + s.key
|
|
250
|
+
: s.target === 'proxyEnv'
|
|
251
|
+
? '.uap/proxy.env (proxy)'
|
|
252
|
+
: 'shell environment (' + s.key + ')';
|
|
253
|
+
console.log(chalk.bold('Set via') + ` uap config set ${s.key} <value> ${chalk.dim('→ ' + where)}`);
|
|
254
|
+
console.log('');
|
|
255
|
+
}
|
|
256
|
+
/**
|
|
257
|
+
* Validate and persist a single setting. Shared by `uap config set` and the
|
|
258
|
+
* interactive wizard so both paths behave identically.
|
|
259
|
+
*/
|
|
260
|
+
export function applySetting(cwd, s, rawValue) {
|
|
261
|
+
const coerced = coerce(s, rawValue);
|
|
262
|
+
if (!coerced.ok) {
|
|
263
|
+
return { ok: false, message: chalk.red(`Invalid value for ${s.key}: ${coerced.error}`) };
|
|
264
|
+
}
|
|
265
|
+
const value = coerced.value;
|
|
266
|
+
if (s.kind === 'json') {
|
|
267
|
+
if (s.secret) {
|
|
268
|
+
return { ok: false, message: chalk.red(`${s.key} is a secret and must not be stored in .uap.json.`) };
|
|
269
|
+
}
|
|
270
|
+
modifyUapConfig(cwd, (cfg) => {
|
|
271
|
+
setPath(cfg, s.key, value);
|
|
272
|
+
return cfg;
|
|
273
|
+
});
|
|
274
|
+
return { ok: true, message: chalk.green('✓') + ` ${s.key} = ${fmt(value)} ${chalk.dim('→ .uap.json')}` };
|
|
275
|
+
}
|
|
276
|
+
if (s.target === 'proxyEnv') {
|
|
277
|
+
const p = upsertProxyEnv(cwd, s.key, String(value), !!s.secret);
|
|
278
|
+
return {
|
|
279
|
+
ok: true,
|
|
280
|
+
message: chalk.green('✓') + ` ${s.key} = ${fmtSecret(s, value)} ${chalk.dim('→ ' + p)}\n ${chalk.dim('Restart the proxy to apply: uap proxy restart')}`,
|
|
281
|
+
};
|
|
282
|
+
}
|
|
283
|
+
// shell-kind: no file the hooks/CLI source, so guide the user.
|
|
284
|
+
const line = `export ${s.key}=${String(value)}`;
|
|
285
|
+
const note = s.secret ? '\n ' + chalk.dim('(secret — keep it out of version control)') : '';
|
|
286
|
+
return {
|
|
287
|
+
ok: true,
|
|
288
|
+
message: chalk.yellow(`${s.key} is a runtime (shell) setting — add this to your shell profile or the agent's launch env:`) +
|
|
289
|
+
'\n ' + chalk.bold(line) + note,
|
|
290
|
+
};
|
|
291
|
+
}
|
|
292
|
+
function doSet(cwd, key, rawValue) {
|
|
293
|
+
const s = resolveOne(key);
|
|
294
|
+
if (!s) {
|
|
295
|
+
process.exitCode = 2;
|
|
296
|
+
return;
|
|
297
|
+
}
|
|
298
|
+
const res = applySetting(cwd, s, rawValue);
|
|
299
|
+
console.log(res.message);
|
|
300
|
+
if (!res.ok)
|
|
301
|
+
process.exitCode = 2;
|
|
302
|
+
}
|
|
303
|
+
function doDoctor(cwd) {
|
|
304
|
+
const raw = loadUapConfigRaw(cwd);
|
|
305
|
+
const findings = [];
|
|
306
|
+
const val = (key) => currentValue(cwd, getSetting(key)).value;
|
|
307
|
+
// Enforcement disabled
|
|
308
|
+
if (val('delivery.enforcement') === 'off') {
|
|
309
|
+
findings.push({ level: 'warn', msg: 'delivery.enforcement is off — direct source edits are ungated and unverified.', fix: 'uap config set delivery.enforcement block' });
|
|
310
|
+
}
|
|
311
|
+
// Leaked advisory env
|
|
312
|
+
const envEnforce = process.env.UAP_ENFORCE_DELIVERY;
|
|
313
|
+
if (envEnforce && envEnforce !== 'block') {
|
|
314
|
+
findings.push({ level: 'warn', msg: `UAP_ENFORCE_DELIVERY=${envEnforce} is exported in your shell — it overrides delivery.enforcement everywhere and can break the delivery-enforcement tests + version bumps.`, fix: 'unset UAP_ENFORCE_DELIVERY (and remove it from your shell profile)' });
|
|
315
|
+
}
|
|
316
|
+
// Long-term memory off
|
|
317
|
+
if (val('memory.longTerm.enabled') === false) {
|
|
318
|
+
findings.push({ level: 'info', msg: 'Long-term memory is off — no cross-session recall.', fix: 'uap config set memory.longTerm.enabled true' });
|
|
319
|
+
}
|
|
320
|
+
// Reactor off
|
|
321
|
+
if (val('reactor.enabled') === false) {
|
|
322
|
+
findings.push({ level: 'info', msg: 'Reactor is off — experts/skills/patterns are not auto-injected per prompt.' });
|
|
323
|
+
}
|
|
324
|
+
// Design token gate without design enabled
|
|
325
|
+
if (val('design.tokenGate') === true && val('design.enabled') === false) {
|
|
326
|
+
findings.push({ level: 'warn', msg: 'design.tokenGate is on but design.enabled is off — the token gate needs a DESIGN.md.', fix: 'uap config set design.enabled true' });
|
|
327
|
+
}
|
|
328
|
+
// Secrets in .uap.json
|
|
329
|
+
const secretPaths = ['recipes.judge.apiKey', 'memory.longTerm.qdrantCloud.apiKey', 'memory.longTerm.github.token'];
|
|
330
|
+
for (const sp of secretPaths) {
|
|
331
|
+
if (getPath(raw, sp) != null) {
|
|
332
|
+
findings.push({ level: 'warn', msg: `A secret is stored in .uap.json (${sp}) — move it to .uap/proxy.env or your shell env.` });
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
// Multi-model without slot budget
|
|
336
|
+
if (val('multiModel.enabled') === true && val('modelConcurrency.slots') == null) {
|
|
337
|
+
findings.push({ level: 'info', msg: 'Multi-model routing is on but modelConcurrency.slots is unset — parallel agents may exhaust the local server.', fix: 'uap config set modelConcurrency.slots <your llama.cpp --parallel>' });
|
|
338
|
+
}
|
|
339
|
+
console.log(chalk.bold('\nUAP config doctor\n'));
|
|
340
|
+
if (findings.length === 0) {
|
|
341
|
+
console.log(chalk.green('✓ No issues found — your configuration looks healthy.\n'));
|
|
342
|
+
return;
|
|
343
|
+
}
|
|
344
|
+
for (const f of findings) {
|
|
345
|
+
const icon = f.level === 'warn' ? chalk.yellow('⚠') : chalk.cyan('ℹ');
|
|
346
|
+
console.log(`${icon} ${f.msg}`);
|
|
347
|
+
if (f.fix)
|
|
348
|
+
console.log(` ${chalk.dim('fix:')} ${chalk.bold(f.fix)}`);
|
|
349
|
+
}
|
|
350
|
+
console.log('');
|
|
351
|
+
if (findings.some((f) => f.level === 'warn'))
|
|
352
|
+
process.exitCode = 1;
|
|
353
|
+
}
|
|
354
|
+
/**
|
|
355
|
+
* Render the whole registry as the CONFIGURATION_REFERENCE.md doc, so the docs
|
|
356
|
+
* are generated from the same source of truth as the CLI and can never drift.
|
|
357
|
+
*/
|
|
358
|
+
export function renderReferenceMarkdown() {
|
|
359
|
+
const out = [];
|
|
360
|
+
out.push('# UAP Configuration Reference');
|
|
361
|
+
out.push('');
|
|
362
|
+
out.push('> **Generated from the settings registry** (`src/config/settings-registry.ts`) via `uap config docs`. Do not edit by hand — change the registry and regenerate.');
|
|
363
|
+
out.push('');
|
|
364
|
+
out.push('Every UAP setting, what it does, its default, and a recommendation. Inspect and change any of these with **`uap config`**:');
|
|
365
|
+
out.push('');
|
|
366
|
+
out.push('```bash');
|
|
367
|
+
out.push('uap config list # all settings + current values');
|
|
368
|
+
out.push('uap config explain <key> # learn one setting');
|
|
369
|
+
out.push('uap config set <key> <value> # change it (.uap.json / .uap/proxy.env)');
|
|
370
|
+
out.push('uap config doctor # flag risky / sub-optimal settings');
|
|
371
|
+
out.push('uap config wizard # interactive expert configurator (also: uap setup --profile custom)');
|
|
372
|
+
out.push('```');
|
|
373
|
+
out.push('');
|
|
374
|
+
out.push('**Where each setting lives:** `json` settings persist to `.uap.json`; `proxy.env` settings persist to `.uap/proxy.env` (loaded by the inference proxy); `shell` settings are runtime environment variables read by the hooks/CLI.');
|
|
375
|
+
out.push('');
|
|
376
|
+
out.push('## Categories');
|
|
377
|
+
out.push('');
|
|
378
|
+
for (const cat of CATEGORIES) {
|
|
379
|
+
if (!settingsByCategory(cat.id).length)
|
|
380
|
+
continue;
|
|
381
|
+
out.push(`- [${cat.title}](#${cat.id}) — ${cat.blurb}`);
|
|
382
|
+
}
|
|
383
|
+
out.push('');
|
|
384
|
+
for (const cat of CATEGORIES) {
|
|
385
|
+
const items = settingsByCategory(cat.id);
|
|
386
|
+
if (!items.length)
|
|
387
|
+
continue;
|
|
388
|
+
out.push(`## ${cat.title}`);
|
|
389
|
+
out.push('');
|
|
390
|
+
out.push(`<a id="${cat.id}"></a>${cat.blurb}`);
|
|
391
|
+
out.push('');
|
|
392
|
+
for (const s of items) {
|
|
393
|
+
const where = s.kind === 'json' ? '`.uap.json`' : s.target === 'proxyEnv' ? '`.uap/proxy.env`' : 'shell env';
|
|
394
|
+
const type = s.type === 'enum' ? `enum (${s.enumValues?.join(' \\| ')})` : s.type;
|
|
395
|
+
out.push(`### \`${s.key}\``);
|
|
396
|
+
out.push('');
|
|
397
|
+
out.push(`| | |`);
|
|
398
|
+
out.push(`|---|---|`);
|
|
399
|
+
out.push(`| **Where** | ${where} |`);
|
|
400
|
+
out.push(`| **Type** | ${type} |`);
|
|
401
|
+
out.push(`| **Default** | \`${String(s.default)}\` |`);
|
|
402
|
+
if (s.secret)
|
|
403
|
+
out.push(`| **Secret** | yes — never store in \`.uap.json\` |`);
|
|
404
|
+
out.push('');
|
|
405
|
+
out.push(s.description);
|
|
406
|
+
out.push('');
|
|
407
|
+
out.push(`**Recommendation:** ${s.recommendation}`);
|
|
408
|
+
out.push('');
|
|
409
|
+
}
|
|
410
|
+
}
|
|
411
|
+
out.push('---');
|
|
412
|
+
out.push('');
|
|
413
|
+
out.push('*Not every environment variable UAP reads is a first-class setting — the inference proxy alone exposes ~130 `PROXY_*` tuning knobs. The registry surfaces the high-impact, commonly-tuned ones; see the proxy source (`tools/agents/scripts/anthropic_proxy.py`) for the full set.*');
|
|
414
|
+
out.push('');
|
|
415
|
+
return out.join('\n');
|
|
416
|
+
}
|
|
417
|
+
// ── registration ────────────────────────────────────────────────────────────
|
|
418
|
+
export function registerConfigCommands(program) {
|
|
419
|
+
const cwd = () => process.cwd();
|
|
420
|
+
const config = program
|
|
421
|
+
.command('config')
|
|
422
|
+
.description('Inspect, learn, and set every UAP setting (list | get | set | explain | doctor)');
|
|
423
|
+
config
|
|
424
|
+
.command('list')
|
|
425
|
+
.description('List all settings with current values and recommendations')
|
|
426
|
+
.option('-c, --category <id>', 'Only show one category')
|
|
427
|
+
.option('--json', 'Machine-readable output')
|
|
428
|
+
.action((opts) => doList(cwd(), opts));
|
|
429
|
+
config
|
|
430
|
+
.command('get <key>')
|
|
431
|
+
.description('Show the current effective value of a setting')
|
|
432
|
+
.action((key) => doGet(cwd(), key));
|
|
433
|
+
config
|
|
434
|
+
.command('set <key> <value>')
|
|
435
|
+
.description('Set a setting (writes .uap.json or .uap/proxy.env; shell vars print an export line)')
|
|
436
|
+
.action((key, value) => doSet(cwd(), key, value));
|
|
437
|
+
config
|
|
438
|
+
.command('explain <key>')
|
|
439
|
+
.description('Explain what a setting does, how to pick a value, and how to set it')
|
|
440
|
+
.action((key) => doExplain(cwd(), key));
|
|
441
|
+
config
|
|
442
|
+
.command('doctor')
|
|
443
|
+
.description('Flag risky, sub-optimal, or inconsistent settings for this project')
|
|
444
|
+
.action(() => doDoctor(cwd()));
|
|
445
|
+
config
|
|
446
|
+
.command('wizard')
|
|
447
|
+
.description('Interactive expert configurator — walk every setting with explanations + recommendations')
|
|
448
|
+
.option('--no-policies', 'Skip the policy-selection step')
|
|
449
|
+
.action(async (opts) => {
|
|
450
|
+
const { runConfigWizard } = await import('./config-wizard.js');
|
|
451
|
+
await runConfigWizard(cwd(), { policies: opts.policies !== false });
|
|
452
|
+
});
|
|
453
|
+
config
|
|
454
|
+
.command('docs')
|
|
455
|
+
.description('Regenerate docs/reference/CONFIGURATION_REFERENCE.md from the registry')
|
|
456
|
+
.option('-o, --out <path>', 'Output path', 'docs/reference/CONFIGURATION_REFERENCE.md')
|
|
457
|
+
.action((opts) => {
|
|
458
|
+
const md = renderReferenceMarkdown();
|
|
459
|
+
const outPath = join(cwd(), opts.out);
|
|
460
|
+
mkdirSync(dirname(outPath), { recursive: true });
|
|
461
|
+
writeFileSync(outPath, md);
|
|
462
|
+
console.log(chalk.green('✓') + ` wrote ${opts.out} (${SETTINGS.length} settings)`);
|
|
463
|
+
});
|
|
464
|
+
}
|
|
465
|
+
//# sourceMappingURL=config-command.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-command.js","sourceRoot":"","sources":["../../src/cli/config-command.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,SAAS,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,aAAa,EAAE,MAAM,IAAI,CAAC;AACnF,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAErC,OAAO,EACL,UAAU,EACV,QAAQ,EACR,YAAY,EACZ,UAAU,EACV,kBAAkB,GAGnB,MAAM,gCAAgC,CAAC;AACxC,OAAO,EAAE,iBAAiB,EAAE,gBAAgB,EAAE,eAAe,EAAE,MAAM,2BAA2B,CAAC;AAEjG,+EAA+E;AAE/E,SAAS,OAAO,CAAC,GAAmC,EAAE,IAAY;IAChE,IAAI,CAAC,GAAG;QAAE,OAAO,SAAS,CAAC;IAC3B,IAAI,GAAG,GAAY,GAAG,CAAC;IACvB,KAAK,MAAM,IAAI,IAAI,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,EAAE,CAAC;QACnC,IAAI,GAAG,IAAI,IAAI,IAAI,OAAO,GAAG,KAAK,QAAQ;YAAE,OAAO,SAAS,CAAC;QAC7D,GAAG,GAAI,GAA+B,CAAC,IAAI,CAAC,CAAC;IAC/C,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC;AAED,SAAS,OAAO,CAAC,GAA4B,EAAE,IAAY,E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EAAE,IAAI,CAAC,QAAQ,KAAK,KAAK,EAAE,CAAC,CAAC;IACtE,CAAC,CAAC,CAAC;IAEL,MAAM;SACH,OAAO,CAAC,MAAM,CAAC;SACf,WAAW,CAAC,wEAAwE,CAAC;SACrF,MAAM,CAAC,kBAAkB,EAAE,aAAa,EAAE,2CAA2C,CAAC;SACtF,MAAM,CAAC,CAAC,IAAqB,EAAE,EAAE;QAChC,MAAM,EAAE,GAAG,uBAAuB,EAAE,CAAC;QACrC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,EAAE,EAAE,IAAI,CAAC,GAAG,CAAC,CAAC;QACtC,SAAS,CAAC,OAAO,CAAC,OAAO,CAAC,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;QACjD,aAAa,CAAC,OAAO,EAAE,EAAE,CAAC,CAAC;QAC3B,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,GAAG,UAAU,IAAI,CAAC,GAAG,KAAK,QAAQ,CAAC,MAAM,YAAY,CAAC,CAAC;IACrF,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `uap config wizard` — the interactive expert configurator (a.k.a.
|
|
3
|
+
* `uap setup --profile custom`). Walks every setting category with its
|
|
4
|
+
* description + recommendation, writes choices via the shared apply path, then
|
|
5
|
+
* offers scenario-based policy selection.
|
|
6
|
+
*
|
|
7
|
+
* Non-TTY safe: with no interactive terminal it prints how to configure headless
|
|
8
|
+
* (`uap config set` / `uap policy install`) and returns without prompting.
|
|
9
|
+
*/
|
|
10
|
+
export declare function runConfigWizard(cwd: string, opts?: {
|
|
11
|
+
policies?: boolean;
|
|
12
|
+
}): Promise<void>;
|
|
13
|
+
//# sourceMappingURL=config-wizard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config-wizard.d.ts","sourceRoot":"","sources":["../../src/cli/config-wizard.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AA8BH,wBAAsB,eAAe,CACnC,GAAG,EAAE,MAAM,EACX,IAAI,GAAE;IAAE,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAO,GAChC,OAAO,CAAC,IAAI,CAAC,CAsEf"}
|
|
@@ -0,0 +1,134 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `uap config wizard` — the interactive expert configurator (a.k.a.
|
|
3
|
+
* `uap setup --profile custom`). Walks every setting category with its
|
|
4
|
+
* description + recommendation, writes choices via the shared apply path, then
|
|
5
|
+
* offers scenario-based policy selection.
|
|
6
|
+
*
|
|
7
|
+
* Non-TTY safe: with no interactive terminal it prints how to configure headless
|
|
8
|
+
* (`uap config set` / `uap policy install`) and returns without prompting.
|
|
9
|
+
*/
|
|
10
|
+
import chalk from 'chalk';
|
|
11
|
+
import { spawnSync } from 'child_process';
|
|
12
|
+
import { CATEGORIES, settingsByCategory, } from '../config/settings-registry.js';
|
|
13
|
+
import { CORE, SCENARIOS, recommendedFor } from '../config/policy-recommendations.js';
|
|
14
|
+
import { applySetting, currentValue } from './config-command.js';
|
|
15
|
+
import { createClackUI } from './prompt-ui.js';
|
|
16
|
+
function toBool(v) {
|
|
17
|
+
if (typeof v === 'boolean')
|
|
18
|
+
return v;
|
|
19
|
+
return ['1', 'true', 'yes', 'on'].includes(String(v).toLowerCase());
|
|
20
|
+
}
|
|
21
|
+
function nonInteractiveGuidance() {
|
|
22
|
+
console.log(chalk.bold('\nUAP expert configuration (non-interactive)\n'));
|
|
23
|
+
console.log('No interactive terminal detected. Configure headless with:');
|
|
24
|
+
console.log(' ' + chalk.cyan('uap config list') + ' # every setting + current value');
|
|
25
|
+
console.log(' ' + chalk.cyan('uap config explain <key>') + ' # learn one setting');
|
|
26
|
+
console.log(' ' + chalk.cyan('uap config set <key> <value>') + ' # change it');
|
|
27
|
+
console.log(' ' + chalk.cyan('uap config doctor') + ' # flag risky settings');
|
|
28
|
+
console.log(' ' + chalk.cyan('uap policy recommend <scenario>') + ' # recommended policies for your workflow');
|
|
29
|
+
console.log('');
|
|
30
|
+
}
|
|
31
|
+
export async function runConfigWizard(cwd, opts = {}) {
|
|
32
|
+
if (!process.stdin.isTTY || !process.stdout.isTTY) {
|
|
33
|
+
nonInteractiveGuidance();
|
|
34
|
+
return;
|
|
35
|
+
}
|
|
36
|
+
const ui = await createClackUI();
|
|
37
|
+
ui.intro('UAP expert configuration — tune every setting for your environment');
|
|
38
|
+
const catOptions = CATEGORIES.filter((c) => settingsByCategory(c.id).length > 0).map((c) => ({
|
|
39
|
+
value: c.id,
|
|
40
|
+
label: c.title,
|
|
41
|
+
hint: c.blurb,
|
|
42
|
+
}));
|
|
43
|
+
const chosen = await ui.multiselect({
|
|
44
|
+
message: 'Which areas do you want to configure? (space to select, enter to confirm)',
|
|
45
|
+
options: catOptions,
|
|
46
|
+
initialValues: [],
|
|
47
|
+
required: false,
|
|
48
|
+
});
|
|
49
|
+
const applied = [];
|
|
50
|
+
for (const catId of chosen) {
|
|
51
|
+
const cat = CATEGORIES.find((c) => c.id === catId);
|
|
52
|
+
ui.note(cat.blurb, cat.title);
|
|
53
|
+
for (const s of settingsByCategory(catId)) {
|
|
54
|
+
const cur = currentValue(cwd, s).value;
|
|
55
|
+
const prompt = `${s.key}\n${chalk.dim(s.description)}\n${chalk.dim('Recommended: ' + s.recommendation)}`;
|
|
56
|
+
let raw = null;
|
|
57
|
+
if (s.type === 'boolean') {
|
|
58
|
+
const val = await ui.confirm({ message: prompt, initialValue: toBool(cur) });
|
|
59
|
+
// Unchanged → leave as-is (don't materialize a default into the config).
|
|
60
|
+
raw = val === toBool(cur) ? null : val ? 'true' : 'false';
|
|
61
|
+
}
|
|
62
|
+
else if (s.type === 'enum') {
|
|
63
|
+
const val = await ui.select({
|
|
64
|
+
message: prompt,
|
|
65
|
+
options: (s.enumValues ?? []).map((v) => ({ value: v, label: v })),
|
|
66
|
+
initialValue: cur != null ? String(cur) : undefined,
|
|
67
|
+
});
|
|
68
|
+
raw = cur != null && val === String(cur) ? null : val;
|
|
69
|
+
}
|
|
70
|
+
else {
|
|
71
|
+
const val = await ui.text({
|
|
72
|
+
message: prompt,
|
|
73
|
+
placeholder: cur != null ? String(cur) : '',
|
|
74
|
+
initialValue: cur != null ? String(cur) : '',
|
|
75
|
+
});
|
|
76
|
+
// Blank or unchanged → leave as-is.
|
|
77
|
+
raw = val.trim() === '' || val === String(cur) ? null : val.trim();
|
|
78
|
+
}
|
|
79
|
+
if (raw !== null) {
|
|
80
|
+
const res = applySetting(cwd, s, raw);
|
|
81
|
+
applied.push(res.message);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
if (opts.policies !== false) {
|
|
86
|
+
await runPolicyStep(cwd, ui);
|
|
87
|
+
}
|
|
88
|
+
if (applied.length) {
|
|
89
|
+
ui.note(applied.join('\n'), `Applied ${applied.length} setting change(s)`);
|
|
90
|
+
}
|
|
91
|
+
ui.outro('Done. Review with `uap config list`, sanity-check with `uap config doctor`, and restart the proxy if you changed proxy settings.');
|
|
92
|
+
}
|
|
93
|
+
async function runPolicyStep(cwd, ui) {
|
|
94
|
+
const scenario = await ui.select({
|
|
95
|
+
message: 'Recommend policies for which kind of work?',
|
|
96
|
+
options: [
|
|
97
|
+
...SCENARIOS.map((sc) => ({ value: sc.id, label: sc.title, hint: sc.blurb })),
|
|
98
|
+
{ value: '__skip__', label: 'Skip policy selection', hint: 'keep current policies' },
|
|
99
|
+
],
|
|
100
|
+
initialValue: 'solo-local',
|
|
101
|
+
});
|
|
102
|
+
if (scenario === '__skip__')
|
|
103
|
+
return;
|
|
104
|
+
const recs = recommendedFor(scenario);
|
|
105
|
+
const coreSlugs = new Set(CORE.map((c) => c.slug));
|
|
106
|
+
const picks = await ui.multiselect({
|
|
107
|
+
message: 'Install these recommended policies? (core policies pre-selected)',
|
|
108
|
+
options: recs.map((r) => ({
|
|
109
|
+
value: r.slug,
|
|
110
|
+
label: `${r.slug}${coreSlugs.has(r.slug) ? ' (core)' : ''}`,
|
|
111
|
+
hint: r.why,
|
|
112
|
+
})),
|
|
113
|
+
initialValues: recs.map((r) => r.slug),
|
|
114
|
+
required: false,
|
|
115
|
+
});
|
|
116
|
+
if (!picks.length)
|
|
117
|
+
return;
|
|
118
|
+
const cli = process.argv[1]; // the running cli.js
|
|
119
|
+
const installed = [];
|
|
120
|
+
const failed = [];
|
|
121
|
+
for (const slug of picks) {
|
|
122
|
+
const r = spawnSync(process.execPath, [cli, 'policy', 'install', slug], { cwd, encoding: 'utf-8' });
|
|
123
|
+
if (r.status === 0)
|
|
124
|
+
installed.push(slug);
|
|
125
|
+
else
|
|
126
|
+
failed.push(slug);
|
|
127
|
+
}
|
|
128
|
+
const lines = [
|
|
129
|
+
installed.length ? chalk.green(`✓ installed: ${installed.join(', ')}`) : '',
|
|
130
|
+
failed.length ? chalk.yellow(`⚠ could not install: ${failed.join(', ')} (try: uap policy install <slug>)`) : '',
|
|
131
|
+
].filter(Boolean);
|
|
132
|
+
ui.note(lines.join('\n'), 'Policies');
|
|
133
|
+
}
|
|
134
|
+
//# sourceMappingURL=config-wizard.js.map
|