-
Notifications
You must be signed in to change notification settings - Fork 3k
feat(cli): select an output style via general.outputStyle or --output-style #10283
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from 1 commit
0b34f32
72689c3
2713c78
31180a0
6e4824e
4ba2441
0e6aa86
2fa3a5b
67edf9e
b6e9068
34d5874
e730ed1
2b84a16
66393b7
a088581
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -46,6 +46,9 @@ import { | |||||
| type WebSearchSettings, | ||||||
| MAX_SUBAGENT_DEPTH_LIMIT, | ||||||
| addDaemonRequestAttribute, | ||||||
| BUILT_IN_OUTPUT_STYLES, | ||||||
| getBuiltInOutputStyle, | ||||||
| type OutputStyleDefinition, | ||||||
| } from '@qwen-code/qwen-code-core'; | ||||||
| import { extensionsCommand } from '../commands/extensions.js'; | ||||||
| import { hooksCommand } from '../commands/hooks.js'; | ||||||
|
|
@@ -145,6 +148,7 @@ export interface CliArgs { | |||||
| promptInteractive: string | undefined; | ||||||
| systemPrompt: string | undefined; | ||||||
| appendSystemPrompt: string | undefined; | ||||||
| outputStyle: string | undefined; | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [Suggestion] R8-2: [probe] The field is declared Witness:
Suggested change
中文说明该字段声明为 证据(探针): 建议修复:把字段声明为真实运行时形状 — qwen3.8-max via Qwen Code /review (v0.22.3) |
||||||
| yolo: boolean | undefined; | ||||||
| bare: boolean | undefined; | ||||||
| safeMode?: boolean | undefined; | ||||||
|
|
@@ -687,6 +691,11 @@ export async function parseArguments(): Promise<CliArgs> { | |||||
| description: | ||||||
| 'Append instructions to the main session system prompt for this run. Can be combined with --system-prompt.', | ||||||
| }) | ||||||
| .option('output-style', { | ||||||
| type: 'string', | ||||||
| description: | ||||||
| 'Output style for this run, for example "Concise" or "Explanatory". Overrides the general.outputStyle setting; "default" selects no style.', | ||||||
| }) | ||||||
| .option('sandbox', { | ||||||
| alias: 's', | ||||||
| type: 'boolean', | ||||||
|
|
@@ -1497,6 +1506,35 @@ export class SessionIdConflictError extends Error { | |||||
| } | ||||||
| } | ||||||
|
|
||||||
| /** | ||||||
| * Resolves the output style for this session. `--output-style` wins over | ||||||
| * `general.outputStyle`; an unset, empty, or `default` value means no style. | ||||||
| * An unknown name is reported and the session falls back to the default | ||||||
| * style rather than refusing to start, so a typo in settings.json never | ||||||
| * locks the user out. | ||||||
| */ | ||||||
| export function resolveOutputStyle( | ||||||
| argvStyle: string | undefined, | ||||||
| settingsStyle: string | undefined, | ||||||
| ): OutputStyleDefinition | undefined { | ||||||
| const name = (argvStyle ?? settingsStyle)?.trim(); | ||||||
|
qqqys marked this conversation as resolved.
Outdated
|
||||||
| if (!name || name.toLowerCase() === 'default') { | ||||||
| return undefined; | ||||||
| } | ||||||
| const style = getBuiltInOutputStyle(name); | ||||||
| if (style) { | ||||||
| return style; | ||||||
| } | ||||||
| const known = BUILT_IN_OUTPUT_STYLES.map((s) => s.name).join(', '); | ||||||
| const source = | ||||||
| argvStyle !== undefined ? '--output-style' : 'general.outputStyle'; | ||||||
| const warning = `Unknown output style "${name}" (from ${source}); using the default style. Available styles: ${known}.`; | ||||||
| debugLogger.warn(warning); | ||||||
| // eslint-disable-next-line no-console | ||||||
| console.error(`WARNING: ${warning}`); | ||||||
| return undefined; | ||||||
| } | ||||||
|
|
||||||
| export async function loadCliConfig( | ||||||
| settings: Settings, | ||||||
| argv: CliArgs, | ||||||
|
|
@@ -2160,6 +2198,10 @@ export async function loadCliConfig( | |||||
| question, | ||||||
| systemPrompt: argv.systemPrompt, | ||||||
| appendSystemPrompt: argv.appendSystemPrompt, | ||||||
| outputStyle: resolveOutputStyle( | ||||||
| argv.outputStyle, | ||||||
| settings.general?.outputStyle, | ||||||
| ), | ||||||
| // Legacy fields – kept for backward compatibility with getCoreTools() etc. | ||||||
| coreTools: | ||||||
| bareMode || safeMode | ||||||
|
|
||||||
Uh oh!
There was an error while loading. Please reload this page.