@inkobytes/nexus 1.0.0 → 1.0.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.
package/CHANGELOG.md ADDED
@@ -0,0 +1,11 @@
1
+ # Changelog
2
+
3
+ ## 1.0.2 - 2026-06-03
4
+
5
+ - Collapsed large `nexus doctor` Git Privacy floods into grouped per-root summaries with sample paths.
6
+ - Prioritized `CONTINUITY.md` and `memories/` samples first so agent-local issues stay visible.
7
+
8
+ ## 1.0.1 - 2026-06-02
9
+
10
+ - Added colorized `nexus help` output for a more readable CLI experience.
11
+ - Added `nexus completion zsh` so users can load shell completions without extra scripts.
package/README.md CHANGED
@@ -67,6 +67,23 @@ npx @inkobytes/nexus help
67
67
 
68
68
  Requires Node.js 18 or newer.
69
69
 
70
+ ## What's New In 1.0.1
71
+
72
+ - Colorized `nexus help` output for easier scanning in the terminal
73
+ - Built-in `nexus completion zsh` support for shell completions
74
+
75
+ See [CHANGELOG.md](./CHANGELOG.md) for the release summary.
76
+
77
+ ## Shell Experience
78
+
79
+ For better typed-command ergonomics in `zsh`, load Nexus completions:
80
+
81
+ ```bash
82
+ source <(nexus completion zsh)
83
+ ```
84
+
85
+ If you want typed commands themselves to colorize while you type in iTerm, pair that with `zsh-syntax-highlighting`. Nexus provides the completions and colorized CLI output; the live input-line highlighting is handled by your shell.
86
+
70
87
  ## Quick Start
71
88
 
72
89
  In a Git repo:
@@ -149,6 +166,7 @@ Doctor reports grouped issues:
149
166
  - missing Nexus files
150
167
  - package script exfiltration and install-hook risks
151
168
  - package privacy risks for local/private files
169
+ - grouped Git Privacy summaries for tracked private/local trees so large agent folders stay readable
152
170
  - stale nexus locks
153
171
  - missing agent instructions specifically for nexus
154
172
  - missing continuity and memory scaffolds
@@ -198,6 +216,17 @@ nexus dashboard --serve --port 13787
198
216
 
199
217
  The dashboard prints both `127.0.0.1` and local-network URLs when available, then shows repo health, active locks, queue items, recent standup lines, recent release notes, and dirty git files. It uses local files as the source of truth and updates the page through server-sent events. The default port is `13787`; if that port is already in use, Nexus tries `13788`, `13789`, and so on. Passing `--port` uses that exact port.
200
218
 
219
+ ### `nexus completion zsh`
220
+
221
+ Print a zsh completion script for Nexus.
222
+
223
+ ```bash
224
+ nexus completion zsh
225
+ source <(nexus completion zsh)
226
+ ```
227
+
228
+ This gives `zsh` tab-completion for commands like `claim`, `release`, `doctor`, `drill`, and common agent handles such as `@codex` and `@claude`.
229
+
201
230
  ### `nexus ledger [--json]`
202
231
 
203
232
  Show completed task entries from `_NEXUS_LEDGER.md`.
package/bin/nexus.js CHANGED
@@ -5,6 +5,7 @@ import { argv, exit } from 'process';
5
5
  const COMMANDS = {
6
6
  init: () => import('../src/commands/init.js'),
7
7
  doctor: () => import('../src/commands/doctor.js'),
8
+ completion: () => import('../src/commands/completion.js'),
8
9
  checkin: () => import('../src/commands/checkin.js'),
9
10
  checkout: () => import('../src/commands/checkout.js'),
10
11
  claim: () => import('../src/commands/claim.js'),
@@ -24,7 +25,8 @@ const COMMANDS = {
24
25
  help: () => import('../src/commands/help.js'),
25
26
  };
26
27
 
27
- const VERSION = '1.0.0';
28
+ const VERSION = '1.0.1';
29
+ const COLORS = createColors();
28
30
 
29
31
  const args = argv.slice(2);
30
32
  const command = args[0];
@@ -40,8 +42,8 @@ if (command === '--version' || command === '-v') {
40
42
  }
41
43
 
42
44
  if (!COMMANDS[command]) {
43
- console.error(`Unknown command: ${command}`);
44
- console.error(`Run "nexus help" for available commands.`);
45
+ console.error(COLORS.red(`Unknown command: ${command}`));
46
+ console.error(`Run ${COLORS.cyan('nexus help')} for available commands.`);
45
47
  exit(1);
46
48
  }
47
49
 
@@ -54,55 +56,98 @@ try {
54
56
  }
55
57
 
56
58
  function printHelp() {
57
- console.log(`
58
- @inkobytes/nexus v${VERSION}
59
- Multi-agent coordination for shared repositories.
59
+ const commands = [
60
+ ['init', 'Scaffold Nexus files into current repo'],
61
+ ['doctor [--fix] [--json]', 'Check or repair agent protocol files'],
62
+ ['completion zsh', 'Print zsh completion script for nexus'],
63
+ ['checkin <agent>', 'Signal agent presence (heartbeat)'],
64
+ ['checkout [--all] <agent>', 'Signal session end or cleanup'],
65
+ ['claim <path> <agent> "<intent>"', 'Lock a file or directory'],
66
+ ['release <path> "<commit msg>"', 'Unlock, auto-commit, and log'],
67
+ ['standup "<dated message>"', 'Append a validated standup line'],
68
+ ['status', 'Show current blackboard state'],
69
+ ['clean [--stale | <path>]', 'Prune locks (surgical, stale, or nuke)'],
70
+ ['next <agent>', 'Suggest next safe task from queue'],
71
+ ['start [--agent @handle]', 'Orient an agent entering this repo'],
72
+ ['dashboard --serve [--port <port>]', 'Serve live local Nexus dashboard'],
73
+ ['metrics [--json]', 'Summarize commits, releases, and queue cost'],
74
+ ['ledger [--json|backfill]', 'Show or backfill completed task ledger'],
75
+ ['chmod [--list] [--init]', 'Show or set promptCHMOD permissions'],
76
+ ['db <backup|list|restore|schedule>', 'Database backup and recovery'],
77
+ ['drill <list|show|run|report>', 'Inspect or run protocol drills'],
78
+ ['soul [--file <path>] [--status | --remove]', 'Manage local soul overlay in agent files'],
79
+ ['help', 'Show this help'],
80
+ ];
60
81
 
61
- Usage: nexus <command> [options]
82
+ const examples = [
83
+ 'nexus init',
84
+ 'nexus doctor --fix',
85
+ 'nexus doctor --json',
86
+ 'nexus completion zsh',
87
+ 'nexus start',
88
+ 'nexus dashboard --serve',
89
+ 'nexus metrics --json',
90
+ 'nexus ledger backfill',
91
+ 'nexus drill show wrong-repo-push',
92
+ 'nexus claim src/lib/components/login/ @claude "Building login UI"',
93
+ 'nexus release src/lib/components/login/ "feat: login form component"',
94
+ 'nexus standup "2026-06-01 08:38 AM @codex [DONE]: Updated tests"',
95
+ 'nexus clean --stale',
96
+ 'nexus next @claude',
97
+ ];
62
98
 
63
- Commands:
64
- init Scaffold Nexus files into current repo
65
- doctor [--fix] [--json] Check or repair agent protocol files
66
- checkin <agent> Signal agent presence (heartbeat)
67
- checkout [--all] <agent> Signal session end or cleanup
68
- claim <path> <agent> "<intent>" Lock a file or directory
69
- Also accepts --agent and --intent
70
- release <path> "<commit msg>" Unlock, auto-commit, and log
71
- standup "<dated message>" Append a validated standup line
72
- status Show current blackboard state
73
- clean [--stale | <path>] Prune locks (surgical, stale, or nuke)
74
- next <agent> Suggest next safe task from queue
75
- start [--agent @handle] Orient an agent entering this repo
76
- dashboard --serve [--port <port>] Serve live local Nexus dashboard
77
- metrics [--json] Summarize commits, releases, and queue cost
78
- ledger [--json|backfill] Show or backfill completed task ledger
79
- chmod [--list] [--init] Show or set promptCHMOD permissions
80
- db <backup|list|restore|schedule> Database backup and recovery
81
- drill <list|show|run|report> Inspect or run protocol drills
82
- soul [--file <path>] [--status | --remove]
83
- Manage local soul overlay in agent files
84
- help Show this help
99
+ const width = Math.max(...commands.map(([left]) => left.length)) + 2;
100
+ const lines = [
101
+ '',
102
+ COLORS.bold(COLORS.cyan(`@inkobytes/nexus v${VERSION}`)),
103
+ COLORS.dim('Multi-agent coordination for shared repositories.'),
104
+ '',
105
+ COLORS.bold('Usage'),
106
+ ` ${COLORS.cyan('nexus')} ${COLORS.yellow('<command>')} ${COLORS.dim('[options]')}`,
107
+ '',
108
+ COLORS.bold('Commands'),
109
+ ...commands.map(([left, right]) => ` ${COLORS.cyan(left.padEnd(width))}${COLORS.dim(right)}`),
110
+ '',
111
+ COLORS.bold('Examples'),
112
+ ...examples.map((example) => ` ${colorizeInline(example)}`),
113
+ '',
114
+ COLORS.dim('Tip: load zsh completions with `source <(nexus completion zsh)` and pair it with zsh-syntax-highlighting for typed command color.'),
115
+ '',
116
+ ];
85
117
 
86
- Examples:
87
- nexus init
88
- nexus doctor --fix
89
- nexus doctor --json
90
- nexus start
91
- nexus dashboard --serve
92
- nexus metrics
93
- nexus metrics --json
94
- nexus ledger
95
- nexus ledger --json
96
- nexus ledger backfill
97
- nexus drill list
98
- nexus drill show wrong-repo-push
99
- nexus drill run wrong-repo-push
100
- nexus drill report
101
- nexus soul
102
- nexus claim src/lib/components/login/ @claude "Building login UI"
103
- nexus release src/lib/components/login/ "feat: login form component"
104
- nexus standup "2026-06-01 08:38 AM @codex [DONE]: Updated tests"
105
- nexus clean --stale
106
- nexus next @claude
107
- `);
118
+ console.log(lines.join('\n'));
119
+ }
120
+
121
+ function colorizeInline(value) {
122
+ return String(value)
123
+ .split(/(\s+)/)
124
+ .map((part, index) => {
125
+ if (/^\s+$/.test(part)) return part;
126
+ if (index === 0 && part === 'nexus') return COLORS.cyan(part);
127
+ if (part.startsWith('--')) return COLORS.blue(part);
128
+ if (part.startsWith('@')) return COLORS.green(part);
129
+ if (part.startsWith('"') || part.endsWith('"')) return COLORS.yellow(part);
130
+ return part;
131
+ })
132
+ .join('');
133
+ }
134
+
135
+ function createColors() {
136
+ const enabled = supportsColor();
137
+ const wrap = (open, close) => (value) => enabled ? `\u001b[${open}m${value}\u001b[${close}m` : String(value);
138
+ return {
139
+ bold: wrap(1, 22),
140
+ dim: wrap(2, 22),
141
+ red: wrap(31, 39),
142
+ green: wrap(32, 39),
143
+ yellow: wrap(33, 39),
144
+ blue: wrap(34, 39),
145
+ cyan: wrap(36, 39),
146
+ };
147
+ }
148
+
149
+ function supportsColor() {
150
+ if (process.env.FORCE_COLOR && process.env.FORCE_COLOR !== '0') return true;
151
+ if ('NO_COLOR' in process.env) return false;
152
+ return Boolean(process.stdout && process.stdout.isTTY);
108
153
  }
@@ -50,115 +50,97 @@
50
50
  <div class="docs-layout">
51
51
  <section class="docs-main">
52
52
  <h2><span data-icon="file-text"></span>Commands</h2>
53
- <div class="command-list">
54
- <article class="command-card" id="checkin">
55
- <h3><code>nexus checkin &lt;agent&gt;</code></h3>
56
- <p>Writes an agent heartbeat so the dashboard can show online, idle, or offline presence.</p>
57
- </article>
58
- <article class="command-card" id="checkout">
59
- <h3><code>nexus checkout [--all] &lt;agent&gt;</code></h3>
60
- <p>Marks an agent session as ended, or clears all presence records during emergency cleanup.</p>
61
- </article>
62
- <article class="command-card" id="chmod">
63
- <h3><code>nexus chmod [--list] [--init]</code></h3>
64
- <p>Shows or initializes promptCHMOD permissions for agent-safe file access conventions.</p>
65
- </article>
66
- <article class="command-card" id="claim">
67
- <h3><code>nexus claim &lt;path&gt; &lt;agent&gt; "&lt;intent&gt;"</code></h3>
68
- <p>Locks a file or directory before edits so other agents can see ownership and intent. Also accepts <code>--agent &lt;agent&gt;</code> and <code>--intent "&lt;intent&gt;"</code>. Warns when agent, intent, or model metadata is missing.</p>
69
- </article>
70
- <article class="command-card" id="clean">
71
- <h3><code>nexus clean [--stale | &lt;path&gt;]</code></h3>
72
- <p>Prunes locks surgically, by stale age, or by explicit target when cleanup is needed.</p>
73
- </article>
74
- <article class="command-card" id="dashboard">
75
- <h3><code>nexus dashboard --serve [--port &lt;port&gt;]</code></h3>
76
- <p>Serves the local dashboard with claims, queue state, metrics, ledger history, and report views.</p>
77
- </article>
78
- <article class="command-card" id="db">
79
- <h3><code>nexus db &lt;backup|list|restore|schedule&gt;</code></h3>
80
- <p>Runs database backup and recovery helpers for repo-local protection workflows.</p>
81
- </article>
82
- <article class="command-card" id="doctor">
83
- <h3><code>nexus doctor [--fix] [--json]</code></h3>
84
- <p>Checks protocol files, private-path safety, and repo health; can repair known protocol drift.</p>
85
- </article>
86
- <article class="command-card" id="drill">
87
- <h3><code>nexus drill &lt;list|show|run|report&gt;</code></h3>
88
- <p>Inspects or runs protocol drills and summarizes the latest drill results.</p>
89
- </article>
90
- <article class="command-card" id="help">
91
- <h3><code>nexus help</code></h3>
92
- <p>Prints the CLI command list, examples, and usage syntax.</p>
93
- </article>
94
- <article class="command-card" id="init">
95
- <h3><code>nexus init</code></h3>
96
- <p>Scaffolds Nexus coordination files into the current repository.</p>
97
- </article>
98
- <article class="command-card" id="ledger">
99
- <h3><code>nexus ledger [--json|backfill]</code></h3>
100
- <p>Shows or backfills the completed-task ledger that powers dashboard history and charts.</p>
101
- </article>
102
- <article class="command-card" id="metrics">
103
- <h3><code>nexus metrics [--json]</code></h3>
104
- <p>Summarizes commits, release activity, queue cost, and agent attribution.</p>
105
- </article>
106
- <article class="command-card" id="next">
107
- <h3><code>nexus next &lt;agent&gt;</code></h3>
108
- <p>Suggests the next safe ready task for an agent from the queue.</p>
109
- </article>
110
- <article class="command-card" id="release">
111
- <h3><code>nexus release &lt;path&gt; "&lt;commit msg&gt;"</code></h3>
112
- <p>Releases a claim, stages and commits the target, and appends a Nexus report receipt.</p>
113
- </article>
114
- <article class="command-card" id="soul">
115
- <h3><code>nexus soul [--file &lt;path&gt;] [--status | --remove]</code></h3>
116
- <p>Manages local soul overlays in agent files without making them part of public docs.</p>
117
- </article>
118
- <article class="command-card" id="standup">
119
- <h3><code>nexus standup "YYYY-MM-DD HH:MM AM/PM @agent [STATUS]: message"</code></h3>
120
- <p>Appends a standup line only after validating the agent handle, date/time, status, and message.</p>
121
- </article>
122
- <article class="command-card" id="start">
123
- <h3><code>nexus start [--agent @handle]</code></h3>
124
- <p>Orients an entering agent with repo facts, scoped memory paths, locks, and current status.</p>
125
- </article>
126
- <article class="command-card" id="status">
127
- <h3><code>nexus status</code></h3>
128
- <p>Shows the current Nexus blackboard state, active locks, and coordination context.</p>
129
- </article>
130
- </div>
53
+ <div id="command-list" class="command-list"></div>
131
54
  </section>
132
55
 
133
56
  <aside class="docs-toc" aria-label="Command table of contents">
134
57
  <h2><span data-icon="list-checks"></span>Commands</h2>
135
- <nav>
136
- <a href="#checkin">checkin</a>
137
- <a href="#checkout">checkout</a>
138
- <a href="#chmod">chmod</a>
139
- <a href="#claim">claim</a>
140
- <a href="#clean">clean</a>
141
- <a href="#dashboard">dashboard</a>
142
- <a href="#db">db</a>
143
- <a href="#doctor">doctor</a>
144
- <a href="#drill">drill</a>
145
- <a href="#help">help</a>
146
- <a href="#init">init</a>
147
- <a href="#ledger">ledger</a>
148
- <a href="#metrics">metrics</a>
149
- <a href="#next">next</a>
150
- <a href="#release">release</a>
151
- <a href="#soul">soul</a>
152
- <a href="#standup">standup</a>
153
- <a href="#start">start</a>
154
- <a href="#status">status</a>
155
- </nav>
58
+ <nav id="docs-toc-nav"></nav>
156
59
  </aside>
157
60
  </div>
158
61
  </main>
159
62
  </div>
160
63
 
161
64
  <script>
65
+ const COMMANDS = [
66
+ { id: 'checkin', name: 'checkin', syntax: 'nexus checkin <agent>', summary: 'Writes an agent heartbeat so the dashboard can show online, idle, or offline presence.', example: 'nexus checkin @codex', tags: ['presence', 'heartbeat'] },
67
+ { id: 'checkout', name: 'checkout', syntax: 'nexus checkout [--all] <agent>', summary: 'Marks an agent session as ended, or clears all presence records during emergency cleanup.', example: 'nexus checkout @codex', tags: ['presence', 'cleanup'] },
68
+ { id: 'chmod', name: 'chmod', syntax: 'nexus chmod [--list] [--init]', summary: 'Shows or initializes promptCHMOD permissions for agent-safe file access conventions.', example: 'nexus chmod --list', tags: ['permissions', 'setup'] },
69
+ { id: 'completion', name: 'completion', syntax: 'nexus completion zsh', summary: 'Prints a zsh completion script so Nexus commands and agent handles tab-complete in your shell.', example: 'source <(nexus completion zsh)', tags: ['shell', 'completion'] },
70
+ { id: 'claim', name: 'claim', syntax: 'nexus claim <path> <agent> "<intent>"', summary: 'Locks a file or directory before edits so other agents can see ownership and intent. Also accepts --agent and --intent.', example: 'nexus claim src/commands/dashboard.js @codex "Polish report chart UI"', tags: ['lock', 'ownership', 'before editing'] },
71
+ { id: 'clean', name: 'clean', syntax: 'nexus clean [--stale | <path>]', summary: 'Prunes locks surgically, by stale age, or by explicit target when cleanup is needed.', example: 'nexus clean --stale', tags: ['locks', 'cleanup'] },
72
+ { id: 'dashboard', name: 'dashboard', syntax: 'nexus dashboard --serve [--port <port>]', summary: 'Serves the local dashboard with claims, queue state, metrics, ledger history, and report views.', example: 'nexus dashboard --serve --port 13787', tags: ['dashboard', 'local UI'] },
73
+ { id: 'db', name: 'db', syntax: 'nexus db <backup|list|restore|schedule>', summary: 'Runs database backup and recovery helpers for repo-local protection workflows.', example: 'nexus db backup', tags: ['database', 'safety'] },
74
+ { id: 'doctor', name: 'doctor', syntax: 'nexus doctor [--fix] [--json]', summary: 'Checks protocol files, private-path safety, and repo health; can repair known protocol drift.', example: 'nexus doctor --fix', tags: ['health', 'repair'] },
75
+ { id: 'drill', name: 'drill', syntax: 'nexus drill <list|show|run|report>', summary: 'Inspects or runs protocol drills and summarizes the latest drill results.', example: 'nexus drill show wrong-repo-push', tags: ['guidance', 'playbooks'] },
76
+ { id: 'help', name: 'help', syntax: 'nexus help', summary: 'Prints the CLI command list, examples, and usage syntax.', example: 'nexus help', tags: ['reference'] },
77
+ { id: 'init', name: 'init', syntax: 'nexus init', summary: 'Scaffolds Nexus coordination files into the current repository.', example: 'nexus init', tags: ['setup'] },
78
+ { id: 'ledger', name: 'ledger', syntax: 'nexus ledger [--json|backfill]', summary: 'Shows or backfills the completed-task ledger that powers dashboard history and charts.', example: 'nexus ledger backfill', tags: ['history', 'analytics'] },
79
+ { id: 'metrics', name: 'metrics', syntax: 'nexus metrics [--json]', summary: 'Summarizes commits, release activity, queue cost, and agent attribution.', example: 'nexus metrics --json', tags: ['metrics', 'reporting'] },
80
+ { id: 'next', name: 'next', syntax: 'nexus next <agent>', summary: 'Suggests the next safe ready task for an agent from the queue.', example: 'nexus next @codex', tags: ['queue', 'routing'] },
81
+ { id: 'release', name: 'release', syntax: 'nexus release <path> "<commit msg>"', summary: 'Releases a claim, stages and commits the target, and appends a Nexus report receipt.', example: 'nexus release src/commands/dashboard.js "feat: improve docs command cards"', tags: ['release', 'commit'] },
82
+ { id: 'soul', name: 'soul', syntax: 'nexus soul [--file <path>] [--status | --remove]', summary: 'Manages local soul overlays in agent files without making them part of public docs.', example: 'nexus soul --status', tags: ['local-only', 'agent files'] },
83
+ { id: 'standup', name: 'standup', syntax: 'nexus standup "YYYY-MM-DD HH:MM AM/PM @agent [STATUS]: message"', summary: 'Appends a standup line only after validating the agent handle, date/time, status, and message.', example: 'nexus standup "2026-06-01 08:38 AM @codex [DONE]: Updated tests"', tags: ['comms', 'validated format'] },
84
+ { id: 'start', name: 'start', syntax: 'nexus start [--agent @handle]', summary: 'Orients an entering agent with repo facts, scoped memory paths, locks, and current status.', example: 'nexus start --agent @codex', tags: ['onboarding', 'context'] },
85
+ { id: 'status', name: 'status', syntax: 'nexus status', summary: 'Shows the current Nexus blackboard state, active locks, and coordination context.', example: 'nexus status', tags: ['snapshot'] },
86
+ ];
87
+
88
+ function renderDocs() {
89
+ document.getElementById('command-list').innerHTML = COMMANDS.map(renderCommandCard).join('');
90
+ document.getElementById('docs-toc-nav').innerHTML = COMMANDS.map((command) =>
91
+ '<a href="#' + command.id + '">' + command.name + '</a>'
92
+ ).join('');
93
+ }
94
+
95
+ function renderCommandCard(command) {
96
+ return '<article class="command-card" id="' + command.id + '">'
97
+ + '<div class="command-card-top">'
98
+ + '<div class="command-name">' + escapeHtml(command.name) + '</div>'
99
+ + '<div class="command-tags">' + command.tags.map(renderTag).join('') + '</div>'
100
+ + '</div>'
101
+ + '<h3>' + renderCommandSyntax(command.syntax) + '</h3>'
102
+ + '<p>' + escapeHtml(command.summary) + '</p>'
103
+ + '<div class="command-example-label">Example</div>'
104
+ + '<pre class="command-example"><code>' + renderCommandSyntax(command.example) + '</code></pre>'
105
+ + '</article>';
106
+ }
107
+
108
+ function renderTag(tag) {
109
+ return '<span class="command-tag">' + escapeHtml(tag) + '</span>';
110
+ }
111
+
112
+ function renderCommandSyntax(value) {
113
+ const pattern = /(".*?"|--[a-z-]+|@[a-z0-9_-]+|<[^>]+>|\[[^\]]+\]|\bnexus\b)/gi;
114
+ let html = '';
115
+ let cursor = 0;
116
+ const source = String(value || '');
117
+
118
+ for (const match of source.matchAll(pattern)) {
119
+ const token = match[0];
120
+ const index = match.index || 0;
121
+ if (index > cursor) html += escapeHtml(source.slice(cursor, index));
122
+ html += wrapCommandToken(token);
123
+ cursor = index + token.length;
124
+ }
125
+
126
+ if (cursor < source.length) html += escapeHtml(source.slice(cursor));
127
+ return html;
128
+ }
129
+
130
+ function wrapCommandToken(token) {
131
+ const escaped = escapeHtml(token);
132
+ if (token === 'nexus') return '<span class="token-cli">' + escaped + '</span>';
133
+ if (token.startsWith('--')) return '<span class="token-flag">' + escaped + '</span>';
134
+ if (token.startsWith('@')) return '<span class="token-agent">' + escaped + '</span>';
135
+ if (token.startsWith('"')) return '<span class="token-string">' + escaped + '</span>';
136
+ if (token.startsWith('<') || token.startsWith('[')) return '<span class="token-arg">' + escaped + '</span>';
137
+ return escaped;
138
+ }
139
+
140
+ function escapeHtml(value) {
141
+ return String(value).replace(/[&<>"']/g, c => ({ '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }[c]));
142
+ }
143
+
162
144
  function renderIcons() {
163
145
  const icons = {
164
146
  activity: '<polyline points="22 12 18 12 15 21 9 3 6 12 2 12"></polyline>',
@@ -177,6 +159,7 @@
177
159
  node.innerHTML = '<svg class="icon" viewBox="0 0 24 24" aria-hidden="true">' + (icons[name] || '') + '</svg>';
178
160
  });
179
161
  }
162
+ renderDocs();
180
163
  renderIcons();
181
164
  </script>
182
165
  </body>