@software-dlc/cli 0.192.17 → 0.192.23

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.
Files changed (48) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/dist/cli.js +34 -20
  3. package/dist/cli.js.map +1 -1
  4. package/dist/local/app-contract-readers.d.ts +5 -0
  5. package/dist/local/app-contract-readers.d.ts.map +1 -1
  6. package/dist/local/app-contract-readers.js +6 -1
  7. package/dist/local/app-contract-readers.js.map +1 -1
  8. package/dist/local/graph-read.d.ts +8 -0
  9. package/dist/local/graph-read.d.ts.map +1 -1
  10. package/dist/local/graph-read.js +40 -0
  11. package/dist/local/graph-read.js.map +1 -1
  12. package/dist/local/managed-projection-change.d.ts +74 -0
  13. package/dist/local/managed-projection-change.d.ts.map +1 -0
  14. package/dist/local/managed-projection-change.js +533 -0
  15. package/dist/local/managed-projection-change.js.map +1 -0
  16. package/dist/local/projection-stat-pool.d.ts.map +1 -1
  17. package/dist/local/projection-stat-pool.js +5 -2
  18. package/dist/local/projection-stat-pool.js.map +1 -1
  19. package/dist/local/workspace-change-commit.d.ts.map +1 -1
  20. package/dist/local/workspace-change-commit.js +119 -12
  21. package/dist/local/workspace-change-commit.js.map +1 -1
  22. package/dist/local/workspace-graph-store.d.ts +4 -0
  23. package/dist/local/workspace-graph-store.d.ts.map +1 -1
  24. package/dist/local/workspace-graph-store.js +10 -0
  25. package/dist/local/workspace-graph-store.js.map +1 -1
  26. package/dist/local/workspace-runtime.d.ts +8 -0
  27. package/dist/local/workspace-runtime.d.ts.map +1 -1
  28. package/dist/local/workspace-runtime.js +86 -21
  29. package/dist/local/workspace-runtime.js.map +1 -1
  30. package/dist/local/workspace-viewer-server.d.ts +9 -2
  31. package/dist/local/workspace-viewer-server.d.ts.map +1 -1
  32. package/dist/local/workspace-viewer-server.js +18 -14
  33. package/dist/local/workspace-viewer-server.js.map +1 -1
  34. package/dist/local/worktree-projection.d.ts +30 -0
  35. package/dist/local/worktree-projection.d.ts.map +1 -1
  36. package/dist/local/worktree-projection.js +110 -11
  37. package/dist/local/worktree-projection.js.map +1 -1
  38. package/dist/mcp/worktree.d.ts.map +1 -1
  39. package/dist/mcp/worktree.js +6 -3
  40. package/dist/mcp/worktree.js.map +1 -1
  41. package/dist/view-seam.d.ts +5 -1
  42. package/dist/view-seam.d.ts.map +1 -1
  43. package/dist/view-seam.js.map +1 -1
  44. package/package.json +1 -1
  45. package/viewer/assets/index--oYFIjRu.js +394 -0
  46. package/viewer/assets/{index-CHw8uj1S.css → index-Dp737Vja.css} +1 -1
  47. package/viewer/index.html +2 -2
  48. package/viewer/assets/index-MxTicR4w.js +0 -394
@@ -15,7 +15,7 @@ import { droppedEvidenceReferences, evidenceDropWarning } from './workspace-evid
15
15
  import { assertLocalWorkspacePathsIgnored, createDetachedGitWorktree, discoverGitRemoteIdentity, gitRemoteNames, discoverGitWorktree, removeGitWorktree, namingRemote, repositoryNames, trackedRemoteName } from './git.js';
16
16
  import { LocalWorkspaceGraphStore, graphRootFor, isTreeRoot, resolveLocalRepositoryStateDirectory } from './workspace-graph-store.js';
17
17
  import { blastRadius } from './blast-radius.js';
18
- import { findGraphEntities, showGraphEntities } from './graph-read.js';
18
+ import { findGraphEntities, showGraphEntities, showKeys } from './graph-read.js';
19
19
  import { readFolderMembers, repositoryTaskScope } from './folder-members.js';
20
20
  import { variantMemberFormIds, variantSyncIds, variantsReport } from './variants.js';
21
21
  import { withWorkspaceOperationLock } from './workspace-lock.js';
@@ -90,14 +90,19 @@ export function projectionStatRows(projection_dir) {
90
90
  const entries = readdirSync(join(projection_dir, folder), { withFileTypes: true });
91
91
  for (const entry of entries) {
92
92
  const path = folder ? `${folder}/${entry.name}` : entry.name;
93
+ // A folder's row names only that it is there: a compose refuses a
94
+ // missing kind folder or a stray one, which no file row would show.
93
95
  if (entry.isDirectory()) {
94
96
  folders.push(path);
97
+ rows.push(`${path}\0dir`);
95
98
  continue;
96
99
  }
97
100
  // stat follows a symbolic link, as the compose's reads do.
98
101
  const info = statSync(join(projection_dir, path));
99
- if (info.isDirectory())
102
+ if (info.isDirectory()) {
100
103
  folders.push(path);
104
+ rows.push(`${path}\0dir`);
105
+ }
101
106
  else
102
107
  rows.push(`${path}\0${info.ino}\0${info.size}\0${info.mtimeMs}\0${info.ctimeMs}`);
103
108
  }
@@ -1043,13 +1048,21 @@ export class LocalWorkspaceRuntime {
1043
1048
  operation: 'remove',
1044
1049
  run: async () => {
1045
1050
  const current = this.requireWorkspace(workspace.id);
1046
- const head_graph = await this.readCommitGraph(current.head_sdlc_commit_id);
1051
+ // Whether the head holds the entity, from its reference index on a
1052
+ // tree head (lst-change-integrate), else from its whole graph.
1053
+ const head = await this.headRefIndex(current.head_sdlc_commit_id);
1054
+ const head_graph = head
1055
+ ? null
1056
+ : await this.readCommitGraph(current.head_sdlc_commit_id);
1057
+ const held = (entry) => head
1058
+ ? head.index.refs.has(entityKey(entry.entity_kind, entry.entity_id))
1059
+ : graphHasProjectionEntity(head_graph, entry);
1047
1060
  const removed = await removeProjectionEntity({
1048
1061
  projection_dir: projectionDirectory(current),
1049
1062
  relative_path: input.relative_path,
1050
- allow_missing: (entry) => graphHasProjectionEntity(head_graph, entry)
1063
+ allow_missing: held
1051
1064
  });
1052
- const deletion_recorded = graphHasProjectionEntity(head_graph, removed);
1065
+ const deletion_recorded = held(removed);
1053
1066
  if (deletion_recorded) {
1054
1067
  this.store.recordWorkspaceDeletion({
1055
1068
  workspace_id: current.id,
@@ -1559,7 +1572,9 @@ export class LocalWorkspaceRuntime {
1559
1572
  })
1560
1573
  : null;
1561
1574
  const head = built ? null : await this.readCommitGraph(commit_id);
1562
- const dirty = head ? await this.projectionDirty(workspace, head) : null;
1575
+ const dirty = head
1576
+ ? await this.projectionDirty(workspace, async () => head)
1577
+ : null;
1563
1578
  const result = await blastRadius({
1564
1579
  graph: built?.graph ?? head,
1565
1580
  files: input.files,
@@ -1585,7 +1600,11 @@ export class LocalWorkspaceRuntime {
1585
1600
  }
1586
1601
  /** `sdlc workspace find`: nodes ranked by the words they match (graph-read.ts). */
1587
1602
  async workspaceFind(input) {
1588
- const read = await this.readGraphForView(input.workspace_id, input.view, 'find');
1603
+ // A search reads every node's text, but no edge, path or projection file.
1604
+ const read = await this.readGraphForView(input.workspace_id, input.view, 'find', async (head) => {
1605
+ const keys = [...head.index.refs.keys()].filter((key) => key.startsWith('node:'));
1606
+ return this.treeSubgraph(head.root, keys);
1607
+ });
1589
1608
  const found = findGraphEntities({
1590
1609
  graph: read.graph,
1591
1610
  terms: input.terms,
@@ -1606,7 +1625,9 @@ export class LocalWorkspaceRuntime {
1606
1625
  }
1607
1626
  /** `sdlc workspace show`: nodes and edges read compactly with their relations (graph-read.ts). */
1608
1627
  async workspaceShow(input) {
1609
- const read = await this.readGraphForView(input.workspace_id, input.view, 'show');
1628
+ // Only what show reports reads: the named entities, the edges at a named
1629
+ // node with their far ends, an edge's ends, and a named node's ancestors.
1630
+ const read = await this.readGraphForView(input.workspace_id, input.view, 'show', async (head) => this.treeSubgraph(head.root, showKeys(head.index, input.ids)));
1610
1631
  return {
1611
1632
  ...showGraphEntities({
1612
1633
  graph: read.graph,
@@ -1625,7 +1646,12 @@ export class LocalWorkspaceRuntime {
1625
1646
  * The graph a read command answers from: the committed head, or the built
1626
1647
  * view, as blast radius reads it, with what blast radius reports beside it.
1627
1648
  */
1628
- async readGraphForView(workspace_id, requested, command) {
1649
+ async readGraphForView(workspace_id, requested, command,
1650
+ /**
1651
+ * The part of a tree head the command reads, from its reference index;
1652
+ * a head that is not a tree is read whole.
1653
+ */
1654
+ select) {
1629
1655
  const workspace = this.requireWorkspace(workspace_id);
1630
1656
  const commit_id = workspace.head_sdlc_commit_id;
1631
1657
  const view = requested ?? 'planned';
@@ -1645,8 +1671,11 @@ export class LocalWorkspaceRuntime {
1645
1671
  }
1646
1672
  };
1647
1673
  }
1648
- const graph = await this.readCommitGraph(commit_id);
1649
- const dirty = await this.projectionDirty(workspace, graph, command);
1674
+ const head = select ? await this.headRefIndex(commit_id) : null;
1675
+ const graph = head
1676
+ ? await select(head)
1677
+ : await this.readCommitGraph(commit_id);
1678
+ const dirty = await this.projectionDirty(workspace, () => (head ? this.readCommitGraph(commit_id) : Promise.resolve(graph)), command);
1650
1679
  return {
1651
1680
  graph,
1652
1681
  view,
@@ -1658,18 +1687,27 @@ export class LocalWorkspaceRuntime {
1658
1687
  }
1659
1688
  /** Whether a workspace's projection differs from its committed head graph, with the warning blast radius gives. */
1660
1689
  async projectionDirty(workspace, head, command = 'blast-radius') {
1661
- let projection;
1662
- try {
1663
- ({ graph: projection } = await composeGraphProjection(projectionDirectory(workspace), undefined, { base: async () => head }));
1690
+ const head_root = this.commitRoot(workspace.head_sdlc_commit_id);
1691
+ // The files changed since the head's stats were kept, as status reads them.
1692
+ const change = await this.projectionChange(workspace, projectionStatRows(projectionDirectory(workspace))).catch(() => null);
1693
+ let clean;
1694
+ if (change) {
1695
+ clean = change.edit === null || change.edit.root === head_root;
1664
1696
  }
1665
- catch (error) {
1666
- return {
1667
- dirty: null,
1668
- warning: `The workspace projection could not be compared with its committed head (${error instanceof Error ? error.message : String(error)}); this answer reads the committed head.`
1669
- };
1697
+ else {
1698
+ let projection;
1699
+ try {
1700
+ ({ graph: projection } = await composeGraphProjection(projectionDirectory(workspace), undefined, { base: head }));
1701
+ }
1702
+ catch (error) {
1703
+ return {
1704
+ dirty: null,
1705
+ warning: `The workspace projection could not be compared with its committed head (${error instanceof Error ? error.message : String(error)}); this answer reads the committed head.`
1706
+ };
1707
+ }
1708
+ clean = graphRootFor(projection, head_root) === head_root;
1670
1709
  }
1671
- const head_root = this.commitRoot(workspace.head_sdlc_commit_id);
1672
- if (graphRootFor(projection, head_root) === head_root) {
1710
+ if (clean) {
1673
1711
  return { dirty: false, warning: null };
1674
1712
  }
1675
1713
  // commit takes the workspace of the directory it runs in, so name another one's worktree.
@@ -2764,6 +2802,33 @@ export class LocalWorkspaceRuntime {
2764
2802
  async readCommitGraph(commit_id) {
2765
2803
  return this.commits.readGraph(commit_id);
2766
2804
  }
2805
+ /**
2806
+ * A commit's tree root and reference index, for reads of the entities a
2807
+ * command names; null when its root is not a tree (a legacy or alias-only
2808
+ * head), which the caller reads whole.
2809
+ */
2810
+ async headRefIndex(commit_id) {
2811
+ const root = this.commitRoot(commit_id);
2812
+ if (!isTreeRoot(root))
2813
+ return null;
2814
+ const index = await loadRefIndex({
2815
+ root,
2816
+ ancestor_roots: () => this.firstParentTreeRoots(commit_id),
2817
+ readDerived: (r) => this.graphs.readDerived(r),
2818
+ writeDerived: (r, text) => this.graphs.writeDerived(r, text),
2819
+ diffRoots: (first, second) => this.treeEntityDiff(first, second),
2820
+ readGraph: (r) => this.graphs.readGraph(r)
2821
+ });
2822
+ return { root, index };
2823
+ }
2824
+ /** The named entities of a stored tree as a graph, read along their paths only. */
2825
+ async treeSubgraph(root, keys) {
2826
+ const values = await this.graphs.readTreeEntities(root, [...new Set(keys)].map((key) => ({
2827
+ entity_kind: key.slice(0, key.indexOf(':')),
2828
+ entity_id: key.slice(key.indexOf(':') + 1)
2829
+ })));
2830
+ return neighborhoodGraph([...values].filter((entry) => entry[1] !== null), await this.graphs.readTreeMetadata(root));
2831
+ }
2767
2832
  async assertProjectionClean(workspace) {
2768
2833
  const status = await this.getWorkspaceStatus(workspace.id);
2769
2834
  if (status.projection_dirty) {