@cspeach/cli 1.1.47 → 1.1.49
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/dist/agent/level.js +1 -1
- package/dist/agent/loop.js +7 -6
- package/dist/agent/sap-connection-adapter.js +2 -0
- package/dist/agent/system-prompt.js +2 -2
- package/dist/agent/tool-dispatch.js +13 -1
- package/dist/approvals/op-labels.js +49 -10
- package/dist/approvals/render.js +14 -23
- package/dist/approvals/risk-floor.js +196 -19
- package/dist/approvals/visible-changes.js +35 -0
- package/dist/commands/config-set.js +5 -5
- package/dist/commands/cost.js +2 -1
- package/dist/commands/help.js +1 -1
- package/dist/commands/project.js +301 -0
- package/dist/commands/team-plan.js +16 -6
- package/dist/commands/team.js +295 -68
- package/dist/config/loader.js +13 -0
- package/dist/cost/cost-log.js +7 -4
- package/dist/cost/credits-wire.js +11 -6
- package/dist/cost/credits.js +15 -0
- package/dist/cost/display-mode.js +16 -4
- package/dist/doctor/checks/zcspeach.js +96 -0
- package/dist/journey/chain.js +489 -61
- package/dist/journey/clean-core.js +61 -36
- package/dist/journey/flow.js +75 -2
- package/dist/journey/people.js +37 -0
- package/dist/journey/rebuild.js +7 -6
- package/dist/journey/run.js +129 -42
- package/dist/journey/trigger.js +16 -10
- package/dist/one-shot.js +1 -1
- package/dist/project-context/render.js +7 -0
- package/dist/projects/clean-core-confirm.js +166 -44
- package/dist/projects/email-template.js +56 -0
- package/dist/projects/extract-cca.js +8 -7
- package/dist/projects/index.js +0 -1
- package/dist/projects/merge-cca.js +0 -19
- package/dist/projects/merge-upgrade.js +2 -2
- package/dist/projects/project-folder.js +2 -1
- package/dist/projects/save-command.js +51 -14
- package/dist/register/decision-rules.js +2 -1
- package/dist/register/export-files.js +18 -0
- package/dist/register/picture.js +3 -3
- package/dist/register/project-transport.js +125 -0
- package/dist/register/records.js +25 -13
- package/dist/register/rules-edit.js +5 -0
- package/dist/register/status-file/progress-chart.js +17 -6
- package/dist/register/status-file/register-map.js +8 -5
- package/dist/register/status-file/register-model.js +55 -36
- package/dist/register/status-file/register-parts.js +97 -82
- package/dist/register/status-file/register-status-file.js +16 -7
- package/dist/register/status-file/report-model.js +293 -205
- package/dist/register/status-file/team-css.js +1 -1
- package/dist/register/status-html.js +11 -4
- package/dist/register/store.js +2 -2
- package/dist/register/workbooks.js +24 -13
- package/dist/renderer/footer-line.js +10 -2
- package/dist/renderer/status-footer.js +2 -1
- package/dist/renderer/tool-labels.js +2 -2
- package/dist/repl/builtin-commands.js +1 -1
- package/dist/repl/continue-skill.js +5 -0
- package/dist/repl/level-command.js +6 -15
- package/dist/repl.js +21 -8
- package/dist/router/router-core.js +5 -3
- package/dist/session/audit-export.js +4 -1
- package/dist/skill-catalog.js +4 -7
- package/dist/tools/_team-work-path.js +53 -0
- package/dist/tools/approval.js +97 -19
- package/dist/tools/filesystem/file-edit.js +8 -1
- package/dist/tools/filesystem/file-write.js +8 -1
- package/dist/tools/local-files.js +31 -0
- package/dist/tools/project/_merge-shared.js +2 -2
- package/dist/tools/project/_team-tool-shared.js +5 -0
- package/dist/tools/project/cca_merge.js +1 -11
- package/dist/tools/project/rules_propose.js +2 -1
- package/dist/tools/project/team_findings.js +81 -28
- package/dist/tools/project/team_lane_move.js +127 -0
- package/dist/tools/project/upgrade_merge_progress.js +8 -4
- package/dist/tools/subagent/schedule_create.js +131 -0
- package/dist/tools/text-elements/tools.js +7 -1
- package/dist/tools/tool-loading.js +1 -1
- package/dist/tools/update-method-intercept.js +18 -1
- package/dist/tools/write-pipeline.js +19 -5
- package/dist/ui/approval-modal.js +6 -3
- package/dist/ui/error-emitter.js +21 -0
- package/dist/ui/footer-line.js +19 -1
- package/dist/ui/header.js +41 -0
- package/dist/ui/ink-classifier-route.js +19 -0
- package/dist/ui/rich-error-box.js +9 -0
- package/dist/ui/sidebar.js +12 -0
- package/dist/ui/status-emitter.js +19 -0
- package/dist/ui/status-line.js +62 -0
- package/dist/ui/status-row.js +38 -0
- package/dist/ui/todo-panel.js +85 -0
- package/dist/ui/widgets/ask-form.js +250 -0
- package/dist/ui/widgets/ask-question-modal.js +178 -0
- package/fiori/zlas-inspection-lr/package.json +26 -0
- package/fiori/zlas-inspection-lr/ui5-local.yaml +45 -0
- package/fiori/zlas-inspection-lr/ui5.yaml +41 -0
- package/fiori/zlas-inspection-lr/webapp/Component.js +12 -0
- package/fiori/zlas-inspection-lr/webapp/i18n/i18n.properties +9 -0
- package/fiori/zlas-inspection-lr/webapp/index.html +35 -0
- package/fiori/zlas-inspection-lr/webapp/manifest.json +145 -0
- package/live-check-2026-10-17-1343.txt +41 -0
- package/package.json +121 -121
- package/test-harness/fe-draft/app.ts +0 -188
- package/test-harness/fe-draft/fe-draft.e2e.test.ts +0 -461
- package/test-harness/fe-draft/manifest-enhancer.unit.test.ts +0 -51
- package/test-harness/fe-draft/routes.ts +0 -224
- package/test-harness/fe-draft/routes.unit.test.ts +0 -45
- package/test-harness/fe-draft/server.ts +0 -225
- package/test-harness/fe-draft/variants.ts +0 -196
package/dist/commands/help.js
CHANGED
|
@@ -63,7 +63,7 @@ export const HELP_GROUPS = [
|
|
|
63
63
|
{ name: '/ui [auto|ink]', description: fixed('Change the UI mode (applies after a relaunch)') },
|
|
64
64
|
{ name: '/ui look [panels|legacy]', description: fixed('Switch between the panels and legacy looks') },
|
|
65
65
|
{ name: '/style [professional|conversational|humor|blunt]', description: fixed('Change the talking style — words only; findings and warnings never change') },
|
|
66
|
-
{ name: '/level [developer|learning|functional]', description: fixed('
|
|
66
|
+
{ name: '/level [developer|learning|functional]', description: fixed('How CSPeach explains things — never what it finds or what it does') },
|
|
67
67
|
] },
|
|
68
68
|
];
|
|
69
69
|
/** Chat lane (spec 2026-10-17 D8): the Session group's /new reads "Fresh start"
|
|
@@ -0,0 +1,301 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `cspeach project …` — the Project Register from the terminal
|
|
3
|
+
* (spec: docs/superpowers/specs/2026-09-18-project-register-folder-mode.md §6).
|
|
4
|
+
*
|
|
5
|
+
* init <folder> lead: pull the baseline from SAP, write the project folder
|
|
6
|
+
* join <folder> everyone: start recording against a project
|
|
7
|
+
* lane … lead: who owns which packages
|
|
8
|
+
* status [folder] anyone: the register as text
|
|
9
|
+
* outbox what this laptop has recorded, and where
|
|
10
|
+
* rule … lead: settle a disagreement
|
|
11
|
+
* leave stop recording
|
|
12
|
+
*
|
|
13
|
+
* Every path written here is one a person typed. Nothing is written to a
|
|
14
|
+
* network location on CSPeach's own initiative, and none of this is reachable
|
|
15
|
+
* from a model tool.
|
|
16
|
+
*/
|
|
17
|
+
import fs from 'node:fs';
|
|
18
|
+
import path from 'node:path';
|
|
19
|
+
import { buildRegister, objectKey } from '@cspeach/register-core';
|
|
20
|
+
import { LOCAL_PACKAGE, listCustomPackages, pullBaseline, BaselineError } from '../register/baseline.js';
|
|
21
|
+
import { BASELINE_FILE, PROJECT_FILE, RegisterError, activeProject, collectRecords, defaultOutboxDir, loadState, projectIdFor, readBaseline, readLanes, readProjectFile, saveState, sha256, writeLanes, writerIdFor, } from '../register/store.js';
|
|
22
|
+
import { writeRecord } from '../register/records.js';
|
|
23
|
+
const CLASSIFICATIONS = ['keep', 'fix', 'retire', 'redesign'];
|
|
24
|
+
const TYPES = ['clean-core', 'upgrade', 'build'];
|
|
25
|
+
function flags(args) {
|
|
26
|
+
const positional = [];
|
|
27
|
+
const opts = {};
|
|
28
|
+
for (let i = 0; i < args.length; i++) {
|
|
29
|
+
const a = args[i];
|
|
30
|
+
if (a.startsWith('--')) {
|
|
31
|
+
opts[a.slice(2)] = args[i + 1] && !args[i + 1].startsWith('--') ? args[++i] : 'true';
|
|
32
|
+
}
|
|
33
|
+
else
|
|
34
|
+
positional.push(a);
|
|
35
|
+
}
|
|
36
|
+
return { positional, opts };
|
|
37
|
+
}
|
|
38
|
+
const list = (v) => (v ?? '').split(',').map((s) => s.trim()).filter(Boolean);
|
|
39
|
+
/** `ZFI_*` style match, used only to expand --packages patterns against the real package list. */
|
|
40
|
+
function matches(pattern, value) {
|
|
41
|
+
const re = new RegExp(`^${pattern.replace(/[.+?^${}()|[\]\\]/g, '\\$&').replace(/\*/g, '.*')}$`, 'i');
|
|
42
|
+
return re.test(value);
|
|
43
|
+
}
|
|
44
|
+
export async function runProjectCommand(args, deps) {
|
|
45
|
+
const [sub, ...rest] = args;
|
|
46
|
+
try {
|
|
47
|
+
switch (sub) {
|
|
48
|
+
case 'init': return await init(rest, deps);
|
|
49
|
+
case 'join': return join(rest, deps);
|
|
50
|
+
case 'lane': return lane(rest, deps);
|
|
51
|
+
case 'status': return status(rest, deps);
|
|
52
|
+
case 'outbox': return outbox(rest, deps);
|
|
53
|
+
case 'rule': return rule(rest, deps);
|
|
54
|
+
case 'leave': return leave(deps);
|
|
55
|
+
default:
|
|
56
|
+
deps.print('Usage: cspeach project init|join|lane|status|outbox|rule|leave (cspeach --help for details)');
|
|
57
|
+
return sub ? 1 : 0;
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (e) {
|
|
61
|
+
if (e instanceof RegisterError || e instanceof BaselineError) {
|
|
62
|
+
deps.print(`✗ ${e.message}`);
|
|
63
|
+
return 1;
|
|
64
|
+
}
|
|
65
|
+
throw e;
|
|
66
|
+
}
|
|
67
|
+
}
|
|
68
|
+
function requireLead(project, deps) {
|
|
69
|
+
const me = deps.identity().name;
|
|
70
|
+
if (me.trim().toLowerCase() !== project.lead.name.trim().toLowerCase()) {
|
|
71
|
+
throw new RegisterError(`Only the project lead (${project.lead.name}) changes this. You are ${me}.`);
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
function joinedOrThrow() {
|
|
75
|
+
const joined = activeProject();
|
|
76
|
+
if (!joined)
|
|
77
|
+
throw new RegisterError('This laptop has not joined a project. Run: cspeach project join <folder>');
|
|
78
|
+
return joined;
|
|
79
|
+
}
|
|
80
|
+
// ── init ────────────────────────────────────────────────────────────────────
|
|
81
|
+
async function init(args, deps) {
|
|
82
|
+
const { positional, opts } = flags(args);
|
|
83
|
+
const folder = positional[0];
|
|
84
|
+
if (!folder)
|
|
85
|
+
throw new RegisterError('Usage: cspeach project init <folder> --name "<name>" [--type clean-core|upgrade|build] [--packages ZFI_*,ZSD_*] [--include-local]');
|
|
86
|
+
const dir = path.resolve(folder);
|
|
87
|
+
if (fs.existsSync(path.join(dir, PROJECT_FILE)))
|
|
88
|
+
throw new RegisterError(`${dir} already holds a project. Pick an empty folder.`);
|
|
89
|
+
const name = opts.name ?? path.basename(dir);
|
|
90
|
+
const type = (opts.type ?? 'clean-core');
|
|
91
|
+
if (!TYPES.includes(type))
|
|
92
|
+
throw new RegisterError(`--type must be one of: ${TYPES.join(', ')}`);
|
|
93
|
+
if (!deps.connect)
|
|
94
|
+
throw new RegisterError('init needs a SAP connection to pull the object list.');
|
|
95
|
+
const { sql, system } = await deps.connect(opts['sap-alias']);
|
|
96
|
+
deps.print('Reading the package list from SAP…');
|
|
97
|
+
const all = await listCustomPackages(sql);
|
|
98
|
+
const patterns = list(opts.packages);
|
|
99
|
+
let chosen = all.filter((p) => patterns.some((pat) => matches(pat, p.package)));
|
|
100
|
+
if (!patterns.length && deps.choosePackages) {
|
|
101
|
+
const picked = new Set(await deps.choosePackages(all));
|
|
102
|
+
chosen = all.filter((p) => picked.has(p.package));
|
|
103
|
+
}
|
|
104
|
+
const local = all.find((p) => p.package === LOCAL_PACKAGE)?.objects ?? 0;
|
|
105
|
+
if (!opts['include-local'])
|
|
106
|
+
chosen = chosen.filter((p) => p.package !== LOCAL_PACKAGE);
|
|
107
|
+
if (!chosen.length) {
|
|
108
|
+
throw new RegisterError(`No package chosen. ${all.length} customer packages exist; name them with --packages, e.g. --packages "ZFI_*,ZSD_*".`);
|
|
109
|
+
}
|
|
110
|
+
deps.print(`Pulling ${chosen.length} package${chosen.length === 1 ? '' : 's'}, checking each against the system's own count…`);
|
|
111
|
+
const pull = await pullBaseline(sql, { packages: chosen });
|
|
112
|
+
if (!pull.objects.length)
|
|
113
|
+
throw new RegisterError('Those packages hold no code objects. Nothing was written.');
|
|
114
|
+
const now = (deps.now ?? (() => new Date()))();
|
|
115
|
+
const projectId = projectIdFor(name);
|
|
116
|
+
const baselineText = `${JSON.stringify({ kind: 'baseline', formatVersion: 1, projectId, objects: pull.objects }, null, 1)}\n`;
|
|
117
|
+
const project = {
|
|
118
|
+
kind: 'project', formatVersion: 1, projectId, name, type, lead: { name: deps.identity().name },
|
|
119
|
+
...(system ? { system } : {}),
|
|
120
|
+
...(opts['atc-variant'] ? { atcVariant: opts['atc-variant'] } : {}),
|
|
121
|
+
baseline: { file: BASELINE_FILE.replace(/\\/g, '/'), sha256: sha256(baselineText), takenAt: now.toISOString(), objectCount: pull.objects.length },
|
|
122
|
+
setAside: { local: opts['include-local'] ? 0 : local, generated: pull.setAside.generated, otherTypes: pull.setAside.otherTypes },
|
|
123
|
+
createdAt: now.toISOString(),
|
|
124
|
+
};
|
|
125
|
+
fs.mkdirSync(path.join(dir, 'baseline'), { recursive: true });
|
|
126
|
+
fs.writeFileSync(path.join(dir, BASELINE_FILE), baselineText);
|
|
127
|
+
fs.writeFileSync(path.join(dir, PROJECT_FILE), `${JSON.stringify(project, null, 2)}\n`);
|
|
128
|
+
writeLanes(dir, projectId, []);
|
|
129
|
+
deps.print(`✓ ${name}: ${pull.objects.length} objects in ${chosen.length} packages. Every package matched the system's count.`);
|
|
130
|
+
deps.print(` Set aside, not in scope: ${project.setAside.local} local ($TMP), ${pull.setAside.generated} generated, ${pull.setAside.otherTypes} non-code entries.`);
|
|
131
|
+
deps.print(` Written to ${dir}`);
|
|
132
|
+
deps.print(' Next: cspeach project lane add <id> --owner "<name>" --packages "ZFI_*" then each person: cspeach project join <folder>');
|
|
133
|
+
return join([dir], deps);
|
|
134
|
+
}
|
|
135
|
+
// ── join / leave ────────────────────────────────────────────────────────────
|
|
136
|
+
function join(args, deps) {
|
|
137
|
+
const { positional, opts } = flags(args);
|
|
138
|
+
if (!positional[0])
|
|
139
|
+
throw new RegisterError('Usage: cspeach project join <project folder> [--outbox <folder>]');
|
|
140
|
+
const projectDir = path.resolve(positional[0]);
|
|
141
|
+
const project = readProjectFile(projectDir);
|
|
142
|
+
const objects = readBaseline(projectDir).length; // also verifies the checksum
|
|
143
|
+
const state = loadState();
|
|
144
|
+
const outboxDir = path.resolve(opts.outbox ?? state.projects[project.projectId]?.outboxDir ?? defaultOutboxDir(project.projectId));
|
|
145
|
+
const writerId = writerIdFor(deps.identity().name);
|
|
146
|
+
fs.mkdirSync(path.join(outboxDir, 'writers', writerId, 'records'), { recursive: true });
|
|
147
|
+
state.projects[project.projectId] = { projectDir, outboxDir, writerId };
|
|
148
|
+
state.active = project.projectId;
|
|
149
|
+
saveState(state);
|
|
150
|
+
deps.print(`✓ Joined "${project.name}" (${objects} objects, lead ${project.lead.name}) as ${writerId}.`);
|
|
151
|
+
deps.print(` Your results are recorded on this laptop, in ${outboxDir}`);
|
|
152
|
+
deps.print(' CSPeach does not send them anywhere. Hand them in by copying that folder\'s "writers" folder into the project folder,');
|
|
153
|
+
deps.print(' or keep the outbox inside your own synced folder: cspeach project join <folder> --outbox <folder>');
|
|
154
|
+
return 0;
|
|
155
|
+
}
|
|
156
|
+
function leave(deps) {
|
|
157
|
+
const state = loadState();
|
|
158
|
+
if (!state.active) {
|
|
159
|
+
deps.print('This laptop is not recording against a project.');
|
|
160
|
+
return 0;
|
|
161
|
+
}
|
|
162
|
+
const was = state.active;
|
|
163
|
+
state.active = null;
|
|
164
|
+
saveState(state);
|
|
165
|
+
deps.print(`✓ Stopped recording against ${was}. Files already written stay where they are.`);
|
|
166
|
+
return 0;
|
|
167
|
+
}
|
|
168
|
+
// ── lane ────────────────────────────────────────────────────────────────────
|
|
169
|
+
function lane(args, deps) {
|
|
170
|
+
const [verb, ...rest] = args;
|
|
171
|
+
const { positional, opts } = flags(rest);
|
|
172
|
+
const joined = joinedOrThrow();
|
|
173
|
+
const project = readProjectFile(joined.projectDir);
|
|
174
|
+
const lanes = readLanes(joined.projectDir);
|
|
175
|
+
if (verb === 'list' || !verb) {
|
|
176
|
+
if (!lanes.length)
|
|
177
|
+
deps.print('No lanes yet. cspeach project lane add <id> --owner "<name>" --packages "ZFI_*"');
|
|
178
|
+
for (const l of lanes)
|
|
179
|
+
deps.print(`${l.id.padEnd(12)} ${l.owner.padEnd(20)} ${[...l.packages, ...l.namePatterns.map((n) => `name:${n}`)].join(', ')}`);
|
|
180
|
+
return 0;
|
|
181
|
+
}
|
|
182
|
+
requireLead(project, deps);
|
|
183
|
+
const id = positional[0];
|
|
184
|
+
if (!id)
|
|
185
|
+
throw new RegisterError('Usage: cspeach project lane add <id> --owner "<name>" --packages "ZFI_*" [--names "ZCL_TAX_*"] | lane remove <id>');
|
|
186
|
+
if (verb === 'remove') {
|
|
187
|
+
writeLanes(joined.projectDir, project.projectId, lanes.filter((l) => l.id !== id));
|
|
188
|
+
deps.print(`✓ Lane ${id} removed.`);
|
|
189
|
+
return 0;
|
|
190
|
+
}
|
|
191
|
+
if (verb !== 'add')
|
|
192
|
+
throw new RegisterError('lane: use add, remove or list.');
|
|
193
|
+
const next = { id, owner: opts.owner ?? '', packages: list(opts.packages), namePatterns: list(opts.names) };
|
|
194
|
+
if (!next.owner || (!next.packages.length && !next.namePatterns.length)) {
|
|
195
|
+
throw new RegisterError('A lane needs --owner and at least one of --packages or --names.');
|
|
196
|
+
}
|
|
197
|
+
writeLanes(joined.projectDir, project.projectId, [...lanes.filter((l) => l.id !== id), next]);
|
|
198
|
+
const reg = registerFor(joined.projectDir, joined.outboxDir);
|
|
199
|
+
const mine = reg.register.lanes.find((l) => l.id === id);
|
|
200
|
+
deps.print(`✓ Lane ${id}: ${next.owner}, ${mine.objects} objects.`);
|
|
201
|
+
if (reg.register.totals.overlapping)
|
|
202
|
+
deps.print(` ! ${reg.register.totals.overlapping} objects now sit in more than one lane.`);
|
|
203
|
+
if (reg.register.totals.unowned)
|
|
204
|
+
deps.print(` ${reg.register.totals.unowned} objects still have no owner.`);
|
|
205
|
+
return 0;
|
|
206
|
+
}
|
|
207
|
+
// ── status ──────────────────────────────────────────────────────────────────
|
|
208
|
+
function registerFor(projectDir, outboxDir) {
|
|
209
|
+
const project = readProjectFile(projectDir);
|
|
210
|
+
const collected = collectRecords(projectDir);
|
|
211
|
+
// This laptop's own outbox counts too, so a developer sees their work before handing it in.
|
|
212
|
+
const own = outboxDir && path.resolve(outboxDir) !== path.resolve(projectDir) ? collectRecords(outboxDir) : { records: [], unreadable: 0, files: 0 };
|
|
213
|
+
const register = buildRegister({
|
|
214
|
+
project, baseline: readBaseline(projectDir), lanes: readLanes(projectDir),
|
|
215
|
+
records: [...collected.records, ...own.records],
|
|
216
|
+
});
|
|
217
|
+
return { register, files: collected.files + own.files, unreadable: collected.unreadable + own.unreadable };
|
|
218
|
+
}
|
|
219
|
+
const STATE_WORDS = [
|
|
220
|
+
['verified', 'verified'], ['clean', 'clean'], ['claimed', 'claimed, not measured since'], ['working', 'in work'],
|
|
221
|
+
['decided', 'decided, not started'], ['untouched', 'untouched'], ['did-not-hold', 'fix did not hold'],
|
|
222
|
+
['regressed', 'regressed'], ['retired', 'retired'],
|
|
223
|
+
];
|
|
224
|
+
function status(args, deps) {
|
|
225
|
+
const { positional } = flags(args);
|
|
226
|
+
const joined = activeProject();
|
|
227
|
+
const projectDir = positional[0] ? path.resolve(positional[0]) : joined?.projectDir;
|
|
228
|
+
if (!projectDir)
|
|
229
|
+
throw new RegisterError('Usage: cspeach project status [<project folder>]');
|
|
230
|
+
const project = readProjectFile(projectDir);
|
|
231
|
+
const { register: r, files, unreadable } = registerFor(projectDir, positional[0] ? undefined : joined?.outboxDir);
|
|
232
|
+
const t = r.totals;
|
|
233
|
+
deps.print(`${project.name} (${project.type}, lead ${project.lead.name})`);
|
|
234
|
+
deps.print(`${t.objects} objects, ${t.active} active. ${t.decided} decided. ${t.byState.verified} verified, ${t.byState.clean} clean.`);
|
|
235
|
+
deps.print(r.lastMeasuredAt ? `Last measured ${r.lastMeasuredAt.slice(0, 16).replace('T', ' ')} UTC.` : 'Not measured yet: "verified" and "clean" need an ATC run.');
|
|
236
|
+
deps.print('');
|
|
237
|
+
for (const [state, word] of STATE_WORDS)
|
|
238
|
+
if (t.byState[state])
|
|
239
|
+
deps.print(` ${String(t.byState[state]).padStart(6)} ${word}`);
|
|
240
|
+
deps.print('');
|
|
241
|
+
if (r.lanes.length) {
|
|
242
|
+
deps.print('Lane Owner Objects Done Last record');
|
|
243
|
+
for (const l of r.lanes) {
|
|
244
|
+
const done = l.byState.verified + l.byState.clean + l.byState.retired;
|
|
245
|
+
deps.print(`${l.id.padEnd(12)} ${l.owner.padEnd(20)} ${String(l.objects).padStart(7)} ${String(done).padStart(5)} ${l.lastRecordAt ? l.lastRecordAt.slice(0, 10) : 'nothing yet'}`);
|
|
246
|
+
}
|
|
247
|
+
deps.print('');
|
|
248
|
+
}
|
|
249
|
+
if (t.unowned)
|
|
250
|
+
deps.print(`! ${t.unowned} objects have no owner.`);
|
|
251
|
+
if (t.overlapping)
|
|
252
|
+
deps.print(`! ${t.overlapping} objects sit in more than one lane.`);
|
|
253
|
+
if (t.conflicts) {
|
|
254
|
+
deps.print(`! ${t.conflicts} objects have conflicting decisions. The lead settles each with: cspeach project rule <TYPE> <NAME> <decision>`);
|
|
255
|
+
for (const o of r.objects.filter((x) => x.decision?.conflict).slice(0, 10)) {
|
|
256
|
+
deps.print(` ${o.key}: ${Object.entries(o.decision.conflict).map(([w, c]) => `${w} says ${c}`).join(', ')}`);
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
const s = r.skipped;
|
|
260
|
+
if (unreadable)
|
|
261
|
+
deps.print(` ${unreadable} of ${files} files could not be read yet (still syncing, or damaged).`);
|
|
262
|
+
if (s.rowsNotInBaseline)
|
|
263
|
+
deps.print(` ${s.rowsNotInBaseline} rows named objects that are not in this project: ${r.unknownKeys.slice(0, 5).join(', ')}`);
|
|
264
|
+
if (s.otherProject)
|
|
265
|
+
deps.print(` ${s.otherProject} files belong to another project and were ignored.`);
|
|
266
|
+
if (s.rulingsNotFromLead)
|
|
267
|
+
deps.print(` ${s.rulingsNotFromLead} rulings were not from the lead and were ignored.`);
|
|
268
|
+
return 0;
|
|
269
|
+
}
|
|
270
|
+
// ── outbox / rule ───────────────────────────────────────────────────────────
|
|
271
|
+
function outbox(_args, deps) {
|
|
272
|
+
const joined = joinedOrThrow();
|
|
273
|
+
const dir = path.join(joined.outboxDir, 'writers', joined.writerId, 'records');
|
|
274
|
+
const files = fs.existsSync(dir) ? fs.readdirSync(dir).filter((f) => f.endsWith('.json')).sort() : [];
|
|
275
|
+
deps.print(`Records this laptop has written for ${joined.projectId}: ${files.length}`);
|
|
276
|
+
deps.print(` ${dir}`);
|
|
277
|
+
for (const f of files.slice(-15)) {
|
|
278
|
+
let rows = '?';
|
|
279
|
+
try {
|
|
280
|
+
rows = String(JSON.parse(fs.readFileSync(path.join(dir, f), 'utf8')).rows.length);
|
|
281
|
+
}
|
|
282
|
+
catch { /* listed anyway */ }
|
|
283
|
+
deps.print(` ${f} (${rows} rows)`);
|
|
284
|
+
}
|
|
285
|
+
deps.print('Each file is plain JSON: object names, decisions, statuses. No source code. Open one in Notepad to check.');
|
|
286
|
+
return 0;
|
|
287
|
+
}
|
|
288
|
+
function rule(args, deps) {
|
|
289
|
+
const { positional, opts } = flags(args);
|
|
290
|
+
const [type, name, classification] = positional;
|
|
291
|
+
if (!type || !name || !CLASSIFICATIONS.includes(classification)) {
|
|
292
|
+
throw new RegisterError(`Usage: cspeach project rule <TYPE> <NAME> ${CLASSIFICATIONS.join('|')} [--reason "<why>"]`);
|
|
293
|
+
}
|
|
294
|
+
const joined = joinedOrThrow();
|
|
295
|
+
requireLead(readProjectFile(joined.projectDir), deps);
|
|
296
|
+
const res = writeRecord(joined, 'ruling', [{ key: objectKey(type, name), classification, ...(opts.reason ? { reason: opts.reason } : {}) }], deps.identity(), { dir: path.join(joined.projectDir, 'rulings'), now: deps.now?.() });
|
|
297
|
+
if (!res.file)
|
|
298
|
+
throw new RegisterError(`${objectKey(type, name)} is not in this project's baseline.`);
|
|
299
|
+
deps.print(`✓ Ruled ${objectKey(type, name)} = ${classification}.`);
|
|
300
|
+
return 0;
|
|
301
|
+
}
|
|
@@ -11,16 +11,19 @@
|
|
|
11
11
|
* Every change is one append-only record in the lead's `plan/` folder, written
|
|
12
12
|
* whole then renamed. Lanes stay patterns in `lanes.json`; everything per object
|
|
13
13
|
* is a plan record, and the register folds them on read. Nothing here edits a
|
|
14
|
-
* record or reaches SAP, and none of it is reachable from a model tool
|
|
14
|
+
* record or reaches SAP, and none of it is reachable from a model tool (the
|
|
15
|
+
* lane-move record is written by moveLanes in team.ts, behind the person's card
|
|
16
|
+
* when team_lane_move runs it).
|
|
15
17
|
*/
|
|
16
18
|
import fs from 'node:fs';
|
|
17
19
|
import path from 'node:path';
|
|
18
20
|
import { createHash } from 'node:crypto';
|
|
19
|
-
import { buildRegister, DEFAULT_WEIGHTS,
|
|
21
|
+
import { buildRegister, DEFAULT_WEIGHTS, objectKey, proposeLanes, utcWords, } from '@cspeach/register-core';
|
|
20
22
|
import { RegisterError, collectRecords, readBaseline, readLanes, readProjectFile, writeLanes, } from '../register/store.js';
|
|
21
23
|
import { diffPlan, readPlanSheet } from '../register/plan-import.js';
|
|
22
24
|
import { writeLeadRecord } from '../register/records.js';
|
|
23
25
|
import { registerFor } from '../register/picture.js';
|
|
26
|
+
import { projectViewFor } from '../register/status-html.js';
|
|
24
27
|
import { shown, shownUpTo } from '../register/atc-file.js';
|
|
25
28
|
import { flags, heldReportLine, joinedOrThrow, list, requireLead, whoAmI, writeReports } from './team.js';
|
|
26
29
|
const MAX_REASON = 300;
|
|
@@ -157,11 +160,16 @@ export async function laneProposal(args, deps) {
|
|
|
157
160
|
deps.print(` Written to the plan folder: ${files.join(', ')}`);
|
|
158
161
|
return 0;
|
|
159
162
|
}
|
|
160
|
-
/**
|
|
161
|
-
|
|
163
|
+
/**
|
|
164
|
+
* `lane add|remove|move`: the history beside the lanes file. Returns the line
|
|
165
|
+
* to print. A move also names the packages that moved (`moved`) and the
|
|
166
|
+
* lanes they left (`from`).
|
|
167
|
+
*/
|
|
168
|
+
export function laneChangeRecord(deps, change, before, after, id, reason, moved, from) {
|
|
162
169
|
const lead = asLead(deps);
|
|
163
170
|
const side = (l) => (l ? { owner: l.owner, packages: l.packages, namePatterns: l.namePatterns } : null);
|
|
164
|
-
const
|
|
171
|
+
const lane = { id, change, ...(moved ? { moved: [...moved] } : {}), ...(from ? { from: from.map((f) => ({ id: f.id, owner: f.owner })) } : {}), before: side(before), after: side(after) };
|
|
172
|
+
const file = writePlan(lead, { action: 'lane', lane, ...(reason ? { reason } : {}) }, [], deps);
|
|
165
173
|
return writtenLine(file);
|
|
166
174
|
}
|
|
167
175
|
// ── focus ───────────────────────────────────────────────────────────────────
|
|
@@ -225,7 +233,9 @@ export function focusCommand(args, deps) {
|
|
|
225
233
|
}
|
|
226
234
|
else {
|
|
227
235
|
const lane = laneOrThrow(readLanes(lead.projectDir), opts.lane);
|
|
228
|
-
|
|
236
|
+
// Owner decision (final review): the lane's OWN objects, the ones its counts cover (the view's lane scope).
|
|
237
|
+
const view = projectViewFor(register, readProjectFile(lead.projectDir));
|
|
238
|
+
keys = (view.lanes.find((l) => l.scope.kind === 'lane' && l.scope.id === lane.id)?.objects ?? []).map((v) => v.key);
|
|
229
239
|
selector = { lane: lane.id };
|
|
230
240
|
}
|
|
231
241
|
if (!keys.length)
|