@agent-scope/cli 1.13.0 → 1.15.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/dist/cli.js +1774 -850
- package/dist/cli.js.map +1 -1
- package/dist/index.cjs +1602 -701
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +116 -1
- package/dist/index.d.ts +116 -1
- package/dist/index.js +1592 -695
- package/dist/index.js.map +1 -1
- package/package.json +6 -6
package/dist/index.d.cts
CHANGED
|
@@ -1,6 +1,121 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { ComplexityClass } from '@agent-scope/manifest';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @agent-scope/cli — `scope ci` command
|
|
6
|
+
*
|
|
7
|
+
* Runs a non-interactive CI pipeline over the component library and exits
|
|
8
|
+
* with a structured exit code so the result can be consumed by CI systems.
|
|
9
|
+
*
|
|
10
|
+
* ## Pipeline steps (in order)
|
|
11
|
+
*
|
|
12
|
+
* 1. Generate the component manifest (discover all components)
|
|
13
|
+
* 2. Render all discovered components
|
|
14
|
+
* 3. Run token-compliance checks
|
|
15
|
+
* 4. Compare against baseline snapshot (if `--baseline` provided)
|
|
16
|
+
*
|
|
17
|
+
* ## Exit codes
|
|
18
|
+
*
|
|
19
|
+
* 0 — All checks passed
|
|
20
|
+
* 1 — Compliance below threshold
|
|
21
|
+
* 2 — Accessibility violations found (reserved; currently surfaced as info)
|
|
22
|
+
* 3 — Console errors during render
|
|
23
|
+
* 4 — Visual regression detected (pixel diff above threshold)
|
|
24
|
+
* 5 — Component render failures
|
|
25
|
+
*
|
|
26
|
+
* ## Usage
|
|
27
|
+
*
|
|
28
|
+
* ```bash
|
|
29
|
+
* scope ci
|
|
30
|
+
* scope ci --baseline .reactscope/baseline
|
|
31
|
+
* scope ci --checks compliance,console-errors
|
|
32
|
+
* scope ci --threshold 0.90 --json
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
declare const CI_EXIT: {
|
|
37
|
+
/** All checks passed */
|
|
38
|
+
readonly OK: 0;
|
|
39
|
+
/** Compliance score below threshold */
|
|
40
|
+
readonly COMPLIANCE_BELOW_THRESHOLD: 1;
|
|
41
|
+
/** Accessibility violations found */
|
|
42
|
+
readonly A11Y_VIOLATIONS: 2;
|
|
43
|
+
/** Console errors detected during render */
|
|
44
|
+
readonly CONSOLE_ERRORS: 3;
|
|
45
|
+
/** Visual regression detected against baseline */
|
|
46
|
+
readonly VISUAL_REGRESSION: 4;
|
|
47
|
+
/** One or more components failed to render */
|
|
48
|
+
readonly RENDER_FAILURES: 5;
|
|
49
|
+
};
|
|
50
|
+
type CiExitCode = (typeof CI_EXIT)[keyof typeof CI_EXIT];
|
|
51
|
+
type CiCheckName = "compliance" | "a11y" | "console-errors" | "visual-regression";
|
|
52
|
+
interface CiCheckResult {
|
|
53
|
+
/** Which check this is */
|
|
54
|
+
check: CiCheckName;
|
|
55
|
+
/** Whether the check passed */
|
|
56
|
+
passed: boolean;
|
|
57
|
+
/** Human-readable summary */
|
|
58
|
+
message: string;
|
|
59
|
+
/** Numeric value for threshold-based checks */
|
|
60
|
+
value?: number;
|
|
61
|
+
/** Threshold that was applied */
|
|
62
|
+
threshold?: number;
|
|
63
|
+
}
|
|
64
|
+
interface CiResult {
|
|
65
|
+
/** ISO timestamp */
|
|
66
|
+
ranAt: string;
|
|
67
|
+
/** Whether the overall CI run passed (exit code 0) */
|
|
68
|
+
passed: boolean;
|
|
69
|
+
/** The resolved exit code */
|
|
70
|
+
exitCode: CiExitCode;
|
|
71
|
+
/** Per-check results */
|
|
72
|
+
checks: CiCheckResult[];
|
|
73
|
+
/** Component counts */
|
|
74
|
+
components: {
|
|
75
|
+
total: number;
|
|
76
|
+
rendered: number;
|
|
77
|
+
failed: number;
|
|
78
|
+
};
|
|
79
|
+
/** Aggregate compliance score (0–1) */
|
|
80
|
+
complianceScore: number;
|
|
81
|
+
/** Compliance threshold that was applied */
|
|
82
|
+
complianceThreshold: number;
|
|
83
|
+
/** Whether baseline comparison was performed */
|
|
84
|
+
baselineCompared: boolean;
|
|
85
|
+
/** Wall-clock duration in ms */
|
|
86
|
+
wallClockMs: number;
|
|
87
|
+
}
|
|
88
|
+
interface CiOptions {
|
|
89
|
+
/** Baseline directory to compare against. Omit to skip visual regression check. */
|
|
90
|
+
baselineDir?: string;
|
|
91
|
+
/** Which checks to run. Default: all */
|
|
92
|
+
checks?: CiCheckName[];
|
|
93
|
+
/** Compliance pass threshold (0–1). Default: 0.90 */
|
|
94
|
+
complianceThreshold?: number;
|
|
95
|
+
/** Viewport width. Default: 375 */
|
|
96
|
+
viewportWidth?: number;
|
|
97
|
+
/** Viewport height. Default: 812 */
|
|
98
|
+
viewportHeight?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Run the full CI pipeline and return a structured CiResult.
|
|
102
|
+
*
|
|
103
|
+
* Does not call `process.exit` — callers are responsible for that so the
|
|
104
|
+
* function remains testable without side effects.
|
|
105
|
+
*/
|
|
106
|
+
declare function runCi(options?: CiOptions): Promise<CiResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Format a CiResult as the CI stdout summary (spec §4.2).
|
|
109
|
+
*/
|
|
110
|
+
declare function formatCiReport(result: CiResult): string;
|
|
111
|
+
/**
|
|
112
|
+
* Build and return the `scope ci` command.
|
|
113
|
+
*
|
|
114
|
+
* The command runs the full pipeline, writes output,
|
|
115
|
+
* and calls `process.exit` with the appropriate exit code.
|
|
116
|
+
*/
|
|
117
|
+
declare function createCiCommand(): Command;
|
|
118
|
+
|
|
4
119
|
/**
|
|
5
120
|
* @agent-scope/cli — `scope init` command implementation
|
|
6
121
|
*
|
|
@@ -418,4 +533,4 @@ declare function resolveTokenFilePath(fileFlag?: string): string;
|
|
|
418
533
|
*/
|
|
419
534
|
declare function createTokensExportCommand(): Command;
|
|
420
535
|
|
|
421
|
-
export { type CausalityLink, type ComponentHookProfile, type HookHeuristicFlag, type HookProfile, type HooksProfilingResult, type InitOptions, type InitResult, type InteractionProfile, type InteractionStep$1 as InteractionStep, type InteractionTiming, type LayoutShiftData, type ListRow, type ProfileHeuristicFlag, type QueryRow, type ReactScopeConfig, type RenderEvent, type RenderTrigger, type RendersAnalysisResult, type ScopeCLIOptions, createInitCommand, createInstrumentCommand, createManifestCommand, createProgram, createTokensCommand, createTokensExportCommand, isTTY, matchGlob, resolveTokenFilePath, runInit };
|
|
536
|
+
export { CI_EXIT, type CausalityLink, type CiCheckName, type CiCheckResult, type CiExitCode, type CiOptions, type CiResult, type ComponentHookProfile, type HookHeuristicFlag, type HookProfile, type HooksProfilingResult, type InitOptions, type InitResult, type InteractionProfile, type InteractionStep$1 as InteractionStep, type InteractionTiming, type LayoutShiftData, type ListRow, type ProfileHeuristicFlag, type QueryRow, type ReactScopeConfig, type RenderEvent, type RenderTrigger, type RendersAnalysisResult, type ScopeCLIOptions, createCiCommand, createInitCommand, createInstrumentCommand, createManifestCommand, createProgram, createTokensCommand, createTokensExportCommand, formatCiReport, isTTY, matchGlob, resolveTokenFilePath, runCi, runInit };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,6 +1,121 @@
|
|
|
1
1
|
import { Command } from 'commander';
|
|
2
2
|
import { ComplexityClass } from '@agent-scope/manifest';
|
|
3
3
|
|
|
4
|
+
/**
|
|
5
|
+
* @agent-scope/cli — `scope ci` command
|
|
6
|
+
*
|
|
7
|
+
* Runs a non-interactive CI pipeline over the component library and exits
|
|
8
|
+
* with a structured exit code so the result can be consumed by CI systems.
|
|
9
|
+
*
|
|
10
|
+
* ## Pipeline steps (in order)
|
|
11
|
+
*
|
|
12
|
+
* 1. Generate the component manifest (discover all components)
|
|
13
|
+
* 2. Render all discovered components
|
|
14
|
+
* 3. Run token-compliance checks
|
|
15
|
+
* 4. Compare against baseline snapshot (if `--baseline` provided)
|
|
16
|
+
*
|
|
17
|
+
* ## Exit codes
|
|
18
|
+
*
|
|
19
|
+
* 0 — All checks passed
|
|
20
|
+
* 1 — Compliance below threshold
|
|
21
|
+
* 2 — Accessibility violations found (reserved; currently surfaced as info)
|
|
22
|
+
* 3 — Console errors during render
|
|
23
|
+
* 4 — Visual regression detected (pixel diff above threshold)
|
|
24
|
+
* 5 — Component render failures
|
|
25
|
+
*
|
|
26
|
+
* ## Usage
|
|
27
|
+
*
|
|
28
|
+
* ```bash
|
|
29
|
+
* scope ci
|
|
30
|
+
* scope ci --baseline .reactscope/baseline
|
|
31
|
+
* scope ci --checks compliance,console-errors
|
|
32
|
+
* scope ci --threshold 0.90 --json
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
|
|
36
|
+
declare const CI_EXIT: {
|
|
37
|
+
/** All checks passed */
|
|
38
|
+
readonly OK: 0;
|
|
39
|
+
/** Compliance score below threshold */
|
|
40
|
+
readonly COMPLIANCE_BELOW_THRESHOLD: 1;
|
|
41
|
+
/** Accessibility violations found */
|
|
42
|
+
readonly A11Y_VIOLATIONS: 2;
|
|
43
|
+
/** Console errors detected during render */
|
|
44
|
+
readonly CONSOLE_ERRORS: 3;
|
|
45
|
+
/** Visual regression detected against baseline */
|
|
46
|
+
readonly VISUAL_REGRESSION: 4;
|
|
47
|
+
/** One or more components failed to render */
|
|
48
|
+
readonly RENDER_FAILURES: 5;
|
|
49
|
+
};
|
|
50
|
+
type CiExitCode = (typeof CI_EXIT)[keyof typeof CI_EXIT];
|
|
51
|
+
type CiCheckName = "compliance" | "a11y" | "console-errors" | "visual-regression";
|
|
52
|
+
interface CiCheckResult {
|
|
53
|
+
/** Which check this is */
|
|
54
|
+
check: CiCheckName;
|
|
55
|
+
/** Whether the check passed */
|
|
56
|
+
passed: boolean;
|
|
57
|
+
/** Human-readable summary */
|
|
58
|
+
message: string;
|
|
59
|
+
/** Numeric value for threshold-based checks */
|
|
60
|
+
value?: number;
|
|
61
|
+
/** Threshold that was applied */
|
|
62
|
+
threshold?: number;
|
|
63
|
+
}
|
|
64
|
+
interface CiResult {
|
|
65
|
+
/** ISO timestamp */
|
|
66
|
+
ranAt: string;
|
|
67
|
+
/** Whether the overall CI run passed (exit code 0) */
|
|
68
|
+
passed: boolean;
|
|
69
|
+
/** The resolved exit code */
|
|
70
|
+
exitCode: CiExitCode;
|
|
71
|
+
/** Per-check results */
|
|
72
|
+
checks: CiCheckResult[];
|
|
73
|
+
/** Component counts */
|
|
74
|
+
components: {
|
|
75
|
+
total: number;
|
|
76
|
+
rendered: number;
|
|
77
|
+
failed: number;
|
|
78
|
+
};
|
|
79
|
+
/** Aggregate compliance score (0–1) */
|
|
80
|
+
complianceScore: number;
|
|
81
|
+
/** Compliance threshold that was applied */
|
|
82
|
+
complianceThreshold: number;
|
|
83
|
+
/** Whether baseline comparison was performed */
|
|
84
|
+
baselineCompared: boolean;
|
|
85
|
+
/** Wall-clock duration in ms */
|
|
86
|
+
wallClockMs: number;
|
|
87
|
+
}
|
|
88
|
+
interface CiOptions {
|
|
89
|
+
/** Baseline directory to compare against. Omit to skip visual regression check. */
|
|
90
|
+
baselineDir?: string;
|
|
91
|
+
/** Which checks to run. Default: all */
|
|
92
|
+
checks?: CiCheckName[];
|
|
93
|
+
/** Compliance pass threshold (0–1). Default: 0.90 */
|
|
94
|
+
complianceThreshold?: number;
|
|
95
|
+
/** Viewport width. Default: 375 */
|
|
96
|
+
viewportWidth?: number;
|
|
97
|
+
/** Viewport height. Default: 812 */
|
|
98
|
+
viewportHeight?: number;
|
|
99
|
+
}
|
|
100
|
+
/**
|
|
101
|
+
* Run the full CI pipeline and return a structured CiResult.
|
|
102
|
+
*
|
|
103
|
+
* Does not call `process.exit` — callers are responsible for that so the
|
|
104
|
+
* function remains testable without side effects.
|
|
105
|
+
*/
|
|
106
|
+
declare function runCi(options?: CiOptions): Promise<CiResult>;
|
|
107
|
+
/**
|
|
108
|
+
* Format a CiResult as the CI stdout summary (spec §4.2).
|
|
109
|
+
*/
|
|
110
|
+
declare function formatCiReport(result: CiResult): string;
|
|
111
|
+
/**
|
|
112
|
+
* Build and return the `scope ci` command.
|
|
113
|
+
*
|
|
114
|
+
* The command runs the full pipeline, writes output,
|
|
115
|
+
* and calls `process.exit` with the appropriate exit code.
|
|
116
|
+
*/
|
|
117
|
+
declare function createCiCommand(): Command;
|
|
118
|
+
|
|
4
119
|
/**
|
|
5
120
|
* @agent-scope/cli — `scope init` command implementation
|
|
6
121
|
*
|
|
@@ -418,4 +533,4 @@ declare function resolveTokenFilePath(fileFlag?: string): string;
|
|
|
418
533
|
*/
|
|
419
534
|
declare function createTokensExportCommand(): Command;
|
|
420
535
|
|
|
421
|
-
export { type CausalityLink, type ComponentHookProfile, type HookHeuristicFlag, type HookProfile, type HooksProfilingResult, type InitOptions, type InitResult, type InteractionProfile, type InteractionStep$1 as InteractionStep, type InteractionTiming, type LayoutShiftData, type ListRow, type ProfileHeuristicFlag, type QueryRow, type ReactScopeConfig, type RenderEvent, type RenderTrigger, type RendersAnalysisResult, type ScopeCLIOptions, createInitCommand, createInstrumentCommand, createManifestCommand, createProgram, createTokensCommand, createTokensExportCommand, isTTY, matchGlob, resolveTokenFilePath, runInit };
|
|
536
|
+
export { CI_EXIT, type CausalityLink, type CiCheckName, type CiCheckResult, type CiExitCode, type CiOptions, type CiResult, type ComponentHookProfile, type HookHeuristicFlag, type HookProfile, type HooksProfilingResult, type InitOptions, type InitResult, type InteractionProfile, type InteractionStep$1 as InteractionStep, type InteractionTiming, type LayoutShiftData, type ListRow, type ProfileHeuristicFlag, type QueryRow, type ReactScopeConfig, type RenderEvent, type RenderTrigger, type RendersAnalysisResult, type ScopeCLIOptions, createCiCommand, createInitCommand, createInstrumentCommand, createManifestCommand, createProgram, createTokensCommand, createTokensExportCommand, formatCiReport, isTTY, matchGlob, resolveTokenFilePath, runCi, runInit };
|