@sentropic/track 0.98.7-rc.3 → 0.98.7-rc.4
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.md +8 -5
- package/dist/cli/index.d.ts.map +1 -1
- package/dist/cli/index.js +72 -16
- package/dist/cli/index.js.map +1 -1
- package/dist/model/report-status.d.ts +23 -2
- package/dist/model/report-status.d.ts.map +1 -1
- package/dist/model/report-status.js +50 -4
- package/dist/model/report-status.js.map +1 -1
- package/dist/read/commands.d.ts +22 -2
- package/dist/read/commands.d.ts.map +1 -1
- package/dist/read/commands.js +134 -25
- package/dist/read/commands.js.map +1 -1
- package/dist/read/contract.d.ts.map +1 -1
- package/dist/read/contract.js +3 -1
- package/dist/read/contract.js.map +1 -1
- package/dist/report/audit.d.ts +68 -0
- package/dist/report/audit.d.ts.map +1 -1
- package/dist/report/audit.js +116 -0
- package/dist/report/audit.js.map +1 -1
- package/dist/report/build.d.ts +82 -1
- package/dist/report/build.d.ts.map +1 -1
- package/dist/report/build.js +85 -3
- package/dist/report/build.js.map +1 -1
- package/dist/report/format.d.ts +94 -2
- package/dist/report/format.d.ts.map +1 -1
- package/dist/report/format.js +230 -25
- package/dist/report/format.js.map +1 -1
- package/dist/report/index.d.ts +5 -2
- package/dist/report/index.d.ts.map +1 -1
- package/dist/report/index.js +6 -1
- package/dist/report/index.js.map +1 -1
- package/dist/report/stage-status-lexicon.d.ts +24 -0
- package/dist/report/stage-status-lexicon.d.ts.map +1 -0
- package/dist/report/stage-status-lexicon.js +96 -0
- package/dist/report/stage-status-lexicon.js.map +1 -0
- package/dist/report/stage-status.d.ts +31 -0
- package/dist/report/stage-status.d.ts.map +1 -0
- package/dist/report/stage-status.js +208 -0
- package/dist/report/stage-status.js.map +1 -0
- package/dist/state/fold.js +7 -2
- package/dist/state/fold.js.map +1 -1
- package/dist/track.d.ts.map +1 -1
- package/dist/track.js +4 -1
- package/dist/track.js.map +1 -1
- package/package.json +1 -1
- package/dist/report/status-table.d.ts +0 -46
- package/dist/report/status-table.d.ts.map +0 -1
- package/dist/report/status-table.js +0 -211
- package/dist/report/status-table.js.map +0 -1
- package/skills/track-report/SKILL.md +0 -137
package/dist/report/format.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
1
|
import { BUCKETS } from './buckets.js';
|
|
2
|
+
import { resolveStageStatusLabels } from './stage-status-lexicon.js';
|
|
3
|
+
import { STATUS_HEALTH } from './stage-status.js';
|
|
2
4
|
import { buildDirectives, decisionNeedsFocus, dispatchQueueOf, keystoneOf, } from './directive.js';
|
|
3
5
|
// Unified report presentation (spec 2026-07-11) — the SINGLE enum→French lexicon the cockpit shares, so
|
|
4
6
|
// the two surfaces can never re-word apart. The terminal composes its own `<nature> (<actor>): <clause>`
|
|
@@ -104,10 +106,12 @@ function rowLine(r, format) {
|
|
|
104
106
|
* readable, but only a dossier that satisfies the native validator is actionable.
|
|
105
107
|
*/
|
|
106
108
|
function classifyDecisions(decisions) {
|
|
109
|
+
// Amendment D12 — `deferred` is pending, not settled, in every renderer.
|
|
110
|
+
const answerable = (decision) => decision.outcome === 'pending' || decision.outcome === 'deferred';
|
|
107
111
|
return {
|
|
108
112
|
structured: decisions.filter((decision) => decision.structured === true),
|
|
109
|
-
legacyPending: decisions.filter((decision) => decision.structured !== true && decision
|
|
110
|
-
legacySettled: decisions.filter((decision) => decision.structured !== true && decision
|
|
113
|
+
legacyPending: decisions.filter((decision) => decision.structured !== true && answerable(decision)),
|
|
114
|
+
legacySettled: decisions.filter((decision) => decision.structured !== true && !answerable(decision)),
|
|
111
115
|
};
|
|
112
116
|
}
|
|
113
117
|
function legacyRevisionAction(decision) {
|
|
@@ -291,7 +295,7 @@ export function formatActionReport(report, format) {
|
|
|
291
295
|
const dropped = report.buckets.DROPPED;
|
|
292
296
|
const allDecisions = report.decisions ?? [];
|
|
293
297
|
const { structured, legacyPending, legacySettled } = classifyDecisions(allDecisions);
|
|
294
|
-
const pendingDecisions = structured.filter((d) => d.outcome === 'pending');
|
|
298
|
+
const pendingDecisions = structured.filter((d) => d.outcome === 'pending' || d.outcome === 'deferred');
|
|
295
299
|
lines.push(h('SYNTHÈSE'));
|
|
296
300
|
lines.push(...table(['fait', 'à-faire', 'attendus', 'dropped', 'décisions pending'], [[String(done.length), String(todo.length), String(awaited.length), String(dropped.length), String(pendingDecisions.length)]]));
|
|
297
301
|
lines.push('');
|
|
@@ -689,19 +693,44 @@ export const DETERMINISTIC_NEXT_ACTIONS = [
|
|
|
689
693
|
*
|
|
690
694
|
* The renderer's own markers are counted as `uninstructed`, never as violations: they are the honest
|
|
691
695
|
* statement that the work is still owed, which is exactly what the report must say until it is done.
|
|
696
|
+
* An `investigated` row without action text AND origin is uncertified — neither a plain string nor
|
|
697
|
+
* missing audit metadata can certify an investigated action — so it still counts as owed.
|
|
692
698
|
*/
|
|
693
|
-
export function auditNextActions(
|
|
694
|
-
const
|
|
695
|
-
|
|
699
|
+
export function auditNextActions(descriptors) {
|
|
700
|
+
const certified = descriptors.filter((descriptor) => descriptor.instruction === 'investigated' &&
|
|
701
|
+
descriptor.action !== undefined &&
|
|
702
|
+
descriptor.actionOrigin !== undefined);
|
|
696
703
|
const counts = new Map();
|
|
697
|
-
for (const
|
|
698
|
-
counts.set(
|
|
704
|
+
for (const descriptor of certified)
|
|
705
|
+
counts.set(descriptor.action, (counts.get(descriptor.action) ?? 0) + 1);
|
|
699
706
|
const repeated = [...counts.entries()].filter(([, n]) => n > 2).map(([value]) => value);
|
|
700
|
-
const
|
|
701
|
-
const
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
return { uninstructed, repeated, gateClauses: [...new Set(hits)], ok: repeated.length === 0 && hits.length === 0 };
|
|
707
|
+
const hits = certified.filter((descriptor) => descriptor.actionOrigin === 'gate-class');
|
|
708
|
+
const uninstructed = descriptors.length - certified.length - descriptors.filter((descriptor) => descriptor.instruction === 'not-instructed' ||
|
|
709
|
+
descriptor.instruction === 'structure-dossier' ||
|
|
710
|
+
descriptor.instruction === 'none-owed').length;
|
|
711
|
+
return { uninstructed, repeated, gateClauses: [...new Set(hits.map((descriptor) => descriptor.action))], ok: repeated.length === 0 && hits.length === 0 };
|
|
712
|
+
}
|
|
713
|
+
/**
|
|
714
|
+
* Amendment D10 — describe rendered À-FAIRE rows as audit descriptors. The
|
|
715
|
+
* serving layer supplies instruction/origin metadata. Missing metadata owes
|
|
716
|
+
* investigation regardless of the text's language; no prose is classified.
|
|
717
|
+
*/
|
|
718
|
+
export function describeRowNextActions(rows) {
|
|
719
|
+
return rows.map((row) => {
|
|
720
|
+
const focus = row['focus'] === 'true';
|
|
721
|
+
const next = row['nextAction'] ?? '';
|
|
722
|
+
const value = row['instruction'];
|
|
723
|
+
const instruction = value === 'investigated' || value === 'not-instructed' || value === 'structure-dossier' || value === 'none-owed'
|
|
724
|
+
? value : 'to-instruct';
|
|
725
|
+
const origin = row['actionOrigin'];
|
|
726
|
+
return {
|
|
727
|
+
focus,
|
|
728
|
+
instruction,
|
|
729
|
+
...(instruction === 'investigated' ? { action: next } : {}),
|
|
730
|
+
...(origin === 'investigated' || origin === 'gate-class' ? { actionOrigin: origin } : {}),
|
|
731
|
+
...(row['gateSteps'] !== undefined ? { gateSteps: row['gateSteps'].split(',').filter(Boolean) } : {}),
|
|
732
|
+
};
|
|
733
|
+
});
|
|
705
734
|
}
|
|
706
735
|
/** `2026-07-29T11:02:03.000Z` → `2026-07-29`. UTC, so the header is TZ-independent and reproducible. */
|
|
707
736
|
function isoDate(value) {
|
|
@@ -714,6 +743,18 @@ function isoDate(value) {
|
|
|
714
743
|
export function reportPeriod(meta) {
|
|
715
744
|
if (meta.periodWindow !== undefined) {
|
|
716
745
|
const period = meta.periodWindow;
|
|
746
|
+
// Amendment D4 — rolling windows are instant bounds: resolved AND printed
|
|
747
|
+
// with time and offset (no calendar rounding). Calendar selectors keep
|
|
748
|
+
// their pinned date labels.
|
|
749
|
+
if (period.requested === 'last-week' || period.requested === 'last-day') {
|
|
750
|
+
const span = period.requested === 'last-week' ? '7 derniers jours glissants' : '24 dernières heures glissantes';
|
|
751
|
+
const from = isoDate(period.from);
|
|
752
|
+
const to = isoDate(period.to);
|
|
753
|
+
const label = period.from === undefined || period.to === undefined
|
|
754
|
+
? 'période : journal vide (aucun événement enregistré)'
|
|
755
|
+
: `période : ${period.from} → ${period.to} (${span} ; ${period.eventsInWindow}/${period.eventsTotal} événements)`;
|
|
756
|
+
return { ...(from !== undefined ? { from } : {}), ...(to !== undefined ? { to } : {}), toSource: 'unknown', label };
|
|
757
|
+
}
|
|
717
758
|
const from = isoDate(period.from);
|
|
718
759
|
const to = isoDate(period.to);
|
|
719
760
|
if (period.requested === null) {
|
|
@@ -789,6 +830,48 @@ function compactRefs(refs) {
|
|
|
789
830
|
function shellArgument(value) {
|
|
790
831
|
return /^[A-Za-z0-9_./:-]+$/u.test(value) ? value : `'${value.replace(/'/gu, "'\"'\"'")}'`;
|
|
791
832
|
}
|
|
833
|
+
/** Named period selectors rebindable with a single `--period` flag. */
|
|
834
|
+
const NAMED_PERIODS = ['today', 'week', 'month', 'all', 'last-week', 'last-day'];
|
|
835
|
+
/**
|
|
836
|
+
* Amendment D4/D13 — the resolution command bound to the exact rendering
|
|
837
|
+
* context: scope, period and sub-WP expansion travel with the handle, so a
|
|
838
|
+
* reply quoting a handle without its context is refused rather than
|
|
839
|
+
* mis-resolved. No context ⇒ the established bare command, byte-identical.
|
|
840
|
+
*/
|
|
841
|
+
export function handleCommandFor(meta) {
|
|
842
|
+
const parts = ['track report'];
|
|
843
|
+
if (meta.scopeProjection !== undefined)
|
|
844
|
+
parts.push(`--scope ${shellArgument(meta.scopeProjection.selector)}`);
|
|
845
|
+
const requested = meta.periodWindow?.requested ?? null;
|
|
846
|
+
if (requested !== null) {
|
|
847
|
+
if (NAMED_PERIODS.includes(requested)) {
|
|
848
|
+
parts.push(`--period ${requested}`);
|
|
849
|
+
}
|
|
850
|
+
else {
|
|
851
|
+
const [since, until] = requested.split('..');
|
|
852
|
+
// Freeze symbolic commit bounds so moving HEAD cannot reassign a handle.
|
|
853
|
+
parts.push(`--since ${shellArgument(meta.periodWindow.fromRef ?? since)}`);
|
|
854
|
+
if (until !== undefined)
|
|
855
|
+
parts.push(`--until ${shellArgument(meta.periodWindow.toRef ?? until)}`);
|
|
856
|
+
}
|
|
857
|
+
}
|
|
858
|
+
if (meta.subWp === true)
|
|
859
|
+
parts.push('--sub-wp');
|
|
860
|
+
const clock = meta.now ?? meta.periodWindow?.to ?? meta.logTo;
|
|
861
|
+
if (clock !== undefined)
|
|
862
|
+
parts.push(`--now ${shellArgument(clock)}`);
|
|
863
|
+
if (meta.baselineCommit !== undefined)
|
|
864
|
+
parts.push(`--commit ${shellArgument(meta.baselineCommit)}`);
|
|
865
|
+
if (meta.requireAccepted === true)
|
|
866
|
+
parts.push('--require-accepted');
|
|
867
|
+
if (meta.journalRevision !== undefined) {
|
|
868
|
+
parts.push(`--expect-events ${meta.journalRevision.events}`);
|
|
869
|
+
if (meta.journalRevision.head !== null)
|
|
870
|
+
parts.push(`--expect-head ${shellArgument(meta.journalRevision.head)}`);
|
|
871
|
+
}
|
|
872
|
+
parts.push('--resolve <handle>');
|
|
873
|
+
return parts.join(' ');
|
|
874
|
+
}
|
|
792
875
|
export function buildWpConductorView(tree, decisions = [], outsideRollup = [], totalScope = 'global', meta = {}) {
|
|
793
876
|
assertOrderedPeriodWindow(meta);
|
|
794
877
|
const wpName = (n) => `${n.label} · ${clean(stripWpPrefix(n.title))}`;
|
|
@@ -834,12 +917,17 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
834
917
|
// cell, or FAIT if it produced something). It leaves the report and is counted among omissions.
|
|
835
918
|
// 24 — a pending dossier with no stored options cannot be answered either. It is not dressed up as a
|
|
836
919
|
// choice: it appears in À-FAIRE as the work of making it answerable.
|
|
837
|
-
|
|
838
|
-
|
|
920
|
+
// Amendment D12 — a `deferred` dossier is NOT settled: it stays answerable
|
|
921
|
+
// (numbered, listed, resolvable) and states explicitly that its answer is
|
|
922
|
+
// postponed. The withdrawn view's private deferred→pending mapping is gone
|
|
923
|
+
// with that view; the validated path answers the same journal the same way.
|
|
924
|
+
const isAnswerable = (d) => d.outcome === 'pending' || d.outcome === 'deferred';
|
|
925
|
+
const structuredPending = structuredDecisions.filter(isAnswerable);
|
|
926
|
+
const settledDecisions = decisions.filter((d) => !isAnswerable(d));
|
|
839
927
|
const decisionRef = new Map();
|
|
840
928
|
structuredPending.forEach((d, i) => decisionRef.set(d.id, `D${i + 1}`));
|
|
841
929
|
legacyPending.forEach((d, i) => decisionRef.set(d.id, `Q${i + 1}`));
|
|
842
|
-
const isPending = new Set(decisions.filter(
|
|
930
|
+
const isPending = new Set(decisions.filter(isAnswerable).map((d) => d.id));
|
|
843
931
|
// ---- handles (criteria 10b/10c) -----------------------------------------------------------------
|
|
844
932
|
// Handles are POSITIONAL WITHIN THIS REPORT (`[row.item]`), assigned AFTER À-FAIRE is ordered. Leg A
|
|
845
933
|
// established that no content-derived handle can be stable across runs — ordering, titles and WP
|
|
@@ -899,6 +987,7 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
899
987
|
attached.push(directive);
|
|
900
988
|
}
|
|
901
989
|
const urgencyIndex = new Map(directives.map((d, i) => [d.id, i]));
|
|
990
|
+
const stepByDirectiveId = new Map(directives.map(d => [d.id, d.step.code]));
|
|
902
991
|
/**
|
|
903
992
|
* Criterion 7 + 19 — `bloqué` names the ANSWER that unblocks (a D-number) when the gate is a dossier,
|
|
904
993
|
* and a short gate token otherwise. It renders `—` ONLY when no gate is recorded at all.
|
|
@@ -934,6 +1023,31 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
934
1023
|
// Machine-only audit properties (NOT declared columns, so no renderer ever prints them): the precise
|
|
935
1024
|
// gate phrase the short `bloqué` token compacts, kept so nothing is lost from the projection.
|
|
936
1025
|
const gateDetail = (attached) => [...new Set(attached.map((d) => gatePhraseFr(d.gate)).filter((p) => p !== undefined))].join(' / ');
|
|
1026
|
+
// Amendment D3/D11 — per-item stage/status + strict-WP facts for the two
|
|
1027
|
+
// new columns, through the existing lexicon (the validated renderer stays
|
|
1028
|
+
// French). Codes stay the identity; only the owner-facing cells are
|
|
1029
|
+
// labelled. Without journal context the cells honestly state `—`.
|
|
1030
|
+
const frLabels = resolveStageStatusLabels(meta.lang ?? 'fr').labels;
|
|
1031
|
+
const stageCell = (id, handle) => {
|
|
1032
|
+
const facts = meta.itemFacts?.[id];
|
|
1033
|
+
if (facts === undefined)
|
|
1034
|
+
return `[${handle}] —`;
|
|
1035
|
+
return `[${handle}] ${frLabels.stage[facts.stage]}`;
|
|
1036
|
+
};
|
|
1037
|
+
const statusCell = (id, handle) => {
|
|
1038
|
+
const facts = meta.itemFacts?.[id];
|
|
1039
|
+
if (facts === undefined)
|
|
1040
|
+
return `[${handle}] —`;
|
|
1041
|
+
const health = STATUS_HEALTH[facts.status];
|
|
1042
|
+
const label = frLabels.status[facts.status];
|
|
1043
|
+
return `[${handle}] ${health === undefined ? '—' : health} ${label}`;
|
|
1044
|
+
};
|
|
1045
|
+
// An item with no strict WP root renders the visible machine flag
|
|
1046
|
+
// `outside-wp` — but only when facts are present (unknown ≠ outside).
|
|
1047
|
+
const isOutsideWp = (id) => {
|
|
1048
|
+
const facts = meta.itemFacts?.[id];
|
|
1049
|
+
return facts !== undefined && facts.wpStrictRootId === undefined;
|
|
1050
|
+
};
|
|
937
1051
|
const wpTodoDrafts = rowNodes
|
|
938
1052
|
.filter((n) => openLeaves(n).length > 0 || branchOf(n).some((b) => directivesByWpId.has(b.id)))
|
|
939
1053
|
.map((n) => {
|
|
@@ -966,6 +1080,7 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
966
1080
|
return {
|
|
967
1081
|
wp: wpName(n),
|
|
968
1082
|
progress: pctStr(n.pct),
|
|
1083
|
+
nodeIds: branchOf(n).map((b) => b.id),
|
|
969
1084
|
items,
|
|
970
1085
|
blocked: blockedCell(attached),
|
|
971
1086
|
gatedOnDecision: gated,
|
|
@@ -990,6 +1105,7 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
990
1105
|
horsWpDrafts.push({
|
|
991
1106
|
wp: 'hors WP · dossiers à structurer',
|
|
992
1107
|
progress: 'n/a',
|
|
1108
|
+
nodeIds: [],
|
|
993
1109
|
// A dossier with no stored options says nothing by its title alone. Its prose context is recorded:
|
|
994
1110
|
// show it as an EXCERPT — never as options, which is what `unstructured` forbids (criterion 16).
|
|
995
1111
|
items: toStructure.map((d) => {
|
|
@@ -1016,6 +1132,7 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1016
1132
|
horsWpDrafts.push({
|
|
1017
1133
|
wp: 'hors WP · items',
|
|
1018
1134
|
progress: 'n/a',
|
|
1135
|
+
nodeIds: [],
|
|
1019
1136
|
items: outsideOpen.map((r) => ({
|
|
1020
1137
|
id: r.id,
|
|
1021
1138
|
title: clean(r.title),
|
|
@@ -1029,10 +1146,73 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1029
1146
|
order: '09998',
|
|
1030
1147
|
});
|
|
1031
1148
|
}
|
|
1032
|
-
|
|
1149
|
+
// Amendment D9 — withdrawal notices join À-FAIRE as identifiable items
|
|
1150
|
+
// under their actual container/WP. An item already rendered (an AWAITED
|
|
1151
|
+
// withdrawal with a live gate) is NOT duplicated: its status comes from
|
|
1152
|
+
// the shared derivation. Notices never touch legacy bucket/tally rules and
|
|
1153
|
+
// are never counted a second time in active/delivered totals.
|
|
1154
|
+
const containerLabel = (containerId) => {
|
|
1155
|
+
const walk = (nodes) => {
|
|
1156
|
+
for (const node of nodes) {
|
|
1157
|
+
if (node.id === containerId)
|
|
1158
|
+
return node;
|
|
1159
|
+
const found = walk(node.children);
|
|
1160
|
+
if (found !== undefined)
|
|
1161
|
+
return found;
|
|
1162
|
+
}
|
|
1163
|
+
return undefined;
|
|
1164
|
+
};
|
|
1165
|
+
const node = walk(tree);
|
|
1166
|
+
return node === undefined ? undefined : wpName(node);
|
|
1167
|
+
};
|
|
1168
|
+
const noticeDrafts = [];
|
|
1169
|
+
for (const notice of meta.withdrawnNotices ?? []) {
|
|
1170
|
+
const existing = [...wpTodoDrafts, ...horsWpDrafts, ...noticeDrafts].flatMap(draft => draft.items).filter(item => item.id === notice.id);
|
|
1171
|
+
const reason = notice.reason === undefined ? 'retiré — motif non enregistré' : `retiré : ${notice.reason}`;
|
|
1172
|
+
if (existing.length > 0) {
|
|
1173
|
+
for (const item of existing)
|
|
1174
|
+
item.excerpt = reason;
|
|
1175
|
+
continue;
|
|
1176
|
+
}
|
|
1177
|
+
const item = {
|
|
1178
|
+
id: notice.id,
|
|
1179
|
+
title: clean(notice.title),
|
|
1180
|
+
excerpt: reason,
|
|
1181
|
+
};
|
|
1182
|
+
const host = [...wpTodoDrafts, ...horsWpDrafts, ...noticeDrafts].find((draft) => notice.containerId !== undefined && draft.nodeIds.includes(notice.containerId));
|
|
1183
|
+
if (host !== undefined) {
|
|
1184
|
+
host.items.push(item);
|
|
1185
|
+
}
|
|
1186
|
+
else {
|
|
1187
|
+
const refs = notice.dossierIds
|
|
1188
|
+
.map((dossierId) => decisionRef.get(dossierId))
|
|
1189
|
+
.filter((ref) => ref !== undefined);
|
|
1190
|
+
noticeDrafts.push({
|
|
1191
|
+
wp: (notice.containerId !== undefined ? containerLabel(notice.containerId) : undefined) ?? 'hors WP · retraits',
|
|
1192
|
+
progress: 'n/a',
|
|
1193
|
+
nodeIds: [],
|
|
1194
|
+
items: [item],
|
|
1195
|
+
// Criterion 19 — a recorded answerable dossier is a reference, never `—`.
|
|
1196
|
+
blocked: refs.length > 0 ? compactRefs(refs) : NO_GATE,
|
|
1197
|
+
// D9 — no action is owed on a withdrawal; stating so must not imply open work.
|
|
1198
|
+
fixedNextAction: NO_ACTION,
|
|
1199
|
+
gatedOnDecision: false,
|
|
1200
|
+
directiveIds: '',
|
|
1201
|
+
gateDetail: '',
|
|
1202
|
+
gateStep: '',
|
|
1203
|
+
order: '09997',
|
|
1204
|
+
});
|
|
1205
|
+
}
|
|
1206
|
+
}
|
|
1207
|
+
const orderedDrafts = [...wpTodoDrafts, ...horsWpDrafts, ...noticeDrafts].sort((a, b) => a.order === b.order ? a.wp.localeCompare(b.wp) : a.order.localeCompare(b.order));
|
|
1033
1208
|
// Handles are assigned HERE, once the order is final: `[row.item]`, both 1-based (criterion 10b/10c).
|
|
1034
1209
|
// `prochaine action` is decided here too, because whether a row is FOCUS depends on that same order
|
|
1035
1210
|
// (criterion 20: the per-row investigation is bounded to the five rows the ordering line names).
|
|
1211
|
+
// Amendment D3/D11 — the two new columns annotate identifiable tracked
|
|
1212
|
+
// items: one stage/status line per item, handle-prefixed like the `à faire`
|
|
1213
|
+
// lines so the mapping survives wrapping; `outside-wp` flags strict
|
|
1214
|
+
// non-attachment in the item line itself.
|
|
1215
|
+
const outsideIds = new Set();
|
|
1036
1216
|
const orderedTodo = orderedDrafts.map((draft, rowIndex) => {
|
|
1037
1217
|
const cells = draft.items.map((item, itemIndex) => {
|
|
1038
1218
|
const handle = `${rowIndex + 1}.${itemIndex + 1}`;
|
|
@@ -1044,24 +1224,38 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1044
1224
|
// Criterion 27 — one idea per line: the item on its line, and its recorded excerpt as a
|
|
1045
1225
|
// SUBORDINATE clause on its own, never a paragraph appended to the title.
|
|
1046
1226
|
const note = item.note === undefined ? '' : ` (${item.note})`;
|
|
1227
|
+
const outside = isOutsideWp(item.id) ? ' (outside-wp)' : '';
|
|
1228
|
+
if (outside !== '')
|
|
1229
|
+
outsideIds.add(item.id);
|
|
1047
1230
|
const excerpt = item.excerpt === undefined ? '' : `\n↳ extrait : ${item.excerpt}`;
|
|
1048
|
-
|
|
1231
|
+
const source = meta.itemFacts?.[item.id]?.requestSource;
|
|
1232
|
+
const request = source?.provenance === 'demand-raw' ? `\n↳ source (demand-raw): ${source.text}` : '';
|
|
1233
|
+
return `[${handle}] ${item.title}${note}${outside}${excerpt}${request}`;
|
|
1049
1234
|
});
|
|
1235
|
+
const stageLines = draft.items.map((item, itemIndex) => stageCell(item.id, `${rowIndex + 1}.${itemIndex + 1}`));
|
|
1236
|
+
const statusLines = draft.items.map((item, itemIndex) => statusCell(item.id, `${rowIndex + 1}.${itemIndex + 1}`));
|
|
1050
1237
|
const nextAction = draft.fixedNextAction ??
|
|
1051
1238
|
(draft.items.length === 0
|
|
1052
1239
|
? NO_ACTION
|
|
1053
1240
|
: rowIndex < FOCUS_ROWS
|
|
1054
1241
|
? NEXT_ACTION_TO_INSTRUCT
|
|
1055
1242
|
: NEXT_ACTION_NOT_INSTRUCTED);
|
|
1243
|
+
const instruction = draft.fixedNextAction !== undefined
|
|
1244
|
+
? (draft.gatedOnDecision || draft.items.length === 0 || draft.fixedNextAction === NO_ACTION ? 'none-owed' : 'structure-dossier')
|
|
1245
|
+
: draft.items.length === 0 ? 'none-owed' : rowIndex < FOCUS_ROWS ? 'to-instruct' : 'not-instructed';
|
|
1056
1246
|
return {
|
|
1057
1247
|
wp: draft.wp,
|
|
1058
1248
|
progress: draft.progress,
|
|
1249
|
+
stage: stageLines.join('\n'),
|
|
1250
|
+
status: statusLines.join('\n'),
|
|
1059
1251
|
todo: cells.join('\n'),
|
|
1060
1252
|
blocked: draft.blocked,
|
|
1061
1253
|
nextAction,
|
|
1254
|
+
instruction,
|
|
1062
1255
|
directiveIds: draft.directiveIds,
|
|
1063
1256
|
gateDetail: draft.gateDetail,
|
|
1064
1257
|
gateStep: draft.gateStep,
|
|
1258
|
+
gateSteps: [...new Set(draft.directiveIds.split(',').flatMap(id => stepByDirectiveId.get(id) ?? []))].join(','),
|
|
1065
1259
|
focus: rowIndex < FOCUS_ROWS ? 'true' : 'false',
|
|
1066
1260
|
};
|
|
1067
1261
|
});
|
|
@@ -1070,7 +1264,7 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1070
1264
|
}
|
|
1071
1265
|
const todoRows = orderedTodo.length > 0
|
|
1072
1266
|
? orderedTodo
|
|
1073
|
-
: [{ wp: '—', progress: 'n/a', todo: 'aucun WP ouvert', blocked: NO_GATE, nextAction: NO_ACTION, directiveIds: '' }];
|
|
1267
|
+
: [{ wp: '—', progress: 'n/a', stage: '—', status: '—', todo: 'aucun WP ouvert', blocked: NO_GATE, nextAction: NO_ACTION, instruction: 'none-owed', directiveIds: '' }];
|
|
1074
1268
|
// ---- DÉCISIONS ----------------------------------------------------------------------------------
|
|
1075
1269
|
// Criterion 23 — pending, answerable dossiers ONLY. Nothing else.
|
|
1076
1270
|
const decisionRows = [];
|
|
@@ -1099,7 +1293,9 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1099
1293
|
let preco = precoLines.join('\n');
|
|
1100
1294
|
if (preco.trim() === '')
|
|
1101
1295
|
preco = '—';
|
|
1102
|
-
|
|
1296
|
+
// Amendment D12 — whether an answer is needed now is stated explicitly.
|
|
1297
|
+
const deferredMark = d.outcome === 'deferred' ? ' (reporté — réponse ajournée, pas abandonnée)' : '';
|
|
1298
|
+
decisionRows.push({ n: ref, subject: `${shortDecisionSubject(d.title)}${deferredMark}`, alternatives, preco });
|
|
1103
1299
|
}
|
|
1104
1300
|
if (decisionRows.length === 0) {
|
|
1105
1301
|
decisionRows.push({
|
|
@@ -1162,6 +1358,8 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1162
1358
|
label: shortDecisionSubject(d.title),
|
|
1163
1359
|
reason: 'décision déjà tranchée (visible dans bloqué ou FAIT, plus rien à y répondre)',
|
|
1164
1360
|
})),
|
|
1361
|
+
// Amendment D9 — withdrawals left out of the served tables stay declared, each with its reason.
|
|
1362
|
+
...(meta.withdrawnOmitted ?? []),
|
|
1165
1363
|
];
|
|
1166
1364
|
// ---- coverage (criteria 17/18) --------------------------------------------------------------------
|
|
1167
1365
|
// 17 — the report STATES both counts, so omission is a declared act rather than a silent one. Both
|
|
@@ -1171,12 +1369,17 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1171
1369
|
// structurally in the rendered lists above, whatever the compression ratio.
|
|
1172
1370
|
// An unscoped directive always TARGETS a dossier already counted in `decisions`, so counting it again
|
|
1173
1371
|
// would inflate the denominator against itself.
|
|
1174
|
-
|
|
1372
|
+
// Amendment D9/D11 — the explicit additions live INSIDE the legacy
|
|
1373
|
+
// equation (`rendered = projected − omitted` stays true: notice rows are
|
|
1374
|
+
// rendered, withdrawal omissions are omissions) and stay separately visible
|
|
1375
|
+
// in the line (`hors WP` count, per-reason omission detail).
|
|
1376
|
+
const projectedRows = wpNodes.length + outsideRollup.length + decisions.length + noticeDrafts.length + (meta.withdrawnOmitted ?? []).length;
|
|
1175
1377
|
const coverage = {
|
|
1176
1378
|
projected: projectedRows,
|
|
1177
1379
|
rendered: projectedRows - omitted.length,
|
|
1178
1380
|
omitted,
|
|
1179
1381
|
aggregated,
|
|
1382
|
+
...(outsideIds.size > 0 ? { outsideWp: outsideIds.size } : {}),
|
|
1180
1383
|
};
|
|
1181
1384
|
const header = {
|
|
1182
1385
|
scope: totalScope,
|
|
@@ -1198,9 +1401,7 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1198
1401
|
]),
|
|
1199
1402
|
],
|
|
1200
1403
|
coverage,
|
|
1201
|
-
handleCommand: meta
|
|
1202
|
-
? 'track report --resolve <handle>'
|
|
1203
|
-
: `track report --scope ${shellArgument(meta.scopeProjection.selector)} --resolve <handle>`,
|
|
1404
|
+
handleCommand: handleCommandFor(meta),
|
|
1204
1405
|
};
|
|
1205
1406
|
const tables = [
|
|
1206
1407
|
{
|
|
@@ -1219,6 +1420,8 @@ export function buildWpConductorView(tree, decisions = [], outsideRollup = [], t
|
|
|
1219
1420
|
columns: [
|
|
1220
1421
|
{ id: 'wp', label: 'WP' },
|
|
1221
1422
|
{ id: 'progress', label: 'av.' },
|
|
1423
|
+
{ id: 'stage', label: 'étape' },
|
|
1424
|
+
{ id: 'status', label: 'statut' },
|
|
1222
1425
|
{ id: 'todo', label: 'à faire' },
|
|
1223
1426
|
{ id: 'blocked', label: 'bloqué' },
|
|
1224
1427
|
{ id: 'nextAction', label: 'prochaine action' },
|
|
@@ -1277,7 +1480,9 @@ export function coverageLine(coverage) {
|
|
|
1277
1480
|
const merged = coverage.aggregated.length > 0
|
|
1278
1481
|
? ` · ${coverage.aggregated.length} sous-WP agrégés dans leur parent`
|
|
1279
1482
|
: '';
|
|
1280
|
-
|
|
1483
|
+
// Amendment D11 — strict-WP orphans are counted in the header coverage line.
|
|
1484
|
+
const outside = (coverage.outsideWp ?? 0) > 0 ? ` · ${coverage.outsideWp} hors WP (outside-wp)` : '';
|
|
1485
|
+
const head = `couverture : ${coverage.projected} lignes projetées · ${coverage.rendered} rendues${merged}${outside}`;
|
|
1281
1486
|
if (coverage.omitted.length === 0)
|
|
1282
1487
|
return `${head} · aucune omission`;
|
|
1283
1488
|
const byReason = new Map();
|