@lesliechan721/aw 0.1.0-beta.87 → 0.1.0-beta.89
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/assets/command-runtime-config.mjs +40 -12
- package/dist/authoring/assets/command-runtime-config.mjs.map +1 -1
- package/dist/authoring/scripts/validate-plugin.mjs +14 -3
- package/dist/authoring/scripts/validate-plugin.mjs.map +1 -1
- package/dist/scripts/aw-skill-eval-materializer.js +10 -2
- package/dist/scripts/aw-skill-eval-materializer.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/catalog-source.js +1 -1
- package/dist/src/commands/catalog-source.js.map +1 -1
- package/dist/src/commands/lifecycle-command-package.d.ts +1 -0
- package/dist/src/commands/lifecycle-command-package.js +14 -10
- package/dist/src/commands/lifecycle-command-package.js.map +1 -1
- package/dist/src/commands/managed-commands.js +8 -16
- package/dist/src/commands/managed-commands.js.map +1 -1
- package/dist/src/commands/plugin-capabilities.js +4 -0
- package/dist/src/commands/plugin-capabilities.js.map +1 -1
- package/dist/src/commands/public-lifecycle-result.js +2 -1
- package/dist/src/commands/public-lifecycle-result.js.map +1 -1
- package/dist/src/generators/local-plugin.js +6 -0
- package/dist/src/generators/local-plugin.js.map +1 -1
- package/dist/src/generators/permissions.d.ts +2 -1
- package/dist/src/generators/permissions.js +5 -5
- package/dist/src/generators/permissions.js.map +1 -1
- package/dist/src/index.js +82 -9
- package/dist/src/index.js.map +1 -1
- package/dist/src/output/command-receipt.js +4 -2
- package/dist/src/output/command-receipt.js.map +1 -1
- package/dist/src/output/public-result.js +16 -4
- package/dist/src/output/public-result.js.map +1 -1
- package/dist/src/output/receipt-projection.js +5 -4
- package/dist/src/output/receipt-projection.js.map +1 -1
- package/dist/src/platforms/grok-permission-config.d.ts +2 -1
- package/dist/src/platforms/grok-permission-config.js +4 -4
- package/dist/src/platforms/grok-permission-config.js.map +1 -1
- package/dist/src/platforms/projection.js +2 -2
- package/dist/src/platforms/projection.js.map +1 -1
- package/dist/src/recovery/status.js +2 -2
- package/dist/src/recovery/status.js.map +1 -1
- package/dist/src/review/skill-materialization.d.ts +1 -0
- package/dist/src/review/skill-materialization.js +11 -2
- package/dist/src/review/skill-materialization.js.map +1 -1
- package/dist/src/tui/config-array-draft.d.ts +2 -1
- package/dist/src/tui/config-array-draft.js +3 -0
- package/dist/src/tui/config-array-draft.js.map +1 -1
- package/dist/src/tui/config-leaf-editor.d.ts +2 -1
- package/dist/src/tui/config-leaf-editor.js +7 -4
- package/dist/src/tui/config-leaf-editor.js.map +1 -1
- package/dist/src/tui/config-suggestions.d.ts +22 -0
- package/dist/src/tui/config-suggestions.js +54 -0
- package/dist/src/tui/config-suggestions.js.map +1 -0
- package/dist/src/tui/config-value-presentation.d.ts +1 -0
- package/dist/src/tui/config-value-presentation.js +26 -1
- package/dist/src/tui/config-value-presentation.js.map +1 -1
- package/dist/src/tui/console-app-v4.js +284 -87
- package/dist/src/tui/console-app-v4.js.map +1 -1
- package/dist/src/tui/controller-runtime.js +14 -0
- package/dist/src/tui/controller-runtime.js.map +1 -1
- package/dist/src/tui/controller.d.ts +4 -0
- package/dist/src/tui/controller.js +46 -4
- package/dist/src/tui/controller.js.map +1 -1
- package/dist/src/tui/operation-review-planner.js +2 -2
- package/dist/src/tui/operation-review-planner.js.map +1 -1
- package/dist/src/tui/router.d.ts +17 -18
- package/dist/src/tui/router.js.map +1 -1
- package/dist/src/tui/screen-registry.d.ts +2 -8
- package/dist/src/types.d.ts +1 -0
- package/dist/src/types.js.map +1 -1
- package/dist/src/utils/bundle-layout.js +7 -0
- package/dist/src/utils/bundle-layout.js.map +1 -1
- package/dist/src/utils/component-command-preparation.js +2 -3
- package/dist/src/utils/component-command-preparation.js.map +1 -1
- package/dist/src/utils/managed-command-cli-review.d.ts +11 -1
- package/dist/src/utils/managed-command-cli-review.js +82 -40
- package/dist/src/utils/managed-command-cli-review.js.map +1 -1
- package/dist/src/utils/managed-command-materialization.js +2 -2
- package/dist/src/utils/managed-command-materialization.js.map +1 -1
- package/dist/src/utils/managed-command-review.js +2 -2
- package/dist/src/utils/managed-command-review.js.map +1 -1
- package/dist/src/utils/managed-command-runtime.d.ts +2 -0
- package/dist/src/utils/managed-command-runtime.js +5 -3
- package/dist/src/utils/managed-command-runtime.js.map +1 -1
- package/dist/src/utils/managed-command-snapshots.d.ts +8 -1
- package/dist/src/utils/managed-command-snapshots.js +16 -11
- package/dist/src/utils/managed-command-snapshots.js.map +1 -1
- package/dist/src/utils/managed-command-store.d.ts +6 -1
- package/dist/src/utils/managed-command-store.js +47 -8
- package/dist/src/utils/managed-command-store.js.map +1 -1
- package/dist/src/utils/native-cli.d.ts +10 -0
- package/dist/src/utils/native-cli.js +24 -18
- package/dist/src/utils/native-cli.js.map +1 -1
- package/dist/src/utils/platform-empty-state.js +3 -2
- package/dist/src/utils/platform-empty-state.js.map +1 -1
- package/dist/src/utils/plugin-config-command-apply.js +7 -5
- package/dist/src/utils/plugin-config-command-apply.js.map +1 -1
- package/dist/src/utils/plugin-config-impact.d.ts +1 -0
- package/dist/src/utils/plugin-config-impact.js +2 -1
- package/dist/src/utils/plugin-config-impact.js.map +1 -1
- package/dist/src/utils/plugin-config-references.d.ts +2 -0
- package/dist/src/utils/plugin-config-references.js +12 -2
- package/dist/src/utils/plugin-config-references.js.map +1 -1
- package/dist/src/utils/plugin-config-suggestion-runner.d.ts +50 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js +167 -0
- package/dist/src/utils/plugin-config-suggestion-runner.js.map +1 -0
- package/dist/src/utils/plugin-config-suggestions.d.ts +47 -0
- package/dist/src/utils/plugin-config-suggestions.js +274 -0
- package/dist/src/utils/plugin-config-suggestions.js.map +1 -0
- package/dist/src/utils/plugin-config.d.ts +5 -1
- package/dist/src/utils/plugin-config.js +48 -22
- package/dist/src/utils/plugin-config.js.map +1 -1
- package/dist/src/utils/plugin-scripts.d.ts +2 -0
- package/dist/src/utils/plugin-scripts.js +101 -28
- package/dist/src/utils/plugin-scripts.js.map +1 -1
- package/dist/src/utils/rendered-contract.js +2 -2
- package/dist/src/utils/rendered-contract.js.map +1 -1
- package/dist/vitest.config.js +1 -0
- package/dist/vitest.config.js.map +1 -1
- package/package.json +3 -3
|
@@ -7,6 +7,7 @@ export { parsePermissionCommand } from '@lesliechan721/aw-plugin-core/manifest';
|
|
|
7
7
|
export interface InactiveManagedCommandPermission {
|
|
8
8
|
name: string;
|
|
9
9
|
action: 'ask' | 'deny';
|
|
10
|
+
invocationSelector: string;
|
|
10
11
|
argsPrefix: string[];
|
|
11
12
|
}
|
|
12
13
|
export declare function managedCommandRouteIsReachable(routes: CommandRoutes | null, argsPrefix: readonly string[]): boolean;
|
|
@@ -21,7 +22,7 @@ export interface ClaudePermissions {
|
|
|
21
22
|
deny: string[];
|
|
22
23
|
excludedCommands?: string[];
|
|
23
24
|
}
|
|
24
|
-
export declare function hostPermissionClaims(permissions: PermissionDefinition[], selector
|
|
25
|
+
export declare function hostPermissionClaims(permissions: PermissionDefinition[], selector?: string): PermissionClaim[];
|
|
25
26
|
export declare function renderClaudeBashRule(tokens: readonly string[]): string;
|
|
26
27
|
export declare function mergeClaudePermissions(permissions: PermissionDefinition[], selector?: string): ClaudePermissions;
|
|
27
28
|
export declare function generateCodexPermissionArtifacts(pluginName: string, permissions: PermissionDefinition[], selector?: string): GeneratedTextArtifact[];
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { COMMAND_ROUTE_UNREACHABLE, deliveryNoticeMessage, INVOCATION_POLICY_NOT_APPLIED, PERMISSION_ACTIONS } from '../output/component-delivery.js';
|
|
2
2
|
import { buildGeneratedName, dedupe } from './shared.js';
|
|
3
|
-
import {
|
|
3
|
+
import { normalizeCommandInvocationSelector, normalizeManagedCommandPermission, parsePermissionCommand, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
4
4
|
export { parsePermissionCommand } from '@lesliechan721/aw-plugin-core/manifest';
|
|
5
5
|
export function managedCommandRouteIsReachable(routes, argsPrefix) {
|
|
6
6
|
const word = argsPrefix[0];
|
|
@@ -44,8 +44,9 @@ export function selectPlatformInvocationPolicy(policy, subject, routes, portable
|
|
|
44
44
|
warn(`permissions.${name}`, COMMAND_ROUTE_UNREACHABLE, skipped);
|
|
45
45
|
for (const action of ['ask', 'deny']) {
|
|
46
46
|
for (const entry of permission[action] ?? []) {
|
|
47
|
-
if (typeof entry !== 'string' && !hasRoute(entry))
|
|
48
|
-
inactivePermissions.push({ name, action, argsPrefix: [...entry.argsPrefix] });
|
|
47
|
+
if (typeof entry !== 'string' && policy.invocationSelector && !hasRoute(entry)) {
|
|
48
|
+
inactivePermissions.push({ name, action, invocationSelector: policy.invocationSelector, argsPrefix: [...entry.argsPrefix] });
|
|
49
|
+
}
|
|
49
50
|
}
|
|
50
51
|
}
|
|
51
52
|
if (!allow?.length && !ask?.length && !deny?.length && !excludedCommands?.length)
|
|
@@ -60,8 +61,7 @@ function permissionTokens(value, selector) {
|
|
|
60
61
|
const permission = normalizeManagedCommandPermission(value);
|
|
61
62
|
if (!selector)
|
|
62
63
|
throw new Error('commandReferenceInvalid: managed command permission requires a verified selector.');
|
|
63
|
-
|
|
64
|
-
return ['aw', 'command', 'run', selector, '--', ...permission.argsPrefix];
|
|
64
|
+
return ['aw', 'command', 'run', normalizeCommandInvocationSelector(selector), '--', ...permission.argsPrefix];
|
|
65
65
|
}
|
|
66
66
|
export function hostPermissionClaims(permissions, selector) {
|
|
67
67
|
return permissions.flatMap((permission) => ['allow', 'ask', 'deny'].flatMap((effect) => (permission[effect] ?? []).map((entry) => ({ name: permission.name, effect, tokens: permissionTokens(entry, selector) }))));
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"permissions.js","sourceRoot":"","sources":["../../../src/generators/permissions.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,yBAAyB,EAAE,qBAAqB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E,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,QAAQ,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YACzG,GAAG,MAAM,CAAC,CAAC,UAAU,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,qBAAqB,CAAC,KAAK,EAAE,WAAW,EAAE,QAAQ,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE;YAC7G,EAAE;SACH,CAAC;QAEF,OAAO;YACL,YAAY,EAAE,SAAS,aAAa,QAAQ;YAC5C,WAAW,EAAE,aAAa;YAC1B,OAAO,EAAE,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC;SAC1B,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC"}
|
package/dist/src/index.js
CHANGED
|
@@ -14,7 +14,7 @@ import { fileURLToPath } from 'node:url';
|
|
|
14
14
|
import { withNativeCliInterruption } from './utils/native-cli-interruption.js';
|
|
15
15
|
import { Command, CommanderError, InvalidArgumentError, Option } from 'commander';
|
|
16
16
|
import { doctorEvalProviders } from '@lesliechan721/agent-skill-eval';
|
|
17
|
-
import { compilePluginConfigDefinition, selectPluginConfigProfile, PLATFORM_TARGETS } from '@lesliechan721/aw-plugin-core/manifest';
|
|
17
|
+
import { compilePluginConfigDefinition, selectPluginConfigProfile, PLATFORM_TARGETS, CONFIG_SUGGESTIONS_TIMEOUT_MIN_MS, CONFIG_SUGGESTIONS_TIMEOUT_MAX_MS, } from '@lesliechan721/aw-plugin-core/manifest';
|
|
18
18
|
import { CatalogWorkspaceMissingError, resolveCatalogWorkspaceRoot } from './commands/catalog-workspace-resolution.js';
|
|
19
19
|
import { addCatalogSourceCommand, describeSourceCommandRebinding, preflightCatalogSourceMutation, explicitRefPolicy, listCatalogSources, removeCatalogSourceCommand, updateCatalogSourceCommand, } from './commands/catalog-source.js';
|
|
20
20
|
import { catalogSourceStatusCommand, syncCatalogSourceCommand, } from './commands/catalog-generation.js';
|
|
@@ -25,11 +25,12 @@ import { parseContextValue, parsePlatformTargetValue, parseScopeValue, resolveSc
|
|
|
25
25
|
import { createNoopReporter, formatWarnings } from './output/reporter.js';
|
|
26
26
|
import { redactString, redactValue } from './output/redact.js';
|
|
27
27
|
import { resolveCliPackageRoot } from './utils/paths.js';
|
|
28
|
-
import { coercePluginConfigUpdates, assertPluginConfigMutationCandidate, findConfigFieldEntry, formatPluginConfigSetRecoveryCommand, listNamespacedPluginConfigStores, readPluginConfigStore, renderPluginConfigValueForDisplay, resolveConfigRead, } from './utils/plugin-config.js';
|
|
28
|
+
import { coercePluginConfigUpdates, assertPluginConfigMutationCandidate, findConfigFieldEntry, formatPluginConfigSetRecoveryCommand, listNamespacedPluginConfigStores, PluginConfigValueValidationError, readPluginConfigStore, renderPluginConfigValueForDisplay, resolveConfigRead, } from './utils/plugin-config.js';
|
|
29
29
|
import { applyPluginConfigWrite, ConfigApplyInterruptedError, applyPluginConfig, buildConfigMutationReceipt, configActiveAvailabilityError, configWriteStateForError, resetPluginConfigWithHelper, } from './utils/plugin-config-write.js';
|
|
30
30
|
import { assertStrictSemVer } from './utils/manifest.js';
|
|
31
31
|
import { assertCatalogSourceReferencesSupported, inventoryLegacyConfigReferences, } from './utils/catalog-source-references.js';
|
|
32
|
-
import { CatalogLeaseEscapeError, parsePluginId, withResolvedCatalogPlugin, withResolvedMultiSourceCatalog, } from './utils/multi-source-catalog.js';
|
|
32
|
+
import { CatalogLeaseEscapeError, CatalogPluginNotFoundError, parsePluginId, withResolvedCatalogPlugin, withResolvedMultiSourceCatalog, } from './utils/multi-source-catalog.js';
|
|
33
|
+
import { ConfigSuggestionArgumentError, parseConfigSuggestionDependencyOverrides, parseConfigSuggestionFieldPath, preparePluginConfigSuggestions, } from './utils/plugin-config-suggestions.js';
|
|
33
34
|
import { sanitizeCatalogSourceError, sanitizeCatalogSourceErrorMessage, } from './utils/catalog-public-error.js';
|
|
34
35
|
import { catalogGenerationErrorCode } from './utils/catalog-generation-error.js';
|
|
35
36
|
import { resolveCatalogOperationContext, } from './utils/catalog-operation-context.js';
|
|
@@ -1930,6 +1931,74 @@ export function buildProgram(options = {}) {
|
|
|
1930
1931
|
};
|
|
1931
1932
|
const configPlatform = (rawOptions) => rawOptions.platform === undefined
|
|
1932
1933
|
? undefined : normalizeWriteRequest(() => parsePlatformTargetValue(rawOptions.platform));
|
|
1934
|
+
configCommand(config.command('suggestions').description('Query dynamic configuration suggestions without saving'))
|
|
1935
|
+
.argument('<plugin>', 'source-qualified plugin ID')
|
|
1936
|
+
.argument('<field-path>', 'dot-separated field path, with optional array indices')
|
|
1937
|
+
.option('--dep <key=value>', 'override a dependency value', (value, previous = []) => [...previous, value])
|
|
1938
|
+
.addOption(strictValueOption('--timeout-ms <ms>', 'suggestion provider timeout in milliseconds'))
|
|
1939
|
+
.action(async (selector, field, rawOptions) => {
|
|
1940
|
+
const command = 'plugin.config.suggestions';
|
|
1941
|
+
const context = createActionContext(command, rawOptions);
|
|
1942
|
+
const platform = configPlatform(rawOptions);
|
|
1943
|
+
let parseValidSelector = false;
|
|
1944
|
+
let fieldPath;
|
|
1945
|
+
try {
|
|
1946
|
+
const parsed = normalizeWriteRequest(() => parsePluginId(selector));
|
|
1947
|
+
if (!parsed.sourceId)
|
|
1948
|
+
throw new ConfigSuggestionArgumentError('Use the source-qualified plugin ID.');
|
|
1949
|
+
parseValidSelector = true;
|
|
1950
|
+
const parts = parseConfigSuggestionFieldPath(field);
|
|
1951
|
+
fieldPath = parts;
|
|
1952
|
+
const dependencyOverrides = parseConfigSuggestionDependencyOverrides(rawOptions.dep ?? []);
|
|
1953
|
+
const timeout = rawOptions.timeoutMs;
|
|
1954
|
+
const timeoutMs = timeout === undefined ? undefined : (/^[0-9]+$/u.test(timeout) ? Number(timeout) : NaN);
|
|
1955
|
+
if (timeoutMs !== undefined && (!Number.isInteger(timeoutMs) || timeoutMs < CONFIG_SUGGESTIONS_TIMEOUT_MIN_MS
|
|
1956
|
+
|| timeoutMs > CONFIG_SUGGESTIONS_TIMEOUT_MAX_MS)) {
|
|
1957
|
+
throw new ConfigSuggestionArgumentError(`Use a decimal integer between ${CONFIG_SUGGESTIONS_TIMEOUT_MIN_MS} and ${CONFIG_SUGGESTIONS_TIMEOUT_MAX_MS} milliseconds.`);
|
|
1958
|
+
}
|
|
1959
|
+
const work = await configContext(context, rawOptions, false);
|
|
1960
|
+
const result = await runActionWithContext(context, () => withResolvedCatalogPlugin({
|
|
1961
|
+
selector, cliVersion: resolveCliVersion(), env: context.env, signal: context.signal,
|
|
1962
|
+
consume: async ({ plugin }) => {
|
|
1963
|
+
const prepared = await preparePluginConfigSuggestions({
|
|
1964
|
+
plugin, platform, context: work.context, cwd: context.cwd, env: context.env, fieldPath: parts,
|
|
1965
|
+
dependencyOverrides, timeoutMs, signal: context.signal,
|
|
1966
|
+
});
|
|
1967
|
+
const { status, items, message, diagnostics } = prepared.project(await prepared.run());
|
|
1968
|
+
const severity = status === 'unavailable' ? 'error' : status === 'unsupported' ? 'warning' : 'info';
|
|
1969
|
+
const entries = status === 'unavailable' && !diagnostics?.length ? [{
|
|
1970
|
+
code: 'configSuggestionsUnavailable',
|
|
1971
|
+
message: message || 'Suggestions are unavailable.',
|
|
1972
|
+
}] : diagnostics ?? [];
|
|
1973
|
+
return commandResult(command, { pluginId: prepared.pluginId, fieldPath: prepared.fieldPath, profile: prepared.profile,
|
|
1974
|
+
provider: prepared.provider, providerPluginId: prepared.providerPluginId, status, items,
|
|
1975
|
+
...(message === undefined ? {} : { message }), ...(diagnostics === undefined ? {} : { diagnostics }) }, {
|
|
1976
|
+
status: status === 'unavailable' ? 'failed' : 'success',
|
|
1977
|
+
diagnostics: entries.map((entry) => ({ ...entry, severity, subject: {
|
|
1978
|
+
pluginId: prepared.providerPluginId, ...(platform === undefined ? {} : { target: platform }), field,
|
|
1979
|
+
} })),
|
|
1980
|
+
});
|
|
1981
|
+
},
|
|
1982
|
+
}));
|
|
1983
|
+
writeJsonReceipt(io.stdout, result);
|
|
1984
|
+
commandExitState.exitCode = publicExitCode(result);
|
|
1985
|
+
}
|
|
1986
|
+
catch (error) {
|
|
1987
|
+
context.signal?.throwIfAborted();
|
|
1988
|
+
const argumentError = error instanceof ConfigSuggestionArgumentError || error instanceof WriteCommandRequestError
|
|
1989
|
+
|| error instanceof CatalogPluginNotFoundError;
|
|
1990
|
+
const result = commandResult(command, {}, { status: 'failed', diagnostics: [{
|
|
1991
|
+
code: argumentError ? 'invalidArguments' : 'configSuggestionsUnavailable', severity: 'error',
|
|
1992
|
+
message: error instanceof ConfigSuggestionArgumentError || error instanceof WriteCommandRequestError ? error.message
|
|
1993
|
+
: error instanceof CatalogPluginNotFoundError ? 'The selected plugin is not in the active Catalog.'
|
|
1994
|
+
: 'The config suggestion provider could not be prepared.',
|
|
1995
|
+
subject: { ...(parseValidSelector ? { pluginId: selector } : {}),
|
|
1996
|
+
...(platform === undefined ? {} : { target: platform }), ...(fieldPath === undefined ? {} : { field }) },
|
|
1997
|
+
}] });
|
|
1998
|
+
writeJsonReceipt(io.stdout, result);
|
|
1999
|
+
commandExitState.exitCode = publicExitCode(result, argumentError);
|
|
2000
|
+
}
|
|
2001
|
+
});
|
|
1933
2002
|
for (const command of ['schema', 'list', 'get']) {
|
|
1934
2003
|
const entry = configCommand((command === 'list' ? new Command(command) : config.command(command)).argument('<plugin>'));
|
|
1935
2004
|
if (command === 'get')
|
|
@@ -2070,8 +2139,9 @@ export function buildProgram(options = {}) {
|
|
|
2070
2139
|
try {
|
|
2071
2140
|
inputValue = (await coercePluginConfigUpdates({ schema: fields, updates: { [key]: inputValue }, cwd: context.cwd }))[key];
|
|
2072
2141
|
}
|
|
2073
|
-
catch {
|
|
2074
|
-
throw new WriteCommandRequestError(
|
|
2142
|
+
catch (error) {
|
|
2143
|
+
throw new WriteCommandRequestError((error instanceof PluginConfigValueValidationError ? error.publicMessage : undefined)
|
|
2144
|
+
?? `Invalid value for configuration field "${key}".`);
|
|
2075
2145
|
}
|
|
2076
2146
|
}
|
|
2077
2147
|
try {
|
|
@@ -2598,12 +2668,12 @@ export async function runCli(argv, options = {}) {
|
|
|
2598
2668
|
const resolvedCommand = resolveRegisteredCommand(program, awArgs);
|
|
2599
2669
|
const selected = resolvedCommand.command;
|
|
2600
2670
|
const id = selected && selected !== program ? commandId(selected) : null;
|
|
2601
|
-
const controlledInterrupt = ['plugin.install', 'plugin.remove', 'plugin.sync', 'plugin.config.apply',
|
|
2671
|
+
const controlledInterrupt = ['plugin.install', 'plugin.remove', 'plugin.sync', 'plugin.config.apply', 'plugin.config.suggestions',
|
|
2602
2672
|
'dev.plugin.create', 'dev.plugin.validate', 'dev.plugin.remove', 'dev.plugin.status',
|
|
2603
2673
|
'dev.skill.create', 'dev.skill.validate'].includes(id ?? '');
|
|
2604
2674
|
if (controlledInterrupt) {
|
|
2605
2675
|
commandOptions.interruption = interruption;
|
|
2606
|
-
commandOptions.signal = id === 'plugin.config.apply' && options.signal
|
|
2676
|
+
commandOptions.signal = (id === 'plugin.config.apply' || id === 'plugin.config.suggestions') && options.signal
|
|
2607
2677
|
? AbortSignal.any([options.signal, interruption.signal]) : interruption.signal;
|
|
2608
2678
|
}
|
|
2609
2679
|
if (id === 'command.run' && !awArgs.some((arg) => arg === '--help' || arg === '-h')) {
|
|
@@ -2762,7 +2832,8 @@ export async function runCli(argv, options = {}) {
|
|
|
2762
2832
|
result.nextActions.push({ kind: 'command', argv: ['aw', 'dev', 'plugin', action, `plugins/${name}`], reason: 'Check and build the new source.', requiresConfirmation: false });
|
|
2763
2833
|
result.nextActions.push({ kind: 'command', argv: ['aw', 'dev', 'catalog', 'build'], reason: 'Build the Catalog after checking the source.', requiresConfirmation: false });
|
|
2764
2834
|
}
|
|
2765
|
-
const invalid =
|
|
2835
|
+
const invalid = id === 'plugin.config.suggestions' ? exitCode === 2
|
|
2836
|
+
: result.diagnostics.some((diagnostic) => /invalidArguments|invalidOption|missingArgument|sensitiveConfigInputUnsupported/u.test(diagnostic.code));
|
|
2766
2837
|
if (invalid && result.status !== 'partial') {
|
|
2767
2838
|
result.status = 'failed';
|
|
2768
2839
|
result.data = {};
|
|
@@ -2776,7 +2847,9 @@ export async function runCli(argv, options = {}) {
|
|
|
2776
2847
|
const raw = id?.startsWith('plugin.config.') && !(error instanceof CommanderError) && !(error instanceof WriteCommandRequestError)
|
|
2777
2848
|
? configMutationFailure(error, options.env ?? process.env, options.cwd ?? process.cwd())
|
|
2778
2849
|
: error;
|
|
2779
|
-
const
|
|
2850
|
+
const invalidOption = id !== 'plugin.config.suggestions'
|
|
2851
|
+
&& (error instanceof InvalidArgumentError || error instanceof CommanderError && error.code === 'commander.invalidArgument');
|
|
2852
|
+
const code = argumentError ? invalidOption ? 'invalidOptionValue' : 'invalidArguments' : raw.code ?? catalogGenerationErrorCode(error);
|
|
2780
2853
|
const blocked = code === 'confirmationRequired' || /unavailable|missing|stale|conflict|unsupported|identityMismatch/iu.test(code);
|
|
2781
2854
|
let message = raw.message ?? 'The operation failed.';
|
|
2782
2855
|
if (error instanceof CommanderError) {
|