Commit Graph

6 Commits

Author SHA1 Message Date
Stefan Broenner 09694d8afe Add table-creation range preflight (#844)
* Add table creation preflight

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: preserve sessions during stale cleanup

Wait for the tracked daemon to finish graceful shutdown even when its reply is lost, so pre-build cleanup cannot interrupt session auto-save.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: preserve sessions during stale cleanup

Wait for the tracked daemon to finish graceful shutdown even when its reply is lost, so pre-build cleanup cannot interrupt session auto-save.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Fix quoted formula reference detection

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: ea1cae23-233e-46ce-9cf7-e22fa9f5ac8b

* fix: await tracked Excel shutdown

Treat graceful cleanup as complete only after the exact daemon generation and its tracked Excel processes exit, while retaining the existing bounded forced fallback.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: b07d5dc3-38d8-4d20-9f07-122e079dd612

* fix: stabilize MCPB staging cleanup

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 9b9eefe6-dd82-44e6-abdc-98202899cf32

* Bound merged-range discovery scans

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* Bound table preflight heuristics

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Stefan Broenner <stbrnner@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: ea1cae23-233e-46ce-9cf7-e22fa9f5ac8b
Copilot-Session: b07d5dc3-38d8-4d20-9f07-122e079dd612
Copilot-Session: 9b9eefe6-dd82-44e6-abdc-98202899cf32
2026-08-31 17:13:31 +02:00
Stefan Broenner d2c993248c Return canonical Excel formula error names (#843)
* fix: return canonical formula error names

Centralize Excel COM formula error mappings and expose canonical names with cell-level diagnostics consistently through Core, CLI, and MCP range reads.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: preserve sessions during stale cleanup

Wait for the tracked daemon to finish graceful shutdown even when its reply is lost, so pre-build cleanup cannot interrupt session auto-save.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: return canonical formula error names

Centralize Excel COM formula error mappings and expose canonical names with cell-level diagnostics consistently through Core, CLI, and MCP range reads.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: distinguish Python object placeholders

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 09caed35-cd31-4286-9b73-a4166c5e7a88

* fix: map double formula error variants

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* test: cover double error variants end to end

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

---------

Co-authored-by: Stefan Broenner <stbrnner@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 09caed35-cd31-4286-9b73-a4166c5e7a88
2026-08-31 16:23:16 +02:00
Stefan Broenner 9a13dba5ae fix: address codebase review findings (#815)
* fix: enforce VBA run timeout

Pass caller-supplied VBA run timeouts through ExcelBatch cancellation and cover blocked macro cleanup with a real-Excel regression test.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: synchronize release version metadata

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: preserve invalid file create paths

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: preserve automation contract failures

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47

* fix: create linked PivotCharts

Create and verify PivotCharts through Excel's UI-equivalent COM sequence for regular and Data Model PivotTables. Reject unsupported chart types without reporting a static chart as linked.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

* fix: complete window layout and view contracts

Resolve Arrange presets against Excel's current monitor work area with per-monitor DPI conversion, and expose formula display through Core, CLI, MCP, tests, and guidance.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: e5373bc0-9387-4f79-9b56-28e41a13496c

* test: use named measure format

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47

* fix: preserve nested release metadata versions

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47

* fix: address final review findings

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47

* docs: add project context glossary

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47

* docs: connect agent rules and issue templates

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47

---------

Co-authored-by: Stefan Broenner <stbrnner@microsoft.com>
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 0b5016ea-1678-43fc-9427-b1578901df47
Copilot-Session: e5373bc0-9387-4f79-9b56-28e41a13496c
2026-08-26 09:12:02 +02:00
Stefan Broenner f9a25d155f feat!: unify CLI and MCP automation contracts (#807)
* feat!: unify CLI and MCP automation contracts

Implement the seven-layer CLI/MCP remediation stack: safe pipe-owned cleanup, truthful daemon states, strict generated contracts, canonical inputs, exact Power Query identity, compact reads, and a unified file lifecycle.

Fixes #781, #782, #783, #784, #785, #786, #787, #788, #789, #796, #797, #798, #799, #800, #801

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 57225379-2632-4201-98b6-94b43b419f5c

* test: strengthen protocol regression assertions

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: 6a90669a-c01e-46be-838f-2a2418e9b788

---------

Copilot-Session: 57225379-2632-4201-98b6-94b43b419f5c
Copilot-Session: 6a90669a-c01e-46be-838f-2a2418e9b788
2026-08-21 16:59:45 +02:00
Stefan Broenner 3a7abdc916 fix(screenshot): capture the live Excel window instead of a temp chart (#777) (#778)
* fix(screenshot): capture the live Excel window instead of a temp chart (#777)

Screenshot capture never took a screenshot: it rendered one inside Excel by
inserting a temporary ChartObject into the target worksheet, pasting a
CopyPicture image into it, and exporting the chart. Excel blocks drawing-object
inserts on a protected worksheet, so `capture` and `capture-sheet` failed with a
bare COMException 0x800A03EC (#777).

Replace that pipeline with a real window capture (PrintWindow with
PW_RENDERFULLCONTENT), using the approach from the sister repo mcp-windows.
Ranges larger than the Excel window are zoomed to fit down to a readable floor
and, if still too large, captured in several passes and stitched together.
Extremely large ranges are truncated to their top-left portion and the result
message says so.

New in ExcelMcp.Core/Commands/Screenshot:
- WindowCapture.cs: PrintWindow plus per-monitor DPI awareness primitives
- ScreenshotEncoder.cs: preserves the existing quality contract
  (High = PNG 100%, Medium = JPEG 75% scale, Low = JPEG 50% scale)
- CapturePlanner.cs: fit-zoom, tile segmentation, tile budget and truncation

Behaviour changes for users:
- Protected sheets can be captured
- The clipboard is no longer overwritten and the workbook is never modified or
  dirtied by taking a screenshot
- Capture requires an interactive desktop session; it fails on a locked desktop
  or a disconnected Remote Desktop session

Two non-obvious details are handled explicitly:
- ExcelWriteGuard sets Application.ScreenUpdating = false for every batch
  operation. With it off Excel does not repaint and PrintWindow returns a stale
  frame, so capture temporarily re-enables it and restores it in finally. This
  is the documented exception to the usual "no ScreenUpdating in command code"
  rule.
- Setting Window.Zoom makes Excel re-scroll to keep the selection visible, so
  the view state is restored zoom first, then ScrollRow/ScrollColumn.

The public surface is unchanged (same actions, parameters, ScreenshotResult and
quality semantics), so no CLI/MCP sync points needed edits.

Tests (Feature=Screenshot, 19/19 passing):
- Protected-sheet regressions for capture, capture-sheet, and protection intact
- Tiling of a range larger than the viewport, asserting stitched corner content
- Zoom/scroll restoration and workbook-unmodified assertions

Docs updated: IScreenshotCommands XML summary, MCP tool description,
skills/shared/screenshot.md plus regenerated skill references, and
docs/features/CHARTS-VISUALS.md.

Fixes #777

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9df3bcb1-9813-4003-adec-93062dec7bf2

* refactor(screenshot): address Copilot review feedback

Use Convert.ToInt32 rather than direct casts when reading UsedRange row/column
counts and origins from Excel COM, matching the convention elsewhere in Core and
avoiding runtime binder conversion errors if COM hands back a double.

Clarify the MinReadableZoom documentation: the readable-zoom floor is a
preference, not a hard limit. The tile budget takes precedence, so a range that
would otherwise need more than PreferredMaxTiles tiles can still be zoomed below
the floor, down to its fit zoom.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9df3bcb1-9813-4003-adec-93062dec7bf2

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: 9df3bcb1-9813-4003-adec-93062dec7bf2
2026-08-19 17:24:20 +02:00
Stefan Broenner 37aa032503 Docs site: task guides, LLM discoverability layer, and published reference corpus (#769)
* docs: improve discovery and documentation UX

Restructure feature documentation around canonical category pages, improve GitHub Pages navigation and SEO, and align contributor guidance with the canonical-first model.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f3240d8f-e245-4dfb-a1f5-79373ca1ca1f

* docs: add release note

Document the user-visible discovery and documentation navigation improvements.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f3240d8f-e245-4dfb-a1f5-79373ca1ca1f

* docs: complete site SEO improvements

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>

Copilot-Session: f3240d8f-e245-4dfb-a1f5-79373ca1ca1f

* docs: add task guides, LLM discoverability layer, and skills reference to site

Intent-matching content (docs/guides/):
- Five canonical task guides built from verified material: refresh Power
  Query, automate PivotTables, query the Data Model with DAX, run VBA
  macros, and COM automation vs. file-parser libraries
- Guides hub index, Guides nav section, cross-links from feature docs,
  FEATURES.md, home page and troubleshooting

Machine-readable layer for AI assistants (gh-pages/hooks.py):
- /llms.txt (llmstxt.org format) and /llms-full.txt, generated from the
  resolved MkDocs nav so they cannot go stale
- Markdown mirror of every page, advertised via rel=alternate
- /tools.json derived from canonical feature docs, build fails on count
  mismatch with FEATURES.md
- FAQPage JSON-LD generated from existing question admonitions
- Explicit AI-crawler allow policy in robots.txt

Reference corpus (skills/shared/ -> /reference/):
- Publish all 24 expert files as a nav-grouped Reference section
- Fix stray outer code fences in conditionalformat, pivottable and
  slicer that also rendered wrong inside the shipped skill packages

Distribution metadata:
- Correct stale tool/operation counts in mcpb/manifest.json and the CLI
  package description
- Point NuGet PackageProjectUrl and .mcp/server.json at the docs site
- Extend check-doc-counts.ps1 to guard both, so this cannot recur

Validation:
- New gh-pages/audit_site.py gate (canonicals, metadata completeness,
  single H1, image dimensions, internal links, sitemap, llms outputs,
  mirror cleanliness, tools.json counts, robots policy) wired into the
  Pages deploy workflow, keeping the docs-only pre-commit path fast

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f3240d8f-e245-4dfb-a1f5-79373ca1ca1f

* docs: fix marketplace extension identifier and security PoC command

The publisher guide linked to itemName=sbroenne.excelmcp, but the
extension is published as sbroenne.excel-mcp (14 other references in
the repo already use the correct form), so both links 404.

The SECURITY.md path-traversal example invoked 'powerquery export',
which is not a command. Replaced with 'powerquery view', which does
take a file path and so actually illustrates the class of issue.

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f3240d8f-e245-4dfb-a1f5-79373ca1ca1f

---------

Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Copilot-Session: f3240d8f-e245-4dfb-a1f5-79373ca1ca1f
2026-08-15 12:25:52 +02:00