MCPcopy
hub / github.com/Doorman11991/smallcode / statusPayload

Function statusPayload

src/session/contract_tools.js:15–42  ·  view source on GitHub ↗
(store)

Source from the content-addressed store, hash-verified

13// always sees current state without a follow-up call.
14
15function statusPayload(store) {
16 const c = store.active();
17 if (!c) {
18 const all = store.list();
19 if (all.length === 0) {
20 return {
21 active: null,
22 contracts: [],
23 message: 'No contracts on disk. Use contract_create to declare a Definition of Done.',
24 };
25 }
26 return {
27 active: null,
28 contracts: all.map((row) => ({ id: row.id, title: row.title, status: row.status })),
29 message: 'No active contract. Use /contract activate <id> to set one.',
30 };
31 }
32 const ds = c.doneStatus();
33 return {
34 active: c.id,
35 title: c.title,
36 status: c.status,
37 summary: `${ds.passed}/${ds.total} passed (${ds.failed} failed, ${ds.pending} pending, ${ds.skipped} skipped)`,
38 done: ds.done,
39 assertions: c.assertions.map((a) => ({ id: a.id, text: a.text, state: a.state })),
40 blockers: ds.blockers,
41 };
42}
43
44function formatStatus(payload) {
45 if (!payload.active) {

Callers 2

executeContractToolFunction · 0.85
commands.jsFile · 0.85

Calls 3

doneStatusMethod · 0.80
activeMethod · 0.45
listMethod · 0.45

Tested by

no test coverage detected