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/docs.js

View on GitHub
// Read-only file viewer for clidash.
//
// Surfaces on-disk documents (skills, CLAUDE.md, profile.json, conversations)
// that are NOT ncl resources. Same security posture as the rest of clidash:
// only files matching a configured collection's glob patterns are listable or
// readable; a deny-list blocks secrets; path traversal is impossible because a
// requested path must be a member of the freshly-globbed allow-set.

import { readdirSync, realpathSync } from 'node:fs';
import { join, resolve, sep } from 'node:path';

// Convert one glob segment to an anchored regex. `*` matches any run of
// non-slash chars (so it works both as a whole segment and inside a filename,
// e.g. `CLAUDE*.md`). All other regex metacharacters are escaped.
function segToRegExp(seg) {
  const esc = seg.replace(/[.+^${}()|[\]\\?]/g, '\\$&').replace(/\*/g, '[^/]*');
  return new RegExp('^' + esc + '$');
}

// A path is denied if any of its segments matches any deny glob.
function isDenied(relPath, deny) {
  const segs = relPath.split('/');
  return deny.some((d) => {
    const re = segToRegExp(d);
    return segs.some((s) => re.test(s));
  });
}

// Directed walk: descend only entries matching each successive pattern segment.
function walk(root, rel, segs, depth, out, deny) {
  if (depth >= segs.length) return;
  let entries;
  try {
    entries = readdirSync(join(root, rel), { withFileTypes: true });
  } catch {
    return;
  }
  const re = segToRegExp(segs[depth]);
  const last = depth === segs.length - 1;
  for (const e of entries) {
    if (e.name === '.' || e.name === '..') continue;
    if (!re.test(e.name)) continue;
    const childRel = rel ? `${rel}/${e.name}` : e.name;
    if (isDenied(childRel, deny)) continue;
    if (last) {
      if (e.isFile()) out.add(childRel);
    } else if (e.isDirectory()) {
      walk(root, childRel, segs, depth + 1, out, deny);
    }
  }
}

/**
 * Relative paths under `root` matching any of `patterns`, minus `deny` matches.
 * Sorted, de-duplicated. Patterns use `*` per the segment rules above; no `**`.
 */
export function globFiles(root, patterns, deny = []) {
  const out = new Set();
  for (const pattern of patterns) {
    walk(root, '', pattern.split('/'), 0, out, deny);
  }
  return [...out].sort();
}

/**
 * Human-friendly grouping/label for a relative path.
 * `groups/<g>/...` → group `<g>`; `container/...` → group `shared`.
 */
const CONTAINER_SEGS = new Set(['skills', 'conversations']); // redundant grouping dirs
export function describeFile(relPath) {
  const parts = relPath.split('/');
  if (parts[0] === 'groups' && parts.length > 2) {
    const rest = parts.slice(2).filter((s) => !CONTAINER_SEGS.has(s)).join('/');
    return { group: parts[1], label: `${parts[1]} / ${rest}` };
  }
  if (parts[0] === 'container') {
    const rest = parts.slice(2).filter((s) => !CONTAINER_SEGS.has(s)).join('/');
    return { group: 'shared', label: `shared / ${rest}` };
  }
  return { group: '', label: relPath };
}

/**
 * Validate a requested doc path against a collection and return its absolute
 * path, or throw. A path is allowed only if it is a member of the collection's
 * freshly-globbed allow-set — this single check enforces the patterns, the
 * deny-list, and traversal safety at once.
 */
export function resolveDoc(root, collection, relPath, deny = []) {
  const allowed = new Set(globFiles(root, collection.patterns, deny));
  if (!allowed.has(relPath)) {
    throw new Error(`Path not allowed: ${relPath}`);
  }
  // Defence in depth: the resolved real path must still live under root.
  const abs = resolve(root, relPath);
  const rootReal = realpathSync(root);
  const absReal = realpathSync(abs);
  if (absReal !== rootReal && !absReal.startsWith(rootReal + sep)) {
    throw new Error(`Path not allowed: ${relPath}`);
  }
  return abs;
}
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