snipara-companion 1.4.13 → 1.4.14

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 (4) hide show
  1. package/README.md +46 -173
  2. package/dist/index.d.ts +262 -53
  3. package/dist/index.js +2057 -1204
  4. package/package.json +1 -1
package/README.md CHANGED
@@ -12,6 +12,25 @@ In this repository, the source currently lives in `packages/cli`, and the instal
12
12
 
13
13
  This package complements `snipara-mcp`. It does not replace it.
14
14
 
15
+ ## Quickstart
16
+
17
+ ```bash
18
+ # 1. Install
19
+ npm install -g snipara-companion
20
+
21
+ # 2. Point this workspace at a Snipara project (writes local .snipara/ config)
22
+ snipara-companion init # interactive; or: snipara-companion login
23
+
24
+ # 3. Use it in your agent workflow
25
+ snipara-companion brief # what changed, why, impact, next action, safe-to-proceed
26
+ snipara-companion status # current work across workflow, git, and Team Sync
27
+ snipara-companion handoff --summary "<what changed>" --next "<next step>"
28
+ ```
29
+
30
+ Local continuity commands work without a Snipara account; commands that read
31
+ hosted context or memory need `init`/`login` first. Run
32
+ `snipara-companion --help` for the full command list.
33
+
15
34
  ```mermaid
16
35
  flowchart LR
17
36
  Project["Local project"] --> Companion["snipara-companion"]
@@ -92,114 +111,9 @@ yarn global add snipara-companion
92
111
  snipara-companion
93
112
  ```
94
113
 
95
- ## New In 1.4.13
96
-
97
- - Adds `snipara-companion memory invalidate <memory-id>` and
98
- `snipara-companion memory supersede <old-memory-id> <new-memory-id>` so agents
99
- can apply Memory V2 lifecycle corrections through companion when a recalled
100
- memory is obsolete or replaced.
101
- - Keeps lifecycle mutation outside read-only hygiene commands: `memory compact`
102
- remains dry-run only, while invalidate/supersede require explicit memory IDs.
103
-
104
- ## New In 1.4.5
105
-
106
- - `workflow phase-commit` and `workflow final-commit` now complete matching
107
- local Team Sync work items when the workflow outcome is completed.
108
- - Matching stays conservative: workflow-goal text wins, and file/token fallback
109
- is only used when no workflow goal is available, so deploy or promotion
110
- threads are not closed from implementation evidence alone.
111
- - Text output now reports completed Team Sync work when workflow commits clean up
112
- local active items.
113
-
114
- ## New In 1.4.4
115
-
116
- - Adds `snipara-companion memory local -- <args...>` as a thin bridge to the
117
- open `snipara-memory` engine for no-account local memory workflows.
118
- - Adds `snipara-companion eval export` to write a `snipara-evals` case from
119
- local workflow, Team Sync, file, command, and expected-signal inputs.
120
- - Adds `snipara-companion eval run` to execute `snipara-evals` through `npx` or a
121
- configured local runner.
122
- - Clarifies the open Mini Snipara stack boundary: local continuity and evals are
123
- open, while team-wide presence, shared locks, GitHub checks, dashboards, and
124
- Cloud code graph remain hosted Snipara capabilities.
125
-
126
- ## New In 1.4.8
127
-
128
- - Adds `snipara-companion collaboration guard --ack-review-only` so enforced
129
- release guards can acknowledge review-only stale-state and
130
- decision-consistency warnings without requiring
131
- `SNIPARA_COLLABORATION_GUARD=0`. The hosted `REVIEW_REQUIRED` verdict stays
132
- visible in the guard payload; `BLOCKED`, `REQUIRES_ACK`, active-session
133
- conflicts and blocking leases still fail.
134
- - Updates the Infomaniak deploy guard to use the review-only ack path for
135
- release UX false positives while keeping the emergency env bypass reserved for
136
- true guard outages.
137
-
138
- ## New In 1.4.2
139
-
140
- - Adds `snipara-companion collaboration start|watch|claim|guard|release|status`
141
- for safe parallel coding presence, auto-claims, advisory/exclusive resource
142
- claims, hosted guard checks, and conflict alarms across humans and agents.
143
- - Adds `snipara-companion collaboration hooks install` plus guard profiles for
144
- blocking pre-commit, pre-push, pre-deploy, schema/migration, and package
145
- release checks.
146
- - Adds `snipara-companion collaboration ide-status` for editor extensions and
147
- local companion UIs that need compact live collaboration state.
148
- - Hardens local code impact so stale or incomplete local overlay caches report
149
- missing target files instead of silently returning an empty impact set.
150
- - Adds `snipara-companion workflow impact-gate` for committed local workflow
151
- phases that are ahead of upstream but not pushed yet. It compares
152
- `upstream..HEAD`, separates dirty working-tree files, runs local code-overlay
153
- impact on the committed code files, and maps the result back to completed
154
- workflow phases.
155
-
156
- ## New In 1.4.1
157
-
158
- - Makes local code overlay Git hooks background by default so `git commit` and
159
- `git push` return quickly while Snipara refreshes local overlay state and
160
- push-time promotion asynchronously.
161
- - Adds `snipara-companion code hooks install --synchronous` for teams that
162
- intentionally want foreground hook work, plus a configurable background
163
- reindex delay for pre-push promotion.
164
-
165
- ## New In 1.3.7
166
-
167
- - Hardens `memory-guard check` with `--confirmed-by-user "<confirmation>"`
168
- for explicit, auditable overrides after the user has reviewed destructive or
169
- contradictory signals.
170
- - Adds stable guard exit codes in strict mode: `20` for confirmation required,
171
- `21` for unavailable memory/context guidance, and `22` for invalid guard
172
- options.
173
- - Validates destructive checks before hosted calls so vague commands such as
174
- `--destructive` without `--intent` or `--command` fail fast.
175
- - Extends `snipara-companion init --with-hooks` so it also installs local code
176
- overlay Git hooks (`post-commit` sync and `pre-push` promotion/reindex).
177
-
178
- ## New In 1.3.6
179
-
180
- - Adds `snipara-companion memory audit` for a read-only memory hygiene pass that
181
- combines hosted memory health, cleanup candidates, and compaction dry-run.
182
- - Adds `memory health`, `memory clean-candidates`, and `memory compact` as
183
- direct companion maintenance commands. `memory compact` always sends
184
- `dry_run=true` and does not mutate memory.
185
- - Extends `memory-guard check` with `--intent`, `--destructive`, and
186
- `--require-confirmation` so agents can surface memory/context contradictions
187
- and ask the user before irreversible actions.
188
-
189
- ## New In 1.3.0
190
-
191
- - Adds top-level Git-style agent work commands: `status`, `brief`, `timeline`,
192
- `verify`, `handoff`, and `workflow resume`.
193
- - Adds `snipara-companion verify` for transparent verification plans based on
194
- companion code impact auto-source selection plus local package scripts.
195
- - Reframes companion as the day-two continuity surface after
196
- `npx create-snipara` installs the project.
197
-
198
- ## New In 1.2.0
199
-
200
- - Adds `snipara-companion intelligence brief` for a local Project Intelligence brief that composes hosted resume context, memory health, and code impact into one agent-ready output.
201
- - Adds `workflow scaffold --preset project-intelligence-continuity-layer` for the full memory + code graph + workflow continuity roadmap.
202
- - Updates generated agent workflow instructions so new work can call the Project Intelligence brief before risky changes and scaffold the roadmap preset for multi-phase delivery.
114
+ ## Changelog
115
+
116
+ Release notes have moved to [CHANGELOG.md](./CHANGELOG.md).
203
117
 
204
118
  ## Agentic Work Commands
205
119
 
@@ -214,6 +128,7 @@ snipara-companion timeline
214
128
  snipara-companion workflow phase-commit build --summary "tests green"
215
129
  snipara-companion workflow impact-gate
216
130
  snipara-companion verify --changed-files src/auth.ts --diff-summary "auth hardening"
131
+ snipara-companion run --task "ship auth hardening" --changed-files src/auth.ts --release
217
132
  snipara-companion handoff --summary "status command shipped" --next "publish package"
218
133
  snipara-companion workflow resume --include-session-context
219
134
  ```
@@ -270,66 +185,6 @@ Output includes:
270
185
  - missing checks and caveats
271
186
  - suggested next commands
272
187
 
273
- ## New In 1.1.15
274
-
275
- - Expands `init --client` to Claude Code, Cursor, Windsurf, Codex, Gemini, Mistral, ChatGPT, VS Code, Continue, and custom MCP clients.
276
- - Keeps Claude Code, Cursor, and Windsurf as hook-capable presets while treating Mistral, ChatGPT, VS Code, Continue, and custom clients as MCP-first setup presets.
277
- - Prints Codex TOML or HTTP MCP references for MCP-first clients instead of generating unsupported legacy hooks.
278
-
279
- ## New In 1.1.14
280
-
281
- - Adds `npx -y snipara-companion@latest automations install/status/diff/update` for installing dashboard-generated automation hook bundles locally.
282
- - `init --with-hooks` now delegates hook installation to the hosted automation config bundle so Claude Code, Cursor, and Windsurf use the same templates as Project Automation.
283
- - Managed automation files are tracked in `.snipara/automations/manifest.json` and are not overwritten after local edits unless `--force` is used.
284
- - Automation REST calls now use `www.snipara.com` while MCP calls stay on `api.snipara.com`, avoiding FastAPI IP rate limits on Stuck Guard and generated hook installs.
285
-
286
- ## New In 1.1.13
287
-
288
- - Adds `snipara-companion stuck-guard status/check/simulate` for hosted Memory Guard / Stuck Guard decisions.
289
- - `pre-tool` now emits canonical `tool_call` events and prints Rescue Packs when hosted Stuck Guard returns `inject` or `enforce`.
290
- - `post-tool` now emits canonical `tool_result` events with status, exit code, command, classification, and a redacted/truncated preview.
291
-
292
- ## New In 1.1.12
293
-
294
- - Documents the GitHub PR Answer Packs boundary: use `create-snipara --github`
295
- for the hosted GitHub App setup, and use `snipara-companion` only for local
296
- planning, code impact checks, workflow state, and memory commits.
297
-
298
- ## New In 1.1.10
299
-
300
- - Snipara Sandbox guidance now points existing projects to `npx create-snipara repair --with-runtime`
301
- - Managed workflow phases marked `needs_runtime` suggest Snipara Sandbox installation only when needed
302
-
303
- ## New In 1.1.4
304
-
305
- - `snipara-companion onboard-folder` previews and applies dashboardless business-folder imports from local or LLM-materialized sources
306
- - `snipara-companion workflow start/status/resume/phase-start/phase-commit` keeps a visible LLM plan in `.snipara/workflow/current.json` and persists each phase through hosted memory so compacted agents can resume safely
307
- - `snipara-companion final-commit` persists the final workflow outcome with `snipara_end_of_task_commit`
308
- - `snipara-companion code symbol-card` and `snipara-companion code impact` expose paid Context safeguards directly from the companion CLI
309
-
310
- ## New In 1.1.2
311
-
312
- - `snipara-companion doctor` and Snipara Sandbox hints detect provider keys from local `.env` files without printing secret values
313
-
314
- ## New In 1.1.1
315
-
316
- - `snipara-companion doctor` diagnoses Snipara auth, Snipara Sandbox, Snipara Sandbox MCP, provider keys, and Docker
317
- - `workflow run` prints contextual Snipara Sandbox hints for full/orchestrated/execution-heavy work
318
- - `workflow run --no-runtime-hint` hides Snipara Sandbox guidance for scripted terminal output
319
-
320
- ## New In 1.1.0
321
-
322
- - `business-collections` commands for Team Business Context presets and reusable business docs
323
- - `client-projects` commands for creating and listing project-scoped client context workspaces
324
- - `upload --metadata/--metadata-file` plus convenience metadata flags for single-file business/client uploads
325
-
326
- ## New In 1.0.0
327
-
328
- - direct `snipara-companion code` access for `callers`, `imports`, `neighbors`, and `shortest-path`
329
- - `workflow run --mode lite|standard|full|orchestrate` for hosted-first workflow routing; `auto` remains a STANDARD compatibility alias
330
- - `snipara-companion shared-context` for project-linked standards and team guidance
331
- - automatic fallback to project token auth when a stale `SNIPARA_API_KEY` overrides a valid local login
332
-
333
188
  ## Supported Client Presets Today
334
189
 
335
190
  The built-in `init` and `automations` flows share these client names:
@@ -713,8 +568,9 @@ metadata, and referenced-from provenance.
713
568
 
714
569
  ### Project Intelligence Briefs
715
570
 
716
- Use `intelligence brief` when a task needs one local entrypoint for continuity,
717
- memory authority, and code impact:
571
+ Use `intelligence brief` when a task needs a local continuity readout for
572
+ memory authority, code impact, verification hints, and the Project Intelligence
573
+ Judgment Card:
718
574
 
719
575
  ```bash
720
576
  snipara-companion intelligence brief \
@@ -727,8 +583,24 @@ The command calls hosted `snipara_resume_context` and `snipara_memory_health`.
727
583
  When changed files are provided, code impact uses companion auto-source
728
584
  selection, so dirty/ahead worktrees use the local overlay and clean configured
729
585
  checkouts use hosted graph impact. It prints continuity signals, memory health,
730
- risk and verification hints, degraded surfaces, and the next companion commands
731
- to keep the workflow resumable.
586
+ risk and verification hints, degraded surfaces, and the Judgment Card's
587
+ weighted readiness, evidence, and required actions.
588
+
589
+ Use top-level `run` when the agent should make a production-oriented go/no-go
590
+ judgment in one pass:
591
+
592
+ ```bash
593
+ snipara-companion run \
594
+ --task "ship auth hardening" \
595
+ --changed-files src/auth.ts tests/auth.test.ts \
596
+ --diff-summary "auth hardening" \
597
+ --release
598
+ ```
599
+
600
+ `run --release` composes the Project Intelligence brief, collaboration guard,
601
+ package-surface review, verification plan, and final Judgment Card. Review-only
602
+ guard findings can be acknowledged with the printed guard action card command;
603
+ blocking conflicts still make the release judgment non-proceedable.
732
604
 
733
605
  For the full Project Intelligence and Continuity Layer roadmap, scaffold the
734
606
  built-in managed workflow plan:
@@ -760,6 +632,7 @@ Semantics:
760
632
  - `snipara-companion timeline` = local timeline of workflow starts, phase starts, phase commits, final commits, and Team Sync handoffs
761
633
  - `snipara-companion handoff` = top-level agent-ready Markdown/JSON handoff artifact plus the same local/hosted Team Sync handoff persistence
762
634
  - `snipara-companion intelligence brief` = one local Project Intelligence brief that combines resume context, memory health, and code impact for a task
635
+ - `snipara-companion run` = production Project Intelligence flow that combines the brief, guard action cards, package review, verification hints, and a final weighted Judgment Card
763
636
  - `snipara-companion workflow start --plan-file` = records the visible LLM plan locally so phase state survives agent compaction; prefer JSON plans with explicit ids for stable machine phase state
764
637
  - `snipara-companion workflow scaffold --preset project-intelligence-continuity-layer` = creates a four-phase managed plan for memory authority, code impact, continuity summaries, and release/docs surfaces
765
638
  - `snipara-companion workflow phase-start` = marks the current phase and prints the required Snipara context gate plus code-impact / symbol-card gates; runtime-marked phases also get a stable Snipara Sandbox session binding
@@ -976,7 +849,7 @@ To test a packed tarball manually, use `npm exec --package`:
976
849
 
977
850
  ```bash
978
851
  npm pack
979
- npm exec --package ./snipara-companion-1.4.13.tgz snipara-companion -- --help
852
+ npm exec --package ./snipara-companion-1.4.14.tgz snipara-companion -- --help
980
853
  ```
981
854
 
982
855
  Do not use `npx /path/to/snipara-companion-*.tgz`. npm will try to execute the tarball itself instead of
package/dist/index.d.ts CHANGED
@@ -1240,6 +1240,18 @@ declare function normalizeGuardTag(tag: string): string;
1240
1240
  declare function categoryFromGuardTag(tag: string): string;
1241
1241
  declare function detectReleaseSurfacesFromFiles(root: string, files: string[]): ReleaseSurface[];
1242
1242
  declare function getStagedFiles(root: string): string[];
1243
+ /**
1244
+ * Recall and evaluate guard guidance before a risky action.
1245
+ *
1246
+ * Given a trigger (failure | pre-commit | commit | pre-final | manual) and
1247
+ * optional touched files (or `--staged`), it detects release surfaces and
1248
+ * destructive/contradictory intent, recalls tagged memory and source context,
1249
+ * and returns findings plus whether the caller must stop or confirm. Honors an
1250
+ * explicit `confirmedByUser` override so a reviewed destructive action can
1251
+ * proceed. Backs the strict-mode exit codes used by Git hooks.
1252
+ *
1253
+ * @returns Findings, warnings, and a decision the caller can act on.
1254
+ */
1243
1255
  declare function runMemoryGuardCheck(options?: MemoryGuardCheckOptions): Promise<MemoryGuardCheckResult>;
1244
1256
 
1245
1257
  type LocalCodeOverlayMode = "working_tree" | "local_commit";
@@ -1438,6 +1450,20 @@ interface HostedCodeOverlayUploadPayload {
1438
1450
  }
1439
1451
  declare function getLocalCodeOverlayCachePath(cwd?: string): string;
1440
1452
  declare function getLocalCodePromotionStatePath(cwd?: string): string;
1453
+ /**
1454
+ * Build a local code graph overlay over the working tree or a local commit.
1455
+ *
1456
+ * Walks candidate files (working tree, or a commit when `mode` is
1457
+ * "local_commit"), parses supported languages into files/symbols/imports, and
1458
+ * records why files were excluded (ignored, unsupported language, too large,
1459
+ * secret pattern, read error). Honors `.sniparaignore`, per-file size and file
1460
+ * count caps (`maxFiles`, `maxFileBytes`), and adds warnings when limits are
1461
+ * hit. This overlay backs the offline impact/callers/imports queries; it is
1462
+ * best-effort, not authoritative.
1463
+ *
1464
+ * @returns A `LocalCodeOverlayManifest` with files, symbols, imports, excluded
1465
+ * samples, and warnings.
1466
+ */
1441
1467
  declare function buildLocalCodeOverlay(options?: LocalCodeOverlayOptions): LocalCodeOverlayManifest;
1442
1468
  declare function summarizeLocalCodeOverlay(manifest: LocalCodeOverlayManifest): LocalCodeOverlaySummary;
1443
1469
  declare function writeLocalCodeOverlayCache(manifest: LocalCodeOverlayManifest): string;
@@ -1455,6 +1481,154 @@ declare function buildLocalImpactResult(options: LocalCodeQueryCommandOptions):
1455
1481
  declare function buildCodeHooksInstallPlan(options?: CodeHooksInstallCommandOptions): Record<string, unknown>;
1456
1482
  declare function buildCodePromotionResult(options?: CodePromoteCommandOptions): Promise<Record<string, unknown>>;
1457
1483
 
1484
+ /**
1485
+ * Project Intelligence Judgment Card.
1486
+ *
1487
+ * Pure scoring and explanation layer for agent-facing "can I proceed?"
1488
+ * decisions. It intentionally consumes already-fetched surfaces instead of
1489
+ * adding network calls, so commands can use it in production paths without
1490
+ * changing hosted behavior.
1491
+ */
1492
+ type ProjectJudgmentCanProceed = "yes" | "review" | "block";
1493
+ type ProjectJudgmentState = "ready" | "watch" | "review" | "proof_required" | "blocked";
1494
+ type ProjectJudgmentSeverity = "info" | "low" | "medium" | "high" | "critical";
1495
+ type ProjectJudgmentActionType = "run_check" | "inspect" | "handoff" | "acknowledge" | "package_review" | "deploy_review" | "resolve_blocker";
1496
+ interface ProjectJudgmentReason {
1497
+ code: string;
1498
+ severity: ProjectJudgmentSeverity;
1499
+ message: string;
1500
+ points: number;
1501
+ source: string;
1502
+ }
1503
+ interface ProjectJudgmentAction {
1504
+ type: ProjectJudgmentActionType;
1505
+ title: string;
1506
+ command?: string;
1507
+ reason?: string;
1508
+ severity: ProjectJudgmentSeverity;
1509
+ safeToAck?: boolean;
1510
+ }
1511
+ interface ProjectJudgmentEvidence {
1512
+ source: string;
1513
+ label: string;
1514
+ detail?: string;
1515
+ }
1516
+ interface ProjectIntelligenceJudgmentCard {
1517
+ version: "project-intelligence.judgment-card.v1";
1518
+ generatedAt: string;
1519
+ task?: string;
1520
+ target: {
1521
+ branch?: string;
1522
+ changedFiles: string[];
1523
+ };
1524
+ score: number;
1525
+ band: "high" | "medium" | "low" | "blocked";
1526
+ state: ProjectJudgmentState;
1527
+ canProceed: ProjectJudgmentCanProceed;
1528
+ summary: string;
1529
+ reasons: ProjectJudgmentReason[];
1530
+ requiredActions: ProjectJudgmentAction[];
1531
+ advisories: ProjectJudgmentAction[];
1532
+ evidence: ProjectJudgmentEvidence[];
1533
+ caveats: string[];
1534
+ }
1535
+ interface BuildProjectJudgmentCardInput {
1536
+ task?: string;
1537
+ branch?: string;
1538
+ changedFiles?: string[];
1539
+ resumeContext?: Record<string, unknown>;
1540
+ memoryHealth?: Record<string, unknown>;
1541
+ codeImpact?: Record<string, unknown>;
1542
+ verificationPlan?: Record<string, unknown>;
1543
+ guard?: Record<string, unknown>;
1544
+ advisoryObservability?: Record<string, unknown>;
1545
+ teamSyncReadiness?: Record<string, unknown>;
1546
+ errors?: Array<{
1547
+ surface: string;
1548
+ message: string;
1549
+ }>;
1550
+ }
1551
+ declare function buildProjectJudgmentCard(input: BuildProjectJudgmentCardInput): ProjectIntelligenceJudgmentCard;
1552
+ declare function formatProjectJudgmentCard(card: ProjectIntelligenceJudgmentCard): string[];
1553
+
1554
+ interface VerifyCommandOptions {
1555
+ task?: string;
1556
+ qualifiedName?: string;
1557
+ symbolKey?: string;
1558
+ filePath?: string;
1559
+ changedFiles?: string[];
1560
+ diffSummary?: string;
1561
+ limit?: number;
1562
+ skipImpact?: boolean;
1563
+ json?: boolean;
1564
+ }
1565
+ interface VerificationCheck {
1566
+ kind: "test" | "lint" | "type-check" | "build" | "inspection" | "command";
1567
+ title: string;
1568
+ command?: string;
1569
+ file?: string;
1570
+ source: "code-impact" | "package-script" | "fallback";
1571
+ reason?: string;
1572
+ }
1573
+ interface VerificationGap {
1574
+ code: string;
1575
+ severity: "low" | "medium" | "high";
1576
+ message: string;
1577
+ }
1578
+ interface VerificationRisk {
1579
+ level: string;
1580
+ score?: number;
1581
+ source: "code-impact" | "fallback";
1582
+ }
1583
+ interface VerificationPlan {
1584
+ version: "snipara.verification_plan.v1";
1585
+ generatedAt: string;
1586
+ task?: string;
1587
+ target: {
1588
+ qualifiedName?: string;
1589
+ symbolKey?: string;
1590
+ filePath?: string;
1591
+ changedFiles: string[];
1592
+ };
1593
+ impactedFiles: string[];
1594
+ recommendedChecks: VerificationCheck[];
1595
+ risk: VerificationRisk;
1596
+ missingChecks: VerificationGap[];
1597
+ caveats: string[];
1598
+ suggestedCommands: string[];
1599
+ codeImpact?: Record<string, unknown>;
1600
+ codeImpactSourceSelection?: CodeGraphSourceSelection;
1601
+ judgmentCard?: ProjectIntelligenceJudgmentCard;
1602
+ errors: Array<{
1603
+ surface: string;
1604
+ message: string;
1605
+ }>;
1606
+ }
1607
+ interface BuildVerificationPlanOptions extends VerifyCommandOptions {
1608
+ cwd?: string;
1609
+ codeImpact?: Record<string, unknown>;
1610
+ codeImpactSourceSelection?: CodeGraphSourceSelection;
1611
+ errors?: Array<{
1612
+ surface: string;
1613
+ message: string;
1614
+ }>;
1615
+ }
1616
+ /**
1617
+ * Build a transparent verification plan for the current change.
1618
+ *
1619
+ * Combines code-impact signals (direct related tests, action checks, coverage
1620
+ * gaps) with package scripts inferred from the impacted files, dedupes the
1621
+ * resulting checks, and records explicit gaps (impact unavailable/skipped, no
1622
+ * direct tests, no impacted files) so the plan is honest about what it can and
1623
+ * cannot verify. Pure: it returns a plan and never executes any check.
1624
+ *
1625
+ * @param options Changed files / file path, optional code impact, cwd, and
1626
+ * `skipImpact`.
1627
+ * @returns A plan of recommended checks plus a list of coverage gaps.
1628
+ */
1629
+ declare function buildVerificationPlan(options: BuildVerificationPlanOptions): VerificationPlan;
1630
+ declare function verifyCommand(options: VerifyCommandOptions): Promise<void>;
1631
+
1458
1632
  interface ProjectIntelligenceBriefOptions {
1459
1633
  task?: string;
1460
1634
  branch?: string;
@@ -1477,12 +1651,28 @@ interface ProjectIntelligenceBrief {
1477
1651
  memoryHealth?: Record<string, unknown>;
1478
1652
  codeImpact?: Record<string, unknown>;
1479
1653
  codeImpactSourceSelection?: CodeGraphSourceSelection;
1654
+ verificationPlan?: VerificationPlan;
1655
+ judgmentCard?: ProjectIntelligenceJudgmentCard;
1480
1656
  errors: Array<{
1481
1657
  surface: string;
1482
1658
  message: string;
1483
1659
  }>;
1484
1660
  suggestedCommands: string[];
1485
1661
  }
1662
+ /**
1663
+ * Build a Project Intelligence continuity brief for the current task.
1664
+ *
1665
+ * Gathers three best-effort signals through the hosted client — resume context
1666
+ * (`snipara_resume_context`), memory health, and local code impact — and merges
1667
+ * them with the changed/recent files and a list of suggested next commands.
1668
+ * Each source is wrapped independently: a failure is recorded in `brief.errors`
1669
+ * rather than thrown, so callers always receive a usable (possibly partial)
1670
+ * brief.
1671
+ *
1672
+ * @param options Task, branch, changed/recent files, token budget, and skip
1673
+ * flags (`skipImpact`, `skipMemoryHealth`).
1674
+ * @returns A `project-intelligence-brief-v1` document.
1675
+ */
1486
1676
  declare function buildProjectIntelligenceBrief(options: ProjectIntelligenceBriefOptions): Promise<ProjectIntelligenceBrief>;
1487
1677
  declare function projectIntelligenceBriefCommand(options: ProjectIntelligenceBriefOptions): Promise<void>;
1488
1678
 
@@ -1587,69 +1777,47 @@ declare function memoryLocalCommand(options: LocalMemoryCommandOptions): Promise
1587
1777
  declare function evalExportCommand(options: EvalExportOptions): Promise<void>;
1588
1778
  declare function evalRunCommand(options: EvalRunOptions): Promise<void>;
1589
1779
 
1590
- interface VerifyCommandOptions {
1780
+ interface ProjectRunCommandOptions {
1591
1781
  task?: string;
1592
- qualifiedName?: string;
1593
- symbolKey?: string;
1594
- filePath?: string;
1782
+ branch?: string;
1595
1783
  changedFiles?: string[];
1784
+ recentFiles?: string[];
1596
1785
  diffSummary?: string;
1597
- limit?: number;
1786
+ maxTokens?: number;
1787
+ release?: boolean;
1598
1788
  skipImpact?: boolean;
1789
+ skipMemoryHealth?: boolean;
1790
+ skipGuard?: boolean;
1791
+ skipPackageReview?: boolean;
1599
1792
  json?: boolean;
1600
1793
  }
1601
- interface VerificationCheck {
1602
- kind: "test" | "lint" | "type-check" | "build" | "inspection" | "command";
1603
- title: string;
1604
- command?: string;
1605
- file?: string;
1606
- source: "code-impact" | "package-script" | "fallback";
1607
- reason?: string;
1608
- }
1609
- interface VerificationGap {
1610
- code: string;
1611
- severity: "low" | "medium" | "high";
1612
- message: string;
1794
+ interface ProjectRunGuardResult {
1795
+ command: string;
1796
+ status: number | null;
1797
+ stdout: string;
1798
+ stderr: string;
1799
+ payload?: Record<string, unknown>;
1800
+ error?: string;
1613
1801
  }
1614
- interface VerificationRisk {
1615
- level: string;
1616
- score?: number;
1617
- source: "code-impact" | "fallback";
1802
+ interface ProjectRunPackageReview {
1803
+ command: string;
1804
+ status: "skipped" | "ok" | "error";
1805
+ packageName: "snipara-companion";
1806
+ data?: unknown;
1807
+ error?: string;
1618
1808
  }
1619
- interface VerificationPlan {
1620
- version: "snipara.verification_plan.v1";
1809
+ interface ProjectIntelligenceRunResult {
1810
+ version: "project-intelligence.production-run.v1";
1621
1811
  generatedAt: string;
1622
- task?: string;
1623
- target: {
1624
- qualifiedName?: string;
1625
- symbolKey?: string;
1626
- filePath?: string;
1627
- changedFiles: string[];
1628
- };
1629
- impactedFiles: string[];
1630
- recommendedChecks: VerificationCheck[];
1631
- risk: VerificationRisk;
1632
- missingChecks: VerificationGap[];
1633
- caveats: string[];
1812
+ release: boolean;
1813
+ brief: ProjectIntelligenceBrief;
1814
+ guard?: ProjectRunGuardResult;
1815
+ packageReview?: ProjectRunPackageReview;
1816
+ judgmentCard: ProjectIntelligenceJudgmentCard;
1634
1817
  suggestedCommands: string[];
1635
- codeImpact?: Record<string, unknown>;
1636
- codeImpactSourceSelection?: CodeGraphSourceSelection;
1637
- errors: Array<{
1638
- surface: string;
1639
- message: string;
1640
- }>;
1641
1818
  }
1642
- interface BuildVerificationPlanOptions extends VerifyCommandOptions {
1643
- cwd?: string;
1644
- codeImpact?: Record<string, unknown>;
1645
- codeImpactSourceSelection?: CodeGraphSourceSelection;
1646
- errors?: Array<{
1647
- surface: string;
1648
- message: string;
1649
- }>;
1650
- }
1651
- declare function buildVerificationPlan(options: BuildVerificationPlanOptions): VerificationPlan;
1652
- declare function verifyCommand(options: VerifyCommandOptions): Promise<void>;
1819
+ declare function buildProjectIntelligenceRun(options: ProjectRunCommandOptions): Promise<ProjectIntelligenceRunResult>;
1820
+ declare function projectIntelligenceRunCommand(options: ProjectRunCommandOptions): Promise<void>;
1653
1821
 
1654
1822
  type SyncDocumentKind = "DOC" | "BINARY";
1655
1823
  type WorkflowMode = "lite" | "standard" | "auto" | "full" | "orchestrate";
@@ -1920,6 +2088,19 @@ declare function buildWorkflowPhaseCommitSummary(args: {
1920
2088
  phase: Pick<ManagedWorkflowPhase, "id" | "title">;
1921
2089
  summary: string;
1922
2090
  }): string;
2091
+ /**
2092
+ * Compute the impact gate for committed-but-unpushed workflow phases.
2093
+ *
2094
+ * Compares `upstream..HEAD`, separates unpushed code changes from non-code and
2095
+ * dirty working-tree files, runs local code-overlay impact on the committed
2096
+ * code files, and maps the result back to completed workflow phases. Surfaces
2097
+ * reason codes such as `dirty_working_tree_not_included` and phase files that
2098
+ * fall outside the unpushed diff, so a phase is not treated as verified on
2099
+ * stale or partial evidence.
2100
+ *
2101
+ * @returns A `WorkflowImpactGateResult` with changed files, local impact,
2102
+ * matched phases, and reason codes.
2103
+ */
1923
2104
  declare function buildWorkflowImpactGate(options?: {
1924
2105
  cwd?: string;
1925
2106
  base?: string;
@@ -2298,6 +2479,17 @@ declare function buildAgenticHandoffMarkdown(artifact: AgenticHandoffArtifact):
2298
2479
  declare function teamSyncSweepCommand(options: TeamSyncCommandOptions): Promise<void>;
2299
2480
 
2300
2481
  declare const COLLABORATION_STATE_RELATIVE_PATH: string;
2482
+ type CollaborationGuardActionKind = "safe_to_ack" | "needs_handoff" | "needs_test" | "needs_package_review" | "blocking_conflict" | "guard_unavailable";
2483
+ interface CollaborationGuardActionCard {
2484
+ kind: CollaborationGuardActionKind;
2485
+ title: string;
2486
+ reason: string;
2487
+ severity: "info" | "watch" | "warning" | "critical";
2488
+ safeToAck: boolean;
2489
+ command?: string;
2490
+ conflictCode?: string;
2491
+ resource?: string;
2492
+ }
2301
2493
  interface CollaborationCommandOptions {
2302
2494
  summary?: string;
2303
2495
  files?: string[];
@@ -2391,6 +2583,12 @@ declare function parseCollaborationResources(values: string[] | undefined): Coll
2391
2583
  declare function deriveLocalCollaborationResourcesFromFiles(files: string[] | undefined, rootDir?: string, maxFiles?: number): CollaborationResource[];
2392
2584
  declare function buildCollaborationHooksInstallPlan(options?: CollaborationHooksInstallOptions): Record<string, unknown>;
2393
2585
  declare function collaborationIdeStatusCommand(options: CollaborationCommandOptions): Promise<void>;
2586
+ declare function buildCollaborationGuardActionCards(evaluation: CollaborationGuardEvaluation | undefined, context?: {
2587
+ profile?: string;
2588
+ enforced?: boolean;
2589
+ ackReviewOnly?: boolean;
2590
+ reviewOnlyAcknowledged?: boolean;
2591
+ }): CollaborationGuardActionCard[];
2394
2592
  interface HostedGuardPayload {
2395
2593
  files: string[];
2396
2594
  resources: CollaborationResource[];
@@ -2477,6 +2675,17 @@ interface RuntimeDetectionReport {
2477
2675
  }
2478
2676
  declare function detectRuntimeEnvironment(cwd?: string, env?: RuntimeEnvironment): RuntimeDetectionReport;
2479
2677
  declare function shouldSuggestRuntimeForWorkflow(query: string, mode: WorkflowMode): boolean;
2678
+ /**
2679
+ * Recommend whether work should be routed to snipara-orchestrator.
2680
+ *
2681
+ * Scores intent signals from the query and workflow mode (orchestrate mode,
2682
+ * production / proof / htask / multi-agent / parallel patterns) plus contextual
2683
+ * signals (changed-file count, active Team Sync collisions, policy auto-route).
2684
+ * The returned recommendation's level escalates with the accumulated score
2685
+ * (suggest → confirm → auto).
2686
+ *
2687
+ * @returns A recommendation with its reasons, or `null` when no signal fires.
2688
+ */
2480
2689
  declare function getOrchestratorRecommendation(query: string, mode: WorkflowMode, options?: OrchestratorRecommendationOptions): OrchestratorRecommendation | null;
2481
2690
  declare function formatOrchestratorRecommendationReason(reason: OrchestratorRecommendationReason): string;
2482
2691
  declare function shouldSuggestOrchestratorForWorkflow(query: string, mode: WorkflowMode): boolean;
@@ -2589,4 +2798,4 @@ interface WrittenOrchestratorHandoff {
2589
2798
  declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions): OrchestratorHandoffArtifact;
2590
2799
  declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff;
2591
2800
 
2592
- export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, COLLABORATION_STATE_RELATIVE_PATH, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, archiveInactiveTeamSyncWork, autoArchiveTeamSyncState, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCollaborationActor, buildCollaborationHooksInstallPlan, buildEvalCaseArtifact, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, collaborationIdeStatusCommand, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, extractCommandFromToolInput, extractFilesFromToolInput, formatOrchestratorRecommendationReason, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, parseCollaborationResources, projectIntelligenceBriefCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, referencesIngestCommand, referencesScanCommand, resolveQueryFromToolInput, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeOrchestratorHandoff };
2801
+ export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, COLLABORATION_STATE_RELATIVE_PATH, ORCHESTRATOR_HANDOFF_RELATIVE_PATH, TEAM_SYNC_STATE_RELATIVE_PATH, WORKFLOW_PLANS_RELATIVE_DIR, WORKFLOW_STATE_RELATIVE_PATH, archiveInactiveTeamSyncWork, autoArchiveTeamSyncState, buildAgenticHandoffMarkdown, buildAgenticTimeline, buildAgenticWorkStatus, buildAutomationInstallPlan, buildCanonicalEvent, buildCodeHooksInstallPlan, buildCodePromotionResult, buildCodeStatusResult, buildCodeSyncResult, buildCollaborationActor, buildCollaborationGuardActionCards, buildCollaborationHooksInstallPlan, buildEvalCaseArtifact, buildHostedCodeOverlayUploadPayload, buildHostedGuardPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildProjectIntelligenceRun, buildProjectJudgmentCard, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowImpactGate, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, collaborationIdeStatusCommand, collectSyncDocuments, collectSyncDocumentsInput, compactHostedGuardResources, completeTeamSyncStateFromEvidence, completeTeamSyncWorkFromEvidence, createClient, createEmptyCollaborationState, createEmptyTeamSyncState, createLocalQueryCache, deriveLocalCollaborationResourcesFromFiles, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, evalExportCommand, evalRunCommand, extractCommandFromToolInput, extractFilesFromToolInput, formatOrchestratorRecommendationReason, formatProjectJudgmentCard, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getCollaborationStatePath, getConfigPath, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadCollaborationState, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, memoryLocalCommand, normalizeCollaborationFiles, normalizeGuardTag, normalizeWorkflowPlanInput, parseCollaborationResources, projectIntelligenceBriefCommand, projectIntelligenceRunCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, referencesIngestCommand, referencesScanCommand, resolveQueryFromToolInput, runMemoryGuardCheck, saveCollaborationState, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeOrchestratorHandoff };