@codecell-germany/company-agent-wiki-skill 0.1.2 → 0.1.3

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.
package/README.md CHANGED
@@ -9,7 +9,9 @@
9
9
  > Context is king.
10
10
 
11
11
  `company-agent-wiki-skill` is an agent-first local company knowledge toolkit.
12
- It ships as a real CLI plus a Codex-style skill payload, so an agent can set up a private company wiki, verify the index state, search knowledge, inspect metadata and headings first, and only then load full Markdown when needed.
12
+ It ships as a real CLI plus a shared agent skill payload, so an agent can set up a private company wiki, verify the index state, search knowledge, inspect metadata and headings first, and only then load full Markdown when needed.
13
+
14
+ The shared install layout is meant to work across agent environments that understand the common `~/.agents` skill home, including Codex through its compatibility mirror and other skills.sh-style runtimes such as Claude Code or OpenClaw.
13
15
 
14
16
  The product surface is the public CLI:
15
17
 
@@ -46,7 +48,7 @@ Here, front matter is not only stored in Markdown files, but also indexed and fi
46
48
 
47
49
  ## Installation
48
50
 
49
- ### 1. Install into Codex with one command
51
+ ### 1. Install with one command
50
52
 
51
53
  The preferred install path is:
52
54
 
@@ -56,19 +58,24 @@ npx -y -p @codecell-germany/company-agent-wiki-skill company-agent-wiki-skill in
56
58
 
57
59
  That installs:
58
60
 
61
+ - the shared skill payload into `~/.agents/skills/company-agent-wiki-cli`
62
+ - the shared runtime into `~/.agents/tools/company-agent-wiki-cli`
63
+ - the shared CLI shim into `~/.agents/bin/company-agent-wiki-cli`
59
64
  - the skill payload into `~/.codex/skills/company-agent-wiki-cli`
60
65
  - the runtime into `~/.codex/tools/company-agent-wiki-cli`
61
- - the CLI shim into `~/.codex/bin/company-agent-wiki-cli`
66
+ - the Codex compatibility shim into `~/.codex/bin/company-agent-wiki-cli`
62
67
 
63
68
  ### 2. Verify the CLI
64
69
 
65
70
  ```bash
66
71
  company-agent-wiki-cli --help
72
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
67
73
  "$CODEX_HOME/bin/company-agent-wiki-cli" --help
68
74
  "$HOME/.codex/bin/company-agent-wiki-cli" --help
69
75
  ```
70
76
 
71
- In Codex, the direct shim path is often the most reliable fallback.
77
+ For agent environments that use the shared `~/.agents` home, the direct shim path is often the most reliable fallback.
78
+ In Codex, the compatibility shim under `~/.codex/bin` also works.
72
79
 
73
80
  ### 3. Optional local repo workflow
74
81
 
@@ -144,6 +151,7 @@ If a fresh agent receives this skill, the correct order is:
144
151
 
145
152
  1. Verify the CLI path:
146
153
  - `company-agent-wiki-cli --help`
154
+ - `"$HOME/.agents/bin/company-agent-wiki-cli" --help`
147
155
  - `"$CODEX_HOME/bin/company-agent-wiki-cli" --help`
148
156
  - `"$HOME/.codex/bin/company-agent-wiki-cli" --help`
149
157
  2. If no workspace exists yet, create one with `setup workspace`.
package/dist/index.js CHANGED
@@ -1189,7 +1189,7 @@ var require_command = __commonJS({
1189
1189
  "node_modules/commander/lib/command.js"(exports2) {
1190
1190
  var EventEmitter = require("node:events").EventEmitter;
1191
1191
  var childProcess = require("node:child_process");
1192
- var path9 = require("node:path");
1192
+ var path10 = require("node:path");
1193
1193
  var fs9 = require("node:fs");
1194
1194
  var process2 = require("node:process");
1195
1195
  var { Argument: Argument2, humanReadableArgName } = require_argument();
@@ -2202,9 +2202,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
2202
2202
  let launchWithNode = false;
2203
2203
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2204
2204
  function findFile(baseDir, baseName) {
2205
- const localBin = path9.resolve(baseDir, baseName);
2205
+ const localBin = path10.resolve(baseDir, baseName);
2206
2206
  if (fs9.existsSync(localBin)) return localBin;
2207
- if (sourceExt.includes(path9.extname(baseName))) return void 0;
2207
+ if (sourceExt.includes(path10.extname(baseName))) return void 0;
2208
2208
  const foundExt = sourceExt.find(
2209
2209
  (ext) => fs9.existsSync(`${localBin}${ext}`)
2210
2210
  );
@@ -2222,17 +2222,17 @@ Expecting one of '${allowedValues.join("', '")}'`);
2222
2222
  } catch {
2223
2223
  resolvedScriptPath = this._scriptPath;
2224
2224
  }
2225
- executableDir = path9.resolve(
2226
- path9.dirname(resolvedScriptPath),
2225
+ executableDir = path10.resolve(
2226
+ path10.dirname(resolvedScriptPath),
2227
2227
  executableDir
2228
2228
  );
2229
2229
  }
2230
2230
  if (executableDir) {
2231
2231
  let localFile = findFile(executableDir, executableFile);
2232
2232
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2233
- const legacyName = path9.basename(
2233
+ const legacyName = path10.basename(
2234
2234
  this._scriptPath,
2235
- path9.extname(this._scriptPath)
2235
+ path10.extname(this._scriptPath)
2236
2236
  );
2237
2237
  if (legacyName !== this._name) {
2238
2238
  localFile = findFile(
@@ -2243,7 +2243,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2243
2243
  }
2244
2244
  executableFile = localFile || executableFile;
2245
2245
  }
2246
- launchWithNode = sourceExt.includes(path9.extname(executableFile));
2246
+ launchWithNode = sourceExt.includes(path10.extname(executableFile));
2247
2247
  let proc;
2248
2248
  if (process2.platform !== "win32") {
2249
2249
  if (launchWithNode) {
@@ -3158,7 +3158,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3158
3158
  * @return {Command}
3159
3159
  */
3160
3160
  nameFromFilename(filename) {
3161
- this._name = path9.basename(filename, path9.extname(filename));
3161
+ this._name = path10.basename(filename, path10.extname(filename));
3162
3162
  return this;
3163
3163
  }
3164
3164
  /**
@@ -3172,9 +3172,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3172
3172
  * @param {string} [path]
3173
3173
  * @return {(string|null|Command)}
3174
3174
  */
3175
- executableDir(path10) {
3176
- if (path10 === void 0) return this._executableDir;
3177
- this._executableDir = path10;
3175
+ executableDir(path11) {
3176
+ if (path11 === void 0) return this._executableDir;
3177
+ this._executableDir = path11;
3178
3178
  return this;
3179
3179
  }
3180
3180
  /**
@@ -6937,7 +6937,7 @@ var require_gray_matter = __commonJS({
6937
6937
 
6938
6938
  // src/index.ts
6939
6939
  var import_node_fs8 = __toESM(require("node:fs"));
6940
- var import_node_path8 = __toESM(require("node:path"));
6940
+ var import_node_path9 = __toESM(require("node:path"));
6941
6941
 
6942
6942
  // node_modules/commander/esm.mjs
6943
6943
  var import_index = __toESM(require_commander(), 1);
@@ -6959,6 +6959,7 @@ var {
6959
6959
  // src/lib/constants.ts
6960
6960
  var PACKAGE_NAME = "@codecell-germany/company-agent-wiki-skill";
6961
6961
  var CLI_NAME = "company-agent-wiki-cli";
6962
+ var SKILL_NAME = "company-agent-wiki-cli";
6962
6963
  var WORKSPACE_INTERNAL_DIR = ".company-agent-wiki";
6963
6964
  var WORKSPACE_CONFIG_FILE = "workspace.json";
6964
6965
  var INDEX_DB_FILE = "index.sqlite";
@@ -7141,10 +7142,8 @@ function getGitDiff(filePath, baseRef, compareRef) {
7141
7142
  return runGit(args, resolved.repoRoot, true);
7142
7143
  }
7143
7144
 
7144
- // src/lib/indexer.ts
7145
- var import_node_fs5 = __toESM(require("node:fs"));
7146
- var import_node_path6 = __toESM(require("node:path"));
7147
- var import_better_sqlite3 = __toESM(require("better-sqlite3"));
7145
+ // src/lib/install.ts
7146
+ var import_node_path3 = __toESM(require("node:path"));
7148
7147
 
7149
7148
  // src/lib/fs-utils.ts
7150
7149
  var import_node_fs2 = __toESM(require("node:fs"));
@@ -7161,13 +7160,13 @@ function writeJsonFile(targetPath, value) {
7161
7160
  `);
7162
7161
  }
7163
7162
  function writeJsonAtomic(targetPath, value) {
7164
- const tempPath = `${targetPath}.tmp`;
7163
+ const tempPath = `${targetPath}.${process.pid}.${Math.random().toString(16).slice(2)}.tmp`;
7165
7164
  ensureDir(import_node_path2.default.dirname(targetPath));
7166
7165
  writeJsonFile(tempPath, value);
7167
7166
  import_node_fs2.default.renameSync(tempPath, targetPath);
7168
7167
  }
7169
7168
  function replaceFileAtomic(targetPath, content) {
7170
- const tempPath = `${targetPath}.tmp`;
7169
+ const tempPath = `${targetPath}.${process.pid}.${Math.random().toString(16).slice(2)}.tmp`;
7171
7170
  ensureDir(import_node_path2.default.dirname(targetPath));
7172
7171
  import_node_fs2.default.writeFileSync(tempPath, content);
7173
7172
  import_node_fs2.default.renameSync(tempPath, targetPath);
@@ -7204,6 +7203,25 @@ function walkMarkdownFiles(rootPath) {
7204
7203
  return files.sort();
7205
7204
  }
7206
7205
 
7206
+ // src/lib/install.ts
7207
+ function detectInstalledRuntimeHome(runtimeDir) {
7208
+ const normalized = import_node_path3.default.resolve(runtimeDir);
7209
+ const skillDir = import_node_path3.default.dirname(normalized);
7210
+ const toolsDir = import_node_path3.default.dirname(skillDir);
7211
+ if (import_node_path3.default.basename(normalized) !== "dist") {
7212
+ return void 0;
7213
+ }
7214
+ if (import_node_path3.default.basename(skillDir) !== SKILL_NAME || import_node_path3.default.basename(toolsDir) !== "tools") {
7215
+ return void 0;
7216
+ }
7217
+ return import_node_path3.default.dirname(toolsDir);
7218
+ }
7219
+
7220
+ // src/lib/indexer.ts
7221
+ var import_node_fs5 = __toESM(require("node:fs"));
7222
+ var import_node_path7 = __toESM(require("node:path"));
7223
+ var import_better_sqlite3 = __toESM(require("better-sqlite3"));
7224
+
7207
7225
  // src/lib/hash.ts
7208
7226
  var import_node_crypto = require("node:crypto");
7209
7227
  function sha256(input) {
@@ -7214,7 +7232,7 @@ function newBuildId() {
7214
7232
  }
7215
7233
 
7216
7234
  // src/lib/markdown.ts
7217
- var import_node_path3 = __toESM(require("node:path"));
7235
+ var import_node_path4 = __toESM(require("node:path"));
7218
7236
  var import_gray_matter = __toESM(require_gray_matter());
7219
7237
  function slugify(value) {
7220
7238
  return value.normalize("NFKD").replace(/[^\w\s-]/g, "").trim().toLowerCase().replace(/[\s_]+/g, "-").replace(/-+/g, "-");
@@ -7264,7 +7282,7 @@ function parseMarkdownDocument(absPath, relPath, rootId, rawContent, mtimeMs) {
7264
7282
  });
7265
7283
  };
7266
7284
  const titleFromFirstHeading = lines.find((line) => line.startsWith("# "))?.replace(/^#\s+/u, "").trim();
7267
- const title = typeof parsed.data.title === "string" && parsed.data.title.trim() || titleFromFirstHeading || import_node_path3.default.basename(relPath, ".md");
7285
+ const title = typeof parsed.data.title === "string" && parsed.data.title.trim() || titleFromFirstHeading || import_node_path4.default.basename(relPath, ".md");
7268
7286
  const documentId = typeof parsed.data.id === "string" && parsed.data.id.trim() || deriveDocId(rootId, relPath);
7269
7287
  for (const line of lines) {
7270
7288
  const match = line.match(headingPattern);
@@ -7340,52 +7358,55 @@ function parseMarkdownDocument(absPath, relPath, rootId, rawContent, mtimeMs) {
7340
7358
  // src/lib/workspace.ts
7341
7359
  var import_node_fs3 = __toESM(require("node:fs"));
7342
7360
  var import_node_os = __toESM(require("node:os"));
7343
- var import_node_path4 = __toESM(require("node:path"));
7361
+ var import_node_path5 = __toESM(require("node:path"));
7344
7362
  function getDefaultCodexHome() {
7345
- return process.env.CODEX_HOME || import_node_path4.default.join(import_node_os.default.homedir(), ".codex");
7363
+ return process.env.CODEX_HOME || import_node_path5.default.join(import_node_os.default.homedir(), ".codex");
7364
+ }
7365
+ function getDefaultAgentsHome() {
7366
+ return process.env.AGENTS_HOME || import_node_path5.default.join(import_node_os.default.homedir(), ".agents");
7346
7367
  }
7347
7368
  function getGlobalRegistryDir() {
7348
7369
  const explicit = process.env.COMPANY_AGENT_WIKI_CONFIG_HOME;
7349
7370
  if (explicit?.trim()) {
7350
- return import_node_path4.default.resolve(explicit);
7371
+ return import_node_path5.default.resolve(explicit);
7351
7372
  }
7352
7373
  if (process.env.VITEST || process.env.NODE_ENV === "test") {
7353
- return import_node_path4.default.join(import_node_os.default.tmpdir(), GLOBAL_REGISTRY_DIR_NAME, "vitest");
7374
+ return import_node_path5.default.join(import_node_os.default.tmpdir(), GLOBAL_REGISTRY_DIR_NAME, "vitest");
7354
7375
  }
7355
7376
  if (process.platform === "darwin") {
7356
- return import_node_path4.default.join(import_node_os.default.homedir(), "Library", "Application Support", GLOBAL_REGISTRY_DIR_NAME);
7377
+ return import_node_path5.default.join(import_node_os.default.homedir(), "Library", "Application Support", GLOBAL_REGISTRY_DIR_NAME);
7357
7378
  }
7358
7379
  if (process.platform === "win32") {
7359
- const roaming = process.env.APPDATA || import_node_path4.default.join(import_node_os.default.homedir(), "AppData", "Roaming");
7360
- return import_node_path4.default.join(roaming, GLOBAL_REGISTRY_DIR_NAME);
7380
+ const roaming = process.env.APPDATA || import_node_path5.default.join(import_node_os.default.homedir(), "AppData", "Roaming");
7381
+ return import_node_path5.default.join(roaming, GLOBAL_REGISTRY_DIR_NAME);
7361
7382
  }
7362
- const xdgConfig = process.env.XDG_CONFIG_HOME || import_node_path4.default.join(import_node_os.default.homedir(), ".config");
7363
- return import_node_path4.default.join(xdgConfig, GLOBAL_REGISTRY_DIR_NAME);
7383
+ const xdgConfig = process.env.XDG_CONFIG_HOME || import_node_path5.default.join(import_node_os.default.homedir(), ".config");
7384
+ return import_node_path5.default.join(xdgConfig, GLOBAL_REGISTRY_DIR_NAME);
7364
7385
  }
7365
7386
  function getGlobalRegistryPath() {
7366
- return import_node_path4.default.join(getGlobalRegistryDir(), GLOBAL_REGISTRY_FILE);
7387
+ return import_node_path5.default.join(getGlobalRegistryDir(), GLOBAL_REGISTRY_FILE);
7367
7388
  }
7368
7389
  function resolveWorkspacePaths(workspaceRoot) {
7369
7390
  const absoluteRoot = normalizeWorkspaceRootPath(workspaceRoot);
7370
- const internalDir = import_node_path4.default.join(absoluteRoot, WORKSPACE_INTERNAL_DIR);
7391
+ const internalDir = import_node_path5.default.join(absoluteRoot, WORKSPACE_INTERNAL_DIR);
7371
7392
  return {
7372
7393
  workspaceRoot: absoluteRoot,
7373
7394
  internalDir,
7374
- configPath: import_node_path4.default.join(internalDir, WORKSPACE_CONFIG_FILE),
7375
- indexDbPath: import_node_path4.default.join(internalDir, INDEX_DB_FILE),
7376
- indexManifestPath: import_node_path4.default.join(internalDir, INDEX_MANIFEST_FILE),
7377
- managedRootPath: import_node_path4.default.join(absoluteRoot, DEFAULT_MANAGED_ROOT_PATH),
7378
- archiveRootPath: import_node_path4.default.join(absoluteRoot, DEFAULT_ARCHIVE_ROOT_PATH)
7395
+ configPath: import_node_path5.default.join(internalDir, WORKSPACE_CONFIG_FILE),
7396
+ indexDbPath: import_node_path5.default.join(internalDir, INDEX_DB_FILE),
7397
+ indexManifestPath: import_node_path5.default.join(internalDir, INDEX_MANIFEST_FILE),
7398
+ managedRootPath: import_node_path5.default.join(absoluteRoot, DEFAULT_MANAGED_ROOT_PATH),
7399
+ archiveRootPath: import_node_path5.default.join(absoluteRoot, DEFAULT_ARCHIVE_ROOT_PATH)
7379
7400
  };
7380
7401
  }
7381
7402
  function detectWorkspaceRoot(startDir = process.cwd()) {
7382
- let current = import_node_path4.default.resolve(startDir);
7403
+ let current = import_node_path5.default.resolve(startDir);
7383
7404
  while (true) {
7384
- const candidate = import_node_path4.default.join(current, WORKSPACE_INTERNAL_DIR, WORKSPACE_CONFIG_FILE);
7405
+ const candidate = import_node_path5.default.join(current, WORKSPACE_INTERNAL_DIR, WORKSPACE_CONFIG_FILE);
7385
7406
  if (fileExists(candidate)) {
7386
7407
  return current;
7387
7408
  }
7388
- const parent = import_node_path4.default.dirname(current);
7409
+ const parent = import_node_path5.default.dirname(current);
7389
7410
  if (parent === current) {
7390
7411
  return void 0;
7391
7412
  }
@@ -7400,7 +7421,7 @@ function createDefaultGlobalRegistry() {
7400
7421
  };
7401
7422
  }
7402
7423
  function normalizeWorkspaceRootPath(candidatePath) {
7403
- const resolved = import_node_path4.default.resolve(candidatePath);
7424
+ const resolved = import_node_path5.default.resolve(candidatePath);
7404
7425
  try {
7405
7426
  return import_node_fs3.default.realpathSync.native ? import_node_fs3.default.realpathSync.native(resolved) : import_node_fs3.default.realpathSync(resolved);
7406
7427
  } catch {
@@ -7425,7 +7446,7 @@ function loadGlobalWorkspaceRegistry() {
7425
7446
  const normalizedEntry = {
7426
7447
  workspaceId: entry.workspaceId,
7427
7448
  path: normalizedPath,
7428
- label: entry.label || import_node_path4.default.basename(normalizedPath),
7449
+ label: entry.label || import_node_path5.default.basename(normalizedPath),
7429
7450
  registeredAt: entry.registeredAt,
7430
7451
  lastUsedAt: entry.lastUsedAt,
7431
7452
  source: entry.source
@@ -7459,14 +7480,14 @@ function buildRegisteredWorkspace(workspaceRoot, source) {
7459
7480
  return {
7460
7481
  workspaceId: config.workspaceId,
7461
7482
  path: resolvedRoot,
7462
- label: import_node_path4.default.basename(resolvedRoot),
7483
+ label: import_node_path5.default.basename(resolvedRoot),
7463
7484
  registeredAt: now,
7464
7485
  lastUsedAt: now,
7465
7486
  source
7466
7487
  };
7467
7488
  }
7468
7489
  function registerWorkspaceGlobally(workspaceRoot, options3) {
7469
- const resolvedRoot = import_node_path4.default.resolve(workspaceRoot);
7490
+ const resolvedRoot = import_node_path5.default.resolve(workspaceRoot);
7470
7491
  const nextEntry = buildRegisteredWorkspace(resolvedRoot, options3?.source || "manual");
7471
7492
  const registry = loadGlobalWorkspaceRegistry();
7472
7493
  const existing = registry.workspaces.find((item) => item.path === resolvedRoot);
@@ -7818,8 +7839,8 @@ function createDefaultConfig() {
7818
7839
  }
7819
7840
  ],
7820
7841
  index: {
7821
- databasePath: import_node_path4.default.join(WORKSPACE_INTERNAL_DIR, INDEX_DB_FILE),
7822
- manifestPath: import_node_path4.default.join(WORKSPACE_INTERNAL_DIR, INDEX_MANIFEST_FILE)
7842
+ databasePath: import_node_path5.default.join(WORKSPACE_INTERNAL_DIR, INDEX_DB_FILE),
7843
+ manifestPath: import_node_path5.default.join(WORKSPACE_INTERNAL_DIR, INDEX_MANIFEST_FILE)
7823
7844
  },
7824
7845
  git: {
7825
7846
  enabled: true,
@@ -7847,22 +7868,22 @@ function saveWorkspaceConfig(workspaceRoot, config) {
7847
7868
  writeJsonFile(paths.configPath, config);
7848
7869
  }
7849
7870
  function normalizeStoredRootPath(workspaceRoot, candidatePath) {
7850
- const absoluteCandidate = import_node_path4.default.resolve(candidatePath);
7851
- const relative = import_node_path4.default.relative(workspaceRoot, absoluteCandidate);
7852
- if (!relative.startsWith("..") && !import_node_path4.default.isAbsolute(relative)) {
7871
+ const absoluteCandidate = import_node_path5.default.resolve(candidatePath);
7872
+ const relative = import_node_path5.default.relative(workspaceRoot, absoluteCandidate);
7873
+ if (!relative.startsWith("..") && !import_node_path5.default.isAbsolute(relative)) {
7853
7874
  return relative || ".";
7854
7875
  }
7855
7876
  return absoluteCandidate;
7856
7877
  }
7857
7878
  function isPathInsideWorkspace(workspaceRoot, candidatePath) {
7858
- const relative = import_node_path4.default.relative(import_node_path4.default.resolve(workspaceRoot), import_node_path4.default.resolve(candidatePath));
7859
- return relative === "" || !relative.startsWith("..") && !import_node_path4.default.isAbsolute(relative);
7879
+ const relative = import_node_path5.default.relative(import_node_path5.default.resolve(workspaceRoot), import_node_path5.default.resolve(candidatePath));
7880
+ return relative === "" || !relative.startsWith("..") && !import_node_path5.default.isAbsolute(relative);
7860
7881
  }
7861
7882
  function resolveRootPath(workspaceRoot, root) {
7862
- if (import_node_path4.default.isAbsolute(root.path)) {
7883
+ if (import_node_path5.default.isAbsolute(root.path)) {
7863
7884
  return root.path;
7864
7885
  }
7865
- return import_node_path4.default.join(workspaceRoot, root.path);
7886
+ return import_node_path5.default.join(workspaceRoot, root.path);
7866
7887
  }
7867
7888
  function setupWorkspace(options3) {
7868
7889
  const paths = resolveWorkspacePaths(options3.workspaceRoot);
@@ -7884,20 +7905,20 @@ function setupWorkspace(options3) {
7884
7905
  config.git.remoteConfigured = true;
7885
7906
  }
7886
7907
  saveWorkspaceConfig(paths.workspaceRoot, config);
7887
- writeTextFile(import_node_path4.default.join(paths.workspaceRoot, "README.md"), templateWorkspaceReadme());
7888
- writeTextFile(import_node_path4.default.join(paths.workspaceRoot, ".gitignore"), templateWorkspaceGitignore());
7889
- writeTextFile(import_node_path4.default.join(paths.managedRootPath, "README.md"), templateKnowledgeReadme());
7890
- writeTextFile(import_node_path4.default.join(paths.archiveRootPath, "README.md"), "# Archive\n");
7908
+ writeTextFile(import_node_path5.default.join(paths.workspaceRoot, "README.md"), templateWorkspaceReadme());
7909
+ writeTextFile(import_node_path5.default.join(paths.workspaceRoot, ".gitignore"), templateWorkspaceGitignore());
7910
+ writeTextFile(import_node_path5.default.join(paths.managedRootPath, "README.md"), templateKnowledgeReadme());
7911
+ writeTextFile(import_node_path5.default.join(paths.archiveRootPath, "README.md"), "# Archive\n");
7891
7912
  const created = [
7892
7913
  paths.configPath,
7893
- import_node_path4.default.join(paths.workspaceRoot, "README.md"),
7894
- import_node_path4.default.join(paths.workspaceRoot, ".gitignore"),
7895
- import_node_path4.default.join(paths.managedRootPath, "README.md"),
7896
- import_node_path4.default.join(paths.archiveRootPath, "README.md")
7914
+ import_node_path5.default.join(paths.workspaceRoot, "README.md"),
7915
+ import_node_path5.default.join(paths.workspaceRoot, ".gitignore"),
7916
+ import_node_path5.default.join(paths.managedRootPath, "README.md"),
7917
+ import_node_path5.default.join(paths.archiveRootPath, "README.md")
7897
7918
  ];
7898
7919
  if (options3.starterDocs !== false) {
7899
7920
  for (const document of createStarterDocuments()) {
7900
- const absPath = import_node_path4.default.join(paths.managedRootPath, document.relPath);
7921
+ const absPath = import_node_path5.default.join(paths.managedRootPath, document.relPath);
7901
7922
  writeTextFile(absPath, document.content);
7902
7923
  created.push(absPath);
7903
7924
  }
@@ -7933,7 +7954,7 @@ function addRoot(workspaceRoot, rootDefinition) {
7933
7954
  if (config.roots.some((root2) => root2.id === rootDefinition.id)) {
7934
7955
  throw new CliError("ROOT_EXISTS", `Root '${rootDefinition.id}' already exists.`, EXIT_CODES.validation);
7935
7956
  }
7936
- const absoluteRoot = import_node_path4.default.resolve(rootDefinition.rootPath);
7957
+ const absoluteRoot = import_node_path5.default.resolve(rootDefinition.rootPath);
7937
7958
  if (!isDirectory(absoluteRoot)) {
7938
7959
  throw new CliError(
7939
7960
  "ROOT_NOT_FOUND",
@@ -7975,10 +7996,13 @@ function listRoots(workspaceRoot) {
7975
7996
  function doctor(workspaceRoot) {
7976
7997
  const paths = resolveWorkspacePaths(workspaceRoot);
7977
7998
  const checks = [];
7999
+ const agentsHome = getDefaultAgentsHome();
8000
+ const agentsBinDir = import_node_path5.default.join(agentsHome, "bin");
8001
+ const agentsShimPath = import_node_path5.default.join(agentsBinDir, CLI_NAME);
7978
8002
  const codexHome = getDefaultCodexHome();
7979
- const codexBinDir = import_node_path4.default.join(codexHome, "bin");
7980
- const codexShimPath = import_node_path4.default.join(codexBinDir, CLI_NAME);
7981
- const pathEntries = (process.env.PATH || "").split(import_node_path4.default.delimiter).filter(Boolean);
8003
+ const codexBinDir = import_node_path5.default.join(codexHome, "bin");
8004
+ const codexShimPath = import_node_path5.default.join(codexBinDir, CLI_NAME);
8005
+ const pathEntries = (process.env.PATH || "").split(import_node_path5.default.delimiter).filter(Boolean);
7982
8006
  const registryPath = getGlobalRegistryPath();
7983
8007
  const registry = loadGlobalWorkspaceRegistry();
7984
8008
  checks.push({
@@ -7996,10 +8020,20 @@ function doctor(workspaceRoot) {
7996
8020
  ok: isGitAvailable(),
7997
8021
  message: isGitAvailable() ? "Git is available in PATH." : "Git is not available in PATH."
7998
8022
  });
8023
+ checks.push({
8024
+ name: "agents-cli-shim",
8025
+ ok: fileExists(agentsShimPath),
8026
+ message: fileExists(agentsShimPath) ? `Shared agent CLI shim found: ${agentsShimPath}` : `Shared agent CLI shim missing: ${agentsShimPath}`
8027
+ });
8028
+ checks.push({
8029
+ name: "agents-bin-in-path",
8030
+ ok: pathEntries.includes(agentsBinDir),
8031
+ message: pathEntries.includes(agentsBinDir) ? `Shared agent bin directory is available in PATH: ${agentsBinDir}` : `Shared agent bin directory is not in PATH: ${agentsBinDir}`
8032
+ });
7999
8033
  checks.push({
8000
8034
  name: "codex-cli-shim",
8001
8035
  ok: fileExists(codexShimPath),
8002
- message: fileExists(codexShimPath) ? `Codex CLI shim found: ${codexShimPath}` : `Codex CLI shim missing: ${codexShimPath}`
8036
+ message: fileExists(codexShimPath) ? `Codex compatibility shim found: ${codexShimPath}` : `Codex compatibility shim missing: ${codexShimPath}`
8003
8037
  });
8004
8038
  checks.push({
8005
8039
  name: "codex-bin-in-path",
@@ -8045,7 +8079,7 @@ function doctor(workspaceRoot) {
8045
8079
 
8046
8080
  // src/lib/write-lock.ts
8047
8081
  var import_node_fs4 = __toESM(require("node:fs"));
8048
- var import_node_path5 = __toESM(require("node:path"));
8082
+ var import_node_path6 = __toESM(require("node:path"));
8049
8083
  var LOCK_FILE_NAME = "write.lock";
8050
8084
  var LOCK_WAIT_TIMEOUT_MS = 6e4;
8051
8085
  var LOCK_POLL_INTERVAL_MS = 125;
@@ -8056,7 +8090,7 @@ function sleepMs(durationMs) {
8056
8090
  Atomics.wait(array, 0, 0, durationMs);
8057
8091
  }
8058
8092
  function getLockPath(workspaceRoot) {
8059
- return import_node_path5.default.join(import_node_path5.default.resolve(workspaceRoot), WORKSPACE_INTERNAL_DIR, LOCK_FILE_NAME);
8093
+ return import_node_path6.default.join(import_node_path6.default.resolve(workspaceRoot), WORKSPACE_INTERNAL_DIR, LOCK_FILE_NAME);
8060
8094
  }
8061
8095
  function readLockPayload(lockPath) {
8062
8096
  if (!fileExists(lockPath)) {
@@ -8101,7 +8135,7 @@ function createLockPayload(workspaceRoot, reason) {
8101
8135
  token: newBuildId(),
8102
8136
  pid: process.pid,
8103
8137
  reason,
8104
- workspaceRoot: import_node_path5.default.resolve(workspaceRoot),
8138
+ workspaceRoot: import_node_path6.default.resolve(workspaceRoot),
8105
8139
  acquiredAt: (/* @__PURE__ */ new Date()).toISOString()
8106
8140
  };
8107
8141
  }
@@ -8110,7 +8144,7 @@ function withWorkspaceWriteLock(workspaceRoot, reason, callback, options3) {
8110
8144
  const timeoutMs = options3?.timeoutMs ?? LOCK_WAIT_TIMEOUT_MS;
8111
8145
  const deadline = Date.now() + timeoutMs;
8112
8146
  const payload = createLockPayload(workspaceRoot, reason);
8113
- ensureDir(import_node_path5.default.dirname(lockPath));
8147
+ ensureDir(import_node_path6.default.dirname(lockPath));
8114
8148
  while (true) {
8115
8149
  try {
8116
8150
  const fileDescriptor = import_node_fs4.default.openSync(lockPath, "wx");
@@ -8190,11 +8224,11 @@ function closeDatabaseQuietly(database) {
8190
8224
  }
8191
8225
  function throwKnownDatabaseError(error, workspaceRoot) {
8192
8226
  const cliError = coerceCliError(error, {
8193
- sqliteLockHint: `Retry in a moment, serialize parallel CLI reads against ${import_node_path6.default.resolve(
8227
+ sqliteLockHint: `Retry in a moment, serialize parallel CLI reads against ${import_node_path7.default.resolve(
8194
8228
  workspaceRoot
8195
8229
  )}, or rerun with --auto-rebuild after the current write finishes.`,
8196
8230
  sqliteLockDetails: {
8197
- workspaceRoot: import_node_path6.default.resolve(workspaceRoot)
8231
+ workspaceRoot: import_node_path7.default.resolve(workspaceRoot)
8198
8232
  }
8199
8233
  });
8200
8234
  if (cliError) {
@@ -8277,7 +8311,7 @@ function collectRootSnapshot(rootId, rootPath, kind) {
8277
8311
  let latestMtimeMs = 0;
8278
8312
  for (const filePath of markdownFiles) {
8279
8313
  const stats = import_node_fs5.default.statSync(filePath);
8280
- const relPath = import_node_path6.default.relative(rootPath, filePath);
8314
+ const relPath = import_node_path7.default.relative(rootPath, filePath);
8281
8315
  latestMtimeMs = Math.max(latestMtimeMs, Math.trunc(stats.mtimeMs));
8282
8316
  entries.push(`${relPath}|${stats.size}|${Math.trunc(stats.mtimeMs)}`);
8283
8317
  }
@@ -8503,7 +8537,7 @@ function rebuildIndexUnlocked(workspaceRoot) {
8503
8537
  for (const filePath of markdownFiles) {
8504
8538
  const rawContent = import_node_fs5.default.readFileSync(filePath, "utf8");
8505
8539
  const stats = import_node_fs5.default.statSync(filePath);
8506
- const relPath = import_node_path6.default.relative(rootPath, filePath);
8540
+ const relPath = import_node_path7.default.relative(rootPath, filePath);
8507
8541
  const parsed = parseMarkdownDocument(filePath, relPath, root.id, rawContent, Math.trunc(stats.mtimeMs));
8508
8542
  insertDocument(database, parsed.document);
8509
8543
  insertSections(database, parsed.document, parsed.sections);
@@ -8615,7 +8649,7 @@ function requireFreshIndex(workspaceRoot, options3) {
8615
8649
  "The workspace has not been indexed yet.",
8616
8650
  EXIT_CODES.indexMissing,
8617
8651
  {
8618
- hint: verification.hint || `Run: company-agent-wiki-cli index rebuild --workspace ${import_node_path6.default.resolve(workspaceRoot)}`
8652
+ hint: verification.hint || `Run: company-agent-wiki-cli index rebuild --workspace ${import_node_path7.default.resolve(workspaceRoot)}`
8619
8653
  }
8620
8654
  );
8621
8655
  }
@@ -8628,7 +8662,7 @@ function requireFreshIndex(workspaceRoot, options3) {
8628
8662
  "The indexed snapshot no longer matches the current roots.",
8629
8663
  EXIT_CODES.indexStale,
8630
8664
  {
8631
- hint: `Run: company-agent-wiki-cli index rebuild --workspace ${import_node_path6.default.resolve(workspaceRoot)}`,
8665
+ hint: `Run: company-agent-wiki-cli index rebuild --workspace ${import_node_path7.default.resolve(workspaceRoot)}`,
8632
8666
  details: verification.roots.filter((root) => !root.ok)
8633
8667
  }
8634
8668
  );
@@ -8938,7 +8972,7 @@ function getDocumentHeadings(workspaceRoot, docId, options3) {
8938
8972
 
8939
8973
  // src/lib/onboarding.ts
8940
8974
  var import_node_fs6 = __toESM(require("node:fs"));
8941
- var import_node_path7 = __toESM(require("node:path"));
8975
+ var import_node_path8 = __toESM(require("node:path"));
8942
8976
  var COMPANY_ONBOARDING_DE_V1 = {
8943
8977
  profileId: "de-company-v1",
8944
8978
  locale: "de-DE",
@@ -9530,8 +9564,8 @@ function ensureKnownAnswerKeys(payload) {
9530
9564
  }
9531
9565
  }
9532
9566
  function isPathInsideWorkspace2(workspaceRoot, candidatePath) {
9533
- const relative = import_node_path7.default.relative(import_node_path7.default.resolve(workspaceRoot), import_node_path7.default.resolve(candidatePath));
9534
- return relative === "" || !relative.startsWith("..") && !import_node_path7.default.isAbsolute(relative);
9567
+ const relative = import_node_path8.default.relative(import_node_path8.default.resolve(workspaceRoot), import_node_path8.default.resolve(candidatePath));
9568
+ return relative === "" || !relative.startsWith("..") && !import_node_path8.default.isAbsolute(relative);
9535
9569
  }
9536
9570
  function resolveManagedRoot(workspaceRoot) {
9537
9571
  const config = loadWorkspaceConfig(workspaceRoot);
@@ -9554,12 +9588,12 @@ function resolveManagedRoot(workspaceRoot) {
9554
9588
  return resolvedPath;
9555
9589
  }
9556
9590
  function createDocument(workspaceRoot, managedRoot, relPath, id, title, type, tags, body, answeredAt, answeredBy) {
9557
- const absPath = import_node_path7.default.join(managedRoot, relPath);
9591
+ const absPath = import_node_path8.default.join(managedRoot, relPath);
9558
9592
  return {
9559
9593
  docId: id,
9560
9594
  title,
9561
9595
  absPath,
9562
- relPath: import_node_path7.default.relative(workspaceRoot, absPath),
9596
+ relPath: import_node_path8.default.relative(workspaceRoot, absPath),
9563
9597
  existed: false,
9564
9598
  content: `${renderFrontmatter({ id, title, type, tags, answeredAt, answeredBy })}${body.trimEnd()}
9565
9599
  `
@@ -9791,8 +9825,8 @@ function previewCompanyOnboarding(workspaceRoot, answerFile) {
9791
9825
  };
9792
9826
  }
9793
9827
  function applyCompanyOnboarding(options3) {
9794
- const workspaceRoot = import_node_path7.default.resolve(options3.workspaceRoot);
9795
- const answerFile = import_node_path7.default.resolve(options3.answerFile);
9828
+ const workspaceRoot = import_node_path8.default.resolve(options3.workspaceRoot);
9829
+ const answerFile = import_node_path8.default.resolve(options3.answerFile);
9796
9830
  const preview = previewCompanyOnboarding(workspaceRoot, answerFile);
9797
9831
  const warnings = [...preview.warnings];
9798
9832
  let indexBuildId;
@@ -9818,7 +9852,7 @@ function applyCompanyOnboarding(options3) {
9818
9852
  }
9819
9853
  }
9820
9854
  for (const document of preview.documents) {
9821
- ensureDir(import_node_path7.default.dirname(document.absPath));
9855
+ ensureDir(import_node_path8.default.dirname(document.absPath));
9822
9856
  if (document.existed) {
9823
9857
  warnings.push(`Overwriting existing file: ${document.relPath}`);
9824
9858
  }
@@ -12510,7 +12544,7 @@ function startServer(workspaceRoot, port, options3) {
12510
12544
  // src/index.ts
12511
12545
  function assertWorkspace(workspacePath) {
12512
12546
  if (workspacePath?.trim()) {
12513
- const resolved = import_node_path8.default.resolve(workspacePath);
12547
+ const resolved = import_node_path9.default.resolve(workspacePath);
12514
12548
  rememberWorkspaceGlobally(resolved, { setDefault: true, source: "runtime" });
12515
12549
  return resolved;
12516
12550
  }
@@ -12597,14 +12631,20 @@ function printHeadings(headings) {
12597
12631
  }
12598
12632
  var program2 = new Command();
12599
12633
  program2.name(CLI_NAME).description("Agent-first local company knowledge CLI").version(CLI_SCHEMA_VERSION);
12600
- program2.command("about").description("Show CLI runtime metadata and common Codex paths").option("--json", "Emit JSON output", false).action((options3) => {
12634
+ program2.command("about").description("Show CLI runtime metadata and common shared-agent paths").option("--json", "Emit JSON output", false).action((options3) => {
12635
+ const agentsHome = getDefaultAgentsHome();
12601
12636
  const codexHome = getDefaultCodexHome();
12637
+ const runtimeHome = detectInstalledRuntimeHome(__dirname) || null;
12602
12638
  const data = {
12603
12639
  packageName: PACKAGE_NAME,
12604
12640
  cliName: CLI_NAME,
12605
12641
  schemaVersion: CLI_SCHEMA_VERSION,
12642
+ runtimeHome,
12643
+ runtimeShimPath: runtimeHome ? import_node_path9.default.join(runtimeHome, "bin", CLI_NAME) : null,
12644
+ agentsHome,
12645
+ agentsShimPath: import_node_path9.default.join(agentsHome, "bin", CLI_NAME),
12606
12646
  codexHome,
12607
- codexShimPath: import_node_path8.default.join(codexHome, "bin", CLI_NAME),
12647
+ codexShimPath: import_node_path9.default.join(codexHome, "bin", CLI_NAME),
12608
12648
  cwdWorkspace: detectWorkspaceRoot(process.cwd()) || null,
12609
12649
  globalRegistryPath: getGlobalRegistryPath(),
12610
12650
  resolvedWorkspace: resolveWorkspaceSelection(process.cwd())
@@ -12616,6 +12656,12 @@ program2.command("about").description("Show CLI runtime metadata and common Code
12616
12656
  process.stdout.write(`${CLI_NAME}
12617
12657
  `);
12618
12658
  process.stdout.write(` schema version: ${CLI_SCHEMA_VERSION}
12659
+ `);
12660
+ if (data.runtimeShimPath) {
12661
+ process.stdout.write(` runtime shim: ${data.runtimeShimPath}
12662
+ `);
12663
+ }
12664
+ process.stdout.write(` shared agent shim: ${data.agentsShimPath}
12619
12665
  `);
12620
12666
  process.stdout.write(` codex shim: ${data.codexShimPath}
12621
12667
  `);
@@ -12680,7 +12726,7 @@ workspace.command("list").description("List globally registered workspaces").opt
12680
12726
  }
12681
12727
  });
12682
12728
  workspace.command("register").description("Register an existing workspace globally for other agents").requiredOption("--workspace <path>", "Absolute or relative workspace path").option("--default", "Also mark this workspace as the global default", false).option("--json", "Emit JSON output", false).action((options3) => {
12683
- const entry = registerWorkspaceGlobally(import_node_path8.default.resolve(options3.workspace), {
12729
+ const entry = registerWorkspaceGlobally(import_node_path9.default.resolve(options3.workspace), {
12684
12730
  setDefault: Boolean(options3.default),
12685
12731
  source: "manual"
12686
12732
  });
@@ -12699,7 +12745,7 @@ workspace.command("register").description("Register an existing workspace global
12699
12745
  }
12700
12746
  });
12701
12747
  workspace.command("use").description("Set a registered workspace as the global default").requiredOption("--workspace <path>", "Absolute or relative workspace path").option("--json", "Emit JSON output", false).action((options3) => {
12702
- const entry = registerWorkspaceGlobally(import_node_path8.default.resolve(options3.workspace), {
12748
+ const entry = registerWorkspaceGlobally(import_node_path9.default.resolve(options3.workspace), {
12703
12749
  setDefault: true,
12704
12750
  source: "manual"
12705
12751
  });
@@ -12717,7 +12763,7 @@ workspace.command("use").description("Set a registered workspace as the global d
12717
12763
  program2.addCommand(workspace);
12718
12764
  program2.command("setup").description("Workspace setup commands").addCommand(
12719
12765
  new Command("workspace").requiredOption("--workspace <path>", "Absolute or relative workspace path").option("--git-init", "Initialize a local Git repository", false).option("--git-remote <url>", "Configure a Git remote URL").option("--no-starter-docs", "Skip creation of starter Markdown documents").option("--force", "Rewrite an existing scaffold", false).option("--json", "Emit JSON output", false).action((options3) => {
12720
- const workspaceRoot = import_node_path8.default.resolve(options3.workspace);
12766
+ const workspaceRoot = import_node_path9.default.resolve(options3.workspace);
12721
12767
  const result = setupWorkspace({
12722
12768
  workspaceRoot,
12723
12769
  gitInit: Boolean(options3.gitInit),
@@ -12971,8 +13017,8 @@ program2.command("read").option("--workspace <path>", "Workspace path. Optional
12971
13017
  const metadataResult = options3.docId ? getDocumentMetadataById(workspaceRoot, options3.docId, {
12972
13018
  autoRebuild: Boolean(options3.autoRebuild)
12973
13019
  }) : (() => {
12974
- const candidatePath = import_node_path8.default.isAbsolute(options3.path) ? options3.path : import_node_path8.default.join(workspaceRoot, options3.path);
12975
- return getDocumentMetadataByPath(workspaceRoot, import_node_path8.default.resolve(candidatePath), {
13020
+ const candidatePath = import_node_path9.default.isAbsolute(options3.path) ? options3.path : import_node_path9.default.join(workspaceRoot, options3.path);
13021
+ return getDocumentMetadataByPath(workspaceRoot, import_node_path9.default.resolve(candidatePath), {
12976
13022
  autoRebuild: Boolean(options3.autoRebuild)
12977
13023
  });
12978
13024
  })();
@@ -13022,7 +13068,7 @@ program2.command("read").option("--workspace <path>", "Workspace path. Optional
13022
13068
  });
13023
13069
  program2.command("history").option("--workspace <path>", "Workspace path. Optional when current directory is already inside a workspace.").option("--doc-id <id>", "Indexed document identifier").option("--path <path>", "Absolute or workspace-relative document path").option("--limit <number>", "Maximum number of commits", "20").option("--json", "Emit JSON output", false).action((options3) => {
13024
13070
  const workspaceRoot = assertWorkspace(options3.workspace);
13025
- const resolvedPath = options3.docId ? resolveDocumentById(workspaceRoot, options3.docId).absPath : import_node_path8.default.resolve(import_node_path8.default.isAbsolute(options3.path) ? options3.path : import_node_path8.default.join(workspaceRoot, options3.path));
13071
+ const resolvedPath = options3.docId ? resolveDocumentById(workspaceRoot, options3.docId).absPath : import_node_path9.default.resolve(import_node_path9.default.isAbsolute(options3.path) ? options3.path : import_node_path9.default.join(workspaceRoot, options3.path));
13026
13072
  const history = getGitHistory(resolvedPath, Number(options3.limit));
13027
13073
  if (options3.json) {
13028
13074
  printJson(envelope("history", { path: resolvedPath, history }));
@@ -13035,7 +13081,7 @@ program2.command("history").option("--workspace <path>", "Workspace path. Option
13035
13081
  });
13036
13082
  program2.command("diff").option("--workspace <path>", "Workspace path. Optional when current directory is already inside a workspace.").option("--doc-id <id>", "Indexed document identifier").option("--path <path>", "Absolute or workspace-relative document path").option("--base <ref>", "Base Git ref", "HEAD").option("--compare <ref>", "Optional compare ref").option("--json", "Emit JSON output", false).action((options3) => {
13037
13083
  const workspaceRoot = assertWorkspace(options3.workspace);
13038
- const resolvedPath = options3.docId ? resolveDocumentById(workspaceRoot, options3.docId).absPath : import_node_path8.default.resolve(import_node_path8.default.isAbsolute(options3.path) ? options3.path : import_node_path8.default.join(workspaceRoot, options3.path));
13084
+ const resolvedPath = options3.docId ? resolveDocumentById(workspaceRoot, options3.docId).absPath : import_node_path9.default.resolve(import_node_path9.default.isAbsolute(options3.path) ? options3.path : import_node_path9.default.join(workspaceRoot, options3.path));
13039
13085
  const diff = getGitDiff(resolvedPath, options3.base, options3.compare);
13040
13086
  if (options3.json) {
13041
13087
  printJson(envelope("diff", { path: resolvedPath, diff }));
package/dist/installer.js CHANGED
@@ -3470,6 +3470,7 @@ var {
3470
3470
  } = import_index.default;
3471
3471
 
3472
3472
  // src/lib/constants.ts
3473
+ var PACKAGE_NAME = "@codecell-germany/company-agent-wiki-skill";
3473
3474
  var CLI_NAME = "company-agent-wiki-cli";
3474
3475
  var INSTALLER_NAME = "company-agent-wiki-skill";
3475
3476
  var SKILL_NAME = "company-agent-wiki-cli";
@@ -3537,14 +3538,18 @@ exec "$NODE_BIN" "${runtimeScript}" "$@"
3537
3538
  `;
3538
3539
  import_node_fs2.default.writeFileSync(targetPath, content, { encoding: "utf8", mode: 493 });
3539
3540
  }
3540
- function installIntoCodexHome(options) {
3541
- const packageRoot = resolvePackageRoot(__dirname);
3542
- const codexHome = options?.codexHome || process.env.CODEX_HOME || import_node_path.default.join(import_node_os.default.homedir(), ".codex");
3543
- const runtimeDir = import_node_path.default.join(codexHome, "tools", SKILL_NAME);
3544
- const skillDir = import_node_path.default.join(codexHome, "skills", SKILL_NAME);
3545
- const binDir = import_node_path.default.join(codexHome, "bin");
3541
+ function getDefaultAgentsHome() {
3542
+ return process.env.AGENTS_HOME || import_node_path.default.join(import_node_os.default.homedir(), ".agents");
3543
+ }
3544
+ function getDefaultCodexHome() {
3545
+ return process.env.CODEX_HOME || import_node_path.default.join(import_node_os.default.homedir(), ".codex");
3546
+ }
3547
+ function installIntoHome(target, home, packageRoot, force = false) {
3548
+ const runtimeDir = import_node_path.default.join(home, "tools", SKILL_NAME);
3549
+ const skillDir = import_node_path.default.join(home, "skills", SKILL_NAME);
3550
+ const binDir = import_node_path.default.join(home, "bin");
3546
3551
  const shimPath = import_node_path.default.join(binDir, CLI_NAME);
3547
- if (options?.force) {
3552
+ if (force) {
3548
3553
  import_node_fs2.default.rmSync(runtimeDir, { recursive: true, force: true });
3549
3554
  import_node_fs2.default.rmSync(skillDir, { recursive: true, force: true });
3550
3555
  import_node_fs2.default.rmSync(shimPath, { force: true });
@@ -3564,7 +3569,8 @@ function installIntoCodexHome(options) {
3564
3569
  const runtimeScript = import_node_path.default.join(runtimeDir, "dist", "index.js");
3565
3570
  writeShim(shimPath, runtimeScript);
3566
3571
  return {
3567
- codexHome,
3572
+ target,
3573
+ home,
3568
3574
  binDir,
3569
3575
  runtimeDir,
3570
3576
  skillDir,
@@ -3573,6 +3579,31 @@ function installIntoCodexHome(options) {
3573
3579
  pathHint: (process.env.PATH || "").split(import_node_path.default.delimiter).includes(binDir) ? void 0 : `The shim exists, but ${binDir} is not in PATH. Use "${shimPath}" directly or add ${binDir} to PATH.`
3574
3580
  };
3575
3581
  }
3582
+ function installIntoAgentHomes(options) {
3583
+ const packageRoot = resolvePackageRoot(__dirname);
3584
+ const agentsHome = options?.agentsHome || getDefaultAgentsHome();
3585
+ const codexHome = options?.codexHome || getDefaultCodexHome();
3586
+ const target = options?.target || "all";
3587
+ if (!["agents", "codex", "all"].includes(target)) {
3588
+ throw new Error(`Unsupported install target "${target}". Use agents, codex or all.`);
3589
+ }
3590
+ const installs = [];
3591
+ if (target === "agents" || target === "all") {
3592
+ installs.push(installIntoHome("agents", agentsHome, packageRoot, options?.force));
3593
+ }
3594
+ if (target === "codex" || target === "all") {
3595
+ const shouldSkipCodex = installs.some((entry) => entry.home === codexHome);
3596
+ if (!shouldSkipCodex) {
3597
+ installs.push(installIntoHome("codex", codexHome, packageRoot, options?.force));
3598
+ }
3599
+ }
3600
+ return {
3601
+ packageName: PACKAGE_NAME,
3602
+ installerName: INSTALLER_NAME,
3603
+ cliName: CLI_NAME,
3604
+ installs
3605
+ };
3606
+ }
3576
3607
 
3577
3608
  // src/lib/errors.ts
3578
3609
  var CliError = class extends Error {
@@ -3653,23 +3684,27 @@ function printJson(value) {
3653
3684
 
3654
3685
  // src/installer.ts
3655
3686
  var program2 = new Command();
3656
- program2.name(INSTALLER_NAME).description("Install the Company Agent Wiki skill and CLI into Codex");
3657
- program2.command("install").option("--codex-home <path>", "Target Codex home directory").option("--force", "Replace an existing install", false).option("--json", "Emit JSON output", false).action((options) => {
3658
- const result = installIntoCodexHome({
3687
+ program2.name(INSTALLER_NAME).description("Install the Company Agent Wiki skill and CLI for shared agent homes and Codex compatibility");
3688
+ program2.command("install").option("--agents-home <path>", "Target shared agents home directory").option("--codex-home <path>", "Target Codex home directory").option("--target <target>", "Install target: agents, codex or all", "all").option("--force", "Replace an existing install", false).option("--json", "Emit JSON output", false).action((options) => {
3689
+ const result = installIntoAgentHomes({
3690
+ agentsHome: options.agentsHome,
3659
3691
  codexHome: options.codexHome,
3660
- force: Boolean(options.force)
3692
+ force: Boolean(options.force),
3693
+ target: options.target
3661
3694
  });
3662
3695
  if (options.json) {
3663
3696
  printJson(envelope("install", result));
3664
3697
  return;
3665
3698
  }
3666
- process.stdout.write(`Installed into ${result.codexHome}
3699
+ for (const install of result.installs) {
3700
+ process.stdout.write(`Installed ${install.target} target into ${install.home}
3667
3701
  `);
3668
- process.stdout.write(`CLI shim: ${result.shimPath}
3702
+ process.stdout.write(`CLI shim: ${install.shimPath}
3669
3703
  `);
3670
- if (result.pathHint) {
3671
- process.stdout.write(`warning: ${result.pathHint}
3704
+ if (install.pathHint) {
3705
+ process.stdout.write(`warning: ${install.pathHint}
3672
3706
  `);
3707
+ }
3673
3708
  }
3674
3709
  });
3675
3710
  async function main() {
@@ -2,7 +2,7 @@
2
2
 
3
3
  ## Scope
4
4
 
5
- Phase 1 delivers a publishable CLI and Codex skill for a private, local company knowledge workspace.
5
+ Phase 1 delivers a publishable CLI and a shared agent skill for a private, local company knowledge workspace.
6
6
 
7
7
  The implementation is intentionally limited to:
8
8
 
@@ -46,7 +46,8 @@ The index and manifest are derived artifacts and should stay ignored in the priv
46
46
  8. `search`, `route` and `read` either enforce a fresh index or can explicitly auto-rebuild when `--auto-rebuild` is set.
47
47
  9. Runtime commands may detect the current workspace automatically when the shell is already inside a private workspace.
48
48
  10. A global per-user workspace registry stores known workspace paths and a default workspace so other agents can resolve the knowledge location automatically on macOS, Windows and Linux.
49
- 11. `serve` exposes the same read-only data through a local web view and now distinguishes `missing`, `stale` and `ok` states with a rebuild action.
49
+ 11. The installer now targets a shared `~/.agents` home as the primary skill/runtime location and also installs a Codex compatibility mirror under `~/.codex`.
50
+ 12. `serve` exposes the same read-only data through a local web view and now distinguishes `missing`, `stale` and `ok` states with a rebuild action.
50
51
 
51
52
  ## Onboarding Model
52
53
 
@@ -30,3 +30,4 @@
30
30
  - The CLI can initialize a private Git remote URL, but it does not validate remote policy or access controls.
31
31
  - The package does not enforce OS-level filesystem permissions; the workspace owner must place the private workspace in a properly protected location.
32
32
  - The global workspace registry is only a discovery layer, not an access-control boundary. Any agent running as the same local user can read the registered workspace path.
33
+ - The installer now targets a shared `~/.agents` home first and mirrors into `~/.codex` for compatibility, but it does not manage every agent product's own skill-indexing or refresh logic automatically.
@@ -66,7 +66,8 @@ Installer aus lokalem Tarball:
66
66
  ```bash
67
67
  TMP="$(mktemp -d)"
68
68
  cd "$TMP"
69
- npx -y -p /absolute/path/to/codecell-germany-company-agent-wiki-skill-0.1.0.tgz company-agent-wiki-skill install --codex-home "$TMP/codex" --force
69
+ npx -y -p /absolute/path/to/codecell-germany-company-agent-wiki-skill-0.1.0.tgz company-agent-wiki-skill install --agents-home "$TMP/agents" --codex-home "$TMP/codex" --force
70
+ "$TMP/agents/bin/company-agent-wiki-cli" --help
70
71
  "$TMP/codex/bin/company-agent-wiki-cli" --help
71
72
  ```
72
73
 
@@ -114,7 +115,8 @@ TMP="$(mktemp -d)"
114
115
  CACHE="$(mktemp -d)"
115
116
  cd "$TMP"
116
117
  npm_config_cache="$CACHE" npx -y @codecell-germany/company-agent-wiki-skill@0.1.0 company-agent-wiki-cli --help
117
- npm_config_cache="$CACHE" npx -y @codecell-germany/company-agent-wiki-skill@0.1.0 company-agent-wiki-skill install --codex-home "$TMP/codex" --force
118
+ npm_config_cache="$CACHE" npx -y @codecell-germany/company-agent-wiki-skill@0.1.0 company-agent-wiki-skill install --agents-home "$TMP/agents" --codex-home "$TMP/codex" --force
119
+ "$TMP/agents/bin/company-agent-wiki-cli" --help
118
120
  "$TMP/codex/bin/company-agent-wiki-cli" --help
119
121
  ```
120
122
 
@@ -155,6 +157,8 @@ npx -y skills add codecell-germany/company-agent-wiki-skill -g --skill company-a
155
157
 
156
158
  - CLI läuft über `company-agent-wiki-cli`
157
159
  - Installer läuft über `company-agent-wiki-skill`
160
+ - Shared agent install unter `~/.agents` funktioniert
161
+ - Codex-Kompatibilitätsinstall unter `~/.codex` funktioniert
158
162
  - README, Skill, Referenzen und Knowledge sind synchron
159
163
  - `npm pack` enthält nur gewollte Dateien
160
164
  - lokaler Tarball-Smoketest ist grün
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@codecell-germany/company-agent-wiki-skill",
3
- "version": "0.1.2",
4
- "description": "Context is king: agent-first local company knowledge workspace with metadata-first retrieval, Markdown as truth, SQLite-indexed front matter, Git-aware verification, and a Codex skill installer.",
3
+ "version": "0.1.3",
4
+ "description": "Context is king: agent-first local company knowledge workspace with metadata-first retrieval, Markdown as truth, SQLite-indexed front matter, Git-aware verification, and a shared agent skill installer.",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "type": "commonjs",
@@ -12,6 +12,8 @@ Use this skill when the task is about a private company knowledge workspace buil
12
12
  - Git-backed history
13
13
  - a read-only local browsing view
14
14
 
15
+ This package now targets a shared `~/.agents` home first so the same published package can work across multiple agent runtimes, not only Codex.
16
+
15
17
  ## Preconditions
16
18
 
17
19
  - The public CLI binary is `company-agent-wiki-cli`.
@@ -19,22 +21,37 @@ Use this skill when the task is about a private company knowledge workspace buil
19
21
  - The private workspace may be the current dedicated local folder; it just must not be the public skill/CLI repo.
20
22
  - The human should provide the workspace path at least once and, if desired, the private Git remote URL. After setup or manual registration, the CLI stores the workspace path in a global per-user registry so later agents can resolve it automatically.
21
23
  - Runtime discovery matters. Before relying on the CLI, verify which path is actually available.
22
- - In Codex, the most reliable fallback is usually the installed shim under `$CODEX_HOME/bin` or `~/.codex/bin`.
24
+ - The primary shared install target is `~/.agents`. Codex additionally gets a compatibility mirror under `~/.codex`.
23
25
  - The preferred one-command installer path is `npx -y -p @codecell-germany/company-agent-wiki-skill company-agent-wiki-skill install --force`. This only works after the npm package is really published.
24
- - `node dist/index.js` only works inside the public implementation repo after `npm run build`, not inside an arbitrary private workspace.
25
26
  - If the binary is not already installed in PATH, use these fallbacks in this order:
26
27
 
27
28
  ```bash
29
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
30
+ "$AGENTS_HOME/bin/company-agent-wiki-cli" --help
28
31
  "$CODEX_HOME/bin/company-agent-wiki-cli" --help
29
32
  "$HOME/.codex/bin/company-agent-wiki-cli" --help
30
33
  company-agent-wiki-cli --help
31
34
  npx -y -p @codecell-germany/company-agent-wiki-skill company-agent-wiki-skill install --force
35
+ ```
36
+
37
+ If you are actively developing inside the public implementation repo, the repo-local fallback also exists:
38
+
39
+ ```bash
40
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
41
+ "$CODEX_HOME/bin/company-agent-wiki-cli" --help
32
42
  node dist/index.js --help
33
43
  ```
34
44
 
35
45
  ## First Run
36
46
 
37
- 1. In Codex, start with the explicit shim paths:
47
+ 1. Start with the shared agent shim path:
48
+
49
+ ```bash
50
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
51
+ "$AGENTS_HOME/bin/company-agent-wiki-cli" --help
52
+ ```
53
+
54
+ If you are in Codex, the compatibility shim also works:
38
55
 
39
56
  ```bash
40
57
  "$CODEX_HOME/bin/company-agent-wiki-cli" --help
@@ -4,6 +4,8 @@
4
4
 
5
5
  ```bash
6
6
  npx -y -p @codecell-germany/company-agent-wiki-skill company-agent-wiki-skill install --force
7
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
8
+ "$AGENTS_HOME/bin/company-agent-wiki-cli" --help
7
9
  "$CODEX_HOME/bin/company-agent-wiki-cli" --help
8
10
  "$HOME/.codex/bin/company-agent-wiki-cli" --help
9
11
  company-agent-wiki-cli --help
@@ -4,6 +4,8 @@
4
4
 
5
5
  ```bash
6
6
  npx -y -p @codecell-germany/company-agent-wiki-skill company-agent-wiki-skill install --force
7
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
8
+ "$AGENTS_HOME/bin/company-agent-wiki-cli" --help
7
9
  "$CODEX_HOME/bin/company-agent-wiki-cli" --help
8
10
  "$HOME/.codex/bin/company-agent-wiki-cli" --help
9
11
  company-agent-wiki-cli about --json
@@ -59,7 +59,7 @@ If target files already exist, the CLI refuses the write unless `--force` is add
59
59
 
60
60
  ```json
61
61
  {
62
- "answeredBy": "Codex Agent",
62
+ "answeredBy": "AI Agent",
63
63
  "notes": ["Buchhaltung zuerst priorisieren"],
64
64
  "answers": {
65
65
  "official_legal_name": "Beispiel GmbH",
@@ -1,6 +1,7 @@
1
1
  # Overview
2
2
 
3
3
  `company-agent-wiki-cli` is the public interface for a private, local company knowledge workspace.
4
+ The published package now installs into a shared `~/.agents` home first and mirrors into `~/.codex` for Codex compatibility.
4
5
 
5
6
  ## Source of Truth
6
7
 
@@ -26,6 +26,8 @@ Before relying on the CLI, verify a real executable path:
26
26
 
27
27
  ```bash
28
28
  npx -y -p @codecell-germany/company-agent-wiki-skill company-agent-wiki-skill install --force
29
+ "$HOME/.agents/bin/company-agent-wiki-cli" --help
30
+ "$AGENTS_HOME/bin/company-agent-wiki-cli" --help
29
31
  "$CODEX_HOME/bin/company-agent-wiki-cli" --help
30
32
  "$HOME/.codex/bin/company-agent-wiki-cli" --help
31
33
  company-agent-wiki-cli --help