lalph 0.3.108 → 0.3.109

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
@@ -241362,7 +241362,7 @@ var Prd = class extends Service$1()("lalph/Prd", { make: gen(function* () {
241362
241362
  const getCurrentIssues = get$5(issuesRef).pipe(map$10((i) => i.issues));
241363
241363
  const syncSemaphore = makeUnsafe$9(1);
241364
241364
  const maybeRevertIssue = fnUntraced(function* (options) {
241365
- const issue = (yield* readPrd).find((i) => i.id === options.issueId);
241365
+ const issue = yield* source.findById(projectId, options.issueId);
241366
241366
  if (!issue || issue.state === "in-review") return;
241367
241367
  yield* source.updateIssue({
241368
241368
  projectId,
@@ -241459,9 +241459,6 @@ var Prd = class extends Service$1()("lalph/Prd", { make: gen(function* () {
241459
241459
  }, scoped$1, withSpan$1("Prd.updateSync"), run$4(updateSyncHandle, { onlyIfMissing: true }), syncSemaphore.withPermitsIfAvailable(1));
241460
241460
  yield* fs.watch(lalphDir).pipe(filter$3((event) => event.path.endsWith("prd.yml")), debounce(50), runForEach((_) => clear(updateSyncHandle).pipe(andThen(ignore$1(sync$3)))), retry$1(forever$1), forkScoped);
241461
241461
  yield* changes(issuesRef).pipe(filter$3((change) => change._tag === "External"), runForEach((s) => updateSync(s.issues)), forkScoped);
241462
- const findById = fnUntraced(function* (issueId) {
241463
- return (yield* getCurrentIssues).find((i) => i.id === issueId) ?? null;
241464
- });
241465
241462
  return {
241466
241463
  path: prdFile,
241467
241464
  maybeRevertIssue,
@@ -241476,7 +241473,6 @@ var Prd = class extends Service$1()("lalph/Prd", { make: gen(function* () {
241476
241473
  }
241477
241474
  })),
241478
241475
  flagUnmergable,
241479
- findById,
241480
241476
  setChosenIssueId,
241481
241477
  setAutoMerge
241482
241478
  };
@@ -241491,7 +241487,6 @@ var Prd = class extends Service$1()("lalph/Prd", { make: gen(function* () {
241491
241487
  maybeRevertIssue: () => void_$2,
241492
241488
  revertUpdatedIssues: void_$2,
241493
241489
  flagUnmergable: () => void_$2,
241494
- findById: () => succeed$4(null),
241495
241490
  setChosenIssueId: () => void_$2,
241496
241491
  setAutoMerge: () => void_$2
241497
241492
  });
@@ -241760,7 +241755,7 @@ After making any changes, commit and push them to the same pull request.
241760
241755
  prState = yield* worktree.viewPrState(prState.value.number);
241761
241756
  yield* log$1("PR state after merge", prState);
241762
241757
  if (isSome(prState) && prState.value.state === "MERGED") {
241763
- const issue = yield* prd.findById(options.issueId);
241758
+ const issue = yield* source.findById(projectId, options.issueId);
241764
241759
  if (issue && issue.state !== "done") yield* source.updateIssue({
241765
241760
  projectId,
241766
241761
  issueId: options.issueId,
@@ -241805,11 +241800,11 @@ But you **do not** need to git push your changes or switch branches.
241805
241800
  }
241806
241801
  }),
241807
241802
  autoMerge: fnUntraced(function* (options) {
241808
- const prd = yield* Prd;
241803
+ const source = yield* IssueSource;
241809
241804
  const projectId = yield* CurrentProjectId;
241810
- const issue = yield* prd.findById(options.issueId);
241805
+ const issue = yield* source.findById(projectId, options.issueId);
241811
241806
  if (!issue || issue.state !== "in-review") return;
241812
- yield* (yield* IssueSource).updateIssue({
241807
+ yield* source.updateIssue({
241813
241808
  projectId,
241814
241809
  issueId: options.issueId,
241815
241810
  state: "done"
@@ -241846,11 +241841,12 @@ var GitFlowError = class extends TaggedError("GitFlowError") {};
241846
241841
  //#endregion
241847
241842
  //#region src/Agents/chooser.ts
241848
241843
  const agentChooser = fnUntraced(function* (options) {
241844
+ const projectId = yield* CurrentProjectId;
241849
241845
  const fs = yield* FileSystem;
241850
241846
  const pathService = yield* Path$1;
241851
241847
  const worktree = yield* Worktree;
241852
241848
  const promptGen = yield* PromptGen;
241853
- const prd = yield* Prd;
241849
+ const source = yield* IssueSource;
241854
241850
  const gitFlow = yield* GitFlow;
241855
241851
  const waitForFile = yield* makeWaitForFile;
241856
241852
  if (!options.preset.cliAgent.command) {
@@ -241862,7 +241858,7 @@ const agentChooser = fnUntraced(function* (options) {
241862
241858
  stallTimeout: options.stallTimeout,
241863
241859
  mode: "choose"
241864
241860
  }).pipe(provideService$2(ChosenTaskDeferred, deferred), flatMap$5(() => fail$6(new ChosenTaskNotFound$1())), raceFirst(_await(deferred)));
241865
- const prdTask = yield* prd.findById(result.taskId);
241861
+ const prdTask = yield* source.findById(projectId, result.taskId);
241866
241862
  if (!prdTask) return yield* new ChosenTaskNotFound$1();
241867
241863
  return {
241868
241864
  id: result.taskId,
@@ -241880,7 +241876,7 @@ const agentChooser = fnUntraced(function* (options) {
241880
241876
  onTimeout: () => fail$6(new RunnerStalled())
241881
241877
  }), raceFirst(taskJsonCreated));
241882
241878
  return yield* pipe$1(fs.readFileString(pathService.join(worktree.directory, ".lalph", "task.json")), flatMap$5(decodeEffect(ChosenTask)), mapError$2((_) => new ChosenTaskNotFound$1()), flatMap$5(fnUntraced(function* (task) {
241883
- const prdTask = yield* prd.findById(task.id);
241879
+ const prdTask = yield* source.findById(projectId, task.id);
241884
241880
  if (prdTask) return {
241885
241881
  ...task,
241886
241882
  prd: prdTask
@@ -242092,7 +242088,7 @@ const run = fnUntraced(function* (options) {
242092
242088
  }
242093
242089
  const taskPreset = getOrElse$2(yield* source.issueCliAgentPreset(chosenTask.prd), () => preset);
242094
242090
  const catchStallInReview = (effect) => catchIf$2(effect, (u) => u instanceof RunnerStalled, fnUntraced(function* (e) {
242095
- if ((yield* prd.findById(taskId))?.state === "in-review") return;
242091
+ if ((yield* source.findById(projectId, taskId))?.state === "in-review") return;
242096
242092
  return yield* e;
242097
242093
  }));
242098
242094
  if (yield* gen(function* () {
@@ -242163,7 +242159,7 @@ const run = fnUntraced(function* (options) {
242163
242159
  targetBranch: getOrUndefined$2(options.targetBranch),
242164
242160
  issueId: taskId
242165
242161
  });
242166
- if ((yield* prd.findById(taskId))?.autoMerge) yield* gitFlow.autoMerge({
242162
+ if ((yield* source.findById(projectId, taskId))?.autoMerge) yield* gitFlow.autoMerge({
242167
242163
  targetBranch: getOrUndefined$2(options.targetBranch),
242168
242164
  issueId: taskId,
242169
242165
  worktree
@@ -242688,7 +242684,7 @@ const commandEdit = make$60("edit").pipe(withDescription("Open the selected proj
242688
242684
  const commandSource = make$60("source").pipe(withDescription("Select the issue source to use (e.g. GitHub Issues or Linear). This applies to all projects."), withHandler(() => selectIssueSource), provide(Settings.layer));
242689
242685
  //#endregion
242690
242686
  //#region package.json
242691
- var version = "0.3.108";
242687
+ var version = "0.3.109";
242692
242688
  //#endregion
242693
242689
  //#region src/Tracing.ts
242694
242690
  const TracingLayer = unwrap$3(gen(function* () {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.3.108",
4
+ "version": "0.3.109",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -9,7 +9,6 @@ import {
9
9
  Schema,
10
10
  } from "effect"
11
11
  import { PromptGen } from "../PromptGen.ts"
12
- import { Prd } from "../Prd.ts"
13
12
  import { ChildProcess } from "effect/unstable/process"
14
13
  import { Worktree } from "../Worktree.ts"
15
14
  import { RunnerStalled } from "../domain/Errors.ts"
@@ -18,16 +17,19 @@ import { GitFlow } from "../GitFlow.ts"
18
17
  import type { CliAgentPreset } from "../domain/CliAgentPreset.ts"
19
18
  import { runClanka } from "../Clanka.ts"
20
19
  import { ChosenTaskDeferred } from "../TaskTools.ts"
20
+ import { IssueSource } from "../IssueSource.ts"
21
+ import { CurrentProjectId } from "../Settings.ts"
21
22
 
22
23
  export const agentChooser = Effect.fnUntraced(function* (options: {
23
24
  readonly stallTimeout: Duration.Duration
24
25
  readonly preset: CliAgentPreset
25
26
  }) {
27
+ const projectId = yield* CurrentProjectId
26
28
  const fs = yield* FileSystem.FileSystem
27
29
  const pathService = yield* Path.Path
28
30
  const worktree = yield* Worktree
29
31
  const promptGen = yield* PromptGen
30
- const prd = yield* Prd
32
+ const source = yield* IssueSource
31
33
  const gitFlow = yield* GitFlow
32
34
  const waitForFile = yield* makeWaitForFile
33
35
 
@@ -45,7 +47,7 @@ export const agentChooser = Effect.fnUntraced(function* (options: {
45
47
  Effect.flatMap(() => Effect.fail(new ChosenTaskNotFound())),
46
48
  Effect.raceFirst(Deferred.await(deferred)),
47
49
  )
48
- const prdTask = yield* prd.findById(result.taskId)
50
+ const prdTask = yield* source.findById(projectId, result.taskId)
49
51
  if (!prdTask) return yield* new ChosenTaskNotFound()
50
52
  return {
51
53
  id: result.taskId,
@@ -85,7 +87,7 @@ export const agentChooser = Effect.fnUntraced(function* (options: {
85
87
  Effect.mapError((_) => new ChosenTaskNotFound()),
86
88
  Effect.flatMap(
87
89
  Effect.fnUntraced(function* (task) {
88
- const prdTask = yield* prd.findById(task.id)
90
+ const prdTask = yield* source.findById(projectId, task.id)
89
91
  if (prdTask) return { ...task, prd: prdTask }
90
92
  return yield* new ChosenTaskNotFound()
91
93
  }),
package/src/GitFlow.ts CHANGED
@@ -103,7 +103,7 @@ After making any changes, commit and push them to the same pull request.
103
103
  prState = yield* worktree.viewPrState(prState.value.number)
104
104
  yield* Effect.log("PR state after merge", prState)
105
105
  if (Option.isSome(prState) && prState.value.state === "MERGED") {
106
- const issue = yield* prd.findById(options.issueId)
106
+ const issue = yield* source.findById(projectId, options.issueId)
107
107
  if (issue && issue.state !== "done") {
108
108
  yield* source.updateIssue({
109
109
  projectId,
@@ -182,13 +182,12 @@ But you **do not** need to git push your changes or switch branches.
182
182
  }
183
183
  }),
184
184
  autoMerge: Effect.fnUntraced(function* (options) {
185
- const prd = yield* Prd
185
+ const source = yield* IssueSource
186
186
  const projectId = yield* CurrentProjectId
187
- const issue = yield* prd.findById(options.issueId)
187
+ const issue = yield* source.findById(projectId, options.issueId)
188
188
  if (!issue || issue.state !== "in-review") {
189
189
  return
190
190
  }
191
- const source = yield* IssueSource
192
191
  yield* source.updateIssue({
193
192
  projectId,
194
193
  issueId: options.issueId,
package/src/Prd.ts CHANGED
@@ -32,12 +32,6 @@ export class Prd extends ServiceMap.Service<
32
32
  readonly flagUnmergable: (options: {
33
33
  readonly issueId: string
34
34
  }) => Effect.Effect<void, IssueSourceError>
35
- readonly findById: (
36
- issueId: string,
37
- ) => Effect.Effect<
38
- PrdIssue | null,
39
- PlatformError.PlatformError | IssueSourceError
40
- >
41
35
  readonly setChosenIssueId: (issueId: string | null) => Effect.Effect<void>
42
36
  readonly setAutoMerge: (enabled: boolean) => Effect.Effect<void>
43
37
  }
@@ -68,8 +62,7 @@ export class Prd extends ServiceMap.Service<
68
62
  const maybeRevertIssue = Effect.fnUntraced(function* (options: {
69
63
  readonly issueId: string
70
64
  }) {
71
- const updated = yield* readPrd
72
- const issue = updated.find((i) => i.id === options.issueId)
65
+ const issue = yield* source.findById(projectId, options.issueId)
73
66
  if (!issue || issue.state === "in-review") return
74
67
  yield* source.updateIssue({
75
68
  projectId,
@@ -244,11 +237,6 @@ export class Prd extends ServiceMap.Service<
244
237
  Effect.forkScoped,
245
238
  )
246
239
 
247
- const findById = Effect.fnUntraced(function* (issueId: string) {
248
- const current = yield* getCurrentIssues
249
- return current.find((i) => i.id === issueId) ?? null
250
- })
251
-
252
240
  return {
253
241
  path: prdFile,
254
242
  maybeRevertIssue,
@@ -265,7 +253,6 @@ export class Prd extends ServiceMap.Service<
265
253
  }),
266
254
  ),
267
255
  flagUnmergable,
268
- findById,
269
256
  setChosenIssueId,
270
257
  setAutoMerge,
271
258
  }
@@ -287,7 +274,6 @@ export class Prd extends ServiceMap.Service<
287
274
  maybeRevertIssue: () => Effect.void,
288
275
  revertUpdatedIssues: Effect.void,
289
276
  flagUnmergable: () => Effect.void,
290
- findById: () => Effect.succeed(null),
291
277
  setChosenIssueId: () => Effect.void,
292
278
  setAutoMerge: () => Effect.void,
293
279
  })
@@ -200,7 +200,7 @@ const run = Effect.fnUntraced(
200
200
  effect,
201
201
  (u): u is RunnerStalled => u instanceof RunnerStalled,
202
202
  Effect.fnUntraced(function* (e) {
203
- const task = yield* prd.findById(taskId!)
203
+ const task = yield* source.findById(projectId, taskId!)
204
204
  const inReview = task?.state === "in-review"
205
205
  if (inReview) return
206
206
  return yield* e
@@ -315,7 +315,7 @@ const run = Effect.fnUntraced(
315
315
  issueId: taskId,
316
316
  })
317
317
 
318
- const task = yield* prd.findById(taskId)
318
+ const task = yield* source.findById(projectId, taskId)
319
319
  if (task?.autoMerge) {
320
320
  yield* gitFlow.autoMerge({
321
321
  targetBranch: Option.getOrUndefined(options.targetBranch),