@oisincoveney/pipeline 2.8.0 → 2.8.2

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.
Files changed (38) hide show
  1. package/dist/argo-submit.d.ts +2 -4
  2. package/dist/argo-submit.js +80 -80
  3. package/dist/cluster-doctor.js +89 -101
  4. package/dist/config/defaults.js +9 -19
  5. package/dist/config/load.js +32 -39
  6. package/dist/config/schemas.d.ts +1 -1
  7. package/dist/gates.js +6 -225
  8. package/dist/mcp/gateway-error.js +15 -0
  9. package/dist/mcp/gateway.js +119 -220
  10. package/dist/moka-global-config.js +20 -20
  11. package/dist/moka-submit.d.ts +1 -1
  12. package/dist/pipeline-runtime.js +580 -371
  13. package/dist/run-state/git-refs.js +124 -94
  14. package/dist/runner-command-contract.d.ts +2 -2
  15. package/dist/runner-event-sink.js +37 -69
  16. package/dist/runtime/agent-node/agent-node.js +214 -173
  17. package/dist/runtime/builtins/builtins.js +344 -57
  18. package/dist/runtime/changed-files/changed-files.js +15 -27
  19. package/dist/runtime/changed-files/index.js +2 -0
  20. package/dist/runtime/drain-merge/drain-merge.js +124 -82
  21. package/dist/runtime/gates/gates.js +46 -28
  22. package/dist/runtime/hooks/hooks.js +74 -29
  23. package/dist/runtime/opencode-server.js +27 -21
  24. package/dist/runtime/opencode-session-executor.js +101 -44
  25. package/dist/runtime/parallel-node/parallel-node.js +24 -5
  26. package/dist/runtime/select-candidate/select-candidate.js +45 -29
  27. package/dist/runtime/services/agent-node-runtime-service.js +15 -0
  28. package/dist/runtime/services/command-executor-service.js +8 -0
  29. package/dist/runtime/services/config-io-service.js +42 -0
  30. package/dist/runtime/services/drain-merge-git-service.js +10 -0
  31. package/dist/runtime/services/git-porcelain-service.js +38 -0
  32. package/dist/runtime/services/kubernetes-argo-service.d.ts +13 -0
  33. package/dist/runtime/services/kubernetes-argo-service.js +81 -0
  34. package/dist/runtime/services/mcp-gateway-service.js +184 -0
  35. package/dist/runtime/services/opencode-sdk-service.js +27 -0
  36. package/dist/runtime/services/runner-event-sink-http-service.js +80 -0
  37. package/dist/runtime/services/select-candidate-service.js +13 -0
  38. package/package.json +1 -1
@@ -1,8 +1,8 @@
1
1
  import { PipelineConfigError } from "./config/schemas.js";
2
+ import { ConfigIoService, runConfigIoSync } from "./runtime/services/config-io-service.js";
2
3
  import "./config.js";
3
- import { parseDocument } from "yaml";
4
4
  import { z } from "zod";
5
- import { existsSync, readFileSync } from "node:fs";
5
+ import { Effect } from "effect";
6
6
  import { join } from "node:path";
7
7
  import { homedir } from "node:os";
8
8
  //#region src/moka-global-config.ts
@@ -30,27 +30,27 @@ function mokaGlobalConfigPath(homeDir = homedir()) {
30
30
  }
31
31
  function loadMokaGlobalConfig() {
32
32
  const configPath = mokaGlobalConfigPath();
33
- if (!existsSync(configPath)) return null;
34
- return parseMokaGlobalConfig(readFileSync(configPath, "utf8"), configPath);
33
+ return runConfigIoSync(Effect.gen(function* () {
34
+ const source = yield* (yield* ConfigIoService).readOptionalText(configPath);
35
+ return source === null ? null : yield* parseMokaGlobalConfigEffect(source, configPath);
36
+ }));
35
37
  }
36
38
  function parseMokaGlobalConfig(source, sourcePath) {
37
- const document = parseDocument(source, {
38
- prettyErrors: false,
39
- uniqueKeys: true
39
+ return runConfigIoSync(parseMokaGlobalConfigEffect(source, sourcePath));
40
+ }
41
+ function parseMokaGlobalConfigEffect(source, sourcePath) {
42
+ return Effect.gen(function* () {
43
+ const yaml = yield* (yield* ConfigIoService).parseYaml(source, sourcePath);
44
+ const parsed = mokaGlobalConfigSchema.safeParse(yaml);
45
+ if (!parsed.success) {
46
+ const issues = parsed.error.issues.map((issue) => ({
47
+ path: issue.path.join("."),
48
+ message: issue.message
49
+ }));
50
+ return yield* Effect.fail(new PipelineConfigError("PIPELINE_CONFIG_VALIDATION_ERROR", [`Invalid ${sourcePath}:`, ...issues.map((issue) => issue.path ? `- ${issue.path}: ${issue.message}` : `- ${issue.message}`)].join("\n"), issues));
51
+ }
52
+ return parsed.data;
40
53
  });
41
- if (document.errors.length > 0) throw new PipelineConfigError("PIPELINE_CONFIG_PARSE_ERROR", `Failed to parse ${sourcePath}`, document.errors.map((err) => ({
42
- message: err.message,
43
- path: sourcePath
44
- })));
45
- const parsed = mokaGlobalConfigSchema.safeParse(document.toJS());
46
- if (!parsed.success) {
47
- const issues = parsed.error.issues.map((issue) => ({
48
- path: issue.path.join("."),
49
- message: issue.message
50
- }));
51
- throw new PipelineConfigError("PIPELINE_CONFIG_VALIDATION_ERROR", [`Invalid ${sourcePath}:`, ...issues.map((issue) => issue.path ? `- ${issue.path}: ${issue.message}` : `- ${issue.message}`)].join("\n"), issues);
52
- }
53
- return parsed.data;
54
54
  }
55
55
  //#endregion
56
56
  export { MOKA_GLOBAL_CONFIG_PATH, loadMokaGlobalConfig, mokaGlobalConfigPath, mokaGlobalConfigSchema, parseMokaGlobalConfig };
@@ -160,8 +160,8 @@ declare const mokaSubmitOptionsSchema: z.ZodDiscriminatedUnion<[z.ZodObject<{
160
160
  }, z.core.$strict>>;
161
161
  serviceAccountName: z.ZodOptional<z.ZodString>;
162
162
  mode: z.ZodEnum<{
163
- quick: "quick";
164
163
  full: "full";
164
+ quick: "quick";
165
165
  }>;
166
166
  schedulePath: z.ZodOptional<z.ZodString>;
167
167
  scheduleYaml: z.ZodOptional<z.ZodString>;