Skip to content

feat(update): respect the manifest's install scope — update on a skills-only install installs hooks, agents and settings.json #1482

Closed

Description

@admarble

Epic: graph-2026-10-freeze-c Tier: mechanical Execution: sequant_run

Problem

A repo adopted with init --manifest-only + sync --only skills records groups: ["skills"] in .sequant-manifest.json (#1409, ADR-0015). Bare sequant update ignores that scope:

  • It computes the whole template set (src/commands/update.ts:213 newFiles, :252 applySet).
  • It writes every new file, including .claude/hooks/, the agents and .claude/settings.json.

Since #1477, the manifest then records a full install. The record is now true, but the scope the user chose is widened without a prompt.

update is the documented upgrade command, and some remedy text still points scoped installs at it. So a skills-only adopter who upgrades the normal way gets hooks and a settings.json they opted out of.

Not the #1409 Non-Goal

#1409 excluded an update --only flag. This issue is about update reading the scope the manifest already records. It adds no new flag.

Decision (owner, 2026-10-16): option B

On a partial scope, update stops and names the scoped upgrade command, sync --only skills. It writes nothing.

sync --only skills already upgrades a scoped install. I checked on 2026-10-16 in a temp repo: with .claude/skills/.sequant-version set to 0.0.1 and a stale skill, it rewrote the skill, reset the marker, kept groups: ["skills"], and wrote nothing outside .claude/skills/. So update needs no second scope filter. It reads the scope through getInstallScope and refuses.

Rejected:

  • A: filter update's change set to the scope. That makes a second apply path for a partial install.
  • C: keep update as the "widen to full" command and only fix the remedy text. That leaves the documented upgrade command widening a scoped install without a prompt.

ADR-0015 must be amended. #1477 wrote "update installs every group, so it removes the field too". That stays true only for a full install. On a partial scope, update now refuses.

Acceptance Criteria

  • AC-1: On a manifest with groups: ["skills"], update (with --yes, and with --force) writes no file (the .mcp.json pin included), leaves the manifest byte-identical, sets a non-zero exit code, and prints the scoped upgrade command sync --only skills. Evidence: npx vitest run src/commands/sync.install-scope.integration.test.ts -t "update refuses on a skills-only install" reports ≥ 1 passed, 0 failed, mutation-verified by deleting the partial-scope check in src/commands/update.ts (exactly those tests fail).
  • AC-2: On a manifest with groups: ["skills"], update --dry-run prints the same message, writes nothing and sets a non-zero exit code. Evidence: npx vitest run src/commands/sync.install-scope.integration.test.ts -t "update --dry-run refuses on a skills-only install" reports ≥ 1 passed, 0 failed.
  • AC-3: On a manifest without groups (full install), update behaves exactly as today: it applies all new and modified files and writes no groups field. Evidence: npx vitest run src/commands/update.test.ts src/commands/update.integration.test.ts reports 0 failed, and npx vitest run src/commands/sync.install-scope.integration.test.ts -t "update on a full install" reports ≥ 1 passed.
  • AC-4: ADR-0015 and the Updating section of docs/getting-started/installation.md say that update refuses on a partial scope and that sync --only skills upgrades a skills-only install. Evidence: sed -n '/^## Updating/,/^## Directory/p' docs/getting-started/installation.md | grep -c "sync --only skills" prints ≥ 1 (0 today), and grep -c "installs every group, so it removes the field too" docs/adr/0015-install-scope-recorded-in-manifest.md prints 0.

Prior fixes / producers

May touch

src/commands/update.ts, src/lib/manifest.ts, src/commands/update.test.ts, src/commands/update.integration.test.ts, src/commands/sync.install-scope.integration.test.ts, docs/getting-started/installation.md, docs/adr/0015-install-scope-recorded-in-manifest.md, and CHANGELOG.

Non-Goals

Related: #1409, #1477, #1209.

Activity

  1. added
    enhancement
    graph-2026-10-freeze-c
    on Oct 16, 2026
  2. admarble commented on Oct 17, 2026

    @admarble
    ContributorAuthor

    Complexity: Standard (4 ACs, 4 directories)

    AC Quality Check

    All four ACs are single-line with an Evidence: clause. AC-1/AC-2/AC-4 evidence fails on today's code (no refusal exists; grep -c "sync --only skills" in the Updating section is 0; the ADR phrase is still present), so none is vacuous. AC-1 and AC-2 use -t name filters, so exec must name the tests exactly update refuses on a skills-only install and update --dry-run refuses on a skills-only install (AC-3: describe/test name containing update on a full install). A name mismatch makes -t report 0 tests, not a failure, so the ≥ 1 passed clause matters.

    Scope Assessment

    Non-Goals: present (no update --only, no plain-sync change, no scope inference, nothing under plugin/, .claude/skills/, templates/skills/).

    Metric Value Status
    Feature count 1 ✅
    AC items 4 ✅
    Directory spread 4 (src/commands, src/lib, docs, root CHANGELOG) ✅

    Verdict: ✅ SCOPE_OK

    Acceptance Criteria

    AC-1: update refuses on a skills-only install (--yes, --force)

    Verification: Integration Test
    Scenario: Given a manifest with groups: ["skills"] → When updateCommand({yes:true}) and ({force:true}) → Then no file changes (.mcp.json pin included), manifest byte-identical, process.exitCode ≠ 0, output contains sync --only skills.
    Assumptions: the check must run before every write in updateCommand. Today the first writes happen before template computation: saveConfig (config setup, ~l.125-175) and syncSequantMcpPin (l.186). The guard goes directly after the !manifest check (l.80-87).

    AC-2: update --dry-run refuses too

    Verification: Integration Test
    Scenario: Given the same manifest → When updateCommand({dryRun:true}) → Then same message, no writes, non-zero exit code.

    AC-3: full install unchanged

    Verification: Integration Test (existing suites + one new case)
    Scenario: Given a manifest without groups → When update → Then all new/modified files applied, no groups field written.

    AC-4: docs

    Verification: Manual Test (grep commands in the AC)
    Scenario: Given the docs → When the two greps run → Then ≥ 1 and 0.

    Implementation Plan

    Phase 1: Guard (src/commands/update.ts)

    1. After the !manifest return, call getInstallScope(manifest). If kind === "partial": print the refusal (what the scope is, why update would widen it, the command sequant sync --only skills), set process.exitCode = 1, return. Applies to all flag combinations, so there are no per-flag branches.
    2. Update the comment above updateManifest({ full: true }) (~l.372). That call now runs only on full installs, so it is a no-op for groups. Keep it unless exec finds it dead. Do not touch src/lib/manifest.ts unless needed (getInstallScope stays the single reader).

    Phase 2: Tests

    1. In sync.install-scope.integration.test.ts, replace an update on a skills-only install records a full install (l.241) with update refuses on a skills-only install. Cases: --yes, --force. Snapshot the file tree plus the manifest bytes and .mcp.json before and after, and assert exitCode and the message.
    2. Add update --dry-run refuses on a skills-only install, and update on a full install (no groups, files applied, no groups written).
    3. Check update.test.ts (mocks getManifest; a mock without groups reads as full, so it should stay green).

    Phase 3: Docs

    1. Amend ADR-0015: replace "update (no --only) installs every group, so it removes the field too" and the Decision line ("a full sync or update removes the field") with: on a partial scope update refuses and points to sync --only skills; only a full install is rewritten by update. Add a dated amendment note, since an ADR is a record.
    2. docs/getting-started/installation.md Updating section: add a note for skills-only installs. It must contain the literal sync --only skills.
    3. CHANGELOG [Unreleased]: a ### Changed entry (feat(update): respect the manifest's install scope — update on a skills-only install installs hooks, agents and settings.json #1482).

    Design Review

    1. Where does this logic belong? In updateCommand, reading getInstallScope (the one reader). It is a refusal, not a filter.
    2. Simplest correct approach? One early return. Rejected: option A (filter the change set; second apply path) and option C (keep widening; leaves the documented upgrade command widening without a prompt). Owner picked B on 2026-10-16.
    3. Pattern / recurrence? update's manifest scope write has been fixed twice (fix(sync): a --only skills install warns 'N file(s) differ' forever, and the suggested sync --force overwrites the repo's constitution #1409 / PR fix(#1409): record the install scope so a skills-only install stops drifting #1467, fix(#1409): update records a full install in the manifest #1477), so the class is "commands that write templates over a scoped install". The issue records this as deliberately local to update; plain sync widening is node A of graph-2026-10-freeze-c. That satisfies the stop rule.
    4. Senior reviewer challenge: "Why not update → delegate to sync --only?" That is hidden behaviour. A refusal is explicit, and sync --only skills already upgrades (verified by the owner).
    5. Producers/consumers of the manifest groups artifact: producers are init --manifest-only ([]), sync --only (adds), full sync and update (remove). Consumers read through getInstallScope (drift check, status). After this change update stops being a producer on partial scopes. Plain sync stays out of scope (node A). Remedy text elsewhere that says "or update" is also node A, so I did not touch it. I did not complete the whole-repo grep for remedy strings; exec should list them in the PR as follow-up for node A.

    No ADR is required: the decision is already in the issue and ADR-0015 is amended in place.

    Feature Quality Planning

    All standard checks pass. Notable items:

    • Edge: groups: [] (init --manifest-only before any sync) is also partial, so update refuses. The message must still name sync --only skills. Add this as a case in the AC-1 test.
    • Hand-edited or corrupt groups (non-array) reads as full via getInstallScope, which is the owner's ruling.
    • Mutation-verify AC-1: delete the guard, confirm exactly the refusal tests fail, restore, and record Mutation-verified: AC-1 — ... in the PR body with the file path first.
    • Plugin freeze: no edits to plugin/, .claude/skills/, templates/skills/.

    Open Questions

    1. Exit code and stream: the existing "not initialized" path uses console.log plus exitCode = 1. Recommendation: match it, or use console.error as at l.61. Impact: only tests that assert on captured output.

    Recommended Workflow

    Phases: exec → qa
    Quality Loop: disabled
    Reasoning: small, mechanical, one early return plus tests and docs. No UI, no security surface. Testgen is not needed because the ACs name concrete tests and exec writes them with the change. Run only the targeted test files in exec, not the full suite.

    Label Review

    Current: enhancement, graph-2026-10-freeze-c
    Recommended: same, plus planned
    Quality Loop: won't auto-enable

  3. added
    planned
    on Oct 17, 2026
  4. admarble commented on Oct 17, 2026

    @admarble
    ContributorAuthor

    QA Verdict: AC_MET_BUT_NOT_A_PLUS

    AC coverage: 4/4 met

    Gaps:

    • AC-1 gate-test mutation result is not recorded (mutation verified by QA: 4 refusal tests fail when the guard is deleted)
    • AC-1's '.mcp.json pin included' clause has no test; a guard reordering would go undetected
    • Remedy text still points scoped installs at update — filed fix(sync): plain sync and doctor still steer a skills-only install into a full install — sync ignores the recorded scope, doctor names bare sync #1485
    • The .mcp.json part of AC-1 is never tested. The fixture has no .mcp.json, so syncSequantMcpPin returns no-file either way. The comment at sync.install-scope.integration.test.ts:241 ("Every file plus the .mcp.json pin") claims more than the test checks. The code order guarantees the pin isn't written, but no test would catch a later reordering.
    • The PR body has no SEQUANT_MUTATION marker for AC-1. AC-1 counts as a gate-test AC (isGateTestEvidence → true). This is the issue that sets the verdict.

    Suggestions:

    • Both test files define a mock getInstallScope that copies the real logic. Using importActual would keep them from drifting apart. This is minor.
  5. added 2 commits that reference this issue on Oct 17, 2026
  6. added a commit that references this issue on Oct 17, 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

    enhancementgraph-2026-10-freeze-cplanned

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions