@corsair-dev/cli 0.1.17 → 0.1.18
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/index.js +84 -3
- package/dist/src/commands/base.command.d.ts +2 -0
- package/dist/src/commands/base.command.d.ts.map +1 -1
- package/dist/src/commands/setup.command.d.ts +1 -0
- package/dist/src/commands/setup.command.d.ts.map +1 -1
- package/dist/src/lib/setup-credentials.d.ts +8 -0
- package/dist/src/lib/setup-credentials.d.ts.map +1 -0
- package/package.json +2 -2
package/dist/index.js
CHANGED
|
@@ -2354,7 +2354,7 @@ import { fileURLToPath } from "url";
|
|
|
2354
2354
|
import { Command } from "commander";
|
|
2355
2355
|
|
|
2356
2356
|
// package.json
|
|
2357
|
-
var version = "0.1.
|
|
2357
|
+
var version = "0.1.18";
|
|
2358
2358
|
|
|
2359
2359
|
// src/utils/subscription.ts
|
|
2360
2360
|
async function runWebhookSubscription(cwd, pluginId) {
|
|
@@ -2405,8 +2405,12 @@ var BaseCommand = class {
|
|
|
2405
2405
|
getSubCommands() {
|
|
2406
2406
|
return [];
|
|
2407
2407
|
}
|
|
2408
|
+
/** When true, unknown flags (e.g. `--slack`) are passed through to the action. */
|
|
2409
|
+
allowUnknownOptions() {
|
|
2410
|
+
return false;
|
|
2411
|
+
}
|
|
2408
2412
|
prepare = (program) => {
|
|
2409
|
-
const command = program.command(this.getName()).description(this.getDescription());
|
|
2413
|
+
const command = program.command(this.getName()).description(this.getDescription()).allowUnknownOption(this.allowUnknownOptions());
|
|
2410
2414
|
const usage = this.getUsage();
|
|
2411
2415
|
if (usage) {
|
|
2412
2416
|
command.usage(usage);
|
|
@@ -2622,9 +2626,80 @@ var ScriptCommand = class extends BaseCommand {
|
|
|
2622
2626
|
};
|
|
2623
2627
|
|
|
2624
2628
|
// src/commands/setup.command.ts
|
|
2625
|
-
init_corsair_instance();
|
|
2626
2629
|
import { setupCorsair } from "corsair";
|
|
2630
|
+
|
|
2631
|
+
// src/lib/setup-credentials.ts
|
|
2632
|
+
var SETUP_FLAGS_WITH_VALUE = /* @__PURE__ */ new Set(["--tenant", "-t", "--plugin", "-p"]);
|
|
2633
|
+
function parseSetupCredentials(rawArgs, pluginIds) {
|
|
2634
|
+
const pluginSet = new Set(pluginIds);
|
|
2635
|
+
const result = {};
|
|
2636
|
+
let currentPlugin = null;
|
|
2637
|
+
for (let i = 0; i < rawArgs.length; i++) {
|
|
2638
|
+
const arg = rawArgs[i];
|
|
2639
|
+
if (arg === "--backfill" || arg === "-b" || arg === "-backfill") {
|
|
2640
|
+
continue;
|
|
2641
|
+
}
|
|
2642
|
+
if (SETUP_FLAGS_WITH_VALUE.has(arg)) {
|
|
2643
|
+
const value2 = rawArgs[++i];
|
|
2644
|
+
if (arg === "--plugin" || arg === "-p") {
|
|
2645
|
+
if (value2 && pluginSet.has(value2)) {
|
|
2646
|
+
currentPlugin = value2;
|
|
2647
|
+
result[value2] ??= {};
|
|
2648
|
+
}
|
|
2649
|
+
}
|
|
2650
|
+
continue;
|
|
2651
|
+
}
|
|
2652
|
+
if (arg.startsWith("--tenant=") || arg.startsWith("-t=")) {
|
|
2653
|
+
continue;
|
|
2654
|
+
}
|
|
2655
|
+
if (arg.startsWith("--plugin=")) {
|
|
2656
|
+
const pluginId = arg.slice("--plugin=".length);
|
|
2657
|
+
if (pluginSet.has(pluginId)) {
|
|
2658
|
+
currentPlugin = pluginId;
|
|
2659
|
+
result[pluginId] ??= {};
|
|
2660
|
+
}
|
|
2661
|
+
continue;
|
|
2662
|
+
}
|
|
2663
|
+
if (arg.startsWith("--")) {
|
|
2664
|
+
const flagBody = arg.slice(2);
|
|
2665
|
+
const eqIdx2 = flagBody.indexOf("=");
|
|
2666
|
+
if (eqIdx2 > 0) {
|
|
2667
|
+
const name = flagBody.slice(0, eqIdx2);
|
|
2668
|
+
const value2 = flagBody.slice(eqIdx2 + 1);
|
|
2669
|
+
if (name === "plugin" && pluginSet.has(value2)) {
|
|
2670
|
+
currentPlugin = value2;
|
|
2671
|
+
result[value2] ??= {};
|
|
2672
|
+
}
|
|
2673
|
+
continue;
|
|
2674
|
+
}
|
|
2675
|
+
if (pluginSet.has(flagBody)) {
|
|
2676
|
+
currentPlugin = flagBody;
|
|
2677
|
+
result[flagBody] ??= {};
|
|
2678
|
+
}
|
|
2679
|
+
continue;
|
|
2680
|
+
}
|
|
2681
|
+
const eqIdx = arg.indexOf("=");
|
|
2682
|
+
if (eqIdx <= 0) continue;
|
|
2683
|
+
const field = arg.slice(0, eqIdx);
|
|
2684
|
+
const value = arg.slice(eqIdx + 1);
|
|
2685
|
+
if (!field || !value || !currentPlugin) continue;
|
|
2686
|
+
const bucket = result[currentPlugin] ??= {};
|
|
2687
|
+
bucket[field] = value;
|
|
2688
|
+
}
|
|
2689
|
+
return result;
|
|
2690
|
+
}
|
|
2691
|
+
function getSetupRawArgs(argv = process.argv) {
|
|
2692
|
+
const setupIdx = argv.indexOf("setup");
|
|
2693
|
+
return setupIdx >= 0 ? argv.slice(setupIdx + 1) : [];
|
|
2694
|
+
}
|
|
2695
|
+
|
|
2696
|
+
// src/commands/setup.command.ts
|
|
2697
|
+
init_corsair();
|
|
2698
|
+
init_corsair_instance();
|
|
2627
2699
|
var SetupCommand = class extends BaseCommand {
|
|
2700
|
+
allowUnknownOptions() {
|
|
2701
|
+
return true;
|
|
2702
|
+
}
|
|
2628
2703
|
getName() {
|
|
2629
2704
|
return "setup";
|
|
2630
2705
|
}
|
|
@@ -2663,9 +2738,15 @@ var SetupCommand = class extends BaseCommand {
|
|
|
2663
2738
|
const backfill = options.backfill || this.hasLegacyBackfillFlag();
|
|
2664
2739
|
const tenantId = options.tenant;
|
|
2665
2740
|
const instance = await getCorsairInstance({ cwd });
|
|
2741
|
+
const internal = await extractInternalConfig(cwd);
|
|
2742
|
+
const credentials = parseSetupCredentials(
|
|
2743
|
+
getSetupRawArgs(),
|
|
2744
|
+
internal.plugins.map((p13) => p13.id)
|
|
2745
|
+
);
|
|
2666
2746
|
await setupCorsair(instance, {
|
|
2667
2747
|
backfill,
|
|
2668
2748
|
tenantId,
|
|
2749
|
+
credentials,
|
|
2669
2750
|
caller: "cli"
|
|
2670
2751
|
});
|
|
2671
2752
|
}
|
|
@@ -9,6 +9,8 @@ export default abstract class BaseCommand {
|
|
|
9
9
|
getOptions(): CommandOption[];
|
|
10
10
|
getUsage(): string;
|
|
11
11
|
getSubCommands(): BaseCommand[];
|
|
12
|
+
/** When true, unknown flags (e.g. `--slack`) are passed through to the action. */
|
|
13
|
+
protected allowUnknownOptions(): boolean;
|
|
12
14
|
readonly prepare: (program: Command) => void;
|
|
13
15
|
}
|
|
14
16
|
//# sourceMappingURL=base.command.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"base.command.d.ts","sourceRoot":"","sources":["../../../src/commands/base.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,WAAW;IACxC,QAAQ,CAAC,OAAO,IAAI,MAAM;IAE1B,QAAQ,CAAC,cAAc,IAAI,MAAM;IAEjC,MAAM,CAAC,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAEnD,UAAU,IAAI,MAAM,EAAE;IAItB,YAAY,IAAI,eAAe,EAAE;IAIjC,UAAU,IAAI,aAAa,EAAE;IAI7B,QAAQ,IAAI,MAAM;IAIlB,cAAc,IAAI,WAAW,EAAE;IAI/B,QAAQ,CAAC,OAAO,GAAI,SAAS,OAAO,KAAG,IAAI,
|
|
1
|
+
{"version":3,"file":"base.command.d.ts","sourceRoot":"","sources":["../../../src/commands/base.command.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAEzC,OAAO,KAAK,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,MAAM,gBAAgB,CAAC;AAExB,MAAM,CAAC,OAAO,CAAC,QAAQ,OAAO,WAAW;IACxC,QAAQ,CAAC,OAAO,IAAI,MAAM;IAE1B,QAAQ,CAAC,cAAc,IAAI,MAAM;IAEjC,MAAM,CAAC,EAAE,EAAE,iBAAiB,GAAG,OAAO,CAAC,IAAI,CAAC,GAAG,IAAI;IAEnD,UAAU,IAAI,MAAM,EAAE;IAItB,YAAY,IAAI,eAAe,EAAE;IAIjC,UAAU,IAAI,aAAa,EAAE;IAI7B,QAAQ,IAAI,MAAM;IAIlB,cAAc,IAAI,WAAW,EAAE;IAI/B,kFAAkF;IAClF,SAAS,CAAC,mBAAmB,IAAI,OAAO;IAIxC,QAAQ,CAAC,OAAO,GAAI,SAAS,OAAO,KAAG,IAAI,CAwCzC;CACF"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { CommandActionData, CommandArgument, CommandOption } from '../index.types';
|
|
2
2
|
import BaseCommand from './base.command';
|
|
3
3
|
export default class SetupCommand extends BaseCommand {
|
|
4
|
+
protected allowUnknownOptions(): boolean;
|
|
4
5
|
getName(): string;
|
|
5
6
|
getDescription(): string;
|
|
6
7
|
getOptions(): CommandOption[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"setup.command.d.ts","sourceRoot":"","sources":["../../../src/commands/setup.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"setup.command.d.ts","sourceRoot":"","sources":["../../../src/commands/setup.command.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACX,iBAAiB,EACjB,eAAe,EACf,aAAa,EACb,MAAM,gBAAgB,CAAC;AAOxB,OAAO,WAAW,MAAM,gBAAgB,CAAC;AAEzC,MAAM,CAAC,OAAO,OAAO,YAAa,SAAQ,WAAW;IACpD,SAAS,CAAC,mBAAmB,IAAI,OAAO;IAIxC,OAAO,IAAI,MAAM;IAIjB,cAAc,IAAI,MAAM;IAIxB,UAAU,IAAI,aAAa,EAAE;IAoB7B,YAAY,IAAI,eAAe,EAAE;IAS3B,MAAM,CAAC,EAAE,OAAO,EAAE,EAAE,iBAAiB;IAmB3C,OAAO,CAAC,qBAAqB;CAK7B"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { SetupCredentials } from 'corsair/setup';
|
|
2
|
+
/**
|
|
3
|
+
* Parses `corsair setup --<plugin> field=value ...` from argv (after "setup").
|
|
4
|
+
* Supports `--plugin=<id>`, `--plugin <id>`, and `--<pluginId>` plugin selectors.
|
|
5
|
+
*/
|
|
6
|
+
export declare function parseSetupCredentials(rawArgs: readonly string[], pluginIds: readonly string[]): SetupCredentials;
|
|
7
|
+
export declare function getSetupRawArgs(argv?: string[]): string[];
|
|
8
|
+
//# sourceMappingURL=setup-credentials.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"setup-credentials.d.ts","sourceRoot":"","sources":["../../../src/lib/setup-credentials.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,eAAe,CAAC;AAItD;;;GAGG;AACH,wBAAgB,qBAAqB,CACpC,OAAO,EAAE,SAAS,MAAM,EAAE,EAC1B,SAAS,EAAE,SAAS,MAAM,EAAE,GAC1B,gBAAgB,CAmElB;AAED,wBAAgB,eAAe,CAAC,IAAI,GAAE,MAAM,EAAiB,GAAG,MAAM,EAAE,CAGvE"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@corsair-dev/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.18",
|
|
4
4
|
"description": "",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"c12": "^3.3.3",
|
|
25
25
|
"commander": "^14.0.3",
|
|
26
26
|
"zod": "^4.1.13",
|
|
27
|
-
"corsair": "0.1.
|
|
27
|
+
"corsair": "0.1.73"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"@types/jest": "^29.5.14",
|