@markmdev/pebble 0.1.15 → 0.1.16
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/index.js
CHANGED
|
@@ -86,6 +86,17 @@ function getMainWorktreeRoot() {
|
|
|
86
86
|
return null;
|
|
87
87
|
}
|
|
88
88
|
}
|
|
89
|
+
function getCurrentWorktreeName() {
|
|
90
|
+
try {
|
|
91
|
+
const toplevel = execSync("git rev-parse --show-toplevel", {
|
|
92
|
+
encoding: "utf-8",
|
|
93
|
+
stdio: ["pipe", "pipe", "pipe"]
|
|
94
|
+
}).trim();
|
|
95
|
+
return path.basename(toplevel);
|
|
96
|
+
} catch {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
89
100
|
|
|
90
101
|
// src/cli/lib/storage.ts
|
|
91
102
|
var PEBBLE_DIR = ".pebble";
|
|
@@ -187,9 +198,21 @@ function getIssuesPath(pebbleDir) {
|
|
|
187
198
|
const dir = pebbleDir ?? getPebbleDir();
|
|
188
199
|
return path2.join(dir, ISSUES_FILE);
|
|
189
200
|
}
|
|
201
|
+
function getEventSource() {
|
|
202
|
+
const worktreeName = getCurrentWorktreeName();
|
|
203
|
+
if (worktreeName) {
|
|
204
|
+
return worktreeName;
|
|
205
|
+
}
|
|
206
|
+
const pebbleDir = discoverPebbleDir();
|
|
207
|
+
if (pebbleDir) {
|
|
208
|
+
return path2.basename(path2.dirname(pebbleDir));
|
|
209
|
+
}
|
|
210
|
+
return "unknown";
|
|
211
|
+
}
|
|
190
212
|
function appendEvent(event, pebbleDir) {
|
|
191
213
|
const issuesPath = getIssuesPath(pebbleDir);
|
|
192
|
-
const
|
|
214
|
+
const eventWithSource = event.source ? event : { ...event, source: getEventSource() };
|
|
215
|
+
const line = JSON.stringify(eventWithSource) + "\n";
|
|
193
216
|
fs.appendFileSync(issuesPath, line, "utf-8");
|
|
194
217
|
}
|
|
195
218
|
function readEventsFromFile(filePath) {
|
|
@@ -270,7 +293,8 @@ function computeState(events) {
|
|
|
270
293
|
verifies: createEvent.data.verifies,
|
|
271
294
|
comments: [],
|
|
272
295
|
createdAt: event.timestamp,
|
|
273
|
-
updatedAt: event.timestamp
|
|
296
|
+
updatedAt: event.timestamp,
|
|
297
|
+
lastSource: event.source
|
|
274
298
|
};
|
|
275
299
|
issues.set(event.issueId, issue);
|
|
276
300
|
break;
|
|
@@ -304,6 +328,7 @@ function computeState(events) {
|
|
|
304
328
|
issue.relatedTo = updateEvent.data.relatedTo;
|
|
305
329
|
}
|
|
306
330
|
issue.updatedAt = event.timestamp;
|
|
331
|
+
if (event.source) issue.lastSource = event.source;
|
|
307
332
|
}
|
|
308
333
|
break;
|
|
309
334
|
}
|
|
@@ -312,6 +337,7 @@ function computeState(events) {
|
|
|
312
337
|
if (issue) {
|
|
313
338
|
issue.status = "closed";
|
|
314
339
|
issue.updatedAt = event.timestamp;
|
|
340
|
+
if (event.source) issue.lastSource = event.source;
|
|
315
341
|
}
|
|
316
342
|
break;
|
|
317
343
|
}
|
|
@@ -320,6 +346,7 @@ function computeState(events) {
|
|
|
320
346
|
if (issue) {
|
|
321
347
|
issue.status = "open";
|
|
322
348
|
issue.updatedAt = event.timestamp;
|
|
349
|
+
if (event.source) issue.lastSource = event.source;
|
|
323
350
|
}
|
|
324
351
|
break;
|
|
325
352
|
}
|
|
@@ -329,6 +356,7 @@ function computeState(events) {
|
|
|
329
356
|
if (issue) {
|
|
330
357
|
issue.comments.push(commentEvent.data);
|
|
331
358
|
issue.updatedAt = event.timestamp;
|
|
359
|
+
if (event.source) issue.lastSource = event.source;
|
|
332
360
|
}
|
|
333
361
|
break;
|
|
334
362
|
}
|
|
@@ -2205,7 +2233,8 @@ function findIssueInSources(issueId, filePaths) {
|
|
|
2205
2233
|
return { issue: found, targetFile };
|
|
2206
2234
|
}
|
|
2207
2235
|
function appendEventToFile(event, filePath) {
|
|
2208
|
-
const
|
|
2236
|
+
const eventWithSource = event.source ? event : { ...event, source: getEventSource() };
|
|
2237
|
+
const line = JSON.stringify(eventWithSource) + "\n";
|
|
2209
2238
|
fs2.appendFileSync(filePath, line, "utf-8");
|
|
2210
2239
|
}
|
|
2211
2240
|
function uiCommand(program2) {
|