@context-vault/core 2.11.0 → 2.12.0

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@context-vault/core",
3
- "version": "2.11.0",
3
+ "version": "2.12.0",
4
4
  "type": "module",
5
5
  "description": "Shared core: capture, index, retrieve, tools, and utilities for context-vault",
6
6
  "main": "src/index.js",
package/src/constants.js CHANGED
@@ -1,3 +1,9 @@
1
+ export const APP_URL = "https://app.context-vault.com";
2
+ export const API_URL = "https://api.context-vault.com";
3
+ export const MARKETING_URL = "https://contextvault.dev";
4
+ export const GITHUB_ISSUES_URL =
5
+ "https://github.com/fellanH/context-vault/issues";
6
+
1
7
  export const MAX_BODY_LENGTH = 100 * 1024; // 100KB
2
8
  export const MAX_TITLE_LENGTH = 500;
3
9
  export const MAX_KIND_LENGTH = 64;
@@ -1,8 +1,10 @@
1
1
  import { existsSync, writeFileSync } from "node:fs";
2
2
  import { join } from "node:path";
3
+ import { API_URL, MARKETING_URL, GITHUB_ISSUES_URL } from "../constants.js";
3
4
 
4
- const TELEMETRY_ENDPOINT = "https://api.context-vault.com/telemetry";
5
+ const TELEMETRY_ENDPOINT = `${API_URL}/telemetry`;
5
6
  const NOTICE_MARKER = ".telemetry-notice-shown";
7
+ const FEEDBACK_PROMPT_MARKER = ".feedback-prompt-shown";
6
8
 
7
9
  export function isTelemetryEnabled(config) {
8
10
  const envVal = process.env.CONTEXT_VAULT_TELEMETRY;
@@ -56,7 +58,31 @@ export function maybeShowTelemetryNotice(dataDir) {
56
58
  "[context-vault] Reports contain only: event type, error code, tool name, version, node version, platform, arch, timestamp.",
57
59
  "[context-vault] No vault content, file paths, or personal data is ever sent.",
58
60
  '[context-vault] Opt in: set "telemetry": true in ~/.context-mcp/config.json or set CONTEXT_VAULT_TELEMETRY=1.',
59
- "[context-vault] Full payload schema: https://contextvault.dev/telemetry",
61
+ `[context-vault] Full payload schema: ${MARKETING_URL}/telemetry`,
62
+ ];
63
+ for (const line of lines) {
64
+ process.stderr.write(line + "\n");
65
+ }
66
+ }
67
+
68
+ /**
69
+ * Print a one-time feedback prompt after the user's first successful save.
70
+ * Uses a marker file in dataDir to ensure it's only shown once.
71
+ * Never throws, never blocks.
72
+ */
73
+ export function maybeShowFeedbackPrompt(dataDir) {
74
+ try {
75
+ const markerPath = join(dataDir, FEEDBACK_PROMPT_MARKER);
76
+ if (existsSync(markerPath)) return;
77
+ writeFileSync(markerPath, new Date().toISOString() + "\n");
78
+ } catch {
79
+ return;
80
+ }
81
+
82
+ const lines = [
83
+ "[context-vault] First entry saved — nice work!",
84
+ "[context-vault] Got feedback, a bug, or a feature request?",
85
+ `[context-vault] Open an issue: ${GITHUB_ISSUES_URL}`,
60
86
  ];
61
87
  for (const line of lines) {
62
88
  process.stderr.write(line + "\n");
@@ -4,6 +4,7 @@ import { indexEntry } from "../../index/index.js";
4
4
  import { categoryFor } from "../../core/categories.js";
5
5
  import { normalizeKind } from "../../core/files.js";
6
6
  import { ok, err, ensureVaultExists, ensureValidKind } from "../helpers.js";
7
+ import { maybeShowFeedbackPrompt } from "../../core/telemetry.js";
7
8
  import {
8
9
  MAX_BODY_LENGTH,
9
10
  MAX_TITLE_LENGTH,
@@ -398,6 +399,11 @@ export async function handler(
398
399
  supersedes,
399
400
  userId,
400
401
  });
402
+
403
+ if (ctx.config?.dataDir) {
404
+ maybeShowFeedbackPrompt(ctx.config.dataDir);
405
+ }
406
+
401
407
  const relPath = entry.filePath
402
408
  ? entry.filePath.replace(config.vaultDir + "/", "")
403
409
  : entry.filePath;