lalph 0.1.44 → 0.1.45

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
@@ -133825,10 +133825,6 @@ const TokenResponse$1 = Struct({
133825
133825
 
133826
133826
  //#endregion
133827
133827
  //#region src/IssueSource.ts
133828
- /**
133829
- * Current unused, but eventually will represent a source of issues so we can
133830
- * support more than just Linear
133831
- */
133832
133828
  var IssueSource = class extends Service()("lalph/IssueSource") {};
133833
133829
  var IssueSourceError = class extends ErrorClass("lalph/IssueSourceError")({
133834
133830
  _tag: tag("IssueSourceError"),
@@ -140460,9 +140456,10 @@ The following instructions should be done without interaction or asking for perm
140460
140456
  ${prdNotes}`;
140461
140457
  const prompt = (options) => `The following instructions should be done without interaction or asking for permission.
140462
140458
 
140463
- 1. Your job is to complete the task with id \`${options.taskId}\` from the prd.yml file.
140459
+ 1. Study the ${options.specsDirectory}/README.md file (if available).
140460
+ Then your job is to complete the task with id \`${options.taskId}\` from the prd.yml file.
140464
140461
  Read the entire prd.yml file to understand the context of the task and any
140465
- key learnings from previous work. Study the .specs/README.md file.
140462
+ key learnings from previous work.
140466
140463
  2. Check if there is an existing Github PR for the task, otherwise create a new
140467
140464
  branch for the task.${options.targetBranch ? ` The target branch for the PR should be \`${options.targetBranch}\`. If the target branch does not exist, create it first.` : ""}
140468
140465
  - If there is an existing PR, checkout the branch for that PR.
@@ -140474,6 +140471,10 @@ ${prdNotes}`;
140474
140471
  - When checking for PR reviews, make sure to check the "reviews" field and read ALL unresolved comments.
140475
140472
  Also read the normal comments to see if there are any additional requests.
140476
140473
  3. Implement the task.
140474
+ - **If at any point** you discover something that needs fixing, or another task
140475
+ that needs doing, immediately add it to the prd.yml file as a new task.
140476
+ - Add important discoveries about the codebase, or challenges faced to the task's
140477
+ \`description\`. More details below.
140477
140478
  4. Run any checks / feedback loops, such as type checks, unit tests, or linting.
140478
140479
  5. Create or update the pull request with your progress.
140479
140480
  ${sourceMeta.githubPrInstructions}
@@ -140511,9 +140512,6 @@ If for any reason you get stuck on a task, mark the task back as "todo" by updat
140511
140512
  \`state\` and leaving some notes in the task's \`description\` field about the
140512
140513
  challenges faced.
140513
140514
 
140514
- If it feels like you are brute forcing your way through a task, STOP and move the
140515
- task back to "todo" state with notes on why in the description.
140516
-
140517
140515
  ${prdNotes}`;
140518
140516
  const promptTimeout = (options) => `Your earlier attempt to complete the task with id \`${options.taskId}\` took too
140519
140517
  long and has timed out. You can find the task details in the prd.yml file.
@@ -140522,19 +140520,20 @@ The following instructions should be done without interaction or asking for
140522
140520
  permission.
140523
140521
 
140524
140522
  1. Investigate why you think the task took too long. Research the codebase
140525
- further if needed.
140526
- 2. Break down the task into smaller tasks and add them to the prd.yml file.
140527
- 3. Mark the original task as "done" by updating its \`state\` in the prd.yml file.
140528
- 4. Each new task should have an id of \`null\`, a title, and a concise description that
140523
+ further to understand what is needed to complete the task.
140524
+ 2. Mark the original task as "done" by updating its \`state\` in the prd.yml file.
140525
+ 3. Break down the task into smaller tasks and add them to the prd.yml file.
140526
+ Each new task should have an id of \`null\`, a title, and a concise description that
140529
140527
  includes a short summary of the task and a brief list of steps to complete it.
140530
140528
  - Include where to find the plan specification in the description (if applicable).
140531
140529
  - The tasks should start in the "todo" state.
140532
140530
  - Each task should be an atomic, committable piece of work.
140533
140531
  Instead of creating tasks like "Refactor the authentication system", create
140534
140532
  smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
140535
- 5. Setup task dependencies using the \`blockedBy\` field as needed. You will need
140533
+ 4. Setup task dependencies using the \`blockedBy\` field as needed. You will need
140536
140534
  to wait 5 seconds after adding tasks to the prd.yml file to allow the system
140537
140535
  to assign ids to the new tasks before you can setup dependencies.
140536
+ 5. If any specifications need updating based on your new understanding, update them.
140538
140537
 
140539
140538
  ${prdNotes}`;
140540
140539
  const planPrompt = (options) => `1. Ask the user for the idea / request, then your job is to create a detailed
@@ -140792,7 +140791,8 @@ const run = fnUntraced(function* (options) {
140792
140791
  const exitCode$1 = yield* execWithStallTimeout(cliAgent.command({
140793
140792
  prompt: promptGen.prompt({
140794
140793
  taskId: task.id,
140795
- targetBranch: getOrUndefined(options.targetBranch)
140794
+ targetBranch: getOrUndefined(options.targetBranch),
140795
+ specsDirectory: options.specsDirectory
140796
140796
  }),
140797
140797
  prdFilePath: pathService.join(".lalph", "prd.yml")
140798
140798
  })).pipe(timeout(options.runTimeout), catchTag("TimeoutError", fnUntraced(function* (error$1) {
@@ -140945,8 +140945,9 @@ const root = make$25("lalph", {
140945
140945
  targetBranch,
140946
140946
  maxIterationMinutes,
140947
140947
  stallMinutes,
140948
- reset
140949
- }).pipe(withHandler(fnUntraced(function* ({ iterations: iterations$1, concurrency: concurrency$1, autoMerge: autoMerge$1, targetBranch: targetBranch$1, maxIterationMinutes: maxIterationMinutes$1, stallMinutes: stallMinutes$1, reset: reset$2 }) {
140948
+ reset,
140949
+ specsDirectory
140950
+ }).pipe(withHandler(fnUntraced(function* ({ iterations: iterations$1, concurrency: concurrency$1, autoMerge: autoMerge$1, targetBranch: targetBranch$1, maxIterationMinutes: maxIterationMinutes$1, stallMinutes: stallMinutes$1, reset: reset$2, specsDirectory: specsDirectory$1 }) {
140950
140951
  if (reset$2) yield* resetCurrentIssueSource;
140951
140952
  const source = yield* build(CurrentIssueSource.layer);
140952
140953
  yield* getOrSelectCliAgent;
@@ -140967,6 +140968,7 @@ const root = make$25("lalph", {
140967
140968
  startedDeferred,
140968
140969
  autoMerge: autoMerge$1,
140969
140970
  targetBranch: targetBranch$1,
140971
+ specsDirectory: specsDirectory$1,
140970
140972
  stallTimeout: minutes(stallMinutes$1),
140971
140973
  runTimeout: minutes(maxIterationMinutes$1)
140972
140974
  })), catchFilter((e) => e._tag === "NoMoreWork" || e._tag === "QuitError" ? fail$8(e) : e, (e) => logWarning(fail$5(e))), catchTags({
@@ -140989,10 +140991,10 @@ const root = make$25("lalph", {
140989
140991
  }, scoped$1)));
140990
140992
  const selectAgent = make$25("agent").pipe(withDescription("Select the CLI agent to use"), withHandler(() => selectCliAgent));
140991
140993
  const selectSource = make$25("source").pipe(withDescription("Select the issue source to use"), withHandler(() => selectIssueSource));
140992
- const planMode = make$25("plan", { specsDirectory }).pipe(withDescription("Iterate on an issue plan and create PRD tasks"), withHandler(fnUntraced(function* (options) {
140993
- const { reset: reset$2 } = yield* root;
140994
+ const planMode = make$25("plan").pipe(withDescription("Iterate on an issue plan and create PRD tasks"), withHandler(fnUntraced(function* () {
140995
+ const { reset: reset$2, specsDirectory: specsDirectory$1 } = yield* root;
140994
140996
  if (reset$2) yield* resetCurrentIssueSource;
140995
- yield* plan(options).pipe(provide$1(CurrentIssueSource.layer));
140997
+ yield* plan({ specsDirectory: specsDirectory$1 }).pipe(provide$1(CurrentIssueSource.layer));
140996
140998
  })));
140997
140999
  root.pipe(withSubcommands([
140998
141000
  planMode,
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.1.44",
4
+ "version": "0.1.45",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -1,10 +1,6 @@
1
1
  import { Effect, Schema, ServiceMap } from "effect"
2
2
  import type { PrdIssue } from "./domain/PrdIssue.ts"
3
3
 
4
- /**
5
- * Current unused, but eventually will represent a source of issues so we can
6
- * support more than just Linear
7
- */
8
4
  export class IssueSource extends ServiceMap.Service<
9
5
  IssueSource,
10
6
  {
package/src/PromptGen.ts CHANGED
@@ -73,11 +73,13 @@ ${prdNotes}`
73
73
  const prompt = (options: {
74
74
  readonly taskId: string
75
75
  readonly targetBranch: string | undefined
76
+ readonly specsDirectory: string
76
77
  }) => `The following instructions should be done without interaction or asking for permission.
77
78
 
78
- 1. Your job is to complete the task with id \`${options.taskId}\` from the prd.yml file.
79
+ 1. Study the ${options.specsDirectory}/README.md file (if available).
80
+ Then your job is to complete the task with id \`${options.taskId}\` from the prd.yml file.
79
81
  Read the entire prd.yml file to understand the context of the task and any
80
- key learnings from previous work. Study the .specs/README.md file.
82
+ key learnings from previous work.
81
83
  2. Check if there is an existing Github PR for the task, otherwise create a new
82
84
  branch for the task.${options.targetBranch ? ` The target branch for the PR should be \`${options.targetBranch}\`. If the target branch does not exist, create it first.` : ""}
83
85
  - If there is an existing PR, checkout the branch for that PR.
@@ -89,6 +91,10 @@ ${prdNotes}`
89
91
  - When checking for PR reviews, make sure to check the "reviews" field and read ALL unresolved comments.
90
92
  Also read the normal comments to see if there are any additional requests.
91
93
  3. Implement the task.
94
+ - **If at any point** you discover something that needs fixing, or another task
95
+ that needs doing, immediately add it to the prd.yml file as a new task.
96
+ - Add important discoveries about the codebase, or challenges faced to the task's
97
+ \`description\`. More details below.
92
98
  4. Run any checks / feedback loops, such as type checks, unit tests, or linting.
93
99
  5. Create or update the pull request with your progress.
94
100
  ${sourceMeta.githubPrInstructions}
@@ -126,9 +132,6 @@ If for any reason you get stuck on a task, mark the task back as "todo" by updat
126
132
  \`state\` and leaving some notes in the task's \`description\` field about the
127
133
  challenges faced.
128
134
 
129
- If it feels like you are brute forcing your way through a task, STOP and move the
130
- task back to "todo" state with notes on why in the description.
131
-
132
135
  ${prdNotes}`
133
136
 
134
137
  const promptTimeout = (options: {
@@ -140,19 +143,20 @@ The following instructions should be done without interaction or asking for
140
143
  permission.
141
144
 
142
145
  1. Investigate why you think the task took too long. Research the codebase
143
- further if needed.
144
- 2. Break down the task into smaller tasks and add them to the prd.yml file.
145
- 3. Mark the original task as "done" by updating its \`state\` in the prd.yml file.
146
- 4. Each new task should have an id of \`null\`, a title, and a concise description that
146
+ further to understand what is needed to complete the task.
147
+ 2. Mark the original task as "done" by updating its \`state\` in the prd.yml file.
148
+ 3. Break down the task into smaller tasks and add them to the prd.yml file.
149
+ Each new task should have an id of \`null\`, a title, and a concise description that
147
150
  includes a short summary of the task and a brief list of steps to complete it.
148
151
  - Include where to find the plan specification in the description (if applicable).
149
152
  - The tasks should start in the "todo" state.
150
153
  - Each task should be an atomic, committable piece of work.
151
154
  Instead of creating tasks like "Refactor the authentication system", create
152
155
  smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
153
- 5. Setup task dependencies using the \`blockedBy\` field as needed. You will need
156
+ 4. Setup task dependencies using the \`blockedBy\` field as needed. You will need
154
157
  to wait 5 seconds after adding tasks to the prd.yml file to allow the system
155
158
  to assign ids to the new tasks before you can setup dependencies.
159
+ 5. If any specifications need updating based on your new understanding, update them.
156
160
 
157
161
  ${prdNotes}`
158
162
 
package/src/Runner.ts CHANGED
@@ -21,6 +21,7 @@ export const run = Effect.fnUntraced(
21
21
  readonly startedDeferred: Deferred.Deferred<void>
22
22
  readonly autoMerge: boolean
23
23
  readonly targetBranch: Option.Option<string>
24
+ readonly specsDirectory: string
24
25
  readonly stallTimeout: Duration.Duration
25
26
  readonly runTimeout: Duration.Duration
26
27
  }) {
@@ -140,6 +141,7 @@ export const run = Effect.fnUntraced(
140
141
  prompt: promptGen.prompt({
141
142
  taskId: task.id,
142
143
  targetBranch: Option.getOrUndefined(options.targetBranch),
144
+ specsDirectory: options.specsDirectory,
143
145
  }),
144
146
  prdFilePath: pathService.join(".lalph", "prd.yml"),
145
147
  })
package/src/cli.ts CHANGED
@@ -80,6 +80,7 @@ const root = Command.make("lalph", {
80
80
  maxIterationMinutes,
81
81
  stallMinutes,
82
82
  reset,
83
+ specsDirectory,
83
84
  }).pipe(
84
85
  Command.withHandler(
85
86
  Effect.fnUntraced(function* ({
@@ -90,6 +91,7 @@ const root = Command.make("lalph", {
90
91
  maxIterationMinutes,
91
92
  stallMinutes,
92
93
  reset,
94
+ specsDirectory,
93
95
  }) {
94
96
  if (reset) {
95
97
  yield* resetCurrentIssueSource
@@ -126,6 +128,7 @@ const root = Command.make("lalph", {
126
128
  startedDeferred,
127
129
  autoMerge,
128
130
  targetBranch,
131
+ specsDirectory,
129
132
  stallTimeout: Duration.minutes(stallMinutes),
130
133
  runTimeout: Duration.minutes(maxIterationMinutes),
131
134
  }),
@@ -185,15 +188,17 @@ const selectSource = Command.make("source").pipe(
185
188
  Command.withHandler(() => selectIssueSource),
186
189
  )
187
190
 
188
- const planMode = Command.make("plan", { specsDirectory }).pipe(
191
+ const planMode = Command.make("plan").pipe(
189
192
  Command.withDescription("Iterate on an issue plan and create PRD tasks"),
190
193
  Command.withHandler(
191
- Effect.fnUntraced(function* (options) {
192
- const { reset } = yield* root
194
+ Effect.fnUntraced(function* () {
195
+ const { reset, specsDirectory } = yield* root
193
196
  if (reset) {
194
197
  yield* resetCurrentIssueSource
195
198
  }
196
- yield* plan(options).pipe(Effect.provide(CurrentIssueSource.layer))
199
+ yield* plan({ specsDirectory }).pipe(
200
+ Effect.provide(CurrentIssueSource.layer),
201
+ )
197
202
  }),
198
203
  ),
199
204
  )