@untools/devflow 0.2.11 → 0.2.12

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 (106) hide show
  1. package/dist/agent/client.d.ts +50 -0
  2. package/dist/agent/client.d.ts.map +1 -0
  3. package/dist/agent/client.js +52 -0
  4. package/dist/agent/client.js.map +1 -0
  5. package/dist/auth/github-token.d.ts +16 -0
  6. package/dist/auth/github-token.d.ts.map +1 -0
  7. package/dist/auth/github-token.js +69 -0
  8. package/dist/auth/github-token.js.map +1 -0
  9. package/dist/auth/oauth.d.ts +16 -0
  10. package/dist/auth/oauth.d.ts.map +1 -0
  11. package/dist/auth/oauth.js +146 -0
  12. package/dist/auth/oauth.js.map +1 -0
  13. package/dist/cli.d.ts +2 -0
  14. package/dist/cli.d.ts.map +1 -0
  15. package/dist/cli.js +363 -0
  16. package/dist/cli.js.map +1 -0
  17. package/dist/config.d.ts +35 -0
  18. package/dist/config.d.ts.map +1 -0
  19. package/dist/config.js +78 -0
  20. package/dist/config.js.map +1 -0
  21. package/dist/copilot/client.d.ts +75 -0
  22. package/dist/copilot/client.d.ts.map +1 -0
  23. package/dist/copilot/client.js +226 -0
  24. package/dist/copilot/client.js.map +1 -0
  25. package/dist/copilot/flows/base.d.ts +47 -0
  26. package/dist/copilot/flows/base.d.ts.map +1 -0
  27. package/dist/copilot/flows/base.js +235 -0
  28. package/dist/copilot/flows/base.js.map +1 -0
  29. package/dist/copilot/flows/explain.d.ts +5 -0
  30. package/dist/copilot/flows/explain.d.ts.map +1 -0
  31. package/dist/copilot/flows/explain.js +76 -0
  32. package/dist/copilot/flows/explain.js.map +1 -0
  33. package/dist/copilot/flows/feature.d.ts +5 -0
  34. package/dist/copilot/flows/feature.d.ts.map +1 -0
  35. package/dist/copilot/flows/feature.js +83 -0
  36. package/dist/copilot/flows/feature.js.map +1 -0
  37. package/dist/copilot/flows/fix-bug.d.ts +5 -0
  38. package/dist/copilot/flows/fix-bug.d.ts.map +1 -0
  39. package/dist/copilot/flows/fix-bug.js +56 -0
  40. package/dist/copilot/flows/fix-bug.js.map +1 -0
  41. package/dist/copilot/flows/index.d.ts +17 -0
  42. package/dist/copilot/flows/index.d.ts.map +1 -0
  43. package/dist/copilot/flows/index.js +41 -0
  44. package/dist/copilot/flows/index.js.map +1 -0
  45. package/dist/copilot/flows/review-pr.d.ts +5 -0
  46. package/dist/copilot/flows/review-pr.d.ts.map +1 -0
  47. package/dist/copilot/flows/review-pr.js +84 -0
  48. package/dist/copilot/flows/review-pr.js.map +1 -0
  49. package/dist/copilot/session-registry.d.ts +12 -0
  50. package/dist/copilot/session-registry.d.ts.map +1 -0
  51. package/dist/copilot/session-registry.js +39 -0
  52. package/dist/copilot/session-registry.js.map +1 -0
  53. package/dist/copilot/tools/files.d.ts +53 -0
  54. package/dist/copilot/tools/files.d.ts.map +1 -0
  55. package/dist/copilot/tools/files.js +250 -0
  56. package/dist/copilot/tools/files.js.map +1 -0
  57. package/dist/copilot/tools/git.d.ts +37 -0
  58. package/dist/copilot/tools/git.d.ts.map +1 -0
  59. package/dist/copilot/tools/git.js +246 -0
  60. package/dist/copilot/tools/git.js.map +1 -0
  61. package/dist/copilot/tools/github.d.ts +36 -0
  62. package/dist/copilot/tools/github.d.ts.map +1 -0
  63. package/dist/copilot/tools/github.js +216 -0
  64. package/dist/copilot/tools/github.js.map +1 -0
  65. package/dist/copilot/tools/index.d.ts +26 -0
  66. package/dist/copilot/tools/index.d.ts.map +1 -0
  67. package/dist/copilot/tools/index.js +25 -0
  68. package/dist/copilot/tools/index.js.map +1 -0
  69. package/dist/copilot/tools/progress.d.ts +19 -0
  70. package/dist/copilot/tools/progress.d.ts.map +1 -0
  71. package/dist/copilot/tools/progress.js +87 -0
  72. package/dist/copilot/tools/progress.js.map +1 -0
  73. package/dist/copilot/tools/tests.d.ts +29 -0
  74. package/dist/copilot/tools/tests.d.ts.map +1 -0
  75. package/dist/copilot/tools/tests.js +136 -0
  76. package/dist/copilot/tools/tests.js.map +1 -0
  77. package/dist/copilot/tools/utils.d.ts +14 -0
  78. package/dist/copilot/tools/utils.d.ts.map +1 -0
  79. package/dist/copilot/tools/utils.js +89 -0
  80. package/dist/copilot/tools/utils.js.map +1 -0
  81. package/dist/credentials.d.ts +21 -0
  82. package/dist/credentials.d.ts.map +1 -0
  83. package/dist/credentials.js +62 -0
  84. package/dist/credentials.js.map +1 -0
  85. package/dist/devflow/client.d.ts +16 -0
  86. package/dist/devflow/client.d.ts.map +1 -0
  87. package/dist/devflow/client.js +61 -0
  88. package/dist/devflow/client.js.map +1 -0
  89. package/dist/index.d.ts +2 -0
  90. package/dist/index.d.ts.map +1 -0
  91. package/dist/index.js +7 -0
  92. package/dist/index.js.map +1 -0
  93. package/dist/pinga/client.d.ts +16 -0
  94. package/dist/pinga/client.d.ts.map +1 -0
  95. package/dist/pinga/client.js +61 -0
  96. package/dist/pinga/client.js.map +1 -0
  97. package/dist/types.d.ts +58 -0
  98. package/dist/types.d.ts.map +1 -0
  99. package/dist/types.js +2 -0
  100. package/dist/types.js.map +1 -0
  101. package/dist/verify-full-flow.d.ts +2 -0
  102. package/dist/verify-full-flow.d.ts.map +1 -0
  103. package/dist/verify-full-flow.js +81 -0
  104. package/dist/verify-full-flow.js.map +1 -0
  105. package/package.json +8 -1
  106. package/.versionrc.json +0 -53
@@ -0,0 +1,83 @@
1
+ // Feature Implementation Workflow
2
+ // Automatically implements new features in a repository
3
+ import { WorkflowExecutor } from "./base.js";
4
+ export class FeatureWorkflow extends WorkflowExecutor {
5
+ async execute(context) {
6
+ try {
7
+ await this.sendProgress(context.taskId, "Starting feature implementation workflow", 0.05, `Repository: ${context.repo}`);
8
+ const systemPrompt = this.buildSystemPrompt("feature", context);
9
+ const isLocal = !!context.localPath;
10
+ const steps = isLocal
11
+ ? `
12
+ 1. Explore the repository structure in ${context.localPath}
13
+ 2. List relevant files and understand the architecture
14
+ 3. Identify the files that need to be created or modified
15
+ 4. Implement the feature:
16
+ - Create new files as needed
17
+ - Modify existing files
18
+ - Follow the existing code patterns and style
19
+ 5. Run tests if available to ensure nothing is broken
20
+ 6. Send final progress update with a summary of changes`
21
+ : `
22
+ 1. Clone the repository to a temporary location
23
+ 2. Explore the repository structure
24
+ 3. List relevant files and understand the architecture
25
+ 4. Create a feature branch: feature/<feature-name>
26
+ 5. Identify the files that need to be created or modified
27
+ 6. Implement the feature:
28
+ - Create new files as needed
29
+ - Modify existing files
30
+ - Follow the existing code patterns and style
31
+ 7. Add appropriate tests for the new feature
32
+ 8. Run tests to ensure nothing is broken
33
+ 9. Commit the changes with a clear, descriptive message
34
+ 10. Push the branch
35
+ 11. Create a pull request
36
+ 12. Send final progress update with the PR URL`;
37
+ const userPrompt = `
38
+ You are tasked with implementing the following feature:
39
+
40
+ ${context.naturalLanguage}
41
+
42
+ ${context.context?.requirements ? `Requirements:\n${context.context.requirements}` : ""}
43
+ ${context.context?.acceptance ? `Acceptance criteria:\n${context.context.acceptance}` : ""}
44
+ ${context.context?.files ? `Related files:\n${context.context.files}` : ""}
45
+
46
+ Follow these steps:
47
+ ${steps}
48
+
49
+ Guidelines:
50
+ - Ask for clarification if requirements are ambiguous
51
+ - Ensure code follows repository conventions
52
+ - Use send_progress_update frequently to keep user informed
53
+ - For local modifications, simply write the files.
54
+ - ${isLocal ? "DO NOT create a PR or push unless explicitly asked." : "Always create a PR."}
55
+
56
+ After each major step, send a progress update to the user.
57
+ `;
58
+ const result = await this.executeWorkflow(`${systemPrompt}\n\n${userPrompt}`, context);
59
+ if (result.success) {
60
+ await this.sendProgress(context.taskId, "Feature implementation complete", 1.0, result.summary);
61
+ // Send completion notification to platform
62
+ await this.sendCompletion(context.taskId, result);
63
+ }
64
+ else {
65
+ // Send error notification
66
+ await this.sendCompletion(context.taskId, result);
67
+ }
68
+ return result;
69
+ }
70
+ catch (error) {
71
+ const errorMsg = error instanceof Error ? error.message : String(error);
72
+ await this.sendCompletion(context.taskId, {
73
+ success: false,
74
+ error: errorMsg,
75
+ });
76
+ return {
77
+ success: false,
78
+ error: errorMsg,
79
+ };
80
+ }
81
+ }
82
+ }
83
+ //# sourceMappingURL=feature.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"feature.js","sourceRoot":"","sources":["../../../src/copilot/flows/feature.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,wDAAwD;AACxD,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AAE9E,MAAM,OAAO,eAAgB,SAAQ,gBAAgB;IACnD,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,CAAC,MAAM,EACd,0CAA0C,EAC1C,IAAI,EACJ,eAAe,OAAO,CAAC,IAAI,EAAE,CAC9B,CAAC;YAEF,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAEhE,MAAM,OAAO,GAAG,CAAC,CAAC,OAAO,CAAC,SAAS,CAAC;YACpC,MAAM,KAAK,GAAG,OAAO;gBACnB,CAAC,CAAC;yCAC+B,OAAO,CAAC,SAAS;;;;;;;;wDAQF;gBAChD,CAAC,CAAC;;;;;;;;;;;;;;;+CAeqC,CAAC;YAE1C,MAAM,UAAU,GAAG;;;EAGvB,OAAO,CAAC,eAAe;;EAEvB,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,kBAAkB,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE;EACrF,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,yBAAyB,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;EACxF,OAAO,CAAC,OAAO,EAAE,KAAK,CAAC,CAAC,CAAC,mBAAmB,OAAO,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE;;;EAGxE,KAAK;;;;;;;IAOH,OAAO,CAAC,CAAC,CAAC,qDAAqD,CAAC,CAAC,CAAC,qBAAqB;;;CAG1F,CAAC;YAEI,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CACvC,GAAG,YAAY,OAAO,UAAU,EAAE,EAClC,OAAO,CACR,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,CAAC,MAAM,EACd,iCAAiC,EACjC,GAAG,EACH,MAAM,CAAC,OAAO,CACf,CAAC;gBAEF,2CAA2C;gBAC3C,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACpD,CAAC;iBAAM,CAAC;gBACN,0BAA0B;gBAC1B,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;YACpD,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE;gBACxC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,5 @@
1
+ import { WorkflowExecutor, WorkflowContext, WorkflowResult } from "./base.js";
2
+ export declare class FixBugWorkflow extends WorkflowExecutor {
3
+ execute(context: WorkflowContext): Promise<WorkflowResult>;
4
+ }
5
+ //# sourceMappingURL=fix-bug.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-bug.d.ts","sourceRoot":"","sources":["../../../src/copilot/flows/fix-bug.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE9E,qBAAa,cAAe,SAAQ,gBAAgB;IAC5C,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAoEjE"}
@@ -0,0 +1,56 @@
1
+ // Fix Bug Workflow
2
+ // Automatically diagnoses and fixes bugs in a repository
3
+ import { WorkflowExecutor } from "./base.js";
4
+ export class FixBugWorkflow extends WorkflowExecutor {
5
+ async execute(context) {
6
+ try {
7
+ await this.sendProgress(context.taskId, "Starting bug fix workflow", 0.05, `Repository: ${context.repo}`);
8
+ const systemPrompt = this.buildSystemPrompt("fix-bug", context);
9
+ const userPrompt = `
10
+ You are tasked with fixing the following bug:
11
+
12
+ ${context.naturalLanguage}
13
+
14
+ ${context.context?.errorMessage ? `Error details: ${context.context.errorMessage}` : ""}
15
+ ${context.context?.stackTrace ? `Stack trace: ${context.context.stackTrace}` : ""}
16
+ ${context.context?.testName ? `Failing test: ${context.context.testName}` : ""}
17
+
18
+ Follow these steps:
19
+ 1. Clone the repository to a temporary location
20
+ 2. List important files in the repository (src/, tests/, etc)
21
+ 3. Examine the error location and related code
22
+ 4. Identify the root cause
23
+ 5. Create a feature branch: fix/bug-<timestamp>
24
+ 6. Apply the fix to the code
25
+ 7. Run tests to verify the fix works
26
+ 8. Commit the changes with a clear message
27
+ 9. Push the branch
28
+ 10. Create a pull request with:
29
+ - Title: "Fix: <bug description>"
30
+ - Body: Description of the bug and how it was fixed
31
+ - Labels: ["bug", "fix"]
32
+ 11. Send final progress update with the PR URL
33
+
34
+ After each major step, use send_progress_update to notify the user.
35
+ If at any point you need user clarification, explain what's blocking you.
36
+ `;
37
+ const result = await this.executeWorkflow(`${systemPrompt}\n\n${userPrompt}`, context);
38
+ if (result.success) {
39
+ await this.sendProgress(context.taskId, "Bug fix complete", 1.0, result.summary);
40
+ }
41
+ return result;
42
+ }
43
+ catch (error) {
44
+ const errorMsg = error instanceof Error ? error.message : String(error);
45
+ await this.sendCompletion(context.taskId, {
46
+ success: false,
47
+ error: errorMsg,
48
+ });
49
+ return {
50
+ success: false,
51
+ error: errorMsg,
52
+ };
53
+ }
54
+ }
55
+ }
56
+ //# sourceMappingURL=fix-bug.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"fix-bug.js","sourceRoot":"","sources":["../../../src/copilot/flows/fix-bug.ts"],"names":[],"mappings":"AAAA,mBAAmB;AACnB,yDAAyD;AACzD,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AAE9E,MAAM,OAAO,cAAe,SAAQ,gBAAgB;IAClD,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,CAAC,MAAM,EACd,2BAA2B,EAC3B,IAAI,EACJ,eAAe,OAAO,CAAC,IAAI,EAAE,CAC9B,CAAC;YAEF,MAAM,YAAY,GAAG,IAAI,CAAC,iBAAiB,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;YAEhE,MAAM,UAAU,GAAG;;;EAGvB,OAAO,CAAC,eAAe;;EAEvB,OAAO,CAAC,OAAO,EAAE,YAAY,CAAC,CAAC,CAAC,kBAAkB,OAAO,CAAC,OAAO,CAAC,YAAY,EAAE,CAAC,CAAC,CAAC,EAAE;EACrF,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,gBAAgB,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;EAC/E,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,iBAAiB,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;CAoB7E,CAAC;YAEI,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CACvC,GAAG,YAAY,OAAO,UAAU,EAAE,EAClC,OAAO,CACR,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,CAAC,MAAM,EACd,kBAAkB,EAClB,GAAG,EACH,MAAM,CAAC,OAAO,CACf,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE;gBACxC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,17 @@
1
+ import { FixBugWorkflow } from "./fix-bug.js";
2
+ import { FeatureWorkflow } from "./feature.js";
3
+ import { ExplainWorkflow } from "./explain.js";
4
+ import { ReviewPRWorkflow } from "./review-pr.js";
5
+ import { WorkflowExecutor } from "./base.js";
6
+ import type { WorkflowContext, WorkflowResult } from "./base.js";
7
+ export type WorkflowIntent = "fix-bug" | "feature" | "explain" | "review-pr" | "deploy";
8
+ export declare class WorkflowFactory {
9
+ static getWorkflow(intent: WorkflowIntent): new (platformUrl: string, platformSecret: string) => WorkflowExecutor;
10
+ static executeWorkflow(context: WorkflowContext, platformUrl?: string, token?: string): Promise<WorkflowResult>;
11
+ }
12
+ export { WorkflowExecutor, WorkflowContext, WorkflowResult };
13
+ export { FixBugWorkflow };
14
+ export { FeatureWorkflow };
15
+ export { ExplainWorkflow };
16
+ export { ReviewPRWorkflow };
17
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/copilot/flows/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAC7C,OAAO,KAAK,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAEjE,MAAM,MAAM,cAAc,GACtB,SAAS,GACT,SAAS,GACT,SAAS,GACT,WAAW,GACX,QAAQ,CAAC;AAEb,qBAAa,eAAe;IAC1B,MAAM,CAAC,WAAW,CAChB,MAAM,EAAE,cAAc,GACrB,KAAK,WAAW,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,KAAK,gBAAgB;WAsB3D,eAAe,CAC1B,OAAO,EAAE,eAAe,EACxB,WAAW,CAAC,EAAE,MAAM,EACpB,KAAK,CAAC,EAAE,MAAM,GACb,OAAO,CAAC,cAAc,CAAC;CAU3B;AAGD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,41 @@
1
+ // Workflow factory and orchestration
2
+ import { FixBugWorkflow } from "./fix-bug.js";
3
+ import { FeatureWorkflow } from "./feature.js";
4
+ import { ExplainWorkflow } from "./explain.js";
5
+ import { ReviewPRWorkflow } from "./review-pr.js";
6
+ import { WorkflowExecutor } from "./base.js";
7
+ export class WorkflowFactory {
8
+ static getWorkflow(intent) {
9
+ switch (intent) {
10
+ case "fix-bug":
11
+ return FixBugWorkflow;
12
+ case "feature":
13
+ return FeatureWorkflow;
14
+ case "explain":
15
+ return ExplainWorkflow;
16
+ case "review-pr":
17
+ return ReviewPRWorkflow;
18
+ case "deploy":
19
+ // TODO: Implement deploy workflow
20
+ throw new Error("Deploy workflow not yet implemented");
21
+ default:
22
+ // Fallback to FeatureWorkflow for any unrecognized intents (e.g., "update readme", custom tasks)
23
+ console.log(`[WorkflowFactory] Unknown intent "${intent}", falling back to FeatureWorkflow`);
24
+ return FeatureWorkflow;
25
+ }
26
+ }
27
+ static async executeWorkflow(context, platformUrl, token) {
28
+ const WorkflowClass = this.getWorkflow(context.intent);
29
+ const devflowUrl = platformUrl || process.env.DEVFLOW_API_URL || "http://localhost:3000";
30
+ const devflowToken = token || process.env.DEVFLOW_API_SECRET || "";
31
+ const workflow = new WorkflowClass(devflowUrl, devflowToken);
32
+ return await workflow.execute(context);
33
+ }
34
+ }
35
+ // Export all workflow classes and base
36
+ export { WorkflowExecutor };
37
+ export { FixBugWorkflow };
38
+ export { FeatureWorkflow };
39
+ export { ExplainWorkflow };
40
+ export { ReviewPRWorkflow };
41
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/copilot/flows/index.ts"],"names":[],"mappings":"AAAA,qCAAqC;AACrC,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAC9C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC/C,OAAO,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAClD,OAAO,EAAE,gBAAgB,EAAE,MAAM,WAAW,CAAC;AAU7C,MAAM,OAAO,eAAe;IAC1B,MAAM,CAAC,WAAW,CAChB,MAAsB;QAEtB,QAAQ,MAAM,EAAE,CAAC;YACf,KAAK,SAAS;gBACZ,OAAO,cAAc,CAAC;YACxB,KAAK,SAAS;gBACZ,OAAO,eAAe,CAAC;YACzB,KAAK,SAAS;gBACZ,OAAO,eAAe,CAAC;YACzB,KAAK,WAAW;gBACd,OAAO,gBAAgB,CAAC;YAC1B,KAAK,QAAQ;gBACX,kCAAkC;gBAClC,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;YACzD;gBACE,iGAAiG;gBACjG,OAAO,CAAC,GAAG,CACT,qCAAqC,MAAM,oCAAoC,CAChF,CAAC;gBACF,OAAO,eAAe,CAAC;QAC3B,CAAC;IACH,CAAC;IAED,MAAM,CAAC,KAAK,CAAC,eAAe,CAC1B,OAAwB,EACxB,WAAoB,EACpB,KAAc;QAEd,MAAM,aAAa,GAAG,IAAI,CAAC,WAAW,CAAC,OAAO,CAAC,MAAwB,CAAC,CAAC;QAEzE,MAAM,UAAU,GACd,WAAW,IAAI,OAAO,CAAC,GAAG,CAAC,eAAe,IAAI,uBAAuB,CAAC;QACxE,MAAM,YAAY,GAAG,KAAK,IAAI,OAAO,CAAC,GAAG,CAAC,kBAAkB,IAAI,EAAE,CAAC;QAEnE,MAAM,QAAQ,GAAG,IAAI,aAAa,CAAC,UAAU,EAAE,YAAY,CAAC,CAAC;QAC7D,OAAO,MAAM,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;IACzC,CAAC;CACF;AAED,uCAAuC;AACvC,OAAO,EAAE,gBAAgB,EAAmC,CAAC;AAC7D,OAAO,EAAE,cAAc,EAAE,CAAC;AAC1B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,eAAe,EAAE,CAAC;AAC3B,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
@@ -0,0 +1,5 @@
1
+ import { WorkflowExecutor, WorkflowContext, WorkflowResult } from "./base.js";
2
+ export declare class ReviewPRWorkflow extends WorkflowExecutor {
3
+ execute(context: WorkflowContext): Promise<WorkflowResult>;
4
+ }
5
+ //# sourceMappingURL=review-pr.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-pr.d.ts","sourceRoot":"","sources":["../../../src/copilot/flows/review-pr.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,cAAc,EAAE,MAAM,WAAW,CAAC;AAE9E,qBAAa,gBAAiB,SAAQ,gBAAgB;IAC9C,OAAO,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,cAAc,CAAC;CAgGjE"}
@@ -0,0 +1,84 @@
1
+ // Pull Request Review Workflow
2
+ // Reviews pull requests and provides feedback
3
+ import { WorkflowExecutor } from "./base.js";
4
+ export class ReviewPRWorkflow extends WorkflowExecutor {
5
+ async execute(context) {
6
+ try {
7
+ await this.sendProgress(context.taskId, "Starting PR review workflow", 0.05, `Repository: ${context.repo}`);
8
+ const systemPrompt = `You are Devflow, an expert code reviewer.
9
+
10
+ Your task: Review pull requests and provide constructive feedback
11
+ Repository: ${context.repo}
12
+ Review Request: ${context.naturalLanguage}
13
+
14
+ You have access to these tools:
15
+ - git_operations: Clone and checkout branches
16
+ - read_file: Examine code changes
17
+ - list_files: List modified files
18
+ - send_progress_update: Send updates to the user
19
+
20
+ IMPORTANT:
21
+ 1. Clone the repository
22
+ 2. List and examine all modified files
23
+ 3. Provide constructive feedback
24
+ 4. Identify potential issues and improvements
25
+ 5. Acknowledge good practices
26
+ 6. Send detailed review comments
27
+ `;
28
+ const userPrompt = `
29
+ Please review this pull request:
30
+
31
+ ${context.naturalLanguage}
32
+
33
+ ${context.context?.prNumber ? `PR Number: #${context.context.prNumber}` : ""}
34
+ ${context.context?.branch ? `Branch: ${context.context.branch}` : ""}
35
+ ${context.context?.focusAreas ? `Focus areas: ${context.context.focusAreas}` : ""}
36
+
37
+ Follow these steps:
38
+ 1. Clone the repository
39
+ 2. Checkout the pull request branch (or fetch it)
40
+ 3. List the modified files to understand the scope
41
+ 4. Examine each modified file to understand the changes
42
+ 5. Look for:
43
+ - Code style and consistency issues
44
+ - Potential bugs or logic errors
45
+ - Security vulnerabilities
46
+ - Performance concerns
47
+ - Test coverage
48
+ - Documentation updates
49
+ - Breaking changes
50
+ 6. Provide a comprehensive review that includes:
51
+ - Summary of the changes
52
+ - Overall assessment
53
+ - Specific issues (if any)
54
+ - Suggestions for improvement
55
+ - Positive feedback on good practices
56
+ 7. Send a progress update with the review feedback
57
+
58
+ Format your review clearly with:
59
+ - Clear issue descriptions
60
+ - Specific file and line references
61
+ - Code snippets showing the issue
62
+ - Suggested improvements
63
+ - Severity levels (blocker, major, minor, nitpick)
64
+ `;
65
+ const result = await this.executeWorkflow(`${systemPrompt}\n\n${userPrompt}`, context);
66
+ if (result.success) {
67
+ await this.sendProgress(context.taskId, "PR review complete", 1.0, "Review feedback has been prepared");
68
+ }
69
+ return result;
70
+ }
71
+ catch (error) {
72
+ const errorMsg = error instanceof Error ? error.message : String(error);
73
+ await this.sendCompletion(context.taskId, {
74
+ success: false,
75
+ error: errorMsg,
76
+ });
77
+ return {
78
+ success: false,
79
+ error: errorMsg,
80
+ };
81
+ }
82
+ }
83
+ }
84
+ //# sourceMappingURL=review-pr.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"review-pr.js","sourceRoot":"","sources":["../../../src/copilot/flows/review-pr.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAC/B,8CAA8C;AAC9C,OAAO,EAAE,gBAAgB,EAAmC,MAAM,WAAW,CAAC;AAE9E,MAAM,OAAO,gBAAiB,SAAQ,gBAAgB;IACpD,KAAK,CAAC,OAAO,CAAC,OAAwB;QACpC,IAAI,CAAC;YACH,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,CAAC,MAAM,EACd,6BAA6B,EAC7B,IAAI,EACJ,eAAe,OAAO,CAAC,IAAI,EAAE,CAC9B,CAAC;YAEF,MAAM,YAAY,GAAG;;;cAGb,OAAO,CAAC,IAAI;kBACR,OAAO,CAAC,eAAe;;;;;;;;;;;;;;;CAexC,CAAC;YAEI,MAAM,UAAU,GAAG;;;EAGvB,OAAO,CAAC,eAAe;;EAEvB,OAAO,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC,CAAC,eAAe,OAAO,CAAC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,EAAE;EAC1E,OAAO,CAAC,OAAO,EAAE,MAAM,CAAC,CAAC,CAAC,WAAW,OAAO,CAAC,OAAO,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE;EAClE,OAAO,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,gBAAgB,OAAO,CAAC,OAAO,CAAC,UAAU,EAAE,CAAC,CAAC,CAAC,EAAE;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA6BhF,CAAC;YAEI,MAAM,MAAM,GAAG,MAAM,IAAI,CAAC,eAAe,CACvC,GAAG,YAAY,OAAO,UAAU,EAAE,EAClC,OAAO,CACR,CAAC;YAEF,IAAI,MAAM,CAAC,OAAO,EAAE,CAAC;gBACnB,MAAM,IAAI,CAAC,YAAY,CACrB,OAAO,CAAC,MAAM,EACd,oBAAoB,EACpB,GAAG,EACH,mCAAmC,CACpC,CAAC;YACJ,CAAC;YAED,OAAO,MAAM,CAAC;QAChB,CAAC;QAAC,OAAO,KAAK,EAAE,CAAC;YACf,MAAM,QAAQ,GAAG,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;YACxE,MAAM,IAAI,CAAC,cAAc,CAAC,OAAO,CAAC,MAAM,EAAE;gBACxC,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC,CAAC;YAEH,OAAO;gBACL,OAAO,EAAE,KAAK;gBACd,KAAK,EAAE,QAAQ;aAChB,CAAC;QACJ,CAAC;IACH,CAAC;CACF"}
@@ -0,0 +1,12 @@
1
+ import { Session } from "./client.js";
2
+ export declare class SessionRegistry {
3
+ private static sessions;
4
+ private static lastAccessed;
5
+ private static TTL_MS;
6
+ static register(sessionId: string, session: Session): void;
7
+ static get(sessionId: string): Session | undefined;
8
+ static has(sessionId: string): boolean;
9
+ static delete(sessionId: string): void;
10
+ private static cleanup;
11
+ }
12
+ //# sourceMappingURL=session-registry.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-registry.d.ts","sourceRoot":"","sources":["../../src/copilot/session-registry.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,aAAa,CAAC;AAGtC,qBAAa,eAAe;IAC1B,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAmC;IAC1D,OAAO,CAAC,MAAM,CAAC,YAAY,CAAkC;IAC7D,OAAO,CAAC,MAAM,CAAC,MAAM,CAAkB;IAEvC,MAAM,CAAC,QAAQ,CAAC,SAAS,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO;IAOnD,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS;IASlD,MAAM,CAAC,GAAG,CAAC,SAAS,EAAE,MAAM,GAAG,OAAO;IAItC,MAAM,CAAC,MAAM,CAAC,SAAS,EAAE,MAAM;IAK/B,OAAO,CAAC,MAAM,CAAC,OAAO;CAWvB"}
@@ -0,0 +1,39 @@
1
+ // Global registry for persistent sessions
2
+ export class SessionRegistry {
3
+ static register(sessionId, session) {
4
+ this.sessions.set(sessionId, session);
5
+ this.lastAccessed.set(sessionId, Date.now());
6
+ console.log(`[SessionRegistry] Registered session: ${sessionId}`);
7
+ this.cleanup();
8
+ }
9
+ static get(sessionId) {
10
+ const session = this.sessions.get(sessionId);
11
+ if (session) {
12
+ this.lastAccessed.set(sessionId, Date.now());
13
+ console.log(`[SessionRegistry] Reusing session: ${sessionId}`);
14
+ }
15
+ return session;
16
+ }
17
+ static has(sessionId) {
18
+ return this.sessions.has(sessionId);
19
+ }
20
+ static delete(sessionId) {
21
+ this.sessions.delete(sessionId);
22
+ this.lastAccessed.delete(sessionId);
23
+ }
24
+ static cleanup() {
25
+ // Simple garbage collection
26
+ const now = Date.now();
27
+ for (const [id, lastTime] of this.lastAccessed.entries()) {
28
+ if (now - lastTime > this.TTL_MS) {
29
+ console.log(`[SessionRegistry] Expiring session: ${id}`);
30
+ this.sessions.delete(id);
31
+ this.lastAccessed.delete(id);
32
+ }
33
+ }
34
+ }
35
+ }
36
+ SessionRegistry.sessions = new Map();
37
+ SessionRegistry.lastAccessed = new Map();
38
+ SessionRegistry.TTL_MS = 30 * 60 * 1000; // 30 minutes
39
+ //# sourceMappingURL=session-registry.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"session-registry.js","sourceRoot":"","sources":["../../src/copilot/session-registry.ts"],"names":[],"mappings":"AAEA,0CAA0C;AAC1C,MAAM,OAAO,eAAe;IAK1B,MAAM,CAAC,QAAQ,CAAC,SAAiB,EAAE,OAAgB;QACjD,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC;QACtC,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAC7C,OAAO,CAAC,GAAG,CAAC,yCAAyC,SAAS,EAAE,CAAC,CAAC;QAClE,IAAI,CAAC,OAAO,EAAE,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,SAAiB;QAC1B,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;QAC7C,IAAI,OAAO,EAAE,CAAC;YACZ,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,SAAS,EAAE,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;YAC7C,OAAO,CAAC,GAAG,CAAC,sCAAsC,SAAS,EAAE,CAAC,CAAC;QACjE,CAAC;QACD,OAAO,OAAO,CAAC;IACjB,CAAC;IAED,MAAM,CAAC,GAAG,CAAC,SAAiB;QAC1B,OAAO,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAED,MAAM,CAAC,MAAM,CAAC,SAAiB;QAC7B,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;QAChC,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,SAAS,CAAC,CAAC;IACtC,CAAC;IAEO,MAAM,CAAC,OAAO;QACpB,4BAA4B;QAC5B,MAAM,GAAG,GAAG,IAAI,CAAC,GAAG,EAAE,CAAC;QACvB,KAAK,MAAM,CAAC,EAAE,EAAE,QAAQ,CAAC,IAAI,IAAI,CAAC,YAAY,CAAC,OAAO,EAAE,EAAE,CAAC;YACzD,IAAI,GAAG,GAAG,QAAQ,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC;gBACjC,OAAO,CAAC,GAAG,CAAC,uCAAuC,EAAE,EAAE,CAAC,CAAC;gBACzD,IAAI,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;gBACzB,IAAI,CAAC,YAAY,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;IACH,CAAC;;AAvCc,wBAAQ,GAAyB,IAAI,GAAG,EAAE,CAAC;AAC3C,4BAAY,GAAwB,IAAI,GAAG,EAAE,CAAC;AAC9C,sBAAM,GAAG,EAAE,GAAG,EAAE,GAAG,IAAI,CAAC,CAAC,aAAa"}
@@ -0,0 +1,53 @@
1
+ export interface ReadFileInput {
2
+ repoPath: string;
3
+ filePath: string;
4
+ maxSize?: number;
5
+ }
6
+ export interface ReadFileResult {
7
+ success: boolean;
8
+ content?: string;
9
+ size: number;
10
+ error?: string;
11
+ language?: string;
12
+ truncated?: boolean;
13
+ }
14
+ export interface WriteFileInput {
15
+ repoPath: string;
16
+ filePath: string;
17
+ content: string;
18
+ createDirs?: boolean;
19
+ }
20
+ export interface WriteFileResult {
21
+ success: boolean;
22
+ filePath: string;
23
+ bytesWritten: number;
24
+ error?: string;
25
+ }
26
+ export interface ListFilesInput {
27
+ repoPath: string;
28
+ pattern?: string;
29
+ maxResults?: number;
30
+ }
31
+ export interface ListFilesResult {
32
+ success: boolean;
33
+ files: string[];
34
+ count: number;
35
+ error?: string;
36
+ }
37
+ export declare class FileManager {
38
+ private readonly maxDefaultSize;
39
+ readFile(input: ReadFileInput): Promise<ReadFileResult>;
40
+ writeFile(input: WriteFileInput): Promise<WriteFileResult>;
41
+ listFiles(input: ListFilesInput): Promise<ListFilesResult>;
42
+ private detectLanguage;
43
+ }
44
+ export declare function createReadFileTool(options?: {
45
+ localPath?: string;
46
+ }): any;
47
+ export declare function createWriteFileTool(options?: {
48
+ localPath?: string;
49
+ }): any;
50
+ export declare function createListFilesTool(options?: {
51
+ localPath?: string;
52
+ }): any;
53
+ //# sourceMappingURL=files.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"files.d.ts","sourceRoot":"","sources":["../../../src/copilot/tools/files.ts"],"names":[],"mappings":"AASA,MAAM,WAAW,aAAa;IAC5B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,MAAM,WAAW,cAAc;IAC7B,OAAO,EAAE,OAAO,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,SAAS,CAAC,EAAE,OAAO,CAAC;CACrB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,OAAO,CAAC;CACtB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,QAAQ,EAAE,MAAM,CAAC;IACjB,YAAY,EAAE,MAAM,CAAC;IACrB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,MAAM,WAAW,cAAc;IAC7B,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED,MAAM,WAAW,eAAe;IAC9B,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,MAAM,EAAE,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AAED,qBAAa,WAAW;IACtB,OAAO,CAAC,QAAQ,CAAC,cAAc,CAAe;IAExC,QAAQ,CAAC,KAAK,EAAE,aAAa,GAAG,OAAO,CAAC,cAAc,CAAC;IAyCvD,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAuB1D,SAAS,CAAC,KAAK,EAAE,cAAc,GAAG,OAAO,CAAC,eAAe,CAAC;IAiChE,OAAO,CAAC,cAAc;CA8BvB;AAGD,wBAAgB,kBAAkB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAqCxE;AAGD,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CA2CzE;AAGD,wBAAgB,mBAAmB,CAAC,OAAO,CAAC,EAAE;IAAE,SAAS,CAAC,EAAE,MAAM,CAAA;CAAE,GAAG,GAAG,CAsCzE"}