@sun-asterisk/sungen 3.2.10 → 3.2.12-beta.1
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/dist/capabilities/discover.d.ts.map +1 -1
- package/dist/capabilities/discover.js +5 -2
- package/dist/capabilities/discover.js.map +1 -1
- package/dist/cli/commands/capability.d.ts.map +1 -1
- package/dist/cli/commands/capability.js +44 -2
- package/dist/cli/commands/capability.js.map +1 -1
- package/dist/harness/capability.d.ts +1 -0
- package/dist/harness/capability.d.ts.map +1 -1
- package/dist/harness/capability.js.map +1 -1
- package/dist/harness/catalog/drivers.yaml +2 -1
- package/dist/harness/query-catalog.d.ts +32 -2
- package/dist/harness/query-catalog.d.ts.map +1 -1
- package/dist/harness/query-catalog.js +0 -0
- package/dist/harness/query-catalog.js.map +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +3 -1
- package/dist/index.js.map +1 -1
- package/dist/orchestrator/templates/ai-src/commands/create-data-test.md +99 -0
- package/dist/orchestrator/templates/ai-src/commands/create-test.md +3 -0
- package/dist/orchestrator/templates/ai-src/commands/run-test.md +1 -0
- package/dist/orchestrator/templates/ai-src/config/claude.md +3 -1
- package/dist/orchestrator/templates/ai-src/config/copilot.md +3 -1
- package/dist/orchestrator/templates/ai-src/skills/sungen-data-factory/SKILL.md +116 -0
- package/dist/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +15 -5
- package/dist/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +1 -0
- package/dist/orchestrator/templates/specs-db.d.ts +201 -11
- package/dist/orchestrator/templates/specs-db.d.ts.map +1 -1
- package/dist/orchestrator/templates/specs-db.js +440 -91
- package/dist/orchestrator/templates/specs-db.js.map +1 -1
- package/dist/orchestrator/templates/specs-db.ts +463 -79
- package/dist/orchestrator/templates/specs-test-data.ts +39 -3
- package/package.json +8 -4
- package/src/capabilities/discover.ts +5 -2
- package/src/cli/commands/capability.ts +40 -2
- package/src/harness/capability.ts +1 -0
- package/src/harness/catalog/drivers.yaml +2 -1
- package/src/harness/query-catalog.ts +0 -0
- package/src/index.ts +2 -2
- package/src/orchestrator/templates/ai-src/commands/create-data-test.md +99 -0
- package/src/orchestrator/templates/ai-src/commands/create-test.md +3 -0
- package/src/orchestrator/templates/ai-src/commands/run-test.md +1 -0
- package/src/orchestrator/templates/ai-src/config/claude.md +3 -1
- package/src/orchestrator/templates/ai-src/config/copilot.md +3 -1
- package/src/orchestrator/templates/ai-src/skills/sungen-data-factory/SKILL.md +116 -0
- package/src/orchestrator/templates/ai-src/skills/sungen-gherkin-syntax/SKILL.md +15 -5
- package/src/orchestrator/templates/ai-src/skills/sungen-tc-generation/SKILL.md +1 -0
- package/src/orchestrator/templates/specs-db.ts +463 -79
- package/src/orchestrator/templates/specs-test-data.ts +39 -3
|
@@ -48,9 +48,27 @@ export class TestDataLoader {
|
|
|
48
48
|
if (value === undefined || value === null) {
|
|
49
49
|
throw new Error(`Test data key not found: ${key}`);
|
|
50
50
|
}
|
|
51
|
+
// A projected array (e.g. `{{q.rows[*].name}}`) serializes as a JSON list so the full
|
|
52
|
+
// ordered set is preserved for the assert-compare — String([...]) would flatten it to a
|
|
53
|
+
// lossy comma-join that can't be distinguished from a scalar containing commas.
|
|
54
|
+
if (Array.isArray(value)) return this.interpolate(JSON.stringify(value));
|
|
51
55
|
return this.interpolate(String(value));
|
|
52
56
|
}
|
|
53
57
|
|
|
58
|
+
/**
|
|
59
|
+
* Resolve a key to its RAW, uncoerced value (array/object/number kept as-is) — for binding
|
|
60
|
+
* DB query parameters, where type-strict stores (MySQL numeric columns, MongoDB) require the
|
|
61
|
+
* native type. get() stringifies for Gherkin text; raw() must not. Throws on missing, mirroring
|
|
62
|
+
* get()'s guard.
|
|
63
|
+
*/
|
|
64
|
+
raw(key: string): any {
|
|
65
|
+
const value = this.resolve(key);
|
|
66
|
+
if (value === undefined || value === null) {
|
|
67
|
+
throw new Error(`Test data key not found: ${key}`);
|
|
68
|
+
}
|
|
69
|
+
return value;
|
|
70
|
+
}
|
|
71
|
+
|
|
54
72
|
/**
|
|
55
73
|
* Substitute embedded `{{ref}}` cross-references inside a resolved string value.
|
|
56
74
|
* Each ref is looked up via resolve() (flat key, @cases row column, or dotted path),
|
|
@@ -78,6 +96,7 @@ export class TestDataLoader {
|
|
|
78
96
|
* `q.count` / `q.length` → number of rows
|
|
79
97
|
* `q.first.col` / `q.last.col` / `q[2].col` → a specific row's column
|
|
80
98
|
* `q.col` → shorthand for the first row's column
|
|
99
|
+
* `q.rows[*].col` → the `col` of EVERY row, projected to an ordered array
|
|
81
100
|
*/
|
|
82
101
|
private resolve(key: string): any {
|
|
83
102
|
// 1. Exact flat key — captured vars (set()) live under a literal, possibly dotted, key.
|
|
@@ -88,9 +107,26 @@ export class TestDataLoader {
|
|
|
88
107
|
return this.data[key];
|
|
89
108
|
}
|
|
90
109
|
// 2. Structured path: head from the row (cases) or shared data, then walk segments.
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
110
|
+
// `[n]` → `.n` (numeric index); `[*]` → `.*` (project the rest of the path over each element).
|
|
111
|
+
const tokens = String(key).replace(/\[(\d+)\]/g, '.$1').replace(/\[\*\]/g, '.*').split('.');
|
|
112
|
+
const cur: any = (this.row && tokens[0] in this.row) ? this.row[tokens[0]] : this.data[tokens[0]];
|
|
113
|
+
return TestDataLoader.walk(cur, tokens, 1);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/**
|
|
117
|
+
* Walk the remaining path tokens from `i`. A `*` token on an array projects: the rest of the
|
|
118
|
+
* path is mapped over every element and the collected array returned (recurses for nested `[*]`).
|
|
119
|
+
* Non-`*` tokens use the linear single-step navigation, so numeric/first/last/object access is
|
|
120
|
+
* unchanged.
|
|
121
|
+
*/
|
|
122
|
+
private static walk(cur: any, tokens: string[], i: number): any {
|
|
123
|
+
for (; i < tokens.length && cur != null; i++) {
|
|
124
|
+
if (tokens[i] === '*' && Array.isArray(cur)) {
|
|
125
|
+
const rest = tokens.slice(i + 1);
|
|
126
|
+
return cur.map((el) => TestDataLoader.walk(el, rest, 0));
|
|
127
|
+
}
|
|
128
|
+
cur = TestDataLoader.step(cur, tokens[i]);
|
|
129
|
+
}
|
|
94
130
|
return cur;
|
|
95
131
|
}
|
|
96
132
|
|