@cspeach/cli 1.1.49 → 1.1.51

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 (64) hide show
  1. package/dist/agent/cold-prune.js +1 -1
  2. package/dist/agent/conversation-prompt.js +52 -0
  3. package/dist/agent/loop.js +189 -5
  4. package/dist/agent/oversized-results.js +204 -0
  5. package/dist/agent/turn-error-ux.js +14 -0
  6. package/dist/cli.js +1 -1
  7. package/dist/commands/compact.js +6 -0
  8. package/dist/commands/config-set.js +1 -1
  9. package/dist/commands/export-audit.js +26 -3
  10. package/dist/commands/export-conversation.js +343 -0
  11. package/dist/commands/help.js +3 -0
  12. package/dist/commands/plan-boundary.js +5 -0
  13. package/dist/commands/plan-continue-gate.js +11 -0
  14. package/dist/commands/plan-continue.js +11 -0
  15. package/dist/commands/plan-startup.js +5 -1
  16. package/dist/cost/cost-log.js +4 -0
  17. package/dist/cost/system-block.js +25 -0
  18. package/dist/docx/doc-meta.js +9 -1
  19. package/dist/docx/markdown-to-docx.js +14 -1
  20. package/dist/lane/app-chain.js +24 -1
  21. package/dist/models/server-config.js +13 -0
  22. package/dist/projects/document-save.js +65 -8
  23. package/dist/projects/document-skills.js +32 -1
  24. package/dist/projects/workspace.js +6 -3
  25. package/dist/repl/builtin-commands.js +1 -1
  26. package/dist/repl/slash-completer.js +4 -0
  27. package/dist/repl.js +50 -16
  28. package/dist/session/cli-record.js +165 -0
  29. package/dist/session/fresh-start.js +19 -0
  30. package/dist/tools/_filesystem-shared.js +7 -0
  31. package/dist/tools/cut-markers.js +47 -0
  32. package/dist/tools/filesystem/extract-document.js +50 -2
  33. package/dist/tools/filesystem/file-read.js +2 -2
  34. package/dist/tools/filesystem/read-document.js +20 -4
  35. package/dist/tools/tool-output-read.js +5 -1
  36. package/dist/tools/write-pipeline.js +5 -0
  37. package/dist/ui/card-slot.js +18 -1
  38. package/package.json +121 -121
  39. package/dist/commands/project.js +0 -301
  40. package/dist/doctor/checks/zcspeach.js +0 -96
  41. package/dist/projects/email-template.js +0 -56
  42. package/dist/projects/merge-cca.js +0 -292
  43. package/dist/tools/local-files.js +0 -31
  44. package/dist/tools/project/cca_merge.js +0 -164
  45. package/dist/tools/subagent/schedule_create.js +0 -131
  46. package/dist/ui/error-emitter.js +0 -21
  47. package/dist/ui/header.js +0 -41
  48. package/dist/ui/ink-classifier-route.js +0 -19
  49. package/dist/ui/rich-error-box.js +0 -9
  50. package/dist/ui/sidebar.js +0 -12
  51. package/dist/ui/status-emitter.js +0 -19
  52. package/dist/ui/status-line.js +0 -62
  53. package/dist/ui/status-row.js +0 -38
  54. package/dist/ui/todo-panel.js +0 -85
  55. package/dist/ui/widgets/ask-form.js +0 -250
  56. package/dist/ui/widgets/ask-question-modal.js +0 -178
  57. package/fiori/zlas-inspection-lr/package.json +0 -26
  58. package/fiori/zlas-inspection-lr/ui5-local.yaml +0 -45
  59. package/fiori/zlas-inspection-lr/ui5.yaml +0 -41
  60. package/fiori/zlas-inspection-lr/webapp/Component.js +0 -12
  61. package/fiori/zlas-inspection-lr/webapp/i18n/i18n.properties +0 -9
  62. package/fiori/zlas-inspection-lr/webapp/index.html +0 -35
  63. package/fiori/zlas-inspection-lr/webapp/manifest.json +0 -145
  64. package/live-check-2026-10-17-1343.txt +0 -41
@@ -1,301 +0,0 @@
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
- }
@@ -1,96 +0,0 @@
1
- import keychain from '../../auth/keychain.js';
2
- import { readFile } from 'node:fs/promises';
3
- import { loadConfig, resolveSapTls } from '../../config/loader.js';
4
- import { probeGet } from './_http-probe.js';
5
- import { sapChecksSkipped, standaloneSkip } from './_standalone-skip.js';
6
- const SAP_SERVICE = 'cspeach-sap';
7
- export async function checkZcspeach() {
8
- const cfg = await loadConfig();
9
- // Standalone mode ONLY — an opted-in paste-mode user has nothing to probe.
10
- // Everything below (including the no-alias failure) is unchanged.
11
- if (sapChecksSkipped(cfg))
12
- return standaloneSkip('zcspeach');
13
- const systems = Object.entries(cfg.sap);
14
- if (systems.length === 0) {
15
- return {
16
- name: 'zcspeach',
17
- ok: false,
18
- message: 'no SAP systems configured',
19
- hint: 'Run: cspeach config add-sap',
20
- };
21
- }
22
- const results = [];
23
- let anyFailed = false;
24
- for (const [alias, sys] of systems) {
25
- const protocol = sys.useSsl ? 'https' : 'http';
26
- const url = `${protocol}://${sys.host}:${sys.port}/sap/bc/zcspeach/discovery`;
27
- let pwd = null;
28
- try {
29
- pwd = await keychain.getPassword(SAP_SERVICE, alias);
30
- }
31
- catch {
32
- // keychain unavailable — fall through, will be skipped below
33
- }
34
- if (!pwd) {
35
- results.push(`${alias}: skipped (no password in keychain)`);
36
- continue;
37
- }
38
- // TLS posture (2026-06-14): verification ON by default; resolveSapTls maps
39
- // the per-alias config (ca_cert_path / insecure_skip_tls_verify, legacy
40
- // sslVerify:false fallback). See checks/_http-probe.ts.
41
- const tls = resolveSapTls(sys);
42
- let ca;
43
- if (tls.mode === 'ca-trusted' && tls.caCertPath) {
44
- try {
45
- ca = await readFile(tls.caCertPath);
46
- }
47
- catch (e) {
48
- results.push(`${alias}: CA unreadable at ${tls.caCertPath} (${e.message})`);
49
- anyFailed = true;
50
- continue;
51
- }
52
- }
53
- const r = await probeGet(url, {
54
- rejectUnauthorized: tls.mode !== 'insecure',
55
- ca,
56
- auth: `${sys.username}:${pwd}`,
57
- accept: 'application/json',
58
- timeoutMs: 5000,
59
- });
60
- if (r.error) {
61
- results.push(`${alias}: ${r.error}`);
62
- anyFailed = true;
63
- continue;
64
- }
65
- if (r.status < 200 || r.status >= 300) {
66
- results.push(`${alias}: HTTP ${r.status} from /zcspeach/discovery`);
67
- anyFailed = true;
68
- continue;
69
- }
70
- let body;
71
- try {
72
- body = JSON.parse(r.body);
73
- }
74
- catch {
75
- results.push(`${alias}: invalid JSON from /zcspeach/discovery`);
76
- anyFailed = true;
77
- continue;
78
- }
79
- if (body.status !== 'ok') {
80
- results.push(`${alias}: discovery returned status=${body.status ?? '<missing>'}`);
81
- anyFailed = true;
82
- continue;
83
- }
84
- const ver = body.data?.version ?? '<missing>';
85
- const ops = body.data?.operations?.length ?? 0;
86
- results.push(`${alias}: v${ver}, ${ops} ops`);
87
- }
88
- return {
89
- name: 'zcspeach',
90
- ok: !anyFailed,
91
- message: results.join('; '),
92
- hint: anyFailed
93
- ? 'SICF node /sap/bc/zcspeach must be active; ensure SAP_BASIS supports the framework'
94
- : undefined,
95
- };
96
- }
@@ -1,56 +0,0 @@
1
- const EDITOR_URL = process.env.CSPEACH_EDITOR_URL ?? 'https://cspeach.dev/edit';
2
- const SUBJECT_BY_TYPE = {
3
- 'spec-gap': (t) => `Gap analysis — ${t}`,
4
- 'design': (t) => `Design — ${t}`,
5
- 'estimate': (t) => `Estimate — ${t}`,
6
- 'cca': (t) => `Custom code analysis — ${t}`,
7
- 'incident': (t) => `Incident report — ${t}`,
8
- 'upgrade-scan': (t) => `S/4HANA upgrade scan — ${t}`,
9
- 'upgrade-progress': (t) => `Upgrade remediation progress — ${t}`,
10
- 'upgrade-report': (t) => `Upgrade remediation report — ${t}`,
11
- 'cca-assessment': (t) => `Custom code assessment — ${t}`,
12
- 'modernize-result': (t) => `Modernization result — ${t}`,
13
- 'test-coverage': (t) => `Test coverage report — ${t}`,
14
- 'plan': (t) => `Project plan — ${t}`,
15
- };
16
- const BODY_BY_TYPE = {
17
- 'spec-gap': (a) => `Attached is the gap analysis for the ${a.title}.\n${a.itemCount} ${a.itemNoun} across business / data / authorisation / edge cases.`,
18
- 'design': (a) => `Attached is the architecture design for the ${a.title}.\n${a.itemCount} ${a.itemNoun} to review (keep / redesign / defer).`,
19
- 'estimate': (a) => `Attached is the effort estimate for the ${a.title}.\n${a.itemCount} ${a.itemNoun} to review (confirm / dispute / defer).`,
20
- 'cca': (a) => `Attached is the custom code analysis for the ${a.title}.\n${a.itemCount} ${a.itemNoun} classified.`,
21
- 'incident': (a) => `Attached is the incident report for the ${a.title}.`,
22
- 'upgrade-scan': (a) => `Attached is the S/4HANA upgrade scan baseline for ${a.title}.\n${a.itemCount} ${a.itemNoun} to remediate.`,
23
- 'upgrade-progress': (a) => `Attached is the upgrade remediation progress for ${a.title}.\n${a.itemCount} ${a.itemNoun} attempted.`,
24
- 'upgrade-report': (a) => `Attached is the upgrade remediation report for ${a.title}.\n${a.itemCount} ${a.itemNoun} listed (regressions to address before sign-off).`,
25
- 'cca-assessment': (a) => `Attached is the custom code assessment for ${a.title}.\n${a.itemCount} ${a.itemNoun} classified — review keep / fix / retire / redesign per object.`,
26
- 'modernize-result': (a) => `Attached is the modernization result for ${a.title}.\n${a.itemCount} ${a.itemNoun} attempted — review applied / skipped / failed per object before sign-off.`,
27
- 'test-coverage': (a) => `Attached is the test coverage report for ${a.title}.\n${a.itemCount} test ${a.itemNoun} generated — review the targets + method counts before merging.`,
28
- 'plan': (a) => `Attached is the project plan for ${a.title}.\n${a.itemCount} ${a.itemNoun} ordered bottom-up — each phase runs in its own session via /abap-plan --resume.`,
29
- };
30
- export function renderEmailTemplate(a) {
31
- const subject = SUBJECT_BY_TYPE[a.artefactType](a.title);
32
- const body = BODY_BY_TYPE[a.artefactType](a);
33
- return [
34
- '─────────────────────────────────────────────────────────────────',
35
- 'Suggested email — copy from below the line, edit, send',
36
- '─────────────────────────────────────────────────────────────────',
37
- `Subject: ${subject}`,
38
- '',
39
- 'Hi,',
40
- '',
41
- body,
42
- '',
43
- 'To review:',
44
- ` 1. Open ${EDITOR_URL}`,
45
- ` 2. Drag the attached ${a.filename} onto the page`,
46
- ' 3. Click each item, mark its status, add comments',
47
- ' 4. Click "Download updated file"',
48
- ' 5. Email me the downloaded file',
49
- '',
50
- 'If your email blocks .json, rename it to .cspeach.json.txt before sending —',
51
- 'the editor accepts both.',
52
- '',
53
- 'Thanks,',
54
- a.author,
55
- ].join('\n');
56
- }