lalph 0.3.103 → 0.3.105

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.103",
4
+ "version": "0.3.105",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -45,7 +45,7 @@
45
45
  "@octokit/plugin-rest-endpoint-methods": "^17.0.0",
46
46
  "@octokit/types": "^16.0.0",
47
47
  "@typescript/native-preview": "7.0.0-dev.20260322.1",
48
- "clanka": "^0.2.32",
48
+ "clanka": "^0.2.33",
49
49
  "concurrently": "^9.2.1",
50
50
  "effect": "4.0.0-beta.37",
51
51
  "husky": "^9.1.7",
@@ -3,6 +3,7 @@ import {
3
3
  Effect,
4
4
  Layer,
5
5
  Option,
6
+ Redacted,
6
7
  Schedule,
7
8
  Schema,
8
9
  Semaphore,
@@ -16,7 +17,9 @@ import {
16
17
  HttpClientResponse,
17
18
  } from "effect/unstable/http"
18
19
  import { KeyValueStore } from "effect/unstable/persistence"
20
+ import { Prompt } from "effect/unstable/cli"
19
21
  import { layerKvs } from "../Kvs.ts"
22
+ import type { QuitError } from "effect/Terminal"
20
23
 
21
24
  const clientId = "Ov23liJMtg6leTI1Vu6m"
22
25
 
@@ -24,6 +27,7 @@ export class TokenManager extends ServiceMap.Service<TokenManager>()(
24
27
  "lalph/Github/TokenManager",
25
28
  {
26
29
  make: Effect.gen(function* () {
30
+ const promptEnv = yield* Effect.services<Prompt.Environment>()
27
31
  const kvs = KeyValueStore.prefix(
28
32
  yield* KeyValueStore.KeyValueStore,
29
33
  "github.accessToken",
@@ -54,16 +58,26 @@ export class TokenManager extends ServiceMap.Service<TokenManager>()(
54
58
  ),
55
59
  })
56
60
 
61
+ const promptPat = Effect.gen(function* () {
62
+ return yield* Prompt.password({
63
+ message:
64
+ "GitHub PAT with repo, read:user, read:project scopes (leave empty for OAuth)",
65
+ validate: (value) => Effect.succeed(value.trim()),
66
+ })
67
+ }).pipe(Effect.provideServices(promptEnv))
68
+
57
69
  const getNoLock: Effect.Effect<
58
70
  AccessToken,
59
- HttpClientError.HttpClientError | Schema.SchemaError
71
+ HttpClientError.HttpClientError | QuitError | Schema.SchemaError
60
72
  > = Effect.gen(function* () {
61
- if (Option.isNone(currentToken)) {
62
- const newToken = yield* deviceCode
63
- yield* set(Option.some(newToken))
64
- return newToken
73
+ if (Option.isSome(currentToken)) {
74
+ return currentToken.value
65
75
  }
66
- return currentToken.value
76
+ const token = Redacted.value(yield* promptPat)
77
+ const accessToken =
78
+ token.length > 0 ? new AccessToken({ token }) : yield* deviceCode
79
+ yield* set(Option.some(accessToken))
80
+ return accessToken
67
81
  })
68
82
  const get = Semaphore.makeUnsafe(1).withPermit(getNoLock)
69
83
 
package/src/Prd.ts CHANGED
@@ -239,6 +239,7 @@ export class Prd extends ServiceMap.Service<
239
239
  )
240
240
 
241
241
  yield* SubscriptionRef.changes(issuesRef).pipe(
242
+ Stream.filter((change) => change._tag === "External"),
242
243
  Stream.runForEach((s) => updateSync(s.issues)),
243
244
  Effect.forkScoped,
244
245
  )
@@ -857,7 +857,6 @@ const taskUpdateSteer = Effect.fnUntraced(function* (options: {
857
857
  return Result.failVoid
858
858
  }
859
859
  current = issue
860
- console.log("issue change", issues._tag)
861
860
  if (issues._tag === "Internal") {
862
861
  return Result.failVoid
863
862
  }
@@ -36,7 +36,9 @@ export class PullRequestComments extends S.Class<PullRequestComments>(
36
36
 
37
37
  export class PullRequest extends S.Class<PullRequest>("PullRequest")({
38
38
  url: S.String,
39
- reviewDecision: S.Null,
39
+ reviewDecision: S.NullOr(
40
+ S.Literals(["APPROVED", "CHANGES_REQUESTED", "REVIEW_REQUIRED"]),
41
+ ),
40
42
  reviews: S.suspend(() => Reviews),
41
43
  reviewThreads: S.suspend(() => ReviewThreads),
42
44
  comments: PullRequestComments,