Skip to content

fix(templates): scripts/dev symlinks target whichever sequant package ran the command — npx-cache targets get evicted, npm-link targets are machine-specific #991

Closed as not planned

Description

@admarble

Problem

scripts/dev/*.sh in a downstream project are symlinks whose target is computed as relative(dest, <templates dir of the sequant package that ran init/sync>) (src/lib/templates.ts:499-506, symlinkDir). The comment calls these "portable symlinks", but the target is wherever the invoking package happens to live:

How sequant ran Symlink target Consequence
npx sequant@latest … / plugin MCP server ~/.npm/_npx/<hash>/node_modules/sequant/templates/scripts/… npx cache is evicted; links go dead
npm link to a sibling checkout ../../../sequant/templates/scripts/… machine-specific; wrong on any other clone
global install <prefix>/lib/node_modules/sequant/… machine-specific
local devDependency ../../node_modules/sequant/templates/scripts/… the only target that survives git clone && npm install

init does not gitignore scripts/dev/ (GITIGNORE_ENTRIES is .sequant/ only), so downstream projects commit these links and every re-sync from a different runner shows as churn on three tracked files.

Evidence (downstream, 2026-09-06)

matcha-maps: a sync fired by the plugin's npx sequant@latest serve (#988) re-pointed scripts/dev/{new-feature,cleanup-worktree,list-worktrees}.sh from ../sequant/templates/… (sibling checkout) to ~/.npm/_npx/ff1581e8907a8ea7/…. Committing that would have broken the worktree scripts on every other machine and, once the cache was evicted, on this one. The user reverted by hand.

The npm link variant is already recorded as a known trap in project memory ("revert with git checkout scripts/dev/*.sh"), i.e. users are working around this rather than sequant handling it.

Acceptance Criteria

  • AC-1: When the project has node_modules/sequant/templates/scripts/ (local dependency), symlinks target that path regardless of which sequant binary is running the command.
  • AC-2: When there is no local node_modules/sequant and the resolved templates dir is inside an npx cache (/_npx/ path segment) or outside the project tree, sequant copies the scripts instead of symlinking and prints why (one line, names --no-symlinks as the explicit form).
  • AC-3: sequant sync --dry-run / update --dry-run show the symlink target that would be written when it differs from the current one.
  • AC-4: sequant doctor flags a scripts/dev/*.sh symlink whose target does not exist or resolves outside node_modules/sequant and the project tree, with the fix command.
  • AC-5: Tests cover the four rows above with SEQUANT_TEMPLATES_DIR pointing at (a) a fake node_modules/sequant, (b) a fake _npx cache path, (c) a sibling directory; mutation-verified per CLAUDE.md.

Notes

Activity

  1. added
    bug
    cli
    on Sep 7, 2026
  2. admarble commented on Sep 7, 2026

    @admarble
    ContributorAuthor

    Sibling from the same 2026-09-06 downstream sync: #990 (AGENTS.md regenerated unconditionally).

  3. admarble commented on Sep 8, 2026

    @admarble
    ContributorAuthor

    Runner context — opencode dogfood sample (graph-2026-09 node 16, #997). This issue is being run spec→exec→qa twice as a sample for the opencode promotion gate: once with --agent opencode (base branch dogfood/opencode-2026-09, which carries the generated .opencode/ wrappers and hook shim), then once with the default claude-code driver. The resulting PRs are samples and will not be merged; the owner reads them for defects and the runner records verdict, skill-marker presence, fan-out, cost and wall time in docs/investigations/multi-backend-2026-07.md ("Dogfood 2026-09"). Work the issue exactly as you would for real — same ACs, same PR body discipline, mutation records for gate tests — but do not file any issue and do not merge. Commit a WIP within 5 minutes and every ~10 minutes; targeted tests in the foreground only; a phase silent for 30 minutes is killed. Cost cap for the opencode arm across all three sample issues: $30.

  4. admarble commented on Sep 9, 2026

    @admarble
    ContributorAuthor

    Consolidated into #990 (W2 plan D1: both edit src/lib/templates.ts and are one contract — sync never writes something the downstream user did not ask for). This issue's ACs are #990 AC-4 (prefer node_modules/sequant), AC-5 (npx-cache / outside-tree → copies, one-line reason — the fixture is the verbatim target committed in sequant-io/sequant-landing), AC-6 (--dry-run shows retargets) and AC-7 (doctor flags dead/outside links). Plan: docs/internal/graph-2026-09-w2/.

  5. added a commit that references this issue on Sep 25, 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

    bugcli

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions