@sudocode-ai/integration-beads 0.1.13
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.
- package/dist/cli-utils.d.ts +76 -0
- package/dist/cli-utils.d.ts.map +1 -0
- package/dist/cli-utils.js +169 -0
- package/dist/cli-utils.js.map +1 -0
- package/dist/hash-utils.d.ts +24 -0
- package/dist/hash-utils.d.ts.map +1 -0
- package/dist/hash-utils.js +55 -0
- package/dist/hash-utils.js.map +1 -0
- package/dist/index.d.ts +22 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +472 -0
- package/dist/index.js.map +1 -0
- package/dist/jsonl-utils.d.ts +87 -0
- package/dist/jsonl-utils.d.ts.map +1 -0
- package/dist/jsonl-utils.js +192 -0
- package/dist/jsonl-utils.js.map +1 -0
- package/dist/watcher.d.ts +81 -0
- package/dist/watcher.d.ts.map +1 -0
- package/dist/watcher.js +252 -0
- package/dist/watcher.js.map +1 -0
- package/package.json +44 -0
package/dist/index.js
ADDED
|
@@ -0,0 +1,472 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Beads Integration Plugin for sudocode
|
|
3
|
+
*
|
|
4
|
+
* Provides integration with Beads - a local file-based issue tracking format.
|
|
5
|
+
* Beads stores issues in a .beads directory with JSONL files similar to sudocode.
|
|
6
|
+
*/
|
|
7
|
+
import { existsSync, readFileSync } from "fs";
|
|
8
|
+
import * as path from "path";
|
|
9
|
+
// Internal utilities
|
|
10
|
+
import { computeCanonicalHash } from "./hash-utils.js";
|
|
11
|
+
import { readBeadsJSONL, createIssueViaJSONL, updateIssueViaJSONL, deleteIssueViaJSONL, } from "./jsonl-utils.js";
|
|
12
|
+
import { isBeadsCLIAvailable, createIssueViaCLI, } from "./cli-utils.js";
|
|
13
|
+
import { BeadsWatcher } from "./watcher.js";
|
|
14
|
+
/**
|
|
15
|
+
* Beads integration plugin
|
|
16
|
+
*/
|
|
17
|
+
const beadsPlugin = {
|
|
18
|
+
name: "beads",
|
|
19
|
+
displayName: "Beads",
|
|
20
|
+
version: "0.1.0",
|
|
21
|
+
description: "Integration with Beads local file-based issue tracking",
|
|
22
|
+
configSchema: {
|
|
23
|
+
type: "object",
|
|
24
|
+
properties: {
|
|
25
|
+
path: {
|
|
26
|
+
type: "string",
|
|
27
|
+
title: "Beads Path",
|
|
28
|
+
description: "Path to the .beads directory (relative to project root)",
|
|
29
|
+
default: ".beads",
|
|
30
|
+
required: true,
|
|
31
|
+
},
|
|
32
|
+
issue_prefix: {
|
|
33
|
+
type: "string",
|
|
34
|
+
title: "Issue Prefix",
|
|
35
|
+
description: "Prefix for issue IDs imported from beads",
|
|
36
|
+
default: "bd",
|
|
37
|
+
},
|
|
38
|
+
},
|
|
39
|
+
required: ["path"],
|
|
40
|
+
},
|
|
41
|
+
validateConfig(options) {
|
|
42
|
+
const errors = [];
|
|
43
|
+
const warnings = [];
|
|
44
|
+
// Check required path field
|
|
45
|
+
if (!options.path || typeof options.path !== "string") {
|
|
46
|
+
errors.push("beads.options.path is required");
|
|
47
|
+
}
|
|
48
|
+
// Validate issue_prefix if provided
|
|
49
|
+
if (options.issue_prefix !== undefined) {
|
|
50
|
+
if (typeof options.issue_prefix !== "string") {
|
|
51
|
+
errors.push("beads.options.issue_prefix must be a string");
|
|
52
|
+
}
|
|
53
|
+
else if (!/^[a-z]{1,4}$/i.test(options.issue_prefix)) {
|
|
54
|
+
warnings.push("beads.options.issue_prefix should be 1-4 alphabetic characters");
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
return {
|
|
58
|
+
valid: errors.length === 0,
|
|
59
|
+
errors,
|
|
60
|
+
warnings,
|
|
61
|
+
};
|
|
62
|
+
},
|
|
63
|
+
async testConnection(options, projectPath) {
|
|
64
|
+
const beadsPath = options.path;
|
|
65
|
+
if (!beadsPath) {
|
|
66
|
+
return {
|
|
67
|
+
success: false,
|
|
68
|
+
configured: true,
|
|
69
|
+
enabled: true,
|
|
70
|
+
error: "Beads path is not configured",
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
const resolvedPath = path.resolve(projectPath, beadsPath);
|
|
74
|
+
if (!existsSync(resolvedPath)) {
|
|
75
|
+
return {
|
|
76
|
+
success: false,
|
|
77
|
+
configured: true,
|
|
78
|
+
enabled: true,
|
|
79
|
+
error: `Beads directory not found: ${resolvedPath}`,
|
|
80
|
+
details: { path: beadsPath, resolvedPath },
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
// Check for issues.jsonl in beads directory
|
|
84
|
+
const issuesPath = path.join(resolvedPath, "issues.jsonl");
|
|
85
|
+
const hasIssues = existsSync(issuesPath);
|
|
86
|
+
// Try to count issues if file exists
|
|
87
|
+
let issueCount = 0;
|
|
88
|
+
if (hasIssues) {
|
|
89
|
+
try {
|
|
90
|
+
const content = readFileSync(issuesPath, "utf-8");
|
|
91
|
+
issueCount = content.split("\n").filter((line) => line.trim()).length;
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Ignore read errors
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return {
|
|
98
|
+
success: true,
|
|
99
|
+
configured: true,
|
|
100
|
+
enabled: true,
|
|
101
|
+
details: {
|
|
102
|
+
path: beadsPath,
|
|
103
|
+
resolvedPath,
|
|
104
|
+
hasIssuesFile: hasIssues,
|
|
105
|
+
issueCount,
|
|
106
|
+
},
|
|
107
|
+
};
|
|
108
|
+
},
|
|
109
|
+
createProvider(options, projectPath) {
|
|
110
|
+
return new BeadsProvider(options, projectPath);
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Beads provider implementation
|
|
115
|
+
*/
|
|
116
|
+
class BeadsProvider {
|
|
117
|
+
name = "beads";
|
|
118
|
+
supportsWatch = true;
|
|
119
|
+
supportsPolling = true;
|
|
120
|
+
options;
|
|
121
|
+
projectPath;
|
|
122
|
+
resolvedPath;
|
|
123
|
+
// CLI detection (cached)
|
|
124
|
+
cliAvailable = false;
|
|
125
|
+
// Change tracking for getChangesSince
|
|
126
|
+
entityHashes = new Map();
|
|
127
|
+
lastCaptureTime = new Date(0);
|
|
128
|
+
// File watcher
|
|
129
|
+
beadsWatcher = null;
|
|
130
|
+
constructor(options, projectPath) {
|
|
131
|
+
this.options = options;
|
|
132
|
+
this.projectPath = projectPath;
|
|
133
|
+
this.resolvedPath = path.resolve(projectPath, options.path);
|
|
134
|
+
}
|
|
135
|
+
async initialize(_config) {
|
|
136
|
+
console.log(`[beads] Initializing provider for path: ${this.resolvedPath}`);
|
|
137
|
+
if (!existsSync(this.resolvedPath)) {
|
|
138
|
+
throw new Error(`Beads directory not found: ${this.resolvedPath}`);
|
|
139
|
+
}
|
|
140
|
+
// Check CLI availability
|
|
141
|
+
this.cliAvailable = isBeadsCLIAvailable();
|
|
142
|
+
console.log(`[beads] CLI available: ${this.cliAvailable}`);
|
|
143
|
+
// Capture initial state for change detection
|
|
144
|
+
this.captureEntityState();
|
|
145
|
+
console.log(`[beads] Captured initial state with ${this.entityHashes.size} entities`);
|
|
146
|
+
}
|
|
147
|
+
async validate() {
|
|
148
|
+
const errors = [];
|
|
149
|
+
if (!existsSync(this.resolvedPath)) {
|
|
150
|
+
errors.push(`Beads directory not found: ${this.resolvedPath}`);
|
|
151
|
+
}
|
|
152
|
+
const issuesPath = path.join(this.resolvedPath, "issues.jsonl");
|
|
153
|
+
if (!existsSync(issuesPath)) {
|
|
154
|
+
// Not an error - file might not exist yet
|
|
155
|
+
console.log(`[beads] Note: issues.jsonl does not exist yet at ${issuesPath}`);
|
|
156
|
+
}
|
|
157
|
+
const valid = errors.length === 0;
|
|
158
|
+
console.log(`[beads] Validation result: valid=${valid}, errors=${errors.length}`);
|
|
159
|
+
return { valid, errors };
|
|
160
|
+
}
|
|
161
|
+
async dispose() {
|
|
162
|
+
console.log(`[beads] Disposing provider`);
|
|
163
|
+
// Stop watcher if running
|
|
164
|
+
this.stopWatching();
|
|
165
|
+
}
|
|
166
|
+
parseExternalId(id) {
|
|
167
|
+
// Handle "beads:xxx" format or just "xxx"
|
|
168
|
+
if (id.startsWith("beads:")) {
|
|
169
|
+
return { provider: "beads", id: id.substring(6) };
|
|
170
|
+
}
|
|
171
|
+
return { provider: "beads", id };
|
|
172
|
+
}
|
|
173
|
+
formatExternalId(id) {
|
|
174
|
+
return `beads:${id}`;
|
|
175
|
+
}
|
|
176
|
+
/**
|
|
177
|
+
* Capture current entity state for change detection
|
|
178
|
+
*/
|
|
179
|
+
captureEntityState() {
|
|
180
|
+
const issues = readBeadsJSONL(path.join(this.resolvedPath, "issues.jsonl"), { skipErrors: true });
|
|
181
|
+
this.entityHashes.clear();
|
|
182
|
+
for (const issue of issues) {
|
|
183
|
+
const hash = computeCanonicalHash(issue);
|
|
184
|
+
this.entityHashes.set(issue.id, hash);
|
|
185
|
+
}
|
|
186
|
+
this.lastCaptureTime = new Date();
|
|
187
|
+
}
|
|
188
|
+
async fetchEntity(externalId) {
|
|
189
|
+
const issuesPath = path.join(this.resolvedPath, "issues.jsonl");
|
|
190
|
+
if (!existsSync(issuesPath)) {
|
|
191
|
+
return null;
|
|
192
|
+
}
|
|
193
|
+
try {
|
|
194
|
+
const content = readFileSync(issuesPath, "utf-8");
|
|
195
|
+
const lines = content.split("\n").filter((line) => line.trim());
|
|
196
|
+
for (const line of lines) {
|
|
197
|
+
const issue = JSON.parse(line);
|
|
198
|
+
if (issue.id === externalId) {
|
|
199
|
+
return this.beadsToExternal(issue);
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
catch {
|
|
204
|
+
// Ignore parse errors
|
|
205
|
+
}
|
|
206
|
+
return null;
|
|
207
|
+
}
|
|
208
|
+
async searchEntities(query) {
|
|
209
|
+
const issuesPath = path.join(this.resolvedPath, "issues.jsonl");
|
|
210
|
+
if (!existsSync(issuesPath)) {
|
|
211
|
+
return [];
|
|
212
|
+
}
|
|
213
|
+
try {
|
|
214
|
+
const content = readFileSync(issuesPath, "utf-8");
|
|
215
|
+
const lines = content.split("\n").filter((line) => line.trim());
|
|
216
|
+
const entities = [];
|
|
217
|
+
for (const line of lines) {
|
|
218
|
+
try {
|
|
219
|
+
const issue = JSON.parse(line);
|
|
220
|
+
const entity = this.beadsToExternal(issue);
|
|
221
|
+
// Filter by query if provided
|
|
222
|
+
if (query) {
|
|
223
|
+
const lowerQuery = query.toLowerCase();
|
|
224
|
+
if (entity.title.toLowerCase().includes(lowerQuery) ||
|
|
225
|
+
entity.description?.toLowerCase().includes(lowerQuery)) {
|
|
226
|
+
entities.push(entity);
|
|
227
|
+
}
|
|
228
|
+
}
|
|
229
|
+
else {
|
|
230
|
+
entities.push(entity);
|
|
231
|
+
}
|
|
232
|
+
}
|
|
233
|
+
catch {
|
|
234
|
+
// Skip invalid lines
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return entities;
|
|
238
|
+
}
|
|
239
|
+
catch {
|
|
240
|
+
return [];
|
|
241
|
+
}
|
|
242
|
+
}
|
|
243
|
+
async createEntity(entity) {
|
|
244
|
+
const prefix = this.options.issue_prefix || "beads";
|
|
245
|
+
if (this.cliAvailable) {
|
|
246
|
+
// Use Beads CLI for creation
|
|
247
|
+
try {
|
|
248
|
+
const id = createIssueViaCLI(this.projectPath, entity.title || "Untitled", {
|
|
249
|
+
priority: entity.priority,
|
|
250
|
+
beadsDir: this.resolvedPath,
|
|
251
|
+
});
|
|
252
|
+
// CLI create doesn't support content or status - update via JSONL if provided
|
|
253
|
+
// Note: sudocode uses 'content', beads uses 'description'
|
|
254
|
+
const issueEntity = entity;
|
|
255
|
+
if (entity.content || issueEntity.status) {
|
|
256
|
+
updateIssueViaJSONL(this.resolvedPath, id, {
|
|
257
|
+
...(entity.content ? { description: entity.content } : {}), // Map content → description
|
|
258
|
+
...(issueEntity.status ? { status: issueEntity.status } : {}),
|
|
259
|
+
});
|
|
260
|
+
}
|
|
261
|
+
// Read back and update watcher hash
|
|
262
|
+
this.updateWatcherHashForEntity(id);
|
|
263
|
+
// Refresh state after creation
|
|
264
|
+
this.captureEntityState();
|
|
265
|
+
return id;
|
|
266
|
+
}
|
|
267
|
+
catch (cliError) {
|
|
268
|
+
// Fall back to JSONL if CLI fails
|
|
269
|
+
console.warn("[beads] CLI create failed, falling back to JSONL:", cliError);
|
|
270
|
+
}
|
|
271
|
+
}
|
|
272
|
+
// Fallback: Direct JSONL manipulation
|
|
273
|
+
// Note: sudocode uses 'content', beads uses 'description'
|
|
274
|
+
const issueEntity = entity;
|
|
275
|
+
const newIssue = createIssueViaJSONL(this.resolvedPath, {
|
|
276
|
+
title: entity.title,
|
|
277
|
+
description: entity.content, // Map content → description
|
|
278
|
+
status: issueEntity.status || "open",
|
|
279
|
+
priority: entity.priority ?? 2,
|
|
280
|
+
}, prefix);
|
|
281
|
+
// Update watcher hash so it won't detect our create as a change
|
|
282
|
+
if (this.beadsWatcher) {
|
|
283
|
+
this.beadsWatcher.updateEntityHash(newIssue.id, newIssue);
|
|
284
|
+
}
|
|
285
|
+
// Refresh state after creation
|
|
286
|
+
this.captureEntityState();
|
|
287
|
+
return newIssue.id;
|
|
288
|
+
}
|
|
289
|
+
/**
|
|
290
|
+
* Helper to update watcher hash for an entity after writing
|
|
291
|
+
*/
|
|
292
|
+
updateWatcherHashForEntity(entityId) {
|
|
293
|
+
if (!this.beadsWatcher)
|
|
294
|
+
return;
|
|
295
|
+
const issues = readBeadsJSONL(path.join(this.resolvedPath, "issues.jsonl"), { skipErrors: true });
|
|
296
|
+
const entity = issues.find(i => i.id === entityId);
|
|
297
|
+
if (entity) {
|
|
298
|
+
this.beadsWatcher.updateEntityHash(entityId, entity);
|
|
299
|
+
}
|
|
300
|
+
}
|
|
301
|
+
async updateEntity(externalId, entity) {
|
|
302
|
+
console.log(`[beads] updateEntity called for ${externalId}:`, JSON.stringify(entity));
|
|
303
|
+
// Always use direct JSONL for updates (Beads CLI may not have update command)
|
|
304
|
+
// Only include defined fields to avoid overwriting existing values with undefined
|
|
305
|
+
// Note: sudocode uses 'content', beads uses 'description'
|
|
306
|
+
const issueEntity = entity;
|
|
307
|
+
const updates = {};
|
|
308
|
+
if (entity.title !== undefined)
|
|
309
|
+
updates.title = entity.title;
|
|
310
|
+
if (entity.content !== undefined)
|
|
311
|
+
updates.description = entity.content; // Map content → description
|
|
312
|
+
if (issueEntity.status !== undefined)
|
|
313
|
+
updates.status = issueEntity.status;
|
|
314
|
+
if (entity.priority !== undefined)
|
|
315
|
+
updates.priority = entity.priority;
|
|
316
|
+
console.log(`[beads] Writing updates to beads:`, JSON.stringify(updates));
|
|
317
|
+
updateIssueViaJSONL(this.resolvedPath, externalId, updates);
|
|
318
|
+
// Read back the updated entity to get the full content with new updated_at
|
|
319
|
+
const updatedIssues = readBeadsJSONL(path.join(this.resolvedPath, "issues.jsonl"), { skipErrors: true });
|
|
320
|
+
const updatedEntity = updatedIssues.find(i => i.id === externalId);
|
|
321
|
+
// Update watcher's hash cache so it won't detect our write as a change
|
|
322
|
+
if (this.beadsWatcher && updatedEntity) {
|
|
323
|
+
this.beadsWatcher.updateEntityHash(externalId, updatedEntity);
|
|
324
|
+
}
|
|
325
|
+
// Refresh provider state after update
|
|
326
|
+
this.captureEntityState();
|
|
327
|
+
}
|
|
328
|
+
async deleteEntity(externalId) {
|
|
329
|
+
// Always use JSONL for hard delete - CLI 'close' only changes status
|
|
330
|
+
// This ensures the entity is actually removed from the file
|
|
331
|
+
deleteIssueViaJSONL(this.resolvedPath, externalId);
|
|
332
|
+
// Remove from watcher's hash cache so it won't detect our delete as a change
|
|
333
|
+
if (this.beadsWatcher) {
|
|
334
|
+
this.beadsWatcher.removeEntityHash(externalId);
|
|
335
|
+
}
|
|
336
|
+
this.captureEntityState();
|
|
337
|
+
}
|
|
338
|
+
async getChangesSince(timestamp) {
|
|
339
|
+
const issues = readBeadsJSONL(path.join(this.resolvedPath, "issues.jsonl"), { skipErrors: true });
|
|
340
|
+
const changes = [];
|
|
341
|
+
const currentIds = new Set();
|
|
342
|
+
// Check for created and updated entities
|
|
343
|
+
for (const issue of issues) {
|
|
344
|
+
currentIds.add(issue.id);
|
|
345
|
+
const newHash = computeCanonicalHash(issue);
|
|
346
|
+
const cachedHash = this.entityHashes.get(issue.id);
|
|
347
|
+
// Check if entity was modified after the timestamp
|
|
348
|
+
const entityUpdatedAt = issue.updated_at ? new Date(issue.updated_at) : new Date();
|
|
349
|
+
if (!cachedHash) {
|
|
350
|
+
// New entity
|
|
351
|
+
if (entityUpdatedAt >= timestamp) {
|
|
352
|
+
changes.push({
|
|
353
|
+
entity_id: issue.id,
|
|
354
|
+
entity_type: "issue",
|
|
355
|
+
change_type: "created",
|
|
356
|
+
timestamp: issue.created_at || new Date().toISOString(),
|
|
357
|
+
data: this.beadsToExternal(issue),
|
|
358
|
+
});
|
|
359
|
+
}
|
|
360
|
+
this.entityHashes.set(issue.id, newHash);
|
|
361
|
+
}
|
|
362
|
+
else if (newHash !== cachedHash) {
|
|
363
|
+
// Updated entity
|
|
364
|
+
if (entityUpdatedAt >= timestamp) {
|
|
365
|
+
changes.push({
|
|
366
|
+
entity_id: issue.id,
|
|
367
|
+
entity_type: "issue",
|
|
368
|
+
change_type: "updated",
|
|
369
|
+
timestamp: issue.updated_at || new Date().toISOString(),
|
|
370
|
+
data: this.beadsToExternal(issue),
|
|
371
|
+
});
|
|
372
|
+
}
|
|
373
|
+
this.entityHashes.set(issue.id, newHash);
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
// Check for deleted entities
|
|
377
|
+
const now = new Date().toISOString();
|
|
378
|
+
for (const [id] of this.entityHashes) {
|
|
379
|
+
if (!currentIds.has(id)) {
|
|
380
|
+
changes.push({
|
|
381
|
+
entity_id: id,
|
|
382
|
+
entity_type: "issue",
|
|
383
|
+
change_type: "deleted",
|
|
384
|
+
timestamp: now,
|
|
385
|
+
});
|
|
386
|
+
this.entityHashes.delete(id);
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
return changes;
|
|
390
|
+
}
|
|
391
|
+
// =========================================================================
|
|
392
|
+
// Real-time Watching
|
|
393
|
+
// =========================================================================
|
|
394
|
+
startWatching(callback) {
|
|
395
|
+
console.log(`[beads] startWatching called for path: ${this.resolvedPath}`);
|
|
396
|
+
if (this.beadsWatcher) {
|
|
397
|
+
console.warn("[beads] Already watching");
|
|
398
|
+
return;
|
|
399
|
+
}
|
|
400
|
+
this.beadsWatcher = new BeadsWatcher(this.resolvedPath);
|
|
401
|
+
this.beadsWatcher.start((changes) => {
|
|
402
|
+
console.log(`[beads] Watcher detected ${changes.length} change(s), forwarding to coordinator`);
|
|
403
|
+
callback(changes);
|
|
404
|
+
});
|
|
405
|
+
console.log("[beads] Watcher started successfully");
|
|
406
|
+
}
|
|
407
|
+
stopWatching() {
|
|
408
|
+
console.log("[beads] stopWatching called");
|
|
409
|
+
if (this.beadsWatcher) {
|
|
410
|
+
this.beadsWatcher.stop();
|
|
411
|
+
this.beadsWatcher = null;
|
|
412
|
+
}
|
|
413
|
+
}
|
|
414
|
+
mapToSudocode(external) {
|
|
415
|
+
if (external.type === "issue") {
|
|
416
|
+
return {
|
|
417
|
+
issue: {
|
|
418
|
+
title: external.title,
|
|
419
|
+
content: external.description || "",
|
|
420
|
+
priority: external.priority ?? 2,
|
|
421
|
+
status: this.mapStatus(external.status),
|
|
422
|
+
},
|
|
423
|
+
};
|
|
424
|
+
}
|
|
425
|
+
return {
|
|
426
|
+
spec: {
|
|
427
|
+
title: external.title,
|
|
428
|
+
content: external.description || "",
|
|
429
|
+
priority: external.priority ?? 2,
|
|
430
|
+
},
|
|
431
|
+
};
|
|
432
|
+
}
|
|
433
|
+
mapFromSudocode(entity) {
|
|
434
|
+
const isIssue = "status" in entity;
|
|
435
|
+
return {
|
|
436
|
+
type: isIssue ? "issue" : "spec",
|
|
437
|
+
title: entity.title,
|
|
438
|
+
description: entity.content,
|
|
439
|
+
priority: entity.priority,
|
|
440
|
+
status: isIssue ? entity.status : undefined,
|
|
441
|
+
};
|
|
442
|
+
}
|
|
443
|
+
beadsToExternal(beadsIssue) {
|
|
444
|
+
return {
|
|
445
|
+
id: beadsIssue.id,
|
|
446
|
+
type: "issue",
|
|
447
|
+
title: beadsIssue.title || "",
|
|
448
|
+
description: beadsIssue.description, // Beads uses 'description'
|
|
449
|
+
status: beadsIssue.status,
|
|
450
|
+
priority: beadsIssue.priority,
|
|
451
|
+
created_at: beadsIssue.created_at,
|
|
452
|
+
updated_at: beadsIssue.updated_at,
|
|
453
|
+
raw: beadsIssue,
|
|
454
|
+
};
|
|
455
|
+
}
|
|
456
|
+
mapStatus(externalStatus) {
|
|
457
|
+
if (!externalStatus)
|
|
458
|
+
return "open";
|
|
459
|
+
const statusMap = {
|
|
460
|
+
open: "open",
|
|
461
|
+
in_progress: "in_progress",
|
|
462
|
+
blocked: "blocked",
|
|
463
|
+
needs_review: "needs_review",
|
|
464
|
+
closed: "closed",
|
|
465
|
+
done: "closed",
|
|
466
|
+
completed: "closed",
|
|
467
|
+
};
|
|
468
|
+
return statusMap[externalStatus.toLowerCase()] || "open";
|
|
469
|
+
}
|
|
470
|
+
}
|
|
471
|
+
export default beadsPlugin;
|
|
472
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAaH,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,IAAI,CAAC;AAC9C,OAAO,KAAK,IAAI,MAAM,MAAM,CAAC;AAE7B,qBAAqB;AACrB,OAAO,EAAE,oBAAoB,EAAE,MAAM,iBAAiB,CAAC;AACvD,OAAO,EACL,cAAc,EACd,mBAAmB,EACnB,mBAAmB,EACnB,mBAAmB,GAEpB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,mBAAmB,EACnB,iBAAiB,GAElB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAuB,MAAM,cAAc,CAAC;AAYjE;;GAEG;AACH,MAAM,WAAW,GAAsB;I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EAAE,QAAQ;YACd,SAAS,EAAE,QAAQ;SACpB,CAAC;QAEF,OAAO,SAAS,CAAC,cAAc,CAAC,WAAW,EAAE,CAAC,IAAI,MAAM,CAAC;IAC3D,CAAC;CACF;AAED,eAAe,WAAW,CAAC"}
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* JSONL utilities for Beads plugin
|
|
3
|
+
*
|
|
4
|
+
* Provides atomic read/write operations for .beads/issues.jsonl files.
|
|
5
|
+
* Used as fallback when Beads CLI is not available.
|
|
6
|
+
*/
|
|
7
|
+
/**
|
|
8
|
+
* Beads issue structure (minimal fields we need)
|
|
9
|
+
* Note: Beads uses 'description' while sudocode uses 'content'
|
|
10
|
+
*/
|
|
11
|
+
export interface BeadsIssue {
|
|
12
|
+
id: string;
|
|
13
|
+
title: string;
|
|
14
|
+
description?: string;
|
|
15
|
+
status?: string;
|
|
16
|
+
priority?: number;
|
|
17
|
+
created_at: string;
|
|
18
|
+
updated_at: string;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* Read all issues from a beads JSONL file
|
|
23
|
+
*
|
|
24
|
+
* @param filePath - Path to issues.jsonl
|
|
25
|
+
* @param options - Read options
|
|
26
|
+
* @returns Array of parsed issues
|
|
27
|
+
*/
|
|
28
|
+
export declare function readBeadsJSONL(filePath: string, options?: {
|
|
29
|
+
skipErrors?: boolean;
|
|
30
|
+
}): BeadsIssue[];
|
|
31
|
+
/**
|
|
32
|
+
* Write issues to a beads JSONL file atomically
|
|
33
|
+
*
|
|
34
|
+
* Features:
|
|
35
|
+
* - Atomic write (temp file + rename)
|
|
36
|
+
* - Sorted by created_at to minimize git merge conflicts
|
|
37
|
+
* - Skips write if content unchanged (prevents watcher loops)
|
|
38
|
+
*
|
|
39
|
+
* @param filePath - Path to issues.jsonl
|
|
40
|
+
* @param issues - Array of issues to write
|
|
41
|
+
*/
|
|
42
|
+
export declare function writeBeadsJSONL(filePath: string, issues: BeadsIssue[]): void;
|
|
43
|
+
/**
|
|
44
|
+
* Generate a beads-style ID
|
|
45
|
+
*
|
|
46
|
+
* Beads uses IDs like "beads-a1b2c3d4"
|
|
47
|
+
*
|
|
48
|
+
* @param prefix - ID prefix (default: "beads")
|
|
49
|
+
* @returns Generated ID
|
|
50
|
+
*/
|
|
51
|
+
export declare function generateBeadsId(prefix?: string): string;
|
|
52
|
+
/**
|
|
53
|
+
* Create a new issue in the JSONL file
|
|
54
|
+
*
|
|
55
|
+
* @param beadsDir - Path to .beads directory
|
|
56
|
+
* @param issue - Issue data to create
|
|
57
|
+
* @param idPrefix - Prefix for generated ID
|
|
58
|
+
* @returns The created issue with generated ID
|
|
59
|
+
*/
|
|
60
|
+
export declare function createIssueViaJSONL(beadsDir: string, issue: Partial<BeadsIssue>, idPrefix?: string): BeadsIssue;
|
|
61
|
+
/**
|
|
62
|
+
* Update an existing issue in the JSONL file
|
|
63
|
+
*
|
|
64
|
+
* @param beadsDir - Path to .beads directory
|
|
65
|
+
* @param issueId - ID of issue to update
|
|
66
|
+
* @param updates - Fields to update
|
|
67
|
+
* @returns The updated issue
|
|
68
|
+
* @throws Error if issue not found
|
|
69
|
+
*/
|
|
70
|
+
export declare function updateIssueViaJSONL(beadsDir: string, issueId: string, updates: Partial<BeadsIssue>): BeadsIssue;
|
|
71
|
+
/**
|
|
72
|
+
* Delete an issue from the JSONL file
|
|
73
|
+
*
|
|
74
|
+
* @param beadsDir - Path to .beads directory
|
|
75
|
+
* @param issueId - ID of issue to delete
|
|
76
|
+
* @returns True if deleted, false if not found
|
|
77
|
+
*/
|
|
78
|
+
export declare function deleteIssueViaJSONL(beadsDir: string, issueId: string): boolean;
|
|
79
|
+
/**
|
|
80
|
+
* Get a single issue by ID
|
|
81
|
+
*
|
|
82
|
+
* @param beadsDir - Path to .beads directory
|
|
83
|
+
* @param issueId - ID of issue to find
|
|
84
|
+
* @returns The issue or null if not found
|
|
85
|
+
*/
|
|
86
|
+
export declare function getIssueById(beadsDir: string, issueId: string): BeadsIssue | null;
|
|
87
|
+
//# sourceMappingURL=jsonl-utils.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"jsonl-utils.d.ts","sourceRoot":"","sources":["../src/jsonl-utils.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAMH;;;GAGG;AACH,MAAM,WAAW,UAAU;IACzB,EAAE,EAAE,MAAM,CAAC;IACX,KAAK,EAAE,MAAM,CAAC;IACd,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,UAAU,EAAE,MAAM,CAAC;IAEnB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC;CACxB;AAED;;;;;;GAMG;AACH,wBAAgB,cAAc,CAC5B,QAAQ,EAAE,MAAM,EAChB,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,OAAO,CAAA;CAAO,GACrC,UAAU,EAAE,CA6Bd;AAED;;;;;;;;;;GAUG;AACH,wBAAgB,eAAe,CAAC,QAAQ,EAAE,MAAM,EAAE,MAAM,EAAE,UAAU,EAAE,GAAG,IAAI,CAmC5E;AAED;;;;;;;GAOG;AACH,wBAAgB,eAAe,CAAC,MAAM,GAAE,MAAgB,GAAG,MAAM,CAGhE;AAED;;;;;;;GAOG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,OAAO,CAAC,UAAU,CAAC,EAC1B,QAAQ,GAAE,MAAgB,GACzB,UAAU,CAuBZ;AAED;;;;;;;;GAQG;AACH,wBAAgB,mBAAmB,CACjC,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,OAAO,CAAC,UAAU,CAAC,GAC3B,UAAU,CA6BZ;AAED;;;;;;GAMG;AACH,wBAAgB,mBAAmB,CAAC,QAA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