auden 0.1.0-alpha.2
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 +59 -0
- package/dist/auden-paths.d.ts +8 -0
- package/dist/auden-paths.d.ts.map +1 -0
- package/dist/auden-paths.js +10 -0
- package/dist/auden-paths.js.map +1 -0
- package/dist/bin.d.ts +11 -0
- package/dist/bin.d.ts.map +1 -0
- package/dist/bin.js +13 -0
- package/dist/bin.js.map +1 -0
- package/dist/chunk.d.ts +3 -0
- package/dist/chunk.d.ts.map +1 -0
- package/dist/chunk.js +13 -0
- package/dist/chunk.js.map +1 -0
- package/dist/commands/doctor.d.ts +13 -0
- package/dist/commands/doctor.d.ts.map +1 -0
- package/dist/commands/doctor.js +125 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/eval/index.d.ts +2 -0
- package/dist/commands/eval/index.d.ts.map +1 -0
- package/dist/commands/eval/index.js +2 -0
- package/dist/commands/eval/index.js.map +1 -0
- package/dist/commands/eval/run.d.ts +38 -0
- package/dist/commands/eval/run.d.ts.map +1 -0
- package/dist/commands/eval/run.js +179 -0
- package/dist/commands/eval/run.js.map +1 -0
- package/dist/commands/guides/active.d.ts +2 -0
- package/dist/commands/guides/active.d.ts.map +1 -0
- package/dist/commands/guides/active.js +38 -0
- package/dist/commands/guides/active.js.map +1 -0
- package/dist/commands/guides/index.d.ts +2 -0
- package/dist/commands/guides/index.d.ts.map +1 -0
- package/dist/commands/guides/index.js +13 -0
- package/dist/commands/guides/index.js.map +1 -0
- package/dist/commands/guides/project.d.ts +13 -0
- package/dist/commands/guides/project.d.ts.map +1 -0
- package/dist/commands/guides/project.js +71 -0
- package/dist/commands/guides/project.js.map +1 -0
- package/dist/commands/guides/search.d.ts +8 -0
- package/dist/commands/guides/search.d.ts.map +1 -0
- package/dist/commands/guides/search.js +46 -0
- package/dist/commands/guides/search.js.map +1 -0
- package/dist/commands/init.d.ts +43 -0
- package/dist/commands/init.d.ts.map +1 -0
- package/dist/commands/init.js +436 -0
- package/dist/commands/init.js.map +1 -0
- package/dist/commands/mcp.d.ts +23 -0
- package/dist/commands/mcp.d.ts.map +1 -0
- package/dist/commands/mcp.js +55 -0
- package/dist/commands/mcp.js.map +1 -0
- package/dist/commands/pull.d.ts +38 -0
- package/dist/commands/pull.d.ts.map +1 -0
- package/dist/commands/pull.js +127 -0
- package/dist/commands/pull.js.map +1 -0
- package/dist/commands/rules/export.d.ts +140 -0
- package/dist/commands/rules/export.d.ts.map +1 -0
- package/dist/commands/rules/export.js +635 -0
- package/dist/commands/rules/export.js.map +1 -0
- package/dist/commands/rules/import.d.ts +33 -0
- package/dist/commands/rules/import.d.ts.map +1 -0
- package/dist/commands/rules/import.js +122 -0
- package/dist/commands/rules/import.js.map +1 -0
- package/dist/commands/rules/index.d.ts +2 -0
- package/dist/commands/rules/index.d.ts.map +1 -0
- package/dist/commands/rules/index.js +13 -0
- package/dist/commands/rules/index.js.map +1 -0
- package/dist/commands/rules/watch.d.ts +43 -0
- package/dist/commands/rules/watch.d.ts.map +1 -0
- package/dist/commands/rules/watch.js +125 -0
- package/dist/commands/rules/watch.js.map +1 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.d.ts.map +1 -0
- package/dist/commands/status.js +61 -0
- package/dist/commands/status.js.map +1 -0
- package/dist/commands/suggest.d.ts +8 -0
- package/dist/commands/suggest.d.ts.map +1 -0
- package/dist/commands/suggest.js +43 -0
- package/dist/commands/suggest.js.map +1 -0
- package/dist/commands/sync.d.ts +23 -0
- package/dist/commands/sync.d.ts.map +1 -0
- package/dist/commands/sync.js +193 -0
- package/dist/commands/sync.js.map +1 -0
- package/dist/commands/verdict/index.d.ts +2 -0
- package/dist/commands/verdict/index.d.ts.map +1 -0
- package/dist/commands/verdict/index.js +11 -0
- package/dist/commands/verdict/index.js.map +1 -0
- package/dist/commands/verdict/record.d.ts +18 -0
- package/dist/commands/verdict/record.d.ts.map +1 -0
- package/dist/commands/verdict/record.js +60 -0
- package/dist/commands/verdict/record.js.map +1 -0
- package/dist/config.d.ts +96 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +246 -0
- package/dist/config.js.map +1 -0
- package/dist/context/pull.d.ts +40 -0
- package/dist/context/pull.d.ts.map +1 -0
- package/dist/context/pull.js +46 -0
- package/dist/context/pull.js.map +1 -0
- package/dist/dashboard-health.d.ts +20 -0
- package/dist/dashboard-health.d.ts.map +1 -0
- package/dist/dashboard-health.js +24 -0
- package/dist/dashboard-health.js.map +1 -0
- package/dist/eval-provider.d.ts +30 -0
- package/dist/eval-provider.d.ts.map +1 -0
- package/dist/eval-provider.js +359 -0
- package/dist/eval-provider.js.map +1 -0
- package/dist/eval-summary.d.ts +24 -0
- package/dist/eval-summary.d.ts.map +1 -0
- package/dist/eval-summary.js +30 -0
- package/dist/eval-summary.js.map +1 -0
- package/dist/feedback/extract.d.ts +6 -0
- package/dist/feedback/extract.d.ts.map +1 -0
- package/dist/feedback/extract.js +580 -0
- package/dist/feedback/extract.js.map +1 -0
- package/dist/http-retry.d.ts +23 -0
- package/dist/http-retry.d.ts.map +1 -0
- package/dist/http-retry.js +54 -0
- package/dist/http-retry.js.map +1 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +33 -0
- package/dist/index.js.map +1 -0
- package/dist/mcp/client.d.ts +70 -0
- package/dist/mcp/client.d.ts.map +1 -0
- package/dist/mcp/client.js +121 -0
- package/dist/mcp/client.js.map +1 -0
- package/dist/mcp/scope.d.ts +30 -0
- package/dist/mcp/scope.d.ts.map +1 -0
- package/dist/mcp/scope.js +64 -0
- package/dist/mcp/scope.js.map +1 -0
- package/dist/mcp/server.d.ts +57 -0
- package/dist/mcp/server.d.ts.map +1 -0
- package/dist/mcp/server.js +427 -0
- package/dist/mcp/server.js.map +1 -0
- package/dist/mcp/write-items.d.ts +34 -0
- package/dist/mcp/write-items.d.ts.map +1 -0
- package/dist/mcp/write-items.js +59 -0
- package/dist/mcp/write-items.js.map +1 -0
- package/dist/rules/deletions-client.d.ts +16 -0
- package/dist/rules/deletions-client.d.ts.map +1 -0
- package/dist/rules/deletions-client.js +40 -0
- package/dist/rules/deletions-client.js.map +1 -0
- package/dist/rules/diff.d.ts +19 -0
- package/dist/rules/diff.d.ts.map +1 -0
- package/dist/rules/diff.js +36 -0
- package/dist/rules/diff.js.map +1 -0
- package/dist/rules/discover.d.ts +81 -0
- package/dist/rules/discover.d.ts.map +1 -0
- package/dist/rules/discover.js +307 -0
- package/dist/rules/discover.js.map +1 -0
- package/dist/rules/file-origin.d.ts +16 -0
- package/dist/rules/file-origin.d.ts.map +1 -0
- package/dist/rules/file-origin.js +31 -0
- package/dist/rules/file-origin.js.map +1 -0
- package/dist/rules/global-flag.d.ts +12 -0
- package/dist/rules/global-flag.d.ts.map +1 -0
- package/dist/rules/global-flag.js +15 -0
- package/dist/rules/global-flag.js.map +1 -0
- package/dist/rules/import-client.d.ts +37 -0
- package/dist/rules/import-client.d.ts.map +1 -0
- package/dist/rules/import-client.js +98 -0
- package/dist/rules/import-client.js.map +1 -0
- package/dist/rules/init-pull.d.ts +34 -0
- package/dist/rules/init-pull.d.ts.map +1 -0
- package/dist/rules/init-pull.js +43 -0
- package/dist/rules/init-pull.js.map +1 -0
- package/dist/rules/member-files-client.d.ts +17 -0
- package/dist/rules/member-files-client.d.ts.map +1 -0
- package/dist/rules/member-files-client.js +29 -0
- package/dist/rules/member-files-client.js.map +1 -0
- package/dist/rules/path-contains.d.ts +9 -0
- package/dist/rules/path-contains.d.ts.map +1 -0
- package/dist/rules/path-contains.js +17 -0
- package/dist/rules/path-contains.js.map +1 -0
- package/dist/rules/payload.d.ts +13 -0
- package/dist/rules/payload.d.ts.map +1 -0
- package/dist/rules/payload.js +35 -0
- package/dist/rules/payload.js.map +1 -0
- package/dist/rules/pull-bundle.d.ts +13 -0
- package/dist/rules/pull-bundle.d.ts.map +1 -0
- package/dist/rules/pull-bundle.js +32 -0
- package/dist/rules/pull-bundle.js.map +1 -0
- package/dist/rules/watch.d.ts +121 -0
- package/dist/rules/watch.d.ts.map +1 -0
- package/dist/rules/watch.js +457 -0
- package/dist/rules/watch.js.map +1 -0
- package/dist/skill-template.d.ts +19 -0
- package/dist/skill-template.d.ts.map +1 -0
- package/dist/skill-template.js +174 -0
- package/dist/skill-template.js.map +1 -0
- package/dist/sync-batches.d.ts +37 -0
- package/dist/sync-batches.d.ts.map +1 -0
- package/dist/sync-batches.js +67 -0
- package/dist/sync-batches.js.map +1 -0
- package/dist/sync-client.d.ts +22 -0
- package/dist/sync-client.d.ts.map +1 -0
- package/dist/sync-client.js +38 -0
- package/dist/sync-client.js.map +1 -0
- package/dist/sync-response.d.ts +23 -0
- package/dist/sync-response.d.ts.map +1 -0
- package/dist/sync-response.js +22 -0
- package/dist/sync-response.js.map +1 -0
- package/dist/token-verify.d.ts +14 -0
- package/dist/token-verify.d.ts.map +1 -0
- package/dist/token-verify.js +30 -0
- package/dist/token-verify.js.map +1 -0
- package/dist/usage/extract.d.ts +31 -0
- package/dist/usage/extract.d.ts.map +1 -0
- package/dist/usage/extract.js +200 -0
- package/dist/usage/extract.js.map +1 -0
- package/dist/usage/providers.d.ts +8 -0
- package/dist/usage/providers.d.ts.map +1 -0
- package/dist/usage/providers.js +23 -0
- package/dist/usage/providers.js.map +1 -0
- package/dist/verdict-queue.d.ts +50 -0
- package/dist/verdict-queue.d.ts.map +1 -0
- package/dist/verdict-queue.js +131 -0
- package/dist/verdict-queue.js.map +1 -0
- package/package.json +72 -0
package/dist/config.js
ADDED
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { chmod, mkdir, readFile, stat, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { AUDEN_CONFIG } from './auden-paths.js';
|
|
4
|
+
/** Permission bits for `~/.auden/` and other auden-owned directories. */
|
|
5
|
+
export const AUDEN_DIR_MODE = 0o700;
|
|
6
|
+
/** Permission bits for `~/.auden/config.json` — it holds a bearer token. */
|
|
7
|
+
export const AUDEN_CONFIG_MODE = 0o600;
|
|
8
|
+
/**
|
|
9
|
+
* Create `dir` (and parents) with owner-only permissions, tightening an
|
|
10
|
+
* existing directory's mode too — `mkdir`'s `mode` option only applies to
|
|
11
|
+
* newly-created directories, so a pre-existing `~/.auden` from an older
|
|
12
|
+
* version (or a permissive umask) would otherwise stay world-readable.
|
|
13
|
+
*/
|
|
14
|
+
export async function ensureAudenDir(dir) {
|
|
15
|
+
await mkdir(dir, { recursive: true, mode: AUDEN_DIR_MODE });
|
|
16
|
+
await chmod(dir, AUDEN_DIR_MODE).catch(() => { });
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Write JSON to `configPath` with owner-only file permissions (it stores a
|
|
20
|
+
* bearer token). Creates the parent directory (also owner-only) if needed.
|
|
21
|
+
*/
|
|
22
|
+
async function writeConfigFile(configPath, contents) {
|
|
23
|
+
await ensureAudenDir(dirname(configPath));
|
|
24
|
+
await writeFile(configPath, contents, { mode: AUDEN_CONFIG_MODE });
|
|
25
|
+
// `writeFile`'s mode option only applies when creating the file — chmod
|
|
26
|
+
// unconditionally so an existing file with looser permissions is tightened.
|
|
27
|
+
await chmod(configPath, AUDEN_CONFIG_MODE).catch(() => { });
|
|
28
|
+
}
|
|
29
|
+
/** Tighten an existing config file's permissions if they're looser than 0600. */
|
|
30
|
+
async function tightenConfigPermissions(configPath) {
|
|
31
|
+
try {
|
|
32
|
+
const info = await stat(configPath);
|
|
33
|
+
if ((info.mode & 0o777) !== AUDEN_CONFIG_MODE) {
|
|
34
|
+
await chmod(configPath, AUDEN_CONFIG_MODE);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
// Missing or unreadable — nothing to tighten.
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
/**
|
|
42
|
+
* Baked-in fallback when the config file has no `dashboardUrl`. Build-time
|
|
43
|
+
* constant so a stripped-down `auden` binary (no config, no flags) still
|
|
44
|
+
* talks to prod.
|
|
45
|
+
*/
|
|
46
|
+
export const DEFAULT_DASHBOARD_URL = 'https://app.auden.to';
|
|
47
|
+
/**
|
|
48
|
+
* Normalize a candidate dashboard URL to its origin (scheme + host + port).
|
|
49
|
+
* Returns '' when the input is empty, whitespace-only, unparseable, or has a
|
|
50
|
+
* non-http(s) protocol. Centralized here so reads, writes, the resolve
|
|
51
|
+
* helper, and the `auden init` flag-validation path all agree on what counts
|
|
52
|
+
* as a valid URL and what gets stripped (paths, queries, fragments, trailing
|
|
53
|
+
* whitespace).
|
|
54
|
+
*/
|
|
55
|
+
export function normalizeDashboardUrl(value) {
|
|
56
|
+
const trimmed = value.trim();
|
|
57
|
+
if (!trimmed)
|
|
58
|
+
return '';
|
|
59
|
+
try {
|
|
60
|
+
const url = new URL(trimmed);
|
|
61
|
+
if (url.protocol !== 'http:' && url.protocol !== 'https:')
|
|
62
|
+
return '';
|
|
63
|
+
return url.origin;
|
|
64
|
+
}
|
|
65
|
+
catch {
|
|
66
|
+
return '';
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
async function readParsedConfig(path = AUDEN_CONFIG) {
|
|
70
|
+
let raw;
|
|
71
|
+
try {
|
|
72
|
+
raw = await readFile(path, 'utf8');
|
|
73
|
+
}
|
|
74
|
+
catch (err) {
|
|
75
|
+
if (err.code === 'ENOENT') {
|
|
76
|
+
return { parsed: {}, missing: true, malformed: false };
|
|
77
|
+
}
|
|
78
|
+
// Other read errors (permissions, etc.) — treat as malformed so callers
|
|
79
|
+
// that want to write are forced to handle it explicitly.
|
|
80
|
+
return { parsed: {}, missing: false, malformed: true };
|
|
81
|
+
}
|
|
82
|
+
// The file holds a bearer token — tighten permissions on read in case it
|
|
83
|
+
// was created by an older version of the CLI or under a permissive umask.
|
|
84
|
+
await tightenConfigPermissions(path);
|
|
85
|
+
try {
|
|
86
|
+
const parsed = JSON.parse(raw);
|
|
87
|
+
if (parsed && typeof parsed === 'object' && !Array.isArray(parsed)) {
|
|
88
|
+
return {
|
|
89
|
+
parsed: parsed,
|
|
90
|
+
missing: false,
|
|
91
|
+
malformed: false,
|
|
92
|
+
};
|
|
93
|
+
}
|
|
94
|
+
return { parsed: {}, missing: false, malformed: true };
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
return { parsed: {}, missing: false, malformed: true };
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Read the stored API token (persisted by `auden init --token` or the first
|
|
102
|
+
* successful `auden sync --token`). Returns '' if absent or unreadable.
|
|
103
|
+
*/
|
|
104
|
+
export async function readConfigToken(configPath = AUDEN_CONFIG) {
|
|
105
|
+
const { parsed } = await readParsedConfig(configPath);
|
|
106
|
+
return typeof parsed['token'] === 'string' ? parsed['token'] : '';
|
|
107
|
+
}
|
|
108
|
+
/**
|
|
109
|
+
* Persist the API token while preserving any other fields already in the
|
|
110
|
+
* config file. Same malformed-config guard as the other writers — refuses to
|
|
111
|
+
* overwrite a broken file. Throws on an empty/whitespace token so callers
|
|
112
|
+
* can't silently wipe a working credential.
|
|
113
|
+
*/
|
|
114
|
+
export async function writeConfigToken(value, configPath = AUDEN_CONFIG) {
|
|
115
|
+
const trimmed = value.trim();
|
|
116
|
+
if (!trimmed) {
|
|
117
|
+
throw new Error('Refusing to store an empty token.');
|
|
118
|
+
}
|
|
119
|
+
const { parsed, malformed } = await readParsedConfig(configPath);
|
|
120
|
+
if (malformed) {
|
|
121
|
+
throw new Error(`Refusing to overwrite malformed config at ${configPath}. ` +
|
|
122
|
+
'Fix or remove the file before re-running.');
|
|
123
|
+
}
|
|
124
|
+
parsed['token'] = trimmed;
|
|
125
|
+
await writeConfigFile(configPath, JSON.stringify(parsed, null, 2) + '\n');
|
|
126
|
+
}
|
|
127
|
+
/**
|
|
128
|
+
* Read the `discoverGlobal` flag. When true, `auden rules import` extends its
|
|
129
|
+
* default scan to `~/.claude/CLAUDE.md`. Defaults to false on missing or
|
|
130
|
+
* malformed config.
|
|
131
|
+
*/
|
|
132
|
+
export async function readConfigDiscoverGlobal(configPath = AUDEN_CONFIG) {
|
|
133
|
+
const { parsed } = await readParsedConfig(configPath);
|
|
134
|
+
return parsed['discoverGlobal'] === true;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Persist `discoverGlobal` while preserving any other fields already in the
|
|
138
|
+
* config file. Creates the parent directory if needed.
|
|
139
|
+
*
|
|
140
|
+
* Throws when the existing config file is present but malformed, rather than
|
|
141
|
+
* silently overwriting it — callers must surface the error so the user can
|
|
142
|
+
* fix or remove the file before retrying.
|
|
143
|
+
*/
|
|
144
|
+
export async function writeConfigDiscoverGlobal(value, configPath = AUDEN_CONFIG) {
|
|
145
|
+
const { parsed, malformed } = await readParsedConfig(configPath);
|
|
146
|
+
if (malformed) {
|
|
147
|
+
throw new Error(`Refusing to overwrite malformed config at ${configPath}. ` +
|
|
148
|
+
'Fix or remove the file before re-running.');
|
|
149
|
+
}
|
|
150
|
+
parsed['discoverGlobal'] = value;
|
|
151
|
+
await writeConfigFile(configPath, JSON.stringify(parsed, null, 2) + '\n');
|
|
152
|
+
}
|
|
153
|
+
/**
|
|
154
|
+
* Read the MCP bundle allowlist. When set to a non-empty array of slugs,
|
|
155
|
+
* `auden mcp` only exposes those bundles; when absent, empty, or malformed it
|
|
156
|
+
* returns `null`, meaning "no restriction" (all of the caller's bundles are
|
|
157
|
+
* reachable). A `--bundles` flag overrides this per invocation.
|
|
158
|
+
*/
|
|
159
|
+
export async function readConfigMcpBundles(configPath = AUDEN_CONFIG) {
|
|
160
|
+
const { parsed } = await readParsedConfig(configPath);
|
|
161
|
+
const value = parsed['mcp'];
|
|
162
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
163
|
+
return null;
|
|
164
|
+
const bundles = value['bundles'];
|
|
165
|
+
if (!Array.isArray(bundles))
|
|
166
|
+
return null;
|
|
167
|
+
// Trim each slug so a hand-edited config with stray whitespace (" work ")
|
|
168
|
+
// matches the real slug — consistent with the `--bundles` flag parser.
|
|
169
|
+
const slugs = bundles
|
|
170
|
+
.filter((s) => typeof s === 'string')
|
|
171
|
+
.map((s) => s.trim())
|
|
172
|
+
.filter((s) => s !== '');
|
|
173
|
+
return slugs.length > 0 ? slugs : null;
|
|
174
|
+
}
|
|
175
|
+
/**
|
|
176
|
+
* Read whether `auden mcp` may perform writes (push/update/archive). Defaults
|
|
177
|
+
* to `true` — writes are enabled unless the config explicitly sets
|
|
178
|
+
* `mcp.write: false` or the caller passes `--read-only`. Returns `true` on a
|
|
179
|
+
* missing or malformed config so a fresh install is fully functional.
|
|
180
|
+
*/
|
|
181
|
+
export async function readConfigMcpWrite(configPath = AUDEN_CONFIG) {
|
|
182
|
+
const { parsed } = await readParsedConfig(configPath);
|
|
183
|
+
const value = parsed['mcp'];
|
|
184
|
+
if (!value || typeof value !== 'object' || Array.isArray(value))
|
|
185
|
+
return true;
|
|
186
|
+
return value['write'] !== false;
|
|
187
|
+
}
|
|
188
|
+
/**
|
|
189
|
+
* Read the configured dashboard base URL. Returns '' when absent, malformed,
|
|
190
|
+
* not a string, or not a valid http(s) URL. Always normalized to origin so
|
|
191
|
+
* callers can concatenate `${url}/api/...` without thinking about paths,
|
|
192
|
+
* trailing slashes, or stray whitespace from hand-edited configs.
|
|
193
|
+
*/
|
|
194
|
+
export async function readConfigDashboardUrl(configPath = AUDEN_CONFIG) {
|
|
195
|
+
const { parsed } = await readParsedConfig(configPath);
|
|
196
|
+
const value = parsed['dashboardUrl'];
|
|
197
|
+
if (typeof value !== 'string')
|
|
198
|
+
return '';
|
|
199
|
+
return normalizeDashboardUrl(value);
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Persist the dashboard URL. Same malformed-config guard as
|
|
203
|
+
* writeConfigDiscoverGlobal — refuses to overwrite a broken file. Throws
|
|
204
|
+
* when the value isn't a valid http(s) URL so callers can't silently store
|
|
205
|
+
* garbage that fails later at fetch time.
|
|
206
|
+
*/
|
|
207
|
+
export async function writeConfigDashboardUrl(value, configPath = AUDEN_CONFIG) {
|
|
208
|
+
const normalized = normalizeDashboardUrl(value);
|
|
209
|
+
if (!normalized) {
|
|
210
|
+
throw new Error(`Refusing to store invalid dashboard URL: ${JSON.stringify(value)}`);
|
|
211
|
+
}
|
|
212
|
+
const { parsed, malformed } = await readParsedConfig(configPath);
|
|
213
|
+
if (malformed) {
|
|
214
|
+
throw new Error(`Refusing to overwrite malformed config at ${configPath}. ` +
|
|
215
|
+
'Fix or remove the file before re-running.');
|
|
216
|
+
}
|
|
217
|
+
parsed['dashboardUrl'] = normalized;
|
|
218
|
+
await writeConfigFile(configPath, JSON.stringify(parsed, null, 2) + '\n');
|
|
219
|
+
}
|
|
220
|
+
/**
|
|
221
|
+
* Resolve which dashboard URL a command should hit. Precedence:
|
|
222
|
+
* 1. Explicit `--dashboard-url` flag (`flag` arg, when non-empty and valid)
|
|
223
|
+
* 2. `dashboardUrl` field in ~/.auden/config.json
|
|
224
|
+
* 3. DEFAULT_DASHBOARD_URL baked into the build
|
|
225
|
+
*
|
|
226
|
+
* Throws when the flag was supplied but isn't a valid http(s) URL — silent
|
|
227
|
+
* fallback would let `auden sync --dashboard-url htps://typo` hit prod
|
|
228
|
+
* instead of the intended override. Matches `auden init`'s strictness.
|
|
229
|
+
*
|
|
230
|
+
* The result is always a bare origin (no path, no trailing slash) so
|
|
231
|
+
* `${resolved}/api/sync` works.
|
|
232
|
+
*/
|
|
233
|
+
export async function resolveDashboardUrl(flag = '', configPath = AUDEN_CONFIG) {
|
|
234
|
+
if (flag.trim()) {
|
|
235
|
+
const fromFlag = normalizeDashboardUrl(flag);
|
|
236
|
+
if (!fromFlag) {
|
|
237
|
+
throw new Error(`--dashboard-url is not a valid http(s) URL: ${flag}`);
|
|
238
|
+
}
|
|
239
|
+
return fromFlag;
|
|
240
|
+
}
|
|
241
|
+
const fromConfig = await readConfigDashboardUrl(configPath);
|
|
242
|
+
if (fromConfig)
|
|
243
|
+
return fromConfig;
|
|
244
|
+
return DEFAULT_DASHBOARD_URL;
|
|
245
|
+
}
|
|
246
|
+
//# sourceMappingURL=config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAA;AAC1E,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAEnC,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAA;AAE/C,yEAAyE;AACzE,MAAM,CAAC,MAAM,cAAc,GAAG,KAAK,CAAA;AACnC,4EAA4E;AAC5E,MAAM,CAAC,MAAM,iBAAiB,GAAG,KAAK,CAAA;AAEtC;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,GAAW;IAC9C,MAAM,KAAK,CAAC,GAAG,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,EAAE,CAAC,CAAA;IAC3D,MAAM,KAAK,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAClD,CAAC;AAED;;;GAGG;AACH,KAAK,UAAU,eAAe,CAAC,UAAkB,EAAE,QAAgB;IACjE,MAAM,cAAc,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC,CAAA;IACzC,MAAM,SAAS,CAAC,UAAU,EAAE,QAAQ,EAAE,EAAE,IAAI,EAAE,iBAAiB,EAAE,CAAC,CAAA;IAClE,wEAAwE;IACxE,4EAA4E;IAC5E,MAAM,KAAK,CAAC,UAAU,EAAE,iBAAiB,CAAC,CAAC,KAAK,CAAC,GAAG,EAAE,GAAE,CAAC,CAAC,CAAA;AAC5D,CAAC;AAED,iFAAiF;AACjF,KAAK,UAAU,wBAAwB,CAAC,UAAkB;IACxD,IAAI,CA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C;IACD,MAAM,UAAU,GAAG,MAAM,sBAAsB,CAAC,UAAU,CAAC,CAAA;IAC3D,IAAI,UAAU;QAAE,OAAO,UAAU,CAAA;IACjC,OAAO,qBAAqB,CAAA;AAC9B,CAAC"}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core logic for the `auden pull <bundle>` command: fetch a bundle's canonical
|
|
3
|
+
* items via the shared `ContextClient` and materialize them to a local
|
|
4
|
+
* directory as Markdown. This is the plain-terminal twin of the MCP
|
|
5
|
+
* `pull_context` tool (`src/mcp/server.ts`) — same client, same
|
|
6
|
+
* `writeItemsToDir` write path — so a human can drop scoped context into a repo
|
|
7
|
+
* without wiring an agent.
|
|
8
|
+
*
|
|
9
|
+
* Kept free of citty/console so it unit-tests directly against a mocked client.
|
|
10
|
+
*/
|
|
11
|
+
import type { ContextClient, PullContextParams } from '../mcp/client.js';
|
|
12
|
+
import type { WriteItemsDeps } from '../mcp/write-items.js';
|
|
13
|
+
import type { ContextItem } from '@auden.to/protocol';
|
|
14
|
+
export type PullBundleParams = PullContextParams;
|
|
15
|
+
export type PullBundleResult = {
|
|
16
|
+
/** Every item the bundle returned, including items with null content (e.g. assets). */
|
|
17
|
+
items: readonly ContextItem[];
|
|
18
|
+
/** Paths written to disk (excludes null-content items, which are skipped). */
|
|
19
|
+
written: string[];
|
|
20
|
+
};
|
|
21
|
+
/**
|
|
22
|
+
* Turn a bundle slug into a safe single path segment for the default output
|
|
23
|
+
* directory. Strips path separators and leading dots so a crafted slug cannot
|
|
24
|
+
* escape the target directory, and falls back to `bundle` when the slug reduces
|
|
25
|
+
* to nothing. Mirrors the defensive posture of `safeItemFileName`.
|
|
26
|
+
*/
|
|
27
|
+
export declare function safeBundleDirName(bundle: string): string;
|
|
28
|
+
/**
|
|
29
|
+
* Default output directory for `auden pull <bundle>` when `--out` is not given:
|
|
30
|
+
* `<cwd>/.auden/context/<bundle>/`. Keeps pulled context out of the way of the
|
|
31
|
+
* repo's own tree while staying discoverable.
|
|
32
|
+
*/
|
|
33
|
+
export declare function defaultPullDir(bundle: string, cwd: string): string;
|
|
34
|
+
/**
|
|
35
|
+
* Pull `params.bundle`'s items and write each to `dir` as `<safe-name>.md`.
|
|
36
|
+
* Returns the full item list (for a caller-facing summary) alongside the paths
|
|
37
|
+
* actually written. `deps` injects the filesystem for tests.
|
|
38
|
+
*/
|
|
39
|
+
export declare function pullBundleToDir(client: ContextClient, params: PullBundleParams, dir: string, deps?: WriteItemsDeps): Promise<PullBundleResult>;
|
|
40
|
+
//# sourceMappingURL=pull.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.d.ts","sourceRoot":"","sources":["../../src/context/pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,aAAa,EAAE,iBAAiB,EAAE,MAAM,kBAAkB,CAAA;AACxE,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,uBAAuB,CAAA;AAC3D,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAA;AAErD,MAAM,MAAM,gBAAgB,GAAG,iBAAiB,CAAA;AAEhD,MAAM,MAAM,gBAAgB,GAAG;IAC7B,uFAAuF;IACvF,KAAK,EAAE,SAAS,WAAW,EAAE,CAAA;IAC7B,8EAA8E;IAC9E,OAAO,EAAE,MAAM,EAAE,CAAA;CAClB,CAAA;AAED;;;;;GAKG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAQxD;AAED;;;;GAIG;AACH,wBAAgB,cAAc,CAAC,MAAM,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,GAAG,MAAM,CAElE;AAED;;;;GAIG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,aAAa,EACrB,MAAM,EAAE,gBAAgB,EACxB,GAAG,EAAE,MAAM,EACX,IAAI,GAAE,cAAmB,GACxB,OAAO,CAAC,gBAAgB,CAAC,CAI3B"}
|
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core logic for the `auden pull <bundle>` command: fetch a bundle's canonical
|
|
3
|
+
* items via the shared `ContextClient` and materialize them to a local
|
|
4
|
+
* directory as Markdown. This is the plain-terminal twin of the MCP
|
|
5
|
+
* `pull_context` tool (`src/mcp/server.ts`) — same client, same
|
|
6
|
+
* `writeItemsToDir` write path — so a human can drop scoped context into a repo
|
|
7
|
+
* without wiring an agent.
|
|
8
|
+
*
|
|
9
|
+
* Kept free of citty/console so it unit-tests directly against a mocked client.
|
|
10
|
+
*/
|
|
11
|
+
import { join } from 'node:path';
|
|
12
|
+
import { writeItemsToDir } from '../mcp/write-items.js';
|
|
13
|
+
/**
|
|
14
|
+
* Turn a bundle slug into a safe single path segment for the default output
|
|
15
|
+
* directory. Strips path separators and leading dots so a crafted slug cannot
|
|
16
|
+
* escape the target directory, and falls back to `bundle` when the slug reduces
|
|
17
|
+
* to nothing. Mirrors the defensive posture of `safeItemFileName`.
|
|
18
|
+
*/
|
|
19
|
+
export function safeBundleDirName(bundle) {
|
|
20
|
+
const cleaned = bundle
|
|
21
|
+
.trim()
|
|
22
|
+
.replace(/[/\\]/g, '-') // no path separators: single segment, no traversal
|
|
23
|
+
.replace(/[<>:"|?*]/g, '-') // chars invalid in Windows filenames
|
|
24
|
+
.replace(/^[-.]+/, '') // no leading dots/dashes (., .., dotfiles-as-traversal)
|
|
25
|
+
.trim();
|
|
26
|
+
return cleaned || 'bundle';
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Default output directory for `auden pull <bundle>` when `--out` is not given:
|
|
30
|
+
* `<cwd>/.auden/context/<bundle>/`. Keeps pulled context out of the way of the
|
|
31
|
+
* repo's own tree while staying discoverable.
|
|
32
|
+
*/
|
|
33
|
+
export function defaultPullDir(bundle, cwd) {
|
|
34
|
+
return join(cwd, '.auden', 'context', safeBundleDirName(bundle));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Pull `params.bundle`'s items and write each to `dir` as `<safe-name>.md`.
|
|
38
|
+
* Returns the full item list (for a caller-facing summary) alongside the paths
|
|
39
|
+
* actually written. `deps` injects the filesystem for tests.
|
|
40
|
+
*/
|
|
41
|
+
export async function pullBundleToDir(client, params, dir, deps = {}) {
|
|
42
|
+
const { items } = await client.pullContext(params);
|
|
43
|
+
const written = await writeItemsToDir(items, dir, deps);
|
|
44
|
+
return { items, written };
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=pull.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pull.js","sourceRoot":"","sources":["../../src/context/pull.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAA;AAEhC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAA;AAevD;;;;;GAKG;AACH,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,MAAM,OAAO,GAAG,MAAM;SACnB,IAAI,EAAE;SACN,OAAO,CAAC,QAAQ,EAAE,GAAG,CAAC,CAAC,mDAAmD;SAC1E,OAAO,CAAC,YAAY,EAAE,GAAG,CAAC,CAAC,qCAAqC;SAChE,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC,wDAAwD;SAC9E,IAAI,EAAE,CAAA;IACT,OAAO,OAAO,IAAI,QAAQ,CAAA;AAC5B,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,cAAc,CAAC,MAAc,EAAE,GAAW;IACxD,OAAO,IAAI,CAAC,GAAG,EAAE,QAAQ,EAAE,SAAS,EAAE,iBAAiB,CAAC,MAAM,CAAC,CAAC,CAAA;AAClE,CAAC;AAED;;;;GAIG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAqB,EACrB,MAAwB,EACxB,GAAW,EACX,OAAuB,EAAE;IAEzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,MAAM,CAAC,WAAW,CAAC,MAAM,CAAC,CAAA;IAClD,MAAM,OAAO,GAAG,MAAM,eAAe,CAAC,KAAK,EAAE,GAAG,EAAE,IAAI,CAAC,CAAA;IACvD,OAAO,EAAE,KAAK,EAAE,OAAO,EAAE,CAAA;AAC3B,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import type { TokenVerification } from './token-verify.js';
|
|
2
|
+
/**
|
|
3
|
+
* Dashboard-connection state reported by `auden doctor`. Extends the network
|
|
4
|
+
* probe's {@link TokenVerification} with `unconfigured` — no token stored at
|
|
5
|
+
* all, i.e. deliberate local-only mode rather than a broken connection.
|
|
6
|
+
*/
|
|
7
|
+
export type DashboardHealth = TokenVerification | 'unconfigured';
|
|
8
|
+
/**
|
|
9
|
+
* One-line, human-readable description of the dashboard connection for
|
|
10
|
+
* `auden doctor`. Presentation only — the actual probe lives in
|
|
11
|
+
* {@link verifyDashboardToken}.
|
|
12
|
+
*
|
|
13
|
+
* Dashboard connectivity is informational and never fails the doctor run: the
|
|
14
|
+
* CLI evaluates fully offline from the cached guide bundle, so a missing or
|
|
15
|
+
* broken connection doesn't stop local use. Surfacing a *broken* connection is
|
|
16
|
+
* the point — a token that silently 401s otherwise reads as "configured", so
|
|
17
|
+
* activation fails with no signal.
|
|
18
|
+
*/
|
|
19
|
+
export declare function describeDashboardHealth(health: DashboardHealth, dashboardUrl: string): string;
|
|
20
|
+
//# sourceMappingURL=dashboard-health.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-health.d.ts","sourceRoot":"","sources":["../src/dashboard-health.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;GAIG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG,cAAc,CAAA;AAEhE;;;;;;;;;;GAUG;AACH,wBAAgB,uBAAuB,CACrC,MAAM,EAAE,eAAe,EACvB,YAAY,EAAE,MAAM,GACnB,MAAM,CAWR"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* One-line, human-readable description of the dashboard connection for
|
|
3
|
+
* `auden doctor`. Presentation only — the actual probe lives in
|
|
4
|
+
* {@link verifyDashboardToken}.
|
|
5
|
+
*
|
|
6
|
+
* Dashboard connectivity is informational and never fails the doctor run: the
|
|
7
|
+
* CLI evaluates fully offline from the cached guide bundle, so a missing or
|
|
8
|
+
* broken connection doesn't stop local use. Surfacing a *broken* connection is
|
|
9
|
+
* the point — a token that silently 401s otherwise reads as "configured", so
|
|
10
|
+
* activation fails with no signal.
|
|
11
|
+
*/
|
|
12
|
+
export function describeDashboardHealth(health, dashboardUrl) {
|
|
13
|
+
switch (health) {
|
|
14
|
+
case 'unconfigured':
|
|
15
|
+
return 'Dashboard token: not set — local-only mode (run `auden sync --token <token>` to connect)';
|
|
16
|
+
case 'ok':
|
|
17
|
+
return `Dashboard connection: healthy (${dashboardUrl})`;
|
|
18
|
+
case 'rejected':
|
|
19
|
+
return `Dashboard connection: token rejected by ${dashboardUrl} — it may be expired or revoked; get a fresh one from the dashboard (Settings → Developer → CLI Token) and run \`auden sync --token <token>\``;
|
|
20
|
+
case 'unreachable':
|
|
21
|
+
return `Dashboard connection: could not reach ${dashboardUrl} — check your network or pass --dashboard-url (token left unverified)`;
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
//# sourceMappingURL=dashboard-health.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-health.js","sourceRoot":"","sources":["../src/dashboard-health.ts"],"names":[],"mappings":"AASA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,uBAAuB,CACrC,MAAuB,EACvB,YAAoB;IAEpB,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,cAAc;YACjB,OAAO,0FAA0F,CAAA;QACnG,KAAK,IAAI;YACP,OAAO,kCAAkC,YAAY,GAAG,CAAA;QAC1D,KAAK,UAAU;YACb,OAAO,2CAA2C,YAAY,+IAA+I,CAAA;QAC/M,KAAK,aAAa;YAChB,OAAO,yCAAyC,YAAY,uEAAuE,CAAA;IACvI,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import type { EvalAdapter } from '@auden.to/eval-core';
|
|
2
|
+
import type { EvalProviderConfig } from '@auden.to/protocol';
|
|
3
|
+
type EvalOptionOverrides = {
|
|
4
|
+
provider?: string;
|
|
5
|
+
model?: string;
|
|
6
|
+
apiKey?: string;
|
|
7
|
+
baseUrl?: string;
|
|
8
|
+
};
|
|
9
|
+
export declare const DEFAULT_EVAL_PROVIDER: "openrouter";
|
|
10
|
+
export declare const DEFAULT_OPENROUTER_MODEL = "anthropic/claude-sonnet-4.6";
|
|
11
|
+
export declare function readStoredEvalProviderSettings(rawConfig: unknown): {
|
|
12
|
+
provider?: "openrouter" | "anthropic" | "openai-compatible" | "google" | "ollama" | undefined;
|
|
13
|
+
model?: string | undefined;
|
|
14
|
+
apiKey?: string | undefined;
|
|
15
|
+
baseUrl?: string | undefined;
|
|
16
|
+
siteUrl?: string | undefined;
|
|
17
|
+
siteName?: string | undefined;
|
|
18
|
+
};
|
|
19
|
+
export declare function resolveEvalProviderConfig(rawConfig: unknown, env: NodeJS.ProcessEnv, overrides?: EvalOptionOverrides): EvalProviderConfig;
|
|
20
|
+
/**
|
|
21
|
+
* Default per-request timeout for eval provider calls. Generous because LLM
|
|
22
|
+
* completions can legitimately take tens of seconds; the guard is against a
|
|
23
|
+
* hung connection blocking the CLI (and the Claude Code Stop hook) forever.
|
|
24
|
+
* Override with `AUDEN_EVAL_TIMEOUT_MS`.
|
|
25
|
+
*/
|
|
26
|
+
export declare const DEFAULT_EVAL_FETCH_TIMEOUT_MS = 120000;
|
|
27
|
+
export declare function evalFetchTimeoutMs(env?: NodeJS.ProcessEnv): number;
|
|
28
|
+
export declare function createEvalAdapter(config: EvalProviderConfig): EvalAdapter;
|
|
29
|
+
export {};
|
|
30
|
+
//# sourceMappingURL=eval-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"eval-provider.d.ts","sourceRoot":"","sources":["../src/eval-provider.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAA;AACtD,OAAO,KAAK,EAAE,kBAAkB,EAAoB,MAAM,oBAAoB,CAAA;AAE9E,KAAK,mBAAmB,GAAG;IACzB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,KAAK,CAAC,EAAE,MAAM,CAAA;IACd,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,OAAO,CAAC,EAAE,MAAM,CAAA;CACjB,CAAA;AAED,eAAO,MAAM,qBAAqB,EAAG,YAAqB,CAAA;AAC1D,eAAO,MAAM,wBAAwB,gCAAgC,CAAA;AAqGrE,wBAAgB,8BAA8B,CAAC,SAAS,EAAE,OAAO;;;;;;;EAMhE;AAED,wBAAgB,yBAAyB,CACvC,SAAS,EAAE,OAAO,EAClB,GAAG,EAAE,MAAM,CAAC,UAAU,EACtB,SAAS,GAAE,mBAAwB,GAClC,kBAAkB,CAmDpB;AAED;;;;;GAKG;AACH,eAAO,MAAM,6BAA6B,SAAU,CAAA;AAEpD,wBAAgB,kBAAkB,CAAC,GAAG,GAAE,MAAM,CAAC,UAAwB,GAAG,MAAM,CAI/E;AA0QD,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,kBAAkB,GAAG,WAAW,CAgBzE"}
|