edsger 0.27.8 → 0.27.10

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.
@@ -1,119 +1,53 @@
1
1
  /**
2
2
  * Checklist service for pipeline integration
3
3
  */
4
+ import { callMcpEndpoint } from '../api/mcp-client.js';
4
5
  /**
5
6
  * Fetch checklists for a specific phase
6
7
  */
7
8
  export async function getChecklistsForPhase(options, phase) {
8
9
  const { featureId } = options;
9
- const mcpServerUrl = process.env.EDSGER_MCP_SERVER_URL;
10
- const mcpToken = process.env.EDSGER_MCP_TOKEN;
11
10
  // Convert phase name from hyphen to underscore format for database compatibility
12
11
  // e.g., 'feature-analysis' -> 'feature_analysis'
13
12
  const dbPhase = phase.replace(/-/g, '_');
14
- // Log the request details for debugging
15
- const requestBody = {
16
- jsonrpc: '2.0',
17
- id: 1,
18
- method: 'checklists/phase',
19
- params: {
20
- feature_id: featureId,
21
- phase: dbPhase, // Use underscore format for database
22
- },
23
- };
24
13
  console.log(`🔍 Fetching checklists: phase="${phase}" (db: "${dbPhase}"), feature_id="${featureId}"`);
25
- const response = await fetch(`${mcpServerUrl}/mcp`, {
26
- method: 'POST',
27
- headers: {
28
- 'Content-Type': 'application/json',
29
- Authorization: `Bearer ${mcpToken}`,
30
- },
31
- body: JSON.stringify(requestBody),
14
+ const result = await callMcpEndpoint('checklists/phase', {
15
+ feature_id: featureId,
16
+ phase: dbPhase,
32
17
  });
33
- if (!response.ok) {
34
- const errorText = await response.text();
35
- throw new Error(`Failed to fetch checklists for phase "${phase}": ${response.status} ${response.statusText}. Response: ${errorText}`);
36
- }
37
- const data = await response.json();
38
- if (data.error) {
39
- throw new Error(`MCP Error for phase "${phase}": ${data.error.message || JSON.stringify(data.error)}`);
40
- }
41
18
  // Handle empty result gracefully
42
- if (!data.result) {
19
+ if (!result) {
43
20
  return {
44
21
  phase,
45
22
  feature_id: featureId,
46
23
  checklists: [],
47
24
  };
48
25
  }
49
- return data.result;
26
+ return result;
50
27
  }
51
28
  /**
52
29
  * Validate checklist completion for a phase
53
30
  */
54
31
  export async function validateChecklistsForPhase(options, phase) {
55
32
  const { featureId } = options;
56
- const mcpServerUrl = process.env.EDSGER_MCP_SERVER_URL;
57
- const mcpToken = process.env.EDSGER_MCP_TOKEN;
58
33
  // Convert phase name from hyphen to underscore format for database compatibility
59
34
  const dbPhase = phase.replace(/-/g, '_');
60
- const response = await fetch(`${mcpServerUrl}/mcp`, {
61
- method: 'POST',
62
- headers: {
63
- 'Content-Type': 'application/json',
64
- Authorization: `Bearer ${mcpToken}`,
65
- },
66
- body: JSON.stringify({
67
- jsonrpc: '2.0',
68
- id: 1,
69
- method: 'checklists/validate',
70
- params: {
71
- feature_id: featureId,
72
- phase: dbPhase, // Use underscore format for database
73
- },
74
- }),
35
+ const result = await callMcpEndpoint('checklists/validate', {
36
+ feature_id: featureId,
37
+ phase: dbPhase,
75
38
  });
76
- if (!response.ok) {
77
- throw new Error(`Failed to validate checklists for phase: ${response.statusText}`);
78
- }
79
- const data = await response.json();
80
- if (data.error) {
81
- throw new Error(`MCP Error: ${data.error.message}`);
82
- }
83
- return data.result;
39
+ return result;
84
40
  }
85
41
  /**
86
42
  * Create checklist results (mark as started/in-progress)
87
43
  */
88
44
  export async function createChecklistResult(options, checklistId, itemResults) {
89
45
  const { featureId } = options;
90
- const mcpServerUrl = process.env.EDSGER_MCP_SERVER_URL;
91
- const mcpToken = process.env.EDSGER_MCP_TOKEN;
92
- const response = await fetch(`${mcpServerUrl}/mcp`, {
93
- method: 'POST',
94
- headers: {
95
- 'Content-Type': 'application/json',
96
- Authorization: `Bearer ${mcpToken}`,
97
- },
98
- body: JSON.stringify({
99
- jsonrpc: '2.0',
100
- id: 1,
101
- method: 'checklist_results/create',
102
- params: {
103
- feature_id: featureId,
104
- checklist_id: checklistId,
105
- item_results: itemResults,
106
- },
107
- }),
46
+ return await callMcpEndpoint('checklist_results/create', {
47
+ feature_id: featureId,
48
+ checklist_id: checklistId,
49
+ item_results: itemResults,
108
50
  });
109
- if (!response.ok) {
110
- throw new Error(`Failed to create checklist result: ${response.statusText}`);
111
- }
112
- const data = await response.json();
113
- if (data.error) {
114
- throw new Error(`MCP Error: ${data.error.message}`);
115
- }
116
- return data.result;
117
51
  }
118
52
  /**
119
53
  * Strictly validate that all required checklists have results
@@ -171,35 +105,13 @@ export async function validateRequiredChecklistResults(options, phase, verbose)
171
105
  */
172
106
  export async function createChecklistItemResult(options, checklistItemId, isPassed, value, notes) {
173
107
  const { featureId } = options;
174
- const mcpServerUrl = process.env.EDSGER_MCP_SERVER_URL;
175
- const mcpToken = process.env.EDSGER_MCP_TOKEN;
176
- const response = await fetch(`${mcpServerUrl}/mcp`, {
177
- method: 'POST',
178
- headers: {
179
- 'Content-Type': 'application/json',
180
- Authorization: `Bearer ${mcpToken}`,
181
- },
182
- body: JSON.stringify({
183
- jsonrpc: '2.0',
184
- id: 1,
185
- method: 'checklist_item_results/create',
186
- params: {
187
- feature_id: featureId,
188
- checklist_item_id: checklistItemId,
189
- is_passed: isPassed,
190
- value: value,
191
- notes: notes,
192
- },
193
- }),
108
+ return await callMcpEndpoint('checklist_item_results/create', {
109
+ feature_id: featureId,
110
+ checklist_item_id: checklistItemId,
111
+ is_passed: isPassed,
112
+ value: value,
113
+ notes: notes,
194
114
  });
195
- if (!response.ok) {
196
- throw new Error(`Failed to create checklist item result: ${response.statusText}`);
197
- }
198
- const data = await response.json();
199
- if (data.error) {
200
- throw new Error(`MCP Error: ${data.error.message}`);
201
- }
202
- return data.result;
203
115
  }
204
116
  /**
205
117
  * Process checklist item results from phase JSON response and create MCP results
@@ -616,7 +616,7 @@ export async function syncFeatBranchWithMain(featBranch, githubToken, owner, rep
616
616
  if (verbose) {
617
617
  logInfo(`â„šī¸ ${featBranch} branch does not exist, skipping sync`);
618
618
  }
619
- return true; // Not an error, just no feat branch yet
619
+ return false; // No feat branch yet, no sync needed (no force push required)
620
620
  }
621
621
  throw error;
622
622
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "edsger",
3
- "version": "0.27.8",
3
+ "version": "0.27.10",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "edsger": "dist/index.js"