@samva/cli 0.22.0 → 0.22.1
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/AGENTS.md +3 -1
- package/dist/bin.mjs +80 -34
- package/package.json +9 -9
package/AGENTS.md
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
# Samva CLI consumer guide
|
|
2
2
|
|
|
3
|
-
Use `samva --help` and `samva <command> --help` as the command contract.
|
|
3
|
+
Use `samva --help` and `samva <command> --help` as the command contract. `--help --json` (or
|
|
4
|
+
`--jsonl`) prints that contract as one result envelope: `data` carries `description`, `usage`,
|
|
5
|
+
`flags`, `globalFlags`, `args`, `subcommands`, and `examples`. For automation, prefer
|
|
4
6
|
`SAMVA_API_KEY`, `--json` for one bounded result, and `--jsonl` with `--all` for streamed lists.
|
|
5
7
|
Machine-readable results go to stdout; warnings and typed errors go to stderr. Error envelopes carry
|
|
6
8
|
`schemaVersion`, `type`, `command`, `reason`, `message`, and optional `next`. For API failures,
|
package/dist/bin.mjs
CHANGED
|
@@ -677,6 +677,7 @@ var identity = (a) => a;
|
|
|
677
677
|
var constant = (value) => () => value;
|
|
678
678
|
var constTrue = /* @__PURE__ */ constant(true);
|
|
679
679
|
var constFalse = /* @__PURE__ */ constant(false);
|
|
680
|
+
var constNull = /* @__PURE__ */ constant(null);
|
|
680
681
|
var constUndefined = /* @__PURE__ */ constant(undefined);
|
|
681
682
|
var constVoid = constUndefined;
|
|
682
683
|
function pipe(a, ...args) {
|
|
@@ -2012,6 +2013,7 @@ var getOrElse = /* @__PURE__ */ dual(2, (self, onNone) => isNone2(self) ? onNone
|
|
|
2012
2013
|
var orElse = /* @__PURE__ */ dual(2, (self, that) => isNone2(self) ? that() : self);
|
|
2013
2014
|
var fromNullishOr = (a) => a == null ? none2() : some2(a);
|
|
2014
2015
|
var fromUndefinedOr = (a) => a === undefined ? none2() : some2(a);
|
|
2016
|
+
var getOrNull = /* @__PURE__ */ getOrElse(constNull);
|
|
2015
2017
|
var getOrUndefined = /* @__PURE__ */ getOrElse(constUndefined);
|
|
2016
2018
|
var liftThrowable = (f) => (...a) => {
|
|
2017
2019
|
try {
|
|
@@ -4139,10 +4141,6 @@ var ignore = /* @__PURE__ */ dual((args) => isEffect(args[0]), (self, options) =
|
|
|
4139
4141
|
onSuccess: (_) => void_
|
|
4140
4142
|
});
|
|
4141
4143
|
});
|
|
4142
|
-
var option = (self) => match5(self, {
|
|
4143
|
-
onFailure: none2,
|
|
4144
|
-
onSuccess: some2
|
|
4145
|
-
});
|
|
4146
4144
|
var result = (self) => matchEager(self, {
|
|
4147
4145
|
onFailure: fail2,
|
|
4148
4146
|
onSuccess: succeed2
|
|
@@ -5744,10 +5742,10 @@ var flatMap3 = flatMap2;
|
|
|
5744
5742
|
var andThen2 = andThen;
|
|
5745
5743
|
var tap2 = tap;
|
|
5746
5744
|
var result2 = result;
|
|
5747
|
-
var option2 = option;
|
|
5748
5745
|
var exit2 = exit;
|
|
5749
5746
|
var map7 = map5;
|
|
5750
5747
|
var as2 = as;
|
|
5748
|
+
var asSome2 = asSome;
|
|
5751
5749
|
var asVoid2 = asVoid;
|
|
5752
5750
|
var catch_2 = catch_;
|
|
5753
5751
|
var catchTag2 = catchTag;
|
|
@@ -14278,7 +14276,7 @@ var layer12 = /* @__PURE__ */ layer.pipe(/* @__PURE__ */ provideMerge(/* @__PURE
|
|
|
14278
14276
|
// package.json
|
|
14279
14277
|
var package_default = {
|
|
14280
14278
|
name: "@samva/cli",
|
|
14281
|
-
version: "0.22.
|
|
14279
|
+
version: "0.22.1",
|
|
14282
14280
|
description: "Samva CLI \u2014 email and platform operations from your terminal",
|
|
14283
14281
|
keywords: [
|
|
14284
14282
|
"cli",
|
|
@@ -14321,7 +14319,7 @@ var package_default = {
|
|
|
14321
14319
|
"build:release-artifacts": "bun run scripts/build-release-artifacts.ts",
|
|
14322
14320
|
test: "vitest run --root ../.. --project cli",
|
|
14323
14321
|
"test:package": "vitest run --root ../.. --project cli packages/cli/tests/package-install.e2e.test.ts",
|
|
14324
|
-
typecheck: "tsc --noEmit && tsc --noEmit -p tests/consumer/tsconfig.json && tsc --noEmit -p tests/consumer/tsconfig.default.json"
|
|
14322
|
+
typecheck: "tsc-rs --noEmit && tsc-rs --noEmit -p tests/consumer/tsconfig.json && tsc-rs --noEmit -p tests/consumer/tsconfig.default.json"
|
|
14325
14323
|
},
|
|
14326
14324
|
devDependencies: {
|
|
14327
14325
|
"@effect/platform-bun": "catalog:effect",
|
|
@@ -14334,16 +14332,16 @@ var package_default = {
|
|
|
14334
14332
|
"@types/node": "catalog:",
|
|
14335
14333
|
"better-auth": "catalog:",
|
|
14336
14334
|
effect: "catalog:effect",
|
|
14337
|
-
samva: "workspace:0.23.
|
|
14338
|
-
|
|
14335
|
+
samva: "workspace:0.23.1",
|
|
14336
|
+
"tsc-rs": "catalog:",
|
|
14339
14337
|
vite: "~8.3.0",
|
|
14340
14338
|
vitest: "catalog:"
|
|
14341
14339
|
},
|
|
14342
14340
|
optionalDependencies: {
|
|
14343
|
-
"@samva/cli-darwin-arm64": "workspace:0.22.
|
|
14344
|
-
"@samva/cli-darwin-x64": "workspace:0.22.
|
|
14345
|
-
"@samva/cli-linux-arm64": "workspace:0.22.
|
|
14346
|
-
"@samva/cli-linux-x64": "workspace:0.22.
|
|
14341
|
+
"@samva/cli-darwin-arm64": "workspace:0.22.1",
|
|
14342
|
+
"@samva/cli-darwin-x64": "workspace:0.22.1",
|
|
14343
|
+
"@samva/cli-linux-arm64": "workspace:0.22.1",
|
|
14344
|
+
"@samva/cli-linux-x64": "workspace:0.22.1"
|
|
14347
14345
|
},
|
|
14348
14346
|
engines: {
|
|
14349
14347
|
node: ">=18"
|
|
@@ -15841,7 +15839,7 @@ var map10 = /* @__PURE__ */ dual(2, (self, f) => {
|
|
|
15841
15839
|
var withDefault3 = /* @__PURE__ */ dual(2, (self, defaultValue) => {
|
|
15842
15840
|
return make28((provider, pathPrefix) => mapEager2(evaluateAt(self, provider, pathPrefix), (resolution) => isFailure2(resolution) ? succeed2(defaultValue) : resolution));
|
|
15843
15841
|
});
|
|
15844
|
-
var
|
|
15842
|
+
var option2 = (self) => self.pipe(map10(some2), withDefault3(none2()));
|
|
15845
15843
|
var isSourceError = (u) => isTagged(u, "SourceError");
|
|
15846
15844
|
var cursorToString = () => "<configuration>";
|
|
15847
15845
|
var mapReasons = (f) => (self) => catchCause2(self, (cause) => failCause3(fromReasons(cause.reasons.map(f))));
|
|
@@ -25566,7 +25564,7 @@ var __exportAll = (all, no_symbols) => {
|
|
|
25566
25564
|
};
|
|
25567
25565
|
|
|
25568
25566
|
// ../sdk/dist/package.js
|
|
25569
|
-
var version = "0.23.
|
|
25567
|
+
var version = "0.23.1";
|
|
25570
25568
|
|
|
25571
25569
|
// ../sdk/dist/client-attribution.js
|
|
25572
25570
|
var SDK_VERSION = version;
|
|
@@ -67306,7 +67304,7 @@ var reconnectNotice = (output, reconnect) => {
|
|
|
67306
67304
|
};
|
|
67307
67305
|
var tailEvents = (options) => gen2(function* () {
|
|
67308
67306
|
const provider = yield* getClientProvider;
|
|
67309
|
-
const override = yield*
|
|
67307
|
+
const override = yield* option2(String5("SAMVA_EVENTS_URL"));
|
|
67310
67308
|
const eventsUrl = getOrUndefined(override);
|
|
67311
67309
|
yield* untilInterrupted((interrupted) => provider.provide(events3({
|
|
67312
67310
|
cursor: options.cursor,
|
|
@@ -79974,7 +79972,7 @@ var observeTemplateCheck = (dir, tsconfig, build) => gen2(function* () {
|
|
|
79974
79972
|
problems: typeProblems
|
|
79975
79973
|
}
|
|
79976
79974
|
});
|
|
79977
|
-
const attempted = typeProblems.length > 0 ? yield*
|
|
79975
|
+
const attempted = typeProblems.length > 0 ? yield* build().pipe(asSome2, catchTag2("SamvaCliError", () => succeed6(none2()))) : some2(yield* build());
|
|
79978
79976
|
if (isNone2(attempted))
|
|
79979
79977
|
return typeFailure();
|
|
79980
79978
|
const built = attempted.value;
|
|
@@ -79986,7 +79984,15 @@ var observeTemplateCheck = (dir, tsconfig, build) => gen2(function* () {
|
|
|
79986
79984
|
const ok = typeProblems.length === 0 && isSuccessfulBuild(built);
|
|
79987
79985
|
const compilerVersion = built.compilerVersion;
|
|
79988
79986
|
const warnings = compatibilityFindings(built, "warning");
|
|
79989
|
-
const
|
|
79987
|
+
const failureMessage = () => {
|
|
79988
|
+
if (typeProblems.length > 0) {
|
|
79989
|
+
return `TypeScript check failed (${typeProblems.length} problem(s)); template check found ${problems.length - typeProblems.length} more.`;
|
|
79990
|
+
}
|
|
79991
|
+
if (built.files.length === 0)
|
|
79992
|
+
return NO_TEMPLATES(dir);
|
|
79993
|
+
return `Template check failed (${problems.length} problem(s)).`;
|
|
79994
|
+
};
|
|
79995
|
+
const message = ok ? `TypeScript v${typecheck.version} \xB7 compiler ${compilerVersion} \xB7 ${built.files.length} template(s) compiled \xB7 ${warnings.length} compatibility warning(s)` : failureMessage();
|
|
79990
79996
|
return {
|
|
79991
79997
|
ok,
|
|
79992
79998
|
message,
|
|
@@ -81290,11 +81296,11 @@ var rotate3 = make29("rotate-secret", {
|
|
|
81290
81296
|
const client = yield* getClientProvider;
|
|
81291
81297
|
const data = yield* regenerateSecret({ id }).pipe(client.provide, mapError2((error) => toCliApiError("Could not rotate webhook secret", error)));
|
|
81292
81298
|
const warning = `Read this signing secret again with samva webhooks secret ${id}. The previous secret remains valid for 24 hours.`;
|
|
81293
|
-
const
|
|
81299
|
+
const signingSecret = value2(data.secret);
|
|
81294
81300
|
if (json)
|
|
81295
|
-
return yield* printJson({ secret, warning });
|
|
81301
|
+
return yield* printJson({ secret: signingSecret, warning });
|
|
81296
81302
|
yield* error(`WARNING: ${warning}`);
|
|
81297
|
-
yield* log(
|
|
81303
|
+
yield* log(signingSecret);
|
|
81298
81304
|
}).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
|
|
81299
81305
|
var create17 = make29("create", {
|
|
81300
81306
|
data: String9("data").pipe(withDescription2("Webhook JSON: name, url, eventTypes, and optional retry settings")),
|
|
@@ -81314,16 +81320,17 @@ var create17 = make29("create", {
|
|
|
81314
81320
|
const client = yield* getClientProvider;
|
|
81315
81321
|
const result = yield* create16(payload).pipe(client.provide, mapError2((error) => toCliApiError("Could not create webhook", error)));
|
|
81316
81322
|
const warning = `Read this signing secret again with samva webhooks secret ${result.endpoint.id}.`;
|
|
81317
|
-
const
|
|
81318
|
-
if (json)
|
|
81319
|
-
return yield* printJson({ endpoint: result.endpoint, secret, warning });
|
|
81323
|
+
const signingSecret = value2(result.secret);
|
|
81324
|
+
if (json) {
|
|
81325
|
+
return yield* printJson({ endpoint: result.endpoint, secret: signingSecret, warning });
|
|
81326
|
+
}
|
|
81320
81327
|
yield* error(`WARNING: ${warning}`);
|
|
81321
81328
|
yield* printFields([
|
|
81322
81329
|
["ID", result.endpoint.id],
|
|
81323
81330
|
["Name", result.endpoint.name],
|
|
81324
81331
|
["Status", result.endpoint.status],
|
|
81325
81332
|
["URL", result.endpoint.url],
|
|
81326
|
-
["Signing secret",
|
|
81333
|
+
["Signing secret", signingSecret]
|
|
81327
81334
|
]);
|
|
81328
81335
|
}).pipe(json ? provideService2(MinimumLogLevel2, "None") : identity)));
|
|
81329
81336
|
var update15 = make29("update", {
|
|
@@ -81454,6 +81461,40 @@ var cli = make29("samva").pipe(withDescription3(`Samva \u2014 email and platform
|
|
|
81454
81461
|
}
|
|
81455
81462
|
]), withSubcommands([...rootCommands, helpCommand]), withGlobalFlags(globalFlags));
|
|
81456
81463
|
|
|
81464
|
+
// src/lib/help-json.ts
|
|
81465
|
+
var description = (value) => getOrNull(value);
|
|
81466
|
+
var flag = (doc) => ({
|
|
81467
|
+
name: doc.name,
|
|
81468
|
+
aliases: doc.aliases,
|
|
81469
|
+
type: doc.type,
|
|
81470
|
+
description: description(doc.description),
|
|
81471
|
+
required: doc.required
|
|
81472
|
+
});
|
|
81473
|
+
var helpDocJson = (doc) => ({
|
|
81474
|
+
schemaVersion: 1,
|
|
81475
|
+
description: doc.description,
|
|
81476
|
+
usage: doc.usage,
|
|
81477
|
+
flags: doc.flags.map(flag),
|
|
81478
|
+
globalFlags: (doc.globalFlags ?? []).map(flag),
|
|
81479
|
+
args: (doc.args ?? []).map((arg) => ({
|
|
81480
|
+
name: arg.name,
|
|
81481
|
+
type: arg.type,
|
|
81482
|
+
description: description(arg.description),
|
|
81483
|
+
required: arg.required,
|
|
81484
|
+
variadic: arg.variadic
|
|
81485
|
+
})),
|
|
81486
|
+
subcommands: (doc.subcommands ?? []).flatMap((group) => group.commands.map((command) => ({
|
|
81487
|
+
name: command.name,
|
|
81488
|
+
alias: command.alias ?? null,
|
|
81489
|
+
description: command.shortDescription ?? command.description,
|
|
81490
|
+
group: group.group ?? null
|
|
81491
|
+
}))),
|
|
81492
|
+
examples: (doc.examples ?? []).map((example) => ({
|
|
81493
|
+
command: example.command,
|
|
81494
|
+
description: example.description ?? null
|
|
81495
|
+
}))
|
|
81496
|
+
});
|
|
81497
|
+
|
|
81457
81498
|
// src/bin.ts
|
|
81458
81499
|
var argv = process.argv.slice(2);
|
|
81459
81500
|
var outputMode = outputModeFromArgv(argv);
|
|
@@ -81479,7 +81520,7 @@ var rootMachineHelp = (() => {
|
|
|
81479
81520
|
}
|
|
81480
81521
|
return { requested, command: undefined };
|
|
81481
81522
|
})();
|
|
81482
|
-
var
|
|
81523
|
+
var helpRequested = processArgs.some((token) => token === "--help" || token === "-h");
|
|
81483
81524
|
var isUnknownRootMachineHelp = machineMode && rootMachineHelp.requested && rootMachineHelp.command !== undefined && !isKnownRootCommand(rootMachineHelp.command);
|
|
81484
81525
|
var cliLogger = make30(({ logLevel, message }) => {
|
|
81485
81526
|
const text = (Array.isArray(message) ? message : [message]).map(String).join(" ");
|
|
@@ -81505,11 +81546,21 @@ var isBareHelp = (error) => error instanceof ShowHelp && error.errors.length ===
|
|
|
81505
81546
|
var formatter = {
|
|
81506
81547
|
...defaultFormatter2(),
|
|
81507
81548
|
formatError: () => "",
|
|
81508
|
-
formatErrors: () => ""
|
|
81549
|
+
formatErrors: () => "",
|
|
81550
|
+
...machineMode && helpRequested ? {
|
|
81551
|
+
formatHelpDoc: (doc) => JSON.stringify(helpDocJson(doc))
|
|
81552
|
+
} : {}
|
|
81509
81553
|
};
|
|
81510
81554
|
var flushSuccessfulResults = (state, partial = false) => gen2(function* () {
|
|
81511
|
-
if (outputMode === "quiet"
|
|
81555
|
+
if (outputMode === "quiet")
|
|
81556
|
+
return;
|
|
81557
|
+
if (outputMode === "jsonl") {
|
|
81558
|
+
if (helpRequested && state.lines.length === 1) {
|
|
81559
|
+
yield* writeOutput(process.stdout, `${JSON.stringify(resultEnvelope(commandNameFromArgv(argv), JSON.parse(state.lines[0])))}
|
|
81560
|
+
`);
|
|
81561
|
+
}
|
|
81512
81562
|
return;
|
|
81563
|
+
}
|
|
81513
81564
|
if (outputMode === "human") {
|
|
81514
81565
|
if (state.lines.length > 0) {
|
|
81515
81566
|
yield* writeOutput(process.stdout, `${state.lines.join(`
|
|
@@ -81611,12 +81662,7 @@ Try: ${next}`}`);
|
|
|
81611
81662
|
}
|
|
81612
81663
|
yield* printJsonError(error2, message);
|
|
81613
81664
|
});
|
|
81614
|
-
var
|
|
81615
|
-
const payload = resultEnvelope(commandNameFromArgv(argv), helpManifest);
|
|
81616
|
-
yield* writeOutput(process.stdout, `${JSON.stringify(payload, null, outputMode === "jsonl" ? undefined : 2)}
|
|
81617
|
-
`);
|
|
81618
|
-
});
|
|
81619
|
-
var program = (isRootMachineHelp ? validateProcessArgs(argv).pipe(flatMap3(() => runMachineHelp)) : isUnknownRootMachineHelp ? validateProcessArgs(argv).pipe(flatMap3(() => new CliUsageError({
|
|
81665
|
+
var program = (isUnknownRootMachineHelp ? validateProcessArgs(argv).pipe(flatMap3(() => new CliUsageError({
|
|
81620
81666
|
code: "unknown_subcommand",
|
|
81621
81667
|
message: `Unknown subcommand ${JSON.stringify(rootMachineHelp.command)} for samva.`
|
|
81622
81668
|
}))) : withStdoutBuffer(validateProcessArgs(argv).pipe(flatMap3(() => run5(cli, { version: package_default.version }))))).pipe(provide4(mergeAll2(layer14([cliLogger]), layer12, layer13(formatter), layer17)), matchEffect3({
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@samva/cli",
|
|
3
|
-
"version": "0.22.
|
|
3
|
+
"version": "0.22.1",
|
|
4
4
|
"description": "Samva CLI — email and platform operations from your terminal",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cli",
|
|
@@ -43,29 +43,29 @@
|
|
|
43
43
|
"build:release-artifacts": "bun run scripts/build-release-artifacts.ts",
|
|
44
44
|
"test": "vitest run --root ../.. --project cli",
|
|
45
45
|
"test:package": "vitest run --root ../.. --project cli packages/cli/tests/package-install.e2e.test.ts",
|
|
46
|
-
"typecheck": "tsc --noEmit && tsc --noEmit -p tests/consumer/tsconfig.json && tsc --noEmit -p tests/consumer/tsconfig.default.json"
|
|
46
|
+
"typecheck": "tsc-rs --noEmit && tsc-rs --noEmit -p tests/consumer/tsconfig.json && tsc-rs --noEmit -p tests/consumer/tsconfig.default.json"
|
|
47
47
|
},
|
|
48
48
|
"devDependencies": {
|
|
49
49
|
"@effect/platform-bun": "4.0.4",
|
|
50
50
|
"@effect/vitest": "4.0.4",
|
|
51
51
|
"@samva/contracts": "0.0.0",
|
|
52
52
|
"@samva/core": "0.0.0",
|
|
53
|
-
"@samva/mailbox": "0.5.
|
|
53
|
+
"@samva/mailbox": "0.5.5",
|
|
54
54
|
"@samva/markup": "0.17.3",
|
|
55
55
|
"@samva/vite": "0.17.3",
|
|
56
56
|
"@types/node": "^26.6.2",
|
|
57
57
|
"better-auth": "1.7.5",
|
|
58
58
|
"effect": "4.0.4",
|
|
59
|
-
"samva": "0.23.
|
|
60
|
-
"
|
|
59
|
+
"samva": "0.23.1",
|
|
60
|
+
"tsc-rs": "0.7.0",
|
|
61
61
|
"vite": "~8.3.0",
|
|
62
62
|
"vitest": "^5.0.3"
|
|
63
63
|
},
|
|
64
64
|
"optionalDependencies": {
|
|
65
|
-
"@samva/cli-darwin-arm64": "0.22.
|
|
66
|
-
"@samva/cli-darwin-x64": "0.22.
|
|
67
|
-
"@samva/cli-linux-arm64": "0.22.
|
|
68
|
-
"@samva/cli-linux-x64": "0.22.
|
|
65
|
+
"@samva/cli-darwin-arm64": "0.22.1",
|
|
66
|
+
"@samva/cli-darwin-x64": "0.22.1",
|
|
67
|
+
"@samva/cli-linux-arm64": "0.22.1",
|
|
68
|
+
"@samva/cli-linux-x64": "0.22.1"
|
|
69
69
|
},
|
|
70
70
|
"engines": {
|
|
71
71
|
"node": ">=18"
|