From d06d4ba836aee6afa81b6e040370b13ea0deaeec Mon Sep 17 00:00:00 2001 From: Philippe Martin Date: Wed, 8 Apr 2026 08:15:23 +0200 Subject: [PATCH] refactor: replace KORTEX_CLI_ names to KDN_ Signed-off-by: Philippe Martin --- AGENTS.md | 4 +- README.md | 52 +++++++++---------- pkg/cmd/init.go | 16 +++--- pkg/cmd/init_test.go | 38 +++++++------- pkg/cmd/root.go | 2 +- pkg/cmd/root_test.go | 6 +-- skills/commit/SKILL.md | 2 +- skills/implementing-command-patterns/SKILL.md | 20 +++---- skills/working-with-config-system/SKILL.md | 4 +- 9 files changed, 72 insertions(+), 72 deletions(-) diff --git a/AGENTS.md b/AGENTS.md index 4cd6667..a97ac6d 100644 --- a/AGENTS.md +++ b/AGENTS.md @@ -87,11 +87,11 @@ Global flags are defined as persistent flags in `pkg/cmd/root.go` and are availa The `--storage` flag specifies the directory where kdn stores all its files. The default path is computed at runtime using `os.UserHomeDir()` and `filepath.Join()` to ensure cross-platform compatibility (Linux, macOS, Windows). The default is `$HOME/.kdn` with a fallback to `.kdn` in the current directory if the home directory cannot be determined. -**Environment Variable**: The `KORTEX_CLI_STORAGE` environment variable can be used to set the storage directory path. The flag `--storage` will override the environment variable if both are specified. +**Environment Variable**: The `KDN_STORAGE` environment variable can be used to set the storage directory path. The flag `--storage` will override the environment variable if both are specified. **Priority order** (highest to lowest): 1. `--storage` flag (if specified) -2. `KORTEX_CLI_STORAGE` environment variable (if set) +2. `KDN_STORAGE` environment variable (if set) 3. Default: `$HOME/.kdn` To access this value in any command: diff --git a/README.md b/README.md index 27d4eab..263d649 100644 --- a/README.md +++ b/README.md @@ -958,14 +958,14 @@ fi kdn supports environment variables for configuring default behavior. -### `KORTEX_CLI_DEFAULT_RUNTIME` +### `KDN_DEFAULT_RUNTIME` Sets the default runtime to use when registering a workspace with the `init` command. **Usage:** ```bash -export KORTEX_CLI_DEFAULT_RUNTIME=fake +export KDN_DEFAULT_RUNTIME=fake kdn init /path/to/project --agent claude ``` @@ -974,14 +974,14 @@ kdn init /path/to/project --agent claude The runtime is determined in the following order (highest to lowest priority): 1. `--runtime` flag (if specified) -2. `KORTEX_CLI_DEFAULT_RUNTIME` environment variable (if set) +2. `KDN_DEFAULT_RUNTIME` environment variable (if set) 3. Error if neither is set (runtime is required) **Example:** ```bash # Set the default runtime for the current shell session -export KORTEX_CLI_DEFAULT_RUNTIME=fake +export KDN_DEFAULT_RUNTIME=fake # Register a workspace using the environment variable kdn init /path/to/project --agent claude @@ -997,14 +997,14 @@ kdn init /path/to/another-project --agent claude --runtime podman - Supported runtime types depend on the available runtime implementations - Setting this environment variable is useful for automation scripts or when you consistently use the same runtime -### `KORTEX_CLI_DEFAULT_AGENT` +### `KDN_DEFAULT_AGENT` Sets the default agent to use when registering a workspace with the `init` command. **Usage:** ```bash -export KORTEX_CLI_DEFAULT_AGENT=claude +export KDN_DEFAULT_AGENT=claude kdn init /path/to/project --runtime podman ``` @@ -1013,14 +1013,14 @@ kdn init /path/to/project --runtime podman The agent is determined in the following order (highest to lowest priority): 1. `--agent` flag (if specified) -2. `KORTEX_CLI_DEFAULT_AGENT` environment variable (if set) +2. `KDN_DEFAULT_AGENT` environment variable (if set) 3. Error if neither is set (agent is required) **Example:** ```bash # Set the default agent for the current shell session -export KORTEX_CLI_DEFAULT_AGENT=claude +export KDN_DEFAULT_AGENT=claude # Register a workspace using the environment variable kdn init /path/to/project --runtime podman @@ -1037,14 +1037,14 @@ kdn init /path/to/another-project --runtime podman --agent goose - Agent names must contain only alphanumeric characters or underscores (e.g., `claude`, `goose`, `my_agent`) - Setting this environment variable is useful for automation scripts or when you consistently use the same agent -### `KORTEX_CLI_STORAGE` +### `KDN_STORAGE` Sets the default storage directory where kdn stores its data files. **Usage:** ```bash -export KORTEX_CLI_STORAGE=/custom/path/to/storage +export KDN_STORAGE=/custom/path/to/storage kdn init /path/to/project --runtime podman --agent claude ``` @@ -1053,14 +1053,14 @@ kdn init /path/to/project --runtime podman --agent claude The storage directory is determined in the following order (highest to lowest priority): 1. `--storage` flag (if specified) -2. `KORTEX_CLI_STORAGE` environment variable (if set) +2. `KDN_STORAGE` environment variable (if set) 3. Default: `$HOME/.kdn` **Example:** ```bash # Set a custom storage directory -export KORTEX_CLI_STORAGE=/var/lib/kortex +export KDN_STORAGE=/var/lib/kortex # All commands will use this storage directory kdn init /path/to/project --runtime podman --agent claude @@ -1070,14 +1070,14 @@ kdn list kdn list --storage /tmp/kortex-storage ``` -### `KORTEX_CLI_INIT_AUTO_START` +### `KDN_INIT_AUTO_START` Automatically starts a workspace after registration when using the `init` command. **Usage:** ```bash -export KORTEX_CLI_INIT_AUTO_START=1 +export KDN_INIT_AUTO_START=1 kdn init /path/to/project --runtime podman --agent claude ``` @@ -1086,7 +1086,7 @@ kdn init /path/to/project --runtime podman --agent claude The auto-start behavior is determined in the following order (highest to lowest priority): 1. `--start` flag (if specified) -2. `KORTEX_CLI_INIT_AUTO_START` environment variable (if set to a truthy value) +2. `KDN_INIT_AUTO_START` environment variable (if set to a truthy value) 3. Default: workspace is not started automatically **Supported Values:** @@ -1102,14 +1102,14 @@ Any other value (including `0`, `false`, `no`, or empty string) will not trigger ```bash # Set auto-start for the current shell session -export KORTEX_CLI_INIT_AUTO_START=1 +export KDN_INIT_AUTO_START=1 # Register and start a workspace automatically kdn init /path/to/project --runtime podman --agent claude # Workspace is now running # Override the environment variable with the flag -export KORTEX_CLI_INIT_AUTO_START=0 +export KDN_INIT_AUTO_START=0 kdn init /path/to/another-project --runtime podman --agent claude --start # Workspace is started despite env var being 0 ``` @@ -1645,7 +1645,7 @@ When registering a workspace, configurations are merged in this order (later con User-specific configurations are stored in the kdn storage directory: - **Default location**: `~/.kdn/config/` -- **Custom location**: Set via `--storage` flag or `KORTEX_CLI_STORAGE` environment variable +- **Custom location**: Set via `--storage` flag or `KDN_STORAGE` environment variable The storage directory contains: - `config/agents.json` - Agent-specific environment variables and mounts @@ -1781,7 +1781,7 @@ kdn init --runtime podman --agent claude kdn init --runtime podman --project my-custom-project --agent goose ``` -**Note:** The `--agent` flag is required (or set `KORTEX_CLI_DEFAULT_AGENT` environment variable) when registering a workspace. +**Note:** The `--agent` flag is required (or set `KDN_DEFAULT_AGENT` environment variable) when registering a workspace. ### Merging Behavior @@ -1928,13 +1928,13 @@ kdn init [sources-directory] [flags] #### Flags -- `--runtime, -r ` - Runtime to use for the workspace (required if `KORTEX_CLI_DEFAULT_RUNTIME` is not set) -- `--agent, -a ` - Agent to use for the workspace (required if `KORTEX_CLI_DEFAULT_AGENT` is not set) +- `--runtime, -r ` - Runtime to use for the workspace (required if `KDN_DEFAULT_RUNTIME` is not set) +- `--agent, -a ` - Agent to use for the workspace (required if `KDN_DEFAULT_AGENT` is not set) - `--model, -m ` - Model ID to configure for the agent (optional, uses agent's default if not specified) - `--workspace-configuration ` - Directory for workspace configuration files (default: `/.kaiden`) - `--name, -n ` - Human-readable name for the workspace (default: generated from sources directory) - `--project, -p ` - Custom project identifier to override auto-detection (default: auto-detected from git repository or source directory) -- `--start` - Start the workspace after registration (can also be set via `KORTEX_CLI_INIT_AUTO_START` environment variable) +- `--start` - Start the workspace after registration (can also be set via `KDN_INIT_AUTO_START` environment variable) - `--verbose, -v` - Show detailed output including all workspace information - `--output, -o ` - Output format (supported: `json`) - `--show-logs` - Show stdout and stderr from runtime commands (cannot be combined with `--output json`) @@ -1981,7 +1981,7 @@ Output: `a1b2c3d4e5f6...` (workspace ID, workspace is now running) **Register and start using environment variable:** ```bash -export KORTEX_CLI_INIT_AUTO_START=1 +export KDN_INIT_AUTO_START=1 kdn init /path/to/myproject --runtime podman --agent claude ``` Output: `a1b2c3d4e5f6...` (workspace ID, workspace is now running) @@ -2135,11 +2135,11 @@ kdn init /tmp/workspace --runtime podman --agent claude #### Notes -- **Runtime is required**: You must specify a runtime using either the `--runtime` flag or the `KORTEX_CLI_DEFAULT_RUNTIME` environment variable -- **Agent is required**: You must specify an agent using either the `--agent` flag or the `KORTEX_CLI_DEFAULT_AGENT` environment variable +- **Runtime is required**: You must specify a runtime using either the `--runtime` flag or the `KDN_DEFAULT_RUNTIME` environment variable +- **Agent is required**: You must specify an agent using either the `--agent` flag or the `KDN_DEFAULT_AGENT` environment variable - **Model is optional**: Use `--model` to specify a model ID for the agent. The flag takes precedence over any model defined in the agent's default settings files (`~/.kdn/config//`). If not provided, the agent uses its default model or the one configured in settings. All agents support model configuration: Claude (via `.claude/settings.json`), Goose (via `config.yaml`), and Cursor (via `.cursor/cli-config.json`) - **Project auto-detection**: The project identifier is automatically detected from git repository information or source directory path. Use `--project` flag to override with a custom identifier -- **Auto-start**: Use the `--start` flag or set `KORTEX_CLI_INIT_AUTO_START=1` to automatically start the workspace after registration, combining `init` and `start` into a single operation +- **Auto-start**: Use the `--start` flag or set `KDN_INIT_AUTO_START=1` to automatically start the workspace after registration, combining `init` and `start` into a single operation - All directory paths are converted to absolute paths for consistency - The workspace ID is a unique identifier generated automatically - Workspaces can be listed using the `workspace list` command diff --git a/pkg/cmd/init.go b/pkg/cmd/init.go index faf8441..06fa05c 100644 --- a/pkg/cmd/init.go +++ b/pkg/cmd/init.go @@ -104,29 +104,29 @@ func (i *initCmd) preRun(cmd *cobra.Command, args []string) error { // Determine runtime: flag takes precedence over environment variable if i.runtime == "" { // Check environment variable - if envRuntime := os.Getenv("KORTEX_CLI_DEFAULT_RUNTIME"); envRuntime != "" { + if envRuntime := os.Getenv("KDN_DEFAULT_RUNTIME"); envRuntime != "" { i.runtime = envRuntime } else { // Neither flag nor environment variable is set - return outputErrorIfJSON(cmd, i.output, fmt.Errorf("runtime is required: use --runtime flag or set KORTEX_CLI_DEFAULT_RUNTIME environment variable")) + return outputErrorIfJSON(cmd, i.output, fmt.Errorf("runtime is required: use --runtime flag or set KDN_DEFAULT_RUNTIME environment variable")) } } // Determine agent: flag takes precedence over environment variable if i.agent == "" { // Check environment variable - if envAgent := os.Getenv("KORTEX_CLI_DEFAULT_AGENT"); envAgent != "" { + if envAgent := os.Getenv("KDN_DEFAULT_AGENT"); envAgent != "" { i.agent = envAgent } else { // Neither flag nor environment variable is set - return outputErrorIfJSON(cmd, i.output, fmt.Errorf("agent is required: use --agent flag or set KORTEX_CLI_DEFAULT_AGENT environment variable")) + return outputErrorIfJSON(cmd, i.output, fmt.Errorf("agent is required: use --agent flag or set KDN_DEFAULT_AGENT environment variable")) } } // Determine start behavior: if flag is not set to true, check environment variable if !i.start { // Check environment variable - if envStart := os.Getenv("KORTEX_CLI_INIT_AUTO_START"); envStart != "" { + if envStart := os.Getenv("KDN_INIT_AUTO_START"); envStart != "" { // Accept "1", "true", "yes" as truthy values (case-insensitive) switch envStart { case "1", "true", "True", "TRUE", "yes", "Yes", "YES": @@ -335,20 +335,20 @@ kdn init --runtime podman --agent claude --show-logs`, cmd.Flags().StringVarP(&c.name, "name", "n", "", "Name for the workspace (default: generated from sources directory)") // Add runtime flag - cmd.Flags().StringVarP(&c.runtime, "runtime", "r", "", "Runtime to use for the workspace (required if KORTEX_CLI_DEFAULT_RUNTIME is not set)") + cmd.Flags().StringVarP(&c.runtime, "runtime", "r", "", "Runtime to use for the workspace (required if KDN_DEFAULT_RUNTIME is not set)") cmd.RegisterFlagCompletionFunc("runtime", completeRuntimeFlag) // Add project flag cmd.Flags().StringVarP(&c.project, "project", "p", "", "Custom project identifier (default: auto-detected from git repository or source directory)") // Add agent flag - cmd.Flags().StringVarP(&c.agent, "agent", "a", "", "Agent name for loading agent-specific configuration (required if KORTEX_CLI_DEFAULT_AGENT is not set)") + cmd.Flags().StringVarP(&c.agent, "agent", "a", "", "Agent name for loading agent-specific configuration (required if KDN_DEFAULT_AGENT is not set)") // Add model flag cmd.Flags().StringVarP(&c.model, "model", "m", "", "Model ID to configure for the agent (optional)") // Add start flag - cmd.Flags().BoolVar(&c.start, "start", false, "Start the workspace after registration (can also be set via KORTEX_CLI_INIT_AUTO_START environment variable)") + cmd.Flags().BoolVar(&c.start, "start", false, "Start the workspace after registration (can also be set via KDN_INIT_AUTO_START environment variable)") // Add verbose flag cmd.Flags().BoolVarP(&c.verbose, "verbose", "v", false, "Show detailed output") diff --git a/pkg/cmd/init_test.go b/pkg/cmd/init_test.go index 87f23f1..c4a0657 100644 --- a/pkg/cmd/init_test.go +++ b/pkg/cmd/init_test.go @@ -530,7 +530,7 @@ func TestInitCmd_PreRun(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() t.Run("with valid runtime from env", func(t *testing.T) { - t.Setenv("KORTEX_CLI_DEFAULT_RUNTIME", "fake") + t.Setenv("KDN_DEFAULT_RUNTIME", "fake") tempDir := t.TempDir() @@ -559,7 +559,7 @@ func TestInitCmd_PreRun(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() t.Run("with valid agent from env", func(t *testing.T) { - t.Setenv("KORTEX_CLI_DEFAULT_AGENT", "test-agent") + t.Setenv("KDN_DEFAULT_AGENT", "test-agent") tempDir := t.TempDir() @@ -588,7 +588,7 @@ func TestInitCmd_PreRun(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() t.Run("flag overrides env", func(t *testing.T) { - t.Setenv("KORTEX_CLI_DEFAULT_RUNTIME", "env-runtime") + t.Setenv("KDN_DEFAULT_RUNTIME", "env-runtime") tempDir := t.TempDir() @@ -617,7 +617,7 @@ func TestInitCmd_PreRun(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() t.Run("flag overrides env", func(t *testing.T) { - t.Setenv("KORTEX_CLI_DEFAULT_AGENT", "env-agent") + t.Setenv("KDN_DEFAULT_AGENT", "env-agent") tempDir := t.TempDir() @@ -821,22 +821,22 @@ func TestInitCmd_PreRun(t *testing.T) { envValue string expected bool }{ - {"KORTEX_CLI_INIT_AUTO_START=1", "1", true}, - {"KORTEX_CLI_INIT_AUTO_START=true", "true", true}, - {"KORTEX_CLI_INIT_AUTO_START=True", "True", true}, - {"KORTEX_CLI_INIT_AUTO_START=TRUE", "TRUE", true}, - {"KORTEX_CLI_INIT_AUTO_START=yes", "yes", true}, - {"KORTEX_CLI_INIT_AUTO_START=Yes", "Yes", true}, - {"KORTEX_CLI_INIT_AUTO_START=YES", "YES", true}, - {"KORTEX_CLI_INIT_AUTO_START=0", "0", false}, - {"KORTEX_CLI_INIT_AUTO_START=false", "false", false}, - {"KORTEX_CLI_INIT_AUTO_START=no", "no", false}, - {"KORTEX_CLI_INIT_AUTO_START=empty", "", false}, + {"KDN_INIT_AUTO_START=1", "1", true}, + {"KDN_INIT_AUTO_START=true", "true", true}, + {"KDN_INIT_AUTO_START=True", "True", true}, + {"KDN_INIT_AUTO_START=TRUE", "TRUE", true}, + {"KDN_INIT_AUTO_START=yes", "yes", true}, + {"KDN_INIT_AUTO_START=Yes", "Yes", true}, + {"KDN_INIT_AUTO_START=YES", "YES", true}, + {"KDN_INIT_AUTO_START=0", "0", false}, + {"KDN_INIT_AUTO_START=false", "false", false}, + {"KDN_INIT_AUTO_START=no", "no", false}, + {"KDN_INIT_AUTO_START=empty", "", false}, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - t.Setenv("KORTEX_CLI_INIT_AUTO_START", tt.envValue) + t.Setenv("KDN_INIT_AUTO_START", tt.envValue) tempDir := t.TempDir() @@ -867,7 +867,7 @@ func TestInitCmd_PreRun(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() t.Run("flag true overrides env", func(t *testing.T) { - t.Setenv("KORTEX_CLI_INIT_AUTO_START", "0") + t.Setenv("KDN_INIT_AUTO_START", "0") tempDir := t.TempDir() @@ -1989,9 +1989,9 @@ func TestInitCmd_E2E(t *testing.T) { func TestInitCmd_E2E_AutoStartWithEnv(t *testing.T) { // Note: This test function cannot use t.Parallel() because subtests use t.Setenv() - t.Run("registers and starts workspace with KORTEX_CLI_INIT_AUTO_START environment variable", func(t *testing.T) { + t.Run("registers and starts workspace with KDN_INIT_AUTO_START environment variable", func(t *testing.T) { t.Run("with env var set to 1", func(t *testing.T) { - t.Setenv("KORTEX_CLI_INIT_AUTO_START", "1") + t.Setenv("KDN_INIT_AUTO_START", "1") storageDir := t.TempDir() sourcesDir := t.TempDir() diff --git a/pkg/cmd/root.go b/pkg/cmd/root.go index 017cd4b..a6494e7 100644 --- a/pkg/cmd/root.go +++ b/pkg/cmd/root.go @@ -34,7 +34,7 @@ func NewRootCmd() *cobra.Command { } // Check for environment variable - if envStorage := os.Getenv("KORTEX_CLI_STORAGE"); envStorage != "" { + if envStorage := os.Getenv("KDN_STORAGE"); envStorage != "" { defaultStoragePath = envStorage } diff --git a/pkg/cmd/root_test.go b/pkg/cmd/root_test.go index 0a53794..da6cf1f 100644 --- a/pkg/cmd/root_test.go +++ b/pkg/cmd/root_test.go @@ -164,7 +164,7 @@ func TestRootCmd_StorageEnvVariable(t *testing.T) { t.Run("env variable sets default", func(t *testing.T) { // Set the environment variable envPath := filepath.Join(t.TempDir(), "from-env") - t.Setenv("KORTEX_CLI_STORAGE", envPath) + t.Setenv("KDN_STORAGE", envPath) rootCmd := NewRootCmd() flag := rootCmd.PersistentFlags().Lookup("storage") @@ -181,7 +181,7 @@ func TestRootCmd_StorageEnvVariable(t *testing.T) { t.Run("flag overrides env variable", func(t *testing.T) { // Set the environment variable envPath := filepath.Join(t.TempDir(), "from-env") - t.Setenv("KORTEX_CLI_STORAGE", envPath) + t.Setenv("KDN_STORAGE", envPath) rootCmd := NewRootCmd() buf := new(bytes.Buffer) @@ -210,7 +210,7 @@ func TestRootCmd_StorageEnvVariable(t *testing.T) { t.Run("default used when env var not set", func(t *testing.T) { // Explicitly unset the environment variable (in case it was set in the shell) - t.Setenv("KORTEX_CLI_STORAGE", "") + t.Setenv("KDN_STORAGE", "") rootCmd := NewRootCmd() flag := rootCmd.PersistentFlags().Lookup("storage") diff --git a/skills/commit/SKILL.md b/skills/commit/SKILL.md index 65542f3..cd7fd5f 100644 --- a/skills/commit/SKILL.md +++ b/skills/commit/SKILL.md @@ -257,7 +257,7 @@ Closes #55 **Test addition:** ```text -test: add tests for KORTEX_CLI_STORAGE support +test: add tests for KDN_STORAGE support Ensures the environment variable is properly respected and has the correct priority order relative to the --storage flag. diff --git a/skills/implementing-command-patterns/SKILL.md b/skills/implementing-command-patterns/SKILL.md index d34d561..8a68fd8 100644 --- a/skills/implementing-command-patterns/SKILL.md +++ b/skills/implementing-command-patterns/SKILL.md @@ -152,16 +152,16 @@ type myCmd struct { func (m *myCmd) preRun(cmd *cobra.Command, args []string) error { // String flag: check if empty, then try environment variable if m.runtime == "" { - if envRuntime := os.Getenv("KORTEX_CLI_DEFAULT_RUNTIME"); envRuntime != "" { + if envRuntime := os.Getenv("KDN_DEFAULT_RUNTIME"); envRuntime != "" { m.runtime = envRuntime } else { - return fmt.Errorf("runtime is required: use --runtime flag or set KORTEX_CLI_DEFAULT_RUNTIME environment variable") + return fmt.Errorf("runtime is required: use --runtime flag or set KDN_DEFAULT_RUNTIME environment variable") } } // Boolean flag: check if false, then try environment variable if !m.start { - if envStart := os.Getenv("KORTEX_CLI_INIT_AUTO_START"); envStart != "" { + if envStart := os.Getenv("KDN_INIT_AUTO_START"); envStart != "" { // Parse truthy values switch envStart { case "1", "true", "True", "TRUE", "yes", "Yes", "YES": @@ -184,9 +184,9 @@ func NewMyCmd() *cobra.Command { } // Bind flags with helpful descriptions mentioning environment variable fallback - cmd.Flags().StringVarP(&c.runtime, "runtime", "r", "", "Runtime to use (or set KORTEX_CLI_DEFAULT_RUNTIME)") - cmd.Flags().StringVarP(&c.agent, "agent", "a", "", "Agent to use (or set KORTEX_CLI_DEFAULT_AGENT)") - cmd.Flags().BoolVar(&c.start, "start", false, "Auto-start (or set KORTEX_CLI_INIT_AUTO_START)") + cmd.Flags().StringVarP(&c.runtime, "runtime", "r", "", "Runtime to use (or set KDN_DEFAULT_RUNTIME)") + cmd.Flags().StringVarP(&c.agent, "agent", "a", "", "Agent to use (or set KDN_DEFAULT_AGENT)") + cmd.Flags().BoolVar(&c.start, "start", false, "Auto-start (or set KDN_INIT_AUTO_START)") return cmd } @@ -210,7 +210,7 @@ func NewMyCmd() *cobra.Command { func TestMyCmd_PreRun(t *testing.T) { t.Run("uses environment variable when flag not set", func(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() - t.Setenv("KORTEX_CLI_DEFAULT_RUNTIME", "podman") + t.Setenv("KDN_DEFAULT_RUNTIME", "podman") c := &myCmd{} cmd := &cobra.Command{} @@ -228,7 +228,7 @@ func TestMyCmd_PreRun(t *testing.T) { t.Run("flag takes precedence over environment variable", func(t *testing.T) { // Note: Cannot use t.Parallel() when using t.Setenv() - t.Setenv("KORTEX_CLI_DEFAULT_RUNTIME", "fake") + t.Setenv("KDN_DEFAULT_RUNTIME", "fake") c := &myCmd{runtime: "podman"} // Set via flag cmd := &cobra.Command{} @@ -263,7 +263,7 @@ func TestMyCmd_PreRun(t *testing.T) { for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - t.Setenv("KORTEX_CLI_INIT_AUTO_START", tt.envValue) + t.Setenv("KDN_INIT_AUTO_START", tt.envValue) c := &myCmd{} cmd := &cobra.Command{} @@ -283,7 +283,7 @@ func TestMyCmd_PreRun(t *testing.T) { } ``` -**Reference:** See `pkg/cmd/init.go` for a complete implementation with `KORTEX_CLI_DEFAULT_RUNTIME`, `KORTEX_CLI_DEFAULT_AGENT`, and `KORTEX_CLI_INIT_AUTO_START`. +**Reference:** See `pkg/cmd/init.go` for a complete implementation with `KDN_DEFAULT_RUNTIME`, `KDN_DEFAULT_AGENT`, and `KDN_INIT_AUTO_START`. ## JSON Output Support Pattern diff --git a/skills/working-with-config-system/SKILL.md b/skills/working-with-config-system/SKILL.md index 6a02bb2..227358d 100644 --- a/skills/working-with-config-system/SKILL.md +++ b/skills/working-with-config-system/SKILL.md @@ -81,7 +81,7 @@ This allows users to quickly specify a model without manually editing settings f ## Configuration File Locations -All user-specific configuration files are stored under the storage directory (default: `~/.kdn`, configurable via `--storage` flag or `KORTEX_CLI_STORAGE` environment variable): +All user-specific configuration files are stored under the storage directory (default: `~/.kdn`, configurable via `--storage` flag or `KDN_STORAGE` environment variable): - **Agent configs**: `/config/agents.json` - **Project configs**: `/config/projects.json` @@ -368,7 +368,7 @@ rootCmd.Execute() - Invalid JSON or validation errors are reported - All loaders follow the module design pattern - Cross-platform compatible (uses `filepath.Join()`, `t.TempDir()`) -- Storage directory is configurable via `--storage` flag or `KORTEX_CLI_STORAGE` env var +- Storage directory is configurable via `--storage` flag or `KDN_STORAGE` env var - Uses nested JSON structure for clarity and extensibility - Model types are imported from external API package for consistency