Skip to content

feat(notebooks): add cells append command for cell-level operations#64

Closed
majorgreys wants to merge 1 commit intomainfrom
feat/notebooks-append-cells
Closed

feat(notebooks): add cells append command for cell-level operations#64
majorgreys wants to merge 1 commit intomainfrom
feat/notebooks-append-cells

Conversation

@majorgreys
Copy link
Contributor

@majorgreys majorgreys commented Feb 14, 2026

Summary

  • Adds notebooks cells append subcommand that appends individual cells to an existing notebook
  • Supports three cell types via simplified JSON: markdown, metric, and logs

Changes

  • cmd/notebooks.go: Add cells subcommand group with append command, simplified cell types, cell builders for markdown/metric/logs, time parser, and append loop with partial failure handling
  • cmd/notebooks_test.go: Add 15 new tests covering command structure, cell building, time parsing, validation errors, and runtime behavior
  • docs/COMMANDS.md: Update notebooks entry to reflect new capabilities

Usage

# Append a markdown cell
echo '{"cells":[{"type":"markdown","data":"# Investigation Notes\nService latency spike observed."}]}' | \
  pup notebooks cells append 12345 --body -

# Append a metric graph from file
cat <<JSON > cells.json
{"cells":[
  {"type":"metric","data":"avg:system.cpu.user{*}","title":"CPU Usage",
   "start":"2025-02-14T00:00:00Z","end":"2025-02-14T01:00:00Z"},
  {"type":"logs","data":"service:api status:error","title":"API Errors"}
]}
JSON
pup notebooks cells append 12345 --body @cells.json

Design Notes

  • All cells are validated before any API calls to prevent partial failures
  • Metric cells default to timeseries line graphs; logs cells default to log stream with timestamp/host/service/message columns

Test plan

  • go build ./... passes
  • go test ./cmd/ -run "TestNotebooks|TestBuildCell|TestParseCellTimes" -v — 25 tests pass
  • go test ./... -race — all tests pass
  • go vet ./... — clean

🤖 Generated with Claude Code

@majorgreys majorgreys requested a review from a team as a code owner February 14, 2026 22:05
@majorgreys majorgreys marked this pull request as draft February 14, 2026 22:06
Add `notebooks cells append` subcommand that appends individual cells
to an existing notebook using the internal /api/v1/notebooks/{id}/cells
endpoint, matching the Datadog MCP server's cell-level operations.

Supports three cell types via simplified JSON format:
- markdown: text content with Markdown formatting
- metric: timeseries graphs with Datadog metrics query language
- logs: log stream widgets with Datadog logs query language

Cells are validated before any API calls to prevent partial failures.
Error messages distinguish between full and partial append failures
when sending multiple cells.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@majorgreys majorgreys force-pushed the feat/notebooks-append-cells branch from 4168ab9 to b91f052 Compare February 14, 2026 22:09
@majorgreys majorgreys closed this Feb 14, 2026
@majorgreys majorgreys deleted the feat/notebooks-append-cells branch February 14, 2026 22:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant