@lifestreamdynamics/vault-cli 1.3.1 → 1.3.3
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/dist/commands/ai.js +78 -0
- package/dist/commands/custom-domains.js +22 -16
- package/package.json +1 -1
package/dist/commands/ai.js
CHANGED
|
@@ -121,4 +121,82 @@ export function registerAiCommands(program) {
|
|
|
121
121
|
handleError(out, err, 'Failed to summarize document');
|
|
122
122
|
}
|
|
123
123
|
});
|
|
124
|
+
addGlobalFlags(ai.command('similar')
|
|
125
|
+
.description('Find documents similar to a given document')
|
|
126
|
+
.argument('<vaultId>', 'Vault ID')
|
|
127
|
+
.argument('<documentId>', 'Document ID')
|
|
128
|
+
.option('-l, --limit <limit>', 'Maximum results (1-50)', '10'))
|
|
129
|
+
.action(async (vaultId, documentId, _opts) => {
|
|
130
|
+
const flags = resolveFlags(_opts);
|
|
131
|
+
const out = createOutput(flags);
|
|
132
|
+
out.startSpinner('Finding similar documents...');
|
|
133
|
+
try {
|
|
134
|
+
const client = await getClientAsync();
|
|
135
|
+
const { similar } = await client.ai.similar({ documentId, vaultId, limit: Number(_opts.limit) || undefined });
|
|
136
|
+
out.stopSpinner();
|
|
137
|
+
out.list(similar.map(d => ({ id: d.id, path: d.path, title: d.title ?? '(untitled)', similarity: d.similarity.toFixed(4) })), {
|
|
138
|
+
emptyMessage: 'No similar documents found.',
|
|
139
|
+
columns: [
|
|
140
|
+
{ key: 'id', header: 'ID' },
|
|
141
|
+
{ key: 'path', header: 'Path' },
|
|
142
|
+
{ key: 'title', header: 'Title' },
|
|
143
|
+
{ key: 'similarity', header: 'Similarity' },
|
|
144
|
+
],
|
|
145
|
+
textFn: (d) => `${chalk.cyan(String(d.path))} (${String(d.similarity)})`,
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
catch (err) {
|
|
149
|
+
handleError(out, err, 'Failed to find similar documents');
|
|
150
|
+
}
|
|
151
|
+
});
|
|
152
|
+
addGlobalFlags(ai.command('assist')
|
|
153
|
+
.description('Get AI text assistance')
|
|
154
|
+
.argument('<vaultId>', 'Vault ID')
|
|
155
|
+
.requiredOption('-t, --text <text>', 'Text to process')
|
|
156
|
+
.requiredOption('-i, --instruction <instruction>', 'Instruction for the AI')
|
|
157
|
+
.option('-c, --context <context>', 'Additional context'))
|
|
158
|
+
.action(async (vaultId, _opts) => {
|
|
159
|
+
const flags = resolveFlags(_opts);
|
|
160
|
+
const out = createOutput(flags);
|
|
161
|
+
out.startSpinner('Processing with AI...');
|
|
162
|
+
try {
|
|
163
|
+
const client = await getClientAsync();
|
|
164
|
+
const response = await client.ai.assist({
|
|
165
|
+
vaultId,
|
|
166
|
+
text: String(_opts.text),
|
|
167
|
+
instruction: String(_opts.instruction),
|
|
168
|
+
context: _opts.context ? String(_opts.context) : undefined,
|
|
169
|
+
});
|
|
170
|
+
out.stopSpinner();
|
|
171
|
+
process.stdout.write(response.result + '\n');
|
|
172
|
+
process.stdout.write(chalk.dim(`Tokens used: ${response.tokensUsed}`) + '\n');
|
|
173
|
+
}
|
|
174
|
+
catch (err) {
|
|
175
|
+
handleError(out, err, 'Failed to get AI assistance');
|
|
176
|
+
}
|
|
177
|
+
});
|
|
178
|
+
addGlobalFlags(ai.command('suggest')
|
|
179
|
+
.description('Get AI writing suggestions for a document')
|
|
180
|
+
.argument('<vaultId>', 'Vault ID')
|
|
181
|
+
.argument('<docPath>', 'Document path')
|
|
182
|
+
.requiredOption('--type <type>', 'Suggestion type: grammar, style, expand, shorten'))
|
|
183
|
+
.action(async (vaultId, docPath, _opts) => {
|
|
184
|
+
const flags = resolveFlags(_opts);
|
|
185
|
+
const out = createOutput(flags);
|
|
186
|
+
out.startSpinner('Getting suggestions...');
|
|
187
|
+
try {
|
|
188
|
+
const client = await getClientAsync();
|
|
189
|
+
const response = await client.ai.suggest({
|
|
190
|
+
vaultId,
|
|
191
|
+
documentPath: docPath,
|
|
192
|
+
type: String(_opts.type),
|
|
193
|
+
});
|
|
194
|
+
out.stopSpinner();
|
|
195
|
+
process.stdout.write(response.suggestion + '\n');
|
|
196
|
+
process.stdout.write(chalk.dim(`Type: ${response.type} | Tokens used: ${response.tokensUsed}`) + '\n');
|
|
197
|
+
}
|
|
198
|
+
catch (err) {
|
|
199
|
+
handleError(out, err, 'Failed to get AI suggestions');
|
|
200
|
+
}
|
|
201
|
+
});
|
|
124
202
|
}
|
|
@@ -14,15 +14,15 @@ export function registerCustomDomainCommands(program) {
|
|
|
14
14
|
const client = await getClientAsync();
|
|
15
15
|
const list = await client.customDomains.list();
|
|
16
16
|
out.stopSpinner();
|
|
17
|
-
out.list(list.map(d => ({ id: d.id, domain: d.domain,
|
|
17
|
+
out.list(list.map(d => ({ id: d.id, domain: d.domain, status: d.status, createdAt: d.createdAt })), {
|
|
18
18
|
emptyMessage: 'No custom domains found.',
|
|
19
19
|
columns: [
|
|
20
20
|
{ key: 'id', header: 'ID' },
|
|
21
21
|
{ key: 'domain', header: 'Domain' },
|
|
22
|
-
{ key: '
|
|
22
|
+
{ key: 'status', header: 'Status' },
|
|
23
23
|
{ key: 'createdAt', header: 'Created' },
|
|
24
24
|
],
|
|
25
|
-
textFn: (d) => `${chalk.cyan(String(d.domain))} — ${d.
|
|
25
|
+
textFn: (d) => `${chalk.cyan(String(d.domain))} — ${d.status === 'verified' ? chalk.green('verified') : chalk.yellow(String(d.status))}`,
|
|
26
26
|
});
|
|
27
27
|
}
|
|
28
28
|
catch (err) {
|
|
@@ -40,7 +40,7 @@ export function registerCustomDomainCommands(program) {
|
|
|
40
40
|
const client = await getClientAsync();
|
|
41
41
|
const d = await client.customDomains.get(domainId);
|
|
42
42
|
out.stopSpinner();
|
|
43
|
-
out.record({ id: d.id, domain: d.domain,
|
|
43
|
+
out.record({ id: d.id, domain: d.domain, status: d.status, sslStatus: d.sslStatus, verificationToken: d.verificationToken, createdAt: d.createdAt });
|
|
44
44
|
}
|
|
45
45
|
catch (err) {
|
|
46
46
|
handleError(out, err, 'Failed to fetch custom domain');
|
|
@@ -59,7 +59,7 @@ export function registerCustomDomainCommands(program) {
|
|
|
59
59
|
out.success(`Domain added: ${d.domain}`, { id: d.id, domain: d.domain, verificationToken: d.verificationToken });
|
|
60
60
|
if (flags.output !== 'json') {
|
|
61
61
|
process.stdout.write(`\nTo verify, add this DNS TXT record:\n`);
|
|
62
|
-
process.stdout.write(` ${chalk.cyan('
|
|
62
|
+
process.stdout.write(` ${chalk.cyan('_lsv-verify.' + d.domain)} TXT ${chalk.green(d.verificationToken)}\n`);
|
|
63
63
|
process.stdout.write(`\nThen run: lsvault custom-domains verify ${d.id}\n`);
|
|
64
64
|
}
|
|
65
65
|
}
|
|
@@ -115,7 +115,7 @@ export function registerCustomDomainCommands(program) {
|
|
|
115
115
|
try {
|
|
116
116
|
const client = await getClientAsync();
|
|
117
117
|
const d = await client.customDomains.verify(domainId);
|
|
118
|
-
out.success(`Domain ${d.verified ? 'verified' : 'not yet verified'}: ${d.domain}`, { id: d.id, domain: d.domain,
|
|
118
|
+
out.success(`Domain ${d.status === 'verified' ? 'verified' : 'not yet verified'}: ${d.domain}`, { id: d.id, domain: d.domain, status: d.status });
|
|
119
119
|
}
|
|
120
120
|
catch (err) {
|
|
121
121
|
handleError(out, err, 'Failed to verify custom domain');
|
|
@@ -132,18 +132,24 @@ export function registerCustomDomainCommands(program) {
|
|
|
132
132
|
const client = await getClientAsync();
|
|
133
133
|
const result = await client.customDomains.checkDns(domainId);
|
|
134
134
|
out.stopSpinner();
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
process.stdout.write(
|
|
135
|
+
if (flags.output === 'json') {
|
|
136
|
+
out.record(result);
|
|
137
|
+
}
|
|
138
|
+
else {
|
|
139
|
+
process.stdout.write(`Domain: ${chalk.cyan(result.domain)}\n\n`);
|
|
140
|
+
for (const check of result.checks) {
|
|
141
|
+
const icon = check.status === 'pass' ? chalk.green('✓') : chalk.red('✗');
|
|
142
|
+
process.stdout.write(`${icon} ${chalk.bold(check.type)} — ${check.hostname}\n`);
|
|
143
|
+
process.stdout.write(` Expected : ${check.expected}\n`);
|
|
144
|
+
process.stdout.write(` Found : ${check.found.length > 0 ? check.found.join(', ') : chalk.yellow('(none)')}\n`);
|
|
145
|
+
process.stdout.write(` Status : ${check.status === 'pass' ? chalk.green('pass') : chalk.red('fail')}\n\n`);
|
|
146
|
+
}
|
|
147
|
+
const allPassed = result.checks.length > 0 && result.checks.every(c => c.status === 'pass');
|
|
148
|
+
if (allPassed) {
|
|
149
|
+
process.stdout.write(chalk.green('All DNS checks passed.\n'));
|
|
144
150
|
}
|
|
145
151
|
else {
|
|
146
|
-
process.stdout.write(chalk.yellow(
|
|
152
|
+
process.stdout.write(chalk.yellow('One or more DNS checks failed. Allow time for propagation and try again.\n'));
|
|
147
153
|
}
|
|
148
154
|
}
|
|
149
155
|
}
|