@papercraneai/cli 1.0.0 → 1.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/bin/papercrane.js +20 -5
- package/lib/function-client.js +3 -3
- package/package.json +1 -1
package/bin/papercrane.js
CHANGED
|
@@ -155,12 +155,12 @@ program
|
|
|
155
155
|
});
|
|
156
156
|
|
|
157
157
|
// ============================================================================
|
|
158
|
-
//
|
|
158
|
+
// ADD COMMAND
|
|
159
159
|
// ============================================================================
|
|
160
160
|
|
|
161
161
|
program
|
|
162
|
-
.command('
|
|
163
|
-
.description('
|
|
162
|
+
.command('add [integration]')
|
|
163
|
+
.description('Add a new integration via OAuth')
|
|
164
164
|
.action(async (integration) => {
|
|
165
165
|
try {
|
|
166
166
|
if (integration) {
|
|
@@ -170,7 +170,7 @@ program
|
|
|
170
170
|
// Construct the connect URL
|
|
171
171
|
const connectUrl = `${baseUrl}/integrations?connect=${integration}`;
|
|
172
172
|
|
|
173
|
-
console.log(chalk.bold(`\
|
|
173
|
+
console.log(chalk.bold(`\nAdd ${integration}:\n`));
|
|
174
174
|
console.log(` ${chalk.cyan(connectUrl)}\n`);
|
|
175
175
|
console.log(chalk.dim('Open this URL in your browser to authenticate.\n'));
|
|
176
176
|
} else {
|
|
@@ -190,7 +190,22 @@ program
|
|
|
190
190
|
});
|
|
191
191
|
|
|
192
192
|
// Default action: show connected modules when no command is given
|
|
193
|
-
program.action(async () => {
|
|
193
|
+
program.action(async (_, cmd) => {
|
|
194
|
+
// Reject unknown commands instead of silently falling through
|
|
195
|
+
const unknownArgs = cmd.args;
|
|
196
|
+
if (unknownArgs.length > 0) {
|
|
197
|
+
console.error(chalk.red(`Unknown command: ${unknownArgs[0]}`));
|
|
198
|
+
console.error();
|
|
199
|
+
console.error('Available commands:');
|
|
200
|
+
console.error(' papercrane List connected integrations and endpoints');
|
|
201
|
+
console.error(' papercrane describe <path> Describe a module or endpoint');
|
|
202
|
+
console.error(' papercrane call <path> [json] Call an endpoint');
|
|
203
|
+
console.error(' papercrane add Add a new integration');
|
|
204
|
+
console.error(' papercrane login Log in with API key');
|
|
205
|
+
console.error(' papercrane logout Log out');
|
|
206
|
+
process.exit(1);
|
|
207
|
+
}
|
|
208
|
+
|
|
194
209
|
try {
|
|
195
210
|
const loggedIn = await isLoggedIn();
|
|
196
211
|
if (!loggedIn) {
|
package/lib/function-client.js
CHANGED
|
@@ -239,7 +239,7 @@ export function formatDescribeRoot(data) {
|
|
|
239
239
|
console.log()
|
|
240
240
|
} else {
|
|
241
241
|
console.log(chalk.dim("\nNo connected modules.\n"))
|
|
242
|
-
console.log(chalk.dim('Run "papercrane
|
|
242
|
+
console.log(chalk.dim('Run "papercrane add" to see available integrations.\n'))
|
|
243
243
|
}
|
|
244
244
|
return
|
|
245
245
|
}
|
|
@@ -345,7 +345,7 @@ export function formatFlat(data) {
|
|
|
345
345
|
}
|
|
346
346
|
|
|
347
347
|
/**
|
|
348
|
-
* Format unconnected integrations for the `
|
|
348
|
+
* Format unconnected integrations for the `add` command.
|
|
349
349
|
* @param {Object} data - Response from listFunctions (mode=list at root)
|
|
350
350
|
*/
|
|
351
351
|
export function formatUnconnected(data) {
|
|
@@ -356,7 +356,7 @@ export function formatUnconnected(data) {
|
|
|
356
356
|
console.log(` ${chalk.dim(item.displayName)}`)
|
|
357
357
|
})
|
|
358
358
|
console.log()
|
|
359
|
-
console.log(chalk.dim('Run "papercrane
|
|
359
|
+
console.log(chalk.dim('Run "papercrane add <name>" to get started.\n'))
|
|
360
360
|
} else {
|
|
361
361
|
console.log(chalk.dim("\nAll integrations are already connected.\n"))
|
|
362
362
|
}
|