@provartesting/provardx-cli 1.5.0-beta.1 → 1.5.0-beta.10

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.
Files changed (78) hide show
  1. package/README.md +137 -13
  2. package/lib/commands/provar/auth/clear.d.ts +7 -0
  3. package/lib/commands/provar/auth/clear.js +36 -0
  4. package/lib/commands/provar/auth/clear.js.map +1 -0
  5. package/lib/commands/provar/auth/login.d.ts +10 -0
  6. package/lib/commands/provar/auth/login.js +90 -0
  7. package/lib/commands/provar/auth/login.js.map +1 -0
  8. package/lib/commands/provar/auth/rotate.d.ts +7 -0
  9. package/lib/commands/provar/auth/rotate.js +42 -0
  10. package/lib/commands/provar/auth/rotate.js.map +1 -0
  11. package/lib/commands/provar/auth/status.d.ts +7 -0
  12. package/lib/commands/provar/auth/status.js +107 -0
  13. package/lib/commands/provar/auth/status.js.map +1 -0
  14. package/lib/mcp/docs/PROVAR_TEST_STEP_REFERENCE.md +1430 -0
  15. package/lib/mcp/licensing/licenseValidator.d.ts +3 -3
  16. package/lib/mcp/licensing/licenseValidator.js +4 -4
  17. package/lib/mcp/prompts/index.d.ts +2 -0
  18. package/lib/mcp/prompts/index.js +19 -0
  19. package/lib/mcp/prompts/index.js.map +1 -0
  20. package/lib/mcp/prompts/loopPrompts.d.ts +6 -0
  21. package/lib/mcp/prompts/loopPrompts.js +435 -0
  22. package/lib/mcp/prompts/loopPrompts.js.map +1 -0
  23. package/lib/mcp/prompts/migrationPrompts.d.ts +4 -0
  24. package/lib/mcp/prompts/migrationPrompts.js +207 -0
  25. package/lib/mcp/prompts/migrationPrompts.js.map +1 -0
  26. package/lib/mcp/rules/provar_best_practices_rules.json +256 -544
  27. package/lib/mcp/server.js +45 -1
  28. package/lib/mcp/server.js.map +1 -1
  29. package/lib/mcp/tools/antTools.d.ts +15 -0
  30. package/lib/mcp/tools/antTools.js +204 -50
  31. package/lib/mcp/tools/antTools.js.map +1 -1
  32. package/lib/mcp/tools/automationTools.d.ts +36 -3
  33. package/lib/mcp/tools/automationTools.js +335 -42
  34. package/lib/mcp/tools/automationTools.js.map +1 -1
  35. package/lib/mcp/tools/bestPracticesEngine.js +161 -23
  36. package/lib/mcp/tools/bestPracticesEngine.js.map +1 -1
  37. package/lib/mcp/tools/connectionTools.d.ts +4 -0
  38. package/lib/mcp/tools/connectionTools.js +168 -0
  39. package/lib/mcp/tools/connectionTools.js.map +1 -0
  40. package/lib/mcp/tools/nitroXTools.d.ts +22 -0
  41. package/lib/mcp/tools/nitroXTools.js +750 -0
  42. package/lib/mcp/tools/nitroXTools.js.map +1 -0
  43. package/lib/mcp/tools/pageObjectGenerate.js +103 -35
  44. package/lib/mcp/tools/pageObjectGenerate.js.map +1 -1
  45. package/lib/mcp/tools/propertiesTools.d.ts +2 -0
  46. package/lib/mcp/tools/propertiesTools.js +277 -39
  47. package/lib/mcp/tools/propertiesTools.js.map +1 -1
  48. package/lib/mcp/tools/qualityHubApiTools.d.ts +3 -0
  49. package/lib/mcp/tools/qualityHubApiTools.js +134 -0
  50. package/lib/mcp/tools/qualityHubApiTools.js.map +1 -0
  51. package/lib/mcp/tools/qualityHubTools.js +127 -19
  52. package/lib/mcp/tools/qualityHubTools.js.map +1 -1
  53. package/lib/mcp/tools/rcaTools.d.ts +3 -2
  54. package/lib/mcp/tools/rcaTools.js +145 -20
  55. package/lib/mcp/tools/rcaTools.js.map +1 -1
  56. package/lib/mcp/tools/testCaseGenerate.js +88 -59
  57. package/lib/mcp/tools/testCaseGenerate.js.map +1 -1
  58. package/lib/mcp/tools/testCaseStepTools.d.ts +4 -0
  59. package/lib/mcp/tools/testCaseStepTools.js +221 -0
  60. package/lib/mcp/tools/testCaseStepTools.js.map +1 -0
  61. package/lib/mcp/tools/testCaseValidate.d.ts +11 -0
  62. package/lib/mcp/tools/testCaseValidate.js +146 -19
  63. package/lib/mcp/tools/testCaseValidate.js.map +1 -1
  64. package/lib/services/auth/credentials.d.ts +21 -0
  65. package/lib/services/auth/credentials.js +75 -0
  66. package/lib/services/auth/credentials.js.map +1 -0
  67. package/lib/services/auth/loginFlow.d.ts +68 -0
  68. package/lib/services/auth/loginFlow.js +216 -0
  69. package/lib/services/auth/loginFlow.js.map +1 -0
  70. package/lib/services/qualityHub/client.d.ts +161 -0
  71. package/lib/services/qualityHub/client.js +226 -0
  72. package/lib/services/qualityHub/client.js.map +1 -0
  73. package/messages/sf.provar.auth.clear.md +16 -0
  74. package/messages/sf.provar.auth.login.md +31 -0
  75. package/messages/sf.provar.auth.rotate.md +23 -0
  76. package/messages/sf.provar.auth.status.md +16 -0
  77. package/oclif.manifest.json +214 -1
  78. package/package.json +8 -4
@@ -0,0 +1,207 @@
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
+ import { z } from 'zod';
8
+ // Source-framework context injected into each migration prompt.
9
+ // Lightweight: just enough to interpret the source. Format knowledge lives
10
+ // in the corpus (provar.qualityhub.examples.retrieve) and the validator
11
+ // (provar.testcase.validate) — not hardcoded here.
12
+ const CRT_CONTEXT = `
13
+ CRT (Copado Robotic Testing) is a keyword-driven framework built on Robot Framework.
14
+ Tests are authored in QEditor using QWords:
15
+ - ClickText <label> → click an element by visible label
16
+ - TypeText <field> <value> → type a value into a field
17
+ - VerifyText <text> → assert text is present on the page
18
+ - SelectDropdown <field> <val> → choose a picklist option
19
+ - OpenBrowser <url> → open a browser session (maps to Salesforce login)
20
+
21
+ Robot Framework sections: *** Keywords *** define reusable blocks; *** Test Cases *** are the test entries.
22
+ Suite Setup/Teardown → login at the start and cleanup at the end.
23
+ `.trim();
24
+ const SELENIUM_CONTEXT = `
25
+ Selenium WebDriver test patterns (Java/Python/JavaScript):
26
+ - driver.get(url) / navigate().to() → navigate to a URL (maps to Salesforce login)
27
+ - findElement(By.linkText/name).click() → click by visible label
28
+ - findElement(...).sendKeys(value) → type into a field
29
+ - Select.selectByVisibleText(val) → select a picklist option
30
+ - findElement(...).getText() + assertion → verify a field value
31
+ - WebDriverWait / ExpectedConditions → wait for element visibility
32
+ - @Before / setUp() → test setup including login
33
+ - @After / tearDown() → cleanup
34
+ `.trim();
35
+ const PLAYWRIGHT_CONTEXT = `
36
+ Playwright test patterns (TypeScript/JavaScript):
37
+ - page.goto(url) / login fixture → navigate to Salesforce (maps to login)
38
+ - getByLabel(label).click() → click by visible label
39
+ - getByRole('button', {name}).click() → click by button name
40
+ - getByLabel(label).fill(value) → fill a field by label
41
+ - locator(selector).fill(value) → fill by XPath/CSS selector
42
+ - locator.selectOption(value) → choose a picklist option
43
+ - expect(locator).toHaveValue(val) → assert a field value
44
+ - expect(locator).toBeVisible() → assert element is visible
45
+ - expect(page).toContainText(text) → assert text on page
46
+ - page.waitForLoadState() / waitForSelector() → wait conditions
47
+ - beforeEach → test setup including login
48
+ `.trim();
49
+ // ── Shared orchestration instructions ────────────────────────────────────────
50
+ function migrationOrchestration(projectPath) {
51
+ const projectHint = projectPath
52
+ ? `The target Provar project is at: ${projectPath}`
53
+ : 'Ask the user for the Provar project path if needed.';
54
+ return `
55
+ ## Migration workflow
56
+
57
+ Follow these steps in order:
58
+
59
+ 1. **Get corpus examples** — call \`provar.qualityhub.examples.retrieve\` with keywords that
60
+ describe the source test's main scenario (e.g. "create opportunity", "close case", "convert lead").
61
+ Use the returned examples as few-shot grounding for the Provar XML format and step patterns.
62
+ If the response has \`"count": 0\` with a \`"warning"\` field (API unavailable or not configured),
63
+ fall back: read the \`provar://docs/step-reference\` MCP resource for step types and attribute
64
+ formats, then continue with generation based on that reference.
65
+
66
+ 2. **Generate the test case** — produce a valid Provar XML test case that faithfully captures
67
+ the intent of the source test. Base the structure entirely on the corpus examples, not on
68
+ prior knowledge of Provar XML. Omit Salesforce login/navigation setup — Provar handles
69
+ that via Connection Manager.
70
+
71
+ 3. **Write the file** — save the generated XML to the appropriate \`tests/\` subdirectory
72
+ inside the Provar project. ${projectHint}
73
+
74
+ 4. **Validate** — call \`provar.testcase.validate\` on the saved file. If it reports errors,
75
+ fix them and re-validate until the file passes clean.
76
+
77
+ 5. **Report** — summarise what was migrated, any steps that could not be mapped (add them
78
+ as \`<!-- TODO: manual step -->\` comments in the XML), and any validation warnings.
79
+ `.trim();
80
+ }
81
+ // ── Prompt: provar.migrate.crt ────────────────────────────────────────────────
82
+ export function registerCrtMigrationPrompt(server) {
83
+ server.prompt('provar.migrate.crt', 'Convert a Copado Robotic Testing (CRT) test — either a QWord step sequence or a Robot Framework .robot file — into a Provar XML test case. Retrieves corpus examples for grounding, generates the test case, then validates it with provar.testcase.validate.', {
84
+ source: z
85
+ .string()
86
+ .describe('The CRT test content to migrate. Accepts either: (1) a numbered QWord step sequence (e.g. "Step 1: ClickText Accounts"), or (2) a Robot Framework .robot file with *** Settings ***, *** Keywords ***, and *** Test Cases *** sections.'),
87
+ projectPath: z
88
+ .string()
89
+ .optional()
90
+ .describe('Absolute path to the Provar project root. Used to locate the tests/ directory when writing the output file.'),
91
+ testName: z
92
+ .string()
93
+ .optional()
94
+ .describe('Optional name for the output Provar test case. Inferred from the source if omitted.'),
95
+ }, ({ source, projectPath, testName }) => ({
96
+ messages: [
97
+ {
98
+ role: 'user',
99
+ content: {
100
+ type: 'text',
101
+ text: `You are a Provar test migration expert. Migrate the following CRT test to Provar.
102
+
103
+ ## Source format — CRT
104
+
105
+ ${CRT_CONTEXT}
106
+
107
+ ${migrationOrchestration(projectPath)}
108
+
109
+ ## Source CRT Test
110
+
111
+ \`\`\`
112
+ ${source}
113
+ \`\`\`
114
+
115
+ ${testName ? `Target test case name: ${testName}` : 'Infer the test case name from the source content.'}
116
+
117
+ Begin with step 1: call provar.qualityhub.examples.retrieve.`,
118
+ },
119
+ },
120
+ ],
121
+ }));
122
+ }
123
+ // ── Prompt: provar.migrate.selenium ──────────────────────────────────────────
124
+ export function registerSeleniumMigrationPrompt(server) {
125
+ server.prompt('provar.migrate.selenium', 'Convert a Selenium WebDriver test (Java, Python, or JavaScript) that tests a Salesforce org into a Provar XML test case. Retrieves corpus examples for grounding, generates the test case, then validates it with provar.testcase.validate.', {
126
+ source: z
127
+ .string()
128
+ .describe('The Selenium test file content to migrate. Accepts Java (JUnit/TestNG), Python (unittest/pytest), or JavaScript (Jest/Mocha) with selenium-webdriver. Include the full file or the relevant test method(s).'),
129
+ projectPath: z
130
+ .string()
131
+ .optional()
132
+ .describe('Absolute path to the Provar project root. Used to locate the tests/ directory when writing the output file.'),
133
+ testName: z
134
+ .string()
135
+ .optional()
136
+ .describe('Optional name for the output Provar test case. Inferred from the source class/method name if omitted.'),
137
+ }, ({ source, projectPath, testName }) => ({
138
+ messages: [
139
+ {
140
+ role: 'user',
141
+ content: {
142
+ type: 'text',
143
+ text: `You are a Provar test migration expert. Migrate the following Selenium WebDriver test to Provar.
144
+
145
+ ## Source format — Selenium WebDriver
146
+
147
+ ${SELENIUM_CONTEXT}
148
+
149
+ ${migrationOrchestration(projectPath)}
150
+
151
+ ## Source Selenium Test
152
+
153
+ \`\`\`
154
+ ${source}
155
+ \`\`\`
156
+
157
+ ${testName ? `Target test case name: ${testName}` : 'Infer the test case name from the class and method name.'}
158
+
159
+ Begin with step 1: call provar.qualityhub.examples.retrieve.`,
160
+ },
161
+ },
162
+ ],
163
+ }));
164
+ }
165
+ // ── Prompt: provar.migrate.playwright ────────────────────────────────────────
166
+ export function registerPlaywrightMigrationPrompt(server) {
167
+ server.prompt('provar.migrate.playwright', 'Convert a Playwright test (TypeScript or JavaScript) that tests a Salesforce org into a Provar XML test case. Retrieves corpus examples for grounding, generates the test case, then validates it with provar.testcase.validate.', {
168
+ source: z
169
+ .string()
170
+ .describe('The Playwright test file content to migrate. Accepts TypeScript or JavaScript using @playwright/test or the playwright library. Include the full file or the relevant test block(s).'),
171
+ projectPath: z
172
+ .string()
173
+ .optional()
174
+ .describe('Absolute path to the Provar project root. Used to locate the tests/ directory when writing the output file.'),
175
+ testName: z
176
+ .string()
177
+ .optional()
178
+ .describe('Optional name for the output Provar test case. Inferred from the test() block description if omitted.'),
179
+ }, ({ source, projectPath, testName }) => ({
180
+ messages: [
181
+ {
182
+ role: 'user',
183
+ content: {
184
+ type: 'text',
185
+ text: `You are a Provar test migration expert. Migrate the following Playwright test to Provar.
186
+
187
+ ## Source format — Playwright
188
+
189
+ ${PLAYWRIGHT_CONTEXT}
190
+
191
+ ${migrationOrchestration(projectPath)}
192
+
193
+ ## Source Playwright Test
194
+
195
+ \`\`\`
196
+ ${source}
197
+ \`\`\`
198
+
199
+ ${testName ? `Target test case name: ${testName}` : 'Infer the test case name from the test() block description.'}
200
+
201
+ Begin with step 1: call provar.qualityhub.examples.retrieve.`,
202
+ },
203
+ },
204
+ ],
205
+ }));
206
+ }
207
+ //# sourceMappingURL=migrationPrompts.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"migrationPrompts.js","sourceRoot":"","sources":["../../../src/mcp/prompts/migrationPrompts.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAEH,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,gEAAgE;AAChE,2EAA2E;AAC3E,wEAAwE;AACxE,mDAAmD;AAEnD,MAAM,WAAW,GAAG;;;;;;;;;;;CAWnB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,gBAAgB,GAAG;;;;;;;;;;CAUxB,CAAC,IAAI,EAAE,CAAC;AAET,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;CAa1B,CAAC,IAAI,EAAE,CAAC;AAET,gFAAgF;AAEhF,SAAS,sBAAsB,CAAC,WAA+B;IAC7D,MAAM,WAAW,GAAG,WAAW;QAC7B,CAAC,CAAC,oCAAoC,WAAW,EAAE;QACnD,CAAC,CAAC,qDAAqD,CAAC;IAE1D,OAAO;;;;;;;;;;;;;;;;;;gCAkBuB,WAAW;;;;;;;CAO1C,CAAC,IAAI,EAAE,CAAC;AACT,CAAC;AAED,iFAAiF;AAE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