Skip to content

Release 0.28.0: Anirudh's #708, and agents get Trail's tools after an npx sign-in - #709

Merged
shhdwi merged 4 commits into
mainfrom
fix/npx-agent-entries
Oct 27, 2026
Merged

shhdwi merged 4 commits into
mainfrom
fix/npx-agent-entries

Conversation

@shhdwi

@shhdwi shhdwi commented Oct 27, 2026 •

Copy link
Copy Markdown
Collaborator

What's in 0.28.0

Anirudh's #708 (already on main): Trail acts at the moments a session needs it.

  • Learnings arrive just before an edit.
  • A trail check runs before commit, push and PR, and stops the command once when the change goes against a learning.
  • A laptop can be signed in to several workspaces, with one workspace per repo.

This PR:

  • Agents get Trail's tools after an npx sign-in.
    • The bug: on a laptop without trail installed, npx -y @trailhq/trail-code@latest login --code … (the connect page's prompt) set up Claude Code, Cursor and Codex with a trail command that isn't there, so they got no tools. Under npx, trail is on PATH only for that one process (npx's temporary node_modules/.bin).
    • The fix: commandOnPath in src/brand.ts skips node_modules/.bin folders, so those laptops get npx -y @trailhq/trail-code mcp --brains.
  • Logout: trail logout --workspace of the last workspace now also removes Cursor's entry, as plain trail logout does.
  • Version and notes: version 0.28.0 (a minor bump, since Connect to Trail Cloud at the moments trail is used #708 adds behaviour), with release notes in plain words.

How it was checked

  • Full suite with a scratch HOME: 4115 pass, 5 fail.
    • 2 are the graft-to-trail tests that only fail on Shrish's machine.
    • 3 failed while the CPU was busy with an end-to-end run, and pass when run alone.
  • New test: test/hosts-trail.test.ts covers the npx PATH case. It failed before the fix.
  • End to end, combined build (Connect to Trail Cloud at the moments trail is used #708 plus this fix), against a local trail-cloud:
    • Fresh laptop, no trail installed: real Claude Code ran the connect page's copied prompt, and the laptop signed in with no browser. The Claude Code, Cursor and Codex entries came out as npx. A new session got all 6 workspace tools and read the brand, and the page's tile turned Connected.
    • A laptop with this build installed: in a clone of trail-cloud, Claude edited internal/store/login_codes.go. It got the learning on that file before the edit, and its commit went through first time, because trail check found no conflicts.
  • What's left: laptops already signed in through npx on 0.27.0 keep the broken entry until they sign in again.

trail check: no conflicts.

🤖 Generated with Claude Code

@trailhq-graft

trailhq-graft Bot commented Oct 27, 2026 •

Copy link
Copy Markdown

🌱 graft blast radius

2 areas changed → 4 areas can be affected. 4 dependent symbols, depth 2.
Tests: 2 areas updated their tests.
Tag: @anirudhkumar-nanonets — 6 of 6 areas

flowchart TB
  A0(("Claude Hook Integration<br/>1 symbol"))
  A1(("MCP Server Configuration<br/>1 symbol"))
  A2(("Upkeep Trail Migration<br/>1 symbol"))
  A3(("Team File Parsing<br/>1 symbol"))
  classDef reached fill:#D9EDF3,stroke:#3AA7C9,stroke-width:1.5px,color:#0E313C;
  class A0,A1,A2,A3 reached;
Loading
Can be affected Symbols Nearest hop Reached from
Claude Hook Integration 1 src/claude/hooks.ts:L495-L579 main — calls, depth 1 CLI Branding
MCP Server Configuration 1 src/hosts/mcp-config.ts:L69-L75 serverEntry — calls, depth 2 CLI Branding
Upkeep Trail Migration 1 src/upkeep-run.ts:L73-L77 shouldMoveToTrail — calls, depth 2 CLI Branding
Team File Parsing 1 src/cloud/team-file.ts:L70-L74 teamLine — calls, depth 2 CLI Branding
Who knows this code — 1 person across 6 areas
Area Who knows it
CLI Branding · changed @anirudhkumar-nanonets — 62 commits, last today
Pre-Bash Validation · changed @anirudhkumar-nanonets — 1 commit, last today
Claude Hook Integration · affected @anirudhkumar-nanonets — 17 commits, last today
MCP Server Configuration · affected @anirudhkumar-nanonets — 5 commits, last 14d ago
Upkeep Trail Migration · affected @anirudhkumar-nanonets — 6 commits, last 12d ago
Team File Parsing · affected @anirudhkumar-nanonets — 1 commit, last today

Ownership is git history over each area's own files, weighted towards recent work (120-day half-life). Merge commits and bots are dropped, and you are dropped from your own PR. A name with no @ has no GitHub handle in its commit email — tag them by hand, or add a .mailmap entry. A suggestion from history, not a CODEOWNERS rule.

All 4 dependent symbols, grouped by area

Claude Hook Integration — 1 symbol in 1 file

  • src/claude/hooks.ts:L495-L579 — main (calls, depth 1)
    495: export async function main(event: string): Promise<void> {

MCP Server Configuration — 1 symbol in 1 file

  • src/hosts/mcp-config.ts:L69-L75 — serverEntry (calls, depth 2)

Upkeep Trail Migration — 1 symbol in 1 file

  • src/upkeep-run.ts:L73-L77 — shouldMoveToTrail (calls, depth 2)

Team File Parsing — 1 symbol in 1 file

  • src/cloud/team-file.ts:L70-L74 — teamLine (calls, depth 2)
Test signal per changed area — 2 ✓

Reached = a node under a test path has a resolved edge into the changed symbol. It undercounts anything called indirectly — through a CLI, a spawned process or a dynamic import — so read a low ratio as “look here”, never as a coverage gate.

  • ✓ CLI Branding — 1 of 2 reached · 1 test file changed here: test/hosts-trail.test.ts
    • not reached: logoutCommand
  • ✓ Pre-Bash Validation — 3 of 4 reached · 1 test file changed here: test/trail-scenario-hooks.test.ts
    • not reached: main
1 test suite also references this code

1 symbol, kept out of the diagram and the table so they cannot crowd out the areas a reviewer has to look at.

  • test/trail-name.test.ts

⚠️ 6 changed files not in the graph (.trail/learnings/2026-10-27-an-agent-seeing-no-trail-tools-shrish.md, .trail/learnings/2026-10-27-claude-code-s-hooks-never-run-shrish.md, .trail/learnings/2026-10-27-under-npx-trail-is-on-path-shrish.md, CHANGELOG.md, package-lock.json) — no parser claims the extension, or the index predates the file.

graft blast · origin/main...HEAD · depth 2 · 12 changed files

Open the interactive graph → — click an area to see its dependent symbols at file:line.

github-actions Bot added a commit that referenced this pull request Oct 27, 2026
Shrish Dwivedi added 2 commits October 27, 2026 20:32
… release 0.27.1

`npx -y @trailhq/trail-code login --code` on a laptop without trail wrote
Claude Code, Cursor and Codex entries with `"command": "trail"`. Under
npx, trail is on PATH only for that process (npx's temporary
node_modules/.bin), so trailOnPath() said yes. Agents start with the
person's PATH and got no tools.

commandOnPath now skips node_modules/.bin folders, so those laptops get
the npx launch. Verified end to end: a fresh sandbox laptop with no trail
ran the page's prompt in Claude Code, and a new session got all 6
workspace tools.
0.28.0 rather than 0.27.1: #708 adds behaviour (learnings before an edit,
a check before commit/push/PR, several workspaces per laptop), not just
the npx fix. Release notes describe both in plain words.

Also: logout --workspace of the last workspace now removes Cursor's
workspace entry too, as plain logout does.
@shhdwi
shhdwi force-pushed the fix/npx-agent-entries branch from c898db7 to 36e7301 Compare October 27, 2026 15:12
@shhdwi shhdwi changed the title Agents get Trail's tools after a sign-in run through npx; release 0.27.1 Release 0.28.0: Anirudh's #708, and agents get Trail's tools after an npx sign-in Oct 27, 2026
github-actions Bot added a commit that referenced this pull request Oct 27, 2026
As asked: until trail check's matching improves, a conflict before
commit/push/PR is a warning. The hook adds additionalContext with no
permission decision, so the command runs and Claude reads which learning
it goes against. SHIP_CHECK_STOPS turns the once-per-conflict stop back on.

Two bugs found testing it in a real Claude Code session:
- The check only ran with TRAIL_INVOKED_AS=trail, which Claude Code's hooks
  never have. It now also runs in a repo wired for trail, as the other
  hooks decide.
- `git -C dir push` and `git -c k=v commit` weren't seen as a commit/push.

Verified: a real session committed against a learning; the commit ran and
Claude quoted the warning and recommended reverting.
github-actions Bot added a commit that referenced this pull request Oct 27, 2026
@shhdwi
shhdwi merged commit 25ea4c7 into main Oct 27, 2026
8 checks passed
github-actions Bot added a commit that referenced this pull request Oct 27, 2026
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.

1 participant