Skip to content

Linear API token from settings.local.json not used by CLI commands #381

@acreeger

Description

@acreeger

Problem

When using Linear as the issue management provider, the LINEAR_API_TOKEN configured in settings.local.json is not read by CLI commands like il a (add-issue).

The settings schema supports storing the token:

// .iloom/settings.local.json
{
  "issueManagement": {
    "provider": "linear",
    "linear": {
      "teamId": "PROD",
      "apiToken": "lin_api_..."
    }
  }
}

However, the Linear SDK wrapper (src/utils/linear.ts) only checks process.env.LINEAR_API_TOKEN:

function getLinearApiToken(): string {
  const token = process.env.LINEAR_API_TOKEN
  if (!token) {
    throw new LinearServiceError(
      'UNAUTHORIZED',
      'LINEAR_API_TOKEN not set. Configure in settings.local.json or set environment variable.',
    )
  }
  return token
}

The error message suggests configuring in settings.local.json, but that path doesn't actually work.

Reproduction

  1. Configure Linear in .iloom/settings.local.json with apiToken
  2. Ensure LINEAR_API_TOKEN is NOT set in environment (unset LINEAR_API_TOKEN)
  3. Run il a "some issue description"
  4. Observe error: LINEAR_API_TOKEN not set. Configure in settings.local.json or set environment variable.

Notes

  • The MCP server flow (src/utils/mcp.ts:79-82) does read from settings and passes it through, but direct CLI commands don't
  • The IssueTrackerFactory.create() receives settings but doesn't pass the token to where it's needed

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    Status

    Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions