@open-agent-toolkit/cli 0.2.62 → 0.2.64
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/config-and-local-state.md +1 -0
- package/assets/docs/cli-utilities/configuration.md +10 -8
- package/assets/docs/cli-utilities/project-log.md +16 -0
- package/assets/docs/cli-utilities/tool-packs.md +83 -0
- package/assets/docs/cli-utilities/workflow-gates.md +124 -16
- package/assets/docs/contributing/skills.md +42 -7
- package/assets/docs/provider-sync/commands.md +3 -0
- package/assets/docs/provider-sync/instruction-sync.md +107 -0
- package/assets/docs/provider-sync/manifest-and-drift.md +105 -0
- package/assets/docs/reference/cli-reference.md +16 -6
- package/assets/docs/reference/oat-directory-structure.md +32 -31
- package/assets/docs/workflows/projects/lifecycle.md +45 -0
- package/assets/docs/workflows/projects/picking-up-projects.md +14 -0
- package/assets/docs/workflows/skills/explainer-kit.md +10 -4
- package/assets/docs/workflows/skills/repo-improve.md +15 -1
- package/assets/public-package-versions.json +4 -4
- package/assets/skills/create-agnostic-skill/SKILL.md +9 -7
- package/assets/skills/create-agnostic-skill/references/skill-template.md +9 -7
- package/assets/skills/oat-explainer-kit/SKILL.md +14 -1
- package/assets/skills/oat-explainer-kit/references/config-contract.md +12 -0
- package/assets/skills/oat-explainer-kit/references/lifecycle-contract.md +57 -10
- package/assets/skills/oat-explainer-kit/scripts/check-terminal-outcome.mjs +28 -5
- package/assets/skills/oat-explainer-kit/scripts/probe-recap-seams.mjs +371 -0
- package/assets/skills/oat-explainer-kit/scripts/resolve-intent.mjs +123 -1
- package/assets/skills/oat-project-autonomous/SKILL.md +10 -1
- package/assets/skills/oat-project-autonomous/references/gate-inventory.md +122 -121
- package/assets/skills/oat-project-complete/SKILL.md +134 -4
- package/assets/skills/oat-project-document/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-implement/SKILL.md +1 -1
- package/assets/skills/oat-project-implement/references/completion-and-closeout.md +38 -6
- package/assets/skills/oat-project-implement/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-lite/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-next/SKILL.md +62 -19
- package/assets/skills/oat-project-plan/SKILL.md +31 -5
- package/assets/skills/oat-project-pr-final/SKILL.md +281 -6
- package/assets/skills/oat-project-pr-final/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-progress/SKILL.md +12 -3
- package/assets/skills/oat-project-quick-start/SKILL.md +264 -4
- package/assets/skills/oat-project-quick-start/references/docs/autonomy-contract.md +122 -121
- package/assets/skills/oat-project-summary/SKILL.md +34 -23
- package/assets/skills/oat-repo-improve/SKILL.md +40 -5
- package/assets/skills/oat-repo-improve/references/plan-template.md +84 -7
- package/dist/agents/canonical/resolve.d.ts.map +1 -1
- package/dist/agents/canonical/resolve.js +25 -4
- 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 +401 -18
- package/dist/commands/doctor/index.d.ts +7 -0
- package/dist/commands/doctor/index.d.ts.map +1 -1
- package/dist/commands/doctor/index.js +10 -2
- package/dist/commands/gate/index.d.ts +3 -1
- package/dist/commands/gate/index.d.ts.map +1 -1
- package/dist/commands/gate/index.js +699 -211
- package/dist/commands/init/tools/index.d.ts.map +1 -1
- package/dist/commands/init/tools/index.js +68 -36
- package/dist/commands/init/tools/shared/skill-script-references.d.ts +126 -0
- package/dist/commands/init/tools/shared/skill-script-references.d.ts.map +1 -0
- package/dist/commands/init/tools/shared/skill-script-references.js +311 -0
- package/dist/commands/instructions/instructions.types.d.ts +63 -0
- package/dist/commands/instructions/instructions.types.d.ts.map +1 -1
- package/dist/commands/instructions/instructions.utils.d.ts +51 -2
- package/dist/commands/instructions/instructions.utils.d.ts.map +1 -1
- package/dist/commands/instructions/instructions.utils.js +201 -4
- package/dist/commands/instructions/sync/sync.d.ts.map +1 -1
- package/dist/commands/instructions/sync/sync.js +12 -1
- package/dist/commands/instructions/validate/validate.d.ts.map +1 -1
- package/dist/commands/instructions/validate/validate.js +12 -1
- package/dist/commands/project/log/append.d.ts +195 -0
- package/dist/commands/project/log/append.d.ts.map +1 -1
- package/dist/commands/project/log/append.js +1034 -11
- package/dist/commands/shared/frontmatter.d.ts +51 -0
- package/dist/commands/shared/frontmatter.d.ts.map +1 -1
- package/dist/commands/shared/frontmatter.js +118 -6
- package/dist/commands/status/index.d.ts.map +1 -1
- package/dist/commands/status/index.js +5 -3
- package/dist/commands/sync/index.d.ts +14 -0
- package/dist/commands/sync/index.d.ts.map +1 -1
- package/dist/commands/sync/index.js +21 -0
- package/dist/commands/tools/info/index.d.ts.map +1 -1
- package/dist/commands/tools/info/index.js +14 -1
- package/dist/commands/tools/info/info-tool.d.ts +12 -0
- package/dist/commands/tools/info/info-tool.d.ts.map +1 -1
- package/dist/commands/tools/info/info-tool.js +54 -6
- package/dist/commands/tools/info/skill-views.d.ts +86 -0
- package/dist/commands/tools/info/skill-views.d.ts.map +1 -0
- package/dist/commands/tools/info/skill-views.js +383 -0
- package/dist/commands/tools/install/index.d.ts.map +1 -1
- package/dist/commands/tools/install/index.js +3 -25
- package/dist/commands/tools/list/list-tools.d.ts +2 -0
- package/dist/commands/tools/list/list-tools.d.ts.map +1 -1
- package/dist/commands/tools/list/list-tools.js +23 -4
- package/dist/commands/tools/remove/index.d.ts.map +1 -1
- package/dist/commands/tools/remove/index.js +35 -42
- package/dist/commands/tools/remove/remove-tools.d.ts +3 -2
- package/dist/commands/tools/remove/remove-tools.d.ts.map +1 -1
- package/dist/commands/tools/remove/remove-tools.js +14 -4
- package/dist/commands/tools/shared/auto-sync.d.ts +12 -1
- package/dist/commands/tools/shared/auto-sync.d.ts.map +1 -1
- package/dist/commands/tools/shared/auto-sync.js +20 -4
- package/dist/commands/tools/shared/format-pack-inventory.d.ts +12 -1
- package/dist/commands/tools/shared/format-pack-inventory.d.ts.map +1 -1
- package/dist/commands/tools/shared/format-pack-inventory.js +48 -6
- package/dist/commands/tools/shared/in-process-sync.d.ts +11 -0
- package/dist/commands/tools/shared/in-process-sync.d.ts.map +1 -0
- package/dist/commands/tools/shared/in-process-sync.js +79 -0
- package/dist/commands/tools/shared/pack-evidence.d.ts +78 -2
- package/dist/commands/tools/shared/pack-evidence.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-evidence.js +96 -2
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts +11 -0
- package/dist/commands/tools/shared/pack-lifecycle-outcome.d.ts.map +1 -1
- package/dist/commands/tools/shared/pack-lifecycle-outcome.js +24 -3
- package/dist/commands/tools/shared/pack-provider-evidence.d.ts +73 -0
- package/dist/commands/tools/shared/pack-provider-evidence.d.ts.map +1 -0
- package/dist/commands/tools/shared/pack-provider-evidence.js +161 -0
- package/dist/commands/tools/shared/provider-context.d.ts +88 -0
- package/dist/commands/tools/shared/provider-context.d.ts.map +1 -0
- package/dist/commands/tools/shared/provider-context.js +77 -0
- package/dist/commands/tools/shared/provider-reachability.d.ts +93 -0
- package/dist/commands/tools/shared/provider-reachability.d.ts.map +1 -0
- package/dist/commands/tools/shared/provider-reachability.js +358 -0
- package/dist/commands/tools/shared/sync-evidence.d.ts +57 -0
- package/dist/commands/tools/shared/sync-evidence.d.ts.map +1 -0
- package/dist/commands/tools/shared/sync-evidence.js +147 -0
- package/dist/commands/tools/update/index.d.ts +0 -4
- package/dist/commands/tools/update/index.d.ts.map +1 -1
- package/dist/commands/tools/update/index.js +22 -40
- package/dist/commands/tools/update/update-tools.d.ts.map +1 -1
- package/dist/commands/tools/update/update-tools.js +23 -8
- package/dist/config/json.d.ts +36 -0
- package/dist/config/json.d.ts.map +1 -1
- package/dist/config/json.js +135 -3
- package/dist/config/oat-config.d.ts +41 -0
- package/dist/config/oat-config.d.ts.map +1 -1
- package/dist/config/oat-config.js +111 -0
- package/dist/drift/index.d.ts +2 -0
- package/dist/drift/index.d.ts.map +1 -1
- package/dist/drift/index.js +1 -0
- package/dist/drift/skill-view-diagnostic.d.ts +197 -0
- package/dist/drift/skill-view-diagnostic.d.ts.map +1 -0
- package/dist/drift/skill-view-diagnostic.js +343 -0
- package/dist/validation/skills.d.ts +1 -0
- package/dist/validation/skills.d.ts.map +1 -1
- package/dist/validation/skills.js +181 -19
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"update-tools.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/update/update-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAM3E,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,
|
|
1
|
+
{"version":3,"file":"update-tools.d.ts","sourceRoot":"","sources":["../../../../src/commands/tools/update/update-tools.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,+BAA+B,EAAE,MAAM,8BAA8B,CAAC;AACpF,OAAO,KAAK,EAAE,kBAAkB,EAAE,MAAM,0BAA0B,CAAC;AACnE,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,0CAA0C,CAAC;AAM3E,OAAO,KAAK,EACV,wBAAwB,EACxB,mBAAmB,EACpB,MAAM,uCAAuC,CAAC;AAE/C,OAAO,EACL,KAAK,oBAAoB,EACzB,KAAK,mBAAmB,EACzB,MAAM,uCAAuC,CAAC;AAC/C,OAAO,EAIL,KAAK,oBAAoB,EAC1B,MAAM,+CAA+C,CAAC;AAMvD,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,uCAAuC,CAAC;AAE/E,OAAO,KAAK,EAAE,gBAAgB,EA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AAE,SAAS,aAAa,EAAE,EAChC,KAAK,EAAE,OAAO,GACb,oBAAoB,EAAE,CAsBxB"}
|
|
@@ -2,8 +2,10 @@ import { join } from 'node:path';
|
|
|
2
2
|
import { hasScopedPackRealizationEvidence, packScopeFactsFromInventory, projectPackEvidence, } from '../../tools/shared/pack-evidence.js';
|
|
3
3
|
import { inventoryScopedPack } from '../../tools/shared/pack-inventory.js';
|
|
4
4
|
import {} from '../../tools/shared/pack-lifecycle.js';
|
|
5
|
-
import { evaluatePackLifecycleOutcome, resolveAdditivePackScopeSelection, } from '../../tools/shared/pack-lifecycle-outcome.js';
|
|
5
|
+
import { evaluatePackLifecycleOutcome, notRunProviderSyncOutcome, resolveAdditivePackScopeSelection, } from '../../tools/shared/pack-lifecycle-outcome.js';
|
|
6
6
|
import { getPackDefinition } from '../../tools/shared/pack-manifest.js';
|
|
7
|
+
import { lifecycleProviderEvidence, withLifecycleProviderEvidence, } from '../../tools/shared/pack-provider-evidence.js';
|
|
8
|
+
import { resolveProviderScopeContexts } from '../../tools/shared/provider-context.js';
|
|
7
9
|
function getBundledPackAssets(pack, scope) {
|
|
8
10
|
const assets = getPackDefinition(pack).assets.filter(({ scopes, ownership }) => scopes.includes(scope) && ownership[scope] === 'managed');
|
|
9
11
|
return {
|
|
@@ -71,7 +73,7 @@ export async function updateTools(target, scopes, cwd, home, dryRun, dependencie
|
|
|
71
73
|
return result;
|
|
72
74
|
}
|
|
73
75
|
const lifecycle = await dependencies.reconcilePacks(requests, { dryRun });
|
|
74
|
-
result.lifecycle = updateLifecycleOutcomes(lifecycle);
|
|
76
|
+
result.lifecycle = await updateLifecycleOutcomes(lifecycle);
|
|
75
77
|
result.plans.push(...lifecycle.map(({ plan }) => plan));
|
|
76
78
|
for (const entry of lifecycle) {
|
|
77
79
|
const definition = getPackDefinition(entry.request.pack);
|
|
@@ -252,9 +254,14 @@ export async function updateTools(target, scopes, cwd, home, dryRun, dependencie
|
|
|
252
254
|
}
|
|
253
255
|
return result;
|
|
254
256
|
}
|
|
255
|
-
function updateLifecycleOutcomes(results) {
|
|
257
|
+
async function updateLifecycleOutcomes(results) {
|
|
256
258
|
const verifiable = results.filter(({ apply }) => apply === null || ('inventory' in apply && apply.inventory !== undefined));
|
|
257
259
|
const packs = [...new Set(verifiable.map(({ request }) => request.pack))];
|
|
260
|
+
// Every request carries the scope root it acted on, so the config-aware
|
|
261
|
+
// provider context is resolvable without re-deriving paths here.
|
|
262
|
+
const providerContexts = await resolveProviderScopeContexts({
|
|
263
|
+
scopeRoots: Object.fromEntries(verifiable.map(({ request }) => [request.scope, request.scopeRoot])),
|
|
264
|
+
});
|
|
258
265
|
return packs.map((pack) => {
|
|
259
266
|
const lifecycle = verifiable.filter(({ request }) => request.pack === pack);
|
|
260
267
|
const requestedScopes = lifecycle.map(({ request }) => request.scope);
|
|
@@ -273,13 +280,21 @@ function updateLifecycleOutcomes(results) {
|
|
|
273
280
|
.map(({ request }) => request.scope),
|
|
274
281
|
unknownScopes: [],
|
|
275
282
|
});
|
|
283
|
+
const providers = lifecycleProviderEvidence({
|
|
284
|
+
pack,
|
|
285
|
+
scopedInventories: finalScopes,
|
|
286
|
+
providerContexts,
|
|
287
|
+
scopes: selection.targetScopes,
|
|
288
|
+
});
|
|
289
|
+
const sync = notRunProviderSyncOutcome(providers, 'Auto-sync has not run for this operation');
|
|
290
|
+
const providerEvidence = withLifecycleProviderEvidence(finalEvidence, providers);
|
|
276
291
|
if (lifecycle.every(({ apply }) => apply === null)) {
|
|
277
292
|
return {
|
|
278
293
|
schemaVersion: 1,
|
|
279
294
|
selection,
|
|
280
295
|
canonical: { status: 'unchanged', results: lifecycle },
|
|
281
|
-
sync
|
|
282
|
-
finalEvidence,
|
|
296
|
+
sync,
|
|
297
|
+
finalEvidence: providerEvidence,
|
|
283
298
|
status: 'complete',
|
|
284
299
|
recovery: [],
|
|
285
300
|
};
|
|
@@ -287,8 +302,8 @@ function updateLifecycleOutcomes(results) {
|
|
|
287
302
|
return evaluatePackLifecycleOutcome({
|
|
288
303
|
selection,
|
|
289
304
|
lifecycle,
|
|
290
|
-
sync
|
|
291
|
-
finalEvidence,
|
|
305
|
+
sync,
|
|
306
|
+
finalEvidence: providerEvidence,
|
|
292
307
|
});
|
|
293
308
|
});
|
|
294
309
|
}
|
|
@@ -305,7 +320,7 @@ export function failedUpdateLifecycleOutcomes(target, scopes, error) {
|
|
|
305
320
|
targetScopes: scopes,
|
|
306
321
|
},
|
|
307
322
|
canonical: { status: 'failed', results: [] },
|
|
308
|
-
sync:
|
|
323
|
+
sync: notRunProviderSyncOutcome([], 'Canonical apply failed before auto-sync'),
|
|
309
324
|
finalEvidence: null,
|
|
310
325
|
status: 'failed',
|
|
311
326
|
recovery: [{ code: 'canonical-apply-failed', message }],
|
package/dist/config/json.d.ts
CHANGED
|
@@ -1,2 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Parse one OAT config document.
|
|
3
|
+
*
|
|
4
|
+
* This is the single parse chokepoint for every OAT config read, so the
|
|
5
|
+
* prototype question is decided here rather than in each consumer.
|
|
6
|
+
*
|
|
7
|
+
* `jsonc-parser`'s `parse` fills a plain object by assignment, and assignment
|
|
8
|
+
* to a member literally named `__proto__` reaches the legacy prototype setter.
|
|
9
|
+
* That loses the key as data *and* installs its value as the parsed object's
|
|
10
|
+
* prototype, after which normalization reads the injected members as though
|
|
11
|
+
* they had been configured: a config file holding only
|
|
12
|
+
* `{"__proto__":{"git":{"defaultBranch":"x"}}}` made `oat config get
|
|
13
|
+
* git.defaultBranch` answer `x`. So the tree API is used instead, and the tree
|
|
14
|
+
* is materialized here rather than by `getNodeValue`.
|
|
15
|
+
*
|
|
16
|
+
* Materialization defines every own key with `Object.defineProperty`, which
|
|
17
|
+
* stores `__proto__` as an ordinary own data property without ever invoking
|
|
18
|
+
* the prototype setter. The objects it builds are otherwise completely
|
|
19
|
+
* ordinary: they keep `Object.prototype`, so every consumer coercion — most
|
|
20
|
+
* importantly `String(value)` in the `projects.defaultScope` diagnostic at
|
|
21
|
+
* `config/oat-config.ts` — behaves byte-identically to the previous
|
|
22
|
+
* implementation, and the result round-trips through `JSON.stringify`
|
|
23
|
+
* unchanged. `getNodeValue` is deliberately not used: it returns
|
|
24
|
+
* null-prototype objects, which break those coercions, and it recurses, which
|
|
25
|
+
* roughly halved the accepted nesting depth and turned deep-but-valid
|
|
26
|
+
* documents into a `RangeError` instead of the contracted `SyntaxError`. The
|
|
27
|
+
* walk below uses an explicit stack for that reason, which restores parity
|
|
28
|
+
* with the previous implementation. Parity, not a guarantee: `parseTree` still
|
|
29
|
+
* recurses while scanning, so the hard limit is a stack depth that moves with
|
|
30
|
+
* the host and the JIT rather than a fixed number.
|
|
31
|
+
*
|
|
32
|
+
* The error contract is untouched: `parseTree` reports the same `ParseError`
|
|
33
|
+
* codes at the same offsets as `parse` for every input, so the set of
|
|
34
|
+
* documents that are rejected and the `SyntaxError` message are both
|
|
35
|
+
* byte-identical to the previous implementation.
|
|
36
|
+
*/
|
|
1
37
|
export declare function parseJsonConfig(raw: string, configPath: string): unknown;
|
|
2
38
|
//# sourceMappingURL=json.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/config/json.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json.d.ts","sourceRoot":"","sources":["../../src/config/json.ts"],"names":[],"mappings":"AAaA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAmCG;AACH,wBAAgB,eAAe,CAAC,GAAG,EAAE,MAAM,EAAE,UAAU,EAAE,MAAM,GAAG,OAAO,CAuBxE"}
|
package/dist/config/json.js
CHANGED
|
@@ -1,18 +1,150 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { parseTree, printParseErrorCode, } from 'jsonc-parser';
|
|
2
2
|
const JSON_CONFIG_PARSE_OPTIONS = {
|
|
3
3
|
allowTrailingComma: true,
|
|
4
4
|
disallowComments: true,
|
|
5
5
|
};
|
|
6
|
+
/**
|
|
7
|
+
* Parse one OAT config document.
|
|
8
|
+
*
|
|
9
|
+
* This is the single parse chokepoint for every OAT config read, so the
|
|
10
|
+
* prototype question is decided here rather than in each consumer.
|
|
11
|
+
*
|
|
12
|
+
* `jsonc-parser`'s `parse` fills a plain object by assignment, and assignment
|
|
13
|
+
* to a member literally named `__proto__` reaches the legacy prototype setter.
|
|
14
|
+
* That loses the key as data *and* installs its value as the parsed object's
|
|
15
|
+
* prototype, after which normalization reads the injected members as though
|
|
16
|
+
* they had been configured: a config file holding only
|
|
17
|
+
* `{"__proto__":{"git":{"defaultBranch":"x"}}}` made `oat config get
|
|
18
|
+
* git.defaultBranch` answer `x`. So the tree API is used instead, and the tree
|
|
19
|
+
* is materialized here rather than by `getNodeValue`.
|
|
20
|
+
*
|
|
21
|
+
* Materialization defines every own key with `Object.defineProperty`, which
|
|
22
|
+
* stores `__proto__` as an ordinary own data property without ever invoking
|
|
23
|
+
* the prototype setter. The objects it builds are otherwise completely
|
|
24
|
+
* ordinary: they keep `Object.prototype`, so every consumer coercion — most
|
|
25
|
+
* importantly `String(value)` in the `projects.defaultScope` diagnostic at
|
|
26
|
+
* `config/oat-config.ts` — behaves byte-identically to the previous
|
|
27
|
+
* implementation, and the result round-trips through `JSON.stringify`
|
|
28
|
+
* unchanged. `getNodeValue` is deliberately not used: it returns
|
|
29
|
+
* null-prototype objects, which break those coercions, and it recurses, which
|
|
30
|
+
* roughly halved the accepted nesting depth and turned deep-but-valid
|
|
31
|
+
* documents into a `RangeError` instead of the contracted `SyntaxError`. The
|
|
32
|
+
* walk below uses an explicit stack for that reason, which restores parity
|
|
33
|
+
* with the previous implementation. Parity, not a guarantee: `parseTree` still
|
|
34
|
+
* recurses while scanning, so the hard limit is a stack depth that moves with
|
|
35
|
+
* the host and the JIT rather than a fixed number.
|
|
36
|
+
*
|
|
37
|
+
* The error contract is untouched: `parseTree` reports the same `ParseError`
|
|
38
|
+
* codes at the same offsets as `parse` for every input, so the set of
|
|
39
|
+
* documents that are rejected and the `SyntaxError` message are both
|
|
40
|
+
* byte-identical to the previous implementation.
|
|
41
|
+
*/
|
|
6
42
|
export function parseJsonConfig(raw, configPath) {
|
|
7
43
|
const errors = [];
|
|
8
|
-
const
|
|
44
|
+
const root = parseTree(raw, errors, JSON_CONFIG_PARSE_OPTIONS);
|
|
9
45
|
if (errors.length > 0) {
|
|
10
46
|
const details = errors
|
|
11
47
|
.map((error) => formatParseError(raw, error))
|
|
12
48
|
.join('; ');
|
|
13
49
|
throw new SyntaxError(`Config at ${configPath} is not valid JSON: ${details}`);
|
|
14
50
|
}
|
|
15
|
-
|
|
51
|
+
// TypeScript narrowing after the rejection above: `parseTree` returns no root
|
|
52
|
+
// for any document that holds no value — empty or whitespace-only content,
|
|
53
|
+
// but also a stray `]` or comment-only content — and every one of those
|
|
54
|
+
// records a parse error and has already thrown. The branch keeps the walk
|
|
55
|
+
// total rather than describing a reachable case.
|
|
56
|
+
if (root === undefined) {
|
|
57
|
+
return undefined;
|
|
58
|
+
}
|
|
59
|
+
return materializeTree(root);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Assignment that cannot be intercepted by an accessor on the prototype chain.
|
|
63
|
+
*
|
|
64
|
+
* `target[key] = value` would invoke the legacy `__proto__` setter; a data
|
|
65
|
+
* descriptor never does. The descriptor matches what a plain assignment would
|
|
66
|
+
* otherwise produce, so the property is indistinguishable from an ordinary
|
|
67
|
+
* one, and re-defining a repeated key overwrites in place exactly as
|
|
68
|
+
* assignment did.
|
|
69
|
+
*/
|
|
70
|
+
function defineOwnProperty(target, key, value) {
|
|
71
|
+
Object.defineProperty(target, key, {
|
|
72
|
+
value,
|
|
73
|
+
enumerable: true,
|
|
74
|
+
writable: true,
|
|
75
|
+
configurable: true,
|
|
76
|
+
});
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Convert a parse tree into plain JavaScript values without recursion.
|
|
80
|
+
*
|
|
81
|
+
* Each frame carries the callback that attaches its finished value to the
|
|
82
|
+
* parent container, so containers are created on the way down and filled as
|
|
83
|
+
* their children pop. Nesting depth costs a heap array entry rather than a
|
|
84
|
+
* call frame, which is what keeps a deeply nested config from overflowing the
|
|
85
|
+
* stack.
|
|
86
|
+
*/
|
|
87
|
+
function materializeTree(root) {
|
|
88
|
+
let result;
|
|
89
|
+
const stack = [
|
|
90
|
+
{
|
|
91
|
+
node: root,
|
|
92
|
+
attach: (value) => {
|
|
93
|
+
result = value;
|
|
94
|
+
},
|
|
95
|
+
},
|
|
96
|
+
];
|
|
97
|
+
while (stack.length > 0) {
|
|
98
|
+
const frame = stack.pop();
|
|
99
|
+
if (frame === undefined) {
|
|
100
|
+
break;
|
|
101
|
+
}
|
|
102
|
+
const { node } = frame;
|
|
103
|
+
if (node.type === 'array') {
|
|
104
|
+
const children = node.children ?? [];
|
|
105
|
+
const array = new Array(children.length);
|
|
106
|
+
frame.attach(array);
|
|
107
|
+
// Pushed in reverse so children pop in source order.
|
|
108
|
+
for (let index = children.length - 1; index >= 0; index -= 1) {
|
|
109
|
+
const child = children[index];
|
|
110
|
+
if (child === undefined) {
|
|
111
|
+
continue;
|
|
112
|
+
}
|
|
113
|
+
stack.push({
|
|
114
|
+
node: child,
|
|
115
|
+
attach: (value) => {
|
|
116
|
+
array[index] = value;
|
|
117
|
+
},
|
|
118
|
+
});
|
|
119
|
+
}
|
|
120
|
+
continue;
|
|
121
|
+
}
|
|
122
|
+
if (node.type === 'object') {
|
|
123
|
+
const object = {};
|
|
124
|
+
frame.attach(object);
|
|
125
|
+
const properties = node.children ?? [];
|
|
126
|
+
for (let index = properties.length - 1; index >= 0; index -= 1) {
|
|
127
|
+
const property = properties[index];
|
|
128
|
+
const keyNode = property?.children?.[0];
|
|
129
|
+
const valueNode = property?.children?.[1];
|
|
130
|
+
// A property with no value node is an incomplete document, which the
|
|
131
|
+
// error check has already rejected; skipping it matches `getNodeValue`.
|
|
132
|
+
if (keyNode === undefined || valueNode === undefined) {
|
|
133
|
+
continue;
|
|
134
|
+
}
|
|
135
|
+
const key = String(keyNode.value);
|
|
136
|
+
stack.push({
|
|
137
|
+
node: valueNode,
|
|
138
|
+
attach: (value) => {
|
|
139
|
+
defineOwnProperty(object, key, value);
|
|
140
|
+
},
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
continue;
|
|
144
|
+
}
|
|
145
|
+
frame.attach(node.value);
|
|
146
|
+
}
|
|
147
|
+
return result;
|
|
16
148
|
}
|
|
17
149
|
function formatParseError(raw, error) {
|
|
18
150
|
const location = offsetToLineColumn(raw, error.offset);
|
|
@@ -12,6 +12,13 @@ export interface OatDocumentationConfig {
|
|
|
12
12
|
* and order-preserving.
|
|
13
13
|
*/
|
|
14
14
|
excludes?: string[];
|
|
15
|
+
/**
|
|
16
|
+
* Repo-relative directories `oat instructions sync` and
|
|
17
|
+
* `oat instructions validate` must not treat as pointer sites, additive to
|
|
18
|
+
* the derived documentation content root they skip by default. Trimmed,
|
|
19
|
+
* de-duplicated, and order-preserving.
|
|
20
|
+
*/
|
|
21
|
+
instructionPointerExcludes?: string[];
|
|
15
22
|
}
|
|
16
23
|
export interface OatGitConfig {
|
|
17
24
|
defaultBranch?: string;
|
|
@@ -209,6 +216,30 @@ export declare function normalizeProjectPath(repoRoot: string, pathValue: string
|
|
|
209
216
|
export declare function resolveLocalPaths(config: OatConfig): string[];
|
|
210
217
|
export declare function readOatConfig(repoRoot: string): Promise<OatConfig>;
|
|
211
218
|
export declare function readOatConfigForDefaultScopeRepair(repoRoot: string): Promise<OatConfig>;
|
|
219
|
+
/**
|
|
220
|
+
* The documentation *content* root: `<documentation.root>/docs` when that path
|
|
221
|
+
* is a directory, otherwise `documentation.root` itself.
|
|
222
|
+
*
|
|
223
|
+
* `documentation.root` canonically names the docs **app root** written by
|
|
224
|
+
* `oat docs init`; the `<root>/docs` preference is compatibility behavior for
|
|
225
|
+
* legacy configs whose `root` names a docs source directory. This is the same
|
|
226
|
+
* rule `oat docs generate-index` applies when `--docs-dir` is omitted
|
|
227
|
+
* (`resolveIndexGeneratePaths` in `commands/docs/index-generate/index.ts`),
|
|
228
|
+
* stated here so the index generator, `oat instructions sync`, and
|
|
229
|
+
* `oat instructions validate` cannot drift into two different meanings of
|
|
230
|
+
* "the docs tree"; `oat-config.test.ts` asserts the two agree on shared
|
|
231
|
+
* fixtures.
|
|
232
|
+
*
|
|
233
|
+
* The app root is deliberately not the answer when a `docs` child exists:
|
|
234
|
+
* `apps/oat-docs/AGENTS.md` is an instruction file, not a documentation page,
|
|
235
|
+
* and must keep receiving pointers.
|
|
236
|
+
*
|
|
237
|
+
* Returns a repo-relative POSIX path, or null when `documentation.root` is
|
|
238
|
+
* unset, empty, resolves to the repository root, or escapes the repository.
|
|
239
|
+
*/
|
|
240
|
+
export declare function resolveDocumentationContentRoot(repoRoot: string, config: OatConfig, dependencies?: {
|
|
241
|
+
dirExists?: (path: string) => Promise<boolean>;
|
|
242
|
+
}): Promise<string | null>;
|
|
212
243
|
/**
|
|
213
244
|
* Read shared config with an unusable `documentation.excludes` dropped, so
|
|
214
245
|
* `oat config set documentation.excludes ...` can perform the repair its own
|
|
@@ -217,6 +248,16 @@ export declare function readOatConfigForDefaultScopeRepair(repoRoot: string): Pr
|
|
|
217
248
|
* itself blocked by the invalid value.
|
|
218
249
|
*/
|
|
219
250
|
export declare function readOatConfigForDocumentationExcludesRepair(repoRoot: string): Promise<OatConfig>;
|
|
251
|
+
/**
|
|
252
|
+
* Read the shared config with a malformed
|
|
253
|
+
* `documentation.instructionPointerExcludes` dropped.
|
|
254
|
+
*
|
|
255
|
+
* The sibling of `readOatConfigForDocumentationExcludesRepair`, and it exists
|
|
256
|
+
* for the same reason: this key's own validation error now names
|
|
257
|
+
* `oat config set` as the repair, and a strict read would refuse to load the
|
|
258
|
+
* very value the operator is trying to replace or remove.
|
|
259
|
+
*/
|
|
260
|
+
export declare function readOatConfigForInstructionPointerExcludesRepair(repoRoot: string): Promise<OatConfig>;
|
|
220
261
|
export declare function readOatLocalConfig(repoRoot: string): Promise<OatLocalConfig>;
|
|
221
262
|
export declare function writeOatConfig(repoRoot: string, config: OatConfig): Promise<void>;
|
|
222
263
|
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;IACtC;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,EAAE,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,+BAA+B,EAC/B,iCAAiC,EACjC,2BAA2B,EAC3B,KAAK,6BAA6B,EAClC,KAAK,yBAAyB,EAC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rE;AAED,wBAAgB,mBAAmB,CAAC,QAAQ,EAAE,MAAM,GAAG,MAAM,CA6B5D"}
|
|
@@ -658,6 +658,44 @@ function normalizeDocumentationExcludes(value, configPath) {
|
|
|
658
658
|
}
|
|
659
659
|
return normalized;
|
|
660
660
|
}
|
|
661
|
+
/**
|
|
662
|
+
* Parse `documentation.instructionPointerExcludes` into a trimmed,
|
|
663
|
+
* de-duplicated, order-preserving list.
|
|
664
|
+
*
|
|
665
|
+
* Fails closed, exactly like its `documentation.excludes` sibling above and for
|
|
666
|
+
* the same reason: a key whose whole job is to keep files out of a tree must
|
|
667
|
+
* never silently protect less than the operator asked for. An absent key and an
|
|
668
|
+
* empty array are both "no extra exclusions"; a present-but-malformed value is
|
|
669
|
+
* an error.
|
|
670
|
+
*
|
|
671
|
+
* The repair instruction names `oat config set` first and the file second: the
|
|
672
|
+
* command is catalogued (`oat config set documentation.instructionPointerExcludes`),
|
|
673
|
+
* and an operator repairing a malformed value should reach for the validated
|
|
674
|
+
* write path before hand-editing JSON.
|
|
675
|
+
*/
|
|
676
|
+
function normalizeInstructionPointerExcludes(value, configPath) {
|
|
677
|
+
if (value === undefined) {
|
|
678
|
+
return [];
|
|
679
|
+
}
|
|
680
|
+
const invalid = () => {
|
|
681
|
+
throw new CliError(`Invalid documentation.instructionPointerExcludes in ${configPath}: expected an array of non-empty strings. ` +
|
|
682
|
+
'Repair it with `oat config set documentation.instructionPointerExcludes <path[,path...]>` (an empty value clears the key), or by editing that file.', 2);
|
|
683
|
+
};
|
|
684
|
+
if (!Array.isArray(value)) {
|
|
685
|
+
invalid();
|
|
686
|
+
}
|
|
687
|
+
const normalized = [];
|
|
688
|
+
for (const entry of value) {
|
|
689
|
+
if (typeof entry !== 'string' || !entry.trim()) {
|
|
690
|
+
invalid();
|
|
691
|
+
}
|
|
692
|
+
const trimmedEntry = entry.trim();
|
|
693
|
+
if (!normalized.includes(trimmedEntry)) {
|
|
694
|
+
normalized.push(trimmedEntry);
|
|
695
|
+
}
|
|
696
|
+
}
|
|
697
|
+
return normalized;
|
|
698
|
+
}
|
|
661
699
|
function normalizeOatConfig(parsed, configPath = '.oat/config.json') {
|
|
662
700
|
const next = { ...DEFAULT_OAT_CONFIG };
|
|
663
701
|
if (!isRecord(parsed)) {
|
|
@@ -777,6 +815,10 @@ function normalizeOatConfig(parsed, configPath = '.oat/config.json') {
|
|
|
777
815
|
if (excludes.length > 0) {
|
|
778
816
|
doc.excludes = excludes;
|
|
779
817
|
}
|
|
818
|
+
const instructionPointerExcludes = normalizeInstructionPointerExcludes(parsed.documentation.instructionPointerExcludes, configPath);
|
|
819
|
+
if (instructionPointerExcludes.length > 0) {
|
|
820
|
+
doc.instructionPointerExcludes = instructionPointerExcludes;
|
|
821
|
+
}
|
|
780
822
|
if (Object.keys(doc).length > 0) {
|
|
781
823
|
next.documentation = doc;
|
|
782
824
|
}
|
|
@@ -864,6 +906,48 @@ export async function readOatConfigForDefaultScopeRepair(repoRoot) {
|
|
|
864
906
|
throw error;
|
|
865
907
|
}
|
|
866
908
|
}
|
|
909
|
+
/**
|
|
910
|
+
* The documentation *content* root: `<documentation.root>/docs` when that path
|
|
911
|
+
* is a directory, otherwise `documentation.root` itself.
|
|
912
|
+
*
|
|
913
|
+
* `documentation.root` canonically names the docs **app root** written by
|
|
914
|
+
* `oat docs init`; the `<root>/docs` preference is compatibility behavior for
|
|
915
|
+
* legacy configs whose `root` names a docs source directory. This is the same
|
|
916
|
+
* rule `oat docs generate-index` applies when `--docs-dir` is omitted
|
|
917
|
+
* (`resolveIndexGeneratePaths` in `commands/docs/index-generate/index.ts`),
|
|
918
|
+
* stated here so the index generator, `oat instructions sync`, and
|
|
919
|
+
* `oat instructions validate` cannot drift into two different meanings of
|
|
920
|
+
* "the docs tree"; `oat-config.test.ts` asserts the two agree on shared
|
|
921
|
+
* fixtures.
|
|
922
|
+
*
|
|
923
|
+
* The app root is deliberately not the answer when a `docs` child exists:
|
|
924
|
+
* `apps/oat-docs/AGENTS.md` is an instruction file, not a documentation page,
|
|
925
|
+
* and must keep receiving pointers.
|
|
926
|
+
*
|
|
927
|
+
* Returns a repo-relative POSIX path, or null when `documentation.root` is
|
|
928
|
+
* unset, empty, resolves to the repository root, or escapes the repository.
|
|
929
|
+
*/
|
|
930
|
+
export async function resolveDocumentationContentRoot(repoRoot, config, dependencies = {}) {
|
|
931
|
+
const configuredRoot = config.documentation?.root?.trim();
|
|
932
|
+
if (!configuredRoot) {
|
|
933
|
+
return null;
|
|
934
|
+
}
|
|
935
|
+
const absoluteRoot = resolve(repoRoot, configuredRoot);
|
|
936
|
+
const docsChild = join(absoluteRoot, 'docs');
|
|
937
|
+
// Callers that simulate a filesystem (the instruction-sync tests inject
|
|
938
|
+
// `stat`) pass their own directory probe so the `<root>/docs` rule sees the
|
|
939
|
+
// same filesystem the rest of the scan does; the default is the real one.
|
|
940
|
+
const probe = dependencies.dirExists ?? dirExists;
|
|
941
|
+
const contentRoot = (await probe(docsChild)) ? docsChild : absoluteRoot;
|
|
942
|
+
const relativeContentRoot = normalizeToPosixPath(relative(repoRoot, contentRoot));
|
|
943
|
+
if (!relativeContentRoot ||
|
|
944
|
+
relativeContentRoot === '.' ||
|
|
945
|
+
relativeContentRoot === '..' ||
|
|
946
|
+
relativeContentRoot.startsWith('../')) {
|
|
947
|
+
return null;
|
|
948
|
+
}
|
|
949
|
+
return relativeContentRoot;
|
|
950
|
+
}
|
|
867
951
|
/**
|
|
868
952
|
* Read shared config with an unusable `documentation.excludes` dropped, so
|
|
869
953
|
* `oat config set documentation.excludes ...` can perform the repair its own
|
|
@@ -889,6 +973,33 @@ export async function readOatConfigForDocumentationExcludesRepair(repoRoot) {
|
|
|
889
973
|
throw error;
|
|
890
974
|
}
|
|
891
975
|
}
|
|
976
|
+
/**
|
|
977
|
+
* Read the shared config with a malformed
|
|
978
|
+
* `documentation.instructionPointerExcludes` dropped.
|
|
979
|
+
*
|
|
980
|
+
* The sibling of `readOatConfigForDocumentationExcludesRepair`, and it exists
|
|
981
|
+
* for the same reason: this key's own validation error now names
|
|
982
|
+
* `oat config set` as the repair, and a strict read would refuse to load the
|
|
983
|
+
* very value the operator is trying to replace or remove.
|
|
984
|
+
*/
|
|
985
|
+
export async function readOatConfigForInstructionPointerExcludesRepair(repoRoot) {
|
|
986
|
+
const configPath = getConfigPath(repoRoot);
|
|
987
|
+
try {
|
|
988
|
+
const raw = await readFile(configPath, 'utf8');
|
|
989
|
+
const parsed = parseJsonConfig(raw, configPath);
|
|
990
|
+
if (isRecord(parsed) && isRecord(parsed.documentation)) {
|
|
991
|
+
const { instructionPointerExcludes: _invalidInstructionPointerExcludes, ...documentation } = parsed.documentation;
|
|
992
|
+
return normalizeOatConfig({ ...parsed, documentation }, configPath);
|
|
993
|
+
}
|
|
994
|
+
return normalizeOatConfig(parsed, configPath);
|
|
995
|
+
}
|
|
996
|
+
catch (error) {
|
|
997
|
+
if (isMissingFileError(error)) {
|
|
998
|
+
return { ...DEFAULT_OAT_CONFIG };
|
|
999
|
+
}
|
|
1000
|
+
throw error;
|
|
1001
|
+
}
|
|
1002
|
+
}
|
|
892
1003
|
export async function readOatLocalConfig(repoRoot) {
|
|
893
1004
|
const configPath = getLocalConfigPath(repoRoot);
|
|
894
1005
|
try {
|
package/dist/drift/index.d.ts
CHANGED
|
@@ -3,5 +3,7 @@ export type { CopyTransform } from './detector.js';
|
|
|
3
3
|
export type { DriftReport, DriftState } from './drift.types.js';
|
|
4
4
|
export { filterKnownStrays } from './known-strays.js';
|
|
5
5
|
export type { FilterKnownStraysOptions, FilterKnownStraysResult, KnownStrayCandidate, KnownStraySources, } from './known-strays.js';
|
|
6
|
+
export { diagnoseSkillViews, resolveExpectedSkillProjections, } from './skill-view-diagnostic.js';
|
|
7
|
+
export type { ExpectedProjection, ProjectedSkillVersion, SkillViewClass, SkillViewDiagnosis, SkillViewDiagnostic, SkillViewObservation, } from './skill-view-diagnostic.js';
|
|
6
8
|
export { detectStrays } from './strays.js';
|
|
7
9
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drift/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/drift/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAC;AACzC,YAAY,EAAE,aAAa,EAAE,MAAM,YAAY,CAAC;AAChD,YAAY,EAAE,WAAW,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAC7D,OAAO,EAAE,iBAAiB,EAAE,MAAM,gBAAgB,CAAC;AACnD,YAAY,EACV,wBAAwB,EACxB,uBAAuB,EACvB,mBAAmB,EACnB,iBAAiB,GAClB,MAAM,gBAAgB,CAAC;AACxB,OAAO,EACL,kBAAkB,EAClB,+BAA+B,GAChC,MAAM,yBAAyB,CAAC;AACjC,YAAY,EACV,kBAAkB,EAClB,qBAAqB,EACrB,cAAc,EACd,kBAAkB,EAClB,mBAAmB,EACnB,oBAAoB,GACrB,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC"}
|
package/dist/drift/index.js
CHANGED