Skip to content

Commit 429f0ae

Browse files
committed
feat: migrate to niceyaml
1 parent 97f5bc5 commit 429f0ae

81 files changed

Lines changed: 1708 additions & 1859 deletions

Some content is hidden

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

.golangci.yaml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -271,9 +271,6 @@ linters:
271271
- source: "= `"
272272
linters:
273273
- grouper
274-
- text: "\\*github\\.com/hashicorp/go-multierror\\.Error"
275-
linters:
276-
- wrapcheck
277274
- path: cmd/
278275
linters:
279276
- wrapcheck

CLAUDE.md

Lines changed: 32 additions & 86 deletions
Original file line numberDiff line numberDiff line change
@@ -6,106 +6,52 @@ This file provides guidance to Claude Code (claude.ai/code) when working with co
66

77
`kclipper` is a superset of KCL that integrates Helm chart management. It provides KCL plugins, packages, and CLI commands to manage Helm charts declaratively and render them directly within KCL code. The binary is named `kcl` and can be used as a drop-in replacement.
88

9-
## Build & Development Commands
9+
## Build & Test Commands
1010

1111
```bash
12-
# Format code
13-
task format
14-
15-
# Lint all (Go, YAML, Actions, Renovate, GoReleaser)
16-
task lint
17-
18-
# Run tests
19-
task test
20-
21-
# Run a single test
22-
go test ./pkg/helm -run TestHelmChart
12+
task format # Format and lint
13+
task lint # Lint only
14+
task test # Run all tests
2315
```
2416

25-
## Architecture
26-
27-
### Entry Point & CLI
28-
29-
- `cmd/kclipper/main.go` - Entry point, wraps upstream KCL CLI and registers plugins
30-
- `cmd/kclipper/commands/` - Root command setup, adds `chart` and `export` subcommands to upstream KCL commands
31-
32-
### Core Packages (`pkg/`)
33-
34-
**Helm Integration:**
35-
36-
- `pkg/helm/` - Chart templating, pulling, dependency resolution (based on Argo CD's implementation, optimized for minimal I/O)
37-
- `pkg/helmrepo/` - Helm repository management and authentication
38-
- `pkg/helmtest/` - Test utilities for Helm operations
39-
40-
**KCL Plugins:**
41-
42-
- `pkg/kclplugin/helm/` - KCL plugin exposing `helm.template()` to KCL code
43-
- `pkg/kclplugin/filepath/` - KCL plugin for filepath operations (base, dir, ext, join, etc.)
44-
- `pkg/kclplugin/plugins/` - Shared plugin utilities (SafeMethodArgs for safe argument access)
45-
46-
**KCL Module Generation:**
47-
48-
- `pkg/kclmodule/kclchart/` - Chart struct definition and KCL schema generation for per-chart packages
49-
- `pkg/kclmodule/kclhelm/` - Helm Chart struct (postRenderer, valueFiles) and base schema generation
50-
51-
**Schema Generation:**
52-
53-
- `pkg/jsonschema/` - Schema generators for Helm values (AUTO, VALUE-INFERENCE, URL, CHART-PATH, LOCAL-PATH)
54-
- `pkg/crd/` - CRD schema generators (TEMPLATE, CHART-PATH, PATH)
55-
- `pkg/kclgen/` - Generates KCL schemas from JSON Schemas and CRDs
56-
57-
**Chart Management:**
58-
59-
- `pkg/chartcmd/` - Logic for `kcl chart` subcommands (add, update, set, init, repo add)
60-
- `pkg/charttui/` - Interactive TUI for chart operations
61-
62-
**Other:**
63-
64-
- `pkg/paths/` - Path resolution for charts and modules
65-
- `pkg/kube/` - Kubernetes YAML utilities
66-
- `pkg/kclexport/` - Export KCL content to other formats
67-
- `pkg/kclerrors/` - Standardized error types and handling
68-
- `pkg/kclautomation/` - KCL file automation (e.g. for chart declarations)
69-
- `pkg/syncs/` - Synchronization primitives (key locks for concurrency)
70-
- `pkg/version/` - Version information management
71-
- `pkg/log/` - Logging management
72-
73-
### KCL Modules (`modules/`)
74-
75-
- `helm/` - Published KCL module with `Charts`, `ChartRepos`, and related schemas
76-
- `filepath/` - File path utilities for KCL
77-
78-
### Data Flow
79-
80-
1. User declares charts in `charts/charts.k` using `helm.Charts` schema
81-
2. `kcl chart update` generates per-chart packages with `Chart` and `Values` schemas
82-
3. User code imports chart packages and calls `helm.template(chart.Chart{...})`
83-
4. Plugin renders chart at runtime, returns list of Kubernetes resources
84-
5. Output piped to kubectl, GitOps workflow, or Argo CD CMP
85-
8617
## Code Style
8718

8819
### Go Conventions
8920

90-
- Document all exported items with doc comments
91-
- Use `[Name]` syntax for Go doc links
92-
- Package documentation in `doc.go` files
93-
- Wrap errors with `fmt.Errorf("context: %w", err)` - no "failed" or "error" in messages
94-
- Use global error variables for common errors
21+
- Document all exported items with doc comments.
22+
- Package documentation in `doc.go` files.
23+
- Wrap errors with `fmt.Errorf("context: %w", err)`, or `fmt.Errorf("%w: %w", ErrSentinel, err)`.
24+
- Avoid using "failed" or "error" in library error messages.
25+
- Use global error variables for common errors.
26+
- Use constructors with functional options.
27+
- Accept interfaces, return concrete types.
28+
- Prefer consistency over performance, avoid "fast paths" that could lead to unpredictable behavior.
29+
30+
### Documentation
31+
32+
- Use `[Name]` syntax for Go doc links. Use `[*Name]` for pointer types.
33+
- Constructors should always begin: `// NewThing creates a new [Thing].`
34+
- Types with constructors should always note: `// Create instances with [NewThing].`
35+
- Interfaces should note: `// See [Thing] for an implementation.`
36+
- Interfaces should have sensible names: `type Builder interface { Build() Thing } // Builder builds [Thing]s.`
37+
- Functional option types should have a list linking to all functions of that type.
38+
- Functional options should always have a link to their type.
39+
- Package docs should explain concepts and usage patterns; **do not enumerate exports**.
9540

9641
### Testing
9742

98-
- Use `github.com/stretchr/testify/assert` and `require`
99-
- Table-driven tests with `map[string]struct{}` format
100-
- Field names: `input`, `want`, `got`, `err`
101-
- Always use `t.Parallel()` in all tests
102-
- Create test packages (`package foo_test`) testing public API
103-
- Use `require.ErrorIs` for error type checking
43+
- Use `github.com/stretchr/testify/assert` and `require`.
44+
- Table-driven tests with `map[string]struct{}` format.
45+
- Field names: prefer `want` for expected output, `err` for expected errors.
46+
- For inputs, use clear contextual names (e.g., `before`/`after` for diffs, `line`/`col` for positions).
47+
- Always use `t.Parallel()` in all tests.
48+
- Create test packages (`package foo_test`) testing public API.
49+
- Use `require.ErrorIs` for sentinel error checking.
50+
- Use `require.ErrorAs` for error type extraction.
51+
- Use the `go.jacobcolvin.com/x/stringtest` helpers whenever possible.
10452

10553
## Key Dependencies
10654

10755
- `kcl-lang.io/cli` - Upstream KCL CLI (commands wrapped by kclipper)
10856
- `kcl-lang.io/kcl-go` - KCL Go SDK and plugin system
10957
- `helm.sh/helm/v3` - Helm library for chart operations
110-
- `github.com/charmbracelet/bubbletea` - TUI framework for interactive chart management
111-
- `github.com/dadav/helm-schema` - Schema inference from values.yaml

0 commit comments

Comments
 (0)