项目文件夹

文件
wehub-resource-sync bb5c75ce05
Component Security Validation / Security Audit (push) Has been cancelled
Deploy to Cloudflare Pages / deploy (push) Has been cancelled
chore: import upstream snapshot with attribution
2026-07-13 12:38:58 +08:00

1.8 KiB

paths
paths
cli-tool/**
src/**

CLI Tool — Component System

This is the npm package claude-code-templates. A Node.js CLI for installing Claude Code components.

Architecture

  • Entry point: src/index.js
  • Components live in cli-tool/components/{type}/{category}/{name}.md
  • Types: agents, commands, mcps, hooks, settings, skills, loops, templates
  • Loops live at cli-tool/components/loops/{category}/{name}.md (markdown + frontmatter), install to .claude/loops/, and auto-install the components listed in their components: frontmatter field
  • Catalog generated by python scripts/generate_components_json.py

Component Files

  • Format: Markdown with YAML frontmatter
  • Names: kebab-case only (e.g., react-performance-expert.md)
  • No hardcoded secrets, API keys, or absolute paths
  • Include clear description, usage examples, and tags
  • Always validate with the component-reviewer agent before committing

After Adding/Modifying Components

  1. Run python scripts/generate_components_json.py to regenerate catalog
  2. Copy docs/components.json to dashboard/public/components.json
  3. Deploy dashboard

Error Reporting (opt-in)

  • cli-tool/src/error-reporting.js — crash reporting to Sentry, off by default. Requires explicit CCT_ERROR_REPORTING=true from the end user; always respects the existing opt-out flags (CCT_NO_TRACKING, CCT_NO_ANALYTICS, CI), which win over the opt-in.
  • Distinct from tracking-service.js (anonymous usage analytics, on by default) — never conflate the two or default error reporting to on.
  • Wired into the top-level catch in cli-tool/bin/create-claude-config.js.

Testing

npm test          # Run all tests
npm run test:watch

Publishing

Always check npm view claude-code-templates version before publishing to avoid version conflicts.