@wairon/cli 5.1.1-dev.40 → 5.1.1-dev.41

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.js CHANGED
@@ -1139,7 +1139,7 @@ var init_defaults = __esm({
1139
1139
  copilot: ".github/prompts",
1140
1140
  codex: ".codex/agents"
1141
1141
  };
1142
- WAIRON_VERSION = "5.1.1-dev.40";
1142
+ WAIRON_VERSION = "5.1.1-dev.41";
1143
1143
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
1144
1144
  ARCHITECT_AGENT_ID = "agent-architect";
1145
1145
  ARCHITECT_TEMPLATE_ID = "architect";
@@ -3079,6 +3079,10 @@ var init_budget_policy = __esm({
3079
3079
  function canonicalize(value) {
3080
3080
  return JSON.stringify(sortKeys(value));
3081
3081
  }
3082
+ function compareOrdinal(a, b) {
3083
+ if (a < b) return -1;
3084
+ return a > b ? 1 : 0;
3085
+ }
3082
3086
  function sortKeys(v) {
3083
3087
  if (Array.isArray(v)) return v.map(sortKeys);
3084
3088
  if (v && typeof v === "object") {
@@ -3099,14 +3103,17 @@ var init_canonical_json = __esm({
3099
3103
  });
3100
3104
 
3101
3105
  // src/core/statehash.ts
3106
+ function inIdentityOrder(specs) {
3107
+ return specs.map((spec) => ({ spec, content: canonicalize(spec) })).sort((a, b) => compareOrdinal(a.spec.id, b.spec.id) || compareOrdinal(a.content, b.content)).map((entry) => entry.spec);
3108
+ }
3102
3109
  function computeStateId() {
3103
3110
  const tree = {
3104
3111
  system: loadSystemSpec(),
3105
- subsystems: loadSubsystemSpecs(),
3106
- components: loadComponentSpecs(),
3107
- interfaces: loadInterfaceSpecs(),
3108
- implementations: loadImplementationSpecs(),
3109
- types: loadTypeSpecs()
3112
+ subsystems: inIdentityOrder(loadSubsystemSpecs()),
3113
+ components: inIdentityOrder(loadComponentSpecs()),
3114
+ interfaces: inIdentityOrder(loadInterfaceSpecs()),
3115
+ implementations: inIdentityOrder(loadImplementationSpecs()),
3116
+ types: inIdentityOrder(loadTypeSpecs())
3110
3117
  };
3111
3118
  const digest2 = crypto.createHash("sha256").update(canonicalize(tree)).digest("hex");
3112
3119
  return { algorithm: CONTENT_ALGORITHM, digest: digest2 };
@@ -8369,7 +8376,7 @@ function discoverPacks(dir) {
8369
8376
  return [];
8370
8377
  }
8371
8378
  const refs = [];
8372
- for (const e of entries.sort((a, b) => a.name.localeCompare(b.name))) {
8379
+ for (const e of entries.sort((a, b) => compareOrdinal(a.name, b.name))) {
8373
8380
  const full = path10.join(dir, e.name);
8374
8381
  if (e.isDirectory()) {
8375
8382
  if (packDirEntry(full)) refs.push(full);
@@ -8662,6 +8669,7 @@ var init_extensions = __esm({
8662
8669
  init_fs();
8663
8670
  init_project_config();
8664
8671
  init_version();
8672
+ init_canonical_json();
8665
8673
  init_project();
8666
8674
  init_packstore();
8667
8675
  ProfileDefSchema = import_zod9.z.object({
@@ -16279,7 +16287,7 @@ var init_candidate = __esm({
16279
16287
 
16280
16288
  // src/core/rules/gate-identity.ts
16281
16289
  function doctrineIdentity(doctrine, builtinRules, gate) {
16282
- const byKey = (items, key) => [...items].sort((a, b) => key(a).localeCompare(key(b)));
16290
+ const byKey = (items, key) => [...items].sort((a, b) => compareOrdinal(key(a), key(b)));
16283
16291
  return {
16284
16292
  /**
16285
16293
  * The BUILTIN rule set, by identity rather than by wairon version.