@chernabog/sdk 0.0.0-stage → 0.2.0
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 +69 -2
- package/package.json +22 -4
- package/src/errors.ts +33 -0
- package/src/flow.ts +155 -0
- package/src/implement.ts +502 -0
- package/src/index.ts +10 -0
- package/src/json.ts +18 -0
- package/src/markers.ts +39 -0
- package/src/paths.ts +38 -0
- package/src/prompt.ts +37 -0
- package/src/review.ts +400 -0
- package/src/services.ts +281 -0
- package/src/stage.ts +25 -0
package/src/stage.ts
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// A step a team writes as Effect code in .chernabog/stages/<name>.ts. It runs
|
|
2
|
+
// in a child process, gets its input checked against `input` and its output
|
|
3
|
+
// against `output`. A step that crashes partway runs again, so it must be safe
|
|
4
|
+
// to repeat: "claim unless this run already holds it".
|
|
5
|
+
|
|
6
|
+
import type * as Effect from 'effect/Effect';
|
|
7
|
+
import type * as Schema from 'effect/Schema';
|
|
8
|
+
|
|
9
|
+
import type { Json } from './json.ts';
|
|
10
|
+
import type { Agent, Git, GitHub, Repo, Run, RunLog, Usage, Worktree } from './services.ts';
|
|
11
|
+
|
|
12
|
+
export type StageServices = Repo | Run | GitHub | Git | Worktree | Usage | Agent | RunLog;
|
|
13
|
+
|
|
14
|
+
export type Stage<I, O, E> = {
|
|
15
|
+
readonly name: string;
|
|
16
|
+
// Both cross a process boundary as JSON.
|
|
17
|
+
readonly input: Schema.Codec<I, Json>;
|
|
18
|
+
readonly output: Schema.Codec<O, Json>;
|
|
19
|
+
readonly run: (input: I) => Effect.Effect<O, E, StageServices>;
|
|
20
|
+
};
|
|
21
|
+
|
|
22
|
+
export const defineStage = <I, O, E>(stage: Stage<I, O, E>): Stage<I, O, E> => stage;
|
|
23
|
+
|
|
24
|
+
// What a step's process says on exit: 0 to continue, 78 to skip, anything else to fail.
|
|
25
|
+
export const STEP_EXIT = { ok: 0, skip: 78 } as const;
|