Skip to content

Commit edac12f

Browse files
authored
Merge pull request #9 from zloeber/copilot/vscode-mlyi000h-6v7t
feat: AI agent enhancements — JSON output, exit codes, plan mode, list/detect commands
2 parents bd99ab0 + d0e312d commit edac12f

5 files changed

Lines changed: 1995 additions & 141 deletions

File tree

.github/feature-tasks.md

Lines changed: 221 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,221 @@
1+
# SecretZero AI Agent Enhancement Feature Tasks
2+
3+
Features to improve SecretZero's usefulness for AI coding agents and automated workflows.
4+
5+
## Priority 1: Foundation (High Impact, Straightforward)
6+
7+
### 1. Structured JSON Output Format
8+
**Goal:** Add `--format json` flag to all major commands for machine-readable results
9+
10+
- [x] Add `--format` option to `validate` command
11+
- [x] Add `--format` option to `status` command
12+
- [x] Add `--format` option to `sync` command
13+
- [x] Add `--format` option to `rotate` command
14+
- [x] Add `--format` option to `policy` command
15+
- [x] Add `--format` option to `drift` command
16+
- [x] Create standard output schema for each command
17+
- [x] Add JSON tests for each command's output
18+
19+
**Why:** Makes it trivial for AI agents to parse results and extract data
20+
21+
---
22+
23+
### 2. Standardized Exit Codes
24+
**Goal:** Use consistent exit codes for different error scenarios
25+
26+
Exit codes:
27+
- `0` = success
28+
- `1` = validation error
29+
- `2` = missing dependency
30+
- `3` = authentication failure
31+
- `4` = drift detected
32+
- `5` = configuration error
33+
- `127` = unknown error
34+
35+
- [x] Implement exit code mapping for each command (EXIT_SUCCESS, EXIT_VALIDATION_ERROR, EXIT_MISSING_DEPENDENCY, EXIT_AUTH_FAILURE, EXIT_DRIFT_DETECTED, EXIT_CONFIG_ERROR, EXIT_UNKNOWN_ERROR)
36+
- [x] Add tests for exit codes
37+
- [ ] Document exit codes in CLI reference guide
38+
39+
**Why:** Enables agents to quickly categorize failures without parsing output
40+
41+
---
42+
43+
### 3. Better Dry-Run / Plan Mode
44+
**Goal:** Show detailed execution plan with `--plan` flag
45+
46+
- [x] Add `--plan` flag to `sync` command
47+
- [x] Implement plan output showing: created, updated, skipped
48+
- [x] Add JSON output support for plans (`--plan --format json`)
49+
- [x] Include affected targets and paths in plan
50+
- [x] Add tests for plan generation
51+
52+
**Why:** Agents can preview changes before executing them
53+
54+
---
55+
56+
## Priority 2: Query & Inspection (Medium Impact, Moderate Effort)
57+
58+
### 4. Query/Inspect Commands
59+
**Goal:** Allow targeted queries without full configuration rendering
60+
61+
- [x] Create `secretzero list` command:
62+
- [x] `list secrets` - show secret names, kinds, rotation periods
63+
- [x] `list providers` - show provider types and auth methods
64+
- [x] `list targets` - show all target destinations
65+
- [x] `list variables` - show all variables in config
66+
- [x] Add `--format json` support
67+
- [x] Add `--filter` search option for secrets and variables
68+
69+
- [ ] Create `secretzero inspect` command:
70+
- [ ] `inspect secret <name>` - detailed secret info
71+
- [ ] `inspect provider <name>` - provider config details
72+
- [ ] `inspect target <provider>/<kind>` - target details
73+
- [ ] Add `--output json` support
74+
75+
**Why:** Agents can get specific information without parsing full rendered config
76+
77+
---
78+
79+
### 5. Dependency Graph Export
80+
**Goal:** Export configuration dependencies in machine-readable format
81+
82+
- [x] Add `--format json` to `graph` command
83+
- [x] Export graph as JSON with nodes and edges
84+
- [ ] Create `secretzero dependencies` command:
85+
- [ ] Show what a secret depends on
86+
- [ ] Show what depends on a variable
87+
- [ ] Transitive dependencies
88+
- [ ] Add `secretzero impact` command:
89+
- [ ] Show what secrets change if variable changes
90+
- [ ] Show cascade effects
91+
92+
**Why:** Agents can understand impact of changes before executing
93+
94+
---
95+
96+
## Priority 3: Configuration Assistance (Medium Impact, Higher Effort)
97+
98+
### 6. Configuration Generation Helpers
99+
**Goal:** Help agents generate or improve SecretZero configs
100+
101+
- [ ] Create `secretzero init` enhancements:
102+
- [ ] `--from-env` - generate from environment variables
103+
- [ ] `--from-file` - scan file and generate config
104+
- [ ] `--interactive` - guided setup wizard
105+
- [ ] Output to stdout with `--dry-run`
106+
107+
- [x] Create `secretzero detect` command:
108+
- [x] Scan directory for potential secrets
109+
- [x] Suggest secret definitions
110+
- [x] Output as partial Secretfile
111+
- [x] JSON output format support
112+
113+
- [ ] Create `secretzero suggest` command:
114+
- [ ] Suggest config improvements
115+
- [ ] Check for best practices
116+
- [ ] Recommend rotation periods
117+
- [ ] Detect missing error handling
118+
119+
**Why:** Agents can assist users in creating better configs
120+
121+
---
122+
123+
### 7. Auto-Environment Detection
124+
**Goal:** Automatically select appropriate .szvar files
125+
126+
- [ ] Detect environment from:
127+
- [ ] Git branch name
128+
- [ ] CI/CD environment variables
129+
- [ ] Deployment context
130+
- [ ] Explicit `--env` flag
131+
- [ ] Auto-apply matching .szvar files
132+
- [ ] Document environment detection rules
133+
134+
**Why:** Reduces manual configuration in CI/CD and agent workflows
135+
136+
---
137+
138+
## Priority 4: API & Integration (Medium-High Impact, Higher Effort)
139+
140+
### 8. Batch Operations
141+
**Goal:** Execute multiple operations atomically
142+
143+
- [ ] Create batch operation format (JSON)
144+
- [ ] Implement `secretzero batch <file>` command
145+
- [ ] Support operations: sync, rotate, validate, check-drift
146+
- [ ] Atomic execution with rollback on failure
147+
- [ ] Output detailed results per operation
148+
149+
**Why:** Agents can perform complex workflows in single call
150+
151+
---
152+
153+
### 9. Enhanced API Mode
154+
**Goal:** Better integration with automation tools
155+
156+
- [ ] Add OpenAPI/Swagger spec generation
157+
- [ ] Auto-generate API client libraries
158+
- [ ] Add webhook/notification support
159+
- [ ] Add streaming responses for long operations
160+
- [ ] Add GraphQL endpoint option (optional)
161+
162+
**Why:** Standard API specifications enable auto-integration
163+
164+
---
165+
166+
### 10. Schema Export & Validation
167+
**Goal:** Export configuration schema for validation
168+
169+
- [ ] Export schema as JSON Schema
170+
- [ ] Export as GraphQL schema
171+
- [ ] Create validator tool: `secretzero schema validate`
172+
- [ ] Create schema documentation generator
173+
- [ ] Support schema migration helpers
174+
175+
**Why:** Agents can validate configs before deployment
176+
177+
---
178+
179+
## Implementation Guide
180+
181+
### Start Here (Day 1-2)
182+
1. Task 1 - JSON output format
183+
2. Task 2 - Standardized exit codes
184+
3. Task 3 - Better dry-run/plan mode
185+
186+
### Continue (Week 2)
187+
4. Task 4 - Query/inspect commands
188+
5. Task 5 - Dependency graph export
189+
190+
### Extend (Week 3+)
191+
6-10. Configuration assistance, batch ops, API enhancements
192+
193+
---
194+
195+
## Testing Strategy
196+
- [x] Add JSON output schema validation tests (tests/test_cli_features.py)
197+
- [x] Add exit code verification tests (tests/test_cli_features.py)
198+
- [ ] Add integration tests for AI agent workflows
199+
- [ ] Add performance tests for large configs
200+
- [ ] Create AI agent test suite
201+
202+
---
203+
204+
## Documentation Updates
205+
- [ ] Update CLI reference for new commands
206+
- [ ] Create "Using with AI Agents" guide
207+
- [ ] Document JSON output schemas
208+
- [ ] Document exit codes reference
209+
- [ ] Add agent integration examples
210+
- [ ] Create batch operations guide
211+
212+
---
213+
214+
## Success Metrics
215+
- AI agents can extract info without regex parsing
216+
- 100% of commands support `--output json`
217+
- Exit codes match documentation
218+
- Agents can preview changes with `--plan`
219+
- Agents can query specific data without full render
220+
- Config generation takes <5 agent calls
221+

0 commit comments

Comments
 (0)