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

View on GitHub
// Pluggable parsers for clidash.
//
// discoveryParsers — turn a CLI's "help"-style output into a resource list.
// parseOutput / unwrapPath — turn a CLI's list output into rows.
// All per-CLI knowledge beyond these small functions lives in clidash.config.json.

/**
 * Discovery parsers, keyed by the `discover.parser` name in config.
 * Each receives the raw discovery output and returns
 * [{ name, description, verbs }] for resources that support `list`.
 * They must throw loudly on unrecognized formats — silent empty results
 * would render as silently-stale tabs.
 */
export const discoveryParsers = {
  /**
   * Parses ncl's two-column help format:
   *
   *   Resources:
   *     sessions             Session — the runtime unit. ...
   *                          verbs: list, get
   *   Commands:
   *     help                 ...
   */
  'ncl-help'(text) {
    const lines = String(text).split('\n');
    const start = lines.findIndex((l) => l.trim() === 'Resources:');
    if (start === -1) {
      throw new Error('ncl-help parser: no "Resources:" section in output — format may have changed');
    }
    const resources = [];
    let current = null;
    for (let i = start + 1; i < lines.length; i++) {
      const line = lines[i];
      if (line.trim() === '') continue;
      if (/^\S/.test(line)) break; // next top-level section, e.g. "Commands:"
      const verbsMatch = line.match(/^\s+verbs:\s*(.+)$/);
      if (verbsMatch && current) {
        current.verbs = verbsMatch[1].split(',').map((v) => v.trim()).filter(Boolean);
        continue;
      }
      const resMatch = line.match(/^  (\S+)\s{2,}(\S.*)$/);
      if (resMatch) {
        current = { name: resMatch[1], description: resMatch[2].trim(), verbs: [] };
        resources.push(current);
      }
    }
    return resources.filter((r) => r.verbs.includes('list'));
  },
};

/**
 * Parses a CLI's list output per the config's `output` field.
 * - 'json'      — one JSON document.
 * - 'jsonlines' — one JSON object per line (docker/kubectl style).
 * Thrown errors carry the raw output on `err.raw` so the UI can show it.
 */
export function parseOutput(text, format) {
  if (format === 'json') {
    try {
      return JSON.parse(text);
    } catch (e) {
      const err = new Error(`Invalid JSON output: ${e.message}`);
      err.raw = text;
      throw err;
    }
  }
  if (format === 'jsonlines') {
    const rows = [];
    const lines = String(text).split('\n');
    for (let i = 0; i < lines.length; i++) {
      const line = lines[i].trim();
      if (!line) continue;
      try {
        rows.push(JSON.parse(line));
      } catch (e) {
        const err = new Error(`Invalid JSON on line ${i + 1}: ${e.message}`);
        err.raw = text;
        throw err;
      }
    }
    return rows;
  }
  throw new Error(`Unknown output format: ${format}`);
}

/**
 * Follows a dot-path into a response envelope (e.g. 'data' for ncl's
 * {id, ok, data} frame). No path → value passes through unchanged.
 * Missing path throws — a changed envelope must fail loudly.
 */
export function unwrapPath(value, path) {
  if (!path) return value;
  let cur = value;
  for (const key of path.split('.')) {
    if (cur === null || typeof cur !== 'object' || !(key in cur)) {
      throw new Error(`Unwrap path "${path}" not found in CLI output (missing "${key}")`);
    }
    cur = cur[key];
  }
  return cur;
}
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 CodeCodexUnverifiedInstall
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