@cs-object/cli 0.1.0 → 0.1.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/README.md +1 -1
- package/dist/{chunk-7XCJ6AF3.js → chunk-2IRNUHX6.js} +3 -18
- package/dist/{chunk-UCPKZ67Z.js → chunk-KZZ2NIR7.js} +2 -2
- package/dist/{chunk-OYQDZWT7.js → chunk-PC7UAF4D.js} +1 -1
- package/dist/{chunk-KYWIVB2V.js → chunk-SCZCL6WF.js} +1 -1
- package/dist/cli.js +8 -8
- package/dist/{dev-server-BVY4Q6R6.js → dev-server-PBQWZU63.js} +5 -7
- package/dist/development.js +1 -1
- package/dist/{html-AAIMIB2S.js → html-WL2NAGRV.js} +3 -3
- package/dist/{pdf-WXWGZ6NC.js → pdf-AQCYVWRF.js} +3 -3
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -9,7 +9,7 @@ retain the unverified development paths.
|
|
|
9
9
|
|
|
10
10
|
Follow [setup](../../docs/development.md#setup). In the workspace use
|
|
11
11
|
`node packages/cso-cli/dist/cli.js`; an installed consumer uses `cso`.
|
|
12
|
-
`PYTHON` selects the interpreter with the installed `
|
|
12
|
+
`PYTHON` selects the interpreter with the installed `cs-object` wheel.
|
|
13
13
|
|
|
14
14
|
```sh
|
|
15
15
|
cso bindings examples/two-panel
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
parseStrictJson
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-SCZCL6WF.js";
|
|
4
4
|
import {
|
|
5
5
|
stringifyJson
|
|
6
6
|
} from "./chunk-MOM6Q2VG.js";
|
|
@@ -231,7 +231,7 @@ import { createRequire } from "module";
|
|
|
231
231
|
import { createElement } from "react";
|
|
232
232
|
import { renderToStaticMarkup } from "react-dom/server";
|
|
233
233
|
import { PreparedFormulaSheet } from "@cs-object/react";
|
|
234
|
-
function buildPreparedHtml(preparedDocument
|
|
234
|
+
function buildPreparedHtml(preparedDocument) {
|
|
235
235
|
const css = readFileSync3(
|
|
236
236
|
createRequire(import.meta.url).resolve("@cs-object/react/style.css"),
|
|
237
237
|
"utf8"
|
|
@@ -239,27 +239,12 @@ function buildPreparedHtml(preparedDocument, reviewNotice) {
|
|
|
239
239
|
const markup = renderToStaticMarkup(
|
|
240
240
|
createElement(PreparedFormulaSheet, { document: preparedDocument })
|
|
241
241
|
);
|
|
242
|
-
const notice = reviewNotice ? renderToStaticMarkup(
|
|
243
|
-
createElement(
|
|
244
|
-
"p",
|
|
245
|
-
{
|
|
246
|
-
"data-cso-review-notice": true,
|
|
247
|
-
style: {
|
|
248
|
-
fontSize: "10pt",
|
|
249
|
-
margin: "0 0 4mm",
|
|
250
|
-
padding: "2mm",
|
|
251
|
-
border: "1px solid #bbb"
|
|
252
|
-
}
|
|
253
|
-
},
|
|
254
|
-
reviewNotice
|
|
255
|
-
)
|
|
256
|
-
) : "";
|
|
257
242
|
return [
|
|
258
243
|
'<!doctype html><html lang="en"><head><meta charset="utf-8">',
|
|
259
244
|
renderToStaticMarkup(createElement("title", null, preparedDocument.title)),
|
|
260
245
|
`<meta http-equiv="Content-Security-Policy" content="default-src 'none'; img-src data:; style-src 'unsafe-inline'; font-src data:">`,
|
|
261
246
|
`<meta name="viewport" content="width=device-width, initial-scale=1"><style>${css}</style></head><body class="formula-sheet-printing cso-standalone-report">`,
|
|
262
|
-
`<div data-formula-sheet-print-root="true">${
|
|
247
|
+
`<div data-formula-sheet-print-root="true">${markup}</div></body></html>`
|
|
263
248
|
].join("");
|
|
264
249
|
}
|
|
265
250
|
|
|
@@ -8,10 +8,10 @@ import {
|
|
|
8
8
|
renderPreparedPdf,
|
|
9
9
|
retainSource,
|
|
10
10
|
sha256
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2IRNUHX6.js";
|
|
12
12
|
import {
|
|
13
13
|
executeAndVerify
|
|
14
|
-
} from "./chunk-
|
|
14
|
+
} from "./chunk-SCZCL6WF.js";
|
|
15
15
|
|
|
16
16
|
// src/document.ts
|
|
17
17
|
import { CommandReportSchema } from "@cs-object/core";
|
|
@@ -133,7 +133,7 @@ Options:
|
|
|
133
133
|
--help Show usage without executing Python or launching Chromium.
|
|
134
134
|
|
|
135
135
|
Paths resolve from the caller's directory. Set PYTHON to the interpreter with the
|
|
136
|
-
|
|
136
|
+
cs-object wheel installed. dev-render requires Playwright Chromium.
|
|
137
137
|
Development exit codes: 0 exported/rendered, 1 execution/render/write failed,
|
|
138
138
|
2 invalid usage. verify/html/pdf --format json emit one public CommandReport.
|
|
139
139
|
`;
|
package/dist/cli.js
CHANGED
|
@@ -3,12 +3,12 @@ import {
|
|
|
3
3
|
UsageError,
|
|
4
4
|
help,
|
|
5
5
|
parseCliArgs
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-PC7UAF4D.js";
|
|
7
7
|
import {
|
|
8
8
|
initialReport,
|
|
9
9
|
usageReport,
|
|
10
10
|
verifyCommand
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-SCZCL6WF.js";
|
|
12
12
|
import {
|
|
13
13
|
stringifyJson
|
|
14
14
|
} from "./chunk-MOM6Q2VG.js";
|
|
@@ -111,7 +111,7 @@ Paths resolve against the caller directory. --help executes neither Python nor C
|
|
|
111
111
|
`;
|
|
112
112
|
return `Usage: cso ${command2} <file.cso.py> --function <name> [--input <name=number>] [--reference <file.json>]${command2 === "pdf" ? " --out <path.pdf>" : ""} [--format json]${command2 === "pdf" ? " [--no-evidence]" : ""}
|
|
113
113
|
|
|
114
|
-
${command2 === "verify" ? "Execute once with installed
|
|
114
|
+
${command2 === "verify" ? "Execute once with installed cs-object and independently evaluate every documented result." : "Verify once, render the captured execution, and atomically replace the PDF. Evidence is retained unless --no-evidence is set."}
|
|
115
115
|
Repeat --input for distinct parameters. Duplicate, unknown and invalid inputs fail.
|
|
116
116
|
--reference captures one explicit versioned reference file. Missing matches are not_applicable.
|
|
117
117
|
--format json emits one public CommandReport, including on errors.
|
|
@@ -130,7 +130,7 @@ var bindingsHelp = `Usage: cso bindings <directory> [--check]
|
|
|
130
130
|
Generate importable _cso_bindings modules and typed signatures from .cso.py files.
|
|
131
131
|
--check reports stale or missing files without writing. Calculations are not executed.
|
|
132
132
|
Python-only equivalent: python -m cso_python bindings <directory> [--check]
|
|
133
|
-
Set PYTHON to the interpreter with
|
|
133
|
+
Set PYTHON to the interpreter with cs-object installed.
|
|
134
134
|
Exit codes: 0 current/generated, 1 stale/source/write failure, 2 invalid usage.
|
|
135
135
|
`;
|
|
136
136
|
function bindingsCommand(args2) {
|
|
@@ -175,11 +175,11 @@ if (command === "--help" || command === void 0 || [
|
|
|
175
175
|
"dev-render"
|
|
176
176
|
].includes(command) && args.includes("--help")) {
|
|
177
177
|
process.stdout.write(
|
|
178
|
-
command === "verify" || command === "pdf" || command === "html" ? verifiedHelp(command) : command === "dev" ? (await import("./dev-server-
|
|
178
|
+
command === "verify" || command === "pdf" || command === "html" ? verifiedHelp(command) : command === "dev" ? (await import("./dev-server-PBQWZU63.js")).devHelp : command === "bindings" ? bindingsHelp : help
|
|
179
179
|
);
|
|
180
180
|
} else if (command === "dev") {
|
|
181
181
|
try {
|
|
182
|
-
const { devCommand } = await import("./dev-server-
|
|
182
|
+
const { devCommand } = await import("./dev-server-PBQWZU63.js");
|
|
183
183
|
await devCommand(args);
|
|
184
184
|
} catch (error) {
|
|
185
185
|
process.stderr.write(
|
|
@@ -195,10 +195,10 @@ if (command === "--help" || command === void 0 || [
|
|
|
195
195
|
try {
|
|
196
196
|
const options = parseVerifiedArgs(command, args);
|
|
197
197
|
if (options.command === "html") {
|
|
198
|
-
const { htmlCommand } = await import("./html-
|
|
198
|
+
const { htmlCommand } = await import("./html-WL2NAGRV.js");
|
|
199
199
|
outcome = await htmlCommand(options);
|
|
200
200
|
} else if (options.command === "pdf") {
|
|
201
|
-
const { pdfCommand } = await import("./pdf-
|
|
201
|
+
const { pdfCommand } = await import("./pdf-AQCYVWRF.js");
|
|
202
202
|
outcome = await pdfCommand(options);
|
|
203
203
|
} else {
|
|
204
204
|
outcome = verifyCommand(options);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
UsageError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-PC7UAF4D.js";
|
|
4
4
|
import {
|
|
5
5
|
LayoutInspectionError,
|
|
6
6
|
buildPreparedHtml,
|
|
@@ -8,11 +8,11 @@ import {
|
|
|
8
8
|
jsonBytes,
|
|
9
9
|
renderPreparedPdf,
|
|
10
10
|
sha256
|
|
11
|
-
} from "./chunk-
|
|
11
|
+
} from "./chunk-2IRNUHX6.js";
|
|
12
12
|
import {
|
|
13
13
|
executeAndVerify,
|
|
14
14
|
parseStrictJson
|
|
15
|
-
} from "./chunk-
|
|
15
|
+
} from "./chunk-SCZCL6WF.js";
|
|
16
16
|
import "./chunk-MOM6Q2VG.js";
|
|
17
17
|
|
|
18
18
|
// src/dev-server.ts
|
|
@@ -219,9 +219,7 @@ function createDevRuntime(options, limits = defaults) {
|
|
|
219
219
|
execution,
|
|
220
220
|
assets: captureAssets(options.sourcePath, execution)
|
|
221
221
|
});
|
|
222
|
-
const
|
|
223
|
-
const notice = `Source-to-document consistency passed. Independent numerical reference: ${independent === "passed" ? "passed" : "pending, no matching reference"}. Human visual inspection is pending. These checks do not establish engineering approval.`;
|
|
224
|
-
const html = Buffer.from(buildPreparedHtml(document, notice));
|
|
222
|
+
const html = Buffer.from(buildPreparedHtml(document));
|
|
225
223
|
const bytes = html.length + jsonBytes(document).length + verified.capture.executionBytes.length + (verified.capture.referenceBytes?.length ?? 0) + jsonBytes(verified.capture.verification).length;
|
|
226
224
|
prune(bytes, 1);
|
|
227
225
|
const run = {
|
|
@@ -439,7 +437,7 @@ pdf.addEventListener('click', async event => {
|
|
|
439
437
|
var devHelp = `Usage: cso dev <file.cso.py> --function <name> [--port <0-65535>] [--reference <file.json>]
|
|
440
438
|
|
|
441
439
|
Serve a verified calculation on 127.0.0.1. Port 0 chooses an available port.
|
|
442
|
-
PYTHON selects the installed
|
|
440
|
+
PYTHON selects the installed cs-object interpreter. Source path and function are fixed at startup.
|
|
443
441
|
`;
|
|
444
442
|
function parseDevArgs(args) {
|
|
445
443
|
const [source, ...rest] = args;
|
package/dist/development.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
documentCommand
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KZZ2NIR7.js";
|
|
4
|
+
import "./chunk-2IRNUHX6.js";
|
|
5
|
+
import "./chunk-SCZCL6WF.js";
|
|
6
6
|
import "./chunk-MOM6Q2VG.js";
|
|
7
7
|
export {
|
|
8
8
|
documentCommand as htmlCommand
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import {
|
|
2
2
|
documentCommand
|
|
3
|
-
} from "./chunk-
|
|
4
|
-
import "./chunk-
|
|
5
|
-
import "./chunk-
|
|
3
|
+
} from "./chunk-KZZ2NIR7.js";
|
|
4
|
+
import "./chunk-2IRNUHX6.js";
|
|
5
|
+
import "./chunk-SCZCL6WF.js";
|
|
6
6
|
import "./chunk-MOM6Q2VG.js";
|
|
7
7
|
export {
|
|
8
8
|
documentCommand as pdfCommand
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cs-object/cli",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.1",
|
|
4
4
|
"license": "Apache-2.0",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"description": "Installed calculation verification and development export/render commands.",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"devDependencies": {
|
|
39
39
|
"tsup": "^8.5.1",
|
|
40
40
|
"typescript": "^5",
|
|
41
|
-
"vitest": "^5.0.
|
|
41
|
+
"vitest": "^5.0.2",
|
|
42
42
|
"@types/node": "^26",
|
|
43
43
|
"@types/react": "^19",
|
|
44
44
|
"@types/react-dom": "^19",
|