Skip to content

refactor: change .kortex-cli directory to .kdn#205

Merged
feloy merged 1 commit intoopenkaiden:mainfrom
feloy:dot-kdn
Apr 8, 2026
Merged

refactor: change .kortex-cli directory to .kdn#205
feloy merged 1 commit intoopenkaiden:mainfrom
feloy:dot-kdn

Conversation

@feloy
Copy link
Copy Markdown
Contributor

@feloy feloy commented Apr 8, 2026

fixes #201

@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Apr 8, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 23df4a19-93ea-4a7e-8a95-75b1d871feac

📥 Commits

Reviewing files that changed from the base of the PR and between 32799a1 and e9cafbf.

📒 Files selected for processing (6)
  • AGENTS.md
  • README.md
  • pkg/cmd/root.go
  • pkg/cmd/root_test.go
  • skills/cross-platform-development/SKILL.md
  • skills/working-with-config-system/SKILL.md
✅ Files skipped from review due to trivial changes (5)
  • skills/working-with-config-system/SKILL.md
  • pkg/cmd/root.go
  • pkg/cmd/root_test.go
  • skills/cross-platform-development/SKILL.md
  • AGENTS.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • README.md

📝 Walkthrough

Walkthrough

Updated default storage directory name from .kortex-cli to .kdn across documentation, the CLI root command default --storage flag, and related tests; no behavioral changes beyond the default path string.

Changes

Cohort / File(s) Summary
Documentation
AGENTS.md, README.md, skills/cross-platform-development/SKILL.md, skills/working-with-config-system/SKILL.md
Replaced documented storage/config paths and examples from ~/.kortex-cli/... to ~/.kdn/... (agent defaults, project/agent config examples, --storage doc, Podman runtime path examples).
CLI Implementation
pkg/cmd/root.go
Changed computed default for persistent --storage flag: fallback directory name now ~/.kdn (and ".kdn" when home resolution fails) instead of ~/.kortex-cli. KORTEX_CLI_STORAGE behavior unchanged.
Tests
pkg/cmd/root_test.go
Updated assertions to expect .kdn suffix in TestRootCmd_StorageFlag and TestRootCmd_StorageEnvVariable; error/expected strings adjusted accordingly.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Possibly related issues

  • reorganize ~/.kdn folder #212: Related change in storage directory usage and proposed reorganization under ~/.kdn; this PR’s rename aligns with that objective.
🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly describes the main change: renaming the storage directory from .kortex-cli to .kdn, which is the primary objective of this PR.
Description check ✅ Passed The description references issue #201, which defines the storage directory rename requirement from .kortex-cli to .kdn.
Linked Issues check ✅ Passed The PR successfully implements the requirement from issue #201 to rename the storage directory from .kortex-cli to .kdn across documentation and code.
Out of Scope Changes check ✅ Passed All changes consistently address the directory rename requirement; no unrelated modifications were introduced.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@codecov-commenter
Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@feloy feloy requested review from benoitf and jeffmaury April 8, 2026 06:29
@feloy feloy enabled auto-merge (squash) April 8, 2026 08:40
@feloy feloy disabled auto-merge April 8, 2026 08:40
Copy link
Copy Markdown
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering why the configuration folder should be .kdn and not .kaiden

usually most of cli tools have short names but the config folder is keeping the name of the project no ?

Copy link
Copy Markdown

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (2)
pkg/cmd/root.go (1)

31-33: Normalize fallback storage path to absolute.

When os.UserHomeDir() fails, fallback remains relative (.kdn). Prefer resolving it with filepath.Abs() to keep storage behavior deterministic.

♻️ Proposed refactor
 homeDir, err := os.UserHomeDir()
 defaultStoragePath := ".kdn" // fallback to current directory
 if err == nil {
 	defaultStoragePath = filepath.Join(homeDir, ".kdn")
+} else if absFallback, absErr := filepath.Abs(defaultStoragePath); absErr == nil {
+	defaultStoragePath = absFallback
 }

As per coding guidelines: "**/*.go: Convert relative paths to absolute with filepath.Abs()".

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/cmd/root.go` around lines 31 - 33, The fallback storage path
defaultStoragePath is left as a relative ".kdn" when os.UserHomeDir() fails;
call filepath.Abs(".kdn") and assign the resolved absolute path to
defaultStoragePath (handle any error from filepath.Abs by retaining the original
value or returning/logging as appropriate) so storage path is
deterministic—update the logic around defaultStoragePath/homeDir in root.go to
use filepath.Abs for the fallback.
pkg/cmd/root_test.go (1)

87-90: Make this test environment-independent.

TestRootCmd_StorageFlag can fail if KORTEX_CLI_STORAGE is set in the process environment. Consider isolating env state in this test to avoid flakes.

♻️ Proposed refactor
 func TestRootCmd_StorageFlag(t *testing.T) {
-	t.Parallel()
+	t.Setenv("KORTEX_CLI_STORAGE", "")
 
 	rootCmd := NewRootCmd()

As per coding guidelines: "**/*_test.go: Tests using t.Setenv() cannot use t.Parallel() on the parent test function."

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@pkg/cmd/root_test.go` around lines 87 - 90, TestRootCmd_StorageFlag is flaky
because it depends on the KORTEX_CLI_STORAGE env var; unset it at test start
with t.Setenv("KORTEX_CLI_STORAGE", "") so flag.DefValue is evaluated in a clean
environment, and ensure the test (or its parent) does not call t.Parallel() per
the guideline about t.Setenv; update the TestRootCmd_StorageFlag test
accordingly to call t.Setenv before any flag evaluation and remove any
t.Parallel() usage.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Nitpick comments:
In `@pkg/cmd/root_test.go`:
- Around line 87-90: TestRootCmd_StorageFlag is flaky because it depends on the
KORTEX_CLI_STORAGE env var; unset it at test start with
t.Setenv("KORTEX_CLI_STORAGE", "") so flag.DefValue is evaluated in a clean
environment, and ensure the test (or its parent) does not call t.Parallel() per
the guideline about t.Setenv; update the TestRootCmd_StorageFlag test
accordingly to call t.Setenv before any flag evaluation and remove any
t.Parallel() usage.

In `@pkg/cmd/root.go`:
- Around line 31-33: The fallback storage path defaultStoragePath is left as a
relative ".kdn" when os.UserHomeDir() fails; call filepath.Abs(".kdn") and
assign the resolved absolute path to defaultStoragePath (handle any error from
filepath.Abs by retaining the original value or returning/logging as
appropriate) so storage path is deterministic—update the logic around
defaultStoragePath/homeDir in root.go to use filepath.Abs for the fallback.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: b5378050-d6f2-4f9c-888b-32d1cf9642d3

📥 Commits

Reviewing files that changed from the base of the PR and between a005348 and c183208.

📒 Files selected for processing (6)
  • AGENTS.md
  • README.md
  • pkg/cmd/root.go
  • pkg/cmd/root_test.go
  • skills/cross-platform-development/SKILL.md
  • skills/working-with-config-system/SKILL.md

@feloy
Copy link
Copy Markdown
Contributor Author

feloy commented Apr 8, 2026

I'm wondering why the configuration folder should be .kdn and not .kaiden

usually most of cli tools have short names but the config folder is keeping the name of the project no ?

I tried to differentiate the cli vs the project: kdn vs kaiden.

Before it was kortex-cli related to the cli, so I renamed to kdn also related to cli.

In #208 is was .kortex related to the project, I renamed to .kaiden also related to the project.

But we can have another approach if you prefer

@benoitf
Copy link
Copy Markdown
Contributor

benoitf commented Apr 8, 2026

ok let's keep kdn but then I think it should go to ~/config/ folder (like the Desktop app) not directly to the home folder

so we'll have ~/.config/kaiden (for the UI) and ~/.config/kdn for the cli (at least on Linux and macOS)

because I think it might be confusing then to have in the home folder a ~/.kdn and a ~/.kaiden (if for example I start the cli from the home folder)

Copy link
Copy Markdown
Contributor

@benoitf benoitf left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might need to move it to ~/.config subfolder (at least on macOS/Linux)

@benoitf
Copy link
Copy Markdown
Contributor

benoitf commented Apr 8, 2026

config files --> ~/.config/kdn
storage files --> ~/.local/share/kdn

Signed-off-by: Philippe Martin <phmartin@redhat.com>
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 8, 2026

Welcome to Codecov 🎉

Once you merge this PR into your default branch, you're all set! Codecov will compare coverage reports and display results in all future pull requests.

ℹ️ You can also turn on project coverage checks and project coverage reporting on Pull Request comment

Thanks for integrating Codecov - We've got you covered ☂️

@feloy feloy merged commit 5c73370 into openkaiden:main Apr 8, 2026
10 of 22 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

change .kortex-cli storage directory name

4 participants