@bilig/xlsx-formula-recalc 0.155.0 → 0.159.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/AGENTS.md ADDED
@@ -0,0 +1,84 @@
1
+ # @bilig/xlsx-formula-recalc Agent Notes
2
+
3
+ Use this package when a Node.js task edits an `.xlsx` workbook and needs fresh
4
+ formula results before returning the file or reading output cells.
5
+
6
+ Start with the no-project evaluator:
7
+
8
+ ```sh
9
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- bilig-evaluate --door workbook-compatibility --json
10
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- bilig-evaluate --door xlsx-cache --json
11
+ ```
12
+
13
+ Use `workbook-compatibility` when a caller asks whether a specific `.xlsx` is
14
+ safe to use with Bilig before an agent or Node service trusts it. The report is
15
+ an inspector, not a grader: it lists unsupported functions, external links,
16
+ macro payloads, pivots, volatile functions, stale caches, and risk reasons. Do
17
+ not add or claim a compatibility score.
18
+
19
+ If the task came from a SheetJS / `xlsx` stale-formula issue, the same package
20
+ also exposes a SheetJS-named command:
21
+
22
+ ```sh
23
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- sheetjs-recalc --demo --json
24
+ ```
25
+
26
+ If the caller has a real workbook but does not know which formulas to read yet,
27
+ inspect it first without writing an output file:
28
+
29
+ ```sh
30
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc workbook.xlsx --inspect --json
31
+ ```
32
+
33
+ Use the memorable cache-diagnosis alias for issue triage or CI:
34
+
35
+ ```sh
36
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-cache-doctor workbook.xlsx --json
37
+ ```
38
+
39
+ Use the workbook compatibility report for preflight risk review:
40
+
41
+ ```sh
42
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- workbook-compatibility-report workbook.xlsx --json
43
+ ```
44
+
45
+ Use the returned `suggestedReads`, stale cached formula counts, warnings, and
46
+ risk reasons to decide the narrow proof command. By default the doctor and
47
+ compatibility report inspect every formula; if a caller passes
48
+ `--inspect-limit`, require `uninspectedFormulaCellCount: 0` before treating the
49
+ report as complete coverage.
50
+
51
+ For a real workbook, use sheet-qualified A1 targets:
52
+
53
+ ```sh
54
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc quote.xlsx \
55
+ --set Inputs!B2=48 \
56
+ --read Summary!B7 \
57
+ --out quote.recalculated.xlsx \
58
+ --json
59
+ ```
60
+
61
+ For external workbook links, pass companion files with `--external-workbook`
62
+ or exact link bindings with `--external-workbook-target <path> <target>`:
63
+
64
+ ```sh
65
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc quote.xlsx \
66
+ --external-workbook-target ./fixtures/rates-current.xlsx file:///tmp/rates.xlsx \
67
+ --read Summary!B7 \
68
+ --json
69
+ ```
70
+
71
+ Use the API when code already has workbook bytes:
72
+
73
+ ```ts
74
+ import { recalculateXlsx } from '@bilig/xlsx-formula-recalc'
75
+
76
+ const result = recalculateXlsx(xlsxBytes, {
77
+ edits: [{ target: 'Inputs!B2', value: 48 }],
78
+ reads: ['Summary!B7'],
79
+ })
80
+ ```
81
+
82
+ Do not claim this is a full Excel clone. Review `result.warnings` and reduce
83
+ unsupported functions, external links, macros, and volatile formula cases into
84
+ fixtures before promising production behavior.
package/README.md CHANGED
@@ -17,26 +17,39 @@ and backend file pipelines where stale readback is worse than a hard failure.
17
17
  Run the no-project evaluator demo:
18
18
 
19
19
  ```sh
20
+ npx --package @bilig/xlsx-formula-recalc bilig-evaluate --door workbook-compatibility --json
20
21
  npx --package @bilig/xlsx-formula-recalc bilig-evaluate --door xlsx-cache --json
21
22
  ```
22
23
 
24
+ Use `workbook-compatibility` when the question is whether a real workbook has
25
+ known integration risks before a Node service or coding agent trusts Bilig with
26
+ it. The report lists unsupported functions, external links, VBA payloads,
27
+ pivots, volatile functions, stale caches, and concrete `risk.reasons`. It does
28
+ not certify Excel compatibility and it does not print a compatibility score.
29
+
23
30
  Expected evaluator shape:
24
31
 
25
32
  ```json
26
33
  {
27
34
  "schemaVersion": "bilig-evaluator.v1",
28
- "door": "xlsx-cache",
35
+ "door": "workbook-compatibility",
29
36
  "verified": true,
30
37
  "evidence": {
31
- "target": "Summary!B2",
32
- "before": 60000,
33
- "after": 72000,
34
- "staleCachedFormulaCount": 1,
35
- "suggestedReads": ["Summary!B2"]
38
+ "riskLevel": "high",
39
+ "unsupportedFunctions": [{ "name": "CUBEVALUE", "count": 1 }],
40
+ "volatileFunctions": [{ "name": "NOW", "count": 1 }],
41
+ "formulaCellCount": 3,
42
+ "staleCachedFormulaCount": 2
36
43
  }
37
44
  }
38
45
  ```
39
46
 
47
+ Run the report directly against a workbook:
48
+
49
+ ```sh
50
+ npx --package @bilig/xlsx-formula-recalc workbook-compatibility-report pricing.xlsx --json
51
+ ```
52
+
40
53
  ## Try The Cache Doctor Directly
41
54
 
42
55
  Run the no-project demo:
@@ -140,6 +153,10 @@ Use this package at the file boundary:
140
153
  That keeps your current file-writer choice intact and adds only the missing
141
154
  calculation/readback step.
142
155
 
156
+ If you are not sure whether the fix belongs at the XLSX file, SheetJS, ExcelJS,
157
+ template, CI, WorkPaper, or agent boundary, start with the
158
+ [stale formula readback chooser](https://proompteng.github.io/bilig/stale-formula-readback-chooser.html).
159
+
143
160
  ## Install
144
161
 
145
162
  ```sh
package/SKILL.md ADDED
@@ -0,0 +1,109 @@
1
+ ---
2
+ name: bilig-xlsx-formula-recalc
3
+ version: 0.1.0
4
+ description: Recalculate XLSX formula outputs in Node.js after cell edits without opening Excel, LibreOffice, or browser automation.
5
+ tags:
6
+ - xlsx
7
+ - excel
8
+ - formula-recalculation
9
+ - node
10
+ - spreadsheet-automation
11
+ - typescript
12
+ ---
13
+
14
+ # Bilig XLSX Formula Recalculation
15
+
16
+ Use `@bilig/xlsx-formula-recalc` when an agent or Node.js service has changed
17
+ XLSX inputs and must read recalculated formula outputs without opening Excel,
18
+ LibreOffice, or a browser. This package is the canonical scoped package.
19
+
20
+ ## First Check
21
+
22
+ ```sh
23
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- bilig-evaluate --door workbook-compatibility --json
24
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- bilig-evaluate --door xlsx-cache --json
25
+ ```
26
+
27
+ Use `workbook-compatibility` when you need a local preflight report for a real
28
+ workbook before a Node service or agent trusts it. The report lists unsupported
29
+ functions, external links, macro payloads, pivots, volatile functions, stale
30
+ caches, and concrete risk reasons. It does not certify Excel compatibility and
31
+ must not grow a compatibility score.
32
+
33
+ The cache evaluator should print `schemaVersion: "bilig-evaluator.v1"`,
34
+ `door: "xlsx-cache"`, `verified: true`, and evidence for a stale cached
35
+ formula corrected to a `Summary!B2` value of `72000`.
36
+
37
+ For SheetJS / `xlsx` stale-formula issues, use the SheetJS-named binary from the
38
+ same package:
39
+
40
+ ```sh
41
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- sheetjs-recalc --demo --json
42
+ ```
43
+
44
+ If you have a real workbook but do not yet know which formula cells to verify,
45
+ inspect it without writing an output file:
46
+
47
+ ```sh
48
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc workbook.xlsx --inspect --json
49
+ ```
50
+
51
+ For CI or issue triage, use the cache-diagnosis alias:
52
+
53
+ ```sh
54
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-cache-doctor workbook.xlsx --json
55
+ ```
56
+
57
+ For workbook risk review, use the compatibility report:
58
+
59
+ ```sh
60
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- workbook-compatibility-report workbook.xlsx --json
61
+ ```
62
+
63
+ The inspection output includes `formulaCellCount`, `staleCachedFormulaCount`,
64
+ `suggestedReads`, and warnings. Default inspection checks every formula. If a
65
+ workflow sets `--inspect-limit`, require `uninspectedFormulaCellCount: 0` before
66
+ treating the report as complete coverage.
67
+
68
+ ## Real Workbook
69
+
70
+ ```sh
71
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc workbook.xlsx \
72
+ --set Inputs!B2=48 \
73
+ --read Summary!B7 \
74
+ --out workbook.recalculated.xlsx \
75
+ --json
76
+ ```
77
+
78
+ For linked workbooks, pass companion files:
79
+
80
+ ```sh
81
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc workbook.xlsx \
82
+ --external-workbook rates.xlsx \
83
+ --read Summary!B7 \
84
+ --json
85
+ ```
86
+
87
+ Use an exact target binding when the workbook link target differs from the local
88
+ filename:
89
+
90
+ ```sh
91
+ npm exec --yes --package @bilig/xlsx-formula-recalc@latest -- xlsx-recalc workbook.xlsx \
92
+ --external-workbook-target ./fixtures/rates-current.xlsx file:///tmp/rates.xlsx \
93
+ --read Summary!B7 \
94
+ --json
95
+ ```
96
+
97
+ ## TypeScript
98
+
99
+ ```ts
100
+ import { recalculateXlsx } from '@bilig/xlsx-formula-recalc'
101
+
102
+ const result = recalculateXlsx(inputXlsxBytes, {
103
+ edits: [{ target: 'Inputs!B2', value: 48 }],
104
+ reads: ['Summary!B7'],
105
+ })
106
+ ```
107
+
108
+ Prefer `exceljs-formula-recalc` when the caller already owns an ExcelJS
109
+ `Workbook` object and wants read results patched back into that object.
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ await import('../dist/workbook-compatibility-report-cli.js')
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env node
2
+ export {};
@@ -0,0 +1,4 @@
1
+ #!/usr/bin/env node
2
+ import { runWorkbookCompatibilityReportCli } from 'xlsx-formula-recalc/workbook-compatibility-report';
3
+ process.exitCode = runWorkbookCompatibilityReportCli(process.argv.slice(2));
4
+ //# sourceMappingURL=workbook-compatibility-report-cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbook-compatibility-report-cli.js","sourceRoot":"","sources":["../src/workbook-compatibility-report-cli.ts"],"names":[],"mappings":";AAEA,OAAO,EAAE,iCAAiC,EAAE,MAAM,mDAAmD,CAAA;AAErG,OAAO,CAAC,QAAQ,GAAG,iCAAiC,CAAC,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,CAAA"}
@@ -0,0 +1,2 @@
1
+ export * from 'xlsx-formula-recalc/workbook-compatibility-report';
2
+ export type * from 'xlsx-formula-recalc/workbook-compatibility-report';
@@ -0,0 +1,2 @@
1
+ export * from 'xlsx-formula-recalc/workbook-compatibility-report';
2
+ //# sourceMappingURL=workbook-compatibility-report.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"workbook-compatibility-report.js","sourceRoot":"","sources":["../src/workbook-compatibility-report.ts"],"names":[],"mappings":"AAAA,cAAc,mDAAmD,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/xlsx-formula-recalc",
3
- "version": "0.155.0",
3
+ "version": "0.159.0",
4
4
  "description": "Diagnose stale cached XLSX formula values and recalculate XLSX formulas in Node.js without Excel, LibreOffice, or browser automation.",
5
5
  "keywords": [
6
6
  "bilig",
@@ -18,6 +18,8 @@
18
18
  "spreadsheet-formulas",
19
19
  "stale-xlsx-cache",
20
20
  "workbook",
21
+ "workbook-compatibility-report",
22
+ "workbook-risk-report",
21
23
  "xlsx",
22
24
  "xlsx-cache-doctor",
23
25
  "xlsx-calc",
@@ -40,12 +42,15 @@
40
42
  "bin": {
41
43
  "bilig-evaluate": "./bin/bilig-evaluate.js",
42
44
  "sheetjs-recalc": "./bin/sheetjs-recalc.js",
45
+ "workbook-compatibility-report": "./bin/workbook-compatibility-report.js",
43
46
  "xlsx-cache-doctor": "./bin/xlsx-cache-doctor.js",
44
47
  "xlsx-recalc": "./bin/xlsx-recalc.js"
45
48
  },
46
49
  "files": [
47
50
  "bin",
48
51
  "dist",
52
+ "AGENTS.md",
53
+ "SKILL.md",
49
54
  "README.md",
50
55
  "LICENSE"
51
56
  ],
@@ -68,6 +73,11 @@
68
73
  "types": "./dist/evaluator.d.ts",
69
74
  "import": "./dist/evaluator.js",
70
75
  "default": "./dist/evaluator.js"
76
+ },
77
+ "./workbook-compatibility-report": {
78
+ "types": "./dist/workbook-compatibility-report.d.ts",
79
+ "import": "./dist/workbook-compatibility-report.js",
80
+ "default": "./dist/workbook-compatibility-report.js"
71
81
  }
72
82
  },
73
83
  "publishConfig": {
@@ -78,7 +88,7 @@
78
88
  "smoke": "node ./dist/cli.js --help"
79
89
  },
80
90
  "dependencies": {
81
- "xlsx-formula-recalc": "0.155.0"
91
+ "xlsx-formula-recalc": "0.159.0"
82
92
  },
83
93
  "engines": {
84
94
  "node": ">=22.0.0"