Skip to content

nanocoai/nanoclaw / .claude/skills/add-clidash

add-clidash

Unverified

Add clidash — a zero-dependency, read-only web dashboard that derives its tabs and tables at runtime from any CLI that lists resources as JSON. Ships pre-wired for NanoClaw's ncl CLI (agent groups, sessions, channels, users, roles), plus message-activity charts, a log tail, and a read-only file viewer for group skills/CLAUDE.md/profiles.

FileKindSize
REMOVE.mdmarkdown544 B
SKILL.mdskill md6.3 KB
add/tools/clidash/README.mdmarkdown4.0 KB
add/tools/clidash/activity.jsscript3.5 KB
add/tools/clidash/clidash.config.example.jsonconfig3.3 KB
add/tools/clidash/docs.jsscript3.7 KB
add/tools/clidash/logs.jsscript667 B
add/tools/clidash/package.jsonmanifest347 B
add/tools/clidash/parsers.jsscript3.3 KB
add/tools/clidash/public/app.jsscript32.6 KB
add/tools/clidash/public/apple-touch-icon.pngbinary5.3 KB
add/tools/clidash/public/favicon.icobinary547 B
add/tools/clidash/public/favicon.svgother570 B
add/tools/clidash/public/icon-192.pngbinary6.5 KB
add/tools/clidash/public/icon-512.pngbinary18.5 KB
add/tools/clidash/public/index.htmlother1.9 KB
add/tools/clidash/public/md.jsscript2.7 KB
add/tools/clidash/public/site.webmanifestother298 B
add/tools/clidash/public/style.cssother18.0 KB
add/tools/clidash/server.jsscript17.2 KB
add/tools/clidash/test/activity-server.test.jsscript2.3 KB
add/tools/clidash/test/activity.test.jsscript3.8 KB
add/tools/clidash/test/cmd.test.jsscript3.4 KB
add/tools/clidash/test/css.test.jsscript991 B
add/tools/clidash/test/docs-server.test.jsscript4.0 KB
add/tools/clidash/test/docs.test.jsscript4.4 KB
add/tools/clidash/test/fixtures/ncl-help.txtmarkdown4.1 KB
add/tools/clidash/test/fixtures/stub-cli.jsscript1.8 KB
add/tools/clidash/test/help.test.jsscript2.2 KB
add/tools/clidash/test/logs.test.jsscript2.9 KB
add/tools/clidash/test/md.test.jsscript2.9 KB
add/tools/clidash/test/ncl-overview.test.jsscript3.5 KB
add/tools/clidash/test/parsers.test.jsscript4.0 KB
add/tools/clidash/test/server.test.jsscript8.9 KB
add/tools/clidash/test/smoke.shexecutablescript747 B
add/tools/clidash/views/ncl-overview.jsscript1.9 KB

add/tools/clidash/test/activity.test.js

View on GitHub
import { test, before, after } from 'node:test';
import assert from 'node:assert/strict';
import { mkdtempSync, mkdirSync, rmSync } from 'node:fs';
import { tmpdir } from 'node:os';
import { join } from 'node:path';
import { DatabaseSync } from 'node:sqlite';
import { collectActivity } from '../activity.js';

let root;
const NOW = new Date('2026-06-14T12:00:00Z');

function makeDb(path, table, timestamps) {
  const db = new DatabaseSync(path);
  db.exec(`CREATE TABLE ${table} (id TEXT, timestamp TEXT)`);
  const ins = db.prepare(`INSERT INTO ${table} (id, timestamp) VALUES (?, ?)`);
  timestamps.forEach((t, i) => ins.run(String(i), t));
  db.close();
}

before(() => {
  root = mkdtempSync(join(tmpdir(), 'clidash-act-'));
  // session 1 (group ag-1): 3 inbound across 2 days, 2 outbound today
  mkdirSync(join(root, 'ag-1', 'sess-1'), { recursive: true });
  makeDb(join(root, 'ag-1', 'sess-1', 'inbound.db'), 'messages_in',
    ['2026-06-14 09:01:23', '2026-06-14 10:00:00', '2026-06-13 08:00:00']);
  makeDb(join(root, 'ag-1', 'sess-1', 'outbound.db'), 'messages_out',
    ['2026-06-14 09:05:00', '2026-06-14 10:05:00']);
  // session 2 (group ag-2): 1 inbound 20 days ago (outside 14d window), 0 outbound
  mkdirSync(join(root, 'ag-2', 'sess-2'), { recursive: true });
  makeDb(join(root, 'ag-2', 'sess-2', 'inbound.db'), 'messages_in', ['2026-05-25 08:00:00']);
  makeDb(join(root, 'ag-2', 'sess-2', 'outbound.db'), 'messages_out', []);
});

after(() => rmSync(root, { recursive: true, force: true }));

test('collectActivity: per-session in/out totals + last activity', () => {
  const { sessions } = collectActivity(root, 14, NOW);
  const s1 = sessions.find((s) => s.session_id === 'sess-1');
  assert.equal(s1.agent_group_id, 'ag-1');
  assert.equal(s1.in, 3);
  assert.equal(s1.out, 2);
  assert.equal(s1.lastActivity, '2026-06-14T10:05:00Z'); // normalized to ISO
  const s2 = sessions.find((s) => s.session_id === 'sess-2');
  assert.equal(s2.in, 1);
  assert.equal(s2.out, 0);
});

// Buckets are LOCAL calendar days — derive expectations with the same
// mapping so the assertions hold in any machine timezone.
const day = (t) => new Date(t).toLocaleDateString('sv-SE');

test('collectActivity: series has one bucket per day for `days`, newest last', () => {
  const { series } = collectActivity(root, 14, NOW);
  assert.equal(series.length, 14);
  assert.equal(series[0].date, day(new Date(NOW.getTime() - 13 * 86_400_000)));
  assert.equal(series[13].date, day(NOW));
});

test('collectActivity: counts land in the right day buckets', () => {
  const { series } = collectActivity(root, 14, NOW);
  const byDate = Object.fromEntries(series.map((d) => [d.date, d]));
  const expIn = {};
  const expOut = {};
  for (const t of ['2026-06-14T09:01:23Z', '2026-06-14T10:00:00Z', '2026-06-13T08:00:00Z']) {
    expIn[day(t)] = (expIn[day(t)] ?? 0) + 1;
  }
  for (const t of ['2026-06-14T09:05:00Z', '2026-06-14T10:05:00Z']) {
    expOut[day(t)] = (expOut[day(t)] ?? 0) + 1;
  }
  for (const [d, n] of Object.entries(expIn)) assert.equal(byDate[d].in, n);
  for (const [d, n] of Object.entries(expOut)) assert.equal(byDate[d].out, n);
});

test('collectActivity: messages outside the window are counted in totals but not the series', () => {
  const { series, sessions } = collectActivity(root, 14, NOW);
  const total = series.reduce((a, d) => a + d.in + d.out, 0);
  assert.equal(total, 5);              // the 20-day-old message is excluded from series
  assert.equal(sessions.find((s) => s.session_id === 'sess-2').in, 1); // but still in the total count
});

test('collectActivity: a dir with no message DBs is not a session (skipped)', () => {
  mkdirSync(join(root, 'ag-1', '.claude-shared'), { recursive: true }); // scaffolding, no db files
  const { sessions } = collectActivity(root, 14, NOW);
  assert.ok(!sessions.some((s) => s.session_id === '.claude-shared'));
});
reverse-engineer-anythingmorluto/reaReverse engineer native, managed, Electron/JavaScript, packaged, firmware, and browser targets with REA, and build agent environments (AgentEnv bundles) of web applications from a live instance or a capture, and of Linux desktop apps with a task from a request. Use shipped-artifact or requested runtime evidence to explain features, compare versions, decompile code, or guide a reconstruction. Skip REA for ordinary source-repository architecture analysis.Stars: 472kUpdated Claude CodeCodexVerifiedInstall
diagnosing-superpowersobra/superpowersUse when a superpowers session went wrong and your human partner wants to know why — repeated work, ignored plans, stumbles, poor results, a skill that didn't fire, "it took too long", "why is it so expensive", "what is it doing" — or wants to build a bug report for the superpowers maintainers, for the current session or a past one identified by id or path, on any harness.Stars: 322kUpdated Claude CodeCodexVerifiedInstall
dispatching-parallel-agentsobra/superpowersUse when facing 2+ independent tasks that can be worked on without shared state or sequential dependenciesStars: 322kUpdated Claude CodeCodexVerifiedInstall
executing-plansobra/superpowersUse when executing an implementation plan in the current session as the implementer yourself — your human partner chose inline execution, or no subagent tool is availableStars: 322kUpdated Claude CodeCodexVerifiedInstall