@cohesivity/init 0.2.3 → 0.2.4

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 +13 -6
  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.3';
37
+ const PKG_VERSION = '0.2.4';
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
@@ -142,11 +142,18 @@ function inferHarness(chain) {
142
142
  function inferModel(harness) {
143
143
  if (!harness) return null;
144
144
  try {
145
- const roots = [
146
- join(homedir(), '.' + harness),
147
- join(process.env.XDG_CONFIG_HOME || join(homedir(), '.config'), harness),
148
- join(process.env.XDG_DATA_HOME || join(homedir(), '.local', 'share'), harness),
149
- ];
145
+ // A harness's state dir is not always named exactly like its process: the
146
+ // binary is cursor-agent but the dir is ~/.cursor, the script is
147
+ // pi-coding-agent but the dir is ~/.pi. So the measured name is also tried
148
+ // truncated at each hyphen — a general string rule over the name, not a
149
+ // list of harnesses. Nonexistent paths cost nothing; the walk skips them.
150
+ const names = [];
151
+ for (let n = harness; n; n = n.includes('-') ? n.slice(0, n.lastIndexOf('-')) : '') {
152
+ if (!names.includes(n)) names.push(n);
153
+ }
154
+ const cfgHome = process.env.XDG_CONFIG_HOME || join(homedir(), '.config');
155
+ const dataHome = process.env.XDG_DATA_HOME || join(homedir(), '.local', 'share');
156
+ const roots = names.flatMap((n) => [join(homedir(), '.' + n), join(cfgHome, n), join(dataHome, n)]);
150
157
  const cutoff = Date.now() - 10 * 60 * 1000;
151
158
  const files = [];
152
159
  const walk = (dir, depth) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@cohesivity/init",
3
- "version": "0.2.3",
3
+ "version": "0.2.4",
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": {