Skip to content

Commit b2d68f9

Browse files
committed
updated
1 parent 2c18a86 commit b2d68f9

File tree

12 files changed

+232
-933
lines changed

12 files changed

+232
-933
lines changed

docs/api/apiaccess/rag/add_file.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,8 @@ async function exampleAddFile() {
3333
console.log("File added successfully.");
3434
}
3535

36-
exampleAddFile();
36+
exampleAddFile();
37+
```
38+
39+
### status
40+
comming soon....

docs/api/apiaccess/rag/retrieve_related_knowledge.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,4 +32,8 @@ async function exampleRetrieveRelatedKnowledge() {
3232
console.log("Related knowledge retrieved.");
3333
}
3434

35-
exampleRetrieveRelatedKnowledge();
35+
exampleRetrieveRelatedKnowledge();
36+
```
37+
38+
### status
39+
comming soon....

docs/api/apiaccess/taskplaner/addTask.md

Lines changed: 17 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,10 @@ cbparameters:
66
parameters:
77
- name: task
88
typeName: string
9-
description: The task to be added.
9+
description: The task description to be added.
1010
returns:
1111
signatureTypeName: Promise
1212
description: A promise that resolves with the response from the add task event.
13-
typeArgs:
14-
- type: reference
15-
name: AddTaskResponse
1613
data:
1714
name: addTask
1815
category: taskplaner
@@ -21,25 +18,22 @@ data:
2118
<CBBaseInfo/>
2219
<CBParameters/>
2320

24-
### Example
21+
## Example
2522

26-
```js
27-
import codebolt from '@codebolt/codeboltjs';
23+
```javascript
24+
const addResult = await codebolt.taskplaner.addTask('Complete project documentation');
25+
console.log('✅ Task added successfully', addResult);
2826

29-
async function exampleAddTask() {
30-
try {
31-
const response = await codebolt.taskplaner.addTask("Complete project documentation");
32-
console.log("Task added successfully:", response);
33-
} catch (error) {
34-
console.error("Failed to add task:", error);
35-
}
36-
}
37-
38-
exampleAddTask();
39-
```
40-
41-
### Explaination
27+
// Adding multiple tasks
28+
const tasks = [
29+
'Review code changes',
30+
'Update unit tests',
31+
'Fix bug in authentication module',
32+
'Prepare release notes'
33+
];
4234

43-
The codebolt.taskplaner.addTask function takes a single parameter, task, which is a string representing the task you want to add. This function sends the task to the task planner system using a WebSocket message.
44-
45-
task (string): The description of the task to be added.
35+
for (const task of tasks) {
36+
await codebolt.taskplaner.addTask(task);
37+
}
38+
console.log('✅ Multiple tasks added successfully');
39+
```

docs/api/apiaccess/taskplaner/getTasks.md

Lines changed: 16 additions & 28 deletions
Original file line numberDiff line numberDiff line change
@@ -7,39 +7,27 @@ cbparameters:
77
returns:
88
signatureTypeName: Promise
99
description: A promise that resolves with the response from the get tasks event.
10-
typeArgs:
11-
- type: intrinsic
12-
name: any
1310
data:
1411
name: getTasks
1512
category: taskplaner
1613
link: getTasks.md
1714
---
1815
<CBBaseInfo/>
19-
<CBParameters/>
20-
21-
### Examples
22-
23-
24-
### Example
25-
26-
```js
27-
import codebolt from '@codebolt/codeboltjs';
28-
29-
async function exampleGetTasks() {
30-
try {
31-
const response = await codebolt.taskplaner.getTasks()
32-
33-
console.log("Tasks retrieved successfully:", response);
34-
} catch (error) {
35-
console.error("Failed to retrieve tasks:", error);
36-
}
16+
<CBParameters/>
17+
18+
## Example
19+
20+
```javascript
21+
const tasksResult = await codebolt.taskplaner.getTasks();
22+
console.log('✅ Tasks retrieved successfully');
23+
console.log(' - Tasks:', tasksResult);
24+
console.log(' - Total tasks:', tasksResult?.data?.length || 0);
25+
26+
// Check if tasks exist
27+
if (tasksResult?.data && tasksResult.data.length > 0) {
28+
console.log(' - Sample tasks:');
29+
tasksResult.data.slice(0, 3).forEach((task, index) => {
30+
console.log(` ${index + 1}. ${task}`);
31+
});
3732
}
38-
39-
exampleGetTasks();
40-
4133
```
42-
43-
### Explaination
44-
45-
The codebolt.taskplaner.getTasks function does not take any parameters. It retrieves the current list of tasks from the task planner.

docs/api/apiaccess/taskplaner/updateTask.md

Lines changed: 17 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -10,9 +10,6 @@ cbparameters:
1010
returns:
1111
signatureTypeName: Promise
1212
description: A promise that resolves with the response from the update task event.
13-
typeArgs:
14-
- type: reference
15-
name: UpdateTasksResponse
1613
data:
1714
name: updateTask
1815
category: taskplaner
@@ -21,20 +18,25 @@ data:
2118
<CBBaseInfo/>
2219
<CBParameters/>
2320

24-
### Example
2521

26-
```js
22+
## Example
2723

28-
import codebolt from '@codebolt/codeboltjs';
24+
```javascript
25+
const updateResult = await codebolt.taskplaner.updateTask('Complete project documentation - UPDATED with new requirements');
26+
console.log('✅ Task updated successfully');
27+
console.log(' - Response:', updateResult);
28+
console.log(' - Success:', updateResult?.success);
2929

30-
async function exampleUpdateTask() {
31-
try {
32-
const response = await codebolt.taskplaner.updateTask("Update project documentation");
33-
console.log("Task updated successfully:", response);
34-
} catch (error) {
35-
console.error("Failed to update task:", error);
36-
}
37-
}
30+
// Update multiple tasks with status
31+
const taskUpdates = [
32+
'Review code changes - COMPLETED',
33+
'Update unit tests - IN PROGRESS',
34+
'Fix bug in authentication module - ASSIGNED to John',
35+
'Prepare release notes - PENDING review'
36+
];
3837

39-
exampleUpdateTask();
38+
for (const update of taskUpdates) {
39+
await codebolt.taskplaner.updateTask(update);
40+
}
41+
console.log('✅ Multiple task updates completed');
4042
```
Lines changed: 30 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
name: executeCommand
33
cbbaseinfo:
4-
description: >-
5-
Executes a given command and returns the result.
4+
description: Executes a given command and returns the result.
65

76
Listens for messages from the WebSocket that indicate the output, error, or
87
finish state
@@ -13,35 +12,40 @@ cbparameters:
1312
- name: command
1413
typeName: string
1514
description: The command to be executed.
15+
- name: returnEmptyStringOnSuccess
16+
typeName: boolean
17+
description: Optional parameter to return empty string on success. Defaults to false.
1618
returns:
1719
signatureTypeName: Promise
18-
description: >-
19-
A promise that resolves with the command's output, error, or finish
20-
signal.
21-
typeArgs:
22-
- type: ' '
23-
name: ' '
20+
description: A promise that resolves with the command's output or error.
21+
typeArgs: []
2422
data:
2523
name: executeCommand
2624
category: terminal
2725
link: executeCommand.md
2826
---
2927
<CBBaseInfo/>
30-
<CBParameters/>
31-
32-
### Examples
33-
34-
```js
35-
36-
// The codebolt.terminal.executeCommand function is likely used to execute a command in the terminal and retrieve the result.
37-
38-
const cmd = await codebolt.terminal.executeCommand("npm i nodemon");
39-
40-
```
41-
42-
43-
### Explaination
44-
45-
The codebolt.terminal.executeCommand function takes a single parameter, which is the command you want to execute in the terminal. It returns the result of the command execution. It has one parameter.
46-
47-
command (string): The command to be executed in the terminal. In this case, the command is "npm i nodemon", which installs the nodemon package using npm.
28+
<CBParameters/>
29+
30+
## Example
31+
32+
```javascript
33+
// Basic command execution
34+
const nodeVersionResult = await codebolt.terminal.executeCommand('node --version');
35+
console.log('✅ Node version:', nodeVersionResult);
36+
37+
const npmVersionResult = await codebolt.terminal.executeCommand('npm --version');
38+
console.log('✅ NPM version:', npmVersionResult);
39+
40+
// Command with return empty string on success
41+
const emptyResult = await codebolt.terminal.executeCommand('echo "test"', true);
42+
console.log('✅ Empty result (success):', emptyResult);
43+
44+
// Error handling
45+
try {
46+
const result = await codebolt.terminal.executeCommand('invalidcommand');
47+
console.log('Command result:', result);
48+
} catch (error) {
49+
console.error('Command failed:', error.message);
50+
}
51+
```
Lines changed: 24 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
---
22
name: executeCommandRunUntilError
33
cbbaseinfo:
4-
description: >-
5-
Executes a given command and keeps running until an error occurs.
4+
description: Executes a given command and keeps running until an error occurs.
65

76
Listens for messages from the WebSocket and resolves the promise when an
87
error is encountered.
@@ -11,12 +10,13 @@ cbparameters:
1110
- name: command
1211
typeName: string
1312
description: The command to be executed.
13+
- name: executeInMain
14+
typeName: boolean
15+
description: Optional parameter to execute in main terminal. Defaults to false.
1416
returns:
1517
signatureTypeName: Promise
1618
description: A promise that resolves when an error occurs during command execution.
17-
typeArgs:
18-
- type: reference
19-
name: CommandError
19+
2020
data:
2121
name: executeCommandRunUntilError
2222
category: terminal
@@ -25,17 +25,22 @@ data:
2525
<CBBaseInfo/>
2626
<CBParameters/>
2727

28-
29-
### Example
30-
31-
```js
32-
33-
codebolt.terminal.executeCommandRunUntilError("npm i nodemon")
34-
35-
```
36-
37-
### Explaination
38-
39-
The codebolt.terminal.executeCommandRunUntilError function takes a single parameter, command, which is a string representing the command you want to execute in the terminal. The function runs the specified command repeatedly until an error occurs.
40-
41-
command (string): The command to be executed in the terminal.
28+
## Example
29+
30+
```javascript
31+
// Run command until error occurs
32+
try {
33+
const errorResult = await codebolt.terminal.executeCommandRunUntilError('npm run dev');
34+
console.log('Command stopped due to error:', errorResult);
35+
} catch (error) {
36+
console.error('Command execution failed:', error.message);
37+
}
38+
39+
// Run in main terminal
40+
try {
41+
const result = await codebolt.terminal.executeCommandRunUntilError('npm start', true);
42+
console.log('Main terminal error:', result);
43+
} catch (error) {
44+
console.error('Main terminal execution failed:', error.message);
45+
}
46+
```

0 commit comments

Comments
 (0)