instar 1.2.43 → 1.2.45

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (35) hide show
  1. package/.claude/skills/build/SKILL.md +78 -8
  2. package/dist/commands/init.d.ts.map +1 -1
  3. package/dist/commands/init.js +51 -0
  4. package/dist/commands/init.js.map +1 -1
  5. package/dist/core/PostUpdateMigrator.d.ts +15 -1
  6. package/dist/core/PostUpdateMigrator.d.ts.map +1 -1
  7. package/dist/core/PostUpdateMigrator.js +197 -0
  8. package/dist/core/PostUpdateMigrator.js.map +1 -1
  9. package/dist/core/SafeFsExecutor.d.ts +18 -0
  10. package/dist/core/SafeFsExecutor.d.ts.map +1 -1
  11. package/dist/core/SafeFsExecutor.js +68 -0
  12. package/dist/core/SafeFsExecutor.js.map +1 -1
  13. package/dist/messaging/TelegramAdapter.d.ts +20 -0
  14. package/dist/messaging/TelegramAdapter.d.ts.map +1 -1
  15. package/dist/messaging/TelegramAdapter.js +97 -2
  16. package/dist/messaging/TelegramAdapter.js.map +1 -1
  17. package/dist/tunnel/TunnelManager.d.ts +16 -0
  18. package/dist/tunnel/TunnelManager.d.ts.map +1 -1
  19. package/dist/tunnel/TunnelManager.js +42 -1
  20. package/dist/tunnel/TunnelManager.js.map +1 -1
  21. package/dist/tunnel/TunnelNotifier.d.ts +10 -0
  22. package/dist/tunnel/TunnelNotifier.d.ts.map +1 -1
  23. package/dist/tunnel/TunnelNotifier.js +11 -7
  24. package/dist/tunnel/TunnelNotifier.js.map +1 -1
  25. package/package.json +1 -1
  26. package/src/data/builtin-manifest.json +19 -19
  27. package/src/templates/hooks/settings-template.json +5 -0
  28. package/upgrades/1.2.44.md +32 -0
  29. package/upgrades/1.2.45.md +34 -0
  30. package/upgrades/side-effects/atomic-write-helper.md +30 -0
  31. package/upgrades/side-effects/build-methodology-bundle.md +34 -0
  32. package/upgrades/side-effects/consent-telegram-buttons.md +77 -0
  33. package/upgrades/side-effects/slopcheck-guard.md +36 -0
  34. package/upgrades/side-effects/verify-claim-skill.md +33 -0
  35. package/upgrades/1.2.43.md +0 -31
@@ -0,0 +1,34 @@
1
+ # Side-Effects Review — /build Methodology Bundle
2
+
3
+ **Source:** Cherry-picks from GSD-Instar spike (gsd-planner + gsd-executor methodology)
4
+ **Author:** Echo · autonomous run · 2026-05-23
5
+
6
+ ## 1. Over-block
7
+ None — these are prompt-skill methodology sections, not gates. They add steps the agent runs, not blocks. The Phase 0.5 "quality gate" (must-haves.md exists before Phase 1) is a soft self-check inside the skill, not an external block.
8
+
9
+ ## 2. Under-block
10
+ The methodology is advisory within /build. An agent could skip Phase 0.5. Enforcement of the spirit lives elsewhere (e2e-pairing pre-commit gate, /verify-claim, response-review). This bundle imports the DISCIPLINE; the structural gates are separate cherry-picks.
11
+
12
+ ## 3. Level-of-abstraction fit
13
+ All four changes are content edits to the /build SKILL.md — the natural home for build methodology. The defense-in-depth doc lives in docs/patterns/ alongside other pattern docs. The migration follows the existing migrateSkillPortHardcoding content-sniff pattern.
14
+
15
+ ## 4. Signal-vs-authority compliance
16
+ Compatible. Phase 0.5 must-haves PRODUCE the verification signals that Phase 3 (authority: the agent + reviewers) acts on. STRIDE mitigations bind to tests (the authority). The defense-in-depth doc explicitly reconciles itself with signal-vs-authority. No brittle filter is given blocking authority.
17
+
18
+ ## 5. Cross-feature interactions
19
+ - Phase 0.5 key_links + /verify-claim (separate PR) compose: must-haves define the wiring; /verify-claim checks it.
20
+ - Atomic-commit discipline aligns with the e2e-pairing pre-commit gate (per-task commits make the gate's per-commit check meaningful).
21
+ - SUMMARY deviation-tracking references the executor Rule 1/2/3/4 vocabulary (consistent with the deferral-detector + the GSD methodology framing).
22
+ - The old Phase 5 `git add -A` guidance is REPLACED (it contradicted the new atomic-commit discipline) — a deliberate fix, not just an addition.
23
+ - Migration only touches a stock /build skill; customized skills are fingerprint-guarded.
24
+
25
+ ## 6. Rollback cost
26
+ Moderate-low. Revert the SKILL.md edits + the migration method + the doc + the migration test. Existing agents that already ran the migration would keep the updated SKILL.md (harmless — the new sections are additive guidance). The migration is idempotent and conservative, so a revert-then-re-apply is safe.
27
+
28
+ ## 7. Migration parity
29
+ - New agents: bundled SKILL.md (copied by installBuildSkill on fresh init) carries the sections.
30
+ - Existing agents: migrateBuildSkillMethodology() content-sniffs for the Phase 0.5 marker and re-copies the bundled SKILL.md if absent AND the file matches the stock fingerprint. Wired into the migration sequence after migrateSkillPortHardcoding. Idempotent + fingerprint-guarded (verified by 4 tests).
31
+ - The defense-in-depth doc is a repo doc, not an agent-installed file — ships with the package, no migration needed.
32
+
33
+ ## Conclusion
34
+ Ship. Bundling the four /build-touching items into one PR is correct (separate PRs would self-conflict on SKILL.md). The methodology is the spike's planner+executor discipline imported as Instar's own. Migration parity covered with a conservative content-sniff migration + 4 tests. Seven-dimension review clean.
@@ -0,0 +1,77 @@
1
+ # Side-effects review — Telegram consent buttons (PR 6 of tunnel-failure-resilience chain)
2
+
3
+ **Scope (PR 6 of the chain):** Wire the consent state machine (PR 5)
4
+ to a real Telegram inline-button UX. When Tier-1 is exhausted and a
5
+ Tier-2 relay is available, the owner gets a DM with two buttons —
6
+ "Yes, use a backup" / "No, keep waiting" — and tapping one drives
7
+ `grantConsent` / `declineConsent` on the manager. Spec
8
+ `specs/dev-infrastructure/tunnel-failure-resilience.md` Part 3.
9
+
10
+ **Files touched:**
11
+ - `src/messaging/TelegramAdapter.ts` — adds `setTunnelConsentHandler`
12
+ (handler injection), `sendOwnerConsentPrompt(text, nonce)` (DM with
13
+ inline buttons carrying `tc:g:<nonce>` / `tc:d:<nonce>`), and a new
14
+ `tc:`-prefixed early-return branch in `processCallbackQuery` that
15
+ enforces the owner-principal check, validates the nonce shape, calls
16
+ the injected handler, and clears the keyboard. `editMessageWithRetry`
17
+ gains an optional `chatId` param (defaults to `config.chatId`) so the
18
+ keyboard-clear edit can target the owner's private DM rather than the
19
+ group — without disturbing the existing prompt-gate callers.
20
+ - `src/tunnel/TunnelManager.ts` — `attachTelegram` captures the adapter
21
+ ref, registers the grant/decline handler, and passes
22
+ `suppressConsentDM: true` to the notifier; `requestConsent` sends the
23
+ button prompt (degrading to plain-text `sendToOwnerDM` when an adapter
24
+ lacks button support). Adds `consentPromptText`. The
25
+ `TunnelMessagingAdapter` interface gains two optional methods.
26
+ - `src/tunnel/TunnelNotifier.ts` — adds `suppressConsentDM` option so
27
+ the manager-sent button prompt isn't duplicated by the notifier's
28
+ plain-text owner-DM.
29
+ - `tests/unit/tunnel-consent-telegram.test.ts` — NEW. 10 tests: 6 on
30
+ the manager↔adapter seam (handler registration, button prompt carries
31
+ the live nonce, no double-send, grant→relay-active, decline→exhausted
32
+ +cooldown, stale-nonce no-op) and 4 on the adapter-side callback gate
33
+ (owner grant/decline, NON-owner rejection, malformed `tc:` data).
34
+
35
+ **Over-block:** None. The `tc:` prefix is unique in the codebase (a grep
36
+ for `callback_data:` literals returns only PR 6's two buttons), the
37
+ regex is strict (`^tc:([gd]):([0-9a-f]{32})$`), and any non-`tc:`
38
+ callback falls through unchanged to the existing prompt-gate handler
39
+ below. Malformed `tc:` data is answered with "Invalid consent button"
40
+ and consumed, never forwarded.
41
+
42
+ **Under-block:** One edge worth naming. The owner gate is
43
+ `if (owner && query.from.id !== owner) reject`. When **no** owner is
44
+ configured (`ownerUserId` and `promptGate.ownerId` both unset), the gate
45
+ is skipped. This is benign by construction: with no owner there is no DM
46
+ target, so `sendOwnerConsentPrompt` returns null and **no button is ever
47
+ sent** — there is nothing to click. Even a hand-crafted callback can't
48
+ activate a relay, because `grantConsent` requires a single-use CSPRNG
49
+ nonce that matches the live pending-consent record (cleared-before-start
50
+ so a replay loses). Security is layered: owner-principal check **and**
51
+ nonce match. The adapter regex is only a low-level validator (signal);
52
+ the manager's `grantConsent` holds the blocking authority.
53
+
54
+ **Level-of-abstraction fit:** Clean. The adapter owns the Telegram
55
+ protocol (parse, owner check, answer toast, keyboard clear); the manager
56
+ owns the tunnel-state transition via the injected handler. The adapter
57
+ never imports tunnel types and the manager never imports Telegram types
58
+ (the duck-typed `TunnelMessagingAdapter` interface is the seam).
59
+
60
+ **Interactions:**
61
+ - `query.data` is guarded (`if (!query.data) return`) immediately above
62
+ the `tc:` block, so `.startsWith` can't throw.
63
+ - The path is reached both by the poll loop and by
64
+ `handleForwardedCallback` — the Lifeline forwards callbacks in
65
+ send-only mode, which is exactly the tunnel-down scenario this feature
66
+ exists for.
67
+ - `suppressConsentDM` prevents a double owner-DM (button prompt from the
68
+ manager + plain-text prompt from the notifier).
69
+ - No HTTP surface in this PR, so the Tier-2/Tier-3 "feature is alive"
70
+ HTTP tests are N/A. Wiring is verified two ways: the unit test asserts
71
+ `attachTelegram` registers the handler, and the production call site
72
+ exists at `src/commands/server.ts` (`tunnel.attachTelegram(telegram, …)`).
73
+
74
+ **Rollback cost:** Low. Purely additive; `suppressConsentDM` defaults
75
+ false (back-compat for existing notifier callers). No config schema,
76
+ migration, or persistent state. Revert = drop the three method additions
77
+ + the `tc:` block + the `attachTelegram` handler-registration lines.
@@ -0,0 +1,36 @@
1
+ # Side-Effects Review — Slopcheck Guard Hook
2
+
3
+ **Source:** Cherry-pick from GSD-Instar spike (gsd-executor Rule 3 exclusion)
4
+ **Author:** Echo · autonomous run · 2026-05-23
5
+
6
+ ## 1. Over-block
7
+ Could over-fire on legitimate installs of new-but-real packages. Mitigation: NEVER blocks — signal-only nudge. Worst case is one extra checklist the agent reads and proceeds past. Familiar packages (in any manifest/lockfile) are silently skipped.
8
+
9
+ ## 2. Under-block
10
+ Could miss a slopsquat if it happens to share a token with something in a lockfile. Mitigation: the lockfile presence check is deliberately loose (favors NOT nagging on known-safe). The nudge is a backstop, not the only defense — the agent still reasons about each install. Acceptable: under-block here means "no extra nudge", not "install proceeds unchecked" (the agent always sees the command).
11
+
12
+ ## 3. Level-of-abstraction fit
13
+ PreToolUse Bash hook alongside dangerous-command-guard, deferral-detector, grounding-before-messaging. Same layer, same idiom, same generator pattern (PostUpdateMigrator getter).
14
+
15
+ ## 4. Signal-vs-authority compliance
16
+ Compliant. Pure pattern-match + lockfile lookup = low-context filter emitting a signal (additionalContext). The agent (full-context authority) decides whether to install. Never blocks.
17
+
18
+ ## 5. Cross-feature interactions
19
+ - dangerous-command-guard (PreToolUse Bash, blocking) runs first and independently — no overlap (it blocks destructive commands; slopcheck nudges on installs).
20
+ - deferral-detector (PreToolUse Bash) matches communication commands — no overlap with install commands.
21
+ - The hook reads project manifests read-only; no mutation, no shared state.
22
+ - Edge: `echo npm install foo` would trigger the nudge (regex matches anywhere). Harmless — signal-only, rare, and erring toward caution on anything that looks like an install is the safe direction.
23
+
24
+ ## 6. Rollback cost
25
+ Trivial. One generator method, one settings-template entry, one migrateSettings ensure-block, one manifest entry, one known-list entry, one test file. Revert the commit; the hook stops generating and existing copies become inert.
26
+
27
+ ## 7. Migration parity
28
+ Full coverage:
29
+ - New agents: settings-template.json PreToolUse Bash entry.
30
+ - Existing agents: explicit ensure-block in migrateSettings() adds the slopcheck entry to the Bash matcher if absent (idempotent — checks `hasSlopcheck` first).
31
+ - Hook script: always-overwritten by migrateHooks() (built-in hook).
32
+ - builtin-manifest.json: registered.
33
+ - known-builtin-hooks list: registered (orphan-cleanup safe).
34
+
35
+ ## Conclusion
36
+ Ship. Real supply-chain defense Instar lacked. Signal-only, trivial rollback, full migration parity. Seven-dimension review clean.
@@ -0,0 +1,33 @@
1
+ # Side-Effects Review — /verify-claim Skill
2
+
3
+ **Source:** Cherry-pick from GSD-Instar spike (gsd-verifier 4-level protocol)
4
+ **Author:** Echo · autonomous run · 2026-05-23
5
+
6
+ ## 1. Over-block
7
+ N/A — a prompt skill, blocks nothing. Worst case: the agent runs a few extra grep/test commands before claiming done. That's the intended cost.
8
+
9
+ ## 2. Under-block
10
+ The skill is advisory — an agent could skip invoking it. Mitigation: it's wired into the recommended /build Phase 3 flow and the "before claiming shipped" trigger. Not a hard gate (that would be the e2e-pairing pre-commit hook + response-review). This is the verification METHODOLOGY made callable; enforcement lives elsewhere.
11
+
12
+ ## 3. Level-of-abstraction fit
13
+ A user-invocable skill alongside the other built-in skills in installBuiltinSkills(). Same inline-content pattern, same install mechanism, same idempotency guarantee.
14
+
15
+ ## 4. Signal-vs-authority compliance
16
+ N/A in the gate sense — it's a methodology the agent runs. It PRODUCES signals (the per-level status), and the agent (authority) acts on them. Aligned with the spike's whole verdict: import the methodology, let the agent wield it.
17
+
18
+ ## 5. Cross-feature interactions
19
+ - Complements the e2e-pairing pre-commit gate (that enforces an e2e test FILE exists; this verifies a claim is actually wired). Different layers, no overlap.
20
+ - Complements response-review (Stop hook). /verify-claim is invoked DURING work; response-review checks the outbound message.
21
+ - Referenced from /build Phase 3 VERIFY as the per-must-have check.
22
+ - Pure additive skill — no existing skill changes.
23
+
24
+ ## 6. Rollback cost
25
+ Trivial. One entry in the installBuiltinSkills record + one test file. Revert the commit; the skill stops being installed for new agents. Existing agents that already have the SKILL.md keep an inert copy (harmless).
26
+
27
+ ## 7. Migration parity
28
+ Adding a NEW skill needs no migration per the Migration Parity Standard: installBuiltinSkills() is called from refreshHooksAndSettings() on every update and is non-destructive (only writes missing SKILL.md files). Existing agents get verify-claim on their next update. Idempotency verified in the test (does not overwrite a customized copy).
29
+
30
+ Note: a follow-up should add /verify-claim to the CLAUDE.md template's capability list (Agent Awareness Standard) so agents surface it conversationally — tracked, not blocking this PR.
31
+
32
+ ## Conclusion
33
+ Ship. The spike's #1 cherry-pick by leverage. Pure additive prompt skill, trivial rollback, no migration needed. Seven-dimension review clean.
@@ -1,31 +0,0 @@
1
- # Upgrade Guide — vNEXT
2
-
3
- <!-- bump: patch -->
4
-
5
- ## What Changed
6
-
7
- **feat(dev): e2e-pairing pre-commit gate — GSD cherry-pick.**
8
-
9
- New pre-commit gate (`scripts/check-e2e-pairing.cjs`, wired into `.husky/pre-commit`) that blocks any commit changing a non-test `src/server/*.ts` file unless it also stages at least one `tests/e2e/*.test.ts`. Structurally enforces the Tier-3 "feature is alive" discipline that CLAUDE.md calls the single most important test for any feature with API routes.
10
-
11
- From the GSD-Instar spike, where the gsd-planner methodology surfaced that the Topic Intent Layer's Tier-3 lifecycle test would have been forgotten under ad-hoc planning. This gate makes "ship a route without an e2e test" structurally hard rather than discipline-dependent.
12
-
13
- Two escape hatches keep it from being tyrannical: env bypass (`INSTAR_SKIP_E2E_PAIRING=1`) and an `E2E-PAIRING: EXEMPT — <reason>` marker in a staged server file (for genuine refactors / type-only / comment changes).
14
-
15
- This governs instar's OWN development commits (it's in instar's `.husky/`), not agent-installed files — so no migration parity needed.
16
-
17
- ## Evidence
18
-
19
- 8 unit tests, all green (tmp-git-repo harness): passes with no server files, blocks server-without-e2e, passes server-with-e2e, ignores server test files + .d.ts, respects env bypass + EXEMPT marker, blocks when only an unrelated unit test is staged. TypeScript clean.
20
-
21
- Verified the gate does not block this very PR (this PR changes scripts/ + .husky/ + tests/, not src/server/).
22
-
23
- Side-effects review: `upgrades/side-effects/e2e-pairing-gate.md`.
24
-
25
- ## What to Tell Your User
26
-
27
- Nothing user-visible. Internal dev-discipline gate for instar contributors.
28
-
29
- ## Summary of New Capabilities
30
-
31
- One new pre-commit gate script + one line in .husky/pre-commit. Signal-with-commit-authority (blocks), with two escape hatches. Errs toward false positives because a route shipped without an e2e test is the corruption-class failure being defended against.