@open-agent-toolkit/cli 0.2.15 → 0.2.17

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.
@@ -85,7 +85,7 @@ For full project-management repo-reference setup, use [`oat pjm init`](tool-pack
85
85
 
86
86
  Use the `oat decision` group for file-per-record decisions under `.oat/repo/reference/decisions/`. Each decision is its own file with a deterministic `DR-YYMMDD-slug` ID (the slug is capped at 30 characters at the last whole-word boundary, with trailing stop-words trimmed), and the human-facing index is a committed generated view.
87
87
 
88
- - `oat decision init` - scaffold `.oat/repo/reference/decisions/` and the managed decision index
88
+ - `oat decision init` - scaffold `.oat/repo/reference/decisions/`, the managed decision index, decision-scoped `AGENTS.md` guidance, and an idempotent `OAT decisions` section in the repository-root `AGENTS.md`
89
89
  - `oat decision new <title>` - create a new decision record; supports `--status`, `--context`, `--decision`, `--consequences`, and `--created-at`
90
90
  - `oat decision regenerate-index` - rebuild the managed decision index table from record frontmatter
91
91
  - `oat decision migrate` - convert a legacy single `decision-record.md` into file-per-record decisions, preserving each old `ADR-NNN`/`DR-NNN` ID as `legacy_id`; applies by default, so pass `--dry-run` to preview the legacy-to-new mappings without writing, and `--delete-legacy` to remove the source file after a verified migration (unlike `oat pjm migrate`, which defaults to dry-run)
@@ -94,6 +94,8 @@ Pass `--context`, `--decision`, and `--consequences` together when creating a re
94
94
 
95
95
  The decision index uses managed marker pairs and is deterministic, so an index merge conflict can be resolved by re-running `oat decision regenerate-index` and staging the result. Decision records replace the legacy single `decision-record.md`; repos still on the old layout migrate with `oat decision migrate` (or the broader `oat pjm migrate`).
96
96
 
97
+ `oat decision init` is the lightweight standalone setup path. It does not require the `project-management` tool pack and does not create current state, roadmap, or backlog artifacts. Its AGENTS guidance uses `oat decision` directly while also recognizing `oat-pjm-decision` when that optional skill is installed later.
98
+
97
99
  ## `oat local ...`
98
100
 
99
101
  `oat local` manages local-only, gitignored paths that still need to follow you between the main repo and worktrees.
@@ -140,6 +140,8 @@ The canonical surface splits active operational state (under `pjm/`) from durabl
140
140
 
141
141
  Decisions are now file-per-record under `reference/decisions/` (created and indexed with the [`oat decision`](config-and-local-state.md#oat-decision-) command group), replacing the legacy single `decision-record.md`. Repos still on the old `reference/` layout can migrate with `oat pjm migrate`.
142
142
 
143
+ For decision records without the broader PJM surface, run `oat decision init` directly. It creates only the decision directory, generated index, and decision-specific AGENTS guidance; it does not require the `project-management` pack or create current state, roadmap, and backlog artifacts. If the pack is installed later, its root guidance is maintained as a separate managed section so the decision instructions remain independently reusable.
144
+
143
145
  `oat pjm init` is idempotent and non-destructive. Existing reference docs are skipped and left unchanged, so curated repo state is not overwritten on repeated runs.
144
146
 
145
147
  Run `oat pjm doctor` to check an existing surface after the `project-management` pack is enabled: it reports missing canonical files, leftover template frontmatter, and legacy/loose/second-roadmap drift, and accepts `--json` for machine-readable output. When the pack is disabled or not configured, doctor reports PJM as disabled and skips drift checks. The same gated checks also run under project-scope `oat doctor`.
@@ -246,12 +246,16 @@ operational layer (`pjm/`) from durable references (`reference/`):
246
246
  reference/
247
247
  AGENTS.md
248
248
  decisions/
249
+ AGENTS.md
250
+ index.md
249
251
  ```
250
252
 
251
253
  Decisions are file-per-record under `reference/decisions/` (managed with the
252
254
  `oat decision` command group), replacing the legacy single
253
255
  `reference/decision-record.md`. Repos still on the old single-`reference/`
254
- layout migrate with `oat pjm migrate`.
256
+ layout migrate with `oat pjm migrate`. Running `oat decision init` by itself
257
+ creates the `decisions/` subtree and decision-specific AGENTS guidance without
258
+ creating the broader `pjm/` surface.
255
259
 
256
260
  ## User scope (`~/.oat/`)
257
261
 
@@ -1,6 +1,6 @@
1
1
  {
2
- "cli": "0.2.15",
3
- "docs-config": "0.2.15",
4
- "docs-theme": "0.2.15",
5
- "docs-transforms": "0.2.15"
2
+ "cli": "0.2.17",
3
+ "docs-config": "0.2.17",
4
+ "docs-theme": "0.2.17",
5
+ "docs-transforms": "0.2.17"
6
6
  }
@@ -5,12 +5,13 @@ export interface GlobalCliInstallerOptions {
5
5
  platform: NodeJS.Platform;
6
6
  nodeExecutable: string;
7
7
  fileExists: (path: string) => boolean;
8
+ readFile?: (path: string) => string;
8
9
  }
9
10
  export interface GlobalCliInstallerInvocation {
10
11
  file: string;
11
12
  args: string[];
12
13
  }
13
14
  export declare function detectGlobalCliPackageManager(argv: string[], env: NodeJS.ProcessEnv): GlobalCliPackageManager;
14
- export declare function formatGlobalCliInstallCommand(packageSpec: string, argv: string[], env: NodeJS.ProcessEnv): string;
15
+ export declare function formatGlobalCliInstallCommand(packageSpec: string, argv: string[], env: NodeJS.ProcessEnv, fileExists?: (path: string) => boolean, readFile?: (path: string) => string): string;
15
16
  export declare function resolveGlobalCliInstallerInvocation(packageSpec: string, options: GlobalCliInstallerOptions): GlobalCliInstallerInvocation | null;
16
17
  //# sourceMappingURL=global-cli-installer.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"global-cli-installer.d.ts","sourceRoot":"","sources":["../../src/app/global-cli-installer.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,uBAAuB,GAAG,KAAK,GAAG,MAAM,GAAG,MAAM,GAAG,KAAK,CAAC;AAEtE,MAAM,WAAW,yBAAyB;IACxC,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,GAAG,EAAE,MAAM,CAAC,UAAU,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,MAAM,CAAC;IACb,IAAI,EAAE,MAAM,EAAE,CAAC;CAChB;AAqCD,wBAAgB,6BAA6B,CAC3C,IAAI,EAAE,MAAM,EAAE,EACd,GAAG,EAAE,MAAM,CAAC,UAAU,GACrB,uBAAuB,CAyBzB;AA0ED,wBAAgB,6BAA6B,CAC3C,WAAW,EAAE,MAAM,EACnB,IAAI,EAA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4 +1,5 @@
1
- import { win32 } from 'node:path';
1
+ import { readFileSync } from 'node:fs';
2
+ import { join, win32 } from 'node:path';
2
3
  function normalizePathForDetection(path) {
3
4
  return path.replaceAll('\\', '/').toLowerCase().replace(/\/+$/, '');
4
5
  }
@@ -39,12 +40,56 @@ export function detectGlobalCliPackageManager(argv, env) {
39
40
  }
40
41
  return 'npm';
41
42
  }
42
- function installArgsForManager(manager, packageSpec) {
43
+ function readPnpmStoreDir(argv, env, fileExists, readFile) {
44
+ const modulesYamlPath = resolvePnpmGlobalModulesYamlPath(argv, env, fileExists);
45
+ if (!modulesYamlPath) {
46
+ return null;
47
+ }
48
+ try {
49
+ const match = readFile(modulesYamlPath).match(/^storeDir:\s*(.+)$/m);
50
+ return match?.[1]?.trim() ?? null;
51
+ }
52
+ catch {
53
+ return null;
54
+ }
55
+ }
56
+ function resolvePnpmGlobalModulesYamlPath(argv, env, fileExists) {
57
+ for (const arg of argv.slice(0, 3)) {
58
+ const normalized = arg.replaceAll('\\', '/');
59
+ const match = normalized.match(/^(.*\/global\/\d+)\//);
60
+ if (match?.[1]) {
61
+ const candidate = `${match[1]}/node_modules/.modules.yaml`;
62
+ if (fileExists(candidate)) {
63
+ return candidate;
64
+ }
65
+ }
66
+ }
67
+ const pnpmHome = env.PNPM_HOME?.trim();
68
+ if (pnpmHome) {
69
+ const candidate = join(pnpmHome, 'global', '5', 'node_modules', '.modules.yaml');
70
+ if (fileExists(candidate)) {
71
+ return candidate;
72
+ }
73
+ }
74
+ return null;
75
+ }
76
+ function resolvePnpmInstallContext(argv, env, fileExists, readFile) {
77
+ const read = readFile ?? ((path) => readFileSync(path, 'utf8'));
78
+ return {
79
+ storeDir: readPnpmStoreDir(argv, env, fileExists, read),
80
+ };
81
+ }
82
+ function installArgsForManager(manager, packageSpec, pnpmStoreDir) {
43
83
  switch (manager) {
44
84
  case 'npm':
45
85
  return ['install', '--global', packageSpec];
46
- case 'pnpm':
47
- return ['add', '-g', packageSpec];
86
+ case 'pnpm': {
87
+ const args = ['add', '-g', packageSpec];
88
+ if (pnpmStoreDir) {
89
+ args.push('--store-dir', pnpmStoreDir);
90
+ }
91
+ return args;
92
+ }
48
93
  case 'yarn':
49
94
  return ['global', 'add', packageSpec];
50
95
  case 'bun':
@@ -58,6 +103,9 @@ function resolveWindowsManagerInvocation(manager, packageSpec, options) {
58
103
  if (manager === 'npm') {
59
104
  return resolveNpmWindowsInvocation(packageSpec, options);
60
105
  }
106
+ const pnpmStoreDir = manager === 'pnpm'
107
+ ? resolvePnpmInstallContext(options.argv, options.env, options.fileExists, options.readFile).storeDir
108
+ : null;
61
109
  const comspec = options.env.ComSpec?.trim() || 'cmd.exe';
62
110
  return {
63
111
  file: comspec,
@@ -66,7 +114,7 @@ function resolveWindowsManagerInvocation(manager, packageSpec, options) {
66
114
  '/s',
67
115
  '/c',
68
116
  manager,
69
- ...installArgsForManager(manager, packageSpec),
117
+ ...installArgsForManager(manager, packageSpec, pnpmStoreDir),
70
118
  ],
71
119
  };
72
120
  }
@@ -86,26 +134,38 @@ function resolveNpmWindowsInvocation(packageSpec, options) {
86
134
  args: [npmCliPath, ...npmArgs],
87
135
  };
88
136
  }
89
- export function formatGlobalCliInstallCommand(packageSpec, argv, env) {
137
+ export function formatGlobalCliInstallCommand(packageSpec, argv, env, fileExists = () => false, readFile) {
90
138
  const manager = detectGlobalCliPackageManager(argv, env);
139
+ const pnpmStoreDir = manager === 'pnpm'
140
+ ? resolvePnpmInstallContext(argv, env, fileExists, readFile).storeDir
141
+ : null;
142
+ const pnpmStoreFlag = pnpmStoreDir === null ? '' : ` --store-dir ${quoteShellWord(pnpmStoreDir)}`;
91
143
  switch (manager) {
92
144
  case 'npm':
93
145
  return `npm install --global ${packageSpec}`;
94
146
  case 'pnpm':
95
- return `pnpm add -g ${packageSpec}`;
147
+ return `pnpm add -g ${packageSpec}${pnpmStoreFlag}`;
96
148
  case 'yarn':
97
149
  return `yarn global add ${packageSpec}`;
98
150
  case 'bun':
99
151
  return `bun install -g ${packageSpec}`;
100
152
  }
101
153
  }
154
+ function quoteShellWord(value) {
155
+ return /[\s"'`$\\]/.test(value)
156
+ ? `'${value.replaceAll("'", `'"'"'`)}'`
157
+ : value;
158
+ }
102
159
  export function resolveGlobalCliInstallerInvocation(packageSpec, options) {
103
160
  const manager = detectGlobalCliPackageManager(options.argv, options.env);
161
+ const pnpmStoreDir = manager === 'pnpm'
162
+ ? resolvePnpmInstallContext(options.argv, options.env, options.fileExists, options.readFile).storeDir
163
+ : null;
104
164
  if (options.platform === 'win32') {
105
165
  return resolveWindowsManagerInvocation(manager, packageSpec, options);
106
166
  }
107
167
  return {
108
168
  file: executableForManager(manager),
109
- args: installArgsForManager(manager, packageSpec),
169
+ args: installArgsForManager(manager, packageSpec, pnpmStoreDir),
110
170
  };
111
171
  }
@@ -1 +1 @@
1
- {"version":3,"file":"tool-bundle-update-guard.d.ts","sourceRoot":"","sources":["../../src/app/tool-bundle-update-guard.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,mBAAmB,CAAC;AAI/D,MAAM,WAAW,mBAAmB;IAClC,KAAK,EAAE,aAAa,GAAG,YAAY,CAAC;IACpC,OAAO,EAAE,MAAM,CAAC;CACjB;AAED,MAAM,WAAW,4BAA6B,SAAQ,qBAAqB;IACzE,WAAW,EAAE,MAAM,CAAC;IACpB,MAAM,EAAE,OAAO,CAAC;IAChB,YAAY,EAAE,mBAAmB,CAAC;CACnC;AAED,UAAU,gBAAgB;IACxB,KAAK,EAAE,KAAK,CAAC;IACb,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,iCAAiC;IAChD,yBAAyB,EAAE,CACzB,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5B,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE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IACb,KAAK,EAAE,SAAS,CAAC;CAClB;AAED,MAAM,WAAW,iCAAiC;IAChD,yBAAyB,EAAE,CACzB,OAAO,EAAE,qBAAqB,KAC3B,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IAC5B,aAAa,EAAE,CACb,OAAO,EAAE,MAAM,EACf,OAAO,EAAE;QAAE,WAAW,EAAE,OAAO,CAAA;KAAE,KAC9B,OAAO,CAAC,OAAO,CAAC,CAAC;IACtB,UAAU,EAAE,CACV,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM,EAAE,EACd,OAAO,EAAE,gBAAgB,KACtB,OAAO,CAAC,IAAI,CAAC,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC,QAAQ,CAAC;IAC1B,cAAc,EAAE,MAAM,CAAC;IACvB,UAAU,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC;CACvC;AA6CD,wBAAgB,iBAAiB,CAAC,OAAO,EAAE,OAAO,GAAG,MAAM,CAE1D;AAgBD,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,MAAM,EAAE,EACd,QAAQ,GAAE,MAAM,CAAC,QAA2B,GAC3C,mBAAmB,CAOrB;AAED,wBAAgB,4BAA4B,CAAC,OAAO,EAAE,OAAO,GAAG,OAAO,CAMtE;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,4BAA4B,EACrC,SAAS,GAAE,OAAO,CAAC,iCAAiC,CAAM,GACzD,OAAO,CAAC,OAAO,CAAC,CA8ElB"}
@@ -81,7 +81,7 @@ export async function guardBundledToolMutation(options, overrides = {}) {
81
81
  'can only install its own bundled tool versions. The available CLI may ' +
82
82
  'bundle newer tool versions.');
83
83
  const packageSpec = `${CLI_PACKAGE}@${availableVersion}`;
84
- const installCommand = formatGlobalCliInstallCommand(packageSpec, options.argv, options.env);
84
+ const installCommand = formatGlobalCliInstallCommand(packageSpec, options.argv, options.env, dependencies.fileExists);
85
85
  let accepted = false;
86
86
  try {
87
87
  accepted = await dependencies.confirmAction(`Update the OAT CLI to ${availableVersion} before running ${options.commandPath}?`, { interactive: options.interactive });
@@ -114,7 +114,7 @@ export async function guardBundledToolMutation(options, overrides = {}) {
114
114
  }
115
115
  catch {
116
116
  throw new CliError(`Failed to update the OAT CLI to ${availableVersion}. ` +
117
- `No tools were changed. Fix the npm installation issue and run: ${installCommand}`, 2);
117
+ `No tools were changed. Fix the package manager installation issue and run: ${installCommand}`, 2);
118
118
  }
119
119
  options.logger.info(`Updated the OAT CLI to ${availableVersion}. To let the new CLI install ` +
120
120
  `its bundled tools, rerun in ${options.rerunCommand.shell}:\n${options.rerunCommand.command}`);
@@ -0,0 +1,15 @@
1
+ import { type UpsertSectionResult } from '../shared/agents-md.js';
2
+ export declare const DECISION_AGENTS_SECTION_KEY = "decisions";
3
+ export declare function buildDecisionAgentsSectionBody(decisionsPath?: string): string;
4
+ export declare function buildScopedDecisionAgentsSectionBody(): string;
5
+ export interface InitializeDecisionAgentsGuidanceOptions {
6
+ projectRoot: string;
7
+ decisionsRoot: string;
8
+ }
9
+ export interface DecisionAgentsGuidanceResult {
10
+ root: UpsertSectionResult['action'];
11
+ scoped: UpsertSectionResult['action'];
12
+ }
13
+ export declare function initializeScopedDecisionAgentsGuidance(decisionsRoot: string): Promise<UpsertSectionResult>;
14
+ export declare function initializeDecisionAgentsGuidance(options: InitializeDecisionAgentsGuidanceOptions): Promise<DecisionAgentsGuidanceResult>;
15
+ //# sourceMappingURL=agents-guidance.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"agents-guidance.d.ts","sourceRoot":"","sources":["../../../src/commands/decision/agents-guidance.ts"],"names":[],"mappings":"AAGA,OAAO,EACL,KAAK,mBAAmB,EAEzB,MAAM,4BAA4B,CAAC;AAEpC,eAAO,MAAM,2BAA2B,cAAc,CAAC;AAwBvD,wBAAgB,8BAA8B,CAC5C,aAAa,SAAyB,GACrC,MAAM,CAUR;AAED,wBAAgB,oCAAoC,IAAI,MAAM,CAU7D;AAED,MAAM,WAAW,uCAAuC;IACtD,WAAW,EAAE,MAAM,CAAC;IACpB,aAAa,EAAE,MAAM,CAAC;CACvB;AAED,MAAM,WAAW,4BAA4B;IAC3C,IAAI,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;IACpC,MAAM,EAAE,mBAAmB,CAAC,QAAQ,CAAC,CAAC;CACvC;AAED,wBAAsB,sCAAsC,CAC1D,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,mBAAmB,CAAC,CAO9B;AAED,wBAAsB,gCAAgC,CACpD,OAAO,EAAE,uCAAuC,GAC/C,OAAO,CAAC,4BAA4B,CAAC,CAgBvC"}
@@ -0,0 +1,51 @@
1
+ import { mkdir } from 'node:fs/promises';
2
+ import { isAbsolute, relative, sep } from 'node:path';
3
+ import { upsertAgentsMdSection, } from '../shared/agents-md.js';
4
+ export const DECISION_AGENTS_SECTION_KEY = 'decisions';
5
+ const DEFAULT_DECISIONS_PATH = '.oat/repo/reference/decisions';
6
+ function portablePath(path) {
7
+ return path.split(sep).join('/');
8
+ }
9
+ function displayDecisionsPath(projectRoot, decisionsRoot) {
10
+ const relativePath = relative(projectRoot, decisionsRoot);
11
+ if (relativePath.length > 0 &&
12
+ !relativePath.startsWith('..') &&
13
+ !isAbsolute(relativePath)) {
14
+ return portablePath(relativePath);
15
+ }
16
+ return portablePath(decisionsRoot);
17
+ }
18
+ export function buildDecisionAgentsSectionBody(decisionsPath = DEFAULT_DECISIONS_PATH) {
19
+ return [
20
+ '### Decision Records',
21
+ '',
22
+ `- Durable repository decisions live under \`${decisionsPath}/\`; read \`${decisionsPath}/AGENTS.md\` before working with them.`,
23
+ `- Before finalizing a durable repository decision, review \`${decisionsPath}/index.md\` and any relevant records.`,
24
+ '- When the user asks to record a durable decision or confirms a proposed capture, use `oat-pjm-decision` when that skill is installed; otherwise use `oat decision new`.',
25
+ '- Do not hand-edit the generated decision index; run `oat decision regenerate-index` after record changes or to resolve index conflicts.',
26
+ '- If the decision surface is missing, initialize it with `oat decision init`.',
27
+ ].join('\n');
28
+ }
29
+ export function buildScopedDecisionAgentsSectionBody() {
30
+ return [
31
+ '# Decision Record Guidance',
32
+ '',
33
+ '- This directory stores one Markdown file per durable repository decision plus a generated `index.md`.',
34
+ '- Review the index and relevant existing records before finalizing a decision.',
35
+ '- Create records with `oat decision new`; do not create IDs or filenames by hand.',
36
+ '- Keep context, the chosen decision, and consequences in the decision record.',
37
+ '- Do not hand-edit the generated table in `index.md`. Run `oat decision regenerate-index` after record changes or to resolve index conflicts.',
38
+ ].join('\n');
39
+ }
40
+ export async function initializeScopedDecisionAgentsGuidance(decisionsRoot) {
41
+ await mkdir(decisionsRoot, { recursive: true });
42
+ return upsertAgentsMdSection(decisionsRoot, DECISION_AGENTS_SECTION_KEY, buildScopedDecisionAgentsSectionBody());
43
+ }
44
+ export async function initializeDecisionAgentsGuidance(options) {
45
+ const scoped = await initializeScopedDecisionAgentsGuidance(options.decisionsRoot);
46
+ const root = await upsertAgentsMdSection(options.projectRoot, DECISION_AGENTS_SECTION_KEY, buildDecisionAgentsSectionBody(displayDecisionsPath(options.projectRoot, options.decisionsRoot)));
47
+ return {
48
+ root: root.action,
49
+ scoped: scoped.action,
50
+ };
51
+ }
@@ -2,6 +2,7 @@ import { buildCommandContext } from '../../app/command-context.js';
2
2
  import { resolveAssetsRoot } from '../../fs/assets.js';
3
3
  import { resolveProjectRoot } from '../../fs/paths.js';
4
4
  import { Command } from 'commander';
5
+ import { initializeDecisionAgentsGuidance } from './agents-guidance.js';
5
6
  import { initializeDecisionRecords } from './init.js';
6
7
  import { migrateDecisionRecords } from './migrate.js';
7
8
  import { createDecisionRecord } from './new.js';
@@ -10,6 +11,7 @@ interface DecisionCommandDependencies {
10
11
  buildCommandContext: typeof buildCommandContext;
11
12
  resolveProjectRoot: typeof resolveProjectRoot;
12
13
  resolveAssetsRoot: typeof resolveAssetsRoot;
14
+ initializeDecisionAgentsGuidance: typeof initializeDecisionAgentsGuidance;
13
15
  initializeDecisionRecords: typeof initializeDecisionRecords;
14
16
  regenerateDecisionIndex: typeof regenerateDecisionIndex;
15
17
  createDecisionRecord: typeof createDecisionRecord;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/decision/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAyB7D,UAAU,2BAA2B;IACnC,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,yBAAyB,EAAE,OAAO,yBAAyB,CAAC;IAC5D,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;IAClD,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AA8CD,wBAAgB,qBAAqB,CACnC,SAAS,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACnD,OAAO,CAmMT"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/commands/decision/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,mBAAmB,EAAuB,MAAM,sBAAsB,CAAC;AAEhF,OAAO,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAC;AAC/C,OAAO,EAAE,kBAAkB,EAAE,MAAM,WAAW,CAAC;AAC/C,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEpC,OAAO,EAAE,gCAAgC,EAAE,MAAM,mBAAmB,CAAC;AACrE,OAAO,EAAE,yBAAyB,EAAE,MAAM,QAAQ,CAAC;AACnD,OAAO,EAAE,sBAAsB,EAAE,MAAM,WAAW,CAAC;AACnD,OAAO,EAAE,oBAAoB,EAAE,MAAM,OAAO,CAAC;AAC7C,OAAO,EAAE,uBAAuB,EAAE,MAAM,oBAAoB,CAAC;AAyB7D,UAAU,2BAA2B;IACnC,mBAAmB,EAAE,OAAO,mBAAmB,CAAC;IAChD,kBAAkB,EAAE,OAAO,kBAAkB,CAAC;IAC9C,iBAAiB,EAAE,OAAO,iBAAiB,CAAC;IAC5C,gCAAgC,EAAE,OAAO,gCAAgC,CAAC;IAC1E,yBAAyB,EAAE,OAAO,yBAAyB,CAAC;IAC5D,uBAAuB,EAAE,OAAO,uBAAuB,CAAC;IACxD,oBAAoB,EAAE,OAAO,oBAAoB,CAAC;IAClD,sBAAsB,EAAE,OAAO,sBAAsB,CAAC;CACvD;AA+CD,wBAAgB,qBAAqB,CACnC,SAAS,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACnD,OAAO,CAoNT"}
@@ -4,6 +4,7 @@ import { readGlobalOptions } from '../shared/shared.utils.js';
4
4
  import { resolveAssetsRoot } from '../../fs/assets.js';
5
5
  import { resolveProjectRoot } from '../../fs/paths.js';
6
6
  import { Command } from 'commander';
7
+ import { initializeDecisionAgentsGuidance } from './agents-guidance.js';
7
8
  import { initializeDecisionRecords } from './init.js';
8
9
  import { migrateDecisionRecords } from './migrate.js';
9
10
  import { createDecisionRecord } from './new.js';
@@ -12,6 +13,7 @@ const DEFAULT_DEPENDENCIES = {
12
13
  buildCommandContext,
13
14
  resolveProjectRoot,
14
15
  resolveAssetsRoot,
16
+ initializeDecisionAgentsGuidance,
15
17
  initializeDecisionRecords,
16
18
  regenerateDecisionIndex,
17
19
  createDecisionRecord,
@@ -55,8 +57,19 @@ export function createDecisionCommand(overrides = {}) {
55
57
  const projectRoot = await dependencies.resolveProjectRoot(context.cwd);
56
58
  const decisionsRoot = await resolveDecisionsRoot(context, projectRoot, options.decisionsRoot);
57
59
  const result = await dependencies.initializeDecisionRecords(decisionsRoot);
60
+ let guidance;
61
+ try {
62
+ guidance = await dependencies.initializeDecisionAgentsGuidance({
63
+ projectRoot,
64
+ decisionsRoot,
65
+ });
66
+ }
67
+ catch (error) {
68
+ const message = error instanceof Error ? error.message : String(error);
69
+ throw new Error(`Decision index initialized at ${result.decisionsRoot}, but AGENTS.md guidance could not be written: ${message}. Fix the guidance write error and rerun \`oat decision init\`.`, { cause: error });
70
+ }
58
71
  if (context.json) {
59
- context.logger.json({ status: 'ok', ...result });
72
+ context.logger.json({ status: 'ok', ...result, guidance });
60
73
  }
61
74
  else {
62
75
  context.logger.info(`Initialized decision scaffold at ${result.decisionsRoot}`);
@@ -66,6 +79,7 @@ export function createDecisionCommand(overrides = {}) {
66
79
  if (result.skipped.length > 0) {
67
80
  context.logger.info(`Skipped existing: ${result.skipped.join(', ')}`);
68
81
  }
82
+ context.logger.info(`AGENTS.md guidance: root=${guidance.root}, decisions=${guidance.scoped}`);
69
83
  }
70
84
  process.exitCode = 0;
71
85
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/commands/init/tools/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EAEnB,MAAM,sBAAsB,CAAC;AAI9B,OAAO,EACL,KAAK,mBAAmB,EAGzB,MAAM,4BAA4B,CAAC;AACpC,OAAO,EACL,KAAK,iBAAiB,EACtB,KAAK,aAAa,EAClB,KAAK,YAAY,EAGlB,MAAM,iCAAiC,CAAC;AASzC,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,mCAAmC,CAAC;AAC1E,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,8BAA8B,C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,EAAE,aAAa,CAAC;CACtB;AAED;;;;GAIG;AACH,wBAAgB,sBAAsB,CACpC,IAAI,EAAE,eAAe,EAAE,EACvB,OAAO,EAAE,eAAe,EAAE,GACzB,MAAM,CASR;AA4GD,wBAAgB,2BAA2B,IAAI,oBAAoB,GAAG,IAAI,CAIzE;AA2TD,UAAU,aAAa;IACrB,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,iBAAiB,CAAC;CAC1B;AAED,wBAAgB,yBAAyB,CAAC,KAAK,EAAE,aAAa,EAAE,GAAG,MAAM,CA8CxE;AAED,wBAAsB,YAAY,CAChC,OAAO,EAAE,cAAc,EACvB,YAAY,EAAE,qBAAqB,GAClC,OAAO,CAAC,QAAQ,EAAE,CAAC,CAqfrB;AAED,wBAAsB,wBAAwB,CAC5C,OAAO,EAAE,cAAc,GACtB,OAAO,CAAC,QAAQ,EAAE,CAAC,CAErB;AAED,wBAAgB,sBAAsB,CACpC,SAAS,GAAE,OAAO,CAAC,qBAAqB,CAAM,GAC7C,OAAO,CAmET"}
@@ -1,6 +1,7 @@
1
1
  import { rm, unlink } from 'node:fs/promises';
2
2
  import { join } from 'node:path';
3
3
  import { buildCommandContext, } from '../../../app/command-context.js';
4
+ import { buildDecisionAgentsSectionBody, DECISION_AGENTS_SECTION_KEY, } from '../../decision/agents-guidance.js';
4
5
  import { copyDirWithStatus } from '../../init/tools/shared/copy-helpers.js';
5
6
  import { applyGitignore } from '../../local/apply.js';
6
7
  import { addLocalPaths } from '../../local/manage.js';
@@ -858,6 +859,9 @@ export async function runInitTools(context, dependencies) {
858
859
  const projectManagementSectionResult = selectedPacks.includes('project-management')
859
860
  ? await dependencies.upsertAgentsMdSection(projectRoot, PROJECT_MANAGEMENT_AGENTS_SECTION_KEY, buildProjectManagementAgentsSectionBody())
860
861
  : null;
862
+ const decisionSectionResult = selectedPacks.includes('project-management')
863
+ ? await dependencies.upsertAgentsMdSection(projectRoot, DECISION_AGENTS_SECTION_KEY, buildDecisionAgentsSectionBody())
864
+ : null;
861
865
  // Migrate: remove legacy <!-- OAT workflows --> section if present
862
866
  await dependencies.removeAgentsMdSection(projectRoot, 'workflows');
863
867
  if (!context.json && sectionResult.action !== 'no-change') {
@@ -868,6 +872,11 @@ export async function runInitTools(context, dependencies) {
868
872
  projectManagementSectionResult.action !== 'no-change') {
869
873
  context.logger.info(`AGENTS.md project-management section ${projectManagementSectionResult.action}.`);
870
874
  }
875
+ if (!context.json &&
876
+ decisionSectionResult !== null &&
877
+ decisionSectionResult.action !== 'no-change') {
878
+ context.logger.info(`AGENTS.md decisions section ${decisionSectionResult.action}.`);
879
+ }
871
880
  const affectedScopesList = [...affectedScopes];
872
881
  lastRunInitToolsMetadata = {
873
882
  affectedScopes: affectedScopesList,
@@ -1 +1 @@
1
- {"version":3,"file":"agents-guidance.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init/tools/project-management/agents-guidance.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qCAAqC,uBAAuB,CAAC;AAE1E,wBAAgB,uCAAuC,IAAI,MAAM,CAehE"}
1
+ {"version":3,"file":"agents-guidance.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init/tools/project-management/agents-guidance.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,qCAAqC,uBAAuB,CAAC;AAE1E,wBAAgB,uCAAuC,IAAI,MAAM,CAShE"}
@@ -7,11 +7,5 @@ export function buildProjectManagementAgentsSectionBody() {
7
7
  '- Consult it when prioritizing or planning work, checking the backlog, starting or closing tracked work, or looking for established repository context.',
8
8
  '- Start with `.oat/repo/AGENTS.md`; it routes to `pjm/` for active state and `reference/` for durable records.',
9
9
  '- If the surface is missing, initialize it with `oat pjm init`.',
10
- '',
11
- '### Decision Records',
12
- '',
13
- '- Before finalizing a durable repository decision, review `.oat/repo/reference/decisions/index.md` and any relevant records.',
14
- '- When the user asks to record a durable decision or confirms a proposed capture, use `oat-pjm-decision`; use `oat decision new` for the CLI path.',
15
- '- Do not hand-edit the generated decision index; run `oat decision regenerate-index` after record changes.',
16
10
  ].join('\n');
17
11
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init/tools/project-management/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAY9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AAMtC,UAAU,sCAAsC;IAC9C,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,wBAAwB,EAAE,CACxB,OAAO,EAAE,+BAA+B,KACrC,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC9C;AASD,wBAAgB,uCAAuC,CACrD,SAAS,GAAE,OAAO,CAAC,sCAAsC,CAAM,GAC9D,OAAO,CAsHT"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../../src/commands/init/tools/project-management/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,KAAK,cAAc,EACnB,KAAK,aAAa,EACnB,MAAM,sBAAsB,CAAC;AAgB9B,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAMpC,OAAO,EAEL,KAAK,+BAA+B,EACpC,KAAK,8BAA8B,EACpC,MAAM,8BAA8B,CAAC;AAMtC,UAAU,sCAAsC;IAC9C,mBAAmB,EAAE,CAAC,OAAO,EAAE,aAAa,KAAK,cAAc,CAAC;IAChE,kBAAkB,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrD,iBAAiB,EAAE,MAAM,OAAO,CAAC,MAAM,CAAC,CAAC;IACzC,wBAAwB,EAAE,CACxB,OAAO,EAAE,+BAA+B,KACrC,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC9C;AASD,wBAAgB,uCAAuC,CACrD,SAAS,GAAE,OAAO,CAAC,sCAAsC,CAAM,GAC9D,OAAO,CAwIT"}
@@ -1,4 +1,5 @@
1
1
  import { buildCommandContext, } from '../../../../app/command-context.js';
2
+ import { buildDecisionAgentsSectionBody, DECISION_AGENTS_SECTION_KEY, } from '../../../decision/agents-guidance.js';
2
3
  import { upsertAgentsMdSection, } from '../../../shared/agents-md.js';
3
4
  import { readGlobalOptions } from '../../../shared/shared.utils.js';
4
5
  import { canonicalPathsForPack, setInstalledCanonicalPaths, } from '../../../tools/shared/install-sync-context.js';
@@ -52,11 +53,15 @@ export function createInitToolsProjectManagementCommand(overrides = {}) {
52
53
  force: options.force,
53
54
  });
54
55
  didInstall = true;
55
- let agentsGuidanceAction;
56
+ let projectManagementGuidanceAction;
57
+ let decisionGuidanceAction;
56
58
  let agentsGuidanceWarning;
57
59
  try {
58
- const agentsGuidanceResult = await upsertAgentsMdSection(targetRoot, PROJECT_MANAGEMENT_AGENTS_SECTION_KEY, buildProjectManagementAgentsSectionBody());
59
- agentsGuidanceAction = agentsGuidanceResult.action;
60
+ const projectManagementGuidanceResult = await upsertAgentsMdSection(targetRoot, PROJECT_MANAGEMENT_AGENTS_SECTION_KEY, buildProjectManagementAgentsSectionBody());
61
+ projectManagementGuidanceAction =
62
+ projectManagementGuidanceResult.action;
63
+ const decisionGuidanceResult = await upsertAgentsMdSection(targetRoot, DECISION_AGENTS_SECTION_KEY, buildDecisionAgentsSectionBody());
64
+ decisionGuidanceAction = decisionGuidanceResult.action;
60
65
  }
61
66
  catch (error) {
62
67
  const message = error instanceof Error ? error.message : String(error);
@@ -79,9 +84,13 @@ export function createInitToolsProjectManagementCommand(overrides = {}) {
79
84
  context.logger.info(`Target root: ${targetRoot}`);
80
85
  context.logger.info(`Skills: copied=${result.copiedSkills.length}, updated=${result.updatedSkills.length}, skipped=${result.skippedSkills.length}`);
81
86
  context.logger.info(`Templates: copied=${result.copiedTemplates.length}, updated=${result.updatedTemplates.length}, skipped=${result.skippedTemplates.length}`);
82
- if (agentsGuidanceAction !== undefined &&
83
- agentsGuidanceAction !== 'no-change') {
84
- context.logger.info(`AGENTS.md project-management section ${agentsGuidanceAction}.`);
87
+ if (projectManagementGuidanceAction !== undefined &&
88
+ projectManagementGuidanceAction !== 'no-change') {
89
+ context.logger.info(`AGENTS.md project-management section ${projectManagementGuidanceAction}.`);
90
+ }
91
+ if (decisionGuidanceAction !== undefined &&
92
+ decisionGuidanceAction !== 'no-change') {
93
+ context.logger.info(`AGENTS.md decisions section ${decisionGuidanceAction}.`);
85
94
  }
86
95
  if (agentsGuidanceWarning !== undefined) {
87
96
  context.logger.warn(agentsGuidanceWarning);
@@ -9,6 +9,6 @@ export interface RepoReferenceInitResult {
9
9
  skipped: string[];
10
10
  }
11
11
  export declare const INSTRUCTIONS_SYNC_HINT: string;
12
- export declare const CANONICAL_REPO_REFERENCE_PATHS: readonly [...("AGENTS.md" | "README.md" | "pjm/AGENTS.md" | "pjm/current-state.md" | "pjm/handoffs/README.md" | "pjm/roadmap.md" | "reference/AGENTS.md")[], "pjm/backlog/index.md", "pjm/backlog/completed.md", "pjm/backlog/items/.gitkeep", "pjm/backlog/archived/.gitkeep", "reference/decisions/index.md"];
12
+ export declare const CANONICAL_REPO_REFERENCE_PATHS: readonly [...("AGENTS.md" | "README.md" | "pjm/AGENTS.md" | "pjm/current-state.md" | "pjm/handoffs/README.md" | "pjm/roadmap.md" | "reference/AGENTS.md")[], "pjm/backlog/index.md", "pjm/backlog/completed.md", "pjm/backlog/items/.gitkeep", "pjm/backlog/archived/.gitkeep", "reference/decisions/AGENTS.md", "reference/decisions/index.md"];
13
13
  export declare function initializeRepoReference(options: InitializeRepoReferenceOptions): Promise<RepoReferenceInitResult>;
14
14
  //# sourceMappingURL=init.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/init.ts"],"names":[],"mappings":"AAOA,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAoBD,eAAO,MAAM,sBAAsB,QAEiD,CAAC;AAWrF,eAAO,MAAM,8BAA8B,iTAIjC,CAAC;AAyEX,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC,CAgElC"}
1
+ {"version":3,"file":"init.d.ts","sourceRoot":"","sources":["../../../src/commands/pjm/init.ts"],"names":[],"mappings":"AAQA,MAAM,WAAW,8BAA8B;IAC7C,QAAQ,EAAE,MAAM,CAAC;IACjB,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,MAAM,WAAW,uBAAuB;IACtC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,OAAO,EAAE,MAAM,EAAE,CAAC;CACnB;AAoBD,eAAO,MAAM,sBAAsB,QAEiD,CAAC;AAerF,eAAO,MAAM,8BAA8B,kVAIjC,CAAC;AAyEX,wBAAsB,uBAAuB,CAC3C,OAAO,EAAE,8BAA8B,GACtC,OAAO,CAAC,uBAAuB,CAAC,CAqElC"}
@@ -1,6 +1,7 @@
1
1
  import { access, mkdir, readFile, writeFile } from 'node:fs/promises';
2
2
  import { dirname, join } from 'node:path';
3
3
  import { initializeBacklog } from '../backlog/init.js';
4
+ import { initializeScopedDecisionAgentsGuidance } from '../decision/agents-guidance.js';
4
5
  import { initializeDecisionRecords } from '../decision/init.js';
5
6
  import { stripTemplateFrontmatter } from '../shared/strip-template-frontmatter.js';
6
7
  const TEMPLATE_TARGETS = [
@@ -23,7 +24,11 @@ const BACKLOG_PATHS = [
23
24
  'pjm/backlog/items/.gitkeep',
24
25
  'pjm/backlog/archived/.gitkeep',
25
26
  ];
26
- const DECISION_PATHS = ['reference/decisions/index.md'];
27
+ const DECISION_AGENTS_PATH = 'reference/decisions/AGENTS.md';
28
+ const DECISION_PATHS = [
29
+ DECISION_AGENTS_PATH,
30
+ 'reference/decisions/index.md',
31
+ ];
27
32
  export const CANONICAL_REPO_REFERENCE_PATHS = [
28
33
  ...TEMPLATE_TARGETS.map((target) => target.target),
29
34
  ...BACKLOG_PATHS,
@@ -119,6 +124,9 @@ export async function initializeRepoReference(options) {
119
124
  }
120
125
  }
121
126
  await initializeDecisionRecords(join(options.repoRoot, 'reference', 'decisions'));
127
+ if (!existingDecisionPaths.has(DECISION_AGENTS_PATH)) {
128
+ await initializeScopedDecisionAgentsGuidance(join(options.repoRoot, 'reference', 'decisions'));
129
+ }
122
130
  for (const relativePath of DECISION_PATHS) {
123
131
  if (existingDecisionPaths.has(relativePath)) {
124
132
  skipped.push(relativePath);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-agent-toolkit/cli",
3
- "version": "0.2.15",
3
+ "version": "0.2.17",
4
4
  "private": false,
5
5
  "description": "Open Agent Toolkit CLI",
6
6
  "homepage": "https://github.com/voxmedia/open-agent-toolkit/tree/main/packages/cli",
@@ -34,7 +34,7 @@
34
34
  "ora": "^9.0.0",
35
35
  "yaml": "2.8.2",
36
36
  "zod": "^3.25.76",
37
- "@open-agent-toolkit/control-plane": "0.2.15"
37
+ "@open-agent-toolkit/control-plane": "0.2.17"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.10.0",