lalph 0.3.23 → 0.3.25

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/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lalph",
3
3
  "type": "module",
4
- "version": "0.3.23",
4
+ "version": "0.3.25",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -22,19 +22,19 @@
22
22
  "devDependencies": {
23
23
  "@changesets/changelog-github": "^0.5.2",
24
24
  "@changesets/cli": "^2.29.8",
25
- "@effect/language-service": "^0.72.0",
26
- "@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@33f368f",
27
- "@linear/sdk": "^72.0.0",
25
+ "@effect/language-service": "^0.73.1",
26
+ "@effect/platform-node": "https://pkg.pr.new/Effect-TS/effect-smol/@effect/platform-node@0a6d33c",
27
+ "@linear/sdk": "^75.0.0",
28
28
  "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
29
29
  "@octokit/types": "^16.0.0",
30
30
  "concurrently": "^9.2.1",
31
- "effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@33f368f",
31
+ "effect": "https://pkg.pr.new/Effect-TS/effect-smol/effect@0a6d33c",
32
32
  "husky": "^9.1.7",
33
33
  "lint-staged": "^16.2.7",
34
34
  "octokit": "^5.0.5",
35
- "oxlint": "^1.42.0",
35
+ "oxlint": "^1.47.0",
36
36
  "prettier": "^3.8.1",
37
- "tsdown": "^0.20.1",
37
+ "tsdown": "^0.20.3",
38
38
  "typescript": "^5.9.3",
39
39
  "yaml": "^2.8.2"
40
40
  },
@@ -164,21 +164,12 @@ export const issueSourceRuntime = atomRuntime(
164
164
  export const currentIssuesAtom = Atom.family((projectId: ProjectId) =>
165
165
  pipe(
166
166
  issueSourceRuntime.atom(
167
- Effect.fnUntraced(function* (get) {
168
- const source = yield* IssueSource
169
- const issues = yield* pipe(
170
- source.issues(projectId),
171
- Effect.withSpan("currentIssuesAtom.refresh"),
172
- )
173
- const handle = setTimeout(() => {
174
- get.refreshSelf()
175
- }, 30_000)
176
- get.addFinalizer(() => clearTimeout(handle))
177
- return issues
178
- }),
179
- { uninterruptible: true },
167
+ IssueSource.use((s) => s.issues(projectId)).pipe(
168
+ Effect.withSpan("currentIssuesAtom"),
169
+ ),
180
170
  ),
181
171
  atomRuntime.withReactivity([`issues:${projectId}`]),
172
+ Atom.withRefresh("30 seconds"),
182
173
  Atom.keepAlive,
183
174
  ),
184
175
  )
package/src/Kvs.ts CHANGED
@@ -7,7 +7,7 @@ import { resolveLalphDirectory } from "./shared/lalphDirectory.ts"
7
7
  export const layerKvs = Layer.unwrap(
8
8
  Effect.gen(function* () {
9
9
  const pathService = yield* Path.Path
10
- const directory = yield* resolveLalphDirectory()
10
+ const directory = yield* resolveLalphDirectory
11
11
  return KeyValueStore.layerFileSystem(
12
12
  pathService.join(directory, ".lalph", "config"),
13
13
  )
@@ -21,7 +21,7 @@ export class ProjectsKvs extends LayerMap.Service<ProjectsKvs>()(
21
21
  Layer.unwrap(
22
22
  Effect.gen(function* () {
23
23
  const pathService = yield* Path.Path
24
- const directory = yield* resolveLalphDirectory()
24
+ const directory = yield* resolveLalphDirectory
25
25
  return KeyValueStore.layerFileSystem(
26
26
  pathService.join(
27
27
  directory,
@@ -6,7 +6,7 @@ import { resolveLalphDirectory } from "./shared/lalphDirectory.ts"
6
6
  export const layerPersistence = Layer.unwrap(
7
7
  Effect.gen(function* () {
8
8
  const pathService = yield* Path.Path
9
- const directory = yield* resolveLalphDirectory()
9
+ const directory = yield* resolveLalphDirectory
10
10
  return Persistence.layerKvs.pipe(
11
11
  Layer.provide(
12
12
  KeyValueStore.layerFileSystem(
package/src/Worktree.ts CHANGED
@@ -22,6 +22,7 @@ import { AtomRegistry } from "effect/unstable/reactivity"
22
22
  import { CurrentProjectId } from "./Settings.ts"
23
23
  import { projectById } from "./Projects.ts"
24
24
  import { parseBranch } from "./shared/git.ts"
25
+ import { resolveLalphDirectory } from "./shared/lalphDirectory.ts"
25
26
 
26
27
  export class Worktree extends ServiceMap.Service<Worktree>()("lalph/Worktree", {
27
28
  make: Effect.gen(function* () {
@@ -75,7 +76,7 @@ export class Worktree extends ServiceMap.Service<Worktree>()("lalph/Worktree", {
75
76
  Effect.gen(function* () {
76
77
  const pathService = yield* Path.Path
77
78
  const fs = yield* FileSystem.FileSystem
78
- const directory = pathService.resolve(".")
79
+ const directory = yield* resolveLalphDirectory
79
80
  return {
80
81
  directory,
81
82
  inExisting: yield* fs.exists(pathService.join(".lalph", "prd.yml")),
@@ -29,20 +29,32 @@ const withNewProject = Flag.boolean("new").pipe(
29
29
  ),
30
30
  )
31
31
 
32
+ const file = Flag.file("file", { mustExist: true }).pipe(
33
+ Flag.withAlias("f"),
34
+ Flag.withDescription(
35
+ "Read the plan from a markdown file instead of opening an editor",
36
+ ),
37
+ Flag.optional,
38
+ )
39
+
32
40
  export const commandPlan = Command.make("plan", {
33
41
  dangerous,
34
42
  withNewProject,
43
+ file,
35
44
  }).pipe(
36
45
  Command.withDescription(
37
- "Open an editor to draft a plan; on save, generate a specification under --specs and then create PRD tasks from it. Use --new to create a project first; use --dangerous to skip permission prompts during spec generation.",
46
+ "Draft a plan in your editor (or use --file); then generate a specification under --specs and create PRD tasks from it. Use --new to create a project first, and --dangerous to skip permission prompts during spec generation.",
38
47
  ),
39
48
  Command.withHandler(
40
- Effect.fnUntraced(function* ({ dangerous, withNewProject }) {
49
+ Effect.fnUntraced(function* ({ dangerous, withNewProject, file }) {
41
50
  const editor = yield* Editor
51
+ const fs = yield* FileSystem.FileSystem
42
52
 
43
- const thePlan = yield* editor.editTemp({
44
- suffix: ".md",
53
+ const thePlan = yield* Effect.matchEffect(file.asEffect(), {
54
+ onFailure: () => editor.editTemp({ suffix: ".md" }),
55
+ onSuccess: (path) => fs.readFileString(path).pipe(Effect.asSome),
45
56
  })
57
+
46
58
  if (Option.isNone(thePlan)) return
47
59
 
48
60
  // We nest this effect, so we can launch the editor first as fast as
@@ -16,7 +16,7 @@ export const commandSh = Command.make("sh").pipe(
16
16
  const worktree = yield* Worktree
17
17
  const fs = yield* FileSystem.FileSystem
18
18
  const pathService = yield* Path.Path
19
- const lalphDirectory = yield* resolveLalphDirectory()
19
+ const lalphDirectory = yield* resolveLalphDirectory
20
20
 
21
21
  // link to lalph config
22
22
  yield* fs.symlink(
@@ -19,7 +19,7 @@ const findProjectRoot = Effect.fnUntraced(function* (cwd: string) {
19
19
  }
20
20
  })
21
21
 
22
- export const resolveLalphDirectory = Effect.fnUntraced(function* () {
22
+ export const resolveLalphDirectory = Effect.gen(function* () {
23
23
  const fs = yield* FileSystem.FileSystem
24
24
  const pathService = yield* Path.Path
25
25
  const cwd = pathService.resolve(".")