fraim 2.0.248 → 2.0.249

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.
@@ -26,6 +26,10 @@ const fs_1 = require("fs");
26
26
  const path_1 = require("path");
27
27
  const project_fraim_paths_1 = require("../core/utils/project-fraim-paths");
28
28
  const brand_store_1 = require("../core/brand-store");
29
+ // Issue #1043 round 2: org and manager content lives at one home named by
30
+ // config. These reads used to hardcode the removed ~/.fraim/{org,manager}
31
+ // cache, which silently returned nothing once that cache stopped existing.
32
+ const pack_home_1 = require("../cli/utils/pack-home");
29
33
  const learning_domains_1 = require("../config/learning-domains");
30
34
  const REPO_LEARNINGS_REL = (0, project_fraim_paths_1.getWorkspaceFraimDisplayPath)('personalized-employee/learnings').replace(/\/$/, '');
31
35
  const DEFAULT_THRESHOLD = 3.0;
@@ -48,11 +52,28 @@ exports.LEARNING_PRIORITIES = ['P-CRITICAL', 'P-HIGH', 'P-MED', 'P-LOW'];
48
52
  function learningEntryHeadingRegex(flags = '') {
49
53
  return new RegExp(`^#{2,}\\s+\\[(${exports.LEARNING_PRIORITIES.join('|')})\\]\\s*(.*)$`, flags);
50
54
  }
55
+ /**
56
+ * The manager location that is NOT the portable authoring base.
57
+ *
58
+ * Issue #1043 round 2: when a synced backend is configured, the manager home is
59
+ * that backend location and it is a genuinely distinct place from the portable
60
+ * base. When nothing is synced, the home IS the portable base, so returning it
61
+ * here would list one file as two tiers and raise a bogus collision note. In
62
+ * that case return the historical path, which simply does not exist and
63
+ * therefore contributes no tier, matching the behavior before round 2.
64
+ */
65
+ function managerSecondaryLearningsBase() {
66
+ const home = (0, pack_home_1.resolvePackHome)('manager');
67
+ if (home.synced)
68
+ return (0, path_1.join)(home.root, 'learnings');
69
+ // pack-home-exempt: deliberate historical secondary location, see above.
70
+ return (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'manager', 'learnings');
71
+ }
51
72
  function getLearningRoots(workspaceRoot) {
52
73
  return {
53
74
  globalPersonalBase: (0, project_fraim_paths_1.getConfiguredPortableLearningsDir)(workspaceRoot),
54
75
  globalPersonalDisplayBase: (0, project_fraim_paths_1.getConfiguredPortableLearningsDisplayPath)(workspaceRoot),
55
- managerCacheBase: (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'manager', 'learnings'),
76
+ managerCacheBase: managerSecondaryLearningsBase(),
56
77
  managerCacheDisplayBase: (0, project_fraim_paths_1.getUserFraimDisplayPath)('manager/learnings'),
57
78
  repoLearningsBase: (0, project_fraim_paths_1.getWorkspaceLearningsDir)(workspaceRoot)
58
79
  };
@@ -385,7 +406,7 @@ function resolveOrgLearningFile(repoLearningsBase, fileName) {
385
406
  if ((0, fs_1.existsSync)(repoPath)) {
386
407
  return { present: true, path: repoPath, displayPath: `${REPO_LEARNINGS_REL}/${fileName}` };
387
408
  }
388
- const cachePath = (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'org', 'learnings', fileName);
409
+ const cachePath = (0, path_1.join)((0, pack_home_1.resolvePackHome)('org').root, 'learnings', fileName);
389
410
  if ((0, fs_1.existsSync)(cachePath)) {
390
411
  return { present: true, path: cachePath, displayPath: (0, project_fraim_paths_1.getUserFraimDisplayPath)(`org/learnings/${fileName}`) };
391
412
  }
@@ -398,7 +419,7 @@ function resolveOrgLearningFile(repoLearningsBase, fileName) {
398
419
  */
399
420
  function resolveOrgLearningFileTiers(repoLearningsBase, fileName) {
400
421
  const tiers = [];
401
- const cachePath = (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'org', 'learnings', fileName);
422
+ const cachePath = (0, path_1.join)((0, pack_home_1.resolvePackHome)('org').root, 'learnings', fileName);
402
423
  if ((0, fs_1.existsSync)(cachePath)) {
403
424
  tiers.push({
404
425
  level: 'org',
@@ -603,7 +624,7 @@ function resolveOrgContextFile(workspaceRoot, relativePath, orgCacheEligible = t
603
624
  };
604
625
  }
605
626
  if (orgCacheEligible) {
606
- const cachePath = (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'org', relativePath);
627
+ const cachePath = (0, path_1.join)((0, pack_home_1.resolvePackHome)('org').root, relativePath);
607
628
  if ((0, fs_1.existsSync)(cachePath)) {
608
629
  return {
609
630
  present: true,
@@ -612,7 +633,7 @@ function resolveOrgContextFile(workspaceRoot, relativePath, orgCacheEligible = t
612
633
  }
613
634
  }
614
635
  if (!orgCacheEligible) {
615
- const managerCachePath = (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'manager', relativePath);
636
+ const managerCachePath = (0, path_1.join)((0, pack_home_1.resolvePackHome)('manager').root, relativePath);
616
637
  if ((0, fs_1.existsSync)(managerCachePath)) {
617
638
  return {
618
639
  present: true,
@@ -774,7 +795,7 @@ function resolveTeamContextFile(workspaceRoot, key) {
774
795
  // destination (R5.1), so writePath stays empty and the caller must route
775
796
  // edits through the org backend's propose-and-approve flow.
776
797
  if (key === 'org' || key === 'orgRules') {
777
- const cachePath = (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'org', relativePath);
798
+ const cachePath = (0, path_1.join)((0, pack_home_1.resolvePackHome)('org').root, relativePath);
778
799
  if ((0, fs_1.existsSync)(cachePath)) {
779
800
  return {
780
801
  present: true,
@@ -787,7 +808,7 @@ function resolveTeamContextFile(workspaceRoot, key) {
787
808
  }
788
809
  }
789
810
  if (key === 'manager' || key === 'managerRules') {
790
- const managerCachePath = (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'manager', relativePath);
811
+ const managerCachePath = (0, path_1.join)((0, pack_home_1.resolvePackHome)('manager').root, relativePath);
791
812
  if ((0, fs_1.existsSync)(managerCachePath)) {
792
813
  return {
793
814
  present: true,
@@ -824,7 +845,7 @@ function resolveTeamContextFile(workspaceRoot, key) {
824
845
  function orgBrandCandidateDirs(workspaceRoot) {
825
846
  return [
826
847
  (0, path_1.join)((0, project_fraim_paths_1.getWorkspaceFraimDir)(workspaceRoot), 'personalized-employee', 'context'),
827
- (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'org', 'context'),
848
+ (0, path_1.join)((0, pack_home_1.resolvePackHome)('org').root, 'context'),
828
849
  (0, path_1.join)((0, project_fraim_paths_1.getUserFraimDirPath)(), 'personalized-employee', 'context'),
829
850
  ];
830
851
  }
@@ -60,6 +60,7 @@ const crypto_1 = require("crypto");
60
60
  const axios_1 = __importDefault(require("axios"));
61
61
  const provider_utils_1 = require("../core/utils/provider-utils");
62
62
  const object_utils_1 = require("../core/utils/object-utils");
63
+ const pack_home_1 = require("../cli/utils/pack-home");
63
64
  const local_registry_resolver_1 = require("../core/utils/local-registry-resolver");
64
65
  const ai_mentor_1 = require("../core/ai-mentor");
65
66
  const quality_evidence_1 = require("../core/quality-evidence");
@@ -794,8 +795,8 @@ class FraimLocalMCPServer {
794
795
  if (this.orgCacheRefreshInFlight)
795
796
  return;
796
797
  this.orgCacheRefreshInFlight = true;
797
- void Promise.resolve().then(() => __importStar(require('../cli/utils/org-pack-sync'))).then(async ({ getOrgCacheAgeHours, syncOrgCache }) => {
798
- const ageHours = getOrgCacheAgeHours();
798
+ void Promise.resolve().then(() => __importStar(require('../cli/utils/org-pack-sync'))).then(async ({ getOrgSyncAgeHours, syncOrgCache }) => {
799
+ const ageHours = getOrgSyncAgeHours();
799
800
  if (ageHours !== null && ageHours < 24)
800
801
  return;
801
802
  const outcome = await syncOrgCache();
@@ -820,8 +821,8 @@ class FraimLocalMCPServer {
820
821
  if (this.managerCacheRefreshInFlight)
821
822
  return;
822
823
  this.managerCacheRefreshInFlight = true;
823
- void Promise.resolve().then(() => __importStar(require('../cli/utils/manager-pack-sync'))).then(async ({ getManagerCacheAgeHours, syncManagerCache }) => {
824
- const ageHours = getManagerCacheAgeHours();
824
+ void Promise.resolve().then(() => __importStar(require('../cli/utils/manager-pack-sync'))).then(async ({ getManagerSyncAgeHours, syncManagerCache }) => {
825
+ const ageHours = getManagerSyncAgeHours();
825
826
  if (ageHours !== null && ageHours < 24)
826
827
  return;
827
828
  const outcome = await syncManagerCache();
@@ -1588,6 +1589,10 @@ class FraimLocalMCPServer {
1588
1589
  // Return a resolver that always falls back to remote
1589
1590
  return new local_registry_resolver_1.LocalRegistryResolver({
1590
1591
  workspaceRoot: process.cwd(),
1592
+ // Issue #1043 round 2: overlay roots are the layers' homes. There is no
1593
+ // separate cache to point at any more.
1594
+ managerCacheRoot: (0, pack_home_1.resolvePackHome)('manager').root,
1595
+ orgCacheRoot: (0, pack_home_1.resolvePackHome)('org').root,
1591
1596
  remoteContentResolver: async (_path) => {
1592
1597
  throw new Error('No project root available');
1593
1598
  },
@@ -1604,6 +1609,9 @@ class FraimLocalMCPServer {
1604
1609
  return new local_registry_resolver_1.LocalRegistryResolver({
1605
1610
  workspaceRoot,
1606
1611
  ...(needsEffectiveDirOverride ? { effectiveFraimDir } : {}),
1612
+ // Issue #1043 round 2: overlay roots are the layers' homes.
1613
+ managerCacheRoot: (0, pack_home_1.resolvePackHome)('manager').root,
1614
+ orgCacheRoot: (0, pack_home_1.resolvePackHome)('org').root,
1607
1615
  shouldFilter: (content) => this.isStub(content),
1608
1616
  remoteContentResolver: async (path) => {
1609
1617
  // Fetch parent content from remote for inheritance
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fraim",
3
- "version": "2.0.248",
3
+ "version": "2.0.249",
4
4
  "description": "FRAIM core CLI and MCP package.",
5
5
  "main": "index.js",
6
6
  "bin": {