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,546 @@
|
|
|
1
|
+
# CLI Distribution
|
|
2
|
+
|
|
3
|
+
Patterns for packaging, versioning, and distributing command-line tools.
|
|
4
|
+
|
|
5
|
+
## Versioning
|
|
6
|
+
|
|
7
|
+
### Semantic Versioning
|
|
8
|
+
|
|
9
|
+
Follow SemVer (MAJOR.MINOR.PATCH):
|
|
10
|
+
|
|
11
|
+
- **MAJOR**: Breaking changes to CLI interface
|
|
12
|
+
- **MINOR**: New commands, flags, or features (backward compatible)
|
|
13
|
+
- **PATCH**: Bug fixes (backward compatible)
|
|
14
|
+
|
|
15
|
+
### Version Information
|
|
16
|
+
|
|
17
|
+
Include comprehensive version output:
|
|
18
|
+
|
|
19
|
+
```go
|
|
20
|
+
// Go: Version command
|
|
21
|
+
var (
|
|
22
|
+
version = "dev"
|
|
23
|
+
commit = "none"
|
|
24
|
+
date = "unknown"
|
|
25
|
+
builtBy = "unknown"
|
|
26
|
+
)
|
|
27
|
+
|
|
28
|
+
var versionCmd = &cobra.Command{
|
|
29
|
+
Use: "version",
|
|
30
|
+
Short: "Print version information",
|
|
31
|
+
Run: func(cmd *cobra.Command, args []string) {
|
|
32
|
+
fmt.Printf("mytool %s\n", version)
|
|
33
|
+
fmt.Printf(" commit: %s\n", commit)
|
|
34
|
+
fmt.Printf(" built: %s\n", date)
|
|
35
|
+
fmt.Printf(" by: %s\n", builtBy)
|
|
36
|
+
fmt.Printf(" go: %s\n", runtime.Version())
|
|
37
|
+
},
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
// Build with ldflags
|
|
41
|
+
// go build -ldflags "-X main.version=1.0.0 -X main.commit=$(git rev-parse HEAD)"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
```typescript
|
|
45
|
+
// TypeScript: Version from package.json
|
|
46
|
+
import { readFileSync } from 'fs';
|
|
47
|
+
import { join } from 'path';
|
|
48
|
+
|
|
49
|
+
const pkg = JSON.parse(
|
|
50
|
+
readFileSync(join(__dirname, '../package.json'), 'utf-8')
|
|
51
|
+
);
|
|
52
|
+
|
|
53
|
+
program
|
|
54
|
+
.version(pkg.version, '-V, --version', 'output version number')
|
|
55
|
+
.action(() => {
|
|
56
|
+
console.log(`mytool ${pkg.version}`);
|
|
57
|
+
console.log(` node: ${process.version}`);
|
|
58
|
+
});
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
## Packaging
|
|
62
|
+
|
|
63
|
+
### Node.js / npm
|
|
64
|
+
|
|
65
|
+
```json
|
|
66
|
+
// package.json
|
|
67
|
+
{
|
|
68
|
+
"name": "mytool",
|
|
69
|
+
"version": "1.0.0",
|
|
70
|
+
"description": "A CLI tool",
|
|
71
|
+
"bin": {
|
|
72
|
+
"mytool": "./bin/cli.js"
|
|
73
|
+
},
|
|
74
|
+
"files": [
|
|
75
|
+
"bin",
|
|
76
|
+
"dist",
|
|
77
|
+
"README.md"
|
|
78
|
+
],
|
|
79
|
+
"engines": {
|
|
80
|
+
"node": ">=18.0.0"
|
|
81
|
+
},
|
|
82
|
+
"publishConfig": {
|
|
83
|
+
"access": "public"
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
```javascript
|
|
89
|
+
// bin/cli.js
|
|
90
|
+
#!/usr/bin/env node
|
|
91
|
+
import '../dist/index.js';
|
|
92
|
+
```
|
|
93
|
+
|
|
94
|
+
```bash
|
|
95
|
+
# Publishing
|
|
96
|
+
npm version patch # Bump version
|
|
97
|
+
npm publish
|
|
98
|
+
```
|
|
99
|
+
|
|
100
|
+
### Go
|
|
101
|
+
|
|
102
|
+
```go
|
|
103
|
+
// Build for multiple platforms
|
|
104
|
+
// Makefile
|
|
105
|
+
BINARY_NAME=mytool
|
|
106
|
+
VERSION=$(shell git describe --tags --always --dirty)
|
|
107
|
+
LDFLAGS=-ldflags "-X main.version=$(VERSION)"
|
|
108
|
+
|
|
109
|
+
build:
|
|
110
|
+
go build $(LDFLAGS) -o $(BINARY_NAME) .
|
|
111
|
+
|
|
112
|
+
build-all:
|
|
113
|
+
GOOS=linux GOARCH=amd64 go build $(LDFLAGS) -o dist/$(BINARY_NAME)-linux-amd64 .
|
|
114
|
+
GOOS=linux GOARCH=arm64 go build $(LDFLAGS) -o dist/$(BINARY_NAME)-linux-arm64 .
|
|
115
|
+
GOOS=darwin GOARCH=amd64 go build $(LDFLAGS) -o dist/$(BINARY_NAME)-darwin-amd64 .
|
|
116
|
+
GOOS=darwin GOARCH=arm64 go build $(LDFLAGS) -o dist/$(BINARY_NAME)-darwin-arm64 .
|
|
117
|
+
GOOS=windows GOARCH=amd64 go build $(LDFLAGS) -o dist/$(BINARY_NAME)-windows-amd64.exe .
|
|
118
|
+
|
|
119
|
+
release: build-all
|
|
120
|
+
# Create checksums
|
|
121
|
+
cd dist && shasum -a 256 * > checksums.txt
|
|
122
|
+
```
|
|
123
|
+
|
|
124
|
+
### Using GoReleaser
|
|
125
|
+
|
|
126
|
+
```yaml
|
|
127
|
+
# .goreleaser.yaml
|
|
128
|
+
version: 2
|
|
129
|
+
|
|
130
|
+
builds:
|
|
131
|
+
- main: ./cmd/mytool
|
|
132
|
+
binary: mytool
|
|
133
|
+
env:
|
|
134
|
+
- CGO_ENABLED=0
|
|
135
|
+
goos:
|
|
136
|
+
- linux
|
|
137
|
+
- darwin
|
|
138
|
+
- windows
|
|
139
|
+
goarch:
|
|
140
|
+
- amd64
|
|
141
|
+
- arm64
|
|
142
|
+
ldflags:
|
|
143
|
+
- -s -w
|
|
144
|
+
- -X main.version={{.Version}}
|
|
145
|
+
- -X main.commit={{.Commit}}
|
|
146
|
+
- -X main.date={{.Date}}
|
|
147
|
+
|
|
148
|
+
archives:
|
|
149
|
+
- format: tar.gz
|
|
150
|
+
name_template: "{{ .ProjectName }}_{{ .Version }}_{{ .Os }}_{{ .Arch }}"
|
|
151
|
+
format_overrides:
|
|
152
|
+
- goos: windows
|
|
153
|
+
format: zip
|
|
154
|
+
|
|
155
|
+
checksum:
|
|
156
|
+
name_template: 'checksums.txt'
|
|
157
|
+
|
|
158
|
+
changelog:
|
|
159
|
+
sort: asc
|
|
160
|
+
filters:
|
|
161
|
+
exclude:
|
|
162
|
+
- '^docs:'
|
|
163
|
+
- '^test:'
|
|
164
|
+
|
|
165
|
+
brews:
|
|
166
|
+
- repository:
|
|
167
|
+
owner: myorg
|
|
168
|
+
name: homebrew-tap
|
|
169
|
+
homepage: https://github.com/myorg/mytool
|
|
170
|
+
description: A CLI tool
|
|
171
|
+
license: MIT
|
|
172
|
+
install: |
|
|
173
|
+
bin.install "mytool"
|
|
174
|
+
# Install shell completions
|
|
175
|
+
bash_completion.install "completions/mytool.bash" => "mytool"
|
|
176
|
+
zsh_completion.install "completions/mytool.zsh" => "_mytool"
|
|
177
|
+
```
|
|
178
|
+
|
|
179
|
+
### Python with PyPI
|
|
180
|
+
|
|
181
|
+
```toml
|
|
182
|
+
# pyproject.toml
|
|
183
|
+
[build-system]
|
|
184
|
+
requires = ["setuptools>=61.0", "wheel"]
|
|
185
|
+
build-backend = "setuptools.build_meta"
|
|
186
|
+
|
|
187
|
+
[project]
|
|
188
|
+
name = "mytool"
|
|
189
|
+
version = "1.0.0"
|
|
190
|
+
description = "A CLI tool"
|
|
191
|
+
readme = "README.md"
|
|
192
|
+
requires-python = ">=3.10"
|
|
193
|
+
dependencies = [
|
|
194
|
+
"click>=8.0",
|
|
195
|
+
"rich>=13.0",
|
|
196
|
+
]
|
|
197
|
+
|
|
198
|
+
[project.scripts]
|
|
199
|
+
mytool = "mytool.cli:main"
|
|
200
|
+
|
|
201
|
+
[project.optional-dependencies]
|
|
202
|
+
dev = [
|
|
203
|
+
"pytest>=7.0",
|
|
204
|
+
"black",
|
|
205
|
+
"mypy",
|
|
206
|
+
]
|
|
207
|
+
```
|
|
208
|
+
|
|
209
|
+
```bash
|
|
210
|
+
# Publishing
|
|
211
|
+
python -m build
|
|
212
|
+
python -m twine upload dist/*
|
|
213
|
+
```
|
|
214
|
+
|
|
215
|
+
## Installation Methods
|
|
216
|
+
|
|
217
|
+
### Direct Download
|
|
218
|
+
|
|
219
|
+
```bash
|
|
220
|
+
# Installation script
|
|
221
|
+
#!/bin/bash
|
|
222
|
+
set -e
|
|
223
|
+
|
|
224
|
+
VERSION="1.0.0"
|
|
225
|
+
OS=$(uname -s | tr '[:upper:]' '[:lower:]')
|
|
226
|
+
ARCH=$(uname -m)
|
|
227
|
+
|
|
228
|
+
case $ARCH in
|
|
229
|
+
x86_64) ARCH="amd64" ;;
|
|
230
|
+
aarch64) ARCH="arm64" ;;
|
|
231
|
+
esac
|
|
232
|
+
|
|
233
|
+
URL="https://github.com/myorg/mytool/releases/download/v${VERSION}/mytool_${VERSION}_${OS}_${ARCH}.tar.gz"
|
|
234
|
+
|
|
235
|
+
echo "Downloading mytool v${VERSION}..."
|
|
236
|
+
curl -sL "$URL" | tar xz -C /tmp
|
|
237
|
+
|
|
238
|
+
echo "Installing to /usr/local/bin..."
|
|
239
|
+
sudo mv /tmp/mytool /usr/local/bin/
|
|
240
|
+
|
|
241
|
+
echo "Done! Run 'mytool --version' to verify."
|
|
242
|
+
```
|
|
243
|
+
|
|
244
|
+
### Package Managers
|
|
245
|
+
|
|
246
|
+
```bash
|
|
247
|
+
# Homebrew (macOS/Linux)
|
|
248
|
+
brew install myorg/tap/mytool
|
|
249
|
+
|
|
250
|
+
# npm (Node.js)
|
|
251
|
+
npm install -g mytool
|
|
252
|
+
|
|
253
|
+
# pip (Python)
|
|
254
|
+
pip install mytool
|
|
255
|
+
|
|
256
|
+
# Cargo (Rust)
|
|
257
|
+
cargo install mytool
|
|
258
|
+
|
|
259
|
+
# Go
|
|
260
|
+
go install github.com/myorg/mytool@latest
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
### Docker
|
|
264
|
+
|
|
265
|
+
```dockerfile
|
|
266
|
+
# Dockerfile
|
|
267
|
+
FROM golang:1.22-alpine AS builder
|
|
268
|
+
WORKDIR /app
|
|
269
|
+
COPY . .
|
|
270
|
+
RUN go build -o mytool .
|
|
271
|
+
|
|
272
|
+
FROM alpine:latest
|
|
273
|
+
RUN apk --no-cache add ca-certificates
|
|
274
|
+
COPY --from=builder /app/mytool /usr/local/bin/
|
|
275
|
+
ENTRYPOINT ["mytool"]
|
|
276
|
+
```
|
|
277
|
+
|
|
278
|
+
```bash
|
|
279
|
+
# Usage
|
|
280
|
+
docker run --rm -v $(pwd):/workspace myorg/mytool build /workspace
|
|
281
|
+
```
|
|
282
|
+
|
|
283
|
+
## Update Mechanisms
|
|
284
|
+
|
|
285
|
+
### Self-Update Command
|
|
286
|
+
|
|
287
|
+
```go
|
|
288
|
+
// Go: Self-update using GitHub releases
|
|
289
|
+
var updateCmd = &cobra.Command{
|
|
290
|
+
Use: "update",
|
|
291
|
+
Short: "Update to the latest version",
|
|
292
|
+
RunE: func(cmd *cobra.Command, args []string) error {
|
|
293
|
+
// Check current version
|
|
294
|
+
current := version
|
|
295
|
+
|
|
296
|
+
// Fetch latest release
|
|
297
|
+
latest, err := getLatestRelease("myorg", "mytool")
|
|
298
|
+
if err != nil {
|
|
299
|
+
return fmt.Errorf("check for updates: %w", err)
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
if latest.Version == current {
|
|
303
|
+
fmt.Println("Already up to date!")
|
|
304
|
+
return nil
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
fmt.Printf("Updating from %s to %s...\n", current, latest.Version)
|
|
308
|
+
|
|
309
|
+
// Download and replace binary
|
|
310
|
+
if err := downloadAndInstall(latest); err != nil {
|
|
311
|
+
return fmt.Errorf("update: %w", err)
|
|
312
|
+
}
|
|
313
|
+
|
|
314
|
+
fmt.Println("Update complete!")
|
|
315
|
+
return nil
|
|
316
|
+
},
|
|
317
|
+
}
|
|
318
|
+
```
|
|
319
|
+
|
|
320
|
+
### Update Check on Startup
|
|
321
|
+
|
|
322
|
+
```go
|
|
323
|
+
// Go: Check for updates (non-blocking)
|
|
324
|
+
func checkForUpdatesAsync() {
|
|
325
|
+
go func() {
|
|
326
|
+
latest, err := getLatestRelease("myorg", "mytool")
|
|
327
|
+
if err != nil {
|
|
328
|
+
return // Silently fail
|
|
329
|
+
}
|
|
330
|
+
|
|
331
|
+
if semver.Compare(latest.Version, version) > 0 {
|
|
332
|
+
fmt.Fprintf(os.Stderr,
|
|
333
|
+
"\nA new version of mytool is available: %s (current: %s)\n"+
|
|
334
|
+
"Run 'mytool update' to upgrade.\n\n",
|
|
335
|
+
latest.Version, version)
|
|
336
|
+
}
|
|
337
|
+
}()
|
|
338
|
+
}
|
|
339
|
+
|
|
340
|
+
func main() {
|
|
341
|
+
// Only check for updates in TTY and not too frequently
|
|
342
|
+
if shouldCheckUpdates() {
|
|
343
|
+
checkForUpdatesAsync()
|
|
344
|
+
}
|
|
345
|
+
rootCmd.Execute()
|
|
346
|
+
}
|
|
347
|
+
```
|
|
348
|
+
|
|
349
|
+
## Shell Completions Distribution
|
|
350
|
+
|
|
351
|
+
### Generate During Build
|
|
352
|
+
|
|
353
|
+
```bash
|
|
354
|
+
# Makefile
|
|
355
|
+
completions:
|
|
356
|
+
mkdir -p completions
|
|
357
|
+
./mytool completion bash > completions/mytool.bash
|
|
358
|
+
./mytool completion zsh > completions/_mytool
|
|
359
|
+
./mytool completion fish > completions/mytool.fish
|
|
360
|
+
```
|
|
361
|
+
|
|
362
|
+
### Installation Instructions
|
|
363
|
+
|
|
364
|
+
```markdown
|
|
365
|
+
# Shell Completions
|
|
366
|
+
|
|
367
|
+
## Bash
|
|
368
|
+
|
|
369
|
+
Add to your `~/.bashrc`:
|
|
370
|
+
|
|
371
|
+
```bash
|
|
372
|
+
source <(mytool completion bash)
|
|
373
|
+
```
|
|
374
|
+
|
|
375
|
+
Or install system-wide:
|
|
376
|
+
|
|
377
|
+
```bash
|
|
378
|
+
mytool completion bash > /etc/bash_completion.d/mytool
|
|
379
|
+
```
|
|
380
|
+
|
|
381
|
+
## Zsh
|
|
382
|
+
|
|
383
|
+
Add to your `~/.zshrc`:
|
|
384
|
+
|
|
385
|
+
```zsh
|
|
386
|
+
source <(mytool completion zsh)
|
|
387
|
+
```
|
|
388
|
+
|
|
389
|
+
Or install to fpath:
|
|
390
|
+
|
|
391
|
+
```zsh
|
|
392
|
+
mytool completion zsh > "${fpath[1]}/_mytool"
|
|
393
|
+
```
|
|
394
|
+
|
|
395
|
+
## Fish
|
|
396
|
+
|
|
397
|
+
```fish
|
|
398
|
+
mytool completion fish > ~/.config/fish/completions/mytool.fish
|
|
399
|
+
```
|
|
400
|
+
```
|
|
401
|
+
|
|
402
|
+
## Documentation
|
|
403
|
+
|
|
404
|
+
### Man Pages
|
|
405
|
+
|
|
406
|
+
```go
|
|
407
|
+
// Go with Cobra: Generate man pages
|
|
408
|
+
import "github.com/spf13/cobra/doc"
|
|
409
|
+
|
|
410
|
+
func generateManPages() error {
|
|
411
|
+
header := &doc.GenManHeader{
|
|
412
|
+
Title: "MYTOOL",
|
|
413
|
+
Section: "1",
|
|
414
|
+
}
|
|
415
|
+
return doc.GenManTree(rootCmd, header, "./man")
|
|
416
|
+
}
|
|
417
|
+
```
|
|
418
|
+
|
|
419
|
+
### README Structure
|
|
420
|
+
|
|
421
|
+
```markdown
|
|
422
|
+
# mytool
|
|
423
|
+
|
|
424
|
+
Brief description of what the tool does.
|
|
425
|
+
|
|
426
|
+
## Installation
|
|
427
|
+
|
|
428
|
+
```bash
|
|
429
|
+
# macOS
|
|
430
|
+
brew install myorg/tap/mytool
|
|
431
|
+
|
|
432
|
+
# Linux
|
|
433
|
+
curl -fsSL https://example.com/install.sh | bash
|
|
434
|
+
|
|
435
|
+
# npm
|
|
436
|
+
npm install -g mytool
|
|
437
|
+
```
|
|
438
|
+
|
|
439
|
+
## Quick Start
|
|
440
|
+
|
|
441
|
+
```bash
|
|
442
|
+
# Initialize a new project
|
|
443
|
+
mytool init my-project
|
|
444
|
+
|
|
445
|
+
# Build the project
|
|
446
|
+
mytool build
|
|
447
|
+
|
|
448
|
+
# Deploy to production
|
|
449
|
+
mytool deploy --env prod
|
|
450
|
+
```
|
|
451
|
+
|
|
452
|
+
## Commands
|
|
453
|
+
|
|
454
|
+
| Command | Description |
|
|
455
|
+
|---------|-------------|
|
|
456
|
+
| `init` | Initialize a new project |
|
|
457
|
+
| `build` | Build the project |
|
|
458
|
+
| `deploy` | Deploy to environment |
|
|
459
|
+
| `config` | Manage configuration |
|
|
460
|
+
|
|
461
|
+
## Configuration
|
|
462
|
+
|
|
463
|
+
Create a `.mytool.yaml` file:
|
|
464
|
+
|
|
465
|
+
```yaml
|
|
466
|
+
output: dist
|
|
467
|
+
verbose: false
|
|
468
|
+
plugins:
|
|
469
|
+
- typescript
|
|
470
|
+
```
|
|
471
|
+
|
|
472
|
+
## Environment Variables
|
|
473
|
+
|
|
474
|
+
| Variable | Description | Default |
|
|
475
|
+
|----------|-------------|---------|
|
|
476
|
+
| `MYTOOL_OUTPUT` | Output directory | `dist` |
|
|
477
|
+
| `MYTOOL_VERBOSE` | Enable verbose output | `false` |
|
|
478
|
+
|
|
479
|
+
## License
|
|
480
|
+
|
|
481
|
+
MIT
|
|
482
|
+
```
|
|
483
|
+
|
|
484
|
+
## CI/CD for Releases
|
|
485
|
+
|
|
486
|
+
### GitHub Actions
|
|
487
|
+
|
|
488
|
+
```yaml
|
|
489
|
+
# .github/workflows/release.yml
|
|
490
|
+
name: Release
|
|
491
|
+
|
|
492
|
+
on:
|
|
493
|
+
push:
|
|
494
|
+
tags:
|
|
495
|
+
- 'v*'
|
|
496
|
+
|
|
497
|
+
jobs:
|
|
498
|
+
release:
|
|
499
|
+
runs-on: ubuntu-latest
|
|
500
|
+
steps:
|
|
501
|
+
- uses: actions/checkout@v4
|
|
502
|
+
with:
|
|
503
|
+
fetch-depth: 0
|
|
504
|
+
|
|
505
|
+
- name: Set up Go
|
|
506
|
+
uses: actions/setup-go@v5
|
|
507
|
+
with:
|
|
508
|
+
go-version: '1.22'
|
|
509
|
+
|
|
510
|
+
- name: Run GoReleaser
|
|
511
|
+
uses: goreleaser/goreleaser-action@v5
|
|
512
|
+
with:
|
|
513
|
+
version: latest
|
|
514
|
+
args: release --clean
|
|
515
|
+
env:
|
|
516
|
+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
517
|
+
```
|
|
518
|
+
|
|
519
|
+
### npm Publishing
|
|
520
|
+
|
|
521
|
+
```yaml
|
|
522
|
+
# .github/workflows/publish.yml
|
|
523
|
+
name: Publish to npm
|
|
524
|
+
|
|
525
|
+
on:
|
|
526
|
+
release:
|
|
527
|
+
types: [created]
|
|
528
|
+
|
|
529
|
+
jobs:
|
|
530
|
+
publish:
|
|
531
|
+
runs-on: ubuntu-latest
|
|
532
|
+
steps:
|
|
533
|
+
- uses: actions/checkout@v4
|
|
534
|
+
|
|
535
|
+
- name: Setup Node.js
|
|
536
|
+
uses: actions/setup-node@v4
|
|
537
|
+
with:
|
|
538
|
+
node-version: '20'
|
|
539
|
+
registry-url: 'https://registry.npmjs.org'
|
|
540
|
+
|
|
541
|
+
- run: npm ci
|
|
542
|
+
- run: npm run build
|
|
543
|
+
- run: npm publish
|
|
544
|
+
env:
|
|
545
|
+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
|
|
546
|
+
```
|