@cohesivity/init 0.2.0 → 0.2.2

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 (2) hide show
  1. package/bin/cli.js +26 -5
  2. package/package.json +1 -1
package/bin/cli.js CHANGED
@@ -34,7 +34,7 @@ const flag = (f) => { const i = argv.indexOf(f); return i >= 0 ? argv[i + 1] : u
34
34
  if (has('--help') || has('-h')) { help(); process.exit(0); }
35
35
 
36
36
  // ── config ──────────────────────────────────────────────────────────────────
37
- const PKG_VERSION = '0.2.0';
37
+ const PKG_VERSION = '0.2.2';
38
38
  const BASE = (flag('--base') || process.env.COHESIVITY_BASE || 'https://cohesivity.ai').replace(/\/+$/, '');
39
39
 
40
40
  // Machine id: one per machine, stored outside any project. A project's
@@ -48,7 +48,7 @@ const MACHINE_ID_FILE = join(MACHINE_ID_DIR, 'machine-id');
48
48
 
49
49
  // The skill is pinned to an immutable commit in the public, auditable repo.
50
50
  // Bumping the pin is a deliberate release step. See COH-172.
51
- const SKILL_PIN = '969ae0a160ac91c26639f55ba9995a95a0fb3da1';
51
+ const SKILL_PIN = 'a4c0e90373b2d61501e4fb544a760b4a602fc14e';
52
52
  const SKILL_URL = `https://raw.githubusercontent.com/cohesivity-org/cohesivity-skill/${SKILL_PIN}/cohesivity.skill.md`;
53
53
 
54
54
  // ── attribution: measured from the machine, never asked of the model ────────
@@ -68,7 +68,7 @@ const ANCESTRY_HEADER = 'X-Cohesivity-Ancestry';
68
68
  // Closed sets: the plumbing an ancestor chain routes through, the interpreter
69
69
  // binaries whose script path carries the real name, and the generic segments
70
70
  // inside those paths. Harness names never belong in any of these.
71
- const PLUMBING = new Set(['sh', 'bash', 'zsh', 'fish', 'dash', 'ksh', 'csh', 'tcsh', 'env', 'sudo', 'doas', 'timeout', 'nice', 'ionice', 'stdbuf', 'setsid', 'nohup', 'xargs', 'script', 'ssh', 'sshd', 'tmux', 'screen', 'login', 'su', 'init', 'systemd', 'launchd', 'docker', 'containerd', 'containerd-shim', 'runc', 'podman', 'npm', 'npx', 'pnpm', 'yarn', 'bunx', 'corepack', 'ps', 'awk', 'grep', 'sed', 'cat', 'tr', 'cut', 'head', 'tail', 'find', 'curl', 'wget', 'gnome-terminal', 'konsole', 'xterm', 'alacritty', 'kitty', 'wezterm', 'tilix', 'terminator', 'iterm2', 'terminal', 'warp-terminal']);
71
+ const PLUMBING = new Set(['sh', 'bash', 'zsh', 'fish', 'dash', 'ksh', 'csh', 'tcsh', 'env', 'sudo', 'doas', 'timeout', 'timelimit', 'nice', 'ionice', 'stdbuf', 'setsid', 'nohup', 'xargs', 'script', 'ssh', 'sshd', 'tmux', 'screen', 'login', 'su', 'init', 'systemd', 'launchd', 'docker', 'containerd', 'containerd-shim', 'runc', 'podman', 'npm', 'npx', 'pnpm', 'yarn', 'bunx', 'corepack', 'ps', 'awk', 'grep', 'sed', 'cat', 'tr', 'cut', 'head', 'tail', 'find', 'curl', 'wget', 'gnome-terminal', 'konsole', 'xterm', 'alacritty', 'kitty', 'wezterm', 'tilix', 'terminator', 'iterm2', 'terminal', 'warp-terminal']);
72
72
  const INTERPRETERS = new Set(['node', 'bun', 'deno', 'python', 'python3', 'python2', 'ruby', 'perl']);
73
73
  const GENERIC_SEGMENTS = new Set(['dist', 'build', 'bin', '.bin', 'lib', 'libexec', 'src', 'out', 'app', 'node_modules', '_npx', 'versions', 'current', 'cli.js', 'index.js', 'main.js', 'app.js', 'run.py', 'main.py', '__main__.py', 'npm-cli.js', 'npx-cli.js', 'yarn.js', 'pnpm.cjs', 'corepack.js']);
74
74
 
@@ -85,11 +85,32 @@ function ancestry() {
85
85
  const chain = [];
86
86
  // Start at the PARENT: this process is `node .../cli.js` and must never
87
87
  // infer itself as the harness.
88
- for (let p = pp[String(process.pid)], i = 0; i < 20 && cmd[p]; p = pp[p], i++) chain.push(cmd[p]);
89
- return chain.join(' | ').replace(/[^\w ._:;()/+~@=,|-]/g, '').slice(0, 800) || null;
88
+ for (let p = pp[String(process.pid)], i = 0; i < 20 && cmd[p]; p = pp[p], i++) chain.push(reduceEntry(cmd[p]));
89
+ return chain.filter(Boolean).join(' | ').replace(/[^\w ._:;()/+~@,|-]/g, '').slice(0, 800) || null;
90
90
  } catch { return null; }
91
91
  }
92
92
 
93
+ // Keep the program that ran; drop its arguments before anything is sent.
94
+ //
95
+ // Arguments are pure liability and identify nothing. A real caller's chain
96
+ // reached the server carrying live AWS credentials, because its parent was
97
+ // `sh -c export AWS_ACCESS_KEY_ID=... AWS_SECRET_ACCESS_KEY=...`; agent
98
+ // invocations put the user's prompt on the command line the same way. argv[0]
99
+ // names the harness, and for an interpreter the script path does, so one
100
+ // path-like argument that is neither a URL nor a k=v assignment survives.
101
+ function reduceEntry(entry) {
102
+ const tokens = String(entry).trim().split(/\s+/).filter(Boolean);
103
+ if (!tokens.length) return '';
104
+ const prog = tokens[0];
105
+ const base = prog.split('/').pop().replace(/^-/, '');
106
+ if (!INTERPRETERS.has(base)) return prog;
107
+ for (const tok of tokens.slice(1)) {
108
+ if (tok.includes('=') || tok.includes('://')) continue;
109
+ if (tok.includes('/')) return `${prog} ${tok}`;
110
+ }
111
+ return prog;
112
+ }
113
+
93
114
  function inferHarness(chain) {
94
115
  for (const entry of (chain || '').split(' | ')) {
95
116
  const tokens = entry.trim().split(' ');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cohesivity/init",
3
- "version": "0.2.0",
3
+ "version": "0.2.2",
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": {