Skip to content

[Bug] /doctor and /skills use process.cwd() instead of getProjectRoot(), breaking when run from subdirectories #1306

Description

@akramcodez

Description

Nanocoder maintains a distinction between process.cwd() and getProjectRoot(). When Nanocoder is started from or navigates into a subdirectory within a repository, project configuration, lockfiles, and .nanocoder/ assets reside at getProjectRoot(). However, getDaemonLock() in source/commands/doctor.tsx and planPromotion / checkSkillBundle in source/commands/skills.tsx hardcode process.cwd(). This causes /doctor to look for daemon lockfiles in the subdirectory, and /skills check <name> to fail to find skills stored under the root's .nanocoder/skills/.

Environment

  • OS: Linux / macOS / Windows
  • Node version: v20+ / v22+
  • Nanocoder version: 1.30.0
  • Provider: Any
  • Model: Any

Steps to Reproduce

  1. In a repository initialized with Nanocoder, cd into a subdirectory (e.g. cd packages/web or cd source/).
  2. Run /doctor or /skills check <name>.
  3. /doctor fails to locate the project daemon lockfile, and /skills check reports that .nanocoder/skills/<name> does not exist.

Expected Behavior

/doctor and /skills should use getProjectRoot() to consistently target the repository's configuration root.

Actual Behavior

process.cwd() is used, causing failures when operating in project subdirectories.

Logs/Screenshots

In source/commands/doctor.tsx:L124:

async function getDaemonLock(): Promise<DaemonLock | null> {
    const projectRoot = process.cwd(); // BUG: should be getProjectRoot()
    const lock = await readLockfile(projectRoot);
    ...

In source/commands/skills.tsx:L322:

const report = await checkSkillBundle(process.cwd(), name); // BUG: should be getProjectRoot()

Additional Context

  • I have searched existing issues to ensure this is not a duplicate
  • I can reproduce this issue consistently
  • This issue occurs with the latest version of nanocoder

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingcli

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions