nemonix-cli 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE +21 -0
- package/README.md +186 -0
- package/dist/cli.js +6870 -0
- package/package.json +48 -0
- package/src/config/claude-code-config/.claude/commands/setup-tmux.md +0 -0
- package/src/config/claude-code-config/CHANGELOG.md +261 -0
- package/src/config/claude-code-config/README.md +1 -0
- package/src/config/claude-code-config/agents/action.md +36 -0
- package/src/config/claude-code-config/agents/clean-code-runner.md +61 -0
- package/src/config/claude-code-config/agents/code-reviewer.md +172 -0
- package/src/config/claude-code-config/agents/code-simplifier.md +49 -0
- package/src/config/claude-code-config/agents/explore-codebase.md +65 -0
- package/src/config/claude-code-config/agents/explore-docs.md +65 -0
- package/src/config/claude-code-config/agents/explore-fast.md +22 -0
- package/src/config/claude-code-config/agents/implementer.md +181 -0
- package/src/config/claude-code-config/agents/snipper.md +36 -0
- package/src/config/claude-code-config/agents/websearch.md +42 -0
- package/src/config/claude-code-config/commands/prompts/create-vitejs-app.md +272 -0
- package/src/config/claude-code-config/commands/prompts/nextjs-add-prisma-db.md +136 -0
- package/src/config/claude-code-config/commands/prompts/nextjs-setup-better-auth.md +173 -0
- package/src/config/claude-code-config/commands/prompts/nextjs-setup-project.md +200 -0
- package/src/config/claude-code-config/commands/prompts/prompt.md +55 -0
- package/src/config/claude-code-config/commands/prompts/saas-challenge-idea.md +135 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-architecture.md +242 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-headline.md +132 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-landing-copywritting.md +267 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-legals-docs.md +176 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-logos.md +240 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-prd.md +195 -0
- package/src/config/claude-code-config/commands/prompts/saas-create-tasks.md +240 -0
- package/src/config/claude-code-config/commands/prompts/saas-define-pricing.md +293 -0
- package/src/config/claude-code-config/commands/prompts/saas-find-domain-name.md +190 -0
- package/src/config/claude-code-config/commands/prompts/saas-implement-landing-page.md +257 -0
- package/src/config/claude-code-config/commands/prompts/setup-tmux.md +160 -0
- package/src/config/claude-code-config/commands/prompts/tools.md +148 -0
- package/src/config/claude-code-config/hooks/hook-post-file.ts +162 -0
- package/src/config/claude-code-config/scripts/.claude/skills/fix-on-my-computer/SKILL.md +81 -0
- package/src/config/claude-code-config/scripts/CLAUDE.md +50 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/CLAUDE.md +59 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/__tests__/shared.test.ts +185 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/__tests__/title-generation.test.ts +44 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/fixtures/sample-transcript.jsonl +3 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/fixtures/transcript-short-message.jsonl +2 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/fixtures/transcript-with-title.jsonl +3 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/src/index.ts +113 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/src/rename-all.ts +148 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/src/shared.ts +157 -0
- package/src/config/claude-code-config/scripts/auto-rename-session/src/worker.ts +58 -0
- package/src/config/claude-code-config/scripts/biome.json +37 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/CLAUDE.md +84 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/__tests__/claude.test.ts +19 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/__tests__/paths.test.ts +68 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/claude.ts +56 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/cli.ts +46 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/helper/credentials.ts +76 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/helper/index.ts +9 -0
- package/src/config/claude-code-config/scripts/claude-code-ai/helper/paths.ts +51 -0
- package/src/config/claude-code-config/scripts/command-validator/CLAUDE.md +112 -0
- package/src/config/claude-code-config/scripts/command-validator/README.md +147 -0
- package/src/config/claude-code-config/scripts/command-validator/src/__tests__/validator.test.ts +99 -0
- package/src/config/claude-code-config/scripts/command-validator/src/cli.ts +121 -0
- package/src/config/claude-code-config/scripts/command-validator/src/lib/security-rules.ts +174 -0
- package/src/config/claude-code-config/scripts/command-validator/src/lib/types.ts +34 -0
- package/src/config/claude-code-config/scripts/command-validator/src/lib/validator.ts +90 -0
- package/src/config/claude-code-config/scripts/package.json +43 -0
- package/src/config/claude-code-config/scripts/statusline/CLAUDE.md +205 -0
- package/src/config/claude-code-config/scripts/statusline/README.md +193 -0
- package/src/config/claude-code-config/scripts/statusline/__tests__/context.test.ts +229 -0
- package/src/config/claude-code-config/scripts/statusline/__tests__/formatters.test.ts +108 -0
- package/src/config/claude-code-config/scripts/statusline/__tests__/statusline.test.ts +309 -0
- package/src/config/claude-code-config/scripts/statusline/data/.gitkeep +0 -0
- package/src/config/claude-code-config/scripts/statusline/defaults.json +82 -0
- package/src/config/claude-code-config/scripts/statusline/docs/ARCHITECTURE.md +166 -0
- package/src/config/claude-code-config/scripts/statusline/fixtures/mock-transcript.jsonl +4 -0
- package/src/config/claude-code-config/scripts/statusline/fixtures/test-input.json +35 -0
- package/src/config/claude-code-config/scripts/statusline/src/analyze-daily-usage.ts +151 -0
- package/src/config/claude-code-config/scripts/statusline/src/commands/interactive-config.ts +515 -0
- package/src/config/claude-code-config/scripts/statusline/src/debug-payloads.ts +195 -0
- package/src/config/claude-code-config/scripts/statusline/src/index.ts +224 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/config-types.ts +110 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/config.ts +21 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/context.ts +103 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/limits/commands/weekly-analysis.ts +108 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/limits/index.ts +111 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/limits/types.ts +15 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/commands/migrate-to-sqlite.ts +136 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/commands/spend-day.ts +79 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/commands/spend-month.ts +66 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/commands/spend-project.ts +85 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/database.ts +395 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/index.ts +178 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/payload-logger.ts +161 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/features/spend/types.ts +37 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/formatters.ts +426 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/git.ts +100 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/menu-factories.ts +224 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/presets.ts +177 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/render-pure.ts +516 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/types.ts +36 -0
- package/src/config/claude-code-config/scripts/statusline/src/lib/utils.ts +15 -0
- package/src/config/claude-code-config/scripts/statusline/src/stats.ts +119 -0
- package/src/config/claude-code-config/scripts/statusline/src/tests/spend-v2.test.ts +377 -0
- package/src/config/claude-code-config/scripts/statusline/src/tools/fixed-cost-calc.ts +317 -0
- package/src/config/claude-code-config/scripts/statusline/statusline.config.free.json +79 -0
- package/src/config/claude-code-config/scripts/statusline/statusline.config.json +100 -0
- package/src/config/claude-code-config/scripts/statusline/test-with-fixtures.ts +37 -0
- package/src/config/claude-code-config/scripts/statusline/test.ts +20 -0
- package/src/config/claude-code-config/scripts/statusline/tsconfig.json +27 -0
- package/src/config/claude-code-config/scripts/tsconfig.json +27 -0
- package/src/config/claude-code-config/settings.json +92 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/SKILL.md +176 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/references/architecture-template.md +436 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/references/challenge-framework.md +289 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/references/discovery-framework.md +338 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/references/prd-template.md +452 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/references/task-template.md +263 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/references/tools.md +132 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/scripts/rename-project.sh +42 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/scripts/setup.sh +104 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-00-init.md +174 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-01-discovery.md +342 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-02-brainstorm.md +230 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-03-validate.md +372 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-04-prd.md +364 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-05-architecture.md +904 -0
- package/src/config/claude-code-config/skills/aibuilder-create-saas/steps/step-06-tasks.md +446 -0
- package/src/config/claude-code-config/skills/explore/SKILL.md +119 -0
- package/src/config/claude-code-config/skills/frontend-design/LICENSE.txt +177 -0
- package/src/config/claude-code-config/skills/frontend-design/SKILL.md +42 -0
- package/src/config/claude-code-config/skills/git-commit/SKILL.md +42 -0
- package/src/config/claude-code-config/skills/git-create-pr/SKILL.md +53 -0
- package/src/config/claude-code-config/skills/git-fix-pr-comments/SKILL.md +51 -0
- package/src/config/claude-code-config/skills/git-merge/SKILL.md +68 -0
- package/src/config/claude-code-config/skills/marketing-copywriting/SKILL.md +72 -0
- package/src/config/claude-code-config/skills/meta-claude-memory/SKILL.md +694 -0
- package/src/config/claude-code-config/skills/meta-claude-memory/references/comprehensive-example.md +175 -0
- package/src/config/claude-code-config/skills/meta-claude-memory/references/project-patterns.md +334 -0
- package/src/config/claude-code-config/skills/meta-claude-memory/references/prompting-techniques.md +411 -0
- package/src/config/claude-code-config/skills/meta-claude-memory/references/rules-directory-guide.md +298 -0
- package/src/config/claude-code-config/skills/meta-claude-memory/references/section-templates.md +347 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/SKILL.md +357 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/references/command-vs-prompt.md +287 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/references/examples.md +689 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/references/hook-types.md +495 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/references/input-output-schemas.md +503 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/references/matchers.md +517 -0
- package/src/config/claude-code-config/skills/meta-hooks-creator/references/troubleshooting.md +653 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/SKILL.md +285 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/anthropic-best-practices.md +126 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/anti-patterns.md +57 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/clarity-principles.md +54 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/context-management.md +389 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/few-shot-patterns.md +47 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/openai-best-practices.md +50 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/prompt-templates.md +110 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/reasoning-techniques.md +52 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/system-prompt-patterns.md +48 -0
- package/src/config/claude-code-config/skills/meta-prompt-creator/references/xml-structure.md +36 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/LICENSE.txt +202 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/SKILL.md +421 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/package.json +5 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/output-patterns.md +82 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/progressive-disclosure-patterns.md +374 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/prompting-integration.md +363 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/real-world-examples.md +513 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/script-patterns.md +385 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/workflows.md +28 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/references/xml-tag-guide.md +606 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/scripts/init-skill.ts +214 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/scripts/package-skill.ts +146 -0
- package/src/config/claude-code-config/skills/meta-skill-creator/scripts/validate.ts +138 -0
- package/src/config/claude-code-config/skills/meta-skill-workflow-creator/SKILL.md +390 -0
- package/src/config/claude-code-config/skills/meta-skill-workflow-creator/references/ask-patterns.md +225 -0
- package/src/config/claude-code-config/skills/meta-skill-workflow-creator/references/prompt-engineering.md +377 -0
- package/src/config/claude-code-config/skills/meta-skill-workflow-creator/references/state-management.md +275 -0
- package/src/config/claude-code-config/skills/meta-skill-workflow-creator/references/step-template.md +334 -0
- package/src/config/claude-code-config/skills/meta-skill-workflow-creator/references/workflow-patterns.md +300 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/SKILL.md +451 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/context-management.md +567 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/debugging-agents.md +714 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/error-handling-and-recovery.md +502 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/evaluation-and-testing.md +374 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/orchestration-patterns.md +591 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/subagents.md +599 -0
- package/src/config/claude-code-config/skills/meta-subagent-creator/references/writing-subagent-prompts.md +513 -0
- package/src/config/claude-code-config/skills/ralph-loop/SKILL.md +117 -0
- package/src/config/claude-code-config/skills/ralph-loop/scripts/setup.sh +278 -0
- package/src/config/claude-code-config/skills/ralph-loop/steps/step-00-init.md +215 -0
- package/src/config/claude-code-config/skills/ralph-loop/steps/step-01-interactive-prd.md +366 -0
- package/src/config/claude-code-config/skills/ralph-loop/steps/step-02-create-stories.md +273 -0
- package/src/config/claude-code-config/skills/ralph-loop/steps/step-03-finish.md +245 -0
- package/src/config/claude-code-config/skills/ralph-tasks/SKILL.md +88 -0
- package/src/config/claude-code-config/skills/ralph-tasks/scripts/add-task.sh +36 -0
- package/src/config/claude-code-config/skills/ralph-tasks/scripts/list-tasks.sh +66 -0
- package/src/config/claude-code-config/skills/ralph-tasks/scripts/remove-task.sh +47 -0
- package/src/config/claude-code-config/skills/ralph-tasks/scripts/setup.sh +201 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-add-search.md +131 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-add.md +46 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-init.md +123 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-list.md +58 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-remove.md +48 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-setup.md +46 -0
- package/src/config/claude-code-config/skills/ralph-tasks/steps/action-wake-up.md +62 -0
- package/src/config/claude-code-config/skills/utils-fix-errors/SKILL.md +61 -0
- package/src/config/claude-code-config/skills/utils-fix-grammar/SKILL.md +59 -0
- package/src/config/claude-code-config/skills/utils-oneshot/SKILL.md +56 -0
- package/src/config/claude-code-config/skills/utils-refactor/SKILL.md +89 -0
- package/src/config/claude-code-config/skills/utils-save-docs/SKILL.md +74 -0
- package/src/config/claude-code-config/skills/utils-ultrathink/SKILL.md +42 -0
- package/src/config/claude-code-config/skills/workflow-apex/SKILL.md +116 -0
- package/src/config/claude-code-config/skills/workflow-apex/scripts/setup-templates.sh +144 -0
- package/src/config/claude-code-config/skills/workflow-apex/scripts/update-progress.sh +80 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-00-init.md +273 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-00b-branch.md +126 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-00b-economy.md +244 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-00b-interactive.md +165 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-00b-save.md +123 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-01-analyze.md +361 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-02-plan.md +422 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-02b-tasks.md +301 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-03-execute-teams.md +297 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-03-execute.md +239 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-04-validate.md +264 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-05-examine.md +294 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-06-resolve.md +237 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-07-tests.md +250 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-08-run-tests.md +308 -0
- package/src/config/claude-code-config/skills/workflow-apex/steps/step-09-finish.md +193 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/00-context.md +53 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/01-analyze.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/02-plan.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/03-execute.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/04-validate.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/05-examine.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/06-resolve.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/07-tests.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/08-run-tests.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/09-finish.md +10 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/README.md +195 -0
- package/src/config/claude-code-config/skills/workflow-apex/templates/step-complete.md +7 -0
- package/src/config/claude-code-config/skills/workflow-brainstorm/SKILL.md +127 -0
- package/src/config/claude-code-config/skills/workflow-brainstorm/steps/step-01-explore.md +230 -0
- package/src/config/claude-code-config/skills/workflow-brainstorm/steps/step-02-challenge.md +238 -0
- package/src/config/claude-code-config/skills/workflow-brainstorm/steps/step-03-synthesize.md +337 -0
- package/src/config/claude-code-config/skills/workflow-brainstorm/steps/step-04-action.md +285 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/SKILL.md +150 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/references/cli-commands.md +122 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/references/github-cli.md +243 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/references/troubleshooting.md +362 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/references/vercel-cli.md +192 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/steps/step-00-init.md +157 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/steps/step-01-watch-ci.md +192 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/steps/step-02-analyze-errors.md +263 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/steps/step-03-fix-locally.md +312 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/steps/step-04-commit-push.md +206 -0
- package/src/config/claude-code-config/skills/workflow-ci-fixer/steps/step-05-cleanup.md +196 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/SKILL.md +129 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/references/general-clean-code.md +347 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/references/nextjs-clean-code.md +458 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/references/react-clean-code.md +406 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/references/tanstack-query-best-practices.md +516 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/references/zustand-best-practices.md +491 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/steps/step-01-scan.md +137 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/steps/step-02-apply.md +152 -0
- package/src/config/claude-code-config/skills/workflow-clean-code/steps/step-03-verify.md +143 -0
- package/src/config/claude-code-config/skills/workflow-debug/SKILL.md +126 -0
- package/src/config/claude-code-config/skills/workflow-debug/references/log-technique.md +285 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-00-init.md +94 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-01-analyze.md +180 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-01b-log-instrumentation.md +271 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-02-find-solutions.md +141 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-03-propose.md +142 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-04-fix.md +176 -0
- package/src/config/claude-code-config/skills/workflow-debug/steps/step-05-verify.md +279 -0
- package/src/config/claude-code-config/skills/workflow-review-code/SKILL.md +219 -0
- package/src/config/claude-code-config/skills/workflow-review-code/references/clean-code-principles.md +140 -0
- package/src/config/claude-code-config/skills/workflow-review-code/references/code-quality-metrics.md +174 -0
- package/src/config/claude-code-config/skills/workflow-review-code/references/feedback-patterns.md +149 -0
- package/src/config/claude-code-config/skills/workflow-review-code/references/security-checklist.md +127 -0
- package/src/config/claude-code-config/song/finish.mp3 +0 -0
- package/src/config/claude-code-config/song/need-human.mp3 +0 -0
|
@@ -0,0 +1,113 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import {
|
|
3
|
+
extractTextContent,
|
|
4
|
+
isRealUserMessage,
|
|
5
|
+
type TranscriptLine,
|
|
6
|
+
} from "./shared";
|
|
7
|
+
|
|
8
|
+
const SCRIPT_DIR = import.meta.dir;
|
|
9
|
+
const LOG_FILE = join(SCRIPT_DIR, "..", "debug.log");
|
|
10
|
+
|
|
11
|
+
async function log(message: string) {
|
|
12
|
+
const timestamp = new Date().toISOString();
|
|
13
|
+
const line = `[${timestamp}] ${message}\n`;
|
|
14
|
+
await Bun.write(
|
|
15
|
+
LOG_FILE,
|
|
16
|
+
(await Bun.file(LOG_FILE)
|
|
17
|
+
.text()
|
|
18
|
+
.catch(() => "")) + line,
|
|
19
|
+
);
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
interface HookInput {
|
|
23
|
+
session_id: string;
|
|
24
|
+
transcript_path: string;
|
|
25
|
+
hook_event_name: string;
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
async function main() {
|
|
29
|
+
await log("=== Hook triggered ===");
|
|
30
|
+
|
|
31
|
+
const input: HookInput = await Bun.stdin.json();
|
|
32
|
+
await log(
|
|
33
|
+
`Input: session_id=${input.session_id}, transcript_path=${input.transcript_path}`,
|
|
34
|
+
);
|
|
35
|
+
|
|
36
|
+
if (!input.transcript_path || !input.session_id) {
|
|
37
|
+
await log("Missing transcript_path or session_id, exiting");
|
|
38
|
+
process.exit(0);
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const transcriptContent = await Bun.file(input.transcript_path).text();
|
|
42
|
+
const lines = transcriptContent.trim().split("\n");
|
|
43
|
+
|
|
44
|
+
let hasCustomTitle = false;
|
|
45
|
+
let firstUserMessage = "";
|
|
46
|
+
let firstAssistantResponse = "";
|
|
47
|
+
let foundUser = false;
|
|
48
|
+
|
|
49
|
+
for (const line of lines) {
|
|
50
|
+
try {
|
|
51
|
+
const parsed: TranscriptLine = JSON.parse(line);
|
|
52
|
+
|
|
53
|
+
if (parsed.type === "custom-title") {
|
|
54
|
+
hasCustomTitle = true;
|
|
55
|
+
break;
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
if (!firstUserMessage && parsed.message?.role === "user") {
|
|
59
|
+
const text = extractTextContent(parsed.message.content);
|
|
60
|
+
if (isRealUserMessage(text)) {
|
|
61
|
+
firstUserMessage = text;
|
|
62
|
+
foundUser = true;
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
if (
|
|
67
|
+
foundUser &&
|
|
68
|
+
!firstAssistantResponse &&
|
|
69
|
+
parsed.message?.role === "assistant"
|
|
70
|
+
) {
|
|
71
|
+
const text = extractTextContent(parsed.message.content);
|
|
72
|
+
if (text) {
|
|
73
|
+
firstAssistantResponse = text;
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
} catch {}
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
await log(
|
|
80
|
+
`hasCustomTitle=${hasCustomTitle}, firstUserMessage="${firstUserMessage.slice(0, 50)}..."`,
|
|
81
|
+
);
|
|
82
|
+
|
|
83
|
+
if (hasCustomTitle || !firstUserMessage) {
|
|
84
|
+
await log(
|
|
85
|
+
`Skipping: hasCustomTitle=${hasCustomTitle}, noFirstUserMessage=${!firstUserMessage}`,
|
|
86
|
+
);
|
|
87
|
+
process.exit(0);
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
await log(`Spawning worker with session_id=${input.session_id}`);
|
|
91
|
+
|
|
92
|
+
const workerPath = join(SCRIPT_DIR, "worker.ts");
|
|
93
|
+
Bun.spawn(
|
|
94
|
+
[
|
|
95
|
+
"bun",
|
|
96
|
+
workerPath,
|
|
97
|
+
input.session_id,
|
|
98
|
+
input.transcript_path,
|
|
99
|
+
firstUserMessage.slice(0, 400),
|
|
100
|
+
firstAssistantResponse.slice(0, 300),
|
|
101
|
+
],
|
|
102
|
+
{
|
|
103
|
+
stdio: ["ignore", "ignore", "ignore"],
|
|
104
|
+
},
|
|
105
|
+
);
|
|
106
|
+
|
|
107
|
+
await log("Worker spawned successfully");
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
main().catch(async (e) => {
|
|
111
|
+
await log(`Main error: ${e?.message || e}`);
|
|
112
|
+
process.exit(0);
|
|
113
|
+
});
|
|
@@ -0,0 +1,148 @@
|
|
|
1
|
+
import { isAbsolute, join, sep } from "node:path";
|
|
2
|
+
import { generateTextCC } from "../../claude-code-ai/claude";
|
|
3
|
+
import { encodeProjectPath } from "../../claude-code-ai/helper";
|
|
4
|
+
import {
|
|
5
|
+
buildPrompt,
|
|
6
|
+
createCustomTitleLine,
|
|
7
|
+
extractTextContent,
|
|
8
|
+
isRealUserMessage,
|
|
9
|
+
parseTitle,
|
|
10
|
+
type TranscriptLine,
|
|
11
|
+
} from "./shared";
|
|
12
|
+
|
|
13
|
+
function toClaudeProjectPath(inputPath: string): string {
|
|
14
|
+
const absolutePath = isAbsolute(inputPath)
|
|
15
|
+
? inputPath
|
|
16
|
+
: join(process.cwd(), inputPath);
|
|
17
|
+
|
|
18
|
+
return encodeProjectPath(absolutePath);
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
async function main() {
|
|
22
|
+
const args = process.argv.slice(2);
|
|
23
|
+
const override = args.includes("--override");
|
|
24
|
+
const inputPath = args.find((arg) => !arg.startsWith("--"));
|
|
25
|
+
|
|
26
|
+
if (!inputPath) {
|
|
27
|
+
console.error("Usage: bun run rename-all <project-path> [--override]");
|
|
28
|
+
console.error("Example: bun run rename-all /Users/melvynx/cc");
|
|
29
|
+
console.error("Example: bun run rename-all . --override");
|
|
30
|
+
console.error("\nFlags:");
|
|
31
|
+
console.error(" --override Override existing titles");
|
|
32
|
+
process.exit(1);
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
const projectPath = toClaudeProjectPath(inputPath);
|
|
36
|
+
console.log(`Session folder: ${projectPath}`);
|
|
37
|
+
console.log(`Override mode: ${override ? "ON" : "OFF"}\n`);
|
|
38
|
+
|
|
39
|
+
const glob = new Bun.Glob("*.jsonl");
|
|
40
|
+
const files = await Array.fromAsync(glob.scan({ cwd: projectPath }));
|
|
41
|
+
|
|
42
|
+
const sessionFiles = files.filter((f) => !f.startsWith("agent-"));
|
|
43
|
+
|
|
44
|
+
console.log(`Found ${sessionFiles.length} sessions in ${projectPath}\n`);
|
|
45
|
+
|
|
46
|
+
let renamed = 0;
|
|
47
|
+
let skipped = 0;
|
|
48
|
+
|
|
49
|
+
for (const file of sessionFiles) {
|
|
50
|
+
const filePath = join(projectPath, file);
|
|
51
|
+
const content = await Bun.file(filePath).text();
|
|
52
|
+
const lines = content.trim().split("\n");
|
|
53
|
+
|
|
54
|
+
let hasCustomTitle = false;
|
|
55
|
+
let firstUserMessage = "";
|
|
56
|
+
let firstAssistantResponse = "";
|
|
57
|
+
let foundUser = false;
|
|
58
|
+
let sessionId = file.replace(".jsonl", "");
|
|
59
|
+
|
|
60
|
+
for (const line of lines) {
|
|
61
|
+
try {
|
|
62
|
+
const parsed: TranscriptLine = JSON.parse(line);
|
|
63
|
+
|
|
64
|
+
if (parsed.type === "custom-title") {
|
|
65
|
+
hasCustomTitle = true;
|
|
66
|
+
break;
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
if (parsed.sessionId) {
|
|
70
|
+
sessionId = parsed.sessionId;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
if (!firstUserMessage && parsed.message?.role === "user") {
|
|
74
|
+
const text = extractTextContent(parsed.message.content);
|
|
75
|
+
if (isRealUserMessage(text)) {
|
|
76
|
+
firstUserMessage = text;
|
|
77
|
+
foundUser = true;
|
|
78
|
+
}
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
if (
|
|
82
|
+
foundUser &&
|
|
83
|
+
!firstAssistantResponse &&
|
|
84
|
+
parsed.message?.role === "assistant"
|
|
85
|
+
) {
|
|
86
|
+
const text = extractTextContent(parsed.message.content);
|
|
87
|
+
if (text) {
|
|
88
|
+
firstAssistantResponse = text;
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
} catch {}
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
if (hasCustomTitle && !override) {
|
|
95
|
+
skipped++;
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
if (!firstUserMessage) {
|
|
100
|
+
console.log(`⏭️ ${file} - No user message found`);
|
|
101
|
+
skipped++;
|
|
102
|
+
continue;
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
try {
|
|
106
|
+
const text = await generateTextCC({
|
|
107
|
+
prompt: buildPrompt(firstUserMessage, firstAssistantResponse),
|
|
108
|
+
model: "haiku",
|
|
109
|
+
});
|
|
110
|
+
|
|
111
|
+
const title = parseTitle(text);
|
|
112
|
+
|
|
113
|
+
if (title) {
|
|
114
|
+
// If overriding, we need to remove the old custom-title line first
|
|
115
|
+
let finalContent = content;
|
|
116
|
+
if (hasCustomTitle && override) {
|
|
117
|
+
const contentLines = content.trim().split("\n");
|
|
118
|
+
const filteredLines = contentLines.filter((line) => {
|
|
119
|
+
try {
|
|
120
|
+
const parsed = JSON.parse(line);
|
|
121
|
+
return parsed.type !== "custom-title";
|
|
122
|
+
} catch {
|
|
123
|
+
return true;
|
|
124
|
+
}
|
|
125
|
+
});
|
|
126
|
+
finalContent = filteredLines.join("\n") + "\n";
|
|
127
|
+
}
|
|
128
|
+
|
|
129
|
+
await Bun.write(
|
|
130
|
+
filePath,
|
|
131
|
+
`${finalContent + createCustomTitleLine(title, sessionId)}\n`,
|
|
132
|
+
);
|
|
133
|
+
const prefix = hasCustomTitle && override ? "🔄" : "✅";
|
|
134
|
+
console.log(`${prefix} ${file} → "${title}"`);
|
|
135
|
+
renamed++;
|
|
136
|
+
} else {
|
|
137
|
+
console.log(`⏭️ ${file} - No meaningful title`);
|
|
138
|
+
skipped++;
|
|
139
|
+
}
|
|
140
|
+
} catch (e) {
|
|
141
|
+
console.error(`❌ ${file} - Error: ${e}`);
|
|
142
|
+
}
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
console.log(`\nDone! Renamed: ${renamed}, Skipped: ${skipped}`);
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
main().catch(console.error);
|
|
@@ -0,0 +1,157 @@
|
|
|
1
|
+
export interface ContentBlock {
|
|
2
|
+
type: string;
|
|
3
|
+
text?: string;
|
|
4
|
+
thinking?: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface TranscriptLine {
|
|
8
|
+
type: string;
|
|
9
|
+
message?: {
|
|
10
|
+
role: string;
|
|
11
|
+
content: string | ContentBlock[];
|
|
12
|
+
};
|
|
13
|
+
sessionId?: string;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
export function extractTextContent(content: string | ContentBlock[]): string {
|
|
17
|
+
if (typeof content === "string") return content;
|
|
18
|
+
|
|
19
|
+
for (const block of content) {
|
|
20
|
+
if (block.type === "text" && block.text) return block.text;
|
|
21
|
+
}
|
|
22
|
+
return "";
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
export function isRealUserMessage(content: string): boolean {
|
|
26
|
+
if (!content) return false;
|
|
27
|
+
if (content.startsWith("Caveat:")) return false;
|
|
28
|
+
if (content.startsWith("<command-")) return false;
|
|
29
|
+
if (content.startsWith("<local-command")) return false;
|
|
30
|
+
if (content.trim().length < 5) return false;
|
|
31
|
+
|
|
32
|
+
// Detect skill/workflow prompt expansions - these are NOT real user messages
|
|
33
|
+
if (content.startsWith("Base directory for this skill:")) return false;
|
|
34
|
+
if (content.includes("<objective>")) return false;
|
|
35
|
+
if (content.includes("<quick_start>")) return false;
|
|
36
|
+
if (content.includes("<parameters>")) return false;
|
|
37
|
+
if (content.includes("<workflow>")) return false;
|
|
38
|
+
if (content.includes("<step_files>")) return false;
|
|
39
|
+
if (content.includes("<execution_rules>")) return false;
|
|
40
|
+
|
|
41
|
+
return true;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
export function buildPrompt(
|
|
45
|
+
userMessage: string,
|
|
46
|
+
assistantResponse: string,
|
|
47
|
+
): string {
|
|
48
|
+
return `Generate a short title (2-5 words) for this Claude Code session.
|
|
49
|
+
|
|
50
|
+
<rules>
|
|
51
|
+
- Start with a verb (action word)
|
|
52
|
+
- Be concise and descriptive
|
|
53
|
+
- Always respond in English
|
|
54
|
+
- CRITICAL: Focus ONLY on the user's ORIGINAL INTENT from their message
|
|
55
|
+
- NEVER include workflow names, tool names, skill names, or methodology references in the title
|
|
56
|
+
- The title should describe WHAT the user wants to accomplish, not HOW (not the method/tool used)
|
|
57
|
+
- If the user's message mentions a workflow/skill, extract the actual goal behind it
|
|
58
|
+
- If the user intent is UNCLEAR or you can only see workflow/skill instructions, respond with exactly: None
|
|
59
|
+
</rules>
|
|
60
|
+
|
|
61
|
+
<examples>
|
|
62
|
+
<example>
|
|
63
|
+
<user>Help me build a React component for user authentication</user>
|
|
64
|
+
<title>Build React Auth Component</title>
|
|
65
|
+
</example>
|
|
66
|
+
<example>
|
|
67
|
+
<user>I'm getting a TypeError when fetching from my API</user>
|
|
68
|
+
<title>Debug API TypeError</title>
|
|
69
|
+
</example>
|
|
70
|
+
<example>
|
|
71
|
+
<user>compte jusqu'à 10</user>
|
|
72
|
+
<title>Count to Ten</title>
|
|
73
|
+
</example>
|
|
74
|
+
<example>
|
|
75
|
+
<user>what is 2+2</user>
|
|
76
|
+
<title>Calculate Simple Math</title>
|
|
77
|
+
</example>
|
|
78
|
+
<example>
|
|
79
|
+
<user>explain how promises work</user>
|
|
80
|
+
<title>Explain JavaScript Promises</title>
|
|
81
|
+
</example>
|
|
82
|
+
<example>
|
|
83
|
+
<user>fix the bug in my code</user>
|
|
84
|
+
<title>Fix Code Bug</title>
|
|
85
|
+
</example>
|
|
86
|
+
<example>
|
|
87
|
+
<user>implement workflow conditions for ralph</user>
|
|
88
|
+
<title>Implement Ralph Conditions</title>
|
|
89
|
+
</example>
|
|
90
|
+
<example>
|
|
91
|
+
<user>/apex add dark mode toggle</user>
|
|
92
|
+
<title>Add Dark Mode Toggle</title>
|
|
93
|
+
</example>
|
|
94
|
+
<example>
|
|
95
|
+
<user>run /apex to refactor the authentication system</user>
|
|
96
|
+
<title>Refactor Auth System</title>
|
|
97
|
+
</example>
|
|
98
|
+
<example>
|
|
99
|
+
<user>Base directory for this skill: /path/to/skill... [skill prompt]</user>
|
|
100
|
+
<title>None</title>
|
|
101
|
+
</example>
|
|
102
|
+
<example>
|
|
103
|
+
<user><objective>Execute systematic implementation workflows...</objective></user>
|
|
104
|
+
<title>None</title>
|
|
105
|
+
</example>
|
|
106
|
+
</examples>
|
|
107
|
+
|
|
108
|
+
<user_message>
|
|
109
|
+
${userMessage.slice(0, 400)}
|
|
110
|
+
</user_message>
|
|
111
|
+
|
|
112
|
+
${assistantResponse ? `<context>\n${assistantResponse.slice(0, 200)}\n</context>` : ""}
|
|
113
|
+
|
|
114
|
+
IMPORTANT: Extract the user's actual goal from their message. If the message is a workflow/skill prompt or system instruction (not a real user request), respond with exactly "None".
|
|
115
|
+
|
|
116
|
+
Title:`;
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
export function parseTitle(text: string): string | null {
|
|
120
|
+
const title = text
|
|
121
|
+
.trim()
|
|
122
|
+
.replace(/["'\n*_`#]/g, "")
|
|
123
|
+
.slice(0, 60);
|
|
124
|
+
|
|
125
|
+
if (!title || title.length <= 2) return null;
|
|
126
|
+
|
|
127
|
+
// Return null for "None" responses (intent unclear)
|
|
128
|
+
if (title.toLowerCase() === "none") return null;
|
|
129
|
+
|
|
130
|
+
// Filter out ANY title containing workflow/skill keywords - these are NOT user intent
|
|
131
|
+
const forbiddenKeywords = [
|
|
132
|
+
"apex",
|
|
133
|
+
"workflow",
|
|
134
|
+
"skill",
|
|
135
|
+
"brainstorm",
|
|
136
|
+
"subagent",
|
|
137
|
+
"hook",
|
|
138
|
+
];
|
|
139
|
+
|
|
140
|
+
const lowerTitle = title.toLowerCase();
|
|
141
|
+
for (const keyword of forbiddenKeywords) {
|
|
142
|
+
if (lowerTitle.includes(keyword)) return null;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
return title;
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
export function createCustomTitleLine(
|
|
149
|
+
title: string,
|
|
150
|
+
sessionId: string,
|
|
151
|
+
): string {
|
|
152
|
+
return JSON.stringify({
|
|
153
|
+
type: "custom-title",
|
|
154
|
+
customTitle: title,
|
|
155
|
+
sessionId: sessionId,
|
|
156
|
+
});
|
|
157
|
+
}
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
import { join } from "node:path";
|
|
2
|
+
import { generateTextCC } from "../../claude-code-ai/claude";
|
|
3
|
+
import { buildPrompt, createCustomTitleLine, parseTitle } from "./shared";
|
|
4
|
+
|
|
5
|
+
const SCRIPT_DIR = import.meta.dir;
|
|
6
|
+
const LOG_FILE = join(SCRIPT_DIR, "..", "debug.log");
|
|
7
|
+
|
|
8
|
+
async function log(message: string) {
|
|
9
|
+
const timestamp = new Date().toISOString();
|
|
10
|
+
const line = `[${timestamp}] [worker] ${message}\n`;
|
|
11
|
+
await Bun.write(
|
|
12
|
+
LOG_FILE,
|
|
13
|
+
(await Bun.file(LOG_FILE)
|
|
14
|
+
.text()
|
|
15
|
+
.catch(() => "")) + line,
|
|
16
|
+
);
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const [sessionId, transcriptPath, firstUserMessage, firstAssistantResponse] =
|
|
20
|
+
process.argv.slice(2);
|
|
21
|
+
|
|
22
|
+
await log(`Worker started: sessionId=${sessionId}`);
|
|
23
|
+
|
|
24
|
+
if (!sessionId || !transcriptPath || !firstUserMessage) {
|
|
25
|
+
await log("Missing args, exiting");
|
|
26
|
+
process.exit(0);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
async function main() {
|
|
30
|
+
await log(`firstUserMessage: "${firstUserMessage}"`);
|
|
31
|
+
await log(`firstAssistantResponse: "${firstAssistantResponse}"`);
|
|
32
|
+
await log("Calling Anthropic API...");
|
|
33
|
+
|
|
34
|
+
const text = await generateTextCC({
|
|
35
|
+
prompt: buildPrompt(firstUserMessage, firstAssistantResponse),
|
|
36
|
+
model: "haiku",
|
|
37
|
+
});
|
|
38
|
+
await log(`API response: "${text}"`);
|
|
39
|
+
|
|
40
|
+
const title = parseTitle(text);
|
|
41
|
+
|
|
42
|
+
if (title) {
|
|
43
|
+
await log(`Writing title "${title}" to transcript`);
|
|
44
|
+
const transcriptContent = await Bun.file(transcriptPath).text();
|
|
45
|
+
await Bun.write(
|
|
46
|
+
transcriptPath,
|
|
47
|
+
`${transcriptContent + createCustomTitleLine(title, sessionId)}\n`,
|
|
48
|
+
);
|
|
49
|
+
await log("Title written successfully");
|
|
50
|
+
} else {
|
|
51
|
+
await log(`Skipping: title too short or empty`);
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
main().catch(async (e) => {
|
|
56
|
+
await log(`Worker error: ${e?.message || e}`);
|
|
57
|
+
process.exit(0);
|
|
58
|
+
});
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://biomejs.dev/schemas/2.3.11/schema.json",
|
|
3
|
+
"vcs": {
|
|
4
|
+
"enabled": true,
|
|
5
|
+
"clientKind": "git",
|
|
6
|
+
"useIgnoreFile": true
|
|
7
|
+
},
|
|
8
|
+
"files": {
|
|
9
|
+
"ignoreUnknown": false
|
|
10
|
+
},
|
|
11
|
+
"formatter": {
|
|
12
|
+
"enabled": true,
|
|
13
|
+
"indentStyle": "tab"
|
|
14
|
+
},
|
|
15
|
+
"linter": {
|
|
16
|
+
"enabled": true,
|
|
17
|
+
"rules": {
|
|
18
|
+
"recommended": true,
|
|
19
|
+
"suspicious": {
|
|
20
|
+
"noControlCharactersInRegex": "off"
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
},
|
|
24
|
+
"javascript": {
|
|
25
|
+
"formatter": {
|
|
26
|
+
"quoteStyle": "double"
|
|
27
|
+
}
|
|
28
|
+
},
|
|
29
|
+
"assist": {
|
|
30
|
+
"enabled": true,
|
|
31
|
+
"actions": {
|
|
32
|
+
"source": {
|
|
33
|
+
"organizeImports": "on"
|
|
34
|
+
}
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
}
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
# Claude Code AI - Project Memory
|
|
2
|
+
|
|
3
|
+
Shared utilities for accessing Claude API using Claude Code's OAuth credentials.
|
|
4
|
+
|
|
5
|
+
## Purpose
|
|
6
|
+
|
|
7
|
+
Provides a unified way to:
|
|
8
|
+
1. Retrieve Claude Code OAuth tokens (cross-platform)
|
|
9
|
+
2. Make authenticated API calls to Claude models
|
|
10
|
+
3. Handle common path operations for Claude config
|
|
11
|
+
|
|
12
|
+
## Files
|
|
13
|
+
|
|
14
|
+
```
|
|
15
|
+
claude-code-ai/
|
|
16
|
+
├── claude.ts # Main API: generateTextCC()
|
|
17
|
+
├── helper/
|
|
18
|
+
│ ├── credentials.ts # getClaudeCodeToken(), getClaudeCodeTokenSafe()
|
|
19
|
+
│ ├── paths.ts # getHomeDir(), getClaudeConfigDir(), encodeProjectPath()
|
|
20
|
+
│ └── index.ts # Re-exports all helpers
|
|
21
|
+
└── __tests__/
|
|
22
|
+
├── claude.test.ts # Integration tests (real API calls)
|
|
23
|
+
└── paths.test.ts # Unit tests for path helpers
|
|
24
|
+
```
|
|
25
|
+
|
|
26
|
+
## Usage
|
|
27
|
+
|
|
28
|
+
### Generate Text with Claude
|
|
29
|
+
|
|
30
|
+
```typescript
|
|
31
|
+
import { generateTextCC } from "../claude-code-ai/claude";
|
|
32
|
+
|
|
33
|
+
const response = await generateTextCC({
|
|
34
|
+
prompt: "Your prompt here",
|
|
35
|
+
model: "haiku", // "haiku" | "sonnet" | "opus"
|
|
36
|
+
system: "Optional system prompt",
|
|
37
|
+
});
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
### Get OAuth Token
|
|
41
|
+
|
|
42
|
+
```typescript
|
|
43
|
+
import { getClaudeCodeToken, getClaudeCodeTokenSafe } from "../claude-code-ai/helper";
|
|
44
|
+
|
|
45
|
+
const token = await getClaudeCodeToken(); // Throws on error
|
|
46
|
+
const token = await getClaudeCodeTokenSafe(); // Returns null on error
|
|
47
|
+
```
|
|
48
|
+
|
|
49
|
+
### Cross-Platform Paths
|
|
50
|
+
|
|
51
|
+
```typescript
|
|
52
|
+
import {
|
|
53
|
+
getHomeDir,
|
|
54
|
+
getClaudeConfigDir,
|
|
55
|
+
getClaudeProjectsDir,
|
|
56
|
+
encodeProjectPath
|
|
57
|
+
} from "../claude-code-ai/helper";
|
|
58
|
+
|
|
59
|
+
const home = getHomeDir(); // Works on all platforms
|
|
60
|
+
const configDir = getClaudeConfigDir(); // ~/.config/claude or ~/.claude
|
|
61
|
+
const projectPath = encodeProjectPath("/Users/me/myproject");
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Credential Storage
|
|
65
|
+
|
|
66
|
+
| Platform | Location |
|
|
67
|
+
|----------|----------|
|
|
68
|
+
| macOS | Keychain (`security find-generic-password -s "Claude Code-credentials"`) |
|
|
69
|
+
| Linux | `~/.claude/.credentials.json` |
|
|
70
|
+
| Windows | WSL required, uses Linux path |
|
|
71
|
+
|
|
72
|
+
## Testing
|
|
73
|
+
|
|
74
|
+
```bash
|
|
75
|
+
bun run ai:test # Runs all tests (includes real API calls, ~15s)
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
## Models
|
|
79
|
+
|
|
80
|
+
| Model | ID |
|
|
81
|
+
|-------|-----|
|
|
82
|
+
| haiku | `claude-haiku-4-5-20251001` |
|
|
83
|
+
| sonnet | `claude-sonnet-4-5-20250929` |
|
|
84
|
+
| opus | `claude-opus-4-5-20251101` |
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { generateTextCC, type Model } from "../claude";
|
|
3
|
+
|
|
4
|
+
const models: Model[] = ["haiku", "sonnet", "opus"];
|
|
5
|
+
|
|
6
|
+
describe("generateTextCC", () => {
|
|
7
|
+
for (const model of models) {
|
|
8
|
+
it(`should generate text with ${model}`, async () => {
|
|
9
|
+
const result = await generateTextCC({
|
|
10
|
+
prompt: "Hey",
|
|
11
|
+
model,
|
|
12
|
+
});
|
|
13
|
+
|
|
14
|
+
expect(result).toBeDefined();
|
|
15
|
+
expect(typeof result).toBe("string");
|
|
16
|
+
expect(result.length).toBeGreaterThan(0);
|
|
17
|
+
}, 30000);
|
|
18
|
+
}
|
|
19
|
+
});
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { describe, expect, it } from "bun:test";
|
|
2
|
+
import { homedir } from "node:os";
|
|
3
|
+
import { join, sep } from "node:path";
|
|
4
|
+
import {
|
|
5
|
+
encodeProjectPath,
|
|
6
|
+
getClaudeConfigDir,
|
|
7
|
+
getClaudeCredentialsPath,
|
|
8
|
+
getClaudeProjectsDir,
|
|
9
|
+
getHomeDir,
|
|
10
|
+
} from "../helper/paths";
|
|
11
|
+
|
|
12
|
+
describe("getHomeDir", () => {
|
|
13
|
+
it("should return a non-empty string", () => {
|
|
14
|
+
const home = getHomeDir();
|
|
15
|
+
expect(home).toBeTruthy();
|
|
16
|
+
expect(typeof home).toBe("string");
|
|
17
|
+
});
|
|
18
|
+
|
|
19
|
+
it("should match os.homedir()", () => {
|
|
20
|
+
expect(getHomeDir()).toBe(homedir());
|
|
21
|
+
});
|
|
22
|
+
});
|
|
23
|
+
|
|
24
|
+
describe("getClaudeCredentialsPath", () => {
|
|
25
|
+
it("should return path in home directory", () => {
|
|
26
|
+
const credPath = getClaudeCredentialsPath();
|
|
27
|
+
expect(credPath).toContain(getHomeDir());
|
|
28
|
+
expect(credPath).toContain(".credentials.json");
|
|
29
|
+
});
|
|
30
|
+
});
|
|
31
|
+
|
|
32
|
+
describe("getClaudeProjectsDir", () => {
|
|
33
|
+
it("should return path with projects directory", () => {
|
|
34
|
+
const projectsDir = getClaudeProjectsDir();
|
|
35
|
+
expect(projectsDir).toContain("projects");
|
|
36
|
+
});
|
|
37
|
+
});
|
|
38
|
+
|
|
39
|
+
describe("encodeProjectPath", () => {
|
|
40
|
+
it("should encode forward slashes to dashes", () => {
|
|
41
|
+
const result = encodeProjectPath("/Users/test/myproject");
|
|
42
|
+
expect(result).toContain("-Users-test-myproject");
|
|
43
|
+
});
|
|
44
|
+
|
|
45
|
+
it("should encode dots to dashes", () => {
|
|
46
|
+
const result = encodeProjectPath("/path/to/.hidden");
|
|
47
|
+
expect(result).toContain("-hidden");
|
|
48
|
+
});
|
|
49
|
+
|
|
50
|
+
it("should handle Windows paths", () => {
|
|
51
|
+
const result = encodeProjectPath("C:\\Users\\test\\project");
|
|
52
|
+
expect(result).not.toContain("\\");
|
|
53
|
+
expect(result).not.toContain(":");
|
|
54
|
+
});
|
|
55
|
+
|
|
56
|
+
it("should return path as-is if already in projects directory", () => {
|
|
57
|
+
const home = getHomeDir();
|
|
58
|
+
const existingPath = join(home, ".claude", "projects", "my-project");
|
|
59
|
+
const result = encodeProjectPath(existingPath);
|
|
60
|
+
expect(result).toBe(existingPath);
|
|
61
|
+
});
|
|
62
|
+
|
|
63
|
+
it("should strip trailing slashes", () => {
|
|
64
|
+
const path1 = encodeProjectPath("/Users/test/project/");
|
|
65
|
+
const path2 = encodeProjectPath("/Users/test/project");
|
|
66
|
+
expect(path1).toBe(path2);
|
|
67
|
+
});
|
|
68
|
+
});
|