@glubean/cli 0.2.6 → 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/README.md +2 -2
- package/dist/commands/init.d.ts +2 -0
- package/dist/commands/init.d.ts.map +1 -1
- package/dist/commands/init.js +267 -60
- package/dist/commands/init.js.map +1 -1
- package/dist/commands/redact.d.ts.map +1 -1
- package/dist/commands/redact.js +32 -8
- package/dist/commands/redact.js.map +1 -1
- package/dist/commands/run.d.ts +110 -2
- package/dist/commands/run.d.ts.map +1 -1
- package/dist/commands/run.js +483 -40
- package/dist/commands/run.js.map +1 -1
- package/dist/lib/config.d.ts +267 -43
- package/dist/lib/config.d.ts.map +1 -1
- package/dist/lib/config.js +744 -149
- package/dist/lib/config.js.map +1 -1
- package/dist/lib/env.d.ts +29 -0
- package/dist/lib/env.d.ts.map +1 -0
- package/dist/lib/env.js +59 -0
- package/dist/lib/env.js.map +1 -0
- package/dist/lib/print-plan.d.ts +21 -0
- package/dist/lib/print-plan.d.ts.map +1 -0
- package/dist/lib/print-plan.js +108 -0
- package/dist/lib/print-plan.js.map +1 -0
- package/dist/lib/upload.d.ts +36 -1
- package/dist/lib/upload.d.ts.map +1 -1
- package/dist/lib/upload.js +126 -19
- package/dist/lib/upload.js.map +1 -1
- package/dist/main.d.ts.map +1 -1
- package/dist/main.js +405 -27
- package/dist/main.js.map +1 -1
- package/package.json +5 -5
- package/templates/README.md +7 -13
- package/templates/demo/.env.example +7 -0
- package/templates/demo/.env.secrets.example +11 -0
- package/templates/demo/README.md +60 -0
- package/templates/demo/config/api.ts +24 -0
- package/templates/demo/gitignore.tpl +13 -0
- package/templates/demo/glubean.yaml +48 -0
- package/templates/demo/tests/api-flaky/search-flaky.test.ts +28 -0
- package/templates/demo/tests/api-stable/get-users.test.ts +30 -0
- package/templates/demo/tests/canary/synthetic-50pct-flaky.test.ts +23 -0
- package/templates/demo/tests/contracts/stable/users-contract.contract.ts +70 -0
- package/templates/demo/tsconfig.json +15 -0
- package/templates/AI-INSTRUCTIONS.md +0 -160
- package/templates/ci-config/ci.yaml +0 -13
- package/templates/ci-config/default.yaml +0 -9
- package/templates/ci-config/explore.yaml +0 -5
- package/templates/ci-config/staging.yaml +0 -9
package/dist/commands/run.d.ts
CHANGED
|
@@ -3,12 +3,29 @@ interface RunOptions {
|
|
|
3
3
|
pick?: string;
|
|
4
4
|
tags?: string[];
|
|
5
5
|
tagMode?: "or" | "and";
|
|
6
|
+
/** Per-test timeout ms (Phase 1 sub-task E: profile execution.timeoutMs). */
|
|
7
|
+
timeoutMs?: number;
|
|
8
|
+
/** Worker concurrency (Phase 1 sub-task E: profile execution.concurrency). */
|
|
9
|
+
concurrency?: number;
|
|
10
|
+
/**
|
|
11
|
+
* Tags to EXCLUDE. Any test/case carrying ANY of these tags is dropped
|
|
12
|
+
* from the inventory before execution. excludeTags is always OR-mode
|
|
13
|
+
* (any match → exclude), independent of `tagMode` which only governs
|
|
14
|
+
* positive `tags` matching. Phase 1 first slice — see plan §Phase 1 task 8.
|
|
15
|
+
*/
|
|
16
|
+
excludeTags?: string[];
|
|
6
17
|
envFile?: string;
|
|
7
18
|
logFile?: boolean;
|
|
8
19
|
pretty?: boolean;
|
|
9
20
|
verbose?: boolean;
|
|
10
21
|
failFast?: boolean;
|
|
11
|
-
|
|
22
|
+
/**
|
|
23
|
+
* Stop after N failures. `null` = explicit "no count limit" (e.g. from a
|
|
24
|
+
* profile that disables it). Distinct from `undefined` (= "no override,
|
|
25
|
+
* fall through to underlying config defaults") — mergeRunOptions
|
|
26
|
+
* preserves the null vs undefined distinction.
|
|
27
|
+
*/
|
|
28
|
+
failAfter?: number | null;
|
|
12
29
|
resultJson?: boolean | string;
|
|
13
30
|
emitFullTrace?: boolean;
|
|
14
31
|
inferSchema?: boolean;
|
|
@@ -25,6 +42,7 @@ interface RunOptions {
|
|
|
25
42
|
/** Include cases with defaultRun: "opt-in" (headless but expensive/slow) */
|
|
26
43
|
includeOptIn?: boolean;
|
|
27
44
|
upload?: boolean;
|
|
45
|
+
uploadReceiptJson?: string;
|
|
28
46
|
project?: string;
|
|
29
47
|
token?: string;
|
|
30
48
|
apiUrl?: string;
|
|
@@ -49,7 +67,77 @@ interface RunOptions {
|
|
|
49
67
|
inputJson?: string;
|
|
50
68
|
bootstrapJson?: string;
|
|
51
69
|
forceStandalone?: boolean;
|
|
70
|
+
/**
|
|
71
|
+
* Per-file allow-list of runnable kinds. When set, each discovered
|
|
72
|
+
* runnable is filtered: only emit it if its kind is in the file's
|
|
73
|
+
* allowed set. This enforces `suite.kinds` at the RUNNABLE level —
|
|
74
|
+
* a `kinds: [contract]` suite running a `.contract.ts` file that
|
|
75
|
+
* also exports a flow inline still drops the flow. Missing entry
|
|
76
|
+
* for a file means "no filter" (legacy behavior).
|
|
77
|
+
*/
|
|
78
|
+
allowedKindsPerFile?: Map<string, Set<"test" | "contract" | "flow">>;
|
|
79
|
+
/**
|
|
80
|
+
* Full redaction config from the v1 resolved plan
|
|
81
|
+
* (`defaults.redaction`). When present, runCommand uses this instead
|
|
82
|
+
* of `glubeanConfig.redaction` loaded via the legacy `loadConfig`
|
|
83
|
+
* path — which doesn't read glubean.yaml. Without this, projects
|
|
84
|
+
* that declare custom `globalRules` / `sensitiveKeys` / `customPatterns`
|
|
85
|
+
* in glubean.yaml would silently ship secrets to Cloud uploads.
|
|
86
|
+
*/
|
|
87
|
+
redactionConfig?: import("@glubean/redaction").RedactionConfig;
|
|
88
|
+
/**
|
|
89
|
+
* Phase 5 5a — profile name from `glubean.yaml` the run executed
|
|
90
|
+
* against. Threaded through upload payload as `metadata.runPlan.profile`
|
|
91
|
+
* so cloud server can project to top-level `RunEntity.profile` for
|
|
92
|
+
* index-backed `GET /open/v1/runs?profile=X` queries.
|
|
93
|
+
*/
|
|
94
|
+
profile?: string;
|
|
95
|
+
/**
|
|
96
|
+
* Phase 5 5a — suite names the run spanned (in declaration order).
|
|
97
|
+
* Threaded as `metadata.runPlan.suites` for the equivalent
|
|
98
|
+
* `?suite=Y` membership query.
|
|
99
|
+
*/
|
|
100
|
+
suites?: string[];
|
|
101
|
+
/**
|
|
102
|
+
* Metric thresholds from the v1 resolved plan (defaults.thresholds ∪
|
|
103
|
+
* profile.thresholds). When non-empty, takes precedence over the legacy
|
|
104
|
+
* `glubeanConfig.thresholds` (package.json) — v1 profiles can declare
|
|
105
|
+
* per-profile gates that the legacy flat-shape path can't express.
|
|
106
|
+
*/
|
|
107
|
+
thresholds?: import("@glubean/sdk").ThresholdConfig;
|
|
52
108
|
}
|
|
109
|
+
/**
|
|
110
|
+
* Map a file path to its Glubean kind by extension.
|
|
111
|
+
* - `.test.ts` → "test"
|
|
112
|
+
* - `.contract.ts` → "contract"
|
|
113
|
+
* - `.flow.ts` → "flow"
|
|
114
|
+
* - `.bootstrap.ts` → "bootstrap" (overlay registration only; not a runnable kind)
|
|
115
|
+
*
|
|
116
|
+
* Returns undefined for non-Glubean files. The suite.kinds filter in
|
|
117
|
+
* resolveTestFiles uses this to keep only files whose kind matches.
|
|
118
|
+
*/
|
|
119
|
+
export type GlubeanFileKind = "test" | "contract" | "flow" | "bootstrap";
|
|
120
|
+
export declare function classifyGlubeanFile(filePath: string): GlubeanFileKind | undefined;
|
|
121
|
+
/**
|
|
122
|
+
* Per-suite resolution helper exposed for main.ts. Resolves a suite's
|
|
123
|
+
* `target` (file / dir / glob), then keeps only files whose
|
|
124
|
+
* `classifyGlubeanFile` result is in `kinds` (.bootstrap.ts files are
|
|
125
|
+
* always kept regardless of kinds so overlay registration still fires
|
|
126
|
+
* across the project — they emit no runnable tests on their own).
|
|
127
|
+
*
|
|
128
|
+
* `kinds.length === 0` means "no kind filter" (all Glubean files).
|
|
129
|
+
*
|
|
130
|
+
* KNOWN LIMITATION (file-level only): the filter operates on the file
|
|
131
|
+
* EXTENSION, not on individual exports. A `.contract.ts` file CAN
|
|
132
|
+
* legitimately export a flow inline (and vice versa). For canonical
|
|
133
|
+
* `tests/` + `contracts/` directory layouts this doesn't matter — each
|
|
134
|
+
* file kind matches its declared suite kind. For mixed exports inside
|
|
135
|
+
* a single file (`kinds: [contract]` running a flow exported from the
|
|
136
|
+
* same .contract.ts), authors should split flows into `.flow.ts`. A
|
|
137
|
+
* proper export-level kind filter would require threading suite kinds
|
|
138
|
+
* through discoverTests and is left as a follow-up.
|
|
139
|
+
*/
|
|
140
|
+
export declare function resolveTestFilesForSuite(target: string, kinds: string[]): Promise<string[]>;
|
|
53
141
|
interface DiscoveredTestMeta {
|
|
54
142
|
id: string;
|
|
55
143
|
name?: string;
|
|
@@ -64,12 +152,32 @@ interface DiscoveredTestMeta {
|
|
|
64
152
|
defaultRun?: string;
|
|
65
153
|
deferred?: string;
|
|
66
154
|
deprecated?: string;
|
|
155
|
+
/**
|
|
156
|
+
* Runnable kind — used by Phase 4's suite.kinds filter to drop
|
|
157
|
+
* runnables whose kind isn't in the declared kinds for the suite
|
|
158
|
+
* that contributed the file. Set by discoverTests at emit time:
|
|
159
|
+
* - "test" — plain `test(...)` exports
|
|
160
|
+
* - "contract" — contract case (any protocol)
|
|
161
|
+
* - "flow" — `contract.flow(...).build()` orchestrator
|
|
162
|
+
*/
|
|
163
|
+
kind?: "test" | "contract" | "flow";
|
|
67
164
|
}
|
|
68
165
|
interface DiscoveredTest {
|
|
69
166
|
exportName: string;
|
|
70
167
|
meta: DiscoveredTestMeta;
|
|
71
168
|
}
|
|
72
169
|
export declare function discoverTests(filePath: string): Promise<DiscoveredTest[]>;
|
|
73
|
-
export declare
|
|
170
|
+
export declare const __testing: {
|
|
171
|
+
matchesTags: (testItem: DiscoveredTest, tags: string[], mode?: "or" | "and" | undefined) => boolean;
|
|
172
|
+
matchesExcludeTags: (testItem: DiscoveredTest, excludeTags: string[]) => boolean;
|
|
173
|
+
};
|
|
174
|
+
declare function matchesTags(testItem: DiscoveredTest, tags: string[], mode?: "or" | "and"): boolean;
|
|
175
|
+
/**
|
|
176
|
+
* Returns true if the test carries ANY tag in excludeTags (case-insensitive).
|
|
177
|
+
* Always OR-mode — independent of positive-side tagMode. A test with no
|
|
178
|
+
* tags is never excluded by this filter.
|
|
179
|
+
*/
|
|
180
|
+
declare function matchesExcludeTags(testItem: DiscoveredTest, excludeTags: string[]): boolean;
|
|
181
|
+
export declare function runCommand(target: string | string[], options?: RunOptions): Promise<void>;
|
|
74
182
|
export {};
|
|
75
183
|
//# sourceMappingURL=run.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AA+CA,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"run.d.ts","sourceRoot":"","sources":["../../src/commands/run.ts"],"names":[],"mappings":"AA+CA,UAAU,UAAU;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,IAAI,CAAC,EAAE,MAAM,EAAE,CAAC;IAChB,OAAO,CAAC,EAAE,IAAI,GAAG,KAAK,CAAC;IACvB,6EAA6E;IAC7E,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,8EAA8E;IAC9E,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,MAAM,EAAE,CAAC;IACvB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,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