@open-agent-toolkit/cli 0.2.35 → 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.
- package/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/backlog-lifecycle.md +18 -0
- package/assets/docs/cli-utilities/bootstrap.md +6 -3
- package/assets/docs/cli-utilities/config-and-local-state.md +26 -12
- package/assets/docs/cli-utilities/configuration.md +36 -13
- package/assets/docs/cli-utilities/tool-packs.md +423 -51
- package/assets/docs/provider-sync/scope-and-surface.md +4 -1
- package/assets/docs/reference/cli-reference.md +5 -3
- package/assets/docs/reference/file-locations.md +28 -4
- package/assets/docs/reference/troubleshooting.md +132 -2
- package/assets/docs/workflows/projects/lifecycle.md +21 -2
- package/assets/public-package-versions.json +4 -4
- package/assets/scripts/generate-oat-state.sh +441 -0
- package/assets/scripts/generate-thin-index.sh +200 -0
- package/assets/skills/oat-agent-instructions-analyze/SKILL.md +10 -5
- package/assets/skills/oat-agent-instructions-apply/SKILL.md +30 -5
- package/assets/skills/oat-brainstorm/SKILL.md +34 -8
- package/assets/skills/oat-brainstorm/references/destinations.md +6 -1
- package/assets/skills/oat-docs-analyze/SKILL.md +9 -4
- package/assets/skills/oat-docs-apply/SKILL.md +6 -3
- package/assets/skills/oat-pjm-add-backlog-item/SKILL.md +14 -1
- package/assets/skills/oat-pjm-decision/SKILL.md +22 -10
- package/assets/skills/oat-pjm-review-backlog/SKILL.md +20 -3
- package/assets/skills/oat-pjm-update-repo-reference/SKILL.md +20 -10
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +1 -1
- package/assets/skills/oat-project-document/SKILL.md +21 -3
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +1 -1
- package/assets/skills/oat-project-summary/SKILL.md +23 -11
- package/assets/skills/oat-repo-knowledge-index/SKILL.md +6 -3
- package/dist/commands/backlog/index.d.ts +2 -0
- package/dist/commands/backlog/index.d.ts.map +1 -1
- package/dist/commands/backlog/index.js +67 -23
- package/dist/commands/backlog/new.d.ts +3 -0
- package/dist/commands/backlog/new.d.ts.map +1 -1
- package/dist/commands/backlog/new.js +8 -21
- package/dist/commands/decision/agents-guidance.d.ts.map +1 -1
- package/dist/commands/decision/agents-guidance.js +2 -1
- package/dist/commands/decision/index.d.ts +2 -0
- package/dist/commands/decision/index.d.ts.map +1 -1
- package/dist/commands/decision/index.js +19 -3
- package/dist/commands/decision/new.d.ts +4 -0
- package/dist/commands/decision/new.d.ts.map +1 -1
- package/dist/commands/decision/new.js +11 -30
- package/dist/commands/doctor/index.d.ts +4 -0
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +254 -9
- package/dist/commands/init/tools/brainstorm/index.d.ts.map +1 -1
- package/dist/commands/init/tools/brainstorm/index.js +20 -6
- package/dist/commands/init/tools/docs/index.d.ts.map +1 -1
- package/dist/commands/init/tools/docs/index.js +4 -1
- package/dist/commands/init/tools/ideas/index.d.ts.map +1 -1
- package/dist/commands/init/tools/ideas/index.js +4 -1
- package/dist/commands/init/tools/index.d.ts +11 -2
- package/dist/commands/init/tools/index.d.ts.map +1 -1
- package/dist/commands/init/tools/index.js +459 -351
- package/dist/commands/init/tools/install-state.d.ts +2 -0
- package/dist/commands/init/tools/install-state.d.ts.map +1 -1
- package/dist/commands/init/tools/install-state.js +11 -0
- package/dist/commands/init/tools/project-management/agents-guidance.d.ts.map +1 -1
- package/dist/commands/init/tools/project-management/agents-guidance.js +3 -1
- package/dist/commands/init/tools/project-management/index.d.ts +1 -0
- package/dist/commands/init/tools/project-management/index.d.ts.map +1 -1
- package/dist/commands/init/tools/project-management/index.js +24 -55
- package/dist/commands/init/tools/project-management/install-project-management.d.ts +4 -0
- package/dist/commands/init/tools/project-management/install-project-management.d.ts.map +1 -1
- package/dist/commands/init/tools/project-management/install-project-management.js +4 -1
- package/dist/commands/init/tools/research/index.d.ts.map +1 -1
- package/dist/commands/init/tools/research/index.js +4 -1
- package/dist/commands/init/tools/shared/copy-helpers.d.ts.map +1 -1
- package/dist/commands/init/tools/shared/copy-helpers.js +10 -0
- package/dist/commands/init/tools/shared/skill-manifest.d.ts +15 -15
- package/dist/commands/init/tools/shared/skill-manifest.d.ts.map +1 -1
- package/dist/commands/init/tools/shared/skill-manifest.js +17 -122
- package/dist/commands/init/tools/utility/index.d.ts.map +1 -1
- package/dist/commands/init/tools/utility/index.js +4 -1
- package/dist/commands/init/tools/workflows/index.d.ts.map +1 -1
- package/dist/commands/init/tools/workflows/index.js +4 -1
- package/dist/commands/init/tools/workflows/install-workflows.d.ts.map +1 -1
- package/dist/commands/init/tools/workflows/install-workflows.js +2 -4
- package/dist/commands/pjm/adoption.d.ts +12 -0
- package/dist/commands/pjm/adoption.d.ts.map +1 -0
- package/dist/commands/pjm/adoption.js +47 -0
- package/dist/commands/pjm/doctor.d.ts +3 -2
- package/dist/commands/pjm/doctor.d.ts.map +1 -1
- package/dist/commands/pjm/doctor.js +28 -13
- package/dist/commands/pjm/index.d.ts +2 -0
- package/dist/commands/pjm/index.d.ts.map +1 -1
- package/dist/commands/pjm/index.js +11 -3
- package/dist/commands/pjm/init.d.ts +3 -0
- package/dist/commands/pjm/init.d.ts.map +1 -1
- package/dist/commands/pjm/init.js +37 -32
- package/dist/commands/pjm/migrate.d.ts +1 -0
- package/dist/commands/pjm/migrate.d.ts.map +1 -1
- package/dist/commands/pjm/migrate.js +1 -0
- package/dist/commands/pjm/template-source.d.ts +14 -0
- package/dist/commands/pjm/template-source.d.ts.map +1 -0
- package/dist/commands/pjm/template-source.js +56 -0
- package/dist/commands/remove/skills/remove-skills.d.ts.map +1 -1
- package/dist/commands/remove/skills/remove-skills.js +10 -19
- package/dist/commands/status/index.d.ts +5 -0
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +203 -2
- package/dist/commands/sync/index.d.ts.map +1 -1
- package/dist/commands/sync/index.js +40 -7
- package/dist/commands/sync/sync.types.d.ts +4 -0
- package/dist/commands/sync/sync.types.d.ts.map +1 -1
- package/dist/commands/tools/has/has-pack.d.ts +11 -2
- package/dist/commands/tools/has/has-pack.d.ts.map +1 -1
- package/dist/commands/tools/has/has-pack.js +33 -20
- package/dist/commands/tools/index.d.ts.map +1 -1
- package/dist/commands/tools/index.js +3 -1
- package/dist/commands/tools/info/info-tool.d.ts +3 -0
- package/dist/commands/tools/info/info-tool.d.ts.map +1 -1
- package/dist/commands/tools/info/info-tool.js +29 -4
- package/dist/commands/tools/list/list-tools.d.ts +3 -0
- package/dist/commands/tools/list/list-tools.d.ts.map +1 -1
- package/dist/commands/tools/list/list-tools.js +31 -4
- package/dist/commands/tools/migrate/index.d.ts +26 -0
- package/dist/commands/tools/migrate/index.d.ts.map +1 -0
- package/dist/commands/tools/migrate/index.js +312 -0
- package/dist/commands/tools/migrate/migrate-pack.d.ts +81 -0
- package/dist/commands/tools/migrate/migrate-pack.d.ts.map +1 -0
- package/dist/commands/tools/migrate/migrate-pack.js +324 -0
- package/dist/commands/tools/outdated/outdated-tools.d.ts +11 -0
- package/dist/commands/tools/outdated/outdated-tools.d.ts.map +1 -1
- package/dist/commands/tools/outdated/outdated-tools.js +33 -5
- package/dist/commands/tools/remove/index.d.ts.map +1 -1
- package/dist/commands/tools/remove/index.js +73 -20
- package/dist/commands/tools/remove/remove-tools.d.ts +28 -0
- package/dist/commands/tools/remove/remove-tools.d.ts.map +1 -1
- package/dist/commands/tools/remove/remove-tools.js +156 -26
- package/dist/commands/tools/shared/apply-pack-reconcile.d.ts +41 -0
- package/dist/commands/tools/shared/apply-pack-reconcile.d.ts.map +1 -0
- package/dist/commands/tools/shared/apply-pack-reconcile.js +126 -0
- package/dist/commands/tools/shared/auto-sync.d.ts +5 -2
- package/dist/commands/tools/shared/auto-sync.d.ts.map +1 -1
- package/dist/commands/tools/shared/auto-sync.js +1 -0
- package/dist/commands/tools/shared/content-digest.d.ts +3 -0
- package/dist/commands/tools/shared/content-digest.d.ts.map +1 -0
- package/dist/commands/tools/shared/content-digest.js +57 -0
- package/dist/commands/tools/shared/format-pack-inventory.d.ts +3 -0
- package/dist/commands/tools/shared/format-pack-inventory.d.ts.map +1 -0
- package/dist/commands/tools/shared/format-pack-inventory.js +21 -0
- package/dist/commands/tools/shared/install-sync-context.d.ts.map +1 -1
- package/dist/commands/tools/shared/install-sync-context.js +2 -25
- package/dist/commands/tools/shared/pack-inventory.d.ts +46 -0
- package/dist/commands/tools/shared/pack-inventory.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-inventory.js +207 -0
- package/dist/commands/tools/shared/pack-lifecycle.d.ts +34 -0
- package/dist/commands/tools/shared/pack-lifecycle.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-lifecycle.js +67 -0
- package/dist/commands/tools/shared/pack-manifest.d.ts +11 -0
- package/dist/commands/tools/shared/pack-manifest.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-manifest.js +384 -0
- package/dist/commands/tools/shared/pack-paths.d.ts +21 -0
- package/dist/commands/tools/shared/pack-paths.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-paths.js +35 -0
- package/dist/commands/tools/shared/pack-reconcile.d.ts +64 -0
- package/dist/commands/tools/shared/pack-reconcile.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-reconcile.js +158 -0
- package/dist/commands/tools/shared/project-tools-config.d.ts.map +1 -1
- package/dist/commands/tools/shared/project-tools-config.js +12 -38
- package/dist/commands/tools/shared/scan-tools.js +2 -2
- package/dist/commands/tools/shared/scoped-pack-intent.d.ts +34 -0
- package/dist/commands/tools/shared/scoped-pack-intent.d.ts.map +1 -0
- package/dist/commands/tools/shared/scoped-pack-intent.js +116 -0
- package/dist/commands/tools/shared/types.d.ts +22 -0
- package/dist/commands/tools/shared/types.d.ts.map +1 -1
- package/dist/commands/tools/update/index.d.ts.map +1 -1
- package/dist/commands/tools/update/index.js +30 -5
- package/dist/commands/tools/update/update-tools.d.ts +9 -1
- package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
- package/dist/commands/tools/update/update-tools.js +176 -64
- package/dist/config/oat-config.d.ts +6 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +49 -20
- package/dist/fs/paths.d.ts +12 -0
- package/dist/fs/paths.d.ts.map +1 -1
- package/dist/fs/paths.js +87 -1
- package/package.json +2 -2
|
@@ -0,0 +1,207 @@
|
|
|
1
|
+
import { lstat } from 'node:fs/promises';
|
|
2
|
+
import { join } from 'node:path';
|
|
3
|
+
import { compareVersions } from '../../init/tools/shared/version.js';
|
|
4
|
+
import { getAgentVersion, getSkillVersion } from '../../shared/frontmatter.js';
|
|
5
|
+
import { resolveManagedScopeRoots, validateManagedPath, } from '../../../fs/paths.js';
|
|
6
|
+
import { USER_SCOPE_MANAGED_AGENT_FILES, } from '../../../shared/types.js';
|
|
7
|
+
import { digestDirectory, digestFile } from './content-digest.js';
|
|
8
|
+
import { getPackDefinition } from './pack-manifest.js';
|
|
9
|
+
import { readScopedPackIntent, } from './scoped-pack-intent.js';
|
|
10
|
+
async function pathExists(path) {
|
|
11
|
+
try {
|
|
12
|
+
await lstat(path);
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch (error) {
|
|
16
|
+
if (typeof error === 'object' &&
|
|
17
|
+
error !== null &&
|
|
18
|
+
'code' in error &&
|
|
19
|
+
error.code === 'ENOENT') {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
throw error;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
async function inventoryVersionedAsset(definition, installedPath, bundledPath) {
|
|
26
|
+
const readVersion = definition.kind === 'skill' ? getSkillVersion : getAgentVersion;
|
|
27
|
+
const [installedVersion, bundledVersion] = await Promise.all([
|
|
28
|
+
readVersion(installedPath),
|
|
29
|
+
readVersion(bundledPath),
|
|
30
|
+
]);
|
|
31
|
+
return {
|
|
32
|
+
definition,
|
|
33
|
+
path: installedPath,
|
|
34
|
+
status: compareVersions(installedVersion, bundledVersion),
|
|
35
|
+
installedVersion,
|
|
36
|
+
bundledVersion,
|
|
37
|
+
};
|
|
38
|
+
}
|
|
39
|
+
async function inventoryStaticAsset(definition, installedPath, bundledPath) {
|
|
40
|
+
const [installedDigest, bundledDigest] = definition.kind === 'directory'
|
|
41
|
+
? await Promise.all([
|
|
42
|
+
digestDirectory(installedPath),
|
|
43
|
+
digestDirectory(bundledPath),
|
|
44
|
+
])
|
|
45
|
+
: await Promise.all([
|
|
46
|
+
digestFile(installedPath),
|
|
47
|
+
digestFile(bundledPath, definition.executable ? 0o755 : undefined),
|
|
48
|
+
]);
|
|
49
|
+
return {
|
|
50
|
+
definition,
|
|
51
|
+
path: installedPath,
|
|
52
|
+
status: installedDigest === bundledDigest ? 'current' : 'outdated',
|
|
53
|
+
installedVersion: null,
|
|
54
|
+
bundledVersion: null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
async function inventoryAsset(definition, scope, scopeRoot, assetsRoot, managedRoots) {
|
|
58
|
+
const installedPath = join(scopeRoot, definition.destination);
|
|
59
|
+
const managedRootName = definition.destination.split('/')[0];
|
|
60
|
+
if (managedRootName !== '.agents' && managedRootName !== '.oat') {
|
|
61
|
+
throw new Error(`Pack asset ${definition.id} has unsupported managed root: ${definition.destination}`);
|
|
62
|
+
}
|
|
63
|
+
const { realPath } = await validateManagedPath(installedPath, managedRoots[managedRootName]);
|
|
64
|
+
if (!(await pathExists(realPath))) {
|
|
65
|
+
return {
|
|
66
|
+
definition,
|
|
67
|
+
path: installedPath,
|
|
68
|
+
status: 'missing',
|
|
69
|
+
installedVersion: null,
|
|
70
|
+
bundledVersion: null,
|
|
71
|
+
};
|
|
72
|
+
}
|
|
73
|
+
if (definition.ownership[scope] === 'seed-if-missing') {
|
|
74
|
+
return {
|
|
75
|
+
definition,
|
|
76
|
+
path: installedPath,
|
|
77
|
+
status: 'present',
|
|
78
|
+
installedVersion: null,
|
|
79
|
+
bundledVersion: null,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
if (!definition.source) {
|
|
83
|
+
throw new Error(`Managed pack asset ${definition.id} has no materialized source`);
|
|
84
|
+
}
|
|
85
|
+
const bundledPath = join(assetsRoot, definition.source);
|
|
86
|
+
if (definition.kind === 'skill' || definition.kind === 'agent') {
|
|
87
|
+
const inventory = await inventoryVersionedAsset(definition, realPath, bundledPath);
|
|
88
|
+
return { ...inventory, path: installedPath };
|
|
89
|
+
}
|
|
90
|
+
const inventory = await inventoryStaticAsset(definition, realPath, bundledPath);
|
|
91
|
+
return { ...inventory, path: installedPath };
|
|
92
|
+
}
|
|
93
|
+
function completenessForAssets(assets, scope) {
|
|
94
|
+
const managed = assets.filter(({ definition }) => definition.ownership[scope] === 'managed');
|
|
95
|
+
const present = managed.filter(({ status }) => status !== 'missing').length;
|
|
96
|
+
if (present === 0)
|
|
97
|
+
return 'absent';
|
|
98
|
+
return present === managed.length ? 'complete' : 'partial';
|
|
99
|
+
}
|
|
100
|
+
function intentDiagnostic(diagnostic) {
|
|
101
|
+
return { ...diagnostic };
|
|
102
|
+
}
|
|
103
|
+
/**
|
|
104
|
+
* User-scope canonical agents are installed into `~/.agents/agents/` but no
|
|
105
|
+
* provider view is generated for them: `SCOPE_CONTENT_TYPES.user` enumerates
|
|
106
|
+
* skills only, and the sole user-scope agent materialization is the bundled
|
|
107
|
+
* managed role file set (`USER_SCOPE_MANAGED_AGENT_FILES`). Completeness alone
|
|
108
|
+
* therefore reports such a pack as complete while the declared agent surface is
|
|
109
|
+
* unreachable, so the gap is named here instead of staying silent.
|
|
110
|
+
*/
|
|
111
|
+
function userAgentMaterializationDiagnostics(pack, scope, assets) {
|
|
112
|
+
if (scope !== 'user')
|
|
113
|
+
return [];
|
|
114
|
+
const bundledRoleFiles = new Set(USER_SCOPE_MANAGED_AGENT_FILES);
|
|
115
|
+
const unmaterialized = assets.filter(({ definition, status }) => definition.kind === 'agent' &&
|
|
116
|
+
definition.ownership.user === 'managed' &&
|
|
117
|
+
status !== 'missing' &&
|
|
118
|
+
!bundledRoleFiles.has(definition.destination.split('/').at(-1) ?? ''));
|
|
119
|
+
if (unmaterialized.length === 0)
|
|
120
|
+
return [];
|
|
121
|
+
return [
|
|
122
|
+
{
|
|
123
|
+
code: 'user-agent-unmaterialized',
|
|
124
|
+
message: `Pack ${pack} installs user-scope canonical agents that no provider view materializes; user-scope agent materialization is limited to the bundled managed role files (${USER_SCOPE_MANAGED_AGENT_FILES.join(', ')}). Install this pack at project scope to make these agents available to providers.`,
|
|
125
|
+
paths: unmaterialized.map(({ path }) => path),
|
|
126
|
+
},
|
|
127
|
+
];
|
|
128
|
+
}
|
|
129
|
+
export async function inventoryScopedPack(input) {
|
|
130
|
+
const definition = getPackDefinition(input.pack);
|
|
131
|
+
if (!definition.allowedScopes.includes(input.scope)) {
|
|
132
|
+
throw new Error(`Pack ${input.pack} does not allow ${input.scope} scope`);
|
|
133
|
+
}
|
|
134
|
+
const applicableAssets = definition.assets.filter(({ scopes }) => scopes.includes(input.scope));
|
|
135
|
+
const managedRoots = await resolveManagedScopeRoots(input.scopeRoot);
|
|
136
|
+
const [intent, assets] = await Promise.all([
|
|
137
|
+
readScopedPackIntent(input),
|
|
138
|
+
Promise.all(applicableAssets.map((asset) => inventoryAsset(asset, input.scope, input.scopeRoot, input.assetsRoot, managedRoots))),
|
|
139
|
+
]);
|
|
140
|
+
const diagnostics = [
|
|
141
|
+
...intent.diagnostics.map(intentDiagnostic),
|
|
142
|
+
...userAgentMaterializationDiagnostics(input.pack, input.scope, assets),
|
|
143
|
+
];
|
|
144
|
+
return {
|
|
145
|
+
pack: input.pack,
|
|
146
|
+
scope: input.scope,
|
|
147
|
+
intent,
|
|
148
|
+
completeness: completenessForAssets(assets, input.scope),
|
|
149
|
+
assets,
|
|
150
|
+
diagnostics,
|
|
151
|
+
};
|
|
152
|
+
}
|
|
153
|
+
export function hasScopedPackPlacementEvidence(inventory) {
|
|
154
|
+
return (inventory.intent.enabled ||
|
|
155
|
+
inventory.assets.some(({ definition, status }) => definition.sharedOwner === undefined &&
|
|
156
|
+
definition.ownership[inventory.scope] === 'managed' &&
|
|
157
|
+
status !== 'missing'));
|
|
158
|
+
}
|
|
159
|
+
export async function inventoryPack(input) {
|
|
160
|
+
const definition = getPackDefinition(input.pack);
|
|
161
|
+
const roots = {
|
|
162
|
+
project: input.projectRoot,
|
|
163
|
+
user: input.userRoot,
|
|
164
|
+
};
|
|
165
|
+
const scopes = await Promise.all(definition.allowedScopes.flatMap((scope) => {
|
|
166
|
+
const scopeRoot = roots[scope];
|
|
167
|
+
return scopeRoot
|
|
168
|
+
? [
|
|
169
|
+
inventoryScopedPack({
|
|
170
|
+
pack: input.pack,
|
|
171
|
+
scope,
|
|
172
|
+
scopeRoot,
|
|
173
|
+
assetsRoot: input.assetsRoot,
|
|
174
|
+
}),
|
|
175
|
+
]
|
|
176
|
+
: [];
|
|
177
|
+
}));
|
|
178
|
+
const active = scopes.filter(hasScopedPackPlacementEvidence);
|
|
179
|
+
const placement = active.length === 2
|
|
180
|
+
? 'both'
|
|
181
|
+
: active[0]?.scope === 'project'
|
|
182
|
+
? 'project'
|
|
183
|
+
: active[0]?.scope === 'user'
|
|
184
|
+
? 'user'
|
|
185
|
+
: 'unavailable';
|
|
186
|
+
const diagnostics = scopes.flatMap(({ diagnostics: values }) => values);
|
|
187
|
+
for (const scoped of scopes) {
|
|
188
|
+
const shared = scoped.assets.filter(({ definition: asset, status }) => asset.sharedOwner !== undefined && status !== 'missing');
|
|
189
|
+
if (shared.length > 0 && !hasScopedPackPlacementEvidence(scoped)) {
|
|
190
|
+
diagnostics.push({
|
|
191
|
+
code: 'shared-owner-observation',
|
|
192
|
+
message: `Pack ${input.pack} has shared managed assets at ${scoped.scope} scope without pack ownership evidence`,
|
|
193
|
+
paths: shared.map(({ path }) => path),
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
if (placement === 'both') {
|
|
198
|
+
const assets = active.flatMap(({ assets: values }) => values.filter(({ status }) => status !== 'missing'));
|
|
199
|
+
diagnostics.push({
|
|
200
|
+
code: 'duplicate-scope',
|
|
201
|
+
message: `Pack ${input.pack} has canonical assets at project and user scope; provider precedence is not inferred`,
|
|
202
|
+
paths: assets.map(({ path }) => path),
|
|
203
|
+
versions: assets.map(({ installedVersion }) => installedVersion),
|
|
204
|
+
});
|
|
205
|
+
}
|
|
206
|
+
return { pack: input.pack, placement, scopes, diagnostics };
|
|
207
|
+
}
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
import type { ConcreteScope } from '../../../shared/types.js';
|
|
2
|
+
import { applyPackReconcilePlan, type ApplyPackReconcileDependencies, type ApplyPackReconcileResult, preflightPackReconcilePlans } from './apply-pack-reconcile.js';
|
|
3
|
+
import { inventoryScopedPack, type ScopedPackInventory } from './pack-inventory.js';
|
|
4
|
+
import { planPackReconcile, type PackReconcileAction, type PackReconcilePlan } from './pack-reconcile.js';
|
|
5
|
+
import type { PackName } from './types.js';
|
|
6
|
+
export interface PackLifecycleRequest {
|
|
7
|
+
pack: PackName;
|
|
8
|
+
scope: ConcreteScope;
|
|
9
|
+
scopeRoot: string;
|
|
10
|
+
assetsRoot: string;
|
|
11
|
+
action: PackReconcileAction;
|
|
12
|
+
}
|
|
13
|
+
export interface PackLifecycleResult {
|
|
14
|
+
request: PackLifecycleRequest;
|
|
15
|
+
before: ScopedPackInventory;
|
|
16
|
+
plan: PackReconcilePlan;
|
|
17
|
+
apply: ApplyPackReconcileResult | null;
|
|
18
|
+
}
|
|
19
|
+
export interface PackLifecycleDependencies {
|
|
20
|
+
inventory?: typeof inventoryScopedPack;
|
|
21
|
+
plan?: typeof planPackReconcile;
|
|
22
|
+
preflight?: typeof preflightPackReconcilePlans;
|
|
23
|
+
apply?: typeof applyPackReconcilePlan;
|
|
24
|
+
applyDependencies?: Partial<ApplyPackReconcileDependencies>;
|
|
25
|
+
}
|
|
26
|
+
export declare function reconcilePackLifecycles(requests: readonly PackLifecycleRequest[], options?: {
|
|
27
|
+
dryRun?: boolean;
|
|
28
|
+
dependencies?: PackLifecycleDependencies;
|
|
29
|
+
}): Promise<PackLifecycleResult[]>;
|
|
30
|
+
export declare function reconcilePackLifecycle(request: PackLifecycleRequest, options?: {
|
|
31
|
+
dryRun?: boolean;
|
|
32
|
+
dependencies?: PackLifecycleDependencies;
|
|
33
|
+
}): Promise<PackLifecycleResult>;
|
|
34
|
+
//# sourceMappingURL=pack-lifecycle.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-lifecycle.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-lifecycle.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,eAAe,CAAC;AAEnD,OAAO,EACL,sBAAsB,EACtB,KAAK,8BAA8B,EACnC,KAAK,wBAAwB,EAC7B,2BAA2B,EAC5B,MAAM,wBAAwB,CAAC;AAChC,OAAO,EACL,mBAAmB,EACnB,KAAK,mBAAmB,EACzB,MAAM,kBAAkB,CAAC;AAC1B,OAAO,EACL,iBAAiB,EACjB,KAAK,mBAAmB,EACxB,KAAK,iBAAiB,EACvB,MAAM,kBAAkB,CAAC;AAE1B,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAC;AAExC,MAAM,WAAW,oBAAoB;IACnC,IAAI,EAAE,QAAQ,CAAC;IACf,KAAK,EAAE,aAAa,CAAC;IACrB,SAAS,EAAE,MAAM,CAAC;IAClB,UAAU,EAAE,MAAM,CAAC;IACnB,MAAM,EAAE,mBAAmB,CAAC;CAC7B;AAED,MAAM,WAAW,mBAAmB;IAClC,OAAO,EAAE,oBAAoB,CAAC;IAC9B,MAAM,EAAE,mBAAmB,CAAC;IAC5B,IAAI,EAAE,iBAAiB,CAAC;IACxB,KAAK,EAAE,wBAAwB,GAAG,IAAI,CAAC;CACxC;AAED,MAAM,WAAW,yBAAyB;IACxC,SAAS,CAAC,EAAE,OAAO,mBAAmB,CAAC;IACvC,IAAI,CAAC,EAAE,OAAO,iBAAiB,CAAC;IAChC,SAAS,CAAC,EAAE,OAAO,2BAA2B,CAAC;IAC/C,KAAK,CAAC,EAAE,OAAO,sBAAsB,CAAC;IACtC,iBAAiB,CAAC,EAAE,OAAO,CAAC,8BAA8B,CAAC,CAAC;CAC7D;AAyBD,wBAAsB,uBAAuB,CAC3C,QAAQ,EAAE,SAAS,oBAAoB,EAAE,EACzC,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,yBAAyB,CAAC;CACrC,GACL,OAAO,CAAC,mBAAmB,EAAE,CAAC,CAgDhC;AAED,wBAAsB,sBAAsB,CAC1C,OAAO,EAAE,oBAAoB,EAC7B,OAAO,GAAE;IACP,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,YAAY,CAAC,EAAE,yBAAyB,CAAC;CACrC,GACL,OAAO,CAAC,mBAAmB,CAAC,CAE9B"}
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
import { mkdir, writeFile } from 'node:fs/promises';
|
|
2
|
+
import { dirname } from 'node:path';
|
|
3
|
+
import { readOatConfig, writeOatConfig } from '../../../config/oat-config.js';
|
|
4
|
+
import { applyPackReconcilePlan, preflightPackReconcilePlans, } from './apply-pack-reconcile.js';
|
|
5
|
+
import { inventoryScopedPack, } from './pack-inventory.js';
|
|
6
|
+
import { planPackReconcile, } from './pack-reconcile.js';
|
|
7
|
+
import { writeScopedPackIntent } from './scoped-pack-intent.js';
|
|
8
|
+
async function writeGenerated(scopeRoot, operation) {
|
|
9
|
+
await mkdir(dirname(operation.destination), { recursive: true });
|
|
10
|
+
switch (operation.generation) {
|
|
11
|
+
case 'projects-root-default':
|
|
12
|
+
await writeFile(operation.destination, '.oat/projects/shared\n', 'utf8');
|
|
13
|
+
return;
|
|
14
|
+
case 'projects-config-default': {
|
|
15
|
+
const config = await readOatConfig(scopeRoot);
|
|
16
|
+
if (config.projects?.root?.trim())
|
|
17
|
+
return;
|
|
18
|
+
await writeOatConfig(scopeRoot, {
|
|
19
|
+
...config,
|
|
20
|
+
projects: { root: '.oat/projects/shared' },
|
|
21
|
+
});
|
|
22
|
+
return;
|
|
23
|
+
}
|
|
24
|
+
case 'empty-file':
|
|
25
|
+
await writeFile(operation.destination, '', 'utf8');
|
|
26
|
+
}
|
|
27
|
+
}
|
|
28
|
+
export async function reconcilePackLifecycles(requests, options = {}) {
|
|
29
|
+
const dependencies = options.dependencies ?? {};
|
|
30
|
+
const inventory = dependencies.inventory ?? inventoryScopedPack;
|
|
31
|
+
const plan = dependencies.plan ?? planPackReconcile;
|
|
32
|
+
const planned = await Promise.all(requests.map(async (request) => {
|
|
33
|
+
const before = await inventory(request);
|
|
34
|
+
return {
|
|
35
|
+
request,
|
|
36
|
+
before,
|
|
37
|
+
plan: plan({ ...request, inventory: before }),
|
|
38
|
+
apply: null,
|
|
39
|
+
};
|
|
40
|
+
}));
|
|
41
|
+
if (options.dryRun)
|
|
42
|
+
return planned;
|
|
43
|
+
await (dependencies.preflight ?? preflightPackReconcilePlans)(planned.map(({ request, plan: value }) => ({
|
|
44
|
+
plan: value,
|
|
45
|
+
scopeRoot: request.scopeRoot,
|
|
46
|
+
})));
|
|
47
|
+
const results = [];
|
|
48
|
+
for (const entry of planned) {
|
|
49
|
+
const request = entry.request;
|
|
50
|
+
const applied = await (dependencies.apply ?? applyPackReconcilePlan)(entry.plan, request.scopeRoot, {
|
|
51
|
+
...dependencies.applyDependencies,
|
|
52
|
+
writeGenerated: async (operation) => writeGenerated(request.scopeRoot, operation),
|
|
53
|
+
writeIntent: async (operation) => writeScopedPackIntent({
|
|
54
|
+
pack: operation.pack,
|
|
55
|
+
scope: operation.scope,
|
|
56
|
+
scopeRoot: request.scopeRoot,
|
|
57
|
+
enabled: operation.enabled,
|
|
58
|
+
}),
|
|
59
|
+
inventory: async () => inventory(request),
|
|
60
|
+
});
|
|
61
|
+
results.push({ ...entry, apply: applied });
|
|
62
|
+
}
|
|
63
|
+
return results;
|
|
64
|
+
}
|
|
65
|
+
export async function reconcilePackLifecycle(request, options = {}) {
|
|
66
|
+
return (await reconcilePackLifecycles([request], options))[0];
|
|
67
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import type { PackAssetDefinition, PackAssetGeneration, PackAssetKind, PackAssetOwnership, PackDefinition, PackName } from './types.js';
|
|
2
|
+
export type { PackAssetDefinition, PackAssetGeneration, PackAssetKind, PackAssetOwnership, PackDefinition, };
|
|
3
|
+
export declare const PACK_NAMES: readonly ["core", "ideas", "docs", "workflows", "utility", "project-management", "research", "brainstorm"];
|
|
4
|
+
export declare function isPackName(value: string): value is PackName;
|
|
5
|
+
export declare const PACK_MANIFEST: readonly PackDefinition[];
|
|
6
|
+
export declare function getPackDefinition(pack: PackName): PackDefinition;
|
|
7
|
+
export declare function getPackAssets(pack: PackName, kind?: PackAssetKind): readonly PackAssetDefinition[];
|
|
8
|
+
export declare function getPackMemberNames(pack: PackName, kind: 'skill' | 'agent' | 'template' | 'script'): string[];
|
|
9
|
+
export declare function getCanonicalProviderPaths(pack: PackName): string[];
|
|
10
|
+
export declare function validatePackManifest(manifest?: readonly PackDefinition[]): void;
|
|
11
|
+
//# sourceMappingURL=pack-manifest.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"pack-manifest.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/shared/pack-manifest.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EACV,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,cAAc,EACd,QAAQ,EACT,MAAM,SAAS,CAAC;AAEjB,YAAY,EACV,mBAAmB,EACnB,mBAAmB,EACnB,aAAa,EACb,kBAAkB,EAClB,cAAc,GACf,CAAC;AAEF,eAAO,MAAM,UAAU,4GASiB,CAAC;AAEzC,wBAAgB,UAAU,CAAC,KAAK,EAAE,MAAM,GAAG,KAAK,IAAI,QAAQ,CAE3D;AA8HD,eAAO,MAAM,aAAa,EAAE,SAAS,cAAc,EAwKlD,CAAC;AAEF,wBAAgB,iBAAiB,CAAC,IAAI,EAAE,QAAQ,GAAG,cAAc,CAMhE;AAED,wBAAgB,aAAa,CAC3B,IAAI,EAAE,QAAQ,EACd,IAAI,CAAC,EAAE,aAAa,GACnB,SAAS,mBAAmB,EAAE,CAGhC;AAED,wBAAgB,kBAAkB,CAChC,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,OAAO,GAAG,OAAO,GAAG,UAAU,GAAG,QAAQ,GAC9C,MAAM,EAAE,CAQV;AAED,wBAAgB,yBAAyB,CAAC,IAAI,EAAE,QAAQ,GAAG,MAAM,EAAE,CAIlE;AA0DD,wBAAgB,oBAAoB,CAClC,QAAQ,GAAE,SAAS,cAAc,EAAkB,GAClD,IAAI,CA6DN"}
|