lalph 0.1.69 → 0.1.70
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.mjs +7 -6
- package/package.json +1 -1
- package/src/Prd.ts +65 -59
package/dist/cli.mjs
CHANGED
|
@@ -141989,6 +141989,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
141989
141989
|
const yaml = yield* fs.readFileString(prdFile);
|
|
141990
141990
|
return PrdIssue.arrayFromYaml(yaml);
|
|
141991
141991
|
});
|
|
141992
|
+
const syncSemaphore = makeSemaphoreUnsafe(1);
|
|
141992
141993
|
const mergableGithubPrs = gen(function* () {
|
|
141993
141994
|
const updated = yield* readPrd;
|
|
141994
141995
|
const prs = empty$11();
|
|
@@ -142008,7 +142009,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142008
142009
|
issueId: issue.id,
|
|
142009
142010
|
state: "todo"
|
|
142010
142011
|
});
|
|
142011
|
-
});
|
|
142012
|
+
}, syncSemaphore.withPermit);
|
|
142012
142013
|
const mergeConflictInstruction = "Next step: Rebase PR and resolve merge conflicts.";
|
|
142013
142014
|
const flagUnmergable = fnUntraced(function* (options) {
|
|
142014
142015
|
const issue = current.find((entry) => entry.id === options.issueId);
|
|
@@ -142048,7 +142049,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142048
142049
|
let current = yield* source.issues;
|
|
142049
142050
|
yield* fs.writeFileString(prdFile, PrdIssue.arrayToYaml(current));
|
|
142050
142051
|
const updatedIssues = /* @__PURE__ */ new Map();
|
|
142051
|
-
const sync$2 = gen(function* () {
|
|
142052
|
+
const sync$2 = syncSemaphore.withPermit(gen(function* () {
|
|
142052
142053
|
const updated = yield* readPrd;
|
|
142053
142054
|
if (!(updated.length !== current.length || updated.some((u, i) => u.isChangedComparedTo(current[i])))) return;
|
|
142054
142055
|
const githubPrs = /* @__PURE__ */ new Map();
|
|
@@ -142081,7 +142082,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142081
142082
|
githubPrNumber: prNumber
|
|
142082
142083
|
});
|
|
142083
142084
|
})));
|
|
142084
|
-
}).pipe(uninterruptible);
|
|
142085
|
+
}).pipe(uninterruptible));
|
|
142085
142086
|
const updateSyncHandle = yield* make$25();
|
|
142086
142087
|
const updateSync = gen(function* () {
|
|
142087
142088
|
const tempFile = yield* fs.makeTempFileScoped();
|
|
@@ -142101,7 +142102,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142101
142102
|
path: prdFile,
|
|
142102
142103
|
mergableGithubPrs,
|
|
142103
142104
|
maybeRevertIssue,
|
|
142104
|
-
revertUpdatedIssues: gen(function* () {
|
|
142105
|
+
revertUpdatedIssues: syncSemaphore.withPermit(gen(function* () {
|
|
142105
142106
|
for (const issue of updatedIssues.values()) {
|
|
142106
142107
|
if (issue.state === "done") continue;
|
|
142107
142108
|
yield* source.updateIssue({
|
|
@@ -142109,7 +142110,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
|
|
|
142109
142110
|
state: "todo"
|
|
142110
142111
|
});
|
|
142111
142112
|
}
|
|
142112
|
-
}),
|
|
142113
|
+
})),
|
|
142113
142114
|
flagUnmergable,
|
|
142114
142115
|
findById
|
|
142115
142116
|
};
|
|
@@ -142442,7 +142443,7 @@ const commandSource = make$27("source").pipe(withDescription("Select the issue s
|
|
|
142442
142443
|
|
|
142443
142444
|
//#endregion
|
|
142444
142445
|
//#region package.json
|
|
142445
|
-
var version = "0.1.
|
|
142446
|
+
var version = "0.1.70";
|
|
142446
142447
|
|
|
142447
142448
|
//#endregion
|
|
142448
142449
|
//#region src/cli.ts
|
package/package.json
CHANGED
package/src/Prd.ts
CHANGED
|
@@ -53,6 +53,8 @@ export class Prd extends ServiceMap.Service<
|
|
|
53
53
|
return PrdIssue.arrayFromYaml(yaml)
|
|
54
54
|
})
|
|
55
55
|
|
|
56
|
+
const syncSemaphore = Effect.makeSemaphoreUnsafe(1)
|
|
57
|
+
|
|
56
58
|
const mergableGithubPrs = Effect.gen(function* () {
|
|
57
59
|
const updated = yield* readPrd
|
|
58
60
|
const prs = Array.empty<{ issueId: string; prNumber: number }>()
|
|
@@ -76,7 +78,7 @@ export class Prd extends ServiceMap.Service<
|
|
|
76
78
|
issueId: issue.id!,
|
|
77
79
|
state: "todo",
|
|
78
80
|
})
|
|
79
|
-
})
|
|
81
|
+
}, syncSemaphore.withPermit)
|
|
80
82
|
|
|
81
83
|
const mergeConflictInstruction =
|
|
82
84
|
"Next step: Rebase PR and resolve merge conflicts."
|
|
@@ -134,64 +136,66 @@ export class Prd extends ServiceMap.Service<
|
|
|
134
136
|
|
|
135
137
|
const updatedIssues = new Map<string, PrdIssue>()
|
|
136
138
|
|
|
137
|
-
const sync =
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
139
|
+
const sync = syncSemaphore.withPermit(
|
|
140
|
+
Effect.gen(function* () {
|
|
141
|
+
const updated = yield* readPrd
|
|
142
|
+
const anyChanges =
|
|
143
|
+
updated.length !== current.length ||
|
|
144
|
+
updated.some((u, i) => u.isChangedComparedTo(current[i]!))
|
|
145
|
+
if (!anyChanges) {
|
|
146
|
+
return
|
|
147
|
+
}
|
|
145
148
|
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
149
|
+
const githubPrs = new Map<string, number>()
|
|
150
|
+
const toRemove = new Set(
|
|
151
|
+
current.filter((i) => i.id !== null).map((i) => i.id!),
|
|
152
|
+
)
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
154
|
+
for (const issue of updated) {
|
|
155
|
+
toRemove.delete(issue.id!)
|
|
153
156
|
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
157
|
+
if (issue.id === null) {
|
|
158
|
+
yield* source.createIssue(issue)
|
|
159
|
+
continue
|
|
160
|
+
}
|
|
158
161
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
+
if (issue.githubPrNumber) {
|
|
163
|
+
githubPrs.set(issue.id, issue.githubPrNumber)
|
|
164
|
+
}
|
|
162
165
|
|
|
163
|
-
|
|
164
|
-
|
|
166
|
+
const existing = current.find((i) => i.id === issue.id)
|
|
167
|
+
if (!existing || !existing.isChangedComparedTo(issue)) continue
|
|
165
168
|
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
169
|
+
yield* source.updateIssue({
|
|
170
|
+
issueId: issue.id,
|
|
171
|
+
title: issue.title,
|
|
172
|
+
description: issue.description,
|
|
173
|
+
state: issue.state,
|
|
174
|
+
blockedBy: issue.blockedBy,
|
|
175
|
+
})
|
|
173
176
|
|
|
174
|
-
|
|
175
|
-
|
|
177
|
+
updatedIssues.set(issue.id, issue)
|
|
178
|
+
}
|
|
176
179
|
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
180
|
+
yield* Effect.forEach(
|
|
181
|
+
toRemove,
|
|
182
|
+
(issueId) => source.cancelIssue(issueId),
|
|
183
|
+
{ concurrency: "unbounded" },
|
|
184
|
+
)
|
|
182
185
|
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
186
|
+
current = yield* source.issues
|
|
187
|
+
yield* fs.writeFileString(
|
|
188
|
+
prdFile,
|
|
189
|
+
PrdIssue.arrayToYaml(
|
|
190
|
+
current.map((issue) => {
|
|
191
|
+
const prNumber = githubPrs.get(issue.id!)
|
|
192
|
+
if (!prNumber) return issue
|
|
193
|
+
return new PrdIssue({ ...issue, githubPrNumber: prNumber })
|
|
194
|
+
}),
|
|
195
|
+
),
|
|
196
|
+
)
|
|
197
|
+
}).pipe(Effect.uninterruptible),
|
|
198
|
+
)
|
|
195
199
|
|
|
196
200
|
const updateSyncHandle = yield* FiberHandle.make()
|
|
197
201
|
const updateSync = Effect.gen(function* () {
|
|
@@ -237,15 +241,17 @@ export class Prd extends ServiceMap.Service<
|
|
|
237
241
|
path: prdFile,
|
|
238
242
|
mergableGithubPrs,
|
|
239
243
|
maybeRevertIssue,
|
|
240
|
-
revertUpdatedIssues:
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
245
|
-
|
|
246
|
-
|
|
247
|
-
|
|
248
|
-
|
|
244
|
+
revertUpdatedIssues: syncSemaphore.withPermit(
|
|
245
|
+
Effect.gen(function* () {
|
|
246
|
+
for (const issue of updatedIssues.values()) {
|
|
247
|
+
if (issue.state === "done") continue
|
|
248
|
+
yield* source.updateIssue({
|
|
249
|
+
issueId: issue.id!,
|
|
250
|
+
state: "todo",
|
|
251
|
+
})
|
|
252
|
+
}
|
|
253
|
+
}),
|
|
254
|
+
),
|
|
249
255
|
flagUnmergable,
|
|
250
256
|
findById,
|
|
251
257
|
}
|