@qotaq/lalphgram 0.1.4 → 0.1.6
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/cjs/Main.js +5 -1
- package/dist/cjs/Main.js.map +1 -1
- package/dist/cjs/lib/StreamJsonParser.js +1 -1
- package/dist/cjs/lib/StreamJsonParser.js.map +1 -1
- package/dist/cjs/schemas/ProjectSchemas.js +3 -0
- package/dist/cjs/schemas/ProjectSchemas.js.map +1 -1
- package/dist/cjs/services/ChatMachine.js +70 -11
- package/dist/cjs/services/ChatMachine.js.map +1 -1
- package/dist/cjs/services/MessengerAdapter/TelegramAdapter.js +2 -2
- package/dist/cjs/services/MessengerAdapter/TelegramAdapter.js.map +1 -1
- package/dist/cjs/services/PlanSession.js +3 -5
- package/dist/cjs/services/PlanSession.js.map +1 -1
- package/dist/cjs/services/ProjectStore.js +41 -19
- package/dist/cjs/services/ProjectStore.js.map +1 -1
- package/dist/cjs/shim/parseArgs.js +1 -1
- package/dist/cjs/shim/parseArgs.js.map +1 -1
- package/dist/dts/schemas/ProjectSchemas.d.ts +10 -2
- package/dist/dts/schemas/ProjectSchemas.d.ts.map +1 -1
- package/dist/dts/services/ChatMachine.d.ts +3 -1
- package/dist/dts/services/ChatMachine.d.ts.map +1 -1
- package/dist/dts/services/PlanSession.d.ts +1 -1
- package/dist/dts/services/PlanSession.d.ts.map +1 -1
- package/dist/dts/services/ProjectStore.d.ts +4 -2
- package/dist/dts/services/ProjectStore.d.ts.map +1 -1
- package/dist/esm/Main.js +5 -1
- package/dist/esm/Main.js.map +1 -1
- package/dist/esm/lib/StreamJsonParser.js +1 -1
- package/dist/esm/lib/StreamJsonParser.js.map +1 -1
- package/dist/esm/schemas/ProjectSchemas.js +3 -0
- package/dist/esm/schemas/ProjectSchemas.js.map +1 -1
- package/dist/esm/services/ChatMachine.js +70 -11
- package/dist/esm/services/ChatMachine.js.map +1 -1
- package/dist/esm/services/MessengerAdapter/TelegramAdapter.js +2 -2
- package/dist/esm/services/MessengerAdapter/TelegramAdapter.js.map +1 -1
- package/dist/esm/services/PlanSession.js +3 -5
- package/dist/esm/services/PlanSession.js.map +1 -1
- package/dist/esm/services/ProjectStore.js +43 -21
- package/dist/esm/services/ProjectStore.js.map +1 -1
- package/dist/esm/shim/parseArgs.js +1 -1
- package/dist/esm/shim/parseArgs.js.map +1 -1
- package/package.json +1 -1
- package/src/Main.ts +6 -2
- package/src/lib/StreamJsonParser.ts +1 -1
- package/src/schemas/ProjectSchemas.ts +2 -1
- package/src/services/ChatMachine.ts +62 -14
- package/src/services/MessengerAdapter/TelegramAdapter.ts +2 -2
- package/src/services/PlanSession.ts +7 -6
- package/src/services/ProjectStore.ts +84 -22
- package/src/shim/parseArgs.ts +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ProjectStore.js","names":["FileSystem","Path","Context","Data","Effect","Layer","Schema","LalphProject","AppContext","ProjectStoreError","TaggedError","ProjectStore","Tag","ProjectsArray","Array","ProjectStoreLive","effect","gen","fs","pathService","appContext","filePath","join","configDir","readProjects","exists","pipe","mapError","err","message","String","cause","empty","content","readFileString","json","try","JSON","parse","catch","decodeUnknown","listProjects","map","projects","filter","p","enabled","getProject","id","flatMap","project","find","fail","succeed","createProject","data","
|
|
1
|
+
{"version":3,"file":"ProjectStore.js","names":["Command","CommandExecutor","FileSystem","Path","Context","Data","Duration","Effect","Layer","Schema","Stream","LalphProject","AppContext","ProjectStoreError","TaggedError","ProjectStore","Tag","ProjectsArray","Array","ARROW_DOWN","ProjectStoreLive","effect","gen","fs","pathService","appContext","executor","filePath","join","configDir","readProjects","exists","pipe","mapError","err","message","String","cause","empty","content","readFileString","json","try","JSON","parse","catch","decodeUnknown","listProjects","map","projects","filter","p","enabled","getProject","id","flatMap","project","find","fail","succeed","createProject","data","encoder","TextEncoder","stdinLines","concurrency","targetBranch","_tag","value","gitFlow","reviewAgent","labelFilter","autoMergeLabel","stdinStream","fromIterable","mapEffect","line","sleep","millis","encode","cmd","make","workingDirectory","projectRoot","stdout","stderr","stdin","scoped","process","start","provideService","run","forkDaemon","runDrain","exitCode","chunk","TextDecoder","decode","runCollect","chunks","log","annotateLogs","projectId","of"],"sources":["../../../src/services/ProjectStore.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAIA,SAASA,OAAO,EAAEC,eAAe,EAAEC,UAAU,EAAEC,IAAI,QAAQ,kBAAkB;AAE7E,SAASC,OAAO,EAAEC,IAAI,EAAEC,QAAQ,EAAEC,MAAM,EAAEC,KAAK,EAAEC,MAAM,EAAEC,MAAM,QAAQ,QAAQ;AAC/E,SAASC,YAAY,QAAQ,8BAA8B;AAC3D,SAASC,UAAU,QAAQ,iBAAiB;AAE5C;;;;AAIA,OAAM,MAAOC,iBAAkB,sBAAQR,IAAI,CAACS,WAAW,CAAC,mBAAmB,CAGzE;AAoBF;;;;AAIA,OAAM,MAAOC,YAAa,sBAAQX,OAAO,CAACY,GAAG,CAAC,cAAc,CAAC,EAG1D;AAEH,MAAMC,aAAa,gBAAGR,MAAM,CAACS,KAAK,CAACP,YAAY,CAAC;AAEhD;AACA,MAAMQ,UAAU,GAAG,QAAQ;AAE3B;;;;AAIA,OAAO,MAAMC,gBAAgB,gBAAGZ,KAAK,CAACa,MAAM,CAC1CN,YAAY,eACZR,MAAM,CAACe,GAAG,CAAC,aAAS;EAClB,MAAMC,EAAE,GAAG,OAAOrB,UAAU,CAACA,UAAU;EACvC,MAAMsB,WAAW,GAAG,OAAOrB,IAAI,CAACA,IAAI;EACpC,MAAMsB,UAAU,GAAG,OAAOb,UAAU;EACpC,MAAMc,QAAQ,GAAG,OAAOzB,eAAe,CAACA,eAAe;EAEvD,MAAM0B,QAAQ,GAAGH,WAAW,CAACI,IAAI,CAACH,UAAU,CAACI,SAAS,EAAE,mBAAmB,CAAC;EAE5E,MAAMC,YAAY,GAAGvB,MAAM,CAACe,GAAG,CAAC,aAAS;IACvC,MAAMS,MAAM,GAAG,OAAOR,EAA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AC;EACJ,CAAC,CAAC;EAEJ,OAAOzD,YAAY,CAACwF,EAAE,CAAC;IAAExD,YAAY;IAAEM,UAAU;IAAEO;EAAa,CAAE,CAAC;AACrE,CAAC,CAAC,CACH","ignoreList":[]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseArgs.js","names":["parseArgs","args","dangerouslySkipPermissions","prompt","model","skipNext","i","length","arg","slice","join","startsWith"],"sources":["../../../src/shim/parseArgs.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAWA,OAAM,SAAUA,SAASA,CAACC,IAA2B;EACnD,IAAIC,0BAA0B,GAAG,KAAK;EACtC,IAAIC,MAAM,GAAG,EAAE;EACf,IAAIC,KAAK,GAAkB,IAAI;EAC/B,IAAIC,QAAQ,GAAG,KAAK;EAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAID,QAAQ,EAAE;MACZA,QAAQ,GAAG,KAAK;MAChB;IACF;IACA,MAAMG,GAAG,GAAGP,IAAI,CAACK,CAAC,
|
|
1
|
+
{"version":3,"file":"parseArgs.js","names":["parseArgs","args","dangerouslySkipPermissions","prompt","model","skipNext","i","length","arg","slice","join","startsWith"],"sources":["../../../src/shim/parseArgs.ts"],"sourcesContent":[null],"mappings":"AAAA;;;;AAWA,OAAM,SAAUA,SAASA,CAACC,IAA2B;EACnD,IAAIC,0BAA0B,GAAG,KAAK;EACtC,IAAIC,MAAM,GAAG,EAAE;EACf,IAAIC,KAAK,GAAkB,IAAI;EAC/B,IAAIC,QAAQ,GAAG,KAAK;EAEpB,KAAK,IAAIC,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGL,IAAI,CAACM,MAAM,EAAED,CAAC,EAAE,EAAE;IACpC,IAAID,QAAQ,EAAE;MACZA,QAAQ,GAAG,KAAK;MAChB;IACF;IACA,MAAMG,GAAG,GAAGP,IAAI,CAACK,CAAC,CAAC,IAAI,EAAE;IACzB,IAAIE,GAAG,KAAK,gCAAgC,EAAE;MAC5CN,0BAA0B,GAAG,IAAI;IACnC,CAAC,MAAM,IAAIM,GAAG,KAAK,iBAAiB,EAAE;MACpCH,QAAQ,GAAG,IAAI;IACjB,CAAC,MAAM,IAAIG,GAAG,KAAK,SAAS,EAAE;MAC5BJ,KAAK,GAAGH,IAAI,CAACK,CAAC,GAAG,CAAC,CAAC,IAAI,IAAI;MAC3BD,QAAQ,GAAG,IAAI;IACjB,CAAC,MAAM,IAAIG,GAAG,KAAK,WAAW,IAAIA,GAAG,KAAK,IAAI,IAAIA,GAAG,KAAK,SAAS,EAAE;MACnE;IAAA,CACD,MAAM,IAAIA,GAAG,KAAK,IAAI,EAAE;MACvB;MACAL,MAAM,GAAGF,IAAI,CAACQ,KAAK,CAACH,CAAC,GAAG,CAAC,CAAC,CAACI,IAAI,CAAC,GAAG,CAAC;MACpC;IACF,CAAC,MAAM,IAAI,CAACF,GAAG,CAACG,UAAU,CAAC,GAAG,CAAC,EAAE;MAC/BR,MAAM,GAAGK,GAAG;IACd;EACF;EAEA,OAAO;IAAEL,MAAM;IAAED,0BAA0B;IAAEE;EAAK,CAAE;AACtD","ignoreList":[]}
|
package/package.json
CHANGED
package/src/Main.ts
CHANGED
|
@@ -144,7 +144,8 @@ const lalphNotifyCommand = CliCommand.make(
|
|
|
144
144
|
Stream.take(1),
|
|
145
145
|
Stream.runCollect
|
|
146
146
|
)
|
|
147
|
-
const firstMsg = [...messages][0]
|
|
147
|
+
const firstMsg = [...messages][0]
|
|
148
|
+
if (firstMsg == null) return
|
|
148
149
|
yield* store.set(new TelegramConfigSchema({ botToken, chatId: firstMsg.chatId }))
|
|
149
150
|
yield* Console.log("Telegram config saved.")
|
|
150
151
|
}
|
|
@@ -162,7 +163,10 @@ const readVersion = Effect.gen(function*() {
|
|
|
162
163
|
const fs = yield* FileSystem.FileSystem
|
|
163
164
|
const pathService = yield* Path.Path
|
|
164
165
|
const dir = pathService.dirname(fileURLToPath(import.meta.url))
|
|
165
|
-
const
|
|
166
|
+
const candidate1 = pathService.join(dir, "..", "..", "package.json")
|
|
167
|
+
const candidate2 = pathService.join(dir, "..", "package.json")
|
|
168
|
+
const pkgPath = (yield* fs.exists(candidate1)) ? candidate1 : candidate2
|
|
169
|
+
const content = yield* fs.readFileString(pkgPath)
|
|
166
170
|
return Schema.decodeUnknownSync(PackageJsonVersion)(JSON.parse(content)).version
|
|
167
171
|
})
|
|
168
172
|
|
|
@@ -88,7 +88,7 @@ export const parseNdjsonMessages = flow(
|
|
|
88
88
|
Stream.mapEffect((line: string) =>
|
|
89
89
|
decodeJsonMessage(line).pipe(
|
|
90
90
|
Effect.tapError((err) =>
|
|
91
|
-
Effect.
|
|
91
|
+
Effect.logDebug("Non-JSON stdout line, skipping").pipe(
|
|
92
92
|
Effect.annotateLogs({ line: line.slice(0, 300), error: err.message.slice(0, 100) })
|
|
93
93
|
)
|
|
94
94
|
),
|
|
@@ -15,5 +15,6 @@ export class LalphProject extends Schema.Class<LalphProject>("LalphProject")({
|
|
|
15
15
|
concurrency: Schema.Int.pipe(Schema.positive()),
|
|
16
16
|
gitFlow: Schema.Literal("pr", "commit"),
|
|
17
17
|
reviewAgent: Schema.Boolean,
|
|
18
|
-
labelFilter: Schema.optionalWith(Schema.String, { default: () => "lalph" })
|
|
18
|
+
labelFilter: Schema.optionalWith(Schema.String, { default: () => "lalph" }),
|
|
19
|
+
autoMergeLabel: Schema.optionalWith(Schema.String, { default: () => "auto-merge" })
|
|
19
20
|
}) {}
|
|
@@ -46,7 +46,14 @@ const SPEC_READY_KEYBOARD = [{ label: APPROVE_BUTTON_LABEL }, { label: ABORT_BUT
|
|
|
46
46
|
|
|
47
47
|
// ── State types ──────────────────────────────────────────────────
|
|
48
48
|
|
|
49
|
-
type CreatingProjectStep =
|
|
49
|
+
type CreatingProjectStep =
|
|
50
|
+
| "Name"
|
|
51
|
+
| "Concurrency"
|
|
52
|
+
| "TargetBranch"
|
|
53
|
+
| "GitFlow"
|
|
54
|
+
| "ReviewAgent"
|
|
55
|
+
| "LabelFilter"
|
|
56
|
+
| "AutoMergeLabel"
|
|
50
57
|
|
|
51
58
|
interface CreatingProjectData {
|
|
52
59
|
readonly name?: string
|
|
@@ -54,6 +61,8 @@ interface CreatingProjectData {
|
|
|
54
61
|
readonly targetBranch?: string | null
|
|
55
62
|
readonly gitFlow?: "pr" | "commit"
|
|
56
63
|
readonly reviewAgent?: boolean
|
|
64
|
+
readonly labelFilter?: string
|
|
65
|
+
readonly autoMergeLabel?: string
|
|
57
66
|
}
|
|
58
67
|
|
|
59
68
|
export class ReadyFlags extends Data.Class<{
|
|
@@ -381,14 +390,15 @@ export const chatMachine = Machine.make(
|
|
|
381
390
|
return reply(state)
|
|
382
391
|
}
|
|
383
392
|
if (projects.length === 1) {
|
|
393
|
+
const singleProject = projects[0] ?? { id: "" }
|
|
384
394
|
yield* Effect.log("Single project auto-selected").pipe(
|
|
385
|
-
Effect.annotateLogs("projectId",
|
|
395
|
+
Effect.annotateLogs("projectId", singleProject.id)
|
|
386
396
|
)
|
|
387
397
|
yield* notifier.sendMessage({
|
|
388
398
|
text: "What type of change?",
|
|
389
399
|
options: [...PLAN_TYPE_LABELS.map((label) => ({ label })), { label: ABORT_BUTTON_LABEL }]
|
|
390
400
|
})
|
|
391
|
-
return reply(ChatState.SelectingPlanType({ projectId:
|
|
401
|
+
return reply(ChatState.SelectingPlanType({ projectId: singleProject.id }))
|
|
392
402
|
}
|
|
393
403
|
yield* notifier.sendMessage({
|
|
394
404
|
text: "Select a project:",
|
|
@@ -472,13 +482,13 @@ export const chatMachine = Machine.make(
|
|
|
472
482
|
Effect.annotateLogs("planText", joinedText)
|
|
473
483
|
)
|
|
474
484
|
const projects = yield* projectStore.listProjects.pipe(
|
|
475
|
-
Effect.orElseSucceed((): ReadonlyArray<
|
|
485
|
+
Effect.orElseSucceed((): ReadonlyArray<
|
|
486
|
+
{ id: string; labelFilter: string; autoMergeLabel: string }
|
|
487
|
+
> => [])
|
|
476
488
|
)
|
|
477
|
-
const currentProject = projects.find((p) => p.id === state.projectId)
|
|
478
489
|
yield* planSession.start(
|
|
479
490
|
joinedText,
|
|
480
|
-
projects.length > 1 ? state.projectId : undefined
|
|
481
|
-
projects.length > 1 ? currentProject?.labelFilter : undefined
|
|
491
|
+
projects.length > 1 ? state.projectId : undefined
|
|
482
492
|
).pipe(
|
|
483
493
|
Effect.tapError((err) => notifier.sendMessage(`Plan error: ${err.message}`)),
|
|
484
494
|
Effect.orElseSucceed(() => undefined)
|
|
@@ -760,24 +770,62 @@ export const chatMachine = Machine.make(
|
|
|
760
770
|
}
|
|
761
771
|
case "ReviewAgent": {
|
|
762
772
|
const reviewAgent = text === "Yes"
|
|
763
|
-
|
|
773
|
+
yield* notifier.sendMessage({
|
|
774
|
+
text: "Label filter (for issue filtering):",
|
|
775
|
+
options: [
|
|
776
|
+
{ label: "lalph" },
|
|
777
|
+
{ label: "Skip" },
|
|
778
|
+
{ label: ABORT_BUTTON_LABEL }
|
|
779
|
+
]
|
|
780
|
+
})
|
|
781
|
+
return reply(ChatState.CreatingProject({
|
|
782
|
+
...state,
|
|
783
|
+
step: "LabelFilter",
|
|
784
|
+
data: { ...state.data, reviewAgent }
|
|
785
|
+
}))
|
|
786
|
+
}
|
|
787
|
+
case "LabelFilter": {
|
|
788
|
+
const labelFilter = text === "Skip" ? "" : text
|
|
789
|
+
yield* notifier.sendMessage({
|
|
790
|
+
text: "Auto-merge label:",
|
|
791
|
+
options: [
|
|
792
|
+
{ label: "auto-merge" },
|
|
793
|
+
{ label: "Skip" },
|
|
794
|
+
{ label: ABORT_BUTTON_LABEL }
|
|
795
|
+
]
|
|
796
|
+
})
|
|
797
|
+
return reply(ChatState.CreatingProject({
|
|
798
|
+
...state,
|
|
799
|
+
step: "AutoMergeLabel",
|
|
800
|
+
data: { ...state.data, labelFilter }
|
|
801
|
+
}))
|
|
802
|
+
}
|
|
803
|
+
case "AutoMergeLabel": {
|
|
804
|
+
const autoMergeLabel = text === "Skip" ? "" : text
|
|
805
|
+
const data = { ...state.data, autoMergeLabel }
|
|
806
|
+
const name = data.name ?? ""
|
|
807
|
+
const concurrency = data.concurrency ?? 1
|
|
808
|
+
const gitFlow = data.gitFlow ?? "pr"
|
|
809
|
+
const reviewAgent = data.reviewAgent ?? false
|
|
764
810
|
yield* projectStore.createProject({
|
|
765
|
-
id:
|
|
811
|
+
id: name,
|
|
766
812
|
targetBranch: data.targetBranch != null ? Option.some(data.targetBranch) : Option.none(),
|
|
767
|
-
concurrency
|
|
768
|
-
gitFlow
|
|
769
|
-
reviewAgent
|
|
813
|
+
concurrency,
|
|
814
|
+
gitFlow,
|
|
815
|
+
reviewAgent,
|
|
816
|
+
...(data.labelFilter != null ? { labelFilter: data.labelFilter } : {}),
|
|
817
|
+
...(data.autoMergeLabel != null ? { autoMergeLabel: data.autoMergeLabel } : {})
|
|
770
818
|
}).pipe(
|
|
771
819
|
Effect.tapError((err) => notifier.sendMessage(`Failed to create project: ${err.message}`)),
|
|
772
820
|
Effect.orElseSucceed(() => undefined)
|
|
773
821
|
)
|
|
774
|
-
yield* notifier.sendMessage(`Project <b>${
|
|
822
|
+
yield* notifier.sendMessage(`Project <b>${name}</b> created.`)
|
|
775
823
|
if (state.continueWithPlan) {
|
|
776
824
|
yield* notifier.sendMessage({
|
|
777
825
|
text: "What type of change?",
|
|
778
826
|
options: [...PLAN_TYPE_LABELS.map((label) => ({ label })), { label: ABORT_BUTTON_LABEL }]
|
|
779
827
|
})
|
|
780
|
-
return reply(ChatState.SelectingPlanType({ projectId:
|
|
828
|
+
return reply(ChatState.SelectingPlanType({ projectId: name }))
|
|
781
829
|
}
|
|
782
830
|
yield* notifier.sendMessage({ text: "Ready.", replyKeyboard: IDLE_KEYBOARD })
|
|
783
831
|
return reply(ChatState.Idle())
|
|
@@ -73,9 +73,9 @@ export const TelegramAdapterLive = Layer.scoped(
|
|
|
73
73
|
}).pipe(Effect.fork)
|
|
74
74
|
|
|
75
75
|
yield* Effect.addFinalizer(() =>
|
|
76
|
-
Effect.
|
|
76
|
+
Effect.try(() => {
|
|
77
77
|
bot.stop("shutdown")
|
|
78
|
-
})
|
|
78
|
+
}).pipe(Effect.ignore)
|
|
79
79
|
)
|
|
80
80
|
|
|
81
81
|
const sendMessage = (message: string | OutgoingMessage) =>
|
|
@@ -111,8 +111,7 @@ interface ActiveSession {
|
|
|
111
111
|
export interface PlanSessionService {
|
|
112
112
|
readonly start: (
|
|
113
113
|
planText: string,
|
|
114
|
-
projectId?: string | undefined
|
|
115
|
-
labelFilter?: string | undefined
|
|
114
|
+
projectId?: string | undefined
|
|
116
115
|
) => Effect.Effect<void, PlanSessionError>
|
|
117
116
|
readonly answer: (text: string) => Effect.Effect<void, PlanSessionError>
|
|
118
117
|
readonly sendFollowUp: (text: string) => Effect.Effect<void, PlanSessionError>
|
|
@@ -200,7 +199,10 @@ export const PlanSessionLive = Layer.scoped(
|
|
|
200
199
|
|
|
201
200
|
yield* Effect.addFinalizer(() => closeActiveSession)
|
|
202
201
|
|
|
203
|
-
const start = (
|
|
202
|
+
const start = (
|
|
203
|
+
planText: string,
|
|
204
|
+
projectId?: string | undefined
|
|
205
|
+
) =>
|
|
204
206
|
Effect.gen(function*() {
|
|
205
207
|
const current = yield* Ref.get(sessionRef)
|
|
206
208
|
if (Option.isSome(current)) {
|
|
@@ -255,9 +257,8 @@ export const PlanSessionLive = Layer.scoped(
|
|
|
255
257
|
if (projectId != null) {
|
|
256
258
|
const encoder = new TextEncoder()
|
|
257
259
|
yield* Queue.offer(stdinQueue, encoder.encode(projectId + "\n"))
|
|
258
|
-
yield*
|
|
259
|
-
|
|
260
|
-
Effect.annotateLogs({ projectId, labelFilter: labelFilter ?? "(empty)" })
|
|
260
|
+
yield* Effect.log("Pre-answered project selection").pipe(
|
|
261
|
+
Effect.annotateLogs({ projectId })
|
|
261
262
|
)
|
|
262
263
|
}
|
|
263
264
|
|
|
@@ -2,9 +2,9 @@
|
|
|
2
2
|
* Project store — reads/writes lalph project configuration
|
|
3
3
|
* @since 1.0.0
|
|
4
4
|
*/
|
|
5
|
-
import { FileSystem, Path } from "@effect/platform"
|
|
5
|
+
import { Command, CommandExecutor, FileSystem, Path } from "@effect/platform"
|
|
6
6
|
import type { Option } from "effect"
|
|
7
|
-
import { Context, Data, Effect, Layer, Schema } from "effect"
|
|
7
|
+
import { Context, Data, Duration, Effect, Layer, Schema, Stream } from "effect"
|
|
8
8
|
import { LalphProject } from "../schemas/ProjectSchemas.js"
|
|
9
9
|
import { AppContext } from "./AppContext.js"
|
|
10
10
|
|
|
@@ -30,6 +30,8 @@ export interface ProjectStoreService {
|
|
|
30
30
|
readonly concurrency: number
|
|
31
31
|
readonly gitFlow: "pr" | "commit"
|
|
32
32
|
readonly reviewAgent: boolean
|
|
33
|
+
readonly labelFilter?: string
|
|
34
|
+
readonly autoMergeLabel?: string
|
|
33
35
|
}) => Effect.Effect<LalphProject, ProjectStoreError>
|
|
34
36
|
}
|
|
35
37
|
|
|
@@ -44,6 +46,9 @@ export class ProjectStore extends Context.Tag("ProjectStore")<
|
|
|
44
46
|
|
|
45
47
|
const ProjectsArray = Schema.Array(LalphProject)
|
|
46
48
|
|
|
49
|
+
// Arrow down escape sequence for Prompt.select navigation
|
|
50
|
+
const ARROW_DOWN = "\x1b[B"
|
|
51
|
+
|
|
47
52
|
/**
|
|
48
53
|
* @since 1.0.0
|
|
49
54
|
* @category layers
|
|
@@ -54,6 +59,7 @@ export const ProjectStoreLive = Layer.effect(
|
|
|
54
59
|
const fs = yield* FileSystem.FileSystem
|
|
55
60
|
const pathService = yield* Path.Path
|
|
56
61
|
const appContext = yield* AppContext
|
|
62
|
+
const executor = yield* CommandExecutor.CommandExecutor
|
|
57
63
|
|
|
58
64
|
const filePath = pathService.join(appContext.configDir, "settings.projects")
|
|
59
65
|
|
|
@@ -105,34 +111,90 @@ export const ProjectStoreLive = Layer.effect(
|
|
|
105
111
|
readonly concurrency: number
|
|
106
112
|
readonly gitFlow: "pr" | "commit"
|
|
107
113
|
readonly reviewAgent: boolean
|
|
114
|
+
readonly labelFilter?: string
|
|
115
|
+
readonly autoMergeLabel?: string
|
|
108
116
|
}) =>
|
|
109
117
|
Effect.gen(function*() {
|
|
110
|
-
const
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
targetBranch
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
118
|
+
const encoder = new TextEncoder()
|
|
119
|
+
const stdinLines: Array<string> = [
|
|
120
|
+
data.id,
|
|
121
|
+
String(data.concurrency),
|
|
122
|
+
data.targetBranch._tag === "Some" ? data.targetBranch.value : "",
|
|
123
|
+
data.gitFlow === "commit" ? ARROW_DOWN : "",
|
|
124
|
+
data.reviewAgent ? "" : "0",
|
|
125
|
+
data.labelFilter ?? "",
|
|
126
|
+
data.autoMergeLabel ?? ""
|
|
127
|
+
]
|
|
128
|
+
// Send each line with a delay so each Prompt has time to set up its keypress listener.
|
|
129
|
+
// Each Effect Prompt creates a new keypress listener — events arriving before
|
|
130
|
+
// the listener is ready are lost.
|
|
131
|
+
const stdinStream = Stream.fromIterable(stdinLines).pipe(
|
|
132
|
+
Stream.mapEffect((line) =>
|
|
133
|
+
Effect.gen(function*() {
|
|
134
|
+
yield* Effect.sleep(Duration.millis(500))
|
|
135
|
+
return encoder.encode(line + "\n")
|
|
136
|
+
})
|
|
123
137
|
)
|
|
124
138
|
)
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
)
|
|
139
|
+
|
|
140
|
+
const cmd = Command.make("lalph", "projects", "add").pipe(
|
|
141
|
+
Command.workingDirectory(appContext.projectRoot),
|
|
142
|
+
Command.stdout("pipe"),
|
|
143
|
+
Command.stderr("pipe"),
|
|
144
|
+
Command.stdin("pipe")
|
|
129
145
|
)
|
|
130
|
-
|
|
146
|
+
|
|
147
|
+
yield* Effect.scoped(
|
|
148
|
+
Effect.gen(function*() {
|
|
149
|
+
const process = yield* Command.start(cmd).pipe(
|
|
150
|
+
Effect.provideService(CommandExecutor.CommandExecutor, executor)
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
yield* stdinStream.pipe(
|
|
154
|
+
Stream.run(process.stdin),
|
|
155
|
+
Effect.forkDaemon
|
|
156
|
+
)
|
|
157
|
+
|
|
158
|
+
// Drain stdout so the process doesn't block when the pipe buffer fills
|
|
159
|
+
yield* process.stdout.pipe(Stream.runDrain, Effect.forkDaemon)
|
|
160
|
+
|
|
161
|
+
const exitCode = yield* process.exitCode
|
|
162
|
+
if (exitCode !== 0) {
|
|
163
|
+
const stderr = yield* process.stderr.pipe(
|
|
164
|
+
Stream.map((chunk) => new TextDecoder().decode(chunk)),
|
|
165
|
+
Stream.runCollect,
|
|
166
|
+
Effect.map((chunks) => [...chunks].join(""))
|
|
167
|
+
)
|
|
168
|
+
return yield* Effect.fail(
|
|
169
|
+
new ProjectStoreError({
|
|
170
|
+
message: `lalph projects add failed (exit ${exitCode}): ${stderr}`,
|
|
171
|
+
cause: null
|
|
172
|
+
})
|
|
173
|
+
)
|
|
174
|
+
}
|
|
175
|
+
})
|
|
176
|
+
).pipe(
|
|
131
177
|
Effect.mapError((err) =>
|
|
132
|
-
|
|
178
|
+
err instanceof ProjectStoreError
|
|
179
|
+
? err
|
|
180
|
+
: new ProjectStoreError({ message: `Failed to create project: ${String(err)}`, cause: err })
|
|
133
181
|
)
|
|
134
182
|
)
|
|
135
|
-
|
|
183
|
+
|
|
184
|
+
yield* Effect.log("Project created via lalph projects add").pipe(
|
|
185
|
+
Effect.annotateLogs({ projectId: data.id })
|
|
186
|
+
)
|
|
187
|
+
|
|
188
|
+
return new LalphProject({
|
|
189
|
+
id: data.id,
|
|
190
|
+
enabled: true,
|
|
191
|
+
targetBranch: data.targetBranch,
|
|
192
|
+
concurrency: data.concurrency,
|
|
193
|
+
gitFlow: data.gitFlow,
|
|
194
|
+
reviewAgent: data.reviewAgent,
|
|
195
|
+
...(data.labelFilter != null ? { labelFilter: data.labelFilter } : {}),
|
|
196
|
+
...(data.autoMergeLabel != null ? { autoMergeLabel: data.autoMergeLabel } : {})
|
|
197
|
+
})
|
|
136
198
|
})
|
|
137
199
|
|
|
138
200
|
return ProjectStore.of({ listProjects, getProject, createProject })
|
package/src/shim/parseArgs.ts
CHANGED
|
@@ -20,7 +20,7 @@ export function parseArgs(args: ReadonlyArray<string>): ParsedArgs {
|
|
|
20
20
|
skipNext = false
|
|
21
21
|
continue
|
|
22
22
|
}
|
|
23
|
-
const arg = args[i]
|
|
23
|
+
const arg = args[i] ?? ""
|
|
24
24
|
if (arg === "--dangerously-skip-permissions") {
|
|
25
25
|
dangerouslySkipPermissions = true
|
|
26
26
|
} else if (arg === "--output-format") {
|