qfai 0.4.0 → 0.4.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/README.md +6 -1
- package/assets/init/.qfai/README.md +2 -1
- package/assets/init/.qfai/prompts/README.md +1 -0
- package/assets/init/.qfai/prompts/qfai-generate-test-globs.md +29 -0
- package/assets/init/root/qfai.config.yaml +6 -0
- package/assets/init/root/tests/qfai-traceability.sample.test.ts +2 -2
- package/dist/cli/index.cjs +337 -117
- package/dist/cli/index.cjs.map +1 -1
- package/dist/cli/index.d.ts +0 -2
- package/dist/cli/index.mjs +337 -117
- package/dist/cli/index.mjs.map +1 -1
- package/dist/index.cjs +327 -107
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +23 -9
- package/dist/index.d.ts +156 -2
- package/dist/index.mjs +327 -107
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -1
- package/dist/cli/commands/init.d.ts +0 -8
- package/dist/cli/commands/init.d.ts.map +0 -1
- package/dist/cli/commands/init.js +0 -30
- package/dist/cli/commands/init.js.map +0 -1
- package/dist/cli/commands/report.d.ts +0 -7
- package/dist/cli/commands/report.d.ts.map +0 -1
- package/dist/cli/commands/report.js +0 -80
- package/dist/cli/commands/report.js.map +0 -1
- package/dist/cli/commands/validate.d.ts +0 -9
- package/dist/cli/commands/validate.d.ts.map +0 -1
- package/dist/cli/commands/validate.js +0 -57
- package/dist/cli/commands/validate.js.map +0 -1
- package/dist/cli/index.d.ts.map +0 -1
- package/dist/cli/index.js +0 -7
- package/dist/cli/index.js.map +0 -1
- package/dist/cli/lib/args.d.ts +0 -18
- package/dist/cli/lib/args.d.ts.map +0 -1
- package/dist/cli/lib/args.js +0 -98
- package/dist/cli/lib/args.js.map +0 -1
- package/dist/cli/lib/assets.d.ts +0 -2
- package/dist/cli/lib/assets.d.ts.map +0 -1
- package/dist/cli/lib/assets.js +0 -24
- package/dist/cli/lib/assets.js.map +0 -1
- package/dist/cli/lib/failOn.d.ts +0 -5
- package/dist/cli/lib/failOn.d.ts.map +0 -1
- package/dist/cli/lib/failOn.js +0 -10
- package/dist/cli/lib/failOn.js.map +0 -1
- package/dist/cli/lib/fs.d.ts +0 -11
- package/dist/cli/lib/fs.d.ts.map +0 -1
- package/dist/cli/lib/fs.js +0 -91
- package/dist/cli/lib/fs.js.map +0 -1
- package/dist/cli/lib/logger.d.ts +0 -4
- package/dist/cli/lib/logger.d.ts.map +0 -1
- package/dist/cli/lib/logger.js +0 -10
- package/dist/cli/lib/logger.js.map +0 -1
- package/dist/cli/main.d.ts +0 -2
- package/dist/cli/main.d.ts.map +0 -1
- package/dist/cli/main.js +0 -66
- package/dist/cli/main.js.map +0 -1
- package/dist/core/config.d.ts +0 -46
- package/dist/core/config.d.ts.map +0 -1
- package/dist/core/config.js +0 -222
- package/dist/core/config.js.map +0 -1
- package/dist/core/contractIndex.d.ts +0 -13
- package/dist/core/contractIndex.d.ts.map +0 -1
- package/dist/core/contractIndex.js +0 -66
- package/dist/core/contractIndex.js.map +0 -1
- package/dist/core/contracts.d.ts +0 -5
- package/dist/core/contracts.d.ts.map +0 -1
- package/dist/core/contracts.js +0 -42
- package/dist/core/contracts.js.map +0 -1
- package/dist/core/discovery.d.ts +0 -14
- package/dist/core/discovery.d.ts.map +0 -1
- package/dist/core/discovery.js +0 -55
- package/dist/core/discovery.js.map +0 -1
- package/dist/core/fs.d.ts +0 -6
- package/dist/core/fs.d.ts.map +0 -1
- package/dist/core/fs.js +0 -55
- package/dist/core/fs.js.map +0 -1
- package/dist/core/gherkin/parse.d.ts +0 -7
- package/dist/core/gherkin/parse.d.ts.map +0 -1
- package/dist/core/gherkin/parse.js +0 -25
- package/dist/core/gherkin/parse.js.map +0 -1
- package/dist/core/ids.d.ts +0 -6
- package/dist/core/ids.d.ts.map +0 -1
- package/dist/core/ids.js +0 -52
- package/dist/core/ids.js.map +0 -1
- package/dist/core/index.d.ts +0 -13
- package/dist/core/index.d.ts.map +0 -1
- package/dist/core/index.js +0 -13
- package/dist/core/index.js.map +0 -1
- package/dist/core/parse/adr.d.ts +0 -13
- package/dist/core/parse/adr.d.ts.map +0 -1
- package/dist/core/parse/adr.js +0 -33
- package/dist/core/parse/adr.js.map +0 -1
- package/dist/core/parse/gherkin.d.ts +0 -12
- package/dist/core/parse/gherkin.d.ts.map +0 -1
- package/dist/core/parse/gherkin.js +0 -22
- package/dist/core/parse/gherkin.js.map +0 -1
- package/dist/core/parse/markdown.d.ts +0 -14
- package/dist/core/parse/markdown.d.ts.map +0 -1
- package/dist/core/parse/markdown.js +0 -45
- package/dist/core/parse/markdown.js.map +0 -1
- package/dist/core/parse/spec.d.ts +0 -28
- package/dist/core/parse/spec.d.ts.map +0 -1
- package/dist/core/parse/spec.js +0 -80
- package/dist/core/parse/spec.js.map +0 -1
- package/dist/core/report.d.ts +0 -41
- package/dist/core/report.d.ts.map +0 -1
- package/dist/core/report.js +0 -260
- package/dist/core/report.js.map +0 -1
- package/dist/core/scenarioModel.d.ts +0 -33
- package/dist/core/scenarioModel.d.ts.map +0 -1
- package/dist/core/scenarioModel.js +0 -130
- package/dist/core/scenarioModel.js.map +0 -1
- package/dist/core/specLayout.d.ts +0 -8
- package/dist/core/specLayout.d.ts.map +0 -1
- package/dist/core/specLayout.js +0 -36
- package/dist/core/specLayout.js.map +0 -1
- package/dist/core/traceability.d.ts +0 -12
- package/dist/core/traceability.d.ts.map +0 -1
- package/dist/core/traceability.js +0 -70
- package/dist/core/traceability.js.map +0 -1
- package/dist/core/types.d.ts +0 -25
- package/dist/core/types.d.ts.map +0 -1
- package/dist/core/types.js +0 -2
- package/dist/core/types.js.map +0 -1
- package/dist/core/validate.d.ts +0 -4
- package/dist/core/validate.d.ts.map +0 -1
- package/dist/core/validate.js +0 -34
- package/dist/core/validate.js.map +0 -1
- package/dist/core/validators/contracts.d.ts +0 -5
- package/dist/core/validators/contracts.d.ts.map +0 -1
- package/dist/core/validators/contracts.js +0 -162
- package/dist/core/validators/contracts.js.map +0 -1
- package/dist/core/validators/delta.d.ts +0 -4
- package/dist/core/validators/delta.d.ts.map +0 -1
- package/dist/core/validators/delta.js +0 -68
- package/dist/core/validators/delta.js.map +0 -1
- package/dist/core/validators/ids.d.ts +0 -4
- package/dist/core/validators/ids.d.ts.map +0 -1
- package/dist/core/validators/ids.js +0 -88
- package/dist/core/validators/ids.js.map +0 -1
- package/dist/core/validators/scenario.d.ts +0 -5
- package/dist/core/validators/scenario.d.ts.map +0 -1
- package/dist/core/validators/scenario.js +0 -140
- package/dist/core/validators/scenario.js.map +0 -1
- package/dist/core/validators/spec.d.ts +0 -5
- package/dist/core/validators/spec.d.ts.map +0 -1
- package/dist/core/validators/spec.js +0 -94
- package/dist/core/validators/spec.js.map +0 -1
- package/dist/core/validators/traceability.d.ts +0 -4
- package/dist/core/validators/traceability.d.ts.map +0 -1
- package/dist/core/validators/traceability.js +0 -190
- package/dist/core/validators/traceability.js.map +0 -1
- package/dist/core/version.d.ts +0 -2
- package/dist/core/version.d.ts.map +0 -1
- package/dist/core/version.js +0 -25
- package/dist/core/version.js.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/index.js +0 -2
- package/dist/index.js.map +0 -1
- package/dist/tsconfig.tsbuildinfo +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
type ScCoverage = {
|
|
2
|
+
total: number;
|
|
3
|
+
covered: number;
|
|
4
|
+
missing: number;
|
|
5
|
+
missingIds: string[];
|
|
6
|
+
refs: Record<string, string[]>;
|
|
7
|
+
};
|
|
8
|
+
type TestFileScan = {
|
|
9
|
+
globs: string[];
|
|
10
|
+
excludeGlobs: string[];
|
|
11
|
+
matchedFileCount: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
1
14
|
type IssueSeverity = "info" | "warning" | "error";
|
|
2
15
|
type IssueLocation = {
|
|
3
16
|
line: number;
|
|
@@ -17,10 +30,15 @@ type ValidationCounts = {
|
|
|
17
30
|
warning: number;
|
|
18
31
|
error: number;
|
|
19
32
|
};
|
|
33
|
+
type ValidationTraceability = {
|
|
34
|
+
sc: ScCoverage;
|
|
35
|
+
testFiles: TestFileScan;
|
|
36
|
+
};
|
|
20
37
|
type ValidationResult = {
|
|
21
38
|
toolVersion: string;
|
|
22
39
|
issues: Issue[];
|
|
23
40
|
counts: ValidationCounts;
|
|
41
|
+
traceability?: ValidationTraceability;
|
|
24
42
|
};
|
|
25
43
|
|
|
26
44
|
type FailOn = "never" | "warning" | "error";
|
|
@@ -44,6 +62,8 @@ type QfaiValidationConfig = {
|
|
|
44
62
|
brMustHaveSc: boolean;
|
|
45
63
|
scMustTouchContracts: boolean;
|
|
46
64
|
scMustHaveTest: boolean;
|
|
65
|
+
testFileGlobs: string[];
|
|
66
|
+
testFileExcludeGlobs: string[];
|
|
47
67
|
scNoTestSeverity: TraceabilitySeverity;
|
|
48
68
|
allowOrphanContracts: boolean;
|
|
49
69
|
unknownContractIdSeverity: TraceabilitySeverity;
|
|
@@ -74,14 +94,6 @@ declare function extractIds(text: string, prefix: IdPrefix): string[];
|
|
|
74
94
|
declare function extractAllIds(text: string): string[];
|
|
75
95
|
declare function extractInvalidIds(text: string, prefixes: IdFormatPrefix[]): string[];
|
|
76
96
|
|
|
77
|
-
type ScCoverage = {
|
|
78
|
-
total: number;
|
|
79
|
-
covered: number;
|
|
80
|
-
missing: number;
|
|
81
|
-
missingIds: string[];
|
|
82
|
-
refs: Record<string, string[]>;
|
|
83
|
-
};
|
|
84
|
-
|
|
85
97
|
type ReportSummary = {
|
|
86
98
|
specs: number;
|
|
87
99
|
scenarios: number;
|
|
@@ -104,6 +116,8 @@ type ReportTraceability = {
|
|
|
104
116
|
upstreamIdsFound: number;
|
|
105
117
|
referencedInCodeOrTests: boolean;
|
|
106
118
|
sc: ScCoverage;
|
|
119
|
+
scSources: Record<string, string[]>;
|
|
120
|
+
testFiles: TestFileScan;
|
|
107
121
|
};
|
|
108
122
|
type ReportData = {
|
|
109
123
|
tool: "qfai";
|
|
@@ -139,4 +153,4 @@ declare function validateSpecContent(text: string, file: string, requiredSection
|
|
|
139
153
|
|
|
140
154
|
declare function validateTraceability(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
141
155
|
|
|
142
|
-
export { type ConfigLoadResult, type ConfigPathKey, type FailOn, type IdFormatPrefix, type IdPrefix, type Issue, type IssueLocation, type IssueSeverity, type OutputFormat, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiValidationConfig, type ReportData, type ReportIds, type ReportSummary, type ReportTraceability, type TraceabilitySeverity, type ValidationCounts, type ValidationResult, createReportData, defaultConfig, extractAllIds, extractIds, extractInvalidIds, formatReportJson, formatReportMarkdown, getConfigPath, lintSql, loadConfig, resolvePath, resolveToolVersion, validateContracts, validateDefinedIds, validateDeltas, validateProject, validateScenarioContent, validateScenarios, validateSpecContent, validateSpecs, validateTraceability };
|
|
156
|
+
export { type ConfigLoadResult, type ConfigPathKey, type FailOn, type IdFormatPrefix, type IdPrefix, type Issue, type IssueLocation, type IssueSeverity, type OutputFormat, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiValidationConfig, type ReportData, type ReportIds, type ReportSummary, type ReportTraceability, type TraceabilitySeverity, type ValidationCounts, type ValidationResult, type ValidationTraceability, createReportData, defaultConfig, extractAllIds, extractIds, extractInvalidIds, formatReportJson, formatReportMarkdown, getConfigPath, lintSql, loadConfig, resolvePath, resolveToolVersion, validateContracts, validateDefinedIds, validateDeltas, validateProject, validateScenarioContent, validateScenarios, validateSpecContent, validateSpecs, validateTraceability };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,156 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
type ScCoverage = {
|
|
2
|
+
total: number;
|
|
3
|
+
covered: number;
|
|
4
|
+
missing: number;
|
|
5
|
+
missingIds: string[];
|
|
6
|
+
refs: Record<string, string[]>;
|
|
7
|
+
};
|
|
8
|
+
type TestFileScan = {
|
|
9
|
+
globs: string[];
|
|
10
|
+
excludeGlobs: string[];
|
|
11
|
+
matchedFileCount: number;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
type IssueSeverity = "info" | "warning" | "error";
|
|
15
|
+
type IssueLocation = {
|
|
16
|
+
line: number;
|
|
17
|
+
column?: number;
|
|
18
|
+
};
|
|
19
|
+
type Issue = {
|
|
20
|
+
code: string;
|
|
21
|
+
severity: IssueSeverity;
|
|
22
|
+
message: string;
|
|
23
|
+
file?: string;
|
|
24
|
+
refs?: string[];
|
|
25
|
+
rule?: string;
|
|
26
|
+
loc?: IssueLocation;
|
|
27
|
+
};
|
|
28
|
+
type ValidationCounts = {
|
|
29
|
+
info: number;
|
|
30
|
+
warning: number;
|
|
31
|
+
error: number;
|
|
32
|
+
};
|
|
33
|
+
type ValidationTraceability = {
|
|
34
|
+
sc: ScCoverage;
|
|
35
|
+
testFiles: TestFileScan;
|
|
36
|
+
};
|
|
37
|
+
type ValidationResult = {
|
|
38
|
+
toolVersion: string;
|
|
39
|
+
issues: Issue[];
|
|
40
|
+
counts: ValidationCounts;
|
|
41
|
+
traceability?: ValidationTraceability;
|
|
42
|
+
};
|
|
43
|
+
|
|
44
|
+
type FailOn = "never" | "warning" | "error";
|
|
45
|
+
type OutputFormat = "text" | "github";
|
|
46
|
+
type TraceabilitySeverity = "warning" | "error";
|
|
47
|
+
type QfaiPaths = {
|
|
48
|
+
contractsDir: string;
|
|
49
|
+
specsDir: string;
|
|
50
|
+
rulesDir: string;
|
|
51
|
+
outDir: string;
|
|
52
|
+
promptsDir: string;
|
|
53
|
+
srcDir: string;
|
|
54
|
+
testsDir: string;
|
|
55
|
+
};
|
|
56
|
+
type QfaiValidationConfig = {
|
|
57
|
+
failOn: FailOn;
|
|
58
|
+
require: {
|
|
59
|
+
specSections: string[];
|
|
60
|
+
};
|
|
61
|
+
traceability: {
|
|
62
|
+
brMustHaveSc: boolean;
|
|
63
|
+
scMustTouchContracts: boolean;
|
|
64
|
+
scMustHaveTest: boolean;
|
|
65
|
+
testFileGlobs: string[];
|
|
66
|
+
testFileExcludeGlobs: string[];
|
|
67
|
+
scNoTestSeverity: TraceabilitySeverity;
|
|
68
|
+
allowOrphanContracts: boolean;
|
|
69
|
+
unknownContractIdSeverity: TraceabilitySeverity;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
type QfaiOutputConfig = {
|
|
73
|
+
validateJsonPath: string;
|
|
74
|
+
};
|
|
75
|
+
type QfaiConfig = {
|
|
76
|
+
paths: QfaiPaths;
|
|
77
|
+
validation: QfaiValidationConfig;
|
|
78
|
+
output: QfaiOutputConfig;
|
|
79
|
+
};
|
|
80
|
+
type ConfigPathKey = keyof QfaiPaths;
|
|
81
|
+
type ConfigLoadResult = {
|
|
82
|
+
config: QfaiConfig;
|
|
83
|
+
issues: Issue[];
|
|
84
|
+
configPath: string;
|
|
85
|
+
};
|
|
86
|
+
declare const defaultConfig: QfaiConfig;
|
|
87
|
+
declare function getConfigPath(root: string): string;
|
|
88
|
+
declare function loadConfig(root: string): Promise<ConfigLoadResult>;
|
|
89
|
+
declare function resolvePath(root: string, config: QfaiConfig, key: ConfigPathKey): string;
|
|
90
|
+
|
|
91
|
+
type IdPrefix = "SPEC" | "BR" | "SC" | "UI" | "API" | "DATA";
|
|
92
|
+
type IdFormatPrefix = IdPrefix | "ADR";
|
|
93
|
+
declare function extractIds(text: string, prefix: IdPrefix): string[];
|
|
94
|
+
declare function extractAllIds(text: string): string[];
|
|
95
|
+
declare function extractInvalidIds(text: string, prefixes: IdFormatPrefix[]): string[];
|
|
96
|
+
|
|
97
|
+
type ReportSummary = {
|
|
98
|
+
specs: number;
|
|
99
|
+
scenarios: number;
|
|
100
|
+
contracts: {
|
|
101
|
+
api: number;
|
|
102
|
+
ui: number;
|
|
103
|
+
db: number;
|
|
104
|
+
};
|
|
105
|
+
counts: ValidationCounts;
|
|
106
|
+
};
|
|
107
|
+
type ReportIds = {
|
|
108
|
+
spec: string[];
|
|
109
|
+
br: string[];
|
|
110
|
+
sc: string[];
|
|
111
|
+
ui: string[];
|
|
112
|
+
api: string[];
|
|
113
|
+
data: string[];
|
|
114
|
+
};
|
|
115
|
+
type ReportTraceability = {
|
|
116
|
+
upstreamIdsFound: number;
|
|
117
|
+
referencedInCodeOrTests: boolean;
|
|
118
|
+
sc: ScCoverage;
|
|
119
|
+
scSources: Record<string, string[]>;
|
|
120
|
+
testFiles: TestFileScan;
|
|
121
|
+
};
|
|
122
|
+
type ReportData = {
|
|
123
|
+
tool: "qfai";
|
|
124
|
+
version: string;
|
|
125
|
+
generatedAt: string;
|
|
126
|
+
root: string;
|
|
127
|
+
configPath: string;
|
|
128
|
+
summary: ReportSummary;
|
|
129
|
+
ids: ReportIds;
|
|
130
|
+
traceability: ReportTraceability;
|
|
131
|
+
issues: Issue[];
|
|
132
|
+
};
|
|
133
|
+
declare function createReportData(root: string, validation?: ValidationResult, configResult?: ConfigLoadResult): Promise<ReportData>;
|
|
134
|
+
declare function formatReportMarkdown(data: ReportData): string;
|
|
135
|
+
declare function formatReportJson(data: ReportData): string;
|
|
136
|
+
|
|
137
|
+
declare function validateProject(root: string, configResult?: ConfigLoadResult): Promise<ValidationResult>;
|
|
138
|
+
|
|
139
|
+
declare function resolveToolVersion(): Promise<string>;
|
|
140
|
+
|
|
141
|
+
declare function validateContracts(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
142
|
+
declare function lintSql(text: string, file: string): Issue[];
|
|
143
|
+
|
|
144
|
+
declare function validateDeltas(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
145
|
+
|
|
146
|
+
declare function validateDefinedIds(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
147
|
+
|
|
148
|
+
declare function validateScenarios(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
149
|
+
declare function validateScenarioContent(text: string, file: string): Issue[];
|
|
150
|
+
|
|
151
|
+
declare function validateSpecs(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
152
|
+
declare function validateSpecContent(text: string, file: string, requiredSections: string[]): Issue[];
|
|
153
|
+
|
|
154
|
+
declare function validateTraceability(root: string, config: QfaiConfig): Promise<Issue[]>;
|
|
155
|
+
|
|
156
|
+
export { type ConfigLoadResult, type ConfigPathKey, type FailOn, type IdFormatPrefix, type IdPrefix, type Issue, type IssueLocation, type IssueSeverity, type OutputFormat, type QfaiConfig, type QfaiOutputConfig, type QfaiPaths, type QfaiValidationConfig, type ReportData, type ReportIds, type ReportSummary, type ReportTraceability, type TraceabilitySeverity, type ValidationCounts, type ValidationResult, type ValidationTraceability, createReportData, defaultConfig, extractAllIds, extractIds, extractInvalidIds, formatReportJson, formatReportMarkdown, getConfigPath, lintSql, loadConfig, resolvePath, resolveToolVersion, validateContracts, validateDefinedIds, validateDeltas, validateProject, validateScenarioContent, validateScenarios, validateSpecContent, validateSpecs, validateTraceability };
|