@phren/cli 0.1.49 → 0.1.50

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.
@@ -96,14 +96,27 @@ export function seedPositions(nodes, links, aspect = DEFAULT_ASPECT) {
96
96
  continue;
97
97
  leavesPer.set(owner, (leavesPer.get(owner) ?? 0) + 1);
98
98
  }
99
- const spread = Math.max(...projects.map((p) => clusterRadius(leavesPer.get(p.id) ?? 0)), IDEAL_DISTANCE);
100
- const packed = (projects.length * spread * 2.3) / (2 * Math.PI);
101
- const ring = Math.max(IDEAL_DISTANCE * 2.2, packed);
99
+ // Each project gets a slice of the ring proportional to its cluster, not an
100
+ // equal share. Equal slices gave a one-finding project the same forty
101
+ // degrees as a fifty-finding one, so small and new projects sat alone in
102
+ // empty space at full ring distance while the heavy clusters merged into a
103
+ // blob — "most of it in the middle, a few way out", and the camera fitted
104
+ // to the few. Small clusters also sit a little inside the ring, so their
105
+ // outer edge lines up with their neighbours' rather than their centre.
106
+ const radii = projects.map((p) => clusterRadius(leavesPer.get(p.id) ?? 0));
107
+ const spread = Math.max(...radii, IDEAL_DISTANCE);
108
+ const slices = radii.map((r) => r * 2.3);
109
+ const circumference = slices.reduce((sum, w) => sum + w, 0);
110
+ const ring = Math.max(IDEAL_DISTANCE * 2.2, circumference / (2 * Math.PI));
111
+ // Projects sit at the start of their slice, so equal clusters land exactly
112
+ // where the equal-slice ring put them (two projects side by side, not
113
+ // stacked, which is the worst case on a wide screen).
114
+ let offset = 0;
102
115
  projects.forEach((project, i) => {
103
- // Start a quarter turn in so two projects sit side by side rather than
104
- // stacked, which is the worst case on a wide screen.
105
- const angle = (i / Math.max(1, projects.length)) * Math.PI * 2;
106
- positions.set(project.id, { x: Math.cos(angle) * ring * ratio, y: Math.sin(angle) * ring });
116
+ const angle = (offset / Math.max(circumference, 1)) * Math.PI * 2;
117
+ offset += slices[i];
118
+ const radius = Math.max(IDEAL_DISTANCE * 1.6, ring - (spread - radii[i]) * 0.7);
119
+ positions.set(project.id, { x: Math.cos(angle) * radius * ratio, y: Math.sin(angle) * radius });
107
120
  });
108
121
  if (projects.length === 1)
109
122
  positions.set(projects[0].id, { x: 0, y: 0 });
@@ -276,7 +289,10 @@ export class ForceSim {
276
289
  if (this.isProject[i]) {
277
290
  // Hold the project on its ring. The error is measured in
278
291
  // aspect-corrected space so the restoring force preserves the wide
279
- // ellipse rather than pulling the layout back into a circle.
292
+ // ellipse rather than pulling the layout back into a circle. A soft
293
+ // spring on purpose: pinning the radius outright left the clusters no
294
+ // room to breathe once the node cap made them larger than the seeded
295
+ // ring allowed for, and a forty-project store folded into a fan.
280
296
  const nx = xs[i] / this.aspect;
281
297
  const ny = ys[i];
282
298
  const radius = Math.hypot(nx, ny);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@phren/cli",
3
- "version": "0.1.49",
3
+ "version": "0.1.50",
4
4
  "description": "Knowledge layer for AI agents — CLI, MCP server, and data layer",
5
5
  "type": "module",
6
6
  "bin": {