@nomad-e/bluma-cli 0.3.0 → 0.5.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.
@@ -1,167 +0,0 @@
1
- /**
2
- * Mapeia tool names + argumentos para labels de ação em tempo real (WorkingTimer).
3
- * Exemplo: shell_command → "Executing command", edit_tool → "Editing file", etc.
4
- */
5
- function parseArgsRecord(args) {
6
- if (args == null)
7
- return {};
8
- if (typeof args === "string") {
9
- try {
10
- return JSON.parse(args);
11
- }
12
- catch {
13
- return {};
14
- }
15
- }
16
- if (typeof args === "object") {
17
- return args;
18
- }
19
- return {};
20
- }
21
- /**
22
- * Gera label de ação para o WorkingTimer baseado na tool e argumentos.
23
- * Retorna string curta e descritiva (ex.: "Executing command", "Writing 2 files").
24
- */
25
- export function getToolActionLabel(toolName, args) {
26
- const p = parseArgsRecord(args);
27
- switch (toolName) {
28
- case "shell_command":
29
- case "run_command": {
30
- const cmd = typeof p.command === "string" ? p.command : "";
31
- const truncated = cmd.length > 40 ? `${cmd.slice(0, 40)}…` : cmd;
32
- return truncated ? `Executing: ${truncated}` : "Executing command";
33
- }
34
- case "command_status":
35
- return "Checking command status";
36
- case "send_command_input":
37
- return "Sending input to command";
38
- case "kill_command":
39
- return "Terminating command";
40
- case "read_file_lines": {
41
- const filepath = typeof p.filepath === "string" ? p.filepath : "";
42
- const file = filepath.split("/").pop() || filepath;
43
- return file ? `Reading: ${file}` : "Reading file";
44
- }
45
- case "count_file_lines": {
46
- const filepath = typeof p.filepath === "string" ? p.filepath : "";
47
- const file = filepath.split("/").pop() || filepath;
48
- return file ? `Counting: ${file}` : "Counting lines";
49
- }
50
- case "edit_tool": {
51
- const edits = p.edits;
52
- const count = Array.isArray(edits) ? edits.length : 1;
53
- const filepath = typeof p.file_path === "string" ? p.file_path : (Array.isArray(edits) && edits[0]?.file_path ? edits[0].file_path : "");
54
- const file = filepath ? filepath.split("/").pop() : "file";
55
- return count === 1 ? `Editing: ${file}` : `Editing ${count} changes`;
56
- }
57
- case "file_write": {
58
- const filepath = typeof p.filepath === "string" ? p.filepath : "";
59
- const file = filepath.split("/").pop() || filepath;
60
- return file ? `Writing: ${file}` : "Writing file";
61
- }
62
- case "grep_search": {
63
- const query = typeof p.query === "string" ? p.query : "";
64
- const truncated = query.length > 30 ? `${query.slice(0, 30)}…` : query;
65
- return truncated ? `Searching: "${truncated}"` : "Searching";
66
- }
67
- case "find_by_name": {
68
- const pattern = typeof p.pattern === "string" ? p.pattern : "";
69
- return pattern ? `Finding: ${pattern}` : "Finding files";
70
- }
71
- case "view_file_outline": {
72
- const filepath = typeof p.file_path === "string" ? p.file_path : "";
73
- const file = filepath.split("/").pop() || filepath;
74
- return file ? `Outline: ${file}` : "Reading outline";
75
- }
76
- case "web_fetch": {
77
- const url = typeof p.url === "string" ? p.url : "";
78
- const truncated = url.length > 40 ? `${url.slice(0, 40)}…` : url;
79
- return truncated ? `Fetching: ${truncated}` : "Fetching URL";
80
- }
81
- case "search_web": {
82
- const query = typeof p.query === "string" ? p.query : "";
83
- const truncated = query.length > 30 ? `${query.slice(0, 30)}…` : query;
84
- return truncated ? `Web search: "${truncated}"` : "Searching web";
85
- }
86
- case "spawn_agent": {
87
- const title = typeof p.title === "string" ? p.title : "";
88
- const task = typeof p.task === "string" ? p.task : "";
89
- const label = title || (task ? task.slice(0, 40) : "task");
90
- return `Spawning agent: ${label}`;
91
- }
92
- case "wait_agent":
93
- return "Waiting for agent";
94
- case "list_agents":
95
- return "Listing agents";
96
- case "todo": {
97
- const action = typeof p.action === "string" ? p.action : "update";
98
- return `Updating todo: ${action}`;
99
- }
100
- case "task_boundary": {
101
- const mode = typeof p.mode === "string" ? p.mode : "";
102
- const taskName = typeof p.task_name === "string" ? p.task_name : "";
103
- return taskName ? `${mode}: ${taskName}` : `Task ${mode}`;
104
- }
105
- case "task_create":
106
- case "task_list":
107
- case "task_get":
108
- case "task_update":
109
- case "task_stop": {
110
- const title = typeof p.title === "string" ? p.title : "";
111
- return title ? `Task: ${title}` : "Managing task";
112
- }
113
- case "load_skill": {
114
- const skill = typeof p.skill_name === "string" ? p.skill_name : "";
115
- return skill ? `Loading skill: ${skill}` : "Loading skill";
116
- }
117
- case "coding_memory": {
118
- const action = typeof p.action === "string" ? p.action : "update";
119
- return `Coding memory: ${action}`;
120
- }
121
- case "create_artifact": {
122
- const filename = typeof p.filename === "string" ? p.filename : "";
123
- return filename ? `Creating: ${filename}` : "Creating artifact";
124
- }
125
- case "read_artifact": {
126
- const filename = typeof p.filename === "string" ? p.filename : "";
127
- return filename ? `Reading: ${filename}` : "Reading artifact";
128
- }
129
- case "message":
130
- return "Writing message";
131
- case "ask_user_question":
132
- return "Asking question";
133
- case "enter_plan_mode":
134
- return "Entering plan mode";
135
- case "exit_plan_mode":
136
- return "Exiting plan mode";
137
- case "list_mcp_resources":
138
- return "Listing MCP resources";
139
- case "read_mcp_resource": {
140
- const server = typeof p.server === "string" ? p.server : "";
141
- const uri = typeof p.uri === "string" ? p.uri : "";
142
- return `Reading MCP: ${server || uri || "resource"}`;
143
- }
144
- case "cron_create":
145
- return "Scheduling reminder";
146
- case "cron_list":
147
- return "Listing reminders";
148
- case "cron_delete":
149
- return "Canceling reminder";
150
- case "notebook_edit": {
151
- const filepath = typeof p.filepath === "string" ? p.filepath : "";
152
- const file = filepath.split("/").pop() || filepath;
153
- return file ? `Editing notebook: ${file}` : "Editing notebook";
154
- }
155
- case "lsp_query": {
156
- const operation = typeof p.operation === "string" ? p.operation : "";
157
- return `LSP: ${operation || "query"}`;
158
- }
159
- default: {
160
- // Fallback: prettify snake_case
161
- const pretty = toolName
162
- .replace(/_/g, " ")
163
- .replace(/\b\w/g, (c) => c.toUpperCase());
164
- return pretty || "Working";
165
- }
166
- }
167
- }