@usine/config 0.2.1 → 0.4.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 (74) hide show
  1. package/LICENSE +661 -21
  2. package/README.md +32 -18
  3. package/dist/agent.d.ts +2 -3
  4. package/dist/agent.d.ts.map +1 -1
  5. package/dist/agent.js +2 -3
  6. package/dist/agent.js.map +1 -1
  7. package/dist/board.d.ts +11 -6
  8. package/dist/board.d.ts.map +1 -1
  9. package/dist/board.js +11 -6
  10. package/dist/board.js.map +1 -1
  11. package/dist/checks.d.ts +3 -0
  12. package/dist/checks.d.ts.map +1 -1
  13. package/dist/checks.js +3 -0
  14. package/dist/checks.js.map +1 -1
  15. package/dist/factory.d.ts +258 -22
  16. package/dist/factory.d.ts.map +1 -1
  17. package/dist/factory.js +270 -30
  18. package/dist/factory.js.map +1 -1
  19. package/dist/file.d.ts +3 -3
  20. package/dist/file.d.ts.map +1 -1
  21. package/dist/file.js +3 -3
  22. package/dist/file.js.map +1 -1
  23. package/dist/frontmatter.d.ts +1 -1
  24. package/dist/frontmatter.d.ts.map +1 -1
  25. package/dist/frontmatter.js +1 -1
  26. package/dist/frontmatter.js.map +1 -1
  27. package/dist/instance/diagnostics.d.ts +1 -1
  28. package/dist/instance/diagnostics.d.ts.map +1 -1
  29. package/dist/instance/diagnostics.js +1 -1
  30. package/dist/instance/diagnostics.js.map +1 -1
  31. package/dist/instance/instance.d.ts +1 -1
  32. package/dist/instance/instance.d.ts.map +1 -1
  33. package/dist/instance/instance.js +2 -2
  34. package/dist/instance/instance.js.map +1 -1
  35. package/dist/instance/references.d.ts +5 -6
  36. package/dist/instance/references.d.ts.map +1 -1
  37. package/dist/instance/references.js +9 -9
  38. package/dist/instance/references.js.map +1 -1
  39. package/dist/instance-folder.d.ts +1 -1
  40. package/dist/instance-folder.d.ts.map +1 -1
  41. package/dist/instance-folder.js +13 -1
  42. package/dist/instance-folder.js.map +1 -1
  43. package/dist/label.d.ts +5 -5
  44. package/dist/label.d.ts.map +1 -1
  45. package/dist/label.js +5 -5
  46. package/dist/label.js.map +1 -1
  47. package/dist/loop.d.ts +12 -3
  48. package/dist/loop.d.ts.map +1 -1
  49. package/dist/loop.js +14 -6
  50. package/dist/loop.js.map +1 -1
  51. package/dist/parser.d.ts +6 -6
  52. package/dist/parser.d.ts.map +1 -1
  53. package/dist/parser.js +30 -11
  54. package/dist/parser.js.map +1 -1
  55. package/dist/payload-slices.d.ts +4 -7
  56. package/dist/payload-slices.d.ts.map +1 -1
  57. package/dist/payload-slices.js +30 -25
  58. package/dist/payload-slices.js.map +1 -1
  59. package/dist/selector.d.ts +6 -3
  60. package/dist/selector.d.ts.map +1 -1
  61. package/dist/selector.js +10 -6
  62. package/dist/selector.js.map +1 -1
  63. package/dist/trigger.d.ts +4 -7
  64. package/dist/trigger.d.ts.map +1 -1
  65. package/dist/trigger.js +6 -9
  66. package/dist/trigger.js.map +1 -1
  67. package/dist/yaml/document.d.ts +2 -2
  68. package/dist/yaml/document.js +3 -3
  69. package/dist/yaml/document.js.map +1 -1
  70. package/dist/yaml/writer.d.ts +4 -4
  71. package/dist/yaml/writer.d.ts.map +1 -1
  72. package/dist/yaml/writer.js +5 -6
  73. package/dist/yaml/writer.js.map +1 -1
  74. package/package.json +12 -11
@@ -4,7 +4,11 @@ import { Schema } from "effect";
4
4
  const reference = Schema.decodeUnknownSync(TypeReference);
5
5
  const objectType = (name, fields) => new ObjectType({
6
6
  name,
7
- fields: fields.map(([fieldName, fieldType]) => new ObjectField({ name: fieldName, type: reference(fieldType) })),
7
+ fields: fields.map(([fieldName, fieldType, nullability]) => new ObjectField({
8
+ name: fieldName,
9
+ type: reference(fieldType),
10
+ nullable: nullability === "nullable",
11
+ })),
8
12
  });
9
13
  const actor = objectType("Actor", [["login", "string"]]);
10
14
  const label = objectType("Label", [["name", "string"]]);
@@ -25,7 +29,7 @@ const assignees = objectType("Assignees", [
25
29
  ["nodes", "list<Actor>"],
26
30
  ]);
27
31
  const issueComment = objectType("IssueComment", [
28
- ["author", "Actor"],
32
+ ["author", "Actor", "nullable"],
29
33
  ["body", "string"],
30
34
  ["createdAt", "string"],
31
35
  ]);
@@ -49,37 +53,39 @@ const issue = objectType("IssuePayload", [
49
53
  ["body", "string"],
50
54
  ["url", "string"],
51
55
  ["state", "string"],
52
- ["stateReason", "string"],
56
+ ["stateReason", "string", "nullable"],
53
57
  ["createdAt", "string"],
54
58
  ["updatedAt", "string"],
55
- ["closedAt", "string"],
56
- ["author", "Actor"],
57
- ["issueType", "IssueType"],
58
- ["milestone", "Milestone"],
59
+ ["closedAt", "string", "nullable"],
60
+ ["author", "Actor", "nullable"],
61
+ ["issueType", "IssueType", "nullable"],
62
+ ["milestone", "Milestone", "nullable"],
59
63
  ["labels", "Labels"],
60
64
  ["assignees", "Assignees"],
61
65
  ["comments", "IssueComments"],
62
66
  ["closedByPullRequestsReferences", "PullRequestReferences"],
63
67
  ]);
64
- const requestedReviewer = objectType("RequestedReviewer", [["login", "string"]]);
65
- const reviewRequest = objectType("ReviewRequest", [["requestedReviewer", "RequestedReviewer"]]);
68
+ const requestedReviewer = objectType("RequestedReviewer", [["login", "string", "nullable"]]);
69
+ const reviewRequest = objectType("ReviewRequest", [
70
+ ["requestedReviewer", "RequestedReviewer", "nullable"],
71
+ ]);
66
72
  const reviewRequests = objectType("ReviewRequests", [
67
73
  ["totalCount", "int"],
68
74
  ["nodes", "list<ReviewRequest>"],
69
75
  ]);
70
76
  const review = objectType("Review", [
71
- ["author", "Actor"],
77
+ ["author", "Actor", "nullable"],
72
78
  ["state", "string"],
73
79
  ["body", "string"],
74
- ["submittedAt", "string"],
75
- ["commit", "Commit"],
80
+ ["submittedAt", "string", "nullable"],
81
+ ["commit", "Commit", "nullable"],
76
82
  ]);
77
83
  const reviews = objectType("Reviews", [
78
84
  ["totalCount", "int"],
79
85
  ["nodes", "list<Review>"],
80
86
  ]);
81
87
  const reviewThreadComment = objectType("ReviewThreadComment", [
82
- ["author", "Actor"],
88
+ ["author", "Actor", "nullable"],
83
89
  ["body", "string"],
84
90
  ]);
85
91
  const reviewThreadComments = objectType("ReviewThreadComments", [
@@ -97,7 +103,7 @@ const reviewThreads = objectType("ReviewThreads", [
97
103
  ["nodes", "list<ReviewThread>"],
98
104
  ]);
99
105
  const pullRequestComment = objectType("PullRequestComment", [
100
- ["author", "Actor"],
106
+ ["author", "Actor", "nullable"],
101
107
  ["body", "string"],
102
108
  ["createdAt", "string"],
103
109
  ]);
@@ -124,16 +130,18 @@ const pullRequest = objectType("PullRequestPayload", [
124
130
  ["merged", "bool"],
125
131
  ["createdAt", "string"],
126
132
  ["updatedAt", "string"],
127
- ["mergedAt", "string"],
128
- ["author", "Actor"],
133
+ ["mergedAt", "string", "nullable"],
134
+ ["author", "Actor", "nullable"],
129
135
  ["baseRefName", "string"],
130
136
  ["headRefName", "string"],
131
137
  ["headRefOid", "string"],
132
138
  ["additions", "int"],
133
139
  ["deletions", "int"],
134
140
  ["changedFiles", "int"],
135
- ["reviewDecision", "string"],
136
- ["statusCheckRollup", "StatusCheckRollup"],
141
+ ["reviewDecision", "string", "nullable"],
142
+ ["mergeable", "string"],
143
+ ["mergeStateStatus", "string"],
144
+ ["statusCheckRollup", "StatusCheckRollup", "nullable"],
137
145
  ["labels", "Labels"],
138
146
  ["reviewRequests", "ReviewRequests"],
139
147
  ["reviews", "Reviews"],
@@ -155,7 +163,7 @@ const environment = (types, itemType) => new Environment({
155
163
  new Variable({ name: "item", type: reference(itemType) }),
156
164
  ],
157
165
  });
158
- /** The CEL environment for issue triggers: the `item` type mirrors the issue payload slice. */
166
+ /** The CEL environment for issue triggers, with the issue payload slice as `item`. */
159
167
  export const issueEnvironment = environment([
160
168
  actor,
161
169
  label,
@@ -169,7 +177,7 @@ export const issueEnvironment = environment([
169
177
  pullRequestReferences,
170
178
  issue,
171
179
  ], "IssuePayload");
172
- /** The CEL environment for pull-request triggers: the `item` type mirrors the pull-request payload slice. */
180
+ /** The CEL environment for pull-request triggers, with the pull-request payload slice as `item`. */
173
181
  export const pullRequestEnvironment = environment([
174
182
  actor,
175
183
  label,
@@ -191,7 +199,7 @@ export const pullRequestEnvironment = environment([
191
199
  statusCheckRollup,
192
200
  pullRequest,
193
201
  ], "PullRequestPayload");
194
- /** The CEL environment for schedule triggers: `item.tick` has `scheduledAt`, `scheduledAtLocal`, `cron`, and `tz`. */
202
+ /** The CEL environment for schedule triggers; `item.tick` has `scheduledAt`, `scheduledAtLocal`, `cron`, and `tz`. */
195
203
  export const scheduleEnvironment = environment([tick, schedule], "SchedulePayload");
196
204
  export const environmentFor = (stream) => {
197
205
  switch (stream) {
@@ -203,10 +211,7 @@ export const environmentFor = (stream) => {
203
211
  return scheduleEnvironment;
204
212
  }
205
213
  };
206
- /**
207
- * The value of the CEL `repo` variable. A field added here must also be added
208
- * to the `RepoContext` type, and the reverse.
209
- */
214
+ /** Returns the value of the CEL `repo` variable; its fields must match the `RepoContext` type. */
210
215
  export const repositoryContext = (repository) => {
211
216
  const { owner } = splitRepositoryName(repository.name);
212
217
  return {
@@ -1 +1 @@
1
- {"version":3,"file":"payload-slices.js","sourceRoot":"","sources":["../src/payload-slices.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,wBAAwB,CAAC;AAC7D,OAAO,EACL,WAAW,EACX,WAAW,EACX,UAAU,EACV,aAAa,EACb,QAAQ,GACT,MAAM,qCAAqC,CAAC;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAIhC,MAAM,SAAS,GAAG,MAAM,CAAC,iBAAiB,CAAC,aAAa,CAAC,CAAC;AAI1D,MAAM,UAAU,GAAG,CAAC,IAAY,EAAE,MAAuC,EAAc,EAAE,CACvF,IAAI,UAAU,CAAC;IACb,IAAI;IACJ,MAAM,EAAE,MAAM,CAAC,GAAG,CAChB,CAAC,CAAC,SAAS,EAAE,SAAS,CAAC,EAAE,EAAE,CAAC,IAAI,WAAW,CAAC,EAAE,IA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YAAY;IACZ,aAAa;IACb,oBAAoB;IACpB,qBAAqB;IACrB,KAAK;CACN,EACD,cAAc,CACf,CAAC;AAEF,oGAAoG;AACpG,MAAM,CAAC,MAAM,sBAAsB,GAAG,WAAW,CAC/C;IACE,KAAK;IACL,KAAK;IACL,MAAM;IACN,MAAM;IACN,iBAAiB;IACjB,aAAa;IACb,cAAc;IACd,MAAM;IACN,OAAO;IACP,mBAAmB;IACnB,oBAAoB;IACpB,YAAY;IACZ,aAAa;IACb,kBAAkB;IAClB,mBAAmB;IACnB,qBAAqB;IACrB,sBAAsB;IACtB,iBAAiB;IACjB,WAAW;CACZ,EACD,oBAAoB,CACrB,CAAC;AAEF,sHAAsH;AACtH,MAAM,CAAC,MAAM,mBAAmB,GAAG,WAAW,CAAC,CAAC,IAAI,EAAE,QAAQ,CAAC,EAAE,iBAAiB,CAAC,CAAC;AAEpF,MAAM,CAAC,MAAM,cAAc,GAAG,CAAC,MAAc,EAAe,EAAE;IAC5D,QAAQ,MAAM,EAAE,CAAC;QACf,KAAK,OAAO;YACV,OAAO,gBAAgB,CAAC;QAC1B,KAAK,IAAI;YACP,OAAO,sBAAsB,CAAC;QAChC,KAAK,UAAU;YACb,OAAO,mBAAmB,CAAC;IAC/B,CAAC;AACH,CAAC,CAAC;AAEF,kGAAkG;AAClG,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,UAAuB,EAAqB,EAAE;IAC9E,MAAM,EAAE,KAAK,EAAE,GAAG,mBAAmB,CAAC,UAAU,CAAC,IAAI,CAAC,CAAC;IACvD,OAAO;QACL,IAAI,EAAE,UAAU,CAAC,IAAI;QACrB,KAAK;QACL,GAAG,EAAE,sBAAsB,UAAU,CAAC,IAAI,EAAE;KAC7C,CAAC;AACJ,CAAC,CAAC"}
@@ -4,10 +4,10 @@ declare const Selector_base: Schema.Class<Selector, Schema.Struct<{
4
4
  readonly repos: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RepositoryName">>>;
5
5
  readonly tags: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RegistryTag">>>;
6
6
  }>, {}>;
7
- /** Narrows a Loop to registry repositories by name, by any listed tag, or by both criteria together. */
7
+ /** A filter that limits a Loop to registry repositories by name, by any listed tag, or both. */
8
8
  export declare class Selector extends Selector_base {
9
9
  }
10
- /** An authored selector must name repositories or tags; omit the selector entirely to include every repository. */
10
+ /** A selector with `repos` or `tags`; to include every repository, omit the selector. */
11
11
  export declare const ValidSelector: Schema.decodeTo<Schema.declareConstructor<Selector, {
12
12
  readonly repos?: readonly string[];
13
13
  readonly tags?: readonly string[];
@@ -21,7 +21,10 @@ export declare const ValidSelector: Schema.decodeTo<Schema.declareConstructor<Se
21
21
  readonly repos: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RepositoryName">>>;
22
22
  readonly tags: Schema.OptionFromOptionalKey<Schema.$Array<Schema.brand<Schema.String, "RegistryTag">>>;
23
23
  }>, never, never>;
24
- /** Whether a repo passes the selector. Both axes must match when present; no selector matches every repo. */
24
+ /**
25
+ * Returns whether `repo` passes `selector`, matching repository names case-insensitively. If both
26
+ * `repos` and `tags` are set, both must match; `None` matches every repo.
27
+ */
25
28
  export declare const matchesSelector: (selector: Option.Option<Selector>, repo: ManagedRepo) => boolean;
26
29
  export {};
27
30
  //# sourceMappingURL=selector.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;;;;;AAE7D,wGAAwG;AACxG,qBAAa,QAAS,SAAQ,aAO5B;CAAG;AAEL,mHAAmH;AACnH,eAAO,MAAM,aAAa;;;;;;;;;;;;iBAIzB,CAAC;AAEF,6GAA6G;AAC7G,eAAO,MAAM,eAAe,aAAc,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,WAAW,KAAG,OAcnF,CAAC"}
1
+ {"version":3,"file":"selector.d.ts","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAe,KAAK,WAAW,EAAE,MAAM,cAAc,CAAC;;;;;AAE7D,gGAAgG;AAChG,qBAAa,QAAS,SAAQ,aAU5B;CAAG;AAEL,yFAAyF;AACzF,eAAO,MAAM,aAAa;;;;;;;;;;;;iBAIzB,CAAC;AAEF;;;GAGG;AACH,eAAO,MAAM,eAAe,aAAc,MAAM,CAAC,MAAM,CAAC,QAAQ,CAAC,QAAQ,WAAW,KAAG,OAiBnF,CAAC"}
package/dist/selector.js CHANGED
@@ -1,23 +1,27 @@
1
- import { RepositoryName } from "@usine/core/repository";
1
+ import { canonicalRepositoryName, RepositoryName } from "@usine/core/repository";
2
2
  import { Option, Schema } from "effect";
3
+ import { uniqueRepositoryNames } from "./checks.js";
3
4
  import { RegistryTag } from "./factory.js";
4
- /** Narrows a Loop to registry repositories by name, by any listed tag, or by both criteria together. */
5
+ /** A filter that limits a Loop to registry repositories by name, by any listed tag, or both. */
5
6
  export class Selector extends Schema.Class("@usine/config/Selector")({
6
- repos: Schema.OptionFromOptionalKey(Schema.Array(RepositoryName).check(Schema.isNonEmpty(), Schema.isUnique())),
7
+ repos: Schema.OptionFromOptionalKey(Schema.Array(RepositoryName).check(Schema.isNonEmpty(), uniqueRepositoryNames((name) => name))),
7
8
  tags: Schema.OptionFromOptionalKey(Schema.Array(RegistryTag).check(Schema.isNonEmpty(), Schema.isUnique())),
8
9
  }) {
9
10
  }
10
- /** An authored selector must name repositories or tags; omit the selector entirely to include every repository. */
11
+ /** A selector with `repos` or `tags`; to include every repository, omit the selector. */
11
12
  export const ValidSelector = Selector.check(Schema.makeFilter((selector) => Option.isSome(selector.repos) || Option.isSome(selector.tags), {
12
13
  message: "Expected selector.repos, selector.tags, or both",
13
14
  }));
14
- /** Whether a repo passes the selector. Both axes must match when present; no selector matches every repo. */
15
+ /**
16
+ * Returns whether `repo` passes `selector`, matching repository names case-insensitively. If both
17
+ * `repos` and `tags` are set, both must match; `None` matches every repo.
18
+ */
15
19
  export const matchesSelector = (selector, repo) => Option.match(selector, {
16
20
  onNone: () => true,
17
21
  onSome: (value) => {
18
22
  const matchesRepo = Option.match(value.repos, {
19
23
  onNone: () => true,
20
- onSome: (repos) => repos.includes(repo.name),
24
+ onSome: (repos) => repos.some((name) => canonicalRepositoryName(name) === canonicalRepositoryName(repo.name)),
21
25
  });
22
26
  const matchesTag = Option.match(value.tags, {
23
27
  onNone: () => true,
@@ -1 +1 @@
1
- {"version":3,"file":"selector.js","sourceRoot":"","sources":["../src/selector.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,wBAAwB,CAAC;AACxD,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,EAAE,WAAW,EAAoB,MAAM,cAAc,CAAC;AAE7D,wGAAwG;AACxG,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,KAAK,CAAW,wBAAwB,CAAC,CAAC;IAC7E,KAAK,EAAE,MAAM,CAAC,qBAAqB,CACjC,MAAM,CAAC,KAAK,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CAC3E;IACD,IAAI,EAAE,MAAM,CAAC,qBAAqB,CAChC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,EAAE,MAAM,CAAC,QAAQ,EAAE,CAAC,CACxE;CACF,CAAC;CAAG;AAEL,mHAAmH;AACnH,MAAM,CAAC,MAAM,aAAa,GAAG,QAAQ,CAAC,KAAK,CACzC,MAAM,CAAC,UAAU,CAAC,CAAC,QAAQ,EA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AAE,CAAC,uBAAuB,CAAC,IAAI,CAAC,KAAK,uBAAuB,CAAC,IAAI,CAAC,IAAI,CAAC,CAC/E;SACJ,CAAC,CAAC;QACH,MAAM,UAAU,GAAG,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,EAAE;YAC1C,MAAM,EAAE,GAAG,EAAE,CAAC,IAAI;YAClB,MAAM,EAAE,CAAC,IAAI,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,EAAE,EAAE,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,GAAG,CAAC,CAAC;SAC9D,CAAC,CAAC;QACH,OAAO,WAAW,IAAI,UAAU,CAAC;IACnC,CAAC;CACF,CAAC,CAAC"}
package/dist/trigger.d.ts CHANGED
@@ -1,22 +1,21 @@
1
1
  import { Schema } from "effect";
2
- /** A five-field schedule evaluated in the trigger's time zone. */
2
+ /** A five-field cron expression, evaluated in the trigger's time zone. */
3
3
  export declare const Cron: Schema.brand<Schema.String, "Cron">;
4
4
  export type Cron = typeof Cron.Type;
5
- /** The IANA time zone whose local clock defines a schedule's firing times. */
6
5
  export declare const TimeZone: Schema.brand<Schema.String, "TimeZone">;
7
6
  export type TimeZone = typeof TimeZone.Type;
8
7
  declare const IssueTrigger_base: Schema.Class<IssueTrigger, Schema.Struct<{
9
8
  readonly on: Schema.Literal<"issue">;
10
9
  readonly if: Schema.brand<Schema.String, "ExpressionSource">;
11
10
  }>, {}>;
12
- /** Watches issues and selects matching payloads with the Loop's `if` expression. */
11
+ /** A trigger that selects issues matching the Loop's `if` expression. */
13
12
  export declare class IssueTrigger extends IssueTrigger_base {
14
13
  }
15
14
  declare const PullRequestTrigger_base: Schema.Class<PullRequestTrigger, Schema.Struct<{
16
15
  readonly on: Schema.Literal<"pr">;
17
16
  readonly if: Schema.brand<Schema.String, "ExpressionSource">;
18
17
  }>, {}>;
19
- /** Watches pull requests and selects matching payloads with the Loop's `if` expression. */
18
+ /** A trigger that selects pull requests matching the Loop's `if` expression. */
20
19
  export declare class PullRequestTrigger extends PullRequestTrigger_base {
21
20
  }
22
21
  declare const ScheduleTrigger_base: Schema.Class<ScheduleTrigger, Schema.Struct<{
@@ -25,13 +24,11 @@ declare const ScheduleTrigger_base: Schema.Class<ScheduleTrigger, Schema.Struct<
25
24
  readonly cron: Schema.brand<Schema.String, "Cron">;
26
25
  readonly tz: Schema.withDecodingDefaultKey<Schema.brand<Schema.String, "TimeZone">, never>;
27
26
  }>, {}>;
28
- /** Fires per selected repository on a schedule, catching up only the latest missed Tick after downtime. */
27
+ /** A trigger that produces one Event per selected repository at each cron time. After downtime, produces only the latest missed Tick. */
29
28
  export declare class ScheduleTrigger extends ScheduleTrigger_base {
30
29
  }
31
- /** The standing Item condition or schedule that produces Events for a Loop. */
32
30
  export declare const Trigger: Schema.Union<readonly [typeof IssueTrigger, typeof PullRequestTrigger, typeof ScheduleTrigger]>;
33
31
  export type Trigger = typeof Trigger.Type;
34
- /** The class of state a Loop watches: issues, pull requests, or scheduled Ticks. */
35
32
  export type Stream = Trigger["on"];
36
33
  export {};
37
34
  //# sourceMappingURL=trigger.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../src/trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,MAAM,EAAE,MAAM,QAAQ,CAAC;AAQtF,kEAAkE;AAClE,eAAO,MAAM,IAAI,qCAEW,CAAC;AAE7B,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAIpC,8EAA8E;AAC9E,eAAO,MAAM,QAAQ,yCAEW,CAAC;AAEjC,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;;;;;AAE5C,oFAAoF;AACpF,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;AAEL,2FAA2F;AAC3F,qBAAa,kBAAmB,SAAQ,uBAKtC;CAAG;;;;;;;AAEL,2GAA2G;AAC3G,qBAAa,eAAgB,SAAQ,oBAOpC;CAAG;AAEJ,+EAA+E;AAC/E,eAAO,MAAM,OAAO,iGAAoE,CAAC;AAEzF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,oFAAoF;AACpF,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
1
+ {"version":3,"file":"trigger.d.ts","sourceRoot":"","sources":["../src/trigger.ts"],"names":[],"mappings":"AACA,OAAO,EAAwD,MAAM,EAAE,MAAM,QAAQ,CAAC;AAOtF,0EAA0E;AAC1E,eAAO,MAAM,IAAI,qCAEW,CAAC;AAE7B,MAAM,MAAM,IAAI,GAAG,OAAO,IAAI,CAAC,IAAI,CAAC;AAIpC,eAAO,MAAM,QAAQ,yCAEW,CAAC;AAEjC,MAAM,MAAM,QAAQ,GAAG,OAAO,QAAQ,CAAC,IAAI,CAAC;;;;;AAE5C,yEAAyE;AACzE,qBAAa,YAAa,SAAQ,iBAGhC;CAAG;;;;;AAEL,gFAAgF;AAChF,qBAAa,kBAAmB,SAAQ,uBAKtC;CAAG;;;;;;;AAEL,yIAAyI;AACzI,qBAAa,eAAgB,SAAQ,oBAOpC;CAAG;AAEJ,eAAO,MAAM,OAAO,iGAAoE,CAAC;AAEzF,MAAM,MAAM,OAAO,GAAG,OAAO,OAAO,CAAC,IAAI,CAAC;AAE1C,MAAM,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC"}
package/dist/trigger.js CHANGED
@@ -1,27 +1,25 @@
1
1
  import { Source } from "@usine/expression/expression-engine";
2
2
  import { Cron as EffectCron, DateTime, Effect, Option, Result, Schema } from "effect";
3
- // Uses the same Cron parser the scheduler evaluates with, so a cron that parses
4
- // here parses at tick time too. Cron.prev and Cron.next can still fail inside a
5
- // DST gap; the scheduler isolates that per schedule.
3
+ // Uses the scheduler's Cron parser. `Cron.prev` and `Cron.next` can still fail in a DST gap; the
4
+ // scheduler handles that per schedule.
6
5
  const isFiveFieldCron = (value) => value.trim().split(/\s+/u).length === 5 && Result.isSuccess(EffectCron.parse(value));
7
- /** A five-field schedule evaluated in the trigger's time zone. */
6
+ /** A five-field cron expression, evaluated in the trigger's time zone. */
8
7
  export const Cron = Schema.String.check(Schema.makeFilter(isFiveFieldCron, { message: "Expected a valid five-field cron expression" })).pipe(Schema.brand("Cron"));
9
8
  const isTimeZone = (value) => Option.isSome(DateTime.zoneMakeNamed(value));
10
- /** The IANA time zone whose local clock defines a schedule's firing times. */
11
9
  export const TimeZone = Schema.String.check(Schema.makeFilter(isTimeZone, { message: "Expected an IANA time-zone name" })).pipe(Schema.brand("TimeZone"));
12
- /** Watches issues and selects matching payloads with the Loop's `if` expression. */
10
+ /** A trigger that selects issues matching the Loop's `if` expression. */
13
11
  export class IssueTrigger extends Schema.Class("@usine/config/IssueTrigger")({
14
12
  on: Schema.Literal("issue"),
15
13
  if: Source,
16
14
  }) {
17
15
  }
18
- /** Watches pull requests and selects matching payloads with the Loop's `if` expression. */
16
+ /** A trigger that selects pull requests matching the Loop's `if` expression. */
19
17
  export class PullRequestTrigger extends Schema.Class("@usine/config/PullRequestTrigger")({
20
18
  on: Schema.Literal("pr"),
21
19
  if: Source,
22
20
  }) {
23
21
  }
24
- /** Fires per selected repository on a schedule, catching up only the latest missed Tick after downtime. */
22
+ /** A trigger that produces one Event per selected repository at each cron time. After downtime, produces only the latest missed Tick. */
25
23
  export class ScheduleTrigger extends Schema.Class("@usine/config/ScheduleTrigger")({
26
24
  on: Schema.Literal("schedule"),
27
25
  if: Source,
@@ -29,6 +27,5 @@ export class ScheduleTrigger extends Schema.Class("@usine/config/ScheduleTrigger
29
27
  tz: TimeZone.pipe(Schema.withDecodingDefaultKey(Effect.succeed("UTC"))),
30
28
  }) {
31
29
  }
32
- /** The standing Item condition or schedule that produces Events for a Loop. */
33
30
  export const Trigger = Schema.Union([IssueTrigger, PullRequestTrigger, ScheduleTrigger]);
34
31
  //# sourceMappingURL=trigger.js.map
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AC,CAAC;CACxE,CACF;CAAG;AAEJ,MAAM,CAAC,MAAM,OAAO,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,YAAY,EAAE,kBAAkB,EAAE,eAAe,CAAC,CAAC,CAAC"}
@@ -2,8 +2,8 @@ import { Effect } from "effect";
2
2
  import { type Document } from "yaml";
3
3
  import { ConfigFileError, type InstancePath } from "../file.ts";
4
4
  /**
5
- * Parses YAML into a Document AST that keeps source tokens, so an edit through
6
- * it preserves formatting. Duplicate keys and parser warnings are errors.
5
+ * Parses YAML into a Document that keeps source tokens, so edits preserve formatting. Fails on
6
+ * duplicate keys and parser warnings.
7
7
  */
8
8
  export declare const parseYamlDocument: (file: InstancePath, source: string) => Effect.Effect<Document.Parsed, ConfigFileError>;
9
9
  //# sourceMappingURL=document.d.ts.map
@@ -2,12 +2,12 @@ import { Effect, Option, Schema } from "effect";
2
2
  import { parseDocument } from "yaml";
3
3
  import { ConfigFileError } from "../file.js";
4
4
  const causeMessage = (cause) => Option.match(Schema.decodeUnknownOption(Schema.Struct({ message: Schema.NonEmptyString }))(cause), {
5
- onNone: () => "Unknown YAML parsing failure",
5
+ onNone: () => "The YAML parser failed without an error message",
6
6
  onSome: ({ message }) => message,
7
7
  });
8
8
  /**
9
- * Parses YAML into a Document AST that keeps source tokens, so an edit through
10
- * it preserves formatting. Duplicate keys and parser warnings are errors.
9
+ * Parses YAML into a Document that keeps source tokens, so edits preserve formatting. Fails on
10
+ * duplicate keys and parser warnings.
11
11
  */
12
12
  export const parseYamlDocument = (file, source) => Effect.gen(function* () {
13
13
  const document = yield* Effect.try({
@@ -1 +1 @@
1
- {"version":3,"file":"document.js","sourceRoot":"","sources":["../../src/yaml/document.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAChD,OAAO,EAAiB,aAAa,EAAE,MAAM,MAAM,CAAC;AACpD,OAAO,EAAE,eAAe,EAAqB,MAAM,YAA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,CAAC;KACL,CAAC,CAAC;IACH,MAAM,WAAW,GAAG,QAAQ,CAAC,MAAM,CAAC,CAAC,CAAC,IAAI,QAAQ,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC;IAC/D,IAAI,WAAW,KAAK,SAAS,EAAE,CAAC;QAC9B,OAAO,KAAK,CAAC,CAAC,IAAI,eAAe,CAAC;YAChC,IAAI;YACJ,KAAK,EAAE,MAAM;YACb,UAAU,EAAE,MAAM,CAAC,IAAI,EAAE;YACzB,OAAO,EAAE,WAAW,CAAC,OAAO;SAC7B,CAAC,CAAC;IACL,CAAC;IACD,OAAO,QAAQ,CAAC;AAClB,CAAC,CAAC,CAAC"}
@@ -1,16 +1,16 @@
1
1
  import { Effect, Schema } from "effect";
2
2
  import type { ConfigFileError } from "../file.ts";
3
3
  declare const YamlEdit_base: Schema.Class<YamlEdit, Schema.Struct<{
4
- /** Path in file-key spelling, for example `["settings", "max_children"]`. */
4
+ /** The keys as written in the file, for example `["settings", "max_children"]`. */
5
5
  readonly path: Schema.$Array<Schema.NonEmptyString>;
6
6
  readonly value: Schema.Codec<Schema.Json, Schema.Json, never, never>;
7
7
  }>, {}>;
8
- /** One replacement in authored YAML, preserving the surrounding file. */
8
+ /** A replacement of one value in a YAML file. */
9
9
  export declare class YamlEdit extends YamlEdit_base {
10
10
  }
11
- /** Sets one YAML path and returns the file with its comments, key order, and newline style intact. */
11
+ /** Returns `source` with `edit` applied, keeping comments, key order, and newline style. */
12
12
  export declare const updateYaml: (file: string & import("effect/Brand").Brand<"InstancePath">, source: string, edit: YamlEdit) => Effect.Effect<string, ConfigFileError, never>;
13
- /** Sets one YAML path in the frontmatter of a Markdown config file and returns the whole file. */
13
+ /** Applies `edit` to the frontmatter of a Markdown config file and returns the whole file. */
14
14
  export declare const updateFrontmatter: (file: string & import("effect/Brand").Brand<"InstancePath">, source: string, edit: YamlEdit) => Effect.Effect<string, ConfigFileError, never>;
15
15
  export {};
16
16
  //# sourceMappingURL=writer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/yaml/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;;IAM9D,6EAA6E;;;;AAF/E,yEAAyE;AACzE,qBAAa,QAAS,SAAQ,aAI5B;CAAG;AAOL,sGAAsG;AACtG,eAAO,MAAM,UAAU,gJAQtB,CAAC;AAEF,kGAAkG;AAClG,eAAO,MAAM,iBAAiB,gJAe7B,CAAC"}
1
+ {"version":3,"file":"writer.d.ts","sourceRoot":"","sources":["../../src/yaml/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AACxC,OAAO,KAAK,EAAE,eAAe,EAAgB,MAAM,YAAY,CAAC;;IAM9D,mFAAmF;;;;AAFrF,iDAAiD;AACjD,qBAAa,QAAS,SAAQ,aAI5B;CAAG;AAOL,4FAA4F;AAC5F,eAAO,MAAM,UAAU,gJAQtB,CAAC;AAEF,8FAA8F;AAC9F,eAAO,MAAM,iBAAiB,gJAc7B,CAAC"}
@@ -1,9 +1,9 @@
1
1
  import { Effect, Schema } from "effect";
2
2
  import { splitMarkdown } from "../frontmatter.js";
3
3
  import { parseYamlDocument } from "./document.js";
4
- /** One replacement in authored YAML, preserving the surrounding file. */
4
+ /** A replacement of one value in a YAML file. */
5
5
  export class YamlEdit extends Schema.Class("@usine/config/YamlEdit")({
6
- /** Path in file-key spelling, for example `["settings", "max_children"]`. */
6
+ /** The keys as written in the file, for example `["settings", "max_children"]`. */
7
7
  path: Schema.Array(Schema.NonEmptyString).check(Schema.isNonEmpty()),
8
8
  value: Schema.Json,
9
9
  }) {
@@ -12,18 +12,17 @@ const restoreNewlines = (text, newline) => {
12
12
  const normalized = text.replaceAll("\r\n", "\n");
13
13
  return newline === "\r\n" ? normalized.replaceAll("\n", "\r\n") : normalized;
14
14
  };
15
- /** Sets one YAML path and returns the file with its comments, key order, and newline style intact. */
15
+ /** Returns `source` with `edit` applied, keeping comments, key order, and newline style. */
16
16
  export const updateYaml = Effect.fn("YamlWriter.updateYaml")((file, source, edit) => Effect.gen(function* () {
17
17
  const document = yield* parseYamlDocument(file, source);
18
18
  document.setIn(edit.path, edit.value);
19
19
  // The stringifier always emits LF.
20
20
  return restoreNewlines(document.toString(), source.includes("\r\n") ? "\r\n" : "\n");
21
21
  }));
22
- /** Sets one YAML path in the frontmatter of a Markdown config file and returns the whole file. */
22
+ /** Applies `edit` to the frontmatter of a Markdown config file and returns the whole file. */
23
23
  export const updateFrontmatter = Effect.fn("YamlWriter.updateFrontmatter")((file, source, edit) => Effect.gen(function* () {
24
24
  const markdown = yield* splitMarkdown(file, source);
25
- // A one-line YAML half has no newline to infer a style from, so the file's
26
- // delimiter decides.
25
+ // Takes the newline style from the whole file, because one-line frontmatter has no newline.
27
26
  const updated = restoreNewlines(yield* updateYaml(file, markdown.yaml, edit), markdown.newline);
28
27
  const yaml = updated.endsWith(markdown.newline)
29
28
  ? updated.slice(0, -markdown.newline.length)
@@ -1 +1 @@
1
- {"version":3,"file":"writer.js","sourceRoot":"","sources":["../../src/yaml/writer.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,MAAM,EAAE,MAAM,QAAQ,CAAC;AAExC,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,EAAE,iBAAiB,EAAE,MAAM,eAAe,CAAC;AAElD,yEAAyE;AACzE,MAAM,OAAO,QAAS,SAAQ,MAAM,CAAC,KAAK,CAAW,wBAAwB,CAAC,CAAC;IAC7E,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC,KAAK,CAAC,MAAM,CAAC,cAAc,CAAC,CAAC,KAAK,CAAC,MAAM,CAAC,UAAU,EAAE,CAAC;IACpE,KAAK,EAAE,MAAM,CAAC,IAA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C,OAAO,CAAC;IACZ,OAAO,MAAM,QAAQ,CAAC,OAAO,GAAG,IAAI,GAAG,QAAQ,CAAC,OAAO,MAAM,QAAQ,CAAC,OAAO,GAAG,QAAQ,CAAC,IAAI,EAAE,CAAC;AAClG,CAAC,CAAC,CACL,CAAC"}
package/package.json CHANGED
@@ -1,15 +1,16 @@
1
1
  {
2
2
  "name": "@usine/config",
3
- "version": "0.2.1",
3
+ "version": "0.4.0",
4
4
  "description": "Config file machinery for usine: parse, validate, and surgically rewrite the instance repo's files — usine.yaml, loop files, agent files.",
5
- "license": "MIT",
5
+ "license": "AGPL-3.0-only",
6
6
  "repository": {
7
7
  "type": "git",
8
8
  "url": "git+https://github.com/basaltbytes/usine.git",
9
9
  "directory": "packages/config"
10
10
  },
11
11
  "files": [
12
- "dist"
12
+ "dist",
13
+ "!dist/tsconfig.tsbuildinfo"
13
14
  ],
14
15
  "type": "module",
15
16
  "sideEffects": false,
@@ -71,20 +72,20 @@
71
72
  "access": "public"
72
73
  },
73
74
  "dependencies": {
74
- "yaml": "2.8.1",
75
- "@usine/core": "0.3.0",
76
- "@usine/expression": "0.2.0"
75
+ "yaml": "2.9.1",
76
+ "@usine/expression": "0.4.0",
77
+ "@usine/core": "0.5.0"
77
78
  },
78
79
  "devDependencies": {
79
- "@effect/platform-node": "4.0.0-rc.111",
80
- "@effect/vitest": "4.0.0-rc.111",
81
- "effect": "4.0.0-rc.111",
80
+ "@effect/platform-node": "4.0.6",
81
+ "@effect/vitest": "4.0.6",
82
+ "effect": "4.0.6",
82
83
  "typescript": "7.0.2",
83
- "vitest": "4.1.11",
84
+ "vitest": "5.0.5",
84
85
  "@usine/tsconfig": "0.0.0"
85
86
  },
86
87
  "peerDependencies": {
87
- "effect": "4.0.0-rc.111"
88
+ "effect": "4.0.6"
88
89
  },
89
90
  "engines": {
90
91
  "node": ">=22"