@lanonasis/cli 1.2.0 ā 1.2.2
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/README.md +30 -4
- package/dist/commands/api-keys.d.ts +3 -0
- package/dist/commands/api-keys.js +812 -0
- package/dist/commands/mcp.js +2 -2
- package/dist/commands/memory.js +22 -20
- package/dist/index-simple.js +522 -189
- package/dist/index.js +320 -23
- package/dist/utils/api.d.ts +12 -2
- package/dist/utils/api.js +17 -0
- package/dist/utils/formatting.d.ts +2 -0
- package/dist/utils/formatting.js +13 -0
- package/dist/utils/mcp-client.js +13 -7
- package/package.json +8 -3
package/dist/commands/mcp.js
CHANGED
|
@@ -48,7 +48,7 @@ export function mcpCommands(program) {
|
|
|
48
48
|
spinner.fail('Failed to auto-connect to MCP');
|
|
49
49
|
}
|
|
50
50
|
}
|
|
51
|
-
catch
|
|
51
|
+
catch {
|
|
52
52
|
spinner.fail('MCP auto-connect failed');
|
|
53
53
|
}
|
|
54
54
|
});
|
|
@@ -196,7 +196,7 @@ export function mcpCommands(program) {
|
|
|
196
196
|
try {
|
|
197
197
|
args = JSON.parse(options.args);
|
|
198
198
|
}
|
|
199
|
-
catch
|
|
199
|
+
catch {
|
|
200
200
|
spinner.fail('Invalid JSON arguments');
|
|
201
201
|
process.exit(1);
|
|
202
202
|
}
|
package/dist/commands/memory.js
CHANGED
|
@@ -6,7 +6,6 @@ import wrap from 'word-wrap';
|
|
|
6
6
|
import { format } from 'date-fns';
|
|
7
7
|
import { apiClient } from '../utils/api.js';
|
|
8
8
|
import { formatBytes, truncateText } from '../utils/formatting.js';
|
|
9
|
-
// Using GetMemoriesParams from api.ts
|
|
10
9
|
export function memoryCommands(program) {
|
|
11
10
|
// Create memory
|
|
12
11
|
program
|
|
@@ -102,26 +101,26 @@ export function memoryCommands(program) {
|
|
|
102
101
|
try {
|
|
103
102
|
const spinner = ora('Fetching memories...').start();
|
|
104
103
|
const params = {
|
|
105
|
-
|
|
104
|
+
page: parseInt(options.page || '1'),
|
|
106
105
|
limit: parseInt(options.limit || '20'),
|
|
107
|
-
|
|
108
|
-
|
|
106
|
+
sort: options.sort || 'created_at',
|
|
107
|
+
order: options.order || 'desc'
|
|
109
108
|
};
|
|
110
109
|
if (options.type)
|
|
111
110
|
params.memory_type = options.type;
|
|
112
111
|
if (options.tags)
|
|
113
|
-
params.tags = options.tags
|
|
114
|
-
|
|
112
|
+
params.tags = options.tags;
|
|
113
|
+
if (options.userId)
|
|
114
|
+
params.user_id = options.userId;
|
|
115
115
|
const result = await apiClient.getMemories(params);
|
|
116
116
|
spinner.stop();
|
|
117
|
-
|
|
117
|
+
const memories = result.memories || result.data || [];
|
|
118
|
+
if (memories.length === 0) {
|
|
118
119
|
console.log(chalk.yellow('No memories found'));
|
|
119
120
|
return;
|
|
120
121
|
}
|
|
121
122
|
console.log(chalk.blue.bold(`\nš Memories (${result.pagination.total} total)`));
|
|
122
|
-
|
|
123
|
-
const totalPages = Math.ceil(result.pagination.total / result.pagination.limit);
|
|
124
|
-
console.log(chalk.gray(`Page ${currentPage} of ${totalPages}`));
|
|
123
|
+
console.log(chalk.gray(`Page ${result.pagination.page || 1} of ${result.pagination.pages || Math.ceil(result.pagination.total / result.pagination.limit)}`));
|
|
125
124
|
console.log();
|
|
126
125
|
const outputFormat = process.env.CLI_OUTPUT_FORMAT || 'table';
|
|
127
126
|
if (outputFormat === 'json') {
|
|
@@ -129,7 +128,7 @@ export function memoryCommands(program) {
|
|
|
129
128
|
}
|
|
130
129
|
else {
|
|
131
130
|
// Table format
|
|
132
|
-
const tableData =
|
|
131
|
+
const tableData = memories.map((memory) => [
|
|
133
132
|
truncateText(memory.title, 30),
|
|
134
133
|
memory.memory_type,
|
|
135
134
|
memory.tags.slice(0, 3).join(', '),
|
|
@@ -137,6 +136,7 @@ export function memoryCommands(program) {
|
|
|
137
136
|
memory.access_count
|
|
138
137
|
]);
|
|
139
138
|
const tableConfig = {
|
|
139
|
+
header: ['Title', 'Type', 'Tags', 'Created', 'Access'],
|
|
140
140
|
columnDefault: {
|
|
141
141
|
width: 20,
|
|
142
142
|
wrapWord: true
|
|
@@ -149,12 +149,13 @@ export function memoryCommands(program) {
|
|
|
149
149
|
{ width: 8 }
|
|
150
150
|
]
|
|
151
151
|
};
|
|
152
|
-
|
|
153
|
-
|
|
152
|
+
console.log(table([tableConfig.header, ...tableData], {
|
|
153
|
+
columnDefault: tableConfig.columnDefault,
|
|
154
|
+
columns: tableConfig.columns
|
|
155
|
+
}));
|
|
154
156
|
// Pagination info
|
|
155
|
-
if (result.pagination.
|
|
156
|
-
|
|
157
|
-
console.log(chalk.gray(`\nUse --page ${nextPage} for next page`));
|
|
157
|
+
if (result.pagination.pages > 1) {
|
|
158
|
+
console.log(chalk.gray(`\nUse --page ${result.pagination.page + 1} for next page`));
|
|
158
159
|
}
|
|
159
160
|
}
|
|
160
161
|
}
|
|
@@ -188,14 +189,15 @@ export function memoryCommands(program) {
|
|
|
188
189
|
}
|
|
189
190
|
const result = await apiClient.searchMemories(query, searchOptions);
|
|
190
191
|
spinner.stop();
|
|
191
|
-
|
|
192
|
+
const results = result.results || result.data || [];
|
|
193
|
+
if (results.length === 0) {
|
|
192
194
|
console.log(chalk.yellow('No memories found matching your search'));
|
|
193
195
|
return;
|
|
194
196
|
}
|
|
195
|
-
console.log(chalk.blue.bold(`\nš Search Results (${result.
|
|
196
|
-
console.log(chalk.gray(`Query: "${query}"`));
|
|
197
|
+
console.log(chalk.blue.bold(`\nš Search Results (${result.total_results || results.length} found)`));
|
|
198
|
+
console.log(chalk.gray(`Query: "${query}" | Search time: ${result.search_time_ms || 0}ms`));
|
|
197
199
|
console.log();
|
|
198
|
-
|
|
200
|
+
results.forEach((memory, index) => {
|
|
199
201
|
const score = (memory.relevance_score * 100).toFixed(1);
|
|
200
202
|
console.log(chalk.green(`${index + 1}. ${memory.title}`) + chalk.gray(` (${score}% match)`));
|
|
201
203
|
console.log(chalk.white(` ${truncateText(memory.content, 100)}`));
|