@lousy-agents/cli 1.0.0

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 (151) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +148 -0
  3. package/dist/commands/copilot-setup.d.ts +5 -0
  4. package/dist/commands/copilot-setup.d.ts.map +1 -0
  5. package/dist/commands/copilot-setup.js +97 -0
  6. package/dist/commands/copilot-setup.js.map +1 -0
  7. package/dist/commands/init.d.ts +12 -0
  8. package/dist/commands/init.d.ts.map +1 -0
  9. package/dist/commands/init.js +115 -0
  10. package/dist/commands/init.js.map +1 -0
  11. package/dist/commands/new.d.ts +11 -0
  12. package/dist/commands/new.d.ts.map +1 -0
  13. package/dist/commands/new.js +41 -0
  14. package/dist/commands/new.js.map +1 -0
  15. package/dist/entities/copilot-agent.d.ts +15 -0
  16. package/dist/entities/copilot-agent.d.ts.map +1 -0
  17. package/dist/entities/copilot-agent.js +53 -0
  18. package/dist/entities/copilot-agent.js.map +1 -0
  19. package/dist/entities/copilot-setup.d.ts +65 -0
  20. package/dist/entities/copilot-setup.d.ts.map +1 -0
  21. package/dist/entities/copilot-setup.js +6 -0
  22. package/dist/entities/copilot-setup.js.map +1 -0
  23. package/dist/entities/index.d.ts +6 -0
  24. package/dist/entities/index.d.ts.map +1 -0
  25. package/dist/entities/index.js +6 -0
  26. package/dist/entities/index.js.map +1 -0
  27. package/dist/gateways/action-version-gateway.d.ts +39 -0
  28. package/dist/gateways/action-version-gateway.d.ts.map +1 -0
  29. package/dist/gateways/action-version-gateway.js +47 -0
  30. package/dist/gateways/action-version-gateway.js.map +1 -0
  31. package/dist/gateways/agent-file-gateway.d.ts +50 -0
  32. package/dist/gateways/agent-file-gateway.d.ts.map +1 -0
  33. package/dist/gateways/agent-file-gateway.js +34 -0
  34. package/dist/gateways/agent-file-gateway.js.map +1 -0
  35. package/dist/gateways/environment-gateway.d.ts +30 -0
  36. package/dist/gateways/environment-gateway.d.ts.map +1 -0
  37. package/dist/gateways/environment-gateway.js +56 -0
  38. package/dist/gateways/environment-gateway.js.map +1 -0
  39. package/dist/gateways/file-system-utils.d.ts +8 -0
  40. package/dist/gateways/file-system-utils.d.ts.map +1 -0
  41. package/dist/gateways/file-system-utils.js +17 -0
  42. package/dist/gateways/file-system-utils.js.map +1 -0
  43. package/dist/gateways/file-system-workflow-gateway.d.ts +27 -0
  44. package/dist/gateways/file-system-workflow-gateway.d.ts.map +1 -0
  45. package/dist/gateways/file-system-workflow-gateway.js +99 -0
  46. package/dist/gateways/file-system-workflow-gateway.js.map +1 -0
  47. package/dist/gateways/index.d.ts +9 -0
  48. package/dist/gateways/index.d.ts.map +1 -0
  49. package/dist/gateways/index.js +9 -0
  50. package/dist/gateways/index.js.map +1 -0
  51. package/dist/gateways/workflow-gateway.d.ts +43 -0
  52. package/dist/gateways/workflow-gateway.d.ts.map +1 -0
  53. package/dist/gateways/workflow-gateway.js +6 -0
  54. package/dist/gateways/workflow-gateway.js.map +1 -0
  55. package/dist/index.d.ts +3 -0
  56. package/dist/index.d.ts.map +1 -0
  57. package/dist/index.js +19 -0
  58. package/dist/index.js.map +1 -0
  59. package/dist/lib/config.d.ts +27 -0
  60. package/dist/lib/config.d.ts.map +1 -0
  61. package/dist/lib/config.js +226 -0
  62. package/dist/lib/config.js.map +1 -0
  63. package/dist/lib/copilot-setup-config.d.ts +79 -0
  64. package/dist/lib/copilot-setup-config.d.ts.map +1 -0
  65. package/dist/lib/copilot-setup-config.js +119 -0
  66. package/dist/lib/copilot-setup-config.js.map +1 -0
  67. package/dist/lib/filesystem-structure.d.ts +45 -0
  68. package/dist/lib/filesystem-structure.d.ts.map +1 -0
  69. package/dist/lib/filesystem-structure.js +69 -0
  70. package/dist/lib/filesystem-structure.js.map +1 -0
  71. package/dist/lib/mcp-test-client.d.ts +43 -0
  72. package/dist/lib/mcp-test-client.d.ts.map +1 -0
  73. package/dist/lib/mcp-test-client.js +167 -0
  74. package/dist/lib/mcp-test-client.js.map +1 -0
  75. package/dist/lib/project-name-validation.d.ts +43 -0
  76. package/dist/lib/project-name-validation.d.ts.map +1 -0
  77. package/dist/lib/project-name-validation.js +131 -0
  78. package/dist/lib/project-name-validation.js.map +1 -0
  79. package/dist/mcp/index.d.ts +5 -0
  80. package/dist/mcp/index.d.ts.map +1 -0
  81. package/dist/mcp/index.js +5 -0
  82. package/dist/mcp/index.js.map +1 -0
  83. package/dist/mcp/server.d.ts +15 -0
  84. package/dist/mcp/server.d.ts.map +1 -0
  85. package/dist/mcp/server.js +120 -0
  86. package/dist/mcp/server.js.map +1 -0
  87. package/dist/mcp/tools/analyze-action-versions.d.ts +9 -0
  88. package/dist/mcp/tools/analyze-action-versions.d.ts.map +1 -0
  89. package/dist/mcp/tools/analyze-action-versions.js +81 -0
  90. package/dist/mcp/tools/analyze-action-versions.js.map +1 -0
  91. package/dist/mcp/tools/create-copilot-setup-workflow.d.ts +9 -0
  92. package/dist/mcp/tools/create-copilot-setup-workflow.d.ts.map +1 -0
  93. package/dist/mcp/tools/create-copilot-setup-workflow.js +121 -0
  94. package/dist/mcp/tools/create-copilot-setup-workflow.js.map +1 -0
  95. package/dist/mcp/tools/discover-environment.d.ts +9 -0
  96. package/dist/mcp/tools/discover-environment.d.ts.map +1 -0
  97. package/dist/mcp/tools/discover-environment.js +30 -0
  98. package/dist/mcp/tools/discover-environment.js.map +1 -0
  99. package/dist/mcp/tools/discover-workflow-setup-actions.d.ts +9 -0
  100. package/dist/mcp/tools/discover-workflow-setup-actions.d.ts.map +1 -0
  101. package/dist/mcp/tools/discover-workflow-setup-actions.js +37 -0
  102. package/dist/mcp/tools/discover-workflow-setup-actions.js.map +1 -0
  103. package/dist/mcp/tools/index.d.ts +11 -0
  104. package/dist/mcp/tools/index.d.ts.map +1 -0
  105. package/dist/mcp/tools/index.js +11 -0
  106. package/dist/mcp/tools/index.js.map +1 -0
  107. package/dist/mcp/tools/read-copilot-setup-workflow.d.ts +9 -0
  108. package/dist/mcp/tools/read-copilot-setup-workflow.d.ts.map +1 -0
  109. package/dist/mcp/tools/read-copilot-setup-workflow.js +38 -0
  110. package/dist/mcp/tools/read-copilot-setup-workflow.js.map +1 -0
  111. package/dist/mcp/tools/resolve-action-versions.d.ts +10 -0
  112. package/dist/mcp/tools/resolve-action-versions.d.ts.map +1 -0
  113. package/dist/mcp/tools/resolve-action-versions.js +61 -0
  114. package/dist/mcp/tools/resolve-action-versions.js.map +1 -0
  115. package/dist/mcp/tools/types.d.ts +67 -0
  116. package/dist/mcp/tools/types.d.ts.map +1 -0
  117. package/dist/mcp/tools/types.js +24 -0
  118. package/dist/mcp/tools/types.js.map +1 -0
  119. package/dist/mcp-server.d.ts +7 -0
  120. package/dist/mcp-server.d.ts.map +1 -0
  121. package/dist/mcp-server.js +17 -0
  122. package/dist/mcp-server.js.map +1 -0
  123. package/dist/use-cases/action-resolution.d.ts +66 -0
  124. package/dist/use-cases/action-resolution.d.ts.map +1 -0
  125. package/dist/use-cases/action-resolution.js +107 -0
  126. package/dist/use-cases/action-resolution.js.map +1 -0
  127. package/dist/use-cases/candidate-builder.d.ts +17 -0
  128. package/dist/use-cases/candidate-builder.d.ts.map +1 -0
  129. package/dist/use-cases/candidate-builder.js +67 -0
  130. package/dist/use-cases/candidate-builder.js.map +1 -0
  131. package/dist/use-cases/copilot-setup.d.ts +8 -0
  132. package/dist/use-cases/copilot-setup.d.ts.map +1 -0
  133. package/dist/use-cases/copilot-setup.js +10 -0
  134. package/dist/use-cases/copilot-setup.js.map +1 -0
  135. package/dist/use-cases/create-copilot-agent.d.ts +29 -0
  136. package/dist/use-cases/create-copilot-agent.d.ts.map +1 -0
  137. package/dist/use-cases/create-copilot-agent.js +73 -0
  138. package/dist/use-cases/create-copilot-agent.js.map +1 -0
  139. package/dist/use-cases/index.d.ts +9 -0
  140. package/dist/use-cases/index.d.ts.map +1 -0
  141. package/dist/use-cases/index.js +9 -0
  142. package/dist/use-cases/index.js.map +1 -0
  143. package/dist/use-cases/setup-step-discovery.d.ts +87 -0
  144. package/dist/use-cases/setup-step-discovery.d.ts.map +1 -0
  145. package/dist/use-cases/setup-step-discovery.js +202 -0
  146. package/dist/use-cases/setup-step-discovery.js.map +1 -0
  147. package/dist/use-cases/workflow-generator.d.ts +34 -0
  148. package/dist/use-cases/workflow-generator.d.ts.map +1 -0
  149. package/dist/use-cases/workflow-generator.js +195 -0
  150. package/dist/use-cases/workflow-generator.js.map +1 -0
  151. package/package.json +65 -0
@@ -0,0 +1,121 @@
1
+ /**
2
+ * MCP tool handler for creating or updating Copilot Setup Steps workflow.
3
+ */
4
+ import { mkdir } from "node:fs/promises";
5
+ import { join } from "node:path";
6
+ import { createEnvironmentGateway, createWorkflowGateway, fileExists, } from "../../gateways/index.js";
7
+ import { buildActionsToResolve, VERSION_RESOLUTION_INSTRUCTIONS, } from "../../use-cases/action-resolution.js";
8
+ import { buildCandidatesFromEnvironment, generateWorkflowContent, updateWorkflowWithMissingSteps, } from "../../use-cases/copilot-setup.js";
9
+ import { findMissingCandidates, getExistingActionsFromWorkflow, mergeCandidates, } from "../../use-cases/setup-step-discovery.js";
10
+ import { errorResponse, successResponse, } from "./types.js";
11
+ /**
12
+ * Gathers setup step candidates from environment and existing workflows.
13
+ */
14
+ async function gatherCandidates(dir, workflowsDirExists) {
15
+ const environmentGateway = createEnvironmentGateway();
16
+ const workflowGateway = createWorkflowGateway();
17
+ // Detect environment configuration
18
+ const environment = await environmentGateway.detectEnvironment(dir);
19
+ // Parse existing workflows for setup actions
20
+ const workflowCandidates = workflowsDirExists
21
+ ? await workflowGateway.parseWorkflowsForSetupActions(dir)
22
+ : [];
23
+ // Build candidates from environment
24
+ const envCandidates = await buildCandidatesFromEnvironment(environment);
25
+ // Merge candidates (workflow takes precedence)
26
+ return mergeCandidates(workflowCandidates, envCandidates);
27
+ }
28
+ /**
29
+ * Updates an existing workflow with missing steps.
30
+ */
31
+ async function updateExistingWorkflow(dir, workflowPath, allCandidates, args) {
32
+ const workflowGateway = createWorkflowGateway();
33
+ const existingWorkflow = await workflowGateway.readCopilotSetupWorkflow(dir);
34
+ const existingActions = getExistingActionsFromWorkflow(existingWorkflow);
35
+ const missingCandidates = findMissingCandidates(allCandidates, existingActions);
36
+ if (missingCandidates.length === 0) {
37
+ // Build actions to resolve for version resolution metadata
38
+ const actionsToResolve = buildActionsToResolve(allCandidates, args.resolvedVersions);
39
+ return successResponse({
40
+ action: "no_changes_needed",
41
+ workflowPath,
42
+ stepsAdded: [],
43
+ message: "Copilot Setup Steps workflow already contains all detected setup steps. No changes needed.",
44
+ actionsToResolve,
45
+ instructions: actionsToResolve.length > 0
46
+ ? VERSION_RESOLUTION_INSTRUCTIONS
47
+ : undefined,
48
+ });
49
+ }
50
+ // Generate workflow with placeholder mode and resolved versions
51
+ const updatedContent = await updateWorkflowWithMissingSteps(existingWorkflow, missingCandidates, undefined, {
52
+ usePlaceholders: true,
53
+ resolvedVersions: args.resolvedVersions,
54
+ });
55
+ await workflowGateway.writeCopilotSetupWorkflow(dir, updatedContent);
56
+ // Build actions to resolve
57
+ const actionsToResolve = buildActionsToResolve(allCandidates, args.resolvedVersions);
58
+ return successResponse({
59
+ action: "updated",
60
+ workflowPath,
61
+ stepsAdded: missingCandidates.map((c) => c.action),
62
+ message: `Updated workflow with ${missingCandidates.length} new step(s)`,
63
+ workflowTemplate: updatedContent,
64
+ actionsToResolve,
65
+ instructions: actionsToResolve.length > 0
66
+ ? VERSION_RESOLUTION_INSTRUCTIONS
67
+ : undefined,
68
+ });
69
+ }
70
+ /**
71
+ * Creates a new workflow with the provided candidates.
72
+ */
73
+ async function createNewWorkflow(dir, workflowPath, allCandidates, args) {
74
+ const workflowGateway = createWorkflowGateway();
75
+ // Generate workflow with placeholder mode and resolved versions
76
+ const content = await generateWorkflowContent(allCandidates, undefined, {
77
+ usePlaceholders: true,
78
+ resolvedVersions: args.resolvedVersions,
79
+ });
80
+ await workflowGateway.writeCopilotSetupWorkflow(dir, content);
81
+ // Build actions to resolve
82
+ const actionsToResolve = buildActionsToResolve(allCandidates, args.resolvedVersions);
83
+ return successResponse({
84
+ action: "created",
85
+ workflowPath,
86
+ stepsAdded: allCandidates.map((c) => c.action),
87
+ message: `Created workflow with ${allCandidates.length + 1} step(s) (including checkout)`,
88
+ workflowTemplate: content,
89
+ actionsToResolve,
90
+ instructions: actionsToResolve.length > 0
91
+ ? VERSION_RESOLUTION_INSTRUCTIONS
92
+ : undefined,
93
+ });
94
+ }
95
+ /**
96
+ * Creates or updates the Copilot Setup Steps workflow.
97
+ */
98
+ export const createCopilotSetupWorkflowHandler = async (args) => {
99
+ const dir = args.targetDir || process.cwd();
100
+ if (!(await fileExists(dir))) {
101
+ return errorResponse(`Target directory does not exist: ${dir}`);
102
+ }
103
+ const workflowGateway = createWorkflowGateway();
104
+ const workflowsDir = join(dir, ".github", "workflows");
105
+ const workflowsDirExists = await fileExists(workflowsDir);
106
+ // Gather all candidates
107
+ const allCandidates = await gatherCandidates(dir, workflowsDirExists);
108
+ // Ensure workflows directory exists
109
+ if (!workflowsDirExists) {
110
+ await mkdir(workflowsDir, { recursive: true });
111
+ }
112
+ // Get the correct workflow path (supports both .yml and .yaml extensions)
113
+ const workflowPath = await workflowGateway.getCopilotSetupWorkflowPath(dir);
114
+ // Check if workflow exists and create/update accordingly
115
+ const workflowExists = await workflowGateway.copilotSetupWorkflowExists(dir);
116
+ if (workflowExists) {
117
+ return updateExistingWorkflow(dir, workflowPath, allCandidates, args);
118
+ }
119
+ return createNewWorkflow(dir, workflowPath, allCandidates, args);
120
+ };
121
+ //# sourceMappingURL=create-copilot-setup-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-copilot-setup-workflow.js","sourceRoot":"","sources":["../../../src/mcp/tools/create-copilot-setup-workflow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,KAAK,EAAE,MAAM,kBAAkB,CAAC;AACzC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAEjC,OAAO,EACH,wBAA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,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IAE1D,wBAAwB;IACxB,MAAM,aAAa,GAAG,MAAM,gBAAgB,CAAC,GAAG,EAAE,kBAAkB,CAAC,CAAC;IAEtE,oCAAoC;IACpC,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACtB,MAAM,KAAK,CAAC,YAAY,EAAE,EAAE,SAAS,EAAE,IAAI,EAAE,CAAC,CAAC;IACnD,CAAC;IAED,0EAA0E;IAC1E,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAE5E,yDAAyD;IACzD,MAAM,cAAc,GAChB,MAAM,eAAe,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC;IAE1D,IAAI,cAAc,EAAE,CAAC;QACjB,OAAO,sBAAsB,CAAC,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;IAC1E,CAAC;IAED,OAAO,iBAAiB,CAAC,GAAG,EAAE,YAAY,EAAE,aAAa,EAAE,IAAI,CAAC,CAAC;AACrE,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP tool handler for discovering environment configuration files.
3
+ */
4
+ import { type ToolHandler } from "./types.js";
5
+ /**
6
+ * Discovers environment configuration files (mise.toml, version files) in a directory.
7
+ */
8
+ export declare const discoverEnvironmentHandler: ToolHandler;
9
+ //# sourceMappingURL=discover-environment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-environment.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/discover-environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAGH,OAAO,EAIH,KAAK,WAAW,EACnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,0BAA0B,EAAE,WAyBxC,CAAC"}
@@ -0,0 +1,30 @@
1
+ /**
2
+ * MCP tool handler for discovering environment configuration files.
3
+ */
4
+ import { createEnvironmentGateway, fileExists } from "../../gateways/index.js";
5
+ import { errorResponse, successResponse, } from "./types.js";
6
+ /**
7
+ * Discovers environment configuration files (mise.toml, version files) in a directory.
8
+ */
9
+ export const discoverEnvironmentHandler = async (args) => {
10
+ const dir = args.targetDir || process.cwd();
11
+ if (!(await fileExists(dir))) {
12
+ return errorResponse(`Target directory does not exist: ${dir}`);
13
+ }
14
+ const environmentGateway = createEnvironmentGateway();
15
+ const environment = await environmentGateway.detectEnvironment(dir);
16
+ return successResponse({
17
+ hasMise: environment.hasMise,
18
+ versionFiles: environment.versionFiles.map((vf) => ({
19
+ type: vf.type,
20
+ filename: vf.filename,
21
+ version: vf.version,
22
+ })),
23
+ message: environment.hasMise
24
+ ? "Found mise.toml - mise will manage all tool versions"
25
+ : environment.versionFiles.length > 0
26
+ ? `Found ${environment.versionFiles.length} version file(s)`
27
+ : "No environment configuration files found",
28
+ });
29
+ };
30
+ //# sourceMappingURL=discover-environment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-environment.js","sourceRoot":"","sources":["../../../src/mcp/tools/discover-environment.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,wBAAwB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC/E,OAAO,EACH,aAAa,EACb,eAAe,GAGlB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,0BAA0B,GAAgB,KAAK,EACxD,IAAc,EAChB,EAAE;IACA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAE5C,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,kBAAkB,GAAG,wBAAwB,EAAE,CAAC;IACtD,MAAM,WAAW,GAAG,MAAM,kBAAkB,CAAC,iBAAiB,CAAC,GAAG,CAAC,CAAC;IAEpE,OAAO,eAAe,CAAC;QACnB,OAAO,EAAE,WAAW,CAAC,OAAO;QAC5B,YAAY,EAAE,WAAW,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,EAAE,EAAE,EAAE,CAAC,CAAC;YAChD,IAAI,EAAE,EAAE,CAAC,IAAI;YACb,QAAQ,EAAE,EAAE,CAAC,QAAQ;YACrB,OAAO,EAAE,EAAE,CAAC,OAAO;SACtB,CAAC,CAAC;QACH,OAAO,EAAE,WAAW,CAAC,OAAO;YACxB,CAAC,CAAC,sDAAsD;YACxD,CAAC,CAAC,WAAW,CAAC,YAAY,CAAC,MAAM,GAAG,CAAC;gBACnC,CAAC,CAAC,SAAS,WAAW,CAAC,YAAY,CAAC,MAAM,kBAAkB;gBAC5D,CAAC,CAAC,0CAA0C;KACrD,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP tool handler for discovering setup actions in existing workflows.
3
+ */
4
+ import { type ToolHandler } from "./types.js";
5
+ /**
6
+ * Discovers setup actions used in existing GitHub Actions workflows.
7
+ */
8
+ export declare const discoverWorkflowSetupActionsHandler: ToolHandler;
9
+ //# sourceMappingURL=discover-workflow-setup-actions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-workflow-setup-actions.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/discover-workflow-setup-actions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAIH,KAAK,WAAW,EACnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,mCAAmC,EAAE,WAmCjD,CAAC"}
@@ -0,0 +1,37 @@
1
+ /**
2
+ * MCP tool handler for discovering setup actions in existing workflows.
3
+ */
4
+ import { join } from "node:path";
5
+ import { createWorkflowGateway, fileExists } from "../../gateways/index.js";
6
+ import { errorResponse, successResponse, } from "./types.js";
7
+ /**
8
+ * Discovers setup actions used in existing GitHub Actions workflows.
9
+ */
10
+ export const discoverWorkflowSetupActionsHandler = async (args) => {
11
+ const dir = args.targetDir || process.cwd();
12
+ if (!(await fileExists(dir))) {
13
+ return errorResponse(`Target directory does not exist: ${dir}`);
14
+ }
15
+ const workflowGateway = createWorkflowGateway();
16
+ const workflowsDir = join(dir, ".github", "workflows");
17
+ const workflowsDirExists = await fileExists(workflowsDir);
18
+ if (!workflowsDirExists) {
19
+ return successResponse({
20
+ actions: [],
21
+ message: "No .github/workflows directory found - no workflows to analyze",
22
+ });
23
+ }
24
+ const candidates = await workflowGateway.parseWorkflowsForSetupActions(dir);
25
+ return successResponse({
26
+ actions: candidates.map((c) => ({
27
+ action: c.action,
28
+ version: c.version,
29
+ config: c.config,
30
+ source: c.source,
31
+ })),
32
+ message: candidates.length > 0
33
+ ? `Found ${candidates.length} setup action(s) in workflows`
34
+ : "No setup actions found in existing workflows",
35
+ });
36
+ };
37
+ //# sourceMappingURL=discover-workflow-setup-actions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"discover-workflow-setup-actions.js","sourceRoot":"","sources":["../../../src/mcp/tools/discover-workflow-setup-actions.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EACH,aAAa,EACb,eAAe,GAGlB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,mCAAmC,GAAgB,KAAK,EACjE,IAAc,EAChB,EAAE;IACA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAE5C,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;IAChD,MAAM,YAAY,GAAG,IAAI,CAAC,GAAG,EAAE,SAAS,EAAE,WAAW,CAAC,CAAC;IACvD,MAAM,kBAAkB,GAAG,MAAM,UAAU,CAAC,YAAY,CAAC,CAAC;IAE1D,IAAI,CAAC,kBAAkB,EAAE,CAAC;QACtB,OAAO,eAAe,CAAC;YACnB,OAAO,EAAE,EAAE;YACX,OAAO,EACH,gEAAgE;SACvE,CAAC,CAAC;IACP,CAAC;IAED,MAAM,UAAU,GAAG,MAAM,eAAe,CAAC,6BAA6B,CAAC,GAAG,CAAC,CAAC;IAE5E,OAAO,eAAe,CAAC;QACnB,OAAO,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;YAC5B,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,OAAO,EAAE,CAAC,CAAC,OAAO;YAClB,MAAM,EAAE,CAAC,CAAC,MAAM;YAChB,MAAM,EAAE,CAAC,CAAC,MAAM;SACnB,CAAC,CAAC;QACH,OAAO,EACH,UAAU,CAAC,MAAM,GAAG,CAAC;YACjB,CAAC,CAAC,SAAS,UAAU,CAAC,MAAM,+BAA+B;YAC3D,CAAC,CAAC,8CAA8C;KAC3D,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * MCP tool handlers module exports.
3
+ */
4
+ export { analyzeActionVersionsHandler } from "./analyze-action-versions.js";
5
+ export { createCopilotSetupWorkflowHandler } from "./create-copilot-setup-workflow.js";
6
+ export { discoverEnvironmentHandler } from "./discover-environment.js";
7
+ export { discoverWorkflowSetupActionsHandler } from "./discover-workflow-setup-actions.js";
8
+ export { readCopilotSetupWorkflowHandler } from "./read-copilot-setup-workflow.js";
9
+ export { resolveActionVersionsHandler } from "./resolve-action-versions.js";
10
+ export { type CreateWorkflowArgs, type CreateWorkflowHandler, errorResponse, type ResolveActionsArgs, type ResolveActionsHandler, successResponse, type ToolArgs, type ToolHandler, type ToolResult, type VersionResolutionResponse, } from "./types.js";
11
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EACH,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,aAAa,EACb,KAAK,kBAAkB,EACvB,KAAK,qBAAqB,EAC1B,eAAe,EACf,KAAK,QAAQ,EACb,KAAK,WAAW,EAChB,KAAK,UAAU,EACf,KAAK,yBAAyB,GACjC,MAAM,YAAY,CAAC"}
@@ -0,0 +1,11 @@
1
+ /**
2
+ * MCP tool handlers module exports.
3
+ */
4
+ export { analyzeActionVersionsHandler } from "./analyze-action-versions.js";
5
+ export { createCopilotSetupWorkflowHandler } from "./create-copilot-setup-workflow.js";
6
+ export { discoverEnvironmentHandler } from "./discover-environment.js";
7
+ export { discoverWorkflowSetupActionsHandler } from "./discover-workflow-setup-actions.js";
8
+ export { readCopilotSetupWorkflowHandler } from "./read-copilot-setup-workflow.js";
9
+ export { resolveActionVersionsHandler } from "./resolve-action-versions.js";
10
+ export { errorResponse, successResponse, } from "./types.js";
11
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/mcp/tools/index.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAAE,iCAAiC,EAAE,MAAM,oCAAoC,CAAC;AACvF,OAAO,EAAE,0BAA0B,EAAE,MAAM,2BAA2B,CAAC;AACvE,OAAO,EAAE,mCAAmC,EAAE,MAAM,sCAAsC,CAAC;AAC3F,OAAO,EAAE,+BAA+B,EAAE,MAAM,kCAAkC,CAAC;AACnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,8BAA8B,CAAC;AAC5E,OAAO,EAGH,aAAa,EAGb,eAAe,GAKlB,MAAM,YAAY,CAAC"}
@@ -0,0 +1,9 @@
1
+ /**
2
+ * MCP tool handler for reading existing Copilot Setup Steps workflow.
3
+ */
4
+ import { type ToolHandler } from "./types.js";
5
+ /**
6
+ * Reads the existing Copilot Setup Steps workflow.
7
+ */
8
+ export declare const readCopilotSetupWorkflowHandler: ToolHandler;
9
+ //# sourceMappingURL=read-copilot-setup-workflow.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-copilot-setup-workflow.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/read-copilot-setup-workflow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAIH,OAAO,EAIH,KAAK,WAAW,EACnB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,+BAA+B,EAAE,WAmC7C,CAAC"}
@@ -0,0 +1,38 @@
1
+ /**
2
+ * MCP tool handler for reading existing Copilot Setup Steps workflow.
3
+ */
4
+ import { createWorkflowGateway, fileExists } from "../../gateways/index.js";
5
+ import { extractAllWorkflowSteps } from "../../use-cases/setup-step-discovery.js";
6
+ import { errorResponse, successResponse, } from "./types.js";
7
+ /**
8
+ * Reads the existing Copilot Setup Steps workflow.
9
+ */
10
+ export const readCopilotSetupWorkflowHandler = async (args) => {
11
+ const dir = args.targetDir || process.cwd();
12
+ if (!(await fileExists(dir))) {
13
+ return errorResponse(`Target directory does not exist: ${dir}`);
14
+ }
15
+ const workflowGateway = createWorkflowGateway();
16
+ const exists = await workflowGateway.copilotSetupWorkflowExists(dir);
17
+ const workflowPath = await workflowGateway.getCopilotSetupWorkflowPath(dir);
18
+ if (!exists) {
19
+ return successResponse({
20
+ exists: false,
21
+ workflowPath,
22
+ message: "Copilot Setup Steps workflow does not exist. Use create_copilot_setup_workflow to create it.",
23
+ });
24
+ }
25
+ const workflow = await workflowGateway.readCopilotSetupWorkflow(dir);
26
+ const workflowObj = workflow;
27
+ const steps = extractAllWorkflowSteps(workflow);
28
+ return successResponse({
29
+ exists: true,
30
+ workflowPath,
31
+ workflow: {
32
+ name: workflowObj?.name || "Copilot Setup Steps",
33
+ steps,
34
+ },
35
+ message: `Found Copilot Setup Steps workflow with ${steps.length} step(s)`,
36
+ });
37
+ };
38
+ //# sourceMappingURL=read-copilot-setup-workflow.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"read-copilot-setup-workflow.js","sourceRoot":"","sources":["../../../src/mcp/tools/read-copilot-setup-workflow.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,EAAE,qBAAqB,EAAE,UAAU,EAAE,MAAM,yBAAyB,CAAC;AAC5E,OAAO,EAAE,uBAAuB,EAAE,MAAM,yCAAyC,CAAC;AAClF,OAAO,EACH,aAAa,EACb,eAAe,GAGlB,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,MAAM,CAAC,MAAM,+BAA+B,GAAgB,KAAK,EAC7D,IAAc,EAChB,EAAE;IACA,MAAM,GAAG,GAAG,IAAI,CAAC,SAAS,IAAI,OAAO,CAAC,GAAG,EAAE,CAAC;IAE5C,IAAI,CAAC,CAAC,MAAM,UAAU,CAAC,GAAG,CAAC,CAAC,EAAE,CAAC;QAC3B,OAAO,aAAa,CAAC,oCAAoC,GAAG,EAAE,CAAC,CAAC;IACpE,CAAC;IAED,MAAM,eAAe,GAAG,qBAAqB,EAAE,CAAC;IAChD,MAAM,MAAM,GAAG,MAAM,eAAe,CAAC,0BAA0B,CAAC,GAAG,CAAC,CAAC;IACrE,MAAM,YAAY,GAAG,MAAM,eAAe,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;IAE5E,IAAI,CAAC,MAAM,EAAE,CAAC;QACV,OAAO,eAAe,CAAC;YACnB,MAAM,EAAE,KAAK;YACb,YAAY;YACZ,OAAO,EACH,8FAA8F;SACrG,CAAC,CAAC;IACP,CAAC;IAED,MAAM,QAAQ,GAAG,MAAM,eAAe,CAAC,wBAAwB,CAAC,GAAG,CAAC,CAAC;IACrE,MAAM,WAAW,GAAG,QAAmC,CAAC;IACxD,MAAM,KAAK,GAAG,uBAAuB,CAAC,QAAQ,CAAC,CAAC;IAEhD,OAAO,eAAe,CAAC;QACnB,MAAM,EAAE,IAAI;QACZ,YAAY;QACZ,QAAQ,EAAE;YACN,IAAI,EAAE,WAAW,EAAE,IAAI,IAAI,qBAAqB;YAChD,KAAK;SACR;QACD,OAAO,EAAE,2CAA2C,KAAK,CAAC,MAAM,UAAU;KAC7E,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,10 @@
1
+ /**
2
+ * MCP tool handler for resolving GitHub Action versions.
3
+ * This is a standalone tool for version resolution without workflow creation.
4
+ */
5
+ import { type ResolveActionsHandler } from "./types.js";
6
+ /**
7
+ * Resolves action versions for the provided actions or detected candidates.
8
+ */
9
+ export declare const resolveActionVersionsHandler: ResolveActionsHandler;
10
+ //# sourceMappingURL=resolve-action-versions.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"resolve-action-versions.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/resolve-action-versions.ts"],"names":[],"mappings":"AAAA;;;GAGG;AASH,OAAO,EAEH,KAAK,qBAAqB,EAG7B,MAAM,YAAY,CAAC;AAEpB;;GAEG;AACH,eAAO,MAAM,4BAA4B,EAAE,qBAoE1C,CAAC"}
@@ -0,0 +1,61 @@
1
+ /**
2
+ * MCP tool handler for resolving GitHub Action versions.
3
+ * This is a standalone tool for version resolution without workflow creation.
4
+ */
5
+ import { loadCopilotSetupConfig } from "../../lib/copilot-setup-config.js";
6
+ import { buildActionsToResolve, buildActionToResolve, VERSION_RESOLUTION_INSTRUCTIONS, } from "../../use-cases/action-resolution.js";
7
+ import { successResponse, } from "./types.js";
8
+ /**
9
+ * Resolves action versions for the provided actions or detected candidates.
10
+ */
11
+ export const resolveActionVersionsHandler = async (args) => {
12
+ // If specific actions are provided, use them directly
13
+ if (args.actions && args.actions.length > 0) {
14
+ const actionsToResolve = args.actions
15
+ .filter((action) => {
16
+ // Filter out already-resolved actions
17
+ if (args.resolvedVersions) {
18
+ return !args.resolvedVersions.some((r) => r.action === action);
19
+ }
20
+ return true;
21
+ })
22
+ .map(buildActionToResolve);
23
+ return successResponse({
24
+ actionsToResolve,
25
+ instructions: actionsToResolve.length > 0
26
+ ? VERSION_RESOLUTION_INSTRUCTIONS
27
+ : undefined,
28
+ message: actionsToResolve.length > 0
29
+ ? `Found ${actionsToResolve.length} action(s) needing version resolution`
30
+ : "All actions have been resolved",
31
+ });
32
+ }
33
+ // Load configuration to get supported setup actions
34
+ const config = await loadCopilotSetupConfig();
35
+ // Build candidates from configured setup actions and patterns
36
+ const defaultActions = [
37
+ // Add actions from setupActions config
38
+ ...config.setupActions.map((actionConfig) => ({
39
+ action: actionConfig.action,
40
+ source: "version-file",
41
+ })),
42
+ // Add mise-action if it's in the patterns but not in setupActions
43
+ ...config.setupActionPatterns
44
+ .filter((pattern) => !config.setupActions.some((a) => a.action === pattern))
45
+ .map((action) => ({
46
+ action,
47
+ source: "version-file",
48
+ })),
49
+ ];
50
+ const actionsToResolve = buildActionsToResolve(defaultActions, args.resolvedVersions);
51
+ return successResponse({
52
+ actionsToResolve,
53
+ instructions: actionsToResolve.length > 0
54
+ ? VERSION_RESOLUTION_INSTRUCTIONS
55
+ : undefined,
56
+ message: actionsToResolve.length > 0
57
+ ? `Found ${actionsToResolve.length} action(s) needing version resolution`
58
+ : "All actions have been resolved",
59
+ });
60
+ };
61
+ //# sourceMappingURL=resolve-action-versions.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":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yB;QACzC,uCAAuC;QACvC,GAAG,MAAM,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,YAAY,EAAE,EAAE,CAAC,CAAC;YAC1C,MAAM,EAAE,YAAY,CAAC,MAAM;YAC3B,MAAM,EAAE,cAAuB;SAClC,CAAC,CAAC;QACH,kEAAkE;QAClE,GAAG,MAAM,CAAC,mBAAmB;aACxB,MAAM,CACH,CAAC,OAAO,EAAE,EAAE,CACR,CAAC,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,KAAK,OAAO,CAAC,CAC7D;aACA,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;YACd,MAAM;YACN,MAAM,EAAE,cAAuB;SAClC,CAAC,CAAC;KACV,CAAC;IAEF,MAAM,gBAAgB,GAAG,qBAAqB,CAC1C,cAAc,EACd,IAAI,CAAC,gBAAgB,CACxB,CAAC;IAEF,OAAO,eAAe,CAAC;QACnB,gBAAgB;QAChB,YAAY,EACR,gBAAgB,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC,+BAA+B;YACjC,CAAC,CAAC,SAAS;QACnB,OAAO,EACH,gBAAgB,CAAC,MAAM,GAAG,CAAC;YACvB,CAAC,CAAC,SAAS,gBAAgB,CAAC,MAAM,uCAAuC;YACzE,CAAC,CAAC,gCAAgC;KAC7C,CAAC,CAAC;AACP,CAAC,CAAC"}
@@ -0,0 +1,67 @@
1
+ /**
2
+ * Shared types and utilities for MCP tool handlers.
3
+ */
4
+ import type { ActionToResolve, ResolvedVersion } from "../../entities/copilot-setup.js";
5
+ /**
6
+ * Arguments for MCP tools that operate on a target directory.
7
+ */
8
+ export interface ToolArgs {
9
+ targetDir?: string;
10
+ }
11
+ /**
12
+ * Extended arguments for create_copilot_setup_workflow tool.
13
+ */
14
+ export interface CreateWorkflowArgs extends ToolArgs {
15
+ /** Resolved versions to use for SHA-pinning */
16
+ resolvedVersions?: ResolvedVersion[];
17
+ }
18
+ /**
19
+ * Arguments for resolve_action_versions tool.
20
+ */
21
+ export interface ResolveActionsArgs extends ToolArgs {
22
+ /** List of action names to resolve (e.g., ["actions/setup-node", "actions/checkout"]) */
23
+ actions?: string[];
24
+ /** Resolved versions to filter out already-resolved actions */
25
+ resolvedVersions?: ResolvedVersion[];
26
+ }
27
+ /**
28
+ * Standard result type for MCP tool responses.
29
+ */
30
+ export interface ToolResult {
31
+ content: Array<{
32
+ type: "text";
33
+ text: string;
34
+ }>;
35
+ }
36
+ /**
37
+ * Tool handler function type.
38
+ */
39
+ export type ToolHandler = (args: ToolArgs) => Promise<ToolResult>;
40
+ /**
41
+ * Extended tool handler for create_copilot_setup_workflow.
42
+ */
43
+ export type CreateWorkflowHandler = (args: CreateWorkflowArgs) => Promise<ToolResult>;
44
+ /**
45
+ * Extended tool handler for resolve_action_versions.
46
+ */
47
+ export type ResolveActionsHandler = (args: ResolveActionsArgs) => Promise<ToolResult>;
48
+ /**
49
+ * Creates an error response for MCP tools.
50
+ */
51
+ export declare function errorResponse(error: string): ToolResult;
52
+ /**
53
+ * Creates a success response for MCP tools.
54
+ */
55
+ export declare function successResponse(data: Record<string, unknown>): ToolResult;
56
+ /**
57
+ * Response fields for version resolution in create workflow tool.
58
+ */
59
+ export interface VersionResolutionResponse {
60
+ /** The generated workflow content */
61
+ workflowTemplate?: string;
62
+ /** Actions that need version resolution */
63
+ actionsToResolve?: ActionToResolve[];
64
+ /** Instructions for the LLM to resolve versions */
65
+ instructions?: string;
66
+ }
67
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../../src/mcp/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,OAAO,KAAK,EACR,eAAe,EACf,eAAe,EAClB,MAAM,iCAAiC,CAAC;AAEzC;;GAEG;AACH,MAAM,WAAW,QAAQ;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;CACtB;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ates an error response for MCP tools.
6
+ */
7
+ export function errorResponse(error) {
8
+ return {
9
+ content: [
10
+ { type: "text", text: JSON.stringify({ success: false, error }) },
11
+ ],
12
+ };
13
+ }
14
+ /**
15
+ * Creates a success response for MCP tools.
16
+ */
17
+ export function successResponse(data) {
18
+ return {
19
+ content: [
20
+ { type: "text", text: JSON.stringify({ success: true, ...data }) },
21
+ ],
22
+ };
23
+ }
24
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../../../src/mcp/tools/types.ts"],"names":[],"mappings":"AAAA;;GAEG;AA0DH;;GAEG;AACH,MAAM,UAAU,aAAa,CAAC,KAAa;IACvC,OAAO;QACH,OAAO,EAAE;YACL,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,KAAK,EAAE,KAAK,EAAE,CAAC,EAAE;SACpE;KACJ,CAAC;AACN,CAAC;AAED;;GAEG;AACH,MAAM,UAAU,eAAe,CAAC,IAA6B;IACzD,OAAO;QACH,OAAO,EAAE;YACL,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,CAAC,EAAE,OAAO,EAAE,IAAI,EAAE,GAAG,IAAI,EAAE,CAAC,EAAE;SACrE;KACJ,CAAC;AACN,CAAC"}
@@ -0,0 +1,7 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MCP Server entry point for lousy-agents.
4
+ * Starts the MCP server with stdio transport for VS Code integration.
5
+ */
6
+ export {};
7
+ //# sourceMappingURL=mcp-server.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.d.ts","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AAEA;;;GAGG"}
@@ -0,0 +1,17 @@
1
+ #!/usr/bin/env node
2
+ /**
3
+ * MCP Server entry point for lousy-agents.
4
+ * Starts the MCP server with stdio transport for VS Code integration.
5
+ */
6
+ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js";
7
+ import { createMcpServer } from "./mcp/server.js";
8
+ async function main() {
9
+ const server = createMcpServer();
10
+ const transport = new StdioServerTransport();
11
+ await server.connect(transport);
12
+ }
13
+ main().catch((error) => {
14
+ console.error("Failed to start MCP server:", error);
15
+ process.exit(1);
16
+ });
17
+ //# sourceMappingURL=mcp-server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"mcp-server.js","sourceRoot":"","sources":["../src/mcp-server.ts"],"names":[],"mappings":";AAEA;;;GAGG;AAEH,OAAO,EAAE,oBAAoB,EAAE,MAAM,2CAA2C,CAAC;AACjF,OAAO,EAAE,eAAe,EAAE,MAAM,iBAAiB,CAAC;AAElD,KAAK,UAAU,IAAI;IACf,MAAM,MAAM,GAAG,eAAe,EAAE,CAAC;IACjC,MAAM,SAAS,GAAG,IAAI,oBAAoB,EAAE,CAAC;IAC7C,MAAM,MAAM,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC;AACpC,CAAC;AAED,IAAI,EAAE,CAAC,KAAK,CAAC,CAAC,KAAK,EAAE,EAAE;IACnB,OAAO,CAAC,KAAK,CAAC,6BAA6B,EAAE,KAAK,CAAC,CAAC;IACpD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
@@ -0,0 +1,66 @@
1
+ /**
2
+ * Use case for building action resolution metadata.
3
+ * This module provides logic for identifying actions that need version resolution
4
+ * and generating lookup URLs for the LLM to fetch latest versions.
5
+ */
6
+ import type { ActionToResolve, ResolvedVersion, SetupStepCandidate } from "../entities/copilot-setup.js";
7
+ /**
8
+ * The placeholder string used in workflow templates when version resolution is needed.
9
+ */
10
+ export declare const VERSION_PLACEHOLDER = "RESOLVE_VERSION";
11
+ /**
12
+ * Instructions for the LLM to resolve action versions.
13
+ */
14
+ export declare const VERSION_RESOLUTION_INSTRUCTIONS = "To resolve action versions:\n1. For each action in actionsToResolve, fetch the lookup_url to find the latest release\n2. Find the latest release tag (e.g., v4.0.0)\n3. Get the commit SHA for that tag from the release page or GitHub API\n4. Pin actions to SHA with version comment: action@SHA # vX.X.X\n5. Call this tool again with resolvedVersions to generate the final workflow\n\nExample resolved format: actions/setup-node@1a2b3c4d5e6f # v4.0.0";
15
+ /**
16
+ * Generates a GitHub releases lookup URL for an action.
17
+ * @param action The action name (e.g., "actions/setup-node")
18
+ * @returns The URL to the action's latest release page
19
+ */
20
+ export declare function generateLookupUrl(action: string): string;
21
+ /**
22
+ * Builds an ActionToResolve entry for a given action.
23
+ * @param action The action name (e.g., "actions/setup-node")
24
+ * @returns ActionToResolve metadata for the action
25
+ */
26
+ export declare function buildActionToResolve(action: string): ActionToResolve;
27
+ /**
28
+ * Builds an array of ActionToResolve entries from setup step candidates.
29
+ * Filters out actions that already have resolved versions.
30
+ * @param candidates The setup step candidates
31
+ * @param resolvedVersions Optional array of already-resolved versions
32
+ * @returns Array of actions that need version resolution
33
+ */
34
+ export declare function buildActionsToResolve(candidates: SetupStepCandidate[], resolvedVersions?: ResolvedVersion[]): ActionToResolve[];
35
+ /**
36
+ * Formats an action reference with SHA pinning and version comment.
37
+ * @param action The action name (e.g., "actions/setup-node")
38
+ * @param sha The commit SHA
39
+ * @param versionTag The version tag for the comment (e.g., "v4.0.0")
40
+ * @returns Formatted action reference (e.g., "actions/setup-node@abc123 # v4.0.0")
41
+ */
42
+ export declare function formatShaPinnedAction(action: string, sha: string, versionTag: string): string;
43
+ /**
44
+ * Finds a resolved version for a given action.
45
+ * @param action The action name to look up
46
+ * @param resolvedVersions Array of resolved versions
47
+ * @returns The resolved version or undefined if not found
48
+ */
49
+ export declare function findResolvedVersion(action: string, resolvedVersions: ResolvedVersion[]): ResolvedVersion | undefined;
50
+ /**
51
+ * Gets the version string to use for an action.
52
+ * Returns SHA-pinned format if resolved, or placeholder if not.
53
+ * @param action The action name
54
+ * @param resolvedVersions Optional array of resolved versions
55
+ * @param fallbackVersion Optional fallback version (e.g., "v4")
56
+ * @returns The version string to use in the workflow
57
+ */
58
+ export declare function getActionVersion(action: string, resolvedVersions?: ResolvedVersion[], fallbackVersion?: string): string;
59
+ /**
60
+ * Checks if all required actions have been resolved.
61
+ * @param candidates The setup step candidates
62
+ * @param resolvedVersions Array of resolved versions
63
+ * @returns True if all actions (including checkout) are resolved
64
+ */
65
+ export declare function allActionsResolved(candidates: SetupStepCandidate[], resolvedVersions: ResolvedVersion[]): boolean;
66
+ //# sourceMappingURL=action-resolution.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"action-resolution.d.ts","sourceRoot":"","sources":["../../src/use-cases/action-resolution.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EACR,eAAe,EACf,eAAe,EACf,kBAAkB,EACrB,MAAM,8BAA8B,CAAC;AAEtC;;GAEG;AACH,eAAO,MAAM,mBAAmB,oBAAoB,CAAC;AAErD;;GAEG;AACH,eAAO,MAAM,+BAA+B,scAOuB,CAAC;AAEpE;;;;GAIG;AACH,wBAAgB,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,CAExD;AAED;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,MAAM,GAAG,eAAe,CAMpE;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,UAAU,EAAE,kBAAkB,EAAE,EAChC,gBAAgB,CAAC,EAAE,eAAe,EAAE,GACrC,eAAe,EAAE,CAcnB;AAED;;;;;;GAMG;AACH,wBAAgB,qBAAqB,CACjC,MAAM,EAAE,MAAM,EACd,GAAG,EAAE,MAAM,EACX,UAAU,EAAE,MAAM,GACnB,MAAM,CAER;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAC/B,MAAM,EAAE,MAAM,EACd,gBAAgB,EAAE,eAAe,EAAE,GACpC,eAAe,GAAG,SAAS,CAE7B;AAED;;;;;;;GAOG;AACH,wBAAgB,gBAAgB,CAC5B,MAAM,EAAE,MAAM,EACd,gBAAgB,CAAC,EAAE,eAAe,EAAE,EACpC,eAAe,CAAC,EAAE,MAAM,GACzB,MAAM,CAeR;AAED;;;;;GAKG;AACH,wBAAgB,kBAAkB,CAC9B,UAAU,EAAE,kBAAkB,EAAE,EAChC,gBAAgB,EAAE,eAAe,EAAE,GACpC,OAAO,CAMT"}