lalph 0.1.103 → 0.1.104

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 CHANGED
@@ -149039,13 +149039,14 @@ const currentIssuesAtom = pipe(issueSourceRuntime.atom(fnUntraced(function* (get
149039
149039
  get.addFinalizer(() => clearTimeout(handle));
149040
149040
  return issues;
149041
149041
  })), makeAtomRuntime.withReactivity(["issues"]), keepAlive);
149042
+ const getCurrentIssues = getResult(currentIssuesAtom, { suspendOnWaiting: true });
149042
149043
  const checkForWork = gen(function* () {
149043
- if (!(yield* getResult(currentIssuesAtom)).some((issue) => issue.state === "todo" && issue.blockedBy.length === 0)) return yield* new NoMoreWork({});
149044
+ if (!(yield* getCurrentIssues).some((issue) => issue.state === "todo" && issue.blockedBy.length === 0)) return yield* new NoMoreWork({});
149044
149045
  });
149045
149046
  const resetInProgress = gen(function* () {
149046
149047
  const source = yield* IssueSource;
149047
149048
  const reactivity = yield* Reactivity;
149048
- const inProgress = (yield* getResult(currentIssuesAtom)).filter((issue) => issue.state === "in-progress" && issue.id !== null);
149049
+ const inProgress = (yield* getCurrentIssues).filter((issue) => issue.state === "in-progress" && issue.id !== null);
149049
149050
  if (inProgress.length === 0) return;
149050
149051
  yield* forEach$1(inProgress, (issue) => source.updateIssue({
149051
149052
  issueId: issue.id,
@@ -149491,6 +149492,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
149491
149492
  const yaml = yield* fs.readFileString(prdFile);
149492
149493
  return PrdIssue.arrayFromYaml(yaml);
149493
149494
  });
149495
+ const getCurrentIssues = getResult$1(registry, currentIssuesAtom, { suspendOnWaiting: true });
149494
149496
  const syncSemaphore = makeSemaphoreUnsafe(1);
149495
149497
  const maybeRevertIssue = fnUntraced(function* (options) {
149496
149498
  const issue = (yield* readPrd).find((i) => i.id === options.issueId);
@@ -149502,7 +149504,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
149502
149504
  }, syncSemaphore.withPermit);
149503
149505
  const mergeConflictInstruction = "**Your only remaining task**: rebase the PR against the target branch, and resolve any merge conflicts. Once done, you can remove this instruction from the issue description.";
149504
149506
  const flagUnmergable = fnUntraced(function* (options) {
149505
- const issue = (yield* getResult$1(registry, currentIssuesAtom)).find((entry) => entry.id === options.issueId);
149507
+ const issue = (yield* getCurrentIssues).find((entry) => entry.id === options.issueId);
149506
149508
  if (!issue) return;
149507
149509
  const nextDescription = issue.description.includes(mergeConflictInstruction) ? issue.description : `${mergeConflictInstruction}\n\n---\n\nPrevious description:\n\n${issue.description.trim()}`;
149508
149510
  yield* source.updateIssue({
@@ -149538,10 +149540,10 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
149538
149540
  };
149539
149541
  }
149540
149542
  yield* addFinalizer(() => ignore(fs.remove(prdFile)));
149541
- yield* fs.writeFileString(prdFile, PrdIssue.arrayToYaml(yield* getResult$1(registry, currentIssuesAtom)));
149543
+ yield* fs.writeFileString(prdFile, PrdIssue.arrayToYaml(yield* getCurrentIssues));
149542
149544
  const updatedIssues = /* @__PURE__ */ new Map();
149543
149545
  const sync$2 = gen(function* () {
149544
- const current = yield* getResult$1(registry, currentIssuesAtom);
149546
+ const current = yield* getCurrentIssues;
149545
149547
  const updated = yield* readPrd;
149546
149548
  if (!(updated.length !== current.length || updated.some((u, i) => u.isChangedComparedTo(current[i])))) return;
149547
149549
  const toRemove = new Set(current.filter((i) => i.id !== null).map((i) => i.id));
@@ -149581,7 +149583,7 @@ var Prd = class extends Service()("lalph/Prd", { make: gen(function* () {
149581
149583
  }), runForEach((_) => clear(updateSyncHandle).pipe(andThen(ignore(sync$2)))), retry$1(forever$1), forkScoped);
149582
149584
  yield* toStreamResult(registry, currentIssuesAtom).pipe(runForEach(updateSync), forkScoped);
149583
149585
  const findById = fnUntraced(function* (issueId) {
149584
- return (yield* getResult$1(registry, currentIssuesAtom)).find((i) => i.id === issueId) ?? null;
149586
+ return (yield* getCurrentIssues).find((i) => i.id === issueId) ?? null;
149585
149587
  });
149586
149588
  return {
149587
149589
  path: prdFile,
@@ -150111,7 +150113,7 @@ const commandSource = make$34("source").pipe(withDescription("Select the issue s
150111
150113
 
150112
150114
  //#endregion
150113
150115
  //#region package.json
150114
- var version = "0.1.103";
150116
+ var version = "0.1.104";
150115
150117
 
150116
150118
  //#endregion
150117
150119
  //#region src/Tracing.ts
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.1.103",
4
+ "version": "0.1.104",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -106,8 +106,12 @@ export const currentIssuesAtom = pipe(
106
106
 
107
107
  // Helpers
108
108
 
109
+ const getCurrentIssues = Atom.getResult(currentIssuesAtom, {
110
+ suspendOnWaiting: true,
111
+ })
112
+
109
113
  export const checkForWork = Effect.gen(function* () {
110
- const issues = yield* Atom.getResult(currentIssuesAtom)
114
+ const issues = yield* getCurrentIssues
111
115
  const hasIncomplete = issues.some(
112
116
  (issue) => issue.state === "todo" && issue.blockedBy.length === 0,
113
117
  )
@@ -119,7 +123,7 @@ export const checkForWork = Effect.gen(function* () {
119
123
  export const resetInProgress = Effect.gen(function* () {
120
124
  const source = yield* IssueSource
121
125
  const reactivity = yield* Reactivity.Reactivity
122
- const issues = yield* Atom.getResult(currentIssuesAtom)
126
+ const issues = yield* getCurrentIssues
123
127
  const inProgress = issues.filter(
124
128
  (issue): issue is PrdIssue & { id: string } =>
125
129
  issue.state === "in-progress" && issue.id !== null,
package/src/Prd.ts CHANGED
@@ -54,6 +54,11 @@ export class Prd extends ServiceMap.Service<
54
54
  const yaml = yield* fs.readFileString(prdFile)
55
55
  return PrdIssue.arrayFromYaml(yaml)
56
56
  })
57
+ const getCurrentIssues = AtomRegistry.getResult(
58
+ registry,
59
+ currentIssuesAtom,
60
+ { suspendOnWaiting: true },
61
+ )
57
62
 
58
63
  const syncSemaphore = Effect.makeSemaphoreUnsafe(1)
59
64
 
@@ -75,7 +80,7 @@ export class Prd extends ServiceMap.Service<
75
80
  const flagUnmergable = Effect.fnUntraced(function* (options: {
76
81
  readonly issueId: string
77
82
  }) {
78
- const current = yield* AtomRegistry.getResult(registry, currentIssuesAtom)
83
+ const current = yield* getCurrentIssues
79
84
  const issue = current.find((entry) => entry.id === options.issueId)
80
85
  if (!issue) return
81
86
 
@@ -126,15 +131,13 @@ export class Prd extends ServiceMap.Service<
126
131
 
127
132
  yield* fs.writeFileString(
128
133
  prdFile,
129
- PrdIssue.arrayToYaml(
130
- yield* AtomRegistry.getResult(registry, currentIssuesAtom),
131
- ),
134
+ PrdIssue.arrayToYaml(yield* getCurrentIssues),
132
135
  )
133
136
 
134
137
  const updatedIssues = new Map<string, PrdIssue>()
135
138
 
136
139
  const sync = Effect.gen(function* () {
137
- const current = yield* AtomRegistry.getResult(registry, currentIssuesAtom)
140
+ const current = yield* getCurrentIssues
138
141
  const updated = yield* readPrd
139
142
  const anyChanges =
140
143
  updated.length !== current.length ||
@@ -221,7 +224,7 @@ export class Prd extends ServiceMap.Service<
221
224
  )
222
225
 
223
226
  const findById = Effect.fnUntraced(function* (issueId: string) {
224
- const current = yield* AtomRegistry.getResult(registry, currentIssuesAtom)
227
+ const current = yield* getCurrentIssues
225
228
  return current.find((i) => i.id === issueId) ?? null
226
229
  })
227
230