@quolu/lattice 0.93.0 → 0.94.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@quolu/lattice",
3
- "version": "0.93.0",
3
+ "version": "0.94.0",
4
4
  "description": "Schedulability compiler for multi-agent development: observe real code boundaries, refactor the conflicting seam, recompile the plan for parallel execution",
5
5
  "author": {
6
6
  "name": "Quo / クオ at kitepon.dev",
package/src/cli-help.mjs CHANGED
@@ -347,7 +347,7 @@ const SUBCOMMAND_USAGE = Object.freeze({
347
347
  'todo done': 'todo done --plan <key> --task <id> [--evidence <file>] [--message <text>] [--test-result <markdown-file>]',
348
348
  'todo reopen': 'todo reopen --plan <key> --task <id> --reason <text> [--override-reason <text>]',
349
349
  'todo evidence': 'todo evidence promote --plan <key> --task <id> --evidence <file> | anchor [--json]',
350
- 'todo evidence anchor': 'todo evidence anchor [--json] # lattice.todo_evidence_anchor_result.v1 {anchored, already, missing}',
350
+ 'todo evidence anchor': 'todo evidence anchor [--json] # lattice.todo_evidence_anchor_result.v1 {anchored, already, missing}; no Store yet: lattice.todo_evidence_anchor_uninitialized.v1',
351
351
  'todo evidence promote': 'todo evidence promote --plan <key> --task <id> --evidence <file>',
352
352
  'todo dependency': [
353
353
  'todo dependency connect --from-plan <key> --from-task <id> --to-plan <key> --to-task <id> --reason <text>',
package/src/todo-cli.mjs CHANGED
@@ -4879,6 +4879,13 @@ function recordedEvidence(store) {
4879
4879
  * existing chart. Evidence gc already pruned cannot come back and is listed as `missing`.
4880
4880
  */
4881
4881
  async function evidenceAnchor({ repoRoot }) {
4882
+ // No Store yet: nothing recorded, so nothing to anchor. Answer like `todo status` does, not as a broken store.
4883
+ if (await isUninitializedTodoStore({ repoRoot })) {
4884
+ const result = { schema: 'lattice.todo_evidence_anchor_uninitialized.v1', anchored: [], already: 0, missing: [],
4885
+ next_actions: ['lattice plan create --template --json', 'lattice plan create --input <file>'], result_digest: '' };
4886
+ result.result_digest = todoSelfDigest(result, 'result_digest');
4887
+ return result;
4888
+ }
4882
4889
  const store = await readTodoStore({ repoRoot });
4883
4890
  const anchored = [];
4884
4891
  const missing = [];
@@ -113,6 +113,13 @@ function fail(code, reason, detail) {
113
113
  throw new TodoStoreError(code, reason, reason, detail);
114
114
  }
115
115
 
116
+ // No Store yet is an empty project, not a broken one (same classification as `status`): never invite repair or deletion.
117
+ function failUninitialized() {
118
+ fail('STORE_UNINITIALIZED', 'store_uninitialized', {
119
+ ref: STORE_ROOT_REF, next_action: 'lattice plan create --template --json',
120
+ });
121
+ }
122
+
116
123
  const upgradeAction = (what) => `${what} was written by a newer Lattice than ${packageJson.version}. The record is`
117
124
  + ` not corrupt: do not repair or delete it. Upgrade Lattice on this host to a version newer than`
118
125
  + ` ${packageJson.version}, then run the command again.`;
@@ -1534,8 +1541,12 @@ async function readTodoStoreView(options = {}) {
1534
1541
  await assertNoCrossPlanImportRecoveryNeeded(repoRoot);
1535
1542
  const pinnedSourceCache = { commits: new Set(), blobs: new Map() };
1536
1543
  const manifest = await readArtifact(repoRoot, MANIFEST_REF, {
1537
- code: 'STORE_INCONSISTENT', maxBytes: TODO_LIMITS.snapshotBytes, validate: validateTodoManifest,
1544
+ code: 'STORE_INCONSISTENT', maxBytes: TODO_LIMITS.snapshotBytes, validate: validateTodoManifest, missing: true,
1538
1545
  });
1546
+ if (manifest === null) {
1547
+ if (await isUninitializedTodoStore({ repoRoot })) failUninitialized();
1548
+ fail('STORE_INCONSISTENT', 'artifact_missing', { ref: MANIFEST_REF });
1549
+ }
1539
1550
  const loaded = [];
1540
1551
  for (const descriptor of manifest.members) {
1541
1552
  const plan = await readArtifact(repoRoot, descriptor.plan_ref, {
@@ -2162,11 +2173,11 @@ async function withLock(repoRoot, callback, {
2162
2173
  try {
2163
2174
  if (!initialize) {
2164
2175
  const root = await lstat(path.join(repoRoot, STORE_ROOT_REF)).catch((error) => {
2165
- if (error?.code === 'ENOENT') fail('STORE_INCONSISTENT', 'artifact_missing', { ref: MANIFEST_REF });
2176
+ if (error?.code === 'ENOENT') failUninitialized();
2166
2177
  throw error;
2167
2178
  });
2168
2179
  const parent = await lstat(path.join(repoRoot, '.lattice')).catch((error) => {
2169
- if (error?.code === 'ENOENT') fail('STORE_INCONSISTENT', 'artifact_missing', { ref: MANIFEST_REF });
2180
+ if (error?.code === 'ENOENT') failUninitialized();
2170
2181
  throw error;
2171
2182
  });
2172
2183
  if (!root.isDirectory() || root.isSymbolicLink()
@@ -3546,7 +3557,7 @@ async function prepareAuthoredStoreRoot(repoRoot, options) {
3546
3557
  }); } catch (error) {
3547
3558
  const gone = (await uninitializedStoreLayout(repoRoot)).identity === null;
3548
3559
  if (gone && error instanceof TodoStoreError
3549
- && ['store_locked', 'artifact_missing'].includes(error.detail.reason)) return;
3560
+ && ['store_locked', 'artifact_missing', 'store_uninitialized'].includes(error.detail.reason)) return;
3550
3561
  throw error;
3551
3562
  }
3552
3563
  await protocolStage(options, 'authoring_residue_released');