@cohesivity/init 0.6.4 → 0.6.6

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 (3) hide show
  1. package/README.md +46 -7
  2. package/bin/cli.js +84 -24
  3. package/package.json +1 -1
package/README.md CHANGED
@@ -22,15 +22,21 @@ Portable directories are staged and atomically replaced.
22
22
  | Claude | `claude plugin marketplace add <verified-local-root> --scope user`, then `claude plugin install cohesivity@cohesivity --scope user` |
23
23
  | Cursor | atomically copy the portable plugin to `~/.cursor/plugins/local/cohesivity` |
24
24
  | Codex | `codex plugin marketplace add <verified-local-marketplace>`, then `codex plugin add cohesivity@cohesivity` |
25
- | Gemini | `gemini extensions install <verified-local-gemini-root> --consent` |
25
+ | Gemini | first run: `gemini extensions install <verified-local-gemini-root> --consent`; rerun: `gemini extensions update cohesivity` |
26
26
  | Antigravity | `agy plugin install <verified-local-root>`; if `agy` is absent, atomically copy to `~/.gemini/config/plugins/cohesivity` only when an Antigravity-specific home is present |
27
27
  | OpenClaw | install `cohesivity` through the verified Claude marketplace root, enable it, then save the remote Streamable HTTP OAuth MCP |
28
- | Hermes | atomically copy to `~/.hermes/plugins/cohesivity`, then `hermes plugins enable cohesivity` |
28
+ | Hermes | install the canonical skill and local server in Hermes-owned paths, import both MCP entries through `hermes import-agent ... --overwrite --yes`, then set the two enabled flags and dormant OAuth metadata with `hermes config set` |
29
+ | OpenCode | preserve the verified portable package, install its skill to `~/.agents/skills/cohesivity`, then use `opencode mcp add` for the local six-tool server and remote management server |
29
30
 
30
31
  Detection is additive rather than first-match-wins. A Claude home does not stop
31
- Cursor, Codex, Gemini, Antigravity, OpenClaw, or Hermes from also being
32
+ Cursor, Codex, Gemini, Antigravity, OpenClaw, Hermes, or OpenCode from also being
32
33
  configured. A shared `~/.gemini` directory alone is not treated as positive
33
- Antigravity detection.
34
+ Antigravity detection. Claude, Codex, Gemini, OpenClaw, Hermes, OpenCode, and
35
+ fallback adapters require their executable; stale configuration homes are not
36
+ installation evidence. Cursor's client-owned home and Antigravity's documented
37
+ product-specific homes remain positive contracts for their desktop surfaces.
38
+ The measured harness label is attribution only and never selects a delivery
39
+ adapter.
34
40
 
35
41
  Known adapters without a Cohesivity plugin package receive the canonical
36
42
  standalone skill plus the remote MCP endpoint
@@ -40,9 +46,15 @@ Copilot CLI, VS Code, Cline CLI, and Grok. It does not modify JSON, TOML, or YAM
40
46
  configuration with regular expressions.
41
47
 
42
48
  The installer never starts OAuth or opens a browser. It prints the relevant
43
- restart and authentication steps after delivery. Hermes remote MCP OAuth is
44
- qualified: automatic login works only when the endpoint supports Dynamic Client
45
- Registration; otherwise Hermes needs a pre-registered OAuth client.
49
+ restart and authentication steps after delivery. Three MCP surfaces have
50
+ different boundaries: the public documentation server at
51
+ `https://cohesivity.ai/mcp` needs no login, the installed local project-bootstrap
52
+ server needs no login, and `https://cohesivity.ai/mcp/manage` requires OAuth for
53
+ account-scoped management. OpenCode users start that last flow explicitly with
54
+ `opencode mcp auth cohesivity`. Hermes uses the exact native server name
55
+ `cohesivity`; `hermes mcp login cohesivity` starts its management OAuth flow.
56
+ The Cohesivity endpoint advertises Dynamic Client Registration, so Hermes does
57
+ not need a pre-registered OAuth client.
46
58
 
47
59
  ## Standalone skill only
48
60
 
@@ -154,6 +166,33 @@ server-issued, and not derived from hardware or user data. Delete
154
166
  | `--base <url>` | API base for tenant bootstrap (default `https://cohesivity.ai`) |
155
167
  | `-h`, `--help` | show command help and the exact package version |
156
168
 
169
+ ## 0.6.6 released Hermes adapter
170
+
171
+ Version 0.6.6 replaces portable-plugin enablement with surfaces shipped by the
172
+ immutable Hermes 0.20.0 release. It keeps plugin 2.1.4's verified local server in
173
+ Hermes's native MCP directory, installs the canonical skill in its skill directory,
174
+ and feeds the local and remote entries through Hermes's own noninteractive
175
+ Claude import and structural config commands. Reruns overwrite only the two
176
+ Cohesivity MCP names, preserve unrelated Hermes settings, verify the exact
177
+ persisted command/URL/auth values, and never start OAuth.
178
+
179
+ ## 0.6.5 OpenCode and repeat-safe Gemini delivery
180
+
181
+ Version 0.6.5 recognizes OpenCode only from its executable, preserves the
182
+ verified portable package under the Cohesivity data directory, installs the
183
+ canonical skill in OpenCode's documented global `~/.agents/skills` surface, and
184
+ uses OpenCode's native noninteractive `mcp add` commands for both the local
185
+ six-tool server and exact remote management endpoint. Reruns replace those
186
+ entries structurally through OpenCode's own JSONC-aware config writer and never
187
+ start OAuth.
188
+
189
+ Gemini now installs the extension on the first run and uses
190
+ `gemini extensions update cohesivity` once the native installed-extension
191
+ directory exists. Both child commands scope `GEMINI_CLI_TRUST_WORKSPACE=true`
192
+ to that process, so a repeat run succeeds without writing a persistent broad
193
+ workspace-trust setting. Stale client configuration homes no longer count as
194
+ installed executable-backed clients.
195
+
157
196
  ## 0.6.4 durable native marketplaces
158
197
 
159
198
  Version 0.6.4 copies each verified native-client package to
package/bin/cli.js CHANGED
@@ -44,7 +44,7 @@ import { gunzipSync } from 'node:zlib';
44
44
  const argv = process.argv.slice(2);
45
45
  const has = (f) => argv.includes(f);
46
46
  const flag = (f) => { const i = argv.indexOf(f); return i >= 0 ? argv[i + 1] : undefined; };
47
- const PKG_VERSION = '0.6.4';
47
+ const PKG_VERSION = '0.6.6';
48
48
 
49
49
  function validateArgs() {
50
50
  const switches = new Set(['--dry-run', '--no-plugin', '--no-branding', '--help', '-h']);
@@ -176,6 +176,7 @@ async function main() {
176
176
  // ── 1) detect clients and deliver verified integrations ──────────────────────
177
177
  const HOME = homedir();
178
178
  const CODEX_HOME = process.env.CODEX_HOME || join(HOME, '.codex');
179
+ const HERMES_HOME = process.env.HERMES_HOME || join(HOME, '.hermes');
179
180
  const DATA_HOME = process.env.XDG_DATA_HOME || join(HOME, '.local', 'share');
180
181
  const DURABLE_PLUGIN_ROOT = join(DATA_HOME, 'cohesivity', 'plugin-packages');
181
182
  const CANONICAL_SKILL_DIR = join(HOME, '.agents', 'skills', 'cohesivity');
@@ -213,37 +214,38 @@ function detectClients() {
213
214
  antigravity: executable(['agy']),
214
215
  openclaw: executable(['openclaw']),
215
216
  hermes: executable(['hermes']),
217
+ opencode: executable(['opencode']),
216
218
  };
217
- const harnessIs = (...names) => names.includes(HARNESS);
218
219
  return [
219
- { id: 'claude', name: 'Claude', bin: bins.claude, detected: Boolean(bins.claude || existsSync(join(HOME, '.claude')) || harnessIs('claude')), artifact: ARTIFACT_KEYS.claude },
220
- { id: 'cursor', name: 'Cursor', bin: bins.cursor, detected: Boolean(bins.cursor || existsSync(join(HOME, '.cursor')) || harnessIs('cursor', 'cursor-agent')), artifact: ARTIFACT_KEYS.portable },
221
- { id: 'codex', name: 'Codex', bin: bins.codex, detected: Boolean(bins.codex || existsSync(CODEX_HOME) || harnessIs('codex')), artifact: ARTIFACT_KEYS.codex },
220
+ { id: 'claude', name: 'Claude', bin: bins.claude, detected: Boolean(bins.claude), artifact: ARTIFACT_KEYS.claude },
221
+ { id: 'cursor', name: 'Cursor', bin: bins.cursor, detected: Boolean(bins.cursor || existsSync(join(HOME, '.cursor'))), artifact: ARTIFACT_KEYS.portable },
222
+ { id: 'codex', name: 'Codex', bin: bins.codex, detected: Boolean(bins.codex), artifact: ARTIFACT_KEYS.codex },
222
223
  {
223
224
  id: 'gemini', name: 'Gemini', bin: bins.gemini,
224
- detected: Boolean(bins.gemini || hasAny([join(HOME, '.gemini', 'settings.json'), join(HOME, '.gemini', 'extensions')]) || harnessIs('gemini')),
225
+ detected: Boolean(bins.gemini),
225
226
  artifact: ARTIFACT_KEYS.gemini,
226
227
  },
227
228
  {
228
229
  id: 'antigravity', name: 'Antigravity', bin: bins.antigravity,
229
- detected: Boolean(bins.antigravity || hasAny(POSITIVE_ANTIGRAVITY_HOMES) || harnessIs('agy', 'antigravity')), artifact: ARTIFACT_KEYS.antigravity,
230
+ detected: Boolean(bins.antigravity || hasAny(POSITIVE_ANTIGRAVITY_HOMES)), artifact: ARTIFACT_KEYS.antigravity,
230
231
  },
231
- { id: 'openclaw', name: 'OpenClaw', bin: bins.openclaw, detected: Boolean(bins.openclaw || existsSync(join(HOME, '.openclaw')) || harnessIs('openclaw')), artifact: ARTIFACT_KEYS.claude },
232
- { id: 'hermes', name: 'Hermes', bin: bins.hermes, detected: Boolean(bins.hermes || existsSync(join(HOME, '.hermes')) || harnessIs('hermes')), artifact: ARTIFACT_KEYS.portable },
232
+ { id: 'openclaw', name: 'OpenClaw', bin: bins.openclaw, detected: Boolean(bins.openclaw), artifact: ARTIFACT_KEYS.claude },
233
+ { id: 'hermes', name: 'Hermes', bin: bins.hermes, detected: Boolean(bins.hermes), artifact: ARTIFACT_KEYS.portable },
234
+ { id: 'opencode', name: 'OpenCode', bin: bins.opencode, detected: Boolean(bins.opencode), artifact: ARTIFACT_KEYS.portable },
233
235
  ].filter((client) => client.detected);
234
236
  }
235
237
 
236
238
  const FALLBACK_ADAPTERS = [
237
- { id: 'copilot', name: 'GitHub Copilot CLI', homes: [join(HOME, '.copilot')], bins: ['copilot'], args: [
239
+ { id: 'copilot', name: 'GitHub Copilot CLI', bins: ['copilot'], args: [
238
240
  'mcp', 'add', '--transport', 'http', 'cohesivity', MCP_URL,
239
241
  ] },
240
- { id: 'vscode', name: 'VS Code', homes: [join(HOME, '.vscode')], bins: ['code'], args: [
242
+ { id: 'vscode', name: 'VS Code', bins: ['code'], args: [
241
243
  '--add-mcp', JSON.stringify({ name: 'cohesivity', type: 'http', url: MCP_URL }),
242
244
  ] },
243
- { id: 'cline', name: 'Cline CLI', homes: [join(HOME, '.cline')], bins: ['cline'], args: [
245
+ { id: 'cline', name: 'Cline CLI', bins: ['cline'], args: [
244
246
  'mcp', 'add', 'cohesivity', MCP_URL, '--type', 'http',
245
247
  ] },
246
- { id: 'grok', name: 'Grok', homes: [join(HOME, '.grok')], bins: ['grok'], args: [
248
+ { id: 'grok', name: 'Grok', bins: ['grok'], args: [
247
249
  'mcp', 'add', '--transport', 'http', 'cohesivity', MCP_URL,
248
250
  ] },
249
251
  ];
@@ -251,7 +253,7 @@ const FALLBACK_ADAPTERS = [
251
253
  function detectFallbackAdapters() {
252
254
  return FALLBACK_ADAPTERS.map((adapter) => {
253
255
  const bin = executable(adapter.bins);
254
- return { ...adapter, bin, detected: Boolean(bin || hasAny(adapter.homes) || adapter.bins.includes(HARNESS)) };
256
+ return { ...adapter, bin, detected: Boolean(bin) };
255
257
  }).filter((adapter) => adapter.detected);
256
258
  }
257
259
 
@@ -509,7 +511,7 @@ function resolveInside(root, path) {
509
511
  async function installForClient(client, artifact) {
510
512
  if (!artifact) throw new Error(`verified ${client.artifact} artifact is unavailable`);
511
513
  const root = artifact.root;
512
- const nativeSource = ['claude', 'codex', 'gemini', 'openclaw'].includes(client.id)
514
+ const nativeSource = ['claude', 'codex', 'gemini', 'openclaw', 'opencode'].includes(client.id)
513
515
  || (client.id === 'antigravity' && client.bin)
514
516
  ? join(DURABLE_PLUGIN_ROOT, client.id)
515
517
  : root;
@@ -530,7 +532,9 @@ async function installForClient(client, artifact) {
530
532
  break;
531
533
  case 'gemini':
532
534
  requireClientCli(client);
533
- runNative(client.bin, ['extensions', 'install', nativeSource, '--consent'], {
535
+ runNative(client.bin, existsSync(join(HOME, '.gemini', 'extensions', 'cohesivity'))
536
+ ? ['extensions', 'update', 'cohesivity']
537
+ : ['extensions', 'install', nativeSource, '--consent'], {
534
538
  ...process.env,
535
539
  GEMINI_CLI_TRUST_WORKSPACE: 'true',
536
540
  });
@@ -551,11 +555,48 @@ async function installForClient(client, artifact) {
551
555
  auth: 'oauth',
552
556
  })]);
553
557
  break;
554
- case 'hermes':
555
- installDirectoryAtomically(root, join(HOME, '.hermes', 'plugins', 'cohesivity'));
558
+ case 'hermes': {
556
559
  requireClientCli(client);
557
- runNative(client.bin, ['plugins', 'enable', 'cohesivity']);
560
+ const skill = join(nativeSource, 'skills', 'cohesivity');
561
+ const packagedServer = join(nativeSource, 'mcp', 'project-bootstrap.mjs');
562
+ const localServer = join(HERMES_HOME, 'mcp', 'cohesivity', 'project-bootstrap.mjs');
563
+ if (!existsSync(join(skill, 'SKILL.md')) || !existsSync(packagedServer)) throw new Error('verified portable artifact is missing its Hermes skill or local MCP server');
564
+ installDirectoryAtomically(skill, join(HERMES_HOME, 'skills', 'cohesivity'));
565
+ installFileAtomically(localServer, readFileSync(packagedServer, 'utf8'));
566
+ const importRoot = mkdtempSync(join(tmpdir(), 'cohesivity-hermes-import-'));
567
+ try {
568
+ mkdirSync(join(importRoot, '.claude'), { mode: 0o700 });
569
+ writeFileSync(join(importRoot, '.claude.json'), JSON.stringify({
570
+ mcpServers: {
571
+ 'cohesivity-local': { command: process.execPath, args: [localServer] },
572
+ cohesivity: { url: MCP_URL },
573
+ },
574
+ }), { mode: 0o600 });
575
+ runNative(client.bin, ['import-agent', 'claude-code', '--source', join(importRoot, '.claude'), '--overwrite', '--yes']);
576
+ runNative(client.bin, ['config', 'set', 'mcp_servers.cohesivity-local.enabled', 'true']);
577
+ runNative(client.bin, ['config', 'set', 'mcp_servers.cohesivity.auth', 'oauth']);
578
+ runNative(client.bin, ['config', 'set', 'mcp_servers.cohesivity.enabled', 'true']);
579
+ const local = runNativeJson(client.bin, ['config', 'get', 'mcp_servers.cohesivity-local', '--json']);
580
+ const remote = runNativeJson(client.bin, ['config', 'get', 'mcp_servers.cohesivity', '--json']);
581
+ if (local?.command !== process.execPath || JSON.stringify(local.args) !== JSON.stringify([localServer]) || local?.enabled !== true
582
+ || remote?.url !== MCP_URL || remote?.auth !== 'oauth' || remote?.enabled !== true) {
583
+ throw new Error('Hermes native MCP reconciliation did not persist the exact Cohesivity entries');
584
+ }
585
+ } finally {
586
+ rmSync(importRoot, { recursive: true, force: true });
587
+ }
588
+ break;
589
+ }
590
+ case 'opencode': {
591
+ requireClientCli(client);
592
+ const skill = join(nativeSource, 'skills', 'cohesivity', 'SKILL.md');
593
+ const localServer = join(nativeSource, 'mcp', 'project-bootstrap.mjs');
594
+ if (!existsSync(skill) || !existsSync(localServer)) throw new Error('verified portable artifact is missing its OpenCode skill or local MCP server');
595
+ installFileAtomically(join(CANONICAL_SKILL_DIR, 'SKILL.md'), readFileSync(skill, 'utf8'));
596
+ runNative(client.bin, ['mcp', 'add', 'cohesivity-local', '--', 'node', localServer]);
597
+ runNative(client.bin, ['mcp', 'add', 'cohesivity', '--url', MCP_URL]);
558
598
  break;
599
+ }
559
600
  default:
560
601
  throw new Error(`unknown client ${client.id}`);
561
602
  }
@@ -572,6 +613,13 @@ function runNative(command, args, env = process.env) {
572
613
  const detail = String(result.stderr || result.stdout || '').trim().replace(/\s+/g, ' ').slice(0, 300);
573
614
  throw new Error(`${formatCommand(command, args)} exited ${result.status}${detail ? `: ${detail}` : ''}`);
574
615
  }
616
+ return result;
617
+ }
618
+
619
+ function runNativeJson(command, args) {
620
+ const result = runNative(command, args);
621
+ try { return JSON.parse(String(result.stdout || '').trim()); }
622
+ catch { throw new Error(`${formatCommand(command, args)} returned invalid JSON`); }
575
623
  }
576
624
 
577
625
  function installDirectoryAtomically(source, destination) {
@@ -640,7 +688,9 @@ function describeDryRunPluginDelivery(clients) {
640
688
  act(`run ${formatCommand(client.bin || 'codex', ['plugin', 'add', 'cohesivity@cohesivity'])}`);
641
689
  } else if (client.id === 'gemini') {
642
690
  act(`atomically replace ${nativeRoot} from ${root}`);
643
- act(`run ${formatCommand(client.bin || 'gemini', ['extensions', 'install', nativeRoot, '--consent'])}`);
691
+ act(`run ${formatCommand(client.bin || 'gemini', existsSync(join(HOME, '.gemini', 'extensions', 'cohesivity'))
692
+ ? ['extensions', 'update', 'cohesivity']
693
+ : ['extensions', 'install', nativeRoot, '--consent'])}`);
644
694
  } else if (client.id === 'antigravity' && client.bin) {
645
695
  act(`atomically replace ${nativeRoot} from ${root}`);
646
696
  act(`run ${formatCommand(client.bin, ['plugin', 'install', nativeRoot])}`);
@@ -652,8 +702,17 @@ function describeDryRunPluginDelivery(clients) {
652
702
  act(`run ${formatCommand(client.bin || 'openclaw', ['plugins', 'enable', 'cohesivity'])}`);
653
703
  act(`run ${formatCommand(client.bin || 'openclaw', ['mcp', 'set', 'cohesivity', JSON.stringify({ url: MCP_URL, transport: 'streamable-http', auth: 'oauth' })])}`);
654
704
  } else if (client.id === 'hermes') {
655
- act(`atomically replace ${displayPath(join(HOME, '.hermes', 'plugins', 'cohesivity'))} from ${root}`);
656
- act(`run ${formatCommand(client.bin || 'hermes', ['plugins', 'enable', 'cohesivity'])}`);
705
+ act(`atomically replace ${displayPath(join(HERMES_HOME, 'skills', 'cohesivity'))} from ${root}/skills/cohesivity`);
706
+ act(`atomically replace ${displayPath(join(HERMES_HOME, 'mcp', 'cohesivity', 'project-bootstrap.mjs'))} from ${root}/mcp/project-bootstrap.mjs`);
707
+ act(`run ${formatCommand(client.bin || 'hermes', ['import-agent', 'claude-code', '--source', '<generated-cohesivity-import>/.claude', '--overwrite', '--yes'])}`);
708
+ act(`run ${formatCommand(client.bin || 'hermes', ['config', 'set', 'mcp_servers.cohesivity-local.enabled', 'true'])}`);
709
+ act(`run ${formatCommand(client.bin || 'hermes', ['config', 'set', 'mcp_servers.cohesivity.auth', 'oauth'])}`);
710
+ act(`run ${formatCommand(client.bin || 'hermes', ['config', 'set', 'mcp_servers.cohesivity.enabled', 'true'])}`);
711
+ } else if (client.id === 'opencode') {
712
+ act(`atomically replace ${nativeRoot} from ${root}`);
713
+ act(`atomically install ${displayPath(join(CANONICAL_SKILL_DIR, 'SKILL.md'))} from ${nativeRoot}`);
714
+ act(`run ${formatCommand(client.bin || 'opencode', ['mcp', 'add', 'cohesivity-local', '--', 'node', join(DURABLE_PLUGIN_ROOT, 'opencode', 'mcp', 'project-bootstrap.mjs')])}`);
715
+ act(`run ${formatCommand(client.bin || 'opencode', ['mcp', 'add', 'cohesivity', '--url', MCP_URL])}`);
657
716
  }
658
717
  }
659
718
  }
@@ -670,7 +729,8 @@ function printClientInstructions(clients, adapters) {
670
729
  gemini: 'Gemini: restart the CLI, then run /mcp auth cohesivity if authentication is required.',
671
730
  antigravity: 'Antigravity: restart, open /mcp (or Installed MCP Servers), and authenticate Cohesivity.',
672
731
  openclaw: 'OpenClaw: restart the Gateway if it did not auto-restart, then run openclaw mcp login cohesivity.',
673
- hermes: 'Hermes: restart, copy the exact qualified remote server name Hermes reports into a native mcp_servers owner override that repeats the URL and sets auth: oauth, then run hermes mcp login <qualified-server-name>. Dynamic Client Registration must be supported; otherwise Hermes needs a pre-registered OAuth client.',
732
+ hermes: 'Hermes: restart the client; the local bootstrap tools need no login, and hermes mcp login cohesivity starts OAuth through Dynamic Client Registration only when management tools are needed.',
733
+ opencode: 'OpenCode: restart the client; the local bootstrap tools need no login, and opencode mcp auth cohesivity starts OAuth only when management tools are needed.',
674
734
  }[client.id];
675
735
  console.log(` - ${instruction}`);
676
736
  }
@@ -875,7 +935,7 @@ Options:
875
935
  -h, --help show this help
876
936
 
877
937
  What it does:
878
- 1. Detects Claude, Cursor, Codex, Gemini, Antigravity, OpenClaw, and Hermes
938
+ 1. Detects Claude, Cursor, Codex, Gemini, Antigravity, OpenClaw, Hermes, and OpenCode
879
939
  independently and installs each client's native or portable plugin package
880
940
  (known adapters without a plugin receive the standalone skill plus MCP)
881
941
  2. Creates or reuses a project tenant -> ./.cohesivity (gitignored)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cohesivity/init",
3
- "version": "0.6.4",
3
+ "version": "0.6.6",
4
4
  "description": "Set up Cohesivity in a project: install the agent skill, create a managed backend tenant, write the project config. Run with `npx @cohesivity/init`.",
5
5
  "type": "module",
6
6
  "bin": {