@lesliechan721/aw 0.1.0-beta.61 → 0.1.0-beta.63
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/dist/authoring/scripts/validate-plugin.mjs +56 -9
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.js +3 -0
- package/dist/scripts/aw-skill-eval-materializer.js.map +1 -1
- package/dist/scripts/test-plugin-scripts.js +20 -1
- package/dist/scripts/test-plugin-scripts.js.map +1 -1
- package/dist/src/commands/aw-capabilities.d.ts +1 -1
- package/dist/src/commands/aw-capabilities.js +1 -0
- package/dist/src/commands/aw-capabilities.js.map +1 -1
- package/dist/src/commands/rebuild-command.js +25 -26
- package/dist/src/commands/rebuild-command.js.map +1 -1
- package/dist/src/commands/rebuild-integration.d.ts +2 -0
- package/dist/src/commands/rebuild-integration.js +23 -7
- package/dist/src/commands/rebuild-integration.js.map +1 -1
- package/dist/src/commands/review-inspection.js +38 -5
- package/dist/src/commands/review-inspection.js.map +1 -1
- package/dist/src/commands/review-preparation.js +1 -0
- package/dist/src/commands/review-preparation.js.map +1 -1
- package/dist/src/portable/materializer.js +3 -0
- package/dist/src/portable/materializer.js.map +1 -1
- package/dist/src/review/review-profile.d.ts +1 -0
- package/dist/src/review/review-profile.js +44 -8
- package/dist/src/review/review-profile.js.map +1 -1
- package/dist/src/review/review-selection.js +19 -6
- package/dist/src/review/review-selection.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -0
- package/dist/src/review/skill-materialization.js +2 -0
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/review/source-binding.d.ts +5 -0
- package/dist/src/review/source-binding.js +83 -22
- package/dist/src/review/source-binding.js.map +1 -1
- package/dist/src/tui/config-leaf-editor.d.ts +24 -0
- package/dist/src/tui/config-leaf-editor.js +19 -7
- package/dist/src/tui/config-leaf-editor.js.map +1 -1
- package/dist/src/tui/config-references.d.ts +1 -0
- package/dist/src/tui/config-references.js +8 -1
- package/dist/src/tui/config-references.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +96 -27
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.d.ts +1 -1
- package/dist/src/tui/controller-runtime.js +119 -91
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +3 -0
- package/dist/src/tui/controller.js +19 -0
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/model.js +1 -1
- package/dist/src/tui/model.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +13 -8
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/utils/artifact-renderer.d.ts +8 -1
- package/dist/src/utils/artifact-renderer.js +25 -7
- package/dist/src/utils/artifact-renderer.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.d.ts +2 -0
- package/dist/src/utils/managed-command-materialization.js +2 -1
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +15 -0
- package/dist/src/utils/plugin-config-impact.js +132 -24
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-references.d.ts +80 -0
- package/dist/src/utils/plugin-config-references.js +340 -0
- package/dist/src/utils/plugin-config-references.js.map +1 -0
- package/dist/src/utils/plugin-config-write.js +148 -31
- package/dist/src/utils/plugin-config-write.js.map +1 -1
- package/dist/src/utils/plugin-config.d.ts +10 -2
- package/dist/src/utils/plugin-config.js +53 -4
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +1 -0
- package/dist/src/utils/plugin-scripts.js +1 -1
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/runtime-config.js +1 -0
- package/dist/src/utils/runtime-config.js.map +1 -1
- package/package.json +3 -3
|
@@ -6,7 +6,8 @@ import { createRequire } from 'node:module';
|
|
|
6
6
|
import * as os from 'node:os';
|
|
7
7
|
import * as path from 'node:path';
|
|
8
8
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
9
|
-
import { AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, createRuntimeConfigSnapshot, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, getManagedCommandArtifactTargets, normalizePluginConfigDefinition, parseManagedCommandPlaceholders, replaceManagedCommandPlaceholders, validateCommandEntryFiles, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
9
|
+
import { assertPluginConfigReferenceSchemas, AW_RUNTIME_CONFIG_READER_PATH, createNativeToolReaderSource, createRuntimeConfigSnapshot, getPluginAuthoringAcceptedValues as getCorePluginAuthoringAcceptedValues, getSkillFrontmatterCapabilityRegistry, getManagedCommandArtifactTargets, normalizePluginConfigDefinition, parseManagedCommandPlaceholders, replaceManagedCommandPlaceholders, validateCommandEntryFiles, validatePluginConfigCandidate, formatPluginConfigIssue, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
10
|
+
import { readCatalogWorkspace } from '@lesliechan721/aw-plugin-core';
|
|
10
11
|
import { checkPluginVersions } from './lib/plugin-version-check.mjs';
|
|
11
12
|
import { scanJavaScriptImportSpecifiers } from './lib/javascript-import-scanner.mjs';
|
|
12
13
|
import { assertAuthoringPluginPathFence, assertCanonicalAuthoringPluginRoot, } from './lib/plugin-root.mjs';
|
|
@@ -339,6 +340,7 @@ async function tryLoadCliManifestTools() {
|
|
|
339
340
|
return {
|
|
340
341
|
assertPluginInputTree: manifestModule.assertPluginInputTree ?? null,
|
|
341
342
|
validateSourcePluginManifest: manifestModule.validateSourcePluginManifest ?? null,
|
|
343
|
+
reservedImports: manifestModule.CLI_RESERVED_IMPORTS,
|
|
342
344
|
readPluginManifest: manifestModule.readPluginManifest ?? null,
|
|
343
345
|
discoverPlugins: manifestModule.discoverPlugins ?? null,
|
|
344
346
|
resolvePluginRequirements: manifestModule.resolvePluginRequirements ?? null,
|
|
@@ -1699,11 +1701,13 @@ function listFilesRecursive(rootDir) {
|
|
|
1699
1701
|
walk(rootDir);
|
|
1700
1702
|
return output;
|
|
1701
1703
|
}
|
|
1702
|
-
function validateConfigSchemaLightweight(config) {
|
|
1704
|
+
function validateConfigSchemaLightweight(config, manifest) {
|
|
1703
1705
|
if (config === undefined)
|
|
1704
1706
|
return;
|
|
1705
1707
|
try {
|
|
1706
|
-
normalizePluginConfigDefinition(config
|
|
1708
|
+
normalizePluginConfigDefinition(config, 'config', {
|
|
1709
|
+
plugin: manifest.name, dependencies: manifest.dependencies ?? [],
|
|
1710
|
+
});
|
|
1707
1711
|
}
|
|
1708
1712
|
catch (validationError) {
|
|
1709
1713
|
error(validationError instanceof Error ? validationError.message : String(validationError));
|
|
@@ -1725,6 +1729,14 @@ function defaultConfigValues(manifest) {
|
|
|
1725
1729
|
}
|
|
1726
1730
|
return values;
|
|
1727
1731
|
}
|
|
1732
|
+
function hasCrossPluginValueRef(value) {
|
|
1733
|
+
if (!isRecord(value))
|
|
1734
|
+
return false;
|
|
1735
|
+
if (isRecord(value.valueRef) && value.valueRef.plugin !== undefined)
|
|
1736
|
+
return true;
|
|
1737
|
+
return Object.values(value).some((child) => Array.isArray(child)
|
|
1738
|
+
? child.some(hasCrossPluginValueRef) : hasCrossPluginValueRef(child));
|
|
1739
|
+
}
|
|
1728
1740
|
function configFieldContainsSensitiveValue(field) {
|
|
1729
1741
|
if (!isRecord(field))
|
|
1730
1742
|
return false;
|
|
@@ -2656,7 +2668,7 @@ function resolveArtifactRendererFixtureRequests(declarations, manifest, requires
|
|
|
2656
2668
|
});
|
|
2657
2669
|
return [...partitionedAwOwned, ...codexNative.values()];
|
|
2658
2670
|
}
|
|
2659
|
-
async function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, resolvedRuntimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput) {
|
|
2671
|
+
async function runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, resolvedRuntimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput, referenceContext) {
|
|
2660
2672
|
if (!renderEntry || declarations.length === 0)
|
|
2661
2673
|
return [];
|
|
2662
2674
|
const requests = resolveArtifactRendererFixtureRequests(declarations, manifest, requiresNonSensitiveArtifactInput);
|
|
@@ -2697,8 +2709,13 @@ async function runArtifactRendererFixture(pluginDir, manifest, renderEntry, decl
|
|
|
2697
2709
|
: [[key, manifest.config.fields[key]]]));
|
|
2698
2710
|
const scopedValues = Object.fromEntries(refreshKeys.flatMap((key) => Object.prototype.hasOwnProperty.call(values, key) ? [[key, values[key]]] : []));
|
|
2699
2711
|
try {
|
|
2712
|
+
if (manifest.config) {
|
|
2713
|
+
const issues = validatePluginConfigCandidate(manifest.config, values, refreshKeys, referenceContext);
|
|
2714
|
+
if (issues.length > 0)
|
|
2715
|
+
throw new Error(formatPluginConfigIssue(issues[0]));
|
|
2716
|
+
}
|
|
2700
2717
|
for (const target of scopedDeclarations.filter((declaration) => declaration.runtimeConfig)) {
|
|
2701
|
-
const definition =
|
|
2718
|
+
const definition = manifest.config;
|
|
2702
2719
|
createRuntimeConfigSnapshot({
|
|
2703
2720
|
installedIdentity: {
|
|
2704
2721
|
sourceId: 'authoring',
|
|
@@ -2715,6 +2732,7 @@ async function runArtifactRendererFixture(pluginDir, manifest, renderEntry, decl
|
|
|
2715
2732
|
declaration: target.runtimeConfig,
|
|
2716
2733
|
definition,
|
|
2717
2734
|
values,
|
|
2735
|
+
referenceContext,
|
|
2718
2736
|
});
|
|
2719
2737
|
}
|
|
2720
2738
|
}
|
|
@@ -2862,7 +2880,7 @@ async function runArtifactRendererFixture(pluginDir, manifest, renderEntry, decl
|
|
|
2862
2880
|
}
|
|
2863
2881
|
return returnedArtifacts;
|
|
2864
2882
|
}
|
|
2865
|
-
async function validateDynamicArtifactsLightweight(pluginDir, manifest, renderEntry, runtimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput) {
|
|
2883
|
+
async function validateDynamicArtifactsLightweight(pluginDir, manifest, renderEntry, runtimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput, referenceContext) {
|
|
2866
2884
|
const declarations = validateArtifactsConfigLightweight(pluginDir, manifest);
|
|
2867
2885
|
if (managedContext)
|
|
2868
2886
|
declarations.push(...getManagedCommandArtifactTargets(managedContext.manifest));
|
|
@@ -2874,7 +2892,7 @@ async function validateDynamicArtifactsLightweight(pluginDir, manifest, renderEn
|
|
|
2874
2892
|
if (hasRenderer && !hasTargets) {
|
|
2875
2893
|
error('scripts.artifacts.render requires artifacts.targets or dynamic managedCommands targets');
|
|
2876
2894
|
}
|
|
2877
|
-
return runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, runtimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput);
|
|
2895
|
+
return runArtifactRendererFixture(pluginDir, manifest, renderEntry, declarations, runtimeImports, skillValidationTools, managedContext, requiresNonSensitiveArtifactInput, referenceContext);
|
|
2878
2896
|
}
|
|
2879
2897
|
async function validateAuthorManagedCommands(pluginDir, manifest, rendered, context) {
|
|
2880
2898
|
const { tools, trees } = context;
|
|
@@ -2998,7 +3016,7 @@ async function validateAuthorManagedCommands(pluginDir, manifest, rendered, cont
|
|
|
2998
3016
|
}
|
|
2999
3017
|
}
|
|
3000
3018
|
function validateScriptsLightweight(pluginDir, manifest) {
|
|
3001
|
-
validateConfigSchemaLightweight(manifest.config);
|
|
3019
|
+
validateConfigSchemaLightweight(manifest.config, manifest);
|
|
3002
3020
|
if (manifest.scripts === undefined)
|
|
3003
3021
|
return null;
|
|
3004
3022
|
const scripts = expectRecord(manifest.scripts, 'scripts');
|
|
@@ -3593,12 +3611,41 @@ async function validatePluginDir(pluginDir, options) {
|
|
|
3593
3611
|
}
|
|
3594
3612
|
}
|
|
3595
3613
|
const skillValidationTools = await tryLoadCliSkillValidationTools();
|
|
3614
|
+
const sourceConfig = manifest.config;
|
|
3596
3615
|
let normalizedManifest;
|
|
3616
|
+
let referenceContext;
|
|
3597
3617
|
try {
|
|
3598
3618
|
normalizedManifest = await cliManifestTools.validateSourcePluginManifest(pluginDir, manifest);
|
|
3599
3619
|
// Renderer fixtures consume the same compiled config as installed runtime consumers.
|
|
3600
3620
|
if (normalizedManifest.config)
|
|
3601
3621
|
manifest.config = normalizedManifest.config;
|
|
3622
|
+
// The Workspace is the sole source of dependency definitions and defaults.
|
|
3623
|
+
// No installed plugin or user config can complete an author fixture.
|
|
3624
|
+
if (manifest.config) {
|
|
3625
|
+
let plugins = [{ manifest, rootDir: pluginDir }];
|
|
3626
|
+
if (hasCrossPluginValueRef(sourceConfig)) {
|
|
3627
|
+
if (!options.repoRoot)
|
|
3628
|
+
throw new Error('Cross-plugin config validation requires the canonical same-source Workspace.');
|
|
3629
|
+
const workspace = await readCatalogWorkspace(options.repoRoot, {
|
|
3630
|
+
reservedImports: cliManifestTools.reservedImports,
|
|
3631
|
+
});
|
|
3632
|
+
if (!workspace.plugins.some((plugin) => plugin.manifest.name === manifest.name
|
|
3633
|
+
&& plugin.rootDir === fs.realpathSync(pluginDir))) {
|
|
3634
|
+
throw new Error('Cross-plugin config validation requires the canonical same-source Workspace plugin.');
|
|
3635
|
+
}
|
|
3636
|
+
plugins = workspace.plugins;
|
|
3637
|
+
}
|
|
3638
|
+
referenceContext = {
|
|
3639
|
+
plugin: manifest.name,
|
|
3640
|
+
dependencies: manifest.dependencies ?? [],
|
|
3641
|
+
plugins: Object.fromEntries(plugins.map((plugin) => [plugin.manifest.name, {
|
|
3642
|
+
definition: plugin.manifest.config ?? { fields: {} },
|
|
3643
|
+
dependencies: plugin.manifest.dependencies ?? [],
|
|
3644
|
+
values: defaultConfigValues(plugin.manifest),
|
|
3645
|
+
}])),
|
|
3646
|
+
};
|
|
3647
|
+
assertPluginConfigReferenceSchemas(manifest.config, referenceContext, sourceConfig);
|
|
3648
|
+
}
|
|
3602
3649
|
const requirements = await cliManifestTools.resolvePluginRequirements({
|
|
3603
3650
|
pluginRoot: pluginDir,
|
|
3604
3651
|
manifest: normalizedManifest,
|
|
@@ -3641,7 +3688,7 @@ async function validatePluginDir(pluginDir, options) {
|
|
|
3641
3688
|
const managedContext = normalizedManifest
|
|
3642
3689
|
? { manifest: normalizedManifest, tools: cliManifestTools, trees: [] }
|
|
3643
3690
|
: undefined;
|
|
3644
|
-
const rendered = await validateDynamicArtifactsLightweight(pluginDir, manifest, artifactRenderEntry, runtimeImports, skillValidationTools, managedContext, cliManifestTools.requiresNonSensitiveArtifactInput);
|
|
3691
|
+
const rendered = await validateDynamicArtifactsLightweight(pluginDir, manifest, artifactRenderEntry, runtimeImports, skillValidationTools, managedContext, cliManifestTools.requiresNonSensitiveArtifactInput, referenceContext);
|
|
3645
3692
|
if (managedContext)
|
|
3646
3693
|
await validateAuthorManagedCommands(pluginDir, normalizedManifest, rendered ?? [], managedContext);
|
|
3647
3694
|
validateMcpContent(pluginDir, manifest);
|