Skip to content

Commit 00419bc

Browse files
committed
feat: add CLI options for automated usage scenarios
Add --userWarning and --upgradeCheck options to support automated environments - --userWarning=false: Disables the user consent check - --upgradeCheck=false: Disables the version upgrade check - Updated documentation in README files
1 parent e236289 commit 00419bc

File tree

4 files changed

+39
-2
lines changed

4 files changed

+39
-2
lines changed

README.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,9 @@ mycoder --enableUserPrompt false "Generate a basic Express.js server"
3939
# or using the alias
4040
mycoder --userPrompt false "Generate a basic Express.js server"
4141

42+
# Disable user consent warning and version upgrade check for automated environments
43+
mycoder --userWarning false --upgradeCheck false "Generate a basic Express.js server"
44+
4245
# Enable GitHub mode via CLI option (overrides config)
4346
mycoder --githubMode "Work with GitHub issues and PRs"
4447

packages/cli/README.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,12 @@ mycoder "Implement a React component that displays a list of items"
3232
# Run with a prompt from a file
3333
mycoder -f prompt.txt
3434

35+
# Disable user prompts for fully automated sessions
36+
mycoder --userPrompt false "Generate a basic Express.js server"
37+
38+
# Disable user consent warning and version upgrade check for automated environments
39+
mycoder --userWarning false --upgradeCheck false "Generate a basic Express.js server"
40+
3541
# Enable GitHub mode
3642
mycoder config set githubMode true
3743
```
@@ -104,6 +110,14 @@ mycoder config set model claude-3-7-sonnet-20250219 # or any other Anthropic mo
104110
- `customPrompt`: Custom instructions to append to the system prompt for both main agent and sub-agents (default: `""`)
105111
- `tokenCache`: Enable token caching for LLM API calls (default: `true`)
106112

113+
### CLI-Only Options
114+
115+
These options are available only as command-line parameters and are not stored in the configuration:
116+
117+
- `userWarning`: Disable user consent check for automated/remote usage (default: `true`)
118+
- `upgradeCheck`: Disable version upgrade check for automated/remote usage (default: `true`)
119+
- `userPrompt`/`enableUserPrompt`: Enable or disable the userPrompt tool (default: `true`)
120+
107121
Example:
108122

109123
```bash

packages/cli/src/commands/$default.ts

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,9 +57,13 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
5757
`MyCoder v${packageInfo.version} - AI-powered coding assistant`,
5858
);
5959

60-
await checkForUpdates(logger);
60+
// Skip version check if upgradeCheck is false
61+
if (argv.upgradeCheck !== false) {
62+
await checkForUpdates(logger);
63+
}
6164

62-
if (!hasUserConsented()) {
65+
// Skip user consent check if userWarning is false
66+
if (!hasUserConsented() && argv.userWarning !== false) {
6367
const readline = createInterface({
6468
input: process.stdin,
6569
output: process.stdout,
@@ -81,6 +85,10 @@ export const command: CommandModule<SharedOptions, DefaultArgs> = {
8185
logger.info('User did not consent. Exiting.');
8286
throw new Error('User did not consent');
8387
}
88+
} else if (!hasUserConsented() && argv.userWarning === false) {
89+
// Auto-save consent when userWarning is false
90+
logger.debug('Skipping user consent check due to --userWarning=false');
91+
saveUserConsent();
8492
}
8593

8694
const tokenTracker = new TokenTracker(

packages/cli/src/options.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,8 @@ export type SharedOptions = {
1616
readonly enableUserPrompt?: boolean;
1717
readonly userPrompt?: boolean;
1818
readonly githubMode?: boolean;
19+
readonly userWarning?: boolean;
20+
readonly upgradeCheck?: boolean;
1921
};
2022

2123
export const sharedOptions = {
@@ -107,4 +109,14 @@ export const sharedOptions = {
107109
description: 'Enable GitHub mode for working with issues and PRs',
108110
default: false,
109111
} as const,
112+
userWarning: {
113+
type: 'boolean',
114+
description: 'Disable user consent check (for automated/remote usage)',
115+
default: false,
116+
} as const,
117+
upgradeCheck: {
118+
type: 'boolean',
119+
description: 'Disable version upgrade check (for automated/remote usage)',
120+
default: false,
121+
} as const,
110122
};

0 commit comments

Comments
 (0)