Skip to content

davila7/claude-code-templates / cli-tool/components/skills/development/pudu-task-telemetry

pudu-task-telemetry

Verified

Measure local AI task latency, token usage, errors and verified outcomes using Pudu AI hardware evidence and installed Ollama models. Use when comparing local task runs, choosing a local model for a bounded subtask, or recording reproducible task telemetry.

scripts/lib/common.mjs

View on GitHub
import { createHash } from 'node:crypto';
import { readFile, stat } from 'node:fs/promises';

export class TaskError extends Error {
  constructor(code, message, exitCode = 2) {
    super(message);
    this.code = code;
    this.exitCode = exitCode;
  }
}
export const fail = (code, message, exitCode) => { throw new TaskError(code, message, exitCode); };
export const hash = value => createHash('sha256').update(typeof value === 'string' || Buffer.isBuffer(value) ? value : JSON.stringify(value)).digest('hex');
export const object = value => value !== null && typeof value === 'object' && !Array.isArray(value);
export function check(condition, message, code = 'invalid_input', exitCode = 2) {
  if (!condition) fail(code, message, exitCode);
}
export function identifier(value, label = 'identifier') {
  check(typeof value === 'string' && /^[a-zA-Z0-9][a-zA-Z0-9._:-]{0,127}$/.test(value), `Invalid ${label}.`);
  return value;
}
export async function inputFile(file, json = true) {
  try {
    check((await stat(file)).size <= 4 * 1024 * 1024, 'Input exceeds 4 MiB.');
    const data = await readFile(file, 'utf8');
    return json ? JSON.parse(data) : data;
  } catch (error) {
    if (error instanceof TaskError) throw error;
    fail('invalid_input', 'Cannot read input file or parse JSON.');
  }
}
export function publicError(error) {
  return error instanceof TaskError
    ? { code: error.code, message: error.message }
    : { code: 'internal_error', message: 'Operation failed; raw diagnostics are omitted to protect local data.' };
}
export const median = values => {
  if (!values.length) return null;
  const sorted = [...values].sort((a, b) => a - b);
  const mid = Math.floor(sorted.length / 2);
  return sorted.length % 2 ? sorted[mid] : (sorted[mid - 1] + sorted[mid]) / 2;
};
slack-gif-creatoranthropics/skillsKnowledge and utilities for creating animated GIFs optimized for Slack. Provides constraints, validation tools, and animation concepts. Use when users request animated GIFs for Slack like "make me a GIF of X doing Y for Slack."Stars: 197kUpdated Claude CodeCodexVerifiedInstall
ponytailDietrichGebert/ponytailLazy senior dev mode for any coding task: the smallest change that fully solves it, and a reply a busy human understands in one read.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailHarvest every shortcut: comment into one debt ledger, so deferrals get tracked instead of forgotten. One-shot report.Stars: 194kUpdated Claude CodeCodexVerifiedInstall
ponytail-debtDietrichGebert/ponytailList every `shortcut:` comment (and older `ponytail:` ones) as a debt ledger. One-shot report, changes nothing. Use for "ponytail debt", "what did ponytail defer", "list the shortcuts", /ponytail-debt.Stars: 194kUpdated Claude CodeCodexVerifiedInstall