@kkeve/suite 0.0.1 → 0.0.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.
Files changed (152) hide show
  1. package/README.md +53 -0
  2. package/dist/bin/keve.d.ts +13 -0
  3. package/dist/bin/keve.js +164 -0
  4. package/dist/commands/auth-update.d.ts +16 -0
  5. package/dist/commands/auth-update.js +88 -0
  6. package/dist/commands/clean.d.ts +10 -0
  7. package/dist/commands/clean.js +78 -0
  8. package/dist/commands/config.d.ts +17 -0
  9. package/dist/commands/config.js +99 -0
  10. package/dist/commands/init.d.ts +15 -0
  11. package/dist/commands/init.js +292 -0
  12. package/dist/commands/report.d.ts +12 -0
  13. package/dist/commands/report.js +159 -0
  14. package/dist/commands/run.d.ts +29 -0
  15. package/dist/commands/run.js +417 -0
  16. package/dist/commands/test.d.ts +12 -0
  17. package/dist/commands/test.js +102 -0
  18. package/dist/commands/vitest.d.ts +14 -0
  19. package/dist/commands/vitest.js +166 -0
  20. package/dist/config.d.ts +109 -0
  21. package/dist/config.js +291 -0
  22. package/dist/core/action-log-writer.d.ts +47 -0
  23. package/dist/{tools/write-file.js → core/action-log-writer.js} +42 -26
  24. package/dist/core/auth.d.ts +17 -0
  25. package/dist/core/auth.js +224 -0
  26. package/dist/core/cdp-resolver.d.ts +5 -0
  27. package/dist/core/cdp-resolver.js +93 -0
  28. package/dist/core/generateReport/report.d.ts +19 -0
  29. package/dist/core/generateReport/report.js +91 -0
  30. package/dist/core/generateReport/reportData.d.ts +215 -0
  31. package/dist/core/generateReport/reportData.js +735 -0
  32. package/dist/core/global-setup.d.ts +6 -0
  33. package/dist/core/global-setup.js +113 -0
  34. package/dist/core/keve-aspect.d.ts +54 -0
  35. package/dist/core/keve-aspect.js +52 -0
  36. package/dist/core/keve-decorators.d.ts +51 -0
  37. package/dist/core/keve-decorators.js +95 -0
  38. package/dist/core/keve-registry.d.ts +38 -0
  39. package/dist/core/keve-registry.js +25 -0
  40. package/dist/core/keve-report.d.ts +27 -0
  41. package/dist/core/keve-report.js +357 -0
  42. package/dist/core/keve-test.d.ts +36 -0
  43. package/dist/core/keve-test.js +364 -0
  44. package/dist/core/learned-actions.d.ts +24 -0
  45. package/dist/core/learned-actions.js +65 -0
  46. package/dist/core/pw-config.d.ts +19 -0
  47. package/dist/core/pw-config.js +180 -0
  48. package/dist/index.d.ts +8 -23
  49. package/dist/index.js +36 -43
  50. package/dist/page-agent/agent.d.ts +129 -0
  51. package/dist/page-agent/agent.js +585 -0
  52. package/dist/page-agent/hooks.d.ts +13 -0
  53. package/dist/page-agent/hooks.js +218 -0
  54. package/dist/page-agent/tools.d.ts +29 -0
  55. package/dist/page-agent/tools.js +297 -0
  56. package/doc/README.md +124 -0
  57. package/doc/agents/keve-dev-test-agent.md +140 -0
  58. package/doc/agents/keve-test-agent.md +178 -0
  59. package/doc/asserts//346/265/213/350/257/225/345/220/204/351/230/266/346/256/265/350/257/264/346/230/216.png +0 -0
  60. package/doc/keve-agent-demo.html +370 -0
  61. package/doc/skills/keve-bddcase-gen/SKILL.md +332 -0
  62. package/doc/skills/keve-bddcase-gen/references/test-case-rules.md +91 -0
  63. package/doc/skills/keve-bddcase-gen/references/test-cases-example.md +103 -0
  64. package/doc/skills/keve-component-gen/SKILL.md +255 -0
  65. package/doc/skills/keve-component-gen/references/component-mock-strategy.md +74 -0
  66. package/doc/skills/keve-component-gen/references/component-model-template.md +98 -0
  67. package/doc/skills/keve-component-gen/references/component-test-template.md +100 -0
  68. package/doc/skills/keve-component-gen/references/vue-test-utils-guide.md +91 -0
  69. package/doc/skills/keve-e2e-gen/SKILL.md +179 -0
  70. package/doc/skills/keve-e2e-gen/references/code-analysis-guide.md +208 -0
  71. package/doc/skills/keve-e2e-gen/references/decisions.md +36 -0
  72. package/doc/skills/keve-e2e-gen/references/pom-generation-guide.md +140 -0
  73. package/doc/skills/keve-e2e-gen/references/script-generation-guide.md +236 -0
  74. package/doc/skills/keve-e2e-gen/references/test-auditor-guide.md +189 -0
  75. package/doc/skills/keve-e2e-gen/scripts/extract-components.sh +85 -0
  76. package/doc/skills/keve-e2e-gen/scripts/inject-testids.sh +95 -0
  77. package/doc/skills/keve-static-analysis/SKILL.md +362 -0
  78. package/doc/skills/keve-static-analysis/references/codegraph-analysis-guide.md +108 -0
  79. package/doc/skills/keve-static-analysis/references/git-impact-analysis.md +81 -0
  80. package/doc/skills/keve-static-analysis/references/lint-fix-guide.md +69 -0
  81. package/doc/skills/keve-static-analysis/references/runtime-risk-patterns.md +92 -0
  82. package/doc/skills/keve-static-analysis/references/security-scan-guide.md +32 -0
  83. package/doc/skills/keve-static-analysis/references/ts-error-patterns.md +98 -0
  84. package/doc/skills/keve-static-analysis/references/vue-security-guide.md +72 -0
  85. package/doc/skills/keve-test-eval/SKILL.md +78 -0
  86. package/doc/skills/keve-test-eval/references/common-fix-guide.md +166 -0
  87. package/doc/skills/keve-test-eval/references/confidence-data-guide.md +78 -0
  88. package/doc/skills/keve-test-eval/references/fix-loop-guide.md +67 -0
  89. package/doc/skills/keve-unit-gen/SKILL.md +203 -0
  90. package/doc/skills/keve-unit-gen/references/boundary-conditions.md +78 -0
  91. package/doc/skills/keve-unit-gen/references/unit-mock-strategy.md +71 -0
  92. package/doc/skills/keve-unit-gen/references/unit-test-template.md +105 -0
  93. package/package.json +47 -25
  94. package/dist/agent/factory.d.ts +0 -25
  95. package/dist/agent/factory.js +0 -99
  96. package/dist/agent/index.d.ts +0 -3
  97. package/dist/agent/index.js +0 -7
  98. package/dist/agent/loader.d.ts +0 -22
  99. package/dist/agent/loader.js +0 -117
  100. package/dist/agent/types.d.ts +0 -9
  101. package/dist/agent/types.js +0 -2
  102. package/dist/agent-loop/complete-task.d.ts +0 -28
  103. package/dist/agent-loop/complete-task.js +0 -70
  104. package/dist/agent-loop/index.d.ts +0 -16
  105. package/dist/agent-loop/index.js +0 -26
  106. package/dist/agent-loop/loop.d.ts +0 -42
  107. package/dist/agent-loop/loop.js +0 -282
  108. package/dist/agent-loop/runtime.d.ts +0 -40
  109. package/dist/agent-loop/runtime.js +0 -163
  110. package/dist/agent-loop/types.d.ts +0 -161
  111. package/dist/agent-loop/types.js +0 -105
  112. package/dist/context/index.d.ts +0 -8
  113. package/dist/context/index.js +0 -29
  114. package/dist/context/tokenCalculation.d.ts +0 -55
  115. package/dist/context/tokenCalculation.js +0 -95
  116. package/dist/context/truncation.d.ts +0 -67
  117. package/dist/context/truncation.js +0 -142
  118. package/dist/context/types.d.ts +0 -7
  119. package/dist/context/types.js +0 -27
  120. package/dist/llm/OpenAIClient.d.ts +0 -31
  121. package/dist/llm/OpenAIClient.js +0 -455
  122. package/dist/llm/constants.d.ts +0 -2
  123. package/dist/llm/constants.js +0 -6
  124. package/dist/llm/errors.d.ts +0 -25
  125. package/dist/llm/errors.js +0 -51
  126. package/dist/llm/index.d.ts +0 -49
  127. package/dist/llm/index.js +0 -158
  128. package/dist/llm/types.d.ts +0 -124
  129. package/dist/llm/types.js +0 -2
  130. package/dist/llm/utils.d.ts +0 -29
  131. package/dist/llm/utils.js +0 -284
  132. package/dist/skill/frontmatter-parser.d.ts +0 -50
  133. package/dist/skill/frontmatter-parser.js +0 -152
  134. package/dist/skill/index.d.ts +0 -12
  135. package/dist/skill/index.js +0 -17
  136. package/dist/skill/loader.d.ts +0 -96
  137. package/dist/skill/loader.js +0 -256
  138. package/dist/tools/ask-user.d.ts +0 -8
  139. package/dist/tools/ask-user.js +0 -47
  140. package/dist/tools/bash.d.ts +0 -47
  141. package/dist/tools/bash.js +0 -213
  142. package/dist/tools/edit-file.d.ts +0 -9
  143. package/dist/tools/edit-file.js +0 -76
  144. package/dist/tools/glob.d.ts +0 -8
  145. package/dist/tools/glob.js +0 -101
  146. package/dist/tools/grep.d.ts +0 -10
  147. package/dist/tools/grep.js +0 -76
  148. package/dist/tools/index.d.ts +0 -24
  149. package/dist/tools/index.js +0 -47
  150. package/dist/tools/read-files.d.ts +0 -8
  151. package/dist/tools/read-files.js +0 -81
  152. package/dist/tools/write-file.d.ts +0 -8
package/README.md ADDED
@@ -0,0 +1,53 @@
1
+ # keve-agent 使用指南
2
+
3
+ ## 1. 安装
4
+
5
+ ```bash
6
+ # 在目标项目中安装
7
+ pnpm add -D c
8
+ ```
9
+
10
+ ## 2. 初始化项目
11
+
12
+ ```bash
13
+ # 在业务项目根目录执行
14
+ keve init
15
+
16
+ # 创建的文件和目录:
17
+ # .keve/ — keve 工作区
18
+ # keve_test_spec/ — 共享模块(POM + fixtures + config)
19
+ # .codeflicker/skills/keve-case-generation/ — 用例生成 Skill
20
+ # .codeflicker/skills/keve-script-generation/ — 脚本生成 Skill
21
+ # .codeflicker/skills/keve-test-eval/ — 执行与评估 Skill
22
+ # .codeflicker/agents/keve-test-agent.md — 测试编排 Agent
23
+
24
+ # 覆盖已有文件
25
+ keve init --force
26
+ ```
27
+
28
+ **职责边界**:
29
+ - **keve-script-generation**:源码分析 + 打标 + POM + spec 生成(不做执行和修复)
30
+ - **keve-test-eval**:执行 + 评估 + 根因分析 + 修复建议 + 重跑(单次闭环)
31
+ - **keve-test-agent**:编排层,控制调用顺序和修复轮次上限(≤3 轮)
32
+
33
+ ## 3. 执行测试
34
+
35
+ > 日常使用建议通过 Skill/Agent 触发,CLI 命令保留作为底层入口。
36
+
37
+ ```bash
38
+ /keve-test-agent 根据需求xxx和代码变更xx 生成测试用例并执行
39
+ ```
40
+
41
+ 手动执行
42
+ ```bash
43
+ KEVE_TASK_DIR=.keve/mr-868-temp npx keve run --config=keve_test_spec/keve-test.config.ts # e2e用例执行
44
+ keve vitest --coverage 2>&1 | head -30 # 单元测试 组件测试执行
45
+ ```
46
+
47
+ ## 4. 自定义模型 .env
48
+
49
+ ```bash
50
+ KEVE_LLM_BASE_URL=https://xxx/api/agent/v1/apps
51
+ KEVE_LLM_MODEL=xxx
52
+ KEVE_LLM_API_KEY=your-api-key
53
+ ```
@@ -0,0 +1,13 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * keve - AI-powered full-stack test agent CLI
4
+ *
5
+ * Commands:
6
+ * init Initialize .keve/ directory and inject Skill
7
+ * run Execute Playwright E2E tests
8
+ * vitest Execute Vitest unit/component tests
9
+ * report Generate HTML summary report
10
+ * test Full pipeline: run → report
11
+ * clean Clean test artifacts
12
+ */
13
+ export {};
@@ -0,0 +1,164 @@
1
+ #!/usr/bin/env node
2
+ "use strict";
3
+ /**
4
+ * keve - AI-powered full-stack test agent CLI
5
+ *
6
+ * Commands:
7
+ * init Initialize .keve/ directory and inject Skill
8
+ * run Execute Playwright E2E tests
9
+ * vitest Execute Vitest unit/component tests
10
+ * report Generate HTML summary report
11
+ * test Full pipeline: run → report
12
+ * clean Clean test artifacts
13
+ */
14
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
15
+ if (k2 === undefined) k2 = k;
16
+ var desc = Object.getOwnPropertyDescriptor(m, k);
17
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
18
+ desc = { enumerable: true, get: function() { return m[k]; } };
19
+ }
20
+ Object.defineProperty(o, k2, desc);
21
+ }) : (function(o, m, k, k2) {
22
+ if (k2 === undefined) k2 = k;
23
+ o[k2] = m[k];
24
+ }));
25
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
26
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
27
+ }) : function(o, v) {
28
+ o["default"] = v;
29
+ });
30
+ var __importStar = (this && this.__importStar) || (function () {
31
+ var ownKeys = function(o) {
32
+ ownKeys = Object.getOwnPropertyNames || function (o) {
33
+ var ar = [];
34
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
35
+ return ar;
36
+ };
37
+ return ownKeys(o);
38
+ };
39
+ return function (mod) {
40
+ if (mod && mod.__esModule) return mod;
41
+ var result = {};
42
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
43
+ __setModuleDefault(result, mod);
44
+ return result;
45
+ };
46
+ })();
47
+ Object.defineProperty(exports, "__esModule", { value: true });
48
+ const commander_1 = require("commander");
49
+ const path = __importStar(require("node:path"));
50
+ // package.json is in the package root, not in dist/
51
+ // __dirname → dist/bin/ → go up 2 levels to package root
52
+ const pkgPath = path.resolve(__dirname, '..', '..', 'package.json');
53
+ const pkg = require(pkgPath);
54
+ const program = new commander_1.Command();
55
+ program
56
+ .name('keve')
57
+ .description('AI-powered full-stack test agent')
58
+ .version(pkg.version);
59
+ // ─── init ──────────────────────────────────────────────────
60
+ program
61
+ .command('init')
62
+ .description('Initialize .keve/ directory and inject Skill')
63
+ .option('--loop <type>', 'Inject Skill to loop framework (myflicker)')
64
+ .option('--skip-skill', 'Only create .keve/ directory, skip Skill injection')
65
+ .option('--force', 'Overwrite existing files')
66
+ .option('--cdp', 'Enable CDP mode in generated Playwright config')
67
+ .option('--base-url <url>', 'Target application URL for Playwright config')
68
+ .action(async (options) => {
69
+ const { init } = await Promise.resolve().then(() => __importStar(require('../commands/init.js')));
70
+ await init(options);
71
+ });
72
+ // ─── config ────────────────────────────────────────────────
73
+ program
74
+ .command('config')
75
+ .description('Create or update Playwright config')
76
+ .option('--base-url <url>', 'Target application URL')
77
+ .option('--cdp', 'Enable CDP mode (connect to running Chrome)')
78
+ .option('--cdp-endpoint <url>', 'CDP endpoint URL')
79
+ .option('--no-web-server', 'Disable webServer section')
80
+ .option('--workers <n>', 'Number of parallel workers', '3')
81
+ .option('--timeout <ms>', 'Test timeout in ms', '1200000')
82
+ .option('--retries <n>', 'Retry count', '0')
83
+ .option('--output <path>', 'Config output path')
84
+ .option('--force', 'Overwrite existing config')
85
+ .option('--show', 'Show current config path and contents')
86
+ .option('--print', 'Print generated config to stdout (no file write)')
87
+ .action(async (options) => {
88
+ const { config } = await Promise.resolve().then(() => __importStar(require('../commands/config.js')));
89
+ await config(options);
90
+ });
91
+ // ─── run ───────────────────────────────────────────────────
92
+ program
93
+ .command('run')
94
+ .description('Execute Playwright tests')
95
+ .option('--config <path>', 'Playwright config path', '.keve/keve-test.config.ts')
96
+ .option('--round <N>', 'Execution round number (auto-increment if omitted)')
97
+ .option('--retry-from <round>', 'Re-run failed cases from specified round number')
98
+ .option('--cases <names>', 'Run specific cases by name (comma-separated)')
99
+ .option('--grep <pattern>', 'Filter cases by regex pattern')
100
+ .option('--verbose', 'Verbose output')
101
+ .action(async (options) => {
102
+ const { run, KeveRunError } = await Promise.resolve().then(() => __importStar(require('../commands/run.js')));
103
+ try {
104
+ await run(options);
105
+ }
106
+ catch (e) {
107
+ if (e instanceof KeveRunError) {
108
+ console.error(`\n ✗ ${e.message}`);
109
+ process.exit(1);
110
+ }
111
+ throw e;
112
+ }
113
+ });
114
+ // ─── vitest ────────────────────────────────────────────────
115
+ program
116
+ .command('vitest')
117
+ .description('Execute Vitest unit/component tests')
118
+ .option('--config <path>', 'Vitest config path', 'keve_test_spec/vitest.config.ts')
119
+ .option('--watch', 'Run in watch mode')
120
+ .option('--coverage', 'Generate coverage report')
121
+ .option('--filter <glob>', 'Run tests matching glob pattern')
122
+ .option('--verbose', 'Verbose output')
123
+ .action(async (options) => {
124
+ const { vitest } = await Promise.resolve().then(() => __importStar(require('../commands/vitest.js')));
125
+ await vitest(options);
126
+ });
127
+ // ─── report ────────────────────────────────────────────────
128
+ program
129
+ .command('report')
130
+ .description('Generate HTML summary report')
131
+ .option('--results <path>', 'test-results.json path')
132
+ .option('--cases <path>', 'test-cases.yaml path')
133
+ .option('--output <dir>', 'Output directory')
134
+ .option('--round <N>', 'Report round number')
135
+ .action(async (options) => {
136
+ const { report } = await Promise.resolve().then(() => __importStar(require('../commands/report.js')));
137
+ await report(options);
138
+ });
139
+ // ─── test (full pipeline) ──────────────────────────────────
140
+ program
141
+ .command('test')
142
+ .description('Full pipeline: run → report')
143
+ .option('--config <path>', 'Playwright config path')
144
+ .option('--grep <pattern>', 'Run tests matching pattern')
145
+ .option('--max-rounds <N>', 'Max fix loop rounds', '3')
146
+ .option('--verbose', 'Show detailed output')
147
+ .action(async (options) => {
148
+ const { test } = await Promise.resolve().then(() => __importStar(require('../commands/test.js')));
149
+ await test(options);
150
+ });
151
+ // ─── clean ─────────────────────────────────────────────────
152
+ program
153
+ .command('clean')
154
+ .description('Clean test artifacts')
155
+ .option('--rounds', 'Clean round artifacts only')
156
+ .option('--reports', 'Clean reports only')
157
+ .option('--all', 'Clean all artifacts')
158
+ .option('--dry-run', 'Preview without deleting')
159
+ .action(async (options) => {
160
+ const { clean } = await Promise.resolve().then(() => __importStar(require('../commands/clean.js')));
161
+ await clean(options);
162
+ });
163
+ // ─── Parse ─────────────────────────────────────────────────
164
+ program.parse();
@@ -0,0 +1,16 @@
1
+ /**
2
+ * keve auth-update - Update auth storage state (cookies/localStorage)
3
+ *
4
+ * Opens a browser for the user to manually log in, then saves the
5
+ * storage state to `.auth/storage-state.json`.
6
+ *
7
+ * Usage:
8
+ * npx keve auth-update
9
+ * npx keve auth-update --url http://localhost:3000
10
+ * npx keve auth-update --config .keve/keve-test.config.ts
11
+ */
12
+ export interface AuthUpdateOptions {
13
+ url?: string;
14
+ config?: string;
15
+ }
16
+ export declare function authUpdate(options?: AuthUpdateOptions): Promise<void>;
@@ -0,0 +1,88 @@
1
+ "use strict";
2
+ /**
3
+ * keve auth-update - Update auth storage state (cookies/localStorage)
4
+ *
5
+ * Opens a browser for the user to manually log in, then saves the
6
+ * storage state to `.auth/storage-state.json`.
7
+ *
8
+ * Usage:
9
+ * npx keve auth-update
10
+ * npx keve auth-update --url http://localhost:3000
11
+ * npx keve auth-update --config .keve/keve-test.config.ts
12
+ */
13
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
14
+ if (k2 === undefined) k2 = k;
15
+ var desc = Object.getOwnPropertyDescriptor(m, k);
16
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
17
+ desc = { enumerable: true, get: function() { return m[k]; } };
18
+ }
19
+ Object.defineProperty(o, k2, desc);
20
+ }) : (function(o, m, k, k2) {
21
+ if (k2 === undefined) k2 = k;
22
+ o[k2] = m[k];
23
+ }));
24
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
25
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
26
+ }) : function(o, v) {
27
+ o["default"] = v;
28
+ });
29
+ var __importStar = (this && this.__importStar) || (function () {
30
+ var ownKeys = function(o) {
31
+ ownKeys = Object.getOwnPropertyNames || function (o) {
32
+ var ar = [];
33
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
34
+ return ar;
35
+ };
36
+ return ownKeys(o);
37
+ };
38
+ return function (mod) {
39
+ if (mod && mod.__esModule) return mod;
40
+ var result = {};
41
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
42
+ __setModuleDefault(result, mod);
43
+ return result;
44
+ };
45
+ })();
46
+ var __importDefault = (this && this.__importDefault) || function (mod) {
47
+ return (mod && mod.__esModule) ? mod : { "default": mod };
48
+ };
49
+ Object.defineProperty(exports, "__esModule", { value: true });
50
+ exports.authUpdate = authUpdate;
51
+ const chalk_1 = __importDefault(require("chalk"));
52
+ const path = __importStar(require("path"));
53
+ const auth_1 = require("../core/auth");
54
+ async function authUpdate(options = {}) {
55
+ const targetUrl = options.url || process.env.PWGEN_TARGET_URL || 'http://localhost:3000';
56
+ const storageStatePath = path.resolve(process.cwd(), '.auth/storage-state.json');
57
+ console.log(chalk_1.default.cyan('\n keve auth-update'));
58
+ console.log(chalk_1.default.gray(` Target URL: ${targetUrl}`));
59
+ console.log(chalk_1.default.gray(` Storage state: ${storageStatePath}`));
60
+ console.log(chalk_1.default.yellow('\n Opening browser for manual login...'));
61
+ console.log(chalk_1.default.gray(' (Auto-save when you navigate away from login page)\n'));
62
+ const success = await (0, auth_1.acquireStorageState)({
63
+ targetUrl,
64
+ storageStatePath,
65
+ logPrefix: ' [keve auth-update]',
66
+ onLoginDetected: (url) => console.log(chalk_1.default.green(` Login detected! URL: ${url}`)),
67
+ onStateSaved: (cookieCount, originCount) => {
68
+ console.log(chalk_1.default.green(`\n ✓ Auth state saved`));
69
+ console.log(chalk_1.default.gray(` Cookies: ${cookieCount}, localStorage origins: ${originCount}`));
70
+ if (cookieCount === 0) {
71
+ console.log(chalk_1.default.yellow(' ⚠ No cookies saved — login may not have completed.'));
72
+ console.log(chalk_1.default.yellow(' Try `npx keve auth-update` again.'));
73
+ }
74
+ else {
75
+ console.log(chalk_1.default.green(' ✓ Auth update complete! Run tests with: npx keve run'));
76
+ }
77
+ },
78
+ onError: (msg) => console.error(chalk_1.default.red(` Error: ${msg}`)),
79
+ onBrowserFailed: (msg) => {
80
+ console.error(chalk_1.default.red(` Cannot launch browser: ${msg}`));
81
+ console.error(chalk_1.default.yellow(' Ensure a display is available, or run in a local environment.'));
82
+ },
83
+ });
84
+ if (!success && !options.url) {
85
+ console.log(chalk_1.default.yellow('\n Hint: Specify target URL if different from default:'));
86
+ console.log(chalk_1.default.yellow(' npx keve auth-update --url http://your-app-url'));
87
+ }
88
+ }
@@ -0,0 +1,10 @@
1
+ /**
2
+ * keve clean - Clean test artifacts
3
+ */
4
+ export interface CleanOptions {
5
+ rounds?: boolean;
6
+ reports?: boolean;
7
+ all?: boolean;
8
+ dryRun?: boolean;
9
+ }
10
+ export declare function clean(options: CleanOptions): Promise<void>;
@@ -0,0 +1,78 @@
1
+ "use strict";
2
+ /**
3
+ * keve clean - Clean test artifacts
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.clean = clean;
43
+ const fs = __importStar(require("node:fs"));
44
+ const path = __importStar(require("node:path"));
45
+ const chalk_1 = __importDefault(require("chalk"));
46
+ const config_1 = require("../config");
47
+ function removeDir(dir, dryRun) {
48
+ if (!fs.existsSync(dir))
49
+ return;
50
+ if (dryRun) {
51
+ console.log(chalk_1.default.gray(` [dry-run] Would remove: ${path.relative(process.cwd(), dir)}`));
52
+ return;
53
+ }
54
+ fs.rmSync(dir, { recursive: true, force: true });
55
+ console.log(chalk_1.default.green(` ✓ Removed: ${path.relative(process.cwd(), dir)}`));
56
+ }
57
+ async function clean(options) {
58
+ const keveDir = (0, config_1.findKeveDir)();
59
+ if (!keveDir) {
60
+ console.error(chalk_1.default.red(' ✗ .keve/ directory not found'));
61
+ process.exit(1);
62
+ }
63
+ console.log(chalk_1.default.cyan('\n🧹 keve clean\n'));
64
+ if (options.all || (!options.rounds && !options.reports)) {
65
+ // Default: clean both
66
+ removeDir(path.join(keveDir, 'test-artifacts'), !!options.dryRun);
67
+ removeDir(path.join(keveDir, 'reports'), !!options.dryRun);
68
+ console.log(chalk_1.default.green(' ✓ Cleaned all artifacts and reports'));
69
+ return;
70
+ }
71
+ if (options.rounds) {
72
+ removeDir(path.join(keveDir, 'test-artifacts'), !!options.dryRun);
73
+ }
74
+ if (options.reports) {
75
+ removeDir(path.join(keveDir, 'reports'), !!options.dryRun);
76
+ }
77
+ console.log(chalk_1.default.green('\n ✓ Clean complete\n'));
78
+ }
@@ -0,0 +1,17 @@
1
+ /**
2
+ * keve config - Create or update Playwright config
3
+ */
4
+ export interface ConfigOptions {
5
+ baseUrl?: string;
6
+ cdp?: boolean;
7
+ cdpEndpoint?: string;
8
+ webServer?: boolean;
9
+ workers?: string;
10
+ timeout?: string;
11
+ retries?: string;
12
+ output?: string;
13
+ force?: boolean;
14
+ show?: boolean;
15
+ print?: boolean;
16
+ }
17
+ export declare function config(options: ConfigOptions): Promise<void>;
@@ -0,0 +1,99 @@
1
+ "use strict";
2
+ /**
3
+ * keve config - Create or update Playwright config
4
+ */
5
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
6
+ if (k2 === undefined) k2 = k;
7
+ var desc = Object.getOwnPropertyDescriptor(m, k);
8
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
9
+ desc = { enumerable: true, get: function() { return m[k]; } };
10
+ }
11
+ Object.defineProperty(o, k2, desc);
12
+ }) : (function(o, m, k, k2) {
13
+ if (k2 === undefined) k2 = k;
14
+ o[k2] = m[k];
15
+ }));
16
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
17
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
18
+ }) : function(o, v) {
19
+ o["default"] = v;
20
+ });
21
+ var __importStar = (this && this.__importStar) || (function () {
22
+ var ownKeys = function(o) {
23
+ ownKeys = Object.getOwnPropertyNames || function (o) {
24
+ var ar = [];
25
+ for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
26
+ return ar;
27
+ };
28
+ return ownKeys(o);
29
+ };
30
+ return function (mod) {
31
+ if (mod && mod.__esModule) return mod;
32
+ var result = {};
33
+ if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
34
+ __setModuleDefault(result, mod);
35
+ return result;
36
+ };
37
+ })();
38
+ var __importDefault = (this && this.__importDefault) || function (mod) {
39
+ return (mod && mod.__esModule) ? mod : { "default": mod };
40
+ };
41
+ Object.defineProperty(exports, "__esModule", { value: true });
42
+ exports.config = config;
43
+ const fs = __importStar(require("node:fs"));
44
+ const path = __importStar(require("node:path"));
45
+ const chalk_1 = __importDefault(require("chalk"));
46
+ const config_1 = require("../config");
47
+ const pw_config_1 = require("../core/pw-config");
48
+ async function config(options) {
49
+ const keveDir = (0, config_1.findKeveDir)();
50
+ const taskDir = (0, config_1.resolveTaskDir)(keveDir);
51
+ if (options.show) {
52
+ const configPath = (0, pw_config_1.findExistingConfig)(keveDir, taskDir);
53
+ if (configPath) {
54
+ console.log(chalk_1.default.green(` Config: ${configPath}`));
55
+ console.log(fs.readFileSync(configPath, 'utf-8'));
56
+ }
57
+ else {
58
+ console.log(chalk_1.default.yellow(' No keve-test.config.ts found'));
59
+ console.log(chalk_1.default.gray(' Run: keve config to create one'));
60
+ }
61
+ return;
62
+ }
63
+ const pwOptions = {
64
+ baseUrl: options.baseUrl || process.env.BASE_URL || process.env.PWGEN_TARGET_URL,
65
+ cdp: options.cdp,
66
+ cdpEndpoint: options.cdpEndpoint,
67
+ webServer: options.webServer === false ? false : undefined,
68
+ workers: options.workers ? parseInt(options.workers, 10) : undefined,
69
+ timeout: options.timeout ? parseInt(options.timeout, 10) : undefined,
70
+ retries: options.retries ? parseInt(options.retries, 10) : undefined,
71
+ };
72
+ const content = (0, pw_config_1.generatePwConfig)(pwOptions);
73
+ if (options.print) {
74
+ console.log(content);
75
+ return;
76
+ }
77
+ const outputPath = options.output
78
+ ? path.resolve(options.output)
79
+ : (0, pw_config_1.resolveConfigOutputPath)();
80
+ console.log(chalk_1.default.cyan('\n⚙️ keve config\n'));
81
+ if (fs.existsSync(outputPath) && !options.force) {
82
+ console.log(chalk_1.default.yellow(` ⚠ ${path.relative(process.cwd(), outputPath)} already exists. Use --force to overwrite.`));
83
+ console.log(chalk_1.default.gray(' Use --show to view current config'));
84
+ return;
85
+ }
86
+ fs.mkdirSync(path.dirname(outputPath), { recursive: true });
87
+ fs.writeFileSync(outputPath, content, 'utf-8');
88
+ console.log(chalk_1.default.green(` ✓ Created: ${path.relative(process.cwd(), outputPath)}`));
89
+ console.log(chalk_1.default.gray(` baseURL: ${pwOptions.baseUrl || '(from env)'}`));
90
+ console.log(chalk_1.default.gray(` CDP: ${pwOptions.cdp ? 'enabled' : 'disabled'}`));
91
+ console.log(chalk_1.default.gray(` webServer: ${pwOptions.webServer !== false ? 'enabled' : 'disabled'}`));
92
+ console.log(chalk_1.default.gray(` workers: ${pwOptions.workers || 3}`));
93
+ console.log(chalk_1.default.gray(` timeout: ${pwOptions.timeout || 60000}ms`));
94
+ if (pwOptions.cdp) {
95
+ console.log(chalk_1.default.blue('\n CDP Mode:'));
96
+ console.log(chalk_1.default.gray(' Set KEVE_CDP_ENDPOINT=http://[::1]:9222 before running tests'));
97
+ }
98
+ console.log(chalk_1.default.green('\n ✓ Config complete\n'));
99
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * keve init - Initialize .keve/ directory and inject Skills
3
+ *
4
+ * Creates the .keve/ workspace, Playwright infrastructure,
5
+ * and copies keve skills into .codeflicker/skills/.
6
+ *
7
+ * Note: keveAssert is exported directly from @ks-data/keve-suite (import { keveAssert } from '@ks-data/keve-suite')
8
+ * — no file needs to be written to the project.
9
+ */
10
+ export interface InitOptions {
11
+ force?: boolean;
12
+ cdp?: boolean;
13
+ baseUrl?: string;
14
+ }
15
+ export declare function init(options: InitOptions): Promise<void>;