@mmmnt/feature 0.3.1 → 0.3.2
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/commands/run.d.ts +1 -0
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +23 -2
- package/dist/commands/run.js.map +1 -1
- package/dist/shard.d.ts +9 -0
- package/dist/shard.d.ts.map +1 -0
- package/dist/shard.js +27 -0
- package/dist/shard.js.map +1 -0
- package/package.json +7 -7
package/dist/commands/run.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ export default class Run extends Command {
|
|
|
5
5
|
config: import("@oclif/core/interfaces").OptionFlag<string, import("@oclif/core/interfaces").CustomOptions>;
|
|
6
6
|
spec: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
7
7
|
coverage: import("@oclif/core/interfaces").BooleanFlag<boolean>;
|
|
8
|
+
shard: import("@oclif/core/interfaces").OptionFlag<string | undefined, import("@oclif/core/interfaces").CustomOptions>;
|
|
8
9
|
};
|
|
9
10
|
run(): Promise<void>;
|
|
10
11
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAMA,OAAO,EAAE,OAAO,EAAS,MAAM,aAAa,CAAC;AAQ7C,MAAM,CAAC,OAAO,OAAO,GAAI,SAAQ,OAAO;IACtC,OAAgB,WAAW,SAA4D;IAEvF,OAAgB,KAAK;;;;;MAQnB;IAEW,GAAG,IAAI,OAAO,CAAC,IAAI,CAAC;CAwDlC"}
|
package/dist/commands/run.js
CHANGED
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
// `feat run` — execute the generated test suites (runner subprocess, GAP-D09).
|
|
2
|
-
// --spec filters to a single spec ID
|
|
2
|
+
// --spec filters to a single spec ID; --shard i/n runs one disjoint slice (for N isolated jobs).
|
|
3
|
+
// JUnit output per the config report block, suffixed per shard.
|
|
3
4
|
import { existsSync, readFileSync } from "node:fs";
|
|
4
5
|
import path from "node:path";
|
|
5
6
|
import { Command, Flags } from "@oclif/core";
|
|
@@ -7,12 +8,16 @@ import { runTests } from "@mmmnt/feat-runner";
|
|
|
7
8
|
import { resolveEnvironment, variablesSidecarPath } from "@mmmnt/feat-runtime";
|
|
8
9
|
import { rmSync } from "node:fs";
|
|
9
10
|
import { generateAll } from "../pipeline.js";
|
|
11
|
+
import { parseShard, selectShard, shardJunitPath } from "../shard.js";
|
|
10
12
|
export default class Run extends Command {
|
|
11
13
|
static description = "Execute the generated tests with the adapter lifecycle";
|
|
12
14
|
static flags = {
|
|
13
15
|
config: Flags.string({ char: "c", description: "Path to feat.config.json", default: "feat.config.json" }),
|
|
14
16
|
spec: Flags.string({ description: "Run only the spec with this ID (e.g. SPEC-RT-001)" }),
|
|
15
17
|
coverage: Flags.boolean({ description: "Collect coverage via the runner's coverage provider" }),
|
|
18
|
+
shard: Flags.string({
|
|
19
|
+
description: "Run slice i of n (e.g. 2/4). Each shard needs its OWN instruments — shards that share a store are not isolated."
|
|
20
|
+
}),
|
|
16
21
|
};
|
|
17
22
|
async run() {
|
|
18
23
|
const { flags } = await this.parse(Run);
|
|
@@ -34,6 +39,21 @@ export default class Run extends Command {
|
|
|
34
39
|
this.exit(1);
|
|
35
40
|
}
|
|
36
41
|
}
|
|
42
|
+
let shard;
|
|
43
|
+
if (flags.shard) {
|
|
44
|
+
try {
|
|
45
|
+
shard = parseShard(flags.shard);
|
|
46
|
+
}
|
|
47
|
+
catch (e) {
|
|
48
|
+
this.logToStderr(`ERROR ${e.message}`);
|
|
49
|
+
this.exit(1);
|
|
50
|
+
}
|
|
51
|
+
const keep = new Set(selectShard(files.map((f) => f.out), shard));
|
|
52
|
+
files = files.filter((f) => keep.has(f.out));
|
|
53
|
+
this.log(`shard ${shard.index}/${shard.total}: ${files.length} file(s)`);
|
|
54
|
+
if (files.length === 0)
|
|
55
|
+
return; // more shards than files — this slice is honestly empty
|
|
56
|
+
}
|
|
37
57
|
const missing = files.filter((f) => !existsSync(f.out));
|
|
38
58
|
if (missing.length > 0) {
|
|
39
59
|
this.logToStderr("ERROR [NOT_GENERATED] Missing generated test files:");
|
|
@@ -42,7 +62,8 @@ export default class Run extends Command {
|
|
|
42
62
|
this.logToStderr(' Run "feat generate" first.');
|
|
43
63
|
this.exit(1);
|
|
44
64
|
}
|
|
45
|
-
const
|
|
65
|
+
const junitBase = config.report?.format?.includes("junit") ? config.report.junitOutput : undefined;
|
|
66
|
+
const junit = junitBase !== undefined ? shardJunitPath(junitBase, shard) : undefined;
|
|
46
67
|
const runOpts = {
|
|
47
68
|
files: files.map((f) => path.relative(root, f.out)),
|
|
48
69
|
root,
|
package/dist/commands/run.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,
|
|
1
|
+
{"version":3,"file":"run.js","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AAAA,+EAA+E;AAC/E,iGAAiG;AACjG,gEAAgE;AAEhE,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,OAAO,EAAE,KAAK,EAAE,MAAM,aAAa,CAAC;AAE7C,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,kBAAkB,EAAE,oBAAoB,EAAE,MAAM,qBAAqB,CAAC;AAC/E,OAAO,EAAE,MAAM,EAAE,MAAM,SAAS,CAAC;AACjC,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAC7C,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,cAAc,EAAE,MA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CAAC;QACjC,IAAI,MAAM,CAAC,SAAS;YAAE,IAAI,CAAC,GAAG,CAAC,UAAU,IAAI,CAAC,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;QAClF,IAAI,MAAM,CAAC,QAAQ,KAAK,CAAC;YAAE,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAC1C,CAAC"}
|
package/dist/shard.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface Shard {
|
|
2
|
+
index: number;
|
|
3
|
+
total: number;
|
|
4
|
+
}
|
|
5
|
+
export declare function parseShard(value: string): Shard;
|
|
6
|
+
export declare function selectShard(files: readonly string[], shard: Shard): string[];
|
|
7
|
+
/** `feat-junit.xml` → `feat-junit.shard-2-of-4.xml`, so parallel shards never share evidence. */
|
|
8
|
+
export declare function shardJunitPath(junit: string, shard: Shard | undefined): string;
|
|
9
|
+
//# sourceMappingURL=shard.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard.d.ts","sourceRoot":"","sources":["../src/shard.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,KAAK;IACpB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,EAAE,MAAM,CAAC;CACf;AAED,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,CAQ/C;AAED,wBAAgB,WAAW,CAAC,KAAK,EAAE,SAAS,MAAM,EAAE,EAAE,KAAK,EAAE,KAAK,GAAG,MAAM,EAAE,CAE5E;AAED,iGAAiG;AACjG,wBAAgB,cAAc,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,KAAK,GAAG,SAAS,GAAG,MAAM,CAM9E"}
|
package/dist/shard.js
ADDED
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
// `feat run --shard i/n` — a deterministic, disjoint slice of the generated files.
|
|
2
|
+
//
|
|
3
|
+
// Sharding is how a suite whose services share one store runs in parallel: N jobs, each with its
|
|
4
|
+
// OWN instruments, each running one slice. The slice depends only on the file set (sorted, then
|
|
5
|
+
// taken round-robin), so every job computes the same partition with no coordination.
|
|
6
|
+
export function parseShard(value) {
|
|
7
|
+
const m = /^(\d+)\/(\d+)$/.exec(value.trim());
|
|
8
|
+
const index = m ? Number(m[1]) : NaN;
|
|
9
|
+
const total = m ? Number(m[2]) : NaN;
|
|
10
|
+
if (!m || total < 1 || index < 1 || index > total) {
|
|
11
|
+
throw new Error(`--shard must be i/n with 1 ≤ i ≤ n (got '${value}')`);
|
|
12
|
+
}
|
|
13
|
+
return { index, total };
|
|
14
|
+
}
|
|
15
|
+
export function selectShard(files, shard) {
|
|
16
|
+
return [...files].sort().filter((_, i) => i % shard.total === shard.index - 1);
|
|
17
|
+
}
|
|
18
|
+
/** `feat-junit.xml` → `feat-junit.shard-2-of-4.xml`, so parallel shards never share evidence. */
|
|
19
|
+
export function shardJunitPath(junit, shard) {
|
|
20
|
+
if (!shard)
|
|
21
|
+
return junit;
|
|
22
|
+
const dot = junit.lastIndexOf(".");
|
|
23
|
+
const base = dot > junit.lastIndexOf("/") ? junit.slice(0, dot) : junit;
|
|
24
|
+
const ext = dot > junit.lastIndexOf("/") ? junit.slice(dot) : "";
|
|
25
|
+
return `${base}.shard-${shard.index}-of-${shard.total}${ext}`;
|
|
26
|
+
}
|
|
27
|
+
//# sourceMappingURL=shard.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shard.js","sourceRoot":"","sources":["../src/shard.ts"],"names":[],"mappings":"AAAA,mFAAmF;AACnF,EAAE;AACF,iGAAiG;AACjG,gGAAgG;AAChG,qFAAqF;AAOrF,MAAM,UAAU,UAAU,CAAC,KAAa;IACtC,MAAM,CAAC,GAAG,gBAAgB,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC,CAAC;IAC9C,MAAM,KAAK,GAAG,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,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KAAK,GAAG,GAAG,EAAE,CAAC;AAChE,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@mmmnt/feature",
|
|
3
|
-
"version": "0.3.
|
|
3
|
+
"version": "0.3.2",
|
|
4
4
|
"description": "The feat CLI — Feature, the quality spine of AI-native delivery.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"type": "module",
|
|
@@ -21,13 +21,13 @@
|
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@oclif/core": "^4.3.0",
|
|
24
|
-
"@mmmnt/feat-core": "^0.3.
|
|
25
|
-
"@mmmnt/feat-derive": "^0.1.10",
|
|
24
|
+
"@mmmnt/feat-core": "^0.3.1",
|
|
26
25
|
"@mmmnt/feat-emit-ts": "^0.1.8",
|
|
27
|
-
"@mmmnt/feat-
|
|
28
|
-
"@mmmnt/feat-
|
|
29
|
-
"@mmmnt/feat-
|
|
30
|
-
"@mmmnt/feat-analyze": "^0.1.8"
|
|
26
|
+
"@mmmnt/feat-runtime": "^0.1.17",
|
|
27
|
+
"@mmmnt/feat-derive": "^0.1.11",
|
|
28
|
+
"@mmmnt/feat-types": "^0.1.13",
|
|
29
|
+
"@mmmnt/feat-analyze": "^0.1.8",
|
|
30
|
+
"@mmmnt/feat-runner": "^0.1.8"
|
|
31
31
|
},
|
|
32
32
|
"devDependencies": {
|
|
33
33
|
"vitest": "^3.2.0",
|