vibeforce 0.1.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.
- package/dist/commands/format.d.ts +23 -0
- package/dist/commands/format.d.ts.map +1 -0
- package/dist/commands/format.js +107 -0
- package/dist/commands/format.js.map +1 -0
- package/dist/commands/model.d.ts +15 -0
- package/dist/commands/model.d.ts.map +1 -0
- package/dist/commands/model.js +169 -0
- package/dist/commands/model.js.map +1 -0
- package/dist/commands/registry.d.ts +36 -0
- package/dist/commands/registry.d.ts.map +1 -0
- package/dist/commands/registry.js +892 -0
- package/dist/commands/registry.js.map +1 -0
- package/dist/commands/skill.d.ts +10 -0
- package/dist/commands/skill.d.ts.map +1 -0
- package/dist/commands/skill.js +63 -0
- package/dist/commands/skill.js.map +1 -0
- package/dist/commands/tool.d.ts +9 -0
- package/dist/commands/tool.d.ts.map +1 -0
- package/dist/commands/tool.js +35 -0
- package/dist/commands/tool.js.map +1 -0
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +69 -0
- package/dist/index.js.map +1 -0
- package/dist/ui/agent-astro.png +0 -0
- package/dist/ui/app.d.ts +10 -0
- package/dist/ui/app.d.ts.map +1 -0
- package/dist/ui/app.js +170 -0
- package/dist/ui/app.js.map +1 -0
- package/dist/ui/greeting.d.ts +8 -0
- package/dist/ui/greeting.d.ts.map +1 -0
- package/dist/ui/greeting.js +108 -0
- package/dist/ui/greeting.js.map +1 -0
- package/package.json +42 -0
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for Salesforce CLI command output.
|
|
3
|
+
* Produces clean, aligned text tables for terminal display.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Format data as an aligned text table.
|
|
7
|
+
*/
|
|
8
|
+
export declare function formatTable(headers: string[], rows: string[][]): string;
|
|
9
|
+
/**
|
|
10
|
+
* Format SOQL query results as a table.
|
|
11
|
+
*/
|
|
12
|
+
export declare function formatQueryResults(data: {
|
|
13
|
+
records: any[];
|
|
14
|
+
}): string;
|
|
15
|
+
/**
|
|
16
|
+
* Format sObject describe fields as a table.
|
|
17
|
+
*/
|
|
18
|
+
export declare function formatFieldList(fields: any[]): string;
|
|
19
|
+
/**
|
|
20
|
+
* Format org list data as a table.
|
|
21
|
+
*/
|
|
22
|
+
export declare function formatOrgInfo(data: any): string;
|
|
23
|
+
//# sourceMappingURL=format.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/commands/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,wBAAgB,WAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE,IAAI,EAAE,MAAM,EAAE,EAAE,GAAG,MAAM,CAkBvE;AAED;;GAEG;AACH,wBAAgB,kBAAkB,CAAC,IAAI,EAAE;IAAE,OAAO,EAAE,GAAG,EAAE,CAAA;CAAE,GAAG,MAAM,CAmBnE;AAED;;GAEG;AACH,wBAAgB,eAAe,CAAC,MAAM,EAAE,GAAG,EAAE,GAAG,MAAM,CAgBrD;AAED;;GAEG;AACH,wBAAgB,aAAa,CAAC,IAAI,EAAE,GAAG,GAAG,MAAM,CAgD/C"}
|
|
@@ -0,0 +1,107 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Formatting utilities for Salesforce CLI command output.
|
|
3
|
+
* Produces clean, aligned text tables for terminal display.
|
|
4
|
+
*/
|
|
5
|
+
/**
|
|
6
|
+
* Format data as an aligned text table.
|
|
7
|
+
*/
|
|
8
|
+
export function formatTable(headers, rows) {
|
|
9
|
+
if (rows.length === 0) {
|
|
10
|
+
return `${headers.join(" ")}\n(no results)`;
|
|
11
|
+
}
|
|
12
|
+
// Calculate column widths (minimum = header width)
|
|
13
|
+
const widths = headers.map((h, i) => {
|
|
14
|
+
const dataMax = Math.max(0, ...rows.map((r) => (r[i] ?? "").length));
|
|
15
|
+
return Math.max(h.length, dataMax);
|
|
16
|
+
});
|
|
17
|
+
const headerLine = headers.map((h, i) => h.padEnd(widths[i])).join(" ");
|
|
18
|
+
const separator = widths.map((w) => "─".repeat(w)).join("──");
|
|
19
|
+
const dataLines = rows.map((row) => row.map((cell, i) => (cell ?? "").padEnd(widths[i])).join(" "));
|
|
20
|
+
return [headerLine, separator, ...dataLines].join("\n");
|
|
21
|
+
}
|
|
22
|
+
/**
|
|
23
|
+
* Format SOQL query results as a table.
|
|
24
|
+
*/
|
|
25
|
+
export function formatQueryResults(data) {
|
|
26
|
+
const records = data.records ?? [];
|
|
27
|
+
if (records.length === 0) {
|
|
28
|
+
return "Query returned 0 records.";
|
|
29
|
+
}
|
|
30
|
+
// Extract column names from first record, ignoring "attributes"
|
|
31
|
+
const headers = Object.keys(records[0]).filter((k) => k !== "attributes");
|
|
32
|
+
const rows = records.map((rec) => headers.map((h) => {
|
|
33
|
+
const val = rec[h];
|
|
34
|
+
if (val === null || val === undefined)
|
|
35
|
+
return "";
|
|
36
|
+
if (typeof val === "object")
|
|
37
|
+
return JSON.stringify(val);
|
|
38
|
+
return String(val);
|
|
39
|
+
}));
|
|
40
|
+
const countLine = `${records.length} record${records.length === 1 ? "" : "s"} returned.`;
|
|
41
|
+
return `${formatTable(headers, rows)}\n\n${countLine}`;
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Format sObject describe fields as a table.
|
|
45
|
+
*/
|
|
46
|
+
export function formatFieldList(fields) {
|
|
47
|
+
if (!fields || fields.length === 0) {
|
|
48
|
+
return "(no fields)";
|
|
49
|
+
}
|
|
50
|
+
const headers = ["Name", "Type", "Required", "Reference To"];
|
|
51
|
+
const rows = fields.map((f) => [
|
|
52
|
+
f.name ?? "",
|
|
53
|
+
f.type ?? "",
|
|
54
|
+
f.nillable === false ? "Yes" : "",
|
|
55
|
+
Array.isArray(f.referenceTo) && f.referenceTo.length > 0
|
|
56
|
+
? f.referenceTo.join(", ")
|
|
57
|
+
: "",
|
|
58
|
+
]);
|
|
59
|
+
return formatTable(headers, rows);
|
|
60
|
+
}
|
|
61
|
+
/**
|
|
62
|
+
* Format org list data as a table.
|
|
63
|
+
*/
|
|
64
|
+
export function formatOrgInfo(data) {
|
|
65
|
+
// sf org list returns { scratchOrgs, nonScratchOrgs, sandboxes, ... } or similar
|
|
66
|
+
const sections = [];
|
|
67
|
+
const allOrgs = [];
|
|
68
|
+
const addOrgs = (list, type) => {
|
|
69
|
+
if (!Array.isArray(list))
|
|
70
|
+
return;
|
|
71
|
+
for (const org of list) {
|
|
72
|
+
allOrgs.push({
|
|
73
|
+
alias: org.alias ?? "",
|
|
74
|
+
username: org.username ?? "",
|
|
75
|
+
type,
|
|
76
|
+
status: org.connectedStatus ?? org.status ?? "",
|
|
77
|
+
});
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
if (data && typeof data === "object") {
|
|
81
|
+
addOrgs(data.nonScratchOrgs, "Production");
|
|
82
|
+
addOrgs(data.scratchOrgs, "Scratch");
|
|
83
|
+
addOrgs(data.sandboxes, "Sandbox");
|
|
84
|
+
// Some versions of sf CLI return a flat "other" array
|
|
85
|
+
if (Array.isArray(data.other)) {
|
|
86
|
+
addOrgs(data.other, "Other");
|
|
87
|
+
}
|
|
88
|
+
// Fallback: if no recognized keys, try treating data as an array
|
|
89
|
+
if (allOrgs.length === 0 && Array.isArray(data)) {
|
|
90
|
+
for (const org of data) {
|
|
91
|
+
allOrgs.push({
|
|
92
|
+
alias: org.alias ?? "",
|
|
93
|
+
username: org.username ?? "",
|
|
94
|
+
type: org.isScratch ? "Scratch" : org.isSandbox ? "Sandbox" : "Production",
|
|
95
|
+
status: org.connectedStatus ?? org.status ?? "",
|
|
96
|
+
});
|
|
97
|
+
}
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (allOrgs.length === 0) {
|
|
101
|
+
return "No authenticated orgs found.";
|
|
102
|
+
}
|
|
103
|
+
const headers = ["Alias", "Username", "Type", "Status"];
|
|
104
|
+
const rows = allOrgs.map((o) => [o.alias, o.username, o.type, o.status]);
|
|
105
|
+
return formatTable(headers, rows);
|
|
106
|
+
}
|
|
107
|
+
//# sourceMappingURL=format.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"format.js","sourceRoot":"","sources":["../../src/commands/format.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH;;GAEG;AACH,MAAM,UAAU,WAAW,CAAC,OAAiB,EAAE,IAAgB;IAC7D,IAAI,IAAI,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACtB,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,gBAAgB,CAAC;IAC/C,CAAC;IAED,mDAAmD;IACnD,MAAM,MAAM,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE;QAClC,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;QACrE,OAAO,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACrC,CAAC,CAAC,CAAC;IAEH,MAAM,UAAU,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,MAAM,CAAC,MAAM,CAAC,CAAC,CAAE,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC1E,MAAM,SAAS,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAC9D,MAAM,SAAS,GAAG,IAAI,CAAC,GAAG,CAAC,CAAC,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AAE,CAAC;QACzB,OAAO,8BAA8B,CAAC;IACxC,CAAC;IAED,MAAM,OAAO,GAAG,CAAC,OAAO,EAAE,UAAU,EAAE,MAAM,EAAE,QAAQ,CAAC,CAAC;IACxD,MAAM,IAAI,GAAG,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC,CAAC,CAAC,KAAK,EAAE,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,IAAI,EAAE,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC;IACzE,OAAO,WAAW,CAAC,OAAO,EAAE,IAAI,CAAC,CAAC;AACpC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for model management.
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* model:list — list all available models
|
|
6
|
+
* model:current — show the current default model
|
|
7
|
+
* model:select — switch model for session (alias for model:default)
|
|
8
|
+
* model:default — set persistent default model
|
|
9
|
+
* model:test — test model connectivity
|
|
10
|
+
* provider:add — interactive wizard to add a provider
|
|
11
|
+
* provider:remove — remove a provider
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from 'commander';
|
|
14
|
+
export declare const modelCommands: Command[];
|
|
15
|
+
//# sourceMappingURL=model.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.d.ts","sourceRoot":"","sources":["../../src/commands/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAkLpC,eAAO,MAAM,aAAa,WAQzB,CAAC"}
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* CLI commands for model management.
|
|
3
|
+
*
|
|
4
|
+
* Subcommands:
|
|
5
|
+
* model:list — list all available models
|
|
6
|
+
* model:current — show the current default model
|
|
7
|
+
* model:select — switch model for session (alias for model:default)
|
|
8
|
+
* model:default — set persistent default model
|
|
9
|
+
* model:test — test model connectivity
|
|
10
|
+
* provider:add — interactive wizard to add a provider
|
|
11
|
+
* provider:remove — remove a provider
|
|
12
|
+
*/
|
|
13
|
+
import { Command } from 'commander';
|
|
14
|
+
import { ModelRegistry, readConfig, setDefaultModel as persistDefaultModel, addProvider as persistProvider, removeProvider as persistRemoveProvider, ensureConfigFile, } from 'vibeforce-core';
|
|
15
|
+
// ----------------------------------------------------------------
|
|
16
|
+
// model:list
|
|
17
|
+
// ----------------------------------------------------------------
|
|
18
|
+
const modelList = new Command('model-list')
|
|
19
|
+
.description('List all available models with provider and type labels')
|
|
20
|
+
.action(() => {
|
|
21
|
+
ensureConfigFile();
|
|
22
|
+
const config = readConfig();
|
|
23
|
+
const registry = new ModelRegistry(config);
|
|
24
|
+
const models = registry.listModels();
|
|
25
|
+
if (models.length === 0) {
|
|
26
|
+
console.log('No models configured. Run `vibeforce provider:add` to get started.');
|
|
27
|
+
return;
|
|
28
|
+
}
|
|
29
|
+
const defaultId = config.defaultModel;
|
|
30
|
+
console.log('\nAvailable models:\n');
|
|
31
|
+
for (const m of models) {
|
|
32
|
+
const isDefault = m.id === defaultId ? ' (default)' : '';
|
|
33
|
+
const typeLabel = m.type.toUpperCase().padEnd(7);
|
|
34
|
+
console.log(` ${typeLabel} ${m.provider.padEnd(12)} ${m.model}${isDefault}`);
|
|
35
|
+
}
|
|
36
|
+
console.log('');
|
|
37
|
+
});
|
|
38
|
+
// ----------------------------------------------------------------
|
|
39
|
+
// model:current
|
|
40
|
+
// ----------------------------------------------------------------
|
|
41
|
+
const modelCurrent = new Command('model-current')
|
|
42
|
+
.description('Show the current default model')
|
|
43
|
+
.action(() => {
|
|
44
|
+
ensureConfigFile();
|
|
45
|
+
const config = readConfig();
|
|
46
|
+
console.log(`Current model: ${config.defaultModel}`);
|
|
47
|
+
});
|
|
48
|
+
// ----------------------------------------------------------------
|
|
49
|
+
// model:select
|
|
50
|
+
// ----------------------------------------------------------------
|
|
51
|
+
const modelSelect = new Command('model-select')
|
|
52
|
+
.argument('<id>', 'Model ID (e.g. "anthropic:claude-opus-4.6")')
|
|
53
|
+
.description('Switch model for session')
|
|
54
|
+
.action((id) => {
|
|
55
|
+
ensureConfigFile();
|
|
56
|
+
const config = readConfig();
|
|
57
|
+
const registry = new ModelRegistry(config);
|
|
58
|
+
const all = registry.listModels();
|
|
59
|
+
const match = all.find((m) => m.id === id || m.model === id);
|
|
60
|
+
if (!match) {
|
|
61
|
+
console.error(`Error: Model "${id}" not found. Run \`vibeforce model:list\` to see available models.`);
|
|
62
|
+
process.exit(1);
|
|
63
|
+
}
|
|
64
|
+
console.log(`Switched to ${match.model} (${match.provider})`);
|
|
65
|
+
});
|
|
66
|
+
// ----------------------------------------------------------------
|
|
67
|
+
// model:default
|
|
68
|
+
// ----------------------------------------------------------------
|
|
69
|
+
const modelDefault = new Command('model-default')
|
|
70
|
+
.argument('<id>', 'Model ID to set as default')
|
|
71
|
+
.description('Set persistent default model')
|
|
72
|
+
.action((id) => {
|
|
73
|
+
ensureConfigFile();
|
|
74
|
+
const config = readConfig();
|
|
75
|
+
const registry = new ModelRegistry(config);
|
|
76
|
+
const all = registry.listModels();
|
|
77
|
+
const match = all.find((m) => m.id === id || m.model === id);
|
|
78
|
+
if (!match) {
|
|
79
|
+
console.error(`Error: Model "${id}" not found. Run \`vibeforce model:list\` to see available models.`);
|
|
80
|
+
process.exit(1);
|
|
81
|
+
}
|
|
82
|
+
persistDefaultModel(match.id);
|
|
83
|
+
console.log(`Default model set to ${match.id}`);
|
|
84
|
+
});
|
|
85
|
+
// ----------------------------------------------------------------
|
|
86
|
+
// model:test
|
|
87
|
+
// ----------------------------------------------------------------
|
|
88
|
+
const modelTest = new Command('model-test')
|
|
89
|
+
.argument('<id>', 'Model ID to test')
|
|
90
|
+
.description('Test model connectivity')
|
|
91
|
+
.action(async (id) => {
|
|
92
|
+
ensureConfigFile();
|
|
93
|
+
const config = readConfig();
|
|
94
|
+
const registry = new ModelRegistry(config);
|
|
95
|
+
const all = registry.listModels();
|
|
96
|
+
const match = all.find((m) => m.id === id || m.model === id);
|
|
97
|
+
if (!match) {
|
|
98
|
+
console.error(`Error: Model "${id}" not found.`);
|
|
99
|
+
process.exit(1);
|
|
100
|
+
}
|
|
101
|
+
console.log(`Testing ${match.id}...`);
|
|
102
|
+
const ok = await registry.testModel(match.id);
|
|
103
|
+
if (ok) {
|
|
104
|
+
console.log(` OK — ${match.id} is reachable.`);
|
|
105
|
+
}
|
|
106
|
+
else {
|
|
107
|
+
console.log(` FAIL — could not reach ${match.id}. Check your API key and network.`);
|
|
108
|
+
process.exit(1);
|
|
109
|
+
}
|
|
110
|
+
});
|
|
111
|
+
// ----------------------------------------------------------------
|
|
112
|
+
// provider:add (non-interactive for now — flags-based)
|
|
113
|
+
// ----------------------------------------------------------------
|
|
114
|
+
const providerAdd = new Command('provider-add')
|
|
115
|
+
.description('Add a model provider')
|
|
116
|
+
.requiredOption('--name <name>', 'Provider name (e.g. "ollama")')
|
|
117
|
+
.requiredOption('--type <type>', 'Provider type: cloud | local | gateway')
|
|
118
|
+
.option('--base-url <url>', 'Base URL for local/gateway providers')
|
|
119
|
+
.option('--api-key <key>', 'API key or env var reference (e.g. "${OPENAI_API_KEY}")')
|
|
120
|
+
.option('--models <models>', 'Comma-separated list of model names')
|
|
121
|
+
.option('--auto-discover', 'Auto-discover models (for local providers)')
|
|
122
|
+
.action((opts) => {
|
|
123
|
+
ensureConfigFile();
|
|
124
|
+
const providerType = opts.type;
|
|
125
|
+
if (!['cloud', 'local', 'gateway'].includes(providerType)) {
|
|
126
|
+
console.error('Error: --type must be one of: cloud, local, gateway');
|
|
127
|
+
process.exit(1);
|
|
128
|
+
}
|
|
129
|
+
const provider = {
|
|
130
|
+
name: opts.name,
|
|
131
|
+
type: providerType,
|
|
132
|
+
baseUrl: opts.baseUrl,
|
|
133
|
+
apiKey: opts.apiKey,
|
|
134
|
+
models: opts.models ? opts.models.split(',').map((m) => m.trim()) : [],
|
|
135
|
+
autoDiscover: opts.autoDiscover,
|
|
136
|
+
};
|
|
137
|
+
persistProvider(opts.name, provider);
|
|
138
|
+
console.log(`Provider "${opts.name}" added with ${provider.models.length} model(s).`);
|
|
139
|
+
});
|
|
140
|
+
// ----------------------------------------------------------------
|
|
141
|
+
// provider:remove
|
|
142
|
+
// ----------------------------------------------------------------
|
|
143
|
+
const providerRemove = new Command('provider-remove')
|
|
144
|
+
.argument('<name>', 'Provider name to remove')
|
|
145
|
+
.description('Remove a model provider')
|
|
146
|
+
.action((name) => {
|
|
147
|
+
ensureConfigFile();
|
|
148
|
+
const removed = persistRemoveProvider(name);
|
|
149
|
+
if (removed) {
|
|
150
|
+
console.log(`Provider "${name}" removed.`);
|
|
151
|
+
}
|
|
152
|
+
else {
|
|
153
|
+
console.error(`Error: Provider "${name}" not found.`);
|
|
154
|
+
process.exit(1);
|
|
155
|
+
}
|
|
156
|
+
});
|
|
157
|
+
// ----------------------------------------------------------------
|
|
158
|
+
// Export all commands for registration
|
|
159
|
+
// ----------------------------------------------------------------
|
|
160
|
+
export const modelCommands = [
|
|
161
|
+
modelList,
|
|
162
|
+
modelCurrent,
|
|
163
|
+
modelSelect,
|
|
164
|
+
modelDefault,
|
|
165
|
+
modelTest,
|
|
166
|
+
providerAdd,
|
|
167
|
+
providerRemove,
|
|
168
|
+
];
|
|
169
|
+
//# sourceMappingURL=model.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"model.js","sourceRoot":"","sources":["../../src/commands/model.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;GAWG;AAEH,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAEL,aAAa,EACb,UAAU,EACV,eAAe,IAAI,mBAAmB,EACtC,WAAW,IAAI,eAAe,EAC9B,cAAc,IAAI,qBAAqB,EACvC,gBAAgB,GACjB,MAAM,gBAAgB,CAAC;AAExB,mEAAmE;AACnE,aAAa;AACb,mEAAmE;AACnE,MAA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AAuC;AACvC,mEAAmE;AACnE,MAAM,CAAC,MAAM,aAAa,GAAG;IAC3B,SAAS;IACT,YAAY;IACZ,WAAW;IACX,YAAY;IACZ,SAAS;IACT,WAAW;IACX,cAAc;CACf,CAAC"}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Slash command registry for the Vibeforce TUI.
|
|
3
|
+
*
|
|
4
|
+
* Two command types:
|
|
5
|
+
* - local: executed in-process, result displayed directly
|
|
6
|
+
* - prompt: expanded into a prompt string and sent to the LLM agent
|
|
7
|
+
*/
|
|
8
|
+
export type CommandType = "local" | "prompt";
|
|
9
|
+
export interface SlashCommand {
|
|
10
|
+
/** Command name without leading slash, e.g. "help", "model", "skill-list" */
|
|
11
|
+
name: string;
|
|
12
|
+
/** Short description shown in the / menu */
|
|
13
|
+
description: string;
|
|
14
|
+
/** Whether the command runs locally or expands into a prompt */
|
|
15
|
+
type: CommandType;
|
|
16
|
+
/** For local commands: execute and return output string */
|
|
17
|
+
execute?: (args: string, context: CommandContext) => Promise<string>;
|
|
18
|
+
/** For prompt commands: return prompt text to send to the agent */
|
|
19
|
+
getPrompt?: (args: string) => string;
|
|
20
|
+
}
|
|
21
|
+
export interface CommandContext {
|
|
22
|
+
skillsDir: string;
|
|
23
|
+
org?: string;
|
|
24
|
+
model?: string;
|
|
25
|
+
setModel?: (id: string) => void;
|
|
26
|
+
clearMessages?: () => void;
|
|
27
|
+
}
|
|
28
|
+
/**
|
|
29
|
+
* Get all registered slash commands, including skill-based prompt commands.
|
|
30
|
+
*/
|
|
31
|
+
export declare function getCommands(skillsDir?: string): SlashCommand[];
|
|
32
|
+
/**
|
|
33
|
+
* Find a command by name (with or without leading slash).
|
|
34
|
+
*/
|
|
35
|
+
export declare function findCommand(input: string, skillsDir?: string): SlashCommand | undefined;
|
|
36
|
+
//# sourceMappingURL=registry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"registry.d.ts","sourceRoot":"","sources":["../../src/commands/registry.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AA8BH,MAAM,MAAM,WAAW,GAAG,OAAO,GAAG,QAAQ,CAAC;AAE7C,MAAM,WAAW,YAAY;IAC3B,6EAA6E;IAC7E,IAAI,EAAE,MAAM,CAAC;IACb,4CAA4C;IAC5C,WAAW,EAAE,MAAM,CAAC;IACpB,gEAAgE;IAChE,IAAI,EAAE,WAAW,CAAC;IAClB,2DAA2D;IAC3D,OAAO,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,EAAE,OAAO,EAAE,cAAc,KAAK,OAAO,CAAC,MAAM,CAAC,CAAC;IACrE,mEAAmE;IACnE,SAAS,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,MAAM,CAAC;CACtC;AAED,MAAM,WAAW,cAAc;IAC7B,SAAS,EAAE,MAAM,CAAC;IAClB,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,QAAQ,CAAC,EAAE,CAAC,EAAE,EAAE,MAAM,KAAK,IAAI,CAAC;IAChC,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAu4BD;;GAEG;AACH,wBAAgB,WAAW,CAAC,SAAS,GAAE,MAAmB,GAAG,YAAY,EAAE,CAI1E;AAED;;GAEG;AACH,wBAAgB,WAAW,CACzB,KAAK,EAAE,MAAM,EACb,SAAS,GAAE,MAAmB,GAC7B,YAAY,GAAG,SAAS,CAM1B"}
|