claude-think 0.4.1 → 0.5.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.
Files changed (57) hide show
  1. package/CHANGELOG.md +26 -0
  2. package/README.md +5 -5
  3. package/package.json +3 -2
  4. package/src/cli/commands/context.ts +69 -0
  5. package/src/cli/commands/learn.ts +24 -23
  6. package/src/cli/commands/setup.ts +828 -611
  7. package/src/cli/commands/status.ts +57 -57
  8. package/src/cli/commands/switch.ts +32 -0
  9. package/src/cli/index.ts +61 -134
  10. package/src/core/banner.ts +4 -21
  11. package/src/core/budget.ts +96 -0
  12. package/src/core/config.ts +34 -13
  13. package/src/core/context.ts +498 -0
  14. package/src/core/extractor.ts +373 -0
  15. package/src/core/file-tree.ts +104 -25
  16. package/src/core/generator.ts +144 -22
  17. package/src/core/names.ts +52 -0
  18. package/src/core/parser.ts +17 -7
  19. package/src/core/project-config.ts +143 -0
  20. package/src/core/project-detect.ts +12 -10
  21. package/src/core/schemas.ts +53 -0
  22. package/src/core/security.ts +24 -0
  23. package/src/tui/App.tsx +140 -143
  24. package/src/tui/components/Agents.tsx +234 -67
  25. package/src/tui/components/Automation.tsx +81 -47
  26. package/src/tui/components/FullScreen.tsx +0 -10
  27. package/src/tui/components/Help.tsx +54 -53
  28. package/src/tui/components/Memory.tsx +120 -145
  29. package/src/tui/components/Navigation.tsx +82 -47
  30. package/src/tui/components/Preferences.tsx +70 -52
  31. package/src/tui/components/Preview.tsx +30 -16
  32. package/src/tui/components/Profile.tsx +122 -43
  33. package/src/tui/components/ProfileSwitcher.tsx +44 -52
  34. package/src/tui/components/Search.tsx +18 -18
  35. package/src/tui/components/Skills.tsx +234 -68
  36. package/src/tui/components/StatusBar.tsx +49 -85
  37. package/src/tui/index.tsx +19 -3
  38. package/.claude/settings.local.json +0 -39
  39. package/.think.yaml +0 -30
  40. package/bun.lock +0 -156
  41. package/src/cli/commands/allow.ts +0 -46
  42. package/src/cli/commands/edit.ts +0 -64
  43. package/src/cli/commands/help.ts +0 -63
  44. package/src/cli/commands/init.ts +0 -83
  45. package/src/cli/commands/profile-commands.ts +0 -142
  46. package/src/cli/commands/profile.ts +0 -30
  47. package/src/cli/commands/project-learn.ts +0 -113
  48. package/src/cli/commands/review.ts +0 -130
  49. package/src/cli/commands/sync.ts +0 -43
  50. package/src/cli/commands/tree.ts +0 -30
  51. package/src/templates/allowed-commands.md +0 -19
  52. package/src/templates/corrections.md +0 -4
  53. package/src/templates/pending.md +0 -5
  54. package/src/templates/settings.md +0 -6
  55. package/src/tui/components/Permissions.tsx +0 -92
  56. package/src/tui/components/QuickActions.tsx +0 -155
  57. package/tsconfig.json +0 -29
package/CHANGELOG.md CHANGED
@@ -5,6 +5,32 @@ All notable changes to this project will be documented in this file.
5
5
  The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
6
6
  and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7
7
 
8
+ ## [0.4.2] - 2025-02-06
9
+
10
+ ### Added
11
+ - **Smart project detection** - `think project` now detects:
12
+ - Monorepo tools (Turborepo, Nx, Lerna, pnpm/yarn/bun workspaces)
13
+ - Workspace structure with types (apps, packages, services)
14
+ - Frameworks from all workspaces (React, Tauri, Hono, Claude SDK, etc.)
15
+ - Tooling (Biome, Docker, TypeScript, Vite, Prisma, etc.)
16
+ - README tagline/description
17
+ - **Agent/Skill management in TUI**:
18
+ - `n` - create new with auto-generated name (e.g., "swift-falcon")
19
+ - `r` - rename selected item
20
+ - `d` - delete with confirmation
21
+ - Creative name generator for new agents/skills
22
+
23
+ ### Fixed
24
+ - YAML parsing errors no longer crash the TUI (graceful fallback)
25
+ - Long descriptions truncated in agent/skill lists
26
+
27
+ ## [0.4.1] - 2025-02-06
28
+
29
+ ### Added
30
+ - Improved project detection for monorepos
31
+ - Detect runtime (Bun vs Node vs Deno)
32
+ - Detect frameworks from workspace dependencies
33
+
8
34
  ## [0.4.0] - 2025-02-05
9
35
 
10
36
  ### Added
package/README.md CHANGED
@@ -83,7 +83,7 @@ Press `P` in the TUI to switch profiles interactively.
83
83
  | `think edit <file>` | Edit any config file |
84
84
  | `think allow "cmd"` | Pre-approve a command |
85
85
  | `think tree` | Preview project file tree |
86
- | `think project learn` | Generate CLAUDE.md for current project |
86
+ | `think project` | Generate CLAUDE.md for current project |
87
87
  | `think help` | Show all commands |
88
88
 
89
89
  ## TUI
@@ -94,13 +94,14 @@ Run `think` to launch the fullscreen TUI:
94
94
  |-----|--------|
95
95
  | `Tab` | Switch sections |
96
96
  | `↑↓` / `jk` | Navigate / scroll |
97
- | `Enter` | Edit selected item |
98
- | `d` | Delete selected item |
97
+ | `e` | Edit selected item |
98
+ | `n` | New agent/skill |
99
+ | `r` | Rename agent/skill |
100
+ | `d` | Delete item |
99
101
  | `a` | Quick actions (sync, learn, search) |
100
102
  | `p` | Preview CLAUDE.md |
101
103
  | `P` | Switch profile |
102
104
  | `/` | Search all files |
103
- | `e` | Open in $EDITOR |
104
105
  | `?` | Help |
105
106
  | `q` | Quit |
106
107
 
@@ -110,7 +111,6 @@ Run `think` to launch the fullscreen TUI:
110
111
  - **Tools** - Package manager, languages, editor
111
112
  - **Patterns** - Coding patterns to follow
112
113
  - **Anti-patterns** - Things to avoid
113
- - **Permissions** - Pre-approved commands (no prompts)
114
114
  - **Memory** - Learnings that persist across sessions
115
115
  - **Skills & Agents** - Custom workflows for Claude
116
116
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "claude-think",
3
- "version": "0.4.1",
3
+ "version": "0.5.0",
4
4
  "description": "Personal context manager for Claude - manage your preferences, patterns, and memory",
5
5
  "author": "Amit Feldman",
6
6
  "license": "MIT",
@@ -34,6 +34,7 @@
34
34
  "ink": "^6.6.0",
35
35
  "ink-text-input": "^6.0.0",
36
36
  "react": "^19.2.4",
37
- "string-similarity": "^4.0.4"
37
+ "string-similarity": "^4.0.4",
38
+ "zod": "^4.3.6"
38
39
  }
39
40
  }
@@ -0,0 +1,69 @@
1
+ import chalk from "chalk";
2
+ import { getProjectClaudeMdPath } from "../../core/config.ts";
3
+ import { generateProjectContext } from "../../core/context.ts";
4
+ import type { ContextResult } from "../../core/context.ts";
5
+
6
+ export async function contextCommand(options: {
7
+ budget?: string;
8
+ force?: boolean;
9
+ dryRun?: boolean;
10
+ }): Promise<void> {
11
+ const projectDir = process.cwd();
12
+
13
+ console.log(` ${chalk.dim("Scanning project...")}`);
14
+
15
+ let result: ContextResult;
16
+ try {
17
+ result = await generateProjectContext(projectDir, {
18
+ budget: options.budget ? parseInt(options.budget, 10) : undefined,
19
+ force: options.force,
20
+ dryRun: options.dryRun,
21
+ });
22
+ } catch (err) {
23
+ const message = err instanceof Error ? err.message : String(err);
24
+ console.log(` ${chalk.red("\u25C6")} ${message}`);
25
+ process.exit(1);
26
+ }
27
+
28
+ // Section summary
29
+ const sectionCount = result.sections.length;
30
+ const truncatedCount = result.truncated.length;
31
+
32
+ console.log(
33
+ ` ${chalk.cyan("\u25C6")} ${sectionCount} section${sectionCount !== 1 ? "s" : ""} generated` +
34
+ (truncatedCount > 0
35
+ ? chalk.dim(` · ${truncatedCount} truncated`)
36
+ : "")
37
+ );
38
+
39
+ // Token budget
40
+ const budgetValue = options.budget ? parseInt(options.budget, 10) : 8000;
41
+ const usedK = (result.totalTokens / 1000).toFixed(1);
42
+ const budgetK = (budgetValue / 1000).toFixed(0);
43
+ console.log(
44
+ ` ${chalk.cyan("\u25C6")} Project context: ${chalk.bold(usedK + "k")} of ${budgetK}k token budget`
45
+ );
46
+
47
+ if (options.dryRun) {
48
+ // Show section breakdown
49
+ console.log();
50
+ console.log(chalk.dim(" Section breakdown:"));
51
+ for (const section of result.sections) {
52
+ const sTokens = (section.tokens / 1000).toFixed(1);
53
+ console.log(
54
+ ` ${chalk.dim(String(section.priority).padStart(2))} ${section.title.padEnd(30)} ${chalk.dim(sTokens + "k tokens")}`
55
+ );
56
+ }
57
+ console.log();
58
+ console.log(chalk.dim(" Dry run — nothing written."));
59
+ } else {
60
+ const outputPath = getProjectClaudeMdPath(projectDir);
61
+ const shortPath = outputPath.replace(
62
+ process.env.HOME || "~",
63
+ "~"
64
+ );
65
+ console.log(
66
+ ` ${chalk.cyan("\u25C6")} Written to ${chalk.dim(shortPath)}`
67
+ );
68
+ }
69
+ }
@@ -1,19 +1,15 @@
1
1
  import { existsSync } from "fs";
2
2
  import { readFile, writeFile } from "fs/promises";
3
3
  import chalk from "chalk";
4
- import { CONFIG, thinkPath } from "../../core/config";
5
- import { addLearning } from "../../core/dedup";
6
- import { syncCommand } from "./sync";
7
-
8
- /**
9
- * Add a new learning with deduplication
10
- */
11
- export async function learnCommand(
12
- learning: string,
13
- options: { noSync?: boolean }
14
- ): Promise<void> {
4
+ import { CONFIG, thinkPath } from "../../core/config.ts";
5
+ import { addLearning, extractLearnings } from "../../core/dedup.ts";
6
+ import { generatePlugin } from "../../core/generator.ts";
7
+
8
+ export async function learnCommand(learning: string): Promise<void> {
15
9
  if (!existsSync(CONFIG.thinkDir)) {
16
- console.log(chalk.red("~/.think not found. Run `think init` first."));
10
+ console.log(
11
+ chalk.red(` ~/.think not found. Run ${chalk.bold("think setup")} first.`)
12
+ );
17
13
  process.exit(1);
18
14
  }
19
15
 
@@ -29,22 +25,27 @@ export async function learnCommand(
29
25
  const result = addLearning(content, learning);
30
26
 
31
27
  if (!result.added) {
32
- console.log(chalk.yellow("Similar learning already exists:"));
33
- console.log(chalk.dim(` "${result.similar}"`));
34
- console.log();
35
- console.log("Learning not added (duplicate detected).");
28
+ console.log(
29
+ ` ${chalk.yellow("\u25C6")} Similar learning already exists:`
30
+ );
31
+ console.log(chalk.dim(` "${result.similar}"`));
36
32
  return;
37
33
  }
38
34
 
39
35
  // Write updated content
40
36
  await writeFile(learningsPath, result.newContent);
41
37
 
42
- console.log(chalk.green("Learning added:"));
43
- console.log(chalk.dim(` "${learning}"`));
38
+ // Count total learnings
39
+ const total = extractLearnings(result.newContent).length;
44
40
 
45
- // Auto-sync unless disabled
46
- if (!options.noSync) {
47
- console.log();
48
- await syncCommand();
49
- }
41
+ console.log(
42
+ ` ${chalk.cyan("\u25C6")} Added learning (${chalk.bold(String(total))} total)`
43
+ );
44
+
45
+ // Auto-sync
46
+ await generatePlugin();
47
+
48
+ console.log(
49
+ ` ${chalk.cyan("\u25C6")} Synced ~/.claude/CLAUDE.md`
50
+ );
50
51
  }