The `--output yaml` flag was accepted but aliased to JSON since
printYAML() was never defined. Add printYAML() using gopkg.in/yaml.v3
(already an indirect dep via viper) and split all output format
branches into explicit json/yaml/table paths.
Affected commands: workspace list/create/inspect/audit,
agent list/inspect/peers, platform audit/health.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
v.SafeWriteConfig() was called without a local viper instance.
Create a fresh viper scoped to the target config file, read any
existing values, set the new key, then atomically write via SafeWriteConfig.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
viper.Viper has no Marshal method in v1.21. Use SafeWriteConfig instead
which atomically writes only explicitly-set keys to the config file.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- workspace.go: remove no-op _ = workspaceID (workspaceID consumed in runHTTP call)
- molecule_test.go: replace hardcoded /workspace/repos/clone-cli path with
dynamic exe-based resolution so tests pass when built by CI
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Wires shell completion for all 4 shells via Cobra's built-in generators.
Covers the remaining item from the implementation status checklist.
Adds:
- internal/cmd/completion.go: cobra.GenXxxCompletion wrappers with
usage examples for each shell
- 5 new integration tests in cmd/molecule/molecule_test.go:
- TestCLI_Completion_Help (4 shells × help flag)
- TestCLI_Completion_GeneratesScript (4 shells × script output)
- TestCLI_Completion_InvalidShell (exit code 2 on bad shell)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
All test.Fatalf messages referenced "mol <subcommand>" but the binary
is now "molecule". Also fix configSet to use os.WriteFile atomic write
instead of viper.WriteConfig (avoids file-permission edge cases).
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
Rename all user-facing "mol" references to "molecule" to match the
published binary name (binary: molecule in .goreleaser.yaml):
- root.go: Use string, versionInfo, viper config name, flag descriptions
- init.go: section comment, Short, Long, cfgPath, scaffolded message
- config.go: Long description, Shorts, configFile, WriteFile, Stat check
- molecule_test.go: binary name, version output check, mol.yaml → molecule.yaml
Also fix test helper to use runtime.GOEXE instead of hardcoded /tmp/go/bin/go.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
rootCmd.Use was "mol" while .goreleaser.yaml sets binary: "molecule".
Align to "molecule" to match the published binary name, test
invocations, and docs. Also fix test helper to use runtime.GOEXE
instead of hardcoded /tmp/go/bin/go.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
- Add `mol init` command (internal/cmd/init.go): scaffolds mol.yaml
in the current directory with commented config sections and
environment variable documentation. Exits with a clear "next steps"
message. Checks for existing mol.yaml before overwriting.
- Register initCmd in root.go alongside the other command groups.
- Add 2 integration tests: TestCLI_Init (scaffolding + output)
and TestCLI_Init_AlreadyExists (error path).
- Update CLAUDE.md command reference to list mol init and note it
is checked off the stub repo checklist.
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>