dsh-office-kit 0.4.1 → 0.4.3
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/assets/skills/excel-live-control/SKILL.md +120 -148
- package/assets/skills/excel-live-control/container_tools/live_excel.py +9 -0
- package/assets/skills/excel-live-control/domain_guidance/financial_models.md +42 -58
- package/assets/skills/excel-live-control/domain_guidance/healthcare.md +36 -42
- package/assets/skills/excel-live-control/domain_guidance/marketing_advertising.md +33 -34
- package/assets/skills/excel-live-control/domain_guidance/scientific_research.md +34 -36
- package/assets/skills/excel-live-control/references/office-automation.md +127 -153
- package/assets/skills/excel-live-control/references/read_only_qna.md +40 -45
- package/assets/skills/excel-live-control/style_guidelines.md +56 -64
- package/assets/skills/excel-live-control/workflows/create_workflows.md +40 -47
- package/assets/skills/excel-live-control/workflows/edit_workflows.md +37 -45
- package/assets/skills/office-documents/SKILL.md +24 -60
- package/assets/skills/office-documents/examples/end_to_end_smoke_test.md +5 -5
- package/assets/skills/office-documents/ooxml/comments.md +8 -8
- package/assets/skills/office-documents/ooxml/hyperlinks_and_fields.md +10 -10
- package/assets/skills/office-documents/ooxml/rels_and_content_types.md +7 -7
- package/assets/skills/office-documents/ooxml/tracked_changes.md +12 -12
- package/assets/skills/office-documents/references/docx-structure.md +11 -13
- package/assets/skills/office-documents/references/template-elicitation.md +11 -13
- package/assets/skills/office-documents/references/writing-quality.md +20 -20
- package/assets/skills/office-documents/tasks/accessibility_a11y.md +16 -22
- package/assets/skills/office-documents/tasks/captions_crossrefs.md +23 -26
- package/assets/skills/office-documents/tasks/clean_tracked_changes.md +17 -22
- package/assets/skills/office-documents/tasks/comments_manage.md +9 -11
- package/assets/skills/office-documents/tasks/compare_diff.md +10 -16
- package/assets/skills/office-documents/tasks/create_edit.md +14 -16
- package/assets/skills/office-documents/tasks/equations.md +17 -28
- package/assets/skills/office-documents/tasks/fields_update.md +14 -16
- package/assets/skills/office-documents/tasks/fixtures_edge_cases.md +19 -33
- package/assets/skills/office-documents/tasks/footnotes_endnotes.md +12 -14
- package/assets/skills/office-documents/tasks/forms_content_controls.md +16 -20
- package/assets/skills/office-documents/tasks/headings_numbering.md +17 -22
- package/assets/skills/office-documents/tasks/images_figures.md +15 -25
- package/assets/skills/office-documents/tasks/multi_doc_merge.md +13 -23
- package/assets/skills/office-documents/tasks/navigation_internal_links.md +18 -21
- package/assets/skills/office-documents/tasks/privacy_scrub_metadata.md +16 -22
- package/assets/skills/office-documents/tasks/protection_restrict_editing.md +19 -21
- package/assets/skills/office-documents/tasks/read_review.md +9 -20
- package/assets/skills/office-documents/tasks/redaction_anonymization.md +17 -18
- package/assets/skills/office-documents/tasks/sections_layout.md +16 -23
- package/assets/skills/office-documents/tasks/style_lint_normalize.md +18 -22
- package/assets/skills/office-documents/tasks/tables_spreadsheets.md +21 -31
- package/assets/skills/office-documents/tasks/templates_style_packs.md +17 -21
- package/assets/skills/office-documents/tasks/toc_workflow.md +10 -14
- package/assets/skills/office-documents/tasks/verify_render.md +11 -23
- package/assets/skills/office-documents/tasks/watermarks_background.md +11 -15
- package/assets/skills/office-documents/troubleshooting/libreoffice_headless.md +9 -9
- package/assets/skills/office-documents/troubleshooting/run_splitting.md +12 -12
- package/assets/skills/office-pdf/SKILL.md +36 -51
- package/assets/skills/office-pdf/references/form-fields.md +20 -20
- package/assets/skills/office-pdf/references/geometry.md +10 -10
- package/assets/skills/office-pdf/references/layout-quality.md +13 -13
- package/assets/skills/office-pdf/references/limits.md +12 -56
- package/assets/skills/office-pdf/tasks/annotations.md +5 -5
- package/assets/skills/office-pdf/tasks/create.md +6 -9
- package/assets/skills/office-pdf/tasks/edit-pages.md +14 -14
- package/assets/skills/office-pdf/tasks/forms.md +15 -15
- package/assets/skills/office-pdf/tasks/read.md +9 -9
- package/assets/skills/office-pdf/tasks/redact.md +18 -18
- package/assets/skills/office-pdf/tasks/stamp.md +10 -10
- package/assets/skills/office-presentations/SKILL.md +71 -91
- package/assets/skills/office-presentations/container_tools/render_slides.py +1 -1
- package/assets/skills/office-presentations/domain_guidance/finance.md +16 -16
- package/assets/skills/office-presentations/recipes/README.md +24 -35
- package/assets/skills/office-presentations/recipes/autolayout.md +12 -13
- package/assets/skills/office-presentations/recipes/connectors.md +11 -12
- package/assets/skills/office-presentations/recipes/images.md +11 -12
- package/assets/skills/office-presentations/recipes/master-and-layouts.md +18 -18
- package/assets/skills/office-presentations/recipes/native-charts.md +8 -8
- package/assets/skills/office-presentations/recipes/rich-text-runs.md +13 -13
- package/assets/skills/office-presentations/recipes/speaker-notes.md +7 -7
- package/assets/skills/office-presentations/recipes/tables.md +14 -14
- package/assets/skills/office-presentations/recipes/textbox-at-coordinate.md +9 -9
- package/assets/skills/office-presentations/recipes/theme-tokens.md +7 -8
- package/assets/skills/office-presentations/references/authoring-workflow.md +38 -43
- package/assets/skills/office-presentations/references/finalization.md +10 -12
- package/assets/skills/office-presentations/references/native-bullets.md +14 -18
- package/assets/skills/office-presentations/references/native-evidence.md +18 -32
- package/assets/skills/office-presentations/references/style-guidelines.md +27 -32
- package/assets/skills/office-presentations/references/templates.md +31 -60
- package/assets/skills/office-presentations/routing/google_slides.md +4 -4
- package/assets/skills/office-presentations/tasks/apply-annotations.md +17 -17
- package/assets/skills/office-presentations/tasks/charts-tables-notes.md +20 -23
- package/assets/skills/office-presentations/tasks/create-deck.md +19 -19
- package/assets/skills/office-presentations/tasks/edit-deck.md +14 -16
- package/assets/skills/office-presentations/tasks/inspect-and-verify.md +31 -34
- package/assets/skills/office-presentations/tasks/template-following.md +23 -28
- package/assets/skills/office-spreadsheets/SKILL.md +32 -39
- package/assets/skills/office-spreadsheets/recipes/charts.md +8 -26
- package/assets/skills/office-spreadsheets/recipes/conditional-formats.md +9 -26
- package/assets/skills/office-spreadsheets/recipes/data-tables.md +7 -23
- package/assets/skills/office-spreadsheets/recipes/named-ranges.md +8 -21
- package/assets/skills/office-spreadsheets/recipes/number-formats.md +7 -23
- package/assets/skills/office-spreadsheets/recipes/sparklines.md +7 -20
- package/assets/skills/office-spreadsheets/references/charts.md +15 -34
- package/assets/skills/office-spreadsheets/references/domain/financial-models.md +10 -25
- package/assets/skills/office-spreadsheets/references/domain/healthcare.md +8 -19
- package/assets/skills/office-spreadsheets/references/domain/marketing.md +8 -22
- package/assets/skills/office-spreadsheets/references/domain/research.md +8 -19
- package/assets/skills/office-spreadsheets/references/formula-patterns.md +20 -50
- package/assets/skills/office-spreadsheets/references/style-guidelines.md +19 -44
- package/assets/skills/office-spreadsheets/references/workbook-structure.md +12 -35
- package/assets/skills/office-spreadsheets/routing/google-sheets.md +11 -26
- package/assets/skills/office-spreadsheets/tasks/analyze-workbook.md +10 -25
- package/assets/skills/office-spreadsheets/tasks/annotations.md +12 -30
- package/assets/skills/office-spreadsheets/tasks/create-workbook.md +5 -5
- package/assets/skills/office-spreadsheets/tasks/diff-workbooks.md +2 -2
- package/assets/skills/office-spreadsheets/tasks/edit-workbook.md +5 -5
- package/assets/skills/office-spreadsheets/tasks/inspect-workbook.md +9 -9
- package/assets/skills/office-spreadsheets/tasks/recalc-and-check.md +10 -30
- package/assets/skills/shared/annotation-recipes.md +98 -120
- package/assets/skills/shared/common-workflow.md +70 -80
- package/dist/index.js +105 -29
- package/package.json +1 -1
- package/postinstall.mjs +58 -17
- package/python/office_cli.py +70 -7
|
@@ -1,87 +1,79 @@
|
|
|
1
1
|
# Style guidelines for a live sheet
|
|
2
2
|
|
|
3
|
-
Style is subordinate to content and
|
|
3
|
+
Style is subordinate to content and the user's file. Precedence, strongest first:
|
|
4
4
|
|
|
5
|
-
1. What the user asked for
|
|
5
|
+
1. What the user asked for in this conversation.
|
|
6
6
|
2. The workbook's existing conventions — fonts, colours, borders, tab colours, number
|
|
7
7
|
formats. Match them; do not impose a house style on someone else's document.
|
|
8
|
-
3. The domain guidance for the
|
|
8
|
+
3. The domain guidance for the model (`domain_guidance/`).
|
|
9
9
|
4. The defaults below.
|
|
10
10
|
|
|
11
|
-
Look before you paint: `info` for tab colours and structure, `read_range` for
|
|
12
|
-
|
|
13
|
-
tidier is a defect, not a service.
|
|
11
|
+
Look before you paint: `info` for tab colours and structure, `read_range` for neighbouring
|
|
12
|
+
formats. Restyling because your defaults are tidier is a defect, not a service.
|
|
14
13
|
|
|
15
14
|
## Defaults that are safe anywhere
|
|
16
15
|
|
|
17
|
-
- **Font
|
|
18
|
-
Aptos.
|
|
19
|
-
|
|
16
|
+
- **Font**: one family per workbook. If it has none, Helvetica Neue → Helvetica → Arial →
|
|
17
|
+
Aptos. Two sizes: 10 pt body, 14 pt title, 16 pt ceiling. Never a third family or a
|
|
18
|
+
decorative size.
|
|
20
19
|
- **Alignment**: text left, numbers right, headers centred horizontally and middle
|
|
21
|
-
vertically.
|
|
20
|
+
vertically. Never centre numbers — they lose decimal alignment.
|
|
22
21
|
- **Headers**: bold, one rule under the last header row (`border: "outline"` on the header
|
|
23
|
-
block, or a bottom border on the row). No merged cells in working headers
|
|
24
|
-
single spanning title,
|
|
25
|
-
- **Inputs vs calculations**:
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
- **Gridlines**: a clean output or dashboard
|
|
29
|
-
= $false`, a view setting, not a cell format) and uses
|
|
30
|
-
|
|
22
|
+
block, or a bottom border on the row). No merged cells in working headers; merge only a
|
|
23
|
+
single spanning title, preferring Center Across Selection.
|
|
24
|
+
- **Inputs vs calculations**: cells the user types into get a light fill (`#FFF2CC` amber)
|
|
25
|
+
and thin border; calculated cells stay plain. If the whole block is inputs, one header
|
|
26
|
+
note beats painting every cell.
|
|
27
|
+
- **Gridlines**: a clean output or dashboard hides them
|
|
28
|
+
(`ActiveWindow.DisplayGridlines = $false`, a view setting, not a cell format) and uses
|
|
29
|
+
thin structural borders; a working sheet keeps them.
|
|
31
30
|
- **Borders**: outline a block, hairline between header and body. No box around every cell,
|
|
32
|
-
no double
|
|
33
|
-
- **Column widths**:
|
|
34
|
-
|
|
35
|
-
- **Conditional formatting**: bounded to the data range, one or two rules
|
|
36
|
-
column, never
|
|
37
|
-
- **Freeze panes** are not
|
|
38
|
-
|
|
31
|
+
no double or thick decorative frames.
|
|
32
|
+
- **Column widths**: once per block (`column_width` in `style_range`), not per cell; widen
|
|
33
|
+
for the formatted value, then check `###` with `read_range --display`.
|
|
34
|
+
- **Conditional formatting**: bounded to the data range, one or two rules; never a whole
|
|
35
|
+
column, never paint a user input cell.
|
|
36
|
+
- **Freeze panes** are a view setting, not styling. The tool cannot set them on a hidden
|
|
37
|
+
window; if scrolling is the complaint, say so and let the user freeze the row.
|
|
39
38
|
|
|
40
39
|
## Model layouts
|
|
41
40
|
|
|
42
|
-
- Summary above detail, outputs before workings, assumptions grouped in one block
|
|
43
|
-
|
|
44
|
-
-
|
|
45
|
-
|
|
46
|
-
-
|
|
47
|
-
|
|
48
|
-
- Helper rows: italic, grouped under
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
-
|
|
54
|
-
section, not per row.
|
|
55
|
-
- Dark header fill with white text, or plain text with a rule. Pick one per workbook.
|
|
41
|
+
- Summary above detail, outputs before workings, assumptions grouped in one block. The
|
|
42
|
+
top-left should explain the sheet.
|
|
43
|
+
- New output sheet: one blank row at the top, title in an unfilled left cell, thin rule
|
|
44
|
+
under it. No logo, merged banner or slogan.
|
|
45
|
+
- Commentary goes right of the numbers, separated by one blank column; never between a
|
|
46
|
+
label and its value.
|
|
47
|
+
- Helper rows: italic, grouped under their block, collapsed if the workbook already groups.
|
|
48
|
+
Helper columns outside the print range or on a separate helper sheet.
|
|
49
|
+
- Scenario selector: a visible label plus a validated cell (`Case Selected:` and the value);
|
|
50
|
+
never hidden in a defined name.
|
|
51
|
+
- Section bands: one outline around the whole section, not per row.
|
|
52
|
+
- Dark header fill with white text, or plain with a rule — one per workbook.
|
|
56
53
|
|
|
57
54
|
## Finance conventions
|
|
58
55
|
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
- **
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
- **
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
- **
|
|
70
|
-
|
|
71
|
-
- **
|
|
72
|
-
|
|
73
|
-
-
|
|
74
|
-
|
|
75
|
-
- **Actuals vs forecast**: the change of basis is visible — a divide, a different fill, or
|
|
76
|
-
a label — and never inferred from a colour alone.
|
|
77
|
-
- A model that needs a gutter between the row labels and the numbers gets columns A:B
|
|
78
|
-
reserved for it. Do not retrofit a gutter onto a sheet that does not have one.
|
|
56
|
+
- **Colour = provenance**: blue font for hard-coded inputs, black for same-sheet formulas,
|
|
57
|
+
green for links to another sheet, red for links to an external workbook. Output views
|
|
58
|
+
stay black or brand dark.
|
|
59
|
+
- **Number formats**: `#,##0` amounts, `#,##0.00` per-share/price, `0.0%` rates,
|
|
60
|
+
`#,##0;(#,##0);"-"` for accounting (parentheses for negatives, dash for zero). Currency
|
|
61
|
+
symbol on the first monetary row and on totals, not every row.
|
|
62
|
+
- **Indent formats** (` @` for text labels, `_(`-style spacing) map hierarchy without empty
|
|
63
|
+
columns.
|
|
64
|
+
- **Totals** flush left in the label column, bold, rule above. A hard-number total instead
|
|
65
|
+
of a formula is a finding.
|
|
66
|
+
- **Period labels** follow `mmm-yy`, `d-mmm`, `yyyy`, `Q#:YY`, `FY:YY` as the workbook does;
|
|
67
|
+
one date format down a column.
|
|
68
|
+
- **Actuals vs forecast**: a visible change of basis (divide, fill, label), never colour
|
|
69
|
+
alone.
|
|
70
|
+
- A needed gutter between row labels and numbers gets columns A:B reserved; do not retrofit
|
|
71
|
+
one onto a sheet that lacks it.
|
|
79
72
|
|
|
80
73
|
## Warning colour, used sparingly
|
|
81
74
|
|
|
82
75
|
- Input that must be refreshed: amber fill (`#FFF2CC`), normal font.
|
|
83
|
-
- Critical error or failed check: light red fill (`#FFC7CE`) plus bold red text
|
|
84
|
-
|
|
85
|
-
-
|
|
86
|
-
-
|
|
87
|
-
vision deficiency, must still see the meaning. Put the flag in a cell.
|
|
76
|
+
- Critical error or failed check: light red fill (`#FFC7CE`) plus bold red text (`#9C0006`).
|
|
77
|
+
- Passing checks: neutral. A green wash over every PASS hides the one red row.
|
|
78
|
+
- Never encode meaning in colour alone; put the flag in a cell so a monochrome printout or
|
|
79
|
+
colour-vision deficiency still reads it.
|
|
@@ -1,44 +1,39 @@
|
|
|
1
1
|
# Creating content in a live workbook
|
|
2
2
|
|
|
3
|
-
The user
|
|
4
|
-
make a small number of writes.
|
|
3
|
+
The user sees every step. Plan on paper first, then write in a few batches.
|
|
5
4
|
|
|
6
|
-
## 1. Decide what is
|
|
5
|
+
## 1. Decide what is being created
|
|
7
6
|
|
|
8
|
-
|
|
7
|
+
Answer these before writing a cell:
|
|
9
8
|
|
|
10
|
-
- **Who reads it, and what decision does it support?** A
|
|
11
|
-
|
|
12
|
-
- **What are the outputs?** Name
|
|
13
|
-
|
|
14
|
-
- **What are the inputs?** Name them, with their sources. Inputs nobody will update are
|
|
9
|
+
- **Who reads it, and what decision does it support?** A committee summary and an analyst's
|
|
10
|
+
working model are different sheets.
|
|
11
|
+
- **What are the outputs?** Name each one: a number with a label, a period and a unit.
|
|
12
|
+
- **What are the inputs?** Name them with their sources. Inputs nobody updates are
|
|
15
13
|
decoration.
|
|
16
|
-
- **What is calculated in between?**
|
|
17
|
-
|
|
18
|
-
- **What would make it wrong?**
|
|
19
|
-
|
|
14
|
+
- **What is calculated in between?** A reviewer audits these steps; if you cannot name them,
|
|
15
|
+
the model is not designed yet.
|
|
16
|
+
- **What would make it wrong?** At least one check: totals tie, parts sum to the whole, cash
|
|
17
|
+
ends at the right balance.
|
|
20
18
|
|
|
21
|
-
If
|
|
22
|
-
a live edit is expensive to unpick.
|
|
19
|
+
If two are still open, ask one short question — a live edit is expensive to unpick.
|
|
23
20
|
|
|
24
21
|
## 2. Where it goes
|
|
25
22
|
|
|
26
|
-
-
|
|
27
|
-
|
|
28
|
-
- Outputs
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
- Keep inputs
|
|
32
|
-
|
|
23
|
+
- Organise by role, not tab count: inputs, assumptions, calculations, outputs. Small sheets
|
|
24
|
+
merge roles; large models separate them.
|
|
25
|
+
- Outputs left of the tab strip, workings middle, inputs right; a check/audit tab last if
|
|
26
|
+
warranted.
|
|
27
|
+
- No separate Checks tab on a simple sheet — a labelled verification row is enough.
|
|
28
|
+
- Keep inputs beside their calculations; use a dedicated input sheet once several sheets
|
|
29
|
+
consume them.
|
|
33
30
|
- Calculate once, link everywhere else. Two cells computing the same number is a future
|
|
34
31
|
disagreement.
|
|
35
|
-
-
|
|
36
|
-
explain, not in a separate "insights" area.
|
|
32
|
+
- Put insights next to the result they explain, never in a separate area.
|
|
37
33
|
|
|
38
|
-
**
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
reopen. Do not repurpose an existing sheet as scratch space.
|
|
34
|
+
**This skill cannot add a tab** — it writes into existing sheets. Ask the user to insert one
|
|
35
|
+
(right-click a tab → Insert), or use the file route in `../../office-spreadsheets/SKILL.md`
|
|
36
|
+
and tell them to reopen. Never repurpose a sheet as scratch space.
|
|
42
37
|
|
|
43
38
|
## 3. Write it
|
|
44
39
|
|
|
@@ -51,28 +46,26 @@ recalc
|
|
|
51
46
|
read_range --sheet "Inputs" --range B3:D9 --formulas
|
|
52
47
|
```
|
|
53
48
|
|
|
54
|
-
- One `write_range` per block
|
|
55
|
-
|
|
56
|
-
- Write
|
|
57
|
-
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
- If the sheet already has content, check the used range first and write beside it, not
|
|
62
|
-
over it.
|
|
49
|
+
- One `write_range` per block, in its real shape (rows × columns). No empty-string padding;
|
|
50
|
+
use `null` for an empty cell.
|
|
51
|
+
- Write labels and units with the numbers. Bare numbers are not done.
|
|
52
|
+
- Apply `number_format` in one `style_range` over the block, not cell by cell.
|
|
53
|
+
- Formulas start with `=`: absolute where fixed (`$C$4`), relative where the fill walks
|
|
54
|
+
(`D5`). Test one cell before filling.
|
|
55
|
+
- If the sheet has content, check the used range and write beside it, not over it.
|
|
63
56
|
|
|
64
57
|
## 4. Check it, then say what you did
|
|
65
58
|
|
|
66
|
-
- `read_range --formulas` over everything
|
|
67
|
-
- `recalc`, then read the outputs
|
|
68
|
-
- `info`
|
|
69
|
-
- Report the ranges and
|
|
70
|
-
|
|
59
|
+
- `read_range --formulas` over everything written; `errors` must be empty.
|
|
60
|
+
- `recalc`, then re-read the outputs — an uncalculated formula proves nothing.
|
|
61
|
+
- `info` after adding tables or charts, to confirm the target sheet.
|
|
62
|
+
- Report the ranges and document state (unsaved, or saved where). See Delivery in
|
|
63
|
+
`../SKILL.md`.
|
|
71
64
|
|
|
72
65
|
## 5. Sizing and layout
|
|
73
66
|
|
|
74
|
-
- Set
|
|
75
|
-
|
|
76
|
-
- Wrap long
|
|
77
|
-
-
|
|
78
|
-
|
|
67
|
+
- Set widths after content, sized to the widest formatted value; check `###` with
|
|
68
|
+
`--display`.
|
|
69
|
+
- Wrap long labels instead of widening a column to half the screen.
|
|
70
|
+
- Give helper calculations their own labelled block or sheet, never a row buried between
|
|
71
|
+
outputs.
|
|
@@ -1,47 +1,41 @@
|
|
|
1
1
|
# Editing a workbook the user already built
|
|
2
2
|
|
|
3
|
-
The existing workbook is the reference.
|
|
4
|
-
navigation
|
|
5
|
-
looks like it was always there.
|
|
3
|
+
The existing workbook is the reference. Keep its structure, formula style, formats, labels
|
|
4
|
+
and navigation; make one change that looks native.
|
|
6
5
|
|
|
7
6
|
## Read the ground first
|
|
8
7
|
|
|
9
|
-
|
|
8
|
+
Cheap, and nothing below works without it:
|
|
10
9
|
|
|
11
|
-
1. `info` — workbook name
|
|
12
|
-
|
|
13
|
-
2. `read_range --formulas` over the block
|
|
14
|
-
|
|
15
|
-
3. `read_range --display` when
|
|
16
|
-
|
|
17
|
-
4. Read the labels
|
|
18
|
-
meaningful with its label, and your new row must match the surrounding convention.
|
|
10
|
+
1. `info` — workbook name/path, `saved` flag (unsaved work!), sheets, used ranges, tables,
|
|
11
|
+
charts, pivots, protection.
|
|
12
|
+
2. `read_range --formulas` over the target block **and its neighbours**. Know the formula
|
|
13
|
+
pattern before extending it.
|
|
14
|
+
3. `read_range --display` when changing formatting: it shows the format's effect, not the
|
|
15
|
+
stored value.
|
|
16
|
+
4. Read the surrounding labels: period, unit, actual/forecast. Match the convention.
|
|
19
17
|
|
|
20
|
-
If the
|
|
21
|
-
live document, "I thought it was empty" is how an analyst's afternoon disappears.
|
|
18
|
+
If the block holds values you cannot explain from the request, stop and ask.
|
|
22
19
|
|
|
23
20
|
## Rules of the edit
|
|
24
21
|
|
|
25
|
-
- **Change the cells the request names
|
|
26
|
-
|
|
27
|
-
- **Do not add, remove, rename, reorder or split sheets
|
|
28
|
-
|
|
22
|
+
- **Change the cells the request names and the formulas those cells feed.** A changed input
|
|
23
|
+
propagates; do not hand-edit downstream totals.
|
|
24
|
+
- **Do not add, remove, rename, reorder or split sheets** unless requested, or the change
|
|
25
|
+
cannot otherwise be expressed (a new output with no home).
|
|
29
26
|
- **Preserve everything you did not create**: other sheets, formulas, named ranges,
|
|
30
|
-
comments, protection, hidden
|
|
31
|
-
|
|
27
|
+
comments, protection, hidden/grouped rows, user freeze panes, native tables and their
|
|
28
|
+
structured references, pivot sources, shared formulas, filters, external links,
|
|
32
29
|
`INDIRECT` routing, calculation settings.
|
|
33
|
-
- **Never flatten formulas to values
|
|
34
|
-
- **Extend, do not replace.**
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
- **
|
|
39
|
-
|
|
40
|
-
- **
|
|
41
|
-
|
|
42
|
-
differently is a maintenance cost the user did not ask for.
|
|
43
|
-
- **Pre-existing errors are not yours to fix.** Report them with the cell and the formula
|
|
44
|
-
and ask. Silently repairing a `#REF!` can change a number the user relies on.
|
|
30
|
+
- **Never flatten formulas to values** — not to "simplify", not to "fix" a display problem.
|
|
31
|
+
- **Extend, do not replace.** A row or column added under a table, conditional format or
|
|
32
|
+
chart extends that object (`ListObject.Resize`, `SetSourceData`), never a parallel one.
|
|
33
|
+
- **Keep visual fixes local.** Widen the one clipped column. No sheet-wide autofit, no
|
|
34
|
+
restyle because it is not your default.
|
|
35
|
+
- **Match formula conventions**: anchoring style, `SUMIFS` vs `SUMPRODUCT`, rounding, error
|
|
36
|
+
handling. A "better" formula that reads differently costs maintenance.
|
|
37
|
+
- **Pre-existing errors are not yours to fix.** Report the cell, its formula and ask;
|
|
38
|
+
silently repairing `#REF!` can change a number the user relies on.
|
|
45
39
|
|
|
46
40
|
## Doing it
|
|
47
41
|
|
|
@@ -54,19 +48,17 @@ recalc
|
|
|
54
48
|
read_range --sheet "Build" --range D5:G13 --formulas # prove it
|
|
55
49
|
```
|
|
56
50
|
|
|
57
|
-
- Keep writes to the named rectangle
|
|
58
|
-
|
|
59
|
-
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
one-off), say why in the reply — a reviewer will find it.
|
|
51
|
+
- Keep writes to the named rectangle. `--clear` only a range whose contents you have read
|
|
52
|
+
and can restore.
|
|
53
|
+
- Copy style codes from the neighbouring block: read a matching cell, mirror its
|
|
54
|
+
`number_format`, apply to the new cells. Do not invent a format for one row.
|
|
55
|
+
- A formula that must differ from the pattern (different anchor, one-off): say why in the
|
|
56
|
+
reply.
|
|
64
57
|
|
|
65
58
|
## When you are done
|
|
66
59
|
|
|
67
|
-
- `read_range --formulas` over every cell
|
|
68
|
-
- `recalc` after formulas, then re-read
|
|
69
|
-
- `info` if tables, charts or pivots were extended, to confirm
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
edit touched a formula graph, say which outputs were affected.
|
|
60
|
+
- `read_range --formulas` over every changed cell and its neighbours.
|
|
61
|
+
- `recalc` after formulas, then re-read dependents.
|
|
62
|
+
- `info` if tables, charts or pivots were extended, to confirm coverage of the new cells.
|
|
63
|
+
- Report sheet, exact ranges, cell counts and saved state. If the formula graph changed,
|
|
64
|
+
name the affected outputs.
|
|
@@ -1,77 +1,39 @@
|
|
|
1
1
|
---
|
|
2
|
-
description:
|
|
2
|
+
description: Create, read, edit, render, and verify Word documents (.docx) — build new files, revise existing ones, and check the rendered pages.
|
|
3
3
|
---
|
|
4
4
|
|
|
5
5
|
# Documents (.docx)
|
|
6
6
|
|
|
7
|
-
A `.docx` is a zip of XML parts: `word/document.xml` holds the body,
|
|
8
|
-
|
|
9
|
-
- **Fast path** — the helper CLI inspects, renders and creates: `docx create`, `docx read`, `docx render`. It performs no in-place mutation.
|
|
10
|
-
- **Structural path** — `scripts/*.py` in this skill do all editing: replace text, append blocks, set properties, and everything structural — comments, tracked changes, fields, protection, watermarks.
|
|
11
|
-
|
|
12
|
-
Pick the cheapest route that produces the structure the user asked for, then verify it visually. Never invent content, and never deliver a file you have not looked at.
|
|
7
|
+
A `.docx` is a zip of XML parts: `word/document.xml` holds the body, with headers, footers, footnotes, comments, styles and numbering beside it. Two routes reach them: the helper CLI (`docx create`, `docx read`, `docx render`, no in-place mutation) and `scripts/*.py`, which edits everything structural — text, blocks, properties, comments, tracked changes, fields, protection, watermarks. Pick the cheapest route that yields the requested structure, then look at the pages. Never invent content; never deliver a file you have not looked at.
|
|
13
8
|
|
|
14
9
|
## Before any file work
|
|
15
10
|
|
|
16
|
-
|
|
17
|
-
2. Read the `## Office runtime` block at the end of this file for the verified `python`, `cli`, `skill` and `shared` paths.
|
|
18
|
-
3. If that block says no runtime is available, stop and give the user the `node "..."` remedy command it names, then call `office_status` again. Do not fake a document or claim success.
|
|
19
|
-
|
|
20
|
-
Quote every path. Spaces, non-ASCII names and `&` are normal on Windows.
|
|
11
|
+
Call `office_status`, then read the `## Office runtime` block at the end of this file — it holds the verified `python`, `cli`, `skill` and `shared` paths for this install. If there is no runtime, stop, give the user the `node "..."` remedy command, and call `office_status` again — never fake a document or claim success. Quote every path: spaces, non-ASCII names and `&` are normal on Windows.
|
|
21
12
|
|
|
22
13
|
## Delivery
|
|
23
14
|
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
- Creating a file: write it into the user's workspace, verify it, then `present`.
|
|
27
|
-
- Editing an existing file: never overwrite the original. Write `<original>-edited.<ext>` (or a name the user asked for), verify it, `present` it, and state both paths.
|
|
15
|
+
Deliver with `present` plus a one-sentence summary. A bare path is not delivery: the transcript renders `.docx`/`.pptx`/`.xlsx`/`.pdf` links as "二进制文件,无法显示改动". Write new files into the workspace, verify, `present`. Never overwrite an original — write `<original>-edited.<ext>` (or the user's name), verify, `present`, and state both paths.
|
|
28
16
|
|
|
29
17
|
## Annotations
|
|
30
18
|
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
When the payload cannot be mapped to a concrete object (the region is empty or the file has no geometry), do not guess silently — say what you could not locate.
|
|
34
|
-
|
|
35
|
-
For `.docx`, `page` is the page of the *rendered PDF preview*, not a Word page. Use `text` (and the paragraph text near it) to locate the target; the region is a hint for near-misses only. A region that lands on a table row, a caption or a header is ambiguous — state which object you picked before editing.
|
|
19
|
+
An `office-annotations` payload is `[{ page, text, requirement, region: { left, top, width, height } }]`: `region` normalised 0–1 against the rendered preview page, `requirement` free-form. Treat it as a change request, not editor state — find what the region covers, apply the smallest edit that satisfies `requirement`, re-render, confirm. Unmappable payload (empty region, no geometry): say what you could not locate; never guess. For `.docx`, `page` is a rendered PDF page, not a Word page: locate by `text` and its neighbouring paragraphs, use the region only for near-misses, and name the object you picked when a region lands on a table row, caption or header.
|
|
36
20
|
|
|
37
21
|
## Verify
|
|
38
22
|
|
|
39
|
-
Rendering is the only proof that a document looks right.
|
|
40
|
-
|
|
41
23
|
```bash
|
|
42
24
|
"<python>" "<cli>" docx render --input "<file.docx>" --out-dir "<render-dir>"
|
|
43
25
|
```
|
|
44
26
|
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
- Iterate until the pages look correct, then deliver. "It parses" is not verification.
|
|
48
|
-
- If the runtime reports no renderer (`renderers.can_render.docx: false` — the DSH LibreOffice kit is missing), ask the user to fix the install, or fall back to `docx read` plus the audit scripts. Say plainly that layout was not visually verified — do not describe a page you did not see.
|
|
49
|
-
- After a script edits XML, re-render. A package can stay valid while the page it produces is broken.
|
|
50
|
-
|
|
51
|
-
## Choosing a route
|
|
52
|
-
|
|
53
|
-
| Job | Fast path | Structural path |
|
|
54
|
-
|---|---|---|
|
|
55
|
-
| New document from scratch | `docx create --spec` | `python-docx` snippet in `tasks/create_edit.md` |
|
|
56
|
-
| Replace or append text and blocks | — | `scripts/replace_text.py`, `scripts/append_blocks.py` |
|
|
57
|
-
| Document properties | — | `scripts/core_properties.py` |
|
|
58
|
-
| Read structure | `docx read` | `scripts/docx_kit.py text`, `style_lint`, audits |
|
|
59
|
-
| Comments, tracked changes | — | `scripts/comments_*.py`, `scripts/*tracked*.py` |
|
|
60
|
-
| Fields, TOC, cross-references | — | `scripts/insert_toc.py`, `insert_ref_fields.py`, `fields_*.py` |
|
|
61
|
-
| Footnotes, endnotes | — | `scripts/insert_note.py`, `footnotes_report.py` |
|
|
62
|
-
| Tables, layout geometry | `docx create` table block | `scripts/table_geometry.py`, `docx_table_to_csv.py` |
|
|
63
|
-
| Styles, templates | — | `scripts/style_*.py`, `apply_template_styles.py` |
|
|
64
|
-
| Protection, watermarks, privacy | — | `scripts/set_protection.py`, `watermark_*.py`, `privacy_scrub.py`, `redact_docx.py` |
|
|
65
|
-
|
|
66
|
-
Where no verb exists, the fallback is the listed script or a short `python-docx`/`lxml` snippet. Both are runnable with the runtime `python`; neither needs a new dependency.
|
|
27
|
+
Writes a PDF and one PNG per page and prints the paths. Open each PNG with `read_image`; check heading hierarchy, table width and cell wrapping, page breaks, header/footer, clipped or overflowing text, missing glyphs (dashes, CJK, symbols), equations, caption placement. Iterate, then deliver — "it parses" is not verification. Without a renderer (`office_status` reports `renderers.available: false`, with a `remedy`) ask the user to fix the install or fall back to `docx read` plus the audit scripts; say layout was not visually verified and never describe an unseen page. Re-render after every script edit: a package can be valid while its page is broken. Details: `tasks/verify_render.md`. Setup: `troubleshooting/libreoffice_headless.md`.
|
|
67
28
|
|
|
68
29
|
## Task index
|
|
69
30
|
|
|
70
|
-
|
|
|
31
|
+
| Job | Task doc | CLI or main tool |
|
|
71
32
|
|---|---|---|
|
|
72
|
-
| Create
|
|
73
|
-
| Read and review a file | `tasks/read_review.md` |
|
|
74
|
-
|
|
|
33
|
+
| Create a document | `tasks/create_edit.md` | `docx create --spec`, `python-docx` snippet, `append_blocks.py` |
|
|
34
|
+
| Read and review a file | `tasks/read_review.md` | `docx read`, `docx_kit.py text`, `style_lint`, audits |
|
|
35
|
+
| Edit text, blocks or properties | `tasks/create_edit.md` | `replace_text.py`, `append_blocks.py`, `core_properties.py` |
|
|
36
|
+
| Comments | `tasks/comments_manage.md` | `comments_*.py` |
|
|
75
37
|
| Tracked changes | `tasks/clean_tracked_changes.md` | `accept_tracked_changes.py`, `add_tracked_replacements.py` |
|
|
76
38
|
| Fields and updates | `tasks/fields_update.md` | `fields_report.py`, `fields_materialize.py` |
|
|
77
39
|
| Table of contents | `tasks/toc_workflow.md` | `insert_toc.py`, `fields_*.py` |
|
|
@@ -79,7 +41,7 @@ Where no verb exists, the fallback is the listed script or a short `python-docx`
|
|
|
79
41
|
| Navigation links | `tasks/navigation_internal_links.md` | `internal_nav.py` |
|
|
80
42
|
| Footnotes and endnotes | `tasks/footnotes_endnotes.md` | `insert_note.py`, `footnotes_report.py` |
|
|
81
43
|
| Headings and numbering | `tasks/headings_numbering.md` | `heading_audit.py` |
|
|
82
|
-
| Tables | `tasks/tables_spreadsheets.md` | `table_geometry.py`, `docx_table_to_csv.py`, `xlsx_to_docx_table.py` |
|
|
44
|
+
| Tables and geometry | `tasks/tables_spreadsheets.md` | `docx create` table block, `table_geometry.py`, `docx_table_to_csv.py`, `xlsx_to_docx_table.py` |
|
|
83
45
|
| Images and figures | `tasks/images_figures.md` | `images_audit.py` |
|
|
84
46
|
| Sections and page setup | `tasks/sections_layout.md` | `section_audit.py` |
|
|
85
47
|
| Styles | `tasks/style_lint_normalize.md` | `style_lint.py`, `style_normalize.py` |
|
|
@@ -91,24 +53,26 @@ Where no verb exists, the fallback is the listed script or a short `python-docx`
|
|
|
91
53
|
| Privacy and metadata | `tasks/privacy_scrub_metadata.md` | `privacy_scrub.py` |
|
|
92
54
|
| Redaction | `tasks/redaction_anonymization.md` | `redact_docx.py` |
|
|
93
55
|
| Merging documents | `tasks/multi_doc_merge.md` | `merge_docx_append.py` |
|
|
94
|
-
| Comparing versions | `tasks/compare_diff.md` | `render_and_diff.py` |
|
|
95
|
-
| Equations | `tasks/equations.md` |
|
|
96
|
-
| Visual verification | `tasks/verify_render.md` | `render_docx.py` (skill root) |
|
|
56
|
+
| Comparing versions | `tasks/compare_diff.md` | `docx render`, `render_and_diff.py` |
|
|
57
|
+
| Equations | `tasks/equations.md` | `docx create` `equation` block |
|
|
58
|
+
| Visual verification | `tasks/verify_render.md` | `docx render`, `render_docx.py` (skill root) |
|
|
97
59
|
| Fixtures and edge cases | `tasks/fixtures_edge_cases.md` | `make_fixtures.py` |
|
|
98
60
|
|
|
61
|
+
Where no verb exists, use the listed script or a short `python-docx`/`lxml` snippet — both run on the runtime `python` without a new dependency.
|
|
62
|
+
|
|
99
63
|
## Document defaults
|
|
100
64
|
|
|
101
65
|
- Letter 8.5×11 portrait (A4 when the user or template says so), 1in margins, body 11–12pt, single column.
|
|
102
|
-
- Black headings and body
|
|
103
|
-
- Tables:
|
|
104
|
-
- No
|
|
105
|
-
- Captions
|
|
106
|
-
- Prefer native
|
|
66
|
+
- Black headings and body; colour only for deliberate emphasis, links and chart series.
|
|
67
|
+
- Tables: `#D9D9D9` borders, bold header row, `w:tblHeader` repeat, no vertical merges in wide tables.
|
|
68
|
+
- No callout boxes, drop shadows or coloured sidebars — structure comes from headings, lists and tables.
|
|
69
|
+
- Captions under figures and above tables, `Caption` style, staying with the object.
|
|
70
|
+
- Prefer native headings, lists, tables and OMML equations over hand-positioned runs: the next edit depends on that structure.
|
|
107
71
|
|
|
108
72
|
## Writing quality
|
|
109
73
|
|
|
110
|
-
|
|
74
|
+
Plain sentences, no filler. Checklist `references/writing-quality.md`; package parts `references/docx-structure.md`.
|
|
111
75
|
|
|
112
76
|
## Shared workflow
|
|
113
77
|
|
|
114
|
-
Cross-format habits
|
|
78
|
+
Cross-format habits and annotation payloads: `"<shared>/common-workflow.md"`, `"<shared>/annotation-recipes.md"`.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# End-to-end smoke test
|
|
2
2
|
|
|
3
|
-
A short job
|
|
3
|
+
A short job touching creation, inspection, structural change and verification. Run it after a runtime change, or as a template for "is this environment healthy".
|
|
4
4
|
|
|
5
5
|
```bash
|
|
6
6
|
PY="<python>"; CLI="<cli>"; S="<skill>/scripts"; R="<skill>"; W="/tmp/docx-smoke"
|
|
@@ -41,7 +41,7 @@ Expect `ok: true` and non-zero `headings`, `tables`, `equations`.
|
|
|
41
41
|
"$PY" "$S/style_lint.py" "$W/base.docx"
|
|
42
42
|
```
|
|
43
43
|
|
|
44
|
-
Expect the sections,
|
|
44
|
+
Expect the sections, `word/document.xml` in the parts list, Letter 8.5×11 portrait, and an empty style-lint `counts`.
|
|
45
45
|
|
|
46
46
|
## 3. Change it structurally
|
|
47
47
|
|
|
@@ -63,7 +63,7 @@ Expect the sections, the parts list to include `word/document.xml`, Letter 8.5×
|
|
|
63
63
|
"$PY" "$S/table_geometry.py" "$W/with-toc.docx"
|
|
64
64
|
```
|
|
65
65
|
|
|
66
|
-
Audits may exit 1 with findings
|
|
66
|
+
Audits may exit 1 with findings: that is a report, not an environment failure. Every finding should be explainable.
|
|
67
67
|
|
|
68
68
|
## 5. Verify visually
|
|
69
69
|
|
|
@@ -71,7 +71,7 @@ Audits may exit 1 with findings — that is a report, not a failure of the envir
|
|
|
71
71
|
"$PY" "$R/render_docx.py" "$W/with-toc.docx" --output_dir "$W/render" --dpi 150
|
|
72
72
|
```
|
|
73
73
|
|
|
74
|
-
|
|
74
|
+
Open each PNG with `read_image`. Without the DSH LibreOffice kit the command exits 3 with `no_renderer`: a setup problem, not a document problem, and the rest of the test still stands.
|
|
75
75
|
|
|
76
76
|
## 6. Deliver
|
|
77
77
|
|
|
@@ -83,4 +83,4 @@ Copy the final file into the user's workspace, `present` it, and state what chan
|
|
|
83
83
|
rm -rf "$W"
|
|
84
84
|
```
|
|
85
85
|
|
|
86
|
-
Nothing under the workspace should be left behind
|
|
86
|
+
Nothing under the workspace should be left behind by a smoke test.
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# Comments in the package
|
|
2
2
|
|
|
3
|
-
A comment is three pieces that must agree: `word/comments.xml` holds the content, `word/document.xml` holds a range marking which text is discussed, and
|
|
3
|
+
A comment is three pieces that must agree: `word/comments.xml` holds the content, `word/document.xml` holds a range marking which text is discussed, and a relationship plus content-type override make the part exist at all.
|
|
4
4
|
|
|
5
5
|
## The markup
|
|
6
6
|
|
|
@@ -20,21 +20,21 @@ A comment is three pieces that must agree: `word/comments.xml` holds the content
|
|
|
20
20
|
|
|
21
21
|
Rules that matter in practice:
|
|
22
22
|
|
|
23
|
-
- `w:id`
|
|
24
|
-
- The comment reference run belongs at the end of the range, not
|
|
23
|
+
- `w:id` is unique across comments **and** matches in all three places. A range start without an end leaves Word showing a comment with no anchor; an end without a start can make the file refuse to open.
|
|
24
|
+
- The comment reference run belongs at the end of the range, not elsewhere in the paragraph.
|
|
25
25
|
- `word/comments.xml` needs an override in `[Content_Types].xml` and a relationship from `word/document.xml`; without both, the part is ignored or the file is corrupt.
|
|
26
|
-
- The file
|
|
26
|
+
- The file root lists `w14`/`w15` in `mc:Ignorable`; the `w15:done` "resolved" attribute is only legal with those namespaces declared.
|
|
27
27
|
|
|
28
28
|
## Resolved versus deleted
|
|
29
29
|
|
|
30
|
-
`w15:done="1"` on
|
|
30
|
+
`w15:done="1"` on `w:comment` keeps the comment in the file and shows it as resolved. Removing it is a different operation: delete the `w:comment`, both range markers and the reference run. Resolving hides the comment from the default pane; it does not remove the text from the file.
|
|
31
31
|
|
|
32
32
|
## Where comments hide
|
|
33
33
|
|
|
34
|
-
- Replies are comments too, linked by `w15:paraIdParent`;
|
|
34
|
+
- Replies are comments too, linked by `w15:paraIdParent`; removing the parent leaves an orphan.
|
|
35
35
|
- Anchors can sit in headers, footnotes and text boxes as well as the body.
|
|
36
|
-
- A comment deleted in Word leaves no trace
|
|
36
|
+
- A comment deleted in Word leaves no trace, but a comment whose range was deleted may remain in `comments.xml` with nothing anchoring it. That is why extraction reports anchors: a comment with empty anchored text is evidence of drift.
|
|
37
37
|
|
|
38
38
|
## Working from the scripts
|
|
39
39
|
|
|
40
|
-
`comments_extract.py` reads the pairing and prints anchored text per comment; `comments_add.py` writes all three pieces; `comments_apply_patch.py` edits content and the resolved flag; `comments_strip.py` removes every trace and the part itself. Use `docx_kit.py xml '<file.docx>' word/comments.xml`
|
|
40
|
+
`comments_extract.py` reads the pairing and prints anchored text per comment; `comments_add.py` writes all three pieces; `comments_apply_patch.py` edits content and the resolved flag; `comments_strip.py` removes every trace and the part itself. Use `docx_kit.py xml '<file.docx>' word/comments.xml` for the raw part.
|