@wairon/cli 5.1.1-dev.29 → 5.1.1-dev.30

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/cli/index.js CHANGED
@@ -65,7 +65,7 @@ var init_defaults = __esm({
65
65
  copilot: ".github/prompts",
66
66
  codex: ".codex/agents"
67
67
  };
68
- WAIRON_VERSION = "5.1.1-dev.29";
68
+ WAIRON_VERSION = "5.1.1-dev.30";
69
69
  GITHUB_REPO = "SYW-Apps/Waffle-AIron";
70
70
  SUPPORTED_ALIASES = ["wai"];
71
71
  SCAN_EXCLUDE_DIRS = /* @__PURE__ */ new Set([
@@ -16905,6 +16905,12 @@ function renameComponent(componentId, newId) {
16905
16905
  return ref;
16906
16906
  }).filter((spec) => !renamed.some((moved) => moved.kind === spec.kind && moved.from === spec.id)).map((spec) => spec.id);
16907
16907
  invalidateSpecCache();
16908
+ moveRenamedSpecs(componentId, newId, component, movingInterface, movingImplementation);
16909
+ return { renamed, rewritten };
16910
+ }
16911
+ function moveRenamedSpecs(componentId, newId, component, movingInterface, movingImplementation) {
16912
+ const interfaceId = `i${newId}`;
16913
+ const implementationId = `${newId}_impl`;
16908
16914
  const movedComponent = loadComponentSpec(componentId) ?? component;
16909
16915
  const movedInterface = movingInterface ? loadInterfaceSpec(movingInterface.id) ?? movingInterface : null;
16910
16916
  const movedImplementation = movingImplementation ? loadImplementationSpec(movingImplementation.id) ?? movingImplementation : null;
@@ -16921,7 +16927,6 @@ function renameComponent(componentId, newId) {
16921
16927
  if (movingInterface) removeSpecFile(getInterfacePath(movingInterface.id), movingInterface.id);
16922
16928
  if (movingImplementation) removeSpecFile(getImplementationPath(movingImplementation.id), movingImplementation.id);
16923
16929
  invalidateSpecCache();
16924
- return { renamed, rewritten };
16925
16930
  }
16926
16931
  function removeSpecFile(file, id) {
16927
16932
  if (!fs13.existsSync(file)) return;
@@ -35777,6 +35782,33 @@ function foldAppliedProfile(recorded, profileId, actor) {
35777
35782
  if (recorded?.defaultPackNames) folded.defaultPackNames = recorded.defaultPackNames;
35778
35783
  return folded;
35779
35784
  }
35785
+ function repairGoverningProfile(cfg, projectId, root, policy, config, catalog, principal) {
35786
+ const selection = config?.profileSelection;
35787
+ const previousProfileId = governingProjectType(config);
35788
+ let governingProfileId = previousProfileId;
35789
+ const requiredProfileIds = policy.requiredProfileIds ?? [];
35790
+ const policyUnsatisfied = requiredProfileIds.length > 0 && !requiredProfileIds.includes(governingProfileId);
35791
+ const governingUnresolvable = !classifyProfile(governingProfileId, catalog).resolvable;
35792
+ let repairedProfileId;
35793
+ let selectedProfileIds = selection?.profileIds ?? [];
35794
+ if (policyUnsatisfied || governingUnresolvable) {
35795
+ const target = firstApplicableProfileId(
35796
+ [...requiredProfileIds, ...selection?.profileIds ?? []],
35797
+ catalog
35798
+ );
35799
+ if (target) {
35800
+ const application = executeApprovedEnsureProfileInstalled(cfg, projectId, target, config);
35801
+ if (application.adoptedPackRef) registerPackRefAt(root, application.adoptedPackRef);
35802
+ setProjectTypeAt(root, application.profileId);
35803
+ governingProfileId = application.profileId;
35804
+ repairedProfileId = application.profileId;
35805
+ const folded = foldAppliedProfile(selection, application.profileId, principalSubject3(principal));
35806
+ recordProfileSelectionAt(root, folded);
35807
+ selectedProfileIds = folded.profileIds;
35808
+ }
35809
+ }
35810
+ return { governingProfileId, previousProfileId, repairedProfileId, selectedProfileIds };
35811
+ }
35780
35812
  function overridingSubsystemIds(root) {
35781
35813
  return runWithProjectRoot(
35782
35814
  root,
@@ -35986,38 +36018,16 @@ function reconcileProjectPolicy(cfg, credential, projectId) {
35986
36018
  const reloaded = loadConfigAt(root);
35987
36019
  const catalog = executeApprovedListProjectProfiles(cfg, projectId, reloaded);
35988
36020
  const selection = reloaded?.profileSelection;
35989
- const previousProfileId = governingProjectType(reloaded);
35990
- let governingProfileId = previousProfileId;
35991
- const requiredProfileIds = policy.requiredProfileIds ?? [];
35992
- const policyUnsatisfied = requiredProfileIds.length > 0 && !requiredProfileIds.includes(governingProfileId);
35993
- const governingUnresolvable = !classifyProfile(governingProfileId, catalog).resolvable;
35994
- let repairedProfileId;
35995
- let selectedProfileIds = selection?.profileIds ?? [];
35996
- if (policyUnsatisfied || governingUnresolvable) {
35997
- const target = firstApplicableProfileId(
35998
- [...requiredProfileIds, ...selection?.profileIds ?? []],
35999
- catalog
36000
- );
36001
- if (target) {
36002
- const application = executeApprovedEnsureProfileInstalled(cfg, projectId, target, reloaded);
36003
- if (application.adoptedPackRef) registerPackRefAt(root, application.adoptedPackRef);
36004
- setProjectTypeAt(root, application.profileId);
36005
- governingProfileId = application.profileId;
36006
- repairedProfileId = application.profileId;
36007
- const folded = foldAppliedProfile(selection, application.profileId, principalSubject3(principal));
36008
- recordProfileSelectionAt(root, folded);
36009
- selectedProfileIds = folded.profileIds;
36010
- }
36011
- }
36021
+ const repair = repairGoverningProfile(cfg, projectId, root, policy, reloaded, catalog, principal);
36012
36022
  const reconciled = loadConfigAt(root);
36013
36023
  const result = buildEvaluation({
36014
36024
  policy,
36015
36025
  presentPackNames: installedPackNames(cfg, projectId, reconciled),
36016
- selectedProfileIds,
36026
+ selectedProfileIds: repair.selectedProfileIds,
36017
36027
  hasSelection: !!selection,
36018
36028
  countMissingPacksAsViolation: true,
36019
36029
  requiredDefaultResolution: resolution,
36020
- governingProfileId
36030
+ governingProfileId: repair.governingProfileId
36021
36031
  });
36022
36032
  tryAppendAudit2(
36023
36033
  cfg,
@@ -36031,7 +36041,7 @@ function reconcileProjectPolicy(cfg, credential, projectId) {
36031
36041
  projectId,
36032
36042
  metadata: JSON.stringify({
36033
36043
  ...appliedPackNames.length > 0 ? { appliedPackNames } : {},
36034
- ...repairedProfileId ? { repairedProfileId, previousProfileId } : {},
36044
+ ...repair.repairedProfileId ? { repairedProfileId: repair.repairedProfileId, previousProfileId: repair.previousProfileId } : {},
36035
36045
  ...resolution.unresolved.length > 0 ? { unresolvedPacks: resolution.unresolved } : {}
36036
36046
  })
36037
36047
  },