@dotdrelle/wiki-manager 0.12.7 → 0.12.8

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
@@ -36,6 +36,44 @@ everything — either with the mouse in a browser, or by talking to an assistant
36
36
  A **workspace** = a project. Each project is isolated: its documents, settings,
37
37
  and results never get mixed up with the others.
38
38
 
39
+ ## Installation and command modes
40
+
41
+ The package can be installed either locally in a project or globally. The
42
+ command used afterwards depends on the installation mode.
43
+
44
+ ### Local installation
45
+
46
+ Use a local installation when the manager should be pinned in a project's
47
+ `package.json`:
48
+
49
+ ```bash
50
+ npm install @dotdrelle/wiki-manager
51
+ npx wiki-manager
52
+ npx wiki-workspace --help
53
+ ```
54
+
55
+ `npm install` does not add `wiki-manager` or `wiki-workspace` to the shell's
56
+ global `PATH`. Run local executables with `npx` (or `npm exec wiki-manager` and
57
+ `npm exec wiki-workspace`). Bun is installed automatically as a package runtime;
58
+ you do not need to add `~/.bun/bin` to `PATH`.
59
+
60
+ ### Global installation
61
+
62
+ Use a global installation when the commands should be available directly from
63
+ any directory:
64
+
65
+ ```bash
66
+ npm install --global @dotdrelle/wiki-manager
67
+ wiki-manager
68
+ wiki-workspace --help
69
+ ```
70
+
71
+ The global installation also installs the required Bun runtime. A separately
72
+ installed Bun remains supported, but is not required.
73
+
74
+ In both modes, launch the commands from the directory that should hold the
75
+ manager state (`workspaces/`, `.env`, and `mcp.endpoints.json`).
76
+
39
77
  ## Functional overview
40
78
 
41
79
  The diagram below shows the whole picture at a glance: how **inputs** (external
@@ -54,14 +92,17 @@ chat** — all on the **shipped example**, with **no external source to
54
92
  configure**. External agents (Confluence, mail…) come later, only when you plug
55
93
  in real sources.
56
94
 
57
- > **Prerequisites:** Docker running and Node ≥ 22.
95
+ > **Prerequisites:** Docker running and Node ≥ 22. Bun is installed with the npm
96
+ > package.
58
97
 
59
- **1 — Install once, pick a home folder.**
98
+ **1 — Install globally, pick a home folder.**
60
99
  The manager keeps its state (workspaces, `.env`, endpoints) in the directory
61
- where you launch it, so give it a home:
100
+ where you launch it, so give it a home. This quick start uses the global mode;
101
+ see [Installation and command modes](#installation-and-command-modes) for the
102
+ local `npm install` + `npx` mode.
62
103
 
63
104
  ```bash
64
- npm i -g @dotdrelle/wiki-manager
105
+ npm install --global @dotdrelle/wiki-manager
65
106
  mkdir -p ~/llm-wiki && cd ~/llm-wiki # all manager state lives here
66
107
  ```
67
108
 
@@ -151,7 +192,7 @@ wiki-workspace wiki demo build # or, in the shell: /skills run pipeli
151
192
  That's the whole loop. Next: the four ways to use it and how to configure the
152
193
  external agents (CME & co.) live in [docs/usage.md](https://raw.githubusercontent.com/dotdrelle/llm-wiki-manager/main/docs/usage.md); the detailed
153
194
  story is in [The journey](#the-journey-from-first-launch-to-first-result); and
154
- installing from source is in [Initial Setup](#initial-setup).
195
+ installing from source is in [Installing from source](#installing-from-source).
155
196
 
156
197
  ## The journey: from first launch to first result
157
198
 
@@ -379,15 +420,15 @@ root `.env`; the wiki's **LLM keys** live in each workspace `.wikirc.yaml`.
379
420
  See the full, field-by-field reference in
380
421
  **[docs/configuration.md](https://raw.githubusercontent.com/dotdrelle/llm-wiki-manager/main/docs/configuration.md)**.
381
422
 
382
- ## Initial Setup
423
+ ## Installing from source
383
424
 
384
425
  ```bash
385
426
  corepack enable
386
427
  pnpm install
387
428
  ```
388
429
 
389
- When installed through `npm`/`npx`/`bun`, `wiki-manager` keeps its state outside
390
- the package, in the directory where the command is launched:
430
+ Whether installed locally, globally, or from source, `wiki-manager` keeps its
431
+ state outside the package, in the directory where the command is launched:
391
432
 
392
433
  ```text
393
434
  ./workspaces/ # workspace registry
package/bin/wiki-manager CHANGED
@@ -39,7 +39,26 @@ if [[ -n "$CACERT_PATH" ]]; then
39
39
  export CURL_CA_BUNDLE="$CACERT_PATH"
40
40
  fi
41
41
 
42
+ SCRIPT_SOURCE="${BASH_SOURCE[0]}"
43
+ while [[ -L "$SCRIPT_SOURCE" ]]; do
44
+ SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
45
+ SCRIPT_TARGET="$(readlink "$SCRIPT_SOURCE")"
46
+ if [[ "$SCRIPT_TARGET" = /* ]]; then
47
+ SCRIPT_SOURCE="$SCRIPT_TARGET"
48
+ else
49
+ SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_TARGET"
50
+ fi
51
+ done
52
+ BIN_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
53
+ PACKAGE_DIR="$(cd "$BIN_DIR/.." && pwd)"
54
+
42
55
  BUN_BIN="$(command -v bun 2>/dev/null || true)"
56
+ if [[ -z "$BUN_BIN" && -x "$PACKAGE_DIR/node_modules/.bin/bun" ]]; then
57
+ BUN_BIN="$PACKAGE_DIR/node_modules/.bin/bun"
58
+ fi
59
+ if [[ -z "$BUN_BIN" && -x "$PACKAGE_DIR/../../.bin/bun" ]]; then
60
+ BUN_BIN="$PACKAGE_DIR/../../.bin/bun"
61
+ fi
43
62
  if [[ -z "$BUN_BIN" && -n "${BUN_INSTALL:-}" && -x "$BUN_INSTALL/bin/bun" ]]; then
44
63
  BUN_BIN="$BUN_INSTALL/bin/bun"
45
64
  fi
@@ -49,20 +68,12 @@ fi
49
68
  if [[ -z "$BUN_BIN" ]]; then
50
69
  printf '%s\n' \
51
70
  'wiki-manager requires Bun >= 1.2.' \
52
- 'Install Bun from https://bun.sh/docs/installation or add it to PATH.' >&2
71
+ 'Reinstall @dotdrelle/wiki-manager or install Bun from https://bun.sh/docs/installation.' >&2
53
72
  exit 127
54
73
  fi
55
74
 
56
- SCRIPT_SOURCE="${BASH_SOURCE[0]}"
57
- while [[ -L "$SCRIPT_SOURCE" ]]; do
58
- SCRIPT_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
59
- SCRIPT_TARGET="$(readlink "$SCRIPT_SOURCE")"
60
- if [[ "$SCRIPT_TARGET" = /* ]]; then
61
- SCRIPT_SOURCE="$SCRIPT_TARGET"
62
- else
63
- SCRIPT_SOURCE="$SCRIPT_DIR/$SCRIPT_TARGET"
64
- fi
65
- done
66
- BIN_DIR="$(cd "$(dirname "$SCRIPT_SOURCE")" && pwd)"
75
+ if [[ ${#ARGS[@]} -eq 0 ]]; then
76
+ exec "$BUN_BIN" "$BIN_DIR/wiki-manager.js"
77
+ fi
67
78
 
68
79
  exec "$BUN_BIN" "$BIN_DIR/wiki-manager.js" "${ARGS[@]}"
@@ -55,7 +55,6 @@ services:
55
55
  - CME_MCP_AUTH_TOKEN
56
56
  - DOCUMENTS_MCP_AUTH_TOKEN
57
57
  - MAILER_MCP_AUTH_TOKEN
58
- - ATLASSIAN_MCP_AUTH_TOKEN
59
58
  - WORKSPACE_NAME
60
59
  - DOCUMENT_INPUT_DIR=/documents/input
61
60
  - DOCUMENT_UPLOADS_DIR=/documents/uploads
@@ -30,12 +30,6 @@
30
30
  "headers": {
31
31
  "Authorization": "Bearer ${MAILER_MCP_AUTH_TOKEN}"
32
32
  }
33
- },
34
- "atlassian": {
35
- "url": "http://host.docker.internal:9000/mcp",
36
- "headers": {
37
- "Authorization": "Bearer ${ATLASSIAN_MCP_AUTH_TOKEN}"
38
- }
39
33
  }
40
34
  }
41
35
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotdrelle/wiki-manager",
3
- "version": "0.12.7",
3
+ "version": "0.12.8",
4
4
  "description": "Agentic shell and orchestration cockpit for llm-wiki workspaces.",
5
5
  "license": "PolyForm-Noncommercial-1.0.0",
6
6
  "author": "dotrelle",
@@ -49,6 +49,7 @@
49
49
  "@langchain/langgraph": "^1.3.2",
50
50
  "@opentui/core": "^0.3.2",
51
51
  "@opentui/solid": "^0.3.2",
52
+ "bun": "^1.3.14",
52
53
  "marked": "^15.0.12",
53
54
  "marked-terminal": "^7.3.0",
54
55
  "openai": "^6.42.0",
@@ -2,7 +2,7 @@ import { readFileSync } from 'node:fs';
2
2
  import { mkdir, writeFile } from 'node:fs/promises';
3
3
  import { dirname, join, resolve } from 'node:path';
4
4
  import { fileURLToPath } from 'node:url';
5
- import { loadManagerEnv } from '../core/env.js';
5
+ import { ensureManagerScaffold, loadManagerEnv } from '../core/env.js';
6
6
  loadManagerEnv();
7
7
  import { createAgentGraph } from '../agent/graph.js';
8
8
  import { handleSlashCommand, printHelp, printVersion, refreshMcpRuntimeStatus } from '../commands/slash.js';
@@ -735,6 +735,8 @@ async function runRuntime(argv, agent) {
735
735
 
736
736
  export async function runCli(argv) {
737
737
  if (argv[0] === 'runtime') {
738
+ const scaffolded = ensureManagerScaffold({ log: (message) => console.log(`[wiki-manager] ${message}`) });
739
+ if (scaffolded.length > 0) loadManagerEnv();
738
740
  const agent = createAgentGraph();
739
741
  await runRuntime(argv.slice(1), agent);
740
742
  return;
@@ -788,6 +790,12 @@ export async function runCli(argv) {
788
790
  throw new Error('Interactive TUI requires Bun. Run: bun ./bin/wiki-manager.js');
789
791
  }
790
792
  const { runOpenTuiShell, runStartupWizard } = await import('../shell/tui.tsx');
793
+ // Fresh directory → copy mcp.endpoints.json/.env from the packaged
794
+ // examples so external agents (cme, mailer, documents) connect out of
795
+ // the box. Done here (and in `runtime`), NOT at import time: --version
796
+ // in a random cwd must not litter files.
797
+ const scaffolded = ensureManagerScaffold({ log: (message) => console.log(`[wiki-manager] ${message}`) });
798
+ if (scaffolded.length > 0) loadManagerEnv();
791
799
  const gaps = await runChecks();
792
800
  if (gaps.length > 0) await runStartupWizard(gaps);
793
801
  let runtime = null;
@@ -1,4 +1,4 @@
1
1
  {
2
- "version": "0.12.7",
3
- "commit": "0bab10f"
2
+ "version": "0.12.8",
3
+ "commit": "eefd59f"
4
4
  }
package/src/core/env.js CHANGED
@@ -1,5 +1,6 @@
1
- import { existsSync, readFileSync } from 'node:fs';
1
+ import { copyFileSync, existsSync, readFileSync } from 'node:fs';
2
2
  import { dirname, isAbsolute, join, resolve } from 'node:path';
3
+ import { fileURLToPath } from 'node:url';
3
4
 
4
5
  export function userManagerDir() {
5
6
  return process.cwd();
@@ -31,6 +32,34 @@ export function managerMcpEndpointsFile() {
31
32
  return join(managerStateDir(), 'mcp.endpoints.json');
32
33
  }
33
34
 
35
+ const packageRoot = resolve(dirname(fileURLToPath(import.meta.url)), '..', '..');
36
+
37
+ // First-run scaffolding: a fresh install directory has neither
38
+ // mcp.endpoints.json nor .env, so the external agents (cme, mailer,
39
+ // documents) silently never connect — /status shows no agents and Donna has
40
+ // no CME tools to configure anything with. Copy the packaged examples so a
41
+ // fresh directory works out of the box with the default agent ports; the
42
+ // user only has to fill in tokens/keys.
43
+ export function ensureManagerScaffold({ log = () => {} } = {}) {
44
+ const created = [];
45
+ const endpointsFile = managerMcpEndpointsFile();
46
+ const endpointsExample = join(packageRoot, 'mcp.endpoints.example.json');
47
+ if (!existsSync(endpointsFile) && existsSync(endpointsExample)) {
48
+ copyFileSync(endpointsExample, endpointsFile);
49
+ created.push('mcp.endpoints.json');
50
+ }
51
+ const envFile = managerEnvFile();
52
+ const envExample = join(packageRoot, '.env.example');
53
+ if (!existsSync(envFile) && existsSync(envExample)) {
54
+ copyFileSync(envExample, envFile);
55
+ created.push('.env');
56
+ }
57
+ if (created.length > 0) {
58
+ log(`scaffold: created ${created.join(' and ')} in ${managerStateDir()} from packaged example(s) — fill in tokens/keys (WIKI_WORKSPACES_DIR, *_MCP_AUTH_TOKEN…) before starting agents.`);
59
+ }
60
+ return created;
61
+ }
62
+
34
63
  // Single source of truth for where `.agents-data` lives, shared by the
35
64
  // manager's own document intake and by the host path it mounts into agent
36
65
  // containers — keeping them in sync avoids the two silently drifting apart.
package/src/core/mcp.js CHANGED
@@ -1,7 +1,7 @@
1
1
  import { existsSync, readFileSync } from 'node:fs';
2
2
  import { managerEnvFile, managerMcpEndpointsFile, readEnvFile } from './env.js';
3
3
 
4
- const WIKI_MANAGER_VERSION = '0.12.7';
4
+ const WIKI_MANAGER_VERSION = '0.12.8';
5
5
 
6
6
  function envValue(key) {
7
7
  const filePath = managerEnvFile();
package/wiki-workspace CHANGED
@@ -228,6 +228,12 @@ agents_compose() {
228
228
  shift
229
229
  fi
230
230
  [[ $# -eq 0 ]] || die "agents up accepts only --pull"
231
+ ensure_agent_tokens
232
+ ensure_endpoints_file
233
+ # The .env may have just been created above — recompute the env-file
234
+ # flag so freshly generated tokens reach the containers on first run.
235
+ compose_env_args=()
236
+ [[ -f "$MANAGER_ENV_FILE" ]] && compose_env_args+=(--env-file "$MANAGER_ENV_FILE")
231
237
  mkdir -p "$agents_data_dir/cme" "$agents_data_dir/documents/input" "$agents_data_dir/documents/output" "$agents_data_dir/documents/uploads"
232
238
  mkdir -p "$workspaces_root"
233
239
  $do_pull && _agents_dc pull
@@ -382,6 +388,33 @@ ensure_runtime_node() {
382
388
  [[ "$major" =~ ^[0-9]+$ && "$major" -ge 22 ]] || die "runtime requires Node.js 22+ for node:sqlite; $node_bin is Node $version"
383
389
  }
384
390
 
391
+ ensure_agent_tokens() {
392
+ # The external agents (cme, documents, mailer) authenticate with tokens
393
+ # from the manager .env — generate any missing one, exactly like the
394
+ # workspace and runtime tokens are generated. Leaving them empty made a
395
+ # fresh install start agents nobody could talk to.
396
+ local key token
397
+ for key in CME_MCP_AUTH_TOKEN DOCUMENTS_MCP_AUTH_TOKEN MAILER_MCP_AUTH_TOKEN; do
398
+ token="$(env_value "$MANAGER_ENV_FILE" "$key" "")"
399
+ if [[ -z "$token" ]]; then
400
+ token="$(generate_token)"
401
+ mkdir -p "$(dirname "$MANAGER_ENV_FILE")"
402
+ set_env_value "$MANAGER_ENV_FILE" "$key" "$token"
403
+ printf 'Generated %s in %s\n' "$key" "$MANAGER_ENV_FILE"
404
+ fi
405
+ done
406
+ }
407
+
408
+ ensure_endpoints_file() {
409
+ # Without mcp.endpoints.json the shell never connects to the agents it
410
+ # just started (and `agents status` refuses to run). Seed it from the
411
+ # packaged example; the \${VAR} placeholders resolve against the .env.
412
+ if [[ ! -f "$MANAGER_ENDPOINTS_FILE" && -f "$ROOT_DIR/mcp.endpoints.example.json" ]]; then
413
+ cp "$ROOT_DIR/mcp.endpoints.example.json" "$MANAGER_ENDPOINTS_FILE"
414
+ printf 'Created %s from packaged example\n' "$MANAGER_ENDPOINTS_FILE"
415
+ fi
416
+ }
417
+
385
418
  ensure_manager_runtime_token() {
386
419
  local token
387
420
  token="$(env_value "$MANAGER_ENV_FILE" WIKI_MANAGER_RUNTIME_TOKEN "")"