lalph 0.3.26 → 0.3.28
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/README.md +1 -0
- package/dist/cli.mjs +7624 -4632
- package/package.json +5 -5
- package/src/Github/Cli.ts +1 -1
- package/src/Github/TokenManager.ts +2 -1
- package/src/Linear/TokenManager.ts +6 -3
- package/src/Prd.ts +2 -1
- package/src/Tracing.ts +7 -12
- package/src/Workers.ts +1 -0
- package/src/commands/root.ts +2 -1
- package/src/domain/GithubComment.ts +18 -1
- package/src/shared/stream.ts +2 -4
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "lalph",
|
|
3
3
|
"type": "module",
|
|
4
|
-
"version": "0.3.
|
|
4
|
+
"version": "0.3.28",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -22,17 +22,17 @@
|
|
|
22
22
|
"devDependencies": {
|
|
23
23
|
"@changesets/changelog-github": "^0.5.2",
|
|
24
24
|
"@changesets/cli": "^2.29.8",
|
|
25
|
-
"@effect/language-service": "^0.
|
|
26
|
-
"@effect/platform-node": "
|
|
25
|
+
"@effect/language-service": "^0.75.1",
|
|
26
|
+
"@effect/platform-node": "4.0.0-beta.6",
|
|
27
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": "
|
|
31
|
+
"effect": "4.0.0-beta.6",
|
|
32
32
|
"husky": "^9.1.7",
|
|
33
33
|
"lint-staged": "^16.2.7",
|
|
34
34
|
"octokit": "^5.0.5",
|
|
35
|
-
"oxlint": "^1.
|
|
35
|
+
"oxlint": "^1.49.0",
|
|
36
36
|
"prettier": "^3.8.1",
|
|
37
37
|
"tsdown": "^0.20.3",
|
|
38
38
|
"typescript": "^5.9.3",
|
package/src/Github/Cli.ts
CHANGED
|
@@ -45,7 +45,7 @@ export class GithubCli extends ServiceMap.Service<GithubCli>()(
|
|
|
45
45
|
Effect.map((data) => {
|
|
46
46
|
const comments =
|
|
47
47
|
data.data.repository.pullRequest.comments.nodes.filter(
|
|
48
|
-
(c) => !c.
|
|
48
|
+
(c) => !c.isBot,
|
|
49
49
|
)
|
|
50
50
|
const reviews =
|
|
51
51
|
data.data.repository.pullRequest.reviews.nodes.filter(
|
|
@@ -5,6 +5,7 @@ import {
|
|
|
5
5
|
Option,
|
|
6
6
|
Schedule,
|
|
7
7
|
Schema,
|
|
8
|
+
Semaphore,
|
|
8
9
|
ServiceMap,
|
|
9
10
|
} from "effect"
|
|
10
11
|
import {
|
|
@@ -64,7 +65,7 @@ export class TokenManager extends ServiceMap.Service<TokenManager>()(
|
|
|
64
65
|
}
|
|
65
66
|
return currentToken.value
|
|
66
67
|
})
|
|
67
|
-
const get =
|
|
68
|
+
const get = Semaphore.makeUnsafe(1).withPermit(getNoLock)
|
|
68
69
|
|
|
69
70
|
const deviceCode = Effect.gen(function* () {
|
|
70
71
|
const code = yield* HttpClientRequest.post(
|
|
@@ -2,10 +2,12 @@ import {
|
|
|
2
2
|
DateTime,
|
|
3
3
|
Deferred,
|
|
4
4
|
Effect,
|
|
5
|
+
Encoding,
|
|
5
6
|
Layer,
|
|
6
7
|
Option,
|
|
7
8
|
Schedule,
|
|
8
9
|
Schema,
|
|
10
|
+
Semaphore,
|
|
9
11
|
ServiceMap,
|
|
10
12
|
} from "effect"
|
|
11
13
|
import {
|
|
@@ -18,7 +20,6 @@ import {
|
|
|
18
20
|
HttpServerRequest,
|
|
19
21
|
HttpServerResponse,
|
|
20
22
|
} from "effect/unstable/http"
|
|
21
|
-
import { Base64Url } from "effect/encoding"
|
|
22
23
|
import { NodeHttpServer } from "@effect/platform-node"
|
|
23
24
|
import { createServer } from "node:http"
|
|
24
25
|
import { KeyValueStore } from "effect/unstable/persistence"
|
|
@@ -80,7 +81,7 @@ export class TokenManager extends ServiceMap.Service<TokenManager>()(
|
|
|
80
81
|
return currentToken.value
|
|
81
82
|
}),
|
|
82
83
|
)
|
|
83
|
-
const get =
|
|
84
|
+
const get = Semaphore.makeUnsafe(1).withPermit(getNoLock)
|
|
84
85
|
|
|
85
86
|
const pkce = Effect.gen(function* () {
|
|
86
87
|
const deferred = yield* Deferred.make<typeof CallbackParams.Type>()
|
|
@@ -116,7 +117,9 @@ export class TokenManager extends ServiceMap.Service<TokenManager>()(
|
|
|
116
117
|
const verifierSha256 = yield* Effect.promise(() =>
|
|
117
118
|
crypto.subtle.digest("SHA-256", new TextEncoder().encode(verifier)),
|
|
118
119
|
)
|
|
119
|
-
const challenge =
|
|
120
|
+
const challenge = Encoding.encodeBase64Url(
|
|
121
|
+
new Uint8Array(verifierSha256),
|
|
122
|
+
)
|
|
120
123
|
|
|
121
124
|
const url = `https://linear.app/oauth/authorize?client_id=${clientId}&redirect_uri=${encodeURIComponent(redirectUri)}&response_type=code&scope=read,write&code_challenge=${challenge}&code_challenge_method=S256`
|
|
122
125
|
|
package/src/Prd.ts
CHANGED
|
@@ -7,6 +7,7 @@ import {
|
|
|
7
7
|
Path,
|
|
8
8
|
PlatformError,
|
|
9
9
|
Schedule,
|
|
10
|
+
Semaphore,
|
|
10
11
|
ServiceMap,
|
|
11
12
|
Stream,
|
|
12
13
|
} from "effect"
|
|
@@ -65,7 +66,7 @@ export class Prd extends ServiceMap.Service<
|
|
|
65
66
|
{ suspendOnWaiting: true },
|
|
66
67
|
)
|
|
67
68
|
|
|
68
|
-
const syncSemaphore =
|
|
69
|
+
const syncSemaphore = Semaphore.makeUnsafe(1)
|
|
69
70
|
|
|
70
71
|
const maybeRevertIssue = Effect.fnUntraced(function* (options: {
|
|
71
72
|
readonly issueId: string
|
package/src/Tracing.ts
CHANGED
|
@@ -41,21 +41,16 @@ const TracerLogger = Effect.gen(function* () {
|
|
|
41
41
|
}
|
|
42
42
|
|
|
43
43
|
return Tracer.make({
|
|
44
|
-
span(
|
|
45
|
-
const span = tracer.span(
|
|
46
|
-
|
|
47
|
-
parent,
|
|
48
|
-
annotations,
|
|
49
|
-
links,
|
|
50
|
-
startTime,
|
|
51
|
-
kind,
|
|
52
|
-
options,
|
|
53
|
-
)
|
|
54
|
-
log(`${name}: started`, startTime)
|
|
44
|
+
span(options) {
|
|
45
|
+
const span = tracer.span(options)
|
|
46
|
+
log(`${options.name}: started`, options.startTime)
|
|
55
47
|
const oldEnd = span.end
|
|
56
48
|
span.end = (endTime, cause) => {
|
|
57
49
|
const duration = Duration.nanos(endTime - span.status.startTime)
|
|
58
|
-
log(
|
|
50
|
+
log(
|
|
51
|
+
`${options.name}: completed. Took ${Duration.format(duration)}`,
|
|
52
|
+
endTime,
|
|
53
|
+
)
|
|
59
54
|
return oldEnd.call(span, endTime, cause)
|
|
60
55
|
}
|
|
61
56
|
return span
|
package/src/Workers.ts
CHANGED
package/src/commands/root.ts
CHANGED
|
@@ -8,6 +8,7 @@ import {
|
|
|
8
8
|
Iterable,
|
|
9
9
|
Option,
|
|
10
10
|
Path,
|
|
11
|
+
Semaphore,
|
|
11
12
|
Stream,
|
|
12
13
|
} from "effect"
|
|
13
14
|
import { PromptGen } from "../PromptGen.ts"
|
|
@@ -248,7 +249,7 @@ const runProject = Effect.fnUntraced(
|
|
|
248
249
|
}) {
|
|
249
250
|
const isFinite = Number.isFinite(options.iterations)
|
|
250
251
|
const iterationsDisplay = isFinite ? options.iterations : "unlimited"
|
|
251
|
-
const semaphore =
|
|
252
|
+
const semaphore = Semaphore.makeUnsafe(options.project.concurrency)
|
|
252
253
|
const fibers = yield* FiberSet.make()
|
|
253
254
|
|
|
254
255
|
yield* resetInProgress.pipe(Effect.withSpan("Main.resetInProgress"))
|
|
@@ -4,12 +4,29 @@ export class Author extends S.Class<Author>("Author")({
|
|
|
4
4
|
login: S.String,
|
|
5
5
|
}) {}
|
|
6
6
|
|
|
7
|
+
// Prefixes of bot users that we want to ignore when determining if a comment is
|
|
8
|
+
// from a bot or not. This is not an exhaustive list, but covers some common
|
|
9
|
+
// cases.
|
|
10
|
+
const commonBotUserPrefixes = [
|
|
11
|
+
"dependabot",
|
|
12
|
+
"github",
|
|
13
|
+
"changeset",
|
|
14
|
+
"renovate",
|
|
15
|
+
"snyk",
|
|
16
|
+
"coderabbit",
|
|
17
|
+
]
|
|
18
|
+
|
|
7
19
|
export class Comment extends S.Class<Comment>("Comment")({
|
|
8
20
|
id: S.String,
|
|
9
21
|
body: S.String,
|
|
10
22
|
author: Author,
|
|
11
23
|
createdAt: S.String,
|
|
12
|
-
}) {
|
|
24
|
+
}) {
|
|
25
|
+
get isBot() {
|
|
26
|
+
const login = this.author.login.toLowerCase()
|
|
27
|
+
return commonBotUserPrefixes.some((prefix) => login.startsWith(prefix))
|
|
28
|
+
}
|
|
29
|
+
}
|
|
13
30
|
|
|
14
31
|
export class PullRequestComments extends S.Class<PullRequestComments>(
|
|
15
32
|
"PullRequestComments",
|
package/src/shared/stream.ts
CHANGED
|
@@ -1,12 +1,10 @@
|
|
|
1
|
-
import { Effect,
|
|
1
|
+
import { Effect, flow, Schema, Stream } from "effect"
|
|
2
2
|
|
|
3
3
|
export const streamFilterJson = <S extends Schema.Top>(schema: S) => {
|
|
4
4
|
const fromString = Schema.fromJsonString(schema)
|
|
5
5
|
const decode = Schema.decodeEffect(fromString)
|
|
6
6
|
return flow(
|
|
7
7
|
Stream.splitLines,
|
|
8
|
-
Stream.
|
|
9
|
-
decode(line).pipe(Effect.catch(() => Effect.succeed(Filter.failVoid))),
|
|
10
|
-
),
|
|
8
|
+
Stream.filterEffect((line) => decode(line).pipe(Effect.result)),
|
|
11
9
|
)
|
|
12
10
|
}
|