clew-code 0.3.2 → 0.3.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (49) hide show
  1. package/README.md +196 -114
  2. package/dist/generated/version.json +1 -1
  3. package/dist/main.js +2963 -3272
  4. package/package.json +5 -5
  5. package/scripts/bun-run.mjs +33 -0
  6. package/scripts/postbuild-inject-macro.mjs +36 -0
  7. package/docs/.nojekyll +0 -0
  8. package/docs/_config.yml +0 -3
  9. package/docs/architecture.html +0 -90
  10. package/docs/assets/clew-agent-loop.png +0 -0
  11. package/docs/assets/clew-general-architecture.png +0 -0
  12. package/docs/assets/clew-mcp-architecture.png +0 -0
  13. package/docs/assets/clew-p2p-swarm.png +0 -0
  14. package/docs/assets/clew.svg +0 -33
  15. package/docs/changelog.html +0 -141
  16. package/docs/cli-reference.html +0 -89
  17. package/docs/commands.html +0 -161
  18. package/docs/configuration.html +0 -85
  19. package/docs/contributing.html +0 -91
  20. package/docs/css/styles.css +0 -545
  21. package/docs/daemon.html +0 -62
  22. package/docs/features/bridge-mode.html +0 -62
  23. package/docs/features/evals.html +0 -58
  24. package/docs/features/searxng-search.html +0 -59
  25. package/docs/features/sentry-setup.html +0 -62
  26. package/docs/generated/providers.html +0 -625
  27. package/docs/generated/tools.html +0 -559
  28. package/docs/index.html +0 -182
  29. package/docs/installation.html +0 -77
  30. package/docs/internals/claude-ai-backend-dependencies.md +0 -278
  31. package/docs/internals/growthbook-ab-testing.html +0 -70
  32. package/docs/internals/hidden-features.html +0 -82
  33. package/docs/internals/long-term-memory-design.md +0 -173
  34. package/docs/js/main.js +0 -438
  35. package/docs/loop.html +0 -69
  36. package/docs/mcp.html +0 -99
  37. package/docs/models.html +0 -81
  38. package/docs/permission-model.html +0 -86
  39. package/docs/personal-profile.html +0 -113
  40. package/docs/plugins.html +0 -84
  41. package/docs/providers.html +0 -625
  42. package/docs/quick-start.html +0 -81
  43. package/docs/research-memory.html +0 -71
  44. package/docs/security.html +0 -71
  45. package/docs/skills.html +0 -67
  46. package/docs/swarm.html +0 -78
  47. package/docs/tools.html +0 -559
  48. package/docs/troubleshooting.html +0 -86
  49. package/docs/voice-mode.html +0 -79
package/docs/js/main.js DELETED
@@ -1,438 +0,0 @@
1
- // Clew Docs — Mobile Nav, Header, Sidebar, TOC, Code Copy
2
- (function () {
3
- 'use strict';
4
-
5
- // ── Root Prefix (for script location detection) ──
6
- var rootPrefix = '';
7
- var scripts = document.getElementsByTagName('script');
8
- for (var i = 0; i < scripts.length; i++) {
9
- var src = scripts[i].getAttribute('src');
10
- if (src && src.indexOf('js/main.js') !== -1) {
11
- rootPrefix = src.replace('js/main.js', '');
12
- break;
13
- }
14
- }
15
-
16
- // ── Header Injection ──
17
- function injectHeader() {
18
- var header = document.querySelector('.header');
19
- if (!header) return;
20
-
21
- var path = window.location.pathname;
22
- var isThai = /\.th\.html$/.test(path);
23
- var isIndex = /\/index(\.th)?\.html$/.test(path) || path === '/' || path.endsWith('/docs/');
24
- var currentPage = path.split('/').pop() || 'index.html';
25
-
26
- var logoHref = isThai ? 'index.th.html' : 'index.html';
27
- var docsHref = isThai ? 'quick-start.th.html' : 'quick-start.html';
28
- var ariaLabel = isThai ? '\u0E40\u0E1B\u0E34\u0E14/\u0E1B\u0E34\u0E14\u0E40\u0E21\u0E19\u0E39' : 'Toggle navigation';
29
-
30
- // Language toggle
31
- var langTarget = isThai
32
- ? currentPage.replace(/\.th\.html$/, '.html')
33
- : currentPage.replace(/\.html$/, '.th.html');
34
- var langLabel = isThai ? 'EN' : '\u0E44\u0E17\u0E22';
35
- // If no .html page exists for the target, just use README
36
- if (isIndex) langTarget = isThai ? 'index.html' : 'index.th.html';
37
-
38
- // Build breadcrumbs from path
39
- var crumbs = [];
40
- var parts = path.replace(/\/$/, '').split('/').filter(Boolean);
41
- if (parts[0] === 'docs') parts.shift(); // remove leading "docs"
42
- if (parts.length > 0) {
43
- var crumbPath = '';
44
- for (var i = 0; i < parts.length; i++) {
45
- crumbPath += (i === 0 ? '' : '/') + parts[i];
46
- var isLast = i === parts.length - 1;
47
- var label = parts[i].replace(/\.th\.html$/, '').replace(/\.html$/, '').replace(/-/g, ' ');
48
- if (isLast) {
49
- crumbs.push('<span class="current">' + label + '</span>');
50
- } else {
51
- crumbs.push('<a href="' + crumbPath + '">' + label + '</a>');
52
- crumbs.push('<span class="sep">/</span>');
53
- }
54
- }
55
- }
56
- var breadcrumbsHtml = crumbs.length > 0
57
- ? '<nav class="header-breadcrumbs">' + crumbs.join('') + '</nav>'
58
- : '';
59
-
60
- header.innerHTML =
61
- '<div class="header-inner">' +
62
- ' <a href="' + logoHref + '" class="logo">Clew</a>' +
63
- breadcrumbsHtml +
64
- ' <div class="header-search">' +
65
- ' <input type="text" id="headerSearchInput" placeholder="' + (isThai ? '\u0E04\u0E49\u0E19\u0E2B\u0E32\u0E40\u0E2D\u0E01\u0E2A\u0E32\u0E23...' : 'Search docs...') + '" autocomplete="off">' +
66
- ' <span class="search-icon">\u2315</span>' +
67
- ' <div class="search-results" id="headerSearchResults"></div>' +
68
- ' </div>' +
69
- ' <nav class="header-nav">' +
70
- ' <a href="' + logoHref + '">' + (isThai ? '\u0E2B\u0E19\u0E49\u0E32\u0E41\u0E23\u0E01' : 'Home') + '</a>' +
71
- ' <a href="' + docsHref + '">' + (isThai ? '\u0E40\u0E2D\u0E01\u0E2A\u0E32\u0E23' : 'Docs') + '</a>' +
72
- ' <a href="https://github.com/JonusNattapong/ClewCode" target="_blank">GitHub</a>' +
73
- ' </nav>' +
74
- ' <button class="lang-toggle" id="langToggle" aria-label="Switch language">' + langLabel + '</button>' +
75
- ' <button class="menu-btn" id="menuToggle" aria-label="' + ariaLabel + '"><span></span><span></span><span></span></button>' +
76
- '</div>';
77
-
78
- // Language toggle
79
- var langToggle = document.getElementById('langToggle');
80
- if (langToggle) {
81
- langToggle.addEventListener('click', function () {
82
- window.location.href = langTarget;
83
- });
84
- }
85
-
86
- // Active nav link
87
- var navLinks = header.querySelectorAll('.header-nav a');
88
- navLinks.forEach(function (link) {
89
- var href = link.getAttribute('href');
90
- if (!href) return;
91
- var hrefPage = href.split('/').pop().split('#')[0] || 'index.html';
92
- if (hrefPage === currentPage) link.classList.add('active');
93
- });
94
- if (!isIndex) {
95
- var docsLink = header.querySelector('.header-nav a[href*="quick-start"]');
96
- if (docsLink) docsLink.classList.add('active');
97
- }
98
-
99
- // Search functionality
100
- initHeaderSearch();
101
- }
102
-
103
- function initHeaderSearch() {
104
- var input = document.getElementById('headerSearchInput');
105
- var results = document.getElementById('headerSearchResults');
106
- if (!input || !results) return;
107
-
108
- // Build search index from sidebar links + TOC headings
109
- var searchIndex = [];
110
- document.querySelectorAll('.sidebar-link').forEach(function (link) {
111
- searchIndex.push({ text: link.textContent.trim(), href: link.getAttribute('href'), type: 'page' });
112
- });
113
- document.querySelectorAll('.content h2, .content h3').forEach(function (h) {
114
- searchIndex.push({ text: h.textContent.trim(), href: '#' + h.id, type: 'section' });
115
- });
116
-
117
- input.addEventListener('input', function () {
118
- var query = this.value.trim().toLowerCase();
119
- results.innerHTML = '';
120
- results.classList.remove('open');
121
- if (query.length < 1) return;
122
-
123
- var matches = [];
124
- for (var i = 0; i < searchIndex.length; i++) {
125
- var item = searchIndex[i];
126
- if (item.text.toLowerCase().indexOf(query) !== -1) {
127
- matches.push(item);
128
- }
129
- }
130
-
131
- if (matches.length === 0) {
132
- results.innerHTML = '<div class="search-empty">No results found</div>';
133
- results.classList.add('open');
134
- return;
135
- }
136
-
137
- for (var j = 0; j < Math.min(matches.length, 8); j++) {
138
- var m = matches[j];
139
- var highlighted = m.text.replace(
140
- new RegExp('(' + query.replace(/[.*+?^${}()|[\]\\]/g, '\\$&') + ')', 'gi'),
141
- '<mark>$1</mark>'
142
- );
143
- results.innerHTML +=
144
- '<a href="' + m.href + '" class="search-result">' +
145
- '<span class="search-type">' + (m.type === 'page' ? '\u{1F4C4}' : '#') + '</span> ' +
146
- highlighted +
147
- '</a>';
148
- }
149
- results.classList.add('open');
150
- });
151
-
152
- // Close on click outside
153
- document.addEventListener('click', function (e) {
154
- if (!input.contains(e.target) && !results.contains(e.target)) {
155
- results.classList.remove('open');
156
- }
157
- });
158
-
159
- // Close on Escape
160
- input.addEventListener('keydown', function (e) {
161
- if (e.key === 'Escape') {
162
- results.classList.remove('open');
163
- input.blur();
164
- }
165
- });
166
- }
167
-
168
- injectHeader();
169
-
170
- // ── Sidebar Injection ──
171
- var sidebar = document.getElementById('sidebar');
172
- if (sidebar) {
173
- sidebar.innerHTML =
174
- '<div class="sidebar-section">' +
175
- ' <div class="sidebar-label">Getting Started</div>' +
176
- ' <nav>' +
177
- ' <a href="' + rootPrefix + 'index.html" class="sidebar-link"><span class="link-icon"></span>Overview</a>' +
178
- ' <a href="' + rootPrefix + 'quick-start.html" class="sidebar-link"><span class="link-icon"></span>Quick Start</a>' +
179
- ' <a href="' + rootPrefix + 'installation.html" class="sidebar-link"><span class="link-icon"></span>Installation</a>' +
180
- ' <a href="' + rootPrefix + 'configuration.html" class="sidebar-link"><span class="link-icon"></span>Configuration</a>' +
181
- ' <a href="' + rootPrefix + 'cli-reference.html" class="sidebar-link"><span class="link-icon"></span>CLI Reference</a>' +
182
- ' <a href="' + rootPrefix + 'troubleshooting.html" class="sidebar-link"><span class="link-icon"></span>Troubleshooting</a>' +
183
- ' </nav>' +
184
- '</div>' +
185
- '<div class="sidebar-section">' +
186
- ' <div class="sidebar-label">Core Concepts</div>' +
187
- ' <nav>' +
188
- ' <a href="' + rootPrefix + 'providers.html" class="sidebar-link"><span class="link-icon"></span>Providers</a>' +
189
- ' <a href="' + rootPrefix + 'models.html" class="sidebar-link"><span class="link-icon"></span>Models</a>' +
190
- ' <a href="' + rootPrefix + 'commands.html" class="sidebar-link"><span class="link-icon"></span>Commands</a>' +
191
- ' <a href="' + rootPrefix + 'tools.html" class="sidebar-link"><span class="link-icon"></span>Tools</a>' +
192
- ' <a href="' + rootPrefix + 'permission-model.html" class="sidebar-link"><span class="link-icon"></span>Permission Model</a>' +
193
- ' <a href="' + rootPrefix + 'personal-profile.html" class="sidebar-link"><span class="link-icon"></span>Personal Profile</a>' +
194
- ' </nav>' +
195
- '</div>' +
196
- '<div class="sidebar-section">' +
197
- ' <div class="sidebar-label">Extending</div>' +
198
- ' <nav>' +
199
- ' <a href="' + rootPrefix + 'plugins.html" class="sidebar-link"><span class="link-icon"></span>Plugins</a>' +
200
- ' <a href="' + rootPrefix + 'skills.html" class="sidebar-link"><span class="link-icon"></span>Skills</a>' +
201
- ' <a href="' + rootPrefix + 'architecture.html" class="sidebar-link"><span class="link-icon"></span>Architecture</a>' +
202
- ' <a href="' + rootPrefix + 'mcp.html" class="sidebar-link"><span class="link-icon"></span>MCP</a>' +
203
- ' </nav>' +
204
- '</div>' +
205
- '<div class="sidebar-section">' +
206
- ' <div class="sidebar-label">Autonomous</div>' +
207
- ' <nav>' +
208
- ' <a href="' + rootPrefix + 'daemon.html" class="sidebar-link"><span class="link-icon"></span>Daemon Mode</a>' +
209
- ' </nav>' +
210
- '</div>' +
211
- '<div class="sidebar-section">' +
212
- ' <div class="sidebar-label">Features</div>' +
213
- ' <nav>' +
214
- ' <a href="' + rootPrefix + 'research-memory.html" class="sidebar-link"><span class="link-icon"></span>Research & Memory</a>' +
215
- ' <a href="' + rootPrefix + 'features/searxng-search.html" class="sidebar-link"><span class="link-icon"></span>SearXNG Search</a>' +
216
- ' <a href="' + rootPrefix + 'features/bridge-mode.html" class="sidebar-link"><span class="link-icon"></span>Bridge Mode</a>' +
217
- ' <a href="' + rootPrefix + 'features/evals.html" class="sidebar-link"><span class="link-icon"></span>Evaluation Harness</a>' +
218
- ' <a href="' + rootPrefix + 'features/sentry-setup.html" class="sidebar-link"><span class="link-icon"></span>Sentry Setup</a>' +
219
- ' <a href="' + rootPrefix + 'voice-mode.html" class="sidebar-link"><span class="link-icon"></span>Voice Mode</a>' +
220
- ' <a href="' + rootPrefix + 'swarm.html" class="sidebar-link"><span class="link-icon"></span>Swarm System</a>' +
221
- ' <a href="' + rootPrefix + 'loop.html" class="sidebar-link"><span class="link-icon"></span>Agent Loop</a>' +
222
- ' </nav>' +
223
- '</div>' +
224
- '<div class="sidebar-section">' +
225
- ' <div class="sidebar-label">Internals</div>' +
226
- ' <nav>' +
227
- ' <a href="' + rootPrefix + 'internals/hidden-features.html" class="sidebar-link"><span class="link-icon"></span>Hidden Features</a>' +
228
- ' <a href="' + rootPrefix + 'internals/growthbook-ab-testing.html" class="sidebar-link"><span class="link-icon"></span>A/B Testing</a>' +
229
- ' </nav>' +
230
- '</div>' +
231
- '<div class="sidebar-section">' +
232
- ' <div class="sidebar-label">Community</div>' +
233
- ' <nav>' +
234
- ' <a href="' + rootPrefix + 'changelog.html" class="sidebar-link"><span class="link-icon"></span>Changelog</a>' +
235
- ' <a href="' + rootPrefix + 'security.html" class="sidebar-link"><span class="link-icon"></span>Security</a>' +
236
- ' <a href="' + rootPrefix + 'contributing.html" class="sidebar-link"><span class="link-icon"></span>Contributing</a>' +
237
- ' </nav>' +
238
- '</div>';
239
- }
240
-
241
- // ── Mobile Nav ──
242
- var menuBtn = document.getElementById('menuToggle');
243
- var overlay = document.getElementById('sidebarOverlay');
244
-
245
- function openSidebar() {
246
- sidebar && sidebar.classList.add('open');
247
- menuBtn && menuBtn.setAttribute('aria-expanded', 'true');
248
- overlay && overlay.classList.add('open');
249
- document.body.style.overflow = 'hidden';
250
- }
251
-
252
- function closeSidebar() {
253
- sidebar && sidebar.classList.remove('open');
254
- menuBtn && menuBtn.setAttribute('aria-expanded', 'false');
255
- overlay && overlay.classList.remove('open');
256
- document.body.style.overflow = '';
257
- }
258
-
259
- if (menuBtn) menuBtn.addEventListener('click', function (e) {
260
- e.stopPropagation();
261
- sidebar && sidebar.classList.contains('open') ? closeSidebar() : openSidebar();
262
- });
263
-
264
- if (overlay) overlay.addEventListener('click', closeSidebar);
265
-
266
- document.addEventListener('keydown', function (e) {
267
- if (e.key === 'Escape' && sidebar && sidebar.classList.contains('open')) closeSidebar();
268
- });
269
-
270
- if (sidebar) {
271
- sidebar.querySelectorAll('.sidebar-link').forEach(function (link) {
272
- link.addEventListener('click', closeSidebar);
273
- });
274
- }
275
-
276
- // ── Active Sidebar Link ──
277
- var currentPath = window.location.pathname;
278
- var currentPage = currentPath.split('/').pop() || 'index.html';
279
- if (currentPage === '') currentPage = 'index.html';
280
-
281
- document.querySelectorAll('.sidebar-link').forEach(function (link) {
282
- var href = link.getAttribute('href');
283
- if (!href) return;
284
- var hrefPage = href.split('/').pop().split('#')[0];
285
- if (hrefPage === currentPage) link.classList.add('active');
286
- });
287
-
288
- // ── Code Copy Buttons ──
289
- function addCopyButtons() {
290
- document.querySelectorAll('.content pre').forEach(function (pre) {
291
- if (pre.parentElement && pre.parentElement.classList.contains('code-block-wrap')) return;
292
-
293
- var wrap = document.createElement('div');
294
- wrap.className = 'code-block-wrap';
295
-
296
- var header = document.createElement('div');
297
- header.className = 'code-block-header';
298
-
299
- var lang = document.createElement('span');
300
- var code = pre.querySelector('code');
301
- var langName = '';
302
- if (code) {
303
- var cls = code.className || '';
304
- var match = cls.match(/language-(\w+)/);
305
- if (match) langName = match[1];
306
- }
307
- lang.textContent = langName || '';
308
- lang.style.textTransform = 'lowercase';
309
-
310
- var btn = document.createElement('button');
311
- btn.className = 'copy-btn';
312
- btn.textContent = 'Copy';
313
- btn.setAttribute('aria-label', 'Copy code to clipboard');
314
-
315
- btn.addEventListener('click', function () {
316
- var text = pre.textContent || '';
317
- text = text.replace(/^\n+|\n+$/g, '');
318
- navigator.clipboard.writeText(text).then(function () {
319
- btn.textContent = 'Copied!';
320
- btn.classList.add('copied');
321
- setTimeout(function () {
322
- btn.textContent = 'Copy';
323
- btn.classList.remove('copied');
324
- }, 2000);
325
- }).catch(function () {
326
- btn.textContent = 'Failed';
327
- setTimeout(function () {
328
- btn.textContent = 'Copy';
329
- }, 2000);
330
- });
331
- });
332
-
333
- header.appendChild(lang);
334
- header.appendChild(btn);
335
-
336
- pre.parentNode.insertBefore(wrap, pre);
337
- wrap.appendChild(header);
338
- wrap.appendChild(pre);
339
- });
340
- }
341
-
342
- addCopyButtons();
343
-
344
- // ── Table Wrapping ──
345
- document.querySelectorAll('.content table').forEach(function (table) {
346
- if (table.parentElement && table.parentElement.classList.contains('table-wrap')) return;
347
- var wrapper = document.createElement('div');
348
- wrapper.className = 'table-wrap';
349
- table.parentNode.insertBefore(wrapper, table);
350
- wrapper.appendChild(table);
351
- });
352
-
353
- // ── TOC Generation ──
354
- function buildTOC() {
355
- var toc = document.querySelector('.toc-sidebar');
356
- if (!toc) return;
357
-
358
- var content = document.querySelector('.content');
359
- if (!content) return;
360
-
361
- var headings = content.querySelectorAll('h2, h3');
362
- if (headings.length < 2) {
363
- toc.style.display = 'none';
364
- return;
365
- }
366
-
367
- var label = document.createElement('div');
368
- label.className = 'toc-label';
369
- label.textContent = 'On this page';
370
- toc.appendChild(label);
371
-
372
- var list = document.createElement('nav');
373
- list.className = 'toc-list';
374
-
375
- var items = [];
376
- headings.forEach(function (h) {
377
- if (!h.id) {
378
- var text = (h.textContent || '')
379
- .toLowerCase()
380
- .replace(/[^a-z0-9\u0E00-\u0E7F]+/g, '-')
381
- .replace(/^-|-$/g, '');
382
- h.id = text || 'section-' + Math.random().toString(36).slice(2, 6);
383
- }
384
-
385
- var link = document.createElement('a');
386
- link.href = '#' + h.id;
387
- link.className = 'toc-link';
388
- if (h.tagName === 'H3') link.classList.add('toc-h3');
389
- link.textContent = h.textContent;
390
-
391
- list.appendChild(link);
392
- items.push({ el: link, id: h.id });
393
- });
394
-
395
- toc.appendChild(list);
396
-
397
- if (typeof IntersectionObserver !== 'undefined' && items.length > 0) {
398
- var observeTargets = [];
399
- headings.forEach(function (h) { observeTargets.push(h); });
400
-
401
- var observer = new IntersectionObserver(function (entries) {
402
- entries.forEach(function (entry) {
403
- if (entry.isIntersecting) {
404
- items.forEach(function (item) {
405
- item.el.classList.toggle('active', item.id === entry.target.id);
406
- });
407
- }
408
- });
409
- }, {
410
- rootMargin: '-64px 0px -60% 0px',
411
- threshold: 0
412
- });
413
-
414
- observeTargets.forEach(function (h) { observer.observe(h); });
415
- }
416
- }
417
-
418
- buildTOC();
419
-
420
- // ── Footer Injection ──
421
- function injectFooter() {
422
- var content = document.querySelector('.content');
423
- if (!content || content.querySelector('.footer')) return;
424
-
425
- var footer = document.createElement('div');
426
- footer.className = 'footer';
427
- footer.innerHTML =
428
- '<span>Clew Code \u2014 GPL-3.0</span>' +
429
- '<div class="footer-links">' +
430
- ' <a href="https://github.com/ClewCode/ClewCode">GitHub</a>' +
431
- ' <a href="https://github.com/ClewCode/ClewCode/issues">Issues</a>' +
432
- ' <a href="https://www.npmjs.com/package/clew-code">npm</a>' +
433
- '</div>';
434
- content.appendChild(footer);
435
- }
436
-
437
- injectFooter();
438
- })();
package/docs/loop.html DELETED
@@ -1,69 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>Agent Loop — Clew Code</title>
7
- <meta name="description" content="24/7 autonomous agent loop for background task execution.">
8
- <link rel="icon" type="image/svg+xml" href="assets/clew.svg">
9
- <link rel="preconnect" href="https://fonts.googleapis.com">
10
- <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
- <link rel="stylesheet" href="css/styles.css">
12
- </head>
13
- <body>
14
- <header class="header"></header>
15
- <div id="sidebarOverlay" class="sidebar-overlay"></div>
16
- <aside id="sidebar" class="sidebar"></aside>
17
-
18
- <div class="content-wrap">
19
- <div class="content">
20
-
21
- <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span class="current">Agent Loop</span></div>
22
-
23
- <h1>Agent Loop</h1>
24
- <p class="sub">Run Clew Code autonomously with a 24/7 background agent loop.</p>
25
-
26
- <h2 id="overview">Overview</h2>
27
- <p>The autonomous agent loop runs Clew Code continuously in the background, processing tasks from a persistent queue. It's ideal for monitoring, scheduled maintenance, automated code review, and recurring development workflows.</p>
28
-
29
- <h2 id="commands">Loop Commands</h2>
30
- <pre><code class="language-bash">❯ /loop start # start the autonomous loop
31
- ❯ /loop stop # stop the loop
32
- ❯ /loop status # check loop status and queue depth
33
- </code></pre>
34
-
35
- <h2 id="loop-skill">Loop Skill</h2>
36
- <p>Use the built-in loop skill to run recurring requests:</p>
37
- <pre><code class="language-bash">❯ /loop 5m /check-status # run /check-status every 5 minutes
38
- ❯ /loop 1h "summarize recent changes"
39
- </code></pre>
40
- <p>Default interval is 10 minutes if not specified.</p>
41
-
42
- <h2 id="task-queue">Task Queue</h2>
43
- <p>The loop integrates with the daemon's persistent task queue:</p>
44
- <ul>
45
- <li><strong>Lease-based concurrency</strong> — up to 3 workers run simultaneously</li>
46
- <li><strong>Exponential backoff</strong> — retries with increasing delays on failure</li>
47
- <li><strong>Dead-letter queue</strong> — failed tasks are stored for later analysis</li>
48
- </ul>
49
-
50
- <h2 id="scheduling">Cron Scheduling</h2>
51
- <p>Schedule recurring tasks with cron expressions:</p>
52
- <pre><code class="language-bash">❯ /task add "0 9 * * 1-5" "weekday morning review"
53
- ❯ /task add "0 0 * * 0" "weekly cleanup"
54
- </code></pre>
55
-
56
- <h2 id="use-cases">Use Cases</h2>
57
- <ul>
58
- <li>Automated code review on schedule</li>
59
- <li>Dependency update checks</li>
60
- <li>Performance monitoring and alerting</li>
61
- <li>Scheduled documentation generation</li>
62
- <li>Automated testing and regression checks</li>
63
- </ul>
64
- </div>
65
- </div>
66
-
67
- <script src="js/main.js"></script>
68
- </body>
69
- </html>
package/docs/mcp.html DELETED
@@ -1,99 +0,0 @@
1
- <!DOCTYPE html>
2
- <html lang="en">
3
- <head>
4
- <meta charset="UTF-8">
5
- <meta name="viewport" content="width=device-width, initial-scale=1.0">
6
- <title>MCP — Clew Code</title>
7
- <meta name="description" href="Model Context Protocol (MCP) integration in Clew Code.">
8
- <link rel="icon" type="image/svg+xml" href="assets/clew.svg">
9
- <link rel="preconnect" href="https://fonts.googleapis.com">
10
- <link href="https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600;700&family=JetBrains+Mono:wght@400;500;600;700&display=swap" rel="stylesheet">
11
- <link rel="stylesheet" href="css/styles.css">
12
- </head>
13
- <body>
14
- <header class="header"></header>
15
- <div id="sidebarOverlay" class="sidebar-overlay"></div>
16
- <aside id="sidebar" class="sidebar"></aside>
17
-
18
- <div class="content-wrap">
19
- <div class="content">
20
-
21
- <div class="breadcrumbs"><a href="index.html">Home</a><span class="sep">/</span><span class="current">MCP</span></div>
22
-
23
- <h1>MCP — Model Context Protocol</h1>
24
- <p class="sub">Connect external tools and data sources via the Model Context Protocol. Clew Code supports stdio, SSE, and DirectConnect transports.</p>
25
-
26
- <h2 id="overview">Overview</h2>
27
- <p>MCP (Model Context Protocol) is an open standard for connecting AI agents with external tools and data sources. Clew Code implements the full MCP specification as both a client and server.</p>
28
-
29
- <h2 id="transports">Transport Types</h2>
30
- <table>
31
- <thead>
32
- <tr><th>Transport</th><th>Description</th></tr>
33
- </thead>
34
- <tbody>
35
- <tr><td>stdio</td><td>Local subprocess — spawns an MCP server as a child process and communicates via stdin/stdout</td></tr>
36
- <tr><td>SSE</td><td>Remote servers with optional OAuth authentication via Server-Sent Events</td></tr>
37
- <tr><td>DirectConnect</td><td>In-process plugin servers — runs MCP servers as plugins within the same process</td></tr>
38
- </tbody>
39
- </table>
40
-
41
- <h2 id="configuration">Configuration</h2>
42
- <p>MCP servers are configured in <code>.mcp.json</code> at the project root:</p>
43
- <pre><code class="language-json">{
44
- "mcpServers": {
45
- "filesystem": {
46
- "command": "npx",
47
- "args": ["-y", "@modelcontextprotocol/server-filesystem", "."]
48
- },
49
- "github": {
50
- "command": "npx",
51
- "args": ["-y", "@modelcontextprotocol/server-github"],
52
- "env": {
53
- "GITHUB_TOKEN": "ghp_..."
54
- }
55
- },
56
- "remote-api": {
57
- "url": "https://my-mcp-server.example.com/sse",
58
- "auth": {
59
- "type": "oauth2"
60
- }
61
- }
62
- }
63
- }
64
- </code></pre>
65
-
66
- <h2 id="commands">MCP Commands</h2>
67
- <pre><code class="language-bash">❯ /mcp list # list connected MCP servers and their tools
68
- ❯ /mcp add # add a new MCP server configuration
69
- ❯ /mcp remove &lt;id&gt; # remove an MCP server
70
- </code></pre>
71
-
72
- <h2 id="cli-tools">CLI MCP Tools</h2>
73
- <p>The built-in MCP tools allow the AI to interact with connected servers:</p>
74
- <table>
75
- <thead>
76
- <tr><th>Tool</th><th>Description</th></tr>
77
- </thead>
78
- <tbody>
79
- <tr><td>ListMcpResourcesTool</td><td>List available resources from connected MCP servers</td></tr>
80
- <tr><td>ReadMcpResourceTool</td><td>Read a specific resource from an MCP server</td></tr>
81
- </tbody>
82
- </table>
83
-
84
- <h2 id="mcp-servers">Example MCP Servers</h2>
85
- <ul>
86
- <li><strong>Filesystem</strong> — safe file access with path restrictions</li>
87
- <li><strong>GitHub</strong> — repository management, PRs, issues</li>
88
- <li><strong>Playwright</strong> — browser automation</li>
89
- <li><strong>Slack</strong> — workspace integration</li>
90
- <li><strong>PostgreSQL</strong> — database schema exploration and queries</li>
91
- <li><strong>Sentry</strong> — error tracking and issue management</li>
92
- </ul>
93
- <p>Browse the <a href="https://github.com/modelcontextprotocol/servers">official MCP server repository</a> for more.</p>
94
- </div>
95
- </div>
96
-
97
- <script src="js/main.js"></script>
98
- </body>
99
- </html>