@open-agent-toolkit/cli 0.2.55 → 0.2.57
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/agents/oat-phase-implementer.md +123 -9
- package/assets/bundle-metadata.json +1 -1
- package/assets/docs/cli-utilities/configuration.md +12 -2
- package/assets/docs/docs-tooling/commands.md +36 -5
- package/assets/docs/reference/oat-directory-structure.md +56 -4
- package/assets/docs/workflows/projects/implementation-execution.md +5 -1
- package/assets/docs/workflows/skills/explainer-kit.md +8 -5
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/analyze/SKILL.md +18 -17
- package/assets/skills/oat-brainstorm/SKILL.md +2 -2
- package/assets/skills/oat-doctor/SKILL.md +49 -36
- package/assets/skills/oat-idea-summarize/SKILL.md +2 -2
- package/assets/skills/oat-project-autonomous/SKILL.md +17 -10
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +3 -3
- package/assets/skills/oat-project-complete/SKILL.md +18 -8
- package/assets/skills/oat-project-discover/SKILL.md +3 -3
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-implement/SKILL.md +1 -1
- package/assets/skills/oat-project-implement/references/completion-and-closeout.md +12 -3
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-implement/references/phase-execution.md +218 -4
- package/assets/skills/oat-project-implement/references/plan-and-resume.md +5 -2
- package/assets/skills/oat-project-implement/scripts/capture-dirty-tree.mjs +1069 -0
- package/assets/skills/oat-project-import-plan/SKILL.md +12 -6
- package/assets/skills/oat-project-next/SKILL.md +7 -5
- package/assets/skills/oat-project-plan/SKILL.md +24 -12
- package/assets/skills/oat-project-pr-final/SKILL.md +2 -2
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-quick-start/SKILL.md +11 -6
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +3 -3
- package/assets/skills/oat-project-retro/SKILL.md +4 -2
- package/assets/skills/oat-project-review-receive/SKILL.md +9 -5
- package/assets/skills/oat-project-revise/SKILL.md +6 -6
- package/dist/commands/config/index.d.ts +1 -0
- package/dist/commands/config/index.d.ts.map +1 -1
- package/dist/commands/config/index.js +51 -4
- package/dist/commands/docs/index-generate/generator.d.ts +43 -1
- package/dist/commands/docs/index-generate/generator.d.ts.map +1 -1
- package/dist/commands/docs/index-generate/generator.js +169 -3
- package/dist/commands/docs/index-generate/index.d.ts +8 -3
- package/dist/commands/docs/index-generate/index.d.ts.map +1 -1
- package/dist/commands/docs/index-generate/index.js +340 -24
- package/dist/commands/docs/init/scaffold.d.ts +11 -1
- package/dist/commands/docs/init/scaffold.d.ts.map +1 -1
- package/dist/commands/docs/init/scaffold.js +11 -2
- package/dist/config/oat-config.d.ts +14 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +61 -0
- package/dist/fs/assets.d.ts +33 -4
- package/dist/fs/assets.d.ts.map +1 -1
- package/dist/fs/assets.js +127 -12
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../../src/commands/docs/init/scaffold.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAKjE,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"scaffold.d.ts","sourceRoot":"","sources":["../../../../src/commands/docs/init/scaffold.ts"],"names":[],"mappings":"AAUA,OAAO,KAAK,EAAE,sBAAsB,EAAE,MAAM,oBAAoB,CAAC;AAKjE,OAAO,KAAK,EAEV,aAAa,EACb,uBAAuB,EAExB,MAAM,mBAAmB,CAAC;AAmF3B,MAAM,WAAW,sBAAuB,SAAQ,uBAAuB;IACrE,UAAU,EAAE,MAAM,CAAC;CACpB;AAED,MAAM,WAAW,qBAAqB;IACpC,OAAO,EAAE,MAAM,CAAC;IAChB,YAAY,EAAE,MAAM,EAAE,CAAC;IACvB,mBAAmB,EAAE,sBAAsB,CAAC;CAC7C;AAED,MAAM,WAAW,aAAa;IAC5B,SAAS,EAAE,OAAO,CAAC;IACnB,aAAa,EAAE,GAAG,CAAC,MAAM,CAAC,CAAC;IAC3B,kBAAkB,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;CAC5C;AAED,KAAK,YAAY,CAAC,CAAC,IAAI,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAC;AAEtC,MAAM,WAAW,2BAA2B;IAC1C,iBAAiB,EAAE,MAAM,YAAY,CAAC,MAAM,GAAG,IAAI,GAAG,SAAS,CAAC,CAAC;IACjE,0BAA0B,EAAE,CAC1B,QAAQ,EAAE,MAAM,EAChB,OAAO,EAAE,MAAM,KACZ,YAAY,CAAC,OAAO,CAAC,CAAC;CAC5B;AAUD,eAAO,MAAM,aAAa,YAAY,CAAC;AAEvC,wBAAsB,eAAe,CAAC,QAAQ,EAAE,MAAM,GAAG,OAAO,CAAC,OAAO,CAAC,CAOxE;AAgDD,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,EAChB,UAAU,EAAE,MAAM,GACjB,OAAO,CAAC,aAAa,CAAC,CAaxB;AAiMD;;;;;;;;GAQG;AACH,wBAAgB,wBAAwB,CACtC,SAAS,EAAE,aAAa,EACxB,SAAS,EAAE,MAAM,GAChB,sBAAsB,CAexB;AAaD,wBAAsB,eAAe,CACnC,OAAO,EAAE,sBAAsB,EAC/B,SAAS,GAAE,OAAO,CAAC,2BAA2B,CAAM,GACnD,OAAO,CAAC,qBAAqB,CAAC,CAkDhC"}
|
|
@@ -256,12 +256,21 @@ function renderTemplate(template, options, depContext, packageManagerField) {
|
|
|
256
256
|
};
|
|
257
257
|
return Object.entries(replacements).reduce((content, [token, value]) => content.replaceAll(token, value), template);
|
|
258
258
|
}
|
|
259
|
-
|
|
259
|
+
/**
|
|
260
|
+
* Seed `documentation.*` for a freshly scaffolded app.
|
|
261
|
+
*
|
|
262
|
+
* For Fumadocs, `index` names the generated app-root manifest that
|
|
263
|
+
* `oat docs generate-index` writes (`<root>/index.md`), not the authored source
|
|
264
|
+
* page at `<root>/docs/index.md`: the scaffold must be correct before the first
|
|
265
|
+
* build rather than depending on a later config mutation. The MkDocs seed keeps
|
|
266
|
+
* pointing at the nav/config YAML, which is that framework's entry point.
|
|
267
|
+
*/
|
|
268
|
+
export function buildDocumentationConfig(framework, targetDir) {
|
|
260
269
|
if (framework === 'fumadocs') {
|
|
261
270
|
return {
|
|
262
271
|
root: targetDir,
|
|
263
272
|
tooling: 'fumadocs',
|
|
264
|
-
index: join(targetDir, '
|
|
273
|
+
index: join(targetDir, 'index.md'),
|
|
265
274
|
};
|
|
266
275
|
}
|
|
267
276
|
return {
|
|
@@ -6,6 +6,12 @@ export interface OatDocumentationConfig {
|
|
|
6
6
|
config?: string;
|
|
7
7
|
index?: string;
|
|
8
8
|
requireForProjectCompletion?: boolean;
|
|
9
|
+
/**
|
|
10
|
+
* Globs, relative to the docs directory `oat docs generate-index` indexes,
|
|
11
|
+
* whose matches are left out of the generated index. Trimmed, de-duplicated,
|
|
12
|
+
* and order-preserving.
|
|
13
|
+
*/
|
|
14
|
+
excludes?: string[];
|
|
9
15
|
}
|
|
10
16
|
export interface OatGitConfig {
|
|
11
17
|
defaultBranch?: string;
|
|
@@ -203,6 +209,14 @@ export declare function normalizeProjectPath(repoRoot: string, pathValue: string
|
|
|
203
209
|
export declare function resolveLocalPaths(config: OatConfig): string[];
|
|
204
210
|
export declare function readOatConfig(repoRoot: string): Promise<OatConfig>;
|
|
205
211
|
export declare function readOatConfigForDefaultScopeRepair(repoRoot: string): Promise<OatConfig>;
|
|
212
|
+
/**
|
|
213
|
+
* Read shared config with an unusable `documentation.excludes` dropped, so
|
|
214
|
+
* `oat config set documentation.excludes ...` can perform the repair its own
|
|
215
|
+
* validation error prescribes. Mirrors the `projects.defaultScope` precedent
|
|
216
|
+
* above: without it, the only key-specific repair command the error names is
|
|
217
|
+
* itself blocked by the invalid value.
|
|
218
|
+
*/
|
|
219
|
+
export declare function readOatConfigForDocumentationExcludesRepair(repoRoot: string): Promise<OatConfig>;
|
|
206
220
|
export declare function readOatLocalConfig(repoRoot: string): Promise<OatLocalConfig>;
|
|
207
221
|
export declare function writeOatConfig(repoRoot: string, config: OatConfig): Promise<void>;
|
|
208
222
|
export declare function writeOatLocalConfig(repoRoot: string, config: OatLocalConfig): Promise<void>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oat-config.d.ts","sourceRoot":"","sources":["../../src/config/oat-config.ts"],"names":[],"mappings":"AAQA,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;
|
|
1
|
+
{"version":3,"file":"oat-config.d.ts","sourceRoot":"","sources":["../../src/config/oat-config.ts"],"names":[],"mappings":"AAQA,OAAO,EAEL,KAAK,6BAA6B,EACnC,MAAM,mBAAmB,CAAC;AAI3B,OAAO,EACL,2BAA2B,EAC3B,8BAA8B,EAC9B,iCAAiC,EACjC,+BA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,EAAE,cAAc,GACrB,OAAO,CAAC,IAAI,CAAC,CAIf;AAED,wBAAsB,oBAAoB,CACxC,QAAQ,EAAE,MAAM,GACf,OAAO,CAAC,uBAAuB,CAAC,CAwClC;AAED,wBAAsB,gBAAgB,CACpC,QAAQ,EAAE,MAAM,EAChB,mBAAmB,EAAE,MAAM,GAC1B,OAAO,CAAC,IAAI,CAAC,CAiCf;AAED,wBAAsB,kBAAkB,CACtC,QAAQ,EAAE,MAAM,EAChB,OAAO,CAAC,EAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAA;CAAE,GAChC,OAAO,CAAC,IAAI,CAAC,CAYf;AA4ED,wBAAsB,cAAc,CAClC,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,UAAU,CAAC,CAarB;AAED,wBAAsB,eAAe,CACnC,aAAa,EAAE,MAAM,EACrB,MAAM,EAAE,UAAU,GACjB,OAAO,CAAC,IAAI,CAAC,CAMf;AAED,wBAAsB,iBAAiB,CACrC,QAAQ,EAAE,MAAM,EAChB,aAAa,EAAE,MAAM,GACpB,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAQxB;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"}
|
|
@@ -626,6 +626,38 @@ async function normalizeReadableProjectPath(repoRoot, pathValue) {
|
|
|
626
626
|
return null;
|
|
627
627
|
}
|
|
628
628
|
}
|
|
629
|
+
/**
|
|
630
|
+
* Parse `documentation.excludes` into a trimmed, de-duplicated,
|
|
631
|
+
* order-preserving list.
|
|
632
|
+
*
|
|
633
|
+
* Unlike its scalar `documentation.*` siblings, a malformed value is rejected
|
|
634
|
+
* rather than silently dropped: a typo in an exclusion list would otherwise
|
|
635
|
+
* publish pages the operator believed were excluded, with no signal anywhere.
|
|
636
|
+
* An absent key and an empty array are both "no exclusions".
|
|
637
|
+
*/
|
|
638
|
+
function normalizeDocumentationExcludes(value, configPath) {
|
|
639
|
+
if (value === undefined) {
|
|
640
|
+
return [];
|
|
641
|
+
}
|
|
642
|
+
const invalid = () => {
|
|
643
|
+
throw new CliError(`Invalid documentation.excludes in ${configPath}: expected an array of non-empty strings. ` +
|
|
644
|
+
'Repair it with oat config set documentation.excludes "<glob>,<glob>" (an empty value clears it).', 2);
|
|
645
|
+
};
|
|
646
|
+
if (!Array.isArray(value)) {
|
|
647
|
+
invalid();
|
|
648
|
+
}
|
|
649
|
+
const normalized = [];
|
|
650
|
+
for (const entry of value) {
|
|
651
|
+
if (typeof entry !== 'string' || !entry.trim()) {
|
|
652
|
+
invalid();
|
|
653
|
+
}
|
|
654
|
+
const trimmedEntry = entry.trim();
|
|
655
|
+
if (!normalized.includes(trimmedEntry)) {
|
|
656
|
+
normalized.push(trimmedEntry);
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
return normalized;
|
|
660
|
+
}
|
|
629
661
|
function normalizeOatConfig(parsed, configPath = '.oat/config.json') {
|
|
630
662
|
const next = { ...DEFAULT_OAT_CONFIG };
|
|
631
663
|
if (!isRecord(parsed)) {
|
|
@@ -741,6 +773,10 @@ function normalizeOatConfig(parsed, configPath = '.oat/config.json') {
|
|
|
741
773
|
doc.requireForProjectCompletion =
|
|
742
774
|
parsed.documentation.requireForProjectCompletion;
|
|
743
775
|
}
|
|
776
|
+
const excludes = normalizeDocumentationExcludes(parsed.documentation.excludes, configPath);
|
|
777
|
+
if (excludes.length > 0) {
|
|
778
|
+
doc.excludes = excludes;
|
|
779
|
+
}
|
|
744
780
|
if (Object.keys(doc).length > 0) {
|
|
745
781
|
next.documentation = doc;
|
|
746
782
|
}
|
|
@@ -828,6 +864,31 @@ export async function readOatConfigForDefaultScopeRepair(repoRoot) {
|
|
|
828
864
|
throw error;
|
|
829
865
|
}
|
|
830
866
|
}
|
|
867
|
+
/**
|
|
868
|
+
* Read shared config with an unusable `documentation.excludes` dropped, so
|
|
869
|
+
* `oat config set documentation.excludes ...` can perform the repair its own
|
|
870
|
+
* validation error prescribes. Mirrors the `projects.defaultScope` precedent
|
|
871
|
+
* above: without it, the only key-specific repair command the error names is
|
|
872
|
+
* itself blocked by the invalid value.
|
|
873
|
+
*/
|
|
874
|
+
export async function readOatConfigForDocumentationExcludesRepair(repoRoot) {
|
|
875
|
+
const configPath = getConfigPath(repoRoot);
|
|
876
|
+
try {
|
|
877
|
+
const raw = await readFile(configPath, 'utf8');
|
|
878
|
+
const parsed = parseJsonConfig(raw, configPath);
|
|
879
|
+
if (isRecord(parsed) && isRecord(parsed.documentation)) {
|
|
880
|
+
const { excludes: _invalidExcludes, ...documentation } = parsed.documentation;
|
|
881
|
+
return normalizeOatConfig({ ...parsed, documentation }, configPath);
|
|
882
|
+
}
|
|
883
|
+
return normalizeOatConfig(parsed, configPath);
|
|
884
|
+
}
|
|
885
|
+
catch (error) {
|
|
886
|
+
if (isMissingFileError(error)) {
|
|
887
|
+
return { ...DEFAULT_OAT_CONFIG };
|
|
888
|
+
}
|
|
889
|
+
throw error;
|
|
890
|
+
}
|
|
891
|
+
}
|
|
831
892
|
export async function readOatLocalConfig(repoRoot) {
|
|
832
893
|
const configPath = getLocalConfigPath(repoRoot);
|
|
833
894
|
try {
|
package/dist/fs/assets.d.ts
CHANGED
|
@@ -1,13 +1,42 @@
|
|
|
1
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Where the assets root under validation came from.
|
|
3
|
+
*
|
|
4
|
+
* The packaged `<cliRoot>/assets` default and an operator-supplied
|
|
5
|
+
* `OAT_ASSETS_DIR` fail exactly the same checks, but only the packaged one is
|
|
6
|
+
* repairable by rebuilding or reinstalling this package. Carrying the source
|
|
7
|
+
* into every fail-closed diagnosis is what keeps its remedy true.
|
|
8
|
+
*
|
|
9
|
+
* Exported only because it appears in the signature of the exported
|
|
10
|
+
* `validateAssetsBundle` and this package emits declarations. It is an
|
|
11
|
+
* internal context argument with a `packaged` default, not a new contract any
|
|
12
|
+
* caller has to satisfy.
|
|
13
|
+
*/
|
|
14
|
+
export type AssetsRootSource = 'packaged' | 'override';
|
|
15
|
+
/**
|
|
16
|
+
* Fail closed on any bundle a consumer must not read as a legitimate install.
|
|
17
|
+
*
|
|
18
|
+
* Checks run in escalating specificity — metadata presence, metadata shape,
|
|
19
|
+
* CLI version, then top-level structure — so malformed metadata remains the
|
|
20
|
+
* primary diagnosis and a structural complaint is only reported about a bundle
|
|
21
|
+
* whose metadata already agrees with the running CLI.
|
|
22
|
+
*
|
|
23
|
+
* `source` only selects the remedy sentence. It defaults to `packaged` so
|
|
24
|
+
* direct callers keep their existing rebuild/reinstall guidance, and it never
|
|
25
|
+
* decides whether a bundle is acceptable.
|
|
26
|
+
*/
|
|
27
|
+
export declare function validateAssetsBundle(assetsRoot: string, expectedVersion?: string, source?: AssetsRootSource): Promise<void>;
|
|
2
28
|
/**
|
|
3
29
|
* Resolve the directory the CLI reads bundled assets from.
|
|
4
30
|
*
|
|
5
31
|
* A non-empty `OAT_ASSETS_DIR` selects an explicit root; an unset or blank
|
|
6
32
|
* value keeps the packaged `<cliRoot>/assets` default. Both paths run the same
|
|
7
33
|
* directory and bundle-integrity checks, and an explicit root never falls back
|
|
8
|
-
* to the packaged one: a missing, non-directory, malformed,
|
|
9
|
-
*
|
|
10
|
-
*
|
|
34
|
+
* to the packaged one: a missing, non-directory, malformed, version-mismatched,
|
|
35
|
+
* or structurally incomplete override fails closed with the same actionable
|
|
36
|
+
* errors. The override discriminator is derived once, here, and carried
|
|
37
|
+
* through every one of those failures so each reports a remedy that applies to
|
|
38
|
+
* the root it actually read. A relative value is resolved against the process
|
|
39
|
+
* working directory.
|
|
11
40
|
*/
|
|
12
41
|
export declare function resolveAssetsRoot(env?: NodeJS.ProcessEnv): Promise<string>;
|
|
13
42
|
//# sourceMappingURL=assets.d.ts.map
|
package/dist/fs/assets.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/fs/assets.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"assets.d.ts","sourceRoot":"","sources":["../../src/fs/assets.ts"],"names":[],"mappings":"AAeA;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,gBAAgB,GAAG,UAAU,GAAG,UAAU,CAAC;AA4IvD;;;;;;;;;;;GAWG;AACH,wBAAsB,oBAAoB,CACxC,UAAU,EAAE,MAAM,EAClB,eAAe,SAAc,EAC7B,MAAM,GAAE,gBAA6B,GACpC,OAAO,CAAC,IAAI,CAAC,CAsCf;AAQD;;;;;;;;;;;;GAYG;AACH,wBAAsB,iBAAiB,CACrC,GAAG,GAAE,MAAM,CAAC,UAAwB,GACnC,OAAO,CAAC,MAAM,CAAC,CA8BjB"}
|
package/dist/fs/assets.js
CHANGED
|
@@ -4,6 +4,56 @@ import { fileURLToPath } from 'node:url';
|
|
|
4
4
|
import { CliError } from '../errors/index.js';
|
|
5
5
|
import { OAT_VERSION } from '../shared/oat-version.js';
|
|
6
6
|
const BUNDLE_METADATA_FILENAME = 'bundle-metadata.json';
|
|
7
|
+
/**
|
|
8
|
+
* Remedy for a packaged root that is absent or is not a directory. The
|
|
9
|
+
* packaged tree is a build output, so the build is what creates it.
|
|
10
|
+
*/
|
|
11
|
+
const PACKAGED_ROOT_REMEDY = "Run 'pnpm build' to generate bundled assets.";
|
|
12
|
+
/**
|
|
13
|
+
* Remedy for a packaged bundle whose contents are missing, malformed, or
|
|
14
|
+
* built for another CLI version. Binding it once keeps the metadata, version,
|
|
15
|
+
* and structural families phrased identically so their guidance cannot drift
|
|
16
|
+
* apart.
|
|
17
|
+
*/
|
|
18
|
+
const PACKAGED_BUNDLE_REMEDY = 'Reinstall @open-agent-toolkit/cli or rebuild the CLI before updating tools.';
|
|
19
|
+
/**
|
|
20
|
+
* The single remedy for every failure under an explicit override. Neither a
|
|
21
|
+
* rebuild nor a reinstall touches an operator-supplied path, so this sentence
|
|
22
|
+
* names the one input the operator controls and the two properties it must
|
|
23
|
+
* satisfy — complete, and built for the running CLI. It deliberately offers no
|
|
24
|
+
* way to proceed on the packaged bundle instead: an explicit override never
|
|
25
|
+
* falls back.
|
|
26
|
+
*/
|
|
27
|
+
const OVERRIDE_REMEDY = 'Check OAT_ASSETS_DIR and point it to a complete asset bundle built for this CLI version.';
|
|
28
|
+
/**
|
|
29
|
+
* The one place a fail-closed assets diagnosis turns its source into advice.
|
|
30
|
+
*
|
|
31
|
+
* Every branch keeps its own factual prefix — path, expected and actual
|
|
32
|
+
* version, offending directory — and varies only this trailing sentence, so a
|
|
33
|
+
* source-aware remedy can never quietly become a source-aware verdict.
|
|
34
|
+
*/
|
|
35
|
+
function assetsRemedy(source, packagedRemedy = PACKAGED_BUNDLE_REMEDY) {
|
|
36
|
+
return source === 'override' ? OVERRIDE_REMEDY : packagedRemedy;
|
|
37
|
+
}
|
|
38
|
+
/**
|
|
39
|
+
* Top-level directories `packages/cli/scripts/bundle-assets.sh` creates for
|
|
40
|
+
* every bundle, listed in the order that script creates them. The producer
|
|
41
|
+
* makes all of them unconditionally — even when a category has no entries — so
|
|
42
|
+
* their presence is the cheapest structural contract that tells a complete
|
|
43
|
+
* bundle apart from a metadata-only or truncated one.
|
|
44
|
+
*
|
|
45
|
+
* This is deliberately a shape check and nothing more: no per-file manifest,
|
|
46
|
+
* no checksums, and no walk of the bundled documents.
|
|
47
|
+
*/
|
|
48
|
+
const REQUIRED_BUNDLE_DIRECTORIES = [
|
|
49
|
+
'skills',
|
|
50
|
+
'agents',
|
|
51
|
+
'templates',
|
|
52
|
+
'scripts',
|
|
53
|
+
'docs',
|
|
54
|
+
'migration',
|
|
55
|
+
'config',
|
|
56
|
+
];
|
|
7
57
|
function isBundleMetadata(value) {
|
|
8
58
|
if (!value || typeof value !== 'object') {
|
|
9
59
|
return false;
|
|
@@ -13,28 +63,86 @@ function isBundleMetadata(value) {
|
|
|
13
63
|
typeof metadata.oatVersion === 'string' &&
|
|
14
64
|
metadata.oatVersion.length > 0);
|
|
15
65
|
}
|
|
16
|
-
|
|
66
|
+
/**
|
|
67
|
+
* The `errno` label of a failed filesystem call, or `unknown` when the thrown
|
|
68
|
+
* value carries none. `EACCES`, `ELOOP`, and `EIO` demand different operator
|
|
69
|
+
* responses and none of them is the remedy this validator can offer, so the
|
|
70
|
+
* code is reported rather than collapsed into one unreadable-path verdict.
|
|
71
|
+
*/
|
|
72
|
+
function errorCode(error) {
|
|
73
|
+
if (typeof error === 'object' &&
|
|
74
|
+
error !== null &&
|
|
75
|
+
'code' in error &&
|
|
76
|
+
typeof error.code === 'string' &&
|
|
77
|
+
error.code.length > 0) {
|
|
78
|
+
return error.code;
|
|
79
|
+
}
|
|
80
|
+
return 'unknown';
|
|
81
|
+
}
|
|
82
|
+
function isMissingPathError(error) {
|
|
83
|
+
return errorCode(error) === 'ENOENT';
|
|
84
|
+
}
|
|
85
|
+
/**
|
|
86
|
+
* Reject a bundle whose top-level shape is incomplete.
|
|
87
|
+
*
|
|
88
|
+
* Reports the first offending path in producer order, so the diagnosis for a
|
|
89
|
+
* given broken bundle is deterministic. A failed `stat` is never read as an
|
|
90
|
+
* absent-but-tolerable directory: a path the process cannot read fails closed
|
|
91
|
+
* under its own diagnosis, naming the `errno` that stopped it.
|
|
92
|
+
*/
|
|
93
|
+
async function validateBundleStructure(assetsRoot, source) {
|
|
94
|
+
for (const directoryName of REQUIRED_BUNDLE_DIRECTORIES) {
|
|
95
|
+
const directoryPath = join(assetsRoot, directoryName);
|
|
96
|
+
let directoryStat;
|
|
97
|
+
try {
|
|
98
|
+
directoryStat = await stat(directoryPath);
|
|
99
|
+
}
|
|
100
|
+
catch (error) {
|
|
101
|
+
if (isMissingPathError(error)) {
|
|
102
|
+
throw new CliError(`Bundled assets are incomplete: required directory not found: ${directoryPath}. ${assetsRemedy(source)}`, 2);
|
|
103
|
+
}
|
|
104
|
+
throw new CliError(`Bundled assets are unreadable: required directory could not be read (${errorCode(error)}): ${directoryPath}. ${assetsRemedy(source)}`, 2);
|
|
105
|
+
}
|
|
106
|
+
if (!directoryStat.isDirectory()) {
|
|
107
|
+
throw new CliError(`Bundled assets are incomplete: required bundle path is not a directory: ${directoryPath}. ${assetsRemedy(source)}`, 2);
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
}
|
|
111
|
+
/**
|
|
112
|
+
* Fail closed on any bundle a consumer must not read as a legitimate install.
|
|
113
|
+
*
|
|
114
|
+
* Checks run in escalating specificity — metadata presence, metadata shape,
|
|
115
|
+
* CLI version, then top-level structure — so malformed metadata remains the
|
|
116
|
+
* primary diagnosis and a structural complaint is only reported about a bundle
|
|
117
|
+
* whose metadata already agrees with the running CLI.
|
|
118
|
+
*
|
|
119
|
+
* `source` only selects the remedy sentence. It defaults to `packaged` so
|
|
120
|
+
* direct callers keep their existing rebuild/reinstall guidance, and it never
|
|
121
|
+
* decides whether a bundle is acceptable.
|
|
122
|
+
*/
|
|
123
|
+
export async function validateAssetsBundle(assetsRoot, expectedVersion = OAT_VERSION, source = 'packaged') {
|
|
17
124
|
const metadataPath = join(assetsRoot, BUNDLE_METADATA_FILENAME);
|
|
18
125
|
let rawMetadata;
|
|
19
126
|
try {
|
|
20
127
|
rawMetadata = await readFile(metadataPath, 'utf8');
|
|
21
128
|
}
|
|
22
129
|
catch {
|
|
23
|
-
throw new CliError(`Bundled asset metadata not found: ${metadataPath}.
|
|
130
|
+
throw new CliError(`Bundled asset metadata not found: ${metadataPath}. ${assetsRemedy(source)}`, 2);
|
|
24
131
|
}
|
|
25
132
|
let metadata;
|
|
26
133
|
try {
|
|
27
134
|
metadata = JSON.parse(rawMetadata);
|
|
28
135
|
}
|
|
29
136
|
catch {
|
|
30
|
-
throw new CliError(`Bundled asset metadata is invalid: ${metadataPath}.
|
|
137
|
+
throw new CliError(`Bundled asset metadata is invalid: ${metadataPath}. ${assetsRemedy(source)}`, 2);
|
|
31
138
|
}
|
|
32
139
|
if (!isBundleMetadata(metadata)) {
|
|
33
|
-
throw new CliError(`Bundled asset metadata is invalid: ${metadataPath}.
|
|
140
|
+
throw new CliError(`Bundled asset metadata is invalid: ${metadataPath}. ${assetsRemedy(source)}`, 2);
|
|
34
141
|
}
|
|
35
142
|
if (metadata.oatVersion !== expectedVersion) {
|
|
36
|
-
throw new CliError(`Bundled assets version mismatch: CLI ${expectedVersion}, assets ${metadata.oatVersion}.
|
|
143
|
+
throw new CliError(`Bundled assets version mismatch: CLI ${expectedVersion}, assets ${metadata.oatVersion}. ${assetsRemedy(source)}`, 2);
|
|
37
144
|
}
|
|
145
|
+
await validateBundleStructure(assetsRoot, source);
|
|
38
146
|
}
|
|
39
147
|
function resolvePackagedAssetsRoot() {
|
|
40
148
|
const modulePath = fileURLToPath(import.meta.url);
|
|
@@ -47,25 +155,32 @@ function resolvePackagedAssetsRoot() {
|
|
|
47
155
|
* A non-empty `OAT_ASSETS_DIR` selects an explicit root; an unset or blank
|
|
48
156
|
* value keeps the packaged `<cliRoot>/assets` default. Both paths run the same
|
|
49
157
|
* directory and bundle-integrity checks, and an explicit root never falls back
|
|
50
|
-
* to the packaged one: a missing, non-directory, malformed,
|
|
51
|
-
*
|
|
52
|
-
*
|
|
158
|
+
* to the packaged one: a missing, non-directory, malformed, version-mismatched,
|
|
159
|
+
* or structurally incomplete override fails closed with the same actionable
|
|
160
|
+
* errors. The override discriminator is derived once, here, and carried
|
|
161
|
+
* through every one of those failures so each reports a remedy that applies to
|
|
162
|
+
* the root it actually read. A relative value is resolved against the process
|
|
163
|
+
* working directory.
|
|
53
164
|
*/
|
|
54
165
|
export async function resolveAssetsRoot(env = process.env) {
|
|
55
166
|
const override = env.OAT_ASSETS_DIR?.trim() ?? '';
|
|
56
|
-
const
|
|
167
|
+
const isOverride = override.length > 0;
|
|
168
|
+
const source = isOverride ? 'override' : 'packaged';
|
|
169
|
+
const assetsRoot = isOverride
|
|
170
|
+
? resolve(override)
|
|
171
|
+
: resolvePackagedAssetsRoot();
|
|
57
172
|
try {
|
|
58
173
|
const assetsStat = await stat(assetsRoot);
|
|
59
174
|
if (!assetsStat.isDirectory()) {
|
|
60
|
-
throw new CliError(`Assets path is not a directory: ${assetsRoot}`, 2);
|
|
175
|
+
throw new CliError(`Assets path is not a directory: ${assetsRoot}. ${assetsRemedy(source, PACKAGED_ROOT_REMEDY)}`, 2);
|
|
61
176
|
}
|
|
62
177
|
}
|
|
63
178
|
catch (error) {
|
|
64
179
|
if (error instanceof CliError) {
|
|
65
180
|
throw error;
|
|
66
181
|
}
|
|
67
|
-
throw new CliError(`Assets directory not found: ${assetsRoot}.
|
|
182
|
+
throw new CliError(`Assets directory not found: ${assetsRoot}. ${assetsRemedy(source, PACKAGED_ROOT_REMEDY)}`, 2);
|
|
68
183
|
}
|
|
69
|
-
await validateAssetsBundle(assetsRoot);
|
|
184
|
+
await validateAssetsBundle(assetsRoot, OAT_VERSION, source);
|
|
70
185
|
return assetsRoot;
|
|
71
186
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@open-agent-toolkit/cli",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.57",
|
|
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.
|
|
37
|
+
"@open-agent-toolkit/control-plane": "0.2.57"
|
|
38
38
|
},
|
|
39
39
|
"devDependencies": {
|
|
40
40
|
"@types/node": "^22.10.0",
|