Skip to content

Commit cd8fe57

Browse files
committed
refactor(cli): Consolidate 'craft' capabilities into core pillars
This major architectural refactor removes the standalone 'craft' command group and integrates its AI-assisted features directly into the 'factory' and 'product' pillars. Key Changes: - Removed 'cmd/craft' and its subcommands. - Added '--ai' flag to 'commit', 'finish', and 'codemod' for AI-assisted workflows. - Added '--strategic' flag to 'kickoff' for AI-guided project planning. - Centralized AI prompt logic in 'internal/workflow/ai_steps.go'. - Refactored 'version' and 'feedback' commands for improved testability and code quality. - Moved build versioning source of truth to 'internal/build' and updated linter rules.
1 parent 1926015 commit cd8fe57

40 files changed

Lines changed: 1516 additions & 824 deletions

.golangci.yml

Lines changed: 38 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -6,22 +6,17 @@ run:
66
modules-download-mode: readonly
77

88
output:
9-
# Satisfies "order the results by file"
109
sort-order:
1110
- file
1211
- linter
1312

1413
linters:
1514
default: all
1615
disable:
17-
# --- Style & Idiom (Too Opinionated) ---
18-
- wsl # Too strict; conflicts with logical grouping.
19-
20-
# --- Style Preference ---
21-
- noinlineerr # Disabled to allow idiomatic `if err :=...`
16+
- wsl
17+
- noinlineerr
2218
- err113
2319
- errcheck
24-
- exhaustruct
2520
- funlen
2621
- gochecknoinits
2722
- gocognit
@@ -32,42 +27,59 @@ linters:
3227
- revive
3328
- varnamelen
3429
- cyclop
35-
- gochecknoglobals
30+
# - gochecknoglobals
3631
- unparam
3732
- wrapcheck
3833
- depguard
34+
# We keep exhaustruct disabled in the general list for now to avoid noise in other files,
35+
# but we configure the settings below so that IF enabled (e.g. via strict mode), it behaves correctly.
3936

4037
exclusions:
41-
generated: strict
42-
warn-unused: true
43-
presets:
44-
# - comments
45-
# - std-error-handling
46-
# - common-false-positives
47-
# - legacy
48-
rules:
49-
- path: "cmd/version/version.go"
50-
linters:
51-
- gochecknoinits
52-
- exhaustruct
53-
- gochecknoglobals
54-
- errcheck
38+
generated: strict
39+
warn-unused: true
40+
presets:
41+
# - comments
42+
# - std-error-handling
43+
# - common-false-positives
44+
# - legacy
45+
rules:
46+
# Allow globals for build-time variables and embedded descriptions
47+
- path: "cmd/(version/version|feedback/feedback)\\.go$"
48+
linters:
49+
- gochecknoglobals
50+
51+
# Allow globals for build-time injection
52+
- path: "internal/build/build\\.go$"
53+
linters:
54+
- gochecknoglobals
55+
56+
# Allow globals for the "Bridge Pattern" in tests
57+
# Regex explanation: Matches any file ending in "export_test.go"
58+
- path: "export_test\\.go$"
59+
linters:
60+
- gochecknoglobals
61+
- exhaustruct
62+
5563

5664
settings:
5765
gofumpt:
5866
extra-rules: true
5967

68+
# --- NEW CONFIGURATION ---
69+
exhaustruct:
70+
exclude:
71+
# Exclude Cobra commands as per research findings (Fragile Structs)
72+
- "^github.com/spf13/cobra.Command$"
73+
6074
depguard:
6175
rules:
62-
# Rule 1: Production Code (Main)
6376
main:
6477
list-mode: strict
6578
files:
6679
- "$all"
67-
- "!$test" # Critical: Exclude test files from this strict rule
80+
- "!$test"
6881
allow:
6982
- $gostd
70-
# Allow SDKs
7183
- golang.org/x/oauth2
7284
- github.com/spf13/cobra
7385
- google.golang.org/grpc
@@ -78,7 +90,6 @@ linters:
7890
- github.com/google/go-github/v74/github
7991
- github.com/fatih/color
8092
- github.com/mattn/go-isatty
81-
# Allow your project imports
8293
- github.com/contextvibes/cli
8394
- github.com/mark3labs/mcp-go/mcp
8495
deny:
@@ -95,14 +106,13 @@ linters:
95106
- error
96107
- empty
97108
- stdlib
98-
# --- Architecture Exemptions (Dependency Injection) ---
99109
- github.com/contextvibes/cli/internal/workitem.Provider
100110
- github.com/contextvibes/cli/internal/exec.CommandExecutor
101111
- github.com/contextvibes/cli/internal/workflow.PresenterInterface
102112

103113
gosec:
104114
excludes:
105-
- G101 # Exclude "Hardcoded Credentials" (false positives with IaC resource names)
115+
- G101
106116

107117
errorlint:
108118
errorf: true

.goreleaser.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ builds:
2020
binary: contextvibes
2121
ldflags:
2222
- -s -w
23-
- -X github.com/contextvibes/cli/cmd/version.Version={{.Version}}
24-
- -X github.com/contextvibes/cli/cmd/version.Commit={{.Commit}}
25-
- -X github.com/contextvibes/cli/cmd/version.Date={{.Date}}
26-
- -X github.com/contextvibes/cli/cmd/version.BuiltBy=goreleaser
23+
- -X github.com/contextvibes/cli/internal/build.Version={{.Version}}
24+
- -X github.com/contextvibes/cli/internal/build.Commit={{.Commit}}
25+
- -X github.com/contextvibes/cli/internal/build.Date={{.Date}}
26+
- -X github.com/contextvibes/cli/internal/build.BuiltBy=goreleaser
2727

2828
archives:
2929
- format: tar.gz

CHANGELOG.md

Lines changed: 21 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
cat <<EOF > CHANGELOG.md
21
# Changelog
32

43
All notable changes to the **Context Vibes CLI** project will be documented in this file.
@@ -8,6 +7,25 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
87

98
---
109

10+
## [Unreleased]
11+
12+
### Deprecated
13+
- **\`craft\` Command Pillar:** The \`craft\` command group has been deprecated. Its functionality has been integrated directly into the core \`factory\` and \`product\` commands to streamline the workflow.
14+
15+
### Added
16+
- **AI-Assisted Flags (`--ai`):** Added a global-style \`--ai\` flag to key commands to generate optimized prompts for external AI assistants:
17+
- \`factory commit --ai\`: Replaces \`craft message\`. Generates a Conventional Commit message prompt based on staged changes.
18+
- \`factory finish --ai\`: Replaces \`craft pr-description\`. Generates a Pull Request description prompt based on branch diffs.
19+
- \`product quality --ai\`: Replaces \`craft review\`. Generates a Code Review prompt for the codebase.
20+
- \`product codemod --ai\`: Replaces \`craft refactor\`. Generates a Refactoring Plan prompt for specific files.
21+
- **Strategic Kickoff Integration:**
22+
- \`factory kickoff --strategic\`: Replaces \`craft kickoff\`. Generates the master protocol for an AI-guided strategic project kickoff.
23+
24+
### Changed
25+
- **Workflow Architecture:** Refactored internal workflow steps to be reusable across different commands, enabling the "AI as a feature" model.
26+
27+
---
28+
1129
## [0.6.0] - 2025-12-05
1230

1331
### Added
@@ -265,7 +283,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
265283
<!--
266284
Link Definitions
267285
-->
268-
[Unreleased]: https://github.com/contextvibes/cli/compare/v0.4.1...HEAD
286+
[Unreleased]: https://github.com/contextvibes/cli/compare/v0.6.0...HEAD
287+
[0.6.0]: https://github.com/contextvibes/cli/compare/v0.4.1...v0.6.0
269288
[0.4.1]: https://github.com/contextvibes/cli/compare/v0.4.0...v0.4.1
270289
[0.4.0]: https://github.com/contextvibes/cli/compare/v0.3.0...v0.4.0
271290
[0.3.0]: https://github.com/contextvibes/cli/compare/v0.2.0...v0.3.0
@@ -276,4 +295,3 @@ Link Definitions
276295
[0.0.3]: https://github.com/contextvibes/cli/compare/v0.0.2...v0.0.3
277296
[0.0.2]: https://github.com/contextvibes/cli/compare/v0.0.1...v0.0.2
278297
[0.0.1]: https://github.com/contextvibes/cli/releases/tag/v0.0.1
279-
EOF

README.md

Lines changed: 20 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -26,23 +26,28 @@ Context Vibes is a command-line tool designed to streamline common development t
2626
* **Consistency:** Provides a unified interface and terminal output style for frequent actions (`commit`, `sync`, `deploy`, etc.).
2727
* **Automation:** Simplifies multi-step processes and provides non-interactive options via the global `--yes` flag. Designed for use in scripts or by AI agents.
2828
* **AI Integration:**
29-
* Generates a `contextvibes.md` context file (`describe`, `diff`) suitable for AI prompts.
30-
* The `kickoff --strategic` command generates a master prompt file to guide an AI-facilitated strategic project kickoff.
31-
* Produces structured terminal output suitable for human review or direct AI parsing.
32-
* Generates a detailed JSON trace log (default: `contextvibes_ai_trace.log`, configurable) for deeper AI analysis or debugging.
29+
* **AI-Assisted Workflows:** Use the `--ai` flag on core commands (`commit`, `finish`, `quality`, `codemod`) to generate optimized prompts for your AI assistant.
30+
* **Context Generation:** Generates a `contextvibes.md` context file (`describe`, `diff`) suitable for AI prompts.
31+
* **Strategic Planning:** The `kickoff --strategic` command generates a master prompt to guide an AI-facilitated strategic project kickoff.
32+
* **Traceability:** Produces structured terminal output and a detailed JSON trace log (default: `contextvibes_ai_trace.log`) for deeper AI analysis.
3333
* **Clarity & Safety:** Uses distinct output formats and requires confirmation for state-changing operations (unless `--yes` is specified).
3434
* **Configurability:** Supports a `.contextvibes.yaml` file for customizing default behaviors (Git, validation rules, logging, AI interaction preferences). See the [Configuration Reference](docs/reference/configuration_reference.md) for details.
3535

3636
## Key Features
3737

3838
* **AI Context Generation:** `describe`, `diff`.
3939
* **Enhanced Git Workflow Automation:**
40-
* `kickoff`: Dual-mode for AI-assisted strategic project kickoff prompt generation OR daily development branch creation.
41-
* `commit`, `sync`, `wrapup`, `status` (Configurable branch/commit rules).
40+
* `kickoff`: Starts a new task. Use `--strategic` for AI-assisted project planning.
41+
* `commit`: Stages and commits changes. Use `--ai` to generate a commit message prompt.
42+
* `finish`: Pushes and creates a PR. Use `--ai` to generate a PR description prompt.
43+
* `sync`, `status`, `tidy`.
4244
* **Infrastructure as Code (IaC) Wrappers:** `plan`, `deploy`, `init` (Terraform/Pulumi).
43-
* **Code Quality & Formatting:** `quality`, `format` (Go, Python, Terraform).
45+
* **Code Quality & Formatting:**
46+
* `quality`: Runs static analysis. Use `--ai` to generate a code review prompt.
47+
* `format`: Formats code (Go, Python, Terraform).
48+
* **Code Modification:**
49+
* `codemod`: Applies programmatic changes. Use `--ai` to generate a refactoring prompt.
4450
* **Project Testing & Versioning:** `test`, `version`.
45-
* **Code Modification:** `codemod` (from JSON scripts).
4651

4752
*(For detailed information on each command, see the [Command Reference](docs/reference/command_reference.md).)*
4853

@@ -91,16 +96,16 @@ contextvibes [command] [flags] # Run a command
9196

9297
```bash
9398
# Initiate a strategic project kickoff (generates a master prompt for your AI)
94-
contextvibes kickoff --strategic
99+
contextvibes factory kickoff --strategic
95100
96-
# (After AI session and creating summary) Mark strategic kickoff as complete
97-
contextvibes kickoff --mark-strategic-complete
101+
# Generate an AI prompt to write your commit message
102+
contextvibes factory commit --ai
98103
99-
# Describe the project for an AI (prompts for task description)
100-
contextvibes describe -o my_context.md
104+
# Generate an AI prompt to review your code
105+
contextvibes product quality --ai
101106
102-
# Run project tests (e.g., for a Go project, passing -v flag)
103-
contextvibes test -v
107+
# Describe the project for an AI (prompts for task description)
108+
contextvibes project describe -o my_context.md
104109
```
105110

106111
## Documentation

cmd/craft/craft.go

Lines changed: 0 additions & 28 deletions
This file was deleted.

cmd/craft/kickoff/kickoff.go

Lines changed: 0 additions & 47 deletions
This file was deleted.

cmd/craft/kickoff/kickoff.md.tpl

Lines changed: 0 additions & 6 deletions
This file was deleted.

0 commit comments

Comments
 (0)