@garuhq/cli 0.7.0 → 0.8.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/CHANGELOG.md +15 -0
- package/dist/index.cjs +16 -13
- package/package.json +2 -2
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,21 @@
|
|
|
3
3
|
All notable changes to `@garuhq/cli` are documented in this file. Format:
|
|
4
4
|
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/). Versioning: [SemVer](https://semver.org/).
|
|
5
5
|
|
|
6
|
+
## [0.8.0] — 2026-07-18
|
|
7
|
+
|
|
8
|
+
### Changed
|
|
9
|
+
|
|
10
|
+
- **Products now use the versioned public API.** Via `@garuhq/node@0.16.0`,
|
|
11
|
+
`garu products create` / `update` hit `/api/v1/products` (uuid-keyed). The
|
|
12
|
+
numeric product id is no longer returned; product output shows the `uuid`.
|
|
13
|
+
|
|
14
|
+
### Fixed
|
|
15
|
+
|
|
16
|
+
- **`--value` is Reais, not centavos.** The flag was documented and parsed as
|
|
17
|
+
centavos; following the help (`--value 4990`) created a product priced 100×
|
|
18
|
+
(R$ 4.990,00 instead of R$ 49,90). `--value` now takes a decimal amount in
|
|
19
|
+
Reais (e.g. `49.90`). `charges` / refund `--amount` remain centavos.
|
|
20
|
+
|
|
6
21
|
## [0.7.0] — 2026-05-31
|
|
7
22
|
|
|
8
23
|
### Added
|
package/dist/index.cjs
CHANGED
|
@@ -15,7 +15,7 @@ var pc__default = /*#__PURE__*/_interopDefault(pc);
|
|
|
15
15
|
// src/index.ts
|
|
16
16
|
|
|
17
17
|
// src/version.ts
|
|
18
|
-
var CLI_VERSION = "0.
|
|
18
|
+
var CLI_VERSION = "0.8.0";
|
|
19
19
|
var CliError = class extends Error {
|
|
20
20
|
code;
|
|
21
21
|
exitCode;
|
|
@@ -536,7 +536,7 @@ function prettyProduct(p) {
|
|
|
536
536
|
const lines = [
|
|
537
537
|
`Product ${p.uuid ?? p.id}`,
|
|
538
538
|
` name: ${p.name}`,
|
|
539
|
-
` value: ${p.value} (
|
|
539
|
+
` value: ${p.value} (reais)`,
|
|
540
540
|
` methods: ${methods || "(none)"}`
|
|
541
541
|
];
|
|
542
542
|
if (p.description) lines.push(` description: ${p.description}`);
|
|
@@ -937,11 +937,14 @@ function parseIntInRange(raw, label, min, max) {
|
|
|
937
937
|
}
|
|
938
938
|
return n;
|
|
939
939
|
}
|
|
940
|
-
function
|
|
940
|
+
function parseNonNegativeBrl(raw, label) {
|
|
941
941
|
const trimmed = raw.trim();
|
|
942
|
-
const n = Number
|
|
943
|
-
if (!Number.isFinite(n) ||
|
|
944
|
-
throw new CliError(
|
|
942
|
+
const n = Number(trimmed);
|
|
943
|
+
if (trimmed === "" || !Number.isFinite(n) || n < 0) {
|
|
944
|
+
throw new CliError(
|
|
945
|
+
"invalid_input",
|
|
946
|
+
`${label} must be a non-negative amount in BRL/reais, e.g. 49.90 (got '${raw}')`
|
|
947
|
+
);
|
|
945
948
|
}
|
|
946
949
|
return n;
|
|
947
950
|
}
|
|
@@ -979,7 +982,7 @@ Recipes:
|
|
|
979
982
|
|
|
980
983
|
# 1. Create a product with Pix Autom\xE1tico enabled
|
|
981
984
|
garu products create \\
|
|
982
|
-
--name "Plano Mensal" --value
|
|
985
|
+
--name "Plano Mensal" --value 49.90 \\
|
|
983
986
|
--pix --credit-card --pix-automatic \\
|
|
984
987
|
--subscription --subscription-type monthly
|
|
985
988
|
|
|
@@ -1285,9 +1288,9 @@ Recipes:
|
|
|
1285
1288
|
});
|
|
1286
1289
|
const products = program.command("products").description("Create and update products");
|
|
1287
1290
|
products.command("create").description("Create a product").requiredOption("--name <name>", "product name").option(
|
|
1288
|
-
"--value <
|
|
1289
|
-
"price in
|
|
1290
|
-
(v) =>
|
|
1291
|
+
"--value <reais>",
|
|
1292
|
+
"price in reais / decimal BRL (e.g. 49.90)",
|
|
1293
|
+
(v) => parseNonNegativeBrl(v, "--value")
|
|
1291
1294
|
).option("--description <text>", "product description").option("--image <url>", "HTTPS URL of the product cover image").option("--tags <list>", "comma-separated tags", parseCsvList).option("--pix", "accept PIX").option("--no-pix", "do not accept PIX").option("--boleto", "accept boleto").option("--no-boleto", "do not accept boleto").option("--credit-card", "accept credit card").option("--no-credit-card", "do not accept credit card").option("--pix-automatic", "expose Pix Autom\xE1tico on the subscription checkout").option("--no-pix-automatic", "do not expose Pix Autom\xE1tico").option(
|
|
1292
1295
|
"--installments <n>",
|
|
1293
1296
|
"max credit-card installments",
|
|
@@ -1316,9 +1319,9 @@ Recipes:
|
|
|
1316
1319
|
products.command("update <id>").description(
|
|
1317
1320
|
"Update a product (partial \u2014 only the flags you pass change). <id> is the numeric id or UUID"
|
|
1318
1321
|
).option("--name <name>", "product name").option(
|
|
1319
|
-
"--value <
|
|
1320
|
-
"price in
|
|
1321
|
-
(v) =>
|
|
1322
|
+
"--value <reais>",
|
|
1323
|
+
"price in reais / decimal BRL (e.g. 49.90)",
|
|
1324
|
+
(v) => parseNonNegativeBrl(v, "--value")
|
|
1322
1325
|
).option("--description <text>", "product description").option("--image <url>", "HTTPS URL of the product cover image").option("--tags <list>", "comma-separated tags", parseCsvList).option("--pix", "accept PIX").option("--no-pix", "do not accept PIX").option("--boleto", "accept boleto").option("--no-boleto", "do not accept boleto").option("--credit-card", "accept credit card").option("--no-credit-card", "do not accept credit card").option("--pix-automatic", "expose Pix Autom\xE1tico on the subscription checkout").option("--no-pix-automatic", "do not expose Pix Autom\xE1tico").option(
|
|
1323
1326
|
"--installments <n>",
|
|
1324
1327
|
"max credit-card installments",
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@garuhq/cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.8.0",
|
|
4
4
|
"description": "Official command-line interface for the Garu payment gateway.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"homepage": "https://garu.com.br",
|
|
@@ -46,7 +46,7 @@
|
|
|
46
46
|
"prepublishOnly": "npm run check:version-sync && npm run typecheck && npm test && npm run build"
|
|
47
47
|
},
|
|
48
48
|
"dependencies": {
|
|
49
|
-
"@garuhq/node": "0.
|
|
49
|
+
"@garuhq/node": "0.16.0",
|
|
50
50
|
"@inquirer/prompts": "8.4.1",
|
|
51
51
|
"commander": "12.0.0",
|
|
52
52
|
"picocolors": "1.0.0",
|