@tpmjs/cli 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/README.md +127 -0
- package/bin/run.js +5 -0
- package/dist/commands/agent/chat.d.ts +23 -0
- package/dist/commands/agent/chat.js +608 -0
- package/dist/commands/agent/chat.js.map +1 -0
- package/dist/commands/agent/create.d.ts +22 -0
- package/dist/commands/agent/create.js +549 -0
- package/dist/commands/agent/create.js.map +1 -0
- package/dist/commands/agent/delete.d.ts +19 -0
- package/dist/commands/agent/delete.js +529 -0
- package/dist/commands/agent/delete.js.map +1 -0
- package/dist/commands/agent/list.d.ts +16 -0
- package/dist/commands/agent/list.js +535 -0
- package/dist/commands/agent/list.js.map +1 -0
- package/dist/commands/agent/update.d.ts +25 -0
- package/dist/commands/agent/update.js +547 -0
- package/dist/commands/agent/update.js.map +1 -0
- package/dist/commands/auth/login.d.ts +21 -0
- package/dist/commands/auth/login.js +603 -0
- package/dist/commands/auth/login.js.map +1 -0
- package/dist/commands/auth/logout.d.ts +13 -0
- package/dist/commands/auth/logout.js +227 -0
- package/dist/commands/auth/logout.js.map +1 -0
- package/dist/commands/auth/status.d.ts +14 -0
- package/dist/commands/auth/status.js +542 -0
- package/dist/commands/auth/status.js.map +1 -0
- package/dist/commands/auth/whoami.d.ts +14 -0
- package/dist/commands/auth/whoami.js +500 -0
- package/dist/commands/auth/whoami.js.map +1 -0
- package/dist/commands/collection/add.d.ts +18 -0
- package/dist/commands/collection/add.js +509 -0
- package/dist/commands/collection/add.js.map +1 -0
- package/dist/commands/collection/create.d.ts +17 -0
- package/dist/commands/collection/create.js +521 -0
- package/dist/commands/collection/create.js.map +1 -0
- package/dist/commands/collection/delete.d.ts +19 -0
- package/dist/commands/collection/delete.js +531 -0
- package/dist/commands/collection/delete.js.map +1 -0
- package/dist/commands/collection/import.d.ts +18 -0
- package/dist/commands/collection/import.js +546 -0
- package/dist/commands/collection/import.js.map +1 -0
- package/dist/commands/collection/list.d.ts +16 -0
- package/dist/commands/collection/list.js +531 -0
- package/dist/commands/collection/list.js.map +1 -0
- package/dist/commands/collection/remove.d.ts +18 -0
- package/dist/commands/collection/remove.js +501 -0
- package/dist/commands/collection/remove.js.map +1 -0
- package/dist/commands/collection/update.d.ts +20 -0
- package/dist/commands/collection/update.js +522 -0
- package/dist/commands/collection/update.js.map +1 -0
- package/dist/commands/doctor.d.ts +14 -0
- package/dist/commands/doctor.js +592 -0
- package/dist/commands/doctor.js.map +1 -0
- package/dist/commands/mcp/config.d.ts +19 -0
- package/dist/commands/mcp/config.js +265 -0
- package/dist/commands/mcp/config.js.map +1 -0
- package/dist/commands/mcp/serve.d.ts +23 -0
- package/dist/commands/mcp/serve.js +689 -0
- package/dist/commands/mcp/serve.js.map +1 -0
- package/dist/commands/playground.d.ts +23 -0
- package/dist/commands/playground.js +666 -0
- package/dist/commands/playground.js.map +1 -0
- package/dist/commands/publish/check.d.ts +17 -0
- package/dist/commands/publish/check.js +544 -0
- package/dist/commands/publish/check.js.map +1 -0
- package/dist/commands/publish/preview.d.ts +19 -0
- package/dist/commands/publish/preview.js +291 -0
- package/dist/commands/publish/preview.js.map +1 -0
- package/dist/commands/tool/execute.d.ts +21 -0
- package/dist/commands/tool/execute.js +574 -0
- package/dist/commands/tool/execute.js.map +1 -0
- package/dist/commands/tool/info.d.ts +18 -0
- package/dist/commands/tool/info.js +537 -0
- package/dist/commands/tool/info.js.map +1 -0
- package/dist/commands/tool/init.d.ts +24 -0
- package/dist/commands/tool/init.js +461 -0
- package/dist/commands/tool/init.js.map +1 -0
- package/dist/commands/tool/search.d.ts +20 -0
- package/dist/commands/tool/search.js +566 -0
- package/dist/commands/tool/search.js.map +1 -0
- package/dist/commands/tool/trending.d.ts +15 -0
- package/dist/commands/tool/trending.js +523 -0
- package/dist/commands/tool/trending.js.map +1 -0
- package/dist/commands/tool/validate.d.ts +15 -0
- package/dist/commands/tool/validate.js +555 -0
- package/dist/commands/tool/validate.js.map +1 -0
- package/dist/commands/update.d.ts +15 -0
- package/dist/commands/update.js +228 -0
- package/dist/commands/update.js.map +1 -0
- package/dist/hooks/init.d.ts +5 -0
- package/dist/hooks/init.js +8 -0
- package/dist/hooks/init.js.map +1 -0
- package/dist/index.d.ts +262 -0
- package/dist/index.js +473 -0
- package/dist/index.js.map +1 -0
- package/oclif.manifest.json +1699 -0
- package/package.json +104 -0
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { Command, Flags } from '@oclif/core';
|
|
2
|
+
import { execSync } from 'child_process';
|
|
3
|
+
import Table from 'cli-table3';
|
|
4
|
+
import ora from 'ora';
|
|
5
|
+
import pc from 'picocolors';
|
|
6
|
+
|
|
7
|
+
// src/commands/update.ts
|
|
8
|
+
var OutputFormatter = class {
|
|
9
|
+
options;
|
|
10
|
+
constructor(options = {}) {
|
|
11
|
+
this.options = options;
|
|
12
|
+
}
|
|
13
|
+
// Output as JSON
|
|
14
|
+
json(data) {
|
|
15
|
+
console.log(JSON.stringify(data, null, 2));
|
|
16
|
+
}
|
|
17
|
+
// Output a table
|
|
18
|
+
table(data, columns) {
|
|
19
|
+
if (this.options.json) {
|
|
20
|
+
this.json(data);
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
const table = new Table({
|
|
24
|
+
head: columns.map((col) => pc.bold(col.header)),
|
|
25
|
+
colWidths: columns.map((col) => col.width ?? null),
|
|
26
|
+
style: {
|
|
27
|
+
head: [],
|
|
28
|
+
border: []
|
|
29
|
+
}
|
|
30
|
+
});
|
|
31
|
+
for (const row of data) {
|
|
32
|
+
table.push(columns.map((col) => String(row[col.key] ?? "")));
|
|
33
|
+
}
|
|
34
|
+
console.log(table.toString());
|
|
35
|
+
}
|
|
36
|
+
// Success message
|
|
37
|
+
success(message) {
|
|
38
|
+
if (this.options.json) return;
|
|
39
|
+
console.log(pc.green("\u2713"), message);
|
|
40
|
+
}
|
|
41
|
+
// Error message
|
|
42
|
+
error(message, details) {
|
|
43
|
+
if (this.options.json) {
|
|
44
|
+
this.json({ error: message, details });
|
|
45
|
+
return;
|
|
46
|
+
}
|
|
47
|
+
console.error(pc.red("\u2717"), message);
|
|
48
|
+
if (details && this.options.verbose) {
|
|
49
|
+
console.error(pc.dim(details));
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
// Warning message
|
|
53
|
+
warning(message) {
|
|
54
|
+
if (this.options.json) return;
|
|
55
|
+
console.log(pc.yellow("\u26A0"), message);
|
|
56
|
+
}
|
|
57
|
+
// Info message
|
|
58
|
+
info(message) {
|
|
59
|
+
if (this.options.json) return;
|
|
60
|
+
console.log(pc.blue("\u2139"), message);
|
|
61
|
+
}
|
|
62
|
+
// Debug message (only in verbose mode)
|
|
63
|
+
debug(message) {
|
|
64
|
+
if (this.options.json) return;
|
|
65
|
+
if (this.options.verbose) {
|
|
66
|
+
console.log(pc.dim(`[debug] ${message}`));
|
|
67
|
+
}
|
|
68
|
+
}
|
|
69
|
+
// Plain text output
|
|
70
|
+
text(message) {
|
|
71
|
+
if (this.options.json) return;
|
|
72
|
+
console.log(message);
|
|
73
|
+
}
|
|
74
|
+
// Heading
|
|
75
|
+
heading(text) {
|
|
76
|
+
if (this.options.json) return;
|
|
77
|
+
console.log();
|
|
78
|
+
console.log(pc.bold(pc.underline(text)));
|
|
79
|
+
console.log();
|
|
80
|
+
}
|
|
81
|
+
// Subheading
|
|
82
|
+
subheading(text) {
|
|
83
|
+
if (this.options.json) return;
|
|
84
|
+
console.log(pc.bold(text));
|
|
85
|
+
}
|
|
86
|
+
// Key-value pair
|
|
87
|
+
keyValue(key, value) {
|
|
88
|
+
if (this.options.json) return;
|
|
89
|
+
console.log(`${pc.dim(key + ":")} ${value ?? pc.dim("(not set)")}`);
|
|
90
|
+
}
|
|
91
|
+
// List item
|
|
92
|
+
listItem(text, indent = 0) {
|
|
93
|
+
if (this.options.json) return;
|
|
94
|
+
const prefix = " ".repeat(indent) + "\u2022";
|
|
95
|
+
console.log(`${prefix} ${text}`);
|
|
96
|
+
}
|
|
97
|
+
// Spinner
|
|
98
|
+
spinner(message) {
|
|
99
|
+
return ora({
|
|
100
|
+
text: message,
|
|
101
|
+
isSilent: this.options.json
|
|
102
|
+
}).start();
|
|
103
|
+
}
|
|
104
|
+
// Blank line
|
|
105
|
+
newLine() {
|
|
106
|
+
if (this.options.json) return;
|
|
107
|
+
console.log();
|
|
108
|
+
}
|
|
109
|
+
// Horizontal rule
|
|
110
|
+
hr() {
|
|
111
|
+
if (this.options.json) return;
|
|
112
|
+
console.log(pc.dim("\u2500".repeat(50)));
|
|
113
|
+
}
|
|
114
|
+
// Alias for hr
|
|
115
|
+
divider() {
|
|
116
|
+
this.hr();
|
|
117
|
+
}
|
|
118
|
+
// Code block
|
|
119
|
+
code(text, language) {
|
|
120
|
+
if (this.options.json) {
|
|
121
|
+
this.json({ code: text, language });
|
|
122
|
+
return;
|
|
123
|
+
}
|
|
124
|
+
console.log(pc.dim("```" + (language ?? "")));
|
|
125
|
+
console.log(text);
|
|
126
|
+
console.log(pc.dim("```"));
|
|
127
|
+
}
|
|
128
|
+
// Highlight text
|
|
129
|
+
highlight(text) {
|
|
130
|
+
return pc.cyan(text);
|
|
131
|
+
}
|
|
132
|
+
// Dim text
|
|
133
|
+
dim(text) {
|
|
134
|
+
return pc.dim(text);
|
|
135
|
+
}
|
|
136
|
+
// Bold text
|
|
137
|
+
bold(text) {
|
|
138
|
+
return pc.bold(text);
|
|
139
|
+
}
|
|
140
|
+
// Link (just returns text in terminal)
|
|
141
|
+
link(text, url) {
|
|
142
|
+
return `\x1B]8;;${url}\x07${pc.underline(pc.blue(text))}\x1B]8;;\x07`;
|
|
143
|
+
}
|
|
144
|
+
};
|
|
145
|
+
function createOutput(flags) {
|
|
146
|
+
return new OutputFormatter({
|
|
147
|
+
json: flags.json,
|
|
148
|
+
verbose: flags.verbose
|
|
149
|
+
});
|
|
150
|
+
}
|
|
151
|
+
|
|
152
|
+
// src/commands/update.ts
|
|
153
|
+
var Update = class _Update extends Command {
|
|
154
|
+
static description = "Update the TPMJS CLI to the latest version";
|
|
155
|
+
static examples = ["<%= config.bin %> <%= command.id %>"];
|
|
156
|
+
static flags = {
|
|
157
|
+
json: Flags.boolean({
|
|
158
|
+
description: "Output in JSON format",
|
|
159
|
+
default: false
|
|
160
|
+
}),
|
|
161
|
+
verbose: Flags.boolean({
|
|
162
|
+
char: "v",
|
|
163
|
+
description: "Show verbose output",
|
|
164
|
+
default: false
|
|
165
|
+
}),
|
|
166
|
+
check: Flags.boolean({
|
|
167
|
+
description: "Only check for updates, do not install",
|
|
168
|
+
default: false
|
|
169
|
+
})
|
|
170
|
+
};
|
|
171
|
+
async run() {
|
|
172
|
+
const { flags } = await this.parse(_Update);
|
|
173
|
+
const output = createOutput(flags);
|
|
174
|
+
const currentVersion = this.config.version;
|
|
175
|
+
output.debug(`Current version: ${currentVersion}`);
|
|
176
|
+
const spinner = output.spinner("Checking for updates...");
|
|
177
|
+
try {
|
|
178
|
+
const latestVersion = execSync("npm view @tpmjs/cli version", {
|
|
179
|
+
encoding: "utf-8",
|
|
180
|
+
timeout: 1e4
|
|
181
|
+
}).trim();
|
|
182
|
+
spinner.stop();
|
|
183
|
+
if (flags.json) {
|
|
184
|
+
output.json({
|
|
185
|
+
currentVersion,
|
|
186
|
+
latestVersion,
|
|
187
|
+
updateAvailable: latestVersion !== currentVersion
|
|
188
|
+
});
|
|
189
|
+
return;
|
|
190
|
+
}
|
|
191
|
+
if (latestVersion === currentVersion) {
|
|
192
|
+
output.success(`You're on the latest version (${currentVersion})`);
|
|
193
|
+
return;
|
|
194
|
+
}
|
|
195
|
+
output.info(`Update available: ${currentVersion} \u2192 ${latestVersion}`);
|
|
196
|
+
if (flags.check) {
|
|
197
|
+
output.text("Run `tpm update` to install the update");
|
|
198
|
+
return;
|
|
199
|
+
}
|
|
200
|
+
const updateSpinner = output.spinner("Installing update...");
|
|
201
|
+
try {
|
|
202
|
+
execSync("npm install -g @tpmjs/cli@latest", {
|
|
203
|
+
encoding: "utf-8",
|
|
204
|
+
timeout: 12e4,
|
|
205
|
+
stdio: flags.verbose ? "inherit" : "pipe"
|
|
206
|
+
});
|
|
207
|
+
updateSpinner.succeed(`Updated to ${latestVersion}`);
|
|
208
|
+
output.text("Restart your terminal to use the new version");
|
|
209
|
+
} catch (installError) {
|
|
210
|
+
updateSpinner.fail("Update failed");
|
|
211
|
+
output.error(
|
|
212
|
+
"Failed to install update",
|
|
213
|
+
flags.verbose ? String(installError) : "Try running: npm install -g @tpmjs/cli@latest"
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
} catch (error) {
|
|
217
|
+
spinner.fail("Failed to check for updates");
|
|
218
|
+
output.error(
|
|
219
|
+
error instanceof Error ? error.message : "Unknown error",
|
|
220
|
+
flags.verbose ? String(error) : void 0
|
|
221
|
+
);
|
|
222
|
+
}
|
|
223
|
+
}
|
|
224
|
+
};
|
|
225
|
+
|
|
226
|
+
export { Update as default };
|
|
227
|
+
//# sourceMappingURL=update.js.map
|
|
228
|
+
//# sourceMappingURL=update.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/lib/output.ts","../../src/commands/update.ts"],"names":[],"mappings":";;;;;;;AAUO,IAAM,kBAAN,MAAsB;AAAA,EACnB,OAAA;AAAA,EAER,WAAA,CAAY,OAAA,GAAyB,EAAC,EAAG;AACvC,IAAA,IAAA,CAAK,OAAA,GAAU,OAAA;AAAA,EACjB;AAAA;AAAA,EAGA,KAAK,IAAA,EAAqB;AACxB,IAAA,OAAA,CAAQ,IAAI,IAAA,CAAK,SAAA,CAAU,IAAA,EAAM,IAAA,EAAM,CAAC,CAAC,CAAA;AAAA,EAC3C;AAAA;AAAA,EAGA,KAAA,CACE,MACA,OAAA,EACM;AACN,IAAA,IAAI,IAAA,CAAK,QAAQ,IAAA,EAAM;AACrB,MAAA,IAAA,CAAK,KAAK,IAAI,CAAA;AACd,MAAA;AAAA,IACF;AAEA,IAAA,MAAM,KAAA,GAAQ,IAAI,K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AA,MACF;AAEA,MAAA,MAAA,CAAO,IAAA,CAAK,CAAA,kBAAA,EAAqB,cAAc,CAAA,QAAA,EAAM,aAAa,CAAA,CAAE,CAAA;AAEpE,MAAA,IAAI,MAAM,KAAA,EAAO;AACf,QAAA,MAAA,CAAO,KAAK,wCAAwC,CAAA;AACpD,QAAA;AAAA,MACF;AAGA,MAAA,MAAM,aAAA,GAAgB,MAAA,CAAO,OAAA,CAAQ,sBAAsB,CAAA;AAE3D,MAAA,IAAI;AAEF,QAAA,QAAA,CAAS,kCAAA,EAAoC;AAAA,UAC3C,QAAA,EAAU,OAAA;AAAA,UACV,OAAA,EAAS,IAAA;AAAA,UACT,KAAA,EAAO,KAAA,CAAM,OAAA,GAAU,SAAA,GAAY;AAAA,SACpC,CAAA;AAED,QAAA,aAAA,CAAc,OAAA,CAAQ,CAAA,WAAA,EAAc,aAAa,CAAA,CAAE,CAAA;AACnD,QAAA,MAAA,CAAO,KAAK,8CAA8C,CAAA;AAAA,MAC5D,SAAS,YAAA,EAAc;AACrB,QAAA,aAAA,CAAc,KAAK,eAAe,CAAA;AAClC,QAAA,MAAA,CAAO,KAAA;AAAA,UACL,0BAAA;AAAA,UACA,KAAA,CAAM,OAAA,GAAU,MAAA,CAAO,YAAY,CAAA,GAAI;AAAA,SACzC;AAAA,MACF;AAAA,IACF,SAAS,KAAA,EAAO;AACd,MAAA,OAAA,CAAQ,KAAK,6BAA6B,CAAA;AAC1C,MAAA,MAAA,CAAO,KAAA;AAAA,QACL,KAAA,YAAiB,KAAA,GAAQ,KAAA,CAAM,OAAA,GAAU,eAAA;AAAA,QACzC,KAAA,CAAM,OAAA,GAAU,MAAA,CAAO,KAAK,CAAA,GAAI;AAAA,OAClC;AAAA,IACF;AAAA,EACF;AACF","file":"update.js","sourcesContent":["import Table from 'cli-table3';\nimport ora, { type Ora } from 'ora';\nimport pc from 'picocolors';\n\nexport interface OutputOptions {\n json?: boolean;\n verbose?: boolean;\n noColor?: boolean;\n}\n\nexport class OutputFormatter {\n private options: OutputOptions;\n\n constructor(options: OutputOptions = {}) {\n this.options = options;\n }\n\n // Output as JSON\n json(data: unknown): void {\n console.log(JSON.stringify(data, null, 2));\n }\n\n // Output a table\n table<T extends Record<string, unknown>>(\n data: T[],\n columns: { key: keyof T; header: string; width?: number }[]\n ): void {\n if (this.options.json) {\n this.json(data);\n return;\n }\n\n const table = new Table({\n head: columns.map((col) => pc.bold(col.header)),\n colWidths: columns.map((col) => col.width ?? null),\n style: {\n head: [],\n border: [],\n },\n });\n\n for (const row of data) {\n table.push(columns.map((col) => String(row[col.key] ?? '')));\n }\n\n console.log(table.toString());\n }\n\n // Success message\n success(message: string): void {\n if (this.options.json) return;\n console.log(pc.green('✓'), message);\n }\n\n // Error message\n error(message: string, details?: string): void {\n if (this.options.json) {\n this.json({ error: message, details });\n return;\n }\n console.error(pc.red('✗'), message);\n if (details && this.options.verbose) {\n console.error(pc.dim(details));\n }\n }\n\n // Warning message\n warning(message: string): void {\n if (this.options.json) return;\n console.log(pc.yellow('⚠'), message);\n }\n\n // Info message\n info(message: string): void {\n if (this.options.json) return;\n console.log(pc.blue('ℹ'), message);\n }\n\n // Debug message (only in verbose mode)\n debug(message: string): void {\n if (this.options.json) return;\n if (this.options.verbose) {\n console.log(pc.dim(`[debug] ${message}`));\n }\n }\n\n // Plain text output\n text(message: string): void {\n if (this.options.json) return;\n console.log(message);\n }\n\n // Heading\n heading(text: string): void {\n if (this.options.json) return;\n console.log();\n console.log(pc.bold(pc.underline(text)));\n console.log();\n }\n\n // Subheading\n subheading(text: string): void {\n if (this.options.json) return;\n console.log(pc.bold(text));\n }\n\n // Key-value pair\n keyValue(key: string, value: string | number | boolean | undefined): void {\n if (this.options.json) return;\n console.log(`${pc.dim(key + ':')} ${value ?? pc.dim('(not set)')}`);\n }\n\n // List item\n listItem(text: string, indent = 0): void {\n if (this.options.json) return;\n const prefix = ' '.repeat(indent) + '•';\n console.log(`${prefix} ${text}`);\n }\n\n // Spinner\n spinner(message: string): Ora {\n return ora({\n text: message,\n isSilent: this.options.json,\n }).start();\n }\n\n // Blank line\n newLine(): void {\n if (this.options.json) return;\n console.log();\n }\n\n // Horizontal rule\n hr(): void {\n if (this.options.json) return;\n console.log(pc.dim('─'.repeat(50)));\n }\n\n // Alias for hr\n divider(): void {\n this.hr();\n }\n\n // Code block\n code(text: string, language?: string): void {\n if (this.options.json) {\n this.json({ code: text, language });\n return;\n }\n console.log(pc.dim('```' + (language ?? '')));\n console.log(text);\n console.log(pc.dim('```'));\n }\n\n // Highlight text\n highlight(text: string): string {\n return pc.cyan(text);\n }\n\n // Dim text\n dim(text: string): string {\n return pc.dim(text);\n }\n\n // Bold text\n bold(text: string): string {\n return pc.bold(text);\n }\n\n // Link (just returns text in terminal)\n link(text: string, url: string): string {\n // OSC 8 hyperlink support for modern terminals\n return `\\x1b]8;;${url}\\x07${pc.underline(pc.blue(text))}\\x1b]8;;\\x07`;\n }\n}\n\n// Convenience function to create formatter from command flags\nexport function createOutput(flags: { json?: boolean; verbose?: boolean }): OutputFormatter {\n return new OutputFormatter({\n json: flags.json,\n verbose: flags.verbose,\n });\n}\n","import { Command, Flags } from '@oclif/core';\nimport { execSync } from 'node:child_process';\nimport { createOutput } from '../lib/output.js';\n\nexport default class Update extends Command {\n static description = 'Update the TPMJS CLI to the latest version';\n\n static examples = ['<%= config.bin %> <%= command.id %>'];\n\n static flags = {\n json: Flags.boolean({\n description: 'Output in JSON format',\n default: false,\n }),\n verbose: Flags.boolean({\n char: 'v',\n description: 'Show verbose output',\n default: false,\n }),\n check: Flags.boolean({\n description: 'Only check for updates, do not install',\n default: false,\n }),\n };\n\n async run(): Promise<void> {\n const { flags } = await this.parse(Update);\n const output = createOutput(flags);\n\n const currentVersion = this.config.version;\n output.debug(`Current version: ${currentVersion}`);\n\n // Check for latest version on npm\n const spinner = output.spinner('Checking for updates...');\n\n try {\n const latestVersion = execSync('npm view @tpmjs/cli version', {\n encoding: 'utf-8',\n timeout: 10000,\n }).trim();\n\n spinner.stop();\n\n if (flags.json) {\n output.json({\n currentVersion,\n latestVersion,\n updateAvailable: latestVersion !== currentVersion,\n });\n return;\n }\n\n if (latestVersion === currentVersion) {\n output.success(`You're on the latest version (${currentVersion})`);\n return;\n }\n\n output.info(`Update available: ${currentVersion} → ${latestVersion}`);\n\n if (flags.check) {\n output.text('Run `tpm update` to install the update');\n return;\n }\n\n // Perform update\n const updateSpinner = output.spinner('Installing update...');\n\n try {\n // Try npm first, then pnpm, then yarn\n execSync('npm install -g @tpmjs/cli@latest', {\n encoding: 'utf-8',\n timeout: 120000,\n stdio: flags.verbose ? 'inherit' : 'pipe',\n });\n\n updateSpinner.succeed(`Updated to ${latestVersion}`);\n output.text('Restart your terminal to use the new version');\n } catch (installError) {\n updateSpinner.fail('Update failed');\n output.error(\n 'Failed to install update',\n flags.verbose ? String(installError) : 'Try running: npm install -g @tpmjs/cli@latest'\n );\n }\n } catch (error) {\n spinner.fail('Failed to check for updates');\n output.error(\n error instanceof Error ? error.message : 'Unknown error',\n flags.verbose ? String(error) : undefined\n );\n }\n }\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/init.ts"],"names":[],"mappings":";AAEA,IAAM,OAAqB,iBAAkB;AAO7C,CAAA;AAEA,IAAO,YAAA,GAAQ","file":"init.js","sourcesContent":["import type { Hook } from '@oclif/core';\n\nconst hook: Hook<'init'> = async function () {\n // Initialization hook - runs before any command\n // Can be used for:\n // - Checking for updates\n // - Loading config\n // - Setting up analytics (if opted in)\n // - etc.\n};\n\nexport default hook;\n"]}
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,262 @@
|
|
|
1
|
+
import { Ora } from 'ora';
|
|
2
|
+
|
|
3
|
+
interface TpmClientOptions {
|
|
4
|
+
baseUrl?: string;
|
|
5
|
+
apiKey?: string;
|
|
6
|
+
timeout?: number;
|
|
7
|
+
}
|
|
8
|
+
interface ApiResponse<T> {
|
|
9
|
+
success: boolean;
|
|
10
|
+
data?: T;
|
|
11
|
+
error?: string;
|
|
12
|
+
message?: string;
|
|
13
|
+
}
|
|
14
|
+
interface PaginationOptions {
|
|
15
|
+
limit?: number;
|
|
16
|
+
offset?: number;
|
|
17
|
+
}
|
|
18
|
+
interface PaginatedResponse<T> {
|
|
19
|
+
data: T[];
|
|
20
|
+
pagination: {
|
|
21
|
+
limit: number;
|
|
22
|
+
offset: number;
|
|
23
|
+
hasMore: boolean;
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
interface Tool {
|
|
27
|
+
id: string;
|
|
28
|
+
name: string;
|
|
29
|
+
slug: string;
|
|
30
|
+
description: string;
|
|
31
|
+
category: string;
|
|
32
|
+
tier: string;
|
|
33
|
+
qualityScore: number | null;
|
|
34
|
+
importHealth: string;
|
|
35
|
+
executionHealth: string;
|
|
36
|
+
likeCount: number;
|
|
37
|
+
npmPackageName: string;
|
|
38
|
+
npmVersion: string;
|
|
39
|
+
npmDownloadsLastMonth: number;
|
|
40
|
+
isOfficial: boolean;
|
|
41
|
+
inputSchema?: Record<string, unknown>;
|
|
42
|
+
outputSchema?: Record<string, unknown>;
|
|
43
|
+
tools?: {
|
|
44
|
+
name: string;
|
|
45
|
+
description?: string;
|
|
46
|
+
}[];
|
|
47
|
+
package?: {
|
|
48
|
+
npmPackageName: string;
|
|
49
|
+
category: string;
|
|
50
|
+
npmDownloadsLastMonth: number;
|
|
51
|
+
isOfficial: boolean;
|
|
52
|
+
};
|
|
53
|
+
}
|
|
54
|
+
interface ToolSearchOptions extends PaginationOptions {
|
|
55
|
+
category?: string;
|
|
56
|
+
query?: string;
|
|
57
|
+
}
|
|
58
|
+
interface Agent {
|
|
59
|
+
id: string;
|
|
60
|
+
uid: string;
|
|
61
|
+
name: string;
|
|
62
|
+
description: string | null;
|
|
63
|
+
provider: string;
|
|
64
|
+
modelId: string;
|
|
65
|
+
systemPrompt: string | null;
|
|
66
|
+
temperature: number;
|
|
67
|
+
isPublic: boolean;
|
|
68
|
+
likeCount: number;
|
|
69
|
+
_count?: {
|
|
70
|
+
tools: number;
|
|
71
|
+
collections: number;
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
interface CreateAgentInput {
|
|
75
|
+
name: string;
|
|
76
|
+
uid?: string;
|
|
77
|
+
description?: string;
|
|
78
|
+
provider: string;
|
|
79
|
+
modelId: string;
|
|
80
|
+
systemPrompt?: string;
|
|
81
|
+
temperature?: number;
|
|
82
|
+
isPublic?: boolean;
|
|
83
|
+
collectionIds?: string[];
|
|
84
|
+
toolIds?: string[];
|
|
85
|
+
}
|
|
86
|
+
interface UpdateAgentInput {
|
|
87
|
+
name?: string;
|
|
88
|
+
uid?: string;
|
|
89
|
+
description?: string;
|
|
90
|
+
provider?: string;
|
|
91
|
+
modelId?: string;
|
|
92
|
+
systemPrompt?: string;
|
|
93
|
+
temperature?: number;
|
|
94
|
+
isPublic?: boolean;
|
|
95
|
+
maxToolCallsPerTurn?: number;
|
|
96
|
+
maxMessagesInContext?: number;
|
|
97
|
+
}
|
|
98
|
+
interface Collection {
|
|
99
|
+
id: string;
|
|
100
|
+
name: string;
|
|
101
|
+
slug: string | null;
|
|
102
|
+
description: string | null;
|
|
103
|
+
isPublic: boolean;
|
|
104
|
+
likeCount: number;
|
|
105
|
+
_count?: {
|
|
106
|
+
tools: number;
|
|
107
|
+
};
|
|
108
|
+
}
|
|
109
|
+
interface CreateCollectionInput {
|
|
110
|
+
name: string;
|
|
111
|
+
description?: string;
|
|
112
|
+
isPublic: boolean;
|
|
113
|
+
}
|
|
114
|
+
interface UpdateCollectionInput {
|
|
115
|
+
name?: string;
|
|
116
|
+
description?: string;
|
|
117
|
+
isPublic?: boolean;
|
|
118
|
+
}
|
|
119
|
+
interface User {
|
|
120
|
+
id: string;
|
|
121
|
+
name: string | null;
|
|
122
|
+
username: string | null;
|
|
123
|
+
email: string;
|
|
124
|
+
image: string | null;
|
|
125
|
+
}
|
|
126
|
+
interface ApiKey {
|
|
127
|
+
id: string;
|
|
128
|
+
name: string;
|
|
129
|
+
keyPrefix: string;
|
|
130
|
+
scopes: string[];
|
|
131
|
+
isActive: boolean;
|
|
132
|
+
lastUsedAt: string | null;
|
|
133
|
+
expiresAt: string | null;
|
|
134
|
+
createdAt: string;
|
|
135
|
+
}
|
|
136
|
+
interface Stats {
|
|
137
|
+
tools: {
|
|
138
|
+
total: number;
|
|
139
|
+
official: number;
|
|
140
|
+
healthyImport: number;
|
|
141
|
+
healthyExecution: number;
|
|
142
|
+
};
|
|
143
|
+
packages: {
|
|
144
|
+
total: number;
|
|
145
|
+
official: number;
|
|
146
|
+
};
|
|
147
|
+
categories: {
|
|
148
|
+
name: string;
|
|
149
|
+
count: number;
|
|
150
|
+
}[];
|
|
151
|
+
}
|
|
152
|
+
declare class TpmClient {
|
|
153
|
+
private baseUrl;
|
|
154
|
+
private apiKey;
|
|
155
|
+
private timeout;
|
|
156
|
+
constructor(options?: TpmClientOptions);
|
|
157
|
+
private request;
|
|
158
|
+
health(): Promise<{
|
|
159
|
+
status: string;
|
|
160
|
+
timestamp: string;
|
|
161
|
+
}>;
|
|
162
|
+
getStats(): Promise<ApiResponse<Stats>>;
|
|
163
|
+
searchTools(options?: ToolSearchOptions): Promise<PaginatedResponse<Tool>>;
|
|
164
|
+
getTool(packageName: string, toolName: string): Promise<ApiResponse<Tool>>;
|
|
165
|
+
getToolBySlug(slug: string): Promise<ApiResponse<Tool>>;
|
|
166
|
+
getTrendingTools(options?: PaginationOptions): Promise<PaginatedResponse<Tool>>;
|
|
167
|
+
validateTpmjsField(field: unknown): Promise<ApiResponse<{
|
|
168
|
+
valid: boolean;
|
|
169
|
+
tier: string | null;
|
|
170
|
+
errors?: unknown[];
|
|
171
|
+
}>>;
|
|
172
|
+
executeTool(slug: string, params: Record<string, unknown>): Promise<unknown>;
|
|
173
|
+
executeToolStream(slug: string, params: Record<string, unknown>): AsyncGenerator<{
|
|
174
|
+
type: string;
|
|
175
|
+
data: string;
|
|
176
|
+
}>;
|
|
177
|
+
listAgents(options?: PaginationOptions): Promise<PaginatedResponse<Agent>>;
|
|
178
|
+
getAgent(id: string): Promise<ApiResponse<Agent>>;
|
|
179
|
+
createAgent(input: CreateAgentInput): Promise<ApiResponse<Agent>>;
|
|
180
|
+
updateAgent(id: string, input: UpdateAgentInput): Promise<ApiResponse<Agent>>;
|
|
181
|
+
deleteAgent(id: string): Promise<ApiResponse<void>>;
|
|
182
|
+
listCollections(options?: PaginationOptions): Promise<PaginatedResponse<Collection>>;
|
|
183
|
+
getCollection(id: string): Promise<ApiResponse<Collection>>;
|
|
184
|
+
createCollection(input: CreateCollectionInput): Promise<ApiResponse<Collection>>;
|
|
185
|
+
updateCollection(id: string, input: UpdateCollectionInput): Promise<ApiResponse<Collection>>;
|
|
186
|
+
deleteCollection(id: string): Promise<ApiResponse<void>>;
|
|
187
|
+
addToolsToCollection(id: string, toolIds: string[]): Promise<ApiResponse<void>>;
|
|
188
|
+
removeToolFromCollection(id: string, toolId: string): Promise<ApiResponse<void>>;
|
|
189
|
+
whoami(): Promise<ApiResponse<User>>;
|
|
190
|
+
listApiKeys(): Promise<ApiResponse<ApiKey[]>>;
|
|
191
|
+
isAuthenticated(): boolean;
|
|
192
|
+
}
|
|
193
|
+
declare class ApiError extends Error {
|
|
194
|
+
statusCode: number;
|
|
195
|
+
data?: unknown | undefined;
|
|
196
|
+
constructor(message: string, statusCode: number, data?: unknown | undefined);
|
|
197
|
+
}
|
|
198
|
+
declare function getClient(options?: TpmClientOptions): TpmClient;
|
|
199
|
+
|
|
200
|
+
interface TpmConfig {
|
|
201
|
+
apiUrl?: string;
|
|
202
|
+
defaultOutput?: 'human' | 'json';
|
|
203
|
+
verbose?: boolean;
|
|
204
|
+
analytics?: boolean;
|
|
205
|
+
env?: Record<string, string>;
|
|
206
|
+
}
|
|
207
|
+
interface TpmCredentials {
|
|
208
|
+
apiKey?: string;
|
|
209
|
+
refreshToken?: string;
|
|
210
|
+
expiresAt?: string;
|
|
211
|
+
}
|
|
212
|
+
declare function getConfig(): TpmConfig;
|
|
213
|
+
declare function setConfig(config: Partial<TpmConfig>): void;
|
|
214
|
+
declare function getConfigValue<K extends keyof TpmConfig>(key: K): TpmConfig[K];
|
|
215
|
+
declare function setConfigValue<K extends keyof TpmConfig>(key: K, value: TpmConfig[K]): void;
|
|
216
|
+
declare function loadCredentials(): TpmCredentials | null;
|
|
217
|
+
declare function saveCredentials(credentials: TpmCredentials): void;
|
|
218
|
+
declare function deleteCredentials(): void;
|
|
219
|
+
declare function hasCredentials(): boolean;
|
|
220
|
+
declare function getApiKey(): string | undefined;
|
|
221
|
+
declare function getApiUrl(): string;
|
|
222
|
+
|
|
223
|
+
interface OutputOptions {
|
|
224
|
+
json?: boolean;
|
|
225
|
+
verbose?: boolean;
|
|
226
|
+
noColor?: boolean;
|
|
227
|
+
}
|
|
228
|
+
declare class OutputFormatter {
|
|
229
|
+
private options;
|
|
230
|
+
constructor(options?: OutputOptions);
|
|
231
|
+
json(data: unknown): void;
|
|
232
|
+
table<T extends Record<string, unknown>>(data: T[], columns: {
|
|
233
|
+
key: keyof T;
|
|
234
|
+
header: string;
|
|
235
|
+
width?: number;
|
|
236
|
+
}[]): void;
|
|
237
|
+
success(message: string): void;
|
|
238
|
+
error(message: string, details?: string): void;
|
|
239
|
+
warning(message: string): void;
|
|
240
|
+
info(message: string): void;
|
|
241
|
+
debug(message: string): void;
|
|
242
|
+
text(message: string): void;
|
|
243
|
+
heading(text: string): void;
|
|
244
|
+
subheading(text: string): void;
|
|
245
|
+
keyValue(key: string, value: string | number | boolean | undefined): void;
|
|
246
|
+
listItem(text: string, indent?: number): void;
|
|
247
|
+
spinner(message: string): Ora;
|
|
248
|
+
newLine(): void;
|
|
249
|
+
hr(): void;
|
|
250
|
+
divider(): void;
|
|
251
|
+
code(text: string, language?: string): void;
|
|
252
|
+
highlight(text: string): string;
|
|
253
|
+
dim(text: string): string;
|
|
254
|
+
bold(text: string): string;
|
|
255
|
+
link(text: string, url: string): string;
|
|
256
|
+
}
|
|
257
|
+
declare function createOutput(flags: {
|
|
258
|
+
json?: boolean;
|
|
259
|
+
verbose?: boolean;
|
|
260
|
+
}): OutputFormatter;
|
|
261
|
+
|
|
262
|
+
export { type Agent, ApiError, type ApiKey, type ApiResponse, type Collection, type CreateAgentInput, type CreateCollectionInput, OutputFormatter, type OutputOptions, type PaginatedResponse, type PaginationOptions, type Stats, type Tool, type ToolSearchOptions, TpmClient, type TpmClientOptions, type TpmConfig, type TpmCredentials, type UpdateAgentInput, type UpdateCollectionInput, type User, createOutput, deleteCredentials, getApiKey, getApiUrl, getClient, getConfig, getConfigValue, hasCredentials, loadCredentials, saveCredentials, setConfig, setConfigValue };
|