gcf-aif-ext 0.16.1 → 0.18.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/lib/design.js CHANGED
@@ -23,6 +23,8 @@ export const HEADER_KEYS = [
23
23
  'flags',
24
24
  'reopens',
25
25
  ];
26
+ // GCF-PRD §5.3: no more than 7 pillars.
27
+ export const PILLARS_MAX = 7;
26
28
  // Engineering decisions of the agent, not words of the designer: no provenance needed.
27
29
  export const AGENT_SLOTS = ['check', 'measure', 'contract', 'interactions'];
28
30
 
package/lib/domain.js CHANGED
@@ -4,7 +4,7 @@
4
4
  // draws these and builds each command from `args` and `fields`; it hard-codes none of them.
5
5
  import { ITEM_MOVES, STORED } from './transitions.js';
6
6
  import { DEFAULT_GATE, GATES, ITEM_TYPES, SEVERITIES, UNIT_ITEM_TYPES } from './validate-item.js';
7
- import { SOURCES } from './inbox.js';
7
+ import { BASE_CATEGORIES, mergeVocabulary, questionOnly } from './inbox-categories.js';
8
8
  import { NOTE_MAX } from './work-ops.js';
9
9
  import { SESSION_TTL_MS } from './session-mark.js';
10
10
  import { RUN_MODES } from './gcf-paths.js';
@@ -72,12 +72,12 @@ const decide = (choice, help, fields = [], danger) => ({
72
72
  ...(danger && { danger }),
73
73
  });
74
74
  const text = (key, label, extra = {}) => ({ key, label, kind: 'text', ...extra });
75
- // How an item's run goes: a board offers its agent's presets (`presets`), and `default`, which
76
- // leaves the choice to the project's `agent.model|effort`, else the agent; a word of the
77
- // operator's own goes too.
78
- const PICKS = "default: the project's, else the agent picks";
79
- const MODEL = text('model', 'Model of its run', { presets: 'model', help: PICKS });
80
- const EFFORT = text('effort', 'Effort of its run', { presets: 'effort', help: PICKS });
75
+ // How an item's run goes (decision 36): a board offers Default (`default`), which leaves the
76
+ // choice to the project's `agent.model|effort`, else the agent's defaults (Opus, High), then its
77
+ // agent's presets (`presets`). The console takes any word.
78
+ const picks = (d) => `Default: the project's setting, else ${d}`;
79
+ const MODEL = text('model', 'Model of its run', { presets: 'model', help: picks('Opus') });
80
+ const EFFORT = text('effort', 'Effort of its run', { presets: 'effort', help: picks('High') });
81
81
  // Where an item's runs go (Methodology §7): the operator's choice over the project's run_mode;
82
82
  // the framework does not judge which a project's work needs.
83
83
  const RUN_MODE_HELP = {
@@ -210,7 +210,8 @@ const ITEM_SPECS = {
210
210
  label: 'attach',
211
211
  help: 'Give the item a file (a chat image, a reference): committed in its attachments',
212
212
  args: ['gcf', 'item', 'attach', '{id}'],
213
- fields: [{ key: 'file', label: 'File path', kind: 'text', required: true }],
213
+ // `file`: the board picks it on the operator's machine and sends its bytes; the core gets a path.
214
+ fields: [{ key: 'file', label: 'File', kind: 'file', required: true }],
214
215
  rare: true,
215
216
  },
216
217
  };
@@ -230,11 +231,10 @@ const RUN = {
230
231
  // shows the proposal, the operator's click makes it.
231
232
  const NEW_ITEM = {
232
233
  label: 'create',
233
- help: 'A new work item, committed; the core refuses a type the phase does not take',
234
- args: ['gcf', 'item', 'new', '{id}', '--commit'],
234
+ help: 'A new work item, committed; its id comes from the title; the core refuses a type the phase does not take',
235
+ args: ['gcf', 'item', 'new', '--commit'],
235
236
  propose: true,
236
237
  fields: [
237
- { key: 'id', label: 'Id (lowercase-hyphen slug)', kind: 'slug', required: true },
238
238
  {
239
239
  key: 'type',
240
240
  label: 'Type',
@@ -266,11 +266,13 @@ const NEW_ITEM = {
266
266
  },
267
267
  text('release', 'Version', { required: true, when: { key: 'type', is: ['release'] } }),
268
268
  text('channel', 'Channel', { required: true, when: { key: 'type', is: ['release'] } }),
269
- text('title', 'Title: one line, what it gives'),
269
+ text('title', 'Title: one line, what it gives', { required: true }),
270
270
  text('system', 'Subsystems, comma-separated'),
271
- { key: 'depends', label: 'Depends on ids, comma-separated', kind: 'ids' },
272
- text('parent', 'Parent feature id'),
273
- text('milestone', 'Milestone'),
271
+ { key: 'depends', label: 'Depends on', kind: 'ids' },
272
+ // One live feature, picked by its title (decision 34).
273
+ { key: 'parent', label: 'Parent feature', kind: 'ids', single: true, of: ['feature'] },
274
+ // A milestone of game.md: a board picks it from the read's `design.milestones` (`from`).
275
+ text('milestone', 'Milestone', { from: 'milestones' }),
274
276
  text('blocked', 'Start blocked: why (e.g. "file needed")'),
275
277
  MODEL,
276
278
  EFFORT,
@@ -287,6 +289,294 @@ const NEW_ITEM = {
287
289
  ],
288
290
  };
289
291
 
292
+ // A part of the design a save names (`gcf design part`): its kind, and the hash it was read at.
293
+ const PART_FIELDS = [
294
+ {
295
+ key: 'kind',
296
+ label: 'Part',
297
+ kind: 'choice',
298
+ required: true,
299
+ hidden: true,
300
+ options: ['doc', 'system', 'unit'].map((k) => ({ value: k, label: k })),
301
+ },
302
+ text('base', 'Read at', { hidden: true }),
303
+ text('system', 'Subsystem of a new unit', { hidden: true }),
304
+ text('type', 'Type of a new unit', { hidden: true }),
305
+ text('title', 'Title of a new unit', { hidden: true }),
306
+ ];
307
+
308
+ // The design's moves (Board-PRD §5.24): a part saved from its form or as text, a session's
309
+ // files recorded, a designer's bundle brought back, a new unit, a draft discarded, a pillar retired, a unit dropped.
310
+ // Every save goes through the import's three-way check and the design check.
311
+ const DESIGN_SPECS = {
312
+ 'design-save': {
313
+ label: 'save',
314
+ help: 'Save the edited fields; refused when the part changed since, or on a new finding',
315
+ args: ['gcf', 'design', 'save', '{id}'],
316
+ fields: [
317
+ ...PART_FIELDS,
318
+ // The edited fields as JSON, key → value: a form builds it, not the operator.
319
+ { key: 'fields', label: 'Fields', kind: 'longtext', required: true, stdin: true },
320
+ ],
321
+ },
322
+ 'design-save-text': {
323
+ label: 'save text',
324
+ help: 'Save the part as text: for what a form cannot hold (a comment, prose)',
325
+ args: ['gcf', 'design', 'save', '{id}'],
326
+ fields: [
327
+ ...PART_FIELDS,
328
+ { key: 'text', label: 'Text', kind: 'longtext', required: true, stdin: true },
329
+ ],
330
+ },
331
+ 'design-commit': {
332
+ label: 'record design',
333
+ help: 'Commit what a design session wrote; refused while the design check has a finding',
334
+ args: ['gcf', 'design', 'commit'],
335
+ fields: [text('message', 'What changed, one line')],
336
+ },
337
+ 'design-import': {
338
+ label: 'import',
339
+ help: "Bring a designer's edited bundle back: what changed in gcf/ meanwhile is reported",
340
+ args: ['gcf', 'design', 'import', '--commit'],
341
+ fields: [{ key: 'bundle', label: 'Bundle', kind: 'longtext', required: true, stdin: true }],
342
+ },
343
+ 'design-new-unit': {
344
+ label: 'add unit',
345
+ help: 'A new unit of the subsystem, its slots TBD; its id comes from the title',
346
+ args: ['gcf', 'design', 'save', '--kind', 'unit'],
347
+ fields: [
348
+ text('system', 'Subsystem', { required: true }),
349
+ {
350
+ key: 'type',
351
+ label: 'Type',
352
+ kind: 'choice',
353
+ required: true,
354
+ options: UNIT_ITEM_TYPES.map((t) => ({ value: t, label: t })),
355
+ },
356
+ text('title', 'Title', { required: true }),
357
+ {
358
+ key: 'fields',
359
+ label: 'Fields',
360
+ kind: 'longtext',
361
+ required: true,
362
+ stdin: true,
363
+ hidden: true,
364
+ },
365
+ ],
366
+ },
367
+ 'design-discard': {
368
+ label: 'discard draft',
369
+ help: "The agent's draft not recorded goes: its files as the last record has them",
370
+ args: ['gcf', 'design', 'discard'],
371
+ fields: [],
372
+ danger: true,
373
+ },
374
+ 'pillar-retire': {
375
+ label: 'retire',
376
+ help: 'The game no longer holds it: units left with no pillar read pillars: TBD',
377
+ args: ['gcf', 'pillar', 'retire', '{id}'],
378
+ fields: [REASON],
379
+ danger: true,
380
+ },
381
+ 'unit-drop': {
382
+ label: 'drop',
383
+ help: 'The unit leaves the design into the graveyard, with the reason',
384
+ args: ['gcf', 'drop', '{id}'],
385
+ fields: [REASON, { key: 'tags', label: 'Graveyard tags', kind: 'tags' }],
386
+ danger: true,
387
+ },
388
+ };
389
+
390
+ // What an agent does for the design from the board (Board-PRD §5.24): each start opens a
391
+ // project chat thread that follows its skill, not gcf-chat, with the first message `say`
392
+ // (`{file}`: an uploaded GDD, `{unit}`: a unit id, `{system}`: a subsystem, `{text}`: the
393
+ // operator's words). `edits`: the
394
+ // files its agent writes without a permission card; everything else still asks.
395
+ const DESIGN_EDITS = [
396
+ 'gcf/game.md',
397
+ 'gcf/glossary.md',
398
+ 'gcf/backlog.md',
399
+ 'gcf/open-questions.md',
400
+ 'gcf/INDEX.md',
401
+ 'gcf/design/**',
402
+ ];
403
+ const STARTS = {
404
+ vision: {
405
+ label: 'Create with agent',
406
+ help: 'An interview about the game: genre, fantasy, references, loop, scope, what it is not',
407
+ skill: 'gcf-vision',
408
+ say: 'Start the game design with me: the vision interview.',
409
+ edits: DESIGN_EDITS,
410
+ },
411
+ ingest: {
412
+ label: 'Import GDD',
413
+ help: 'A GDD (.md) becomes design units, questions, and drafts of the vision and glossary',
414
+ skill: 'gcf-ingest',
415
+ takes: 'file',
416
+ say: 'Import the GDD {file}.',
417
+ edits: DESIGN_EDITS,
418
+ },
419
+ 'review-gdd': {
420
+ label: 'Review GDD first',
421
+ help: 'Expert lenses read the GDD before its import; their findings become questions',
422
+ skill: 'gcf-debate',
423
+ takes: 'file',
424
+ say: 'Review the GDD {file}; it is not imported yet.',
425
+ edits: ['gcf/open-questions.md', 'gcf/INDEX.md'],
426
+ },
427
+ pillars: {
428
+ label: 'Pillars interview',
429
+ help: "The game's 2..7 pillars, each with what it forbids and its review question",
430
+ skill: 'gcf-init',
431
+ say:
432
+ 'gcf/ exists: run the pillars interview with me; with gcf/PILLARS.md empty, start from ' +
433
+ 'candidates you draw from the vision and the design units.',
434
+ edits: ['gcf/PILLARS.md', 'gcf/INDEX.md'],
435
+ },
436
+ 'revise-pillars': {
437
+ label: 'Revise with agent',
438
+ help: 'Talk a change of the pillars through: the agent proposes, you confirm',
439
+ skill: 'gcf-init',
440
+ takes: 'text',
441
+ say: 'Revise the pillars with me: {text}',
442
+ edits: ['gcf/PILLARS.md', 'gcf/INDEX.md'],
443
+ },
444
+ 'revise-vision': {
445
+ label: 'Change with agent',
446
+ help: 'Talk a change of the vision, scope or milestones through',
447
+ skill: 'gcf-vision',
448
+ takes: 'text',
449
+ say: 'Change the vision with me: {text}',
450
+ edits: DESIGN_EDITS,
451
+ },
452
+ debate: {
453
+ label: 'Review with agent',
454
+ help: 'Expert lenses read the whole design: holes and contradictions become questions',
455
+ skill: 'gcf-debate',
456
+ say: 'Review the design.',
457
+ edits: DESIGN_EDITS,
458
+ },
459
+ 'debate-unit': {
460
+ label: 'Review with agent',
461
+ help: 'Expert lenses read this unit',
462
+ skill: 'gcf-debate',
463
+ takes: 'unit',
464
+ say: 'Review unit {unit}.',
465
+ edits: DESIGN_EDITS,
466
+ },
467
+ // A draft beside an empty or TBD part (decision 35): the agent writes it, records nothing; the
468
+ // operator records it, edits it in the form, or discards it.
469
+ 'draft-glossary': {
470
+ label: 'Draft with agent',
471
+ help: 'A draft of the glossary from the vision and the units: you record it, edit or discard it',
472
+ skill: 'gcf-vision',
473
+ say: 'Draft gcf/glossary.md from the vision and the design units. Write it, do not record it.',
474
+ edits: DESIGN_EDITS,
475
+ },
476
+ 'draft-system': {
477
+ label: 'Draft with agent',
478
+ help: "A draft of the subsystem's purpose from its units and the vision",
479
+ skill: 'gcf-vision',
480
+ takes: 'system',
481
+ say:
482
+ 'Draft the purpose of subsystem {system} from its units and the vision. Write it, do not ' +
483
+ 'record it.',
484
+ edits: DESIGN_EDITS,
485
+ },
486
+ 'name-pillars': {
487
+ label: 'Name with agent',
488
+ help: 'A short name for each pillar without one, from its statement',
489
+ skill: 'gcf-init',
490
+ say:
491
+ 'Give each pillar of gcf/PILLARS.md without a name a short name of 2 to 4 words from its ' +
492
+ 'statement. Change nothing else, do not record it.',
493
+ edits: ['gcf/PILLARS.md', 'gcf/INDEX.md'],
494
+ },
495
+ card: {
496
+ label: 'Fill TBDs with agent',
497
+ help: "Go through the unit's TBDs together; it goes into work only when you say so",
498
+ skill: 'gcf-card',
499
+ takes: 'unit',
500
+ say: 'Go through the TBDs of unit {unit} with me; take it into work only when I say so.',
501
+ edits: DESIGN_EDITS,
502
+ },
503
+ };
504
+
505
+ // The way from an empty project to its first work, in order: the board shows each step done or
506
+ // not (the board read's `design.steps`) with the starts that do it.
507
+ const DESIGN_STEPS = [
508
+ {
509
+ id: 'design',
510
+ label: 'The game design',
511
+ help: 'Import a GDD, or create the design with an agent: design units, the vision, the scope',
512
+ starts: ['ingest', 'review-gdd', 'vision', 'draft-glossary'],
513
+ },
514
+ {
515
+ id: 'pillars',
516
+ label: 'Pillars',
517
+ help: 'What the game always holds: every unit and every review answers to them',
518
+ starts: ['pillars', 'name-pillars'],
519
+ },
520
+ {
521
+ id: 'questions',
522
+ label: 'Open questions',
523
+ help: 'What the design leaves open: a unit a question holds cannot go into work',
524
+ },
525
+ {
526
+ id: 'work',
527
+ label: 'First work',
528
+ help: 'A unit with no TBD and no question goes into work: it becomes a card on the board',
529
+ starts: ['card'],
530
+ },
531
+ ];
532
+
533
+ // The game's own inbox categories (Board-PRD §2.6), merged over the framework's base.
534
+ const GAME_CATEGORIES = [
535
+ {
536
+ id: 'playtest',
537
+ label: 'Play note',
538
+ help: 'What you saw while playing',
539
+ rank: 5,
540
+ group: 'to-sort',
541
+ // An agent records one only in a playtest session, on the operator's words.
542
+ set_by: ['you', 'agent'],
543
+ details: null,
544
+ later: true,
545
+ },
546
+ {
547
+ id: 'tune',
548
+ label: 'Tune note',
549
+ help: 'A note on the feel or a number of an item that waits for its verdict',
550
+ rank: 10,
551
+ group: 'ideas',
552
+ set_by: ['you'],
553
+ details: null,
554
+ later: true,
555
+ },
556
+ ];
557
+
558
+ /** The inbox's vocabulary of a GCF project: the base and the game's layer (decision 32). */
559
+ export const inboxVocabulary = () => mergeVocabulary(BASE_CATEGORIES, GAME_CATEGORIES);
560
+
561
+ // An entry's category: one an entry can be filed in or moved into; the core checks who may.
562
+ const CATEGORY = (dflt) => ({
563
+ key: 'category',
564
+ label: 'Category',
565
+ kind: 'choice',
566
+ required: true,
567
+ ...(dflt && { default: dflt }),
568
+ options: inboxVocabulary()
569
+ .categories.filter((c) => !questionOnly(c) && c.set_by.length)
570
+ .map((c) => ({ value: c.id, label: c.label, help: c.help })),
571
+ });
572
+ const DETAIL = {
573
+ key: 'detail',
574
+ label: 'Detail',
575
+ kind: 'text',
576
+ max: 30,
577
+ help: 'One lowercase word after the category: asset, static-analysis, framework',
578
+ };
579
+
290
580
  // The moves of the domain's blocks: the phase, the inbox, the questions, the run order.
291
581
  const BLOCK_SPECS = {
292
582
  'item-new': NEW_ITEM,
@@ -306,18 +596,12 @@ const BLOCK_SPECS = {
306
596
  },
307
597
  'inbox-add': {
308
598
  label: 'add',
309
- help: 'A raw note for triage (an idea, a playtest note, a CI finding); line 1 is its title',
599
+ help: 'A raw note for triage (an idea, a playtest note, a bug); line 1 is its title',
310
600
  args: ['gcf', 'inbox', 'add', '--commit'],
311
601
  fields: [
312
602
  { key: 'text', label: 'Text', kind: 'longtext', required: true },
313
- {
314
- key: 'source',
315
- label: 'Source',
316
- kind: 'choice',
317
- default: 'operator',
318
- options: SOURCES.map((s) => ({ value: s, label: s })),
319
- },
320
- { key: 'tags', label: 'Tags', kind: 'tags' },
603
+ CATEGORY('note'),
604
+ DETAIL,
321
605
  ],
322
606
  propose: true,
323
607
  },
@@ -329,16 +613,27 @@ const BLOCK_SPECS = {
329
613
  danger: true,
330
614
  propose: true,
331
615
  },
332
- 'inbox-tag': {
333
- label: 'tag',
334
- help: 'Sort the entry: tags added and removed',
335
- args: ['gcf', 'inbox', 'tag', '{id}', '--commit'],
336
- fields: [
337
- { key: 'add', label: 'Add tags', kind: 'tags' },
338
- { key: 'remove', label: 'Remove tags', kind: 'tags' },
339
- ],
616
+ 'inbox-category': {
617
+ label: 'sort',
618
+ help: 'Give the entry another category or detail; where it came from stays',
619
+ args: ['gcf', 'inbox', 'category', '{id}', '--commit'],
620
+ // An emptied detail goes as `--detail=`: it clears the one there.
621
+ fields: [CATEGORY(), { ...DETAIL, clear: true }],
340
622
  propose: true,
341
623
  },
624
+ 'inbox-later': {
625
+ label: 'later',
626
+ help: 'Put the entry away to Later: nothing there asks for you now',
627
+ args: ['gcf', 'inbox', 'later', '{id}', '--commit'],
628
+ fields: [],
629
+ propose: true,
630
+ },
631
+ 'inbox-back': {
632
+ label: 'back',
633
+ help: 'Take the entry back from Later to its group',
634
+ args: ['gcf', 'inbox', 'later', '{id}', '--off', '--commit'],
635
+ fields: [],
636
+ },
342
637
  'question-answer': {
343
638
  label: 'answer',
344
639
  help: 'The answer goes into the record; the next agent on its units puts it in place',
@@ -351,6 +646,7 @@ const BLOCK_SPECS = {
351
646
  args: ['gcf', 'prioritize', '{ids}'],
352
647
  fields: [],
353
648
  },
649
+ ...DESIGN_SPECS,
354
650
  };
355
651
 
356
652
  // The item fields a board shows: on the card (`card`), in the drawer (all that have a value).
@@ -415,11 +711,23 @@ const TERMS = [
415
711
  'A parent item: when its children are done, the operator decides: close, continue or kill',
416
712
  ],
417
713
  ['design unit', 'A mechanic, resource, rule, constraint or entity of gcf/design/'],
714
+ [
715
+ 'GDD import',
716
+ 'A GDD becomes design units (each slot a GDD quote or TBD), questions, drafts of the vision ' +
717
+ 'and the glossary, and pillar candidates: no item until a unit goes into work',
718
+ ],
719
+ ['pillar', 'What the game always holds: units cite it, a review asks its question'],
720
+ [
721
+ 'record design',
722
+ 'One commit of what a design session wrote: pillars, vision, glossary, units, questions',
723
+ ],
418
724
  ['phase', 'The stage of the project (prototype, vertical slice…): the types it takes'],
419
725
  ['WIP', 'Items built and waiting for a verdict; at the limit new verdict work stops'],
420
726
  ['verify', 'The DoD: the project test and build commands, green on the code as it is'],
421
727
  ['inbox', 'Raw input waiting for triage: it becomes an item or is erased'],
422
728
  ['lesson', 'An inbox entry an agent session left: what got in its way'],
729
+ ['category', 'What an inbox entry or a question asks of you: it sets its group and rank'],
730
+ ['Later', 'Inbox entries put away: nothing there asks for you now'],
423
731
  ['D1', 'A question only the operator answers; it blocks the units it names'],
424
732
  ['D2', 'An assumption the agent made and works with; it comes back when its trigger fires'],
425
733
  ['unplayed', 'Closed by its checks without a playtest; it waits for one'],
@@ -431,12 +739,20 @@ const SECTIONS = {
431
739
  phase: { next: 'phase-next' },
432
740
  release: {},
433
741
  wip: { help: 'Items awaiting a verdict / wip_built_limit' },
434
- inbox: { add: 'inbox-add', drop: 'inbox-drop', tag: 'inbox-tag' },
742
+ inbox: {
743
+ add: 'inbox-add',
744
+ drop: 'inbox-drop',
745
+ category: 'inbox-category',
746
+ later: 'inbox-later',
747
+ back: 'inbox-back',
748
+ // The vocabulary as data: the board draws its groups and choices from it, knows none.
749
+ ...inboxVocabulary(),
750
+ },
435
751
  questions: { answer: 'question-answer' },
436
752
  lessons: {},
437
753
  playtest: {
438
- // The inbox source a note from the playtest screen goes with.
439
- source: 'playtest',
754
+ // The inbox category a note from the playtest screen goes with.
755
+ category: 'playtest',
440
756
  waits: ['awaiting-verdict', 'unplayed'],
441
757
  verdicts: ['verdict:keep', 'verdict:tune', 'verdict:kill'],
442
758
  },
@@ -444,6 +760,20 @@ const SECTIONS = {
444
760
  // `match`: the item's field Related holds against the graveyard's tags.
445
761
  graveyard: { label: 'Graveyard', match: 'system' },
446
762
  units: { label: 'Design units' },
763
+ // The game design screen (Board-PRD §5.24): the read's `design` block, its moves and starts.
764
+ design: {
765
+ label: 'Design',
766
+ steps: DESIGN_STEPS,
767
+ save: 'design-save',
768
+ save_text: 'design-save-text',
769
+ commit: 'design-commit',
770
+ import: 'design-import',
771
+ new_unit: 'design-new-unit',
772
+ discard: 'design-discard',
773
+ retire: 'pillar-retire',
774
+ drop: 'unit-drop',
775
+ answer: 'question-answer',
776
+ },
447
777
  };
448
778
 
449
779
  // The gcf commands that change the project: a project chat asks the operator before each one
@@ -459,6 +789,9 @@ const CHANGES = [
459
789
  'design export',
460
790
  'design import',
461
791
  'design migrate',
792
+ 'design save',
793
+ 'design commit',
794
+ 'design discard',
462
795
  'take',
463
796
  'done',
464
797
  'drop',
@@ -473,7 +806,9 @@ const CHANGES = [
473
806
  'block',
474
807
  'unblock',
475
808
  'inbox add',
476
- 'inbox tag',
809
+ 'inbox category',
810
+ 'inbox later',
811
+ 'inbox migrate',
477
812
  'inbox drop',
478
813
  'lessons add',
479
814
  'config set',
@@ -531,6 +866,7 @@ export function domainOf(extensions = {}) {
531
866
  new_item: 'item-new',
532
867
  rank: 'prioritize',
533
868
  chat: CHAT,
869
+ starts: STARTS,
534
870
  // A session's mark nobody refreshed for this long stops making its item `running`.
535
871
  session_ttl_min: SESSION_TTL_MS / 60_000,
536
872
  };
package/lib/git.js CHANGED
@@ -55,10 +55,15 @@ const BY = ['run', 'session', 'operator'];
55
55
 
56
56
  /**
57
57
  * Who makes a move: `GCF_MOVE_BY` when it names one (the harness sets `run` for both run modes),
58
- * else a harness run's owner, else a Claude Code session, else the operator.
58
+ * else a harness run's owner, else a Claude Code session, else the operator. Inside a run or a
59
+ * session `GCF_MOVE_BY` cannot name the operator: an agent would claim the operator's moves.
60
+ * shortcut: an agent that unsets its own markers still passes for the operator; a trusted channel
61
+ * of who runs a command would close it.
59
62
  */
60
63
  export function moveBy(env = process.env) {
61
- if (BY.includes(env.GCF_MOVE_BY ?? '')) return /** @type {string} */ (env.GCF_MOVE_BY);
64
+ const agent = Boolean(env.GCF_RUN_OWNER || env.CLAUDE_CODE_SESSION_ID);
65
+ const named = env.GCF_MOVE_BY ?? '';
66
+ if (BY.includes(named) && !(agent && named === 'operator')) return named;
62
67
  if (env.GCF_RUN_OWNER) return 'run';
63
68
 
64
69
  return env.CLAUDE_CODE_SESSION_ID ? 'session' : 'operator';
@@ -66,17 +71,19 @@ export function moveBy(env = process.env) {
66
71
 
67
72
  /**
68
73
  * The trailer paragraph of a move's commit as `git commit`/`git merge` arguments (`gcf item
69
- * history` reads it): the items and units it touched, the domain's move key, who made it. A
70
- * separate `-m`, not `--trailer`: any git version takes it. None without a move key.
71
- * @param {{key?: string, items?: string[]}} [move]
74
+ * history` reads it): the items and units it touched, the domain's move key, who made it, and
75
+ * the board's proposal it carries out (its recovery finds the move by it). A separate `-m`, not
76
+ * `--trailer`: any git version takes it. None without a move key.
77
+ * @param {{key?: string, items?: string[], proposal?: string}} [move]
72
78
  */
73
- export function moveTrailers({ key, items = [] } = {}) {
79
+ export function moveTrailers({ key, items = [], proposal } = {}) {
74
80
  if (!key) return [];
75
81
  const ids = [...new Set(items)];
76
82
  const lines = [
77
83
  ...(ids.length ? [`GCF-Items: ${ids.join(', ')}`] : []),
78
84
  `GCF-Move: ${key}`,
79
85
  `GCF-By: ${moveBy()}`,
86
+ ...(proposal ? [`GCF-Proposal: ${proposal}`] : []),
80
87
  ];
81
88
 
82
89
  return ['-m', lines.join('\n')];
package/lib/id.js CHANGED
@@ -15,6 +15,53 @@ export function slugify(name) {
15
15
  return slug;
16
16
  }
17
17
 
18
+ // Cyrillic to Latin, one way for good: an id is frozen once made, and a test holds this table
19
+ // (Board-PRD decision 34). Ukrainian and Belarusian letters too.
20
+ // prettier-ignore
21
+ const CYRILLIC = {
22
+ а: 'a', б: 'b', в: 'v', г: 'g', ґ: 'g', д: 'd', е: 'e', ё: 'e', є: 'ie', ж: 'zh', з: 'z',
23
+ и: 'i', і: 'i', ї: 'i', й: 'i', к: 'k', л: 'l', м: 'm', н: 'n', о: 'o', п: 'p', р: 'r',
24
+ с: 's', т: 't', у: 'u', ў: 'u', ф: 'f', х: 'kh', ц: 'ts', ч: 'ch', ш: 'sh', щ: 'shch',
25
+ ъ: '', ы: 'y', ь: '', э: 'e', ю: 'iu', я: 'ia',
26
+ };
27
+
28
+ /** `s` in Latin letters: Cyrillic by the table, accents dropped (`é` → `e`). */
29
+ export const transliterate = (s) =>
30
+ [...String(s).toLowerCase().normalize('NFD').replace(/\p{M}/gu, '').normalize('NFC')]
31
+ .map((ch) => CYRILLIC[ch] ?? ch)
32
+ .join('');
33
+
34
+ // About four words: an id names, a title describes.
35
+ const ID_WORDS = 4;
36
+ const ID_CHARS = 32;
37
+
38
+ /**
39
+ * The id the system makes from a title (Board-PRD decision 34): transliterated, slugged, cut at
40
+ * a word to 4 words and 32 characters, `-2`, `-3`… while `known(id)` (an id is never reused).
41
+ * A title with nothing to slug gets `<type>-<n>`, the lowest n free.
42
+ * @param {string} title
43
+ * @param {(id: string) => boolean} known
44
+ * @param {string} type
45
+ */
46
+ export function deriveId(title, known, type) {
47
+ const words = transliterate(title)
48
+ .split(/[^a-z0-9]+/)
49
+ .filter(Boolean)
50
+ .slice(0, ID_WORDS);
51
+ while (words.length > 1 && words.join('-').length > ID_CHARS) words.pop();
52
+ const base = words.join('-').slice(0, ID_CHARS).replace(/-+$/, '');
53
+ if (!base) {
54
+ let n = 1;
55
+ while (known(`${type}-${n}`)) n++;
56
+
57
+ return `${type}-${n}`;
58
+ }
59
+ let id = base;
60
+ for (let n = 2; known(id); n++) id = `${base}-${n}`;
61
+
62
+ return id;
63
+ }
64
+
18
65
  export function isValidId(id) {
19
66
  return ID_RE.test(String(id ?? ''));
20
67
  }