@kody-ade/kody-engine-lite 0.1.104 → 0.1.105

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 (75) hide show
  1. package/README.md +1 -1
  2. package/dist/bin/cli.js +759 -1037
  3. package/package.json +1 -1
  4. package/prompts/autofix.md +20 -33
  5. package/prompts/review-fix.md +8 -12
  6. package/prompts/taskify.md +2 -19
  7. package/templates/kody.yml +26 -17
  8. package/dist/agent-runner.d.ts +0 -4
  9. package/dist/agent-runner.js +0 -122
  10. package/dist/ci/parse-inputs.d.ts +0 -6
  11. package/dist/ci/parse-inputs.js +0 -76
  12. package/dist/ci/parse-safety.d.ts +0 -6
  13. package/dist/ci/parse-safety.js +0 -22
  14. package/dist/cli/args.d.ts +0 -13
  15. package/dist/cli/args.js +0 -42
  16. package/dist/cli/litellm.d.ts +0 -2
  17. package/dist/cli/litellm.js +0 -85
  18. package/dist/cli/task-resolution.d.ts +0 -2
  19. package/dist/cli/task-resolution.js +0 -41
  20. package/dist/config.d.ts +0 -49
  21. package/dist/config.js +0 -72
  22. package/dist/context.d.ts +0 -4
  23. package/dist/context.js +0 -83
  24. package/dist/definitions.d.ts +0 -3
  25. package/dist/definitions.js +0 -59
  26. package/dist/entry.d.ts +0 -1
  27. package/dist/entry.js +0 -236
  28. package/dist/git-utils.d.ts +0 -13
  29. package/dist/git-utils.js +0 -174
  30. package/dist/github-api.d.ts +0 -14
  31. package/dist/github-api.js +0 -114
  32. package/dist/kody-utils.d.ts +0 -1
  33. package/dist/kody-utils.js +0 -9
  34. package/dist/learning/auto-learn.d.ts +0 -2
  35. package/dist/learning/auto-learn.js +0 -169
  36. package/dist/logger.d.ts +0 -14
  37. package/dist/logger.js +0 -51
  38. package/dist/memory.d.ts +0 -1
  39. package/dist/memory.js +0 -20
  40. package/dist/observer.d.ts +0 -9
  41. package/dist/observer.js +0 -80
  42. package/dist/pipeline/complexity.d.ts +0 -3
  43. package/dist/pipeline/complexity.js +0 -12
  44. package/dist/pipeline/executor-registry.d.ts +0 -3
  45. package/dist/pipeline/executor-registry.js +0 -20
  46. package/dist/pipeline/hooks.d.ts +0 -17
  47. package/dist/pipeline/hooks.js +0 -110
  48. package/dist/pipeline/questions.d.ts +0 -2
  49. package/dist/pipeline/questions.js +0 -44
  50. package/dist/pipeline/runner-selection.d.ts +0 -2
  51. package/dist/pipeline/runner-selection.js +0 -13
  52. package/dist/pipeline/state.d.ts +0 -4
  53. package/dist/pipeline/state.js +0 -37
  54. package/dist/pipeline.d.ts +0 -3
  55. package/dist/pipeline.js +0 -213
  56. package/dist/preflight.d.ts +0 -1
  57. package/dist/preflight.js +0 -69
  58. package/dist/retrospective.d.ts +0 -26
  59. package/dist/retrospective.js +0 -211
  60. package/dist/stages/agent.d.ts +0 -2
  61. package/dist/stages/agent.js +0 -94
  62. package/dist/stages/gate.d.ts +0 -2
  63. package/dist/stages/gate.js +0 -32
  64. package/dist/stages/review.d.ts +0 -2
  65. package/dist/stages/review.js +0 -32
  66. package/dist/stages/ship.d.ts +0 -3
  67. package/dist/stages/ship.js +0 -154
  68. package/dist/stages/verify.d.ts +0 -2
  69. package/dist/stages/verify.js +0 -94
  70. package/dist/types.d.ts +0 -61
  71. package/dist/types.js +0 -1
  72. package/dist/validators.d.ts +0 -8
  73. package/dist/validators.js +0 -42
  74. package/dist/verify-runner.d.ts +0 -11
  75. package/dist/verify-runner.js +0 -110
package/dist/types.d.ts DELETED
@@ -1,61 +0,0 @@
1
- export type StageName = "taskify" | "plan" | "build" | "verify" | "review" | "review-fix" | "ship";
2
- export type StageType = "agent" | "gate" | "deterministic";
3
- export type PipelineState = "pending" | "running" | "completed" | "failed" | "timeout";
4
- export interface StageDefinition {
5
- name: StageName;
6
- type: StageType;
7
- modelTier: "cheap" | "mid" | "strong";
8
- timeout: number;
9
- maxRetries: number;
10
- outputFile?: string;
11
- retryWithAgent?: string;
12
- }
13
- export interface StageState {
14
- state: PipelineState;
15
- startedAt?: string;
16
- completedAt?: string;
17
- retries: number;
18
- error?: string;
19
- outputFile?: string;
20
- }
21
- export interface PipelineStatus {
22
- taskId: string;
23
- state: "running" | "completed" | "failed";
24
- stages: Record<StageName, StageState>;
25
- createdAt: string;
26
- updatedAt: string;
27
- }
28
- export interface StageResult {
29
- outcome: "completed" | "failed" | "timed_out";
30
- outputFile?: string;
31
- error?: string;
32
- retries: number;
33
- }
34
- export interface AgentResult {
35
- outcome: "completed" | "failed" | "timed_out";
36
- output?: string;
37
- error?: string;
38
- }
39
- export interface AgentRunnerOptions {
40
- cwd?: string;
41
- env?: Record<string, string>;
42
- }
43
- export interface AgentRunner {
44
- run(stageName: string, prompt: string, model: string, timeout: number, taskDir: string, options?: AgentRunnerOptions): Promise<AgentResult>;
45
- healthCheck(): Promise<boolean>;
46
- }
47
- export interface PipelineContext {
48
- taskId: string;
49
- taskDir: string;
50
- projectDir: string;
51
- runners: Record<string, AgentRunner>;
52
- input: {
53
- mode: "full" | "rerun" | "status";
54
- fromStage?: string;
55
- dryRun?: boolean;
56
- issueNumber?: number;
57
- feedback?: string;
58
- local?: boolean;
59
- complexity?: "low" | "medium" | "high";
60
- };
61
- }
package/dist/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
@@ -1,8 +0,0 @@
1
- export interface ValidationResult {
2
- valid: boolean;
3
- error?: string;
4
- }
5
- export declare function stripFences(content: string): string;
6
- export declare function validateTaskJson(content: string): ValidationResult;
7
- export declare function validatePlanMd(content: string): ValidationResult;
8
- export declare function validateReviewMd(content: string): ValidationResult;
@@ -1,42 +0,0 @@
1
- const REQUIRED_TASK_FIELDS = [
2
- "task_type",
3
- "title",
4
- "description",
5
- "scope",
6
- "risk_level",
7
- ];
8
- export function stripFences(content) {
9
- return content.replace(/^```json\s*\n?/m, "").replace(/\n?```\s*$/m, "");
10
- }
11
- export function validateTaskJson(content) {
12
- try {
13
- const parsed = JSON.parse(stripFences(content));
14
- for (const field of REQUIRED_TASK_FIELDS) {
15
- if (!(field in parsed)) {
16
- return { valid: false, error: `Missing field: ${field}` };
17
- }
18
- }
19
- return { valid: true };
20
- }
21
- catch (err) {
22
- return {
23
- valid: false,
24
- error: `Invalid JSON: ${err instanceof Error ? err.message : String(err)}`,
25
- };
26
- }
27
- }
28
- export function validatePlanMd(content) {
29
- if (content.length < 10) {
30
- return { valid: false, error: "Plan is too short (< 10 chars)" };
31
- }
32
- if (!/^##\s+\w+/m.test(content)) {
33
- return { valid: false, error: "Plan has no markdown h2 sections" };
34
- }
35
- return { valid: true };
36
- }
37
- export function validateReviewMd(content) {
38
- if (/pass/i.test(content) || /fail/i.test(content)) {
39
- return { valid: true };
40
- }
41
- return { valid: false, error: "Review must contain 'pass' or 'fail'" };
42
- }
@@ -1,11 +0,0 @@
1
- export interface VerifyResult {
2
- pass: boolean;
3
- errors: string[];
4
- summary: string[];
5
- }
6
- /**
7
- * Parse a command string into [executable, ...args], respecting quoted arguments.
8
- * e.g., 'pnpm -s "test:unit"' → ["pnpm", "-s", "test:unit"]
9
- */
10
- export declare function parseCommand(cmd: string): string[];
11
- export declare function runQualityGates(taskDir: string, projectRoot?: string): VerifyResult;
@@ -1,110 +0,0 @@
1
- import { execFileSync } from "child_process";
2
- import { getProjectConfig, VERIFY_COMMAND_TIMEOUT_MS } from "./config.js";
3
- import { logger } from "./logger.js";
4
- function isExecError(err) {
5
- return typeof err === "object" && err !== null;
6
- }
7
- /**
8
- * Parse a command string into [executable, ...args], respecting quoted arguments.
9
- * e.g., 'pnpm -s "test:unit"' → ["pnpm", "-s", "test:unit"]
10
- */
11
- export function parseCommand(cmd) {
12
- const parts = [];
13
- let current = "";
14
- let inQuote = null;
15
- for (const ch of cmd) {
16
- if (inQuote) {
17
- if (ch === inQuote) {
18
- inQuote = null;
19
- }
20
- else {
21
- current += ch;
22
- }
23
- }
24
- else if (ch === '"' || ch === "'") {
25
- inQuote = ch;
26
- }
27
- else if (/\s/.test(ch)) {
28
- if (current) {
29
- parts.push(current);
30
- current = "";
31
- }
32
- }
33
- else {
34
- current += ch;
35
- }
36
- }
37
- if (current)
38
- parts.push(current);
39
- if (inQuote)
40
- logger.warn(`Unclosed quote in command: ${cmd}`);
41
- return parts;
42
- }
43
- function runCommand(cmd, cwd, timeout) {
44
- const parts = parseCommand(cmd);
45
- if (parts.length === 0) {
46
- return { success: true, output: "", timedOut: false };
47
- }
48
- try {
49
- const output = execFileSync(parts[0], parts.slice(1), {
50
- cwd,
51
- timeout,
52
- encoding: "utf-8",
53
- stdio: ["pipe", "pipe", "pipe"],
54
- env: { ...process.env, FORCE_COLOR: "0" },
55
- });
56
- return { success: true, output: output ?? "", timedOut: false };
57
- }
58
- catch (err) {
59
- const stdout = isExecError(err) ? err.stdout ?? "" : "";
60
- const stderr = isExecError(err) ? err.stderr ?? "" : "";
61
- const killed = isExecError(err) ? !!err.killed : false;
62
- return { success: false, output: `${stdout}${stderr}`, timedOut: killed };
63
- }
64
- }
65
- function parseErrors(output) {
66
- const errors = [];
67
- for (const line of output.split("\n")) {
68
- if (/error|Error|ERROR|failed|Failed|FAIL|warning:|Warning:|WARN/i.test(line)) {
69
- errors.push(line.slice(0, 500));
70
- }
71
- }
72
- return errors;
73
- }
74
- function extractSummary(output, cmdName) {
75
- const summaryPatterns = /Test Suites|Tests|Coverage|ERRORS|FAILURES|success|completed/i;
76
- const lines = output.split("\n").filter((l) => summaryPatterns.test(l));
77
- return lines.slice(-3).map((l) => `[${cmdName}] ${l.trim()}`);
78
- }
79
- export function runQualityGates(taskDir, projectRoot) {
80
- const config = getProjectConfig();
81
- const cwd = projectRoot ?? process.cwd();
82
- const allErrors = [];
83
- const allSummary = [];
84
- let allPass = true;
85
- const commands = [
86
- { name: "typecheck", cmd: config.quality.typecheck },
87
- { name: "test", cmd: config.quality.testUnit },
88
- ];
89
- if (config.quality.lint) {
90
- commands.push({ name: "lint", cmd: config.quality.lint });
91
- }
92
- for (const { name, cmd } of commands) {
93
- if (!cmd)
94
- continue;
95
- logger.info(` Running ${name}: ${cmd}`);
96
- const result = runCommand(cmd, cwd, VERIFY_COMMAND_TIMEOUT_MS);
97
- if (result.timedOut) {
98
- allErrors.push(`${name}: timed out after ${VERIFY_COMMAND_TIMEOUT_MS / 1000}s`);
99
- allPass = false;
100
- continue;
101
- }
102
- if (!result.success) {
103
- allPass = false;
104
- const errors = parseErrors(result.output);
105
- allErrors.push(...errors.map((e) => `[${name}] ${e}`));
106
- }
107
- allSummary.push(...extractSummary(result.output, name));
108
- }
109
- return { pass: allPass, errors: allErrors, summary: allSummary };
110
- }