@provartesting/provardx-cli 1.5.0 → 1.5.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/lib/mcp/docs/PROVAR_TOOL_GUIDE.md +18 -6
- package/lib/mcp/prompts/guidePrompts.js +21 -11
- package/lib/mcp/prompts/guidePrompts.js.map +1 -1
- package/lib/mcp/server.d.ts +1 -0
- package/lib/mcp/server.js +89 -21
- package/lib/mcp/server.js.map +1 -1
- package/lib/mcp/tools/antTools.js +60 -38
- package/lib/mcp/tools/antTools.js.map +1 -1
- package/lib/mcp/tools/automationTools.js +22 -21
- package/lib/mcp/tools/automationTools.js.map +1 -1
- package/lib/mcp/tools/connectionTools.js +100 -30
- package/lib/mcp/tools/connectionTools.js.map +1 -1
- package/lib/mcp/tools/defectTools.js +12 -7
- package/lib/mcp/tools/defectTools.js.map +1 -1
- package/lib/mcp/tools/descHelper.d.ts +5 -0
- package/lib/mcp/tools/descHelper.js +14 -0
- package/lib/mcp/tools/descHelper.js.map +1 -0
- package/lib/mcp/tools/nitroXTools.js +72 -32
- package/lib/mcp/tools/nitroXTools.js.map +1 -1
- package/lib/mcp/tools/pageObjectGenerate.js +33 -15
- package/lib/mcp/tools/pageObjectGenerate.js.map +1 -1
- package/lib/mcp/tools/pageObjectValidate.js +11 -4
- package/lib/mcp/tools/pageObjectValidate.js.map +1 -1
- package/lib/mcp/tools/projectInspect.js +31 -5
- package/lib/mcp/tools/projectInspect.js.map +1 -1
- package/lib/mcp/tools/projectValidateFromPath.js +128 -22
- package/lib/mcp/tools/projectValidateFromPath.js.map +1 -1
- package/lib/mcp/tools/propertiesTools.js +43 -17
- package/lib/mcp/tools/propertiesTools.js.map +1 -1
- package/lib/mcp/tools/qualityHubApiTools.js +8 -7
- package/lib/mcp/tools/qualityHubApiTools.js.map +1 -1
- package/lib/mcp/tools/qualityHubTools.js +108 -37
- package/lib/mcp/tools/qualityHubTools.js.map +1 -1
- package/lib/mcp/tools/rcaTools.js +18 -13
- package/lib/mcp/tools/rcaTools.js.map +1 -1
- package/lib/mcp/tools/testCaseGenerate.js +71 -12
- package/lib/mcp/tools/testCaseGenerate.js.map +1 -1
- package/lib/mcp/tools/testCaseStepTools.js +27 -9
- package/lib/mcp/tools/testCaseStepTools.js.map +1 -1
- package/lib/mcp/tools/testCaseValidate.js +136 -57
- package/lib/mcp/tools/testCaseValidate.js.map +1 -1
- package/lib/mcp/tools/testPlanTools.js +43 -26
- package/lib/mcp/tools/testPlanTools.js.map +1 -1
- package/lib/mcp/tools/testPlanValidate.js +64 -11
- package/lib/mcp/tools/testPlanValidate.js.map +1 -1
- package/lib/mcp/tools/testSuiteValidate.js +99 -10
- package/lib/mcp/tools/testSuiteValidate.js.map +1 -1
- package/lib/mcp/utils/detailLevel.d.ts +9 -0
- package/lib/mcp/utils/detailLevel.js +20 -0
- package/lib/mcp/utils/detailLevel.js.map +1 -0
- package/lib/mcp/utils/fieldMask.d.ts +17 -0
- package/lib/mcp/utils/fieldMask.js +75 -0
- package/lib/mcp/utils/fieldMask.js.map +1 -0
- package/lib/mcp/utils/tokenMeta.d.ts +40 -0
- package/lib/mcp/utils/tokenMeta.js +90 -0
- package/lib/mcp/utils/tokenMeta.js.map +1 -0
- package/lib/mcp/utils/validationDiff.d.ts +57 -0
- package/lib/mcp/utils/validationDiff.js +191 -0
- package/lib/mcp/utils/validationDiff.js.map +1 -0
- package/lib/mcp/utils/validationScore.d.ts +15 -0
- package/lib/mcp/utils/validationScore.js +31 -0
- package/lib/mcp/utils/validationScore.js.map +1 -0
- package/oclif.manifest.json +1 -1
- package/package.json +13 -1
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
export type DiffableViolation = Record<string, unknown>;
|
|
2
|
+
export interface DiffResult {
|
|
3
|
+
added: DiffableViolation[];
|
|
4
|
+
resolved: DiffableViolation[];
|
|
5
|
+
unchanged_count: number;
|
|
6
|
+
run_id: string;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Compute a stable 8-char context hash for a tool + context pair. Used to
|
|
10
|
+
* scope baseline run lookups so that a run_id from context A cannot be diffed
|
|
11
|
+
* against context B (different project, different suite, different file).
|
|
12
|
+
*/
|
|
13
|
+
export declare function computeContextHash(toolTag: string, context: string): string;
|
|
14
|
+
/**
|
|
15
|
+
* Resolve the validation storage root for a given tool subdir. Honors the
|
|
16
|
+
* PROVAR_MCP_VALIDATION_DIR env var when set; otherwise falls back to
|
|
17
|
+
* `~/.provardx/validation/<subdir>`. The env override is useful for restricted
|
|
18
|
+
* CI/dev environments where the home directory is read-only or shared.
|
|
19
|
+
*/
|
|
20
|
+
export declare function resolveValidationDir(subdir: string): string;
|
|
21
|
+
/** Generate a run ID from a context string (e.g. project path or suite name). */
|
|
22
|
+
export declare function generateRunId(context: string): string;
|
|
23
|
+
/**
|
|
24
|
+
* Check whether any prior runs exist in the given storage directory.
|
|
25
|
+
* Used by calcNextAction to determine the first-run heuristic.
|
|
26
|
+
*/
|
|
27
|
+
export declare function hasAnyRun(storageDir: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Save the current violations as a new run in the storage directory.
|
|
30
|
+
* Caps the index at MAX_RUNS by evicting the oldest entry when full.
|
|
31
|
+
* Returns the generated run_id.
|
|
32
|
+
*
|
|
33
|
+
* When `contextHash` is provided, it is recorded alongside the run so that
|
|
34
|
+
* `loadBaselineViolations` can reject a baseline_run_id whose context does
|
|
35
|
+
* not match the calling context (prevents cross-context diffs).
|
|
36
|
+
*/
|
|
37
|
+
export declare function saveRun(storageDir: string, runId: string, violations: DiffableViolation[], contextHash?: string): string;
|
|
38
|
+
/**
|
|
39
|
+
* Load the violations array for a given baseline run ID.
|
|
40
|
+
* Returns null if the run is not found in the index (BASELINE_NOT_FOUND).
|
|
41
|
+
* The filename is looked up from the index only — the run_id itself is never
|
|
42
|
+
* used to construct a file path, preventing path traversal.
|
|
43
|
+
*
|
|
44
|
+
* When `expectedContextHash` is provided, the record's `context_hash` must
|
|
45
|
+
* match. Records without a `context_hash` (written by older versions before
|
|
46
|
+
* H3) are treated as a mismatch and are effectively retired within one or
|
|
47
|
+
* two new runs as the FIFO cap evicts them. This guard prevents diffing a
|
|
48
|
+
* baseline from a different file/suite/project against the current context.
|
|
49
|
+
*/
|
|
50
|
+
export declare function loadBaselineViolations(storageDir: string, baselineRunId: string, expectedContextHash?: string): DiffableViolation[] | null;
|
|
51
|
+
/**
|
|
52
|
+
* Compute the diff between a baseline and current violations array.
|
|
53
|
+
* Uses (rule_id + applies_to + full message) as the unique key.
|
|
54
|
+
* Duplicate violations (same key, multiple occurrences) are treated as
|
|
55
|
+
* distinct entries — each occurrence is counted separately (multiset semantics).
|
|
56
|
+
*/
|
|
57
|
+
export declare function computeDiff(baseline: DiffableViolation[], current: DiffableViolation[]): Omit<DiffResult, 'run_id'>;
|
|
@@ -0,0 +1,191 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Provar Limited.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
/* eslint-disable camelcase */
|
|
8
|
+
import fs from 'node:fs';
|
|
9
|
+
import os from 'node:os';
|
|
10
|
+
import path from 'node:path';
|
|
11
|
+
import { createHash } from 'node:crypto';
|
|
12
|
+
const MAX_RUNS = 20;
|
|
13
|
+
const INDEX_FILE = '.runs.json';
|
|
14
|
+
const DEFAULT_ROOT_NAME = '.provardx';
|
|
15
|
+
const VALIDATION_SUBDIR = 'validation';
|
|
16
|
+
// ── Helpers ───────────────────────────────────────────────────────────────────
|
|
17
|
+
/** Stable 8-char hash of a string for use in run IDs. */
|
|
18
|
+
function shortHash(input) {
|
|
19
|
+
return createHash('sha1').update(input).digest('hex').slice(0, 8);
|
|
20
|
+
}
|
|
21
|
+
/** Build a unique key for a violation so additions/resolutions can be detected. */
|
|
22
|
+
function violationKey(v) {
|
|
23
|
+
const rule_id = String(v['rule_id'] ?? '');
|
|
24
|
+
const applies_to = Array.isArray(v['applies_to'])
|
|
25
|
+
? v['applies_to'].join(',')
|
|
26
|
+
: String(v['applies_to'] ?? '');
|
|
27
|
+
const message = String(v['message'] ?? '');
|
|
28
|
+
return `${rule_id}||${applies_to}||${message}`;
|
|
29
|
+
}
|
|
30
|
+
function loadIndex(storageDir) {
|
|
31
|
+
const indexPath = path.join(storageDir, INDEX_FILE);
|
|
32
|
+
try {
|
|
33
|
+
return JSON.parse(fs.readFileSync(indexPath, 'utf-8'));
|
|
34
|
+
}
|
|
35
|
+
catch {
|
|
36
|
+
return { runs: [] };
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
function saveIndex(storageDir, index) {
|
|
40
|
+
const indexPath = path.join(storageDir, INDEX_FILE);
|
|
41
|
+
fs.writeFileSync(indexPath, JSON.stringify(index, null, 2), 'utf-8');
|
|
42
|
+
}
|
|
43
|
+
// ── Public API ────────────────────────────────────────────────────────────────
|
|
44
|
+
/**
|
|
45
|
+
* Compute a stable 8-char context hash for a tool + context pair. Used to
|
|
46
|
+
* scope baseline run lookups so that a run_id from context A cannot be diffed
|
|
47
|
+
* against context B (different project, different suite, different file).
|
|
48
|
+
*/
|
|
49
|
+
export function computeContextHash(toolTag, context) {
|
|
50
|
+
return shortHash(`${toolTag}|${context}`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve the validation storage root for a given tool subdir. Honors the
|
|
54
|
+
* PROVAR_MCP_VALIDATION_DIR env var when set; otherwise falls back to
|
|
55
|
+
* `~/.provardx/validation/<subdir>`. The env override is useful for restricted
|
|
56
|
+
* CI/dev environments where the home directory is read-only or shared.
|
|
57
|
+
*/
|
|
58
|
+
export function resolveValidationDir(subdir) {
|
|
59
|
+
const override = process.env['PROVAR_MCP_VALIDATION_DIR']?.trim();
|
|
60
|
+
if (override)
|
|
61
|
+
return path.join(override, subdir);
|
|
62
|
+
return path.join(os.homedir(), DEFAULT_ROOT_NAME, VALIDATION_SUBDIR, subdir);
|
|
63
|
+
}
|
|
64
|
+
/** Generate a run ID from a context string (e.g. project path or suite name). */
|
|
65
|
+
export function generateRunId(context) {
|
|
66
|
+
const rand = Math.random().toString(36).slice(2, 6);
|
|
67
|
+
return `${Date.now()}-${shortHash(context)}-${rand}`;
|
|
68
|
+
}
|
|
69
|
+
/**
|
|
70
|
+
* Check whether any prior runs exist in the given storage directory.
|
|
71
|
+
* Used by calcNextAction to determine the first-run heuristic.
|
|
72
|
+
*/
|
|
73
|
+
export function hasAnyRun(storageDir) {
|
|
74
|
+
const index = loadIndex(storageDir);
|
|
75
|
+
return index.runs.length > 0;
|
|
76
|
+
}
|
|
77
|
+
/**
|
|
78
|
+
* Save the current violations as a new run in the storage directory.
|
|
79
|
+
* Caps the index at MAX_RUNS by evicting the oldest entry when full.
|
|
80
|
+
* Returns the generated run_id.
|
|
81
|
+
*
|
|
82
|
+
* When `contextHash` is provided, it is recorded alongside the run so that
|
|
83
|
+
* `loadBaselineViolations` can reject a baseline_run_id whose context does
|
|
84
|
+
* not match the calling context (prevents cross-context diffs).
|
|
85
|
+
*/
|
|
86
|
+
export function saveRun(storageDir, runId, violations, contextHash) {
|
|
87
|
+
fs.mkdirSync(storageDir, { recursive: true });
|
|
88
|
+
const filename = `${runId}.json`;
|
|
89
|
+
fs.writeFileSync(path.join(storageDir, filename), JSON.stringify(violations), 'utf-8');
|
|
90
|
+
const index = loadIndex(storageDir);
|
|
91
|
+
index.runs.push({
|
|
92
|
+
run_id: runId,
|
|
93
|
+
timestamp: Date.now(),
|
|
94
|
+
filename,
|
|
95
|
+
...(contextHash ? { context_hash: contextHash } : {}),
|
|
96
|
+
});
|
|
97
|
+
// Evict oldest entries when over the cap
|
|
98
|
+
while (index.runs.length > MAX_RUNS) {
|
|
99
|
+
const evicted = index.runs.shift();
|
|
100
|
+
if (evicted) {
|
|
101
|
+
try {
|
|
102
|
+
fs.unlinkSync(path.join(storageDir, evicted.filename));
|
|
103
|
+
}
|
|
104
|
+
catch {
|
|
105
|
+
/* best-effort eviction */
|
|
106
|
+
}
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
saveIndex(storageDir, index);
|
|
110
|
+
return runId;
|
|
111
|
+
}
|
|
112
|
+
/**
|
|
113
|
+
* Load the violations array for a given baseline run ID.
|
|
114
|
+
* Returns null if the run is not found in the index (BASELINE_NOT_FOUND).
|
|
115
|
+
* The filename is looked up from the index only — the run_id itself is never
|
|
116
|
+
* used to construct a file path, preventing path traversal.
|
|
117
|
+
*
|
|
118
|
+
* When `expectedContextHash` is provided, the record's `context_hash` must
|
|
119
|
+
* match. Records without a `context_hash` (written by older versions before
|
|
120
|
+
* H3) are treated as a mismatch and are effectively retired within one or
|
|
121
|
+
* two new runs as the FIFO cap evicts them. This guard prevents diffing a
|
|
122
|
+
* baseline from a different file/suite/project against the current context.
|
|
123
|
+
*/
|
|
124
|
+
export function loadBaselineViolations(storageDir, baselineRunId, expectedContextHash) {
|
|
125
|
+
const index = loadIndex(storageDir);
|
|
126
|
+
const record = index.runs.find((r) => r.run_id === baselineRunId);
|
|
127
|
+
if (!record)
|
|
128
|
+
return null;
|
|
129
|
+
if (expectedContextHash !== undefined && record.context_hash !== expectedContextHash) {
|
|
130
|
+
return null;
|
|
131
|
+
}
|
|
132
|
+
// Use the filename from the index, not the run_id
|
|
133
|
+
try {
|
|
134
|
+
const content = fs.readFileSync(path.join(storageDir, record.filename), 'utf-8');
|
|
135
|
+
return JSON.parse(content);
|
|
136
|
+
}
|
|
137
|
+
catch {
|
|
138
|
+
return null;
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Compute the diff between a baseline and current violations array.
|
|
143
|
+
* Uses (rule_id + applies_to + full message) as the unique key.
|
|
144
|
+
* Duplicate violations (same key, multiple occurrences) are treated as
|
|
145
|
+
* distinct entries — each occurrence is counted separately (multiset semantics).
|
|
146
|
+
*/
|
|
147
|
+
export function computeDiff(baseline, current) {
|
|
148
|
+
// Build multiset counts keyed by violation identity
|
|
149
|
+
const baselineCounts = new Map();
|
|
150
|
+
for (const v of baseline) {
|
|
151
|
+
const key = violationKey(v);
|
|
152
|
+
const entry = baselineCounts.get(key);
|
|
153
|
+
if (entry) {
|
|
154
|
+
entry.count++;
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
baselineCounts.set(key, { count: 1, sample: v });
|
|
158
|
+
}
|
|
159
|
+
}
|
|
160
|
+
const currentCounts = new Map();
|
|
161
|
+
for (const v of current) {
|
|
162
|
+
const key = violationKey(v);
|
|
163
|
+
const entry = currentCounts.get(key);
|
|
164
|
+
if (entry) {
|
|
165
|
+
entry.count++;
|
|
166
|
+
}
|
|
167
|
+
else {
|
|
168
|
+
currentCounts.set(key, { count: 1, sample: v });
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
const added = [];
|
|
172
|
+
const resolved = [];
|
|
173
|
+
let unchanged_count = 0;
|
|
174
|
+
// Tally additions: occurrences in current that exceed baseline count
|
|
175
|
+
for (const [key, { count: curr, sample }] of currentCounts) {
|
|
176
|
+
const base = baselineCounts.get(key)?.count ?? 0;
|
|
177
|
+
unchanged_count += Math.min(base, curr);
|
|
178
|
+
const addedCount = curr - base;
|
|
179
|
+
for (let i = 0; i < addedCount; i++)
|
|
180
|
+
added.push(sample);
|
|
181
|
+
}
|
|
182
|
+
// Tally resolutions: occurrences in baseline that exceed current count
|
|
183
|
+
for (const [key, { count: base, sample }] of baselineCounts) {
|
|
184
|
+
const curr = currentCounts.get(key)?.count ?? 0;
|
|
185
|
+
const resolvedCount = base - Math.min(base, curr);
|
|
186
|
+
for (let i = 0; i < resolvedCount; i++)
|
|
187
|
+
resolved.push(sample);
|
|
188
|
+
}
|
|
189
|
+
return { added, resolved, unchanged_count };
|
|
190
|
+
}
|
|
191
|
+
//# sourceMappingURL=validationDiff.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file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AE,EAAE,KAAK,EAAE,IAAI,EAAE,MAAM,EAAE,CAAC,IAAI,cAAc,EAAE,CAAC;QAC5D,MAAM,IAAI,GAAG,aAAa,CAAC,GAAG,CAAC,GAAG,CAAC,EAAE,KAAK,IAAI,CAAC,CAAC;QAChD,MAAM,aAAa,GAAG,IAAI,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,EAAE,IAAI,CAAC,CAAC;QAClD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,aAAa,EAAE,CAAC,EAAE;YAAE,QAAQ,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChE,CAAC;IAED,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,eAAe,EAAE,CAAC;AAC9C,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
export type NextAction = 'stop' | 'fix_and_revalidate' | 'inspect_failures';
|
|
2
|
+
/** Fraction of passing tests expressed as 0–100 integer. Returns 0 when total is 0. */
|
|
3
|
+
export declare function calcCompletenessScore(passing: number, total: number): number;
|
|
4
|
+
/**
|
|
5
|
+
* Recommend what the agent should do next based on the completeness score,
|
|
6
|
+
* remaining violation count, and whether any prior runs exist on disk.
|
|
7
|
+
*
|
|
8
|
+
* - `stop` → score is 100 AND no violations remain
|
|
9
|
+
* - `inspect_failures` → first run (no baseline on disk) — review what's failing before trying to fix
|
|
10
|
+
* - `fix_and_revalidate`→ subsequent run — agent knows the failure set, should fix and re-run
|
|
11
|
+
*
|
|
12
|
+
* The secondary `remainingViolationCount` check prevents `stop` from firing when all
|
|
13
|
+
* tests pass but quality or best-practice violations are still present.
|
|
14
|
+
*/
|
|
15
|
+
export declare function calcNextAction(score: number, hasBaseline: boolean, remainingViolationCount?: number): NextAction;
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* Copyright (c) 2024 Provar Limited.
|
|
3
|
+
* All rights reserved.
|
|
4
|
+
* Licensed under the BSD 3-Clause license.
|
|
5
|
+
* For full license text, see LICENSE.md file in the repo root or https://opensource.org/licenses/BSD-3-Clause
|
|
6
|
+
*/
|
|
7
|
+
/** Fraction of passing tests expressed as 0–100 integer. Returns 0 when total is 0. */
|
|
8
|
+
export function calcCompletenessScore(passing, total) {
|
|
9
|
+
if (total === 0)
|
|
10
|
+
return 0;
|
|
11
|
+
return Math.round((passing / total) * 100);
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Recommend what the agent should do next based on the completeness score,
|
|
15
|
+
* remaining violation count, and whether any prior runs exist on disk.
|
|
16
|
+
*
|
|
17
|
+
* - `stop` → score is 100 AND no violations remain
|
|
18
|
+
* - `inspect_failures` → first run (no baseline on disk) — review what's failing before trying to fix
|
|
19
|
+
* - `fix_and_revalidate`→ subsequent run — agent knows the failure set, should fix and re-run
|
|
20
|
+
*
|
|
21
|
+
* The secondary `remainingViolationCount` check prevents `stop` from firing when all
|
|
22
|
+
* tests pass but quality or best-practice violations are still present.
|
|
23
|
+
*/
|
|
24
|
+
export function calcNextAction(score, hasBaseline, remainingViolationCount = 0) {
|
|
25
|
+
if (score === 100 && remainingViolationCount === 0)
|
|
26
|
+
return 'stop';
|
|
27
|
+
if (!hasBaseline)
|
|
28
|
+
return 'inspect_failures';
|
|
29
|
+
return 'fix_and_revalidate';
|
|
30
|
+
}
|
|
31
|
+
//# sourceMappingURL=validationScore.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"validationScore.js","sourceRoot":"","sources":["../../../src/mcp/utils/validationScore.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAIH,uFAAuF;AACvF,MAAM,UAAU,qBAAqB,CAAC,OAAe,EAAE,KAAa;IAClE,IAAI,KAAK,KAAK,CAAC;QAAE,OAAO,CAAC,CAAC;IAC1B,OAAO,IAAI,CAAC,KAAK,CAAC,CAAC,OAAO,GAAG,KAAK,CAAC,GAAG,GAAG,CAAC,CAAC;AAC7C,CAAC;AAED;;;;;;;;;;GAUG;AACH,MAAM,UAAU,cAAc,CAAC,KAAa,EAAE,WAAoB,EAAE,uBAAuB,GAAG,CAAC;IAC7F,IAAI,KAAK,KAAK,GAAG,IAAI,uBAAuB,KAAK,CAAC;QAAE,OAAO,MAAM,CAAC;IAClE,IAAI,CAAC,WAAW;QAAE,OAAO,kBAAkB,CAAC;IAC5C,OAAO,oBAAoB,CAAC;AAC9B,CAAC"}
|
package/oclif.manifest.json
CHANGED
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@provartesting/provardx-cli",
|
|
3
3
|
"description": "A plugin for the Salesforce CLI to orchestrate testing activities and report quality metrics to Provar Quality Hub",
|
|
4
|
-
"version": "1.5.
|
|
4
|
+
"version": "1.5.1",
|
|
5
5
|
"mcpName": "io.github.ProvarTesting/provar",
|
|
6
6
|
"license": "BSD-3-Clause",
|
|
7
7
|
"plugins": [
|
|
@@ -158,6 +158,7 @@
|
|
|
158
158
|
"src/mcp/rules/*.json",
|
|
159
159
|
"docs/NITROX_COMPONENT_CATALOG.md",
|
|
160
160
|
"docs/NITROX_CATALOG_SOURCE.json",
|
|
161
|
+
"docs/PROVAR_TOOL_GUIDE.md",
|
|
161
162
|
"**/tsconfig.json",
|
|
162
163
|
"messages/**"
|
|
163
164
|
],
|
|
@@ -180,6 +181,9 @@
|
|
|
180
181
|
},
|
|
181
182
|
"lint": {
|
|
182
183
|
"command": "eslint src test --color --cache --cache-location .eslintcache",
|
|
184
|
+
"dependencies": [
|
|
185
|
+
"lint:script-names"
|
|
186
|
+
],
|
|
183
187
|
"files": [
|
|
184
188
|
"src/**/*.ts",
|
|
185
189
|
"test/**/*.ts",
|
|
@@ -189,6 +193,14 @@
|
|
|
189
193
|
],
|
|
190
194
|
"output": []
|
|
191
195
|
},
|
|
196
|
+
"lint:script-names": {
|
|
197
|
+
"command": "node scripts/lint-script-names.cjs",
|
|
198
|
+
"files": [
|
|
199
|
+
"scripts/lint-script-names.cjs",
|
|
200
|
+
"scripts/**/*"
|
|
201
|
+
],
|
|
202
|
+
"output": []
|
|
203
|
+
},
|
|
192
204
|
"test:compile": {
|
|
193
205
|
"command": "tsc -p \"./test\" --pretty",
|
|
194
206
|
"files": [
|