snipara-companion 1.3.6 → 1.3.8

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.
package/README.md CHANGED
@@ -59,6 +59,19 @@ yarn global add snipara-companion
59
59
  snipara-companion
60
60
  ```
61
61
 
62
+ ## New In 1.3.7
63
+
64
+ - Hardens `memory-guard check` with `--confirmed-by-user "<confirmation>"`
65
+ for explicit, auditable overrides after the user has reviewed destructive or
66
+ contradictory signals.
67
+ - Adds stable guard exit codes in strict mode: `20` for confirmation required,
68
+ `21` for unavailable memory/context guidance, and `22` for invalid guard
69
+ options.
70
+ - Validates destructive checks before hosted calls so vague commands such as
71
+ `--destructive` without `--intent` or `--command` fail fast.
72
+ - Extends `snipara-companion init --with-hooks` so it also installs local code
73
+ overlay Git hooks (`post-commit` sync and `pre-push` promotion/reindex).
74
+
62
75
  ## New In 1.3.6
63
76
 
64
77
  - Adds `snipara-companion memory audit` for a read-only memory hygiene pass that
@@ -459,6 +472,8 @@ snipara-companion upload --path docs/spec.md --file ./docs/spec.md
459
472
  snipara-companion upload --path clients/acme/current.md --file ./current.md --asset-class BUSINESS_DOCUMENT --usage-mode current_truth --source-kind local_agent --client-id acme
460
473
  snipara-companion upload --path diagrams/network.vsdx --file ./diagrams/network.vsdx --kind BINARY --format vsdx --reindex
461
474
  snipara-companion upload --path docs/spec.md --file ./docs/spec.md --reindex
475
+ snipara-companion references scan --allow-domain docs.stripe.com --allow-domain docs.github.com
476
+ snipara-companion references ingest --upload --reindex
462
477
  snipara-companion business-collections list
463
478
  snipara-companion business-collections ensure --preset business_response_playbook
464
479
  snipara-companion business-collections ensure --preset offer_templates
@@ -552,6 +567,29 @@ snipara-companion task-commit --summary "Validated PR Answer Pack release docs"
552
567
  Only add a dedicated `snipara-companion github answer-packs` command if Snipara
553
568
  ships a public API for manual regeneration or inspection outside the dashboard.
554
569
 
570
+ ### External References
571
+
572
+ Use `references` when repository docs point at source material the agent may not
573
+ be able to fetch directly, such as SDK docs, vendor runbooks, RFCs, or client
574
+ pages:
575
+
576
+ ```bash
577
+ snipara-companion references scan \
578
+ --allow-domain docs.stripe.com \
579
+ --allow-domain docs.github.com
580
+
581
+ snipara-companion references ingest --dry-run
582
+ snipara-companion references ingest --upload --reindex
583
+ ```
584
+
585
+ `scan` writes `.snipara/references/manifest.json` with each URL, source file,
586
+ line number, domain, and allowlist status. URLs are only ingested when their
587
+ domain is allowlisted in the manifest or passed with `--allow-domain` at ingest
588
+ time. `ingest` fetches allowed URLs into local Markdown snapshots under
589
+ `.snipara/references/snapshots/`; `--upload` sends those snapshots to Snipara as
590
+ external reference documents with source URL, content hash, fetch time, HTTP
591
+ metadata, and referenced-from provenance.
592
+
555
593
  ### Project Intelligence Briefs
556
594
 
557
595
  Use `intelligence brief` when a task needs one local entrypoint for continuity,
@@ -661,6 +699,11 @@ snipara-companion memory-guard check \
661
699
  --intent "npm publish snipara-companion" \
662
700
  --destructive \
663
701
  --strict
702
+ snipara-companion memory-guard check \
703
+ --intent "npm publish snipara-companion" \
704
+ --destructive \
705
+ --strict \
706
+ --confirmed-by-user "User confirmed npm publish after reviewing guard output"
664
707
  ```
665
708
 
666
709
  When memory or source context contradicts the requested action, the JSON output
@@ -668,6 +711,13 @@ sets `requiresConfirmation=true`, includes `contradictions`, and provides a
668
711
  `confirmationPrompt`. In `--strict` mode the command exits non-zero until the
669
712
  operator has explicitly confirmed the override.
670
713
 
714
+ Strict mode exit codes:
715
+
716
+ - `20`: confirmation is required before continuing.
717
+ - `21`: memory/context guidance was unavailable for a triggered guard.
718
+ - `22`: guard options were invalid, for example `--destructive` without a
719
+ specific `--intent` or `--command`.
720
+
671
721
  ### Commit Memory Policy
672
722
 
673
723
  Companion separates two concepts:
package/dist/index.d.ts CHANGED
@@ -1000,6 +1000,7 @@ interface MemoryGuardFinding {
1000
1000
  code: "recent_failure" | "release_surface" | "manual" | "destructive_intent" | "contradiction";
1001
1001
  message: string;
1002
1002
  }
1003
+ type MemoryGuardBlockReason = "confirmation_required" | "guidance_unavailable";
1003
1004
  interface MemoryGuardContradiction {
1004
1005
  source: "memory" | "context";
1005
1006
  reason: string;
@@ -1020,6 +1021,7 @@ interface MemoryGuardCheckOptions {
1020
1021
  status?: string;
1021
1022
  destructive?: boolean;
1022
1023
  requireConfirmation?: boolean;
1024
+ confirmedByUser?: string;
1023
1025
  strict?: boolean;
1024
1026
  json?: boolean;
1025
1027
  limit?: number;
@@ -1027,9 +1029,18 @@ interface MemoryGuardCheckOptions {
1027
1029
  includeContext?: boolean;
1028
1030
  recentFailures?: boolean;
1029
1031
  }
1032
+ interface MemoryGuardConfirmation {
1033
+ required: boolean;
1034
+ confirmed: boolean;
1035
+ note?: string;
1036
+ overridesDestructive: boolean;
1037
+ overridesContradictions: boolean;
1038
+ }
1030
1039
  interface MemoryGuardCheckResult {
1031
1040
  triggered: boolean;
1032
1041
  shouldBlock: boolean;
1042
+ blockReason?: MemoryGuardBlockReason;
1043
+ exitCode: number;
1033
1044
  trigger: MemoryGuardTrigger;
1034
1045
  findings: MemoryGuardFinding[];
1035
1046
  files: string[];
@@ -1047,6 +1058,7 @@ interface MemoryGuardCheckResult {
1047
1058
  destructive: boolean;
1048
1059
  contradictions: MemoryGuardContradiction[];
1049
1060
  requiresConfirmation: boolean;
1061
+ confirmation: MemoryGuardConfirmation;
1050
1062
  confirmationPrompt?: string;
1051
1063
  memoryAvailable: boolean;
1052
1064
  contextAvailable: boolean;
@@ -1628,6 +1640,91 @@ declare function buildAgenticTimeline(options?: {
1628
1640
  cwd?: string;
1629
1641
  }): AgenticTimeline;
1630
1642
 
1643
+ declare const MANIFEST_VERSION = "snipara.references.v1";
1644
+ type ReferenceStatus = "allowed" | "pending" | "denied" | "unsupported";
1645
+ interface ReferenceOccurrence {
1646
+ file: string;
1647
+ line: number;
1648
+ label?: string;
1649
+ }
1650
+ interface ReferenceManifestItem {
1651
+ id: string;
1652
+ url: string;
1653
+ normalizedUrl: string;
1654
+ domain: string;
1655
+ status: ReferenceStatus;
1656
+ reason: string;
1657
+ discoveredAt: string;
1658
+ occurrences: ReferenceOccurrence[];
1659
+ latestSnapshotPath?: string;
1660
+ latestFetchStatus?: number;
1661
+ latestFetchAt?: string;
1662
+ latestContentHash?: string;
1663
+ latestError?: string;
1664
+ }
1665
+ interface ReferenceManifest {
1666
+ version: typeof MANIFEST_VERSION;
1667
+ generatedAt: string;
1668
+ root: string;
1669
+ allowDomains: string[];
1670
+ denyDomains: string[];
1671
+ items: ReferenceManifestItem[];
1672
+ }
1673
+ interface ScanReferencesOptions {
1674
+ root?: string;
1675
+ output?: string;
1676
+ allowDomain?: string[];
1677
+ denyDomain?: string[];
1678
+ extensions?: string[];
1679
+ maxFiles?: number;
1680
+ json?: boolean;
1681
+ }
1682
+ interface IngestReferencesOptions {
1683
+ manifest?: string;
1684
+ outputDir?: string;
1685
+ allowDomain?: string[];
1686
+ ids?: string[];
1687
+ max?: number;
1688
+ timeoutMs?: number;
1689
+ maxBytes?: number;
1690
+ destinationPrefix?: string;
1691
+ upload?: boolean;
1692
+ reindex?: boolean;
1693
+ dryRun?: boolean;
1694
+ json?: boolean;
1695
+ }
1696
+ interface ScanSummary {
1697
+ manifest: ReferenceManifest;
1698
+ outputPath: string;
1699
+ scannedFiles: number;
1700
+ foundUrls: number;
1701
+ allowed: number;
1702
+ pending: number;
1703
+ denied: number;
1704
+ unsupported: number;
1705
+ }
1706
+ interface IngestSummary {
1707
+ manifestPath: string;
1708
+ selected: number;
1709
+ fetched: number;
1710
+ uploaded: number;
1711
+ failed: number;
1712
+ dryRun: boolean;
1713
+ snapshots: Array<{
1714
+ id: string;
1715
+ url: string;
1716
+ snapshotPath?: string;
1717
+ destinationPath?: string;
1718
+ status?: number;
1719
+ uploaded?: boolean;
1720
+ error?: string;
1721
+ }>;
1722
+ }
1723
+ declare function scanReferences(options?: ScanReferencesOptions): ScanSummary;
1724
+ declare function ingestReferences(options?: IngestReferencesOptions): Promise<IngestSummary>;
1725
+ declare function referencesScanCommand(options: ScanReferencesOptions): Promise<void>;
1726
+ declare function referencesIngestCommand(options: IngestReferencesOptions): Promise<void>;
1727
+
1631
1728
  type CacheStrategy = "exact" | "nearby" | "warm";
1632
1729
  interface QueryCacheScope {
1633
1730
  cwd?: string;
@@ -2050,4 +2147,4 @@ interface WrittenOrchestratorHandoff {
2050
2147
  declare function buildOrchestratorHandoff(options: OrchestratorHandoffOptions): OrchestratorHandoffArtifact;
2051
2148
  declare function writeOrchestratorHandoff(options: OrchestratorHandoffOptions): WrittenOrchestratorHandoff;
2052
2149
 
2053
- export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, 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, buildHostedCodeOverlayUploadPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, collectSyncDocuments, collectSyncDocumentsInput, createClient, createEmptyTeamSyncState, createLocalQueryCache, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, extractCommandFromToolInput, extractFilesFromToolInput, formatOrchestratorRecommendationReason, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getConfigPath, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, normalizeGuardTag, normalizeWorkflowPlanInput, projectIntelligenceBriefCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, resolveQueryFromToolInput, runMemoryGuardCheck, saveConfig, saveTeamSyncState, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeOrchestratorHandoff };
2150
+ export { AUTOMATION_MANIFEST_RELATIVE_PATH, AutomationInstallConflictError, AutomationUnsupportedHookBundleError, 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, buildHostedCodeOverlayUploadPayload, buildJournalCheckpointEntry, buildLocalCallersResult, buildLocalCodeOverlay, buildLocalImpactResult, buildLocalImportsResult, buildLocalNeighborsResult, buildLocalShortestPathResult, buildMemoryAudit, buildOnboardFolderManifest, buildOrchestratorHandoff, buildProjectIntelligenceBrief, buildSyncDocumentsDryRun, buildTeamSyncHandoffRecord, buildTeamSyncStartWorkRecord, buildTeamSyncSummary, buildToolCallPayload, buildToolResultPayload, buildVerificationPlan, buildWorkflowPhaseCommitSummary, buildWorkflowPlanScaffold, categoryFromGuardTag, classifyToolResult, collectSyncDocuments, collectSyncDocumentsInput, createClient, createEmptyTeamSyncState, createLocalQueryCache, detectReleaseSurfacesFromFiles, detectRuntimeEnvironment, extractCommandFromToolInput, extractFilesFromToolInput, formatOrchestratorRecommendationReason, formatStuckGuardDecision, getAutomationManifestPath, getAutomationStatus, getConfigPath, getLocalCodeOverlayCachePath, getLocalCodePromotionStatePath, getOrchestratorRecommendation, getPlanStepDisplayTitle, getStagedFiles, getStuckGuardInjection, getTeamSyncStatePath, ingestReferences, installAutomationBundle, listProjectsForApiKey, loadAutomationManifest, loadConfig, loadTeamSyncState, memoryAuditCommand, memoryCleanCandidatesCommand, memoryCompactCommand, memoryHealthCommand, normalizeGuardTag, normalizeWorkflowPlanInput, projectIntelligenceBriefCommand, readLocalCodeOverlayCache, readLocalCodePromotionState, referencesIngestCommand, referencesScanCommand, resolveQueryFromToolInput, runMemoryGuardCheck, saveConfig, saveTeamSyncState, scanReferences, shouldSuggestOrchestratorForWorkflow, shouldSuggestRuntimeForWorkflow, summarizeLocalCodeOverlay, teamSyncSweepCommand, verifyCommand, writeLocalCodeOverlayCache, writeLocalCodePromotionState, writeOrchestratorHandoff };