pivotkit-cli 0.0.0-stage → 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/CHANGELOG.md +33 -0
- package/LICENSE +21 -0
- package/README.md +38 -2
- package/bin/pivotkit.js +5 -0
- package/package.json +66 -4
- package/src/cli.js +495 -0
- package/src/commands.js +113 -0
- package/src/errors.js +66 -0
- package/src/help.js +116 -0
- package/src/safe-files.js +190 -0
- package/types/cli.d.ts +27 -0
- package/types/commands.d.ts +80 -0
- package/types/errors.d.ts +26 -0
- package/types/help.d.ts +7 -0
- package/types/safe-files.d.ts +39 -0
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to `pivotkit-cli` are documented in this file. The format is based on
|
|
4
|
+
[Keep a Changelog](https://keepachangelog.com/en/1.1.0/), and this package adheres to
|
|
5
|
+
[Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
+
|
|
7
|
+
## [Unreleased]
|
|
8
|
+
|
|
9
|
+
## [0.1.0] - 2026-11-13
|
|
10
|
+
|
|
11
|
+
First release.
|
|
12
|
+
|
|
13
|
+
### Added
|
|
14
|
+
|
|
15
|
+
- A workbook over `archiveEntries` or `unpackedBytes` is a `limit` error with the code
|
|
16
|
+
`LIMIT_EXCEEDED` (pivotkit-xlsx [#208](https://github.com/eizedev/pivotkit/issues/208)); the docs
|
|
17
|
+
give the measured time and memory of untrusted workbooks at the default limits and recommend
|
|
18
|
+
`--limit unpackedBytes=...` and a time limit for them.
|
|
19
|
+
- `pivotkit render`, `validate`, `describe`, `completion` (bash, zsh, fish, PowerShell) and `help`,
|
|
20
|
+
with exit codes 0, 1 (findings) and 2 (usage, file, limit, template) and `--json`
|
|
21
|
+
([#165](https://github.com/eizedev/pivotkit/issues/165)).
|
|
22
|
+
- Files read once as regular files with their size checked before reading, written through a
|
|
23
|
+
temporary file; `--allow-dir` limits every file to the directories named (real paths); no file
|
|
24
|
+
content in a message.
|
|
25
|
+
- Defaults from `PIVOTKIT_LOCALE`, `PIVOTKIT_TIME_ZONE` and `PIVOTKIT_NOW`; every command checks them
|
|
26
|
+
and names the variable a wrong value came from.
|
|
27
|
+
- `--bom auto|on|off`: a CSV file of `-o` starts with a byte order mark for Excel, CSV on stdout not.
|
|
28
|
+
- The format comes from `-f` or a known extension of `-o`; another extension (`-o report.pdf`) is a
|
|
29
|
+
usage error instead of HTML in a `.pdf`.
|
|
30
|
+
- An option that does nothing in the chosen format (`--width` with `csv`) is a warning `ignoredOption`.
|
|
31
|
+
|
|
32
|
+
[Unreleased]: https://github.com/eizedev/pivotkit/compare/pivotkit-cli@0.1.0...HEAD
|
|
33
|
+
[0.1.0]: https://github.com/eizedev/pivotkit/releases/tag/pivotkit-cli@0.1.0
|
package/LICENSE
ADDED
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 eizedev
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
package/README.md
CHANGED
|
@@ -1,3 +1,39 @@
|
|
|
1
|
-
#
|
|
1
|
+
# pivotkit-cli
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
The [pivotkit](https://pivotkit.eize.dev/) command line, `pivotkit`: run a view over a CSV, JSON or
|
|
4
|
+
Excel file and write an HTML report, CSV, JSON, XLSX or the chart as SVG; validate and describe views
|
|
5
|
+
in CI with stable exit codes and `--json`. No network, no browser; with `--now` the output is the same
|
|
6
|
+
on every run. Files are read and written only as regular files, and `--allow-dir` limits them to the
|
|
7
|
+
directories you name.
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install --global pivotkit-cli # or: npx pivotkit-cli render ...
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
Node 22 or later. It brings pivotkit-core, pivotkit-report, pivotkit-xlsx and ECharts 6.1.0.
|
|
16
|
+
|
|
17
|
+
## Example
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
pivotkit render sales.pivot.json --data sales.csv -o sales.html --now 2026-11-13
|
|
21
|
+
pivotkit validate sales.pivot.json --data sales.csv --strict --json
|
|
22
|
+
pivotkit describe sales.csv
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
Exit codes: 0 done, 1 findings (an error in the view, or a warning with `--strict`), 2 a usage, file,
|
|
26
|
+
limit or template error.
|
|
27
|
+
|
|
28
|
+
## Where in the docs
|
|
29
|
+
|
|
30
|
+
| Topic | Page |
|
|
31
|
+
| --- | --- |
|
|
32
|
+
| Commands, options, exit codes, `--json`, completion, file safety | [pivotkit-cli reference](https://pivotkit.eize.dev/reference/cli/) |
|
|
33
|
+
| The print template of `--template` | [Print template](https://pivotkit.eize.dev/reference/print-template/) |
|
|
34
|
+
| The library it runs on | [pivotkit-report reference](https://pivotkit.eize.dev/reference/report/) |
|
|
35
|
+
| Changes | [CHANGELOG](https://github.com/eizedev/pivotkit/blob/main/packages/pivotkit-cli/CHANGELOG.md) |
|
|
36
|
+
|
|
37
|
+
## License
|
|
38
|
+
|
|
39
|
+
[MIT](https://github.com/eizedev/pivotkit/blob/main/LICENSE)
|
package/bin/pivotkit.js
ADDED
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// pivotkit: the command line of pivotkit-report (docs/reference/cli.md).
|
|
3
|
+
import { main } from "../src/cli.js";
|
|
4
|
+
|
|
5
|
+
process.exitCode = await main(process.argv.slice(2), { stdin: process.stdin, stdout: process.stdout, stderr: process.stderr, env: process.env, cwd: process.cwd() });
|
package/package.json
CHANGED
|
@@ -1,6 +1,68 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pivotkit-cli",
|
|
3
|
-
"version": "0.
|
|
4
|
-
"
|
|
5
|
-
"
|
|
6
|
-
|
|
3
|
+
"version": "0.1.0",
|
|
4
|
+
"description": "The pivotkit command line: render views over CSV, JSON or Excel data to HTML reports, CSV, JSON, XLSX and SVG, and validate or describe views in CI.",
|
|
5
|
+
"license": "MIT",
|
|
6
|
+
"author": "eizedev <oss@eize.dev>",
|
|
7
|
+
"homepage": "https://pivotkit.eize.dev/reference/cli/",
|
|
8
|
+
"repository": {
|
|
9
|
+
"type": "git",
|
|
10
|
+
"url": "git+https://github.com/eizedev/pivotkit.git",
|
|
11
|
+
"directory": "packages/pivotkit-cli"
|
|
12
|
+
},
|
|
13
|
+
"bugs": "https://github.com/eizedev/pivotkit/issues",
|
|
14
|
+
"keywords": [
|
|
15
|
+
"pivotkit",
|
|
16
|
+
"pivot-table",
|
|
17
|
+
"cli",
|
|
18
|
+
"reporting",
|
|
19
|
+
"report",
|
|
20
|
+
"csv",
|
|
21
|
+
"excel",
|
|
22
|
+
"pivot-grid",
|
|
23
|
+
"pivottable",
|
|
24
|
+
"excel-export"
|
|
25
|
+
],
|
|
26
|
+
"type": "module",
|
|
27
|
+
"bin": {
|
|
28
|
+
"pivotkit": "bin/pivotkit.js"
|
|
29
|
+
},
|
|
30
|
+
"exports": {
|
|
31
|
+
".": {
|
|
32
|
+
"types": "./types/cli.d.ts",
|
|
33
|
+
"default": "./src/cli.js"
|
|
34
|
+
},
|
|
35
|
+
"./package.json": "./package.json"
|
|
36
|
+
},
|
|
37
|
+
"files": [
|
|
38
|
+
"bin",
|
|
39
|
+
"src",
|
|
40
|
+
"types",
|
|
41
|
+
"README.md",
|
|
42
|
+
"CHANGELOG.md",
|
|
43
|
+
"LICENSE"
|
|
44
|
+
],
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=22"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"test": "node --test \"test/*.test.js\"",
|
|
50
|
+
"coverage": "node --test --experimental-test-coverage --test-coverage-include=\"src/**\" \"test/*.test.js\"",
|
|
51
|
+
"types": "tsc -p .",
|
|
52
|
+
"test:types": "tsc -p test/types",
|
|
53
|
+
"prepack": "npm run types && node -e \"require('node:fs').copyFileSync('../../LICENSE', 'LICENSE')\""
|
|
54
|
+
},
|
|
55
|
+
"dependencies": {
|
|
56
|
+
"echarts": "6.1.0",
|
|
57
|
+
"pivotkit-core": "^0.5.0",
|
|
58
|
+
"pivotkit-report": "^0.1.0",
|
|
59
|
+
"pivotkit-xlsx": "^0.2.0"
|
|
60
|
+
},
|
|
61
|
+
"types": "./types/cli.d.ts",
|
|
62
|
+
"publishConfig": {
|
|
63
|
+
"access": "public"
|
|
64
|
+
},
|
|
65
|
+
"devDependencies": {
|
|
66
|
+
"@types/node": "22.20.4"
|
|
67
|
+
}
|
|
68
|
+
}
|