mirror of
https://github.com/sbroenne/mcp-server-excel.git
synced 2026-09-19 07:53:08 +08:00
analytics-data
4 Commits
| Author | SHA1 | Message | Date | |
|---|---|---|---|---|
|
|
352b1da895 |
Revert: remove RELEASE_PAT verification scratch file [skip ci]
Reverts the scratch verification commit; confirms PAT push authentication and ruleset bypass work end-to-end for the release-automation fix. |
||
|
|
f1d85698f3 |
test: verify RELEASE_PAT can push directly to protected main [skip ci]
This is a scratch verification commit for the release-automation fix in PR #739 (direct changelog push using RELEASE_PAT as a ruleset bypass actor). It will be reverted immediately by a follow-up commit. |
||
|
|
b9ad2986a3 |
feat: Agent Mode - watch AI work in Excel in real-time (#470) (#471)
* feat: Agent Mode - watch AI work in Excel in real-time (#470) Implement Agent Mode for Excel automation with window management capabilities: Core Infrastructure: - Add IWindowCommands interface with 9 actions (show, hide, set-state, set-position, arrange, bring-to-front, get-info, set-status-bar, clear-status-bar) - Implement WindowCommands with Excel COM interop and Win32 P/Invoke - Add SessionManager visibility tracking per session - Wire DispatchWindowAsync in ExcelMcpService with session-scoped operations Agent Mode UX: - LLM guidance: ask user with action cards before starting multi-step tasks - Action cards include tradeoffs (visible = slower rendering; hidden = faster but no visual feedback) - Add excel_agent_mode.md and window.md shared skill references - Update behavioral-rules.md, ServerInstructions, and SKILL.md Documentation: - Add Agent Mode feature card and example to gh-pages/index.md - Add Window Management section to gh-pages features - Update mcpb/README.md with Agent Mode highlights - Update all READMEs with new operation counts (225 total) - Update FEATURES.md and CHANGELOG.md Bug Fix: - Fix ExcelBatch.Dispose race condition: wait for EXCEL.EXE process to terminate before returning, preventing CO_E_SERVER_EXEC_FAILURE on rapid create/destroy cycles Scripts: - Fix all 14 PowerShell scripts for cross-environment compatibility Tests: - Add 29 integration tests for Window commands (visibility, state, position, arrange, status bar, info) * fix: address bug reports from dashboard session Bug 5 - SetDataLabels seriesIndex=0: treat 0 as null (apply to all series) since MCP clients may send 0 instead of omitting the parameter. Improved all series index error messages with 1-based indexing hint. Bug 6 - CaptureSheet: cap UsedRange to 500 rows x 50 columns to avoid CopyPicture failures on sheets with formatting extending far beyond data. Bug 7 - RPC_S_SERVER_UNAVAILABLE (0x800706BA): add handling in resilience pipeline and WithSessionAsync. Auto-cleanup dead sessions and return friendly error message instead of cryptic COM exception. Bug 3 - Documentation: fix incorrect 'range_format set-number-format' references (should be 'range set-number-format') in 5 skill/template files. Bug 2/4 - Improve tool descriptions for SetStyle (style_id parameter), SetDataLabels (seriesIndex=0 semantics), and AddTrendline (type values). Screenshot stability: add 1s render delay after visibility toggle in ExportRangeAsImage to prevent CopyPicture crashes. Start screenshot test batches with show:true since CopyPicture requires a visible window. Bug 1 - Filed as GitHub issue #472 (session timeout auto-save). Bug 2/4 - Filed as GitHub issue #473 (parameter naming discoverability). * fix: auto-save sessions on shutdown and add session creation resilience - SessionManager.Dispose() auto-saves all live sessions before closing to prevent silent data loss on MCP client disconnect or process exit - ServiceBridge.Dispose() + Program.cs finally block ensure cleanup runs - Added CreateSessionCreationPipeline() in ResiliencePipelines for transient COM failures (CO_E_SERVER_EXEC_FAILURE, RPC_E_CALL_FAILED) during Excel process startup under resource constraints - SessionManager.CreateSession/CreateSessionForNewFile wrapped in retry - Tests simplified: removed test-level retry, uses per-test unique files --------- Co-authored-by: Stefan Broenner <stefan.broenner@microsoft.comm> |
||
|
|
5dd4dfd3e1 |
feat(cli): comprehensive CLI improvements for coding agents (#387)
* feat(cli): improve agent experience with session close --save, version check, quiet mode - Replace dead session save with session close --save flag - Add version --check to detect updates from NuGet - Add -q/--quiet flag for agent-friendly output - Fix ServiceProvider disposal in TypeRegistrar - Add excel-cli skill documentation - Update README and SKILL.md - Fix pre-existing test using wrong JSON property names * feat(cli): add Slicer command and complete Chart config actions Slicer command (8 actions): - create-slicer, list-slicers, set-slicer-selection, delete-slicer (PivotTable) - create-table-slicer, list-table-slicers, set-table-slicer-selection, delete-table-slicer (Table) Chart config actions (14 new): - get/set-axis-number-format, set-data-labels - get/set-axis-scale, get/set-gridlines - set-series-format, list/add/delete/set-trendline - set-placement, fit-to-range Updated SKILL.md and README.md with new commands * Phase 3-6: SessionCommandBase, ExitCodes, PathValidator, CLI tests Phase 3: SessionCommandBase<TSettings> - Abstract base class for session-aware commands - RequireParameter()/RequireParameters() for validation - WriteResult()/ExecuteVoidAction() helpers - Refactored SlicerCommand to extend base class Phase 4: ExitCodes standardization - Success=0, OperationFailed=1, MissingSession=2 - MissingAction=3, UnknownAction=4, MissingParameter=5 Phase 5: PathValidator utilities - ValidateExcelPath() with extension and existence checks - NormalizePath() for relative-to-absolute conversion - GetUniqueFilePath() for avoiding overwrites - HasInvalidPathCharacters() and IsWithinAllowedDirectory() Phase 6: CLI integration tests - SlicerCommandIntegrationTests (4 tests) - VersionCommandIntegrationTests (2 tests) - PathValidatorTests (18 unit tests) * Sync CLI help with MCP tool descriptions and update skill references CLI Help Updates: - Session: Added workflow hint (open -> sessionId -> close) - PowerQuery: Added action list (list, view, create, update, refresh, load-to, delete) - Range: Emphasized core operations and formatting - Sheet: Clarified lifecycle operations - NamedRange: Added action list - ConditionalFormat: Added rule types info - Table: Added Data Model integration note - PivotTable: Added calculated fields and layout - Chart: Added series, axis, trendlines - Connection: Clarified use excel_powerquery for Text/Web/CSV - DataModel: Added prerequisite note (tables must be in Data Model first) - VBA: Added .xlsm and trust requirement - Slicer: Clarified PivotTable and Table slicer support Skill Updates: - Added excel_slicer.md reference (PivotTable and Table slicers) - Added excel_conditionalformat.md reference (cell-value and expression rules) - Added Chart Positioning section (CRITICAL: never place at 0,0) - Added Slicers for Visual Filtering section - Added CLI Usage section with example workflow - Expanded Power Query quirks (create vs update, validation timing) - Version bump to 1.3.0 * feat(cli): expose all Core commands in daemon - Add all Range command handlers (45+ ops: formulas, clear, copy, insert/delete, find/replace, sort, hyperlinks, number formats, styles, validation, autofit, merge, cell lock) - Add Sheet command handlers (tab color, visibility, cross-file operations) - Add Table get-structured-reference handler - Add PivotTable handlers (set-field-function/name/format, group-by-date/numeric, calculated members) - Add parsing helpers for DateGroupingInterval, CalculatedMemberType, TableRegion - Update SKILL.md v1.3.0 with all new commands - Remove command aliases (use canonical names only) * feat: replace CreateEmpty with CreateAndOpen for 50% faster file creation BREAKING CHANGE: Removed create-empty action from excel_file tool - Remove FileCommands.CreateEmpty() and related STA thread code - Add ExcelBatch.CreateNewWorkbook() factory method - Add SessionManager.CreateSessionForNewFile() for optimized path - CreateAndOpen combines file creation + session in single Excel start - Performance: ~3.8s vs ~7-8s (50% faster for new workbooks) Directory validation: - Now throws DirectoryNotFoundException if directory doesn't exist - Previously auto-created directories (removed for explicit control) Test fixtures updated (12+ files): - All fixtures now use SessionManager.CreateSessionForNewFile() - Deleted 3 obsolete CreateEmpty test files Documentation: - Updated skills (excel-mcp, excel-cli) with CreateAndOpen guidance - Updated CHANGELOG with performance improvements - Updated tool descriptions in ExcelFileTool.cs * feat: add session operation timeout to prevent infinite hangs (#388) - Add timeoutSeconds parameter to MCP excel_file (open, create-and-open) - Add --timeout option to CLI session create and session open commands - Default: 300 seconds (5 min), range: 10-3600 seconds - Timeout applies to ALL operations within the session - Operations exceeding timeout throw TimeoutException and trigger cleanup Implementation: - ComInteropConstants: DefaultOperationTimeout constant - IExcelBatch/ExcelBatch: OperationTimeout property, linked CancellationToken - ExcelSession.BeginBatch: operationTimeout parameter - SessionManager: operationTimeout on CreateSession/CreateSessionForNewFile - ExcelFileTool: timeoutSeconds parameter with validation - DaemonCommands: --timeout option for session commands - ExcelDaemon: Pass timeout to SessionManager Closes #388 * Remove SpecKit for the time being * Refactor test namespaces and update README for diagnostics tests - Updated namespaces in CoreCommandsCoverageTests, ActionEnumCompletenessTests, ExcelFileToolTests, and TelemetryIntegrationTests to use Sbroenne.ExcelMcp.Core.Models.Actions instead of Sbroenne.ExcelMcp.McpServer.Models. - Added section in README.md for diagnostics tests, detailing their purpose, execution, and CI behavior. * fix: update version check command in SKILL.md for clarity * feat: add comprehensive financial report automation scenarios and enhance sales report workflow with detailed validation * feat: expose PowerQuery Unload, fix docs, add Rule 24 for post-change sync PowerQuery Unload: - Add Unload to PowerQueryAction enum and ActionExtensions mapping - Expose via IPowerQueryCommands interface (instance method) - Add MCP Server handler in ExcelPowerQueryTool - Add CLI handler in ExcelDaemon (was missing!) Documentation fixes: - Update operation counts: 209 → 210, Power Query 10 → 11 ops - Fix slicer position format: cell address ('E1') not points format - Add create-from-table to excel_chart.md prompt disambiguation Rule 24 - Post-Change Sync Verification: - New critical rule added to prevent missing CLI/SKILLs/READMEs - Checklist of 9 sync points for any tool/action changes - Added to Quick Reference tables in critical-rules.instructions.md Tests: - Add Chart CreateFromTable unit tests - Add LLM test for chart create-from-table - Fix PowerQuery test files (static → instance method) * refactor: rename create-and-open to create for simpler LLM usage BREAKING CHANGE: excel_file action renamed from 'create-and-open' to 'create' Why: - LLMs were confused by hyphenated name containing 'and' and 'open' - They sometimes tried to chain separate create + open calls - Simpler 'create' name matches standard file API expectations Changes: - FileAction enum: CreateAndOpen -> Create - ActionExtensions: create-and-open -> create - ExcelFileTool: Method renamed CreateSessionAsync - Tests: All test names and action strings updated - Skills: SKILL.md updated with new action name - Scripts: Audit scripts updated No functionality change - create still creates file AND starts session. * feat: add COM diagnostics, fix calculated field bug, consolidate LLM tests COM Diagnostics: - Add exType, hr (HRESULT), inner fields to error responses - Log COM exceptions to stderr for debugging - Check IsExcelProcessAlive() in WithSession() Bug Fixes: - Fix calculated field bug in RegularPivotTableFieldStrategy - Fix slicer test using non-existent 'SalesRep' column LLM Test Improvements: - Consolidate chart tests into single excel-chart-test.yaml - Update skills and behavioral rules documentation - Remove redundant test scenarios * feat(cli): add help descriptions and file input options for all commands - Add Description attributes to all CommandOption and CommandArgument properties - Add --*-file options to read complex parameters from files instead of command line: - range: --values-file - vba: --code-file - powerquery: --mcode-file - datamodel: --expression-file, --dax-query-file, --dmv-query-file - table: --csv-file, --dax-query-file - connection: --connection-string-file, --command-text-file - conditionalformat: --formula-file - Improves agent experience by providing clear option descriptions in help output - Enables passing complex JSON/code content via files (avoids shell escaping issues) * fix(cli): complete CLI action coverage and remove redundant test config - Fix 82+ missing CLI action handlers across all commands - Add check-cli-action-coverage.ps1 to pre-commit checks - Add check-cli-coverage.ps1 for CLI enum coverage validation - Add DataModelRelCommand for relationship operations - Remove unnecessary help_command from 7 LLM test YAMLs - Add test fixtures (CSV, JSON, M code files) for LLM tests - Update CHANGELOG with branch features * docs: update operation count to 210 across all documentation * fix(codeql): replace empty catch blocks with COMException for chart commands Changed catch { } and catch blocks to catch (COMException) in: - RegularChartStrategy.cs (8 locations) - PivotChartStrategy.cs (5 locations) - ChartCommands.Appearance.cs (5 trendline properties) These catches are intentional for optional COM property access - not all chart types support all properties. COMException is more specific than catch-all while maintaining the same behavior. * fix(ci): correct CLI build path to net10.0-windows CLI targets net10.0-windows (Window-specific COM interop), not net10.0. Fixed build-cli.yml and release.yml to use correct output path. * fix(codeql): address dispose and finally block warnings in daemon - ExcelDaemon.cs: Use try-finally for tray disposal instead of try-catch - DaemonSecurity.cs: Ensure mutex disposal on all exception paths * fix(codeql): remove redundant null checks in finally block _instanceMutex is guaranteed non-null at cleanup point (method throws if null) * fix(codeql): use explicit null check instead of null-conditional for dynamic COM Avoids CodeQL false positive about missing Quit() method on dynamic type * fix(codeql): extract TryQuitExcel helper to isolate dynamic COM invocation - Add ComUtilities.TryQuitExcel for fire-and-forget cleanup - Use helper in ExcelSession.cs instead of inline dynamic call - Centralizes dynamic COM quit pattern for easier maintenance --------- Co-authored-by: Stefan Broenner <stefan.broenner@microsoft.comm> |