slapify 0.0.16 → 0.0.18

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.
Files changed (52) hide show
  1. package/README.md +38 -4
  2. package/dist/ai/interpreter.js +1 -331
  3. package/dist/browser/agent.js +1 -485
  4. package/dist/cli.js +1 -1553
  5. package/dist/config/loader.js +1 -305
  6. package/dist/index.js +1 -262
  7. package/dist/parser/flow.js +1 -117
  8. package/dist/perf/audit.js +1 -635
  9. package/dist/report/generator.js +1 -641
  10. package/dist/runner/index.js +1 -744
  11. package/dist/task/index.js +1 -4
  12. package/dist/task/report.js +1 -740
  13. package/dist/task/runner.js +1 -1362
  14. package/dist/task/session.js +1 -153
  15. package/dist/task/tools.d.ts +12 -0
  16. package/dist/task/tools.js +1 -258
  17. package/dist/task/types.d.ts +18 -0
  18. package/dist/task/types.js +1 -2
  19. package/dist/types.js +1 -2
  20. package/package.json +6 -3
  21. package/dist/ai/interpreter.d.ts.map +0 -1
  22. package/dist/ai/interpreter.js.map +0 -1
  23. package/dist/browser/agent.d.ts.map +0 -1
  24. package/dist/browser/agent.js.map +0 -1
  25. package/dist/cli.d.ts.map +0 -1
  26. package/dist/cli.js.map +0 -1
  27. package/dist/config/loader.d.ts.map +0 -1
  28. package/dist/config/loader.js.map +0 -1
  29. package/dist/index.d.ts.map +0 -1
  30. package/dist/index.js.map +0 -1
  31. package/dist/parser/flow.d.ts.map +0 -1
  32. package/dist/parser/flow.js.map +0 -1
  33. package/dist/perf/audit.d.ts.map +0 -1
  34. package/dist/perf/audit.js.map +0 -1
  35. package/dist/report/generator.d.ts.map +0 -1
  36. package/dist/report/generator.js.map +0 -1
  37. package/dist/runner/index.d.ts.map +0 -1
  38. package/dist/runner/index.js.map +0 -1
  39. package/dist/task/index.d.ts.map +0 -1
  40. package/dist/task/index.js.map +0 -1
  41. package/dist/task/report.d.ts.map +0 -1
  42. package/dist/task/report.js.map +0 -1
  43. package/dist/task/runner.d.ts.map +0 -1
  44. package/dist/task/runner.js.map +0 -1
  45. package/dist/task/session.d.ts.map +0 -1
  46. package/dist/task/session.js.map +0 -1
  47. package/dist/task/tools.d.ts.map +0 -1
  48. package/dist/task/tools.js.map +0 -1
  49. package/dist/task/types.d.ts.map +0 -1
  50. package/dist/task/types.js.map +0 -1
  51. package/dist/types.d.ts.map +0 -1
  52. package/dist/types.js.map +0 -1
@@ -1,117 +1 @@
1
- import fs from "fs";
2
- import path from "path";
3
- import { glob } from "glob";
4
- /**
5
- * Parse a single line into a FlowStep
6
- */
7
- function parseLine(line, lineNumber) {
8
- const trimmed = line.trim();
9
- // Skip empty lines and comments
10
- if (!trimmed || trimmed.startsWith("#")) {
11
- return null;
12
- }
13
- // Check for [Optional] prefix
14
- const optionalMatch = trimmed.match(/^\[Optional\]\s*(.+)$/i);
15
- const isOptional = !!optionalMatch;
16
- const stepText = optionalMatch ? optionalMatch[1] : trimmed;
17
- // Check for conditional (If ... appears, ...)
18
- const conditionalMatch = stepText.match(/^If\s+(.+?)\s*,\s*(.+)$/i);
19
- const isConditional = !!conditionalMatch;
20
- return {
21
- line: lineNumber,
22
- text: stepText,
23
- optional: isOptional,
24
- conditional: isConditional,
25
- condition: conditionalMatch ? conditionalMatch[1] : undefined,
26
- action: conditionalMatch ? conditionalMatch[2] : undefined,
27
- };
28
- }
29
- /**
30
- * Extract comments from a flow file
31
- */
32
- function extractComments(content) {
33
- return content
34
- .split("\n")
35
- .filter((line) => line.trim().startsWith("#"))
36
- .map((line) => line.trim().substring(1).trim());
37
- }
38
- /**
39
- * Parse a .flow file into a FlowFile object
40
- */
41
- export function parseFlowFile(filePath) {
42
- if (!fs.existsSync(filePath)) {
43
- throw new Error(`Flow file not found: ${filePath}`);
44
- }
45
- const content = fs.readFileSync(filePath, "utf-8");
46
- const lines = content.split("\n");
47
- const steps = [];
48
- for (let i = 0; i < lines.length; i++) {
49
- const step = parseLine(lines[i], i + 1);
50
- if (step) {
51
- steps.push(step);
52
- }
53
- }
54
- return {
55
- path: filePath,
56
- name: path.basename(filePath, ".flow"),
57
- steps,
58
- comments: extractComments(content),
59
- };
60
- }
61
- /**
62
- * Parse flow content from a string (for inline tests)
63
- */
64
- export function parseFlowContent(content, name = "inline") {
65
- const lines = content.split("\n");
66
- const steps = [];
67
- for (let i = 0; i < lines.length; i++) {
68
- const step = parseLine(lines[i], i + 1);
69
- if (step) {
70
- steps.push(step);
71
- }
72
- }
73
- return {
74
- path: "",
75
- name,
76
- steps,
77
- comments: extractComments(content),
78
- };
79
- }
80
- /**
81
- * Find all .flow files in a directory
82
- */
83
- export async function findFlowFiles(dir) {
84
- const pattern = path.join(dir, "**/*.flow");
85
- return glob(pattern, { nodir: true });
86
- }
87
- /**
88
- * Validate a flow file for common issues
89
- */
90
- export function validateFlowFile(flow) {
91
- const warnings = [];
92
- if (flow.steps.length === 0) {
93
- warnings.push("Flow file has no steps");
94
- }
95
- // Check for steps that might be incomplete
96
- for (const step of flow.steps) {
97
- if (step.text.length < 3) {
98
- warnings.push(`Line ${step.line}: Step seems too short: "${step.text}"`);
99
- }
100
- if (step.conditional && !step.action) {
101
- warnings.push(`Line ${step.line}: Conditional step missing action`);
102
- }
103
- }
104
- return warnings;
105
- }
106
- /**
107
- * Get a summary of a flow file
108
- */
109
- export function getFlowSummary(flow) {
110
- return {
111
- totalSteps: flow.steps.length,
112
- requiredSteps: flow.steps.filter((s) => !s.optional).length,
113
- optionalSteps: flow.steps.filter((s) => s.optional).length,
114
- conditionalSteps: flow.steps.filter((s) => s.conditional).length,
115
- };
116
- }
117
- //# sourceMappingURL=flow.js.map
1
+ import t from"fs";import n from"path";import{glob as o}from"glob";function e(t,n){const o=t.trim();if(!o||o.startsWith("#"))return null;const e=o.match(/^\[Optional\]\s*(.+)$/i),i=!!e,s=e?e[1]:o,r=s.match(/^If\s+(.+?)\s*,\s*(.+)$/i);return{line:n,text:s,optional:i,conditional:!!r,condition:r?r[1]:void 0,action:r?r[2]:void 0}}function i(t){return t.split("\n").filter(t=>t.trim().startsWith("#")).map(t=>t.trim().substring(1).trim())}export function parseFlowFile(o){if(!t.existsSync(o))throw new Error(`Flow file not found: ${o}`);const s=t.readFileSync(o,"utf-8"),r=s.split("\n"),l=[];for(let t=0;t<r.length;t++){const n=e(r[t],t+1);n&&l.push(n)}return{path:o,name:n.basename(o,".flow"),steps:l,comments:i(s)}}export function parseFlowContent(t,n="inline"){const o=t.split("\n"),s=[];for(let t=0;t<o.length;t++){const n=e(o[t],t+1);n&&s.push(n)}return{path:"",name:n,steps:s,comments:i(t)}}export async function findFlowFiles(t){const e=n.join(t,"**/*.flow");return o(e,{nodir:!0})}export function validateFlowFile(t){const n=[];0===t.steps.length&&n.push("Flow file has no steps");for(const o of t.steps)o.text.length<3&&n.push(`Line ${o.line}: Step seems too short: "${o.text}"`),o.conditional&&!o.action&&n.push(`Line ${o.line}: Conditional step missing action`);return n}export function getFlowSummary(t){return{totalSteps:t.steps.length,requiredSteps:t.steps.filter(t=>!t.optional).length,optionalSteps:t.steps.filter(t=>t.optional).length,conditionalSteps:t.steps.filter(t=>t.conditional).length}}