@kitsi/action 0.0.35 → 0.1.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.
Files changed (2) hide show
  1. package/dist/index.js +658 -644
  2. package/package.json +1 -48
package/dist/index.js CHANGED
@@ -125458,9 +125458,9 @@ class GroupManager {
125458
125458
  import { resolve as resolvePath2 } from "node:path";
125459
125459
  import { pathToFileURL } from "node:url";
125460
125460
 
125461
- // ../core/dist/version.js
125461
+ // ../core/src/version.ts
125462
125462
  var VERSION = "0.0.1";
125463
- // ../core/dist/dsl/plan.js
125463
+ // ../core/src/dsl/plan.ts
125464
125464
  var clonePlan = (plan, patch) => {
125465
125465
  const next = {
125466
125466
  name: patch.name ?? plan.config.name,
@@ -125562,7 +125562,7 @@ var plan = (name) => new PlanBuilder({
125562
125562
  concurrency: {},
125563
125563
  tasks: []
125564
125564
  });
125565
- // ../core/dist/dsl/task.js
125565
+ // ../core/src/dsl/task.ts
125566
125566
  var cloneTask = (task, patch) => new TaskBuilder({
125567
125567
  ...task.config,
125568
125568
  ...patch,
@@ -125633,7 +125633,7 @@ var task = (name) => new TaskBuilder({
125633
125633
  inputs: [],
125634
125634
  cacheEnv: []
125635
125635
  });
125636
- // ../core/dist/dsl/step.js
125636
+ // ../core/src/dsl/step.ts
125637
125637
  class StepBuilder {
125638
125638
  name;
125639
125639
  run;
@@ -125650,7 +125650,7 @@ class StepBuilder {
125650
125650
  }
125651
125651
  }
125652
125652
  var step = (name, run) => new StepBuilder(name, run);
125653
- // ../core/dist/dsl/kit.js
125653
+ // ../core/src/dsl/kit.ts
125654
125654
  var cloneKit = (kit, patch) => new KitBuilder({
125655
125655
  ...kit.config,
125656
125656
  ...patch,
@@ -125684,7 +125684,7 @@ class KitBuilder {
125684
125684
  }
125685
125685
  }
125686
125686
  var kit = (name) => new KitBuilder({ name, env: {}, setupSteps: [] });
125687
- // ../core/dist/dsl/image.js
125687
+ // ../core/src/dsl/image.ts
125688
125688
  class ImageBuilder {
125689
125689
  config;
125690
125690
  constructor(config) {
@@ -125698,7 +125698,7 @@ class ImageBuilder {
125698
125698
  }
125699
125699
  }
125700
125700
  var image = (ref) => new ImageBuilder({ ref, env: {} });
125701
- // ../core/dist/dsl/service.js
125701
+ // ../core/src/dsl/service.ts
125702
125702
  class ServiceBuilder {
125703
125703
  config;
125704
125704
  constructor(config) {
@@ -125718,11 +125718,11 @@ class ServiceBuilder {
125718
125718
  }
125719
125719
  }
125720
125720
  var service = (imageRef) => new ServiceBuilder({ image: imageRef, env: {}, ports: [] });
125721
- // ../core/dist/dsl/registry.js
125721
+ // ../core/src/dsl/registry.ts
125722
125722
  var registry = (...plansList) => ({
125723
125723
  plans: plansList
125724
125724
  });
125725
- // ../core/dist/errors/index.js
125725
+ // ../core/src/errors/index.ts
125726
125726
  class CliError extends Error {
125727
125727
  format() {
125728
125728
  return this.message;
@@ -125732,7 +125732,7 @@ class NotFoundError extends CliError {
125732
125732
  code = "NOT_FOUND";
125733
125733
  exitCode = 2;
125734
125734
  }
125735
- // ../core/dist/ops/operation.js
125735
+ // ../core/src/ops/operation.ts
125736
125736
  var isOperation = (value) => {
125737
125737
  if (!value || typeof value !== "object")
125738
125738
  return false;
@@ -125740,12 +125740,12 @@ var isOperation = (value) => {
125740
125740
  return typeof op.kind === "string" && typeof op.toOp === "function" && typeof op.analysisPlaceholder === "function" && typeof op.extractDependencies === "function" && typeof op.extractSecrets === "function" && typeof op.extractRefs === "function" && typeof op.cacheNormalize === "function" && typeof op.cachePlaceholder === "function";
125741
125741
  };
125742
125742
 
125743
- // ../core/dist/ops/types.js
125743
+ // ../core/src/ops/types.ts
125744
125744
  var isSecretRef = (value) => value.kind === "secret";
125745
125745
  var isParamRef = (value) => value.kind === "param";
125746
125746
  var isValueRef = (value) => value.kind === "value";
125747
125747
 
125748
- // ../core/dist/dsl/glob.js
125748
+ // ../core/src/dsl/glob.ts
125749
125749
  var import_picomatch = __toESM(require_picomatch2(), 1);
125750
125750
  var GLOB_CHARS = /[*?[\]{}!]/;
125751
125751
  function isGlobPattern(pattern) {
@@ -125763,7 +125763,7 @@ function expandPattern(pattern, taskNames) {
125763
125763
  return matches;
125764
125764
  }
125765
125765
 
125766
- // ../core/dist/dsl/analysis.js
125766
+ // ../core/src/dsl/analysis.ts
125767
125767
  function toOperation(value) {
125768
125768
  if (isOperation(value)) {
125769
125769
  return value;
@@ -125810,421 +125810,244 @@ function collectSecrets(tasks) {
125810
125810
  }
125811
125811
  return secrets;
125812
125812
  }
125813
- // ../core/dist/dsl/utils.js
125813
+ // ../core/src/dsl/utils.ts
125814
125814
  import { resolve as resolvePath } from "node:path";
125815
125815
  var resolveWorkspace = (workspace) => {
125816
125816
  if (!workspace)
125817
125817
  return process.cwd();
125818
125818
  return workspace.startsWith(".") ? resolvePath(process.cwd(), workspace) : workspace;
125819
125819
  };
125820
- // ../core/dist/ops/errors.js
125821
- class OpErrorBuilder {
125822
- type;
125823
- message;
125824
- context = {};
125825
- constructor(type, message) {
125826
- this.type = type;
125827
- this.message = message;
125828
- }
125829
- inTask(task2) {
125830
- this.context.task = task2;
125831
- return this;
125832
- }
125833
- inStep(step2) {
125834
- this.context.step = step2;
125835
- return this;
125836
- }
125837
- causedBy(cause) {
125838
- this.context.cause = cause;
125839
- return this;
125840
- }
125841
- build() {
125842
- return { type: this.type, message: this.message, ...this.context };
125843
- }
125844
- }
125845
- var OpErrors = {
125846
- bundle: (message) => new OpErrorBuilder("bundle", message),
125847
- artifact: (message) => new OpErrorBuilder("artifact", message),
125848
- command: (message) => new OpErrorBuilder("command", message),
125849
- http: (message) => new OpErrorBuilder("http", message),
125850
- secret: (message) => new OpErrorBuilder("secret", message),
125851
- param: (message) => new OpErrorBuilder("param", message),
125852
- value: (message) => new OpErrorBuilder("value", message),
125853
- validation: (message) => new OpErrorBuilder("validation", message),
125854
- env: (message) => new OpErrorBuilder("env", message),
125855
- cache: (message) => new OpErrorBuilder("cache", message),
125856
- report: (message) => new OpErrorBuilder("report", message),
125857
- annotation: (message) => new OpErrorBuilder("annotation", message),
125858
- service: (message) => new OpErrorBuilder("service", message),
125859
- timeout: (message) => new OpErrorBuilder("timeout", message)
125860
- };
125861
- // ../core/dist/ops/template.js
125862
- var isTemplateStringsArray = (value) => Array.isArray(value) && Object.prototype.hasOwnProperty.call(value, "raw");
125863
- var isTemplatePartArray = (value) => Array.isArray(value) && (value.length === 0 || typeof value[0] === "object" && value[0] !== null && ("type" in value[0]));
125864
- var toTemplatePart = (value) => {
125865
- if (typeof value === "string" || typeof value === "number") {
125866
- return { type: "interpolated", value: String(value) };
125867
- }
125868
- if (value.kind === "secret") {
125869
- return { type: "secret", name: value.name };
125870
- }
125871
- if (value.kind === "param") {
125872
- return { type: "param", ref: value };
125873
- }
125874
- return { type: "value", ref: value };
125875
- };
125876
- var buildTemplateParts = (strings, values) => {
125877
- const template = [];
125878
- for (let i = 0;i < strings.length; i += 1) {
125879
- const text = strings[i] ?? "";
125880
- if (text.length > 0) {
125881
- template.push({ type: "text", value: text });
125882
- }
125883
- const value = values[i];
125884
- if (i < values.length && value !== undefined) {
125885
- template.push(toTemplatePart(value));
125886
- }
125887
- }
125888
- return template;
125889
- };
125890
- var templateFromInput = (input, values) => {
125891
- if (isTemplateStringsArray(input)) {
125892
- return buildTemplateParts(input, values);
125893
- }
125894
- if (isTemplatePartArray(input)) {
125895
- return input;
125896
- }
125897
- if (Array.isArray(input)) {
125898
- return input.map((part) => toTemplatePart(part));
125899
- }
125900
- return [toTemplatePart(input)];
125901
- };
125902
- var collectTemplateMetadata = (template, addSecret, addParam) => {
125903
- for (const part of template) {
125904
- if (part.type === "secret")
125905
- addSecret(part.name);
125906
- if (part.type === "param")
125907
- addParam(part.ref.name);
125908
- }
125909
- };
125910
- var collectTemplateSecrets = (template) => {
125911
- const names = new Set;
125912
- for (const part of template) {
125913
- if (part.type === "secret")
125914
- names.add(part.name);
125915
- }
125916
- return Array.from(names);
125917
- };
125918
- var normalizeTemplatePart = (part) => {
125919
- if (part.type === "text" || part.type === "interpolated") {
125920
- return { type: part.type, value: part.value };
125921
- }
125922
- if (part.type === "secret") {
125923
- return { type: part.type, name: part.name };
125924
- }
125925
- return { type: part.type, name: part.ref.name };
125926
- };
125927
- var commandSignature = (template) => {
125928
- const raw = template.map((part) => {
125929
- if (part.type === "text")
125930
- return part.value;
125931
- if (part.type === "interpolated")
125932
- return String(part.value);
125933
- if (part.type === "secret")
125934
- return `<secret:${part.name}>`;
125935
- if (part.type === "param")
125936
- return `<param:${part.ref.name}>`;
125937
- return `<value:${part.ref.name}>`;
125938
- }).join("");
125939
- return raw.replace(/\s+/g, " ").trim();
125940
- };
125941
-
125942
- // ../core/dist/ops/shell.js
125943
- class CommandBuilder {
125944
- op;
125945
- constructor(op) {
125946
- this.op = op;
125947
- }
125948
- get kind() {
125949
- return this.op.kind;
125950
- }
125951
- toOp() {
125952
- return this.op;
125953
- }
125820
+ // ../core/src/ops/operation-base.ts
125821
+ class OperationBase {
125954
125822
  analysisPlaceholder() {
125955
- return "";
125823
+ return;
125956
125824
  }
125957
125825
  extractDependencies(_taskName) {
125958
125826
  return [];
125959
125827
  }
125960
125828
  extractSecrets() {
125961
- const names = new Set;
125962
- collectTemplateMetadata(this.op.template, (name) => names.add(name), () => {});
125963
- return Array.from(names);
125829
+ return [];
125964
125830
  }
125965
125831
  extractRefs() {
125966
125832
  return [];
125967
125833
  }
125968
- cacheNormalize(context) {
125969
- context.addCommandSignature(commandSignature(this.op.template));
125970
- collectTemplateMetadata(this.op.template, context.addSecret, context.addParam);
125971
- return {
125972
- kind: this.op.kind,
125973
- capture: this.op.capture,
125974
- cache: this.op.cache ?? null,
125975
- template: this.op.template.map(normalizeTemplatePart)
125976
- };
125977
- }
125978
125834
  cachePlaceholder(context) {
125979
- if (!context.isPrimary)
125980
- return;
125981
- if (this.op.capture === "ok")
125982
- return true;
125983
- if (this.op.capture === "code")
125984
- return 0;
125985
- return "";
125986
- }
125987
- stdout() {
125988
- return new CommandBuilder({ ...this.op, capture: "stdout" });
125989
- }
125990
- code() {
125991
- return new CommandBuilder({ ...this.op, capture: "code" });
125835
+ return context.value;
125992
125836
  }
125993
- ok() {
125994
- return new CommandBuilder({ ...this.op, capture: "ok" });
125837
+ }
125838
+
125839
+ // ../core/src/ops/annotate.ts
125840
+ class AnnotateOperation extends OperationBase {
125841
+ level;
125842
+ message;
125843
+ location;
125844
+ constructor(level, message, location) {
125845
+ super();
125846
+ this.level = level;
125847
+ this.message = message;
125848
+ if (location)
125849
+ this.location = location;
125995
125850
  }
125996
- must() {
125997
- return new CommandBuilder({ ...this.op, capture: "must" });
125851
+ get kind() {
125852
+ return "annotate";
125998
125853
  }
125999
- cached(options) {
126000
- return new CommandBuilder({ ...this.op, cache: { enabled: true, ...options } });
125854
+ toOp() {
125855
+ return {
125856
+ kind: "annotate",
125857
+ level: this.level,
125858
+ message: this.message,
125859
+ ...this.location ? { location: this.location } : {}
125860
+ };
126001
125861
  }
126002
- uncached() {
126003
- return new CommandBuilder({ ...this.op, cache: { enabled: false } });
125862
+ cacheNormalize(_context) {
125863
+ return { kind: this.kind, level: this.level, message: this.message };
126004
125864
  }
126005
125865
  }
126006
- var sh = (strings, ...values) => {
126007
- const template = buildTemplateParts(strings, values);
126008
- return new CommandBuilder({
126009
- kind: "command",
126010
- capture: "result",
126011
- template
126012
- });
125866
+ var createAnnotation = (level) => (message, location) => new AnnotateOperation(level, message, location);
125867
+ var annotate = {
125868
+ error: createAnnotation("error"),
125869
+ warning: createAnnotation("warning"),
125870
+ info: createAnnotation("info")
126013
125871
  };
126014
- // ../core/dist/ops/http.js
126015
- var hasHeader = (headers, name) => headers.some((header) => header.name.toLowerCase() === name.toLowerCase());
126016
125872
 
126017
- class HttpBuilder {
126018
- op;
126019
- constructor(op) {
126020
- this.op = op;
125873
+ // ../core/src/ops/artifact.ts
125874
+ class ArtifactUploadOperation extends OperationBase {
125875
+ name;
125876
+ patterns;
125877
+ when;
125878
+ constructor(name, patterns, when) {
125879
+ super();
125880
+ this.name = name;
125881
+ this.patterns = patterns;
125882
+ this.when = when;
126021
125883
  }
126022
125884
  get kind() {
126023
- return this.op.kind;
125885
+ return "artifact-upload";
126024
125886
  }
126025
125887
  toOp() {
126026
- return this.op;
126027
- }
126028
- analysisPlaceholder() {
126029
- return { status: 200, ok: true, headers: {}, body: "" };
126030
- }
126031
- extractDependencies(_taskName) {
126032
- return [];
126033
- }
126034
- extractSecrets() {
126035
- const names = new Set;
126036
- for (const name of collectTemplateSecrets(this.op.url))
126037
- names.add(name);
126038
- for (const header of this.op.headers) {
126039
- for (const name of collectTemplateSecrets(header.value))
126040
- names.add(name);
126041
- }
126042
- if (this.op.body) {
126043
- for (const name of collectTemplateSecrets(this.op.body))
126044
- names.add(name);
126045
- }
126046
- return Array.from(names);
126047
- }
126048
- extractRefs() {
126049
- return [];
125888
+ return { kind: "artifact-upload", name: this.name, patterns: this.patterns, when: this.when };
126050
125889
  }
126051
- cacheNormalize(context) {
126052
- collectTemplateMetadata(this.op.url, context.addSecret, context.addParam);
126053
- for (const header of this.op.headers) {
126054
- collectTemplateMetadata(header.value, context.addSecret, context.addParam);
126055
- }
126056
- if (this.op.body) {
126057
- collectTemplateMetadata(this.op.body, context.addSecret, context.addParam);
126058
- }
125890
+ cacheNormalize(_context) {
126059
125891
  return {
126060
- kind: this.op.kind,
126061
- method: this.op.method,
126062
- url: this.op.url.map(normalizeTemplatePart),
126063
- headers: this.op.headers.map((header) => ({
126064
- name: header.name,
126065
- value: header.value.map(normalizeTemplatePart)
126066
- })),
126067
- body: this.op.body ? this.op.body.map(normalizeTemplatePart) : null,
126068
- bodyPath: this.op.bodyPath ?? null
125892
+ kind: this.kind,
125893
+ name: this.name,
125894
+ patterns: this.patterns,
125895
+ when: this.when
126069
125896
  };
126070
125897
  }
126071
- cachePlaceholder(context) {
126072
- if (!context.isPrimary)
126073
- return;
126074
- return { status: 200, ok: true, headers: {}, body: "" };
126075
- }
126076
- header(name, value, ...values) {
126077
- const next = { name, value: templateFromInput(value, values) };
126078
- return new HttpBuilder({ ...this.op, headers: [...this.op.headers, next] });
126079
- }
126080
- headers(values) {
126081
- let builder = this;
126082
- for (const [name, value] of Object.entries(values)) {
126083
- builder = builder.header(name, value);
126084
- }
126085
- return builder;
125898
+ }
125899
+
125900
+ class ArtifactDownloadOperation extends OperationBase {
125901
+ name;
125902
+ destination;
125903
+ constructor(name, destination) {
125904
+ super();
125905
+ this.name = name;
125906
+ this.destination = destination;
126086
125907
  }
126087
- body(value, ...values) {
126088
- return new HttpBuilder({
126089
- ...this.op,
126090
- body: templateFromInput(value, values),
126091
- bodyPath: undefined
126092
- });
125908
+ get kind() {
125909
+ return "artifact-download";
126093
125910
  }
126094
- bodyPath(path) {
126095
- return new HttpBuilder({ ...this.op, bodyPath: path, body: undefined });
125911
+ toOp() {
125912
+ return { kind: "artifact-download", name: this.name, destination: this.destination };
126096
125913
  }
126097
- jsonBody(value) {
126098
- const body = JSON.stringify(value);
126099
- let builder = this.body(body);
126100
- if (!hasHeader(builder.op.headers, "Content-Type")) {
126101
- builder = builder.header("Content-Type", "application/json");
126102
- }
126103
- return builder;
125914
+ cacheNormalize(_context) {
125915
+ return { kind: this.kind, name: this.name, destination: this.destination };
126104
125916
  }
126105
125917
  }
126106
- var buildRequest = (method, url, values) => new HttpBuilder({
126107
- kind: "http",
126108
- method,
126109
- url: templateFromInput(url, values),
126110
- headers: []
126111
- });
126112
- var http = {
126113
- request: (method, url, ...values) => buildRequest(method, url, values),
126114
- get: (url, ...values) => buildRequest("GET", url, values),
126115
- post: (url, ...values) => buildRequest("POST", url, values),
126116
- put: (url, ...values) => buildRequest("PUT", url, values),
126117
- patch: (url, ...values) => buildRequest("PATCH", url, values),
126118
- delete: (url, ...values) => buildRequest("DELETE", url, values),
126119
- head: (url, ...values) => buildRequest("HEAD", url, values),
126120
- options: (url, ...values) => buildRequest("OPTIONS", url, values)
126121
- };
126122
- // ../core/dist/ops/env.js
126123
- class EnvOperation {
125918
+
125919
+ class ArtifactUploadBuilder {
126124
125920
  name;
126125
- value;
126126
- constructor(name, value) {
125921
+ patterns;
125922
+ when;
125923
+ constructor(name, patterns = [], when = "success") {
126127
125924
  this.name = name;
126128
- this.value = value;
125925
+ this.patterns = patterns;
125926
+ this.when = when;
126129
125927
  }
126130
- get kind() {
126131
- return "env";
125928
+ paths(...patterns) {
125929
+ return new ArtifactUploadBuilder(this.name, patterns, this.when);
126132
125930
  }
126133
- toOp() {
126134
- return { kind: "env", name: this.name, value: this.value };
125931
+ whenSuccess() {
125932
+ return new ArtifactUploadOperation(this.name, this.patterns, "success");
126135
125933
  }
126136
- analysisPlaceholder() {
126137
- if (typeof this.value === "string" || typeof this.value === "number") {
126138
- return this.value;
126139
- }
126140
- return "";
125934
+ whenAlways() {
125935
+ return new ArtifactUploadOperation(this.name, this.patterns, "always");
126141
125936
  }
126142
- extractDependencies(_taskName) {
126143
- return [];
125937
+ }
125938
+
125939
+ class ArtifactDownloadBuilder {
125940
+ name;
125941
+ constructor(name) {
125942
+ this.name = name;
126144
125943
  }
126145
- extractSecrets() {
126146
- const value = this.value;
126147
- if (typeof value === "object" && value !== null && isSecretRef(value)) {
126148
- return [value.name];
126149
- }
126150
- return [];
125944
+ to(destination) {
125945
+ return new ArtifactDownloadOperation(this.name, destination);
126151
125946
  }
126152
- extractRefs() {
126153
- return [];
125947
+ }
125948
+ var artifact2 = {
125949
+ upload: (name) => new ArtifactUploadBuilder(name),
125950
+ download: (name) => new ArtifactDownloadBuilder(name)
125951
+ };
125952
+
125953
+ // ../core/src/ops/bind.ts
125954
+ class BindServiceOperation extends OperationBase {
125955
+ service;
125956
+ alias;
125957
+ constructor(service2, alias) {
125958
+ super();
125959
+ this.service = service2;
125960
+ if (alias)
125961
+ this.alias = alias;
126154
125962
  }
126155
- cacheNormalize(context) {
126156
- const value = this.value;
126157
- if (typeof value !== "string" && typeof value !== "number") {
126158
- if (isSecretRef(value))
126159
- context.addSecret(value.name);
126160
- if (isParamRef(value))
126161
- context.addParam(value.name);
126162
- }
126163
- const normalized = (() => {
126164
- if (typeof value === "string" || typeof value === "number")
126165
- return value;
126166
- if (isSecretRef(value))
126167
- return { kind: "secret", name: value.name };
126168
- if (isParamRef(value))
126169
- return { kind: "param", name: value.name };
126170
- if (isValueRef(value))
126171
- return { kind: "value", name: value.name };
126172
- return String(value);
126173
- })();
126174
- return { kind: this.kind, name: this.name, value: normalized };
125963
+ get kind() {
125964
+ return "bind-service";
125965
+ }
125966
+ toOp() {
125967
+ const op = { kind: "bind-service", service: this.service };
125968
+ if (this.alias)
125969
+ op.alias = this.alias;
125970
+ return op;
126175
125971
  }
126176
- cachePlaceholder(context) {
126177
- if (typeof this.value === "string" || typeof this.value === "number") {
126178
- return this.value;
126179
- }
126180
- return context.isPrimary ? "" : undefined;
125972
+ cacheNormalize(_context) {
125973
+ return { kind: this.kind, service: this.service, alias: this.alias ?? null };
126181
125974
  }
126182
125975
  }
126183
- var env = (name, value) => new EnvOperation(name, value);
126184
- // ../core/dist/ops/secret.js
126185
- var secret = (name) => ({ kind: "secret", name });
126186
- // ../core/dist/ops/ref.js
126187
- var coerce = {
126188
- string: (value) => String(value),
126189
- number: (value) => Number(value),
126190
- boolean: (value) => Boolean(value),
126191
- json: (value) => value
126192
- };
126193
- var createRefFactory = (kind) => {
126194
- const ref = (name, parse) => ({
126195
- kind,
125976
+ var bind = (serviceInstance, alias) => new BindServiceOperation(serviceInstance, alias);
125977
+
125978
+ // ../core/src/ops/bundle.ts
125979
+ var cloneBundle = (ref, patterns) => ({
125980
+ ...ref,
125981
+ patterns,
125982
+ paths: (...nextPatterns) => cloneBundle(ref, nextPatterns.length > 0 ? nextPatterns : patterns)
125983
+ });
125984
+ var createBundleRef = (name) => {
125985
+ const ref = {
125986
+ kind: "bundle",
126196
125987
  name,
126197
- parse
126198
- });
126199
- return {
126200
- string: (name) => ref(name, coerce.string),
126201
- number: (name) => ref(name, coerce.number),
126202
- boolean: (name) => ref(name, coerce.boolean),
126203
- json: (name) => ref(name, coerce.json)
125988
+ patterns: [],
125989
+ paths: (...patterns) => cloneBundle(ref, patterns)
126204
125990
  };
125991
+ return ref;
126205
125992
  };
126206
- var param = createRefFactory("param");
126207
- var out = createRefFactory("value");
126208
- // ../core/dist/ops/operation-base.js
126209
- class OperationBase {
126210
- analysisPlaceholder() {
125993
+
125994
+ class PackOperation extends OperationBase {
125995
+ ref;
125996
+ constructor(ref) {
125997
+ super();
125998
+ this.ref = ref;
125999
+ }
126000
+ get kind() {
126001
+ return "pack";
126002
+ }
126003
+ toOp() {
126004
+ return { kind: "pack", ref: this.ref };
126005
+ }
126006
+ cacheNormalize(_context) {
126007
+ return { kind: this.kind, name: this.ref.name, patterns: this.ref.patterns };
126008
+ }
126009
+ cachePlaceholder(_context) {
126211
126010
  return;
126212
126011
  }
126213
- extractDependencies(_taskName) {
126214
- return [];
126012
+ }
126013
+
126014
+ class UnpackOperation extends OperationBase {
126015
+ from;
126016
+ ref;
126017
+ constructor(from, ref) {
126018
+ super();
126019
+ this.from = from;
126020
+ this.ref = ref;
126215
126021
  }
126216
- extractSecrets() {
126217
- return [];
126022
+ get kind() {
126023
+ return "unpack";
126024
+ }
126025
+ toOp() {
126026
+ return { kind: "unpack", from: this.from, ref: this.ref };
126027
+ }
126028
+ extractDependencies(taskName) {
126029
+ return [{ from: this.from.config.name, to: taskName, type: "unpack" }];
126218
126030
  }
126219
126031
  extractRefs() {
126220
- return [];
126032
+ return [{ type: "bundle", ref: this.ref }];
126221
126033
  }
126222
- cachePlaceholder(context) {
126223
- return context.value;
126034
+ cacheNormalize(context) {
126035
+ context.addDependency(this.from.config.name);
126036
+ return {
126037
+ kind: this.kind,
126038
+ from: this.from.config.name,
126039
+ name: this.ref.name,
126040
+ patterns: this.ref.patterns
126041
+ };
126042
+ }
126043
+ cachePlaceholder(_context) {
126044
+ return;
126224
126045
  }
126225
126046
  }
126047
+ var pack = (ref) => new PackOperation(ref);
126048
+ var unpack = (from, ref) => new UnpackOperation(from, ref);
126226
126049
 
126227
- // ../core/dist/ops/cache.js
126050
+ // ../core/src/ops/cache.ts
126228
126051
  class CacheOperation extends OperationBase {
126229
126052
  name;
126230
126053
  paths;
@@ -126328,232 +126151,459 @@ var cacheFn = (name, options) => new CacheOperation(name, options.paths, options
126328
126151
  cacheFn.dir = (name) => createCacheRef(name);
126329
126152
  cacheFn.mount = (ref) => new CacheMountOperation(ref);
126330
126153
  var cache2 = cacheFn;
126331
- // ../core/dist/ops/artifact.js
126332
- class ArtifactUploadOperation extends OperationBase {
126154
+
126155
+ // ../core/src/ops/env.ts
126156
+ class EnvOperation {
126333
126157
  name;
126334
- patterns;
126335
- when;
126336
- constructor(name, patterns, when) {
126337
- super();
126158
+ value;
126159
+ constructor(name, value) {
126338
126160
  this.name = name;
126339
- this.patterns = patterns;
126340
- this.when = when;
126161
+ this.value = value;
126341
126162
  }
126342
126163
  get kind() {
126343
- return "artifact-upload";
126164
+ return "env";
126344
126165
  }
126345
126166
  toOp() {
126346
- return { kind: "artifact-upload", name: this.name, patterns: this.patterns, when: this.when };
126167
+ return { kind: "env", name: this.name, value: this.value };
126347
126168
  }
126348
- cacheNormalize(_context) {
126349
- return {
126350
- kind: this.kind,
126351
- name: this.name,
126352
- patterns: this.patterns,
126353
- when: this.when
126354
- };
126169
+ analysisPlaceholder() {
126170
+ if (typeof this.value === "string" || typeof this.value === "number") {
126171
+ return this.value;
126172
+ }
126173
+ return "";
126174
+ }
126175
+ extractDependencies(_taskName) {
126176
+ return [];
126177
+ }
126178
+ extractSecrets() {
126179
+ const value = this.value;
126180
+ if (typeof value === "object" && value !== null && isSecretRef(value)) {
126181
+ return [value.name];
126182
+ }
126183
+ return [];
126184
+ }
126185
+ extractRefs() {
126186
+ return [];
126187
+ }
126188
+ cacheNormalize(context) {
126189
+ const value = this.value;
126190
+ if (typeof value !== "string" && typeof value !== "number") {
126191
+ if (isSecretRef(value))
126192
+ context.addSecret(value.name);
126193
+ if (isParamRef(value))
126194
+ context.addParam(value.name);
126195
+ }
126196
+ const normalized = (() => {
126197
+ if (typeof value === "string" || typeof value === "number")
126198
+ return value;
126199
+ if (isSecretRef(value))
126200
+ return { kind: "secret", name: value.name };
126201
+ if (isParamRef(value))
126202
+ return { kind: "param", name: value.name };
126203
+ if (isValueRef(value))
126204
+ return { kind: "value", name: value.name };
126205
+ return String(value);
126206
+ })();
126207
+ return { kind: this.kind, name: this.name, value: normalized };
126208
+ }
126209
+ cachePlaceholder(context) {
126210
+ if (typeof this.value === "string" || typeof this.value === "number") {
126211
+ return this.value;
126212
+ }
126213
+ return context.isPrimary ? "" : undefined;
126355
126214
  }
126356
126215
  }
126216
+ var env = (name, value) => new EnvOperation(name, value);
126357
126217
 
126358
- class ArtifactDownloadOperation extends OperationBase {
126359
- name;
126360
- destination;
126361
- constructor(name, destination) {
126362
- super();
126363
- this.name = name;
126364
- this.destination = destination;
126218
+ // ../core/src/ops/template.ts
126219
+ var isTemplateStringsArray = (value) => Array.isArray(value) && Object.prototype.hasOwnProperty.call(value, "raw");
126220
+ var isTemplatePartArray = (value) => Array.isArray(value) && (value.length === 0 || typeof value[0] === "object" && value[0] !== null && ("type" in value[0]));
126221
+ var toTemplatePart = (value) => {
126222
+ if (typeof value === "string" || typeof value === "number") {
126223
+ return { type: "interpolated", value: String(value) };
126224
+ }
126225
+ if (value.kind === "secret") {
126226
+ return { type: "secret", name: value.name };
126227
+ }
126228
+ if (value.kind === "param") {
126229
+ return { type: "param", ref: value };
126230
+ }
126231
+ return { type: "value", ref: value };
126232
+ };
126233
+ var buildTemplateParts = (strings, values) => {
126234
+ const template = [];
126235
+ for (let i = 0;i < strings.length; i += 1) {
126236
+ const text = strings[i] ?? "";
126237
+ if (text.length > 0) {
126238
+ template.push({ type: "text", value: text });
126239
+ }
126240
+ const value = values[i];
126241
+ if (i < values.length && value !== undefined) {
126242
+ template.push(toTemplatePart(value));
126243
+ }
126244
+ }
126245
+ return template;
126246
+ };
126247
+ var templateFromInput = (input, values) => {
126248
+ if (isTemplateStringsArray(input)) {
126249
+ return buildTemplateParts(input, values);
126250
+ }
126251
+ if (isTemplatePartArray(input)) {
126252
+ return input;
126253
+ }
126254
+ if (Array.isArray(input)) {
126255
+ return input.map((part) => toTemplatePart(part));
126256
+ }
126257
+ return [toTemplatePart(input)];
126258
+ };
126259
+ var collectTemplateMetadata = (template, addSecret, addParam) => {
126260
+ for (const part of template) {
126261
+ if (part.type === "secret")
126262
+ addSecret(part.name);
126263
+ if (part.type === "param")
126264
+ addParam(part.ref.name);
126265
+ }
126266
+ };
126267
+ var collectTemplateSecrets = (template) => {
126268
+ const names = new Set;
126269
+ for (const part of template) {
126270
+ if (part.type === "secret")
126271
+ names.add(part.name);
126272
+ }
126273
+ return Array.from(names);
126274
+ };
126275
+ var normalizeTemplatePart = (part) => {
126276
+ if (part.type === "text" || part.type === "interpolated") {
126277
+ return { type: part.type, value: part.value };
126278
+ }
126279
+ if (part.type === "secret") {
126280
+ return { type: part.type, name: part.name };
126281
+ }
126282
+ return { type: part.type, name: part.ref.name };
126283
+ };
126284
+ var commandSignature = (template) => {
126285
+ const raw = template.map((part) => {
126286
+ if (part.type === "text")
126287
+ return part.value;
126288
+ if (part.type === "interpolated")
126289
+ return String(part.value);
126290
+ if (part.type === "secret")
126291
+ return `<secret:${part.name}>`;
126292
+ if (part.type === "param")
126293
+ return `<param:${part.ref.name}>`;
126294
+ return `<value:${part.ref.name}>`;
126295
+ }).join("");
126296
+ return raw.replace(/\s+/g, " ").trim();
126297
+ };
126298
+
126299
+ // ../core/src/ops/http.ts
126300
+ var hasHeader = (headers, name) => headers.some((header) => header.name.toLowerCase() === name.toLowerCase());
126301
+
126302
+ class HttpBuilder {
126303
+ op;
126304
+ constructor(op) {
126305
+ this.op = op;
126365
126306
  }
126366
126307
  get kind() {
126367
- return "artifact-download";
126308
+ return this.op.kind;
126368
126309
  }
126369
126310
  toOp() {
126370
- return { kind: "artifact-download", name: this.name, destination: this.destination };
126311
+ return this.op;
126371
126312
  }
126372
- cacheNormalize(_context) {
126373
- return { kind: this.kind, name: this.name, destination: this.destination };
126313
+ analysisPlaceholder() {
126314
+ return { status: 200, ok: true, headers: {}, body: "" };
126374
126315
  }
126375
- }
126376
-
126377
- class ArtifactUploadBuilder {
126378
- name;
126379
- patterns;
126380
- when;
126381
- constructor(name, patterns = [], when = "success") {
126382
- this.name = name;
126383
- this.patterns = patterns;
126384
- this.when = when;
126316
+ extractDependencies(_taskName) {
126317
+ return [];
126385
126318
  }
126386
- paths(...patterns) {
126387
- return new ArtifactUploadBuilder(this.name, patterns, this.when);
126319
+ extractSecrets() {
126320
+ const names = new Set;
126321
+ for (const name of collectTemplateSecrets(this.op.url))
126322
+ names.add(name);
126323
+ for (const header of this.op.headers) {
126324
+ for (const name of collectTemplateSecrets(header.value))
126325
+ names.add(name);
126326
+ }
126327
+ if (this.op.body) {
126328
+ for (const name of collectTemplateSecrets(this.op.body))
126329
+ names.add(name);
126330
+ }
126331
+ return Array.from(names);
126388
126332
  }
126389
- whenSuccess() {
126390
- return new ArtifactUploadOperation(this.name, this.patterns, "success");
126333
+ extractRefs() {
126334
+ return [];
126391
126335
  }
126392
- whenAlways() {
126393
- return new ArtifactUploadOperation(this.name, this.patterns, "always");
126336
+ cacheNormalize(context) {
126337
+ collectTemplateMetadata(this.op.url, context.addSecret, context.addParam);
126338
+ for (const header of this.op.headers) {
126339
+ collectTemplateMetadata(header.value, context.addSecret, context.addParam);
126340
+ }
126341
+ if (this.op.body) {
126342
+ collectTemplateMetadata(this.op.body, context.addSecret, context.addParam);
126343
+ }
126344
+ return {
126345
+ kind: this.op.kind,
126346
+ method: this.op.method,
126347
+ url: this.op.url.map(normalizeTemplatePart),
126348
+ headers: this.op.headers.map((header) => ({
126349
+ name: header.name,
126350
+ value: header.value.map(normalizeTemplatePart)
126351
+ })),
126352
+ body: this.op.body ? this.op.body.map(normalizeTemplatePart) : null,
126353
+ bodyPath: this.op.bodyPath ?? null
126354
+ };
126394
126355
  }
126395
- }
126396
-
126397
- class ArtifactDownloadBuilder {
126398
- name;
126399
- constructor(name) {
126400
- this.name = name;
126356
+ cachePlaceholder(context) {
126357
+ if (!context.isPrimary)
126358
+ return;
126359
+ return { status: 200, ok: true, headers: {}, body: "" };
126401
126360
  }
126402
- to(destination) {
126403
- return new ArtifactDownloadOperation(this.name, destination);
126361
+ header(name, value, ...values) {
126362
+ const next = { name, value: templateFromInput(value, values) };
126363
+ return new HttpBuilder({ ...this.op, headers: [...this.op.headers, next] });
126364
+ }
126365
+ headers(values) {
126366
+ let builder = this;
126367
+ for (const [name, value] of Object.entries(values)) {
126368
+ builder = builder.header(name, value);
126369
+ }
126370
+ return builder;
126371
+ }
126372
+ body(value, ...values) {
126373
+ return new HttpBuilder({
126374
+ ...this.op,
126375
+ body: templateFromInput(value, values),
126376
+ bodyPath: undefined
126377
+ });
126378
+ }
126379
+ bodyPath(path) {
126380
+ return new HttpBuilder({ ...this.op, bodyPath: path, body: undefined });
126381
+ }
126382
+ jsonBody(value) {
126383
+ const body = JSON.stringify(value);
126384
+ let builder = this.body(body);
126385
+ if (!hasHeader(builder.op.headers, "Content-Type")) {
126386
+ builder = builder.header("Content-Type", "application/json");
126387
+ }
126388
+ return builder;
126404
126389
  }
126405
126390
  }
126406
- var artifact2 = {
126407
- upload: (name) => new ArtifactUploadBuilder(name),
126408
- download: (name) => new ArtifactDownloadBuilder(name)
126409
- };
126410
- // ../core/dist/ops/bundle.js
126411
- var cloneBundle = (ref, patterns) => ({
126412
- ...ref,
126413
- patterns,
126414
- paths: (...nextPatterns) => cloneBundle(ref, nextPatterns.length > 0 ? nextPatterns : patterns)
126391
+ var buildRequest = (method, url, values) => new HttpBuilder({
126392
+ kind: "http",
126393
+ method,
126394
+ url: templateFromInput(url, values),
126395
+ headers: []
126415
126396
  });
126416
- var createBundleRef = (name) => {
126417
- const ref = {
126418
- kind: "bundle",
126397
+ var http = {
126398
+ request: (method, url, ...values) => buildRequest(method, url, values),
126399
+ get: (url, ...values) => buildRequest("GET", url, values),
126400
+ post: (url, ...values) => buildRequest("POST", url, values),
126401
+ put: (url, ...values) => buildRequest("PUT", url, values),
126402
+ patch: (url, ...values) => buildRequest("PATCH", url, values),
126403
+ delete: (url, ...values) => buildRequest("DELETE", url, values),
126404
+ head: (url, ...values) => buildRequest("HEAD", url, values),
126405
+ options: (url, ...values) => buildRequest("OPTIONS", url, values)
126406
+ };
126407
+
126408
+ // ../core/src/ops/ref.ts
126409
+ var coerce = {
126410
+ string: (value) => String(value),
126411
+ number: (value) => Number(value),
126412
+ boolean: (value) => Boolean(value),
126413
+ json: (value) => value
126414
+ };
126415
+ var createRefFactory = (kind) => {
126416
+ const ref = (name, parse) => ({
126417
+ kind,
126419
126418
  name,
126420
- patterns: [],
126421
- paths: (...patterns) => cloneBundle(ref, patterns)
126419
+ parse
126420
+ });
126421
+ return {
126422
+ string: (name) => ref(name, coerce.string),
126423
+ number: (name) => ref(name, coerce.number),
126424
+ boolean: (name) => ref(name, coerce.boolean),
126425
+ json: (name) => ref(name, coerce.json)
126422
126426
  };
126423
- return ref;
126424
126427
  };
126428
+ var param = createRefFactory("param");
126429
+ var out = createRefFactory("value");
126430
+
126431
+ // ../core/src/ops/output.ts
126432
+ var out2 = {
126433
+ ...out,
126434
+ bundle: (name) => createBundleRef(name)
126435
+ };
126436
+ var emit = (ref, value) => new EmitOperation(ref, value);
126437
+ var use = (from, ref) => new UseOperation(from, ref);
126425
126438
 
126426
- class PackOperation extends OperationBase {
126439
+ class EmitOperation {
126427
126440
  ref;
126428
- constructor(ref) {
126429
- super();
126441
+ value;
126442
+ constructor(ref, value) {
126430
126443
  this.ref = ref;
126444
+ this.value = value;
126431
126445
  }
126432
126446
  get kind() {
126433
- return "pack";
126447
+ return "emit";
126434
126448
  }
126435
126449
  toOp() {
126436
- return { kind: "pack", ref: this.ref };
126450
+ return { kind: "emit", ref: this.ref, value: this.value };
126451
+ }
126452
+ analysisPlaceholder() {
126453
+ return this.value;
126454
+ }
126455
+ extractDependencies(_taskName) {
126456
+ return [];
126457
+ }
126458
+ extractSecrets() {
126459
+ return [];
126460
+ }
126461
+ extractRefs() {
126462
+ return [];
126437
126463
  }
126438
126464
  cacheNormalize(_context) {
126439
- return { kind: this.kind, name: this.ref.name, patterns: this.ref.patterns };
126465
+ return { kind: this.kind, ref: this.ref.name, value: this.value };
126440
126466
  }
126441
126467
  cachePlaceholder(_context) {
126442
- return;
126468
+ return this.value;
126443
126469
  }
126444
126470
  }
126445
126471
 
126446
- class UnpackOperation extends OperationBase {
126472
+ class UseOperation {
126447
126473
  from;
126448
126474
  ref;
126449
126475
  constructor(from, ref) {
126450
- super();
126451
126476
  this.from = from;
126452
126477
  this.ref = ref;
126453
126478
  }
126454
126479
  get kind() {
126455
- return "unpack";
126480
+ return "use";
126456
126481
  }
126457
126482
  toOp() {
126458
- return { kind: "unpack", from: this.from, ref: this.ref };
126483
+ return { kind: "use", from: this.from, ref: this.ref };
126484
+ }
126485
+ analysisPlaceholder() {
126486
+ return this.ref.parse("");
126459
126487
  }
126460
126488
  extractDependencies(taskName) {
126461
- return [{ from: this.from.config.name, to: taskName, type: "unpack" }];
126489
+ return [{ from: this.from.config.name, to: taskName, type: "use" }];
126490
+ }
126491
+ extractSecrets() {
126492
+ return [];
126462
126493
  }
126463
126494
  extractRefs() {
126464
- return [{ type: "bundle", ref: this.ref }];
126495
+ return [{ type: "value", ref: this.ref }];
126465
126496
  }
126466
126497
  cacheNormalize(context) {
126467
126498
  context.addDependency(this.from.config.name);
126468
- return {
126469
- kind: this.kind,
126470
- from: this.from.config.name,
126471
- name: this.ref.name,
126472
- patterns: this.ref.patterns
126473
- };
126499
+ return { kind: this.kind, from: this.from.config.name, ref: this.ref.name };
126474
126500
  }
126475
- cachePlaceholder(_context) {
126476
- return;
126501
+ cachePlaceholder(context) {
126502
+ return context.isPrimary ? this.ref.parse("") : undefined;
126477
126503
  }
126478
126504
  }
126479
- var pack = (ref) => new PackOperation(ref);
126480
- var unpack = (from, ref) => new UnpackOperation(from, ref);
126481
126505
 
126482
- // ../core/dist/ops/output.js
126483
- var out2 = {
126484
- ...out,
126485
- bundle: (name) => createBundleRef(name)
126506
+ // ../core/src/ops/report.ts
126507
+ class ReportOperation extends OperationBase {
126508
+ reportType;
126509
+ path;
126510
+ constructor(reportType, path) {
126511
+ super();
126512
+ this.reportType = reportType;
126513
+ this.path = path;
126514
+ }
126515
+ get kind() {
126516
+ return "report";
126517
+ }
126518
+ toOp() {
126519
+ return { kind: "report", reportType: this.reportType, path: this.path };
126520
+ }
126521
+ cacheNormalize(_context) {
126522
+ return { kind: this.kind, reportType: this.reportType, path: this.path };
126523
+ }
126524
+ }
126525
+ var report = {
126526
+ junit: (path) => new ReportOperation("junit", path),
126527
+ coverage: (path) => new ReportOperation("coverage", path)
126486
126528
  };
126487
- var emit = (ref, value) => new EmitOperation(ref, value);
126488
- var use = (from, ref) => new UseOperation(from, ref);
126489
126529
 
126490
- class EmitOperation {
126491
- ref;
126492
- value;
126493
- constructor(ref, value) {
126494
- this.ref = ref;
126495
- this.value = value;
126530
+ // ../core/src/ops/secret.ts
126531
+ var secret = (name) => ({ kind: "secret", name });
126532
+
126533
+ // ../core/src/ops/shell.ts
126534
+ class CommandBuilder {
126535
+ op;
126536
+ constructor(op) {
126537
+ this.op = op;
126496
126538
  }
126497
126539
  get kind() {
126498
- return "emit";
126540
+ return this.op.kind;
126499
126541
  }
126500
126542
  toOp() {
126501
- return { kind: "emit", ref: this.ref, value: this.value };
126543
+ return this.op;
126502
126544
  }
126503
126545
  analysisPlaceholder() {
126504
- return this.value;
126546
+ return "";
126505
126547
  }
126506
126548
  extractDependencies(_taskName) {
126507
126549
  return [];
126508
126550
  }
126509
126551
  extractSecrets() {
126510
- return [];
126552
+ const names = new Set;
126553
+ collectTemplateMetadata(this.op.template, (name) => names.add(name), () => {});
126554
+ return Array.from(names);
126511
126555
  }
126512
126556
  extractRefs() {
126513
126557
  return [];
126514
126558
  }
126515
- cacheNormalize(_context) {
126516
- return { kind: this.kind, ref: this.ref.name, value: this.value };
126517
- }
126518
- cachePlaceholder(_context) {
126519
- return this.value;
126520
- }
126521
- }
126522
-
126523
- class UseOperation {
126524
- from;
126525
- ref;
126526
- constructor(from, ref) {
126527
- this.from = from;
126528
- this.ref = ref;
126529
- }
126530
- get kind() {
126531
- return "use";
126559
+ cacheNormalize(context) {
126560
+ context.addCommandSignature(commandSignature(this.op.template));
126561
+ collectTemplateMetadata(this.op.template, context.addSecret, context.addParam);
126562
+ return {
126563
+ kind: this.op.kind,
126564
+ capture: this.op.capture,
126565
+ cache: this.op.cache ?? null,
126566
+ template: this.op.template.map(normalizeTemplatePart)
126567
+ };
126532
126568
  }
126533
- toOp() {
126534
- return { kind: "use", from: this.from, ref: this.ref };
126569
+ cachePlaceholder(context) {
126570
+ if (!context.isPrimary)
126571
+ return;
126572
+ if (this.op.capture === "ok")
126573
+ return true;
126574
+ if (this.op.capture === "code")
126575
+ return 0;
126576
+ return "";
126535
126577
  }
126536
- analysisPlaceholder() {
126537
- return this.ref.parse("");
126578
+ stdout() {
126579
+ return new CommandBuilder({ ...this.op, capture: "stdout" });
126538
126580
  }
126539
- extractDependencies(taskName) {
126540
- return [{ from: this.from.config.name, to: taskName, type: "use" }];
126581
+ code() {
126582
+ return new CommandBuilder({ ...this.op, capture: "code" });
126541
126583
  }
126542
- extractSecrets() {
126543
- return [];
126584
+ ok() {
126585
+ return new CommandBuilder({ ...this.op, capture: "ok" });
126544
126586
  }
126545
- extractRefs() {
126546
- return [{ type: "value", ref: this.ref }];
126587
+ must() {
126588
+ return new CommandBuilder({ ...this.op, capture: "must" });
126547
126589
  }
126548
- cacheNormalize(context) {
126549
- context.addDependency(this.from.config.name);
126550
- return { kind: this.kind, from: this.from.config.name, ref: this.ref.name };
126590
+ cached(options) {
126591
+ return new CommandBuilder({ ...this.op, cache: { enabled: true, ...options } });
126551
126592
  }
126552
- cachePlaceholder(context) {
126553
- return context.isPrimary ? this.ref.parse("") : undefined;
126593
+ uncached() {
126594
+ return new CommandBuilder({ ...this.op, cache: { enabled: false } });
126554
126595
  }
126555
126596
  }
126556
- // ../core/dist/ops/summary.js
126597
+ var sh = (strings, ...values) => {
126598
+ const template = buildTemplateParts(strings, values);
126599
+ return new CommandBuilder({
126600
+ kind: "command",
126601
+ capture: "result",
126602
+ template
126603
+ });
126604
+ };
126605
+
126606
+ // ../core/src/ops/summary.ts
126557
126607
  class SummaryOperation extends OperationBase {
126558
126608
  format;
126559
126609
  content;
@@ -126575,90 +126625,92 @@ class SummaryOperation extends OperationBase {
126575
126625
  var summary2 = {
126576
126626
  md: (content) => new SummaryOperation("md", content)
126577
126627
  };
126578
- // ../core/dist/ops/annotate.js
126579
- class AnnotateOperation extends OperationBase {
126580
- level;
126628
+
126629
+ // ../core/src/dsl/pipeline-globals.ts
126630
+ var KITSI_GLOBALS_KEY = Symbol.for("kitsi.globals");
126631
+ var KITSI_GLOBALS = {
126632
+ plan,
126633
+ task,
126634
+ step,
126635
+ kit,
126636
+ image,
126637
+ service,
126638
+ registry,
126639
+ sh,
126640
+ http,
126641
+ secret,
126642
+ env,
126643
+ param,
126644
+ out: out2,
126645
+ emit,
126646
+ use,
126647
+ pack,
126648
+ unpack,
126649
+ artifact: artifact2,
126650
+ cache: cache2,
126651
+ cacheOr,
126652
+ report,
126653
+ annotate,
126654
+ summary: summary2,
126655
+ bind
126656
+ };
126657
+ var registerPipelineGlobals = () => {
126658
+ const target = globalThis;
126659
+ if (target[KITSI_GLOBALS_KEY])
126660
+ return;
126661
+ Object.assign(target, KITSI_GLOBALS);
126662
+ Object.defineProperty(target, KITSI_GLOBALS_KEY, {
126663
+ value: true,
126664
+ enumerable: false,
126665
+ configurable: false,
126666
+ writable: false
126667
+ });
126668
+ };
126669
+ // ../core/src/ops/errors.ts
126670
+ class OpErrorBuilder {
126671
+ type;
126581
126672
  message;
126582
- location;
126583
- constructor(level, message, location) {
126584
- super();
126585
- this.level = level;
126673
+ context = {};
126674
+ constructor(type, message) {
126675
+ this.type = type;
126586
126676
  this.message = message;
126587
- if (location)
126588
- this.location = location;
126589
- }
126590
- get kind() {
126591
- return "annotate";
126592
- }
126593
- toOp() {
126594
- return {
126595
- kind: "annotate",
126596
- level: this.level,
126597
- message: this.message,
126598
- ...this.location ? { location: this.location } : {}
126599
- };
126600
- }
126601
- cacheNormalize(_context) {
126602
- return { kind: this.kind, level: this.level, message: this.message };
126603
126677
  }
126604
- }
126605
- var createAnnotation = (level) => (message, location) => new AnnotateOperation(level, message, location);
126606
- var annotate = {
126607
- error: createAnnotation("error"),
126608
- warning: createAnnotation("warning"),
126609
- info: createAnnotation("info")
126610
- };
126611
- // ../core/dist/ops/report.js
126612
- class ReportOperation extends OperationBase {
126613
- reportType;
126614
- path;
126615
- constructor(reportType, path) {
126616
- super();
126617
- this.reportType = reportType;
126618
- this.path = path;
126678
+ inTask(task2) {
126679
+ this.context.task = task2;
126680
+ return this;
126619
126681
  }
126620
- get kind() {
126621
- return "report";
126682
+ inStep(step2) {
126683
+ this.context.step = step2;
126684
+ return this;
126622
126685
  }
126623
- toOp() {
126624
- return { kind: "report", reportType: this.reportType, path: this.path };
126686
+ causedBy(cause) {
126687
+ this.context.cause = cause;
126688
+ return this;
126625
126689
  }
126626
- cacheNormalize(_context) {
126627
- return { kind: this.kind, reportType: this.reportType, path: this.path };
126690
+ build() {
126691
+ return { type: this.type, message: this.message, ...this.context };
126628
126692
  }
126629
126693
  }
126630
- var report = {
126631
- junit: (path) => new ReportOperation("junit", path),
126632
- coverage: (path) => new ReportOperation("coverage", path)
126694
+ var OpErrors = {
126695
+ bundle: (message) => new OpErrorBuilder("bundle", message),
126696
+ artifact: (message) => new OpErrorBuilder("artifact", message),
126697
+ command: (message) => new OpErrorBuilder("command", message),
126698
+ http: (message) => new OpErrorBuilder("http", message),
126699
+ secret: (message) => new OpErrorBuilder("secret", message),
126700
+ param: (message) => new OpErrorBuilder("param", message),
126701
+ value: (message) => new OpErrorBuilder("value", message),
126702
+ validation: (message) => new OpErrorBuilder("validation", message),
126703
+ env: (message) => new OpErrorBuilder("env", message),
126704
+ cache: (message) => new OpErrorBuilder("cache", message),
126705
+ report: (message) => new OpErrorBuilder("report", message),
126706
+ annotation: (message) => new OpErrorBuilder("annotation", message),
126707
+ service: (message) => new OpErrorBuilder("service", message),
126708
+ timeout: (message) => new OpErrorBuilder("timeout", message)
126633
126709
  };
126634
- // ../core/dist/ops/bind.js
126635
- class BindServiceOperation extends OperationBase {
126636
- service;
126637
- alias;
126638
- constructor(service2, alias) {
126639
- super();
126640
- this.service = service2;
126641
- if (alias)
126642
- this.alias = alias;
126643
- }
126644
- get kind() {
126645
- return "bind-service";
126646
- }
126647
- toOp() {
126648
- const op = { kind: "bind-service", service: this.service };
126649
- if (this.alias)
126650
- op.alias = this.alias;
126651
- return op;
126652
- }
126653
- cacheNormalize(_context) {
126654
- return { kind: this.kind, service: this.service, alias: this.alias ?? null };
126655
- }
126656
- }
126657
- var bind = (serviceInstance, alias) => new BindServiceOperation(serviceInstance, alias);
126658
- // ../core/dist/engine/cache/coordinator.js
126710
+ // ../core/src/engine/cache/coordinator.ts
126659
126711
  import { join as join4 } from "node:path";
126660
126712
 
126661
- // ../core/dist/engine/executor/file-system.js
126713
+ // ../core/src/engine/executor/file-system.ts
126662
126714
  var import_picomatch2 = __toESM(require_picomatch2(), 1);
126663
126715
  import { mkdir as mkdir2, readFile as readFile3, readdir, stat, writeFile } from "node:fs/promises";
126664
126716
  import { dirname, join, relative } from "node:path";
@@ -126706,7 +126758,7 @@ var writeFiles = async (basePath, files) => {
126706
126758
  }));
126707
126759
  };
126708
126760
 
126709
- // ../core/dist/engine/cache/serialize.js
126761
+ // ../core/src/engine/cache/serialize.ts
126710
126762
  var isPlainObject = (value) => typeof value === "object" && value !== null && !Array.isArray(value);
126711
126763
  var stableStringify = (value) => {
126712
126764
  if (value === null || value === undefined)
@@ -126726,7 +126778,7 @@ var stableStringify = (value) => {
126726
126778
  return JSON.stringify(String(value));
126727
126779
  };
126728
126780
 
126729
- // ../core/dist/engine/cache/analyze.js
126781
+ // ../core/src/engine/cache/analyze.ts
126730
126782
  var createPlaceholderTracker = () => {
126731
126783
  let touched = false;
126732
126784
  const placeholder = new Proxy(() => {
@@ -126828,7 +126880,7 @@ var analyzeTaskSteps = (task2, workspace) => {
126828
126880
  return primary.analysis;
126829
126881
  };
126830
126882
 
126831
- // ../core/dist/engine/cache/hasher.js
126883
+ // ../core/src/engine/cache/hasher.ts
126832
126884
  import { createHash as createHash2 } from "node:crypto";
126833
126885
  import { readFile as readFile4 } from "node:fs/promises";
126834
126886
  import { join as join2, relative as relative2 } from "node:path";
@@ -126877,7 +126929,7 @@ var hashNamedValues = (values) => {
126877
126929
  return toHex(overall);
126878
126930
  };
126879
126931
 
126880
- // ../core/dist/engine/cache/inference.js
126932
+ // ../core/src/engine/cache/inference.ts
126881
126933
  var trimCommand = (command) => command.replace(/\s+/g, " ").trim();
126882
126934
  var inferInputsFromCommand = (command) => {
126883
126935
  const normalized = trimCommand(command.toLowerCase());
@@ -126921,7 +126973,7 @@ var inferOutputsFromCommand = (command) => {
126921
126973
  return [];
126922
126974
  };
126923
126975
 
126924
- // ../core/dist/engine/cache/store.js
126976
+ // ../core/src/engine/cache/store.ts
126925
126977
  import { existsSync } from "node:fs";
126926
126978
  import { mkdir as mkdir3, readFile as readFile5, readdir as readdir2, rm, stat as stat2, writeFile as writeFile2 } from "node:fs/promises";
126927
126979
  import { join as join3 } from "node:path";
@@ -127158,7 +127210,7 @@ class CacheStore {
127158
127210
  }
127159
127211
  }
127160
127212
 
127161
- // ../core/dist/engine/cache/coordinator.js
127213
+ // ../core/src/engine/cache/coordinator.ts
127162
127214
  class CacheCoordinator {
127163
127215
  workspace;
127164
127216
  settings;
@@ -127897,7 +127949,7 @@ class CacheCoordinator {
127897
127949
  }
127898
127950
  }
127899
127951
 
127900
- // ../core/dist/engine/handlers/annotate-handler.js
127952
+ // ../core/src/engine/handlers/annotate-handler.ts
127901
127953
  class AnnotateHandler {
127902
127954
  kind = "annotate";
127903
127955
  async execute(op, context, _state) {
@@ -127906,7 +127958,7 @@ class AnnotateHandler {
127906
127958
  }
127907
127959
  }
127908
127960
 
127909
- // ../core/dist/engine/handlers/artifact-download-handler.js
127961
+ // ../core/src/engine/handlers/artifact-download-handler.ts
127910
127962
  import { existsSync as existsSync2 } from "node:fs";
127911
127963
  import { mkdir as mkdir4, readFile as readFile6 } from "node:fs/promises";
127912
127964
  import { join as join5, relative as relative3 } from "node:path";
@@ -127942,7 +127994,7 @@ class ArtifactDownloadHandler {
127942
127994
  }
127943
127995
  }
127944
127996
 
127945
- // ../core/dist/engine/handlers/artifact-upload-handler.js
127997
+ // ../core/src/engine/handlers/artifact-upload-handler.ts
127946
127998
  import { join as join6 } from "node:path";
127947
127999
  class ArtifactUploadHandler {
127948
128000
  kind = "artifact-upload";
@@ -127967,7 +128019,7 @@ class ArtifactUploadHandler {
127967
128019
  }
127968
128020
  }
127969
128021
 
127970
- // ../core/dist/engine/handlers/bind-service-handler.js
128022
+ // ../core/src/engine/handlers/bind-service-handler.ts
127971
128023
  class BindServiceHandler {
127972
128024
  kind = "bind-service";
127973
128025
  async execute(op, context, _state) {
@@ -127976,7 +128028,7 @@ class BindServiceHandler {
127976
128028
  }
127977
128029
  }
127978
128030
 
127979
- // ../core/dist/engine/handlers/cache-mount-handler.js
128031
+ // ../core/src/engine/handlers/cache-mount-handler.ts
127980
128032
  import { existsSync as existsSync3 } from "node:fs";
127981
128033
  import { mkdir as mkdir5 } from "node:fs/promises";
127982
128034
  import { join as join7 } from "node:path";
@@ -127994,7 +128046,7 @@ class CacheMountHandler {
127994
128046
  }
127995
128047
  }
127996
128048
 
127997
- // ../core/dist/engine/handlers/command-handler.js
128049
+ // ../core/src/engine/handlers/command-handler.ts
127998
128050
  class CommandHandler {
127999
128051
  runner;
128000
128052
  kind = "command";
@@ -128006,7 +128058,7 @@ class CommandHandler {
128006
128058
  }
128007
128059
  }
128008
128060
 
128009
- // ../core/dist/engine/handlers/emit-handler.js
128061
+ // ../core/src/engine/handlers/emit-handler.ts
128010
128062
  class EmitHandler {
128011
128063
  kind = "emit";
128012
128064
  async execute(op, _context, state) {
@@ -128015,7 +128067,7 @@ class EmitHandler {
128015
128067
  }
128016
128068
  }
128017
128069
 
128018
- // ../core/dist/engine/handlers/env-handler.js
128070
+ // ../core/src/engine/handlers/env-handler.ts
128019
128071
  class EnvHandler {
128020
128072
  kind = "env";
128021
128073
  async execute(op, context, _state) {
@@ -128025,7 +128077,7 @@ class EnvHandler {
128025
128077
  }
128026
128078
  }
128027
128079
 
128028
- // ../core/dist/engine/handlers/http-handler.js
128080
+ // ../core/src/engine/handlers/http-handler.ts
128029
128081
  import { readFile as readFile7 } from "node:fs/promises";
128030
128082
  import { isAbsolute, resolve } from "node:path";
128031
128083
  class HttpHandler {
@@ -128092,7 +128144,7 @@ class HttpHandler {
128092
128144
  }
128093
128145
  }
128094
128146
 
128095
- // ../core/dist/engine/handlers/pack-handler.js
128147
+ // ../core/src/engine/handlers/pack-handler.ts
128096
128148
  class PackHandler {
128097
128149
  kind = "pack";
128098
128150
  async execute(op, context, state) {
@@ -128105,7 +128157,7 @@ class PackHandler {
128105
128157
  }
128106
128158
  }
128107
128159
 
128108
- // ../core/dist/engine/handlers/registry.js
128160
+ // ../core/src/engine/handlers/registry.ts
128109
128161
  class OpHandlerRegistry {
128110
128162
  handlers = new Map;
128111
128163
  register(handler) {
@@ -128120,7 +128172,7 @@ class OpHandlerRegistry {
128120
128172
  }
128121
128173
  }
128122
128174
 
128123
- // ../core/dist/engine/handlers/report-handler.js
128175
+ // ../core/src/engine/handlers/report-handler.ts
128124
128176
  class ReportHandler {
128125
128177
  kind = "report";
128126
128178
  async execute(op, context, _state) {
@@ -128134,7 +128186,7 @@ class ReportHandler {
128134
128186
  }
128135
128187
  }
128136
128188
 
128137
- // ../core/dist/engine/handlers/summary-handler.js
128189
+ // ../core/src/engine/handlers/summary-handler.ts
128138
128190
  class SummaryHandler {
128139
128191
  kind = "summary";
128140
128192
  async execute(op, _context, state) {
@@ -128143,7 +128195,7 @@ class SummaryHandler {
128143
128195
  }
128144
128196
  }
128145
128197
 
128146
- // ../core/dist/engine/handlers/unpack-handler.js
128198
+ // ../core/src/engine/handlers/unpack-handler.ts
128147
128199
  class UnpackHandler {
128148
128200
  executeTask;
128149
128201
  states;
@@ -128166,7 +128218,7 @@ class UnpackHandler {
128166
128218
  }
128167
128219
  }
128168
128220
 
128169
- // ../core/dist/engine/handlers/use-handler.js
128221
+ // ../core/src/engine/handlers/use-handler.ts
128170
128222
  class UseHandler {
128171
128223
  executeTask;
128172
128224
  states;
@@ -128188,7 +128240,7 @@ class UseHandler {
128188
128240
  }
128189
128241
  }
128190
128242
 
128191
- // ../core/dist/engine/executor/buffering-reporter.js
128243
+ // ../core/src/engine/executor/buffering-reporter.ts
128192
128244
  class BufferingReporter {
128193
128245
  target;
128194
128246
  taskBuffers = new Map;
@@ -128240,7 +128292,7 @@ class BufferingReporter {
128240
128292
  }
128241
128293
  }
128242
128294
 
128243
- // ../core/dist/engine/executor/command-runner.js
128295
+ // ../core/src/engine/executor/command-runner.ts
128244
128296
  import { spawn } from "node:child_process";
128245
128297
  class CommandRunner {
128246
128298
  workspace;
@@ -128374,7 +128426,7 @@ class CommandRunner {
128374
128426
  }
128375
128427
  }
128376
128428
 
128377
- // ../core/dist/engine/executor/value-resolver.js
128429
+ // ../core/src/engine/executor/value-resolver.ts
128378
128430
  class ValueResolver {
128379
128431
  states;
128380
128432
  params;
@@ -128437,7 +128489,7 @@ class ValueResolver {
128437
128489
  }
128438
128490
  }
128439
128491
 
128440
- // ../core/dist/engine/executor/plan-runner.js
128492
+ // ../core/src/engine/executor/plan-runner.ts
128441
128493
  function mergeEnv(...sources) {
128442
128494
  const merged = {};
128443
128495
  for (const source of sources) {
@@ -128894,7 +128946,7 @@ class PlanRunner {
128894
128946
  }
128895
128947
  }
128896
128948
 
128897
- // ../core/dist/engine/executor/executor.js
128949
+ // ../core/src/engine/executor/executor.ts
128898
128950
  var defaultLogger = {
128899
128951
  info: (message) => console.log(message),
128900
128952
  error: (message) => console.error(message),
@@ -128921,46 +128973,8 @@ var runPlan = async (registryOrPlan, planName, options = {}) => {
128921
128973
  return runner.run();
128922
128974
  };
128923
128975
  // ../cli/dist/bin/pipeline-authoring.js
128924
- var KITSI_GLOBALS_KEY = Symbol.for("kitsi.globals");
128925
128976
  var KITSI_TYPES_VERSION = VERSION;
128926
- var KITSI_GLOBALS = {
128927
- plan,
128928
- task,
128929
- step,
128930
- kit,
128931
- image,
128932
- service,
128933
- registry,
128934
- sh,
128935
- http,
128936
- secret,
128937
- env,
128938
- param,
128939
- out: out2,
128940
- emit,
128941
- use,
128942
- pack,
128943
- unpack,
128944
- artifact: artifact2,
128945
- cache: cache2,
128946
- cacheOr,
128947
- report,
128948
- annotate,
128949
- summary: summary2,
128950
- bind
128951
- };
128952
- var registerPipelineGlobals = () => {
128953
- const target = globalThis;
128954
- if (target[KITSI_GLOBALS_KEY])
128955
- return;
128956
- Object.assign(target, KITSI_GLOBALS);
128957
- Object.defineProperty(target, KITSI_GLOBALS_KEY, {
128958
- value: true,
128959
- enumerable: false,
128960
- configurable: false,
128961
- writable: false
128962
- });
128963
- };
128977
+ var registerPipelineGlobals2 = registerPipelineGlobals;
128964
128978
  var KITSI_TYPES_HEADER = `// @kitsi-types v${KITSI_TYPES_VERSION}
128965
128979
  // Generated by kitsi types - do not edit manually
128966
128980
  `;
@@ -129003,7 +129017,7 @@ function parseTimeout(timeout) {
129003
129017
  }
129004
129018
  }
129005
129019
  async function loadPipeline(file, cwd) {
129006
- registerPipelineGlobals();
129020
+ registerPipelineGlobals2();
129007
129021
  const resolved = resolvePath2(cwd, file);
129008
129022
  const moduleUrl = pathToFileURL(resolved).href;
129009
129023
  const loaded = await import(moduleUrl);