@kitsy/coop-core 2.0.0 → 2.1.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -2176,6 +2176,9 @@ var TASK_FIELD_ORDER = [
2176
2176
  "depends_on",
2177
2177
  "tags",
2178
2178
  "delivery",
2179
+ "acceptance",
2180
+ "tests_required",
2181
+ "origin",
2179
2182
  "complexity",
2180
2183
  "determinism",
2181
2184
  "estimate",
@@ -4710,6 +4713,7 @@ var import_node_path8 = __toESM(require("path"), 1);
4710
4713
  var ID_PATTERN = /^[A-Z0-9]+(?:-[A-Z0-9]+)+$/;
4711
4714
  var ALIAS_PATTERN = /^[A-Z0-9]+(?:[.-][A-Z0-9]+)*$/;
4712
4715
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
4716
+ var SHA256_RE = /^[a-f0-9]{64}$/i;
4713
4717
  function error4(field, rule, message) {
4714
4718
  return { level: "error", field, rule, message };
4715
4719
  }
@@ -4723,6 +4727,23 @@ function isIsoDate(value) {
4723
4727
  }
4724
4728
  return date.toISOString().slice(0, 10) === value;
4725
4729
  }
4730
+ function validateStringArrayField(errors, field, value, options = {}) {
4731
+ if (value === void 0) {
4732
+ return;
4733
+ }
4734
+ if (!Array.isArray(value)) {
4735
+ errors.push(error4(field, `struct.${field}_array`, `Field '${field}' must be an array of strings.`));
4736
+ return;
4737
+ }
4738
+ for (const entry of value) {
4739
+ if (typeof entry !== "string" || entry.trim().length < (options.minLength ?? 1)) {
4740
+ errors.push(
4741
+ error4(field, `struct.${field}_string`, `Field '${field}' entries must be non-empty strings.`)
4742
+ );
4743
+ return;
4744
+ }
4745
+ }
4746
+ }
4726
4747
  function validateStructural(task, context = {}) {
4727
4748
  const errors = [];
4728
4749
  const required = ["id", "title", "type", "status", "created", "updated"];
@@ -4787,6 +4808,27 @@ function validateStructural(task, context = {}) {
4787
4808
  }
4788
4809
  }
4789
4810
  }
4811
+ validateStringArrayField(errors, "acceptance", task.acceptance);
4812
+ validateStringArrayField(errors, "tests_required", task.tests_required);
4813
+ if (task.origin !== void 0) {
4814
+ if (!task.origin || typeof task.origin !== "object" || Array.isArray(task.origin)) {
4815
+ errors.push(error4("origin", "struct.origin_object", "Field 'origin' must be an object."));
4816
+ } else {
4817
+ validateStringArrayField(errors, "origin.authority_refs", task.origin.authority_refs);
4818
+ validateStringArrayField(errors, "origin.derived_refs", task.origin.derived_refs);
4819
+ validateStringArrayField(errors, "origin.promoted_from", task.origin.promoted_from);
4820
+ validateStringArrayField(errors, "origin.promoted_to", task.origin.promoted_to);
4821
+ if (task.origin.snapshot_sha256 !== void 0 && (typeof task.origin.snapshot_sha256 !== "string" || !SHA256_RE.test(task.origin.snapshot_sha256))) {
4822
+ errors.push(
4823
+ error4(
4824
+ "origin.snapshot_sha256",
4825
+ "struct.origin_snapshot_sha256",
4826
+ "Field 'origin.snapshot_sha256' must be a 64-character SHA-256 hex string."
4827
+ )
4828
+ );
4829
+ }
4830
+ }
4831
+ }
4790
4832
  return errors;
4791
4833
  }
4792
4834
 
package/dist/index.d.cts CHANGED
@@ -293,6 +293,15 @@ interface TaskPlanning {
293
293
  depends_on?: string[];
294
294
  tags?: string[];
295
295
  delivery?: string | null;
296
+ acceptance?: string[];
297
+ tests_required?: string[];
298
+ origin?: {
299
+ authority_refs?: string[];
300
+ derived_refs?: string[];
301
+ promoted_from?: string[];
302
+ promoted_to?: string[];
303
+ snapshot_sha256?: string;
304
+ };
296
305
  }
297
306
  interface TaskEstimate {
298
307
  optimistic_hours: number;
@@ -721,6 +730,10 @@ interface CoopConfig {
721
730
  delivery?: string;
722
731
  run?: string;
723
732
  };
733
+ id?: {
734
+ naming?: string;
735
+ seq_padding?: number;
736
+ };
724
737
  defaults?: {
725
738
  task?: {
726
739
  type?: TaskType;
@@ -745,6 +758,9 @@ interface CoopConfig {
745
758
  plugins?: {
746
759
  enabled?: string[];
747
760
  };
761
+ artifacts?: {
762
+ dir?: string;
763
+ };
748
764
  hooks?: {
749
765
  on_task_transition?: string;
750
766
  on_delivery_complete?: string;
package/dist/index.d.ts CHANGED
@@ -293,6 +293,15 @@ interface TaskPlanning {
293
293
  depends_on?: string[];
294
294
  tags?: string[];
295
295
  delivery?: string | null;
296
+ acceptance?: string[];
297
+ tests_required?: string[];
298
+ origin?: {
299
+ authority_refs?: string[];
300
+ derived_refs?: string[];
301
+ promoted_from?: string[];
302
+ promoted_to?: string[];
303
+ snapshot_sha256?: string;
304
+ };
296
305
  }
297
306
  interface TaskEstimate {
298
307
  optimistic_hours: number;
@@ -721,6 +730,10 @@ interface CoopConfig {
721
730
  delivery?: string;
722
731
  run?: string;
723
732
  };
733
+ id?: {
734
+ naming?: string;
735
+ seq_padding?: number;
736
+ };
724
737
  defaults?: {
725
738
  task?: {
726
739
  type?: TaskType;
@@ -745,6 +758,9 @@ interface CoopConfig {
745
758
  plugins?: {
746
759
  enabled?: string[];
747
760
  };
761
+ artifacts?: {
762
+ dir?: string;
763
+ };
748
764
  hooks?: {
749
765
  on_task_transition?: string;
750
766
  on_delivery_complete?: string;
package/dist/index.js CHANGED
@@ -1966,6 +1966,9 @@ var TASK_FIELD_ORDER = [
1966
1966
  "depends_on",
1967
1967
  "tags",
1968
1968
  "delivery",
1969
+ "acceptance",
1970
+ "tests_required",
1971
+ "origin",
1969
1972
  "complexity",
1970
1973
  "determinism",
1971
1974
  "estimate",
@@ -3627,6 +3630,7 @@ import path8 from "path";
3627
3630
  var ID_PATTERN = /^[A-Z0-9]+(?:-[A-Z0-9]+)+$/;
3628
3631
  var ALIAS_PATTERN = /^[A-Z0-9]+(?:[.-][A-Z0-9]+)*$/;
3629
3632
  var ISO_DATE_RE = /^\d{4}-\d{2}-\d{2}$/;
3633
+ var SHA256_RE = /^[a-f0-9]{64}$/i;
3630
3634
  function error4(field, rule, message) {
3631
3635
  return { level: "error", field, rule, message };
3632
3636
  }
@@ -3640,6 +3644,23 @@ function isIsoDate(value) {
3640
3644
  }
3641
3645
  return date.toISOString().slice(0, 10) === value;
3642
3646
  }
3647
+ function validateStringArrayField(errors, field, value, options = {}) {
3648
+ if (value === void 0) {
3649
+ return;
3650
+ }
3651
+ if (!Array.isArray(value)) {
3652
+ errors.push(error4(field, `struct.${field}_array`, `Field '${field}' must be an array of strings.`));
3653
+ return;
3654
+ }
3655
+ for (const entry of value) {
3656
+ if (typeof entry !== "string" || entry.trim().length < (options.minLength ?? 1)) {
3657
+ errors.push(
3658
+ error4(field, `struct.${field}_string`, `Field '${field}' entries must be non-empty strings.`)
3659
+ );
3660
+ return;
3661
+ }
3662
+ }
3663
+ }
3643
3664
  function validateStructural(task, context = {}) {
3644
3665
  const errors = [];
3645
3666
  const required = ["id", "title", "type", "status", "created", "updated"];
@@ -3704,6 +3725,27 @@ function validateStructural(task, context = {}) {
3704
3725
  }
3705
3726
  }
3706
3727
  }
3728
+ validateStringArrayField(errors, "acceptance", task.acceptance);
3729
+ validateStringArrayField(errors, "tests_required", task.tests_required);
3730
+ if (task.origin !== void 0) {
3731
+ if (!task.origin || typeof task.origin !== "object" || Array.isArray(task.origin)) {
3732
+ errors.push(error4("origin", "struct.origin_object", "Field 'origin' must be an object."));
3733
+ } else {
3734
+ validateStringArrayField(errors, "origin.authority_refs", task.origin.authority_refs);
3735
+ validateStringArrayField(errors, "origin.derived_refs", task.origin.derived_refs);
3736
+ validateStringArrayField(errors, "origin.promoted_from", task.origin.promoted_from);
3737
+ validateStringArrayField(errors, "origin.promoted_to", task.origin.promoted_to);
3738
+ if (task.origin.snapshot_sha256 !== void 0 && (typeof task.origin.snapshot_sha256 !== "string" || !SHA256_RE.test(task.origin.snapshot_sha256))) {
3739
+ errors.push(
3740
+ error4(
3741
+ "origin.snapshot_sha256",
3742
+ "struct.origin_snapshot_sha256",
3743
+ "Field 'origin.snapshot_sha256' must be a 64-character SHA-256 hex string."
3744
+ )
3745
+ );
3746
+ }
3747
+ }
3748
+ }
3707
3749
  return errors;
3708
3750
  }
3709
3751
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@kitsy/coop-core",
3
3
  "description": "Core models, parser, validator, graph, and planning engine for COOP.",
4
- "version": "2.0.0",
4
+ "version": "2.1.1",
5
5
  "license": "MIT",
6
6
  "type": "module",
7
7
  "publishConfig": {