@llman-sdd/core 0.11.0 → 0.12.1

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 (112) hide show
  1. package/package.json +6 -3
  2. package/src/archive/freeze.ts +0 -13
  3. package/src/archive/frozenCard.ts +1 -10
  4. package/src/archive/ignoreChain.ts +2 -6
  5. package/src/archive/sevenzip.ts +0 -1
  6. package/src/change/closeOutHarness.ts +17 -0
  7. package/src/change/collect.ts +0 -5
  8. package/src/change/frontmatter.ts +15 -7
  9. package/src/change/id.ts +0 -2
  10. package/src/change/lifecycle.ts +1 -38
  11. package/src/config/changeId.ts +0 -2
  12. package/src/config/load.ts +0 -4
  13. package/src/config/schema.ts +24 -0
  14. package/src/git/spawnGit.ts +0 -3
  15. package/src/hints/jitHints.ts +82 -0
  16. package/src/index.ts +455 -3
  17. package/src/init/defaultConfig.ts +2 -0
  18. package/src/init/init.ts +61 -20
  19. package/src/init/uncommentConfig.ts +909 -0
  20. package/src/locale.ts +0 -2
  21. package/src/project/migrateNotes.ts +0 -9
  22. package/src/project/migrations.ts +70 -0
  23. package/src/report/graph/analysis.ts +0 -4
  24. package/src/report/graph/nodes.ts +0 -6
  25. package/src/report/show.ts +7 -23
  26. package/src/report/specHelpers.ts +10 -14
  27. package/src/review/review.ts +0 -12
  28. package/src/spec/assignSpecIds.ts +0 -3
  29. package/src/spec/authoring.ts +14 -26
  30. package/src/spec/ir.ts +14 -5
  31. package/src/spec/keywords.ts +0 -2
  32. package/src/spec/machineKey.ts +49 -0
  33. package/src/spec/migrateNative.ts +4 -18
  34. package/src/spec/parser.ts +10 -19
  35. package/src/spec/reqRef.ts +135 -0
  36. package/src/studio/changeScope.ts +50 -0
  37. package/src/studio/changeScopeDiff.ts +195 -0
  38. package/src/studio/contracts.ts +493 -0
  39. package/src/studio/decisionTree.ts +206 -0
  40. package/src/studio/deeplink.ts +116 -0
  41. package/src/studio/demos.ts +167 -0
  42. package/src/studio/diff.ts +494 -0
  43. package/src/studio/drift.ts +738 -0
  44. package/src/studio/extract.ts +360 -0
  45. package/src/studio/featureSync.ts +592 -0
  46. package/src/studio/forest.ts +570 -0
  47. package/src/studio/index.ts +32 -0
  48. package/src/studio/model.ts +254 -0
  49. package/src/studio/revisions.ts +476 -0
  50. package/src/studio/search.ts +337 -0
  51. package/src/studio/store.ts +811 -0
  52. package/src/studio/sync.ts +912 -0
  53. package/src/studio/textfold.ts +72 -0
  54. package/src/studio/time.ts +107 -0
  55. package/src/studio/validate.ts +363 -0
  56. package/src/templates/embedded.ts +4 -6
  57. package/src/templates/engine.ts +1 -1
  58. package/src/templates/skills.ts +71 -49
  59. package/src/theorems/guard.ts +52 -0
  60. package/src/theorems/index.ts +56 -0
  61. package/src/theorems/migrate.ts +133 -0
  62. package/src/theorems/schema.ts +67 -0
  63. package/src/theorems/scope.ts +68 -0
  64. package/src/theorems/serialize.ts +60 -0
  65. package/src/theorems/transactionMachine.ts +247 -0
  66. package/src/theorems/validate.ts +141 -0
  67. package/src/util/nextNumber.ts +0 -2
  68. package/src/validation/changeCheck.ts +0 -24
  69. package/src/validation/flowAndNesting.ts +434 -0
  70. package/src/validation/harness.ts +108 -65
  71. package/src/validation/validate.ts +26 -12
  72. package/src/validation/xstateTransitions.ts +483 -184
  73. package/templates/zh-Hans/llmanspec-agents-stub.md +17 -2
  74. package/templates/zh-Hans/skills/llman-sdd-autopilot/SKILL.md +34 -0
  75. package/templates/zh-Hans/skills/llman-sdd-change/SKILL.md +44 -0
  76. package/templates/zh-Hans/skills/llman-sdd-change/playbooks/archive.md +15 -0
  77. package/templates/zh-Hans/skills/llman-sdd-change/playbooks/draft.md +9 -0
  78. package/templates/zh-Hans/skills/llman-sdd-review/SKILL.md +71 -0
  79. package/templates/zh-Hans/skills/llman-sdd-specs/SKILL.md +70 -0
  80. package/templates/zh-Hans/skills/llman-sdd-specs/playbooks/compact.md +12 -0
  81. package/templates/zh-Hans/skills/llman-sdd-specs/playbooks/doctor.md +26 -0
  82. package/templates/zh-Hans/skills/llman-sdd-specs/references/graph-dsl.md +33 -0
  83. package/templates/zh-Hans/skills/llman-sdd-studio/SKILL.md +33 -0
  84. package/templates/zh-Hans/skills/llman-sdd-studio/playbooks/collab.md +20 -0
  85. package/templates/zh-Hans/skills/llman-sdd-studio/playbooks/drift.md +52 -0
  86. package/templates/zh-Hans/skills/llman-sdd-studio/playbooks/onboard.md +33 -0
  87. package/templates/zh-Hans/units/skills/cli-footer.md +2 -2
  88. package/templates/zh-Hans/agents-root-stub.md +0 -9
  89. package/templates/zh-Hans/skills/llman-sdd-apply-cycle.md +0 -69
  90. package/templates/zh-Hans/skills/llman-sdd-apply.md +0 -116
  91. package/templates/zh-Hans/skills/llman-sdd-arch-review.md +0 -58
  92. package/templates/zh-Hans/skills/llman-sdd-archive.md +0 -78
  93. package/templates/zh-Hans/skills/llman-sdd-continue.md +0 -34
  94. package/templates/zh-Hans/skills/llman-sdd-draft.md +0 -53
  95. package/templates/zh-Hans/skills/llman-sdd-explore.md +0 -63
  96. package/templates/zh-Hans/skills/llman-sdd-ff.md +0 -34
  97. package/templates/zh-Hans/skills/llman-sdd-graph.md +0 -56
  98. package/templates/zh-Hans/skills/llman-sdd-propose.md +0 -106
  99. package/templates/zh-Hans/skills/llman-sdd-quick.md +0 -40
  100. package/templates/zh-Hans/skills/llman-sdd-research.md +0 -35
  101. package/templates/zh-Hans/skills/llman-sdd-specs-compact.md +0 -42
  102. package/templates/zh-Hans/skills/llman-sdd-validate.md +0 -28
  103. package/templates/zh-Hans/skills/llman-sdd-verify.md +0 -77
  104. package/templates/zh-Hans/skills/llman-sdd-wayfinder.md +0 -83
  105. package/templates/zh-Hans/units/skills/ethics-governance.md +0 -6
  106. package/templates/zh-Hans/units/skills/git-native-flow.md +0 -56
  107. package/templates/zh-Hans/units/skills/human-readable-summary.md +0 -9
  108. package/templates/zh-Hans/units/skills/stage-guard.md +0 -17
  109. package/templates/zh-Hans/units/skills/structured-protocol.md +0 -19
  110. package/templates/zh-Hans/units/skills/validation-hints.md +0 -20
  111. package/templates/zh-Hans/units/skills/version-drift.md +0 -3
  112. package/templates/zh-Hans/units/spec/feature-contract.md +0 -8
package/src/index.ts CHANGED
@@ -52,6 +52,16 @@ export {
52
52
  type RegistryOccurrence,
53
53
  type ReqRegistry,
54
54
  } from './spec/reqRegistry.ts';
55
+ export {
56
+ REQ_ID_RE,
57
+ allocateNextReqId,
58
+ formatReqRef,
59
+ parseReqRef,
60
+ quoteScenarioName,
61
+ reqIdFromTag,
62
+ tokenizeReqRefs,
63
+ type ReqRef,
64
+ } from './spec/reqRef.ts';
55
65
  export {
56
66
  analyzeLegacy,
57
67
  hasNativeRules,
@@ -97,10 +107,26 @@ export type {
97
107
  } from './validation/validate.ts';
98
108
  export { validateAllSpecs, validateCapability } from './validation/validate.ts';
99
109
  export { buildDuplicatesFor, formatTotals } from './validation/validate.ts';
110
+ export { validateFlowAndNesting } from './validation/flowAndNesting.ts';
100
111
  export {
101
112
  TRANSITIONS_INTROSPECTION,
102
- isTransitionOutline,
103
- type TransitionDecision,
113
+ extractTransitions,
114
+ isJudgmentKind,
115
+ isNodesOutline,
116
+ parseNestRef,
117
+ resolveNodesColumns,
118
+ resolveFlowEdgeColumns,
119
+ resolveStateEdgeColumns,
120
+ resolveGraphScope,
121
+ FLOW_TAG,
122
+ STATE_TAG,
123
+ NODES_TAG,
124
+ DECISION_TABLE_TAG,
125
+ namedExitsInGraph,
126
+ validateDecisionScenario,
127
+ type EdgeColumnMap,
128
+ type NodesColumnMap,
129
+ type NestRef,
104
130
  type TransitionEdge,
105
131
  } from './validation/xstateTransitions.ts';
106
132
  export { splitVerb } from './config/changeId.ts';
@@ -135,7 +161,9 @@ export {
135
161
  export {
136
162
  expandRunCommand,
137
163
  runHarnessForSpecs,
164
+ type HarnessCommandKind,
138
165
  type HarnessGate,
166
+ type HarnessNamedCommand,
139
167
  type HarnessRunner,
140
168
  type HarnessRunOutcome,
141
169
  type HarnessTarget,
@@ -168,7 +196,11 @@ export {
168
196
  export { DRAFT_PROPOSAL_TEMPLATE, deriveChangeId } from './change/id.ts';
169
197
  export { parseTaskCheckboxes, type ParsedTaskCheckboxes } from './change/tasks.ts';
170
198
  export { CLOSE_OUT_TASK_HINT, closeOutTaskLines, isCloseOutTaskTitle } from './change/tasks.ts';
171
- export { decideCloseOutHarness, type CloseOutHarnessDecision } from './change/closeOutHarness.ts';
199
+ export {
200
+ decideCloseOutHarness,
201
+ decideCloseOutDangling,
202
+ type CloseOutHarnessDecision,
203
+ } from './change/closeOutHarness.ts';
172
204
  export {
173
205
  extractUniqueNumber,
174
206
  collectNumbers,
@@ -178,6 +210,7 @@ export {
178
210
  export { ChangeIdResolveError, resolveChangeId, type ResolvedChangeId } from './change/resolve.ts';
179
211
  export {
180
212
  CHANGES_DIR,
213
+ SPECS_DIR,
181
214
  LifecycleError,
182
215
  attachChange,
183
216
  changeDiff,
@@ -201,13 +234,16 @@ export {
201
234
  } from './templates/engine.ts';
202
235
  export {
203
236
  ETHICS_KEYS,
237
+ SKILL_PACKAGES,
204
238
  buildTemplateVars,
205
239
  enforceEthicsGovernance,
206
240
  loadLocaleResource,
207
241
  loadSkillTemplates,
208
242
  loadUnitRegistry,
209
243
  skillCandidates,
244
+ type SkillPackageSpec,
210
245
  type SkillTemplate,
246
+ type SkillTemplateFile,
211
247
  type TemplateIo,
212
248
  } from './templates/skills.ts';
213
249
  export {
@@ -225,7 +261,16 @@ export {
225
261
  updateFileWithMarkers,
226
262
  type InitIo,
227
263
  type InitResult,
264
+ type UncommentConfigOutcome,
228
265
  } from './init/init.ts';
266
+ export {
267
+ LLMAN_UNCOMMENT_EXCLUDES,
268
+ LLMAN_UNCOMMENT_PRESERVE_PATTERNS,
269
+ UNCOMMENT_CONFIG_CANDIDATES,
270
+ findUncommentConfig,
271
+ patchUncommentConfig,
272
+ type UncommentPatchResult,
273
+ } from './init/uncommentConfig.ts';
229
274
  export { checkSkillVersions, readSkillVersion, skillVersionCompatible } from './init/skillCheck.ts';
230
275
  export {
231
276
  changeTitle,
@@ -253,6 +298,7 @@ export {
253
298
  nextReqId,
254
299
  scaffoldSpec,
255
300
  skeletonContent,
301
+ usedReqIds,
256
302
  type SpecHelperIo,
257
303
  } from './report/specHelpers.ts';
258
304
  export {
@@ -331,3 +377,409 @@ export {
331
377
  type CompletionCommandSpec,
332
378
  type CompletionShell,
333
379
  } from './self/completion.ts';
380
+ export {
381
+ cloneMachineDraft,
382
+ cloneMachineIR,
383
+ makeMachineKey,
384
+ splitMachineKey,
385
+ nextPrefixedUid,
386
+ type DocDraftChangeKind,
387
+ type EdgeBendOffset,
388
+ type MachineDraft,
389
+ type MachineDraftMode,
390
+ type MachineTimeline,
391
+ type ParsedMachineKey,
392
+ type NodePosition,
393
+ type RevisionOp,
394
+ type SemanticAnchor,
395
+ type StudioComment,
396
+ type StudioDocDraft,
397
+ type StudioGraphKind,
398
+ type StudioMachineColumns,
399
+ type StudioMachineIR,
400
+ type StudioRevisionProposal,
401
+ type StudioStateDoc,
402
+ type StudioStateNode,
403
+ type StudioTransitionEdge,
404
+ type TimelineActor,
405
+ type TimelineEntry,
406
+ } from './studio/model.ts';
407
+ export {
408
+ createMachineDraft,
409
+ extractStudioMachines,
410
+ fillMissingExtractedMachines,
411
+ markMachineRemoved,
412
+ type CreateMachineDraftInput,
413
+ type ExtractedStudioMachine,
414
+ } from './studio/extract.ts';
415
+ export {
416
+ FLOWCHART_LINTER_RULES,
417
+ STUDIO_LINTER_RULES,
418
+ hasBlockingDiagnostics,
419
+ validateMachineGraph,
420
+ type DiagnosticFixKind,
421
+ type DiagnosticSeverity,
422
+ type DiagnosticTargetKind,
423
+ type MachineDiagnostic,
424
+ type StudioLinterRuleMeta,
425
+ } from './studio/validate.ts';
426
+ export {
427
+ computeMachineDiff,
428
+ computeWorldlineOverlayDiff,
429
+ formatSemanticDiff,
430
+ EDGE_ANNOTATION_FIELDS,
431
+ NODE_ANNOTATION_FIELDS,
432
+ isAnnotationField,
433
+ isAnnotationOnlyDiff,
434
+ isAnnotationOnlyEntry,
435
+ isAnnotationOnlyPatch,
436
+ type AnnotationEntity,
437
+ type NodeKindDiff,
438
+ type NodeMetaDiff,
439
+ type NodeMetaField,
440
+ type MachineSemanticDiff,
441
+ type NestLinkDiff,
442
+ type StateRenameDiff,
443
+ type TransitionChangedField,
444
+ type TransitionModifiedDiff,
445
+ type WorldlineOverlayDiff,
446
+ } from './studio/diff.ts';
447
+ export {
448
+ StudioRevisionError,
449
+ acceptRevisionProposal,
450
+ addStudioComment,
451
+ applyRevisionOpsToMachine,
452
+ deleteStudioComment,
453
+ editStudioComment,
454
+ previewRevisionProposal,
455
+ proposeRevision,
456
+ rejectRevisionProposal,
457
+ reopenStudioComment,
458
+ replyStudioComment,
459
+ resolveStudioComment,
460
+ commentWatchTag,
461
+ setStudioCommentWatchTag,
462
+ type AddCommentInput,
463
+ type ProposeRevisionInput,
464
+ type RevisionPreviewResult,
465
+ } from './studio/revisions.ts';
466
+ export {
467
+ STUDIO_STATES_REL,
468
+ StudioStateError,
469
+ applyAllocatedReqIds,
470
+ buildInitialTimeline,
471
+ planStudioApply,
472
+ createStudioStateDoc,
473
+ deleteStudioState,
474
+ listStudioStates,
475
+ parseStudioStateDoc,
476
+ previewTimelineEntry,
477
+ readStudioState,
478
+ recordTimelineCommit,
479
+ recordWorldlineCommit,
480
+ redoTimeline,
481
+ rollbackTimeline,
482
+ studioStateDocSchema,
483
+ studioStateRelPath,
484
+ switchWorldlineHead,
485
+ undoTimeline,
486
+ validateStateId,
487
+ writeStudioState,
488
+ type AllocatedReqId,
489
+ type CreateStudioStateDocInput,
490
+ type StudioApplyPlan,
491
+ type StudioStateIo,
492
+ type StudioStateSummary,
493
+ } from './studio/store.ts';
494
+ export {
495
+ STUDIO_FOCUS_KINDS,
496
+ formatStudioDeepLinkQuery,
497
+ formatStudioFocusToken,
498
+ formatStudioNestToken,
499
+ nestLevelLabel,
500
+ nestPathFromStack,
501
+ nestStackFromPath,
502
+ parseStudioDeepLink,
503
+ parseStudioFocusToken,
504
+ parseStudioNestToken,
505
+ type StudioDeepLink,
506
+ type StudioDeepLinkFocus,
507
+ type StudioFocusKind,
508
+ } from './studio/deeplink.ts';
509
+ export {
510
+ buildDemoJobRunnerDraft,
511
+ buildDemoReimbursementDraft,
512
+ buildDemoStudioDrafts,
513
+ buildDemoStudioWebDrafts,
514
+ mergeDemoDraftsWithExtracted,
515
+ } from './studio/demos.ts';
516
+ export {
517
+ compileDecisionTableToTree,
518
+ detectConvertibleStructure,
519
+ extractDecisionTables,
520
+ type ConvertibleStructureHint,
521
+ type DecisionTreeEdge,
522
+ type DecisionTreeGraph,
523
+ type DecisionTreeNode,
524
+ type StudioDecisionTable,
525
+ } from './studio/decisionTree.ts';
526
+ export { foldFeatureAst, foldPlainText, type TextfoldLevels } from './studio/textfold.ts';
527
+ export {
528
+ EMPTY_CHANGE_SCOPE,
529
+ resolveChangeScopeActivation,
530
+ type ChangeScopeActivationDecision,
531
+ type ChangeScopeActivationInput,
532
+ type StudioScopeViewMode,
533
+ } from './studio/changeScope.ts';
534
+ export {
535
+ computeFeatureChangeDiff,
536
+ type FeatureChangeDiffResult,
537
+ } from './studio/changeScopeDiff.ts';
538
+ export {
539
+ bootstrapResponseSchema,
540
+ convertibleHintSchema,
541
+ decisionTreeEdgeSchema,
542
+ decisionTreeNodeSchema,
543
+ exportProposalRequestSchema,
544
+ exportProposalResponseSchema,
545
+ healthResponseSchema,
546
+ hubInfoSchema,
547
+ previewDiffResponseSchema,
548
+ putLayoutRequestSchema,
549
+ putStateRequestSchema,
550
+ putStateResponseSchema,
551
+ putViewsRequestSchema,
552
+ registerWorkspaceRequestSchema,
553
+ specDetailResponseSchema,
554
+ specIndexEdgeSchema,
555
+ specIndexItemSchema,
556
+ specRuleItemSchema,
557
+ studioChangeItemStatusSchema,
558
+ studioChangeScopeSchema,
559
+ studioDecisionTableSchema,
560
+ studioDeepLinkJsonSchema,
561
+ studioFocusContextSchema,
562
+ studioFocusObjectSchema,
563
+ studioGraphKindSchema,
564
+ studioSpecKindSchema,
565
+ studioSseEventSchema,
566
+ studioTouchedSpecSchema,
567
+ textfoldRequestSchema,
568
+ textfoldResponseSchema,
569
+ verificationHardnessSchema,
570
+ viewsResponseSchema,
571
+ workspaceItemSchema,
572
+ workspacesResponseSchema,
573
+ type BootstrapResponse,
574
+ type ExportProposalRequest,
575
+ type ExportProposalResponse,
576
+ type HealthResponse,
577
+ type HubInfo,
578
+ type PreviewDiffResponse,
579
+ type PutLayoutRequest,
580
+ type PutStateRequest,
581
+ type PutStateResponse,
582
+ type PutViewsRequest,
583
+ type RegisterWorkspaceRequest,
584
+ type SpecDetailResponse,
585
+ type SpecIndexEdge,
586
+ type SpecIndexItem,
587
+ type SpecRuleItem,
588
+ type StudioChangeItemStatus,
589
+ type StudioChangeScope,
590
+ type StudioDecisionTableDto,
591
+ type StudioDeepLinkJson,
592
+ type StudioFocusContext,
593
+ type StudioFocusObject,
594
+ type StudioSseEvent,
595
+ type StudioTouchedSpec,
596
+ type TextfoldRequest,
597
+ type TextfoldResponse,
598
+ type ViewsResponse,
599
+ type WorkspaceItem,
600
+ type WorkspacesResponse,
601
+ studioSearchHitSchema,
602
+ studioSearchRequestSchema,
603
+ studioSearchResponseSchema,
604
+ studioSearchTargetKindSchema,
605
+ studioTheoremSchema,
606
+ theoremProtectionSummarySchema,
607
+ type StudioSearchHit,
608
+ type StudioSearchRequest,
609
+ type StudioSearchResponse,
610
+ type StudioTheoremDto,
611
+ type TheoremProtectionSummary,
612
+ syncApplyRequestSchema,
613
+ syncApplyResponseSchema,
614
+ syncItemSchema,
615
+ syncPickSchema,
616
+ syncPreviewResponseSchema,
617
+ type SyncApplyRequest,
618
+ type SyncApplyResponse,
619
+ type SyncItemDto,
620
+ type SyncPickDto,
621
+ type SyncPreviewResponse,
622
+ } from './studio/contracts.ts';
623
+ export {
624
+ SYNC_BOTH_BLOCKED_REASON,
625
+ SYNC_SNAPSHOT_BRANCH_REF,
626
+ SYNC_SNAPSHOT_LABEL,
627
+ applyDocSyncPicks,
628
+ applySyncPicks,
629
+ buildDocSyncItems,
630
+ buildSyncItems,
631
+ closeAllSyncSnapshots,
632
+ closeSyncSnapshot,
633
+ hasOpenSyncSnapshot,
634
+ machineIrSemanticallyEquivalent,
635
+ machineDomainEquals,
636
+ picksMatchDiff,
637
+ snapshotBeforeSync,
638
+ type ApplyDocSyncPicksResult,
639
+ type ApplySyncPicksResult,
640
+ type SyncItem,
641
+ type SyncItemKind,
642
+ type SyncPick,
643
+ type SyncTransitionPayload,
644
+ } from './studio/sync.ts';
645
+ export {
646
+ formatStudioDateTime,
647
+ partitionTimelineEntries,
648
+ pruneTimelineEntries,
649
+ pruneStudioTimelines,
650
+ } from './studio/time.ts';
651
+ export {
652
+ THEOREM_CONFIRM_STATE,
653
+ THEOREM_ID_RE,
654
+ THEOREM_LEGACY_LOCK_FILE,
655
+ THEOREM_LOCK_STRENGTHS,
656
+ THEOREM_TRANSACTION_FINAL_STATES,
657
+ THEOREM_TRANSACTION_SPEC_STATES,
658
+ THEOREMS_DIR_REL,
659
+ TheoremDocumentSchema,
660
+ TheoremSeveritySchema,
661
+ TheoremStatusSchema,
662
+ TheoremVerifySchema,
663
+ compileScopeGlob,
664
+ discoverTheoremFiles,
665
+ evaluateTheoremGuard,
666
+ findLegacyTheoremFiles,
667
+ isSingleTheoremDocument,
668
+ migrateLegacyTheoremMarkdown,
669
+ normalizeTheoremPath,
670
+ renderTheoremUnifiedDiff,
671
+ renderTheoremYaml,
672
+ selectTheoremsByTag,
673
+ selectTheoremsForPaths,
674
+ theoremMatchesPath,
675
+ theoremTransactionMachine,
676
+ validateTheoremSet,
677
+ yamlBlock,
678
+ yamlScalar,
679
+ type MigratedTheorem,
680
+ type TheoremDiscoverIo,
681
+ type TheoremDocument,
682
+ type TheoremEntry,
683
+ type TheoremGuardDecision,
684
+ type TheoremGuardInput,
685
+ type TheoremGuardScenario,
686
+ type TheoremGuardVerdict,
687
+ type TheoremIssue,
688
+ type TheoremLockStrength,
689
+ type TheoremMigrationResult,
690
+ type TheoremSeverity,
691
+ type TheoremSourceFile,
692
+ type TheoremStatus,
693
+ type TheoremTransactionActors,
694
+ type TheoremTransactionContext,
695
+ type TheoremTransactionEvent,
696
+ type TheoremTransactionSpecState,
697
+ type TheoremValidationResult,
698
+ type TheoremVerify,
699
+ } from './theorems/index.ts';
700
+ export {
701
+ buildWorkspaceSearchDocuments,
702
+ extractHighlightSnippet,
703
+ searchWorkspaceBm25,
704
+ tokenizeSearchText,
705
+ type SearchableSpecInput,
706
+ type StudioSearchTargetKind,
707
+ type WorkspaceSearchDocument,
708
+ type WorkspaceSearchHit,
709
+ } from './studio/search.ts';
710
+ export {
711
+ STUDIO_VIEWS_REL,
712
+ StudioViewsError,
713
+ buildForestGraph,
714
+ computeCrossForestBridges,
715
+ defaultStudioViewsDoc,
716
+ forestEdgeEvidenceSchema,
717
+ parseStudioViewsDoc,
718
+ readStudioViews,
719
+ studioManualGroupSchema,
720
+ studioManualLinkSchema,
721
+ studioTabViewSchema,
722
+ studioViewsDocSchema,
723
+ validateForestIsolation,
724
+ writeStudioViews,
725
+ type CrossForestBridgeItem,
726
+ type CrossForestBridgeResult,
727
+ type ForestDiagnostic,
728
+ type ForestEdge,
729
+ type ForestEdgeEvidence,
730
+ type ForestGraph,
731
+ type ForestGroupSpec,
732
+ type ForestNode,
733
+ type ForestNodeKind,
734
+ type StudioManualGroup,
735
+ type StudioManualLink,
736
+ type StudioTabView,
737
+ type StudioViewsDoc,
738
+ type StudioViewsIo,
739
+ } from './studio/forest.ts';
740
+ export {
741
+ StudioSyncError,
742
+ buildProposalDraft,
743
+ previewFeatureUnifiedDiff,
744
+ renderUpdatedFeatureSource,
745
+ type BuildProposalDraftInput,
746
+ type RenderFeatureOptions,
747
+ } from './studio/featureSync.ts';
748
+ export {
749
+ applyDriftProposalsToStateDoc,
750
+ buildDriftRevisionProposals,
751
+ buildDriftSlicePacket,
752
+ parseRuntimeTraceJsonl,
753
+ parseUnifiedDiffHunks,
754
+ reconcileRuntimeTrace,
755
+ runtimeTraceEventSchema,
756
+ scanLlmanspecAnchors,
757
+ type DriftDiffFileInput,
758
+ type DriftImpactedSpec,
759
+ type DriftMatchedFileSlice,
760
+ type DriftRevisionProposalDraft,
761
+ type DriftSlicePacket,
762
+ type LlmanspecAnchorMatch,
763
+ type ParseRuntimeTraceResult,
764
+ type ParsedDiffFile,
765
+ type ParsedRuntimeTraceEvent,
766
+ type RuntimeTraceEvent,
767
+ type RuntimeTraceParseError,
768
+ type RuntimeTraceReconcileResult,
769
+ type ShadowTransitionFinding,
770
+ type UncoveredTransitionFinding,
771
+ type UnifiedDiffHunk,
772
+ type UnknownMachineFinding,
773
+ } from './studio/drift.ts';
774
+ export {
775
+ formatCliHint,
776
+ hintForChangeNew,
777
+ hintForChangeStart,
778
+ hintForStudioDiagnostic,
779
+ hintForValidateCheckPass,
780
+ hintForValidationIssue,
781
+ shouldEmitCliHint,
782
+ type CliHint,
783
+ type CliHintKind,
784
+ type HintOutputMode,
785
+ } from './hints/jitHints.ts';
@@ -21,6 +21,8 @@ locale: zh-Hans
21
21
  # # check_command: "pytest {feature_dir} -k {feature_name} -v"
22
22
  # # 项目级 runner(无占位符):validate --all/--specs 整批只跑一次(batch-once)。
23
23
  # # check_command: "cargo test --features bdd"
24
+ # # check_dangling_bdd_command: "cargo bdd unused"
25
+ # # check_dangling_bdd_command: "cucumber --dry-run --format usage"
24
26
  # # verify_prompt: |
25
27
  # # 将测试失败映射到对应的 requirement ID。
26
28
  `;
package/src/init/init.ts CHANGED
@@ -26,6 +26,11 @@ import {
26
26
  } from '../templates/skills.ts';
27
27
  import { type FsPort } from '../util/fsPort.ts';
28
28
  import { DEFAULT_CONFIGS, LLMANSPEC_SCHEMA_URL, prependSchemaHeader } from './defaultConfig.ts';
29
+ import {
30
+ findUncommentConfig,
31
+ patchUncommentConfig,
32
+ type UncommentPatchResult,
33
+ } from './uncommentConfig.ts';
29
34
 
30
35
  const MARKER_START = '<!-- LLMANSPEC:START -->';
31
36
  const MARKER_END = '<!-- LLMANSPEC:END -->';
@@ -147,6 +152,16 @@ export interface InitResult {
147
152
  /** llman-sdd-* directories removed by --update namespace cleanup. */
148
153
  removed: string[];
149
154
  configPath: string;
155
+ /** Outcome of the idempotent uncomment-config patch (absent when no config file exists). */
156
+ uncomment?: UncommentConfigOutcome;
157
+ }
158
+
159
+ export interface UncommentConfigOutcome {
160
+ path: string;
161
+ changed: boolean;
162
+ addedPreserve: string[];
163
+ addedExclude: string[];
164
+ warning?: string;
150
165
  }
151
166
 
152
167
  const SKILLS_BASE = '.agents/skills';
@@ -186,12 +201,12 @@ export function runInit(
186
201
  locale?: string;
187
202
  version: string;
188
203
  skills: boolean;
204
+ uncomment?: boolean;
189
205
  onWarning?: (message: string) => void;
190
206
  },
191
207
  ): InitResult {
192
208
  io.mkdirp('llmanspec');
193
209
 
194
- // 1) config: create with defaults if missing, then always load.
195
210
  const configPath = 'llmanspec/config.yaml';
196
211
  const configExisted = io.exists(configPath);
197
212
  if (!configExisted) writeDefaultConfig(io, opts.locale ?? DEFAULT_LOCALE);
@@ -202,11 +217,11 @@ export function runInit(
202
217
  opts.onWarning,
203
218
  );
204
219
 
205
- // 1b) scaffold-state stamp: record the rendering version for drift notices
206
- // (version-awareness). Corrupt/missing state on later reads is silent-OK.
207
220
  writeSddState(io, opts.version);
208
221
 
209
- // 2) scaffold directories.
222
+ const uncomment =
223
+ opts.uncomment === false ? undefined : patchExistingUncommentConfig(io, opts.onWarning);
224
+
210
225
  io.mkdirp(SPECS_DIR);
211
226
  io.mkdirp(`${CHANGES_DIR}/archive`);
212
227
  if (!io.exists('llmanspec/specs/.gitkeep')) io.writeText('llmanspec/specs/.gitkeep', '');
@@ -214,18 +229,15 @@ export function runInit(
214
229
  io.writeText(`${CHANGES_DIR}/archive/.gitkeep`, '');
215
230
  }
216
231
 
217
- // 3) llmanspec/AGENTS.md managed block; strip a root AGENTS.md block if present.
218
232
  writeManagedBlocks(io, templates, config, opts.version);
219
233
  const vars = buildTemplateVars(config, opts.version);
220
234
  const skillTemplates = loadSkillTemplates(templates, TEMPLATES_ROOT, config, vars);
221
235
  enforceEthicsGovernance(skillTemplates);
222
236
 
223
- // 4) skills namespace cleanup (--update only): remove llman-sdd-* dirs
224
- // outside the candidate set; un-prefixed custom skills stay untouched.
225
237
  const removed: string[] = [];
226
238
  if (opts.skills && opts.update && io.exists(SKILLS_BASE)) {
227
- const candidates = new Set(skillCandidates(config).map((f) => f.replace(/\.md$/u, '')));
228
- for (const entry of io.listDir(SKILLS_BASE)) {
239
+ const candidates = new Set(skillCandidates(config));
240
+ for (const entry of io.listDir(SKILLS_BASE).toSorted()) {
229
241
  if (entry.startsWith('llman-sdd-') && !candidates.has(entry)) {
230
242
  io.removeDir(`${SKILLS_BASE}/${entry}`);
231
243
  removed.push(entry);
@@ -233,24 +245,53 @@ export function runInit(
233
245
  }
234
246
  }
235
247
 
236
- // 5) write candidates: rendered product trimmed + single trailing newline.
237
- // Sub-root instances default to no skills injection (r93): the agent skill
238
- // surface stays at the repo root and sub-root navigation lives in the
239
- // managed blocks; --skills opts a sub-root in.
240
248
  if (!opts.skills) {
241
- return { skills: [], removed, configPath };
249
+ return { skills: [], removed, configPath, ...(uncomment === undefined ? {} : { uncomment }) };
242
250
  }
243
251
  for (const t of skillTemplates) {
244
- const dirName = t.name.replace(/\.md$/u, '');
245
- io.mkdirp(`${SKILLS_BASE}/${dirName}`);
246
- io.writeText(`${SKILLS_BASE}/${dirName}/SKILL.md`, `${t.content.trimEnd()}\n`);
252
+ const dirName = t.name;
253
+ const skillDir = `${SKILLS_BASE}/${dirName}`;
254
+ if (opts.update && io.exists(skillDir)) {
255
+ io.removeDir(skillDir);
256
+ }
257
+ io.mkdirp(skillDir);
258
+ io.writeText(`${skillDir}/SKILL.md`, `${t.content.trimEnd()}\n`);
259
+ for (const nested of t.files) {
260
+ const target = `${skillDir}/${nested.relativePath}`;
261
+ const slashIdx = target.lastIndexOf('/');
262
+ if (slashIdx > 0) io.mkdirp(target.slice(0, slashIdx));
263
+ io.writeText(target, `${nested.content.trimEnd()}\n`);
264
+ }
247
265
  if (MANUAL_INVOCATION_SKILLS.includes(dirName)) {
248
- io.mkdirp(`${SKILLS_BASE}/${dirName}/agents`);
249
- io.writeText(`${SKILLS_BASE}/${dirName}/agents/openai.yaml`, OPENAI_EXPLICIT_POLICY);
266
+ io.mkdirp(`${skillDir}/agents`);
267
+ io.writeText(`${skillDir}/agents/openai.yaml`, OPENAI_EXPLICIT_POLICY);
250
268
  }
251
269
  }
252
270
 
253
- return { skills: skillTemplates.map((t) => t.name.replace(/\.md$/u, '')), removed, configPath };
271
+ return {
272
+ skills: skillTemplates.map((t) => t.name),
273
+ removed,
274
+ configPath,
275
+ ...(uncomment === undefined ? {} : { uncomment }),
276
+ };
277
+ }
278
+
279
+ function patchExistingUncommentConfig(
280
+ io: InitIo,
281
+ onWarning: ((message: string) => void) | undefined,
282
+ ): UncommentConfigOutcome | undefined {
283
+ const path = findUncommentConfig((candidate) => io.exists(candidate));
284
+ if (path === null) return undefined;
285
+ const patched: UncommentPatchResult = patchUncommentConfig(io.readText(path));
286
+ if (patched.warning !== undefined) onWarning?.(`WARNING: ${path}: ${patched.warning}`);
287
+ if (patched.changed) io.writeText(path, patched.content);
288
+ return {
289
+ path,
290
+ changed: patched.changed,
291
+ addedPreserve: patched.addedPreserve,
292
+ addedExclude: patched.addedExclude,
293
+ ...(patched.warning === undefined ? {} : { warning: patched.warning }),
294
+ };
254
295
  }
255
296
 
256
297
  /**