Skip to content

feat: Warn when running from local node_modules #87

Closed

Description

@admarble

Problem

Users who have sequant as a local dependency (in their project's package.json) will run the local version instead of fetching from npm when using npx sequant.

This caused confusion when a user had an old local install with a buggy hardcoded version (0.1.0), while thinking they were running the latest.

Solution

Detect if CLI is running from a project's node_modules and warn:

// bin/cli.ts - early in startup
const isLocalInstall = __dirname.includes('/node_modules/sequant/');
if (isLocalInstall) {
  console.warn(chalk.yellow(
    '⚠️  Running sequant from local node_modules\n' +
    '   For latest version: npx sequant@latest\n' +
    '   To remove local: npm uninstall sequant\n'
  ));
}

Why This Matters

Scenario What user expects What happens
npx sequant with local dep Latest from npm Uses stale node_modules
npx sequant@latest Latest from npm ✅ Correct
npx sequant without local dep Latest from npm ✅ Correct

The warning makes the hidden behavior visible.

Acceptance Criteria

  • Warning shown when running from */node_modules/sequant/*
  • Warning includes remediation steps (npx @latest, npm uninstall)
  • Warning is yellow/non-blocking (doesn't prevent execution)
  • Warning does NOT show when running from npx cache (~/.npm/_npx/)
  • Warning does NOT show when running from global install

Edge Cases

  • Some users may intentionally pin a local version - warning is informational only
  • Don't warn for npx cache locations (those are expected)

Discovered From

Session where user's workout project had "sequant": "^1.1.2" in package.json with stale node_modules/sequant containing buggy build.

Activity

  1. added
    enhancement
    on Jan 14, 2026
  2. admarble commented on Jan 18, 2026

    @admarble
    ContributorAuthor

    📋 Implementation Plan

    Acceptance Criteria

    • AC-1: Warning shown when running from */node_modules/sequant/*
    • AC-2: Warning includes remediation steps (npx @latest, npm uninstall)
    • AC-3: Warning is yellow/non-blocking (doesn't prevent execution)
    • AC-4: Warning does NOT show when running from npx cache (~/.npm/_npx/)
    • AC-5: Warning does NOT show when running from global install

    Verification Methods

    AC Method Notes
    AC-1 Integration Test CLI startup behavior
    AC-2 Unit Test Message content validation
    AC-3 Integration Test Command completes after warning
    AC-4 Unit Test isLocalNodeModulesInstall() returns false
    AC-5 Unit Test isLocalNodeModulesInstall() returns false

    Implementation Steps

    1. Modify bin/cli.ts - Add local install detection + warning at startup
    2. Add tests - Verify warning message content

    Key Decision

    • --quiet flag: Will suppress the warning for users who intentionally pin local versions

    Effort

    • Scope: 1 file change + test additions
    • Complexity: Low (detection logic already exists in src/lib/version-check.ts)

    🤖 Generated by /spec

  3. added
    planned
    on Jan 18, 2026
  4. added a commit that references this issue on Jan 18, 2026
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

    enhancementplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions