@quolu/lattice 0.106.0 → 0.107.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/README.ja.md +6 -9
- package/README.md +2 -2
- package/package.json +1 -1
- package/src/chart-cli.mjs +23 -11
- package/src/cli-help.mjs +9 -15
- package/src/cli-refusal-guidance.mjs +7 -15
- package/src/sensor-cli.mjs +23 -0
- package/src/todo-audit-pending.mjs +3 -5
- package/src/todo-authoring-input.mjs +1 -1
- package/src/todo-cli.mjs +91 -475
- package/src/todo-contracts.mjs +6 -2
- package/src/todo-note-store.mjs +3 -3
- package/src/todo-readiness.mjs +0 -1
- package/src/todo-status.mjs +0 -1
- package/src/todo-store.mjs +7 -3
package/src/todo-contracts.mjs
CHANGED
|
@@ -896,8 +896,12 @@ export function validateTodoChartMeta(value) {
|
|
|
896
896
|
const text = (field) => field === null || (typeof field === 'string' && field.length > 0 && field.length <= 1024);
|
|
897
897
|
const word = (field) => typeof field === 'string' && field.length > 0 && field.length <= 1024;
|
|
898
898
|
const { repo } = value ?? {};
|
|
899
|
-
|
|
900
|
-
|
|
899
|
+
// no_code_lanes is optional: a file without it stays valid, and an empty list is never written (old readers keep working).
|
|
900
|
+
const lanes = value?.no_code_lanes;
|
|
901
|
+
const lanesOk = lanes === undefined || (Array.isArray(lanes) && lanes.every((lane, index) => isTodoIdentifier(lane)
|
|
902
|
+
&& (index === 0 || lanes[index - 1] < lane)));
|
|
903
|
+
return exactRecord(value, ['schema', 'name', 'created_by', 'created_at', 'repo', ...(lanes === undefined ? [] : ['no_code_lanes'])])
|
|
904
|
+
&& lanesOk && value.schema === TODO_CHART_META_SCHEMA && text(value.name) && text(value.created_by)
|
|
901
905
|
&& (value.created_at === null || isStrictTodoTimestamp(value.created_at))
|
|
902
906
|
&& (repo === null || (exactRecord(repo, ['url', 'branch', 'accepted_tip'])
|
|
903
907
|
&& word(repo.url) && word(repo.branch) && text(repo.accepted_tip)));
|
package/src/todo-note-store.mjs
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { createHash, randomBytes } from 'node:crypto';
|
|
2
2
|
import { fsyncDirectory } from './fs-dir-sync.mjs';
|
|
3
3
|
import {
|
|
4
|
-
lstat, mkdir, open, readFile, readdir,
|
|
4
|
+
lstat, mkdir, open, readFile, readdir, rm, stat,
|
|
5
5
|
} from 'node:fs/promises';
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { LOCK_WAIT_MS, StoreLockError, withStoreLock } from './store-lock.mjs';
|
|
8
|
-
import { syncPublishedFile } from './fs-publish.mjs';
|
|
8
|
+
import { renamePublishedFile, syncPublishedFile } from './fs-publish.mjs';
|
|
9
9
|
import { normalizeCheckoutEol } from './todo-store-view.mjs';
|
|
10
10
|
import { memoByFileIdentity } from './todo-version-memo.mjs';
|
|
11
11
|
import { TODO_VERSION_COMPACT_FILE, readVersionCompact } from './todo-version-compact.mjs';
|
|
@@ -201,7 +201,7 @@ async function atomicWrite(ref, bytes) {
|
|
|
201
201
|
await syncPublishedFile(handle, ref);
|
|
202
202
|
await handle.close();
|
|
203
203
|
handle = null;
|
|
204
|
-
await
|
|
204
|
+
await renamePublishedFile(temporary, ref);
|
|
205
205
|
await fsyncDirectory(path.dirname(ref));
|
|
206
206
|
} finally {
|
|
207
207
|
if (handle) await handle.close();
|
package/src/todo-readiness.mjs
CHANGED
|
@@ -282,7 +282,6 @@ export function validateProspectiveEvent({ store, member, event }) {
|
|
|
282
282
|
const definition = todoPhaseDefinitions(member.plan).find(({ phase_id: id }) => id === event.phase_id);
|
|
283
283
|
return refused('phase_gate_not_ready', 'phase_state', {
|
|
284
284
|
plan_key: member.plan.plan_key, phase_id: event.phase_id, phase_status: phase.status,
|
|
285
|
-
required_evidence_slots: [...(definition?.required_evidence_slots ?? [])],
|
|
286
285
|
});
|
|
287
286
|
}
|
|
288
287
|
}
|
package/src/todo-status.mjs
CHANGED
|
@@ -436,7 +436,6 @@ function collectAuditPending(member, sink) {
|
|
|
436
436
|
implicit,
|
|
437
437
|
required_evidence_slots: [...definition.required_evidence_slots],
|
|
438
438
|
next_commands: auditPendingNextCommands(member.plan.plan_key, phase.phase_id, phase.status,
|
|
439
|
-
definition.required_evidence_slots.length,
|
|
440
439
|
{ auditRequired: phaseAuditRequired(member, definition.gate_policy) }),
|
|
441
440
|
});
|
|
442
441
|
}
|
package/src/todo-store.mjs
CHANGED
|
@@ -3973,7 +3973,7 @@ async function withInitialStoreLocks(stage, currentRoot, callback) {
|
|
|
3973
3973
|
/** G5-only initial authoring transaction. Store membership appears by one final directory rename. */
|
|
3974
3974
|
const CHART_META_REF = '.lattice/chart.json';
|
|
3975
3975
|
const CHART_META_MAX_BYTES = 65_536;
|
|
3976
|
-
const CHART_META_PATCH_KEYS = ['name', 'created_by', 'repo'];
|
|
3976
|
+
const CHART_META_PATCH_KEYS = ['name', 'created_by', 'repo', 'no_code_lanes'];
|
|
3977
3977
|
|
|
3978
3978
|
/** The recorded chart identity, or null when `.lattice/chart.json` does not exist. */
|
|
3979
3979
|
async function readChartMetaRecord(repoRoot) {
|
|
@@ -3999,7 +3999,7 @@ async function readChartMetaRecord(repoRoot) {
|
|
|
3999
3999
|
}
|
|
4000
4000
|
|
|
4001
4001
|
const chartMetaView = (record) => ({ name: record?.name ?? null, created_by: record?.created_by ?? null,
|
|
4002
|
-
created_at: record?.created_at ?? null, repo: record?.repo ?? null });
|
|
4002
|
+
created_at: record?.created_at ?? null, repo: record?.repo ?? null, no_code_lanes: record?.no_code_lanes ?? [] });
|
|
4003
4003
|
|
|
4004
4004
|
/**
|
|
4005
4005
|
* a101 K4: chart identity `.lattice/chart.json` (dfd-charts-read). Read only, no lock, no Store needed: a missing file
|
|
@@ -4010,7 +4010,7 @@ export async function readTodoChartMeta({ repoRoot = process.cwd() } = {}) {
|
|
|
4010
4010
|
}
|
|
4011
4011
|
|
|
4012
4012
|
/**
|
|
4013
|
-
* a101 K4: patch {name?, created_by?, repo?} (absent key = keep). `created_by` applies only while unrecorded and
|
|
4013
|
+
* a101 K4: patch {name?, created_by?, repo?, no_code_lanes?} (absent key = keep; `no_code_lanes` replaces the list). `created_by` applies only while unrecorded and
|
|
4014
4014
|
* `created_at` is stamped when the file is first created: the creator is never overwritten. Works before the first plan
|
|
4015
4015
|
* (creates `.lattice/`). The read-modify-write holds `.lattice/.chart.write.lock` so two writers cannot both see an
|
|
4016
4016
|
* unrecorded creator (identified lock, proven-dead recovery). Name rules are the CLI's.
|
|
@@ -4042,6 +4042,10 @@ export async function writeTodoChartMeta({ repoRoot = process.cwd(), patch = {}
|
|
|
4042
4042
|
created_at: current === null ? new Date().toISOString() : current.created_at,
|
|
4043
4043
|
repo: 'repo' in patch ? patch.repo : current?.repo ?? null,
|
|
4044
4044
|
};
|
|
4045
|
+
// The list is stored only when non-empty; the patch value replaces it (sorted, unique).
|
|
4046
|
+
const lanes = 'no_code_lanes' in patch ? patch.no_code_lanes : current?.no_code_lanes ?? [];
|
|
4047
|
+
if (!Array.isArray(lanes)) throw new TypeError('chart meta patch invalid');
|
|
4048
|
+
if (lanes.length > 0) next.no_code_lanes = 'no_code_lanes' in patch ? [...new Set(lanes)].sort() : lanes;
|
|
4045
4049
|
if (!validateTodoChartMeta(next)) throw new TypeError('chart meta patch invalid');
|
|
4046
4050
|
if (current !== null && canonicalizeTodoArtifact(next) === canonicalizeTodoArtifact(current)) {
|
|
4047
4051
|
return { meta: chartMetaView(current), unchanged: true };
|