@bilig/headless 0.10.14 → 0.10.16

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.
Files changed (2) hide show
  1. package/README.md +30 -4
  2. package/package.json +14 -5
package/README.md CHANGED
@@ -94,6 +94,8 @@ Repository:
94
94
  - Website: <https://proompteng.github.io/bilig/>
95
95
  - GitHub: <https://github.com/proompteng/bilig>
96
96
  - Star or bookmark: <https://github.com/proompteng/bilig/stargazers>
97
+ - Feedback discussion:
98
+ <https://github.com/proompteng/bilig/discussions/115>
97
99
  - Good first issues:
98
100
  <https://github.com/proompteng/bilig/blob/main/docs/starter-issues.md>
99
101
  - npm: <https://www.npmjs.com/package/@bilig/headless>
@@ -143,6 +145,10 @@ pnpm --filter @bilig/headless build
143
145
 
144
146
  ## Quickstart
145
147
 
148
+ This snippet is safe to paste into a one-file npm evaluation. It verifies formula
149
+ readback before and after a persisted restore instead of only printing a demo
150
+ value.
151
+
146
152
  ```ts
147
153
  import {
148
154
  WorkPaper,
@@ -167,6 +173,16 @@ const workbook = WorkPaper.buildFromSheets(
167
173
  },
168
174
  )
169
175
 
176
+ const numberValue = (cell: unknown): number => {
177
+ if (typeof cell === 'object' && cell !== null && 'value' in cell) {
178
+ const value = (cell as { value: unknown }).value
179
+ if (typeof value === 'number') {
180
+ return value
181
+ }
182
+ }
183
+ throw new Error(`expected numeric cell value, got ${JSON.stringify(cell)}`)
184
+ }
185
+
170
186
  const sheet = workbook.getSheetId('Sheet1')
171
187
  if (sheet === undefined) {
172
188
  throw new Error('Sheet1 was not created')
@@ -178,11 +194,15 @@ const at = (row: number, col: number): WorkPaperCellAddress => ({
178
194
  col,
179
195
  })
180
196
 
181
- console.log(workbook.getCellValue(at(0, 2))) // CellValue for 30
197
+ const initial = numberValue(workbook.getCellValue(at(0, 2)))
198
+ if (initial !== 30) {
199
+ throw new Error(`unexpected initial formula value: ${String(initial)}`)
200
+ }
182
201
 
183
202
  workbook.setCellContents(at(1, 2), '=A2+B2')
184
- console.log(workbook.getCellFormula(at(1, 2))) // "=A2+B2"
185
- console.log(workbook.getCellSerialized(at(1, 2))) // "=A2+B2"
203
+ if (workbook.getCellFormula(at(1, 2)) !== '=A2+B2') {
204
+ throw new Error('formula text was not recorded')
205
+ }
186
206
 
187
207
  const document = exportWorkPaperDocument(workbook)
188
208
  const json = serializeWorkPaperDocument(document)
@@ -192,7 +212,13 @@ if (restoredSheet === undefined) {
192
212
  throw new Error('Sheet1 was not restored')
193
213
  }
194
214
 
195
- console.log(restored.getCellValue({ sheet: restoredSheet, row: 1, col: 2 }))
215
+ const restoredValue = numberValue(restored.getCellValue({ sheet: restoredSheet, row: 1, col: 2 }))
216
+ const verified = restoredValue === 28 && restored.getSheetNames().includes('Sheet1')
217
+ if (!verified) {
218
+ throw new Error(`unexpected restored formula value: ${String(restoredValue)}`)
219
+ }
220
+
221
+ console.log({ initial, restoredValue, bytes: json.length, verified })
196
222
  ```
197
223
 
198
224
  ## Runnable Example
package/package.json CHANGED
@@ -1,11 +1,15 @@
1
1
  {
2
2
  "name": "@bilig/headless",
3
- "version": "0.10.14",
3
+ "version": "0.10.16",
4
4
  "description": "Headless spreadsheet engine and WorkPaper workbook facade for Node services, coding agents, and HyperFormula-style workflows.",
5
5
  "keywords": [
6
6
  "agent",
7
+ "agents",
8
+ "ai-agents",
7
9
  "automation",
8
10
  "bilig",
11
+ "coding-agents",
12
+ "excel-automation",
9
13
  "formula",
10
14
  "formula-engine",
11
15
  "headless",
@@ -13,9 +17,14 @@
13
17
  "hyperformula",
14
18
  "local-first",
15
19
  "node",
20
+ "nodejs",
16
21
  "spreadsheet",
22
+ "spreadsheet-automation",
17
23
  "spreadsheet-engine",
18
- "workbook"
24
+ "workbook",
25
+ "workbook-api",
26
+ "workbook-engine",
27
+ "workpaper"
19
28
  ],
20
29
  "homepage": "https://proompteng.github.io/bilig/",
21
30
  "bugs": {
@@ -49,9 +58,9 @@
49
58
  "build": "rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
50
59
  },
51
60
  "dependencies": {
52
- "@bilig/core": "0.10.14",
53
- "@bilig/formula": "0.10.14",
54
- "@bilig/protocol": "0.10.14"
61
+ "@bilig/core": "0.10.16",
62
+ "@bilig/formula": "0.10.16",
63
+ "@bilig/protocol": "0.10.16"
55
64
  },
56
65
  "engines": {
57
66
  "node": ">=24.0.0"