teamsmith 0.4.3 → 0.4.6
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 +4 -4
- package/package.json +1 -1
- package/skills/teamsmith/CHANGELOG.md +33 -1
- package/skills/teamsmith/SKILL.md +1 -1
- package/skills/teamsmith/extension/team-bg.ts +7 -8
- package/skills/teamsmith/extension/team-inbox-watch.ts +136 -3
- package/skills/teamsmith/references/protocol.md +2 -3
- package/skills/teamsmith/references/reminders.md +55 -12
- package/skills/teamsmith/references/workflows.md +1 -3
- package/skills/teamsmith/scripts/lib/cmd-agents.sh +18 -1
- package/skills/teamsmith/scripts/lib/cmd-project.sh +12 -9
- package/skills/teamsmith/scripts/lib/cmd-remind.sh +49 -10
- package/skills/teamsmith/scripts/lib/cmd-update.sh +90 -88
- package/skills/teamsmith/scripts/lib/cmd-watch.sh +281 -155
- package/skills/teamsmith/scripts/lib/common.sh +74 -14
- package/skills/teamsmith/scripts/panel/panel.js +134 -134
- package/skills/teamsmith/scripts/panel/src/data.ts +51 -0
- package/skills/teamsmith/scripts/panel/src/layout.ts +10 -0
- package/skills/teamsmith/scripts/panel/src/main.tsx +27 -0
- package/skills/teamsmith/scripts/remind-store.mjs +362 -6
- package/skills/teamsmith/scripts/remind-tick.mjs +102 -0
- package/skills/teamsmith/scripts/reminder-delivery.mjs +76 -0
- package/skills/teamsmith/scripts/reply-capture.mjs +53 -8
- package/skills/teamsmith/scripts/state-authority.mjs +265 -17
- package/skills/teamsmith/scripts/strings/commands.tsv +3 -3
- package/skills/teamsmith/scripts/strings/help.en.tsv +12 -12
- package/skills/teamsmith/scripts/strings/help.zh.tsv +12 -12
- package/skills/teamsmith/scripts/team +3 -3
- package/skills/teamsmith/templates/AGENTS.section.md.tmpl +2 -3
- package/skills/teamsmith/templates/pm-prompt.md.tmpl +11 -5
- package/skills/teamsmith/tests/death-cause.sh +5 -0
- package/skills/teamsmith/tests/help-surface.sh +15 -150
- package/skills/teamsmith/tests/isolation-ledger.sh +85 -0
- package/skills/teamsmith/tests/lib/main-team-fingerprint.sh +17 -1
- package/skills/teamsmith/tests/live-capture-probe.sh +63 -0
- package/skills/teamsmith/tests/pulse-nudge-key.sh +5 -0
- package/skills/teamsmith/tests/remind-delivery-node.mjs +176 -0
- package/skills/teamsmith/tests/remind-delivery.sh +611 -0
- package/skills/teamsmith/tests/section-paths.tsv +6 -6
- package/skills/teamsmith/tests/smoke.sh +397 -107
- package/skills/teamsmith/tests/state-authority.sh +246 -26
- package/skills/teamsmith/tests/team-inbox-watch-harness.mjs +58 -8
- package/skills/teamsmith/tests/tmux-identity-leak.sh +12 -16
- package/skills/teamsmith-init/SKILL.md +1 -1
|
@@ -16,15 +16,21 @@
|
|
|
16
16
|
//
|
|
17
17
|
// A missing flock, a lock timeout, a corrupt/unsupported snapshot, a torn file or an identity mismatch
|
|
18
18
|
// is a visible error. There is no unlocked fallback and an unreadable snapshot is never replaced by an
|
|
19
|
-
// empty store.
|
|
20
|
-
//
|
|
19
|
+
// empty store. Task 1.3 moved every Standby reader/writer here: the snapshot's `standby` slot is the only
|
|
20
|
+
// truth, and the legacy `<state>/standby` marker is read once by the migration (see importLegacy) and then
|
|
21
|
+
// retired to `<state>/standby.migrated` -- the snapshot is published before the marker is retired, so a
|
|
22
|
+
// crash in between replays only the retirement (`migrated` makes the import exactly-once).
|
|
23
|
+
//
|
|
24
|
+
// Reads are pure: they never publish a snapshot and never take part in the migration (the panel and the
|
|
25
|
+
// monitor are display paths and must not write). Until the first write, a read answers from the legacy
|
|
26
|
+
// marker exactly as the old readers did, so an upgrading team is never mistaken for "not on standby".
|
|
21
27
|
|
|
22
28
|
import * as fs from 'node:fs';
|
|
23
29
|
import path from 'node:path';
|
|
24
30
|
import { randomUUID } from 'node:crypto';
|
|
25
31
|
import { spawn, spawnSync } from 'node:child_process';
|
|
26
32
|
import { fileURLToPath } from 'node:url';
|
|
27
|
-
import { REMIND_OPS, applyReminder, renderRemind, validateReminders } from './remind-store.mjs';
|
|
33
|
+
import { REMIND_OPS, applyReminder, peekReminders, renderRemind, validateReminders } from './remind-store.mjs';
|
|
28
34
|
|
|
29
35
|
const SELF = fileURLToPath(import.meta.url);
|
|
30
36
|
const SNAPSHOT_VERSION = 1;
|
|
@@ -34,6 +40,10 @@ const LOCK_WAIT_SECONDS = 5;
|
|
|
34
40
|
const LOCK_CONFLICT_EXIT = 75;
|
|
35
41
|
const UUID_RE = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/;
|
|
36
42
|
const SEQUENCE_KINDS = new Set(['reminder', 'batch', 'queue']);
|
|
43
|
+
// Standby operations. A read is answered from the snapshot and never publishes one; the other three are
|
|
44
|
+
// mutations and run the legacy import first, in the same locked transaction.
|
|
45
|
+
const STANDBY_OPS = new Set(['standby-read', 'standby-on', 'standby-off', 'standby-import']);
|
|
46
|
+
const STANDBY_READ_OPS = new Set(['read', 'standby-read']);
|
|
37
47
|
|
|
38
48
|
const fail = message => { throw new Error(message); };
|
|
39
49
|
|
|
@@ -201,15 +211,94 @@ function initial(locator) {
|
|
|
201
211
|
project: { id: locator.projectId, mainRoot: locator.mainRoot, stateRoot: locator.stateRoot },
|
|
202
212
|
sequences: { reminder: 1, batch: 1, queue: 1 },
|
|
203
213
|
pruned: 0,
|
|
204
|
-
//
|
|
205
|
-
//
|
|
206
|
-
standby: { on: false, generation: 0, reason: null, since: null },
|
|
214
|
+
// `migrated` records that the legacy marker has been imported (or proven absent): an old snapshot
|
|
215
|
+
// without the key is unmigrated, and the next mutation imports the marker before it does anything.
|
|
216
|
+
standby: { on: false, generation: 0, reason: null, since: null, migrated: false },
|
|
217
|
+
pulse: null,
|
|
207
218
|
reminders: [],
|
|
208
219
|
batches: [],
|
|
209
220
|
audit: [],
|
|
210
221
|
};
|
|
211
222
|
}
|
|
212
223
|
|
|
224
|
+
// ---------------------------------------------------------------- 待命(PM 主动停工)
|
|
225
|
+
// The legacy marker is one line: `<timestamp> <reason>` (the old writer printed `-` when it had no reason).
|
|
226
|
+
// It is only consulted while the snapshot says `migrated: false`, i.e. before the import has run.
|
|
227
|
+
const legacyMarkerFile = state => path.join(state, 'standby');
|
|
228
|
+
|
|
229
|
+
function legacyMarker(state) {
|
|
230
|
+
const file = legacyMarkerFile(state);
|
|
231
|
+
let stat;
|
|
232
|
+
try { stat = fs.lstatSync(file); } catch (e) { if (e.code === 'ENOENT') return null; throw e; }
|
|
233
|
+
// A symlink or a directory here is not the old format: refuse it instead of importing a guess.
|
|
234
|
+
if (!stat.isFile()) fail(`legacy Standby marker is not a regular file: ${file}; move it aside and retry`);
|
|
235
|
+
const line = fs.readFileSync(file, 'utf8').split('\n', 1)[0];
|
|
236
|
+
const cut = line.indexOf(' ');
|
|
237
|
+
const since = cut === -1 ? line : line.slice(0, cut);
|
|
238
|
+
if (!since) fail(`legacy Standby marker is empty: ${file}; delete it if the team was not on standby`);
|
|
239
|
+
const reason = cut === -1 ? '-' : line.slice(cut + 1);
|
|
240
|
+
return { reason: reason === '' ? '-' : reason, since };
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
// Import once, inside the caller's transaction: the reason and the start time survive, and the generation
|
|
244
|
+
// is kept as it is -- the import is not a new on generation (a later `standby on` is). A marker that is
|
|
245
|
+
// still there after a completed import is leftover evidence, not truth: it is only retired, never adopted.
|
|
246
|
+
function importLegacy(snapshot, state) {
|
|
247
|
+
const marker = legacyMarker(state);
|
|
248
|
+
let imported = false;
|
|
249
|
+
if (!snapshot.standby.migrated) {
|
|
250
|
+
snapshot.standby = {
|
|
251
|
+
on: marker ? true : snapshot.standby.on,
|
|
252
|
+
generation: snapshot.standby.generation,
|
|
253
|
+
reason: marker ? marker.reason : snapshot.standby.reason,
|
|
254
|
+
since: marker ? marker.since : snapshot.standby.since,
|
|
255
|
+
migrated: true,
|
|
256
|
+
};
|
|
257
|
+
imported = Boolean(marker);
|
|
258
|
+
}
|
|
259
|
+
return { imported, marker: Boolean(marker) };
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
// The snapshot is already durable when this runs, so a failure here cannot lose the state: the marker is
|
|
263
|
+
// inert from now on. Say so instead of reporting the whole write as failed (the caller would retry, and a
|
|
264
|
+
// retried `standby on` is a new generation).
|
|
265
|
+
function retireLegacy(state) {
|
|
266
|
+
const file = legacyMarkerFile(state);
|
|
267
|
+
if (!regular_exists(file)) return null;
|
|
268
|
+
let target = path.join(state, 'standby.migrated');
|
|
269
|
+
for (let n = 1; exists(target); n++) target = path.join(state, `standby.migrated.${n}`);
|
|
270
|
+
try {
|
|
271
|
+
fs.renameSync(file, target);
|
|
272
|
+
fsyncDir(state);
|
|
273
|
+
return target;
|
|
274
|
+
} catch (e) {
|
|
275
|
+
process.stderr.write(`state-authority: imported ${file} but could not retire it (${e.code ?? e.message}); ` +
|
|
276
|
+
'it is no longer read, remove it by hand\n');
|
|
277
|
+
return null;
|
|
278
|
+
}
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
// What readers see. While the import has not run, the marker is still the record (an upgrading team must
|
|
282
|
+
// not read as "off"); afterwards only the snapshot counts, even if a stale marker is still on disk.
|
|
283
|
+
function standbyView(snapshot, state) {
|
|
284
|
+
if (snapshot.standby.migrated) return { ...snapshot.standby, legacy: false };
|
|
285
|
+
const marker = legacyMarker(state);
|
|
286
|
+
if (!marker) return { ...snapshot.standby, legacy: false };
|
|
287
|
+
return { on: true, generation: snapshot.standby.generation, reason: marker.reason, since: marker.since, legacy: true };
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
function standbyResult(snapshot, state, extra) {
|
|
291
|
+
const view = standbyView(snapshot, state);
|
|
292
|
+
return {
|
|
293
|
+
ok: true, on: view.on, generation: view.generation, reason: view.reason, since: view.since,
|
|
294
|
+
migrated: Boolean(snapshot.standby.migrated), legacy: Boolean(view.legacy), ...extra,
|
|
295
|
+
};
|
|
296
|
+
}
|
|
297
|
+
|
|
298
|
+
function isoSeconds(ms) {
|
|
299
|
+
return new Date(ms).toISOString().replace(/\.\d{3}Z$/, 'Z');
|
|
300
|
+
}
|
|
301
|
+
|
|
213
302
|
function validate(snapshot, main, state) {
|
|
214
303
|
const where = snapshotFile(state);
|
|
215
304
|
if (!snapshot || typeof snapshot !== 'object' || Array.isArray(snapshot)) fail(`invalid state snapshot ${where}: not an object`);
|
|
@@ -230,6 +319,8 @@ function validate(snapshot, main, state) {
|
|
|
230
319
|
}
|
|
231
320
|
if (standby.reason !== null && typeof standby.reason !== 'string') fail(`invalid state snapshot ${where}: invalid Standby reason`);
|
|
232
321
|
if (standby.since !== null && typeof standby.since !== 'string') fail(`invalid state snapshot ${where}: invalid Standby timestamp`);
|
|
322
|
+
// Absent means "not imported yet" (a snapshot written by 1.1/1.2); anything but a boolean is corrupt.
|
|
323
|
+
if (standby.migrated !== undefined && typeof standby.migrated !== 'boolean') fail(`invalid state snapshot ${where}: invalid Standby migration flag`);
|
|
233
324
|
for (const key of ['reminders', 'batches', 'audit']) {
|
|
234
325
|
if (!Array.isArray(snapshot[key])) fail(`invalid state snapshot ${where}: ${key} is not an array`);
|
|
235
326
|
}
|
|
@@ -253,19 +344,43 @@ function summary(snapshot, created) {
|
|
|
253
344
|
stateRoot: snapshot.project.stateRoot,
|
|
254
345
|
sequences: { ...snapshot.sequences },
|
|
255
346
|
pruned: snapshot.pruned,
|
|
256
|
-
standby: { ...snapshot.standby },
|
|
347
|
+
standby: { ...snapshot.standby, migrated: Boolean(snapshot.standby.migrated) },
|
|
257
348
|
counts: { reminders: snapshot.reminders.length, batches: snapshot.batches.length, audit: snapshot.audit.length },
|
|
258
349
|
snapshot: snapshotFile(snapshot.project.stateRoot),
|
|
259
350
|
};
|
|
260
351
|
}
|
|
261
352
|
|
|
262
|
-
function apply(snapshot, request, nowMs) {
|
|
353
|
+
function apply(snapshot, request, nowMs, state) {
|
|
263
354
|
if (REMIND_OPS.has(request.op)) return applyReminder(snapshot, request, nowMs);
|
|
264
355
|
switch (request.op) {
|
|
265
356
|
case 'init':
|
|
266
357
|
return summary(snapshot, true);
|
|
267
358
|
case 'read':
|
|
268
359
|
return summary(snapshot, false);
|
|
360
|
+
case 'standby-read':
|
|
361
|
+
return standbyResult(snapshot, state);
|
|
362
|
+
case 'standby-import':
|
|
363
|
+
return standbyResult(snapshot, state);
|
|
364
|
+
case 'standby-on': {
|
|
365
|
+
// Every `on` is a new, never-reused generation (an already-on team that is told to stand down again
|
|
366
|
+
// gets one too): a wake binds a generation, and reusing one would let a stale binding turn off a
|
|
367
|
+
// newer stand-down.
|
|
368
|
+
snapshot.standby = {
|
|
369
|
+
on: true,
|
|
370
|
+
generation: snapshot.standby.generation + 1,
|
|
371
|
+
reason: typeof request.reason === 'string' ? request.reason : '-',
|
|
372
|
+
since: isoSeconds(nowMs),
|
|
373
|
+
migrated: true,
|
|
374
|
+
};
|
|
375
|
+
return standbyResult(snapshot, state);
|
|
376
|
+
}
|
|
377
|
+
case 'standby-off': {
|
|
378
|
+
// Already off is not an error and not a transition: nothing changes, so nothing is written.
|
|
379
|
+
if (snapshot.standby.on) {
|
|
380
|
+
snapshot.standby = { on: false, generation: snapshot.standby.generation, reason: null, since: isoSeconds(nowMs), migrated: true };
|
|
381
|
+
}
|
|
382
|
+
return standbyResult(snapshot, state);
|
|
383
|
+
}
|
|
269
384
|
case 'allocate': {
|
|
270
385
|
const kind = request.kind;
|
|
271
386
|
if (!SEQUENCE_KINDS.has(kind)) fail(`unknown state sequence kind: ${kind}`);
|
|
@@ -297,16 +412,26 @@ function transaction(main, state, request) {
|
|
|
297
412
|
if (request.op === 'read') fail(`state authority is not initialized: ${file}`);
|
|
298
413
|
snapshot = initial(locator);
|
|
299
414
|
validate(snapshot, main, state);
|
|
415
|
+
// A display path (panel banner, monitor, `standby status`) must not create anything: answer from the
|
|
416
|
+
// legacy marker -- or "off" -- and let the first write publish the snapshot.
|
|
417
|
+
if (STANDBY_READ_OPS.has(request.op)) return apply(snapshot, request, Date.now(), state);
|
|
300
418
|
}
|
|
301
419
|
const before = JSON.stringify(snapshot);
|
|
302
|
-
|
|
420
|
+
// Every mutation imports the legacy marker first, inside this same transaction, so no write can land on
|
|
421
|
+
// a half-upgraded team. Reads never import: they only *view* the marker (see standbyView).
|
|
422
|
+
const migration = STANDBY_READ_OPS.has(request.op) ? { imported: false, marker: false } : importLegacy(snapshot, state);
|
|
423
|
+
const result = apply(snapshot, request, Date.now(), state);
|
|
303
424
|
// A reminder result reports its own `created` (an idempotent key hit is created:false); every other
|
|
304
425
|
// operation keeps the authority-level meaning: was this the first snapshot?
|
|
305
|
-
if (!REMIND_OPS.has(request.op)) result.created = !hasSnapshot;
|
|
426
|
+
if (!REMIND_OPS.has(request.op) && !STANDBY_OPS.has(request.op)) result.created = !hasSnapshot;
|
|
306
427
|
const changed = JSON.stringify(snapshot) !== before;
|
|
307
428
|
// A first `init` does not mutate the object, but the fresh snapshot must still be published. A read
|
|
308
429
|
// (list/show, a refused cancel) never publishes one: reading an empty authority stays a read.
|
|
309
430
|
if (changed || (!hasSnapshot && request.op === 'init')) writeAtomic(file, snapshot);
|
|
431
|
+
// Publish first, retire second: the snapshot already records `migrated`, so a crash in between only
|
|
432
|
+
// replays the retirement instead of importing a second time.
|
|
433
|
+
const retired = migration.marker ? retireLegacy(state) : null;
|
|
434
|
+
if (request.op === 'standby-import') { result.imported = migration.imported; result.retired = retired; }
|
|
310
435
|
return result;
|
|
311
436
|
}
|
|
312
437
|
|
|
@@ -339,6 +464,34 @@ function flock(lock, args, input) {
|
|
|
339
464
|
});
|
|
340
465
|
}
|
|
341
466
|
|
|
467
|
+
// A whole-snapshot read WITHOUT the lock (the caller's "is there anything to commit right now" probe).
|
|
468
|
+
// Renames are atomic, so an unlocked reader sees either the previous or the next snapshot, never half of
|
|
469
|
+
// one; nothing here writes, publishes or decides -- every decision still runs inside `request()`.
|
|
470
|
+
export async function peek(context) {
|
|
471
|
+
const main = authorityIdentity(context);
|
|
472
|
+
const want = canonical(context.stateRoot);
|
|
473
|
+
const pinned = readLocator(main);
|
|
474
|
+
if (!pinned) {
|
|
475
|
+
return { pinned: false, mainRoot: main, stateRoot: want, reminders: { due: [], queued: [], staleIntent: [] }, outstanding: null };
|
|
476
|
+
}
|
|
477
|
+
if (pinned.stateRoot !== want) {
|
|
478
|
+
fail(`canonical state-root mismatch: pinned ${pinned.stateRoot}, requested ${want}; ` +
|
|
479
|
+
'quiesce the writers and migrate the locator explicitly (never pick a second authority)');
|
|
480
|
+
}
|
|
481
|
+
const file = snapshotFile(pinned.stateRoot);
|
|
482
|
+
if (!snapshotPresence(file)) {
|
|
483
|
+
return { pinned: true, mainRoot: main, stateRoot: pinned.stateRoot, reminders: { due: [], queued: [], staleIntent: [] }, outstanding: null };
|
|
484
|
+
}
|
|
485
|
+
const snapshot = readJSON(file);
|
|
486
|
+
validate(snapshot, main, pinned.stateRoot);
|
|
487
|
+
const pending = snapshot.batches.find(batch => batch.phase === 'intent' || batch.phase === 'unknown') ?? null;
|
|
488
|
+
return {
|
|
489
|
+
pinned: true, mainRoot: main, stateRoot: pinned.stateRoot, projectId: snapshot.project.id,
|
|
490
|
+
reminders: peekReminders(snapshot, Date.now()),
|
|
491
|
+
outstanding: pending ? { id: pending.id, phase: pending.phase } : null,
|
|
492
|
+
};
|
|
493
|
+
}
|
|
494
|
+
|
|
342
495
|
async function resolveAuthority(context) {
|
|
343
496
|
const main = authorityIdentity(context);
|
|
344
497
|
const want = canonical(context.stateRoot);
|
|
@@ -353,6 +506,7 @@ async function resolveAuthority(context) {
|
|
|
353
506
|
|
|
354
507
|
// The single Node-facing entry point (the CLI below is a thin wrapper around it).
|
|
355
508
|
export async function request(context, requestData) {
|
|
509
|
+
if (requestData.op === 'standby-read') return readStandby(context);
|
|
356
510
|
const located = await resolveAuthority(context);
|
|
357
511
|
const state = located.stateRoot;
|
|
358
512
|
try { fs.mkdirSync(remindersDir(state), { recursive: true, mode: 0o700 }); }
|
|
@@ -360,6 +514,35 @@ export async function request(context, requestData) {
|
|
|
360
514
|
return flock(authorityLock(state), ['--transaction', located.mainRoot, state], JSON.stringify(requestData));
|
|
361
515
|
}
|
|
362
516
|
|
|
517
|
+
// A read must establish nothing: it never creates the locator and never publishes a snapshot. Two reasons:
|
|
518
|
+
// the panel and the monitor are display paths (they must not write), and a caller that merely names another
|
|
519
|
+
// TEAM_STATE_DIR must not capture the project's pin from under it. Which record answers the read is the
|
|
520
|
+
// same decision the migration makes: an unpinned project is still described by the legacy marker.
|
|
521
|
+
function unfiledStandby(state) {
|
|
522
|
+
const marker = legacyMarker(state);
|
|
523
|
+
return marker
|
|
524
|
+
? { ok: true, on: true, generation: 0, reason: marker.reason, since: marker.since, migrated: false, legacy: true }
|
|
525
|
+
: { ok: true, on: false, generation: 0, reason: null, since: null, migrated: false, legacy: false };
|
|
526
|
+
}
|
|
527
|
+
|
|
528
|
+
async function readStandby(context) {
|
|
529
|
+
const main = authorityIdentity(context);
|
|
530
|
+
const state = canonical(context.stateRoot);
|
|
531
|
+
const pinned = readLocator(main);
|
|
532
|
+
if (!pinned) {
|
|
533
|
+
if (snapshotPresence(snapshotFile(state))) {
|
|
534
|
+
fail(`state authority is not pinned for ${main} (${locatorFile(main)} is missing) but ${snapshotFile(state)} exists; ` +
|
|
535
|
+
'refusing to answer from an unpinned snapshot');
|
|
536
|
+
}
|
|
537
|
+
return unfiledStandby(state);
|
|
538
|
+
}
|
|
539
|
+
if (pinned.stateRoot !== state) {
|
|
540
|
+
fail(`canonical state-root mismatch: pinned ${pinned.stateRoot}, requested ${state}; ` +
|
|
541
|
+
'quiesce the writers and migrate the locator explicitly (never pick a second authority)');
|
|
542
|
+
}
|
|
543
|
+
return flock(authorityLock(state), ['--transaction', main, state], JSON.stringify({ op: 'standby-read' }));
|
|
544
|
+
}
|
|
545
|
+
|
|
363
546
|
export async function resolve(context) {
|
|
364
547
|
return resolveAuthority(context);
|
|
365
548
|
}
|
|
@@ -368,7 +551,9 @@ function parseCli(argv) {
|
|
|
368
551
|
const [main, state, op, ...rest] = argv;
|
|
369
552
|
if (!main || !state || !op) {
|
|
370
553
|
fail('usage: state-authority.mjs --cli <project-root> <state-root> ' +
|
|
371
|
-
'<resolve|init|read|allocate <kind>|
|
|
554
|
+
'<resolve|init|read|allocate <kind>|standby-read|standby-on|standby-off|standby-import|' +
|
|
555
|
+
'remind-add|remind-list|remind-show|remind-cancel|remind-admit|remind-intent|' +
|
|
556
|
+
'remind-observe|remind-fail|remind-resolve> ' +
|
|
372
557
|
'[--print <field>] [--json]');
|
|
373
558
|
}
|
|
374
559
|
let print = null;
|
|
@@ -393,9 +578,24 @@ function parseCli(argv) {
|
|
|
393
578
|
flags[name] = value;
|
|
394
579
|
continue;
|
|
395
580
|
}
|
|
581
|
+
// Standby takes exactly one flag (`--reason` on `standby-on`); anything else is refused by name, so a
|
|
582
|
+
// typo cannot pass for a successful stand-down.
|
|
583
|
+
if (STANDBY_OPS.has(op) && token.startsWith('--')) {
|
|
584
|
+
const name = token.slice(2);
|
|
585
|
+
if (name === 'json') { json = true; continue; }
|
|
586
|
+
if (op === 'standby-on' && name === 'reason') {
|
|
587
|
+
const value = rest.shift();
|
|
588
|
+
if (value === undefined) fail('--reason needs a value');
|
|
589
|
+
flags.reason = value;
|
|
590
|
+
continue;
|
|
591
|
+
}
|
|
592
|
+
fail(`${op} does not accept --${name}`);
|
|
593
|
+
}
|
|
396
594
|
args.push(token);
|
|
397
595
|
}
|
|
398
|
-
const requestData = REMIND_OPS.has(op) ? parseRemindFlags(op, flags)
|
|
596
|
+
const requestData = REMIND_OPS.has(op) ? parseRemindFlags(op, flags)
|
|
597
|
+
: STANDBY_OPS.has(op) ? (op === 'standby-on' ? { op, reason: flags.reason ?? '-' } : { op })
|
|
598
|
+
: { op };
|
|
399
599
|
if (op === 'allocate') {
|
|
400
600
|
requestData.kind = args.shift();
|
|
401
601
|
if (!requestData.kind) fail('allocate needs a sequence kind (reminder|batch|queue)');
|
|
@@ -405,15 +605,30 @@ function parseCli(argv) {
|
|
|
405
605
|
}
|
|
406
606
|
|
|
407
607
|
// Boolean reminder flags (everything else takes a value).
|
|
408
|
-
const REMIND_BOOL_FLAGS = { 'remind-list': new Set(['all']) };
|
|
608
|
+
const REMIND_BOOL_FLAGS = { 'remind-list': new Set(['all']), 'remind-resolve': new Set(['ack-unknown']) };
|
|
409
609
|
|
|
410
610
|
// Exactly the flags each reminder operation accepts: an unknown flag is refused here rather than silently
|
|
411
|
-
// ignored, so a typo cannot look like a successful create.
|
|
611
|
+
// ignored, so a typo cannot look like a successful create or a successful delivery step.
|
|
412
612
|
const REMIND_FLAGS = {
|
|
413
613
|
'remind-add': new Set(['at', 'after', 'key', 'task', 'source']),
|
|
414
614
|
'remind-list': new Set(['all']),
|
|
415
615
|
'remind-show': new Set(['id']),
|
|
416
616
|
'remind-cancel': new Set(['id']),
|
|
617
|
+
'remind-admit': new Set(['pulse-started']),
|
|
618
|
+
'remind-intent': new Set(['session', 'pid']),
|
|
619
|
+
'remind-observe': new Set(['id', 'nonce', 'session']),
|
|
620
|
+
'remind-fail': new Set(['id', 'nonce', 'reason']),
|
|
621
|
+
'remind-resolve': new Set(['id', 'ack-unknown']),
|
|
622
|
+
};
|
|
623
|
+
|
|
624
|
+
// The kebab-case command line is mapped to the transaction's field names in one place: the transaction
|
|
625
|
+
// never sees a flag it did not ask for, and a missing required field is refused by name.
|
|
626
|
+
const REMIND_FIELD = { 'pulse-started': 'pulseStartedAt', 'ack-unknown': 'ack' };
|
|
627
|
+
const REMIND_REQUIRED = {
|
|
628
|
+
'remind-intent': ['session'],
|
|
629
|
+
'remind-observe': ['id', 'nonce', 'session'],
|
|
630
|
+
'remind-fail': ['id', 'nonce'],
|
|
631
|
+
'remind-resolve': ['id'],
|
|
417
632
|
};
|
|
418
633
|
|
|
419
634
|
function parseRemindFlags(op, flags) {
|
|
@@ -421,9 +636,20 @@ function parseRemindFlags(op, flags) {
|
|
|
421
636
|
const request = { op };
|
|
422
637
|
for (const name of Object.keys(flags)) {
|
|
423
638
|
if (!allowed.has(name)) fail(`${op} does not accept --${name}`);
|
|
424
|
-
request[name] = flags[name];
|
|
639
|
+
request[REMIND_FIELD[name] ?? name] = flags[name];
|
|
640
|
+
}
|
|
641
|
+
for (const name of REMIND_REQUIRED[op] ?? []) {
|
|
642
|
+
const field = REMIND_FIELD[name] ?? name;
|
|
643
|
+
if (request[field] === undefined || request[field] === '') fail(`${op} needs --${name}`);
|
|
644
|
+
}
|
|
645
|
+
if (op === 'remind-intent' && request.pid !== undefined) {
|
|
646
|
+
const pid = Number(request.pid);
|
|
647
|
+
if (!Number.isSafeInteger(pid) || pid < 1) fail('remind-intent --pid must be a process id');
|
|
648
|
+
request.pid = pid;
|
|
649
|
+
}
|
|
650
|
+
if (op === 'remind-resolve' && request.ack !== true) {
|
|
651
|
+
fail('remind-resolve requires --ack-unknown: acknowledging an unknown batch closes it and burns its one automatic-off right');
|
|
425
652
|
}
|
|
426
|
-
if ((op === 'remind-show' || op === 'remind-cancel') && !request.id) fail(`${op} needs --id <reminder-id>`);
|
|
427
653
|
return request;
|
|
428
654
|
}
|
|
429
655
|
|
|
@@ -440,6 +666,24 @@ async function readMessageFromStdin() {
|
|
|
440
666
|
return { message: text };
|
|
441
667
|
}
|
|
442
668
|
|
|
669
|
+
// Standby is rendered here (not in the shell) so a reason keeps every byte it was given: the shell only
|
|
670
|
+
// prints these lines, and `--print <field>` stays the machine interface.
|
|
671
|
+
function renderStandby(op, result) {
|
|
672
|
+
const status = result.on
|
|
673
|
+
? `standby: on(自 ${result.since ?? '-'},原因:${result.reason ?? '-'})`
|
|
674
|
+
: 'standby: off';
|
|
675
|
+
if (op !== 'standby-import') {
|
|
676
|
+
// Until the import runs, the marker is still the record: say so once, where a human reads it.
|
|
677
|
+
return result.legacy ? `${status}\n(旧标记还没并入统一状态:跑 team standby migrate 完成迁移)` : status;
|
|
678
|
+
}
|
|
679
|
+
if (result.imported) {
|
|
680
|
+
return `${status}\n迁移:state/standby 已并入统一状态(原因与时间保留,代次仍是 ${result.generation}:迁移不加代);` +
|
|
681
|
+
`旧标记改名为 ${result.retired ?? '(改名失败,已不再被读取)'}`;
|
|
682
|
+
}
|
|
683
|
+
if (result.retired) return `${status}\n迁移:统一状态早已并入;这次清掉了残留的旧标记(改名为 ${result.retired})`;
|
|
684
|
+
return `${status}\n迁移:无需迁移(统一状态已记录待命${result.on ? '开启' : '关闭'})`;
|
|
685
|
+
}
|
|
686
|
+
|
|
443
687
|
async function main(argv) {
|
|
444
688
|
const [mode, ...rest] = argv;
|
|
445
689
|
if (mode === '--locator') {
|
|
@@ -482,13 +726,17 @@ async function main(argv) {
|
|
|
482
726
|
if (!Object.hasOwn(result, print)) fail(`unknown output field: ${print}`);
|
|
483
727
|
if (result[print] === null || typeof result[print] === 'object') fail(`output field ${print} is not scalar`);
|
|
484
728
|
process.stdout.write(String(result[print]) + '\n');
|
|
729
|
+
} else if (STANDBY_OPS.has(requestData.op) && !json) {
|
|
730
|
+
process.stdout.write(renderStandby(requestData.op, result) + '\n');
|
|
485
731
|
} else {
|
|
486
732
|
process.stdout.write(JSON.stringify(result, null, 2) + '\n');
|
|
487
733
|
}
|
|
488
734
|
return;
|
|
489
735
|
}
|
|
490
736
|
fail('usage: state-authority.mjs --cli <project-root> <state-root> ' +
|
|
491
|
-
'<resolve|init|read|allocate <kind>|
|
|
737
|
+
'<resolve|init|read|allocate <kind>|standby-read|standby-on|standby-off|standby-import|' +
|
|
738
|
+
'remind-add|remind-list|remind-show|remind-cancel|remind-admit|remind-intent|' +
|
|
739
|
+
'remind-observe|remind-fail|remind-resolve> [--print <field>] [--json]');
|
|
492
740
|
}
|
|
493
741
|
|
|
494
742
|
if (process.argv[1] && path.resolve(process.argv[1]) === SELF) {
|
|
@@ -67,8 +67,8 @@ cmd reply seats reply list ;; reply show <slug> ;; reply post --from <sender> --
|
|
|
67
67
|
cmd pulse patrol pulse up|down|restart|status|logs [--print] --print up down restart status logs watchdog watchdog-status install-watchdog uninstall-watchdog pm pulse knock - starts-process none not-reversible:the window that was started is gone once it stops - pulse team pulse status
|
|
68
68
|
cmd monitor patrol monitor [--once] [--print|--json] [--width <N>] [--height <N>] [--interval <N>] [--events <K>] [--no-pulse] --once --print --json --width --height --interval --events --no-pulse - - pulse state writes-state none not-reversible:every run appends its own bookkeeping line - monitor team monitor --print --once
|
|
69
69
|
cmd watch patrol watch [--once] [--interval <N>] [--ui] --once --interval --ui - - pulse state writes-state none not-reversible:every tick appends to the patrol log - watch team watch --once
|
|
70
|
-
cmd standby patrol standby on [--reason <text>] ;; standby off ;; standby status --reason on off status - pm pulse state writes-state none not-reversible:the state it writes is a record of when it was set - standby team standby on --reason "waiting for the user"
|
|
71
|
-
cmd remind patrol remind add --after <duration> --message <text> [--key <id>] [--task <ref>] [--json] ;; remind add --at <date-time> --message-file <file> [--key <id>] [--task <ref>] [--json] ;; remind list [--all] [--json] ;; remind show <id> [--json] ;; remind cancel <id> [--json] --after --at --message --message-file --key --task --all --json add list show cancel - pm pulse state writes-state none not-reversible:a reminder is a record: cancel marks it cancelled and the history stays - remind team remind add --after 20m --message "check the build"
|
|
70
|
+
cmd standby patrol standby on [--reason <text>] ;; standby off ;; standby status ;; standby migrate --reason on off status migrate - pm pulse state writes-state none not-reversible:the state it writes is a record of when it was set - standby team standby on --reason "waiting for the user"
|
|
71
|
+
cmd remind patrol remind add --after <duration> --message <text> [--key <id>] [--task <ref>] [--json] ;; remind add --at <date-time> --message-file <file> [--key <id>] [--task <ref>] [--json] ;; remind list [--all] [--json] ;; remind show <id> [--json] ;; remind cancel <id> [--json] ;; remind resolve <batch-id> --ack-unknown [--json] --after --at --message --message-file --key --task --all --json --ack-unknown add list show cancel resolve - pm pulse state writes-state none not-reversible:a reminder is a record: cancel marks it cancelled and the history stays - remind team remind add --after 20m --message "check the build"
|
|
72
72
|
cmd up patrol up [--agents] [--fresh-pm] [--print] --agents --fresh-pm --print - - pm seat state starts-process none not-reversible:the PM session it starts keeps its own history - up team up
|
|
73
73
|
cmd resume patrol resume [--agent <a>] [--all] [--dry-run] --agent --all --dry-run - - seat pm state starts-process none not-reversible:a resumed seat continues in its own session - resume team resume --all
|
|
74
74
|
cmd meeting peers meeting open <slug> --with <peer> --topic <text> [--ttl <hours>] [--yes] ;; meeting say <slug> --intent <intent> <message> [--knock] ;; meeting read <slug> [--since <n>] [--peek] ;; meeting list [--all] ;; meeting inbox ;; meeting agree <slug> <option> [--note <text>] ;; meeting close <slug> --with --topic --ttl --yes --intent --knock --since --peek --all --note open say read list inbox agree close propose peer knock help - pm meetings writes-meetings needs-yes:TEAM_CONFIRM_WRITES not-reversible:the shared transcript is the record of what was said - meeting team meeting open rename --with other:pm --topic "rename the interface"
|
|
@@ -81,7 +81,7 @@ cmd merge finish merge - - - ledger - read-only none idempotent - merge team mer
|
|
|
81
81
|
cmd pr finish pr - - - ledger - read-only none idempotent - pr team pr
|
|
82
82
|
cmd gh finish gh - - - ledger - read-only none idempotent - gh team gh
|
|
83
83
|
cmd gl finish gl - - - ledger - read-only none idempotent - gl team gl
|
|
84
|
-
cmd mark-loaded versions mark-loaded
|
|
84
|
+
cmd mark-loaded versions mark-loaded - - - gate - read-only none idempotent - mark-loaded team mark-loaded
|
|
85
85
|
cmd version versions version [--check] --check - - gate - read-only none idempotent - version team version --check
|
|
86
86
|
cmd changelog versions changelog [--since <X>] --since - - - - read-only none idempotent - changelog team changelog
|
|
87
87
|
cmd reload versions reload [--done] --done - - gate state writes-state none not-reversible:every request leaves its own record - reload team reload
|
|
@@ -349,7 +349,7 @@ cmd.watch.arg.--once run a single tick and exit.
|
|
|
349
349
|
cmd.watch.arg.--interval repeat every this many seconds instead of running once.
|
|
350
350
|
cmd.watch.arg.--ui show the interactive panel instead of the text output.
|
|
351
351
|
cmd.standby.title tell the patrol that no one is needed
|
|
352
|
-
cmd.standby.what Records that the PM stands down: the patrol stops waking it, while everything that arrives is still written to the patrol log. A human turns it back on, so an agent cannot silently wake itself up again.
|
|
352
|
+
cmd.standby.what Records that the PM stands down: the patrol stops waking it, while everything that arrives is still written to the patrol log. A human turns it back on, so an agent cannot silently wake itself up again. `standby migrate` carries a stand-down recorded by an older version into the current record; running it twice changes nothing.
|
|
353
353
|
cmd.standby.when Use it when the work is blocked on a person, or when the backlog should wait for a human rather than for the PM.
|
|
354
354
|
cmd.standby.example team standby on --reason "waiting for the user to pick an interface"
|
|
355
355
|
cmd.standby.read the state directory and the patrol log
|
|
@@ -357,7 +357,7 @@ cmd.standby.write the state directory
|
|
|
357
357
|
cmd.standby.see `team pulse`, `team digest`
|
|
358
358
|
cmd.standby.arg.--reason why the PM is standing down; it is written down so the next session knows.
|
|
359
359
|
cmd.remind.title record a one-shot reminder for this project
|
|
360
|
-
cmd.remind.what Records a reminder for the project PM in the same versioned project state as the rest of teamsmith: its full text, when it is due and who created it. `list` prints what is waiting and when it is due, `show` prints one record in full, `cancel` stops a reminder that has not been frozen
|
|
360
|
+
cmd.remind.what Records a reminder for the project PM in the same versioned project state as the rest of teamsmith: its full text, when it is due and who created it. `list` prints what is waiting and when it is due, `show` prints one record in full, `cancel` stops a reminder that has not been frozen into a batch, and `resolve` acknowledges a whole batch whose delivery cannot be proven (it needs an explicit `--ack-unknown` and never resends). The patrol queues a reminder when it comes due and the PM session receives it as one complete message; Standby is left once, and only by an actual wake. Every status you see is derived from that one record on each read, never a second copy.
|
|
361
361
|
cmd.remind.when Use it to park something for a later time instead of holding a session open or retrying from memory.
|
|
362
362
|
cmd.remind.example team remind add --after 20m --message "check the build"
|
|
363
363
|
cmd.remind.read the project state snapshot and the state-root locator
|
|
@@ -371,6 +371,7 @@ cmd.remind.arg.--key a name for this logical reminder. While a live reminder hol
|
|
|
371
371
|
cmd.remind.arg.--task the task or brief this reminder belongs to, so the record says what it is about.
|
|
372
372
|
cmd.remind.arg.--all also print the reminders that already ended (the retained history), newest first.
|
|
373
373
|
cmd.remind.arg.--json print the record(s) as JSON instead of the table.
|
|
374
|
+
cmd.remind.arg.--ack-unknown acknowledge that this batch cannot be proven delivered: close every member, burn its one automatic Standby exit and do not resend. Without it `resolve` is refused.
|
|
374
375
|
cmd.up.title build the stage and start the PM
|
|
375
376
|
cmd.up.what Creates the project's session and windows if they are missing and starts the PM in its own window, continuing the project's previous conversation unless a fresh one is asked for. It starts the PM only; the seats are not touched.
|
|
376
377
|
cmd.up.when Use it after a restart, or when the session was lost and the team should keep working in the same project.
|
|
@@ -483,21 +484,20 @@ cmd.gl.example team gl
|
|
|
483
484
|
cmd.gl.read nothing
|
|
484
485
|
cmd.gl.write nothing
|
|
485
486
|
cmd.gl.see `team gh`, `team pr`
|
|
486
|
-
cmd.mark-loaded.title
|
|
487
|
-
cmd.mark-loaded.what
|
|
488
|
-
cmd.mark-loaded.when
|
|
489
|
-
cmd.mark-loaded.example team mark-loaded
|
|
490
|
-
cmd.mark-loaded.read
|
|
491
|
-
cmd.mark-loaded.write
|
|
492
|
-
cmd.mark-loaded.see `team version`, `team
|
|
493
|
-
cmd.mark-loaded.arg.--version record this version instead of the one found on disk.
|
|
487
|
+
cmd.mark-loaded.title the removed version record
|
|
488
|
+
cmd.mark-loaded.what This name used to write down which skill version the session had loaded. The record was only ever written by hand, so it went stale, and the staleness it reported was usually wrong. It is now refused, and the same question is answered from facts the tool already has.
|
|
489
|
+
cmd.mark-loaded.when Run it only to read the replacement: the PM process start time compared with the newest skill file mtime.
|
|
490
|
+
cmd.mark-loaded.example team mark-loaded
|
|
491
|
+
cmd.mark-loaded.read nothing
|
|
492
|
+
cmd.mark-loaded.write nothing
|
|
493
|
+
cmd.mark-loaded.see `team version --check`, `team doctor`
|
|
494
494
|
cmd.version.title which version is on disk, in the skill and in this session
|
|
495
495
|
cmd.version.what Prints the version of the installed skill, the version written in the skill file, the changelog's head and the version this session loaded. With the check argument it gives a verdict instead of a list.
|
|
496
496
|
cmd.version.when Use it when a command behaves differently from what this session's skill describes, or at the start of a long session.
|
|
497
497
|
cmd.version.example team version --check
|
|
498
498
|
cmd.version.read the installed skill, the changelog and the session record
|
|
499
499
|
cmd.version.write nothing
|
|
500
|
-
cmd.version.see `team changelog`, `team reload
|
|
500
|
+
cmd.version.see `team changelog`, `team reload`
|
|
501
501
|
cmd.version.arg.--check answer whether this session's skill is current instead of printing every version.
|
|
502
502
|
cmd.changelog.title what changed in the skill
|
|
503
503
|
cmd.changelog.what Prints the skill's change history, newest first, optionally only what came after a given version.
|
|
@@ -513,5 +513,5 @@ cmd.reload.when Use it after the skill was upgraded, when you want the current s
|
|
|
513
513
|
cmd.reload.example team reload
|
|
514
514
|
cmd.reload.read the reload request record
|
|
515
515
|
cmd.reload.write the reload request record
|
|
516
|
-
cmd.reload.see `team version
|
|
516
|
+
cmd.reload.see `team version`
|
|
517
517
|
cmd.reload.arg.--done mark the request as handled, after the reload really happened.
|
|
@@ -335,7 +335,7 @@ cmd.watch.arg.--once 只跑一拍就退出。
|
|
|
335
335
|
cmd.watch.arg.--interval 每隔这么多秒跑一次,而不是只跑一次。
|
|
336
336
|
cmd.watch.arg.--ui 显示可交互面板,而不是文本输出。
|
|
337
337
|
cmd.standby.title 告诉巡检"暂时不需要人"
|
|
338
|
-
cmd.standby.what 记下"PM 停工"这件事:巡检不再叫醒它,期间到达的一切照旧写进巡检日志。只有人能把它关掉,所以 agent
|
|
338
|
+
cmd.standby.what 记下"PM 停工"这件事:巡检不再叫醒它,期间到达的一切照旧写进巡检日志。只有人能把它关掉,所以 agent 不能自己悄悄醒来。`standby migrate` 把旧版本记下的停工搬进现在的记录;重跑一遍不会改变什么。
|
|
339
339
|
cmd.standby.when 工作卡在一个人身上时用它,或者你希望积压等一个人而不是等 PM 时用它。
|
|
340
340
|
cmd.standby.example team standby on --reason "等用户定接口"
|
|
341
341
|
cmd.standby.read 状态目录与巡检日志
|
|
@@ -343,7 +343,7 @@ cmd.standby.write 状态目录
|
|
|
343
343
|
cmd.standby.see `team pulse`、`team digest`
|
|
344
344
|
cmd.standby.arg.--reason PM 为什么停工;写下来,下一个会话才知道。
|
|
345
345
|
cmd.remind.title 给本项目记一条定时提醒
|
|
346
|
-
cmd.remind.what 把一条提醒记进 teamsmith 的项目状态:完整正文、什么时候到期、谁创建的。`list` 打印还在等的提醒和它们的到期时间,`show` 打印一条的全部内容,`cancel`
|
|
346
|
+
cmd.remind.what 把一条提醒记进 teamsmith 的项目状态:完整正文、什么时候到期、谁创建的。`list` 打印还在等的提醒和它们的到期时间,`show` 打印一条的全部内容,`cancel` 取消一条还没被冻结成批次的提醒,`resolve` 确认一整批无法证实送达的提醒(必须显式给 `--ack-unknown`;它不重发)。巡检到点把提醒入队,PM 会话把它作为一条完整消息收到;真的被叫醒时才退出待命一次。你看到的状态都是每次读取时从那条记录派生出来的,不另存一份。
|
|
347
347
|
cmd.remind.when 要把一件事留到以后再处理、又不想一直挂着会话或靠记性重来时用它。
|
|
348
348
|
cmd.remind.example team remind add --after 20m --message "看一下构建"
|
|
349
349
|
cmd.remind.read 项目状态快照与状态根定位器
|
|
@@ -357,6 +357,7 @@ cmd.remind.arg.--key 这条逻辑提醒的名字。只要还有一条未结束
|
|
|
357
357
|
cmd.remind.arg.--task 这条提醒属于哪个任务或任务书,记录里因此能看出它是关于什么的。
|
|
358
358
|
cmd.remind.arg.--all 连已经结束的提醒(保留的历史)一起打印,最新的在前。
|
|
359
359
|
cmd.remind.arg.--json 把记录按 JSON 打印,不打印表格。
|
|
360
|
+
cmd.remind.arg.--ack-unknown 确认这一批提醒无法证实是否送达:关闭整批、烧掉它那一次自动退出待命的权利,并且不重发。没有这个参数 `resolve` 一律拒绝。
|
|
360
361
|
cmd.up.title 搭好台子并把 PM 拉起来
|
|
361
362
|
cmd.up.what 缺什么就建什么:项目的 session 与窗口,然后在它自己的窗口里启动 PM,默认接着这个项目上一场会话,除非你要一场新的。它只负责 PM,不动席位。
|
|
362
363
|
cmd.up.when 重启之后用它,或者在 session 丢了、团队该在同一个项目里继续干活时用它。
|
|
@@ -469,21 +470,20 @@ cmd.gl.example team gl
|
|
|
469
470
|
cmd.gl.read 不读任何东西
|
|
470
471
|
cmd.gl.write 不写任何东西
|
|
471
472
|
cmd.gl.see `team gh`、`team pr`
|
|
472
|
-
cmd.mark-loaded.title
|
|
473
|
-
cmd.mark-loaded.what
|
|
474
|
-
cmd.mark-loaded.when
|
|
475
|
-
cmd.mark-loaded.example team mark-loaded
|
|
476
|
-
cmd.mark-loaded.read
|
|
477
|
-
cmd.mark-loaded.write
|
|
478
|
-
cmd.mark-loaded.see `team version`、`team
|
|
479
|
-
cmd.mark-loaded.arg.--version 记这个版本,而不是磁盘上找到的那个。
|
|
473
|
+
cmd.mark-loaded.title 已移除的版本记录
|
|
474
|
+
cmd.mark-loaded.what 这个命令以前把「本会话加载的是哪个 skill 版本」写进 state。那份记录只有人手动写,没人写就停在上一版,它报出来的旧会话多数是误报。现在它被拒绝,同一个问题由工具已有的事实回答。
|
|
475
|
+
cmd.mark-loaded.when 只在想看替代做法时跑:PM 进程启动时刻与 skill 文件最近改动时刻的比较。
|
|
476
|
+
cmd.mark-loaded.example team mark-loaded
|
|
477
|
+
cmd.mark-loaded.read 不读任何东西
|
|
478
|
+
cmd.mark-loaded.write 不写任何东西
|
|
479
|
+
cmd.mark-loaded.see `team version --check`、`team doctor`
|
|
480
480
|
cmd.version.title 磁盘上、skill 里和本会话各是什么版本
|
|
481
481
|
cmd.version.what 打印装在机器上的 skill 版本、skill 文件里写的版本、变更史的开头,以及本会话加载的版本。带 check 参数时它给结论,而不是列清单。
|
|
482
482
|
cmd.version.when 某个命令的行为跟本会话 skill 描述的不一样时用它,长会话开头也用它。
|
|
483
483
|
cmd.version.example team version --check
|
|
484
484
|
cmd.version.read 装在机器上的 skill、变更史与会话记录
|
|
485
485
|
cmd.version.write 不写任何东西
|
|
486
|
-
cmd.version.see `team changelog`、`team reload
|
|
486
|
+
cmd.version.see `team changelog`、`team reload`
|
|
487
487
|
cmd.version.arg.--check 只回答"本会话的 skill 是不是最新的",而不是把每个版本都打出来。
|
|
488
488
|
cmd.changelog.title skill 改了什么
|
|
489
489
|
cmd.changelog.what 打印 skill 的变更史,最新的在前;可以只看某个版本之后的部分。
|
|
@@ -499,5 +499,5 @@ cmd.reload.when skill 升级之后、想让当前会话看到新文件时用它
|
|
|
499
499
|
cmd.reload.example team reload
|
|
500
500
|
cmd.reload.read 重载请求的记录
|
|
501
501
|
cmd.reload.write 重载请求的记录
|
|
502
|
-
cmd.reload.see `team version
|
|
502
|
+
cmd.reload.see `team version`
|
|
503
503
|
cmd.reload.arg.--done 重载真的发生之后,把这个请求标记成已处理。
|
|
@@ -133,7 +133,7 @@ case "$CMD" in
|
|
|
133
133
|
remind) team_cmd_remind "$@" ;;
|
|
134
134
|
meeting) team_cmd_meeting "$@" ;;
|
|
135
135
|
version) if [ "${1:-}" = "--check" ] || [ "${1:-}" = "check" ]; then team_cmd_version_check "$@"; else team_cmd_version_brief "$@"; fi ;;
|
|
136
|
-
mark-loaded)
|
|
136
|
+
mark-loaded) team_err "mark-loaded 已移除:会话新旧由推导得出——PM 进程启动时刻 vs skill 文件的最近改动时刻,跑 $TEAM_CLI version --check 或 $TEAM_CLI doctor"; exit 2 ;;
|
|
137
137
|
reload) team_cmd_reload "$@" ;;
|
|
138
138
|
changelog) team_cmd_changelog "$@" ;;
|
|
139
139
|
smoke|test) team_cmd_smoke "$@" ;;
|
|
@@ -146,8 +146,8 @@ case "$CMD" in
|
|
|
146
146
|
team_dim " 有 PR:先 gh pr merge --squash --delete-branch <PR>,再 git -C $TEAM_MAIN_ROOT fetch origin $TEAM_PROTECTED_BRANCH && git -C $TEAM_MAIN_ROOT merge --ff-only FETCH_HEAD"
|
|
147
147
|
team_dim " 收尾:代码确认进 $TEAM_PROTECTED_BRANCH 之后再 $TEAM_CLI board set <ID> done"
|
|
148
148
|
team_dim " 步骤全文:$TEAM_SKILL_DIR/SKILL.md「git 与 forge」一节"
|
|
149
|
-
if [ -n "$(
|
|
150
|
-
team_dim "
|
|
149
|
+
if [ -n "$(team_skill_stale_line 2>/dev/null || true)" ]; then
|
|
150
|
+
team_dim " $(team_skill_stale_line):在 Pi 里输入 /reload 刷新 skill 描述"
|
|
151
151
|
fi
|
|
152
152
|
exit 2 ;;
|
|
153
153
|
gh|gl)
|
|
@@ -54,9 +54,8 @@ last three take `--force` + one audited line). `team change status <id>` shows t
|
|
|
54
54
|
+ report written + branch settled), **hard-blocked** (notify the PM + `BLOCKED:` in the report), or
|
|
55
55
|
**suspended on background jobs** (this session's jobs still running, every step that does not depend on them
|
|
56
56
|
done; the turn's last line names every awaited job id). The lane rule is the suspend default: `team_bg_run`
|
|
57
|
-
starts a long job and the turn ends
|
|
58
|
-
|
|
59
|
-
step and nothing else can advance. A previous session's wake-ups died with its process: find its jobs on disk
|
|
57
|
+
starts a long job and the turn ends; the completion wake-up is the normal harvest point. Do not wait inside the
|
|
58
|
+
turn (`sleep`, `team wait`, a blocking harvest): the user cannot type while the PM waits. A previous session's wake-ups died with its process: find its jobs on disk
|
|
60
59
|
(`state/bg.log`, `team bg list`) before awaiting or re-running them (`{{SKILL_DIR}}/references/workflows.md` §E2).
|
|
61
60
|
- **Never claim tests passed without having run them.** The PM re-runs in an independent worktree; a false report
|
|
62
61
|
fails the task.
|