@plumloom/cli 0.1.4 → 0.1.6
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 +6 -0
- package/dist/actions/config.d.ts +16 -0
- package/dist/actions/config.d.ts.map +1 -0
- package/dist/actions/config.js +28 -0
- package/dist/actions/config.js.map +1 -0
- package/dist/actions/imports.d.ts +120 -0
- package/dist/actions/imports.d.ts.map +1 -0
- package/dist/actions/imports.js +404 -0
- package/dist/actions/imports.js.map +1 -0
- package/dist/actions/init.d.ts +47 -0
- package/dist/actions/init.d.ts.map +1 -0
- package/dist/actions/init.js +89 -0
- package/dist/actions/init.js.map +1 -0
- package/dist/actions/pack.d.ts +36 -0
- package/dist/actions/pack.d.ts.map +1 -0
- package/dist/actions/pack.js +271 -0
- package/dist/actions/pack.js.map +1 -0
- package/dist/actions/suite.d.ts +4 -0
- package/dist/actions/suite.d.ts.map +1 -1
- package/dist/actions/suite.js +19 -0
- package/dist/actions/suite.js.map +1 -1
- package/dist/api/api.d.ts +3 -0
- package/dist/api/api.d.ts.map +1 -1
- package/dist/api/api.js +9 -0
- package/dist/api/api.js.map +1 -1
- package/dist/api/client.d.ts +2 -2
- package/dist/api/client.d.ts.map +1 -1
- package/dist/api/external-import.d.ts +9 -0
- package/dist/api/external-import.d.ts.map +1 -0
- package/dist/api/external-import.js +2 -0
- package/dist/api/external-import.js.map +1 -0
- package/dist/commands/executor.d.ts +1 -0
- package/dist/commands/executor.d.ts.map +1 -1
- package/dist/commands/executor.js +126 -2
- package/dist/commands/executor.js.map +1 -1
- package/dist/commands/imports.d.ts +6 -0
- package/dist/commands/imports.d.ts.map +1 -0
- package/dist/commands/imports.js +132 -0
- package/dist/commands/imports.js.map +1 -0
- package/dist/commands/program.d.ts.map +1 -1
- package/dist/commands/program.js +2 -0
- package/dist/commands/program.js.map +1 -1
- package/dist/commands/types.d.ts +5 -0
- package/dist/commands/types.d.ts.map +1 -1
- package/dist/errors/autoeval-error.d.ts +1 -0
- package/dist/errors/autoeval-error.d.ts.map +1 -1
- package/dist/errors/autoeval-error.js +1 -1
- package/dist/errors/autoeval-error.js.map +1 -1
- package/dist/errors/hints.d.ts.map +1 -1
- package/dist/errors/hints.js +7 -0
- package/dist/errors/hints.js.map +1 -1
- package/dist/gate/decision.d.ts +1 -1
- package/dist/gate/decision.d.ts.map +1 -1
- package/dist/gate/decision.js +8 -8
- package/dist/gate/decision.js.map +1 -1
- package/dist/github/pr-comment.d.ts +55 -0
- package/dist/github/pr-comment.d.ts.map +1 -0
- package/dist/github/pr-comment.js +287 -0
- package/dist/github/pr-comment.js.map +1 -0
- package/dist/github/reliability-report.d.ts +16 -0
- package/dist/github/reliability-report.d.ts.map +1 -0
- package/dist/github/reliability-report.js +341 -0
- package/dist/github/reliability-report.js.map +1 -0
- package/dist/mcp/schemas.d.ts +32 -0
- package/dist/mcp/schemas.d.ts.map +1 -1
- package/dist/mcp/schemas.js +55 -0
- package/dist/mcp/schemas.js.map +1 -1
- package/dist/mcp/tools.d.ts +2 -0
- package/dist/mcp/tools.d.ts.map +1 -1
- package/dist/mcp/tools.js +146 -17
- package/dist/mcp/tools.js.map +1 -1
- package/dist/output/imports.d.ts +3 -0
- package/dist/output/imports.d.ts.map +1 -0
- package/dist/output/imports.js +280 -0
- package/dist/output/imports.js.map +1 -0
- package/dist/output/next-steps.d.ts +26 -0
- package/dist/output/next-steps.d.ts.map +1 -0
- package/dist/output/next-steps.js +54 -0
- package/dist/output/next-steps.js.map +1 -0
- package/dist/packs/data.d.ts +3 -0
- package/dist/packs/data.d.ts.map +1 -0
- package/dist/packs/data.js +102 -0
- package/dist/packs/data.js.map +1 -0
- package/dist/packs/registry.d.ts +37 -0
- package/dist/packs/registry.d.ts.map +1 -0
- package/dist/packs/registry.js +19 -0
- package/dist/packs/registry.js.map +1 -0
- package/dist/reliability/evidence.d.ts +44 -0
- package/dist/reliability/evidence.d.ts.map +1 -0
- package/dist/reliability/evidence.js +259 -0
- package/dist/reliability/evidence.js.map +1 -0
- package/dist/settings/resolve.d.ts +14 -0
- package/dist/settings/resolve.d.ts.map +1 -0
- package/dist/settings/resolve.js +18 -0
- package/dist/settings/resolve.js.map +1 -0
- package/dist/settings/settings.d.ts +47 -0
- package/dist/settings/settings.d.ts.map +1 -0
- package/dist/settings/settings.js +169 -0
- package/dist/settings/settings.js.map +1 -0
- package/package.json +1 -1
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { AutoevalSettings } from './settings.js';
|
|
2
|
+
/**
|
|
3
|
+
* Resolution precedence for a workspace or model, applied in the command
|
|
4
|
+
* activation/action workflow before model selection: explicit flag → saved settings default →
|
|
5
|
+
* the existing interactive/auto behavior handled downstream (a return of
|
|
6
|
+
* `undefined` means "fall through to that behavior"). See ADR 0014.
|
|
7
|
+
*/
|
|
8
|
+
export declare function resolveWorkspaceId(flag: string | undefined, settings: AutoevalSettings): string | undefined;
|
|
9
|
+
export type ModelIdFlags = {
|
|
10
|
+
judgeModelId?: string;
|
|
11
|
+
primaryModelId?: string;
|
|
12
|
+
};
|
|
13
|
+
export declare function resolveModelIds(flags: ModelIdFlags, settings: AutoevalSettings): ModelIdFlags;
|
|
14
|
+
//# sourceMappingURL=resolve.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.d.ts","sourceRoot":"","sources":["../../src/settings/resolve.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAEtD;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,GAAG,SAAS,EACxB,QAAQ,EAAE,gBAAgB,GACzB,MAAM,GAAG,SAAS,CAEpB;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,YAAY,CAAC,EAAE,MAAM,CAAC;IACtB,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB,CAAC;AAEF,wBAAgB,eAAe,CAAC,KAAK,EAAE,YAAY,EAAE,QAAQ,EAAE,gBAAgB,GAAG,YAAY,CAO7F"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Resolution precedence for a workspace or model, applied in the command
|
|
3
|
+
* activation/action workflow before model selection: explicit flag → saved settings default →
|
|
4
|
+
* the existing interactive/auto behavior handled downstream (a return of
|
|
5
|
+
* `undefined` means "fall through to that behavior"). See ADR 0014.
|
|
6
|
+
*/
|
|
7
|
+
export function resolveWorkspaceId(flag, settings) {
|
|
8
|
+
return flag ?? settings.defaultWorkspaceId;
|
|
9
|
+
}
|
|
10
|
+
export function resolveModelIds(flags, settings) {
|
|
11
|
+
const judgeModelId = flags.judgeModelId ?? settings.defaultJudgeModelId;
|
|
12
|
+
const primaryModelId = flags.primaryModelId ?? settings.defaultPrimaryModelId;
|
|
13
|
+
return {
|
|
14
|
+
...(judgeModelId !== undefined ? { judgeModelId } : {}),
|
|
15
|
+
...(primaryModelId !== undefined ? { primaryModelId } : {}),
|
|
16
|
+
};
|
|
17
|
+
}
|
|
18
|
+
//# sourceMappingURL=resolve.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"resolve.js","sourceRoot":"","sources":["../../src/settings/resolve.ts"],"names":[],"mappings":"AAEA;;;;;GAKG;AACH,MAAM,UAAU,kBAAkB,CAChC,IAAwB,EACxB,QAA0B;IAE1B,OAAO,IAAI,IAAI,QAAQ,CAAC,kBAAkB,CAAC;AAC7C,CAAC;AAOD,MAAM,UAAU,eAAe,CAAC,KAAmB,EAAE,QAA0B;IAC7E,MAAM,YAAY,GAAG,KAAK,CAAC,YAAY,IAAI,QAAQ,CAAC,mBAAmB,CAAC;IACxE,MAAM,cAAc,GAAG,KAAK,CAAC,cAAc,IAAI,QAAQ,CAAC,qBAAqB,CAAC;IAC9E,OAAO;QACL,GAAG,CAAC,YAAY,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;QACvD,GAAG,CAAC,cAAc,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,cAAc,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;KAC5D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* The first on-disk settings file. It holds only non-secret user defaults so
|
|
3
|
+
* commands stop demanding a workspace or model UUID every time.
|
|
4
|
+
*
|
|
5
|
+
* It never holds the API key (that stays in the OS keyring, ADR 0002) and never
|
|
6
|
+
* holds an API base URL (ADR 0011). See ADR 0014 for the full rationale.
|
|
7
|
+
*/
|
|
8
|
+
export type AutoevalSettings = {
|
|
9
|
+
version: 1;
|
|
10
|
+
defaultWorkspaceId?: string;
|
|
11
|
+
defaultJudgeModelId?: string;
|
|
12
|
+
defaultPrimaryModelId?: string;
|
|
13
|
+
/** Owned by SPEC-02 (opt-in telemetry); the field is reserved here. */
|
|
14
|
+
telemetryOptIn?: boolean;
|
|
15
|
+
};
|
|
16
|
+
export type SettingsEnvironment = Readonly<Record<string, string | undefined>>;
|
|
17
|
+
export type LoadSettingsOptions = {
|
|
18
|
+
/** Overrides the resolved file path; used for hermetic tests and injection. */
|
|
19
|
+
path?: string;
|
|
20
|
+
/** Overrides the environment used to resolve the default path. */
|
|
21
|
+
env?: SettingsEnvironment;
|
|
22
|
+
/** Receives a human-readable message when a present file could not be used. */
|
|
23
|
+
onDiagnostic?: (message: string) => void;
|
|
24
|
+
};
|
|
25
|
+
export type WriteSettingsOptions = {
|
|
26
|
+
path?: string;
|
|
27
|
+
env?: SettingsEnvironment;
|
|
28
|
+
};
|
|
29
|
+
export declare function settingsDirectory(env?: SettingsEnvironment): string;
|
|
30
|
+
export declare function settingsPath(env?: SettingsEnvironment): string;
|
|
31
|
+
/**
|
|
32
|
+
* Reads settings from disk. A missing file returns defaults silently; a present
|
|
33
|
+
* but unreadable, oversized, or invalid file returns defaults and reports a
|
|
34
|
+
* diagnostic. This never throws, so it can run at the top of any command.
|
|
35
|
+
*/
|
|
36
|
+
export declare function loadSettings(options?: LoadSettingsOptions): Promise<AutoevalSettings>;
|
|
37
|
+
/**
|
|
38
|
+
* Writes settings atomically with `0600` permissions. The temporary file is
|
|
39
|
+
* created with the `wx` flag (`O_EXCL`), so the write fails rather than
|
|
40
|
+
* following or overwriting a pre-planted file or symlink at the temp path, and
|
|
41
|
+
* uses a random suffix to avoid predictable names. It is `fsync`ed and then
|
|
42
|
+
* renamed over the target, so a partial write can never replace a good file.
|
|
43
|
+
*/
|
|
44
|
+
export declare function saveSettings(next: AutoevalSettings, options?: WriteSettingsOptions): Promise<void>;
|
|
45
|
+
/** Removes the settings file. A missing file is treated as already cleared. */
|
|
46
|
+
export declare function clearSettings(options?: WriteSettingsOptions): Promise<void>;
|
|
47
|
+
//# sourceMappingURL=settings.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.d.ts","sourceRoot":"","sources":["../../src/settings/settings.ts"],"names":[],"mappings":"AAUA;;;;;;GAMG;AACH,MAAM,MAAM,gBAAgB,GAAG;IAC7B,OAAO,EAAE,CAAC,CAAC;IACX,kBAAkB,CAAC,EAAE,MAAM,CAAC;IAC5B,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,qBAAqB,CAAC,EAAE,MAAM,CAAC;IAC/B,uEAAuE;IACvE,cAAc,CAAC,EAAE,OAAO,CAAC;CAC1B,CAAC;AAEF,MAAM,MAAM,mBAAmB,GAAG,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC,CAAC;AAE/E,MAAM,MAAM,mBAAmB,GAAG;IAChC,+EAA+E;IAC/E,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,kEAAkE;IAClE,GAAG,CAAC,EAAE,mBAAmB,CAAC;IAC1B,+EAA+E;IAC/E,YAAY,CAAC,EAAE,CAAC,OAAO,EAAE,MAAM,KAAK,IAAI,CAAC;CAC1C,CAAC;AAEF,MAAM,MAAM,oBAAoB,GAAG;IACjC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,GAAG,CAAC,EAAE,mBAAmB,CAAC;CAC3B,CAAC;AAiCF,wBAAgB,iBAAiB,CAAC,GAAG,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAMnE;AAED,wBAAgB,YAAY,CAAC,GAAG,CAAC,EAAE,mBAAmB,GAAG,MAAM,CAE9D;AAkBD;;;;GAIG;AACH,wBAAsB,YAAY,CAAC,OAAO,GAAE,mBAAwB,GAAG,OAAO,CAAC,gBAAgB,CAAC,CA2C/F;AAED;;;;;;GAMG;AACH,wBAAsB,YAAY,CAChC,IAAI,EAAE,gBAAgB,EACtB,OAAO,GAAE,oBAAyB,GACjC,OAAO,CAAC,IAAI,CAAC,CAuCf;AAED,+EAA+E;AAC/E,wBAAsB,aAAa,CAAC,OAAO,GAAE,oBAAyB,GAAG,OAAO,CAAC,IAAI,CAAC,CAWrF"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { randomBytes } from 'node:crypto';
|
|
2
|
+
import { mkdir, open, rename, rm } from 'node:fs/promises';
|
|
3
|
+
import { homedir } from 'node:os';
|
|
4
|
+
import { dirname, join } from 'node:path';
|
|
5
|
+
import { z } from 'zod';
|
|
6
|
+
import { containsCliCredential } from '../auth/redact.js';
|
|
7
|
+
import { AutoevalError } from '../errors/autoeval-error.js';
|
|
8
|
+
const DEFAULT_SETTINGS = { version: 1 };
|
|
9
|
+
/** A corrupt or oversized settings file degrades to defaults, never a crash. */
|
|
10
|
+
const MAX_SETTINGS_BYTES = 64 * 1024;
|
|
11
|
+
/**
|
|
12
|
+
* IDs are stored as non-empty strings rather than strict UUIDs so `config
|
|
13
|
+
* set-*` works offline and the value is validated lazily when it is used.
|
|
14
|
+
*/
|
|
15
|
+
const nonSecretSettingSchema = z
|
|
16
|
+
.string()
|
|
17
|
+
.trim()
|
|
18
|
+
.min(1)
|
|
19
|
+
.refine((value) => !containsCliCredential(value), {
|
|
20
|
+
message: 'Settings values must not contain an Autoeval CLI credential.',
|
|
21
|
+
});
|
|
22
|
+
const settingsSchema = z
|
|
23
|
+
.object({
|
|
24
|
+
version: z.literal(1),
|
|
25
|
+
defaultWorkspaceId: nonSecretSettingSchema.optional(),
|
|
26
|
+
defaultJudgeModelId: nonSecretSettingSchema.optional(),
|
|
27
|
+
defaultPrimaryModelId: nonSecretSettingSchema.optional(),
|
|
28
|
+
telemetryOptIn: z.boolean().optional(),
|
|
29
|
+
})
|
|
30
|
+
.strip();
|
|
31
|
+
function resolveEnvironment(env) {
|
|
32
|
+
return env ?? process.env;
|
|
33
|
+
}
|
|
34
|
+
export function settingsDirectory(env) {
|
|
35
|
+
const environment = resolveEnvironment(env);
|
|
36
|
+
const configHome = environment.XDG_CONFIG_HOME;
|
|
37
|
+
const base = configHome !== undefined && configHome.trim() !== '' ? configHome : join(homedir(), '.config');
|
|
38
|
+
return join(base, 'autoeval');
|
|
39
|
+
}
|
|
40
|
+
export function settingsPath(env) {
|
|
41
|
+
return join(settingsDirectory(env), 'settings.json');
|
|
42
|
+
}
|
|
43
|
+
function normalizeSettings(parsed) {
|
|
44
|
+
return {
|
|
45
|
+
version: 1,
|
|
46
|
+
...(parsed.defaultWorkspaceId !== undefined
|
|
47
|
+
? { defaultWorkspaceId: parsed.defaultWorkspaceId }
|
|
48
|
+
: {}),
|
|
49
|
+
...(parsed.defaultJudgeModelId !== undefined
|
|
50
|
+
? { defaultJudgeModelId: parsed.defaultJudgeModelId }
|
|
51
|
+
: {}),
|
|
52
|
+
...(parsed.defaultPrimaryModelId !== undefined
|
|
53
|
+
? { defaultPrimaryModelId: parsed.defaultPrimaryModelId }
|
|
54
|
+
: {}),
|
|
55
|
+
...(parsed.telemetryOptIn !== undefined ? { telemetryOptIn: parsed.telemetryOptIn } : {}),
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
/**
|
|
59
|
+
* Reads settings from disk. A missing file returns defaults silently; a present
|
|
60
|
+
* but unreadable, oversized, or invalid file returns defaults and reports a
|
|
61
|
+
* diagnostic. This never throws, so it can run at the top of any command.
|
|
62
|
+
*/
|
|
63
|
+
export async function loadSettings(options = {}) {
|
|
64
|
+
const filePath = options.path ?? settingsPath(options.env);
|
|
65
|
+
let handle;
|
|
66
|
+
let contents;
|
|
67
|
+
try {
|
|
68
|
+
handle = await open(filePath, 'r');
|
|
69
|
+
const metadata = await handle.stat();
|
|
70
|
+
if (!metadata.isFile()) {
|
|
71
|
+
options.onDiagnostic?.(`Ignoring settings at ${filePath}: not a regular file.`);
|
|
72
|
+
return DEFAULT_SETTINGS;
|
|
73
|
+
}
|
|
74
|
+
if (metadata.size > MAX_SETTINGS_BYTES) {
|
|
75
|
+
options.onDiagnostic?.(`Ignoring settings at ${filePath}: file exceeds the size limit.`);
|
|
76
|
+
return DEFAULT_SETTINGS;
|
|
77
|
+
}
|
|
78
|
+
contents = await handle.readFile('utf8');
|
|
79
|
+
}
|
|
80
|
+
catch (error) {
|
|
81
|
+
const code = typeof error === 'object' && error !== null && 'code' in error
|
|
82
|
+
? String(error.code)
|
|
83
|
+
: undefined;
|
|
84
|
+
if (code !== 'ENOENT') {
|
|
85
|
+
options.onDiagnostic?.(`Ignoring settings at ${filePath}: ${code ?? 'could not be read'}.`);
|
|
86
|
+
}
|
|
87
|
+
return DEFAULT_SETTINGS;
|
|
88
|
+
}
|
|
89
|
+
finally {
|
|
90
|
+
await handle?.close();
|
|
91
|
+
}
|
|
92
|
+
let documentJson;
|
|
93
|
+
try {
|
|
94
|
+
documentJson = JSON.parse(contents);
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
options.onDiagnostic?.(`Ignoring settings at ${filePath}: file is not valid JSON.`);
|
|
98
|
+
return DEFAULT_SETTINGS;
|
|
99
|
+
}
|
|
100
|
+
const parsed = settingsSchema.safeParse(documentJson);
|
|
101
|
+
if (!parsed.success) {
|
|
102
|
+
options.onDiagnostic?.(`Ignoring settings at ${filePath}: file did not match the schema.`);
|
|
103
|
+
return DEFAULT_SETTINGS;
|
|
104
|
+
}
|
|
105
|
+
return normalizeSettings(parsed.data);
|
|
106
|
+
}
|
|
107
|
+
/**
|
|
108
|
+
* Writes settings atomically with `0600` permissions. The temporary file is
|
|
109
|
+
* created with the `wx` flag (`O_EXCL`), so the write fails rather than
|
|
110
|
+
* following or overwriting a pre-planted file or symlink at the temp path, and
|
|
111
|
+
* uses a random suffix to avoid predictable names. It is `fsync`ed and then
|
|
112
|
+
* renamed over the target, so a partial write can never replace a good file.
|
|
113
|
+
*/
|
|
114
|
+
export async function saveSettings(next, options = {}) {
|
|
115
|
+
const parsed = settingsSchema.safeParse(next);
|
|
116
|
+
if (!parsed.success) {
|
|
117
|
+
throw new AutoevalError('Refusing to write invalid Autoeval settings.', {
|
|
118
|
+
kind: 'validation',
|
|
119
|
+
code: 'SETTINGS_WRITE_FAILED',
|
|
120
|
+
cause: parsed.error,
|
|
121
|
+
});
|
|
122
|
+
}
|
|
123
|
+
const validated = normalizeSettings(parsed.data);
|
|
124
|
+
const filePath = options.path ?? settingsPath(options.env);
|
|
125
|
+
const directory = dirname(filePath);
|
|
126
|
+
const temporaryPath = `${filePath}.${randomBytes(12).toString('hex')}.tmp`;
|
|
127
|
+
const body = `${JSON.stringify(validated, null, 2)}\n`;
|
|
128
|
+
let createdTemporaryFile = false;
|
|
129
|
+
try {
|
|
130
|
+
await mkdir(directory, { recursive: true, mode: 0o700 });
|
|
131
|
+
// `wx` = O_CREAT | O_EXCL: never follow or overwrite an existing path.
|
|
132
|
+
const handle = await open(temporaryPath, 'wx', 0o600);
|
|
133
|
+
createdTemporaryFile = true;
|
|
134
|
+
try {
|
|
135
|
+
await handle.writeFile(body, 'utf8');
|
|
136
|
+
await handle.sync();
|
|
137
|
+
}
|
|
138
|
+
finally {
|
|
139
|
+
await handle.close();
|
|
140
|
+
}
|
|
141
|
+
await rename(temporaryPath, filePath);
|
|
142
|
+
createdTemporaryFile = false;
|
|
143
|
+
}
|
|
144
|
+
catch (error) {
|
|
145
|
+
if (createdTemporaryFile) {
|
|
146
|
+
await rm(temporaryPath, { force: true }).catch(() => undefined);
|
|
147
|
+
}
|
|
148
|
+
throw new AutoevalError('The Autoeval settings file could not be written.', {
|
|
149
|
+
kind: 'usage',
|
|
150
|
+
code: 'SETTINGS_WRITE_FAILED',
|
|
151
|
+
cause: error,
|
|
152
|
+
});
|
|
153
|
+
}
|
|
154
|
+
}
|
|
155
|
+
/** Removes the settings file. A missing file is treated as already cleared. */
|
|
156
|
+
export async function clearSettings(options = {}) {
|
|
157
|
+
const filePath = options.path ?? settingsPath(options.env);
|
|
158
|
+
try {
|
|
159
|
+
await rm(filePath, { force: true });
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
throw new AutoevalError('The Autoeval settings file could not be removed.', {
|
|
163
|
+
kind: 'usage',
|
|
164
|
+
code: 'SETTINGS_WRITE_FAILED',
|
|
165
|
+
cause: error,
|
|
166
|
+
});
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
//# sourceMappingURL=settings.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"settings.js","sourceRoot":"","sources":["../../src/settings/settings.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAC1C,OAAO,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,EAAE,MAAM,kBAAkB,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAE1C,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAExB,OAAO,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAkC5D,MAAM,gBAAgB,GAAqB,EAAE,OAAO,EAAE,CAAC,EAAE,CAAC;AAE1D,gFAAgF;AAChF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