@open-agent-toolkit/cli 0.3.7 → 0.3.9

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 (147) hide show
  1. package/README.md +3 -3
  2. package/assets/agents/oat-codebase-mapper.md +3 -2
  3. package/assets/agents/oat-reviewer.md +5 -13
  4. package/assets/agents/skeptical-evaluator.md +6 -2
  5. package/assets/bundle-metadata.json +1 -1
  6. package/assets/docs/cli-utilities/backlog-lifecycle.md +3 -2
  7. package/assets/docs/cli-utilities/bootstrap.md +5 -2
  8. package/assets/docs/cli-utilities/config-and-local-state.md +13 -6
  9. package/assets/docs/cli-utilities/configuration.md +25 -10
  10. package/assets/docs/cli-utilities/tool-packs.md +60 -10
  11. package/assets/docs/cli-utilities/workflow-gates.md +37 -0
  12. package/assets/docs/contributing/code.md +9 -5
  13. package/assets/docs/provider-sync/commands.md +17 -8
  14. package/assets/docs/provider-sync/instruction-sync.md +241 -39
  15. package/assets/docs/provider-sync/providers.md +20 -0
  16. package/assets/docs/provider-sync/scope-and-surface.md +3 -1
  17. package/assets/docs/reference/cli-reference.md +4 -1
  18. package/assets/docs/reference/oat-directory-structure.md +12 -11
  19. package/assets/docs/reference/troubleshooting.md +19 -4
  20. package/assets/docs/workflows/projects/evidence-layers.md +5 -1
  21. package/assets/docs/workflows/projects/implementation-execution.md +22 -8
  22. package/assets/docs/workflows/projects/lifecycle.md +4 -6
  23. package/assets/docs/workflows/projects/retro.md +7 -0
  24. package/assets/public-package-versions.json +4 -4
  25. package/assets/skills/oat-agent-instructions-analyze/SKILL.md +4 -4
  26. package/assets/skills/oat-agent-instructions-analyze/references/analysis-artifact-template.md +5 -5
  27. package/assets/skills/oat-agent-instructions-analyze/references/docs/rules-files.md +14 -11
  28. package/assets/skills/oat-agent-instructions-analyze/references/quality-checklist.md +2 -2
  29. package/assets/skills/oat-agent-instructions-analyze/scripts/resolve-instruction-files.sh +4 -3
  30. package/assets/skills/oat-agent-instructions-analyze/scripts/resolve-providers.sh +17 -6
  31. package/assets/skills/oat-agent-instructions-apply/SKILL.md +3 -3
  32. package/assets/skills/oat-agent-instructions-apply/references/docs/rules-files.md +14 -11
  33. package/assets/skills/oat-dispatch-subagents/SKILL.md +1 -1
  34. package/assets/skills/oat-dispatch-subagents/references/managed-claude-example.json +387 -0
  35. package/assets/skills/oat-dispatch-subagents/references/record-schema.md +75 -0
  36. package/assets/skills/oat-doctor/SKILL.md +17 -13
  37. package/assets/skills/oat-project-autonomous/references/gate-inventory.md +1 -1
  38. package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +1 -1
  39. package/assets/skills/oat-project-implement/SKILL.md +2 -2
  40. package/assets/skills/oat-project-implement/references/completion-and-closeout.md +33 -11
  41. package/assets/skills/oat-project-implement/references/dispatch-and-dry-run.md +24 -22
  42. package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +1 -1
  43. package/assets/skills/oat-project-implement/references/phase-execution.md +109 -8
  44. package/assets/skills/oat-project-lite/SKILL.md +23 -1
  45. package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +1 -1
  46. package/assets/skills/oat-project-next/SKILL.md +3 -3
  47. package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +1 -1
  48. package/assets/skills/oat-project-progress/SKILL.md +2 -2
  49. package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +1 -1
  50. package/assets/skills/oat-project-retro/SKILL.md +70 -6
  51. package/assets/skills/oat-project-review-provide/SKILL.md +3 -1
  52. package/assets/skills/oat-project-review-provide-remote/SKILL.md +3 -1
  53. package/assets/templates/docs-app-mkdocs/docs/contributing.md +1 -3
  54. package/assets/templates/pjm-agents.md +7 -3
  55. package/assets/templates/state.md +2 -2
  56. package/dist/agents/canonical/resolve.d.ts +6 -4
  57. package/dist/agents/canonical/resolve.d.ts.map +1 -1
  58. package/dist/agents/canonical/resolve.js +6 -4
  59. package/dist/commands/backlog/archive.d.ts +10 -2
  60. package/dist/commands/backlog/archive.d.ts.map +1 -1
  61. package/dist/commands/backlog/archive.js +22 -6
  62. package/dist/commands/backlog/index.d.ts.map +1 -1
  63. package/dist/commands/backlog/index.js +5 -1
  64. package/dist/commands/backlog/rewrite-references.d.ts +41 -0
  65. package/dist/commands/backlog/rewrite-references.d.ts.map +1 -0
  66. package/dist/commands/backlog/rewrite-references.js +516 -0
  67. package/dist/commands/config/index.d.ts +1 -0
  68. package/dist/commands/config/index.d.ts.map +1 -1
  69. package/dist/commands/config/index.js +69 -34
  70. package/dist/commands/gate/index.d.ts.map +1 -1
  71. package/dist/commands/gate/index.js +51 -2
  72. package/dist/commands/gate/review-verdict.d.ts +22 -0
  73. package/dist/commands/gate/review-verdict.d.ts.map +1 -1
  74. package/dist/commands/gate/review-verdict.js +111 -0
  75. package/dist/commands/init/index.d.ts +6 -0
  76. package/dist/commands/init/index.d.ts.map +1 -1
  77. package/dist/commands/init/index.js +27 -4
  78. package/dist/commands/init/tools/index.d.ts +18 -1
  79. package/dist/commands/init/tools/index.d.ts.map +1 -1
  80. package/dist/commands/init/tools/index.js +84 -17
  81. package/dist/commands/init/tools/project-guidance.d.ts +19 -4
  82. package/dist/commands/init/tools/project-guidance.d.ts.map +1 -1
  83. package/dist/commands/init/tools/project-guidance.js +58 -15
  84. package/dist/commands/init/tools/workflows/index.d.ts.map +1 -1
  85. package/dist/commands/init/tools/workflows/index.js +5 -1
  86. package/dist/commands/instructions/instructions.types.d.ts +105 -4
  87. package/dist/commands/instructions/instructions.types.d.ts.map +1 -1
  88. package/dist/commands/instructions/instructions.types.js +4 -5
  89. package/dist/commands/instructions/instructions.utils.d.ts +161 -6
  90. package/dist/commands/instructions/instructions.utils.d.ts.map +1 -1
  91. package/dist/commands/instructions/instructions.utils.js +650 -12
  92. package/dist/commands/instructions/sync/sync.d.ts.map +1 -1
  93. package/dist/commands/instructions/sync/sync.js +256 -18
  94. package/dist/commands/instructions/validate/validate.d.ts.map +1 -1
  95. package/dist/commands/instructions/validate/validate.js +36 -8
  96. package/dist/commands/pjm/index.d.ts.map +1 -1
  97. package/dist/commands/pjm/index.js +19 -4
  98. package/dist/commands/pjm/init.d.ts +3 -0
  99. package/dist/commands/pjm/init.d.ts.map +1 -1
  100. package/dist/commands/pjm/init.js +23 -5
  101. package/dist/commands/project/dispatch/canonical-role.d.ts +33 -0
  102. package/dist/commands/project/dispatch/canonical-role.d.ts.map +1 -0
  103. package/dist/commands/project/dispatch/canonical-role.js +114 -0
  104. package/dist/commands/project/dispatch/index.d.ts.map +1 -1
  105. package/dist/commands/project/dispatch/index.js +3 -1
  106. package/dist/commands/project/dispatch/record.d.ts.map +1 -1
  107. package/dist/commands/project/dispatch/record.js +146 -4
  108. package/dist/commands/shared/agents-md.d.ts +26 -5
  109. package/dist/commands/shared/agents-md.d.ts.map +1 -1
  110. package/dist/commands/shared/agents-md.js +182 -3
  111. package/dist/commands/sync/apply.d.ts.map +1 -1
  112. package/dist/commands/sync/apply.js +28 -21
  113. package/dist/commands/tools/guidance/index.d.ts +15 -0
  114. package/dist/commands/tools/guidance/index.d.ts.map +1 -0
  115. package/dist/commands/tools/guidance/index.js +81 -0
  116. package/dist/commands/tools/index.d.ts.map +1 -1
  117. package/dist/commands/tools/index.js +2 -0
  118. package/dist/commands/tools/shared/sync-evidence.d.ts.map +1 -1
  119. package/dist/commands/tools/shared/sync-evidence.js +32 -5
  120. package/dist/config/oat-config.d.ts +57 -3
  121. package/dist/config/oat-config.d.ts.map +1 -1
  122. package/dist/config/oat-config.js +223 -15
  123. package/dist/config/resolve.d.ts.map +1 -1
  124. package/dist/config/resolve.js +12 -2
  125. package/dist/engine/compute-plan.d.ts.map +1 -1
  126. package/dist/engine/compute-plan.js +31 -3
  127. package/dist/providers/claude/dispatch-envelope.d.ts +53 -0
  128. package/dist/providers/claude/dispatch-envelope.d.ts.map +1 -1
  129. package/dist/providers/claude/dispatch-envelope.js +324 -48
  130. package/dist/providers/claude/rule-transform.js +1 -1
  131. package/dist/providers/copilot/rule-transform.js +1 -1
  132. package/dist/providers/cursor/rule-transform.js +1 -1
  133. package/dist/providers/identity/absolute-paths.d.ts +13 -0
  134. package/dist/providers/identity/absolute-paths.d.ts.map +1 -1
  135. package/dist/providers/identity/absolute-paths.js +27 -14
  136. package/dist/providers/identity/generic-dispatch-record.d.ts +212 -0
  137. package/dist/providers/identity/generic-dispatch-record.d.ts.map +1 -1
  138. package/dist/providers/identity/generic-dispatch-record.js +78 -19
  139. package/dist/providers/identity/oat-dispatch-record.d.ts +5 -0
  140. package/dist/providers/identity/oat-dispatch-record.d.ts.map +1 -1
  141. package/dist/providers/identity/oat-dispatch-record.js +11 -2
  142. package/dist/providers/shared/registry.d.ts +6 -0
  143. package/dist/providers/shared/registry.d.ts.map +1 -1
  144. package/dist/providers/shared/registry.js +30 -0
  145. package/dist/rules/canonical/parse.d.ts.map +1 -1
  146. package/dist/rules/canonical/parse.js +38 -3
  147. package/package.json +2 -2
@@ -12,7 +12,7 @@ import { normalizeDispatchMatrix, validateDispatchRouteTarget, walkDispatchMatri
12
12
  import { formatDispatchNotices, terminalReviewerNoticesForMatrix, } from '../../config/dispatch-notices.js';
13
13
  import { dispatchPolicyModeDescription, dispatchPolicyPolicyDescription, managedDispatchPolicyValueList, } from '../../config/dispatch-policy-options.js';
14
14
  import { parseJsonConfig } from '../../config/json.js';
15
- import { VALID_DISPATCH_POLICY_MODES, VALID_MANAGED_DISPATCH_POLICIES, MAX_GATE_TIMEOUT_MS, MIN_GATE_TIMEOUT_MS, isValidGateTimeoutMs, normalizeWorkflowPostImplementSequence, readOatConfig, readOatConfigForDefaultScopeRepair, readOatConfigForDocumentationExcludesRepair, readOatConfigForInstructionPointerExcludesRepair, readOatConfigWithWarnings, readOatLocalConfig, readUserConfig, writeOatConfig, writeOatLocalConfig, writeUserConfig, VALID_POST_IMPLEMENT_LEGACY_SEQUENCES, } from '../../config/oat-config.js';
15
+ import { DEFAULT_INSTRUCTION_SYNC_STRATEGY, INSTRUCTION_SYNC_STRATEGIES, VALID_DISPATCH_POLICY_MODES, VALID_MANAGED_DISPATCH_POLICIES, MAX_GATE_TIMEOUT_MS, MIN_GATE_TIMEOUT_MS, isValidGateTimeoutMs, normalizeWorkflowPostImplementSequence, readOatConfig, readOatConfigForDefaultScopeRepair, readOatConfigForDocumentationExcludesRepair, readOatConfigForInstructionPointerExcludesRepair, readOatConfigForInstructionSyncStrategyRepair, readOatConfigWithWarnings, readOatLocalConfig, readUserConfig, writeOatConfig, writeOatLocalConfig, writeUserConfig, VALID_POST_IMPLEMENT_LEGACY_SEQUENCES, } from '../../config/oat-config.js';
16
16
  import { getOwnKey, setOwnKey } from '../../config/own-keys.js';
17
17
  import { resolveEffectiveConfig, resolveEnvOverride, } from '../../config/resolve.js';
18
18
  import { resolveAssetsRoot } from '../../fs/assets.js';
@@ -71,13 +71,14 @@ const KEY_ORDER = [
71
71
  'documentation.tooling',
72
72
  'documentation.config',
73
73
  'documentation.excludes',
74
- 'documentation.instructionPointerExcludes',
75
74
  'documentation.requireForProjectCompletion',
76
75
  'explainers.defaults.style',
77
76
  'explainers.defaults.palette',
78
77
  'explainers.defaults.visualProfile',
79
78
  'explainers.defaults.themeBundlePath',
80
79
  'git.defaultBranch',
80
+ 'instructions.claude.shims',
81
+ 'instructions.claude.excludes',
81
82
  'projects.root',
82
83
  'projects.defaultScope',
83
84
  ...PJM_REMOTE_CONFIG_KEYS,
@@ -200,6 +201,28 @@ const CONFIG_CATALOG = [
200
201
  owningCommand: 'oat config set git.defaultBranch <value>',
201
202
  description: 'Default branch used by lifecycle PR flows when base branch auto-detection is unavailable.',
202
203
  },
204
+ {
205
+ key: 'instructions.claude.shims',
206
+ group: 'Shared Repo (.oat/config.json)',
207
+ file: '.oat/config.json',
208
+ scope: 'shared repo',
209
+ type: 'enum',
210
+ defaultValue: DEFAULT_INSTRUCTION_SYNC_STRATEGY,
211
+ mutability: 'read/write',
212
+ owningCommand: `oat config set instructions.claude.shims <${INSTRUCTION_SYNC_STRATEGIES.join('|')}>`,
213
+ description: 'How `oat instructions sync` keeps a CLAUDE.md beside each AGENTS.md, and what `oat instructions validate` checks. The `--strategy` flag overrides it for one run.',
214
+ },
215
+ {
216
+ key: 'instructions.claude.excludes',
217
+ group: 'Shared Repo (.oat/config.json)',
218
+ file: '.oat/config.json',
219
+ scope: 'shared repo',
220
+ type: 'string[]',
221
+ defaultValue: 'unset',
222
+ mutability: 'read/write',
223
+ owningCommand: 'oat config set instructions.claude.excludes <path[,path...]>',
224
+ description: 'Comma-separated repository-relative directories that `oat instructions sync` and `oat instructions validate` must not treat as pointer sites, additive to the documentation content root they already skip. Absolute paths and paths escaping the repository are rejected; an empty value clears the key.',
225
+ },
203
226
  {
204
227
  key: 'autoReviewAtCheckpoints',
205
228
  group: 'Shared Repo (.oat/config.json)',
@@ -256,17 +279,6 @@ const CONFIG_CATALOG = [
256
279
  owningCommand: 'oat config set documentation.excludes <glob[,glob...]>',
257
280
  description: 'Comma-separated globs, relative to the docs directory, excluded from `oat docs generate-index`. Repeated `--exclude` flags extend this list; an empty value clears the key.',
258
281
  },
259
- {
260
- key: 'documentation.instructionPointerExcludes',
261
- group: 'Shared Repo (.oat/config.json)',
262
- file: '.oat/config.json',
263
- scope: 'shared repo',
264
- type: 'string[]',
265
- defaultValue: 'unset',
266
- mutability: 'read/write',
267
- owningCommand: 'oat config set documentation.instructionPointerExcludes <path[,path...]>',
268
- description: 'Comma-separated repository-relative directories that `oat instructions sync` and `oat instructions validate` must not treat as pointer sites, additive to the documentation content root they already skip. Absolute paths and paths escaping the repository are rejected; an empty value clears the key.',
269
- },
270
282
  {
271
283
  key: 'documentation.requireForProjectCompletion',
272
284
  group: 'Shared Repo (.oat/config.json)',
@@ -891,6 +903,7 @@ const DEFAULT_DEPENDENCIES = {
891
903
  readOatConfigForDefaultScopeRepair,
892
904
  readOatConfigForDocumentationExcludesRepair,
893
905
  readOatConfigForInstructionPointerExcludesRepair,
906
+ readOatConfigForInstructionSyncStrategyRepair,
894
907
  readOatConfigWithWarnings,
895
908
  writeOatConfig,
896
909
  readOatLocalConfig,
@@ -966,7 +979,7 @@ function normalizeSharedRoot(value) {
966
979
  * as "clear the key" rather than as an error.
967
980
  */
968
981
  /**
969
- * Parse `documentation.instructionPointerExcludes` from one comma-separated
982
+ * Parse `instructions.claude.excludes` from one comma-separated
970
983
  * value into the shape the loader and the consumer already agree on.
971
984
  *
972
985
  * Every entry goes through `normalizeExcludedPaths`, the same function
@@ -994,7 +1007,7 @@ function parseInstructionPointerExcludes(rawValue) {
994
1007
  .filter((value) => value.length > 0)) {
995
1008
  const [normalizedEntry] = normalizeExcludedPaths([entry]);
996
1009
  if (normalizedEntry === undefined || WINDOWS_DRIVE_PATH_RE.test(entry)) {
997
- throw new Error(`Invalid documentation.instructionPointerExcludes entry ${JSON.stringify(entry)}: entries must be repository-relative paths inside the repository. Absolute paths and paths escaping the repository cannot exclude anything.`);
1010
+ throw new Error(`Invalid instructions.claude.excludes entry ${JSON.stringify(entry)}: entries must be repository-relative paths inside the repository. Absolute paths and paths escaping the repository cannot exclude anything.`);
998
1011
  }
999
1012
  if (!normalized.includes(normalizedEntry)) {
1000
1013
  normalized.push(normalizedEntry);
@@ -1037,6 +1050,7 @@ function parseExplainerValue(key, rawValue, surface) {
1037
1050
  }
1038
1051
  const WORKFLOW_ENUM_VALUES = {
1039
1052
  'projects.defaultScope': PROJECT_SCOPES,
1053
+ 'instructions.claude.shims': INSTRUCTION_SYNC_STRATEGIES,
1040
1054
  'workflow.hillCheckpointDefault': ['every', 'final'],
1041
1055
  'workflow.postImplementSequence': ['wait', 'summary', 'pr', 'docs-pr'],
1042
1056
  'workflow.reviewExecutionModel': ['subagent', 'inline', 'fresh-session'],
@@ -1094,6 +1108,7 @@ function isStructuralKey(key) {
1094
1108
  key === 'worktrees.root' ||
1095
1109
  key === 'git.defaultBranch' ||
1096
1110
  key.startsWith('documentation.') ||
1111
+ key.startsWith('instructions.') ||
1097
1112
  key.startsWith('archive.') ||
1098
1113
  key.startsWith('tools.'));
1099
1114
  }
@@ -1126,7 +1141,7 @@ function validateSurfaceForKey(key, surface) {
1126
1141
  }
1127
1142
  if (isStructuralKey(key)) {
1128
1143
  if (surface !== 'shared') {
1129
- throw new Error(`Cannot set structural key '${key}' at '${surface}' scope. Structural keys (projects.root, worktrees.root, git.*, documentation.*, archive.*, tools.*) can only be set at shared scope (.oat/config.json).`);
1144
+ throw new Error(`Cannot set structural key '${key}' at '${surface}' scope. Structural keys (projects.root, worktrees.root, git.*, documentation.*, instructions.*, archive.*, tools.*) can only be set at shared scope (.oat/config.json).`);
1130
1145
  }
1131
1146
  return;
1132
1147
  }
@@ -1844,9 +1859,37 @@ async function setConfigValue(repoRoot, userConfigDir, key, rawValue, surface, d
1844
1859
  // would reject the very value the operator is trying to replace.
1845
1860
  const config = key === 'documentation.excludes'
1846
1861
  ? await dependencies.readOatConfigForDocumentationExcludesRepair(repoRoot)
1847
- : key === 'documentation.instructionPointerExcludes'
1862
+ : key === 'instructions.claude.excludes'
1848
1863
  ? await dependencies.readOatConfigForInstructionPointerExcludesRepair(repoRoot)
1849
- : await dependencies.readOatConfig(repoRoot);
1864
+ : key === 'instructions.claude.shims'
1865
+ ? await dependencies.readOatConfigForInstructionSyncStrategyRepair(repoRoot)
1866
+ : await dependencies.readOatConfig(repoRoot);
1867
+ if (key.startsWith('instructions.claude.')) {
1868
+ const claude = { ...config.instructions?.claude };
1869
+ if (key === 'instructions.claude.excludes') {
1870
+ const excludes = parseInstructionPointerExcludes(rawValue);
1871
+ if (excludes.length === 0) {
1872
+ delete claude.excludes;
1873
+ }
1874
+ else {
1875
+ claude.excludes = excludes;
1876
+ }
1877
+ }
1878
+ else {
1879
+ claude.shims = parseWorkflowValue(key, rawValue);
1880
+ }
1881
+ await dependencies.writeOatConfig(repoRoot, {
1882
+ ...config,
1883
+ instructions: { ...config.instructions, claude },
1884
+ });
1885
+ return {
1886
+ key,
1887
+ value: key === 'instructions.claude.excludes'
1888
+ ? (claude.excludes ?? null)
1889
+ : (claude.shims ?? null),
1890
+ source: 'shared',
1891
+ };
1892
+ }
1850
1893
  if (key.startsWith('documentation.')) {
1851
1894
  const doc = { ...config.documentation };
1852
1895
  if (key === 'documentation.root') {
@@ -1869,15 +1912,6 @@ async function setConfigValue(repoRoot, userConfigDir, key, rawValue, surface, d
1869
1912
  doc.excludes = excludes;
1870
1913
  }
1871
1914
  }
1872
- else if (key === 'documentation.instructionPointerExcludes') {
1873
- const excludes = parseInstructionPointerExcludes(rawValue);
1874
- if (excludes.length === 0) {
1875
- delete doc.instructionPointerExcludes;
1876
- }
1877
- else {
1878
- doc.instructionPointerExcludes = excludes;
1879
- }
1880
- }
1881
1915
  else if (key === 'documentation.requireForProjectCompletion') {
1882
1916
  doc.requireForProjectCompletion =
1883
1917
  rawValue.trim().toLowerCase() === 'true';
@@ -1890,9 +1924,7 @@ async function setConfigValue(repoRoot, userConfigDir, key, rawValue, surface, d
1890
1924
  ? String(doc.requireForProjectCompletion ?? false)
1891
1925
  : key === 'documentation.excludes'
1892
1926
  ? (doc.excludes ?? null)
1893
- : key === 'documentation.instructionPointerExcludes'
1894
- ? (doc.instructionPointerExcludes ?? null)
1895
- : (doc[key.replace('documentation.', '')] ?? null);
1927
+ : (doc[key.replace('documentation.', '')] ?? null);
1896
1928
  return {
1897
1929
  key,
1898
1930
  value: resultValue,
@@ -2095,6 +2127,7 @@ function configPathForKey(key) {
2095
2127
  }
2096
2128
  if (key.startsWith('explainers.') ||
2097
2129
  key.startsWith('documentation.') ||
2130
+ key.startsWith('instructions.') ||
2098
2131
  key.startsWith('archive.') ||
2099
2132
  isPjmRemoteConfigKey(key)) {
2100
2133
  return key.split('.');
@@ -2289,11 +2322,13 @@ async function removeFromSurface(repoRoot, userConfigDir, key, effectiveSurface,
2289
2322
  }
2290
2323
  const sharedConfig = key === 'documentation.excludes'
2291
2324
  ? await dependencies.readOatConfigForDocumentationExcludesRepair(repoRoot)
2292
- : key === 'documentation.instructionPointerExcludes'
2325
+ : key === 'instructions.claude.excludes'
2293
2326
  ? await dependencies.readOatConfigForInstructionPointerExcludesRepair(repoRoot)
2294
- : key === 'projects.defaultScope'
2295
- ? await dependencies.readOatConfigForDefaultScopeRepair(repoRoot)
2296
- : await dependencies.readOatConfig(repoRoot);
2327
+ : key === 'instructions.claude.shims'
2328
+ ? await dependencies.readOatConfigForInstructionSyncStrategyRepair(repoRoot)
2329
+ : key === 'projects.defaultScope'
2330
+ ? await dependencies.readOatConfigForDefaultScopeRepair(repoRoot)
2331
+ : await dependencies.readOatConfig(repoRoot);
2297
2332
  const { next, removed } = removeConfigPath(sharedConfig, path);
2298
2333
  if (removed) {
2299
2334
  await dependencies.writeOatConfig(repoRoot, next);
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/gate/index.ts"],"names":[],"mappings":"AAaA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EACL,gBAAgB,EAKhB,KAAK,qBAAqB,EAE3B,MAAM,8BAA8B,CAAC;AAYtC,OAAO,EAWL,KAAK,UAAU,EAIf,KAAK,SAAS,EACd,KAAK,cAAc,EACnB,KAAK,UAAU,EAEhB,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAOL,KAAK,cAAc,EACpB,MAAM,iBAAiB,CAAC;AAWzB,OAAO,EAEL,KAAK,WAAW,EACjB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EAEL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EAExB,MAAM,gCAAgC,CAAC;AAExC,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAGpC,OAAO,EACL,uBAAuB,EAExB,MAAM,mBAAmB,CAAC;AAC3B,OAAO,EACL,wBAAwB,EACxB,oBAAoB,EACpB,oBAAoB,EACpB,wBAAwB,EAEzB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAEL,KAAK,iBAAiB,EACtB,KAAK,gBAAgB,EACtB,MAAM,iBAA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AAM,EAAE,WAAW,CAAC;QACpB,KAAK,CAAC,EAAE,MAAM,CAAC;KAChB,CAAC;IACF,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAg5CD,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,UAAU,CAAC,CAAC,EAC9C,cAAc,EAAE,MAAM,EACtB,KAAK,EAAE,kBAAkB,EACzB,gBAAgB,CAAC,EAAE,oBAAoB,GACtC,kBAAkB,GAAG,IAAI,CAS3B;AA2zFD,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,uBAAuB,CAAM,GAC/C,OAAO,CAsOT"}
@@ -16,7 +16,7 @@ import { normalizeToPosixPath, resolveProjectRoot, validateRealPathWithinScope,
16
16
  import { buildDispatchReport, } from '../../providers/identity/dispatch-report.js';
17
17
  import { classifyModelFamily, } from '../../providers/identity/family.js';
18
18
  import { resolveIdentityConfidence, } from '../../providers/identity/provenance.js';
19
- import { parseDispatchStamps } from '../../providers/identity/stamp.js';
19
+ import { parseDispatchStamps, } from '../../providers/identity/stamp.js';
20
20
  import { Command } from 'commander';
21
21
  import YAML from 'yaml';
22
22
  import { createGateActivityProbe, } from './activity-probes.js';
@@ -84,7 +84,7 @@ const VALID_IDENTITY_PROVENANCES = [
84
84
  'unknown',
85
85
  ];
86
86
  const REVIEW_GATE_CONTEXT_NOTE = [
87
- 'This review is gate-originated. If you run `oat-project-review-provide`, set `oat_review_invocation: gate` in the review artifact. Write a canonical review artifact with `### Critical`, `### High`, `### Medium`, and `### Low` headings in that order, using `None` for empty sections.',
87
+ "This review is gate-originated. If you run `oat-project-review-provide`, set `oat_review_invocation: gate` in the review artifact. Write a canonical review artifact with `### Critical`, `### High`, `### Medium`, and `### Low` headings in that order, using `None` for empty sections. Gate-originated reviews write the resolver dispatch stamp on a line labeled `**Dispatch audit (policy view):**`, with the stamp in one backtick pair, because an unlabeled audit stamp must name this gate's target and effort.",
88
88
  'Complete the review, artifact write, and required bookkeeping inline or through a synchronously awaited child before this headless process exits. Do not start background tasks, monitors, or waiters that outlive this turn.',
89
89
  "Artifact hygiene contract: Before finishing or committing, format every file you created or edited. Use the concrete write/fix formatting command supplied by the governing plan, task, or brief. If none is usable, discover the repository's documented write/fix command from applicable `AGENTS.md`/`CLAUDE.md` instructions and relevant package manifests; do not infer or hardcode a formatter. Prefer a file-scoped invocation when supported, and avoid rewriting unrelated files. If no command is discoverable, warn once with `no format command discovered in repo instructions; skipping`, then continue.",
90
90
  ].join('\n\n');
@@ -281,6 +281,29 @@ function gateInvocationPromptContext(invocation) {
281
281
  frontmatter,
282
282
  ].join('\n');
283
283
  }
284
+ const NON_CONCRETE_REASONING_EFFORTS = new Set([
285
+ 'unknown',
286
+ 'provider-default',
287
+ 'not-applicable',
288
+ ]);
289
+ /**
290
+ * Unlabeled reviewer audit stamps that disagree with the gate frontmatter.
291
+ *
292
+ * The frontmatter (`oat_gate_target`, `oat_invocation_*`) is the authority for
293
+ * the gate's actual invocation. A stamp labeled as the reviewer policy view is
294
+ * exempt; any other audit stamp must name the gate target and, when the gate
295
+ * recorded a concrete reasoning effort, carry `effort_axis=selected:<effort>`.
296
+ */
297
+ function disagreeingDispatchAuditStamps(verdict) {
298
+ const unlabeled = verdict.dispatchAudit?.unlabeled ?? [];
299
+ const target = verdict.gateInvocation?.targetId ?? null;
300
+ const effort = verdict.gateInvocation?.reasoningEffort ?? null;
301
+ const expectedEffortAxis = effort && !NON_CONCRETE_REASONING_EFFORTS.has(effort)
302
+ ? `selected:${effort}`
303
+ : null;
304
+ return unlabeled.filter((stamp) => stamp.target !== target ||
305
+ (expectedEffortAxis !== null && stamp.effortAxis !== expectedEffortAxis));
306
+ }
284
307
  function corroborateGateInvocation(expected, actual, targetCorroboration) {
285
308
  const invocationFields = [
286
309
  ['targetId', expected.targetId, actual?.targetId],
@@ -2422,6 +2445,32 @@ async function disposeValidatedReviewArtifact(snapshot, identity, dependencies,
2422
2445
  },
2423
2446
  };
2424
2447
  }
2448
+ const disagreeingAudit = disagreeingDispatchAuditStamps(verdict);
2449
+ if (disagreeingAudit.length > 0) {
2450
+ const lines = disagreeingAudit.map((stamp) => stamp.lineNumber).join(', ');
2451
+ const effort = verdict.gateInvocation?.reasoningEffort ?? 'unknown';
2452
+ return {
2453
+ eligible: false,
2454
+ status: 'artifact_validation_failed',
2455
+ cause: 'gate_dispatch_audit_mismatched',
2456
+ verdict,
2457
+ writeEnvelope: (context) => {
2458
+ writeReviewGateArtifactValidationFailure(context, {
2459
+ runId: identity.runId,
2460
+ target: identity.target,
2461
+ project: identity.project,
2462
+ projectResolutionSource: identity.projectResolutionSource,
2463
+ artifactPath: snapshot.path,
2464
+ generatedAt: snapshot.generatedAt,
2465
+ message: `Review artifact dispatch audit line (line ${lines}) does not agree with the gate invocation frontmatter (oat_gate_target: ${verdict.gateInvocation?.targetId ?? 'unknown'}, oat_invocation_reasoning_effort: ${effort}). An unlabeled audit stamp must describe the gate invocation; label the reviewer policy stamp \`**Dispatch audit (policy view):**\`. Artifacts written by an older installed review skill need \`oat tools update\`.`,
2466
+ recovery: `Label the reviewer policy stamp in ${snapshot.path} as \`**Dispatch audit (policy view):**\`, or correct the stamp to the gate target and effort, then rerun the gate. If an older installed oat-project-review-provide wrote the unlabeled line, refresh installed skills with \`oat tools update\` and rerun the gate.`,
2467
+ gateInvocation: identity.gateInvocation,
2468
+ dispatchReport: identity.dispatchReport,
2469
+ corroboration,
2470
+ });
2471
+ },
2472
+ };
2473
+ }
2425
2474
  hooks.onStep?.('verdict-disposition');
2426
2475
  return {
2427
2476
  eligible: true,
@@ -1,3 +1,4 @@
1
+ import { type DispatchStamp } from '../../providers/identity/stamp.js';
1
2
  export interface ReviewGateVerdict {
2
3
  artifactPath: string;
3
4
  reviewType: 'code' | 'artifact' | 'unknown';
@@ -5,6 +6,8 @@ export interface ReviewGateVerdict {
5
6
  invocation: string | null;
6
7
  project: string | null;
7
8
  gateInvocation?: ReviewArtifactGateInvocation;
9
+ /** Present only when the artifact carries at least one audit line. */
10
+ dispatchAudit?: ReviewDispatchAudit;
8
11
  counts: {
9
12
  critical: number;
10
13
  high: number;
@@ -25,6 +28,15 @@ export interface ReviewArtifactGateInvocation {
25
28
  reasoningEffort: string | null;
26
29
  source: string | null;
27
30
  }
31
+ /**
32
+ * Reviewer dispatch stamps found on audit lines. `policyView` holds stamps
33
+ * whose label names the project reviewer policy view; every other audit stamp
34
+ * is `unlabeled` and must agree with the gate invocation frontmatter.
35
+ */
36
+ export interface ReviewDispatchAudit {
37
+ unlabeled: DispatchStamp[];
38
+ policyView: DispatchStamp[];
39
+ }
28
40
  export type Severity = keyof ReviewGateVerdict['counts'];
29
41
  export interface ReviewGateArtifactSnapshot {
30
42
  readonly content: string;
@@ -35,5 +47,15 @@ export interface ParseReviewGateVerdictOptions {
35
47
  artifactSnapshot?: ReviewGateArtifactSnapshot;
36
48
  }
37
49
  export declare function severityDisplayName(severity: Severity): string;
50
+ /**
51
+ * Reviewer dispatch audit lines from every part of the artifact body except
52
+ * finding sections: `## Findings` (with its subsections) and any
53
+ * `### Critical`, `### High`, `### Medium`, or `### Low` section. Reviewers
54
+ * have placed audit stamps in the pre-heading metadata block and in sections
55
+ * such as `## Dispatch Audit`, `## Review Dispatch Audit`, `## Review Scope`,
56
+ * and `## Dispatch Evidence`, so recognition is by line shape, not section
57
+ * name. Fenced code blocks and prose that merely quotes a stamp are ignored.
58
+ */
59
+ export declare function extractDispatchAudit(content: string): ReviewDispatchAudit;
38
60
  export declare function parseReviewGateVerdict(artifactPath: string, options?: ParseReviewGateVerdictOptions): Promise<ReviewGateVerdict>;
39
61
  //# sourceMappingURL=review-verdict.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"review-verdict.d.ts","sourceRoot":"","sources":["../../../src/commands/gate/review-verdict.ts"],"names":[],"mappings":"AAMA,MAAM,WAAW,iBAAiB;IAChC,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,EAAE,MAAM,GAAG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AAM,iBAAiB,CAAC,QAAQ,CAAC,CAAC;AAEzD,MAAM,WAAW,0BAA0B;IACzC,QAAQ,CAAC,OAAO,EAAE,MAAM,CAAC;IACzB,QAAQ,CAAC,SAAS,EAAE,MAAM,CAAC;CAC5B;AAED,MAAM,WAAW,6BAA6B;IAC5C,qCAAqC,CAAC,EAAE,OAAO,CAAC;IAChD,gBAAgB,CAAC,EAAE,0BAA0B,CAAC;CAC/C;AA8OD,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,QAAQ,GAAG,MAAM,CAE9D;AAwJD;;;;;;;;GAQG;AACH,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,MAAM,GAAG,mBAAmB,CAkCzE;AAwbD,wBAAsB,sBAAsB,CAC1C,YAAY,EAAE,MAAM,EACpB,OAAO,GAAE,6BAAkC,GAC1C,OAAO,CAAC,iBAAiB,CAAC,CAkG5B"}
@@ -1,6 +1,7 @@
1
1
  import { createHash } from 'node:crypto';
2
2
  import { readFile, writeFile } from 'node:fs/promises';
3
3
  import { getFrontmatterBlock } from '../shared/frontmatter.js';
4
+ import { parseDispatchStamps, } from '../../providers/identity/stamp.js';
4
5
  import YAML from 'yaml';
5
6
  const SEVERITIES = ['critical', 'high', 'medium', 'low'];
6
7
  const FRONTMATTER_COUNT_KEYS = {
@@ -214,6 +215,113 @@ function linesOutsideFences(content) {
214
215
  }
215
216
  return outsideFenceLines;
216
217
  }
218
+ const TOP_SECTION_HEADING = /^##\s+\S/;
219
+ const FINDINGS_SECTION_HEADING = /^##\s+Findings\b/i;
220
+ const SEVERITY_SECTION_HEADING = /^#{3,6}\s+(?:Critical|High|Medium|Low)\s*#*\s*$/i;
221
+ const LIST_MARKER = /^(?:[-*+]|\d+[.)])\s+/;
222
+ const DISPATCH_TOKEN = /(^|[\s`])Dispatch:/;
223
+ const POLICY_VIEW_LABEL = /policy\s+view/i;
224
+ /** After a closing backtick: nothing, punctuation, or one parenthetical. */
225
+ const ALLOWED_TRAILING_TEXT = /^\s*(?:[.,;:!?]+|\([^()`]*\))?\s*$/;
226
+ function frontmatterEnd(content) {
227
+ const match = content.match(/^---\n[\s\S]*?\n---(?:\n|$)/);
228
+ return match ? match[0].length : 0;
229
+ }
230
+ /**
231
+ * Classifies one line as a reviewer dispatch audit line.
232
+ *
233
+ * Shape: an optional list marker, an optional bold or plain label ending in
234
+ * `:` (the label may itself hold backtick spans), and a `Dispatch:` stamp that
235
+ * is either bare to the end of the line or wrapped in one backtick pair, which
236
+ * may be followed only by punctuation or a single parenthetical. A wrapped
237
+ * stamp followed by other prose is a quotation, not an audit line. The stamp
238
+ * must parse as a reviewer stamp (`action=review role=reviewer`).
239
+ */
240
+ function classifyAuditLine(text, lineNumber) {
241
+ const remainder = text.trim().replace(LIST_MARKER, '');
242
+ const token = DISPATCH_TOKEN.exec(remainder);
243
+ if (!token) {
244
+ return null;
245
+ }
246
+ let label = remainder.slice(0, token.index + (token[1] ?? '').length);
247
+ let stamp = remainder.slice(token.index + (token[1] ?? '').length);
248
+ const wrapped = label.endsWith('`');
249
+ if (wrapped) {
250
+ label = label.slice(0, -1);
251
+ const closing = stamp.indexOf('`');
252
+ if (closing === -1) {
253
+ return null;
254
+ }
255
+ // Only punctuation or one parenthetical may follow the closing backtick;
256
+ // longer prose means the line quotes a stamp rather than records one.
257
+ if (!ALLOWED_TRAILING_TEXT.test(stamp.slice(closing + 1))) {
258
+ return null;
259
+ }
260
+ stamp = stamp.slice(0, closing);
261
+ }
262
+ else if (stamp.includes('`')) {
263
+ return null;
264
+ }
265
+ const trimmedLabel = label.trim();
266
+ if (trimmedLabel && !/:(?:\*{1,2}|_{1,2})?$/.test(trimmedLabel)) {
267
+ return null;
268
+ }
269
+ const parsed = parseDispatchStamps(stamp);
270
+ const first = parsed[0];
271
+ if (parsed.length !== 1 ||
272
+ !first ||
273
+ first.legacy ||
274
+ first.action !== 'review' ||
275
+ first.role !== 'reviewer') {
276
+ return null;
277
+ }
278
+ return {
279
+ stamp: { ...first, line: text, lineNumber },
280
+ policyView: POLICY_VIEW_LABEL.test(trimmedLabel),
281
+ };
282
+ }
283
+ /**
284
+ * Reviewer dispatch audit lines from every part of the artifact body except
285
+ * finding sections: `## Findings` (with its subsections) and any
286
+ * `### Critical`, `### High`, `### Medium`, or `### Low` section. Reviewers
287
+ * have placed audit stamps in the pre-heading metadata block and in sections
288
+ * such as `## Dispatch Audit`, `## Review Dispatch Audit`, `## Review Scope`,
289
+ * and `## Dispatch Evidence`, so recognition is by line shape, not section
290
+ * name. Fenced code blocks and prose that merely quotes a stamp are ignored.
291
+ */
292
+ export function extractDispatchAudit(content) {
293
+ const bodyStart = frontmatterEnd(content);
294
+ const audit = { unlabeled: [], policyView: [] };
295
+ let inFindingSection = false;
296
+ for (const line of linesOutsideFences(content)) {
297
+ if (line.start < bodyStart) {
298
+ continue;
299
+ }
300
+ if (TOP_SECTION_HEADING.test(line.text)) {
301
+ inFindingSection = FINDINGS_SECTION_HEADING.test(line.text);
302
+ continue;
303
+ }
304
+ if (SEVERITY_SECTION_HEADING.test(line.text)) {
305
+ inFindingSection = true;
306
+ continue;
307
+ }
308
+ if (inFindingSection) {
309
+ continue;
310
+ }
311
+ const lineNumber = content.slice(0, line.start).split('\n').length;
312
+ const classified = classifyAuditLine(line.text, lineNumber);
313
+ if (!classified) {
314
+ continue;
315
+ }
316
+ if (classified.policyView) {
317
+ audit.policyView.push(classified.stamp);
318
+ }
319
+ else {
320
+ audit.unlabeled.push(classified.stamp);
321
+ }
322
+ }
323
+ return audit;
324
+ }
217
325
  function findFindingsSection(content) {
218
326
  const lines = linesOutsideFences(content);
219
327
  const findingsHeading = lines.find((line) => /^##\s+Findings\s*#*\s*$/i.test(line.text));
@@ -544,6 +652,8 @@ export async function parseReviewGateVerdict(artifactPath, options = {}) {
544
652
  throw new Error(`Review artifact at ${artifactPath} does not contain recognizable review findings or explicit verdict counts.`);
545
653
  }
546
654
  const gateInvocation = readGateInvocation(frontmatter);
655
+ const dispatchAudit = extractDispatchAudit(content);
656
+ const hasDispatchAudit = dispatchAudit.unlabeled.length > 0 || dispatchAudit.policyView.length > 0;
547
657
  if (options.artifactSnapshot) {
548
658
  await assertArtifactContentCurrent(artifactPath, options.artifactSnapshot.content);
549
659
  }
@@ -554,6 +664,7 @@ export async function parseReviewGateVerdict(artifactPath, options = {}) {
554
664
  invocation: stringOrNull(frontmatter['oat_review_invocation']),
555
665
  project: stringOrNull(frontmatter['oat_project']),
556
666
  ...(gateInvocation ? { gateInvocation } : {}),
667
+ ...(hasDispatchAudit ? { dispatchAudit } : {}),
557
668
  counts,
558
669
  blocking: hasBlockingFindings(counts),
559
670
  ...(insertedSeverities.length > 0
@@ -13,6 +13,7 @@ import type { ConcreteScope } from '../../shared/types.js';
13
13
  import { Command } from 'commander';
14
14
  import { type DetectedDocs, type DetectDocsDependencies } from './detect-docs.js';
15
15
  import { type ToolPack } from './tools/index.js';
16
+ import { type AgentsGuidancePlan } from './tools/project-guidance.js';
16
17
  export interface InitStrayCandidate {
17
18
  provider: string;
18
19
  report: DriftReport;
@@ -76,6 +77,11 @@ interface InitDependencies {
76
77
  runGuidedSetup: (context: CommandContext, dependencies: InitDependencies, explicitProjectGuidance?: boolean) => Promise<void>;
77
78
  runToolPacks: (context: CommandContext, explicitProjectGuidance?: boolean) => Promise<ToolPack[]>;
78
79
  runProviderSync: (projectRoot: string) => Promise<void>;
80
+ /**
81
+ * Applies accepted OAT tools guidance for the already-installed packs when
82
+ * `--project-guidance` is given and guided setup does not run.
83
+ */
84
+ applyProjectGuidance: (context: CommandContext, projectRoot: string | null) => Promise<AgentsGuidancePlan>;
79
85
  }
80
86
  export declare function createInitCommand(overrides?: Partial<InitDependencies>): Command;
81
87
  export {};
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/init/index.ts"],"names":[],"mappings":"AAIA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAEL,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AAC,EAAE,EAC1B,GAAG,EAAE,aAAa,KACf,OAAO,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;IACvB,2BAA2B,EAAE,CAC3B,SAAS,EAAE,MAAM,EACjB,KAAK,EAAE,kBAAkB,EACzB,QAAQ,EAAE,QAAQ,EAClB,WAAW,EAAE,sBAAsB,EACnC,cAAc,EAAE,MAAM,EACtB,OAAO,CAAC,EAAE;QAAE,gBAAgB,CAAC,EAAE,OAAO,CAAA;KAAE,KACrC,OAAO,CAAC,QAAQ,CAAC,CAAC;IACvB,cAAc,EAAE,CACd,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,gBAAgB,EAC9B,uBAAuB,CAAC,EAAE,OAAO,KAC9B,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,YAAY,EAAE,CACZ,OAAO,EAAE,cAAc,EACvB,uBAAuB,CAAC,EAAE,OAAO,KAC9B,OAAO,CAAC,QAAQ,EAAE,CAAC,CAAC;IACzB,eAAe,EAAE,CAAC,WAAW,EAAE,MAAM,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IACxD;;;OAGG;IACH,oBAAoB,EAAE,CACpB,OAAO,EAAE,cAAc,EACvB,WAAW,EAAE,MAAM,GAAG,IAAI,KACvB,OAAO,CAAC,kBAAkB,CAAC,CAAC;CAClC;AA0jCD,wBAAgB,iBAAiB,CAC/B,SAAS,GAAE,OAAO,CAAC,gBAAgB,CAAM,GACxC,OAAO,CA8BT"}
@@ -28,8 +28,8 @@ import { getActiveAdapters, getConfigAwareAdapters, getProviderRegistrations, re
28
28
  import { getAdoptionSources } from '../../providers/shared/adapter.utils.js';
29
29
  import { Command } from 'commander';
30
30
  import { detectExistingDocs, } from './detect-docs.js';
31
- import { createInitToolsCommand, runInitToolsWithDefaults, } from './tools/index.js';
32
- import { commandProjectGuidanceChoice, withProjectGuidanceOptions, } from './tools/project-guidance.js';
31
+ import { applyProjectGuidanceForInstalledPacks, createInitToolsCommand, runInitToolsWithDefaults, } from './tools/index.js';
32
+ import { commandProjectGuidanceChoice, isProjectGuidanceIncomplete, reportableProjectGuidance, reportProjectGuidancePlan, withProjectGuidanceOptions, } from './tools/project-guidance.js';
33
33
  const ADOPT_REMEDIATION = 'Run "oat init" interactively to adopt stray entries.';
34
34
  const HOOK_PROMPT = 'Install optional pre-commit hook for drift warnings?';
35
35
  const HOOK_CONFIGURE_PROMPT = (hooksPath) => `Configure Git hooks to use ${hooksPath} before installing the OAT hook?`;
@@ -171,6 +171,7 @@ function createDependencies() {
171
171
  applyNativeSkillDisposition,
172
172
  runGuidedSetup: runGuidedSetupImpl,
173
173
  runToolPacks: runInitToolsWithDefaults,
174
+ applyProjectGuidance: (context, projectRoot) => applyProjectGuidanceForInstalledPacks(context, projectRoot, true),
174
175
  async runProviderSync(projectRoot) {
175
176
  execSync('oat sync --scope project', {
176
177
  cwd: projectRoot,
@@ -695,6 +696,15 @@ async function runInitCommand(context, dependencies, hookFlag, setupFlag, explic
695
696
  });
696
697
  }
697
698
  const hookInstalled = await maybeHandleHook(context, dependencies, projectRoot, hookFlag);
699
+ const freshInit = projectRoot !== null && !oatDirExistedBefore;
700
+ const setupMayRun = !!setupFlag || (context.interactive && freshInit);
701
+ // Guided setup owns guidance when it runs. Otherwise an explicit
702
+ // --project-guidance is applied directly for the installed packs, so the
703
+ // flag is never silently dropped (--no-project-guidance needs no write).
704
+ let directGuidance = null;
705
+ if (explicitProjectGuidance === true && !setupMayRun) {
706
+ directGuidance = await dependencies.applyProjectGuidance(context, projectRoot);
707
+ }
698
708
  if (context.json) {
699
709
  const payload = {
700
710
  scope: context.scope,
@@ -704,12 +714,14 @@ async function runInitCommand(context, dependencies, hookFlag, setupFlag, explic
704
714
  hookInstalled,
705
715
  scopes: scopeSummaries,
706
716
  manifestVersionRestamps,
717
+ ...(directGuidance
718
+ ? { projectGuidance: reportableProjectGuidance(directGuidance) }
719
+ : {}),
707
720
  };
708
721
  context.logger.json(payload);
709
722
  }
710
723
  process.exitCode = 0;
711
- const freshInit = projectRoot !== null && !oatDirExistedBefore;
712
- if (setupFlag || (context.interactive && freshInit)) {
724
+ if (setupMayRun) {
713
725
  let shouldRunSetup = !!setupFlag;
714
726
  if (!shouldRunSetup && freshInit) {
715
727
  shouldRunSetup = await dependencies.confirmAction('Would you like to run guided setup?', { interactive: context.interactive });
@@ -722,6 +734,17 @@ async function runInitCommand(context, dependencies, hookFlag, setupFlag, explic
722
734
  await dependencies.runGuidedSetup(context, dependencies, explicitProjectGuidance);
723
735
  }
724
736
  }
737
+ else if (explicitProjectGuidance === true) {
738
+ directGuidance = await dependencies.applyProjectGuidance(context, projectRoot);
739
+ }
740
+ }
741
+ if (directGuidance) {
742
+ if (!context.json) {
743
+ reportProjectGuidancePlan(context.logger, directGuidance);
744
+ }
745
+ if (isProjectGuidanceIncomplete(directGuidance)) {
746
+ process.exitCode = 1;
747
+ }
725
748
  }
726
749
  }
727
750
  export function createInitCommand(overrides = {}) {