cohvu 2.21.1 → 3.0.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.
Files changed (102) hide show
  1. package/README.md +37 -0
  2. package/cli.js +15501 -0
  3. package/package.json +15 -26
  4. package/dist/__tests__/instruction-file.unit.test.d.ts +0 -1
  5. package/dist/__tests__/instruction-file.unit.test.js +0 -296
  6. package/dist/__tests__/instruction-file.unit.test.js.map +0 -1
  7. package/dist/__tests__/teardown.unit.test.d.ts +0 -1
  8. package/dist/__tests__/teardown.unit.test.js +0 -196
  9. package/dist/__tests__/teardown.unit.test.js.map +0 -1
  10. package/dist/api.d.ts +0 -292
  11. package/dist/api.js +0 -337
  12. package/dist/api.js.map +0 -1
  13. package/dist/auth.d.ts +0 -4
  14. package/dist/auth.js +0 -96
  15. package/dist/auth.js.map +0 -1
  16. package/dist/constants.d.ts +0 -2
  17. package/dist/constants.js +0 -10
  18. package/dist/constants.js.map +0 -1
  19. package/dist/index.d.ts +0 -2
  20. package/dist/index.js +0 -259
  21. package/dist/index.js.map +0 -1
  22. package/dist/instructions.d.ts +0 -33
  23. package/dist/instructions.js +0 -238
  24. package/dist/instructions.js.map +0 -1
  25. package/dist/log.d.ts +0 -6
  26. package/dist/log.js +0 -51
  27. package/dist/log.js.map +0 -1
  28. package/dist/pause.d.ts +0 -3
  29. package/dist/pause.js +0 -24
  30. package/dist/pause.js.map +0 -1
  31. package/dist/platforms.d.ts +0 -22
  32. package/dist/platforms.js +0 -79
  33. package/dist/platforms.js.map +0 -1
  34. package/dist/postinstall.d.ts +0 -2
  35. package/dist/postinstall.js +0 -11
  36. package/dist/postinstall.js.map +0 -1
  37. package/dist/proxy.d.ts +0 -1
  38. package/dist/proxy.js +0 -371
  39. package/dist/proxy.js.map +0 -1
  40. package/dist/setup.d.ts +0 -15
  41. package/dist/setup.js +0 -295
  42. package/dist/setup.js.map +0 -1
  43. package/dist/teardown.d.ts +0 -15
  44. package/dist/teardown.js +0 -235
  45. package/dist/teardown.js.map +0 -1
  46. package/dist/tui/App.d.ts +0 -1
  47. package/dist/tui/App.js +0 -2245
  48. package/dist/tui/App.js.map +0 -1
  49. package/dist/tui/components/Banner.d.ts +0 -4
  50. package/dist/tui/components/Banner.js +0 -71
  51. package/dist/tui/components/Banner.js.map +0 -1
  52. package/dist/tui/components/Divider.d.ts +0 -1
  53. package/dist/tui/components/Divider.js +0 -8
  54. package/dist/tui/components/Divider.js.map +0 -1
  55. package/dist/tui/components/Footer.d.ts +0 -4
  56. package/dist/tui/components/Footer.js +0 -214
  57. package/dist/tui/components/Footer.js.map +0 -1
  58. package/dist/tui/components/Header.d.ts +0 -4
  59. package/dist/tui/components/Header.js +0 -126
  60. package/dist/tui/components/Header.js.map +0 -1
  61. package/dist/tui/components/LockCard.d.ts +0 -17
  62. package/dist/tui/components/LockCard.js +0 -37
  63. package/dist/tui/components/LockCard.js.map +0 -1
  64. package/dist/tui/components/Modal.d.ts +0 -5
  65. package/dist/tui/components/Modal.js +0 -195
  66. package/dist/tui/components/Modal.js.map +0 -1
  67. package/dist/tui/components/TabBar.d.ts +0 -4
  68. package/dist/tui/components/TabBar.js +0 -17
  69. package/dist/tui/components/TabBar.js.map +0 -1
  70. package/dist/tui/components/Toast.d.ts +0 -4
  71. package/dist/tui/components/Toast.js +0 -9
  72. package/dist/tui/components/Toast.js.map +0 -1
  73. package/dist/tui/index.d.ts +0 -1
  74. package/dist/tui/index.js +0 -20
  75. package/dist/tui/index.js.map +0 -1
  76. package/dist/tui/platform-detect.d.ts +0 -2
  77. package/dist/tui/platform-detect.js +0 -79
  78. package/dist/tui/platform-detect.js.map +0 -1
  79. package/dist/tui/state.d.ts +0 -414
  80. package/dist/tui/state.js +0 -397
  81. package/dist/tui/state.js.map +0 -1
  82. package/dist/tui/tabs/BillingTab.d.ts +0 -5
  83. package/dist/tui/tabs/BillingTab.js +0 -72
  84. package/dist/tui/tabs/BillingTab.js.map +0 -1
  85. package/dist/tui/tabs/KeysTab.d.ts +0 -5
  86. package/dist/tui/tabs/KeysTab.js +0 -87
  87. package/dist/tui/tabs/KeysTab.js.map +0 -1
  88. package/dist/tui/tabs/KnowledgeTab.d.ts +0 -5
  89. package/dist/tui/tabs/KnowledgeTab.js +0 -143
  90. package/dist/tui/tabs/KnowledgeTab.js.map +0 -1
  91. package/dist/tui/tabs/ProjectTab.d.ts +0 -5
  92. package/dist/tui/tabs/ProjectTab.js +0 -34
  93. package/dist/tui/tabs/ProjectTab.js.map +0 -1
  94. package/dist/tui/tabs/TeamTab.d.ts +0 -5
  95. package/dist/tui/tabs/TeamTab.js +0 -57
  96. package/dist/tui/tabs/TeamTab.js.map +0 -1
  97. package/dist/tui/tabs/YouTab.d.ts +0 -5
  98. package/dist/tui/tabs/YouTab.js +0 -25
  99. package/dist/tui/tabs/YouTab.js.map +0 -1
  100. package/dist/tui/utils.d.ts +0 -6
  101. package/dist/tui/utils.js +0 -58
  102. package/dist/tui/utils.js.map +0 -1
@@ -1,238 +0,0 @@
1
- export const COHVU_INSTRUCTIONS = `\
2
- You are connected to Cohvu, a substrate that stores understanding about \
3
- this software project — the reasoning behind decisions, constraints \
4
- discovered, intent behind changes, direction the work is heading. Not \
5
- code. Not documentation. The thinking that lives behind the work.
6
-
7
- Everything here was contributed by previous agents and developers working \
8
- on this project. Nothing is synthesized or rewritten. When an agent ends \
9
- a session, everything it understood but didn't write down is lost \
10
- permanently — these entries are what survived.
11
-
12
- Why this exists: you're a stateless reasoner. Each session, you read \
13
- code and try to be useful. But code tells you what — not why. The \
14
- reasoning behind every decision, the constraints that ruled out \
15
- alternatives, the intent that shaped the architecture — those lived in \
16
- someone's context window, and without a substrate, they're gone the \
17
- moment a session ends. The substrate makes that understanding durable. \
18
- Use it well and you start with the accumulated context of every agent \
19
- and developer who worked before you — the reasoning they built, \
20
- available to you now — rather than inferring everything from code alone.
21
-
22
- How the substrate works:
23
-
24
- When you call \`understand\`, your query is searched from multiple \
25
- angles — not just the literal terms you used, but related concepts, \
26
- alternative phrasings, and the reasoning dimension. Results are then \
27
- curated for your specific task, so what you receive is what's actually \
28
- relevant, not everything that matched. The more specific your query, \
29
- the sharper the selection. What you receive is verbatim — no synthesis, \
30
- no rewriting.
31
-
32
- When you call \`contribute\`, your contribution is saved immediately, \
33
- then the substrate processes it. Multi-topic contributions are split \
34
- into focused single-topic entries, because blended entries degrade \
35
- everything downstream. Each entry is then checked against the existing \
36
- substrate — if it directly contradicts something, the old entry is \
37
- superseded; if it says the same thing with no new detail, it's merged. \
38
- Multiple layers of structural safeguards prevent wrong destructive \
39
- decisions. Finally, pursue examines your contribution alongside the \
40
- nearby corpus and may respond — more on this below.
41
-
42
- Why you can trust what you read: the substrate actively maintains \
43
- itself through multiple mechanisms. Stale understanding gets superseded. \
44
- Redundant contributions get merged. The system is biased toward keeping \
45
- — letting two similar entries coexist is harmless, while wrongly \
46
- removing understanding is permanent. And pursue actively surfaces \
47
- tension between new contributions and existing entries, prompting \
48
- agents to update or remove stale framing. The substrate doesn't just \
49
- accumulate — it stays coherent.
50
-
51
- Using understand:
52
-
53
- Call \`understand\` before starting work. Describe what you're working \
54
- on, what you're thinking about, what you need to understand. Be specific \
55
- — "investigating why the worker queue drops jobs" will surface \
56
- constraints, architectural decisions, and locking strategies that \
57
- "worker queue" alone won't. Call it again whenever you encounter \
58
- something unfamiliar or need deeper context.
59
-
60
- Using contribute:
61
-
62
- Contribute in the moment — not after, not as a summary. When you make \
63
- a decision, contribute the reasoning behind it. When you discover a \
64
- constraint, contribute it. When you form an understanding of why \
65
- something is the way it is, contribute it. Your session could end at \
66
- any moment. Don't wait.
67
-
68
- Always contribute the why, not the what. If someone could learn it from \
69
- reading the code, don't contribute it.
70
-
71
- Weak: "We switched the queue from Redis to Postgres."
72
- Good: "We moved the queue from Redis to Postgres because we needed \
73
- transactional guarantees with the main data. Redis worked for isolated \
74
- queueing but coupling with the primary DB meant reconciling state across \
75
- two systems, which caused subtle bugs in billing reconciliation."
76
-
77
- Don't contribute: narration of what you're doing ("I refactored the \
78
- auth module" is narration, not understanding), code changes, \
79
- implementation details obvious from the code, general programming \
80
- knowledge, things derivable from the repo. Contribute: reasoning, intent, \
81
- constraints, rejected alternatives, direction, and understanding that \
82
- would be lost when your session ends.
83
-
84
- How pursue works:
85
-
86
- After you contribute, the substrate may respond. Not always — most \
87
- contributions don't trigger a response. But when the substrate sees \
88
- tension with existing entries, stale framing that your contribution \
89
- reveals, a connection you likely don't know about, or a gap that \
90
- matters, it will tell you specifically what it found.
91
-
92
- When the substrate responds: read it carefully. It will quote existing \
93
- entries by ID. Use \`substrate(get, ids: [...])\` to fetch those entries \
94
- in full before acting — pursue only sees short quotes; you should see \
95
- the whole entry. Once you've read them, decide: resolve tension with \
96
- \`substrate(update)\`, contribute a new entry that adds what's missing, \
97
- or (rarely) \`substrate(delete)\` if the entry is genuinely obsolete.
98
-
99
- The substrate is not always right — it sees your contribution and nearby \
100
- entries, not your full session. But it's the only vantage point that \
101
- sees both your fresh context and the substrate's accumulated \
102
- understanding simultaneously, so when it speaks, it's usually worth \
103
- listening to. If what it surfaces is relevant to the user's work, bring \
104
- it to them.
105
-
106
- Using substrate:
107
-
108
- The \`substrate\` tool gives you scoped operations on existing entries. \
109
- Read primitives (\`search\`, \`get\`, \`history\`) are open to every role; \
110
- mutations (\`update\`, \`delete\`, \`restore\`) are scoped by ownership.
111
-
112
- - \`substrate(search, queries: [...])\` — direct vector search across \
113
- 1–10 queries, no curator. Useful when you already know what you're \
114
- looking for or are building a custom workflow.
115
- - \`substrate(get, ids: [...])\` — fetch specific entries in full. Use \
116
- this whenever you have an ID — pursue emits IDs, search returns IDs, \
117
- the user may name an ID. Skip the search step when you already know \
118
- what to pull.
119
- - \`substrate(history, id: "...")\` — read an entry's version timeline: \
120
- prior bodies, who changed it, when. Useful when you're deciding how to \
121
- resolve a pursue-flagged conflict or when an entry looks like it may \
122
- be churning.
123
- - \`substrate(update/delete/restore)\` — curate entries. Members can \
124
- curate their own contributions; admins can curate any. Deleted entries \
125
- are recoverable for 30 days via \`restore\`.
126
-
127
- Substrate never creates new entries — \`contribute\` is the only write \
128
- path. Edits affect every future agent, so when in doubt, ask the user \
129
- before making substantial changes.
130
-
131
- Principles:
132
-
133
- - Understand before you start. Don't assume you know the context.
134
- - Contribute in the moment. Don't save it for later — your session could end anytime.
135
- - Contribute the why, not the what. Code shows what; the substrate holds why.
136
- - Trust what's in the substrate. It was contributed by someone who had context you don't. Unless you see clear evidence it's wrong, reason from it.
137
- - When the substrate speaks after a contribution, treat it like a thoughtful colleague — not infallible, but usually worth listening to.`;
138
- import { existsSync, mkdirSync, readFileSync, unlinkSync, writeFileSync, } from "fs";
139
- import { dirname } from "path";
140
- export const MARKER_START = "<!-- cohvu:start -->";
141
- export const MARKER_END = "<!-- cohvu:end -->";
142
- export function markedSection() {
143
- return `${MARKER_START}\n# Cohvu\n\n${COHVU_INSTRUCTIONS}\n${MARKER_END}`;
144
- }
145
- function escapeRegex(s) {
146
- return s.replace(/[.*+?^${}()|[\]\\]/g, "\\$&");
147
- }
148
- /**
149
- * Remove every cohvu trace from a file's content: paired marker blocks
150
- * (including duplicates from repeated bad installs) and any orphan
151
- * markers left behind by partial hand edits. Used by both setup (to
152
- * converge to a single clean block without bloating the file) and
153
- * teardown (so "disconnect" cleans up no matter what state the file
154
- * landed in). Collapses runs of blank lines so removal doesn't leave
155
- * whitespace holes.
156
- */
157
- export function stripCohvuMarkers(content) {
158
- const start = escapeRegex(MARKER_START);
159
- const end = escapeRegex(MARKER_END);
160
- let out = content;
161
- // Non-greedy match lets duplicates collapse one pair at a time.
162
- out = out.replace(new RegExp(`${start}[\\s\\S]*?${end}`, "g"), "");
163
- // Anything left must be a stray marker — strip it.
164
- out = out.replace(new RegExp(start, "g"), "");
165
- out = out.replace(new RegExp(end, "g"), "");
166
- return out.replace(/\n{3,}/g, "\n\n");
167
- }
168
- function ensureDir(dir) {
169
- if (!existsSync(dir)) {
170
- mkdirSync(dir, { recursive: true });
171
- }
172
- }
173
- /**
174
- * Setup's instruction-file writer. Converges to exactly one current cohvu
175
- * block at the end of the file: strip everything cohvu-related first (so
176
- * duplicates/orphans/misordered markers all collapse), then append a fresh
177
- * block. Self-healing across arbitrary hand edits, no fragment bloat on
178
- * repeated runs. Idempotent when the file is already in the target state.
179
- */
180
- export function writeMarkdownInstructions(filePath) {
181
- try {
182
- const section = markedSection();
183
- if (!existsSync(filePath)) {
184
- ensureDir(dirname(filePath));
185
- writeFileSync(filePath, section + "\n");
186
- return "ok";
187
- }
188
- const content = readFileSync(filePath, "utf-8");
189
- const stripped = stripCohvuMarkers(content).trimEnd();
190
- const next = stripped ? stripped + "\n\n" + section + "\n" : section + "\n";
191
- if (next === content)
192
- return "skipped";
193
- writeFileSync(filePath, next);
194
- return "ok";
195
- }
196
- catch (err) {
197
- const msg = err instanceof Error ? err.message : String(err);
198
- if (msg.includes("EACCES") || msg.includes("permission"))
199
- return { failed: "permission denied" };
200
- return { failed: msg.slice(0, 60) };
201
- }
202
- }
203
- /**
204
- * Teardown's instruction-file remover. Strips every cohvu trace, preserves
205
- * user content, deletes the file if cohvu was its only content. Symmetric
206
- * with writeMarkdownInstructions: whatever setup can produce, this undoes.
207
- */
208
- export function removeMarkdownInstructions(filePath) {
209
- try {
210
- if (!existsSync(filePath))
211
- return "skipped";
212
- const content = readFileSync(filePath, "utf-8");
213
- // Zero-cost short-circuit for the common "never had cohvu" case. Checks
214
- // both markers so a lone stray end marker still triggers a clean.
215
- if (!content.includes(MARKER_START) && !content.includes(MARKER_END))
216
- return "skipped";
217
- const stripped = stripCohvuMarkers(content).trimEnd();
218
- if (!stripped) {
219
- unlinkSync(filePath);
220
- }
221
- else {
222
- writeFileSync(filePath, stripped + "\n");
223
- }
224
- return "ok";
225
- }
226
- catch (err) {
227
- return { failed: (err instanceof Error ? err.message : String(err)).slice(0, 60) };
228
- }
229
- }
230
- // Cursor .mdc rule — entire file is owned by Cohvu
231
- export const CURSOR_RULE = `---
232
- description: Cohvu continuous understanding for AI coding agents
233
- alwaysApply: true
234
- ---
235
-
236
- ${COHVU_INSTRUCTIONS}
237
- `;
238
- //# sourceMappingURL=instructions.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"instructions.js","sourceRoot":"","sources":["../src/instructions.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,kBAAkB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;yIAwIuG,CAAC;AAE1I,OAAO,EACL,UAAU,EACV,SAAS,EACT,YAAY,EACZ,UAAU,EACV,aAAa,GACd,MAAM,IAAI,CAAC;AACZ,OAAO,EAAE,OAAO,EAAE,MAAM,MAAM,CAAC;AAE/B,MAAM,CAAC,MAAM,YAAY,GAAG,sBAAsB,CAAC;AACnD,MAAM,CAAC,MAAM,UAAU,GAAG,oBAAoB,CAAC;AAE/C,MAAM,UAAU,aAAa;IAC3B,OAAO,GAAG,YAAY,gBAAgB,kBAAkB,KAAK,UAAU,EAAE,CAAC;AAC5E,CAAC;AAID,SAAS,WAAW,CAAC,CAAS;IAC5B,OAAO,CAAC,CAAC,OAAO,CAAC,qBAAqB,EAAE,MAAM,CAAC,CAAC;AAClD,CAAC;AAED;;;;;;;;GAQG;AACH,MAAM,UAAU,iBAAiB,CAAC,OAAe;IAC/C,MAAM,KAAK,GAAG,WAAW,CAAC,YAAY,CAAC,CAAC;IACxC,MAAM,GAAG,GAAG,WAAW,CAAC,UAAU,CAAC,CAAC;IACpC,IAAI,GAAG,GAAG,OAAO,CAAC;IAClB,gEAAgE;IAChE,GAAG,GAAG,GAAG,CAAC,OAAO,CAAC,IAAI,MAAM,CAAC,GAAG,KAAK,aAAa,GAAG,EAAE,EAAE,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;IACnE,mDAAmD;IACnD,GAAG,GAAG,GA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AC,EAAE,CAAC;IACrF,CAAC;AACH,CAAC;AAED,mDAAmD;AACnD,MAAM,CAAC,MAAM,WAAW,GAAG;;;;;EAKzB,kBAAkB;CACnB,CAAC"}
package/dist/log.d.ts DELETED
@@ -1,6 +0,0 @@
1
- export declare const log: {
2
- error: (event: string, data?: Record<string, unknown>) => void;
3
- warn: (event: string, data?: Record<string, unknown>) => void;
4
- info: (event: string, data?: Record<string, unknown>) => void;
5
- debug: (event: string, data?: Record<string, unknown>) => void;
6
- };
package/dist/log.js DELETED
@@ -1,51 +0,0 @@
1
- // Structured logging for the MCP proxy. Writes JSON lines to stderr so the
2
- // editor's MCP log panel can surface them for debugging. Stdout is reserved
3
- // for the MCP protocol — never write non-protocol bytes there.
4
- //
5
- // Levels:
6
- // error — failures that surface to the agent
7
- // warn — degraded state (manifest fetch retrying, etc.)
8
- // info — lifecycle events (proxy start, paused, signed-out)
9
- // debug — per-request detail (tool calls, manifest refreshes)
10
- //
11
- // Default level is `info`. Developers who want per-request traces set
12
- // `COHVU_LOG=debug`. Setting `COHVU_LOG=error` silences lifecycle noise.
13
- const LEVEL_ORDER = {
14
- error: 0,
15
- warn: 1,
16
- info: 2,
17
- debug: 3,
18
- };
19
- function resolveLevel() {
20
- const raw = (process.env.COHVU_LOG ?? "info").toLowerCase();
21
- if (raw === "error" || raw === "warn" || raw === "info" || raw === "debug")
22
- return raw;
23
- return "info";
24
- }
25
- const ACTIVE_LEVEL = resolveLevel();
26
- function shouldLog(level) {
27
- return LEVEL_ORDER[level] <= LEVEL_ORDER[ACTIVE_LEVEL];
28
- }
29
- function emit(level, event, data) {
30
- if (!shouldLog(level))
31
- return;
32
- const entry = {
33
- ts: new Date().toISOString(),
34
- level,
35
- event,
36
- ...data,
37
- };
38
- try {
39
- process.stderr.write(JSON.stringify(entry) + "\n");
40
- }
41
- catch {
42
- // stderr closed — nothing we can do; the editor process handles lifecycle.
43
- }
44
- }
45
- export const log = {
46
- error: (event, data = {}) => emit("error", event, data),
47
- warn: (event, data = {}) => emit("warn", event, data),
48
- info: (event, data = {}) => emit("info", event, data),
49
- debug: (event, data = {}) => emit("debug", event, data),
50
- };
51
- //# sourceMappingURL=log.js.map
package/dist/log.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"log.js","sourceRoot":"","sources":["../src/log.ts"],"names":[],"mappings":"AAAA,2EAA2E;AAC3E,4EAA4E;AAC5E,+DAA+D;AAC/D,EAAE;AACF,UAAU;AACV,gDAAgD;AAChD,4DAA4D;AAC5D,gEAAgE;AAChE,iEAAiE;AACjE,EAAE;AACF,sEAAsE;AACtE,yEAAyE;AAIzE,MAAM,WAAW,GAA0B;IACzC,KAAK,EAAE,CAAC;IACR,IAAI,EAAE,CAAC;IACP,IAAI,EAAE,CAAC;IACP,KAAK,EAAE,CAAC;CACT,CAAC;AAEF,SAAS,YAAY;IACnB,MAAM,GAAG,GAAG,CAAC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,MAAM,CAAC,CAAC,WAAW,EAAE,CAAC;IAC5D,IAAI,GAAG,KAAK,OAAO,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,MAAM,IAAI,GAAG,KAAK,OAAO;QAAE,OAAO,GAAG,CAAC;IACvF,OAAO,MAAM,CAAC;AAChB,CAAC;AAED,MAAM,YAAY,GAAG,YAAY,EAAE,CAAC;AAEpC,SAAS,SAAS,CAAC,KAAY;IAC7B,OAAO,WAAW,CAAC,KAAK,CAAC,IAAI,WAAW,CAAC,YAAY,CAAC,CAAC;AACzD,CAAC;AAED,SAAS,IAAI,CAAC,KAAY,EAAE,KAAa,EAAE,IAA6B;IACtE,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC;QAAE,OAAO;IAC9B,MAAM,KAAK,GAAG;QACZ,EAAE,EAAE,IAAI,IAAI,EAAE,CAAC,WAAW,EAAE;QAC5B,KAAK;QACL,KAAK;QACL,GAAG,IAAI;KACR,CAAC;IACF,IAAI,CAAC;QACH,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,GAAG,IAAI,CAAC,CAAC;IACrD,CAAC;IAAC,MAAM,CAAC;QACP,2EAA2E;IAC7E,CAAC;AACH,CAAC;AAED,MAAM,CAAC,MAAM,GAAG,GAAG;IACjB,KAAK,EAAE,CAAC,KAAa,EAAE,OAAgC,EAAE,EAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;IAC9F,IAAI,EAAE,CAAC,KAAa,EAAE,OAAgC,EAAE,EAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC;IAC5F,IAAI,EAAE,CAAC,KAAa,EAAE,OAAgC,EAAE,EAAQ,EAAE,CAAC,IAAI,CAAC,MAAM,EAAE,KAAK,EAAE,IAAI,CAAC;IAC5F,KAAK,EAAE,CAAC,KAAa,EAAE,OAAgC,EAAE,EAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,EAAE,KAAK,EAAE,IAAI,CAAC;CAC/F,CAAC"}
package/dist/pause.d.ts DELETED
@@ -1,3 +0,0 @@
1
- export declare const PAUSED_FILE: string;
2
- export declare function isPaused(): boolean;
3
- export declare function setPaused(paused: boolean): void;
package/dist/pause.js DELETED
@@ -1,24 +0,0 @@
1
- // Pause flag — file-based, survives restarts.
2
- // The proxy checks this on startup to decide whether to expose tools.
3
- import { existsSync, writeFileSync, unlinkSync } from "fs";
4
- import { homedir } from "os";
5
- import { join } from "path";
6
- const CONFIG_DIR = join(homedir(), ".cohvu");
7
- export const PAUSED_FILE = join(CONFIG_DIR, "paused");
8
- export function isPaused() {
9
- return existsSync(PAUSED_FILE);
10
- }
11
- export function setPaused(paused) {
12
- if (paused) {
13
- writeFileSync(PAUSED_FILE, "1", { mode: 0o600 });
14
- }
15
- else {
16
- try {
17
- unlinkSync(PAUSED_FILE);
18
- }
19
- catch {
20
- // Already gone — that's fine
21
- }
22
- }
23
- }
24
- //# sourceMappingURL=pause.js.map
package/dist/pause.js.map DELETED
@@ -1 +0,0 @@
1
- {"version":3,"file":"pause.js","sourceRoot":"","sources":["../src/pause.ts"],"names":[],"mappings":"AAAA,8CAA8C;AAC9C,sEAAsE;AAEtE,OAAO,EAAE,UAAU,EAAE,aAAa,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAC3D,OAAO,EAAE,OAAO,EAAE,MAAM,IAAI,CAAC;AAC7B,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAE5B,MAAM,UAAU,GAAG,IAAI,CAAC,OAAO,EAAE,EAAE,QAAQ,CAAC,CAAC;AAC7C,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC;AAEtD,MAAM,UAAU,QAAQ;IACtB,OAAO,UAAU,CAAC,WAAW,CAAC,CAAC;AACjC,CAAC;AAED,MAAM,UAAU,SAAS,CAAC,MAAe;IACvC,IAAI,MAAM,EAAE,CAAC;QACX,aAAa,CAAC,WAAW,EAAE,GAAG,EAAE,EAAE,IAAI,EAAE,KAAK,EAAE,CAAC,CAAC;IACnD,CAAC;SAAM,CAAC;QACN,IAAI,CAAC;YACH,UAAU,CAAC,WAAW,CAAC,CAAC;QAC1B,CAAC;QAAC,MAAM,CAAC;YACP,6BAA6B;QAC/B,CAAC;IACH,CAAC;AACH,CAAC"}
@@ -1,22 +0,0 @@
1
- export interface PlatformDef {
2
- name: string;
3
- detectPath: string;
4
- agentSlug: string;
5
- mcp: {
6
- path: string;
7
- rootKey: string;
8
- format: "json" | "toml";
9
- } | null;
10
- instructions: {
11
- path: string;
12
- format: "markdown" | "mdc";
13
- } | null;
14
- permissions: {
15
- path: string;
16
- allowRules: string[];
17
- } | null;
18
- }
19
- export interface DetectedPlatform {
20
- def: PlatformDef;
21
- }
22
- export declare function detectPlatforms(): DetectedPlatform[];
package/dist/platforms.js DELETED
@@ -1,79 +0,0 @@
1
- // Platform definitions and detection for auto-configuration.
2
- import { existsSync } from "fs";
3
- import { homedir, platform } from "os";
4
- import { join } from "path";
5
- function vscodeUserDir() {
6
- if (platform() === "darwin") {
7
- return join("Library", "Application Support", "Code", "User");
8
- }
9
- // Linux / WSL
10
- return join(".config", "Code", "User");
11
- }
12
- const PLATFORMS = [
13
- {
14
- name: "Claude Code",
15
- detectPath: ".claude",
16
- agentSlug: "claude-code",
17
- mcp: { path: ".claude.json", rootKey: "mcpServers", format: "json" },
18
- instructions: { path: join(".claude", "CLAUDE.md"), format: "markdown" },
19
- permissions: {
20
- path: join(".claude", "settings.json"),
21
- allowRules: ["mcp__cohvu__*"],
22
- },
23
- },
24
- {
25
- name: "Cursor",
26
- detectPath: ".cursor",
27
- agentSlug: "cursor",
28
- mcp: { path: join(".cursor", "mcp.json"), rootKey: "mcpServers", format: "json" },
29
- instructions: { path: join(".cursor", "rules", "cohvu.mdc"), format: "mdc" },
30
- permissions: null,
31
- },
32
- {
33
- name: "Windsurf",
34
- detectPath: join(".codeium", "windsurf"),
35
- agentSlug: "windsurf",
36
- mcp: {
37
- path: join(".codeium", "windsurf", "mcp_config.json"),
38
- rootKey: "mcpServers",
39
- format: "json",
40
- },
41
- instructions: {
42
- path: join(".codeium", "windsurf", "contributions", "global_rules.md"),
43
- format: "markdown",
44
- },
45
- permissions: null,
46
- },
47
- {
48
- name: "Cline",
49
- detectPath: join(vscodeUserDir(), "globalStorage", "saoudrizwan.claude-dev"),
50
- agentSlug: "cline",
51
- mcp: {
52
- path: join(vscodeUserDir(), "globalStorage", "saoudrizwan.claude-dev", "settings", "cline_mcp_settings.json"),
53
- rootKey: "mcpServers",
54
- format: "json",
55
- },
56
- instructions: { path: join("Documents", "Cline", "Rules", "cohvu.md"), format: "markdown" },
57
- permissions: null,
58
- },
59
- {
60
- name: "Codex",
61
- detectPath: ".codex",
62
- agentSlug: "codex",
63
- mcp: { path: join(".codex", "config.toml"), rootKey: "mcp_servers", format: "toml" },
64
- instructions: { path: join(".codex", "AGENTS.md"), format: "markdown" },
65
- permissions: null,
66
- },
67
- ];
68
- export function detectPlatforms() {
69
- const home = homedir();
70
- const detected = [];
71
- for (const def of PLATFORMS) {
72
- const fullPath = join(home, def.detectPath);
73
- if (existsSync(fullPath)) {
74
- detected.push({ def });
75
- }
76
- }
77
- return detected;
78
- }
79
- //# sourceMappingURL=platforms.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"platforms.js","sourceRoot":"","sources":["../src/platforms.ts"],"names":[],"mappings":"AAAA,6DAA6D;AAE7D,OAAO,EAAE,UAAU,EAAE,MAAM,IAAI,CAAC;AAChC,OAAO,EAAE,OAAO,EAAE,QAAQ,EAAE,MAAM,IAAI,CAAC;AACvC,OAAO,EAAE,IAAI,EAAE,MAAM,MAAM,CAAC;AAwB5B,SAAS,aAAa;IACpB,IAAI,QAAQ,EAAE,KAAK,QAAQ,EAAE,CAAC;QAC5B,OAAO,IAAI,CAAC,SAAS,EAAE,qBAAqB,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;IAChE,CAAC;IACD,cAAc;IACd,OAAO,IAAI,CAAC,SAAS,EAAE,MAAM,EAAE,MAAM,CAAC,CAAC;AACzC,CAAC;AAED,MAAM,SAAS,GAAkB;IAC/B;QACE,IAAI,EAAE,aAAa;QACnB,UAAU,EAAE,SAAS;QACrB,SAAS,EAAE,aAAa;QACxB,GAAG,EAAE,EAAE,IAAI,EAAE,cAAc,EAAE,OAAO,EAAE,YAAY,EAAE,MAAM,EAAE,MAAM,EAAE;QACpE,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE;QACxE,WAAW,EAAE;YACX,IAAI,EAAE,IAAI,CAAC,SAAS,EAAE,eAAe,CAAC;YACtC,UAAU,EAAE,CAAC,eAAe,CAAC;SAC9B;KACF;IACD;QACE,IAAI,EAAE,QAAQ;QACd,UAAU,EAAE,SAAS;QACrB,SAAS,EAAE,QAAQ;QACnB,GAAG,EAAE,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,EAAE,aAAa,CAAC,EAAE,OAAO,EAAE,aAAa,EAAE,MAAM,EAAE,MAAM,EAAE;QACpF,YAAY,EAAE,EAAE,IAAI,EAAE,IAAI,CAAC,QAAQ,EAAE,WAAW,CAAC,EAAE,MAAM,EAAE,UAAU,EAAE;QACvE,WAAW,EAAE,IAAI;KAClB;CACF,CAAC;AAMF,MAAM,UAAU,eAAe;IAC7B,MAAM,IAAI,GAAG,OAAO,EAAE,CAAC;IACvB,MAAM,QAAQ,GAAuB,EAAE,CAAC;IAExC,KAAK,MAAM,GAAG,IAAI,SAAS,EAAE,CAAC;QAC5B,MAAM,QAAQ,GAAG,IAAI,CAAC,IAAI,EAAE,GAAG,CAAC,UAAU,CAAC,CAAC;QAC5C,IAAI,UAAU,CAAC,QAAQ,CAAC,EAAE,CAAC;YACzB,QAAQ,CAAC,IAAI,CAAC,EAAE,GAAG,EAAE,CAAC,CAAC;QACzB,CAAC;IACH,CAAC;IAED,OAAO,QAAQ,CAAC;AAClB,CAAC"}
@@ -1,2 +0,0 @@
1
- #!/usr/bin/env node
2
- export {};
@@ -1,11 +0,0 @@
1
- #!/usr/bin/env node
2
- import { openSync, writeSync, closeSync } from "fs";
3
- try {
4
- const fd = openSync("/dev/tty", "w");
5
- writeSync(fd, "\n installed. run \x1b[1mcohvu\x1b[0m.\n\n");
6
- closeSync(fd);
7
- }
8
- catch {
9
- // Not a TTY (CI, piped) — skip silently
10
- }
11
- //# sourceMappingURL=postinstall.js.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"postinstall.js","sourceRoot":"","sources":["../src/postinstall.ts"],"names":[],"mappings":";AACA,OAAO,EAAE,QAAQ,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,IAAI,CAAC;AAEpD,IAAI,CAAC;IACH,MAAM,EAAE,GAAG,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC;IACrC,SAAS,CAAC,EAAE,EAAE,6CAA6C,CAAC,CAAC;IAC7D,SAAS,CAAC,EAAE,CAAC,CAAC;AAChB,CAAC;AAAC,MAAM,CAAC;IACP,wCAAwC;AAC1C,CAAC"}
package/dist/proxy.d.ts DELETED
@@ -1 +0,0 @@
1
- export declare function proxy(): Promise<void>;