@claudetools/tools 0.9.0 → 0.9.1

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.
Files changed (2) hide show
  1. package/dist/setup.js +195 -3
  2. package/package.json +1 -1
package/dist/setup.js CHANGED
@@ -21,6 +21,7 @@ const MCP_CONFIG_PATH = join(CLAUDE_DIR, 'mcp.json');
21
21
  const CLAUDE_DESKTOP_CONFIG_PATH = join(CLAUDE_DIR, 'claude_desktop_config.json');
22
22
  const SETTINGS_PATH = join(CLAUDE_DIR, 'settings.json');
23
23
  const HOOKS_DIR = join(CLAUDE_DIR, 'hooks');
24
+ const COMMANDS_DIR = join(CLAUDE_DIR, 'commands');
24
25
  const CLAUDE_MD_PATH = join(CLAUDE_DIR, 'CLAUDE.md');
25
26
  const SYSTEM_FILE = join(CLAUDETOOLS_DIR, 'system.json');
26
27
  const PROJECTS_FILE = join(CLAUDETOOLS_DIR, 'projects.json');
@@ -920,6 +921,195 @@ exit 0
920
921
  writeFileSync(preCompactPath, preCompactHook, { mode: 0o755 });
921
922
  success('Installed pre-compact.sh hook');
922
923
  }
924
+ // -----------------------------------------------------------------------------
925
+ // Slash Commands Installation
926
+ // -----------------------------------------------------------------------------
927
+ const PROJECT_INIT_COMMAND = `---
928
+ description: Initialize a new project with AI-driven onboarding
929
+ model: claude-sonnet-4-5
930
+ ---
931
+
932
+ # Project Onboarding
933
+
934
+ Starting interactive onboarding for this project...
935
+
936
+ ## Instructions for Claude
937
+
938
+ You are beginning an onboarding session for a new or existing project. Your goal is to:
939
+ 1. Gather project context through conversational questioning
940
+ 2. **Store ALL learned facts in the memory system immediately** (don't batch - store as you learn)
941
+ 3. **Cache documentation for libraries/frameworks mentioned** (using \`docs_cache\`)
942
+ 4. **Verify ClaudeTools integration is working correctly**
943
+
944
+ ### Phase 1: ClaudeTools Verification
945
+
946
+ Before starting onboarding, verify the tooling is correctly set up:
947
+
948
+ \`\`\`bash
949
+ # Check session facts cache exists
950
+ ls -la ~/.claudetools/session-facts.json
951
+
952
+ # Check hooks are in place
953
+ ls -la ~/.claude/hooks/
954
+
955
+ # Verify MCP connection
956
+ # (If memory_search works, MCP is connected)
957
+ \`\`\`
958
+
959
+ If any issues found, help the user fix their ClaudeTools setup before proceeding.
960
+
961
+ ### Phase 2: Onboarding Workflow
962
+
963
+ **1. Check if project exists**
964
+ - Use \`memory_search\` to check for existing project context
965
+ - If exists, offer to update/extend vs start fresh
966
+
967
+ **2. Start onboarding conversation**
968
+ Ask about (store facts AS you learn them, not at the end):
969
+
970
+ - **Project Type**: What kind of project? (web app, API, library, CLI, etc.)
971
+ → Store: \`[ProjectName] IS_TYPE [ProjectType]\`
972
+
973
+ - **Tech Stack**: What technologies/frameworks?
974
+ → Store: \`[ProjectName] USES [Technology]\` for EACH technology
975
+ → **IMPORTANT**: Call \`docs_cache({ library: "technology-name" })\` for each library mentioned
976
+
977
+ - **Architecture**: Key patterns, structure, decisions?
978
+ → Store: \`[ProjectName] USES_PATTERN [Pattern]\`
979
+ → Store: \`[Component] IMPLEMENTS [Pattern]\`
980
+
981
+ - **Constraints**: Performance requirements, limitations, must-haves?
982
+ → Store: \`[ProjectName] HAS_CONSTRAINT [Constraint]\`
983
+
984
+ - **External Integrations**: APIs, services, databases?
985
+ → Store: \`[ProjectName] INTEGRATES_WITH [Service]\`
986
+ → Call \`docs_cache\` if documentation available
987
+
988
+ - **Development Practices**: Testing, CI/CD, code style?
989
+ → Store: \`[ProjectName] FOLLOWS [Practice]\`
990
+
991
+ **3. Research when needed**
992
+ If user mentions:
993
+ - Existing specs/docs → Read and extract facts
994
+ - External libraries → Cache docs with \`docs_cache({ library: "name" })\`
995
+ - Existing code → Analyse patterns and store architectural decisions
996
+
997
+ **4. Complete onboarding**
998
+ - Summarise what was learned
999
+ - Confirm with user before finalising
1000
+ - List all cached documentation
1001
+
1002
+ ### Memory Storage (CRITICAL)
1003
+
1004
+ **Store facts IMMEDIATELY as you learn them, not at the end.**
1005
+
1006
+ \`\`\`typescript
1007
+ // After learning tech stack
1008
+ memory_store_fact({
1009
+ entity1: "MyProject",
1010
+ relationship: "USES",
1011
+ entity2: "React",
1012
+ context: "Frontend framework chosen for component-based architecture"
1013
+ })
1014
+
1015
+ // Immediately cache React docs
1016
+ docs_cache({ library: "react" })
1017
+ \`\`\`
1018
+
1019
+ **Fact relationship types:**
1020
+ - \`IS_TYPE\` - Project classification
1021
+ - \`USES\` - Technologies, libraries, frameworks
1022
+ - \`USES_PATTERN\` - Architectural patterns
1023
+ - \`HAS_CONSTRAINT\` - Requirements, limitations
1024
+ - \`INTEGRATES_WITH\` - External services
1025
+ - \`FOLLOWS\` - Development practices
1026
+ - \`DEPENDS_ON\` - Critical dependencies
1027
+ - \`OWNED_BY\` - Team/ownership info
1028
+
1029
+ ### Documentation Caching
1030
+
1031
+ For ANY library/framework mentioned, cache its docs:
1032
+
1033
+ \`\`\`typescript
1034
+ // Cache documentation for mentioned technologies
1035
+ docs_cache({ library: "next.js" })
1036
+ docs_cache({ library: "prisma" })
1037
+ docs_cache({ library: "zod" })
1038
+ docs_cache({ library: "tanstack-query" })
1039
+ \`\`\`
1040
+
1041
+ This enables future sessions to reference up-to-date documentation.
1042
+
1043
+ ### Code Generation Tools
1044
+
1045
+ **IMPORTANT**: When the project involves APIs, frontends, or full-stack development, inform the user about available code generation tools that can save 95%+ tokens:
1046
+
1047
+ **Kappa v2.5** - For full-stack applications:
1048
+ - Use when: Multiple entities, pages, forms, API routes
1049
+ - Tools: \`kappa_parse\`, \`kappa_generate_all\`, \`kappa_generate_schema\`, etc.
1050
+ - Generates: Drizzle schemas, Zod validators, API routes, pages, forms, design tokens
1051
+
1052
+ **CodeDNA** - For individual components:
1053
+ - Use when: Single entity, specific component, or targeted generation
1054
+ - Tools: \`codedna_generate_api\`, \`codedna_generate_frontend\`, \`codedna_generate_component\`
1055
+ - Supports: Express, FastAPI, NestJS, Hono, React, Vue, SvelteKit
1056
+
1057
+ During onboarding, if the user is building:
1058
+ - **Full-stack app with multiple entities** → Suggest Kappa: "For your Next.js app with User, Task, and Project entities, I can use Kappa to generate your entire backend and frontend from a compact spec. Would you like to see an example?"
1059
+ - **Single API or component** → Suggest CodeDNA: "For this API, I can use CodeDNA to generate the routes, validation, and types. This saves significant time and tokens."
1060
+
1061
+ Store code generation preferences:
1062
+ \`\`\`typescript
1063
+ memory_store_fact({
1064
+ entity1: "ProjectName",
1065
+ relationship: "PREFERS",
1066
+ entity2: "Kappa",
1067
+ context: "User prefers Kappa for full-stack generation"
1068
+ })
1069
+ \`\`\`
1070
+
1071
+ ### Conversation Style
1072
+
1073
+ - Be conversational, not interrogative
1074
+ - Explain WHY you're asking each question
1075
+ - Store facts immediately after each answer (don't wait)
1076
+ - Confirm what you've stored: "I've noted that you're using React for..."
1077
+ - Offer to skip questions if not relevant
1078
+ - Summarise understanding periodically
1079
+
1080
+ ### Troubleshooting ClaudeTools
1081
+
1082
+ If MCP tools aren't available:
1083
+ 1. Check \`~/.claudetools/config.json\` exists
1084
+ 2. Verify Claude Code has MCP server configured
1085
+ 3. Run \`/doctor\` command if available
1086
+
1087
+ If hooks aren't triggering:
1088
+ 1. Check \`~/.claude/hooks/\` directory
1089
+ 2. Verify hook files are executable
1090
+ 3. Check hook logs in \`/tmp/claude-*.log\`
1091
+
1092
+ ### User Request (if provided):
1093
+
1094
+ $ARGUMENTS
1095
+ `;
1096
+ async function installSlashCommands() {
1097
+ header('Slash Commands');
1098
+ // Create commands/project directory
1099
+ const projectCommandsDir = join(COMMANDS_DIR, 'project');
1100
+ if (!existsSync(projectCommandsDir)) {
1101
+ mkdirSync(projectCommandsDir, { recursive: true });
1102
+ }
1103
+ // Install project:init command
1104
+ const initPath = join(projectCommandsDir, 'init.md');
1105
+ if (existsSync(initPath)) {
1106
+ const backup = backupFile(initPath);
1107
+ if (backup)
1108
+ info(`Backed up existing command to ${basename(backup)}`);
1109
+ }
1110
+ writeFileSync(initPath, PROJECT_INIT_COMMAND);
1111
+ success('Installed /project:init slash command');
1112
+ }
923
1113
  async function configureSettings() {
924
1114
  header('Claude Code Settings');
925
1115
  // Read existing settings
@@ -1244,11 +1434,13 @@ export async function runSetup() {
1244
1434
  await configureMcpSettings(services);
1245
1435
  // Step 8: Install Hooks
1246
1436
  await installHooks();
1247
- // Step 9: Configure Settings
1437
+ // Step 9: Install Slash Commands
1438
+ await installSlashCommands();
1439
+ // Step 10: Configure Settings
1248
1440
  await configureSettings();
1249
- // Step 10: Configure CLAUDE.md
1441
+ // Step 11: Configure CLAUDE.md
1250
1442
  await configureCLAUDEMD();
1251
- // Step 11: Verify
1443
+ // Step 12: Verify
1252
1444
  await verifySetup(extendedConfig);
1253
1445
  // Done
1254
1446
  header('Setup Complete');
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@claudetools/tools",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "description": "Persistent AI memory, task management, and codebase intelligence for Claude Code",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",