Skip to content

Commit aecbbf9

Browse files
committed
Fix linting errors: errcheck, unused, gosimple, ineffassign
1 parent 2afc64b commit aecbbf9

4,333 files changed

Lines changed: 1025575 additions & 66 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
Binary file not shown.

README.md

Lines changed: 193 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,22 @@ cm marketplace search --gpu
251251
cm marketplace install ml-pytorch
252252
```
253253

254-
### 7. VS Code Integration (`cm code`)
254+
### 7. Instant Sharing (`cm share`)
255+
256+
Generate "One-Click Onboarding" links for your team.
257+
258+
```bash
259+
# Generate a universal clone command
260+
cm share
261+
262+
# Markdown badge for your README
263+
cm share --format markdown
264+
```
265+
266+
Outputs a command like: `cm clone https://github.com/org/repo`. This single command will clone the repo, detect the configuration, and enter the development environment instantly.
267+
268+
### 8. VS Code Integration (`cm code`)
269+
255270

256271
Open your project in VS Code with full DevContainer support.
257272

@@ -263,22 +278,74 @@ cm code
263278
- Launches VS Code with Remote-Containers
264279
- Works with local and remote containers
265280

281+
### 8. Multi-Service Workspaces (`cm workspace`)
282+
283+
Orchestrate complex microservices architectures. `cm` manages the entire lifecycle, including dependency resolution, shared networks, and volume persistence.
284+
285+
**Commands:**
286+
- `cm workspace init`: Initialize a new workspace or add services.
287+
- `cm workspace graph`: Visualize the dependency tree (Topological Sort).
288+
- `cm workspace services`: List all configured services.
289+
- `cm workspace validate`: Check configuration integrity.
290+
291+
**Lifecycle Control:**
292+
- `cm up`: Start all services in dependency order.
293+
- `cm down`: Stop and remove services.
294+
- `cm restart <service>`: Hot-reload a specific service.
295+
- `cm logs <service>`: Stream unified or service-specific logs.
296+
- `cm ps`: View running processes across the workspace.
297+
298+
```yaml
299+
# cm-workspace.yaml example
300+
workspace:
301+
name: my-app
302+
network: bridge
303+
services:
304+
backend:
305+
path: ./backend
306+
exposed_ports: ["8080:8080"]
307+
db:
308+
image: postgres:15
309+
environment:
310+
POSTGRES_PASSWORD: secret
311+
```
312+
313+
### 9. Brownfield Migration (`cm import`)
314+
315+
Migrate existing projects seamlessly. The import engine parses `docker-compose.yml`, performs compatibility analysis, and generates a native CM configuration.
316+
317+
**Workflow:**
318+
1. **Analyze**: `cm import analyze docker-compose.yml`
319+
- Generates a report of supported/unsupported features.
320+
- Checks port conflicts and volume bindings.
321+
2. **Import**: `cm import docker-compose.yml --dry-run`
322+
- Preview the conversion result.
323+
3. **Execute**: `cm import docker-compose.yml`
324+
- create `cm-workspace.yaml` and service definitions.
325+
326+
Supported conversions: Services, Ports, Volumes, Networks, Environment variables.
327+
266328
---
267329

268330
## 🔧 Advanced Features
269331

270332
### DevContainer Features (OCI)
271333

272-
Install additional tools from OCI registries:
334+
Install additional tools from OCI registries with smart local caching.
273335

274336
```bash
275337
# Add Go to your container
276338
cm feature add ghcr.io/devcontainers/features/go
277339
278-
# Add Docker-in-Docker
279-
cm feature add ghcr.io/devcontainers/features/docker-in-docker
340+
# Download and cache a feature locally
341+
cm feature download node
342+
343+
# Manage local cache
344+
cm feature cache
345+
cm feature cache clear
280346
```
281347

348+
282349
### Docker Compose Integration
283350

284351
Seamlessly works with `docker-compose.yml`:
@@ -344,6 +411,84 @@ Detects:
344411
- ⚠️ Sensitive environment variables
345412
- ✅ Suggests Rootless Docker alternatives
346413

414+
### GPU Management (`cm gpu`)
415+
416+
First-class support for AI/ML development. Container-Maker includes a native scheduler to managing GPU resources.
417+
418+
**Features:**
419+
- **Auto-Detection**: Zero-config detection of NVIDIA GPUs via `nvidia-smi`.
420+
- **Hardware Monitoring**: Real-time tracking of VRAM, Temperature, Power Draw, and Utilization.
421+
- **Intelligent Scheduling**:
422+
- *Exclusive Mode*: Lock a GPU for a single high-priority task.
423+
- *Shared Mode*: Allow multiple services to share VRAM.
424+
- *Strategy*: First-fit allocation based on VRAM requirements.
425+
426+
```bash
427+
# List physical GPUs
428+
cm gpu list
429+
430+
# Detailed monitoring dashboard
431+
cm gpu status
432+
433+
# Request resources (blocks until available)
434+
cm gpu allocate training-job --count 2 --vram 16G
435+
```
436+
437+
### Service Mocking (`cm mock`)
438+
439+
Accelerate frontend and microservice development by mocking upstream dependencies.
440+
441+
**Capabilities:**
442+
- **Dynamic Reponses**: Use Go templates to generate JSON based on requests.
443+
- **Latency Injection**: Simulate network jitter and timeouts to test resilience.
444+
- **Contract Verification**: Validate that your real service matches the API contract (OpenAPI/YAML).
445+
- **Quick Mock**: Spin up an instant endpoint without config.
446+
447+
```bash
448+
# Instant mock
449+
cm mock quick /api/status '{"status": "ok"}'
450+
451+
# Full server
452+
cm mock serve mocks.yaml
453+
454+
# Verify contract compliance
455+
cm mock verify --contract api-contract.yaml --url http://localhost:8080
456+
```
457+
458+
### Enterprise Security & Compliance
459+
460+
#### Policy as Code (`cm policy`)
461+
Enforce organizational standards using a Rego-inspired policy engine.
462+
463+
**Built-in Policies:**
464+
- `SEC-001` 🚨 **Critical**: No Privileged Containers.
465+
- `SEC-002` ⚠️ **High**: Non-root user enforcement.
466+
- `RES-001` ⚠️ **Medium**: Memory/CPU limits must be defined.
467+
- `BP-001` ℹ️ **Info**: Healthchecks required.
468+
469+
```bash
470+
cm policy check --strict # Fail CI pipeline on violation
471+
cm policy list # View active rules
472+
```
473+
474+
#### SBOM Generation (`cm sbom`)
475+
Secure your supply chain by generating Software Bills of Materials (CycloneDX JSON).
476+
477+
**Supported Parsers:**
478+
- 🟢 Go (`go.mod`)
479+
- 🟡 Node.js (`package.json`)
480+
- 🔵 Python (`requirements.txt`)
481+
482+
```bash
483+
cm sbom -o sbom.json
484+
```
485+
486+
#### Plugin System (`cm plugin`)
487+
Extend Container-Maker with custom behavior.
488+
- **Lifecycle Hooks**: Inject logic `PreStart` / `PostStart` (e.g., for specialized auditing or setup).
489+
- **Custom Auditing**: Built-in audit plugin tracks workspace events.
490+
491+
347492
### Remote Development (`cm remote`)
348493

349494
Connect to remote machines and sync files seamlessly:
@@ -450,6 +595,17 @@ Features:
450595
- Interactive terminal
451596
- Usage analytics and billing
452597

598+
### CLI Commands
599+
600+
```bash
601+
# Billing & Usage
602+
cm cloud billing
603+
604+
# List supported providers
605+
cm cloud providers
606+
```
607+
608+
453609
---
454610

455611
## 📊 TUI Dashboard
@@ -576,6 +732,19 @@ Features:
576732
| `cm images` | Manage preset images | `cm images list` |
577733
| `cm make` | Run Makefile targets | `cm make build` |
578734

735+
### Workspace & Enterprise Commands
736+
737+
| Command | Description | Example |
738+
|---------|-------------|---------|
739+
| `cm workspace` | Manage workspaces | `cm workspace graph` |
740+
| `cm up/down` | Start/Stop workspace | `cm up -d` |
741+
| `cm import` | Import Docker Compose | `cm import docker-compose.yml` |
742+
| `cm gpu` | Manage GPU resources | `cm gpu status` |
743+
| `cm mock` | Mock services | `cm mock serve` |
744+
| `cm policy` | Enforce policies | `cm policy check` |
745+
| `cm sbom` | Generate SBOM | `cm sbom` |
746+
| `cm plugin` | Manage plugins | `cm plugin list` |
747+
579748
### Remote Development
580749

581750
| Command | Description | Example |
@@ -589,13 +758,29 @@ Features:
589758
| `cm remote sync push` | Push to remote | `cm remote sync push` |
590759
| `cm remote sync pull` | Pull from remote | `cm remote sync pull` |
591760

592-
### Team & Organization
761+
### Team & Organization (`cm team`)
762+
763+
Manage enterprise configuration, shared templates, and audit logs.
593764

594765
| Command | Description | Example |
595766
|---------|-------------|---------|
596-
| `cm team set` | Set organization | `cm team set mycompany` |
597-
| `cm team templates` | Set templates repo | `cm team templates <url>` |
598-
| `cm team info` | Show team config | `cm team info` |
767+
| **Repo Management** | | |
768+
| `cm team add` | Add template repo | `cm team add https://github.com/org/tmpls` |
769+
| `cm team remove` | Remove repo | `cm team remove my-repo` |
770+
| `cm team sync` | Sync/Update repos | `cm team sync` |
771+
| `cm team list` | List cached templates | `cm team list` |
772+
| **Enterprise Controls** | | |
773+
| `cm team auth` | Configure auth | `cm team auth --token <gh_token>` |
774+
| `cm team pin` | Pin repo version | `cm team pin hq@v1.2.0` |
775+
| `cm team unpin` | Unpin repo | `cm team unpin hq` |
776+
| `cm team var` | Set global variable | `cm team var REGISTRY=harbor.internal` |
777+
| **Auditing** | | |
778+
| `cm team log` | View audit log | `cm team log` |
779+
| `cm team set-audit`| Enable/Disable audit | `cm team set-audit on` |
780+
| **Configuration** | | |
781+
| `cm team set` | Set Org Name | `cm team set MyCorp` |
782+
| `cm team info` | Show configuration | `cm team info` |
783+
599784

600785
---
601786

cmd/cm/benchmark.go

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,11 @@ func benchmarkContainerStartup() (time.Duration, error) {
150150
}
151151

152152
// benchmarkVersion returns a simple version for testing
153-
var benchmarkVersionCmd = &cobra.Command{
154-
Use: "version --short",
155-
Hidden: true,
156-
Run: func(cmd *cobra.Command, args []string) {},
157-
}
153+
// var benchmarkVersionCmd = &cobra.Command{
154+
// Use: "version --short",
155+
// Hidden: true,
156+
// Run: func(cmd *cobra.Command, args []string) {},
157+
// }
158158

159159
func init() {
160160
benchmarkCmd.Flags().IntVar(&benchmarkIterations, "iterations", 5, "Number of iterations for startup benchmark")

cmd/cm/env.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -349,7 +349,7 @@ var envDeleteCmd = &cobra.Command{
349349
if !envDeleteForce {
350350
fmt.Printf("Delete environment '%s'? This cannot be undone. [y/N] ", name)
351351
var response string
352-
fmt.Scanln(&response)
352+
_, _ = fmt.Scanln(&response)
353353
if strings.ToLower(response) != "y" {
354354
fmt.Println("Cancelled.")
355355
return nil

cmd/cm/gpu.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ func parseVRAMRequirement(s string) int64 {
200200
}
201201

202202
var value int64
203-
fmt.Sscanf(s, "%d", &value)
203+
_, _ = fmt.Sscanf(s, "%d", &value)
204204
return value * multiplier
205205
}
206206

0 commit comments

Comments
 (0)