qa360 1.4.5 → 2.0.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/README.md +1 -1
- package/dist/commands/ai.d.ts +41 -0
- package/dist/commands/ai.js +499 -0
- package/dist/commands/ask.js +12 -12
- package/dist/commands/coverage.d.ts +8 -0
- package/dist/commands/coverage.js +252 -0
- package/dist/commands/explain.d.ts +27 -0
- package/dist/commands/explain.js +630 -0
- package/dist/commands/flakiness.d.ts +73 -0
- package/dist/commands/flakiness.js +435 -0
- package/dist/commands/generate.d.ts +66 -0
- package/dist/commands/generate.js +438 -0
- package/dist/commands/init.d.ts +56 -9
- package/dist/commands/init.js +217 -10
- package/dist/commands/monitor.d.ts +27 -0
- package/dist/commands/monitor.js +225 -0
- package/dist/commands/ollama.d.ts +40 -0
- package/dist/commands/ollama.js +301 -0
- package/dist/commands/pack.d.ts +37 -9
- package/dist/commands/pack.js +240 -141
- package/dist/commands/regression.d.ts +8 -0
- package/dist/commands/regression.js +340 -0
- package/dist/commands/repair.d.ts +26 -0
- package/dist/commands/repair.js +307 -0
- package/dist/commands/retry.d.ts +43 -0
- package/dist/commands/retry.js +275 -0
- package/dist/commands/run.d.ts +8 -3
- package/dist/commands/run.js +45 -31
- package/dist/commands/slo.d.ts +8 -0
- package/dist/commands/slo.js +327 -0
- package/dist/core/adapters/playwright-native-api.d.ts +183 -0
- package/dist/core/adapters/playwright-native-api.js +461 -0
- package/dist/core/adapters/playwright-ui.d.ts +7 -0
- package/dist/core/adapters/playwright-ui.js +29 -1
- package/dist/core/ai/anthropic-provider.d.ts +50 -0
- package/dist/core/ai/anthropic-provider.js +211 -0
- package/dist/core/ai/deepseek-provider.d.ts +81 -0
- package/dist/core/ai/deepseek-provider.js +254 -0
- package/dist/core/ai/index.d.ts +60 -0
- package/dist/core/ai/index.js +18 -0
- package/dist/core/ai/llm-client.d.ts +45 -0
- package/dist/core/ai/llm-client.js +7 -0
- package/dist/core/ai/mock-provider.d.ts +49 -0
- package/dist/core/ai/mock-provider.js +121 -0
- package/dist/core/ai/ollama-provider.d.ts +78 -0
- package/dist/core/ai/ollama-provider.js +192 -0
- package/dist/core/ai/openai-provider.d.ts +48 -0
- package/dist/core/ai/openai-provider.js +188 -0
- package/dist/core/ai/provider-factory.d.ts +160 -0
- package/dist/core/ai/provider-factory.js +269 -0
- package/dist/core/auth/api-key-provider.d.ts +16 -0
- package/dist/core/auth/api-key-provider.js +63 -0
- package/dist/core/auth/aws-iam-provider.d.ts +35 -0
- package/dist/core/auth/aws-iam-provider.js +177 -0
- package/dist/core/auth/azure-ad-provider.d.ts +15 -0
- package/dist/core/auth/azure-ad-provider.js +99 -0
- package/dist/core/auth/basic-auth-provider.d.ts +26 -0
- package/dist/core/auth/basic-auth-provider.js +111 -0
- package/dist/core/auth/gcp-adc-provider.d.ts +27 -0
- package/dist/core/auth/gcp-adc-provider.js +126 -0
- package/dist/core/auth/index.d.ts +238 -0
- package/dist/core/auth/index.js +82 -0
- package/dist/core/auth/jwt-provider.d.ts +19 -0
- package/dist/core/auth/jwt-provider.js +160 -0
- package/dist/core/auth/manager.d.ts +84 -0
- package/dist/core/auth/manager.js +230 -0
- package/dist/core/auth/oauth2-provider.d.ts +17 -0
- package/dist/core/auth/oauth2-provider.js +114 -0
- package/dist/core/auth/totp-provider.d.ts +31 -0
- package/dist/core/auth/totp-provider.js +134 -0
- package/dist/core/auth/ui-login-provider.d.ts +26 -0
- package/dist/core/auth/ui-login-provider.js +198 -0
- package/dist/core/cache/index.d.ts +7 -0
- package/dist/core/cache/index.js +6 -0
- package/dist/core/cache/lru-cache.d.ts +203 -0
- package/dist/core/cache/lru-cache.js +397 -0
- package/dist/core/coverage/analyzer.d.ts +101 -0
- package/dist/core/coverage/analyzer.js +415 -0
- package/dist/core/coverage/collector.d.ts +74 -0
- package/dist/core/coverage/collector.js +459 -0
- package/dist/core/coverage/config.d.ts +37 -0
- package/dist/core/coverage/config.js +156 -0
- package/dist/core/coverage/index.d.ts +11 -0
- package/dist/core/coverage/index.js +15 -0
- package/dist/core/coverage/types.d.ts +267 -0
- package/dist/core/coverage/types.js +6 -0
- package/dist/core/coverage/vault.d.ts +95 -0
- package/dist/core/coverage/vault.js +405 -0
- package/dist/core/dashboard/assets.d.ts +6 -0
- package/dist/core/dashboard/assets.js +690 -0
- package/dist/core/dashboard/index.d.ts +6 -0
- package/dist/core/dashboard/index.js +5 -0
- package/dist/core/dashboard/server.d.ts +72 -0
- package/dist/core/dashboard/server.js +354 -0
- package/dist/core/dashboard/types.d.ts +70 -0
- package/dist/core/dashboard/types.js +5 -0
- package/dist/core/discoverer/index.d.ts +115 -0
- package/dist/core/discoverer/index.js +250 -0
- package/dist/core/flakiness/index.d.ts +228 -0
- package/dist/core/flakiness/index.js +384 -0
- package/dist/core/generation/code-formatter.d.ts +111 -0
- package/dist/core/generation/code-formatter.js +307 -0
- package/dist/core/generation/code-generator.d.ts +144 -0
- package/dist/core/generation/code-generator.js +293 -0
- package/dist/core/generation/generator.d.ts +40 -0
- package/dist/core/generation/generator.js +76 -0
- package/dist/core/generation/index.d.ts +30 -0
- package/dist/core/generation/index.js +28 -0
- package/dist/core/generation/pack-generator.d.ts +107 -0
- package/dist/core/generation/pack-generator.js +416 -0
- package/dist/core/generation/prompt-builder.d.ts +132 -0
- package/dist/core/generation/prompt-builder.js +672 -0
- package/dist/core/generation/source-analyzer.d.ts +213 -0
- package/dist/core/generation/source-analyzer.js +657 -0
- package/dist/core/generation/test-optimizer.d.ts +117 -0
- package/dist/core/generation/test-optimizer.js +328 -0
- package/dist/core/generation/types.d.ts +214 -0
- package/dist/core/generation/types.js +4 -0
- package/dist/core/index.d.ts +23 -1
- package/dist/core/index.js +39 -0
- package/dist/core/pack/validator.js +31 -1
- package/dist/core/pack-v2/index.d.ts +9 -0
- package/dist/core/pack-v2/index.js +8 -0
- package/dist/core/pack-v2/loader.d.ts +62 -0
- package/dist/core/pack-v2/loader.js +231 -0
- package/dist/core/pack-v2/migrator.d.ts +56 -0
- package/dist/core/pack-v2/migrator.js +455 -0
- package/dist/core/pack-v2/validator.d.ts +61 -0
- package/dist/core/pack-v2/validator.js +577 -0
- package/dist/core/regression/detector.d.ts +107 -0
- package/dist/core/regression/detector.js +497 -0
- package/dist/core/regression/index.d.ts +9 -0
- package/dist/core/regression/index.js +11 -0
- package/dist/core/regression/trend-analyzer.d.ts +102 -0
- package/dist/core/regression/trend-analyzer.js +345 -0
- package/dist/core/regression/types.d.ts +222 -0
- package/dist/core/regression/types.js +7 -0
- package/dist/core/regression/vault.d.ts +87 -0
- package/dist/core/regression/vault.js +289 -0
- package/dist/core/repair/engine/fixer.d.ts +24 -0
- package/dist/core/repair/engine/fixer.js +226 -0
- package/dist/core/repair/engine/suggestion-engine.d.ts +18 -0
- package/dist/core/repair/engine/suggestion-engine.js +187 -0
- package/dist/core/repair/index.d.ts +10 -0
- package/dist/core/repair/index.js +13 -0
- package/dist/core/repair/repairer.d.ts +90 -0
- package/dist/core/repair/repairer.js +284 -0
- package/dist/core/repair/types.d.ts +91 -0
- package/dist/core/repair/types.js +6 -0
- package/dist/core/repair/utils/error-analyzer.d.ts +28 -0
- package/dist/core/repair/utils/error-analyzer.js +264 -0
- package/dist/core/retry/flakiness-integration.d.ts +60 -0
- package/dist/core/retry/flakiness-integration.js +228 -0
- package/dist/core/retry/index.d.ts +14 -0
- package/dist/core/retry/index.js +16 -0
- package/dist/core/retry/retry-engine.d.ts +80 -0
- package/dist/core/retry/retry-engine.js +296 -0
- package/dist/core/retry/types.d.ts +178 -0
- package/dist/core/retry/types.js +52 -0
- package/dist/core/retry/vault.d.ts +77 -0
- package/dist/core/retry/vault.js +304 -0
- package/dist/core/runner/e2e-helpers.d.ts +102 -0
- package/dist/core/runner/e2e-helpers.js +153 -0
- package/dist/core/runner/phase3-runner.d.ts +101 -2
- package/dist/core/runner/phase3-runner.js +559 -24
- package/dist/core/self-healing/assertion-healer.d.ts +97 -0
- package/dist/core/self-healing/assertion-healer.js +371 -0
- package/dist/core/self-healing/engine.d.ts +122 -0
- package/dist/core/self-healing/engine.js +538 -0
- package/dist/core/self-healing/index.d.ts +10 -0
- package/dist/core/self-healing/index.js +11 -0
- package/dist/core/self-healing/selector-healer.d.ts +103 -0
- package/dist/core/self-healing/selector-healer.js +372 -0
- package/dist/core/self-healing/types.d.ts +152 -0
- package/dist/core/self-healing/types.js +6 -0
- package/dist/core/slo/config.d.ts +107 -0
- package/dist/core/slo/config.js +360 -0
- package/dist/core/slo/index.d.ts +11 -0
- package/dist/core/slo/index.js +15 -0
- package/dist/core/slo/sli-calculator.d.ts +92 -0
- package/dist/core/slo/sli-calculator.js +364 -0
- package/dist/core/slo/slo-tracker.d.ts +148 -0
- package/dist/core/slo/slo-tracker.js +379 -0
- package/dist/core/slo/types.d.ts +281 -0
- package/dist/core/slo/types.js +7 -0
- package/dist/core/slo/vault.d.ts +102 -0
- package/dist/core/slo/vault.js +427 -0
- package/dist/core/tui/index.d.ts +7 -0
- package/dist/core/tui/index.js +6 -0
- package/dist/core/tui/monitor.d.ts +92 -0
- package/dist/core/tui/monitor.js +271 -0
- package/dist/core/tui/renderer.d.ts +33 -0
- package/dist/core/tui/renderer.js +218 -0
- package/dist/core/tui/types.d.ts +63 -0
- package/dist/core/tui/types.js +5 -0
- package/dist/core/types/pack-v2.d.ts +425 -0
- package/dist/core/types/pack-v2.js +8 -0
- package/dist/core/vault/index.d.ts +116 -0
- package/dist/core/vault/index.js +400 -5
- package/dist/core/watch/index.d.ts +7 -0
- package/dist/core/watch/index.js +6 -0
- package/dist/core/watch/watch-mode.d.ts +213 -0
- package/dist/core/watch/watch-mode.js +389 -0
- package/dist/index.js +68 -68
- package/dist/utils/config.d.ts +5 -0
- package/dist/utils/config.js +136 -0
- package/package.json +5 -1
- package/dist/core/adapters/playwright-api.d.ts +0 -82
- package/dist/core/adapters/playwright-api.js +0 -264
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* QA360 Ollama Command
|
|
3
|
+
*
|
|
4
|
+
* Manage Ollama integration for AI-powered test generation.
|
|
5
|
+
* This command handles connection testing, model management, and configuration.
|
|
6
|
+
*/
|
|
7
|
+
import { Command } from 'commander';
|
|
8
|
+
import chalk from 'chalk';
|
|
9
|
+
import ora from 'ora';
|
|
10
|
+
import { checkOllamaSetup, OllamaProvider, OllamaError } from '../core/index.js';
|
|
11
|
+
/**
|
|
12
|
+
* Test Ollama connection
|
|
13
|
+
*/
|
|
14
|
+
export async function ollamaTestCommand(options = {}) {
|
|
15
|
+
const spinner = ora('Testing Ollama connection...').start();
|
|
16
|
+
const model = options.model || 'deepseek-coder';
|
|
17
|
+
try {
|
|
18
|
+
const check = await checkOllamaSetup(model);
|
|
19
|
+
if (!check.available) {
|
|
20
|
+
spinner.fail('Ollama is not available');
|
|
21
|
+
console.log(chalk.red('\n❌ Ollama is not running or not installed'));
|
|
22
|
+
console.log(chalk.yellow('\n📦 To install Ollama:'));
|
|
23
|
+
console.log(chalk.gray(' brew install ollama # macOS'));
|
|
24
|
+
console.log(chalk.gray(' # Or visit: https://ollama.com'));
|
|
25
|
+
console.log(chalk.yellow('\n🚀 To start Ollama:'));
|
|
26
|
+
console.log(chalk.gray(' ollama serve'));
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
spinner.succeed('Ollama is running!');
|
|
30
|
+
console.log(chalk.green('\n✅ Ollama is available\n'));
|
|
31
|
+
if (check.models.length === 0) {
|
|
32
|
+
console.log(chalk.yellow('⚠️ No models found'));
|
|
33
|
+
console.log(chalk.yellow('\n📥 Pull DeepSeek Coder (recommended for code generation):'));
|
|
34
|
+
console.log(chalk.gray(' ollama pull deepseek-coder'));
|
|
35
|
+
return;
|
|
36
|
+
}
|
|
37
|
+
console.log(chalk.bold(`Found ${check.models.length} model(s):\n`));
|
|
38
|
+
for (const modelName of check.models) {
|
|
39
|
+
const isInstalled = modelName.includes(model);
|
|
40
|
+
const icon = isInstalled ? '✅' : ' ';
|
|
41
|
+
const color = isInstalled ? chalk.green : chalk.gray;
|
|
42
|
+
console.log(color(` ${icon} ${modelName}`));
|
|
43
|
+
}
|
|
44
|
+
if (!check.modelInstalled) {
|
|
45
|
+
console.log(chalk.yellow(`\n⚠️ Model "${model}" is not installed`));
|
|
46
|
+
console.log(chalk.yellow(`\n📥 To install: ollama pull ${model}`));
|
|
47
|
+
}
|
|
48
|
+
else {
|
|
49
|
+
console.log(chalk.green(`\n✅ Model "${model}" is ready!`));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
catch (error) {
|
|
53
|
+
spinner.fail('Connection test failed');
|
|
54
|
+
if (error instanceof OllamaError) {
|
|
55
|
+
console.error(chalk.red(error.message));
|
|
56
|
+
}
|
|
57
|
+
else {
|
|
58
|
+
console.error(chalk.red('Unknown error:', error));
|
|
59
|
+
}
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
/**
|
|
63
|
+
* List available models
|
|
64
|
+
*/
|
|
65
|
+
export async function ollamaListCommand() {
|
|
66
|
+
const spinner = ora('Connecting to Ollama...').start();
|
|
67
|
+
try {
|
|
68
|
+
const provider = new OllamaProvider();
|
|
69
|
+
const models = await provider.listModels();
|
|
70
|
+
spinner.succeed(`Found ${models.length} model(s)\n`);
|
|
71
|
+
console.log(chalk.bold('Available Models:\n'));
|
|
72
|
+
for (const model of models) {
|
|
73
|
+
const sizeGB = (model.size / 1024 / 1024 / 1024).toFixed(1);
|
|
74
|
+
console.log(chalk.cyan(` ${model.name}`));
|
|
75
|
+
console.log(chalk.gray(` Size: ${sizeGB} GB`));
|
|
76
|
+
console.log(chalk.gray(` Modified: ${new Date(model.modifiedAt).toISOString()}\n`));
|
|
77
|
+
}
|
|
78
|
+
console.log(chalk.yellow('💡 Recommended for code generation:'));
|
|
79
|
+
console.log(chalk.gray(' • deepseek-coder (6.7GB) - Best for code'));
|
|
80
|
+
console.log(chalk.gray(' • codellama (34GB) - Also good'));
|
|
81
|
+
console.log(chalk.gray(' • llama3.2 (3-4GB) - General purpose\n'));
|
|
82
|
+
console.log(chalk.yellow('📥 To install a model:'));
|
|
83
|
+
console.log(chalk.gray(' ollama pull <model-name>\n'));
|
|
84
|
+
}
|
|
85
|
+
catch (error) {
|
|
86
|
+
spinner.fail('Failed to list models');
|
|
87
|
+
if (error instanceof OllamaError) {
|
|
88
|
+
console.error(chalk.red(error.message));
|
|
89
|
+
}
|
|
90
|
+
else {
|
|
91
|
+
console.error(chalk.red('Unknown error:', error));
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
/**
|
|
96
|
+
* Pull a model
|
|
97
|
+
*/
|
|
98
|
+
export async function ollamaPullCommand(model) {
|
|
99
|
+
console.log(chalk.cyan(`📥 Pulling model: ${model}\n`));
|
|
100
|
+
console.log(chalk.yellow('This may take a while depending on your connection...\n'));
|
|
101
|
+
console.log(chalk.gray('Alternatively, run this command in another terminal:\n'));
|
|
102
|
+
console.log(chalk.bold(` ollama pull ${model}\n`));
|
|
103
|
+
try {
|
|
104
|
+
const provider = new OllamaProvider();
|
|
105
|
+
const models = await provider.listModels();
|
|
106
|
+
if (models.some(m => m.name === model)) {
|
|
107
|
+
console.log(chalk.green(`✅ Model "${model}" is already installed\n`));
|
|
108
|
+
return;
|
|
109
|
+
}
|
|
110
|
+
console.log(chalk.yellow('💡 Use the command above in a separate terminal to download the model.'));
|
|
111
|
+
console.log(chalk.gray('Large models (several GB) can take 10-30 minutes depending on your internet.\n'));
|
|
112
|
+
}
|
|
113
|
+
catch (error) {
|
|
114
|
+
if (error instanceof OllamaError) {
|
|
115
|
+
console.error(chalk.red(error.message));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
console.error(chalk.red('Unknown error:', error));
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Generate tests using Ollama
|
|
124
|
+
*/
|
|
125
|
+
export async function ollamaGenerateCommand(prompt, options = {}) {
|
|
126
|
+
const spinner = ora('Connecting to Ollama...').start();
|
|
127
|
+
const model = options.model || 'deepseek-coder';
|
|
128
|
+
const type = options.type || 'api';
|
|
129
|
+
try {
|
|
130
|
+
const provider = new OllamaProvider({ model });
|
|
131
|
+
// Check availability
|
|
132
|
+
const available = await provider.isAvailable();
|
|
133
|
+
if (!available) {
|
|
134
|
+
spinner.fail('Ollama not available');
|
|
135
|
+
console.log(chalk.red('\n❌ Ollama is not running'));
|
|
136
|
+
console.log(chalk.yellow('\nStart Ollama with: ollama serve'));
|
|
137
|
+
return;
|
|
138
|
+
}
|
|
139
|
+
spinner.succeed('Connected to Ollama');
|
|
140
|
+
// Build system prompt based on type
|
|
141
|
+
const systemPrompt = buildSystemPrompt(type);
|
|
142
|
+
const genSpinner = ora(`Generating ${type} tests...`).start();
|
|
143
|
+
const response = await provider.generate({
|
|
144
|
+
systemPrompt,
|
|
145
|
+
prompt,
|
|
146
|
+
maxTokens: 4096,
|
|
147
|
+
temperature: 0.7,
|
|
148
|
+
});
|
|
149
|
+
genSpinner.succeed('Tests generated!\n');
|
|
150
|
+
if (options.json) {
|
|
151
|
+
console.log(JSON.stringify({ content: response.content, usage: response.usage }, null, 2));
|
|
152
|
+
}
|
|
153
|
+
else {
|
|
154
|
+
console.log(chalk.bold('Generated Tests:\n'));
|
|
155
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
156
|
+
console.log(response.content);
|
|
157
|
+
console.log(chalk.gray('─'.repeat(60)));
|
|
158
|
+
console.log(chalk.gray(`\n📊 Tokens: ${response.usage.totalTokens} (${response.usage.promptTokens} prompt + ${response.usage.completionTokens} completion)`));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
catch (error) {
|
|
162
|
+
spinner.fail('Generation failed');
|
|
163
|
+
if (error instanceof OllamaError) {
|
|
164
|
+
console.error(chalk.red(error.message));
|
|
165
|
+
}
|
|
166
|
+
else {
|
|
167
|
+
console.error(chalk.red('Unknown error:', error));
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Show Ollama configuration
|
|
173
|
+
*/
|
|
174
|
+
export async function ollamaConfigCommand(options = {}) {
|
|
175
|
+
// TODO: Implement config file persistence
|
|
176
|
+
console.log(chalk.cyan('Ollama Configuration:\n'));
|
|
177
|
+
console.log(chalk.gray(' Base URL: http://localhost:11434 (default)'));
|
|
178
|
+
console.log(chalk.gray(' Model: deepseek-coder (default)\n'));
|
|
179
|
+
console.log(chalk.yellow('💡 Configuration will be persisted in .qa360/config.yml'));
|
|
180
|
+
}
|
|
181
|
+
/**
|
|
182
|
+
* Build system prompt for test generation
|
|
183
|
+
*/
|
|
184
|
+
function buildSystemPrompt(type) {
|
|
185
|
+
const basePrompt = `You are QA360, an expert QA test generator.
|
|
186
|
+
Generate production-ready, well-structured test code following best practices.
|
|
187
|
+
|
|
188
|
+
Rules:
|
|
189
|
+
- Generate COMPLETE, working code (no "...", no comments saying "to be implemented")
|
|
190
|
+
- Include proper imports and setup
|
|
191
|
+
- Handle errors gracefully
|
|
192
|
+
- Use modern async/await patterns
|
|
193
|
+
- Add helpful comments for complex logic
|
|
194
|
+
- Return ONLY the code, no explanations before or after`;
|
|
195
|
+
const typePrompts = {
|
|
196
|
+
api: `${basePrompt}
|
|
197
|
+
|
|
198
|
+
For API tests using Playwright:
|
|
199
|
+
- Use @playwright/test
|
|
200
|
+
- Use test() and expect() from Playwright
|
|
201
|
+
- Test REST API endpoints (GET, POST, PUT, DELETE)
|
|
202
|
+
- Include proper assertions for status codes, headers, and response body
|
|
203
|
+
- Handle both success and error cases`,
|
|
204
|
+
ui: `${basePrompt}
|
|
205
|
+
|
|
206
|
+
For UI/E2E tests using Playwright:
|
|
207
|
+
- Use @playwright/test
|
|
208
|
+
- Use page.goto(), page.click(), page.fill(), etc.
|
|
209
|
+
- Include explicit waits where needed (waitForLoadState, waitForSelector)
|
|
210
|
+
- Add assertions for page content
|
|
211
|
+
- Use data-testid attributes when possible`,
|
|
212
|
+
perf: `${basePrompt}
|
|
213
|
+
|
|
214
|
+
For performance tests using K6:
|
|
215
|
+
- Use k6/http module
|
|
216
|
+
- Define thresholds for response times and error rates
|
|
217
|
+
- Include realistic user scenarios
|
|
218
|
+
- Use options for VUs and duration`,
|
|
219
|
+
a11y: `${basePrompt}
|
|
220
|
+
|
|
221
|
+
For accessibility tests:
|
|
222
|
+
- Use @axe-core/playwright
|
|
223
|
+
- Test WCAG compliance
|
|
224
|
+
- Check for common a11y issues`,
|
|
225
|
+
};
|
|
226
|
+
return typePrompts[type] || typePrompts.api;
|
|
227
|
+
}
|
|
228
|
+
/**
|
|
229
|
+
* Create Ollama commands
|
|
230
|
+
*/
|
|
231
|
+
export function createOllamaCommands() {
|
|
232
|
+
const ollamaCmd = new Command('ollama')
|
|
233
|
+
.description('Manage Ollama AI integration for test generation');
|
|
234
|
+
ollamaCmd
|
|
235
|
+
.command('test')
|
|
236
|
+
.description('Test Ollama connection and availability')
|
|
237
|
+
.option('-m, --model <model>', 'Model to test', 'deepseek-coder')
|
|
238
|
+
.action(async (options) => {
|
|
239
|
+
try {
|
|
240
|
+
await ollamaTestCommand(options);
|
|
241
|
+
}
|
|
242
|
+
catch (error) {
|
|
243
|
+
console.error(chalk.red('Error testing Ollama:'), error.message);
|
|
244
|
+
process.exit(1);
|
|
245
|
+
}
|
|
246
|
+
});
|
|
247
|
+
ollamaCmd
|
|
248
|
+
.command('list')
|
|
249
|
+
.description('List available Ollama models')
|
|
250
|
+
.action(async () => {
|
|
251
|
+
try {
|
|
252
|
+
await ollamaListCommand();
|
|
253
|
+
}
|
|
254
|
+
catch (error) {
|
|
255
|
+
console.error(chalk.red('Error listing models:'), error.message);
|
|
256
|
+
process.exit(1);
|
|
257
|
+
}
|
|
258
|
+
});
|
|
259
|
+
ollamaCmd
|
|
260
|
+
.command('pull <model>')
|
|
261
|
+
.description('Pull a model from Ollama registry')
|
|
262
|
+
.action(async (model) => {
|
|
263
|
+
try {
|
|
264
|
+
await ollamaPullCommand(model);
|
|
265
|
+
}
|
|
266
|
+
catch (error) {
|
|
267
|
+
console.error(chalk.red('Error pulling model:'), error.message);
|
|
268
|
+
process.exit(1);
|
|
269
|
+
}
|
|
270
|
+
});
|
|
271
|
+
ollamaCmd
|
|
272
|
+
.command('generate <prompt>')
|
|
273
|
+
.description('Generate tests using Ollama (preview)')
|
|
274
|
+
.option('-m, --model <model>', 'Model to use', 'deepseek-coder')
|
|
275
|
+
.option('-t, --type <type>', 'Test type (api, ui, perf)', 'api')
|
|
276
|
+
.option('--json', 'Output as JSON')
|
|
277
|
+
.action(async (prompt, options) => {
|
|
278
|
+
try {
|
|
279
|
+
await ollamaGenerateCommand(prompt, options);
|
|
280
|
+
}
|
|
281
|
+
catch (error) {
|
|
282
|
+
console.error(chalk.red('Error generating tests:'), error.message);
|
|
283
|
+
process.exit(1);
|
|
284
|
+
}
|
|
285
|
+
});
|
|
286
|
+
ollamaCmd
|
|
287
|
+
.command('config')
|
|
288
|
+
.description('Show or set Ollama configuration')
|
|
289
|
+
.option('--set-url <url>', 'Set Ollama base URL')
|
|
290
|
+
.option('--set-model <model>', 'Set default model')
|
|
291
|
+
.action(async (options) => {
|
|
292
|
+
try {
|
|
293
|
+
await ollamaConfigCommand(options);
|
|
294
|
+
}
|
|
295
|
+
catch (error) {
|
|
296
|
+
console.error(chalk.red('Error showing config:'), error.message);
|
|
297
|
+
process.exit(1);
|
|
298
|
+
}
|
|
299
|
+
});
|
|
300
|
+
return ollamaCmd;
|
|
301
|
+
}
|
package/dist/commands/pack.d.ts
CHANGED
|
@@ -1,19 +1,31 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* QA360 Pack Commands
|
|
3
|
+
*
|
|
3
4
|
* Implements pack validate, lint, and migrate commands
|
|
5
|
+
* Supports both v1 and v2 pack formats
|
|
4
6
|
*/
|
|
5
7
|
export declare class QA360Pack {
|
|
6
8
|
private qa360Dir;
|
|
7
9
|
private packPath;
|
|
8
|
-
private
|
|
9
|
-
private
|
|
10
|
+
private validatorV1;
|
|
11
|
+
private migratorV1;
|
|
10
12
|
/**
|
|
11
|
-
* Validate pack.yml
|
|
13
|
+
* Validate pack.yml (auto-detects v1 or v2)
|
|
12
14
|
*/
|
|
13
|
-
validate(packPath?: string
|
|
15
|
+
validate(packPath?: string, options?: {
|
|
16
|
+
checkFiles?: boolean;
|
|
17
|
+
}): Promise<{
|
|
14
18
|
valid: boolean;
|
|
15
19
|
exitCode: number;
|
|
16
20
|
}>;
|
|
21
|
+
/**
|
|
22
|
+
* Validate v1 pack
|
|
23
|
+
*/
|
|
24
|
+
private validateV1;
|
|
25
|
+
/**
|
|
26
|
+
* Validate v2 pack
|
|
27
|
+
*/
|
|
28
|
+
private validateV2;
|
|
17
29
|
/**
|
|
18
30
|
* Lint and auto-fix pack.yml
|
|
19
31
|
*/
|
|
@@ -22,21 +34,37 @@ export declare class QA360Pack {
|
|
|
22
34
|
exitCode: number;
|
|
23
35
|
}>;
|
|
24
36
|
/**
|
|
25
|
-
* Migrate
|
|
37
|
+
* Migrate pack to v2
|
|
26
38
|
*/
|
|
27
|
-
migrate(packPath?: string
|
|
39
|
+
migrate(packPath?: string, options?: {
|
|
40
|
+
output?: string;
|
|
41
|
+
dryRun?: boolean;
|
|
42
|
+
}): Promise<{
|
|
28
43
|
success: boolean;
|
|
29
44
|
exitCode: number;
|
|
30
45
|
}>;
|
|
46
|
+
/**
|
|
47
|
+
* Detect pack version
|
|
48
|
+
*/
|
|
49
|
+
private detectPackVersion;
|
|
31
50
|
/**
|
|
32
51
|
* Apply automatic fixes to pack
|
|
33
52
|
*/
|
|
34
53
|
private applyAutoFixes;
|
|
35
54
|
/**
|
|
36
|
-
* Show pack summary
|
|
55
|
+
* Show v1 pack summary
|
|
37
56
|
*/
|
|
38
57
|
private showPackSummary;
|
|
58
|
+
/**
|
|
59
|
+
* Show v2 pack summary
|
|
60
|
+
*/
|
|
61
|
+
private showPackV2Summary;
|
|
39
62
|
}
|
|
40
|
-
export declare function packValidateCommand(packPath?: string
|
|
63
|
+
export declare function packValidateCommand(packPath?: string, options?: {
|
|
64
|
+
checkFiles?: boolean;
|
|
65
|
+
}): Promise<void>;
|
|
41
66
|
export declare function packLintCommand(packPath?: string): Promise<void>;
|
|
42
|
-
export declare function packMigrateCommand(packPath?: string
|
|
67
|
+
export declare function packMigrateCommand(packPath?: string, options?: {
|
|
68
|
+
output?: string;
|
|
69
|
+
dryRun?: boolean;
|
|
70
|
+
}): Promise<void>;
|