@ranimontagna/agent-toolkit 0.2.2 → 0.3.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/CHANGELOG.md +6 -0
- package/README.md +21 -7
- package/dist/bin/agent-toolkit.js +9 -4
- package/dist/bin/agent-toolkit.js.map +1 -1
- package/dist/src/ariadne/args.d.ts +2 -0
- package/dist/src/ariadne/args.js +146 -0
- package/dist/src/ariadne/args.js.map +1 -0
- package/dist/src/ariadne/checks.d.ts +24 -0
- package/dist/src/ariadne/checks.js +74 -0
- package/dist/src/ariadne/checks.js.map +1 -0
- package/dist/src/ariadne/cli.d.ts +38 -0
- package/dist/src/ariadne/cli.js +206 -0
- package/dist/src/ariadne/cli.js.map +1 -0
- package/dist/src/ariadne/doctor.d.ts +16 -0
- package/dist/src/ariadne/doctor.js +207 -0
- package/dist/src/ariadne/doctor.js.map +1 -0
- package/dist/src/ariadne/git.d.ts +58 -0
- package/dist/src/ariadne/git.js +577 -0
- package/dist/src/ariadne/git.js.map +1 -0
- package/dist/src/ariadne/import.d.ts +2 -0
- package/dist/src/ariadne/import.js +93 -0
- package/dist/src/ariadne/import.js.map +1 -0
- package/dist/src/ariadne/init.d.ts +47 -0
- package/dist/src/ariadne/init.js +345 -0
- package/dist/src/ariadne/init.js.map +1 -0
- package/dist/src/ariadne/lock.d.ts +22 -0
- package/dist/src/ariadne/lock.js +478 -0
- package/dist/src/ariadne/lock.js.map +1 -0
- package/dist/src/ariadne/loop.d.ts +26 -0
- package/dist/src/ariadne/loop.js +1316 -0
- package/dist/src/ariadne/loop.js.map +1 -0
- package/dist/src/ariadne/ownership.d.ts +32 -0
- package/dist/src/ariadne/ownership.js +161 -0
- package/dist/src/ariadne/ownership.js.map +1 -0
- package/dist/src/ariadne/process.d.ts +27 -0
- package/dist/src/ariadne/process.js +302 -0
- package/dist/src/ariadne/process.js.map +1 -0
- package/dist/src/ariadne/prompt.d.ts +11 -0
- package/dist/src/ariadne/prompt.js +29 -0
- package/dist/src/ariadne/prompt.js.map +1 -0
- package/dist/src/ariadne/render.d.ts +7 -0
- package/dist/src/ariadne/render.js +72 -0
- package/dist/src/ariadne/render.js.map +1 -0
- package/dist/src/ariadne/result.d.ts +54 -0
- package/dist/src/ariadne/result.js +129 -0
- package/dist/src/ariadne/result.js.map +1 -0
- package/dist/src/ariadne/runtimes/antigravity.d.ts +2 -0
- package/dist/src/ariadne/runtimes/antigravity.js +17 -0
- package/dist/src/ariadne/runtimes/antigravity.js.map +1 -0
- package/dist/src/ariadne/runtimes/claude.d.ts +2 -0
- package/dist/src/ariadne/runtimes/claude.js +17 -0
- package/dist/src/ariadne/runtimes/claude.js.map +1 -0
- package/dist/src/ariadne/runtimes/codex.d.ts +2 -0
- package/dist/src/ariadne/runtimes/codex.js +24 -0
- package/dist/src/ariadne/runtimes/codex.js.map +1 -0
- package/dist/src/ariadne/runtimes/gemini.d.ts +2 -0
- package/dist/src/ariadne/runtimes/gemini.js +18 -0
- package/dist/src/ariadne/runtimes/gemini.js.map +1 -0
- package/dist/src/ariadne/runtimes/index.d.ts +4 -0
- package/dist/src/ariadne/runtimes/index.js +82 -0
- package/dist/src/ariadne/runtimes/index.js.map +1 -0
- package/dist/src/ariadne/runtimes/opencode.d.ts +2 -0
- package/dist/src/ariadne/runtimes/opencode.js +19 -0
- package/dist/src/ariadne/runtimes/opencode.js.map +1 -0
- package/dist/src/ariadne/runtimes/shared.d.ts +24 -0
- package/dist/src/ariadne/runtimes/shared.js +141 -0
- package/dist/src/ariadne/runtimes/shared.js.map +1 -0
- package/dist/src/ariadne/runtimes/types.d.ts +56 -0
- package/dist/src/ariadne/runtimes/types.js +3 -0
- package/dist/src/ariadne/runtimes/types.js.map +1 -0
- package/dist/src/ariadne/schema.d.ts +11 -0
- package/dist/src/ariadne/schema.js +214 -0
- package/dist/src/ariadne/schema.js.map +1 -0
- package/dist/src/ariadne/status.d.ts +72 -0
- package/dist/src/ariadne/status.js +280 -0
- package/dist/src/ariadne/status.js.map +1 -0
- package/dist/src/ariadne/store.d.ts +99 -0
- package/dist/src/ariadne/store.js +738 -0
- package/dist/src/ariadne/store.js.map +1 -0
- package/dist/src/ariadne/types.d.ts +128 -0
- package/dist/src/ariadne/types.js +5 -0
- package/dist/src/ariadne/types.js.map +1 -0
- package/dist/src/ariadne/usage.d.ts +1 -0
- package/dist/src/ariadne/usage.js +8 -0
- package/dist/src/ariadne/usage.js.map +1 -0
- package/dist/src/cli.d.ts +5 -0
- package/dist/src/cli.js +14 -0
- package/dist/src/cli.js.map +1 -0
- package/dist/src/skills-audit.d.ts +6 -0
- package/dist/src/skills-audit.js +36 -2
- package/dist/src/skills-audit.js.map +1 -1
- package/dist/src/tool-lock.d.ts +20 -0
- package/dist/src/tool-lock.js +26 -0
- package/dist/src/tool-lock.js.map +1 -1
- package/dist/src/usage.js +1 -0
- package/dist/src/usage.js.map +1 -1
- package/package.json +7 -3
- package/skills/workflow/ariadne/NOTICE.md +11 -0
- package/skills/workflow/ariadne/SKILL.md +96 -0
- package/skills/workflow/ariadne-prd/NOTICE.md +11 -0
- package/skills/workflow/ariadne-prd/SKILL.md +69 -0
- package/tools.lock.json +40 -21
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
const versionTokenPattern = /(?:^|[^0-9A-Za-z])v?(\d+(?:\.\d+){1,3}(?:[-+][0-9A-Za-z.-]+)?)(?=$|[^0-9A-Za-z])/;
|
|
2
|
+
export function parseVersionToken(output) {
|
|
3
|
+
return versionTokenPattern.exec(output)?.[1];
|
|
4
|
+
}
|
|
5
|
+
export function compareNumericVersions(left, right) {
|
|
6
|
+
const numeric = (value) => value
|
|
7
|
+
.split(/[+-]/, 1)[0]
|
|
8
|
+
?.split(".")
|
|
9
|
+
.map((part) => Number.parseInt(part, 10)) ?? [];
|
|
10
|
+
const leftParts = numeric(left);
|
|
11
|
+
const rightParts = numeric(right);
|
|
12
|
+
const length = Math.max(leftParts.length, rightParts.length);
|
|
13
|
+
for (let index = 0; index < length; index += 1) {
|
|
14
|
+
const difference = (leftParts[index] ?? 0) - (rightParts[index] ?? 0);
|
|
15
|
+
if (difference !== 0)
|
|
16
|
+
return Math.sign(difference);
|
|
17
|
+
}
|
|
18
|
+
return 0;
|
|
19
|
+
}
|
|
20
|
+
export function promptInstruction(relativePromptPath) {
|
|
21
|
+
return `Read ${relativePromptPath} and follow it exactly.`;
|
|
22
|
+
}
|
|
23
|
+
function probeFailureReason(fallback, stdout, stderr) {
|
|
24
|
+
return stderr.trim() || stdout.trim() || fallback;
|
|
25
|
+
}
|
|
26
|
+
function detectRuntime(definition, deps) {
|
|
27
|
+
const commandPath = deps.findCommand(definition.command);
|
|
28
|
+
if (!commandPath) {
|
|
29
|
+
return {
|
|
30
|
+
name: definition.name,
|
|
31
|
+
state: "unavailable",
|
|
32
|
+
reason: `${definition.command} was not found on PATH.`,
|
|
33
|
+
};
|
|
34
|
+
}
|
|
35
|
+
const versionResult = deps.capture(commandPath, ["--version"]);
|
|
36
|
+
const version = parseVersionToken(`${versionResult.stdout}\n${versionResult.stderr}`);
|
|
37
|
+
if (!versionResult.ok || !version) {
|
|
38
|
+
return {
|
|
39
|
+
name: definition.name,
|
|
40
|
+
state: "incompatible",
|
|
41
|
+
commandPath,
|
|
42
|
+
version,
|
|
43
|
+
reason: probeFailureReason(`Could not verify the ${definition.name} version.`, versionResult.stdout, versionResult.stderr),
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
const versionCompatible = definition.version.kind === "exact"
|
|
47
|
+
? version === definition.version.version
|
|
48
|
+
: compareNumericVersions(version, definition.version.version) >= 0;
|
|
49
|
+
if (!versionCompatible) {
|
|
50
|
+
const requirement = definition.version.kind === "exact"
|
|
51
|
+
? `exactly ${definition.version.version}`
|
|
52
|
+
: `at least ${definition.version.version}`;
|
|
53
|
+
return {
|
|
54
|
+
name: definition.name,
|
|
55
|
+
state: "incompatible",
|
|
56
|
+
commandPath,
|
|
57
|
+
version,
|
|
58
|
+
reason: `${definition.name} must be ${requirement}; found ${version}.`,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const helpResult = deps.capture(commandPath, definition.helpArgs);
|
|
62
|
+
const help = `${helpResult.stdout}\n${helpResult.stderr}`;
|
|
63
|
+
const missingFlags = definition.requiredHelp.filter((required) => !help.includes(required));
|
|
64
|
+
if (!helpResult.ok || missingFlags.length > 0) {
|
|
65
|
+
const reason = missingFlags.length > 0
|
|
66
|
+
? `Missing required headless flags: ${missingFlags.join(", ")}.`
|
|
67
|
+
: probeFailureReason(`Could not inspect ${definition.name} headless capabilities.`, helpResult.stdout, helpResult.stderr);
|
|
68
|
+
return {
|
|
69
|
+
name: definition.name,
|
|
70
|
+
state: "incompatible",
|
|
71
|
+
commandPath,
|
|
72
|
+
version,
|
|
73
|
+
reason,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
if (!definition.authArgs) {
|
|
77
|
+
return {
|
|
78
|
+
name: definition.name,
|
|
79
|
+
state: "unverified",
|
|
80
|
+
commandPath,
|
|
81
|
+
version,
|
|
82
|
+
reason: "No zero-credit local authentication probe is available.",
|
|
83
|
+
};
|
|
84
|
+
}
|
|
85
|
+
const authResult = deps.capture(commandPath, definition.authArgs);
|
|
86
|
+
if (!authResult.ok) {
|
|
87
|
+
return {
|
|
88
|
+
name: definition.name,
|
|
89
|
+
state: "unverified",
|
|
90
|
+
commandPath,
|
|
91
|
+
version,
|
|
92
|
+
reason: probeFailureReason("Local authentication readiness could not be confirmed.", authResult.stdout, authResult.stderr),
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
return {
|
|
96
|
+
name: definition.name,
|
|
97
|
+
state: "healthy",
|
|
98
|
+
commandPath,
|
|
99
|
+
version,
|
|
100
|
+
reason: "Executable, version, headless flags, and local auth are ready.",
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
export function interpretProcessResult(result) {
|
|
104
|
+
if (result.timedOut) {
|
|
105
|
+
return {
|
|
106
|
+
ok: false,
|
|
107
|
+
status: result.status,
|
|
108
|
+
reason: "Runtime process timed out.",
|
|
109
|
+
};
|
|
110
|
+
}
|
|
111
|
+
if (result.aborted) {
|
|
112
|
+
return {
|
|
113
|
+
ok: false,
|
|
114
|
+
status: result.status,
|
|
115
|
+
reason: "Runtime process was aborted.",
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
if (result.status !== 0) {
|
|
119
|
+
return {
|
|
120
|
+
ok: false,
|
|
121
|
+
status: result.status,
|
|
122
|
+
reason: `Runtime exited with status ${result.status ?? "unknown"}; inspect machine-local logs.`,
|
|
123
|
+
};
|
|
124
|
+
}
|
|
125
|
+
return { ok: true, status: result.status };
|
|
126
|
+
}
|
|
127
|
+
export function createRuntimeAdapter(definition, deps) {
|
|
128
|
+
return Object.freeze({
|
|
129
|
+
name: definition.name,
|
|
130
|
+
command: definition.command,
|
|
131
|
+
detect: () => detectRuntime(definition, deps),
|
|
132
|
+
buildInvocation: (context) => ({
|
|
133
|
+
command: deps.findCommand(definition.command) ?? definition.command,
|
|
134
|
+
args: definition.invocationArgs(context),
|
|
135
|
+
cwd: context.projectRoot,
|
|
136
|
+
env: { ...deps.baseEnv, ARIADNE_RUN_ID: context.runId },
|
|
137
|
+
}),
|
|
138
|
+
interpretResult: interpretProcessResult,
|
|
139
|
+
});
|
|
140
|
+
}
|
|
141
|
+
//# sourceMappingURL=shared.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared.js","sourceRoot":"","sources":["../../../../src/ariadne/runtimes/shared.ts"],"names":[],"mappings":"AAwBA,MAAM,mBAAmB,GACvB,kFAAkF,CAAC;AAErF,MAAM,UAAU,iBAAiB,CAAC,MAAc;IAC9C,OAAO,mBAAmB,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;AAC/C,CAAC;AAED,MAAM,UAAU,sBAAsB,CAAC,IAAY,EAAE,KAAa;IAChE,MAAM,OAAO,GAAG,CAAC,KAAa,EAAE,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AC;YAChE,OAAO,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,CAAC,IAAI,UAAU,CAAC,OAAO;YACnE,IAAI,EAAE,UAAU,CAAC,cAAc,CAAC,OAAO,CAAC;YACxC,GAAG,EAAE,OAAO,CAAC,WAAW;YACxB,GAAG,EAAE,EAAE,GAAG,IAAI,CAAC,OAAO,EAAE,cAAc,EAAE,OAAO,CAAC,KAAK,EAAE;SACxD,CAAC;QACF,eAAe,EAAE,sBAAsB;KACxC,CAAC,CAAC;AACL,CAAC"}
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import type { RunResult } from "../../system.js";
|
|
2
|
+
import type { AriadneRuntimeName, ProcessResult } from "../types.js";
|
|
3
|
+
export type RuntimeDetectionState = "unavailable" | "incompatible" | "unverified" | "healthy";
|
|
4
|
+
export type AgentInvocation = {
|
|
5
|
+
command: string;
|
|
6
|
+
args: string[];
|
|
7
|
+
cwd: string;
|
|
8
|
+
env: NodeJS.ProcessEnv;
|
|
9
|
+
};
|
|
10
|
+
export type RuntimeDetection = {
|
|
11
|
+
name: AriadneRuntimeName;
|
|
12
|
+
state: RuntimeDetectionState;
|
|
13
|
+
commandPath?: string;
|
|
14
|
+
version?: string;
|
|
15
|
+
reason: string;
|
|
16
|
+
};
|
|
17
|
+
export type IterationContext = {
|
|
18
|
+
runId: string;
|
|
19
|
+
projectRoot: string;
|
|
20
|
+
promptPath: string;
|
|
21
|
+
relativePromptPath: string;
|
|
22
|
+
};
|
|
23
|
+
export type AgentOutcome = {
|
|
24
|
+
ok: boolean;
|
|
25
|
+
status: number | null;
|
|
26
|
+
reason?: string;
|
|
27
|
+
};
|
|
28
|
+
export type RuntimeProbeDeps = {
|
|
29
|
+
findCommand: (command: string) => string | null;
|
|
30
|
+
capture: (command: string, args: string[]) => RunResult;
|
|
31
|
+
baseEnv: NodeJS.ProcessEnv;
|
|
32
|
+
};
|
|
33
|
+
export type RuntimeRegistry = Record<AriadneRuntimeName, AriadneRuntimeAdapter>;
|
|
34
|
+
export type RuntimeSelectionInput = {
|
|
35
|
+
explicit?: AriadneRuntimeName;
|
|
36
|
+
configured?: AriadneRuntimeName;
|
|
37
|
+
globalPreferred?: AriadneRuntimeName;
|
|
38
|
+
interactive: boolean;
|
|
39
|
+
choose?: (choices: RuntimeDetection[]) => Promise<AriadneRuntimeName>;
|
|
40
|
+
registry: RuntimeRegistry;
|
|
41
|
+
};
|
|
42
|
+
export type RuntimeSelection = {
|
|
43
|
+
name: AriadneRuntimeName;
|
|
44
|
+
adapter: AriadneRuntimeAdapter;
|
|
45
|
+
detection: RuntimeDetection;
|
|
46
|
+
source: "explicit" | "configured" | "automatic" | "global" | "interactive";
|
|
47
|
+
};
|
|
48
|
+
export declare class AriadneRuntimeError extends Error {
|
|
49
|
+
}
|
|
50
|
+
export interface AriadneRuntimeAdapter {
|
|
51
|
+
readonly name: AriadneRuntimeName;
|
|
52
|
+
readonly command: string;
|
|
53
|
+
detect(): RuntimeDetection;
|
|
54
|
+
buildInvocation(context: IterationContext): AgentInvocation;
|
|
55
|
+
interpretResult(result: ProcessResult): AgentOutcome;
|
|
56
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../../../src/ariadne/runtimes/types.ts"],"names":[],"mappings":"AA6DA,MAAM,OAAO,mBAAoB,SAAQ,KAAK;CAAG"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { AgentResult, ExpectedAgentResult } from "./result.js";
|
|
2
|
+
import type { AriadneConfig, AriadnePrd, StoryStatus } from "./types.js";
|
|
3
|
+
export declare class AriadneStateError extends Error {
|
|
4
|
+
readonly jsonPath: string;
|
|
5
|
+
constructor(jsonPath: string, message: string);
|
|
6
|
+
}
|
|
7
|
+
export declare function validatePrd(input: unknown): AriadnePrd;
|
|
8
|
+
export declare function validateConfig(input: unknown): AriadneConfig;
|
|
9
|
+
export declare function assertRunnableConfig(config: AriadneConfig): void;
|
|
10
|
+
export declare function assertStoryTransition(from: StoryStatus, to: StoryStatus): void;
|
|
11
|
+
export declare function validateAgentResult(input: unknown, expected: ExpectedAgentResult): AgentResult;
|
|
@@ -0,0 +1,214 @@
|
|
|
1
|
+
import { isRuntimeName } from "../state.js";
|
|
2
|
+
export class AriadneStateError extends Error {
|
|
3
|
+
jsonPath;
|
|
4
|
+
constructor(jsonPath, message) {
|
|
5
|
+
super(`${jsonPath}: ${message}`);
|
|
6
|
+
this.jsonPath = jsonPath;
|
|
7
|
+
this.name = "AriadneStateError";
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
function stateError(path, message) {
|
|
11
|
+
throw new AriadneStateError(path, message);
|
|
12
|
+
}
|
|
13
|
+
function recordAt(input, jsonPath) {
|
|
14
|
+
if (!input || typeof input !== "object" || Array.isArray(input)) {
|
|
15
|
+
stateError(jsonPath, "expected an object");
|
|
16
|
+
}
|
|
17
|
+
return input;
|
|
18
|
+
}
|
|
19
|
+
function assertOnlyKeys(input, allowedKeys, jsonPath) {
|
|
20
|
+
for (const key of Object.keys(input)) {
|
|
21
|
+
if (!allowedKeys.includes(key)) {
|
|
22
|
+
stateError(`${jsonPath}.${key}`, "is not allowed");
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
function stringAt(input, jsonPath) {
|
|
27
|
+
if (typeof input !== "string" || input.trim() === "") {
|
|
28
|
+
stateError(jsonPath, "expected a non-empty string");
|
|
29
|
+
}
|
|
30
|
+
return input;
|
|
31
|
+
}
|
|
32
|
+
function integerAt(input, jsonPath, minimum = 0) {
|
|
33
|
+
if (!Number.isSafeInteger(input) || input < minimum) {
|
|
34
|
+
stateError(jsonPath, `expected an integer greater than or equal to ${minimum}`);
|
|
35
|
+
}
|
|
36
|
+
return input;
|
|
37
|
+
}
|
|
38
|
+
function arrayAt(input, jsonPath) {
|
|
39
|
+
if (!Array.isArray(input))
|
|
40
|
+
stateError(jsonPath, "expected an array");
|
|
41
|
+
return input;
|
|
42
|
+
}
|
|
43
|
+
function schemaVersionAt(input, jsonPath) {
|
|
44
|
+
if (input !== 1)
|
|
45
|
+
stateError(jsonPath, "expected schema version 1");
|
|
46
|
+
return 1;
|
|
47
|
+
}
|
|
48
|
+
function statusAt(input, jsonPath) {
|
|
49
|
+
if (input === "pending" ||
|
|
50
|
+
input === "in_progress" ||
|
|
51
|
+
input === "completed" ||
|
|
52
|
+
input === "blocked") {
|
|
53
|
+
return input;
|
|
54
|
+
}
|
|
55
|
+
return stateError(jsonPath, "expected pending, in_progress, completed, or blocked");
|
|
56
|
+
}
|
|
57
|
+
function validateStory(input, jsonPath) {
|
|
58
|
+
const story = recordAt(input, jsonPath);
|
|
59
|
+
const acceptanceCriteria = arrayAt(story.acceptanceCriteria, `${jsonPath}.acceptanceCriteria`).map((criterion, index) => stringAt(criterion, `${jsonPath}.acceptanceCriteria[${index}]`));
|
|
60
|
+
return {
|
|
61
|
+
id: stringAt(story.id, `${jsonPath}.id`),
|
|
62
|
+
title: stringAt(story.title, `${jsonPath}.title`),
|
|
63
|
+
description: stringAt(story.description, `${jsonPath}.description`),
|
|
64
|
+
acceptanceCriteria,
|
|
65
|
+
priority: integerAt(story.priority, `${jsonPath}.priority`, 1),
|
|
66
|
+
status: statusAt(story.status, `${jsonPath}.status`),
|
|
67
|
+
attempts: integerAt(story.attempts, `${jsonPath}.attempts`),
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
export function validatePrd(input) {
|
|
71
|
+
const prd = recordAt(input, "$");
|
|
72
|
+
const userStories = arrayAt(prd.userStories, "$.userStories").map((story, index) => validateStory(story, `$.userStories[${index}]`));
|
|
73
|
+
const ids = new Set();
|
|
74
|
+
for (let index = 0; index < userStories.length; index += 1) {
|
|
75
|
+
const id = userStories[index]?.id;
|
|
76
|
+
if (!id)
|
|
77
|
+
continue;
|
|
78
|
+
if (ids.has(id))
|
|
79
|
+
stateError(`$.userStories[${index}].id`, `duplicate story id: ${id}`);
|
|
80
|
+
ids.add(id);
|
|
81
|
+
}
|
|
82
|
+
return {
|
|
83
|
+
schemaVersion: schemaVersionAt(prd.schemaVersion, "$.schemaVersion"),
|
|
84
|
+
project: stringAt(prd.project, "$.project"),
|
|
85
|
+
branchName: stringAt(prd.branchName, "$.branchName"),
|
|
86
|
+
description: stringAt(prd.description, "$.description"),
|
|
87
|
+
userStories,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
export function validateConfig(input) {
|
|
91
|
+
const config = recordAt(input, "$");
|
|
92
|
+
const qualityChecks = arrayAt(config.qualityChecks, "$.qualityChecks").map((check, index) => stringAt(check, `$.qualityChecks[${index}]`));
|
|
93
|
+
const runtime = config.runtime;
|
|
94
|
+
if (runtime !== undefined &&
|
|
95
|
+
(typeof runtime !== "string" || !isRuntimeName(runtime))) {
|
|
96
|
+
stateError("$.runtime", "expected a supported runtime");
|
|
97
|
+
}
|
|
98
|
+
const maxAttemptsPerStory = config.maxAttemptsPerStory === undefined
|
|
99
|
+
? 3
|
|
100
|
+
: integerAt(config.maxAttemptsPerStory, "$.maxAttemptsPerStory", 1);
|
|
101
|
+
return {
|
|
102
|
+
schemaVersion: schemaVersionAt(config.schemaVersion, "$.schemaVersion"),
|
|
103
|
+
...(runtime === undefined ? {} : { runtime }),
|
|
104
|
+
qualityChecks,
|
|
105
|
+
maxAttemptsPerStory,
|
|
106
|
+
};
|
|
107
|
+
}
|
|
108
|
+
export function assertRunnableConfig(config) {
|
|
109
|
+
if (config.qualityChecks.length === 0) {
|
|
110
|
+
stateError("$.qualityChecks", "at least one quality check is required for a run");
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const transitions = {
|
|
114
|
+
pending: ["in_progress"],
|
|
115
|
+
in_progress: ["completed", "blocked", "in_progress"],
|
|
116
|
+
completed: [],
|
|
117
|
+
blocked: [],
|
|
118
|
+
};
|
|
119
|
+
export function assertStoryTransition(from, to) {
|
|
120
|
+
if (!transitions[from].includes(to)) {
|
|
121
|
+
stateError("$.userStories[].status", `invalid story transition from ${from} to ${to}`);
|
|
122
|
+
}
|
|
123
|
+
}
|
|
124
|
+
function booleanAt(input, jsonPath) {
|
|
125
|
+
if (typeof input !== "boolean")
|
|
126
|
+
stateError(jsonPath, "expected a boolean");
|
|
127
|
+
return input;
|
|
128
|
+
}
|
|
129
|
+
function safeRelativePathAt(input, jsonPath) {
|
|
130
|
+
const value = stringAt(input, jsonPath);
|
|
131
|
+
if (value.includes("\0") ||
|
|
132
|
+
value.startsWith("/") ||
|
|
133
|
+
value.startsWith("\\") ||
|
|
134
|
+
/^[A-Za-z]:[\\/]/.test(value) ||
|
|
135
|
+
value
|
|
136
|
+
.split(/[\\/]+/)
|
|
137
|
+
.some((part) => part === "" || part === "." || part === "..")) {
|
|
138
|
+
stateError(jsonPath, "expected a safe relative path");
|
|
139
|
+
}
|
|
140
|
+
return value;
|
|
141
|
+
}
|
|
142
|
+
function validateAgentCriterion(input, jsonPath) {
|
|
143
|
+
const criterion = recordAt(input, jsonPath);
|
|
144
|
+
assertOnlyKeys(criterion, ["criterion", "passed", "evidence"], jsonPath);
|
|
145
|
+
return {
|
|
146
|
+
criterion: stringAt(criterion.criterion, `${jsonPath}.criterion`),
|
|
147
|
+
passed: booleanAt(criterion.passed, `${jsonPath}.passed`),
|
|
148
|
+
evidence: stringAt(criterion.evidence, `${jsonPath}.evidence`),
|
|
149
|
+
};
|
|
150
|
+
}
|
|
151
|
+
export function validateAgentResult(input, expected) {
|
|
152
|
+
const result = recordAt(input, "$");
|
|
153
|
+
assertOnlyKeys(result, [
|
|
154
|
+
"schemaVersion",
|
|
155
|
+
"runId",
|
|
156
|
+
"storyId",
|
|
157
|
+
"outcome",
|
|
158
|
+
"criteria",
|
|
159
|
+
"summary",
|
|
160
|
+
"filesChanged",
|
|
161
|
+
"checksAttempted",
|
|
162
|
+
"learnings",
|
|
163
|
+
"failureReason",
|
|
164
|
+
], "$");
|
|
165
|
+
const criteria = arrayAt(result.criteria, "$.criteria").map((criterion, index) => validateAgentCriterion(criterion, `$.criteria[${index}]`)), filesChanged = arrayAt(result.filesChanged, "$.filesChanged").map((file, index) => safeRelativePathAt(file, `$.filesChanged[${index}]`)), checksAttempted = arrayAt(result.checksAttempted, "$.checksAttempted").map((check, index) => stringAt(check, `$.checksAttempted[${index}]`)), learnings = arrayAt(result.learnings, "$.learnings").map((learning, index) => stringAt(learning, `$.learnings[${index}]`));
|
|
166
|
+
const outcome = result.outcome;
|
|
167
|
+
if (outcome !== "completed" && outcome !== "failed") {
|
|
168
|
+
stateError("$.outcome", "expected completed or failed");
|
|
169
|
+
}
|
|
170
|
+
const runId = stringAt(result.runId, "$.runId");
|
|
171
|
+
if (runId !== expected.runId)
|
|
172
|
+
stateError("$.runId", "does not match run");
|
|
173
|
+
const storyId = stringAt(result.storyId, "$.storyId");
|
|
174
|
+
if (storyId !== expected.storyId)
|
|
175
|
+
stateError("$.storyId", "does not match story");
|
|
176
|
+
const criteriaByName = new Map();
|
|
177
|
+
for (const [index, criterion] of criteria.entries()) {
|
|
178
|
+
if (criteriaByName.has(criterion.criterion)) {
|
|
179
|
+
stateError(`$.criteria[${index}].criterion`, "duplicate criterion");
|
|
180
|
+
}
|
|
181
|
+
criteriaByName.set(criterion.criterion, criterion);
|
|
182
|
+
}
|
|
183
|
+
for (const criterion of expected.acceptanceCriteria) {
|
|
184
|
+
if (!criteriaByName.has(criterion)) {
|
|
185
|
+
stateError("$.criteria", `missing criterion: ${criterion}`);
|
|
186
|
+
}
|
|
187
|
+
}
|
|
188
|
+
if (criteriaByName.size !== expected.acceptanceCriteria.length) {
|
|
189
|
+
stateError("$.criteria", "contains an unexpected criterion");
|
|
190
|
+
}
|
|
191
|
+
if (outcome === "completed" &&
|
|
192
|
+
criteria.some((criterion) => !criterion.passed)) {
|
|
193
|
+
stateError("$.criteria", "completed results require passing criteria");
|
|
194
|
+
}
|
|
195
|
+
const failureReason = result.failureReason === undefined
|
|
196
|
+
? undefined
|
|
197
|
+
: stringAt(result.failureReason, "$.failureReason");
|
|
198
|
+
if (outcome === "failed" && failureReason === undefined) {
|
|
199
|
+
stateError("$.failureReason", "is required for failed results");
|
|
200
|
+
}
|
|
201
|
+
return {
|
|
202
|
+
schemaVersion: schemaVersionAt(result.schemaVersion, "$.schemaVersion"),
|
|
203
|
+
runId,
|
|
204
|
+
storyId,
|
|
205
|
+
outcome,
|
|
206
|
+
criteria,
|
|
207
|
+
summary: stringAt(result.summary, "$.summary"),
|
|
208
|
+
filesChanged,
|
|
209
|
+
checksAttempted,
|
|
210
|
+
learnings,
|
|
211
|
+
...(failureReason === undefined ? {} : { failureReason }),
|
|
212
|
+
};
|
|
213
|
+
}
|
|
214
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../../src/ariadne/schema.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,MAAM,aAAa,CAAC;AAa5C,MAAM,OAAO,iBAAkB,SAAQ,KAAK;IAExB;IADlB,YACkB,QAAgB,EAChC,OAAe;QAEf,KAAK,CAAC,GAAG,QAAQ,KAAK,OAAO,EAAE,CAAC,CAAC;QAHjB,aAAQ,GAAR,QAAQ,CAAQ;QAIhC,IAAI,CAAC,IAAI,GAAG,mBAAmB,CAAC;IAClC,CAAC;CACF;AAED,SAAS,UAAU,CAAC,IAAY,EAAE,OAAe;IAC/C,MAAM,IAAI,iBAAiB,CAAC,IAAI,EAAE,OAAO,CAAC,CAAC;AAC7C,CAAC;AAED,SAAS,QAAQ,CAAC,KAAc,EAAE,QAAgB;IAChD,IAAI,CAAC,KAAK,IAAI,OAAO,KAAK,KAAK,QAAQ,IAAI,KAAK,CAAC,OAAO,CAAC,KAAK,CAAC,EAAE,CAAC;QAChE,UAAU,CAAC,QAAQ,EAAE,oBAAoB,CAAC,CAAC;IAC7C,CAAC;IACD,OAAO,KAAgC,CAAC;AAC1C,CAAC;AAED,SAAS,cAAc,CACrB,KAA8B,EAC9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AAK,SAAS;QAChC,CAAC,CAAC,SAAS;QACX,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC,CAAC;IACxD,IAAI,OAAO,KAAK,QAAQ,IAAI,aAAa,KAAK,SAAS,EAAE,CAAC;QACxD,UAAU,CAAC,iBAAiB,EAAE,gCAAgC,CAAC,CAAC;IAClE,CAAC;IAED,OAAO;QACL,aAAa,EAAE,eAAe,CAAC,MAAM,CAAC,aAAa,EAAE,iBAAiB,CAAC;QACvE,KAAK;QACL,OAAO;QACP,OAAO;QACP,QAAQ;QACR,OAAO,EAAE,QAAQ,CAAC,MAAM,CAAC,OAAO,EAAE,WAAW,CAAC;QAC9C,YAAY;QACZ,eAAe;QACf,SAAS;QACT,GAAG,CAAC,aAAa,KAAK,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,EAAE,aAAa,EAAE,CAAC;KAC1D,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { AriadneGit } from "./git.js";
|
|
2
|
+
import type { RuntimeDetectionState, RuntimeRegistry } from "./runtimes/types.js";
|
|
3
|
+
import { AriadneStore } from "./store.js";
|
|
4
|
+
import type { AriadneConfig, AriadneOwnershipViolation, AriadnePrd, AriadneRuntimeName } from "./types.js";
|
|
5
|
+
export { formatAriadneStatus } from "./render.js";
|
|
6
|
+
export type AriadneStoryCounts = {
|
|
7
|
+
pending: number;
|
|
8
|
+
inProgress: number;
|
|
9
|
+
completed: number;
|
|
10
|
+
blocked: number;
|
|
11
|
+
};
|
|
12
|
+
export type AriadneStatusReport = {
|
|
13
|
+
schemaVersion: 1;
|
|
14
|
+
command: "status";
|
|
15
|
+
project: string;
|
|
16
|
+
branch: {
|
|
17
|
+
configured: string;
|
|
18
|
+
current: string;
|
|
19
|
+
};
|
|
20
|
+
runtime?: {
|
|
21
|
+
name: AriadneRuntimeName;
|
|
22
|
+
state: RuntimeDetectionState;
|
|
23
|
+
version?: string;
|
|
24
|
+
};
|
|
25
|
+
stories: AriadneStoryCounts;
|
|
26
|
+
activeStory?: {
|
|
27
|
+
id: string;
|
|
28
|
+
title: string;
|
|
29
|
+
attempts: number;
|
|
30
|
+
};
|
|
31
|
+
blockedStory?: {
|
|
32
|
+
id: string;
|
|
33
|
+
title: string;
|
|
34
|
+
attempts: number;
|
|
35
|
+
};
|
|
36
|
+
ownershipViolation?: AriadneOwnershipViolation;
|
|
37
|
+
lastRun?: {
|
|
38
|
+
id: string;
|
|
39
|
+
outcome: string;
|
|
40
|
+
durationMs: number;
|
|
41
|
+
initialHead?: string;
|
|
42
|
+
finalHead?: string;
|
|
43
|
+
};
|
|
44
|
+
consecutiveFailures: number;
|
|
45
|
+
dirty: boolean;
|
|
46
|
+
lock: {
|
|
47
|
+
state: "absent" | "live" | "stale";
|
|
48
|
+
pid?: number;
|
|
49
|
+
runId?: string;
|
|
50
|
+
};
|
|
51
|
+
paths: {
|
|
52
|
+
progress: string;
|
|
53
|
+
runs: string;
|
|
54
|
+
};
|
|
55
|
+
};
|
|
56
|
+
export type AriadneStatusInput = {
|
|
57
|
+
projectRoot: string;
|
|
58
|
+
registry?: RuntimeRegistry;
|
|
59
|
+
isProcessAlive?: (pid: number) => boolean;
|
|
60
|
+
store?: AriadneStore;
|
|
61
|
+
git?: AriadneGit;
|
|
62
|
+
state?: {
|
|
63
|
+
prd: AriadnePrd;
|
|
64
|
+
config: AriadneConfig;
|
|
65
|
+
};
|
|
66
|
+
lock?: AriadneStatusReport["lock"];
|
|
67
|
+
ownershipViolation?: AriadneOwnershipViolation | null;
|
|
68
|
+
};
|
|
69
|
+
export declare function createAriadneGit(projectRoot: string): AriadneGit;
|
|
70
|
+
export declare function inspectAriadneLock(lockPath: string, isProcessAlive?: (pid: number) => boolean): AriadneStatusReport["lock"];
|
|
71
|
+
export declare function inspectLastAriadneRun(runsPath: string): AriadneStatusReport["lastRun"];
|
|
72
|
+
export declare function buildAriadneStatus(input: AriadneStatusInput): AriadneStatusReport;
|