mercury-agent 0.4.5
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/LICENSE +22 -0
- package/README.md +438 -0
- package/container/Dockerfile +127 -0
- package/container/Dockerfile.base +109 -0
- package/container/Dockerfile.power +17 -0
- package/container/agent-package.json +8 -0
- package/container/build.sh +54 -0
- package/docs/TODOS.md +147 -0
- package/docs/auth/dashboard.md +28 -0
- package/docs/auth/overview.md +109 -0
- package/docs/auth/whatsapp.md +173 -0
- package/docs/configuration.md +54 -0
- package/docs/container-lifecycle.md +349 -0
- package/docs/context-architecture.md +87 -0
- package/docs/deployment.md +199 -0
- package/docs/extensions.md +375 -0
- package/docs/graceful-shutdown.md +62 -0
- package/docs/kb-distillation.md +77 -0
- package/docs/media/overview.md +140 -0
- package/docs/media/whatsapp.md +171 -0
- package/docs/memory.md +137 -0
- package/docs/permissions.md +217 -0
- package/docs/pipeline.md +228 -0
- package/docs/prd-chat-memory.md +76 -0
- package/docs/prd-config-load.md +82 -0
- package/docs/rate-limiting.md +166 -0
- package/docs/scheduler.md +288 -0
- package/docs/setup-discord.md +100 -0
- package/docs/setup-slack.md +119 -0
- package/docs/setup-whatsapp.md +94 -0
- package/docs/subagents.md +166 -0
- package/docs/web-search.md +62 -0
- package/examples/extensions/README.md +12 -0
- package/examples/extensions/charts/index.ts +13 -0
- package/examples/extensions/charts/skill/SKILL.md +98 -0
- package/examples/extensions/gws/README.md +52 -0
- package/examples/extensions/gws/index.ts +106 -0
- package/examples/extensions/gws/skill/SKILL.md +57 -0
- package/examples/extensions/gws/skill/references/calendar.md +101 -0
- package/examples/extensions/gws/skill/references/docs.md +65 -0
- package/examples/extensions/gws/skill/references/drive.md +79 -0
- package/examples/extensions/gws/skill/references/gmail.md +85 -0
- package/examples/extensions/gws/skill/references/sheets.md +60 -0
- package/examples/extensions/napkin/index.ts +821 -0
- package/examples/extensions/napkin/prompts/consolidation-monthly.md +73 -0
- package/examples/extensions/napkin/prompts/consolidation-weekly.md +67 -0
- package/examples/extensions/napkin/prompts/kb-distillation.md +176 -0
- package/examples/extensions/napkin/skill/SKILL.md +728 -0
- package/examples/extensions/pdf/index.ts +23 -0
- package/examples/extensions/pdf/skill/LICENSE.txt +30 -0
- package/examples/extensions/pdf/skill/SKILL.md +314 -0
- package/examples/extensions/pdf/skill/forms.md +294 -0
- package/examples/extensions/pdf/skill/reference.md +612 -0
- package/examples/extensions/pdf/skill/scripts/check_bounding_boxes.py +65 -0
- package/examples/extensions/pdf/skill/scripts/check_fillable_fields.py +11 -0
- package/examples/extensions/pdf/skill/scripts/convert_pdf_to_images.py +33 -0
- package/examples/extensions/pdf/skill/scripts/create_validation_image.py +37 -0
- package/examples/extensions/pdf/skill/scripts/extract_form_field_info.py +122 -0
- package/examples/extensions/pdf/skill/scripts/extract_form_structure.py +115 -0
- package/examples/extensions/pdf/skill/scripts/fill_fillable_fields.py +98 -0
- package/examples/extensions/pdf/skill/scripts/fill_pdf_form_with_annotations.py +107 -0
- package/examples/extensions/permission-guard/index.ts +65 -0
- package/examples/extensions/pinchtab/index.ts +199 -0
- package/examples/extensions/pinchtab/lib/session-injector.ts +144 -0
- package/examples/extensions/pinchtab/skill/SKILL.md +224 -0
- package/examples/extensions/pinchtab/skill/TRUST.md +69 -0
- package/examples/extensions/pinchtab/skill/references/api.md +297 -0
- package/examples/extensions/pinchtab/skill/references/env.md +45 -0
- package/examples/extensions/pinchtab/skill/references/profiles.md +107 -0
- package/examples/extensions/tradestation/host/refresh.ts +102 -0
- package/examples/extensions/tradestation/index.ts +153 -0
- package/examples/extensions/tradestation/skill/SKILL.md +67 -0
- package/examples/extensions/tradestation/skill/scripts/ts-cli.ts +111 -0
- package/examples/extensions/voice-synth/index.ts +94 -0
- package/examples/extensions/voice-synth/skill/SKILL.md +38 -0
- package/examples/extensions/voice-transcribe/index.ts +381 -0
- package/examples/extensions/voice-transcribe/requirements.txt +8 -0
- package/examples/extensions/voice-transcribe/scripts/transcribe.py +179 -0
- package/examples/extensions/voice-transcribe/skill/SKILL.md +53 -0
- package/examples/extensions/web-search/index.ts +22 -0
- package/examples/extensions/web-search/skill/SKILL.md +114 -0
- package/examples/extensions/web-search/skill/references/apartments.md +178 -0
- package/examples/extensions/web-search/skill/references/car-purchase.md +132 -0
- package/examples/extensions/web-search/skill/references/car-rental.md +113 -0
- package/examples/extensions/web-search/skill/references/flights.md +133 -0
- package/examples/extensions/web-search/skill/references/hotels.md +148 -0
- package/examples/extensions/yahoo-mail/cli/bun.lock +66 -0
- package/examples/extensions/yahoo-mail/cli/package.json +13 -0
- package/examples/extensions/yahoo-mail/cli/ymail.mjs +353 -0
- package/examples/extensions/yahoo-mail/index.ts +57 -0
- package/examples/extensions/yahoo-mail/skill/SKILL.md +78 -0
- package/package.json +106 -0
- package/resources/agents/explore.md +50 -0
- package/resources/agents/worker.md +24 -0
- package/resources/builtin-extensions.txt +3 -0
- package/resources/connection-env-vars.json +25 -0
- package/resources/extensions/.gitkeep +0 -0
- package/resources/pi-extensions/subagent/agents.ts +126 -0
- package/resources/pi-extensions/subagent/index.ts +964 -0
- package/resources/profiles/coding/AGENTS.md +43 -0
- package/resources/profiles/coding/mercury-profile.yaml +15 -0
- package/resources/profiles/general/AGENTS.md +31 -0
- package/resources/profiles/general/mercury-profile.yaml +15 -0
- package/resources/profiles/research/AGENTS.md +40 -0
- package/resources/profiles/research/mercury-profile.yaml +15 -0
- package/resources/skills/config/SKILL.md +25 -0
- package/resources/skills/context/SKILL.md +33 -0
- package/resources/skills/conversation-recap/SKILL.md +19 -0
- package/resources/skills/media/SKILL.md +27 -0
- package/resources/skills/mutes/SKILL.md +31 -0
- package/resources/skills/permissions/SKILL.md +19 -0
- package/resources/skills/preferences/SKILL.md +31 -0
- package/resources/skills/recall/SKILL.md +24 -0
- package/resources/skills/roles/SKILL.md +18 -0
- package/resources/skills/spaces/SKILL.md +18 -0
- package/resources/skills/tasks/SKILL.md +45 -0
- package/resources/templates/AGENTS.md +157 -0
- package/resources/templates/env.template +34 -0
- package/resources/templates/mercury.example.yaml +75 -0
- package/src/adapters/discord-native.ts +534 -0
- package/src/adapters/discord.ts +38 -0
- package/src/adapters/setup.ts +89 -0
- package/src/adapters/slack.ts +9 -0
- package/src/adapters/whatsapp-media.ts +337 -0
- package/src/adapters/whatsapp.ts +629 -0
- package/src/agent/api-socket.ts +127 -0
- package/src/agent/container-entry.ts +967 -0
- package/src/agent/container-error.ts +49 -0
- package/src/agent/container-runner.ts +1272 -0
- package/src/agent/model-capabilities-core.ts +23 -0
- package/src/agent/model-capabilities.ts +231 -0
- package/src/agent/pi-failure-class.ts +83 -0
- package/src/agent/pi-jsonl-parser.ts +306 -0
- package/src/agent/preferences-prompt.ts +20 -0
- package/src/agent/user-error-messages.ts +78 -0
- package/src/bridges/discord.ts +171 -0
- package/src/bridges/slack.ts +177 -0
- package/src/bridges/teams.ts +160 -0
- package/src/bridges/telegram.ts +571 -0
- package/src/bridges/whatsapp.ts +290 -0
- package/src/chat-shim.ts +259 -0
- package/src/cli/mercury.ts +2508 -0
- package/src/cli/mrctl-http.ts +27 -0
- package/src/cli/mrctl.ts +611 -0
- package/src/cli/whatsapp-auth.ts +260 -0
- package/src/config-file.ts +397 -0
- package/src/config-model-chain.ts +30 -0
- package/src/config.ts +316 -0
- package/src/core/api-types.ts +58 -0
- package/src/core/api.ts +105 -0
- package/src/core/commands.ts +76 -0
- package/src/core/conversation.ts +47 -0
- package/src/core/handler.ts +206 -0
- package/src/core/media.ts +200 -0
- package/src/core/mute-duration.ts +22 -0
- package/src/core/outbox.ts +76 -0
- package/src/core/permissions.ts +192 -0
- package/src/core/profiles.ts +245 -0
- package/src/core/rate-limiter.ts +127 -0
- package/src/core/router.ts +191 -0
- package/src/core/routes/chat.ts +172 -0
- package/src/core/routes/config-builtin.ts +107 -0
- package/src/core/routes/config.ts +81 -0
- package/src/core/routes/connections.ts +190 -0
- package/src/core/routes/console.ts +668 -0
- package/src/core/routes/control.ts +46 -0
- package/src/core/routes/conversations.ts +66 -0
- package/src/core/routes/dashboard.ts +2491 -0
- package/src/core/routes/extensions.ts +37 -0
- package/src/core/routes/index.ts +14 -0
- package/src/core/routes/media.ts +72 -0
- package/src/core/routes/messages.ts +37 -0
- package/src/core/routes/mutes.ts +89 -0
- package/src/core/routes/prefs.ts +95 -0
- package/src/core/routes/roles.ts +125 -0
- package/src/core/routes/spaces.ts +60 -0
- package/src/core/routes/storage.ts +126 -0
- package/src/core/routes/tasks.ts +189 -0
- package/src/core/routes/tradestation.ts +268 -0
- package/src/core/routes/tts.ts +51 -0
- package/src/core/runtime.ts +1140 -0
- package/src/core/space-queue.ts +103 -0
- package/src/core/storage-cleanup.ts +140 -0
- package/src/core/storage-guard.ts +24 -0
- package/src/core/task-scheduler.ts +132 -0
- package/src/core/telegram-format.ts +178 -0
- package/src/core/trigger.ts +142 -0
- package/src/dashboard/index.html +729 -0
- package/src/dashboard/tokens.css +53 -0
- package/src/extensions/api.ts +252 -0
- package/src/extensions/catalog.ts +117 -0
- package/src/extensions/config-registry.ts +83 -0
- package/src/extensions/context.ts +36 -0
- package/src/extensions/hooks.ts +156 -0
- package/src/extensions/image-builder.ts +617 -0
- package/src/extensions/installer.ts +306 -0
- package/src/extensions/jobs.ts +122 -0
- package/src/extensions/loader.ts +271 -0
- package/src/extensions/permission-guard.ts +52 -0
- package/src/extensions/reserved.ts +28 -0
- package/src/extensions/skills.ts +123 -0
- package/src/extensions/types.ts +462 -0
- package/src/logger.ts +174 -0
- package/src/main.ts +586 -0
- package/src/server.ts +391 -0
- package/src/storage/db.ts +1624 -0
- package/src/storage/memory.ts +45 -0
- package/src/storage/pi-auth.ts +95 -0
- package/src/text/markdown.ts +117 -0
- package/src/text/rtl.ts +38 -0
- package/src/tradestation/host-api.ts +77 -0
- package/src/tradestation/pending-orders.ts +69 -0
- package/src/tts/azure.ts +52 -0
- package/src/tts/google.ts +128 -0
- package/src/tts/index.ts +8 -0
- package/src/tts/language.ts +20 -0
- package/src/tts/synthesize.ts +133 -0
- package/src/types.ts +295 -0
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
# Docs Reference
|
|
2
|
+
|
|
3
|
+
Use `gws docs` for reading and writing Google Docs.
|
|
4
|
+
|
|
5
|
+
## Read a document
|
|
6
|
+
|
|
7
|
+
First find the document ID from Drive:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Find document by name
|
|
11
|
+
gws drive files list --params '{"q":"name contains '\''Meeting Notes'\'' and mimeType = '\''application/vnd.google-apps.document'\''","pageSize":5}'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then export its content as plain text:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
gws drive files export --params '{"fileId":"<DOC_ID>","mimeType":"text/plain"}' --output /tmp/doc.txt
|
|
18
|
+
cat /tmp/doc.txt
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
## Summarize a document
|
|
22
|
+
|
|
23
|
+
Read the document with the export method above, then summarize the content in plain language. Never paste the raw text export as-is — always translate into a concise summary.
|
|
24
|
+
|
|
25
|
+
## Append text to a document
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gws docs +write --document <DOC_ID> --text 'New paragraph to append.'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
Text is inserted at the end of the document body. For multiline content, use `$'...'` shell quoting:
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
gws docs +write --document <DOC_ID> --text $'Line one.\nLine two.'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
## Read document metadata
|
|
38
|
+
|
|
39
|
+
```bash
|
|
40
|
+
gws docs documents get --params '{"documentId":"<DOC_ID>"}'
|
|
41
|
+
```
|
|
42
|
+
|
|
43
|
+
Useful fields: `title`, `body.content` (structured content). For plain reading, prefer the Drive export approach above.
|
|
44
|
+
|
|
45
|
+
## Raw API fallback
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
gws docs --help # list all subcommands
|
|
49
|
+
gws docs documents --help
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
For rich formatting (headings, bold, tables), use the raw `documents.batchUpdate` API:
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
gws docs documents batchUpdate \
|
|
56
|
+
--params '{"documentId":"<DOC_ID>"}' \
|
|
57
|
+
--json '{"requests":[{"insertText":{"location":{"index":1},"text":"Hello\n"}}]}'
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Output format rules
|
|
61
|
+
|
|
62
|
+
- Document found: say "I found your doc — [title]"
|
|
63
|
+
- Summary: present as a plain paragraph or bullet list of key points
|
|
64
|
+
- Append confirmation: "Added your text to '[document title]'"
|
|
65
|
+
- Never show document IDs, revision IDs, or raw JSON content structures
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
# Drive Reference
|
|
2
|
+
|
|
3
|
+
Use `gws drive` for all Google Drive operations.
|
|
4
|
+
|
|
5
|
+
## List files in root (My Drive)
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
gws drive files list --params '{"pageSize":20}'
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
Response fields to use: `name`, `mimeType`, `modifiedTime`. Never show `id` to the user — keep it for follow-up commands.
|
|
12
|
+
|
|
13
|
+
## List files in a specific folder
|
|
14
|
+
|
|
15
|
+
First get the folder ID from a `files list` call (store internally):
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
# Find folder by name
|
|
19
|
+
gws drive files list --params '{"q":"name = '\''Reports'\'' and mimeType = '\''application/vnd.google-apps.folder'\''","pageSize":5}'
|
|
20
|
+
|
|
21
|
+
# List files inside the folder
|
|
22
|
+
gws drive files list --params '{"q":"'\''<FOLDER_ID>'\'' in parents","pageSize":20}'
|
|
23
|
+
```
|
|
24
|
+
|
|
25
|
+
## Search by name
|
|
26
|
+
|
|
27
|
+
```bash
|
|
28
|
+
gws drive files list --params '{"q":"name contains '\''budget'\''","pageSize":10}'
|
|
29
|
+
```
|
|
30
|
+
|
|
31
|
+
## Upload a file
|
|
32
|
+
|
|
33
|
+
```bash
|
|
34
|
+
# Upload to root
|
|
35
|
+
gws drive +upload ./report.pdf
|
|
36
|
+
|
|
37
|
+
# Upload to a specific folder
|
|
38
|
+
gws drive +upload ./report.pdf --parent <FOLDER_ID>
|
|
39
|
+
|
|
40
|
+
# Upload with a custom name
|
|
41
|
+
gws drive +upload ./data.csv --name 'Sales Data Q1.csv'
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
## Create a folder
|
|
45
|
+
|
|
46
|
+
```bash
|
|
47
|
+
gws drive files create --json '{"name":"New Folder","mimeType":"application/vnd.google-apps.folder"}'
|
|
48
|
+
|
|
49
|
+
# Inside an existing folder
|
|
50
|
+
gws drive files create --json '{"name":"Sub Folder","mimeType":"application/vnd.google-apps.folder","parents":["<PARENT_FOLDER_ID>"]}'
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
## Move a file to a folder
|
|
54
|
+
|
|
55
|
+
```bash
|
|
56
|
+
gws drive files update --params '{"fileId":"<FILE_ID>","addParents":"<FOLDER_ID>","removeParents":"root"}'
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
## Download a file
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
gws drive files download --params '{"fileId":"<FILE_ID>"}' --output ./downloaded-file.pdf
|
|
63
|
+
|
|
64
|
+
# Export a Google Doc as plain text
|
|
65
|
+
gws drive files export --params '{"fileId":"<DOC_ID>","mimeType":"text/plain"}' --output ./doc.txt
|
|
66
|
+
```
|
|
67
|
+
|
|
68
|
+
## Raw API fallback
|
|
69
|
+
|
|
70
|
+
```bash
|
|
71
|
+
gws drive files --help # list all files subcommands
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
## Output format rules
|
|
75
|
+
|
|
76
|
+
- List files as: "1. Budget 2026 (Google Sheets) — modified 3 days ago"
|
|
77
|
+
- Translate MIME types: `application/vnd.google-apps.document` → "Google Doc", `application/vnd.google-apps.spreadsheet` → "spreadsheet", `application/vnd.google-apps.folder` → "folder", `application/pdf` → "PDF"
|
|
78
|
+
- Never show `fileId`, `parents`, or any other ID field
|
|
79
|
+
- Upload confirmation: "Uploaded report.pdf to your Drive" (or "to the Reports folder" if parent specified)
|
|
@@ -0,0 +1,85 @@
|
|
|
1
|
+
# Gmail Reference
|
|
2
|
+
|
|
3
|
+
Use `gws gmail` for all email operations. All helpers are read-only except `+send`, `+reply`, `+reply-all`, and `+forward`.
|
|
4
|
+
|
|
5
|
+
## Triage inbox
|
|
6
|
+
|
|
7
|
+
```bash
|
|
8
|
+
# Show unread messages (default: 20)
|
|
9
|
+
gws gmail +triage
|
|
10
|
+
|
|
11
|
+
# Limit count or filter by search query
|
|
12
|
+
gws gmail +triage --max 10
|
|
13
|
+
gws gmail +triage --query 'from:boss@example.com'
|
|
14
|
+
gws gmail +triage --query 'is:unread subject:invoice'
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Output fields: sender, subject, date. Never show `messageId`, `threadId`, or `labelIds`.
|
|
18
|
+
|
|
19
|
+
## Read a message
|
|
20
|
+
|
|
21
|
+
First get the message ID from `+triage` output (use internally only — never show it to the user).
|
|
22
|
+
|
|
23
|
+
```bash
|
|
24
|
+
gws gmail +read --id <MESSAGE_ID>
|
|
25
|
+
gws gmail +read --id <MESSAGE_ID> --headers # includes From, To, Subject, Date
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Present: sender name, subject, date, and a plain-text summary of the body.
|
|
29
|
+
|
|
30
|
+
## Send a new email
|
|
31
|
+
|
|
32
|
+
```bash
|
|
33
|
+
gws gmail +send --to alice@example.com --subject 'Hello' --body 'Hi Alice!'
|
|
34
|
+
|
|
35
|
+
# With CC / BCC
|
|
36
|
+
gws gmail +send --to alice@example.com --subject 'Report' --body 'See attached' \
|
|
37
|
+
--cc bob@example.com --bcc charlie@example.com
|
|
38
|
+
|
|
39
|
+
# With attachment
|
|
40
|
+
gws gmail +send --to alice@example.com --subject 'Report' --body 'Attached.' -a report.pdf
|
|
41
|
+
|
|
42
|
+
# Save as draft first, then confirm with user before sending
|
|
43
|
+
gws gmail +send --to alice@example.com --subject 'Hello' --body 'Hi!' --draft
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
Always confirm recipient and subject with the user before sending.
|
|
47
|
+
|
|
48
|
+
## Reply to a message
|
|
49
|
+
|
|
50
|
+
```bash
|
|
51
|
+
gws gmail +reply --message-id <MESSAGE_ID> --body 'Thanks, got it!'
|
|
52
|
+
|
|
53
|
+
# Reply-all
|
|
54
|
+
gws gmail +reply-all --message-id <MESSAGE_ID> --body 'Noted — will follow up.'
|
|
55
|
+
```
|
|
56
|
+
|
|
57
|
+
Handles threading (In-Reply-To, References) automatically.
|
|
58
|
+
|
|
59
|
+
## Forward a message
|
|
60
|
+
|
|
61
|
+
```bash
|
|
62
|
+
gws gmail +forward --message-id <MESSAGE_ID> --to dave@example.com
|
|
63
|
+
gws gmail +forward --message-id <MESSAGE_ID> --to dave@example.com --body 'FYI see below'
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
## Raw API fallback
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
# List messages with custom query
|
|
70
|
+
gws gmail users messages list --params '{"userId":"me","q":"is:unread","maxResults":10}'
|
|
71
|
+
|
|
72
|
+
# Get message metadata
|
|
73
|
+
gws gmail users messages get --params '{"userId":"me","id":"<MESSAGE_ID>","format":"metadata"}'
|
|
74
|
+
|
|
75
|
+
# Modify labels (e.g. archive = remove INBOX label)
|
|
76
|
+
gws gmail users messages modify --params '{"userId":"me","id":"<MESSAGE_ID>"}' \
|
|
77
|
+
--json '{"removeLabelIds":["INBOX"]}'
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
## Output format rules
|
|
81
|
+
|
|
82
|
+
- Show sender name and subject; never show `messageId`, `threadId`, or `labelIds`
|
|
83
|
+
- Present a triage summary as a numbered list: "1. From Alice — Re: Invoice (2 hours ago)"
|
|
84
|
+
- For send/reply confirmations: "Sent to Alice — subject: Hello"
|
|
85
|
+
- Errors: say "I couldn't send the email" — never show HTTP status codes or API error objects
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
# Sheets Reference
|
|
2
|
+
|
|
3
|
+
Use `gws sheets` for reading and writing Google Sheets.
|
|
4
|
+
|
|
5
|
+
## Read values from a spreadsheet
|
|
6
|
+
|
|
7
|
+
First find the spreadsheet ID from Drive (store internally — never show to user):
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
# Find spreadsheet by name
|
|
11
|
+
gws drive files list --params '{"q":"name contains '\''Budget'\'' and mimeType = '\''application/vnd.google-apps.spreadsheet'\''","pageSize":5}'
|
|
12
|
+
```
|
|
13
|
+
|
|
14
|
+
Then read a range:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
# Read a named range or A1 notation
|
|
18
|
+
gws sheets +read --spreadsheet <SPREADSHEET_ID> --range 'Sheet1!A1:D10'
|
|
19
|
+
|
|
20
|
+
# Read an entire sheet (by tab name)
|
|
21
|
+
gws sheets +read --spreadsheet <SPREADSHEET_ID> --range Sheet1
|
|
22
|
+
```
|
|
23
|
+
|
|
24
|
+
Present the data as a plain summary or a simple list — not as a raw JSON array.
|
|
25
|
+
|
|
26
|
+
## Append a row
|
|
27
|
+
|
|
28
|
+
```bash
|
|
29
|
+
# Simple comma-separated values (single row)
|
|
30
|
+
gws sheets +append --spreadsheet <SPREADSHEET_ID> --values 'Alice,100,true'
|
|
31
|
+
|
|
32
|
+
# Multiple rows (JSON array of arrays)
|
|
33
|
+
gws sheets +append --spreadsheet <SPREADSHEET_ID> \
|
|
34
|
+
--json-values '[["Alice","100","true"],["Bob","200","false"]]'
|
|
35
|
+
```
|
|
36
|
+
|
|
37
|
+
Values are appended after the last row that contains data.
|
|
38
|
+
|
|
39
|
+
## Read all data and summarize
|
|
40
|
+
|
|
41
|
+
```bash
|
|
42
|
+
gws sheets +read --spreadsheet <SPREADSHEET_ID> --range Sheet1 --format table
|
|
43
|
+
```
|
|
44
|
+
|
|
45
|
+
Parse the table output to provide a plain-language summary (e.g. "The sheet has 42 rows. The highest value in column B is 250.").
|
|
46
|
+
|
|
47
|
+
## Raw API fallback
|
|
48
|
+
|
|
49
|
+
```bash
|
|
50
|
+
gws sheets spreadsheets get --params '{"spreadsheetId":"<SPREADSHEET_ID>"}' # metadata + sheet names
|
|
51
|
+
gws sheets spreadsheets values get --params '{"spreadsheetId":"<SPREADSHEET_ID>","range":"Sheet1!A1:Z100"}'
|
|
52
|
+
gws sheets --help # list all subcommands
|
|
53
|
+
```
|
|
54
|
+
|
|
55
|
+
## Output format rules
|
|
56
|
+
|
|
57
|
+
- Read results: present as a short prose summary or a simple list — never paste raw JSON arrays
|
|
58
|
+
- Append confirmation: "Added a row to '[spreadsheet name]'"
|
|
59
|
+
- Never show spreadsheet IDs, sheet GIDs, or raw cell object structures
|
|
60
|
+
- If the range is empty, say "That range appears to be empty"
|