You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
chore: access command root so that subcommands can be worked in parallel (#100)
* chore: add shared infrastructure for access commands
Adds base command helpers, auth API client methods, test utilities,
and key ID completion support needed by the access key commands.
Copy file name to clipboardExpand all lines: AGENTS.md
+27Lines changed: 27 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -50,6 +50,33 @@ If make lint fails from formatting problems, use `make format` to fix them.
50
50
51
51
## Conventions
52
52
53
+
### Long descriptions and examples — mandatory
54
+
55
+
Every leaf command and group command **must** have a `Long` description and an `Example` block.
56
+
57
+
**`Long`:**
58
+
- First line expands the `Short` description into a full sentence.
59
+
- Blank line, then one or two paragraphs explaining behaviour, use cases, and important caveats.
60
+
- Use the proto service/message comments as the authoritative source of truth for what a resource or operation does.
61
+
- Do NOT describe individual flags — only document unusual or non-obvious flag interactions.
62
+
63
+
**`Example`:**
64
+
- One example per meaningful use case (basic call, common flag combinations, scripting).
65
+
- Prefix every line with `# ` comment explaining what the example does.
66
+
- Real command invocations with plausible IDs/values.
67
+
68
+
All five base types (`ListCmd`, `DescribeCmd`, `CreateCmd`, `UpdateCmd`, `Cmd`) expose `Long` and `Example` as top-level struct fields. Never set them inside `BaseCobraCommand()`.
69
+
70
+
### Tests — mandatory
71
+
72
+
Every new command package **must** ship tests. This is not optional.
73
+
74
+
- Place tests in `internal/cmd/<group>/` as `<file>_test.go` using `package <group>_test`.
75
+
- Use `testutil.NewTestEnv` + `testutil.Exec` — never call command functions directly.
76
+
- When adding a new gRPC service, also add a `fake_<service>.go` in `internal/testutil/` and register it in `server.go` / `TestEnv`.
77
+
- Cover: table output (assert header columns + key values), JSON output (unmarshal and assert), request fields sent to server, backend errors (use `Returns(nil, fmt.Errorf(...))` and assert `require.Error`), input errors (missing args, wrong flags).
78
+
- Run `make test` before declaring done.
79
+
53
80
### Subcommand pattern
54
81
55
82
Each subcommand group lives in `internal/cmd/<group>/`:
0 commit comments