@bilig/workpaper 0.38.2 → 0.39.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.
Files changed (4) hide show
  1. package/AGENTS.md +58 -0
  2. package/README.md +83 -2
  3. package/SKILL.md +166 -0
  4. package/package.json +5 -3
package/AGENTS.md ADDED
@@ -0,0 +1,58 @@
1
+ # Bilig Agent Instructions
2
+
3
+ Use this file when an AI coding agent, MCP client, or tool host needs workbook formulas without opening Excel, LibreOffice, Google Sheets, or a screenshot grid.
4
+
5
+ ## Discovery Order
6
+
7
+ 1. Read `https://proompteng.github.io/bilig/llms.txt` for the compact map.
8
+ 2. Read `https://proompteng.github.io/bilig/llms-full.txt` when you need enough context to implement a workflow without searching the whole site.
9
+ 3. Read `https://proompteng.github.io/bilig/skill.txt` when your agent supports skill manifests.
10
+ 4. Start the MCP server or import `@bilig/workpaper` directly.
11
+
12
+ Remote MCP clients that support Streamable HTTP can smoke-test the stateless
13
+ demo endpoint at `https://bilig.proompteng.ai/mcp`. Directory scanners that inspect the
14
+ hosted endpoint origin can read the same-origin server card at
15
+ `https://bilig.proompteng.ai/.well-known/mcp/server-card.json`. Local agents that need writable project files should
16
+ still prefer the file-backed stdio command below.
17
+
18
+ ## Default Decision
19
+
20
+ Use Bilig when the task is workbook-shaped business logic: pricing, budget checks, payout models, import validation, forecasts, agent tools, or route handlers that need formula readback.
21
+
22
+ Do not start with UI automation when the workbook can be represented as WorkPaper state. Screenshots are useful for human review; they are not formula truth.
23
+
24
+ ## Required Proof
25
+
26
+ Before reporting success, return a compact proof object with:
27
+
28
+ - `editedCell`
29
+ - `before`
30
+ - `after`
31
+ - `afterRestore`
32
+ - `persistedDocumentBytes`
33
+ - `verified`
34
+ - `limitations`
35
+
36
+ Do not claim success from a write call alone. The proof is computed readback plus persisted state.
37
+
38
+ ## Fast Commands
39
+
40
+ ```sh
41
+ npm exec --package @bilig/workpaper@0.39.0 -- bilig-agent-challenge
42
+ npm exec --package @bilig/workpaper@0.39.0 -- bilig-mcp-challenge
43
+ npm exec --package @bilig/workpaper@0.39.0 -- bilig-workpaper-mcp --workpaper ./pricing.workpaper.json --init-demo-workpaper --writable
44
+ npm exec --package @bilig/workpaper@0.39.0 -- bilig-formula-clinic ./reduced.xlsx --cells "Summary!B7,Inputs!B2"
45
+ ```
46
+
47
+ Claude Desktop users can install the released MCPB bundle from:
48
+
49
+ - https://github.com/proompteng/bilig/releases/download/libraries-v0.39.0/bilig-workpaper.mcpb
50
+ - https://github.com/proompteng/bilig/releases/download/libraries-v0.39.0/bilig-workpaper.mcpb.sha256
51
+
52
+ ## Direct TypeScript
53
+
54
+ Use `WorkPaper.buildFromSheets()` for hand-authored models, `setCellContents()` for edits, `getCellDisplayValue()` for readback, and `exportWorkPaperDocument()` plus `serializeWorkPaperDocument()` for persistence proof.
55
+
56
+ ## Boundaries
57
+
58
+ Keep Excel, LibreOffice, Microsoft Graph, or an oracle harness in the loop when the workbook depends on macros, pivots, charts, external links, unsupported functions, locale-specific Excel behavior, or exact desktop UI behavior.
package/README.md CHANGED
@@ -2,16 +2,97 @@
2
2
 
3
3
  Scoped Bilig WorkPaper runtime for Node.js services, agent tools, and server-side spreadsheet formulas.
4
4
 
5
+ Use this when business logic is easiest to review as workbook cells and
6
+ formulas, but the calculation needs to run in a backend service, queue worker,
7
+ serverless route, test, or coding-agent tool.
8
+
9
+ `@bilig/workpaper` is the canonical scoped npm entrypoint. The unscoped
10
+ `bilig-workpaper` package remains published as a compatibility and search alias.
11
+
12
+ ## Install
13
+
5
14
  ```sh
6
15
  npm install @bilig/workpaper
7
16
  ```
8
17
 
18
+ ## Use A WorkPaper In Node
19
+
20
+ ```ts
21
+ import { WorkPaper } from '@bilig/workpaper'
22
+
23
+ const workbook = WorkPaper.buildFromSheets({
24
+ Inputs: [
25
+ ['Metric', 'Value'],
26
+ ['Units', 40],
27
+ ['Price', 1200],
28
+ ],
29
+ Summary: [
30
+ ['Metric', 'Value'],
31
+ ['Revenue', '=Inputs!B2*Inputs!B3'],
32
+ ],
33
+ })
34
+
35
+ const inputs = workbook.getSheetId('Inputs')
36
+ const summary = workbook.getSheetId('Summary')
37
+
38
+ if (inputs === undefined || summary === undefined) {
39
+ throw new Error('Expected sheets to exist')
40
+ }
41
+
42
+ workbook.setCellContents({ sheet: inputs, row: 1, col: 1 }, 48)
43
+ workbook.setCellContents({ sheet: inputs, row: 2, col: 1 }, 1500)
44
+
45
+ console.log(workbook.getCellValue({ sheet: summary, row: 1, col: 1 }))
46
+ console.log(workbook.exportSnapshot())
47
+
48
+ workbook.dispose()
49
+ ```
50
+
51
+ ## Prove The Agent Loop Without Cloning
52
+
53
+ The package ships proof commands for coding agents and service evaluators:
54
+
55
+ ```sh
56
+ npm exec --package @bilig/workpaper -- bilig-agent-challenge
57
+ npm exec --package @bilig/workpaper -- bilig-mcp-challenge
58
+ npm exec --package @bilig/workpaper -- bilig-workpaper-mcp --workpaper ./pricing.workpaper.json --init-demo-workpaper --writable
59
+ ```
60
+
61
+ The challenge commands edit one input, recalculate dependent formulas, export
62
+ WorkPaper JSON, restore it, and print a `verified: true` proof object.
63
+
64
+ ## XLSX Import And Export
65
+
9
66
  ```ts
10
67
  import { WorkPaper } from '@bilig/workpaper'
11
68
  import { exportXlsx, importXlsx } from '@bilig/workpaper/xlsx'
12
69
  ```
13
70
 
14
- `@bilig/workpaper` is the canonical scoped package. The unscoped
15
- `bilig-workpaper` package remains published as a compatibility and search alias.
71
+ Use `@bilig/xlsx-formula-recalc` when you only need to edit and recalculate
72
+ XLSX files. Use `@bilig/exceljs-formula-recalc` when you already use ExcelJS
73
+ and need recalculated formula results after changing inputs.
74
+
75
+ ## Agent Commands And Optional MCP
76
+
77
+ The npm tarball exposes the same CLI entrypoints as `@bilig/headless`, so agents
78
+ can install one focused package and still get the MCP stdio server:
79
+
80
+ ```ts
81
+ import { createWorkPaperMcpServer } from '@bilig/workpaper/mcp'
82
+ ```
83
+
84
+ For a runnable starter project with `AGENTS.md`, MCP client config, and an
85
+ `agent:verify` script:
86
+
87
+ ```sh
88
+ npm create @bilig/workpaper@latest pricing-agent -- --agent
89
+ ```
90
+
91
+ ## Scope
92
+
93
+ Bilig is not a desktop Excel clone. It is a formula workbook runtime for
94
+ service-owned calculations, JSON persistence, XLSX import/export, and
95
+ agent-readable readback. Unsupported Excel functions, external workbook links,
96
+ macros, and volatile functions may need review.
16
97
 
17
98
  Full docs: <https://proompteng.github.io/bilig/>
package/SKILL.md ADDED
@@ -0,0 +1,166 @@
1
+ ---
2
+ name: bilig-workpaper
3
+ version: 0.1.0
4
+ description: Use @bilig/workpaper WorkPaper state for workbook formulas, agent spreadsheet tools, MCP file-backed or remote demo editing, and XLSX formula bug reports without driving spreadsheet UI.
5
+ tags:
6
+ - ai-agents
7
+ - spreadsheet-automation
8
+ - formulas
9
+ - xlsx
10
+ - mcp
11
+ - typescript
12
+ ---
13
+
14
+ # Bilig WorkPaper Agent Skill
15
+
16
+ Use this skill when an agent needs spreadsheet-style formulas but the work should run through files, terminal commands, TypeScript, HTTP routes, or MCP tools instead of Excel UI automation.
17
+
18
+ ## When To Trigger
19
+
20
+ Trigger this skill for tasks involving:
21
+
22
+ - workbook-shaped business logic in Node.js services;
23
+ - formula readback after writing cells;
24
+ - quote, budget, payout, pricing, import-validation, or forecast models;
25
+ - agent spreadsheet tools that need deterministic cell addresses;
26
+ - MCP clients that can run a stdio server or call a Streamable HTTP endpoint;
27
+ - reduced XLSX formula bugs that need a paste-ready report.
28
+
29
+ Do not trigger it for manual spreadsheet editing, Office macros, VBA, pivots, charts, COM automation, or exact Excel desktop behavior unless the user explicitly asks to compare Bilig against an Excel oracle.
30
+
31
+ ## Command Safety
32
+
33
+ Do not build shell commands by concatenating user text. Treat the commands below as literal templates, validate workbook paths before use, and reject values containing newlines, backticks, `$(`, `;`, `&`, `|`, `<`, or `>`. Prefer MCP client `command` plus `args` arrays or direct TypeScript calls when inserting user-provided paths or cell references.
34
+
35
+ ## First Choice: MCP
36
+
37
+ Use MCP when the host can run a stdio server or call a Streamable HTTP server.
38
+ Configure stdio as an argument array, not a shell-concatenated string:
39
+
40
+ Before wiring a client, an agent can prove the direct WorkPaper loop with:
41
+
42
+ ```json
43
+ {
44
+ "command": "npm",
45
+ "args": ["exec", "--package", "@bilig/workpaper@0.39.0", "--", "bilig-agent-challenge"]
46
+ }
47
+ ```
48
+
49
+ For the actual file-backed MCP path, run the package-owned challenge first:
50
+
51
+ ```json
52
+ {
53
+ "command": "npm",
54
+ "args": ["exec", "--package", "@bilig/workpaper@0.39.0", "--", "bilig-mcp-challenge"]
55
+ }
56
+ ```
57
+
58
+ ```json
59
+ {
60
+ "command": "npm",
61
+ "args": [
62
+ "exec",
63
+ "--package",
64
+ "@bilig/workpaper@0.39.0",
65
+ "--",
66
+ "bilig-workpaper-mcp",
67
+ "--workpaper",
68
+ "./pricing.workpaper.json",
69
+ "--init-demo-workpaper",
70
+ "--writable"
71
+ ]
72
+ }
73
+ ```
74
+
75
+ The useful file-backed tools are:
76
+
77
+ - `list_sheets`
78
+ - `read_range`
79
+ - `read_cell`
80
+ - `set_cell_contents`
81
+ - `get_cell_display_value`
82
+ - `export_workpaper_document`
83
+ - `validate_formula`
84
+
85
+ After a write, always read the dependent output cell and export the WorkPaper document.
86
+
87
+ For remote MCP clients, use the stateless demo endpoint when the client supports
88
+ Streamable HTTP:
89
+
90
+ ```text
91
+ https://bilig.proompteng.ai/mcp
92
+ https://bilig.proompteng.ai/mcp/workpaper
93
+ ```
94
+
95
+ The remote endpoint is request-local and does not write user files. Use it for
96
+ connector smoke tests, tool discovery, and agent onboarding; use the file-backed
97
+ stdio command when the workflow must persist a project WorkPaper JSON file.
98
+
99
+ ## Second Choice: Direct TypeScript
100
+
101
+ Use `@bilig/workpaper` directly when workbook logic belongs in a service, queue worker, test, or route:
102
+
103
+ ```ts
104
+ import { WorkPaper, exportWorkPaperDocument, serializeWorkPaperDocument } from '@bilig/workpaper'
105
+
106
+ const workbook = WorkPaper.buildFromSheets({
107
+ Inputs: [
108
+ ['Metric', 'Value'],
109
+ ['Customers', 20],
110
+ ['Average revenue', 1200],
111
+ ],
112
+ Summary: [
113
+ ['Metric', 'Value'],
114
+ ['Revenue', '=Inputs!B2*Inputs!B3'],
115
+ ],
116
+ })
117
+
118
+ const inputs = workbook.getSheetId('Inputs')
119
+ const summary = workbook.getSheetId('Summary')
120
+ if (inputs === undefined || summary === undefined) {
121
+ throw new Error('Workbook is missing required sheets')
122
+ }
123
+
124
+ workbook.setCellContents({ sheet: inputs, row: 1, col: 1 }, 32)
125
+ const revenue = workbook.getCellDisplayValue({ sheet: summary, row: 1, col: 1 })
126
+ const saved = serializeWorkPaperDocument(exportWorkPaperDocument(workbook, { includeConfig: true }))
127
+
128
+ console.log({ revenue, savedBytes: saved.length })
129
+ ```
130
+
131
+ ## XLSX Formula Clinic
132
+
133
+ When the user has a reduced XLSX formula/import bug, generate a local report through an argument array:
134
+
135
+ ```json
136
+ {
137
+ "command": "npm",
138
+ "args": ["exec", "--package", "@bilig/workpaper@0.39.0", "--", "bilig-formula-clinic", "./reduced.xlsx", "--cells", "Summary!B7,Inputs!B2"]
139
+ }
140
+ ```
141
+
142
+ The report is local. It does not upload workbook contents. Ask for a reduced public fixture rather than private customer spreadsheets.
143
+
144
+ ## Required Verification
145
+
146
+ Return proof, not vibes. A successful agent response should include:
147
+
148
+ - the exact edited sheet and A1 cell;
149
+ - before values for relevant inputs and dependent outputs;
150
+ - after values read from the recalculated workbook;
151
+ - persistence evidence from serialized or exported WorkPaper state;
152
+ - restore or reimport proof when file boundaries matter;
153
+ - limitations for unsupported formulas or Excel-only features.
154
+
155
+ If any proof step fails, report the blocker instead of claiming the workbook was updated.
156
+
157
+ ## Reference URLs
158
+
159
+ - Compact docs map: https://proompteng.github.io/bilig/llms.txt
160
+ - Full agent context: https://proompteng.github.io/bilig/llms-full.txt
161
+ - Agent handbook: https://proompteng.github.io/bilig/headless-workpaper-agent-handbook.html
162
+ - Agent workbook challenge: https://proompteng.github.io/bilig/agent-workbook-challenge.html
163
+ - MCP server guide: https://proompteng.github.io/bilig/mcp-workpaper-tool-server.html
164
+ - XLSX formula clinic: https://proompteng.github.io/bilig/formula-bug-clinic.html
165
+ - Compatibility limits: https://proompteng.github.io/bilig/where-bilig-is-not-excel-compatible-yet.html
166
+ - Repository: https://github.com/proompteng/bilig
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@bilig/workpaper",
3
- "version": "0.38.2",
3
+ "version": "0.39.0",
4
4
  "description": "Scoped Bilig WorkPaper runtime for Node.js services, agent tools, and server-side spreadsheet formulas.",
5
5
  "keywords": [
6
6
  "agent-tools",
@@ -40,6 +40,8 @@
40
40
  },
41
41
  "files": [
42
42
  "dist",
43
+ "AGENTS.md",
44
+ "SKILL.md",
43
45
  "README.md",
44
46
  "LICENSE"
45
47
  ],
@@ -68,8 +70,8 @@
68
70
  "build": "pnpm --dir ../.. --filter bilig-workpaper build && rm -rf dist tsconfig.tsbuildinfo && tsc -p tsconfig.json"
69
71
  },
70
72
  "dependencies": {
71
- "@bilig/headless": "0.38.2",
72
- "bilig-workpaper": "0.38.2"
73
+ "@bilig/headless": "0.39.0",
74
+ "bilig-workpaper": "0.39.0"
73
75
  },
74
76
  "engines": {
75
77
  "node": ">=22.0.0"