@mannyc1/ts-release 0.0.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 +249 -0
- package/SPEC.md +254 -0
- package/dist/cli/command.d.ts +4 -0
- package/dist/cli/command.d.ts.map +1 -0
- package/dist/cli/command.js +90 -0
- package/dist/cli/command.js.map +1 -0
- package/dist/cli/main.d.ts +3 -0
- package/dist/cli/main.d.ts.map +1 -0
- package/dist/cli/main.js +12 -0
- package/dist/cli/main.js.map +1 -0
- package/dist/cli/programmatic.d.ts +25 -0
- package/dist/cli/programmatic.d.ts.map +1 -0
- package/dist/cli/programmatic.js +48 -0
- package/dist/cli/programmatic.js.map +1 -0
- package/dist/config/errors.d.ts +23 -0
- package/dist/config/errors.d.ts.map +1 -0
- package/dist/config/errors.js +18 -0
- package/dist/config/errors.js.map +1 -0
- package/dist/config/load.d.ts +9 -0
- package/dist/config/load.d.ts.map +1 -0
- package/dist/config/load.js +27 -0
- package/dist/config/load.js.map +1 -0
- package/dist/config/schema.d.ts +8 -0
- package/dist/config/schema.d.ts.map +1 -0
- package/dist/config/schema.js +6 -0
- package/dist/config/schema.js.map +1 -0
- package/dist/domain/artifact.d.ts +36 -0
- package/dist/domain/artifact.d.ts.map +1 -0
- package/dist/domain/artifact.js +29 -0
- package/dist/domain/artifact.js.map +1 -0
- package/dist/domain/evidence.d.ts +58 -0
- package/dist/domain/evidence.d.ts.map +1 -0
- package/dist/domain/evidence.js +50 -0
- package/dist/domain/evidence.js.map +1 -0
- package/dist/domain/operation.d.ts +98 -0
- package/dist/domain/operation.d.ts.map +1 -0
- package/dist/domain/operation.js +133 -0
- package/dist/domain/operation.js.map +1 -0
- package/dist/domain/release.d.ts +66 -0
- package/dist/domain/release.d.ts.map +1 -0
- package/dist/domain/release.js +56 -0
- package/dist/domain/release.js.map +1 -0
- package/dist/domain/target.d.ts +75 -0
- package/dist/domain/target.d.ts.map +1 -0
- package/dist/domain/target.js +67 -0
- package/dist/domain/target.js.map +1 -0
- package/dist/host/bun.d.ts +9 -0
- package/dist/host/bun.d.ts.map +1 -0
- package/dist/host/bun.js +156 -0
- package/dist/host/bun.js.map +1 -0
- package/dist/host/host.d.ts +47 -0
- package/dist/host/host.d.ts.map +1 -0
- package/dist/host/host.js +42 -0
- package/dist/host/host.js.map +1 -0
- package/dist/host/test.d.ts +19 -0
- package/dist/host/test.d.ts.map +1 -0
- package/dist/host/test.js +76 -0
- package/dist/host/test.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +2 -0
- package/dist/index.js.map +1 -0
- package/dist/planner/create-release-plan.d.ts +5 -0
- package/dist/planner/create-release-plan.d.ts.map +1 -0
- package/dist/planner/create-release-plan.js +25 -0
- package/dist/planner/create-release-plan.js.map +1 -0
- package/dist/planner/errors.d.ts +37 -0
- package/dist/planner/errors.d.ts.map +1 -0
- package/dist/planner/errors.js +30 -0
- package/dist/planner/errors.js.map +1 -0
- package/dist/planner/evidence-recorder.d.ts +18 -0
- package/dist/planner/evidence-recorder.d.ts.map +1 -0
- package/dist/planner/evidence-recorder.js +95 -0
- package/dist/planner/evidence-recorder.js.map +1 -0
- package/dist/planner/executor.d.ts +19 -0
- package/dist/planner/executor.d.ts.map +1 -0
- package/dist/planner/executor.js +59 -0
- package/dist/planner/executor.js.map +1 -0
- package/dist/planner/normalize-release.d.ts +7 -0
- package/dist/planner/normalize-release.d.ts.map +1 -0
- package/dist/planner/normalize-release.js +101 -0
- package/dist/planner/normalize-release.js.map +1 -0
- package/dist/planner/render-plan.d.ts +5 -0
- package/dist/planner/render-plan.d.ts.map +1 -0
- package/dist/planner/render-plan.js +49 -0
- package/dist/planner/render-plan.js.map +1 -0
- package/dist/targets/adapter.d.ts +15 -0
- package/dist/targets/adapter.d.ts.map +1 -0
- package/dist/targets/adapter.js +2 -0
- package/dist/targets/adapter.js.map +1 -0
- package/dist/targets/github.d.ts +11 -0
- package/dist/targets/github.d.ts.map +1 -0
- package/dist/targets/github.js +174 -0
- package/dist/targets/github.js.map +1 -0
- package/dist/targets/homebrew.d.ts +11 -0
- package/dist/targets/homebrew.d.ts.map +1 -0
- package/dist/targets/homebrew.js +153 -0
- package/dist/targets/homebrew.js.map +1 -0
- package/dist/targets/live.d.ts +5 -0
- package/dist/targets/live.d.ts.map +1 -0
- package/dist/targets/live.js +31 -0
- package/dist/targets/live.js.map +1 -0
- package/dist/targets/npm.d.ts +11 -0
- package/dist/targets/npm.d.ts.map +1 -0
- package/dist/targets/npm.js +105 -0
- package/dist/targets/npm.js.map +1 -0
- package/dist/targets/registry.d.ts +25 -0
- package/dist/targets/registry.d.ts.map +1 -0
- package/dist/targets/registry.js +34 -0
- package/dist/targets/registry.js.map +1 -0
- package/dist/types/effect-internal.d.ts +5 -0
- package/dist/types/effect-internal.d.ts.map +1 -0
- package/dist/types/effect-internal.js +2 -0
- package/dist/types/effect-internal.js.map +1 -0
- package/examples/README.md +15 -0
- package/examples/github-release/artifacts/release-example-github-0.1.0.tgz +1 -0
- package/examples/github-release/release.config.json +31 -0
- package/examples/homebrew-tap/artifacts/release-example-homebrew-0.1.0.tgz +1 -0
- package/examples/homebrew-tap/release.config.json +34 -0
- package/examples/non-strict-skips/artifacts/release-example-skips-0.1.0.tgz +1 -0
- package/examples/non-strict-skips/release.config.json +29 -0
- package/examples/npm-only/index.js +1 -0
- package/examples/npm-only/package.json +8 -0
- package/examples/npm-only/release.config.json +30 -0
- package/package.json +176 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"programmatic.d.ts","sourceRoot":"","sources":["../../src/cli/programmatic.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAA;AAQlD,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,2BAA2B,UAAU,CAAA;AAElD,eAAO,MAAM,iBAAiB,4CAAoC,CAAA;AAClE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;;;;;AAE7D,qBAAa,iBAAkB,SAAQ,sBAGrC;CAAG;;;;;;AAEL,qBAAa,wBAAyB,SAAQ,6BAI5C;CAAG;AAoBL,eAAO,MAAM,iBAAiB,kZAM5B,CAAA;AAEF,eAAO,MAAM,uBAAuB,6YAOlC,CAAA;AAEF,eAAO,MAAM,aAAa,mnBAOxB,CAAA;AAEF,MAAM,MAAM,uBAAuB,GAAG,WAAW,CAAA"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import * as BunServices from "@effect/platform-bun/BunServices";
|
|
2
|
+
import * as Effect from "effect/Effect";
|
|
3
|
+
import * as Layer from "effect/Layer";
|
|
4
|
+
import * as Schema from "effect/Schema";
|
|
5
|
+
import * as Command from "effect/unstable/cli/Command";
|
|
6
|
+
import { parseReleaseIntent } from "../config/load.js";
|
|
7
|
+
import { DEFAULT_CONFIG_PATH } from "../config/schema.js";
|
|
8
|
+
import { makeBunReleaseHostLayer } from "../host/bun.js";
|
|
9
|
+
import { ReleaseHost } from "../host/host.js";
|
|
10
|
+
import { createReleasePlan } from "../planner/create-release-plan.js";
|
|
11
|
+
import { renderPlanJson, renderPlanText } from "../planner/render-plan.js";
|
|
12
|
+
import { LiveTargetRegistryLayer } from "../targets/live.js";
|
|
13
|
+
import { cli } from "./command.js";
|
|
14
|
+
export const DEFAULT_RELEASE_CLI_VERSION = "0.0.0";
|
|
15
|
+
export const ReleasePlanFormat = Schema.Literals(["json", "text"]);
|
|
16
|
+
export class ReleaseCliOptions extends Schema.Class("ReleaseCliOptions")({
|
|
17
|
+
root: Schema.optionalKey(Schema.String),
|
|
18
|
+
version: Schema.optionalKey(Schema.String)
|
|
19
|
+
}) {
|
|
20
|
+
}
|
|
21
|
+
export class PlanReleaseConfigOptions extends Schema.Class("PlanReleaseConfigOptions")({
|
|
22
|
+
root: Schema.optionalKey(Schema.String),
|
|
23
|
+
configPath: Schema.optionalKey(Schema.String),
|
|
24
|
+
format: Schema.optionalKey(ReleasePlanFormat)
|
|
25
|
+
}) {
|
|
26
|
+
}
|
|
27
|
+
const programmaticLayer = (root) => Layer.mergeAll(makeBunReleaseHostLayer({ root }), LiveTargetRegistryLayer, BunServices.layer);
|
|
28
|
+
const loadPlanFromOptions = Effect.fn("cli.programmatic.loadPlanFromOptions")(function* (options) {
|
|
29
|
+
const root = options.root ?? ".";
|
|
30
|
+
const configPath = options.configPath ?? DEFAULT_CONFIG_PATH;
|
|
31
|
+
const host = yield* ReleaseHost;
|
|
32
|
+
const contents = yield* host.readFileString(configPath);
|
|
33
|
+
const intent = yield* parseReleaseIntent(contents, configPath);
|
|
34
|
+
return yield* createReleasePlan(intent, root, configPath);
|
|
35
|
+
});
|
|
36
|
+
export const planReleaseConfig = Effect.fn("planReleaseConfig")(function* (options = PlanReleaseConfigOptions.make({})) {
|
|
37
|
+
return yield* loadPlanFromOptions(options).pipe(Effect.provide(programmaticLayer(options.root)));
|
|
38
|
+
});
|
|
39
|
+
export const renderReleaseConfigPlan = Effect.fn("renderReleaseConfigPlan")(function* (options = PlanReleaseConfigOptions.make({})) {
|
|
40
|
+
const plan = yield* planReleaseConfig(options);
|
|
41
|
+
return (options.format ?? "text") === "json"
|
|
42
|
+
? renderPlanJson(plan)
|
|
43
|
+
: renderPlanText(plan);
|
|
44
|
+
});
|
|
45
|
+
export const runReleaseCli = Effect.fn("runReleaseCli")(function* (args, options = ReleaseCliOptions.make({})) {
|
|
46
|
+
yield* Command.runWith(cli, { version: options.version ?? DEFAULT_RELEASE_CLI_VERSION })([...args]).pipe(Effect.provide(programmaticLayer(options.root)));
|
|
47
|
+
});
|
|
48
|
+
//# sourceMappingURL=programmatic.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"programmatic.js","sourceRoot":"","sources":["../../src/cli/programmatic.ts"],"names":[],"mappings":"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AAC,CAAC,QAAQ,CAAC,EACnF,UAAoC,wBAAwB,CAAC,IAAI,CAAC,EAAE,CAAC;IAErE,MAAM,IAAI,GAAG,KAAK,CAAC,CAAC,iBAAiB,CAAC,OAAO,CAAC,CAAA;IAC9C,OAAO,CAAC,OAAO,CAAC,MAAM,IAAI,MAAM,CAAC,KAAK,MAAM;QAC1C,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC;QACtB,CAAC,CAAC,cAAc,CAAC,IAAI,CAAC,CAAA;AAC1B,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,aAAa,GAAG,MAAM,CAAC,EAAE,CAAC,eAAe,CAAC,CAAC,QAAQ,CAAC,EAC/D,IAA2B,EAC3B,UAA6B,iBAAiB,CAAC,IAAI,CAAC,EAAE,CAAC;IAEvD,KAAK,CAAC,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,OAAO,IAAI,2BAA2B,EAAE,CAAC,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC,CAAC,IAAI,CACtG,MAAM,CAAC,OAAO,CAAC,iBAAiB,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC,CAChD,CAAA;AACH,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export type * from "../types/effect-internal.js";
|
|
3
|
+
declare const ConfigReadError_base: Schema.Class<ConfigReadError, Schema.TaggedStruct<"ConfigReadError", {
|
|
4
|
+
readonly path: Schema.String;
|
|
5
|
+
readonly reason: Schema.String;
|
|
6
|
+
}>, import("effect/Cause").YieldableError>;
|
|
7
|
+
export declare class ConfigReadError extends ConfigReadError_base {
|
|
8
|
+
}
|
|
9
|
+
declare const ConfigParseError_base: Schema.Class<ConfigParseError, Schema.TaggedStruct<"ConfigParseError", {
|
|
10
|
+
readonly path: Schema.String;
|
|
11
|
+
readonly reason: Schema.String;
|
|
12
|
+
}>, import("effect/Cause").YieldableError>;
|
|
13
|
+
export declare class ConfigParseError extends ConfigParseError_base {
|
|
14
|
+
}
|
|
15
|
+
declare const ConfigValidationError_base: Schema.Class<ConfigValidationError, Schema.TaggedStruct<"ConfigValidationError", {
|
|
16
|
+
readonly path: Schema.String;
|
|
17
|
+
readonly reason: Schema.String;
|
|
18
|
+
}>, import("effect/Cause").YieldableError>;
|
|
19
|
+
export declare class ConfigValidationError extends ConfigValidationError_base {
|
|
20
|
+
}
|
|
21
|
+
export type ConfigError = ConfigReadError | ConfigParseError | ConfigValidationError;
|
|
22
|
+
export declare const formatUnknown: (cause: unknown) => string;
|
|
23
|
+
//# sourceMappingURL=errors.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.d.ts","sourceRoot":"","sources":["../../src/config/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,mBAAmB,6BAA6B,CAAA;;;;;AAEhD,qBAAa,eAAgB,SAAQ,oBAGnC;CAAG;;;;;AAEL,qBAAa,gBAAiB,SAAQ,qBAGpC;CAAG;;;;;AAEL,qBAAa,qBAAsB,SAAQ,0BAGzC;CAAG;AAEL,MAAM,MAAM,WAAW,GAAG,eAAe,GAAG,gBAAgB,GAAG,qBAAqB,CAAA;AAEpF,eAAO,MAAM,aAAa,GAAI,OAAO,OAAO,KAAG,MACS,CAAA"}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export class ConfigReadError extends Schema.TaggedErrorClass()("ConfigReadError", {
|
|
3
|
+
path: Schema.String,
|
|
4
|
+
reason: Schema.String
|
|
5
|
+
}) {
|
|
6
|
+
}
|
|
7
|
+
export class ConfigParseError extends Schema.TaggedErrorClass()("ConfigParseError", {
|
|
8
|
+
path: Schema.String,
|
|
9
|
+
reason: Schema.String
|
|
10
|
+
}) {
|
|
11
|
+
}
|
|
12
|
+
export class ConfigValidationError extends Schema.TaggedErrorClass()("ConfigValidationError", {
|
|
13
|
+
path: Schema.String,
|
|
14
|
+
reason: Schema.String
|
|
15
|
+
}) {
|
|
16
|
+
}
|
|
17
|
+
export const formatUnknown = (cause) => cause instanceof Error ? cause.message : String(cause);
|
|
18
|
+
//# sourceMappingURL=errors.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"errors.js","sourceRoot":"","sources":["../../src/config/errors.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,MAAM,OAAO,eAAgB,SAAQ,MAAM,CAAC,gBAAgB,EAAmB,CAAC,iBAAiB,EAAE;IACjG,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC;CAAG;AAEL,MAAM,OAAO,gBAAiB,SAAQ,MAAM,CAAC,gBAAgB,EAAoB,CAAC,kBAAkB,EAAE;IACpG,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC;CAAG;AAEL,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,gBAAgB,EAAyB,CAAC,uBAAuB,EAAE;IACnH,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,MAAM,CAAC,MAAM;CACtB,CAAC;CAAG;AAIL,MAAM,CAAC,MAAM,aAAa,GAAG,CAAC,KAAc,EAAU,EAAE,CACtD,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAA"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import { ReleaseIntent } from "../domain/release.js";
|
|
4
|
+
import { ConfigParseError, ConfigReadError, ConfigValidationError } from "./errors.js";
|
|
5
|
+
export type * from "../types/effect-internal.js";
|
|
6
|
+
export declare const parseReleaseIntent: (input: string, path?: string | undefined) => Effect.Effect<ReleaseIntent, ConfigParseError | ConfigValidationError, never>;
|
|
7
|
+
export declare const loadReleaseIntent: (path?: string | undefined) => Effect.Effect<ReleaseIntent, ConfigReadError | ConfigParseError | ConfigValidationError, FileSystem.FileSystem>;
|
|
8
|
+
export declare const encodeReleaseIntent: (intent: ReleaseIntent) => ReleaseIntent;
|
|
9
|
+
//# sourceMappingURL=load.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.d.ts","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AACpD,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAiB,MAAM,aAAa,CAAA;AAGrG,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,kBAAkB,6HAkB7B,CAAA;AAEF,eAAO,MAAM,iBAAiB,gJAY5B,CAAA;AAEF,eAAO,MAAM,mBAAmB,GAAI,QAAQ,aAAa,KAAG,aAAuB,CAAA"}
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as FileSystem from "effect/FileSystem";
|
|
3
|
+
import { ConfigParseError, ConfigReadError, ConfigValidationError, formatUnknown } from "./errors.js";
|
|
4
|
+
import { decodeReleaseConfig, DEFAULT_CONFIG_PATH } from "./schema.js";
|
|
5
|
+
export const parseReleaseIntent = Effect.fn("parseReleaseIntent")(function* (input, path = DEFAULT_CONFIG_PATH) {
|
|
6
|
+
const parsed = yield* Effect.try({
|
|
7
|
+
try: () => JSON.parse(input),
|
|
8
|
+
catch: (cause) => ConfigParseError.make({
|
|
9
|
+
path,
|
|
10
|
+
reason: formatUnknown(cause)
|
|
11
|
+
})
|
|
12
|
+
});
|
|
13
|
+
return yield* decodeReleaseConfig(parsed).pipe(Effect.mapError((error) => ConfigValidationError.make({
|
|
14
|
+
path,
|
|
15
|
+
reason: error.message
|
|
16
|
+
})));
|
|
17
|
+
});
|
|
18
|
+
export const loadReleaseIntent = Effect.fn("loadReleaseIntent")(function* (path = DEFAULT_CONFIG_PATH) {
|
|
19
|
+
const fs = yield* FileSystem.FileSystem;
|
|
20
|
+
const contents = yield* fs.readFileString(path).pipe(Effect.mapError((error) => ConfigReadError.make({
|
|
21
|
+
path,
|
|
22
|
+
reason: error.message
|
|
23
|
+
})));
|
|
24
|
+
return yield* parseReleaseIntent(contents, path);
|
|
25
|
+
});
|
|
26
|
+
export const encodeReleaseIntent = (intent) => intent;
|
|
27
|
+
//# sourceMappingURL=load.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"load.js","sourceRoot":"","sources":["../../src/config/load.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,UAAU,MAAM,mBAAmB,CAAA;AAE/C,OAAO,EAAE,gBAAgB,EAAE,eAAe,EAAE,qBAAqB,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AACrG,OAAO,EAAE,mBAAmB,EAAE,mBAAmB,EAAE,MAAM,aAAa,CAAA;AAItE,MAAM,CAAC,MAAM,kBAAkB,GAAG,MAAM,CAAC,EAAE,CAAC,oBAAoB,CAAC,CAAC,QAAQ,CAAC,EAAC,KAAa,EAAE,OAAe,mBAAmB;IAC3H,MAAM,MAAM,GAAY,KAAK,CAAC,CAAC,MAAM,CAAC,GAAG,CAAC;QACxC,GAAG,EAAE,GAAG,EAAE,CAAC,IAAI,CAAC,KAAK,CAAC,KAAK,CAAC;QAC5B,KAAK,EAAE,CAAC,KAAK,EAAE,EAAE,CACf,gBAAgB,CAAC,IAAI,CAAC;YACpB,IAAI;YACJ,MAAM,EAAE,aAAa,CAAC,KAAK,CAAC;SAC7B,CAAC;KACL,CAAC,CAAA;IAEF,OAAO,KAAK,CAAC,CAAC,mBAAmB,CAAC,MAAM,CAAC,CAAC,IAAI,CAC5C,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,qBAAqB,CAAC,IAAI,CAAC;QACzB,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,OAAO;KACtB,CAAC,CACH,CACF,CAAA;AACH,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,EAAE,CAAC,mBAAmB,CAAC,CAAC,QAAQ,CAAC,EAAC,OAAe,mBAAmB;IAC1G,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,UAAU,CAAC,UAAU,CAAA;IACvC,MAAM,QAAQ,GAAG,KAAK,CAAC,CAAC,EAAE,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC,IAAI,CAClD,MAAM,CAAC,QAAQ,CAAC,CAAC,KAAK,EAAE,EAAE,CACxB,eAAe,CAAC,IAAI,CAAC;QACnB,IAAI;QACJ,MAAM,EAAE,KAAK,CAAC,OAAO;KACtB,CAAC,CACH,CACF,CAAA;IAED,OAAO,KAAK,CAAC,CAAC,kBAAkB,CAAC,QAAQ,EAAE,IAAI,CAAC,CAAA;AAClD,CAAC,CAAC,CAAA;AAEF,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,MAAqB,EAAiB,EAAE,CAAC,MAAM,CAAA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { ReleaseIntent } from "../domain/release.js";
|
|
3
|
+
export type * from "../types/effect-internal.js";
|
|
4
|
+
export declare const DEFAULT_CONFIG_PATH = "release.config.json";
|
|
5
|
+
export declare const ReleaseConfig: typeof ReleaseIntent;
|
|
6
|
+
export type ReleaseConfig = typeof ReleaseConfig.Type;
|
|
7
|
+
export declare const decodeReleaseConfig: (input: unknown, options?: import("effect/SchemaAST").ParseOptions) => import("effect/Effect").Effect<ReleaseIntent, Schema.SchemaError, never>;
|
|
8
|
+
//# sourceMappingURL=schema.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.d.ts","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAEpD,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,mBAAmB,wBAAwB,CAAA;AAExD,eAAO,MAAM,aAAa,sBAAgB,CAAA;AAC1C,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;AAErD,eAAO,MAAM,mBAAmB,iJAA4C,CAAA"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { ReleaseIntent } from "../domain/release.js";
|
|
3
|
+
export const DEFAULT_CONFIG_PATH = "release.config.json";
|
|
4
|
+
export const ReleaseConfig = ReleaseIntent;
|
|
5
|
+
export const decodeReleaseConfig = Schema.decodeUnknownEffect(ReleaseConfig);
|
|
6
|
+
//# sourceMappingURL=schema.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"schema.js","sourceRoot":"","sources":["../../src/config/schema.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAA;AAIpD,MAAM,CAAC,MAAM,mBAAmB,GAAG,qBAAqB,CAAA;AAExD,MAAM,CAAC,MAAM,aAAa,GAAG,aAAa,CAAA;AAG1C,MAAM,CAAC,MAAM,mBAAmB,GAAG,MAAM,CAAC,mBAAmB,CAAC,aAAa,CAAC,CAAA"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export type * from "../types/effect-internal.js";
|
|
3
|
+
export declare const ArtifactId: Schema.String;
|
|
4
|
+
export type ArtifactId = typeof ArtifactId.Type;
|
|
5
|
+
export declare const ArtifactFormat: Schema.Literals<readonly ["tarball", "zip", "file", "directory", "oci-image"]>;
|
|
6
|
+
export type ArtifactFormat = typeof ArtifactFormat.Type;
|
|
7
|
+
export declare const ChecksumAlgorithm: Schema.Literals<readonly ["sha256", "sha512"]>;
|
|
8
|
+
export type ChecksumAlgorithm = typeof ChecksumAlgorithm.Type;
|
|
9
|
+
declare const Checksum_base: Schema.Class<Checksum, Schema.Struct<{
|
|
10
|
+
readonly algorithm: Schema.Literals<readonly ["sha256", "sha512"]>;
|
|
11
|
+
readonly value: Schema.String;
|
|
12
|
+
}>, {}>;
|
|
13
|
+
export declare class Checksum extends Checksum_base {
|
|
14
|
+
}
|
|
15
|
+
declare const ArtifactIntent_base: Schema.Class<ArtifactIntent, Schema.Struct<{
|
|
16
|
+
readonly id: Schema.String;
|
|
17
|
+
readonly path: Schema.String;
|
|
18
|
+
readonly format: Schema.Literals<readonly ["tarball", "zip", "file", "directory", "oci-image"]>;
|
|
19
|
+
readonly consumers: Schema.$Array<Schema.String>;
|
|
20
|
+
readonly checksum: Schema.optionalKey<typeof Checksum>;
|
|
21
|
+
}>, {}>;
|
|
22
|
+
export declare class ArtifactIntent extends ArtifactIntent_base {
|
|
23
|
+
}
|
|
24
|
+
declare const ArtifactInventoryItem_base: Schema.Class<ArtifactInventoryItem, Schema.Struct<{
|
|
25
|
+
readonly id: Schema.String;
|
|
26
|
+
readonly path: Schema.String;
|
|
27
|
+
readonly format: Schema.Literals<readonly ["tarball", "zip", "file", "directory", "oci-image"]>;
|
|
28
|
+
readonly consumers: Schema.$Array<Schema.String>;
|
|
29
|
+
readonly sizeBytes: Schema.Number;
|
|
30
|
+
readonly checksum: Schema.optionalKey<typeof Checksum>;
|
|
31
|
+
}>, {}>;
|
|
32
|
+
export declare class ArtifactInventoryItem extends ArtifactInventoryItem_base {
|
|
33
|
+
}
|
|
34
|
+
export declare const artifactIntentOrder: (left: ArtifactIntent, right: ArtifactIntent) => number;
|
|
35
|
+
export declare const artifactInventoryOrder: (left: ArtifactInventoryItem, right: ArtifactInventoryItem) => number;
|
|
36
|
+
//# sourceMappingURL=artifact.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.d.ts","sourceRoot":"","sources":["../../src/domain/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAEvC,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,UAAU,eAAgB,CAAA;AACvC,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;AAE/C,eAAO,MAAM,cAAc,gFAAwE,CAAA;AACnG,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;AAEvD,eAAO,MAAM,iBAAiB,gDAAwC,CAAA;AACtE,MAAM,MAAM,iBAAiB,GAAG,OAAO,iBAAiB,CAAC,IAAI,CAAA;;;;;AAE7D,qBAAa,QAAS,SAAQ,aAG5B;CAAG;;;;;;;;AAEL,qBAAa,cAAe,SAAQ,mBAMlC;CAAG;;;;;;;;;AAEL,qBAAa,qBAAsB,SAAQ,0BAOzC;CAAG;AAEL,eAAO,MAAM,mBAAmB,GAAI,MAAM,cAAc,EAAE,OAAO,cAAc,KAAG,MACjD,CAAA;AAEjC,eAAO,MAAM,sBAAsB,GACjC,MAAM,qBAAqB,EAC3B,OAAO,qBAAqB,KAC3B,MAAyC,CAAA"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
export const ArtifactId = Schema.String;
|
|
3
|
+
export const ArtifactFormat = Schema.Literals(["tarball", "zip", "file", "directory", "oci-image"]);
|
|
4
|
+
export const ChecksumAlgorithm = Schema.Literals(["sha256", "sha512"]);
|
|
5
|
+
export class Checksum extends Schema.Class("Checksum")({
|
|
6
|
+
algorithm: ChecksumAlgorithm,
|
|
7
|
+
value: Schema.String
|
|
8
|
+
}) {
|
|
9
|
+
}
|
|
10
|
+
export class ArtifactIntent extends Schema.Class("ArtifactIntent")({
|
|
11
|
+
id: ArtifactId,
|
|
12
|
+
path: Schema.String,
|
|
13
|
+
format: ArtifactFormat,
|
|
14
|
+
consumers: Schema.Array(Schema.String),
|
|
15
|
+
checksum: Schema.optionalKey(Checksum)
|
|
16
|
+
}) {
|
|
17
|
+
}
|
|
18
|
+
export class ArtifactInventoryItem extends Schema.Class("ArtifactInventoryItem")({
|
|
19
|
+
id: ArtifactId,
|
|
20
|
+
path: Schema.String,
|
|
21
|
+
format: ArtifactFormat,
|
|
22
|
+
consumers: Schema.Array(Schema.String),
|
|
23
|
+
sizeBytes: Schema.Number,
|
|
24
|
+
checksum: Schema.optionalKey(Checksum)
|
|
25
|
+
}) {
|
|
26
|
+
}
|
|
27
|
+
export const artifactIntentOrder = (left, right) => left.id.localeCompare(right.id);
|
|
28
|
+
export const artifactInventoryOrder = (left, right) => left.id.localeCompare(right.id);
|
|
29
|
+
//# sourceMappingURL=artifact.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"artifact.js","sourceRoot":"","sources":["../../src/domain/artifact.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAIvC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAA;AAGvC,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,SAAS,EAAE,KAAK,EAAE,MAAM,EAAE,WAAW,EAAE,WAAW,CAAC,CAAC,CAAA;AAGnG,MAAM,CAAC,MAAM,iBAAiB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAA;AAGtE,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,KAAK,CAAW,UAAU,CAAC,CAAC;IAC/D,SAAS,EAAE,iBAAiB;IAC5B,KAAK,EAAE,MAAM,CAAC,MAAM;CACrB,CAAC;CAAG;AAEL,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,KAAK,CAAiB,gBAAgB,CAAC,CAAC;IACjF,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;CACvC,CAAC;CAAG;AAEL,MAAM,OAAO,qBAAsB,SAAQ,MAAM,CAAC,KAAK,CAAwB,uBAAuB,CAAC,CAAC;IACtG,EAAE,EAAE,UAAU;IACd,IAAI,EAAE,MAAM,CAAC,MAAM;IACnB,MAAM,EAAE,cAAc;IACtB,SAAS,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,MAAM,CAAC;IACtC,SAAS,EAAE,MAAM,CAAC,MAAM;IACxB,QAAQ,EAAE,MAAM,CAAC,WAAW,CAAC,QAAQ,CAAC;CACvC,CAAC;CAAG;AAEL,MAAM,CAAC,MAAM,mBAAmB,GAAG,CAAC,IAAoB,EAAE,KAAqB,EAAU,EAAE,CACzF,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA;AAEjC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CACpC,IAA2B,EAC3B,KAA4B,EACpB,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,aAAa,CAAC,KAAK,CAAC,EAAE,CAAC,CAAA"}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { CommandSpec } from "./operation.js";
|
|
3
|
+
export type * from "../types/effect-internal.js";
|
|
4
|
+
export declare const EvidenceId: Schema.String;
|
|
5
|
+
export type EvidenceId = typeof EvidenceId.Type;
|
|
6
|
+
export declare const EvidenceSeverity: Schema.Literals<readonly ["info", "warning", "error"]>;
|
|
7
|
+
export type EvidenceSeverity = typeof EvidenceSeverity.Type;
|
|
8
|
+
export declare const EvidenceStatus: Schema.Literals<readonly ["passed", "failed", "skipped", "warning"]>;
|
|
9
|
+
export type EvidenceStatus = typeof EvidenceStatus.Type;
|
|
10
|
+
declare const CommandEvidence_base: Schema.Class<CommandEvidence, Schema.Struct<{
|
|
11
|
+
readonly id: Schema.String;
|
|
12
|
+
readonly operationId: Schema.String;
|
|
13
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
14
|
+
readonly status: Schema.Literals<readonly ["passed", "failed", "skipped", "warning"]>;
|
|
15
|
+
readonly severity: Schema.Literals<readonly ["info", "warning", "error"]>;
|
|
16
|
+
readonly command: typeof CommandSpec;
|
|
17
|
+
readonly exitCode: Schema.Number;
|
|
18
|
+
readonly stdout: Schema.String;
|
|
19
|
+
readonly stderr: Schema.String;
|
|
20
|
+
readonly startedAt: Schema.String;
|
|
21
|
+
readonly endedAt: Schema.String;
|
|
22
|
+
readonly durationMillis: Schema.Number;
|
|
23
|
+
}>, {}>;
|
|
24
|
+
export declare class CommandEvidence extends CommandEvidence_base {
|
|
25
|
+
}
|
|
26
|
+
declare const ValidationEvidence_base: Schema.Class<ValidationEvidence, Schema.Struct<{
|
|
27
|
+
readonly id: Schema.String;
|
|
28
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
29
|
+
readonly status: Schema.Literals<readonly ["passed", "failed", "skipped", "warning"]>;
|
|
30
|
+
readonly severity: Schema.Literals<readonly ["info", "warning", "error"]>;
|
|
31
|
+
readonly message: Schema.String;
|
|
32
|
+
readonly timestamp: Schema.String;
|
|
33
|
+
readonly skipped: Schema.Boolean;
|
|
34
|
+
}>, {}>;
|
|
35
|
+
export declare class ValidationEvidence extends ValidationEvidence_base {
|
|
36
|
+
}
|
|
37
|
+
declare const ExecutionEvidence_base: Schema.Class<ExecutionEvidence, Schema.Struct<{
|
|
38
|
+
readonly id: Schema.String;
|
|
39
|
+
readonly operationId: Schema.String;
|
|
40
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
41
|
+
readonly status: Schema.Literals<readonly ["passed", "failed", "skipped", "warning"]>;
|
|
42
|
+
readonly severity: Schema.Literals<readonly ["info", "warning", "error"]>;
|
|
43
|
+
readonly message: Schema.String;
|
|
44
|
+
readonly timestamp: Schema.String;
|
|
45
|
+
}>, {}>;
|
|
46
|
+
export declare class ExecutionEvidence extends ExecutionEvidence_base {
|
|
47
|
+
}
|
|
48
|
+
export declare const EvidenceRecord: Schema.Union<readonly [typeof CommandEvidence, typeof ValidationEvidence, typeof ExecutionEvidence]>;
|
|
49
|
+
export type EvidenceRecord = typeof EvidenceRecord.Type;
|
|
50
|
+
declare const EvidenceBundle_base: Schema.Class<EvidenceBundle, Schema.Struct<{
|
|
51
|
+
readonly schemaVersion: Schema.Literal<"release-evidence/v1">;
|
|
52
|
+
readonly releaseName: Schema.String;
|
|
53
|
+
readonly releaseVersion: Schema.String;
|
|
54
|
+
readonly records: Schema.$Array<Schema.Union<readonly [typeof CommandEvidence, typeof ValidationEvidence, typeof ExecutionEvidence]>>;
|
|
55
|
+
}>, {}>;
|
|
56
|
+
export declare class EvidenceBundle extends EvidenceBundle_base {
|
|
57
|
+
}
|
|
58
|
+
//# sourceMappingURL=evidence.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.d.ts","sourceRoot":"","sources":["../../src/domain/evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAe,MAAM,gBAAgB,CAAA;AAGzD,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,UAAU,eAAgB,CAAA;AACvC,MAAM,MAAM,UAAU,GAAG,OAAO,UAAU,CAAC,IAAI,CAAA;AAE/C,eAAO,MAAM,gBAAgB,wDAAgD,CAAA;AAC7E,MAAM,MAAM,gBAAgB,GAAG,OAAO,gBAAgB,CAAC,IAAI,CAAA;AAE3D,eAAO,MAAM,cAAc,sEAA8D,CAAA;AACzF,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;;;;;;;;;;;;;;;AAEvD,qBAAa,eAAgB,SAAQ,oBAanC;CAAG;;;;;;;;;;AAEL,qBAAa,kBAAmB,SAAQ,uBAQtC;CAAG;;;;;;;;;;AAEL,qBAAa,iBAAkB,SAAQ,sBAQrC;CAAG;AAEL,eAAO,MAAM,cAAc,sGAAyE,CAAA;AACpG,MAAM,MAAM,cAAc,GAAG,OAAO,cAAc,CAAC,IAAI,CAAA;;;;;;;AAEvD,qBAAa,cAAe,SAAQ,mBAKlC;CAAG"}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import * as Schema from "effect/Schema";
|
|
2
|
+
import { CommandSpec, OperationId } from "./operation.js";
|
|
3
|
+
import { TargetId } from "./target.js";
|
|
4
|
+
export const EvidenceId = Schema.String;
|
|
5
|
+
export const EvidenceSeverity = Schema.Literals(["info", "warning", "error"]);
|
|
6
|
+
export const EvidenceStatus = Schema.Literals(["passed", "failed", "skipped", "warning"]);
|
|
7
|
+
export class CommandEvidence extends Schema.Class("CommandEvidence")({
|
|
8
|
+
id: EvidenceId,
|
|
9
|
+
operationId: OperationId,
|
|
10
|
+
targetId: Schema.optionalKey(TargetId),
|
|
11
|
+
status: EvidenceStatus,
|
|
12
|
+
severity: EvidenceSeverity,
|
|
13
|
+
command: CommandSpec,
|
|
14
|
+
exitCode: Schema.Number,
|
|
15
|
+
stdout: Schema.String,
|
|
16
|
+
stderr: Schema.String,
|
|
17
|
+
startedAt: Schema.String,
|
|
18
|
+
endedAt: Schema.String,
|
|
19
|
+
durationMillis: Schema.Number
|
|
20
|
+
}) {
|
|
21
|
+
}
|
|
22
|
+
export class ValidationEvidence extends Schema.Class("ValidationEvidence")({
|
|
23
|
+
id: EvidenceId,
|
|
24
|
+
targetId: Schema.optionalKey(TargetId),
|
|
25
|
+
status: EvidenceStatus,
|
|
26
|
+
severity: EvidenceSeverity,
|
|
27
|
+
message: Schema.String,
|
|
28
|
+
timestamp: Schema.String,
|
|
29
|
+
skipped: Schema.Boolean
|
|
30
|
+
}) {
|
|
31
|
+
}
|
|
32
|
+
export class ExecutionEvidence extends Schema.Class("ExecutionEvidence")({
|
|
33
|
+
id: EvidenceId,
|
|
34
|
+
operationId: OperationId,
|
|
35
|
+
targetId: Schema.optionalKey(TargetId),
|
|
36
|
+
status: EvidenceStatus,
|
|
37
|
+
severity: EvidenceSeverity,
|
|
38
|
+
message: Schema.String,
|
|
39
|
+
timestamp: Schema.String
|
|
40
|
+
}) {
|
|
41
|
+
}
|
|
42
|
+
export const EvidenceRecord = Schema.Union([CommandEvidence, ValidationEvidence, ExecutionEvidence]);
|
|
43
|
+
export class EvidenceBundle extends Schema.Class("EvidenceBundle")({
|
|
44
|
+
schemaVersion: Schema.Literal("release-evidence/v1"),
|
|
45
|
+
releaseName: Schema.String,
|
|
46
|
+
releaseVersion: Schema.String,
|
|
47
|
+
records: Schema.Array(EvidenceRecord)
|
|
48
|
+
}) {
|
|
49
|
+
}
|
|
50
|
+
//# sourceMappingURL=evidence.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"evidence.js","sourceRoot":"","sources":["../../src/domain/evidence.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,WAAW,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAItC,MAAM,CAAC,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,CAAA;AAGvC,MAAM,CAAC,MAAM,gBAAgB,GAAG,MAAM,CAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,OAAO,CAAC,CAAC,CAAA;A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,MAAM;IACtB,SAAS,EAAE,MAAM,CAAC,MAAM;CACzB,CAAC;CAAG;AAEL,MAAM,CAAC,MAAM,cAAc,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,eAAe,EAAE,kBAAkB,EAAE,iBAAiB,CAAC,CAAC,CAAA;AAGpG,MAAM,OAAO,cAAe,SAAQ,MAAM,CAAC,KAAK,CAAiB,gBAAgB,CAAC,CAAC;IACjF,aAAa,EAAE,MAAM,CAAC,OAAO,CAAC,qBAAqB,CAAC;IACpD,WAAW,EAAE,MAAM,CAAC,MAAM;IAC1B,cAAc,EAAE,MAAM,CAAC,MAAM;IAC7B,OAAO,EAAE,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC;CACtC,CAAC;CAAG"}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
export type * from "../types/effect-internal.js";
|
|
4
|
+
export declare const OperationId: Schema.String;
|
|
5
|
+
export type OperationId = typeof OperationId.Type;
|
|
6
|
+
export declare const OperationRisk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
7
|
+
export type OperationRisk = typeof OperationRisk.Type;
|
|
8
|
+
declare const ExecutionGate_base: Schema.Class<ExecutionGate, Schema.Struct<{
|
|
9
|
+
readonly requiresExecute: Schema.Boolean;
|
|
10
|
+
readonly requiresIrreversibleApproval: Schema.Boolean;
|
|
11
|
+
readonly reason: Schema.String;
|
|
12
|
+
}>, {}>;
|
|
13
|
+
export declare class ExecutionGate extends ExecutionGate_base {
|
|
14
|
+
}
|
|
15
|
+
declare const CommandSpec_base: Schema.Class<CommandSpec, Schema.Struct<{
|
|
16
|
+
readonly executable: Schema.String;
|
|
17
|
+
readonly args: Schema.$Array<Schema.String>;
|
|
18
|
+
readonly cwd: Schema.optionalKey<Schema.String>;
|
|
19
|
+
readonly requiredEnv: Schema.$Array<Schema.String>;
|
|
20
|
+
readonly redactedEnv: Schema.$Array<Schema.String>;
|
|
21
|
+
}>, {}>;
|
|
22
|
+
export declare class CommandSpec extends CommandSpec_base {
|
|
23
|
+
}
|
|
24
|
+
declare const RenderFileOperation_base: Schema.Class<RenderFileOperation, Schema.TaggedStruct<"RenderFileOperation", {
|
|
25
|
+
readonly id: Schema.String;
|
|
26
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
27
|
+
readonly description: Schema.String;
|
|
28
|
+
readonly risk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
29
|
+
readonly gate: typeof ExecutionGate;
|
|
30
|
+
readonly path: Schema.String;
|
|
31
|
+
readonly contents: Schema.String;
|
|
32
|
+
}>, {}>;
|
|
33
|
+
export declare class RenderFileOperation extends RenderFileOperation_base {
|
|
34
|
+
}
|
|
35
|
+
declare const ValidateCommandOperation_base: Schema.Class<ValidateCommandOperation, Schema.TaggedStruct<"ValidateCommandOperation", {
|
|
36
|
+
readonly id: Schema.String;
|
|
37
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
38
|
+
readonly description: Schema.String;
|
|
39
|
+
readonly risk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
40
|
+
readonly gate: typeof ExecutionGate;
|
|
41
|
+
readonly command: typeof CommandSpec;
|
|
42
|
+
}>, {}>;
|
|
43
|
+
export declare class ValidateCommandOperation extends ValidateCommandOperation_base {
|
|
44
|
+
}
|
|
45
|
+
declare const ValidationNoteOperation_base: Schema.Class<ValidationNoteOperation, Schema.TaggedStruct<"ValidationNoteOperation", {
|
|
46
|
+
readonly id: Schema.String;
|
|
47
|
+
readonly targetId: Schema.optionalKey<Schema.String>;
|
|
48
|
+
readonly description: Schema.String;
|
|
49
|
+
readonly risk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
50
|
+
readonly gate: typeof ExecutionGate;
|
|
51
|
+
readonly message: Schema.String;
|
|
52
|
+
readonly skipped: Schema.Boolean;
|
|
53
|
+
readonly severity: Schema.Literals<readonly ["info", "warning"]>;
|
|
54
|
+
}>, {}>;
|
|
55
|
+
export declare class ValidationNoteOperation extends ValidationNoteOperation_base {
|
|
56
|
+
}
|
|
57
|
+
declare const PublishCommandOperation_base: Schema.Class<PublishCommandOperation, Schema.TaggedStruct<"PublishCommandOperation", {
|
|
58
|
+
readonly id: Schema.String;
|
|
59
|
+
readonly targetId: Schema.String;
|
|
60
|
+
readonly description: Schema.String;
|
|
61
|
+
readonly risk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
62
|
+
readonly gate: typeof ExecutionGate;
|
|
63
|
+
readonly command: typeof CommandSpec;
|
|
64
|
+
}>, {}>;
|
|
65
|
+
export declare class PublishCommandOperation extends PublishCommandOperation_base {
|
|
66
|
+
}
|
|
67
|
+
declare const VerifyRemoteOperation_base: Schema.Class<VerifyRemoteOperation, Schema.TaggedStruct<"VerifyRemoteOperation", {
|
|
68
|
+
readonly id: Schema.String;
|
|
69
|
+
readonly targetId: Schema.String;
|
|
70
|
+
readonly description: Schema.String;
|
|
71
|
+
readonly risk: Schema.Literals<readonly ["read-only", "writes-local", "externally-visible", "irreversible"]>;
|
|
72
|
+
readonly gate: typeof ExecutionGate;
|
|
73
|
+
readonly command: typeof CommandSpec;
|
|
74
|
+
}>, {}>;
|
|
75
|
+
export declare class VerifyRemoteOperation extends VerifyRemoteOperation_base {
|
|
76
|
+
}
|
|
77
|
+
export declare const Operation: Schema.Union<readonly [typeof RenderFileOperation, typeof ValidateCommandOperation, typeof ValidationNoteOperation, typeof PublishCommandOperation, typeof VerifyRemoteOperation]>;
|
|
78
|
+
export type Operation = typeof Operation.Type;
|
|
79
|
+
declare const ExecutionApproval_base: Schema.Class<ExecutionApproval, Schema.Struct<{
|
|
80
|
+
readonly execute: Schema.Boolean;
|
|
81
|
+
readonly approveIrreversible: Schema.Boolean;
|
|
82
|
+
}>, {}>;
|
|
83
|
+
export declare class ExecutionApproval extends ExecutionApproval_base {
|
|
84
|
+
static readonly none: ExecutionApproval;
|
|
85
|
+
}
|
|
86
|
+
declare const ExecutionApprovalError_base: Schema.Class<ExecutionApprovalError, Schema.TaggedStruct<"ExecutionApprovalError", {
|
|
87
|
+
readonly operationId: Schema.String;
|
|
88
|
+
readonly reason: Schema.String;
|
|
89
|
+
}>, import("effect/Cause").YieldableError>;
|
|
90
|
+
export declare class ExecutionApprovalError extends ExecutionApprovalError_base {
|
|
91
|
+
}
|
|
92
|
+
export declare const noApprovalGate: (reason: string) => ExecutionGate;
|
|
93
|
+
export declare const executeGate: (reason: string) => ExecutionGate;
|
|
94
|
+
export declare const irreversibleGate: (reason: string) => ExecutionGate;
|
|
95
|
+
export declare const canExecuteOperation: (operation: Operation, approval: ExecutionApproval) => boolean;
|
|
96
|
+
export declare const requireExecutionApproval: (operation: RenderFileOperation | ValidateCommandOperation | ValidationNoteOperation | PublishCommandOperation | VerifyRemoteOperation, approval: ExecutionApproval) => Effect.Effect<undefined, ExecutionApprovalError, never>;
|
|
97
|
+
export declare const operationOrder: (left: Operation, right: Operation) => number;
|
|
98
|
+
//# sourceMappingURL=operation.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.d.ts","sourceRoot":"","sources":["../../src/domain/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AAGvC,mBAAmB,6BAA6B,CAAA;AAEhD,eAAO,MAAM,WAAW,eAAgB,CAAA;AACxC,MAAM,MAAM,WAAW,GAAG,OAAO,WAAW,CAAC,IAAI,CAAA;AAEjD,eAAO,MAAM,aAAa,+FAAuF,CAAA;AACjH,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC,IAAI,CAAA;;;;;;AAErD,qBAAa,aAAc,SAAQ,kBAIjC;CAAG;;;;;;;;AAEL,qBAAa,WAAY,SAAQ,gBAM/B;CAAG;;;;;;;;;;AAEL,qBAAa,mBAAoB,SAAQ,wBAQvC;CAAG;;;;;;;;;AAEL,qBAAa,wBAAyB,SAAQ,6BAO5C;CAAG;;;;;;;;;;;AAEL,qBAAa,uBAAwB,SAAQ,4BAS3C;CAAG;;;;;;;;;AAEL,qBAAa,uBAAwB,SAAQ,4BAO3C;CAAG;;;;;;;;;AAEL,qBAAa,qBAAsB,SAAQ,0BAOzC;CAAG;AAEL,eAAO,MAAM,SAAS,oLAMpB,CAAA;AACF,MAAM,MAAM,SAAS,GAAG,OAAO,SAAS,CAAC,IAAI,CAAA;;;;;AAE7C,qBAAa,iBAAkB,SAAQ,sBAGrC;IACA,MAAM,CAAC,QAAQ,CAAC,IAAI,oBAGlB;CACH;;;;;AAED,qBAAa,sBAAuB,SAAQ,2BAM3C;CAAG;AAEJ,eAAO,MAAM,cAAc,GAAI,QAAQ,MAAM,KAAG,aAK5C,CAAA;AAEJ,eAAO,MAAM,WAAW,GAAI,QAAQ,MAAM,KAAG,aAKzC,CAAA;AAEJ,eAAO,MAAM,gBAAgB,GAAI,QAAQ,MAAM,KAAG,aAK9C,CAAA;AAEJ,eAAO,MAAM,mBAAmB,GAAI,WAAW,SAAS,EAAE,UAAU,iBAAiB,KAAG,OAevF,CAAA;AAED,eAAO,MAAM,wBAAwB,iOAmBnC,CAAA;AAEF,eAAO,MAAM,cAAc,GAAI,MAAM,SAAS,EAAE,OAAO,SAAS,KAAG,MAClC,CAAA"}
|
|
@@ -0,0 +1,133 @@
|
|
|
1
|
+
import * as Effect from "effect/Effect";
|
|
2
|
+
import * as Schema from "effect/Schema";
|
|
3
|
+
import { TargetId } from "./target.js";
|
|
4
|
+
export const OperationId = Schema.String;
|
|
5
|
+
export const OperationRisk = Schema.Literals(["read-only", "writes-local", "externally-visible", "irreversible"]);
|
|
6
|
+
export class ExecutionGate extends Schema.Class("ExecutionGate")({
|
|
7
|
+
requiresExecute: Schema.Boolean,
|
|
8
|
+
requiresIrreversibleApproval: Schema.Boolean,
|
|
9
|
+
reason: Schema.String
|
|
10
|
+
}) {
|
|
11
|
+
}
|
|
12
|
+
export class CommandSpec extends Schema.Class("CommandSpec")({
|
|
13
|
+
executable: Schema.String,
|
|
14
|
+
args: Schema.Array(Schema.String),
|
|
15
|
+
cwd: Schema.optionalKey(Schema.String),
|
|
16
|
+
requiredEnv: Schema.Array(Schema.String),
|
|
17
|
+
redactedEnv: Schema.Array(Schema.String)
|
|
18
|
+
}) {
|
|
19
|
+
}
|
|
20
|
+
export class RenderFileOperation extends Schema.TaggedClass()("RenderFileOperation", {
|
|
21
|
+
id: OperationId,
|
|
22
|
+
targetId: Schema.optionalKey(TargetId),
|
|
23
|
+
description: Schema.String,
|
|
24
|
+
risk: OperationRisk,
|
|
25
|
+
gate: ExecutionGate,
|
|
26
|
+
path: Schema.String,
|
|
27
|
+
contents: Schema.String
|
|
28
|
+
}) {
|
|
29
|
+
}
|
|
30
|
+
export class ValidateCommandOperation extends Schema.TaggedClass()("ValidateCommandOperation", {
|
|
31
|
+
id: OperationId,
|
|
32
|
+
targetId: Schema.optionalKey(TargetId),
|
|
33
|
+
description: Schema.String,
|
|
34
|
+
risk: OperationRisk,
|
|
35
|
+
gate: ExecutionGate,
|
|
36
|
+
command: CommandSpec
|
|
37
|
+
}) {
|
|
38
|
+
}
|
|
39
|
+
export class ValidationNoteOperation extends Schema.TaggedClass()("ValidationNoteOperation", {
|
|
40
|
+
id: OperationId,
|
|
41
|
+
targetId: Schema.optionalKey(TargetId),
|
|
42
|
+
description: Schema.String,
|
|
43
|
+
risk: OperationRisk,
|
|
44
|
+
gate: ExecutionGate,
|
|
45
|
+
message: Schema.String,
|
|
46
|
+
skipped: Schema.Boolean,
|
|
47
|
+
severity: Schema.Literals(["info", "warning"])
|
|
48
|
+
}) {
|
|
49
|
+
}
|
|
50
|
+
export class PublishCommandOperation extends Schema.TaggedClass()("PublishCommandOperation", {
|
|
51
|
+
id: OperationId,
|
|
52
|
+
targetId: TargetId,
|
|
53
|
+
description: Schema.String,
|
|
54
|
+
risk: OperationRisk,
|
|
55
|
+
gate: ExecutionGate,
|
|
56
|
+
command: CommandSpec
|
|
57
|
+
}) {
|
|
58
|
+
}
|
|
59
|
+
export class VerifyRemoteOperation extends Schema.TaggedClass()("VerifyRemoteOperation", {
|
|
60
|
+
id: OperationId,
|
|
61
|
+
targetId: TargetId,
|
|
62
|
+
description: Schema.String,
|
|
63
|
+
risk: OperationRisk,
|
|
64
|
+
gate: ExecutionGate,
|
|
65
|
+
command: CommandSpec
|
|
66
|
+
}) {
|
|
67
|
+
}
|
|
68
|
+
export const Operation = Schema.Union([
|
|
69
|
+
RenderFileOperation,
|
|
70
|
+
ValidateCommandOperation,
|
|
71
|
+
ValidationNoteOperation,
|
|
72
|
+
PublishCommandOperation,
|
|
73
|
+
VerifyRemoteOperation
|
|
74
|
+
]);
|
|
75
|
+
export class ExecutionApproval extends Schema.Class("ExecutionApproval")({
|
|
76
|
+
execute: Schema.Boolean,
|
|
77
|
+
approveIrreversible: Schema.Boolean
|
|
78
|
+
}) {
|
|
79
|
+
static none = ExecutionApproval.make({
|
|
80
|
+
execute: false,
|
|
81
|
+
approveIrreversible: false
|
|
82
|
+
});
|
|
83
|
+
}
|
|
84
|
+
export class ExecutionApprovalError extends Schema.TaggedErrorClass()("ExecutionApprovalError", {
|
|
85
|
+
operationId: OperationId,
|
|
86
|
+
reason: Schema.String
|
|
87
|
+
}) {
|
|
88
|
+
}
|
|
89
|
+
export const noApprovalGate = (reason) => ExecutionGate.make({
|
|
90
|
+
requiresExecute: false,
|
|
91
|
+
requiresIrreversibleApproval: false,
|
|
92
|
+
reason
|
|
93
|
+
});
|
|
94
|
+
export const executeGate = (reason) => ExecutionGate.make({
|
|
95
|
+
requiresExecute: true,
|
|
96
|
+
requiresIrreversibleApproval: false,
|
|
97
|
+
reason
|
|
98
|
+
});
|
|
99
|
+
export const irreversibleGate = (reason) => ExecutionGate.make({
|
|
100
|
+
requiresExecute: true,
|
|
101
|
+
requiresIrreversibleApproval: true,
|
|
102
|
+
reason
|
|
103
|
+
});
|
|
104
|
+
export const canExecuteOperation = (operation, approval) => {
|
|
105
|
+
const requiresExecute = operation.gate.requiresExecute ||
|
|
106
|
+
operation._tag === "PublishCommandOperation" ||
|
|
107
|
+
operation._tag === "RenderFileOperation" ||
|
|
108
|
+
operation.risk !== "read-only";
|
|
109
|
+
const requiresIrreversibleApproval = operation.gate.requiresIrreversibleApproval ||
|
|
110
|
+
operation.risk === "irreversible";
|
|
111
|
+
if (requiresExecute && !approval.execute) {
|
|
112
|
+
return false;
|
|
113
|
+
}
|
|
114
|
+
if (requiresIrreversibleApproval && !approval.approveIrreversible) {
|
|
115
|
+
return false;
|
|
116
|
+
}
|
|
117
|
+
return true;
|
|
118
|
+
};
|
|
119
|
+
export const requireExecutionApproval = Effect.fn("requireExecutionApproval")(function* (operation, approval) {
|
|
120
|
+
if (canExecuteOperation(operation, approval)) {
|
|
121
|
+
return;
|
|
122
|
+
}
|
|
123
|
+
const reason = (operation.gate.requiresIrreversibleApproval || operation.risk === "irreversible") &&
|
|
124
|
+
!approval.approveIrreversible
|
|
125
|
+
? "Operation requires irreversible approval."
|
|
126
|
+
: "Operation requires execute approval.";
|
|
127
|
+
return yield* Effect.fail(ExecutionApprovalError.make({
|
|
128
|
+
operationId: operation.id,
|
|
129
|
+
reason
|
|
130
|
+
}));
|
|
131
|
+
});
|
|
132
|
+
export const operationOrder = (left, right) => left.id.localeCompare(right.id);
|
|
133
|
+
//# sourceMappingURL=operation.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"operation.js","sourceRoot":"","sources":["../../src/domain/operation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,KAAK,MAAM,MAAM,eAAe,CAAA;AACvC,OAAO,EAAE,QAAQ,EAAE,MAAM,aAAa,CAAA;AAItC,MAAM,CAAC,MAAM,WAAW,GAAG,MAAM,CAAC,MAA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