@open-agent-toolkit/cli 0.2.36 → 0.2.37

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 (183) hide show
  1. package/assets/bundle-metadata.json +1 -1
  2. package/assets/docs/cli-utilities/backlog-lifecycle.md +18 -0
  3. package/assets/docs/cli-utilities/bootstrap.md +6 -3
  4. package/assets/docs/cli-utilities/config-and-local-state.md +26 -12
  5. package/assets/docs/cli-utilities/configuration.md +36 -13
  6. package/assets/docs/cli-utilities/tool-packs.md +423 -51
  7. package/assets/docs/provider-sync/scope-and-surface.md +4 -1
  8. package/assets/docs/reference/cli-reference.md +5 -3
  9. package/assets/docs/reference/file-locations.md +28 -4
  10. package/assets/docs/reference/troubleshooting.md +132 -2
  11. package/assets/docs/workflows/projects/lifecycle.md +21 -2
  12. package/assets/public-package-versions.json +4 -4
  13. package/assets/scripts/generate-oat-state.sh +441 -0
  14. package/assets/scripts/generate-thin-index.sh +200 -0
  15. package/assets/skills/oat-agent-instructions-analyze/SKILL.md +10 -5
  16. package/assets/skills/oat-agent-instructions-apply/SKILL.md +30 -5
  17. package/assets/skills/oat-brainstorm/SKILL.md +34 -8
  18. package/assets/skills/oat-brainstorm/references/destinations.md +6 -1
  19. package/assets/skills/oat-docs-analyze/SKILL.md +9 -4
  20. package/assets/skills/oat-docs-apply/SKILL.md +6 -3
  21. package/assets/skills/oat-pjm-add-backlog-item/SKILL.md +14 -1
  22. package/assets/skills/oat-pjm-decision/SKILL.md +22 -10
  23. package/assets/skills/oat-pjm-review-backlog/SKILL.md +20 -3
  24. package/assets/skills/oat-pjm-update-repo-reference/SKILL.md +20 -10
  25. package/assets/skills/oat-project-autonomous/references/gate-inventory.md +1 -1
  26. package/assets/skills/oat-project-document/SKILL.md +21 -3
  27. package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +1 -1
  28. package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +1 -1
  29. package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +1 -1
  30. package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +1 -1
  31. package/assets/skills/oat-project-summary/SKILL.md +23 -11
  32. package/assets/skills/oat-repo-knowledge-index/SKILL.md +6 -3
  33. package/dist/commands/backlog/index.d.ts +2 -0
  34. package/dist/commands/backlog/index.d.ts.map +1 -1
  35. package/dist/commands/backlog/index.js +67 -23
  36. package/dist/commands/backlog/new.d.ts +3 -0
  37. package/dist/commands/backlog/new.d.ts.map +1 -1
  38. package/dist/commands/backlog/new.js +8 -21
  39. package/dist/commands/decision/agents-guidance.d.ts.map +1 -1
  40. package/dist/commands/decision/agents-guidance.js +2 -1
  41. package/dist/commands/decision/index.d.ts +2 -0
  42. package/dist/commands/decision/index.d.ts.map +1 -1
  43. package/dist/commands/decision/index.js +19 -3
  44. package/dist/commands/decision/new.d.ts +4 -0
  45. package/dist/commands/decision/new.d.ts.map +1 -1
  46. package/dist/commands/decision/new.js +11 -30
  47. package/dist/commands/doctor/index.d.ts +4 -0
  48. package/dist/commands/doctor/index.d.ts.map +1 -1
  49. package/dist/commands/doctor/index.js +254 -9
  50. package/dist/commands/init/tools/brainstorm/index.d.ts.map +1 -1
  51. package/dist/commands/init/tools/brainstorm/index.js +20 -6
  52. package/dist/commands/init/tools/docs/index.d.ts.map +1 -1
  53. package/dist/commands/init/tools/docs/index.js +4 -1
  54. package/dist/commands/init/tools/ideas/index.d.ts.map +1 -1
  55. package/dist/commands/init/tools/ideas/index.js +4 -1
  56. package/dist/commands/init/tools/index.d.ts +11 -2
  57. package/dist/commands/init/tools/index.d.ts.map +1 -1
  58. package/dist/commands/init/tools/index.js +459 -351
  59. package/dist/commands/init/tools/install-state.d.ts +2 -0
  60. package/dist/commands/init/tools/install-state.d.ts.map +1 -1
  61. package/dist/commands/init/tools/install-state.js +11 -0
  62. package/dist/commands/init/tools/project-management/agents-guidance.d.ts.map +1 -1
  63. package/dist/commands/init/tools/project-management/agents-guidance.js +3 -1
  64. package/dist/commands/init/tools/project-management/index.d.ts +1 -0
  65. package/dist/commands/init/tools/project-management/index.d.ts.map +1 -1
  66. package/dist/commands/init/tools/project-management/index.js +24 -55
  67. package/dist/commands/init/tools/project-management/install-project-management.d.ts +4 -0
  68. package/dist/commands/init/tools/project-management/install-project-management.d.ts.map +1 -1
  69. package/dist/commands/init/tools/project-management/install-project-management.js +4 -1
  70. package/dist/commands/init/tools/research/index.d.ts.map +1 -1
  71. package/dist/commands/init/tools/research/index.js +4 -1
  72. package/dist/commands/init/tools/shared/copy-helpers.d.ts.map +1 -1
  73. package/dist/commands/init/tools/shared/copy-helpers.js +10 -0
  74. package/dist/commands/init/tools/shared/skill-manifest.d.ts +15 -15
  75. package/dist/commands/init/tools/shared/skill-manifest.d.ts.map +1 -1
  76. package/dist/commands/init/tools/shared/skill-manifest.js +17 -122
  77. package/dist/commands/init/tools/utility/index.d.ts.map +1 -1
  78. package/dist/commands/init/tools/utility/index.js +4 -1
  79. package/dist/commands/init/tools/workflows/index.d.ts.map +1 -1
  80. package/dist/commands/init/tools/workflows/index.js +4 -1
  81. package/dist/commands/init/tools/workflows/install-workflows.d.ts.map +1 -1
  82. package/dist/commands/init/tools/workflows/install-workflows.js +2 -4
  83. package/dist/commands/pjm/adoption.d.ts +12 -0
  84. package/dist/commands/pjm/adoption.d.ts.map +1 -0
  85. package/dist/commands/pjm/adoption.js +47 -0
  86. package/dist/commands/pjm/doctor.d.ts +3 -2
  87. package/dist/commands/pjm/doctor.d.ts.map +1 -1
  88. package/dist/commands/pjm/doctor.js +28 -13
  89. package/dist/commands/pjm/index.d.ts +2 -0
  90. package/dist/commands/pjm/index.d.ts.map +1 -1
  91. package/dist/commands/pjm/index.js +11 -3
  92. package/dist/commands/pjm/init.d.ts +3 -0
  93. package/dist/commands/pjm/init.d.ts.map +1 -1
  94. package/dist/commands/pjm/init.js +37 -32
  95. package/dist/commands/pjm/migrate.d.ts +1 -0
  96. package/dist/commands/pjm/migrate.d.ts.map +1 -1
  97. package/dist/commands/pjm/migrate.js +1 -0
  98. package/dist/commands/pjm/template-source.d.ts +14 -0
  99. package/dist/commands/pjm/template-source.d.ts.map +1 -0
  100. package/dist/commands/pjm/template-source.js +56 -0
  101. package/dist/commands/remove/skills/remove-skills.d.ts.map +1 -1
  102. package/dist/commands/remove/skills/remove-skills.js +10 -19
  103. package/dist/commands/status/index.d.ts +5 -0
  104. package/dist/commands/status/index.d.ts.map +1 -1
  105. package/dist/commands/status/index.js +203 -2
  106. package/dist/commands/sync/index.d.ts.map +1 -1
  107. package/dist/commands/sync/index.js +40 -7
  108. package/dist/commands/sync/sync.types.d.ts +4 -0
  109. package/dist/commands/sync/sync.types.d.ts.map +1 -1
  110. package/dist/commands/tools/has/has-pack.d.ts +11 -2
  111. package/dist/commands/tools/has/has-pack.d.ts.map +1 -1
  112. package/dist/commands/tools/has/has-pack.js +33 -20
  113. package/dist/commands/tools/index.d.ts.map +1 -1
  114. package/dist/commands/tools/index.js +3 -1
  115. package/dist/commands/tools/info/info-tool.d.ts +3 -0
  116. package/dist/commands/tools/info/info-tool.d.ts.map +1 -1
  117. package/dist/commands/tools/info/info-tool.js +29 -4
  118. package/dist/commands/tools/list/list-tools.d.ts +3 -0
  119. package/dist/commands/tools/list/list-tools.d.ts.map +1 -1
  120. package/dist/commands/tools/list/list-tools.js +31 -4
  121. package/dist/commands/tools/migrate/index.d.ts +26 -0
  122. package/dist/commands/tools/migrate/index.d.ts.map +1 -0
  123. package/dist/commands/tools/migrate/index.js +312 -0
  124. package/dist/commands/tools/migrate/migrate-pack.d.ts +81 -0
  125. package/dist/commands/tools/migrate/migrate-pack.d.ts.map +1 -0
  126. package/dist/commands/tools/migrate/migrate-pack.js +324 -0
  127. package/dist/commands/tools/outdated/outdated-tools.d.ts +11 -0
  128. package/dist/commands/tools/outdated/outdated-tools.d.ts.map +1 -1
  129. package/dist/commands/tools/outdated/outdated-tools.js +33 -5
  130. package/dist/commands/tools/remove/index.d.ts.map +1 -1
  131. package/dist/commands/tools/remove/index.js +73 -20
  132. package/dist/commands/tools/remove/remove-tools.d.ts +28 -0
  133. package/dist/commands/tools/remove/remove-tools.d.ts.map +1 -1
  134. package/dist/commands/tools/remove/remove-tools.js +156 -26
  135. package/dist/commands/tools/shared/apply-pack-reconcile.d.ts +41 -0
  136. package/dist/commands/tools/shared/apply-pack-reconcile.d.ts.map +1 -0
  137. package/dist/commands/tools/shared/apply-pack-reconcile.js +126 -0
  138. package/dist/commands/tools/shared/auto-sync.d.ts +5 -2
  139. package/dist/commands/tools/shared/auto-sync.d.ts.map +1 -1
  140. package/dist/commands/tools/shared/auto-sync.js +1 -0
  141. package/dist/commands/tools/shared/content-digest.d.ts +3 -0
  142. package/dist/commands/tools/shared/content-digest.d.ts.map +1 -0
  143. package/dist/commands/tools/shared/content-digest.js +57 -0
  144. package/dist/commands/tools/shared/format-pack-inventory.d.ts +3 -0
  145. package/dist/commands/tools/shared/format-pack-inventory.d.ts.map +1 -0
  146. package/dist/commands/tools/shared/format-pack-inventory.js +21 -0
  147. package/dist/commands/tools/shared/install-sync-context.d.ts.map +1 -1
  148. package/dist/commands/tools/shared/install-sync-context.js +2 -25
  149. package/dist/commands/tools/shared/pack-inventory.d.ts +46 -0
  150. package/dist/commands/tools/shared/pack-inventory.d.ts.map +1 -0
  151. package/dist/commands/tools/shared/pack-inventory.js +207 -0
  152. package/dist/commands/tools/shared/pack-lifecycle.d.ts +34 -0
  153. package/dist/commands/tools/shared/pack-lifecycle.d.ts.map +1 -0
  154. package/dist/commands/tools/shared/pack-lifecycle.js +67 -0
  155. package/dist/commands/tools/shared/pack-manifest.d.ts +11 -0
  156. package/dist/commands/tools/shared/pack-manifest.d.ts.map +1 -0
  157. package/dist/commands/tools/shared/pack-manifest.js +384 -0
  158. package/dist/commands/tools/shared/pack-paths.d.ts +21 -0
  159. package/dist/commands/tools/shared/pack-paths.d.ts.map +1 -0
  160. package/dist/commands/tools/shared/pack-paths.js +35 -0
  161. package/dist/commands/tools/shared/pack-reconcile.d.ts +64 -0
  162. package/dist/commands/tools/shared/pack-reconcile.d.ts.map +1 -0
  163. package/dist/commands/tools/shared/pack-reconcile.js +158 -0
  164. package/dist/commands/tools/shared/project-tools-config.d.ts.map +1 -1
  165. package/dist/commands/tools/shared/project-tools-config.js +12 -38
  166. package/dist/commands/tools/shared/scan-tools.js +2 -2
  167. package/dist/commands/tools/shared/scoped-pack-intent.d.ts +34 -0
  168. package/dist/commands/tools/shared/scoped-pack-intent.d.ts.map +1 -0
  169. package/dist/commands/tools/shared/scoped-pack-intent.js +116 -0
  170. package/dist/commands/tools/shared/types.d.ts +22 -0
  171. package/dist/commands/tools/shared/types.d.ts.map +1 -1
  172. package/dist/commands/tools/update/index.d.ts.map +1 -1
  173. package/dist/commands/tools/update/index.js +30 -5
  174. package/dist/commands/tools/update/update-tools.d.ts +9 -1
  175. package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
  176. package/dist/commands/tools/update/update-tools.js +176 -64
  177. package/dist/config/oat-config.d.ts +6 -0
  178. package/dist/config/oat-config.d.ts.map +1 -1
  179. package/dist/config/oat-config.js +49 -20
  180. package/dist/fs/paths.d.ts +12 -0
  181. package/dist/fs/paths.d.ts.map +1 -1
  182. package/dist/fs/paths.js +87 -1
  183. package/package.json +2 -2
@@ -1,64 +1,18 @@
1
1
  import { join } from 'node:path';
2
- import { BRAINSTORM_SKILLS, CORE_SKILLS, DOCS_SKILLS, DOCS_SCRIPTS, IDEA_SKILLS, PROJECT_MANAGEMENT_SKILLS, PROJECT_MANAGEMENT_SCRIPTS, PROJECT_MANAGEMENT_TEMPLATES, RESEARCH_AGENTS, RESEARCH_SKILLS, UTILITY_SKILLS, WORKFLOW_AGENTS, WORKFLOW_SKILLS, WORKFLOW_SCRIPTS, WORKFLOW_TEMPLATES, } from '../../init/tools/shared/skill-manifest.js';
3
- const BUNDLED_PACK_MEMBERS = {
4
- core: CORE_SKILLS.map((name) => ({ name, type: 'skill' })),
5
- ideas: IDEA_SKILLS.map((name) => ({ name, type: 'skill' })),
6
- docs: DOCS_SKILLS.map((name) => ({ name, type: 'skill' })),
7
- workflows: [
8
- ...WORKFLOW_SKILLS.map((name) => ({ name, type: 'skill' })),
9
- ...WORKFLOW_AGENTS.map((name) => ({
10
- name: name.replace(/\.md$/, ''),
11
- type: 'agent',
12
- })),
13
- ],
14
- utility: UTILITY_SKILLS.map((name) => ({ name, type: 'skill' })),
15
- 'project-management': PROJECT_MANAGEMENT_SKILLS.map((name) => ({
16
- name,
17
- type: 'skill',
18
- })),
19
- research: [
20
- ...RESEARCH_SKILLS.map((name) => ({ name, type: 'skill' })),
21
- ...RESEARCH_AGENTS.map((name) => ({
22
- name: name.replace(/\.md$/, ''),
23
- type: 'agent',
24
- })),
25
- ],
26
- brainstorm: BRAINSTORM_SKILLS.map((name) => ({ name, type: 'skill' })),
27
- };
28
- const BUNDLED_PACK_ASSETS = {
29
- core: {
30
- templates: [],
31
- scripts: [],
32
- },
33
- ideas: {
34
- templates: [],
35
- scripts: [],
36
- },
37
- docs: {
38
- templates: [],
39
- scripts: DOCS_SCRIPTS,
40
- },
41
- workflows: {
42
- templates: WORKFLOW_TEMPLATES,
43
- scripts: WORKFLOW_SCRIPTS,
44
- },
45
- utility: {
46
- templates: [],
47
- scripts: [],
48
- },
49
- 'project-management': {
50
- templates: PROJECT_MANAGEMENT_TEMPLATES,
51
- scripts: PROJECT_MANAGEMENT_SCRIPTS,
52
- },
53
- research: {
54
- templates: [],
55
- scripts: [],
56
- },
57
- brainstorm: {
58
- templates: [],
59
- scripts: [],
60
- },
61
- };
2
+ import { hasScopedPackPlacementEvidence, inventoryScopedPack, } from '../../tools/shared/pack-inventory.js';
3
+ import {} from '../../tools/shared/pack-lifecycle.js';
4
+ import { getPackDefinition } from '../../tools/shared/pack-manifest.js';
5
+ function getBundledPackAssets(pack, scope) {
6
+ const assets = getPackDefinition(pack).assets.filter(({ scopes, ownership }) => scopes.includes(scope) && ownership[scope] === 'managed');
7
+ return {
8
+ templates: assets
9
+ .filter(({ kind }) => kind === 'template')
10
+ .flatMap(({ source }) => source ? [source.replace(/^templates\//, '')] : []),
11
+ scripts: assets
12
+ .filter(({ kind }) => kind === 'script')
13
+ .flatMap(({ source }) => source ? [source.replace(/^scripts\//, '')] : []),
14
+ };
15
+ }
62
16
  export async function updateTools(target, scopes, cwd, home, dryRun, dependencies) {
63
17
  const assetsRoot = await dependencies.resolveAssetsRoot();
64
18
  const result = {
@@ -68,10 +22,95 @@ export async function updateTools(target, scopes, cwd, home, dryRun, dependencie
68
22
  notInstalled: [],
69
23
  notBundled: [],
70
24
  assetRefreshes: [],
25
+ plans: [],
71
26
  };
27
+ if (target.kind !== 'name' && dependencies.reconcilePacks) {
28
+ const inventory = dependencies.inventoryScopedPack ?? inventoryScopedPack;
29
+ const selectedDefinitions = getSelectedDefinitions(target);
30
+ const requests = [];
31
+ for (const scope of scopes) {
32
+ let scopeRoot;
33
+ try {
34
+ scopeRoot = await dependencies.resolveScopeRoot(scope, cwd, home);
35
+ }
36
+ catch (error) {
37
+ if (scope === 'project' && scopes.includes('user'))
38
+ continue;
39
+ throw error;
40
+ }
41
+ for (const definition of selectedDefinitions) {
42
+ if (!definition.allowedScopes.includes(scope))
43
+ continue;
44
+ const before = await inventory({
45
+ pack: definition.name,
46
+ scope,
47
+ scopeRoot,
48
+ assetsRoot,
49
+ });
50
+ if (!hasScopedPackPlacementEvidence(before))
51
+ continue;
52
+ requests.push({
53
+ pack: definition.name,
54
+ scope,
55
+ scopeRoot,
56
+ assetsRoot,
57
+ action: 'update',
58
+ });
59
+ }
60
+ }
61
+ if (target.kind === 'pack' && requests.length === 0) {
62
+ result.notInstalled.push(target.pack);
63
+ return result;
64
+ }
65
+ const lifecycle = await dependencies.reconcilePacks(requests, { dryRun });
66
+ result.plans.push(...lifecycle.map(({ plan }) => plan));
67
+ for (const entry of lifecycle) {
68
+ const definition = getPackDefinition(entry.request.pack);
69
+ const changed = new Set(entry.plan.changedCanonicalPaths);
70
+ for (const asset of definition.assets) {
71
+ if (!asset.scopes.includes(entry.request.scope))
72
+ continue;
73
+ if (asset.kind === 'skill' || asset.kind === 'agent') {
74
+ if (!changed.has(asset.destination))
75
+ continue;
76
+ result.updated.push({
77
+ name: asset.destination.split('/').at(-1).replace(/\.md$/, ''),
78
+ type: asset.kind,
79
+ scope: entry.request.scope,
80
+ version: null,
81
+ bundledVersion: null,
82
+ pack: entry.request.pack,
83
+ status: 'outdated',
84
+ });
85
+ continue;
86
+ }
87
+ if (entry.plan.operations.some((operation) => 'assetId' in operation && operation.assetId === asset.id)) {
88
+ result.assetRefreshes.push({
89
+ name: asset.destination,
90
+ type: asset.kind,
91
+ pack: entry.request.pack,
92
+ scope: entry.request.scope,
93
+ status: dryRun ? 'planned' : 'refreshed',
94
+ });
95
+ }
96
+ }
97
+ }
98
+ return result;
99
+ }
72
100
  const allTools = [];
101
+ const scopedInventories = [];
102
+ const scopeRoots = new Map();
73
103
  for (const scope of scopes) {
74
- const scopeRoot = await dependencies.resolveScopeRoot(scope, cwd, home);
104
+ let scopeRoot;
105
+ try {
106
+ scopeRoot = await dependencies.resolveScopeRoot(scope, cwd, home);
107
+ }
108
+ catch (error) {
109
+ if (scope === 'project' && scopes.includes('user'))
110
+ continue;
111
+ throw error;
112
+ }
113
+ scopeRoots.set(scope, scopeRoot);
75
114
  const tools = await dependencies.scanTools({
76
115
  scope,
77
116
  scopeRoot,
@@ -80,6 +119,51 @@ export async function updateTools(target, scopes, cwd, home, dryRun, dependencie
80
119
  for (const tool of tools) {
81
120
  allTools.push({ tool, scopeRoot });
82
121
  }
122
+ if (dependencies.inventoryScopedPack) {
123
+ for (const { name: pack } of [
124
+ getPackDefinition('core'),
125
+ getPackDefinition('ideas'),
126
+ getPackDefinition('docs'),
127
+ getPackDefinition('workflows'),
128
+ getPackDefinition('utility'),
129
+ getPackDefinition('project-management'),
130
+ getPackDefinition('research'),
131
+ getPackDefinition('brainstorm'),
132
+ ]) {
133
+ if (!getPackDefinition(pack).allowedScopes.includes(scope))
134
+ continue;
135
+ scopedInventories.push(await dependencies.inventoryScopedPack({
136
+ pack,
137
+ scope,
138
+ scopeRoot,
139
+ assetsRoot,
140
+ }));
141
+ }
142
+ }
143
+ }
144
+ for (const inventory of scopedInventories) {
145
+ const selected = target.kind === 'pack'
146
+ ? target.pack === inventory.pack
147
+ : target.kind === 'all';
148
+ if (!selected || !inventory.intent.enabled)
149
+ continue;
150
+ const scopeRoot = scopeRoots.get(inventory.scope);
151
+ if (!scopeRoot)
152
+ continue;
153
+ const existing = new Set(allTools.map(({ tool }) => buildEntryKey(tool)));
154
+ for (const member of getBundledPackMembers(inventory.pack, inventory.scope)) {
155
+ const tool = {
156
+ name: member.name,
157
+ type: member.type,
158
+ scope: inventory.scope,
159
+ version: null,
160
+ bundledVersion: null,
161
+ pack: inventory.pack,
162
+ status: 'outdated',
163
+ };
164
+ if (!existing.has(buildEntryKey(tool)))
165
+ allTools.push({ tool, scopeRoot });
166
+ }
83
167
  }
84
168
  const targetEntries = target.kind === 'name'
85
169
  ? allTools
@@ -123,7 +207,7 @@ export async function updateTools(target, scopes, cwd, home, dryRun, dependencie
123
207
  result.updated.push(tool);
124
208
  }
125
209
  for (const assetTarget of resolvePackAssetTargets(target, allTools)) {
126
- const assets = BUNDLED_PACK_ASSETS[assetTarget.pack];
210
+ const assets = getBundledPackAssets(assetTarget.pack, assetTarget.scope);
127
211
  for (const template of assets.templates) {
128
212
  const source = join(assetsRoot, 'templates', template);
129
213
  const destination = join(assetTarget.scopeRoot, '.oat', 'templates', template);
@@ -159,6 +243,20 @@ export async function updateTools(target, scopes, cwd, home, dryRun, dependencie
159
243
  }
160
244
  return result;
161
245
  }
246
+ function getSelectedDefinitions(target) {
247
+ return target.kind === 'pack'
248
+ ? [getPackDefinition(target.pack)]
249
+ : [
250
+ getPackDefinition('core'),
251
+ getPackDefinition('ideas'),
252
+ getPackDefinition('docs'),
253
+ getPackDefinition('workflows'),
254
+ getPackDefinition('utility'),
255
+ getPackDefinition('project-management'),
256
+ getPackDefinition('research'),
257
+ getPackDefinition('brainstorm'),
258
+ ];
259
+ }
162
260
  function expandInstalledPackEntries(target, installedEntries) {
163
261
  const entries = [...installedEntries];
164
262
  const seen = new Set(installedEntries.map((entry) => buildEntryKey(entry.tool)));
@@ -202,7 +300,21 @@ function expandInstalledPackEntries(target, installedEntries) {
202
300
  return entries;
203
301
  }
204
302
  function getBundledPackMembers(pack, scope) {
205
- return BUNDLED_PACK_MEMBERS[pack].filter((member) => scope === 'project' || member.type === 'skill' || pack === 'workflows');
303
+ return getPackDefinition(pack).assets.flatMap((asset) => {
304
+ if (!asset.scopes.includes(scope) ||
305
+ asset.ownership[scope] !== 'managed' ||
306
+ (asset.kind !== 'skill' && asset.kind !== 'agent')) {
307
+ return [];
308
+ }
309
+ return [
310
+ {
311
+ name: asset.kind === 'agent'
312
+ ? asset.destination.split('/').at(-1).replace(/\.md$/, '')
313
+ : asset.destination.split('/').at(-1),
314
+ type: asset.kind,
315
+ },
316
+ ];
317
+ });
206
318
  }
207
319
  function resolvePackAssetTargets(target, installedEntries) {
208
320
  if (target.kind === 'name') {
@@ -228,7 +340,7 @@ function resolvePackAssetTargets(target, installedEntries) {
228
340
  : []
229
341
  : [...installedPacks];
230
342
  for (const pack of packsToExpand) {
231
- const assets = BUNDLED_PACK_ASSETS[pack];
343
+ const assets = getBundledPackAssets(pack, scope);
232
344
  if (assets.templates.length === 0 && assets.scripts.length === 0) {
233
345
  continue;
234
346
  }
@@ -145,6 +145,10 @@ export declare const BUILTIN_EXEC_TARGETS: Readonly<Record<string, ExecTarget>>;
145
145
  export declare function normalizeWorkflowPostImplementSequence(value: unknown): WorkflowPostImplementStructuredSequence | undefined;
146
146
  export declare function isWorkflowPostImplementStructuredSequence(value: unknown): value is WorkflowPostImplementStructuredSequence;
147
147
  export type OatToolsConfig = Partial<Record<'core' | 'ideas' | 'docs' | 'workflows' | 'utility' | 'project-management' | 'research' | 'brainstorm', boolean>>;
148
+ export interface OatPjmConfig {
149
+ initialized?: boolean;
150
+ schemaVersion?: number;
151
+ }
148
152
  export interface OatConfig {
149
153
  version: number;
150
154
  worktrees?: {
@@ -157,6 +161,7 @@ export interface OatConfig {
157
161
  archive?: OatArchiveConfig;
158
162
  explainers?: OatExplainersConfig;
159
163
  tools?: OatToolsConfig;
164
+ pjm?: OatPjmConfig;
160
165
  documentation?: OatDocumentationConfig;
161
166
  localPaths?: string[];
162
167
  autoReviewAtCheckpoints?: boolean;
@@ -174,6 +179,7 @@ export interface UserConfig {
174
179
  version: number;
175
180
  activeIdea?: string | null;
176
181
  updateNotifications?: boolean;
182
+ tools?: OatToolsConfig;
177
183
  explainers?: OatExplainersConfig;
178
184
  workflow?: OatWorkflowConfig;
179
185
  }
@@ -1 +1 @@
1
- {"version":3,"file":"oat-config.d.ts","sourceRoot":"","sources":["../../src/config/oat-config.ts"],"names":[],"mappings":"AAOA,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,6BAA6B,EAClC,KAAK,gCAAgC,EACrC,KAAK,0BAA0B,EAC/B,KAAK,0BAA0B,EAC/B,KAAK,6BAA6B,EAClC,KAAK,qBAAqB,EAC1B,KAAK,0BAA0B,EAC/B,KAAK,2BAA2B,GACjC,MAAM,mBAAmB,CAAC;AAE3B,MAAM,WAAW,sBAAsB;IACrC,IAAI,CAAC,EAAE,MAAM,CAAC;IACd,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,2BAA2B,CAAC,EAAE,OAAO,CAAC;CACvC;AAED,MAAM,WAAW,YAAY;IAC3B,aAAa,CAAC,EAAE,MAAM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xB;AAED,wBAAsB,aAAa,CACjC,QAAQ,EAAE,MAAM,EAChB,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAMrE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA6B5D"}
@@ -497,6 +497,43 @@ function normalizeWorkflowConfig(parsed) {
497
497
  }
498
498
  return Object.keys(next).length > 0 ? next : undefined;
499
499
  }
500
+ const VALID_TOOL_PACKS = [
501
+ 'core',
502
+ 'ideas',
503
+ 'docs',
504
+ 'workflows',
505
+ 'utility',
506
+ 'project-management',
507
+ 'research',
508
+ 'brainstorm',
509
+ ];
510
+ function normalizeToolsConfig(value) {
511
+ if (!isRecord(value)) {
512
+ return undefined;
513
+ }
514
+ const tools = {};
515
+ for (const pack of VALID_TOOL_PACKS) {
516
+ if (typeof value[pack] === 'boolean') {
517
+ tools[pack] = value[pack];
518
+ }
519
+ }
520
+ return Object.keys(tools).length > 0 ? tools : undefined;
521
+ }
522
+ function normalizePjmConfig(value) {
523
+ if (!isRecord(value)) {
524
+ return undefined;
525
+ }
526
+ const pjm = {};
527
+ if (typeof value.initialized === 'boolean') {
528
+ pjm.initialized = value.initialized;
529
+ }
530
+ if (typeof value.schemaVersion === 'number' &&
531
+ Number.isInteger(value.schemaVersion) &&
532
+ value.schemaVersion > 0) {
533
+ pjm.schemaVersion = value.schemaVersion;
534
+ }
535
+ return Object.keys(pjm).length > 0 ? pjm : undefined;
536
+ }
500
537
  const DEFAULT_OAT_CONFIG = { version: 1 };
501
538
  const DEFAULT_OAT_LOCAL_CONFIG = { version: 1 };
502
539
  const DEFAULT_USER_CONFIG = { version: 1 };
@@ -627,26 +664,13 @@ function normalizeOatConfig(parsed) {
627
664
  if (explainers) {
628
665
  next.explainers = explainers;
629
666
  }
630
- if (isRecord(parsed.tools)) {
631
- const validPacks = [
632
- 'core',
633
- 'ideas',
634
- 'docs',
635
- 'workflows',
636
- 'utility',
637
- 'project-management',
638
- 'research',
639
- 'brainstorm',
640
- ];
641
- const tools = {};
642
- for (const pack of validPacks) {
643
- if (typeof parsed.tools[pack] === 'boolean') {
644
- tools[pack] = parsed.tools[pack];
645
- }
646
- }
647
- if (Object.keys(tools).length > 0) {
648
- next.tools = tools;
649
- }
667
+ const tools = normalizeToolsConfig(parsed.tools);
668
+ if (tools) {
669
+ next.tools = tools;
670
+ }
671
+ const pjm = normalizePjmConfig(parsed.pjm);
672
+ if (pjm) {
673
+ next.pjm = pjm;
650
674
  }
651
675
  if (isRecord(parsed.documentation)) {
652
676
  const doc = {};
@@ -839,6 +863,7 @@ const USER_CONFIG_OWNED_KEYS = new Set([
839
863
  'version',
840
864
  'activeIdea',
841
865
  'updateNotifications',
866
+ 'tools',
842
867
  'workflow',
843
868
  'knownStrays',
844
869
  ]);
@@ -856,6 +881,10 @@ function normalizeUserConfig(parsed) {
856
881
  if (typeof parsed.updateNotifications === 'boolean') {
857
882
  next.updateNotifications = parsed.updateNotifications;
858
883
  }
884
+ const tools = normalizeToolsConfig(parsed.tools);
885
+ if (tools) {
886
+ next.tools = tools;
887
+ }
859
888
  const explainers = normalizeExplainersConfig(parsed.explainers, 'user');
860
889
  if (explainers) {
861
890
  next.explainers = explainers;
@@ -1,5 +1,12 @@
1
1
  import type { Scope } from '../shared/types.js';
2
2
  type ConcreteScope = Exclude<Scope, 'all'>;
3
+ export type ManagedRootName = '.agents' | '.oat';
4
+ export interface ResolvedManagedRoot {
5
+ name: ManagedRootName;
6
+ logicalRoot: string;
7
+ realRoot: string;
8
+ exists: boolean;
9
+ }
3
10
  export declare function resolveProjectRoot(cwd: string): Promise<string>;
4
11
  export declare function resolveScopeRoot(scope: ConcreteScope, cwd: string, home: string): string;
5
12
  export declare function toPosixPath(pathValue: string): string;
@@ -9,5 +16,10 @@ export declare function validateRealPathWithinScope(candidatePath: string, scope
9
16
  realScopeRoot: string;
10
17
  realPath: string;
11
18
  }>;
19
+ export declare function resolveManagedScopeRoots(scopeRoot: string): Promise<Record<ManagedRootName, ResolvedManagedRoot>>;
20
+ export declare function validateManagedPath(candidatePath: string, managedRoot: ResolvedManagedRoot): Promise<{
21
+ realManagedRoot: string;
22
+ realPath: string;
23
+ }>;
12
24
  export {};
13
25
  //# sourceMappingURL=paths.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/fs/paths.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,KAAK,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAE3C,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBrE;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAcR;AAED,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBtD"}
1
+ {"version":3,"file":"paths.d.ts","sourceRoot":"","sources":["../../src/fs/paths.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,KAAK,EAAE,MAAM,eAAe,CAAC;AAE3C,KAAK,aAAa,GAAG,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC;AAC3C,MAAM,MAAM,eAAe,GAAG,SAAS,GAAG,MAAM,CAAC;AAEjD,MAAM,WAAW,mBAAmB;IAClC,IAAI,EAAE,eAAe,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,OAAO,CAAC;CACjB;AAED,wBAAsB,kBAAkB,CAAC,GAAG,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAiBrE;AAED,wBAAgB,gBAAgB,CAC9B,KAAK,EAAE,aAAa,EACpB,GAAG,EAAE,MAAM,EACX,IAAI,EAAE,MAAM,GACX,MAAM,CAMR;AAED,wBAAgB,WAAW,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAErD;AAED,wBAAgB,oBAAoB,CAAC,SAAS,EAAE,MAAM,GAAG,MAAM,CAE9D;AAED,wBAAgB,uBAAuB,CACrC,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,MAAM,CAcR;AAED,wBAAsB,2BAA2B,CAC/C,aAAa,EAAE,MAAM,EACrB,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC;IAAE,aAAa,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAsBtD;AAiDD,wBAAsB,wBAAwB,CAC5C,SAAS,EAAE,MAAM,GAChB,OAAO,CAAC,MAAM,CAAC,eAAe,EAAE,mBAAmB,CAAC,CAAC,CAMvD;AAED,wBAAsB,mBAAmB,CACvC,aAAa,EAAE,MAAM,EACrB,WAAW,EAAE,mBAAmB,GAC/B,OAAO,CAAC;IAAE,eAAe,EAAE,MAAM,CAAC;IAAC,QAAQ,EAAE,MAAM,CAAA;CAAE,CAAC,CAwDxD"}
package/dist/fs/paths.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { access, realpath } from 'node:fs/promises';
2
- import { dirname, posix, resolve, sep } from 'node:path';
2
+ import { dirname, join, posix, relative, resolve, sep } from 'node:path';
3
3
  import { CliError } from '../errors/index.js';
4
4
  export async function resolveProjectRoot(cwd) {
5
5
  let current = resolve(cwd);
@@ -57,3 +57,89 @@ export async function validateRealPathWithinScope(candidatePath, scopeRoot) {
57
57
  validatePathWithinScope(realCandidatePath, realScopeRoot);
58
58
  return { realScopeRoot, realPath: realCandidatePath };
59
59
  }
60
+ function isMissingFileError(error) {
61
+ return (typeof error === 'object' &&
62
+ error !== null &&
63
+ 'code' in error &&
64
+ error.code === 'ENOENT');
65
+ }
66
+ async function resolveManagedRoot(scopeRoot, name) {
67
+ const logicalRoot = validatePathWithinScope(join(scopeRoot, name), scopeRoot);
68
+ try {
69
+ return {
70
+ name,
71
+ logicalRoot,
72
+ realRoot: await realpath(logicalRoot),
73
+ exists: true,
74
+ };
75
+ }
76
+ catch (error) {
77
+ if (!isMissingFileError(error)) {
78
+ const detail = error instanceof Error ? `: ${error.message}` : '';
79
+ throw new CliError(`Unable to resolve managed root ${logicalRoot}${detail}`);
80
+ }
81
+ }
82
+ let realScopeRoot;
83
+ try {
84
+ realScopeRoot = await realpath(resolve(scopeRoot));
85
+ }
86
+ catch (error) {
87
+ const detail = error instanceof Error ? `: ${error.message}` : '';
88
+ throw new CliError(`Unable to resolve scope root ${scopeRoot} for managed paths${detail}`);
89
+ }
90
+ return {
91
+ name,
92
+ logicalRoot,
93
+ realRoot: join(realScopeRoot, name),
94
+ exists: false,
95
+ };
96
+ }
97
+ export async function resolveManagedScopeRoots(scopeRoot) {
98
+ const [agents, oat] = await Promise.all([
99
+ resolveManagedRoot(scopeRoot, '.agents'),
100
+ resolveManagedRoot(scopeRoot, '.oat'),
101
+ ]);
102
+ return { '.agents': agents, '.oat': oat };
103
+ }
104
+ export async function validateManagedPath(candidatePath, managedRoot) {
105
+ const logicalPath = validatePathWithinScope(candidatePath, managedRoot.logicalRoot);
106
+ const relativePath = relative(managedRoot.logicalRoot, logicalPath);
107
+ if (!managedRoot.exists) {
108
+ return {
109
+ realManagedRoot: managedRoot.realRoot,
110
+ realPath: join(managedRoot.realRoot, relativePath),
111
+ };
112
+ }
113
+ let nearestExisting = logicalPath;
114
+ let realAncestor = null;
115
+ while (realAncestor === null) {
116
+ try {
117
+ realAncestor = await realpath(nearestExisting);
118
+ }
119
+ catch (error) {
120
+ if (!isMissingFileError(error)) {
121
+ const detail = error instanceof Error ? `: ${error.message}` : '';
122
+ throw new CliError(`Unable to validate managed path ${candidatePath}${detail}`);
123
+ }
124
+ const parent = dirname(nearestExisting);
125
+ if (parent === nearestExisting) {
126
+ throw new CliError(`Unable to find an existing ancestor for managed path ${candidatePath}`);
127
+ }
128
+ nearestExisting = parent;
129
+ }
130
+ }
131
+ try {
132
+ validatePathWithinScope(realAncestor, managedRoot.realRoot);
133
+ }
134
+ catch {
135
+ throw new CliError(`Managed path ${candidatePath} escapes resolved root ${managedRoot.realRoot} through ${nearestExisting}. Remove or repoint the nested symlink, then retry.`);
136
+ }
137
+ const realCandidate = join(realAncestor, relative(nearestExisting, logicalPath));
138
+ try {
139
+ validatePathWithinScope(realCandidate, managedRoot.realRoot);
140
+ }
141
+ catch {
142
+ throw new CliError(`Managed path ${candidatePath} resolves outside ${managedRoot.realRoot}. Remove or repoint the nested symlink, then retry.`);
143
+ }
144
+ return { realManagedRoot: managedRoot.realRoot, realPath: realCandidate };
145
+ }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@open-agent-toolkit/cli",
3
- "version": "0.2.36",
3
+ "version": "0.2.37",
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.36"
37
+ "@open-agent-toolkit/control-plane": "0.2.37"
38
38
  },
39
39
  "devDependencies": {
40
40
  "@types/node": "^22.10.0",