@cohesivity/init 0.6.4 → 0.6.5

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 +34 -6
  2. package/bin/cli.js +39 -18
  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
28
  | Hermes | atomically copy to `~/.hermes/plugins/cohesivity`, then `hermes plugins enable cohesivity` |
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,14 @@ 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 remote MCP OAuth is qualified: automatic
55
+ login works only when the endpoint supports Dynamic Client Registration;
56
+ otherwise Hermes needs a pre-registered OAuth client.
46
57
 
47
58
  ## Standalone skill only
48
59
 
@@ -154,6 +165,23 @@ server-issued, and not derived from hardware or user data. Delete
154
165
  | `--base <url>` | API base for tenant bootstrap (default `https://cohesivity.ai`) |
155
166
  | `-h`, `--help` | show command help and the exact package version |
156
167
 
168
+ ## 0.6.5 OpenCode and repeat-safe Gemini delivery
169
+
170
+ Version 0.6.5 recognizes OpenCode only from its executable, preserves the
171
+ verified portable package under the Cohesivity data directory, installs the
172
+ canonical skill in OpenCode's documented global `~/.agents/skills` surface, and
173
+ uses OpenCode's native noninteractive `mcp add` commands for both the local
174
+ six-tool server and exact remote management endpoint. Reruns replace those
175
+ entries structurally through OpenCode's own JSONC-aware config writer and never
176
+ start OAuth.
177
+
178
+ Gemini now installs the extension on the first run and uses
179
+ `gemini extensions update cohesivity` once the native installed-extension
180
+ directory exists. Both child commands scope `GEMINI_CLI_TRUST_WORKSPACE=true`
181
+ to that process, so a repeat run succeeds without writing a persistent broad
182
+ workspace-trust setting. Stale client configuration homes no longer count as
183
+ installed executable-backed clients.
184
+
157
185
  ## 0.6.4 durable native marketplaces
158
186
 
159
187
  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.5';
48
48
 
49
49
  function validateArgs() {
50
50
  const switches = new Set(['--dry-run', '--no-plugin', '--no-branding', '--help', '-h']);
@@ -213,37 +213,38 @@ function detectClients() {
213
213
  antigravity: executable(['agy']),
214
214
  openclaw: executable(['openclaw']),
215
215
  hermes: executable(['hermes']),
216
+ opencode: executable(['opencode']),
216
217
  };
217
- const harnessIs = (...names) => names.includes(HARNESS);
218
218
  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 },
219
+ { id: 'claude', name: 'Claude', bin: bins.claude, detected: Boolean(bins.claude), artifact: ARTIFACT_KEYS.claude },
220
+ { id: 'cursor', name: 'Cursor', bin: bins.cursor, detected: Boolean(bins.cursor || existsSync(join(HOME, '.cursor'))), artifact: ARTIFACT_KEYS.portable },
221
+ { id: 'codex', name: 'Codex', bin: bins.codex, detected: Boolean(bins.codex), artifact: ARTIFACT_KEYS.codex },
222
222
  {
223
223
  id: 'gemini', name: 'Gemini', bin: bins.gemini,
224
- detected: Boolean(bins.gemini || hasAny([join(HOME, '.gemini', 'settings.json'), join(HOME, '.gemini', 'extensions')]) || harnessIs('gemini')),
224
+ detected: Boolean(bins.gemini),
225
225
  artifact: ARTIFACT_KEYS.gemini,
226
226
  },
227
227
  {
228
228
  id: 'antigravity', name: 'Antigravity', bin: bins.antigravity,
229
- detected: Boolean(bins.antigravity || hasAny(POSITIVE_ANTIGRAVITY_HOMES) || harnessIs('agy', 'antigravity')), artifact: ARTIFACT_KEYS.antigravity,
229
+ detected: Boolean(bins.antigravity || hasAny(POSITIVE_ANTIGRAVITY_HOMES)), artifact: ARTIFACT_KEYS.antigravity,
230
230
  },
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 },
231
+ { id: 'openclaw', name: 'OpenClaw', bin: bins.openclaw, detected: Boolean(bins.openclaw), artifact: ARTIFACT_KEYS.claude },
232
+ { id: 'hermes', name: 'Hermes', bin: bins.hermes, detected: Boolean(bins.hermes), artifact: ARTIFACT_KEYS.portable },
233
+ { id: 'opencode', name: 'OpenCode', bin: bins.opencode, detected: Boolean(bins.opencode), artifact: ARTIFACT_KEYS.portable },
233
234
  ].filter((client) => client.detected);
234
235
  }
235
236
 
236
237
  const FALLBACK_ADAPTERS = [
237
- { id: 'copilot', name: 'GitHub Copilot CLI', homes: [join(HOME, '.copilot')], bins: ['copilot'], args: [
238
+ { id: 'copilot', name: 'GitHub Copilot CLI', bins: ['copilot'], args: [
238
239
  'mcp', 'add', '--transport', 'http', 'cohesivity', MCP_URL,
239
240
  ] },
240
- { id: 'vscode', name: 'VS Code', homes: [join(HOME, '.vscode')], bins: ['code'], args: [
241
+ { id: 'vscode', name: 'VS Code', bins: ['code'], args: [
241
242
  '--add-mcp', JSON.stringify({ name: 'cohesivity', type: 'http', url: MCP_URL }),
242
243
  ] },
243
- { id: 'cline', name: 'Cline CLI', homes: [join(HOME, '.cline')], bins: ['cline'], args: [
244
+ { id: 'cline', name: 'Cline CLI', bins: ['cline'], args: [
244
245
  'mcp', 'add', 'cohesivity', MCP_URL, '--type', 'http',
245
246
  ] },
246
- { id: 'grok', name: 'Grok', homes: [join(HOME, '.grok')], bins: ['grok'], args: [
247
+ { id: 'grok', name: 'Grok', bins: ['grok'], args: [
247
248
  'mcp', 'add', '--transport', 'http', 'cohesivity', MCP_URL,
248
249
  ] },
249
250
  ];
@@ -251,7 +252,7 @@ const FALLBACK_ADAPTERS = [
251
252
  function detectFallbackAdapters() {
252
253
  return FALLBACK_ADAPTERS.map((adapter) => {
253
254
  const bin = executable(adapter.bins);
254
- return { ...adapter, bin, detected: Boolean(bin || hasAny(adapter.homes) || adapter.bins.includes(HARNESS)) };
255
+ return { ...adapter, bin, detected: Boolean(bin) };
255
256
  }).filter((adapter) => adapter.detected);
256
257
  }
257
258
 
@@ -509,7 +510,7 @@ function resolveInside(root, path) {
509
510
  async function installForClient(client, artifact) {
510
511
  if (!artifact) throw new Error(`verified ${client.artifact} artifact is unavailable`);
511
512
  const root = artifact.root;
512
- const nativeSource = ['claude', 'codex', 'gemini', 'openclaw'].includes(client.id)
513
+ const nativeSource = ['claude', 'codex', 'gemini', 'openclaw', 'opencode'].includes(client.id)
513
514
  || (client.id === 'antigravity' && client.bin)
514
515
  ? join(DURABLE_PLUGIN_ROOT, client.id)
515
516
  : root;
@@ -530,7 +531,9 @@ async function installForClient(client, artifact) {
530
531
  break;
531
532
  case 'gemini':
532
533
  requireClientCli(client);
533
- runNative(client.bin, ['extensions', 'install', nativeSource, '--consent'], {
534
+ runNative(client.bin, existsSync(join(HOME, '.gemini', 'extensions', 'cohesivity'))
535
+ ? ['extensions', 'update', 'cohesivity']
536
+ : ['extensions', 'install', nativeSource, '--consent'], {
534
537
  ...process.env,
535
538
  GEMINI_CLI_TRUST_WORKSPACE: 'true',
536
539
  });
@@ -556,6 +559,16 @@ async function installForClient(client, artifact) {
556
559
  requireClientCli(client);
557
560
  runNative(client.bin, ['plugins', 'enable', 'cohesivity']);
558
561
  break;
562
+ case 'opencode': {
563
+ requireClientCli(client);
564
+ const skill = join(nativeSource, 'skills', 'cohesivity', 'SKILL.md');
565
+ const localServer = join(nativeSource, 'mcp', 'project-bootstrap.mjs');
566
+ if (!existsSync(skill) || !existsSync(localServer)) throw new Error('verified portable artifact is missing its OpenCode skill or local MCP server');
567
+ installFileAtomically(join(CANONICAL_SKILL_DIR, 'SKILL.md'), readFileSync(skill, 'utf8'));
568
+ runNative(client.bin, ['mcp', 'add', 'cohesivity-local', '--', 'node', localServer]);
569
+ runNative(client.bin, ['mcp', 'add', 'cohesivity', '--url', MCP_URL]);
570
+ break;
571
+ }
559
572
  default:
560
573
  throw new Error(`unknown client ${client.id}`);
561
574
  }
@@ -640,7 +653,9 @@ function describeDryRunPluginDelivery(clients) {
640
653
  act(`run ${formatCommand(client.bin || 'codex', ['plugin', 'add', 'cohesivity@cohesivity'])}`);
641
654
  } else if (client.id === 'gemini') {
642
655
  act(`atomically replace ${nativeRoot} from ${root}`);
643
- act(`run ${formatCommand(client.bin || 'gemini', ['extensions', 'install', nativeRoot, '--consent'])}`);
656
+ act(`run ${formatCommand(client.bin || 'gemini', existsSync(join(HOME, '.gemini', 'extensions', 'cohesivity'))
657
+ ? ['extensions', 'update', 'cohesivity']
658
+ : ['extensions', 'install', nativeRoot, '--consent'])}`);
644
659
  } else if (client.id === 'antigravity' && client.bin) {
645
660
  act(`atomically replace ${nativeRoot} from ${root}`);
646
661
  act(`run ${formatCommand(client.bin, ['plugin', 'install', nativeRoot])}`);
@@ -654,6 +669,11 @@ function describeDryRunPluginDelivery(clients) {
654
669
  } else if (client.id === 'hermes') {
655
670
  act(`atomically replace ${displayPath(join(HOME, '.hermes', 'plugins', 'cohesivity'))} from ${root}`);
656
671
  act(`run ${formatCommand(client.bin || 'hermes', ['plugins', 'enable', 'cohesivity'])}`);
672
+ } else if (client.id === 'opencode') {
673
+ act(`atomically replace ${nativeRoot} from ${root}`);
674
+ act(`atomically install ${displayPath(join(CANONICAL_SKILL_DIR, 'SKILL.md'))} from ${nativeRoot}`);
675
+ act(`run ${formatCommand(client.bin || 'opencode', ['mcp', 'add', 'cohesivity-local', '--', 'node', join(DURABLE_PLUGIN_ROOT, 'opencode', 'mcp', 'project-bootstrap.mjs')])}`);
676
+ act(`run ${formatCommand(client.bin || 'opencode', ['mcp', 'add', 'cohesivity', '--url', MCP_URL])}`);
657
677
  }
658
678
  }
659
679
  }
@@ -671,6 +691,7 @@ function printClientInstructions(clients, adapters) {
671
691
  antigravity: 'Antigravity: restart, open /mcp (or Installed MCP Servers), and authenticate Cohesivity.',
672
692
  openclaw: 'OpenClaw: restart the Gateway if it did not auto-restart, then run openclaw mcp login cohesivity.',
673
693
  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.',
694
+ 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
695
  }[client.id];
675
696
  console.log(` - ${instruction}`);
676
697
  }
@@ -875,7 +896,7 @@ Options:
875
896
  -h, --help show this help
876
897
 
877
898
  What it does:
878
- 1. Detects Claude, Cursor, Codex, Gemini, Antigravity, OpenClaw, and Hermes
899
+ 1. Detects Claude, Cursor, Codex, Gemini, Antigravity, OpenClaw, Hermes, and OpenCode
879
900
  independently and installs each client's native or portable plugin package
880
901
  (known adapters without a plugin receive the standalone skill plus MCP)
881
902
  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.5",
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": {