agentic-team-templates 0.3.0
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/README.md +280 -0
- package/bin/cli.js +5 -0
- package/package.json +47 -0
- package/src/index.js +521 -0
- package/templates/_shared/code-quality.md +162 -0
- package/templates/_shared/communication.md +114 -0
- package/templates/_shared/core-principles.md +62 -0
- package/templates/_shared/git-workflow.md +165 -0
- package/templates/_shared/security-fundamentals.md +173 -0
- package/templates/blockchain/.cursorrules/defi-patterns.md +520 -0
- package/templates/blockchain/.cursorrules/gas-optimization.md +339 -0
- package/templates/blockchain/.cursorrules/overview.md +130 -0
- package/templates/blockchain/.cursorrules/security.md +318 -0
- package/templates/blockchain/.cursorrules/smart-contracts.md +364 -0
- package/templates/blockchain/.cursorrules/testing.md +415 -0
- package/templates/blockchain/.cursorrules/web3-integration.md +538 -0
- package/templates/blockchain/CLAUDE.md +389 -0
- package/templates/cli-tools/.cursorrules/architecture.md +412 -0
- package/templates/cli-tools/.cursorrules/arguments.md +406 -0
- package/templates/cli-tools/.cursorrules/distribution.md +546 -0
- package/templates/cli-tools/.cursorrules/error-handling.md +455 -0
- package/templates/cli-tools/.cursorrules/overview.md +136 -0
- package/templates/cli-tools/.cursorrules/testing.md +537 -0
- package/templates/cli-tools/.cursorrules/user-experience.md +545 -0
- package/templates/cli-tools/CLAUDE.md +356 -0
- package/templates/data-engineering/.cursorrules/data-modeling.md +367 -0
- package/templates/data-engineering/.cursorrules/data-quality.md +455 -0
- package/templates/data-engineering/.cursorrules/overview.md +85 -0
- package/templates/data-engineering/.cursorrules/performance.md +339 -0
- package/templates/data-engineering/.cursorrules/pipeline-design.md +280 -0
- package/templates/data-engineering/.cursorrules/security.md +460 -0
- package/templates/data-engineering/.cursorrules/testing.md +452 -0
- package/templates/data-engineering/CLAUDE.md +974 -0
- package/templates/devops-sre/.cursorrules/capacity-planning.md +653 -0
- package/templates/devops-sre/.cursorrules/change-management.md +584 -0
- package/templates/devops-sre/.cursorrules/chaos-engineering.md +651 -0
- package/templates/devops-sre/.cursorrules/disaster-recovery.md +641 -0
- package/templates/devops-sre/.cursorrules/incident-management.md +565 -0
- package/templates/devops-sre/.cursorrules/observability.md +714 -0
- package/templates/devops-sre/.cursorrules/overview.md +230 -0
- package/templates/devops-sre/.cursorrules/postmortems.md +588 -0
- package/templates/devops-sre/.cursorrules/runbooks.md +760 -0
- package/templates/devops-sre/.cursorrules/slo-sli.md +617 -0
- package/templates/devops-sre/.cursorrules/toil-reduction.md +567 -0
- package/templates/devops-sre/CLAUDE.md +1007 -0
- package/templates/documentation/.cursorrules/adr.md +277 -0
- package/templates/documentation/.cursorrules/api-documentation.md +411 -0
- package/templates/documentation/.cursorrules/code-comments.md +253 -0
- package/templates/documentation/.cursorrules/maintenance.md +260 -0
- package/templates/documentation/.cursorrules/overview.md +82 -0
- package/templates/documentation/.cursorrules/readme-standards.md +306 -0
- package/templates/documentation/CLAUDE.md +120 -0
- package/templates/fullstack/.cursorrules/api-contracts.md +331 -0
- package/templates/fullstack/.cursorrules/architecture.md +298 -0
- package/templates/fullstack/.cursorrules/overview.md +109 -0
- package/templates/fullstack/.cursorrules/shared-types.md +348 -0
- package/templates/fullstack/.cursorrules/testing.md +386 -0
- package/templates/fullstack/CLAUDE.md +349 -0
- package/templates/ml-ai/.cursorrules/data-engineering.md +483 -0
- package/templates/ml-ai/.cursorrules/deployment.md +601 -0
- package/templates/ml-ai/.cursorrules/model-development.md +538 -0
- package/templates/ml-ai/.cursorrules/monitoring.md +658 -0
- package/templates/ml-ai/.cursorrules/overview.md +131 -0
- package/templates/ml-ai/.cursorrules/security.md +637 -0
- package/templates/ml-ai/.cursorrules/testing.md +678 -0
- package/templates/ml-ai/CLAUDE.md +1136 -0
- package/templates/mobile/.cursorrules/navigation.md +246 -0
- package/templates/mobile/.cursorrules/offline-first.md +302 -0
- package/templates/mobile/.cursorrules/overview.md +71 -0
- package/templates/mobile/.cursorrules/performance.md +345 -0
- package/templates/mobile/.cursorrules/testing.md +339 -0
- package/templates/mobile/CLAUDE.md +233 -0
- package/templates/platform-engineering/.cursorrules/ci-cd.md +778 -0
- package/templates/platform-engineering/.cursorrules/developer-experience.md +632 -0
- package/templates/platform-engineering/.cursorrules/infrastructure-as-code.md +600 -0
- package/templates/platform-engineering/.cursorrules/kubernetes.md +710 -0
- package/templates/platform-engineering/.cursorrules/observability.md +747 -0
- package/templates/platform-engineering/.cursorrules/overview.md +215 -0
- package/templates/platform-engineering/.cursorrules/security.md +855 -0
- package/templates/platform-engineering/.cursorrules/testing.md +878 -0
- package/templates/platform-engineering/CLAUDE.md +850 -0
- package/templates/utility-agent/.cursorrules/action-control.md +284 -0
- package/templates/utility-agent/.cursorrules/context-management.md +186 -0
- package/templates/utility-agent/.cursorrules/hallucination-prevention.md +253 -0
- package/templates/utility-agent/.cursorrules/overview.md +78 -0
- package/templates/utility-agent/.cursorrules/token-optimization.md +369 -0
- package/templates/utility-agent/CLAUDE.md +513 -0
- package/templates/web-backend/.cursorrules/api-design.md +255 -0
- package/templates/web-backend/.cursorrules/authentication.md +309 -0
- package/templates/web-backend/.cursorrules/database-patterns.md +298 -0
- package/templates/web-backend/.cursorrules/error-handling.md +366 -0
- package/templates/web-backend/.cursorrules/overview.md +69 -0
- package/templates/web-backend/.cursorrules/security.md +358 -0
- package/templates/web-backend/.cursorrules/testing.md +395 -0
- package/templates/web-backend/CLAUDE.md +366 -0
- package/templates/web-frontend/.cursorrules/accessibility.md +296 -0
- package/templates/web-frontend/.cursorrules/component-patterns.md +204 -0
- package/templates/web-frontend/.cursorrules/overview.md +72 -0
- package/templates/web-frontend/.cursorrules/performance.md +325 -0
- package/templates/web-frontend/.cursorrules/state-management.md +227 -0
- package/templates/web-frontend/.cursorrules/styling.md +271 -0
- package/templates/web-frontend/.cursorrules/testing.md +311 -0
- package/templates/web-frontend/CLAUDE.md +399 -0
|
@@ -0,0 +1,406 @@
|
|
|
1
|
+
# Command-Line Arguments
|
|
2
|
+
|
|
3
|
+
Patterns for parsing, validating, and documenting CLI arguments.
|
|
4
|
+
|
|
5
|
+
## Argument Types
|
|
6
|
+
|
|
7
|
+
### Positional Arguments
|
|
8
|
+
|
|
9
|
+
Arguments identified by position, not name:
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
# cp SOURCE DEST
|
|
13
|
+
cp file.txt backup/
|
|
14
|
+
|
|
15
|
+
# git checkout BRANCH
|
|
16
|
+
git checkout main
|
|
17
|
+
```
|
|
18
|
+
|
|
19
|
+
```go
|
|
20
|
+
// Go with Cobra
|
|
21
|
+
var copyCmd = &cobra.Command{
|
|
22
|
+
Use: "copy <source> <dest>",
|
|
23
|
+
Short: "Copy a file",
|
|
24
|
+
Args: cobra.ExactArgs(2),
|
|
25
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
26
|
+
source := args[0]
|
|
27
|
+
dest := args[1]
|
|
28
|
+
return copyFile(source, dest)
|
|
29
|
+
},
|
|
30
|
+
}
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
```typescript
|
|
34
|
+
// TypeScript with Commander
|
|
35
|
+
program
|
|
36
|
+
.command('copy <source> <dest>')
|
|
37
|
+
.description('Copy a file')
|
|
38
|
+
.action((source: string, dest: string) => {
|
|
39
|
+
copyFile(source, dest);
|
|
40
|
+
});
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
### Optional Positional Arguments
|
|
44
|
+
|
|
45
|
+
```go
|
|
46
|
+
// Go: Optional with default
|
|
47
|
+
var buildCmd = &cobra.Command{
|
|
48
|
+
Use: "build [path]",
|
|
49
|
+
Short: "Build the project",
|
|
50
|
+
Args: cobra.MaximumNArgs(1),
|
|
51
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
52
|
+
path := "." // Default
|
|
53
|
+
if len(args) > 0 {
|
|
54
|
+
path = args[0]
|
|
55
|
+
}
|
|
56
|
+
return runBuild(path)
|
|
57
|
+
},
|
|
58
|
+
}
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
```typescript
|
|
62
|
+
// TypeScript: Optional argument
|
|
63
|
+
program
|
|
64
|
+
.command('build [path]')
|
|
65
|
+
.description('Build the project')
|
|
66
|
+
.action((path: string = '.') => {
|
|
67
|
+
runBuild(path);
|
|
68
|
+
});
|
|
69
|
+
```
|
|
70
|
+
|
|
71
|
+
### Variadic Arguments
|
|
72
|
+
|
|
73
|
+
Accept multiple values:
|
|
74
|
+
|
|
75
|
+
```bash
|
|
76
|
+
# rm file1.txt file2.txt file3.txt
|
|
77
|
+
rm *.txt
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
```go
|
|
81
|
+
// Go: One or more arguments
|
|
82
|
+
var deleteCmd = &cobra.Command{
|
|
83
|
+
Use: "delete <file>...",
|
|
84
|
+
Short: "Delete files",
|
|
85
|
+
Args: cobra.MinimumNArgs(1),
|
|
86
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
87
|
+
for _, file := range args {
|
|
88
|
+
if err := deleteFile(file); err != nil {
|
|
89
|
+
return err
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return nil
|
|
93
|
+
},
|
|
94
|
+
}
|
|
95
|
+
```
|
|
96
|
+
|
|
97
|
+
## Flags and Options
|
|
98
|
+
|
|
99
|
+
### Boolean Flags
|
|
100
|
+
|
|
101
|
+
```go
|
|
102
|
+
// Go
|
|
103
|
+
cmd.Flags().BoolP("verbose", "v", false, "enable verbose output")
|
|
104
|
+
cmd.Flags().Bool("dry-run", false, "show what would be done")
|
|
105
|
+
cmd.Flags().Bool("force", false, "skip confirmation prompts")
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
```typescript
|
|
109
|
+
// TypeScript
|
|
110
|
+
program
|
|
111
|
+
.option('-v, --verbose', 'enable verbose output')
|
|
112
|
+
.option('--dry-run', 'show what would be done')
|
|
113
|
+
.option('-f, --force', 'skip confirmation prompts');
|
|
114
|
+
```
|
|
115
|
+
|
|
116
|
+
### Value Flags
|
|
117
|
+
|
|
118
|
+
```go
|
|
119
|
+
// Go
|
|
120
|
+
cmd.Flags().StringP("output", "o", "dist", "output directory")
|
|
121
|
+
cmd.Flags().IntP("port", "p", 8080, "server port")
|
|
122
|
+
cmd.Flags().StringSlice("tags", []string{}, "tags to apply")
|
|
123
|
+
cmd.Flags().StringToString("env", map[string]string{}, "environment variables")
|
|
124
|
+
```
|
|
125
|
+
|
|
126
|
+
```typescript
|
|
127
|
+
// TypeScript
|
|
128
|
+
program
|
|
129
|
+
.option('-o, --output <dir>', 'output directory', 'dist')
|
|
130
|
+
.option('-p, --port <number>', 'server port', '8080')
|
|
131
|
+
.option('--tags <tags...>', 'tags to apply')
|
|
132
|
+
.option('--env <key=value...>', 'environment variables');
|
|
133
|
+
```
|
|
134
|
+
|
|
135
|
+
### Required Flags
|
|
136
|
+
|
|
137
|
+
```go
|
|
138
|
+
// Go
|
|
139
|
+
cmd.Flags().String("api-key", "", "API key (required)")
|
|
140
|
+
cmd.MarkFlagRequired("api-key")
|
|
141
|
+
```
|
|
142
|
+
|
|
143
|
+
```typescript
|
|
144
|
+
// TypeScript with Commander
|
|
145
|
+
program
|
|
146
|
+
.requiredOption('--api-key <key>', 'API key');
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
### Mutually Exclusive Flags
|
|
150
|
+
|
|
151
|
+
```go
|
|
152
|
+
// Go with Cobra
|
|
153
|
+
cmd.Flags().String("file", "", "read from file")
|
|
154
|
+
cmd.Flags().Bool("stdin", false, "read from stdin")
|
|
155
|
+
cmd.MarkFlagsMutuallyExclusive("file", "stdin")
|
|
156
|
+
```
|
|
157
|
+
|
|
158
|
+
### Flag Groups
|
|
159
|
+
|
|
160
|
+
```go
|
|
161
|
+
// Go: At least one required
|
|
162
|
+
cmd.Flags().String("name", "", "resource name")
|
|
163
|
+
cmd.Flags().String("id", "", "resource ID")
|
|
164
|
+
cmd.MarkFlagsOneRequired("name", "id")
|
|
165
|
+
|
|
166
|
+
// Go: All or none
|
|
167
|
+
cmd.Flags().String("username", "", "username")
|
|
168
|
+
cmd.Flags().String("password", "", "password")
|
|
169
|
+
cmd.MarkFlagsRequiredTogether("username", "password")
|
|
170
|
+
```
|
|
171
|
+
|
|
172
|
+
## Argument Validation
|
|
173
|
+
|
|
174
|
+
### Built-in Validators
|
|
175
|
+
|
|
176
|
+
```go
|
|
177
|
+
// Go Cobra validators
|
|
178
|
+
cobra.NoArgs // No positional arguments allowed
|
|
179
|
+
cobra.ExactArgs(n) // Exactly n arguments
|
|
180
|
+
cobra.MinimumNArgs(n) // At least n arguments
|
|
181
|
+
cobra.MaximumNArgs(n) // At most n arguments
|
|
182
|
+
cobra.RangeArgs(min, max) // Between min and max
|
|
183
|
+
cobra.OnlyValidArgs // Only args from ValidArgs list
|
|
184
|
+
```
|
|
185
|
+
|
|
186
|
+
### Custom Validation
|
|
187
|
+
|
|
188
|
+
```go
|
|
189
|
+
// Go: Custom argument validator
|
|
190
|
+
var runCmd = &cobra.Command{
|
|
191
|
+
Use: "run <environment>",
|
|
192
|
+
Short: "Run in specified environment",
|
|
193
|
+
Args: func(cmd *cobra.Command, args []string) error {
|
|
194
|
+
if len(args) != 1 {
|
|
195
|
+
return fmt.Errorf("requires exactly one argument: environment")
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
validEnvs := []string{"dev", "staging", "prod"}
|
|
199
|
+
env := args[0]
|
|
200
|
+
|
|
201
|
+
for _, valid := range validEnvs {
|
|
202
|
+
if env == valid {
|
|
203
|
+
return nil
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
|
|
207
|
+
return fmt.Errorf("invalid environment %q, must be one of: %v", env, validEnvs)
|
|
208
|
+
},
|
|
209
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
210
|
+
return runInEnvironment(args[0])
|
|
211
|
+
},
|
|
212
|
+
}
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
```typescript
|
|
216
|
+
// TypeScript: Custom validation
|
|
217
|
+
program
|
|
218
|
+
.command('run <environment>')
|
|
219
|
+
.description('Run in specified environment')
|
|
220
|
+
.action((environment: string) => {
|
|
221
|
+
const validEnvs = ['dev', 'staging', 'prod'];
|
|
222
|
+
if (!validEnvs.includes(environment)) {
|
|
223
|
+
console.error(`Invalid environment "${environment}"`);
|
|
224
|
+
console.error(`Must be one of: ${validEnvs.join(', ')}`);
|
|
225
|
+
process.exit(1);
|
|
226
|
+
}
|
|
227
|
+
runInEnvironment(environment);
|
|
228
|
+
});
|
|
229
|
+
```
|
|
230
|
+
|
|
231
|
+
### Flag Value Validation
|
|
232
|
+
|
|
233
|
+
```go
|
|
234
|
+
// Go: Validate flag values
|
|
235
|
+
func validatePort(cmd *cobra.Command, args []string) error {
|
|
236
|
+
port, _ := cmd.Flags().GetInt("port")
|
|
237
|
+
if port < 1 || port > 65535 {
|
|
238
|
+
return fmt.Errorf("port must be between 1 and 65535, got %d", port)
|
|
239
|
+
}
|
|
240
|
+
return nil
|
|
241
|
+
}
|
|
242
|
+
|
|
243
|
+
cmd.PreRunE = validatePort
|
|
244
|
+
```
|
|
245
|
+
|
|
246
|
+
## Help Text
|
|
247
|
+
|
|
248
|
+
### Command Documentation
|
|
249
|
+
|
|
250
|
+
```go
|
|
251
|
+
var buildCmd = &cobra.Command{
|
|
252
|
+
Use: "build [flags] [path]",
|
|
253
|
+
Short: "Build the project", // One line
|
|
254
|
+
Long: `Build compiles the project and outputs artifacts.
|
|
255
|
+
|
|
256
|
+
The build command processes all source files in the specified
|
|
257
|
+
directory (or current directory if not specified) and outputs
|
|
258
|
+
compiled artifacts to the output directory.`,
|
|
259
|
+
Example: ` # Build current directory
|
|
260
|
+
mytool build
|
|
261
|
+
|
|
262
|
+
# Build specific directory with output
|
|
263
|
+
mytool build ./src -o ./dist
|
|
264
|
+
|
|
265
|
+
# Build with minification
|
|
266
|
+
mytool build --minify`,
|
|
267
|
+
}
|
|
268
|
+
```
|
|
269
|
+
|
|
270
|
+
### Flag Documentation
|
|
271
|
+
|
|
272
|
+
```go
|
|
273
|
+
// Include default values and allowed values
|
|
274
|
+
cmd.Flags().StringP("format", "f", "json", "output format (json, yaml, table)")
|
|
275
|
+
cmd.Flags().IntP("timeout", "t", 30, "timeout in seconds (1-300)")
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
### Auto-Generated Help
|
|
279
|
+
|
|
280
|
+
```
|
|
281
|
+
$ mytool build --help
|
|
282
|
+
|
|
283
|
+
Build compiles the project and outputs artifacts.
|
|
284
|
+
|
|
285
|
+
The build command processes all source files in the specified
|
|
286
|
+
directory (or current directory if not specified) and outputs
|
|
287
|
+
compiled artifacts to the output directory.
|
|
288
|
+
|
|
289
|
+
Usage:
|
|
290
|
+
mytool build [flags] [path]
|
|
291
|
+
|
|
292
|
+
Examples:
|
|
293
|
+
# Build current directory
|
|
294
|
+
mytool build
|
|
295
|
+
|
|
296
|
+
# Build specific directory with output
|
|
297
|
+
mytool build ./src -o ./dist
|
|
298
|
+
|
|
299
|
+
# Build with minification
|
|
300
|
+
mytool build --minify
|
|
301
|
+
|
|
302
|
+
Flags:
|
|
303
|
+
-f, --format string output format (json, yaml, table) (default "json")
|
|
304
|
+
-h, --help help for build
|
|
305
|
+
--minify minify output
|
|
306
|
+
-o, --output string output directory (default "dist")
|
|
307
|
+
|
|
308
|
+
Global Flags:
|
|
309
|
+
-v, --verbose verbose output
|
|
310
|
+
--config string config file path
|
|
311
|
+
```
|
|
312
|
+
|
|
313
|
+
## Shell Completion
|
|
314
|
+
|
|
315
|
+
### Generating Completions
|
|
316
|
+
|
|
317
|
+
```go
|
|
318
|
+
// Go with Cobra - built-in completion command
|
|
319
|
+
rootCmd.AddCommand(&cobra.Command{
|
|
320
|
+
Use: "completion [bash|zsh|fish|powershell]",
|
|
321
|
+
Short: "Generate shell completion scripts",
|
|
322
|
+
Args: cobra.ExactArgs(1),
|
|
323
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
324
|
+
switch args[0] {
|
|
325
|
+
case "bash":
|
|
326
|
+
return rootCmd.GenBashCompletion(os.Stdout)
|
|
327
|
+
case "zsh":
|
|
328
|
+
return rootCmd.GenZshCompletion(os.Stdout)
|
|
329
|
+
case "fish":
|
|
330
|
+
return rootCmd.GenFishCompletion(os.Stdout, true)
|
|
331
|
+
case "powershell":
|
|
332
|
+
return rootCmd.GenPowerShellCompletion(os.Stdout)
|
|
333
|
+
default:
|
|
334
|
+
return fmt.Errorf("unknown shell: %s", args[0])
|
|
335
|
+
}
|
|
336
|
+
},
|
|
337
|
+
})
|
|
338
|
+
```
|
|
339
|
+
|
|
340
|
+
### Custom Completions
|
|
341
|
+
|
|
342
|
+
```go
|
|
343
|
+
// Go: Dynamic completions
|
|
344
|
+
var deployCmd = &cobra.Command{
|
|
345
|
+
Use: "deploy <environment>",
|
|
346
|
+
Short: "Deploy to environment",
|
|
347
|
+
ValidArgsFunction: func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
|
348
|
+
if len(args) != 0 {
|
|
349
|
+
return nil, cobra.ShellCompDirectiveNoFileComp
|
|
350
|
+
}
|
|
351
|
+
|
|
352
|
+
// Return available environments
|
|
353
|
+
envs := []string{"dev", "staging", "prod"}
|
|
354
|
+
return envs, cobra.ShellCompDirectiveNoFileComp
|
|
355
|
+
},
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
// Flag value completion
|
|
359
|
+
cmd.RegisterFlagCompletionFunc("format", func(cmd *cobra.Command, args []string, toComplete string) ([]string, cobra.ShellCompDirective) {
|
|
360
|
+
return []string{"json", "yaml", "table"}, cobra.ShellCompDirectiveNoFileComp
|
|
361
|
+
})
|
|
362
|
+
```
|
|
363
|
+
|
|
364
|
+
## Common Conventions
|
|
365
|
+
|
|
366
|
+
### Standard Flags
|
|
367
|
+
|
|
368
|
+
Always support these:
|
|
369
|
+
|
|
370
|
+
| Flag | Purpose |
|
|
371
|
+
|------|---------|
|
|
372
|
+
| `-h, --help` | Show help (usually automatic) |
|
|
373
|
+
| `-v, --verbose` | Increase output verbosity |
|
|
374
|
+
| `-q, --quiet` | Suppress non-essential output |
|
|
375
|
+
| `--version` | Show version information |
|
|
376
|
+
| `--config` | Specify config file path |
|
|
377
|
+
| `--no-color` | Disable colored output |
|
|
378
|
+
| `--dry-run` | Show what would happen |
|
|
379
|
+
| `-f, --force` | Skip confirmations |
|
|
380
|
+
| `-o, --output` | Output file/directory |
|
|
381
|
+
|
|
382
|
+
### Environment Variable Naming
|
|
383
|
+
|
|
384
|
+
```bash
|
|
385
|
+
# Convention: PREFIX_FLAG_NAME
|
|
386
|
+
MYTOOL_VERBOSE=true
|
|
387
|
+
MYTOOL_OUTPUT_DIR=/tmp/build
|
|
388
|
+
MYTOOL_API_KEY=secret
|
|
389
|
+
|
|
390
|
+
# In code
|
|
391
|
+
viper.SetEnvPrefix("MYTOOL")
|
|
392
|
+
viper.AutomaticEnv()
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
### Flag Naming
|
|
396
|
+
|
|
397
|
+
```bash
|
|
398
|
+
# Use kebab-case for multi-word flags
|
|
399
|
+
--output-dir # Good
|
|
400
|
+
--outputDir # Bad (hard to type)
|
|
401
|
+
--output_dir # Bad (inconsistent)
|
|
402
|
+
|
|
403
|
+
# Short flags are single characters
|
|
404
|
+
-o # Good
|
|
405
|
+
-od # Bad (ambiguous)
|
|
406
|
+
```
|