@overshift/sfs 1.1.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/README.md +215 -0
- package/dist/cli/coverage-output.d.ts +3 -0
- package/dist/cli/coverage-output.d.ts.map +1 -0
- package/dist/cli/coverage-output.js +74 -0
- package/dist/cli/coverage-output.js.map +1 -0
- package/dist/cli/coverage-types.d.ts +24 -0
- package/dist/cli/coverage-types.d.ts.map +1 -0
- package/dist/cli/coverage-types.js +2 -0
- package/dist/cli/coverage-types.js.map +1 -0
- package/dist/cli/coverage.d.ts +3 -0
- package/dist/cli/coverage.d.ts.map +1 -0
- package/dist/cli/coverage.js +69 -0
- package/dist/cli/coverage.js.map +1 -0
- package/dist/cli/init-templates.d.ts +5 -0
- package/dist/cli/init-templates.d.ts.map +1 -0
- package/dist/cli/init-templates.js +108 -0
- package/dist/cli/init-templates.js.map +1 -0
- package/dist/cli/init.d.ts +7 -0
- package/dist/cli/init.d.ts.map +1 -0
- package/dist/cli/init.js +170 -0
- package/dist/cli/init.js.map +1 -0
- package/dist/cli/run.d.ts +3 -0
- package/dist/cli/run.d.ts.map +1 -0
- package/dist/cli/run.js +58 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/story-extractor.d.ts +7 -0
- package/dist/cli/story-extractor.d.ts.map +1 -0
- package/dist/cli/story-extractor.js +130 -0
- package/dist/cli/story-extractor.js.map +1 -0
- package/dist/cli/validate.d.ts +2 -0
- package/dist/cli/validate.d.ts.map +1 -0
- package/dist/cli/validate.js +39 -0
- package/dist/cli/validate.js.map +1 -0
- package/dist/executor/assertion-executor.d.ts +7 -0
- package/dist/executor/assertion-executor.d.ts.map +1 -0
- package/dist/executor/assertion-executor.js +206 -0
- package/dist/executor/assertion-executor.js.map +1 -0
- package/dist/executor/config-loader.d.ts +5 -0
- package/dist/executor/config-loader.d.ts.map +1 -0
- package/dist/executor/config-loader.js +48 -0
- package/dist/executor/config-loader.js.map +1 -0
- package/dist/executor/executor-types.d.ts +64 -0
- package/dist/executor/executor-types.d.ts.map +1 -0
- package/dist/executor/executor-types.js +6 -0
- package/dist/executor/executor-types.js.map +1 -0
- package/dist/executor/retry-handler.d.ts +7 -0
- package/dist/executor/retry-handler.d.ts.map +1 -0
- package/dist/executor/retry-handler.js +32 -0
- package/dist/executor/retry-handler.js.map +1 -0
- package/dist/executor/run-context.d.ts +27 -0
- package/dist/executor/run-context.d.ts.map +1 -0
- package/dist/executor/run-context.js +52 -0
- package/dist/executor/run-context.js.map +1 -0
- package/dist/executor/run-engine.d.ts +9 -0
- package/dist/executor/run-engine.d.ts.map +1 -0
- package/dist/executor/run-engine.js +140 -0
- package/dist/executor/run-engine.js.map +1 -0
- package/dist/executor/session-manager.d.ts +16 -0
- package/dist/executor/session-manager.d.ts.map +1 -0
- package/dist/executor/session-manager.js +103 -0
- package/dist/executor/session-manager.js.map +1 -0
- package/dist/executor/shell-executor.d.ts +12 -0
- package/dist/executor/shell-executor.d.ts.map +1 -0
- package/dist/executor/shell-executor.js +66 -0
- package/dist/executor/shell-executor.js.map +1 -0
- package/dist/executor/step-executor.d.ts +6 -0
- package/dist/executor/step-executor.d.ts.map +1 -0
- package/dist/executor/step-executor.js +73 -0
- package/dist/executor/step-executor.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +37 -0
- package/dist/index.js.map +1 -0
- package/dist/parser/assertion-parser.d.ts +3 -0
- package/dist/parser/assertion-parser.d.ts.map +1 -0
- package/dist/parser/assertion-parser.js +92 -0
- package/dist/parser/assertion-parser.js.map +1 -0
- package/dist/parser/command-parser.d.ts +3 -0
- package/dist/parser/command-parser.d.ts.map +1 -0
- package/dist/parser/command-parser.js +252 -0
- package/dist/parser/command-parser.js.map +1 -0
- package/dist/parser/config-parser.d.ts +16 -0
- package/dist/parser/config-parser.d.ts.map +1 -0
- package/dist/parser/config-parser.js +217 -0
- package/dist/parser/config-parser.js.map +1 -0
- package/dist/parser/sfs-parser.d.ts +3 -0
- package/dist/parser/sfs-parser.d.ts.map +1 -0
- package/dist/parser/sfs-parser.js +184 -0
- package/dist/parser/sfs-parser.js.map +1 -0
- package/dist/parser/step-parser.d.ts +3 -0
- package/dist/parser/step-parser.d.ts.map +1 -0
- package/dist/parser/step-parser.js +72 -0
- package/dist/parser/step-parser.js.map +1 -0
- package/dist/parser/types.d.ts +115 -0
- package/dist/parser/types.d.ts.map +1 -0
- package/dist/parser/types.js +3 -0
- package/dist/parser/types.js.map +1 -0
- package/dist/utils/mcp-detector.d.ts +9 -0
- package/dist/utils/mcp-detector.d.ts.map +1 -0
- package/dist/utils/mcp-detector.js +62 -0
- package/dist/utils/mcp-detector.js.map +1 -0
- package/package.json +72 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"run-engine.js","sourceRoot":"","sources":["../../src/executor/run-engine.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAC;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,MAAM,CAAC;AAChC,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AAEvD,OAAO,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC3D,OAAO,EAAE,mBAAmB,EAAE,MAAM,qBAAqB,CAAC;AAC1D,OAAO,EAAE,uBAAuB,EAAE,MAAM,yBAAyB,CAAC;AAClE,OAAO,EAAE,gBAAgB,EAAE,MAAM,kBAAkB,CAAC;AAEpD,OAAO,EAAE,oBAAoB,EAAE,MAAM,sBAAsB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,MAAM,oBAAoB,CAAC;AACnD,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAO9D,MAAM,UAAU,eAAe;IAC7B,OAAO;QACL,KAAK,CAAC,GAAG,CAAC,KAAe,EAAE,OAAmB;YAC5C,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EA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SfsAssertion, SfsConfig } from "../parser/types.js";
|
|
2
|
+
import type { HookResult } from "./executor-types.js";
|
|
3
|
+
import type { ShellExecutor } from "./shell-executor.js";
|
|
4
|
+
import type { AssertionExecutor } from "./assertion-executor.js";
|
|
5
|
+
import type { RunContext } from "./run-context.js";
|
|
6
|
+
interface SessionManager {
|
|
7
|
+
runBeforeSession(): Promise<HookResult>;
|
|
8
|
+
runAfterSession(): Promise<HookResult>;
|
|
9
|
+
runBeforeEach(storyId: string): Promise<HookResult>;
|
|
10
|
+
runAfterEach(storyId: string, passed: boolean): Promise<HookResult>;
|
|
11
|
+
runBeforeThis(assertions: SfsAssertion[], commands: SfsCommand[]): Promise<HookResult>;
|
|
12
|
+
runAfterThis(commands: SfsCommand[], passed: boolean): Promise<HookResult>;
|
|
13
|
+
}
|
|
14
|
+
export declare function createSessionManager(config: SfsConfig, context: RunContext, shell: ShellExecutor, assertionExecutor: AssertionExecutor): SessionManager;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=session-manager.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-manager.d.ts","sourceRoot":"","sources":["../../src/executor/session-manager.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,YAAY,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC9E,OAAO,KAAK,EAAc,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAClE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACzD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,yBAAyB,CAAC;AACjE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAInD,UAAU,cAAc;IACtB,gBAAgB,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACxC,eAAe,IAAI,OAAO,CAAC,UAAU,CAAC,CAAC;IACvC,aAAa,CAAC,OAAO,EAAE,MAAM,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpD,YAAY,CAAC,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;IACpE,aAAa,CACX,UAAU,EAAE,YAAY,EAAE,EAC1B,QAAQ,EAAE,UAAU,EAAE,GACrB,OAAO,CAAC,UAAU,CAAC,CAAC;IACvB,YAAY,CAAC,QAAQ,EAAE,UAAU,EAAE,EAAE,MAAM,EAAE,OAAO,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CAC5E;AAED,wBAAgB,oBAAoB,CAClC,MAAM,EAAE,SAAS,EACjB,OAAO,EAAE,UAAU,EACnB,KAAK,EAAE,aAAa,EACpB,iBAAiB,EAAE,iBAAiB,GACnC,cAAc,CAsEhB"}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
import { getContextVariables } from "./run-context.js";
|
|
2
|
+
import { substituteCommandVariables } from "./shell-executor.js";
|
|
3
|
+
export function createSessionManager(config, context, shell, assertionExecutor) {
|
|
4
|
+
return {
|
|
5
|
+
async runBeforeSession() {
|
|
6
|
+
return executeHook("beforeSession", config.beforeSession, context, shell);
|
|
7
|
+
},
|
|
8
|
+
async runAfterSession() {
|
|
9
|
+
return executeHook("afterSession", config.afterSession, context, shell);
|
|
10
|
+
},
|
|
11
|
+
async runBeforeEach(storyId) {
|
|
12
|
+
context.currentFile = storyId;
|
|
13
|
+
return executeHook("beforeEach", config.beforeEach, context, shell);
|
|
14
|
+
},
|
|
15
|
+
async runAfterEach(_storyId, _passed) {
|
|
16
|
+
return executeHook("afterEach", config.afterEach, context, shell);
|
|
17
|
+
},
|
|
18
|
+
async runBeforeThis(assertions, commands) {
|
|
19
|
+
const commandResults = [];
|
|
20
|
+
const variables = getContextVariables(context);
|
|
21
|
+
for (const assertion of assertions) {
|
|
22
|
+
const start = Date.now();
|
|
23
|
+
const result = await assertionExecutor.execute(assertion, variables, context.retryConfig);
|
|
24
|
+
commandResults.push({
|
|
25
|
+
success: result.passed,
|
|
26
|
+
output: result.message,
|
|
27
|
+
error: result.passed ? undefined : result.message,
|
|
28
|
+
duration: Date.now() - start,
|
|
29
|
+
});
|
|
30
|
+
if (!result.passed) {
|
|
31
|
+
return {
|
|
32
|
+
hook: "BEFORE THIS",
|
|
33
|
+
success: false,
|
|
34
|
+
commandResults,
|
|
35
|
+
error: `Assertion failed: ${result.message}`,
|
|
36
|
+
};
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
for (const cmd of commands) {
|
|
40
|
+
const stepResult = executeShellCommand(cmd, context, shell);
|
|
41
|
+
commandResults.push(stepResult);
|
|
42
|
+
if (!stepResult.success) {
|
|
43
|
+
return {
|
|
44
|
+
hook: "BEFORE THIS",
|
|
45
|
+
success: false,
|
|
46
|
+
commandResults,
|
|
47
|
+
error: `Command failed: ${cmd.raw}`,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
return { hook: "BEFORE THIS", success: true, commandResults };
|
|
52
|
+
},
|
|
53
|
+
async runAfterThis(commands, _passed) {
|
|
54
|
+
return executeHook("AFTER THIS", commands, context, shell);
|
|
55
|
+
},
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
async function executeHook(hookName, commands, context, shell) {
|
|
59
|
+
const commandResults = [];
|
|
60
|
+
for (const cmd of commands) {
|
|
61
|
+
const stepResult = executeShellCommand(cmd, context, shell);
|
|
62
|
+
commandResults.push(stepResult);
|
|
63
|
+
if (!stepResult.success) {
|
|
64
|
+
return {
|
|
65
|
+
hook: hookName,
|
|
66
|
+
success: false,
|
|
67
|
+
commandResults,
|
|
68
|
+
error: `Hook ${hookName} failed: ${cmd.raw}`,
|
|
69
|
+
};
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
return { hook: hookName, success: true, commandResults };
|
|
73
|
+
}
|
|
74
|
+
function executeShellCommand(cmd, context, shell) {
|
|
75
|
+
const start = Date.now();
|
|
76
|
+
const variables = getContextVariables(context);
|
|
77
|
+
let command = cmd.value ?? cmd.raw;
|
|
78
|
+
if (command.startsWith("SHELL "))
|
|
79
|
+
command = command.slice(6);
|
|
80
|
+
// Skip non-shell commands
|
|
81
|
+
if (command.startsWith("ASSERT ") ||
|
|
82
|
+
command.startsWith("CLEAR ") ||
|
|
83
|
+
command.startsWith("WAIT ") ||
|
|
84
|
+
command.startsWith("NAVIGATE ")) {
|
|
85
|
+
return {
|
|
86
|
+
success: true,
|
|
87
|
+
output: `Skipped non-shell command: ${cmd.raw}`,
|
|
88
|
+
duration: Date.now() - start,
|
|
89
|
+
};
|
|
90
|
+
}
|
|
91
|
+
if (command.startsWith("#")) {
|
|
92
|
+
return { success: true, output: `Comment: ${command}`, duration: 0 };
|
|
93
|
+
}
|
|
94
|
+
command = substituteCommandVariables(command, variables);
|
|
95
|
+
const result = shell.execute(command);
|
|
96
|
+
return {
|
|
97
|
+
success: result.success,
|
|
98
|
+
output: result.stdout,
|
|
99
|
+
error: result.success ? undefined : result.stderr,
|
|
100
|
+
duration: Date.now() - start,
|
|
101
|
+
};
|
|
102
|
+
}
|
|
103
|
+
//# sourceMappingURL=session-manager.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"session-manager.js","sourceRoot":"","sources":["../../src/executor/session-manager.ts"],"names":[],"mappings":"AAKA,OAAO,EAAE,mBAAmB,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,0BAA0B,EAAE,MAAM,qBAAqB,CAAC;AAcjE,MAAM,UAAU,oBAAoB,CAClC,MAAiB,EACjB,OAAmB,EACnB,KAAoB,EACpB,iBAAoC;IAEpC,OAAO;QACL,KAAK,CAAC,gBAAgB;YACpB,OAAO,WAAW,CAAC,eAAe,EAAE,MAAM,CAAC,aAAa,EAAE,OAAO,EAAE,KAAK,CAAC,CAAC;QAC5E,CAAC;QACD,KAAK,CAAC,eAAe;YACnB,OAAO,WAAW,CAAC,cAAc,EAAE,MAAM,CAAC,YAAY,EAAE,OAAO,EAAE,K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;QACjD,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;KAC7B,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { ShellResult } from "./executor-types.js";
|
|
2
|
+
export interface ShellExecutor {
|
|
3
|
+
execute(command: string): ShellResult;
|
|
4
|
+
executeWithTimeout(command: string, timeoutMs?: number): ShellResult;
|
|
5
|
+
}
|
|
6
|
+
export declare function createShellExecutor(): ShellExecutor;
|
|
7
|
+
/**
|
|
8
|
+
* Substitute variables in a command string.
|
|
9
|
+
* Supports {{ENV_VAR}} and $variable patterns.
|
|
10
|
+
*/
|
|
11
|
+
export declare function substituteCommandVariables(command: string, variables?: Record<string, string>): string;
|
|
12
|
+
//# sourceMappingURL=shell-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-executor.d.ts","sourceRoot":"","sources":["../../src/executor/shell-executor.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,qBAAqB,CAAC;AAEvD,MAAM,WAAW,aAAa;IAC5B,OAAO,CAAC,OAAO,EAAE,MAAM,GAAG,WAAW,CAAC;IACtC,kBAAkB,CAAC,OAAO,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,MAAM,GAAG,WAAW,CAAC;CACtE;AAID,wBAAgB,mBAAmB,IAAI,aAAa,CAanD;AAiDD;;;GAGG;AACH,wBAAgB,0BAA0B,CACxC,OAAO,EAAE,MAAM,EACf,SAAS,GAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAM,GACrC,MAAM,CAaR"}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { execSync } from "child_process";
|
|
2
|
+
const DEFAULT_TIMEOUT = 30000;
|
|
3
|
+
export function createShellExecutor() {
|
|
4
|
+
return {
|
|
5
|
+
execute(command) {
|
|
6
|
+
return executeCommand(command, DEFAULT_TIMEOUT);
|
|
7
|
+
},
|
|
8
|
+
executeWithTimeout(command, timeoutMs = DEFAULT_TIMEOUT) {
|
|
9
|
+
return executeCommand(command, timeoutMs);
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
}
|
|
13
|
+
function executeCommand(command, timeoutMs) {
|
|
14
|
+
const start = Date.now();
|
|
15
|
+
try {
|
|
16
|
+
const stdout = execSync(command, {
|
|
17
|
+
timeout: timeoutMs,
|
|
18
|
+
encoding: "utf-8",
|
|
19
|
+
stdio: ["pipe", "pipe", "pipe"],
|
|
20
|
+
});
|
|
21
|
+
return {
|
|
22
|
+
success: true,
|
|
23
|
+
exitCode: 0,
|
|
24
|
+
stdout: stdout ?? "",
|
|
25
|
+
stderr: "",
|
|
26
|
+
duration: Date.now() - start,
|
|
27
|
+
};
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
const duration = Date.now() - start;
|
|
31
|
+
const error = err;
|
|
32
|
+
if (error.killed || error.signal === "SIGTERM") {
|
|
33
|
+
return {
|
|
34
|
+
success: false,
|
|
35
|
+
exitCode: 1,
|
|
36
|
+
stdout: String(error.stdout ?? ""),
|
|
37
|
+
stderr: "Command timed out",
|
|
38
|
+
duration,
|
|
39
|
+
};
|
|
40
|
+
}
|
|
41
|
+
return {
|
|
42
|
+
success: false,
|
|
43
|
+
exitCode: error.status ?? 1,
|
|
44
|
+
stdout: String(error.stdout ?? ""),
|
|
45
|
+
stderr: String(error.stderr ?? ""),
|
|
46
|
+
duration,
|
|
47
|
+
};
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/**
|
|
51
|
+
* Substitute variables in a command string.
|
|
52
|
+
* Supports {{ENV_VAR}} and $variable patterns.
|
|
53
|
+
*/
|
|
54
|
+
export function substituteCommandVariables(command, variables = {}) {
|
|
55
|
+
let result = command;
|
|
56
|
+
result = result.replace(/\{\{(\w+)\}\}/g, (_match, name) => {
|
|
57
|
+
if (name in variables)
|
|
58
|
+
return variables[name] ?? "";
|
|
59
|
+
return process.env[name] ?? "";
|
|
60
|
+
});
|
|
61
|
+
result = result.replace(/\$(\w+)/g, (_match, name) => {
|
|
62
|
+
return variables[name] ?? "";
|
|
63
|
+
});
|
|
64
|
+
return result;
|
|
65
|
+
}
|
|
66
|
+
//# sourceMappingURL=shell-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shell-executor.js","sourceRoot":"","sources":["../../src/executor/shell-executor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,eAAe,CAAC;AAQzC,MAAM,eAAe,GAAG,KAAK,CAAC;AAE9B,MAAM,UAAU,mBAAmB;IACjC,OAAO;QACL,OAAO,CAAC,OAAe;YACrB,OAAO,cAAc,CAAC,OAAO,EAAE,eAAe,CAAC,CAAC;QAClD,CAAC;QAED,kBAAkB,CAChB,OAAe,EACf,YAAoB,eAAe;YAEnC,OAAO,cAAc,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;QAC5C,CAAC;KACF,CAAC;AACJ,CAAC;AAED,SAAS,cAAc,CAAC,OAAe,EAAE,SAAiB;IACxD,MAAM,KAAK,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;IAEzB,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE;YAC/B,OAAO,EAAE,SAAS;YAClB,QAAQ,EAAE,OAAO;YACjB,KAAK,EAAE,CAAC,MAAM,EAAE,MAAM,EAAE,MAAM,CAAC;SAChC,CAAC,CAAC;QAEH,OAAO;YACL,OAAO,EAAE,IAAI;YACb,QAAQ,EAAE,CAAC;YACX,MAAM,EAAE,MAAM,IAAI,EAAE;YACpB,MAAM,EAAE,EAAE;YACV,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;SAC7B,CAAC;IACJ,CAAC;IAAC,OAAO,GAAY,EAAE,CAAC;QACtB,MAAM,QAAQ,GAAG,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK,CAAC;QACpC,MAAM,KAAK,GAAG,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
|
3
|
+
import type { ShellExecutor } from "./shell-executor.js";
|
|
4
|
+
import type { RunContext } from "./run-context.js";
|
|
5
|
+
export declare function executePhases(phases: SfsPhase[], shell: ShellExecutor, context: RunContext): PhaseResult[];
|
|
6
|
+
//# sourceMappingURL=step-executor.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-executor.d.ts","sourceRoot":"","sources":["../../src/executor/step-executor.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAW,MAAM,oBAAoB,CAAC;AAC5D,OAAO,KAAK,EAAE,WAAW,EAAc,MAAM,qBAAqB,CAAC;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAEzD,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAC;AAGnD,wBAAgB,aAAa,CAC3B,MAAM,EAAE,QAAQ,EAAE,EAClB,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,UAAU,GAClB,WAAW,EAAE,CA6Bf"}
|
|
@@ -0,0 +1,73 @@
|
|
|
1
|
+
import { substituteCommandVariables } from "./shell-executor.js";
|
|
2
|
+
import { getContextVariables, setCapturedVariable } from "./run-context.js";
|
|
3
|
+
export function executePhases(phases, shell, context) {
|
|
4
|
+
const results = [];
|
|
5
|
+
for (const phase of phases) {
|
|
6
|
+
const start = Date.now();
|
|
7
|
+
const steps = [];
|
|
8
|
+
let phaseSuccess = true;
|
|
9
|
+
for (const step of phase.steps) {
|
|
10
|
+
const stepResult = executeStep(step, shell, context);
|
|
11
|
+
steps.push(stepResult);
|
|
12
|
+
if (!stepResult.success) {
|
|
13
|
+
phaseSuccess = false;
|
|
14
|
+
break;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
results.push({
|
|
18
|
+
name: phase.name,
|
|
19
|
+
success: phaseSuccess,
|
|
20
|
+
steps,
|
|
21
|
+
duration: Date.now() - start,
|
|
22
|
+
});
|
|
23
|
+
if (!phaseSuccess)
|
|
24
|
+
break;
|
|
25
|
+
}
|
|
26
|
+
return results;
|
|
27
|
+
}
|
|
28
|
+
function executeStep(step, shell, context) {
|
|
29
|
+
const start = Date.now();
|
|
30
|
+
const variables = getContextVariables(context);
|
|
31
|
+
switch (step.type) {
|
|
32
|
+
case "command": {
|
|
33
|
+
let command = step.value ?? step.raw;
|
|
34
|
+
if (step.verb === "SHELL") {
|
|
35
|
+
if (command.startsWith("SHELL "))
|
|
36
|
+
command = command.slice(6);
|
|
37
|
+
command = substituteCommandVariables(command, variables);
|
|
38
|
+
const result = shell.execute(command);
|
|
39
|
+
return {
|
|
40
|
+
success: result.success,
|
|
41
|
+
output: result.stdout,
|
|
42
|
+
error: result.success ? undefined : result.stderr,
|
|
43
|
+
duration: Date.now() - start,
|
|
44
|
+
};
|
|
45
|
+
}
|
|
46
|
+
// Non-shell commands are skipped during execution
|
|
47
|
+
return {
|
|
48
|
+
success: true,
|
|
49
|
+
output: `Skipped non-shell step: ${step.raw}`,
|
|
50
|
+
duration: Date.now() - start,
|
|
51
|
+
};
|
|
52
|
+
}
|
|
53
|
+
case "capture": {
|
|
54
|
+
const name = step.name;
|
|
55
|
+
// Capture is a placeholder - actual value comes from MCP/agent
|
|
56
|
+
setCapturedVariable(context, name, "");
|
|
57
|
+
return {
|
|
58
|
+
success: true,
|
|
59
|
+
output: `Captured: ${name}`,
|
|
60
|
+
duration: Date.now() - start,
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
case "observation":
|
|
64
|
+
case "wait":
|
|
65
|
+
case "persona":
|
|
66
|
+
return {
|
|
67
|
+
success: true,
|
|
68
|
+
output: `Agent step: ${step.raw}`,
|
|
69
|
+
duration: Date.now() - start,
|
|
70
|
+
};
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
//# sourceMappingURL=step-executor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"step-executor.js","sourceRoot":"","sources":["../../src/executor/step-executor.ts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gBACb,MAAM,EAAE,eAAe,IAAI,CAAC,GAAG,EAAE;gBACjC,QAAQ,EAAE,IAAI,CAAC,GAAG,EAAE,GAAG,KAAK;aAC7B,CAAC;IACN,CAAC;AACH,CAAC"}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":""}
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import { Command } from "commander";
|
|
3
|
+
import { runCommand } from "./cli/run.js";
|
|
4
|
+
import { validateCommand } from "./cli/validate.js";
|
|
5
|
+
import { initCommand } from "./cli/init.js";
|
|
6
|
+
import { coverageCommand } from "./cli/coverage.js";
|
|
7
|
+
const program = new Command();
|
|
8
|
+
program
|
|
9
|
+
.name("sfs")
|
|
10
|
+
.description("StoryFlowSteps - Agent-oriented browser automation for user story validation")
|
|
11
|
+
.version("0.1.0");
|
|
12
|
+
program
|
|
13
|
+
.command("run [files...]")
|
|
14
|
+
.description("Run SFS flow files")
|
|
15
|
+
.option("-e, --env <environment>", "Use environment-specific config")
|
|
16
|
+
.option("-v, --verbose", "Show verbose output")
|
|
17
|
+
.option("--headed", "Run browser in headed mode")
|
|
18
|
+
.action(runCommand);
|
|
19
|
+
program
|
|
20
|
+
.command("validate <files...>")
|
|
21
|
+
.description("Validate SFS file syntax without running")
|
|
22
|
+
.action(validateCommand);
|
|
23
|
+
program
|
|
24
|
+
.command("init")
|
|
25
|
+
.description("Initialize SFS in the current directory")
|
|
26
|
+
.option("-f, --force", "Overwrite existing files")
|
|
27
|
+
.option("--skills-dir <dir>", "Directory to copy skills to")
|
|
28
|
+
.action(initCommand);
|
|
29
|
+
program
|
|
30
|
+
.command("coverage")
|
|
31
|
+
.description("Report user story coverage by SFS files")
|
|
32
|
+
.option("-s, --stories <dir>", "Directory containing user story markdown files", "stories")
|
|
33
|
+
.option("--sfs <pattern>", "Glob pattern for SFS files", "**/*.sfs")
|
|
34
|
+
.option("-f, --format <format>", "Output format: table, json, summary", "table")
|
|
35
|
+
.action(coverageCommand);
|
|
36
|
+
program.parse();
|
|
37
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAC1C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AACpD,OAAO,EAAE,WAAW,EAAE,MAAM,eAAe,CAAC;AAC5C,OAAO,EAAE,eAAe,EAAE,MAAM,mBAAmB,CAAC;AAEpD,MAAM,OAAO,GAAG,IAAI,OAAO,EAAE,CAAC;AAE9B,OAAO;KACJ,IAAI,CAAC,KAAK,CAAC;KACX,WAAW,CACV,8EAA8E,CAC/E;KACA,OAAO,CAAC,OAAO,CAAC,CAAC;AAEpB,OAAO;KACJ,OAAO,CAAC,gBAAgB,CAAC;KACzB,WAAW,CAAC,oBAAoB,CAAC;KACjC,MAAM,CAAC,yBAAyB,EAAE,iCAAiC,CAAC;KACpE,MAAM,CAAC,eAAe,EAAE,qBAAqB,CAAC;KAC9C,MAAM,CAAC,UAAU,EAAE,4BAA4B,CAAC;KAChD,MAAM,CAAC,UAAU,CAAC,CAAC;AAEtB,OAAO;KACJ,OAAO,CAAC,qBAAqB,CAAC;KAC9B,WAAW,CAAC,0CAA0C,CAAC;KACvD,MAAM,CAAC,eAAe,CAAC,CAAC;AAE3B,OAAO;KACJ,OAAO,CAAC,MAAM,CAAC;KACf,WAAW,CAAC,yCAAyC,CAAC;KACtD,MAAM,CAAC,aAAa,EAAE,0BAA0B,CAAC;KACjD,MAAM,CAAC,oBAAoB,EAAE,6BAA6B,CAAC;KAC3D,MAAM,CAAC,WAAW,CAAC,CAAC;AAEvB,OAAO;KACJ,OAAO,CAAC,UAAU,CAAC;KACnB,WAAW,CAAC,yCAAyC,CAAC;KACtD,MAAM,CACL,qBAAqB,EACrB,gDAAgD,EAChD,SAAS,CACV;KACA,MAAM,CAAC,iBAAiB,EAAE,4BAA4B,EAAE,UAAU,CAAC;KACnE,MAAM,CACL,uBAAuB,EACvB,qCAAqC,EACrC,OAAO,CACR;KACA,MAAM,CAAC,eAAe,CAAC,CAAC;AAE3B,OAAO,CAAC,KAAK,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertion-parser.d.ts","sourceRoot":"","sources":["../../src/parser/assertion-parser.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAE/C,wBAAgB,cAAc,CAC5B,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,MAAM,GACd,YAAY,GAAG,SAAS,CAqG1B"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
export function parseAssertion(line, lineNum) {
|
|
2
|
+
// Shorthand: env-check
|
|
3
|
+
if (line === "ASSERT env-check") {
|
|
4
|
+
return {
|
|
5
|
+
type: "env_check",
|
|
6
|
+
target: "env-check",
|
|
7
|
+
raw: line,
|
|
8
|
+
line: lineNum,
|
|
9
|
+
};
|
|
10
|
+
}
|
|
11
|
+
// Shorthand: docker is ready
|
|
12
|
+
if (line === "ASSERT docker is ready") {
|
|
13
|
+
return {
|
|
14
|
+
type: "docker_ready",
|
|
15
|
+
target: "docker",
|
|
16
|
+
raw: line,
|
|
17
|
+
line: lineNum,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
// port N is open/free
|
|
21
|
+
const portMatch = line.match(/^ASSERT port\s+(\d+)\s+is\s+(open|free)$/);
|
|
22
|
+
if (portMatch?.[1] && portMatch[2]) {
|
|
23
|
+
return {
|
|
24
|
+
type: portMatch[2] === "open" ? "port_open" : "port_free",
|
|
25
|
+
target: portMatch[1],
|
|
26
|
+
raw: line,
|
|
27
|
+
line: lineNum,
|
|
28
|
+
};
|
|
29
|
+
}
|
|
30
|
+
// file <path> exists
|
|
31
|
+
const fileMatch = line.match(/^ASSERT file\s+(.+)\s+exists$/);
|
|
32
|
+
if (fileMatch?.[1]) {
|
|
33
|
+
return {
|
|
34
|
+
type: "file_exists",
|
|
35
|
+
target: fileMatch[1].trim(),
|
|
36
|
+
raw: line,
|
|
37
|
+
line: lineNum,
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
// env <var> is set
|
|
41
|
+
const envMatch = line.match(/^ASSERT env\s+(\S+)\s+is set$/);
|
|
42
|
+
if (envMatch?.[1]) {
|
|
43
|
+
return {
|
|
44
|
+
type: "env_set",
|
|
45
|
+
target: envMatch[1],
|
|
46
|
+
raw: line,
|
|
47
|
+
line: lineNum,
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
// url <url> responds [with <status>]
|
|
51
|
+
const urlWithMatch = line.match(/^ASSERT url\s+(.+)\s+responds with\s+(\d+)$/);
|
|
52
|
+
if (urlWithMatch?.[1] && urlWithMatch[2]) {
|
|
53
|
+
return {
|
|
54
|
+
type: "url_responds_with",
|
|
55
|
+
target: urlWithMatch[1].trim(),
|
|
56
|
+
value: urlWithMatch[2],
|
|
57
|
+
raw: line,
|
|
58
|
+
line: lineNum,
|
|
59
|
+
};
|
|
60
|
+
}
|
|
61
|
+
const urlMatch = line.match(/^ASSERT url\s+(.+)\s+responds$/);
|
|
62
|
+
if (urlMatch?.[1]) {
|
|
63
|
+
return {
|
|
64
|
+
type: "url_responds",
|
|
65
|
+
target: urlMatch[1].trim(),
|
|
66
|
+
raw: line,
|
|
67
|
+
line: lineNum,
|
|
68
|
+
};
|
|
69
|
+
}
|
|
70
|
+
// shell <command> succeeds
|
|
71
|
+
const shellMatch = line.match(/^ASSERT shell\s+(.+)\s+succeeds$/);
|
|
72
|
+
if (shellMatch?.[1]) {
|
|
73
|
+
return {
|
|
74
|
+
type: "shell_succeeds",
|
|
75
|
+
target: shellMatch[1].trim(),
|
|
76
|
+
raw: line,
|
|
77
|
+
line: lineNum,
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
// Generic assertion
|
|
81
|
+
const genericMatch = line.match(/^ASSERT\s+(.+)$/);
|
|
82
|
+
if (genericMatch?.[1]) {
|
|
83
|
+
return {
|
|
84
|
+
type: "custom",
|
|
85
|
+
target: genericMatch[1].trim(),
|
|
86
|
+
raw: line,
|
|
87
|
+
line: lineNum,
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
return undefined;
|
|
91
|
+
}
|
|
92
|
+
//# sourceMappingURL=assertion-parser.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"assertion-parser.js","sourceRoot":"","sources":["../../src/parser/assertion-parser.ts"],"names":[],"mappings":"AAEA,MAAM,UAAU,cAAc,CAC5B,IAAY,EACZ,OAAe;IAEf,uBAAuB;IACvB,IAAI,IAAI,KAAK,kBAAkB,EAAE,CAAC;QAChC,OAAO;YACL,IAAI,EAAE,WAAW;YACjB,MAAM,EAAE,WAAW;YACnB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;IAED,6BAA6B;IAC7B,IAAI,IAAI,KAAK,wBAAwB,EAAE,CAAC;QACtC,OAAO;YACL,IAAI,EAAE,cAAc;YACpB,MAAM,EAAE,QAAQ;YAChB,GAAG,EAAE,IAAI;YACT,IAAI,EAAE,OAAO;SACd,CAAC;IACJ,CAAC;IAED,sBAAsB;IACtB,MAAM,SAAS,GAAG,IAAI,CAAC,KAAK,CAAC,0CAA0C,CAAC,CAAC;IACzE,IAAI,SAAS,EAAE,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;QACnC,OAAO;YACL,IAAI,EAAE,SAAS,CAAC,CAAC,CAAC,KAAK,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC,CAAC,CAAC,WAAW;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