lalph 0.3.22 → 0.3.23
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 +47 -7
- package/package.json +1 -1
- package/src/Github/Cli.ts +3 -1
- package/src/Kvs.ts +24 -6
- package/src/Persistence.ts +15 -5
- package/src/commands/sh.ts +4 -2
- package/src/shared/lalphDirectory.ts +43 -0
package/dist/cli.mjs
CHANGED
|
@@ -67634,11 +67634,44 @@ var Project$1 = class extends Class$1("lalph/Project")({
|
|
|
67634
67634
|
reviewAgent: Boolean$2
|
|
67635
67635
|
}) {};
|
|
67636
67636
|
|
|
67637
|
+
//#endregion
|
|
67638
|
+
//#region src/shared/lalphDirectory.ts
|
|
67639
|
+
const findProjectRoot = fnUntraced(function* (cwd) {
|
|
67640
|
+
const fs = yield* FileSystem;
|
|
67641
|
+
const pathService = yield* Path$1;
|
|
67642
|
+
let current = cwd;
|
|
67643
|
+
while (true) {
|
|
67644
|
+
if (yield* fs.exists(pathService.join(current, ".git"))) return some$2(current);
|
|
67645
|
+
const parent = pathService.dirname(current);
|
|
67646
|
+
if (parent === current) return none$4();
|
|
67647
|
+
current = parent;
|
|
67648
|
+
}
|
|
67649
|
+
});
|
|
67650
|
+
const resolveLalphDirectory = fnUntraced(function* () {
|
|
67651
|
+
const fs = yield* FileSystem;
|
|
67652
|
+
const pathService = yield* Path$1;
|
|
67653
|
+
const cwd = pathService.resolve(".");
|
|
67654
|
+
if (yield* fs.exists(pathService.join(cwd, ".lalph"))) return cwd;
|
|
67655
|
+
const projectRoot = yield* findProjectRoot(cwd);
|
|
67656
|
+
if (isSome(projectRoot)) {
|
|
67657
|
+
if (yield* fs.exists(pathService.join(projectRoot.value, ".lalph"))) return projectRoot.value;
|
|
67658
|
+
}
|
|
67659
|
+
return cwd;
|
|
67660
|
+
});
|
|
67661
|
+
|
|
67637
67662
|
//#endregion
|
|
67638
67663
|
//#region src/Kvs.ts
|
|
67639
|
-
const layerKvs =
|
|
67664
|
+
const layerKvs = unwrap$3(gen(function* () {
|
|
67665
|
+
const pathService = yield* Path$1;
|
|
67666
|
+
const directory = yield* resolveLalphDirectory();
|
|
67667
|
+
return layerFileSystem(pathService.join(directory, ".lalph", "config"));
|
|
67668
|
+
})).pipe(provide$3(PlatformServices));
|
|
67640
67669
|
var ProjectsKvs = class extends Service()("lalph/ProjectsKvs", {
|
|
67641
|
-
lookup: (projectId) =>
|
|
67670
|
+
lookup: (projectId) => unwrap$3(gen(function* () {
|
|
67671
|
+
const pathService = yield* Path$1;
|
|
67672
|
+
const directory = yield* resolveLalphDirectory();
|
|
67673
|
+
return layerFileSystem(pathService.join(directory, ".lalph", "projects", encodeURIComponent(projectId)));
|
|
67674
|
+
})).pipe(orDie$3),
|
|
67642
67675
|
dependencies: [PlatformServices]
|
|
67643
67676
|
}) {};
|
|
67644
67677
|
|
|
@@ -144486,7 +144519,11 @@ const promptForCommandPrefix = fnUntraced(function* (initial) {
|
|
|
144486
144519
|
|
|
144487
144520
|
//#endregion
|
|
144488
144521
|
//#region src/Persistence.ts
|
|
144489
|
-
const layerPersistence =
|
|
144522
|
+
const layerPersistence = unwrap$3(gen(function* () {
|
|
144523
|
+
const pathService = yield* Path$1;
|
|
144524
|
+
const directory = yield* resolveLalphDirectory();
|
|
144525
|
+
return layerKvs$1.pipe(provide$3(layerFileSystem(pathService.join(directory, ".lalph", "cache"))));
|
|
144526
|
+
})).pipe(provide$3(PlatformServices));
|
|
144490
144527
|
|
|
144491
144528
|
//#endregion
|
|
144492
144529
|
//#region src/Linear.ts
|
|
@@ -151150,7 +151187,9 @@ var GithubCliRepoNotFound = class extends TaggedError("GithubCliRepoNotFound") {
|
|
|
151150
151187
|
message = "GitHub repository not found. Ensure the current directory is inside a git repo with a GitHub remote.";
|
|
151151
151188
|
};
|
|
151152
151189
|
const renderReviewComments = (comment, followup) => `<comment author="${comment.author.login}" path="${comment.path}">
|
|
151153
|
-
<diffHunk
|
|
151190
|
+
<diffHunk><![CDATA[
|
|
151191
|
+
${comment.diffHunk}
|
|
151192
|
+
]]></diffHunk>
|
|
151154
151193
|
${comment.originalLine ? `<lineNumber>${comment.originalLine}</lineNumber>` : ""}
|
|
151155
151194
|
<body>${comment.body}</body>${followup.length > 0 ? `
|
|
151156
151195
|
|
|
@@ -153011,7 +153050,7 @@ const commandSource = make$36("source").pipe(withDescription("Select the issue s
|
|
|
153011
153050
|
|
|
153012
153051
|
//#endregion
|
|
153013
153052
|
//#region package.json
|
|
153014
|
-
var version = "0.3.
|
|
153053
|
+
var version = "0.3.23";
|
|
153015
153054
|
|
|
153016
153055
|
//#endregion
|
|
153017
153056
|
//#region src/commands/projects/ls.ts
|
|
@@ -153099,8 +153138,9 @@ const commandSh = make$36("sh").pipe(withDescription("Launch an interactive shel
|
|
|
153099
153138
|
const worktree = yield* Worktree;
|
|
153100
153139
|
const fs = yield* FileSystem;
|
|
153101
153140
|
const pathService = yield* Path$1;
|
|
153102
|
-
yield*
|
|
153103
|
-
yield* fs.symlink(pathService.
|
|
153141
|
+
const lalphDirectory = yield* resolveLalphDirectory();
|
|
153142
|
+
yield* fs.symlink(pathService.join(lalphDirectory, ".lalph", "config"), pathService.join(worktree.directory, ".lalph", "config"));
|
|
153143
|
+
yield* fs.symlink(pathService.join(lalphDirectory, ".lalph", "projects"), pathService.join(worktree.directory, ".lalph", "projects"));
|
|
153104
153144
|
yield* make$24(process.env.SHELL || "/bin/bash", [], {
|
|
153105
153145
|
cwd: worktree.directory,
|
|
153106
153146
|
stdin: "inherit",
|
package/package.json
CHANGED
package/src/Github/Cli.ts
CHANGED
|
@@ -150,7 +150,9 @@ const renderReviewComments = (
|
|
|
150
150
|
comment: ReviewComment,
|
|
151
151
|
followup: Array<ReviewComment>,
|
|
152
152
|
) => `<comment author="${comment.author.login}" path="${comment.path}">
|
|
153
|
-
<diffHunk
|
|
153
|
+
<diffHunk><![CDATA[
|
|
154
|
+
${comment.diffHunk}
|
|
155
|
+
]]></diffHunk>
|
|
154
156
|
${comment.originalLine ? `<lineNumber>${comment.originalLine}</lineNumber>` : ""}
|
|
155
157
|
<body>${comment.body}</body>${
|
|
156
158
|
followup.length > 0
|
package/src/Kvs.ts
CHANGED
|
@@ -1,18 +1,36 @@
|
|
|
1
|
-
import { Layer, LayerMap } from "effect"
|
|
1
|
+
import { Effect, Layer, LayerMap, Path } from "effect"
|
|
2
2
|
import { KeyValueStore } from "effect/unstable/persistence"
|
|
3
3
|
import { PlatformServices } from "./shared/platform.ts"
|
|
4
4
|
import { ProjectId } from "./domain/Project.ts"
|
|
5
|
+
import { resolveLalphDirectory } from "./shared/lalphDirectory.ts"
|
|
5
6
|
|
|
6
|
-
export const layerKvs =
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
export const layerKvs = Layer.unwrap(
|
|
8
|
+
Effect.gen(function* () {
|
|
9
|
+
const pathService = yield* Path.Path
|
|
10
|
+
const directory = yield* resolveLalphDirectory()
|
|
11
|
+
return KeyValueStore.layerFileSystem(
|
|
12
|
+
pathService.join(directory, ".lalph", "config"),
|
|
13
|
+
)
|
|
14
|
+
}),
|
|
15
|
+
).pipe(Layer.provide(PlatformServices))
|
|
9
16
|
|
|
10
17
|
export class ProjectsKvs extends LayerMap.Service<ProjectsKvs>()(
|
|
11
18
|
"lalph/ProjectsKvs",
|
|
12
19
|
{
|
|
13
20
|
lookup: (projectId: ProjectId) =>
|
|
14
|
-
|
|
15
|
-
|
|
21
|
+
Layer.unwrap(
|
|
22
|
+
Effect.gen(function* () {
|
|
23
|
+
const pathService = yield* Path.Path
|
|
24
|
+
const directory = yield* resolveLalphDirectory()
|
|
25
|
+
return KeyValueStore.layerFileSystem(
|
|
26
|
+
pathService.join(
|
|
27
|
+
directory,
|
|
28
|
+
".lalph",
|
|
29
|
+
"projects",
|
|
30
|
+
encodeURIComponent(projectId),
|
|
31
|
+
),
|
|
32
|
+
)
|
|
33
|
+
}),
|
|
16
34
|
).pipe(Layer.orDie),
|
|
17
35
|
dependencies: [PlatformServices],
|
|
18
36
|
},
|
package/src/Persistence.ts
CHANGED
|
@@ -1,8 +1,18 @@
|
|
|
1
|
-
import { Layer } from "effect"
|
|
1
|
+
import { Effect, Layer, Path } from "effect"
|
|
2
2
|
import { KeyValueStore, Persistence } from "effect/unstable/persistence"
|
|
3
3
|
import { PlatformServices } from "./shared/platform.ts"
|
|
4
|
+
import { resolveLalphDirectory } from "./shared/lalphDirectory.ts"
|
|
4
5
|
|
|
5
|
-
export const layerPersistence =
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
)
|
|
6
|
+
export const layerPersistence = Layer.unwrap(
|
|
7
|
+
Effect.gen(function* () {
|
|
8
|
+
const pathService = yield* Path.Path
|
|
9
|
+
const directory = yield* resolveLalphDirectory()
|
|
10
|
+
return Persistence.layerKvs.pipe(
|
|
11
|
+
Layer.provide(
|
|
12
|
+
KeyValueStore.layerFileSystem(
|
|
13
|
+
pathService.join(directory, ".lalph", "cache"),
|
|
14
|
+
),
|
|
15
|
+
),
|
|
16
|
+
)
|
|
17
|
+
}),
|
|
18
|
+
).pipe(Layer.provide(PlatformServices))
|
package/src/commands/sh.ts
CHANGED
|
@@ -4,6 +4,7 @@ import { ChildProcess } from "effect/unstable/process"
|
|
|
4
4
|
import { Prd } from "../Prd.ts"
|
|
5
5
|
import { Worktree } from "../Worktree.ts"
|
|
6
6
|
import { layerProjectIdPrompt } from "../Projects.ts"
|
|
7
|
+
import { resolveLalphDirectory } from "../shared/lalphDirectory.ts"
|
|
7
8
|
|
|
8
9
|
export const commandSh = Command.make("sh").pipe(
|
|
9
10
|
Command.withDescription(
|
|
@@ -15,14 +16,15 @@ export const commandSh = Command.make("sh").pipe(
|
|
|
15
16
|
const worktree = yield* Worktree
|
|
16
17
|
const fs = yield* FileSystem.FileSystem
|
|
17
18
|
const pathService = yield* Path.Path
|
|
19
|
+
const lalphDirectory = yield* resolveLalphDirectory()
|
|
18
20
|
|
|
19
21
|
// link to lalph config
|
|
20
22
|
yield* fs.symlink(
|
|
21
|
-
pathService.
|
|
23
|
+
pathService.join(lalphDirectory, ".lalph", "config"),
|
|
22
24
|
pathService.join(worktree.directory, ".lalph", "config"),
|
|
23
25
|
)
|
|
24
26
|
yield* fs.symlink(
|
|
25
|
-
pathService.
|
|
27
|
+
pathService.join(lalphDirectory, ".lalph", "projects"),
|
|
26
28
|
pathService.join(worktree.directory, ".lalph", "projects"),
|
|
27
29
|
)
|
|
28
30
|
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { Effect, FileSystem, Option, Path } from "effect"
|
|
2
|
+
|
|
3
|
+
const findProjectRoot = Effect.fnUntraced(function* (cwd: string) {
|
|
4
|
+
const fs = yield* FileSystem.FileSystem
|
|
5
|
+
const pathService = yield* Path.Path
|
|
6
|
+
|
|
7
|
+
let current = cwd
|
|
8
|
+
while (true) {
|
|
9
|
+
const inProjectRoot = yield* fs.exists(pathService.join(current, ".git"))
|
|
10
|
+
if (inProjectRoot) {
|
|
11
|
+
return Option.some(current)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
const parent = pathService.dirname(current)
|
|
15
|
+
if (parent === current) {
|
|
16
|
+
return Option.none<string>()
|
|
17
|
+
}
|
|
18
|
+
current = parent
|
|
19
|
+
}
|
|
20
|
+
})
|
|
21
|
+
|
|
22
|
+
export const resolveLalphDirectory = Effect.fnUntraced(function* () {
|
|
23
|
+
const fs = yield* FileSystem.FileSystem
|
|
24
|
+
const pathService = yield* Path.Path
|
|
25
|
+
const cwd = pathService.resolve(".")
|
|
26
|
+
|
|
27
|
+
const inCwd = yield* fs.exists(pathService.join(cwd, ".lalph"))
|
|
28
|
+
if (inCwd) {
|
|
29
|
+
return cwd
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
const projectRoot = yield* findProjectRoot(cwd)
|
|
33
|
+
if (Option.isSome(projectRoot)) {
|
|
34
|
+
const inProjectRoot = yield* fs.exists(
|
|
35
|
+
pathService.join(projectRoot.value, ".lalph"),
|
|
36
|
+
)
|
|
37
|
+
if (inProjectRoot) {
|
|
38
|
+
return projectRoot.value
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
return cwd
|
|
43
|
+
})
|