lalph 0.1.38 → 0.1.40

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
@@ -44313,18 +44313,18 @@ const defaultFormatter = (options) => {
44313
44313
  yellow: (text$3) => text$3,
44314
44314
  magenta: (text$3) => text$3
44315
44315
  };
44316
- const reset$1 = useColor ? "\x1B[0m" : "";
44316
+ const reset$2 = useColor ? "\x1B[0m" : "";
44317
44317
  const red$1 = useColor ? "\x1B[31m" : "";
44318
44318
  const bold$1 = useColor ? "\x1B[1m" : "";
44319
44319
  return {
44320
44320
  formatHelpDoc: (doc) => formatHelpDocImpl(doc, colors$1),
44321
44321
  formatCliError: (error$1) => error$1.message,
44322
44322
  formatError: (error$1) => {
44323
- return `\n${bold$1}${red$1}ERROR${reset$1}\n ${error$1.message}${reset$1}`;
44323
+ return `\n${bold$1}${red$1}ERROR${reset$2}\n ${error$1.message}${reset$2}`;
44324
44324
  },
44325
44325
  formatErrors: (errors) => {
44326
44326
  if (errors.length === 0) return "";
44327
- if (errors.length === 1) return `\n${bold$1}${red$1}ERROR${reset$1}\n ${errors[0].message}${reset$1}`;
44327
+ if (errors.length === 1) return `\n${bold$1}${red$1}ERROR${reset$2}\n ${errors[0].message}${reset$2}`;
44328
44328
  const grouped = /* @__PURE__ */ new Map();
44329
44329
  for (const error$1 of errors) {
44330
44330
  const tag$1 = error$1._tag ?? "Error";
@@ -44333,8 +44333,8 @@ const defaultFormatter = (options) => {
44333
44333
  grouped.set(tag$1, group);
44334
44334
  }
44335
44335
  const sections = [];
44336
- sections.push(`\n${bold$1}${red$1}ERRORS${reset$1}`);
44337
- for (const [, group] of grouped) for (const error$1 of group) sections.push(` ${error$1.message}${reset$1}`);
44336
+ sections.push(`\n${bold$1}${red$1}ERRORS${reset$2}`);
44337
+ for (const [, group] of grouped) for (const error$1 of group) sections.push(` ${error$1.message}${reset$2}`);
44338
44338
  return sections.join("\n");
44339
44339
  },
44340
44340
  formatVersion: (name, version$1) => `${colors$1.bold(name)} ${colors$1.dim("v")}${colors$1.bold(version$1)}`
@@ -45917,7 +45917,7 @@ const ESC = "\x1B[";
45917
45917
  const BEL = "\x07";
45918
45918
  const SEP = ";";
45919
45919
  /** @internal */
45920
- const reset = `${ESC}0m`;
45920
+ const reset$1 = `${ESC}0m`;
45921
45921
  /** @internal */
45922
45922
  const bold = `${ESC}1m`;
45923
45923
  /** @internal */
@@ -45973,7 +45973,7 @@ const cyanBright = `${ESC}96m`;
45973
45973
  /** @internal */
45974
45974
  const whiteBright = `${ESC}97m`;
45975
45975
  const annotate = (text$3, ...styles) => {
45976
- return `${styles.flat().join("")}${text$3}${reset}`;
45976
+ return `${styles.flat().join("")}${text$3}${reset$1}`;
45977
45977
  };
45978
45978
  const combine = (...styles) => styles;
45979
45979
  /** @internal */
@@ -53173,7 +53173,7 @@ function make$12() {
53173
53173
  pairs: 0,
53174
53174
  size: 0
53175
53175
  };
53176
- function reset$1(value) {
53176
+ function reset$2(value) {
53177
53177
  state.state = State$1.key;
53178
53178
  state.headers = Object.create(null);
53179
53179
  state.key = "";
@@ -53191,7 +53191,7 @@ function make$12() {
53191
53191
  return newUint8Array;
53192
53192
  }
53193
53193
  function error$1(reason) {
53194
- return reset$1({
53194
+ return reset$2({
53195
53195
  _tag: "Failure",
53196
53196
  reason,
53197
53197
  headers: state.headers
@@ -53293,7 +53293,7 @@ function make$12() {
53293
53293
  state.size--;
53294
53294
  if (state.crlf !== 4 && state.pairs === constMaxPairs) return error$1("TooManyHeaders");
53295
53295
  else if (state.crlf === 3) return error$1("InvalidHeaderValue");
53296
- else if (state.crlf === 4) return reset$1({
53296
+ else if (state.crlf === 4) return reset$2({
53297
53297
  _tag: "Headers",
53298
53298
  headers: state.headers,
53299
53299
  endPosition: start - endOffset
@@ -140379,6 +140379,9 @@ const getOrSelectIssueSource = gen(function* () {
140379
140379
  if (isSome(issueSource)) return issueSources.find((s) => s.id === issueSource.value);
140380
140380
  return yield* selectIssueSource;
140381
140381
  });
140382
+ const resetCurrentIssueSource = gen(function* () {
140383
+ yield* (yield* getOrSelectIssueSource).reset;
140384
+ });
140382
140385
  var CurrentIssueSource = class CurrentIssueSource extends Service()("lalph/CurrentIssueSource") {
140383
140386
  static layer = effectServices(gen(function* () {
140384
140387
  const source = yield* getOrSelectIssueSource;
@@ -140414,6 +140417,8 @@ To add a new task, append a new item to the prd.yml file with the id set to
140414
140417
  When adding a new task, it will take about 5 seconds for the system to update the
140415
140418
  prd.yml file with a new id for the task.
140416
140419
 
140420
+ After adding a new task, you can setup dependencies using the \`blockedBy\` field
140421
+
140417
140422
  ### Removing tasks
140418
140423
 
140419
140424
  To remove a task, simply delete the item from the prd.yml file.
@@ -140449,16 +140454,6 @@ The following instructions should be done without interaction or asking for perm
140449
140454
  }
140450
140455
  \`\`\`
140451
140456
 
140452
- ## Important: Task sizing
140453
-
140454
- If at any point you decide that a task is too large or complex to complete in a
140455
- single iteration, break it down into smaller tasks and add them to the prd.yml
140456
- file. Then, mark the original task as "done" by updating its \`state\`.
140457
-
140458
- Each task should be an atomic, committable piece of work.
140459
- Instead of creating tasks like "Refactor the authentication system", create
140460
- smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
140461
-
140462
140457
  ${prdNotes}`;
140463
140458
  const prompt = (options) => `# Instructions
140464
140459
 
@@ -140466,6 +140461,8 @@ The following instructions should be done without interaction or asking for
140466
140461
  permission.
140467
140462
 
140468
140463
  1. Your job is to complete the task with id \`${options.taskId}\` from the prd.yml file.
140464
+ Read the entire prd.yml file to understand the context of the task and any
140465
+ key learnings from previous work.
140469
140466
  2. Check if there is an existing Github PR for the task, otherwise create a new
140470
140467
  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.` : ""}
140471
140468
  - If there is an existing PR, checkout the branch for that PR.
@@ -140477,15 +140474,6 @@ permission.
140477
140474
  - When checking for PR reviews, make sure to check the "reviews" field and read ALL unresolved comments.
140478
140475
  Also read the normal comments to see if there are any additional requests.
140479
140476
  4. Implement the task.
140480
- - This session will time out after a certain period, so make sure to record
140481
- key information that could speed up future work on the task in the task
140482
- description. Record the information **in the moment** as you discover it,
140483
- do not wait until the end of the task. Things to record include:
140484
- - Important discoveries about the codebase.
140485
- - Any challenges faced and how you overcame them.
140486
- - APIs / libraries discovered that were useful.
140487
- - Links to relevant documentation.
140488
- - Any other information that could help future work on the task.
140489
140477
  5. Run any checks / feedback loops, such as type checks, unit tests, or linting.
140490
140478
  6. Create or update the pull request with your progress.
140491
140479
  ${sourceMeta.githubPrInstructions}
@@ -140495,13 +140483,27 @@ permission.
140495
140483
  permission to push branches, create PRs or create git commits.
140496
140484
  7. Update the prd.yml file to reflect any changes in task states.
140497
140485
  - Update the prd.yml file after the GitHub PR has been created or updated.
140498
- - Add follow up tasks only if needed.
140499
- - Append to the \`description\` field with any notes or important discoveries.
140486
+ - Rewrite the notes in the description to include only the key discoveries
140487
+ and information that could speed up future work on other tasks.
140500
140488
  - If you believe the task is complete, update the \`state\` to "in-review".
140501
140489
 
140502
- **Remember:** record key information that could speed up future work on the task in
140503
- the task description **in the moment** as you discover it, do not wait until
140504
- the end of the task.
140490
+ ## Important: Adding new tasks
140491
+
140492
+ **If at any point** you discover something that needs fixing, or another task
140493
+ that needs doing, immediately add it to the prd.yml file as a new task.
140494
+
140495
+ ## Important: Recording key information
140496
+
140497
+ This session will time out after a certain period, so make sure to record
140498
+ key information that could speed up future work on the task in the description.
140499
+ Record the information **in the moment** as you discover it,
140500
+ do not wait until the end of the task. Things to record include:
140501
+
140502
+ - Important discoveries about the codebase.
140503
+ - Any challenges faced and how you overcame them.
140504
+ - If it took multiple attempts to get something working, record what worked.
140505
+ - If you found a library api was renamed or moved, record the new name.
140506
+ - Any other information that could help future work on similar tasks.
140505
140507
 
140506
140508
  ## Handling blockers
140507
140509
 
@@ -140546,7 +140548,7 @@ ${prdNotes}`;
140546
140548
  - Make sure to research the codebase before creating the specification, to
140547
140549
  ensure it is relevant and feasible.
140548
140550
  2. Once you have saved the specification, your next job is to break down the
140549
- specification into smaller, manageable tasks.
140551
+ specification into smaller, manageable tasks and add them to the prd.yml file.
140550
140552
  Each task should have a id of \`null\`, a title, and a concise description that
140551
140553
  includes a where to find the plan specification, a short summary of the task and a
140552
140554
  brief list of steps to complete it.
@@ -140554,13 +140556,12 @@ ${prdNotes}`;
140554
140556
  - Each task should be an atomic, committable piece of work.
140555
140557
  Instead of creating tasks like "Refactor the authentication system", create
140556
140558
  smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
140557
- - **Never** create a research task. You should do all the necessary research
140558
- before creating the specification and tasks. Instead of creating a task like
140559
- "Research endpoints to refactor", investigate then endpoints first then create
140560
- tasks like "Implement user profile endpoint", "Refactor authentication endpoint", etc.
140561
- 3. Add the new or updated tasks to the prd.yml file.
140562
- 4. Wait until the tasks are saved, then setup task dependencies using the \`blockedBy\` field.
140563
- 5. Start a subagent with a copy of this prompt, to review the plan and provide feedback or improvements.
140559
+ - If you need to add a research task, mention in the description that it needs to:
140560
+ - add a specification file in the \`${options.specsDirectory}\` directory.
140561
+ - add follow up tasks in the prd.yml file based on the new specification. The tasks
140562
+ should reference the specification file in their description.
140563
+ 3. Wait until the tasks are saved, then setup task dependencies using the \`blockedBy\` field.
140564
+ 4. Start a subagent with a copy of this prompt, to review the plan and provide feedback or improvements.
140564
140565
 
140565
140566
  **Important:** You are only creating or updating a plan, not implementing any tasks yet.
140566
140567
 
@@ -140943,7 +140944,14 @@ const createIssue = make$25("issue").pipe(withDescription("Create a new issue in
140943
140944
  const selectAgent = make$25("agent").pipe(withDescription("Select the CLI agent to use"), withHandler(() => selectCliAgent));
140944
140945
  const selectSource = make$25("source").pipe(withDescription("Select the issue source to use"), withHandler(() => selectIssueSource));
140945
140946
  const specsDirectory = directory("specs").pipe(withDescription$1("Directory to store plan specifications"), withAlias("s"), withDefault(".specs"));
140946
- const planMode = make$25("plan", { specsDirectory }).pipe(withDescription("Iterate on an issue plan and create PRD tasks"), withHandler(plan), provide(CurrentIssueSource.layer));
140947
+ const reset = boolean("reset").pipe(withDescription$1("Reset the current issue source before planning"), withAlias("r"));
140948
+ const planMode = make$25("plan", {
140949
+ specsDirectory,
140950
+ reset
140951
+ }).pipe(withDescription("Iterate on an issue plan and create PRD tasks"), withHandler(fnUntraced(function* (options) {
140952
+ if (options.reset) yield* resetCurrentIssueSource;
140953
+ yield* plan(options).pipe(provide$1(CurrentIssueSource.layer));
140954
+ })));
140947
140955
  const iterations = integer("iterations").pipe(withDescription$1("Number of iterations to run, defaults to unlimited"), withAlias("i"), withDefault(Number.POSITIVE_INFINITY));
140948
140956
  const concurrency = integer("concurrency").pipe(withDescription$1("Number of concurrent agents, defaults to 1"), withAlias("c"), withDefault(1));
140949
140957
  const autoMerge = boolean("auto-merge").pipe(withAlias("a"), withDescription$1("Automatically merge eligible PRs"));
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.1.38",
4
+ "version": "0.1.40",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -48,6 +48,11 @@ const getOrSelectIssueSource = Effect.gen(function* () {
48
48
  return yield* selectIssueSource
49
49
  })
50
50
 
51
+ export const resetCurrentIssueSource = Effect.gen(function* () {
52
+ const source = yield* getOrSelectIssueSource
53
+ yield* source.reset
54
+ })
55
+
51
56
  export class CurrentIssueSource extends ServiceMap.Service<
52
57
  CurrentIssueSource,
53
58
  {
package/src/PromptGen.ts CHANGED
@@ -31,6 +31,8 @@ To add a new task, append a new item to the prd.yml file with the id set to
31
31
  When adding a new task, it will take about 5 seconds for the system to update the
32
32
  prd.yml file with a new id for the task.
33
33
 
34
+ After adding a new task, you can setup dependencies using the \`blockedBy\` field
35
+
34
36
  ### Removing tasks
35
37
 
36
38
  To remove a task, simply delete the item from the prd.yml file.
@@ -67,16 +69,6 @@ The following instructions should be done without interaction or asking for perm
67
69
  }
68
70
  \`\`\`
69
71
 
70
- ## Important: Task sizing
71
-
72
- If at any point you decide that a task is too large or complex to complete in a
73
- single iteration, break it down into smaller tasks and add them to the prd.yml
74
- file. Then, mark the original task as "done" by updating its \`state\`.
75
-
76
- Each task should be an atomic, committable piece of work.
77
- Instead of creating tasks like "Refactor the authentication system", create
78
- smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
79
-
80
72
  ${prdNotes}`
81
73
 
82
74
  const prompt = (options: {
@@ -88,6 +80,8 @@ The following instructions should be done without interaction or asking for
88
80
  permission.
89
81
 
90
82
  1. Your job is to complete the task with id \`${options.taskId}\` from the prd.yml file.
83
+ Read the entire prd.yml file to understand the context of the task and any
84
+ key learnings from previous work.
91
85
  2. Check if there is an existing Github PR for the task, otherwise create a new
92
86
  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.` : ""}
93
87
  - If there is an existing PR, checkout the branch for that PR.
@@ -99,15 +93,6 @@ permission.
99
93
  - When checking for PR reviews, make sure to check the "reviews" field and read ALL unresolved comments.
100
94
  Also read the normal comments to see if there are any additional requests.
101
95
  4. Implement the task.
102
- - This session will time out after a certain period, so make sure to record
103
- key information that could speed up future work on the task in the task
104
- description. Record the information **in the moment** as you discover it,
105
- do not wait until the end of the task. Things to record include:
106
- - Important discoveries about the codebase.
107
- - Any challenges faced and how you overcame them.
108
- - APIs / libraries discovered that were useful.
109
- - Links to relevant documentation.
110
- - Any other information that could help future work on the task.
111
96
  5. Run any checks / feedback loops, such as type checks, unit tests, or linting.
112
97
  6. Create or update the pull request with your progress.
113
98
  ${sourceMeta.githubPrInstructions}
@@ -117,13 +102,27 @@ permission.
117
102
  permission to push branches, create PRs or create git commits.
118
103
  7. Update the prd.yml file to reflect any changes in task states.
119
104
  - Update the prd.yml file after the GitHub PR has been created or updated.
120
- - Add follow up tasks only if needed.
121
- - Append to the \`description\` field with any notes or important discoveries.
105
+ - Rewrite the notes in the description to include only the key discoveries
106
+ and information that could speed up future work on other tasks.
122
107
  - If you believe the task is complete, update the \`state\` to "in-review".
123
108
 
124
- **Remember:** record key information that could speed up future work on the task in
125
- the task description **in the moment** as you discover it, do not wait until
126
- the end of the task.
109
+ ## Important: Adding new tasks
110
+
111
+ **If at any point** you discover something that needs fixing, or another task
112
+ that needs doing, immediately add it to the prd.yml file as a new task.
113
+
114
+ ## Important: Recording key information
115
+
116
+ This session will time out after a certain period, so make sure to record
117
+ key information that could speed up future work on the task in the description.
118
+ Record the information **in the moment** as you discover it,
119
+ do not wait until the end of the task. Things to record include:
120
+
121
+ - Important discoveries about the codebase.
122
+ - Any challenges faced and how you overcame them.
123
+ - If it took multiple attempts to get something working, record what worked.
124
+ - If you found a library api was renamed or moved, record the new name.
125
+ - Any other information that could help future work on similar tasks.
127
126
 
128
127
  ## Handling blockers
129
128
 
@@ -174,7 +173,7 @@ ${prdNotes}`
174
173
  - Make sure to research the codebase before creating the specification, to
175
174
  ensure it is relevant and feasible.
176
175
  2. Once you have saved the specification, your next job is to break down the
177
- specification into smaller, manageable tasks.
176
+ specification into smaller, manageable tasks and add them to the prd.yml file.
178
177
  Each task should have a id of \`null\`, a title, and a concise description that
179
178
  includes a where to find the plan specification, a short summary of the task and a
180
179
  brief list of steps to complete it.
@@ -182,13 +181,12 @@ ${prdNotes}`
182
181
  - Each task should be an atomic, committable piece of work.
183
182
  Instead of creating tasks like "Refactor the authentication system", create
184
183
  smaller tasks like "Implement OAuth2 login endpoint", "Add JWT token refresh mechanism", etc.
185
- - **Never** create a research task. You should do all the necessary research
186
- before creating the specification and tasks. Instead of creating a task like
187
- "Research endpoints to refactor", investigate then endpoints first then create
188
- tasks like "Implement user profile endpoint", "Refactor authentication endpoint", etc.
189
- 3. Add the new or updated tasks to the prd.yml file.
190
- 4. Wait until the tasks are saved, then setup task dependencies using the \`blockedBy\` field.
191
- 5. Start a subagent with a copy of this prompt, to review the plan and provide feedback or improvements.
184
+ - If you need to add a research task, mention in the description that it needs to:
185
+ - add a specification file in the \`${options.specsDirectory}\` directory.
186
+ - add follow up tasks in the prd.yml file based on the new specification. The tasks
187
+ should reference the specification file in their description.
188
+ 3. Wait until the tasks are saved, then setup task dependencies using the \`blockedBy\` field.
189
+ 4. Start a subagent with a copy of this prompt, to review the plan and provide feedback or improvements.
192
190
 
193
191
  **Important:** You are only creating or updating a plan, not implementing any tasks yet.
194
192
 
package/src/cli.ts CHANGED
@@ -15,7 +15,11 @@ import { Settings } from "./Settings.ts"
15
15
  import { run } from "./Runner.ts"
16
16
  import { plan } from "./Planner.ts"
17
17
  import { getOrSelectCliAgent, selectCliAgent } from "./CliAgent.ts"
18
- import { CurrentIssueSource, selectIssueSource } from "./IssueSources.ts"
18
+ import {
19
+ CurrentIssueSource,
20
+ resetCurrentIssueSource,
21
+ selectIssueSource,
22
+ } from "./IssueSources.ts"
19
23
  import { checkForWork } from "./IssueSource.ts"
20
24
  import { editPrd } from "./Edit.ts"
21
25
  import { createIssue } from "./CreateIssue.ts"
@@ -36,10 +40,21 @@ const specsDirectory = Flag.directory("specs").pipe(
36
40
  Flag.withDefault(".specs"),
37
41
  )
38
42
 
39
- const planMode = Command.make("plan", { specsDirectory }).pipe(
43
+ const reset = Flag.boolean("reset").pipe(
44
+ Flag.withDescription("Reset the current issue source before planning"),
45
+ Flag.withAlias("r"),
46
+ )
47
+
48
+ const planMode = Command.make("plan", { specsDirectory, reset }).pipe(
40
49
  Command.withDescription("Iterate on an issue plan and create PRD tasks"),
41
- Command.withHandler(plan),
42
- Command.provide(CurrentIssueSource.layer),
50
+ Command.withHandler(
51
+ Effect.fnUntraced(function* (options) {
52
+ if (options.reset) {
53
+ yield* resetCurrentIssueSource
54
+ }
55
+ yield* plan(options).pipe(Effect.provide(CurrentIssueSource.layer))
56
+ }),
57
+ ),
43
58
  )
44
59
 
45
60
  const iterations = Flag.integer("iterations").pipe(