Skip to content

Commit 2c7104e

Browse files
authored
Merge pull request #171 from drivecore/feat/cli-automated-options
feat: add CLI options for automated usage scenarios
2 parents e236289 + 41cf69d commit 2c7104e

File tree

5 files changed

+47
-12
lines changed

5 files changed

+47
-12
lines changed

CHANGELOG.md

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,19 @@
11
# [0.8.0](https://github.com/drivecore/mycoder/compare/v0.7.0...v0.8.0) (2025-03-11)
22

3-
43
### Features
54

6-
* add --githubMode and --userPrompt as boolean CLI options that override config settings ([0390f94](https://github.com/drivecore/mycoder/commit/0390f94651e40de93a8cb9486a056a0b9cb2e165))
7-
* remove modelProvider and modelName - instant decrepation ([59834dc](https://github.com/drivecore/mycoder/commit/59834dcf932051a5c75624bd6f6ab12254f43769))
5+
- add --githubMode and --userPrompt as boolean CLI options that override config settings ([0390f94](https://github.com/drivecore/mycoder/commit/0390f94651e40de93a8cb9486a056a0b9cb2e165))
6+
- remove modelProvider and modelName - instant decrepation ([59834dc](https://github.com/drivecore/mycoder/commit/59834dcf932051a5c75624bd6f6ab12254f43769))
87

98
# [0.7.0](https://github.com/drivecore/mycoder/compare/v0.6.1...v0.7.0) (2025-03-10)
109

11-
1210
### Bug Fixes
1311

14-
* change where anthropic key is declared ([f6f72d3](https://github.com/drivecore/mycoder/commit/f6f72d3bc18a65fc775151cd375398aba230a06f))
15-
* ensure npm publish only happens on release branch ([ec352d6](https://github.com/drivecore/mycoder/commit/ec352d6956c717726ef388a07d88372c12b634a6))
16-
12+
- change where anthropic key is declared ([f6f72d3](https://github.com/drivecore/mycoder/commit/f6f72d3bc18a65fc775151cd375398aba230a06f))
13+
- ensure npm publish only happens on release branch ([ec352d6](https://github.com/drivecore/mycoder/commit/ec352d6956c717726ef388a07d88372c12b634a6))
1714

1815
### Features
1916

20-
* add GitHub Action for issue comment commands ([136950f](https://github.com/drivecore/mycoder/commit/136950f4bd6d14e544bbd415ed313f7842a9b9a2)), closes [#162](https://github.com/drivecore/mycoder/issues/162)
21-
* allow for generic /mycoder commands ([4b6608e](https://github.com/drivecore/mycoder/commit/4b6608e0b8e5f408eb5f12fe891657a5fb25bdb4))
22-
* **release:** implement conventional commits approach ([5878dd1](https://github.com/drivecore/mycoder/commit/5878dd1a56004eb8a994d40416d759553b022eb8)), closes [#140](https://github.com/drivecore/mycoder/issues/140)
17+
- add GitHub Action for issue comment commands ([136950f](https://github.com/drivecore/mycoder/commit/136950f4bd6d14e544bbd415ed313f7842a9b9a2)), closes [#162](https://github.com/drivecore/mycoder/issues/162)
18+
- allow for generic /mycoder commands ([4b6608e](https://github.com/drivecore/mycoder/commit/4b6608e0b8e5f408eb5f12fe891657a5fb25bdb4))
19+
- **release:** implement conventional commits approach ([5878dd1](https://github.com/drivecore/mycoder/commit/5878dd1a56004eb8a994d40416d759553b022eb8)), closes [#140](https://github.com/drivecore/mycoder/issues/140)

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`: Skip user consent check for current session without saving consent (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+
// Just skip the consent check without saving consent when userWarning is false
90+
logger.debug('Skipping user consent check due to --userWarning=false');
91+
// Note: We don't save consent here, just bypassing the check for this session
8492
}
8593

8694
const tokenTracker = new TokenTracker(

packages/cli/src/options.ts

Lines changed: 13 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,15 @@ 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:
115+
'Skip user consent check for current session (does not save consent)',
116+
default: false,
117+
} as const,
118+
upgradeCheck: {
119+
type: 'boolean',
120+
description: 'Disable version upgrade check (for automated/remote usage)',
121+
default: false,
122+
} as const,
110123
};

0 commit comments

Comments
 (0)