gws-axi 0.15.0 → 0.16.0
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/README.md +24 -4
- package/dist/src/auth/scopes.d.ts +1 -0
- package/dist/src/auth/scopes.js +3 -1
- package/dist/src/auth/scopes.js.map +1 -1
- package/dist/src/cli.d.ts +1 -1
- package/dist/src/cli.js +5 -3
- package/dist/src/cli.js.map +1 -1
- package/dist/src/commands/docs/comments.d.ts +12 -1
- package/dist/src/commands/docs/comments.js +9 -6
- package/dist/src/commands/docs/comments.js.map +1 -1
- package/dist/src/commands/sheets/read.d.ts +108 -0
- package/dist/src/commands/sheets/read.js +525 -0
- package/dist/src/commands/sheets/read.js.map +1 -0
- package/dist/src/commands/sheets/read.test.d.ts +1 -0
- package/dist/src/commands/sheets/read.test.js +218 -0
- package/dist/src/commands/sheets/read.test.js.map +1 -0
- package/dist/src/commands/sheets.d.ts +2 -0
- package/dist/src/commands/sheets.js +129 -0
- package/dist/src/commands/sheets.js.map +1 -0
- package/dist/src/commands/slides/page.d.ts +1 -1
- package/dist/src/commands/slides/page.js +8 -3
- package/dist/src/commands/slides/page.js.map +1 -1
- package/dist/src/commands/slides/summarize.d.ts +1 -1
- package/dist/src/commands/slides/summarize.js +10 -0
- package/dist/src/commands/slides/summarize.js.map +1 -1
- package/dist/src/commands/slides/text.d.ts +25 -1
- package/dist/src/commands/slides/text.js +88 -20
- package/dist/src/commands/slides/text.js.map +1 -1
- package/dist/src/commands/slides/text.test.d.ts +1 -0
- package/dist/src/commands/slides/text.test.js +77 -0
- package/dist/src/commands/slides/text.test.js.map +1 -0
- package/dist/src/commands/slides.js +26 -0
- package/dist/src/commands/slides.js.map +1 -1
- package/dist/src/google/client.d.ts +2 -1
- package/dist/src/google/client.js +4 -0
- package/dist/src/google/client.js.map +1 -1
- package/dist/src/google/probe.js +22 -2
- package/dist/src/google/probe.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
# gws-axi
|
|
2
2
|
|
|
3
|
-
Agent-ergonomic CLI for Google Workspace — Gmail, Calendar, Docs, Drive, and
|
|
3
|
+
Agent-ergonomic CLI for Google Workspace — Gmail, Calendar, Docs, Drive, Slides, and Sheets behind a single command, built to the [AXI standard](https://axi.md): [TOON](https://toonformat.dev/)-formatted output, contextual next-step suggestions, idempotent mutations, and multi-account safety by default.
|
|
4
4
|
|
|
5
5
|
Designed for use by AI agents. Every response is structured, every error names a specific fix, and write operations lock to the explicit account when multiple are authenticated — so two agents in parallel sessions can't silently touch the wrong mailbox.
|
|
6
6
|
|
|
7
7
|
## Status
|
|
8
8
|
|
|
9
|
-
Read coverage is complete across all
|
|
9
|
+
Read coverage is complete across all six services; write coverage is rolling out service by service.
|
|
10
10
|
|
|
11
11
|
| Service | Reads | Writes |
|
|
12
12
|
| --- | --- | --- |
|
|
@@ -14,7 +14,8 @@ Read coverage is complete across all five services; write coverage is rolling ou
|
|
|
14
14
|
| **Gmail** | ✅ search · read · labels · download | ✅ triage · draft · labels · filters · ✋ `send` out of scope |
|
|
15
15
|
| **Docs** | ✅ read · find · comments · download · revisions · diff | 🚧 append · insert-text · delete-range |
|
|
16
16
|
| **Drive** | ✅ ls · get · search · permissions · download · revisions · activity | 🟡 upload · mkdir · 🚧 create · copy · move · rename · delete |
|
|
17
|
-
| **Slides** | ✅ get · page · summarize | 🚧 create · update |
|
|
17
|
+
| **Slides** | ✅ get · page · summarize · comments | 🚧 create · update |
|
|
18
|
+
| **Sheets** | ✅ read · comments | 🚧 update · append · clear · create · add-tab |
|
|
18
19
|
|
|
19
20
|
<sub>✅ shipped · 🟡 partial · 🚧 planned · ✋ out of scope by design</sub>
|
|
20
21
|
|
|
@@ -87,7 +88,7 @@ To make sure agents reach for `gws-axi` instead of stale alternatives, also cons
|
|
|
87
88
|
```markdown
|
|
88
89
|
## Google Workspace
|
|
89
90
|
|
|
90
|
-
Use `gws-axi` for ALL Google Calendar, Gmail, Docs, Drive, and
|
|
91
|
+
Use `gws-axi` for ALL Google Calendar, Gmail, Docs, Drive, Slides, and Sheets
|
|
91
92
|
interactions. Check the SessionStart `gws-axi` line for current auth
|
|
92
93
|
state; run `gws-axi --help` for the command surface. Prefer this over
|
|
93
94
|
any other Google integrations.
|
|
@@ -241,8 +242,26 @@ gws-axi drive upload ./edited.md --convert --update <docId> --account you@exampl
|
|
|
241
242
|
gws-axi slides get <presentationId> # deck metadata + slide list
|
|
242
243
|
gws-axi slides page <presentationId> <slideId> # one slide's content
|
|
243
244
|
gws-axi slides summarize <presentationId> # all slides condensed to text per slide
|
|
245
|
+
gws-axi slides comments <presentationId> # review comments (Drive comments)
|
|
244
246
|
```
|
|
245
247
|
|
|
248
|
+
<sub>Embedded hyperlinks in slide text resolve inline as markdown `[text](url)` (with `links_resolved: N` in the header); images/videos are counted, not inlined.</sub>
|
|
249
|
+
|
|
250
|
+
### Sheets
|
|
251
|
+
|
|
252
|
+
A spreadsheet's tabs are its sheets, so `sheets read` mirrors `docs read`: it lists the tabs, and renders one tab's grid into context. Embedded links resolve inline as markdown `[text](url)`; cell notes come back in a `notes[]` block.
|
|
253
|
+
|
|
254
|
+
```bash
|
|
255
|
+
gws-axi sheets read <spreadsheetId> # single tab renders; multi-tab lists tabs to pick
|
|
256
|
+
gws-axi sheets read <spreadsheetId> --tab Costs # by tab title (or numeric gid)
|
|
257
|
+
gws-axi sheets read <spreadsheetId> --tab Costs --range A1:D50 # scope to an A1 range
|
|
258
|
+
gws-axi sheets read <spreadsheetId> --header-row # promote row 1 to column names (auto for a frozen top row; --raw to force letters)
|
|
259
|
+
gws-axi sheets read <spreadsheetId> --tab Costs --full # don't cap at 50 rows
|
|
260
|
+
gws-axi sheets comments <spreadsheetId> # review comments (Drive comments)
|
|
261
|
+
```
|
|
262
|
+
|
|
263
|
+
<sub>Cell values are the displayed strings (not formulas). The new `spreadsheets` scope means existing accounts must `gws-axi auth login` once.</sub>
|
|
264
|
+
|
|
246
265
|
### Multi-account with write protection
|
|
247
266
|
|
|
248
267
|
gws-axi supports multiple Google accounts under one OAuth client. When two or more are authenticated, write operations require `--account <email>` explicitly — silent wrong-account mutations are impossible:
|
|
@@ -279,6 +298,7 @@ help[2]:
|
|
|
279
298
|
- **Docs writes** (`append`, `insert-text`, `delete-range`, etc.): scaffolded as `NOT_IMPLEMENTED`. The next frontier.
|
|
280
299
|
- **Drive writes**: `upload` and `mkdir` are shipped; `create` / `copy` / `move` / `rename` / `delete` are still scaffolded as `NOT_IMPLEMENTED`.
|
|
281
300
|
- **Slides writes**: still scaffolded as `NOT_IMPLEMENTED` (reads are complete).
|
|
301
|
+
- **Sheets writes** (`update`, `append`, `clear`, `create`, `add-tab`): scaffolded as `NOT_IMPLEMENTED`; `read` (with inline-markdown links + cell notes) and `comments` are shipped.
|
|
282
302
|
- **Testing-mode tokens** still expire every 7 days *if* you haven't published your OAuth app yet. Run `gws-axi auth publish` for the walkthrough — it covers the single-developer Production flow and removes the expiry once you've re-auth'd each account.
|
|
283
303
|
|
|
284
304
|
## Contributing
|
|
@@ -5,6 +5,7 @@ export declare const SERVICE_SCOPES: {
|
|
|
5
5
|
readonly docs: "https://www.googleapis.com/auth/documents";
|
|
6
6
|
readonly drive: "https://www.googleapis.com/auth/drive";
|
|
7
7
|
readonly slides: "https://www.googleapis.com/auth/presentations";
|
|
8
|
+
readonly sheets: "https://www.googleapis.com/auth/spreadsheets";
|
|
8
9
|
};
|
|
9
10
|
export type ServiceName = keyof typeof SERVICE_SCOPES;
|
|
10
11
|
export interface AdditionalScope {
|
package/dist/src/auth/scopes.js
CHANGED
|
@@ -5,6 +5,7 @@ export const SERVICE_SCOPES = {
|
|
|
5
5
|
docs: "https://www.googleapis.com/auth/documents",
|
|
6
6
|
drive: "https://www.googleapis.com/auth/drive",
|
|
7
7
|
slides: "https://www.googleapis.com/auth/presentations",
|
|
8
|
+
sheets: "https://www.googleapis.com/auth/spreadsheets",
|
|
8
9
|
};
|
|
9
10
|
export const ADDITIONAL_SCOPE_INFO = [
|
|
10
11
|
{
|
|
@@ -21,13 +22,14 @@ export const ADDITIONAL_SCOPE_INFO = [
|
|
|
21
22
|
},
|
|
22
23
|
];
|
|
23
24
|
export const ADDITIONAL_SCOPES = ADDITIONAL_SCOPE_INFO.map((s) => s.scope);
|
|
24
|
-
export const SERVICES = ["gmail", "calendar", "docs", "drive", "slides"];
|
|
25
|
+
export const SERVICES = ["gmail", "calendar", "docs", "drive", "slides", "sheets"];
|
|
25
26
|
export const REQUIRED_APIS = {
|
|
26
27
|
gmail: "gmail.googleapis.com",
|
|
27
28
|
calendar: "calendar-json.googleapis.com",
|
|
28
29
|
docs: "docs.googleapis.com",
|
|
29
30
|
drive: "drive.googleapis.com",
|
|
30
31
|
slides: "slides.googleapis.com",
|
|
32
|
+
sheets: "sheets.googleapis.com",
|
|
31
33
|
};
|
|
32
34
|
// APIs required beyond the per-service REQUIRED_APIS map. The Drive Activity
|
|
33
35
|
// API is a distinct service backing the `drive activity` command — it must be
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../../src/auth/scopes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,8CAA8C;IACrD,QAAQ,EAAE,0CAA0C;IACpD,IAAI,EAAE,2CAA2C;IACjD,KAAK,EAAE,uCAAuC;IAC9C,MAAM,EAAE,+CAA+C;
|
|
1
|
+
{"version":3,"file":"scopes.js","sourceRoot":"","sources":["../../../src/auth/scopes.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,CAAC,QAAQ,EAAE,OAAO,EAAE,SAAS,CAAU,CAAC;AAEnE,MAAM,CAAC,MAAM,cAAc,GAAG;IAC5B,KAAK,EAAE,8CAA8C;IACrD,QAAQ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/D,CAAC"}
|
package/dist/src/cli.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const TOP_HELP = "usage: gws-axi [command] [args] [flags]\ncommands[
|
|
1
|
+
export declare const TOP_HELP = "usage: gws-axi [command] [args] [flags]\ncommands[10]:\n (none)=home, auth, doctor, calendar, gmail, docs, drive, slides, sheets, setup\nflags[2]:\n --help, -v/-V/--version\nexamples:\n gws-axi\n gws-axi auth setup\n gws-axi doctor\n gws-axi calendar events\n gws-axi setup hooks\n";
|
|
2
2
|
export declare function main(): Promise<void>;
|
package/dist/src/cli.js
CHANGED
|
@@ -10,12 +10,13 @@ import { gmailCommand } from "./commands/gmail.js";
|
|
|
10
10
|
import { docsCommand } from "./commands/docs.js";
|
|
11
11
|
import { driveCommand } from "./commands/drive.js";
|
|
12
12
|
import { slidesCommand } from "./commands/slides.js";
|
|
13
|
+
import { sheetsCommand } from "./commands/sheets.js";
|
|
13
14
|
import { setupCommand, SETUP_HELP } from "./commands/setup.js";
|
|
14
|
-
const DESCRIPTION = "Agent ergonomic CLI for Google Workspace. Unified interface for Gmail, Calendar, Docs, Drive, and
|
|
15
|
+
const DESCRIPTION = "Agent ergonomic CLI for Google Workspace. Unified interface for Gmail, Calendar, Docs, Drive, Slides, and Sheets with agent-guided OAuth setup.";
|
|
15
16
|
const VERSION = readPackageVersion();
|
|
16
17
|
export const TOP_HELP = `usage: gws-axi [command] [args] [flags]
|
|
17
|
-
commands[
|
|
18
|
-
(none)=home, auth, doctor, calendar, gmail, docs, drive, slides, setup
|
|
18
|
+
commands[10]:
|
|
19
|
+
(none)=home, auth, doctor, calendar, gmail, docs, drive, slides, sheets, setup
|
|
19
20
|
flags[2]:
|
|
20
21
|
--help, -v/-V/--version
|
|
21
22
|
examples:
|
|
@@ -47,6 +48,7 @@ export async function main() {
|
|
|
47
48
|
docs: docsCommand,
|
|
48
49
|
drive: driveCommand,
|
|
49
50
|
slides: slidesCommand,
|
|
51
|
+
sheets: sheetsCommand,
|
|
50
52
|
setup: setupCommand,
|
|
51
53
|
},
|
|
52
54
|
getCommandHelp: (command) => COMMAND_HELP[command],
|
package/dist/src/cli.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,WAAW,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC5D,OAAO,EAAE,aAAa,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAClE,OAAO,EAAE,eAAe,EAAE,MAAM,wBAAwB,CAAC;AACzD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,WAAW,EAAE,MAAM,oBAAoB,CAAC;AACjD,OAAO,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,sBAAsB,CAAC;AACrD,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,MAAM,qBAAqB,CAAC;AAE/D,MAAM,WAAW,GACf,
|
|
1
|
+
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../../src/cli.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AACnD,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,EAAE,MAAM,YAAY,CAAC;AACvC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AE,aAAa;YACrB,KAAK,EAAE,YAAY;SACpB;QACD,cAAc,EAAE,CAAC,OAAO,EAAE,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC;KACnD,CAAC,CAAC;AACL,CAAC;AAED,SAAS,kBAAkB;IACzB,MAAM,IAAI,GAAG,OAAO,CAAC,aAAa,CAAC,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC;IAErD,KAAK,MAAM,SAAS,IAAI;QACtB,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC;QAChC,IAAI,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,EAAE,cAAc,CAAC;KACvC,EAAE,CAAC;QACF,IAAI,CAAC,UAAU,CAAC,SAAS,CAAC,EAAE,CAAC;YAC3B,SAAS;QACX,CAAC;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,YAAY,CAAC,SAAS,EAAE,OAAO,CAAC,CAEzD,CAAC;QACF,IAAI,OAAO,MAAM,CAAC,OAAO,KAAK,QAAQ,IAAI,MAAM,CAAC,OAAO,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;YACpE,OAAO,MAAM,CAAC,OAAO,CAAC;QACxB,CAAC;IACH,CAAC;IAED,MAAM,IAAI,KAAK,CAAC,6CAA6C,CAAC,CAAC;AACjE,CAAC"}
|
|
@@ -1,2 +1,13 @@
|
|
|
1
1
|
export declare const COMMENTS_HELP = "usage: gws-axi docs comments <documentId> [flags]\nargs[1]:\n <documentId> The Google Doc ID (from the URL after /d/)\nflags[4]:\n --include-resolved Also show comments that have been resolved\n --full Don't truncate comment/reply bodies (default cap: 500 chars)\n --limit <n> Max comments to return (default: 50)\n --account <email> Account override when 2+ are configured\nexamples:\n gws-axi docs comments 1BxAbc...\n gws-axi docs comments 1BxAbc... --include-resolved --full\noutput:\n A `comments[N]{id,author,created,resolved,quoted_content,body,reply_count}`\n list and (when any comment has replies) a sibling `replies[N]{comment,author,created,body}`\n table keyed by parent comment id. Bodies and quoted_content are truncated\n at 500 chars unless --full is passed.\nnotes:\n `quoted_content` is the exact text in the doc that the comment is anchored\n to \u2014 important for agents to know what the comment is *about*. Comments\n without an anchor (overall-document comments) will have an empty value.\n";
|
|
2
|
-
|
|
2
|
+
/**
|
|
3
|
+
* Options for aliasing this Drive-comments handler onto another resource type
|
|
4
|
+
* (e.g. `sheets comments`). Drive comments are file-type-agnostic, so the only
|
|
5
|
+
* per-service differences are cosmetic: the header label and the not-found code.
|
|
6
|
+
*/
|
|
7
|
+
export interface CommentsOptions {
|
|
8
|
+
/** Header/message noun, e.g. "document" (default) or "spreadsheet". */
|
|
9
|
+
resource?: string;
|
|
10
|
+
/** Domain error code for a 404, e.g. "DOCUMENT_NOT_FOUND" (default). */
|
|
11
|
+
notFoundCode?: string;
|
|
12
|
+
}
|
|
13
|
+
export declare function docsCommentsCommand(account: string, args: string[], opts?: CommentsOptions): Promise<string>;
|
|
@@ -91,7 +91,10 @@ function replySchema(truncateAt) {
|
|
|
91
91
|
},
|
|
92
92
|
];
|
|
93
93
|
}
|
|
94
|
-
export async function docsCommentsCommand(account, args) {
|
|
94
|
+
export async function docsCommentsCommand(account, args, opts = {}) {
|
|
95
|
+
const resource = opts.resource ?? "document";
|
|
96
|
+
const Resource = resource.charAt(0).toUpperCase() + resource.slice(1);
|
|
97
|
+
const notFoundCode = opts.notFoundCode ?? "DOCUMENT_NOT_FOUND";
|
|
95
98
|
const flags = parseFlags(args);
|
|
96
99
|
const api = await driveClient(account);
|
|
97
100
|
let data;
|
|
@@ -112,9 +115,9 @@ export async function docsCommentsCommand(account, args) {
|
|
|
112
115
|
operation: "drive.comments.list",
|
|
113
116
|
});
|
|
114
117
|
if (translated.code === "NOT_FOUND") {
|
|
115
|
-
throw new AxiError(
|
|
116
|
-
`Verify the
|
|
117
|
-
`Confirm ${account} has at least view access to the
|
|
118
|
+
throw new AxiError(`${Resource} '${flags.documentId}' not found (or ${account} doesn't have access)`, notFoundCode, [
|
|
119
|
+
`Verify the ${resource} ID is correct (the portion of the URL after /d/)`,
|
|
120
|
+
`Confirm ${account} has at least view access to the ${resource}`,
|
|
118
121
|
]);
|
|
119
122
|
}
|
|
120
123
|
throw translated;
|
|
@@ -138,13 +141,13 @@ export async function docsCommentsCommand(account, args) {
|
|
|
138
141
|
body: r.content ?? "",
|
|
139
142
|
})));
|
|
140
143
|
const blocks = [];
|
|
141
|
-
blocks.push(renderObject({ account,
|
|
144
|
+
blocks.push(renderObject({ account, [resource]: flags.documentId }));
|
|
142
145
|
if (commentRows.length === 0) {
|
|
143
146
|
// AXI canonical empty-list: collapse to a scalar message under the
|
|
144
147
|
// same field name (rather than `comments[0]:` + `message:` sibling).
|
|
145
148
|
blocks.push(renderObject({
|
|
146
149
|
comments: flags.includeResolved
|
|
147
|
-
?
|
|
150
|
+
? `no comments on this ${resource}`
|
|
148
151
|
: "no open comments (pass --include-resolved to include resolved)",
|
|
149
152
|
}));
|
|
150
153
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"comments.js","sourceRoot":"","sources":["../../../../src/commands/docs/comments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EACL,KAAK,EACL,UAAU,EACV,UAAU,EACV,UAAU,EACV,YAAY,GAEb,MAAM,uBAAuB,CAAC;AAE/B,MAAM,CAAC,MAAM,aAAa,GAAG;;;;;;;;;;;;;;;;;;;;CAoB5B,CAAC;AAEF,MAAM,aAAa,GAAG,EAAE,CAAC;AACzB,MAAM,aAAa,GAAG,GAAG,CAAC;AAS1B,SAAS,UAAU,CAAC,IAAc;IAChC,IAAI,UAA8B,CAAC;IACnC,IAAI,eAAe,GAAG,KAAK,CAAC;IAC5B,IAAI,IAAI,GAAG,KAAK,CAAC;IACjB,IAAI,KAAK,GAAG,aAAa,CAAC;IAC1B,KAAK,IA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ACpF,CAAC;QACF,IAAI,aAAa,EAAE,CAAC;YAClB,WAAW,CAAC,IAAI,CAAC,oDAAoD,CAAC,CAAC;QACzE,CAAC;IACH,CAAC;IAED,IAAI,WAAW,CAAC,MAAM,GAAG,CAAC;QAAE,MAAM,CAAC,IAAI,CAAC,UAAU,CAAC,WAAW,CAAC,CAAC,CAAC;IAEjE,OAAO,UAAU,CAAC,GAAG,MAAM,CAAC,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
import { type FieldDef } from "../../output/index.js";
|
|
2
|
+
export declare const READ_HELP = "usage: gws-axi sheets read <spreadsheetId> [flags]\nargs[1]:\n <spreadsheetId> The spreadsheet ID (the portion of the URL after /d/)\nflags[7]:\n --tab <name|gid> Tab to render (by title or numeric sheetId). Omit for a\n single-tab file; required to pick one in a multi-tab file\n --range <A1> Restrict to an A1 range within the tab (e.g. A1:D50). A\n tab-qualified range (Costs!A1:D50) makes --tab optional\n --header-row Force-promote the first fetched row to column names\n (rows[N]{\u2026}) instead of the A1 column-letter grid\n --raw Force the A1 column-letter grid, overriding header\n auto-detection\n --full Don't cap rendered rows (default cap: 50)\n --max-rows <n> Override the 50-row render cap (ignored with --full)\n --account <email> Account override when 2+ are configured\nexamples:\n gws-axi sheets read 1AbC...\n gws-axi sheets read 1AbC... --tab Costs\n gws-axi sheets read 1AbC... --tab Costs --range A1:D50\n gws-axi sheets read 1AbC... --tab Costs --header-row\noutput:\n A `spreadsheet{id,title,tab?,tab_count?}` header, a `sheets[N]{gid,title,\n index,rows,cols}` tabs listing (always shown), and \u2014 when a tab is selected \u2014\n a `cells[N]{row,A,B,\u2026}` grid (real sheet row numbers + A1 column letters).\n Embedded links are resolved inline as markdown `[text](url)` in the cells;\n cell notes come back in a `notes[N]{cell,note}` block. Multi-tab files\n without --tab return only the tabs listing so you can pick one.\nnotes:\n A single frozen top row is auto-promoted to column names (header_source:\n frozen-row in the output); pass --raw to override, or --header-row to force\n promotion when no row is frozen.\n Cell values are FORMATTED_VALUE (displayed strings), not formulas/raw numbers.\n For review comments use `gws-axi sheets comments <id>` (Drive comments).\n Operates on native Google Sheets only; uploaded .xlsx/.csv route to Drive.\n";
|
|
3
|
+
/**
|
|
4
|
+
* Decide whether to promote the first fetched row to column names. Explicit
|
|
5
|
+
* flags win; otherwise a single frozen top row (a user-declared header) inside
|
|
6
|
+
* the fetched window auto-promotes. Multi-row frozen headers are left as-is —
|
|
7
|
+
* promoting only the first of several would misrepresent the data.
|
|
8
|
+
*/
|
|
9
|
+
export declare function resolveHeaderMode(opts: {
|
|
10
|
+
explicitHeader: boolean;
|
|
11
|
+
explicitRaw: boolean;
|
|
12
|
+
frozenRows: number;
|
|
13
|
+
originRow1: number;
|
|
14
|
+
}): {
|
|
15
|
+
headerRow: boolean;
|
|
16
|
+
auto: boolean;
|
|
17
|
+
};
|
|
18
|
+
/** 0-based column index → A1 column letter (0→A, 25→Z, 26→AA). */
|
|
19
|
+
export declare function columnLetter(index0: number): string;
|
|
20
|
+
/** A1 column letters → 0-based column index (A→0, Z→25, AA→26). */
|
|
21
|
+
export declare function columnIndex(letters: string): number;
|
|
22
|
+
export interface RangeOrigin {
|
|
23
|
+
col0: number;
|
|
24
|
+
row1: number;
|
|
25
|
+
}
|
|
26
|
+
/**
|
|
27
|
+
* Parse the top-left origin of a `values.get` range echo. Handles a bare range
|
|
28
|
+
* (`C5:E9`), a tab-qualified range (`Costs!C5:E9`), quoted titles that may
|
|
29
|
+
* contain `!` (`'My Sheet!x'!A1:B2`), absolute refs (`$C$5`), and open-ended
|
|
30
|
+
* ranges (`Costs!A:D` → row 1; `Costs!5:9` → col A). Falls back to A1 when the
|
|
31
|
+
* origin can't be determined, so a parse miss degrades to a safe default rather
|
|
32
|
+
* than mis-addressing.
|
|
33
|
+
*/
|
|
34
|
+
export declare function parseRangeOrigin(range: string | undefined | null): RangeOrigin;
|
|
35
|
+
export interface GridRender {
|
|
36
|
+
/** Row objects ready for renderList. */
|
|
37
|
+
rows: Array<Record<string, unknown>>;
|
|
38
|
+
/** Column schema for renderList. */
|
|
39
|
+
schema: FieldDef[];
|
|
40
|
+
/** Field name for the rendered list (`cells` or `rows`). */
|
|
41
|
+
listName: string;
|
|
42
|
+
/** Total data rows available (before the render cap). */
|
|
43
|
+
totalRows: number;
|
|
44
|
+
/** Whether the render was capped below totalRows. */
|
|
45
|
+
truncated: boolean;
|
|
46
|
+
}
|
|
47
|
+
/**
|
|
48
|
+
* Turn a `values.get` 2D array into row objects + a matching TOON schema.
|
|
49
|
+
*
|
|
50
|
+
* Default: `cells[N]{row,A,B,…}` — real sheet row numbers, A1 column letters
|
|
51
|
+
* from `origin`, ragged rows padded to the widest row.
|
|
52
|
+
* With `headerRow`: the first fetched row becomes the column names (`rows[N]{…}`),
|
|
53
|
+
* the `row` column is dropped, and duplicate/empty headers fall back to letters.
|
|
54
|
+
*/
|
|
55
|
+
export declare function buildGrid(values: unknown[][], origin: RangeOrigin, opts: {
|
|
56
|
+
headerRow: boolean;
|
|
57
|
+
maxRows: number;
|
|
58
|
+
full: boolean;
|
|
59
|
+
}): GridRender;
|
|
60
|
+
export interface GridCellLike {
|
|
61
|
+
formattedValue?: string | null;
|
|
62
|
+
hyperlink?: string | null;
|
|
63
|
+
note?: string | null;
|
|
64
|
+
textFormatRuns?: Array<{
|
|
65
|
+
startIndex?: number | null;
|
|
66
|
+
format?: {
|
|
67
|
+
link?: {
|
|
68
|
+
uri?: string | null;
|
|
69
|
+
} | null;
|
|
70
|
+
} | null;
|
|
71
|
+
}> | null;
|
|
72
|
+
}
|
|
73
|
+
export interface GridRowLike {
|
|
74
|
+
values?: GridCellLike[] | null;
|
|
75
|
+
}
|
|
76
|
+
export interface NoteEntry {
|
|
77
|
+
cell: string;
|
|
78
|
+
note: string;
|
|
79
|
+
[key: string]: unknown;
|
|
80
|
+
}
|
|
81
|
+
export interface ExtractedGrid {
|
|
82
|
+
/** Cell values with links rendered inline as markdown `[text](url)`. */
|
|
83
|
+
values: string[][];
|
|
84
|
+
/** Cell notes (distinct from Drive comments), keyed by A1 cell. */
|
|
85
|
+
notes: NoteEntry[];
|
|
86
|
+
/** Total number of resolved links inlined into the grid. */
|
|
87
|
+
linkCount: number;
|
|
88
|
+
}
|
|
89
|
+
/**
|
|
90
|
+
* Render one cell's display value, inlining any embedded links as markdown.
|
|
91
|
+
* - A whole-cell `hyperlink` wraps the entire value: `[value](url)`.
|
|
92
|
+
* - Rich-text links (`textFormatRuns` with a `format.link.uri`) wrap only the
|
|
93
|
+
* linked span, reconstructed from the run boundaries, so a cell with several
|
|
94
|
+
* links (`…here and here`) becomes `…[here](u1) and [here](u2)`.
|
|
95
|
+
* Returns `{ text, links }` where `links` counts resolved links in the cell.
|
|
96
|
+
*/
|
|
97
|
+
export declare function cellToMarkdown(cell: GridCellLike): {
|
|
98
|
+
text: string;
|
|
99
|
+
links: number;
|
|
100
|
+
};
|
|
101
|
+
/**
|
|
102
|
+
* Extract a values grid (with markdown-inlined links) + notes from
|
|
103
|
+
* includeGridData rowData. `origin` supplies the A1 coordinate of the top-left
|
|
104
|
+
* cell so notes are addressed correctly. Trailing fully-empty rows are trimmed
|
|
105
|
+
* to mirror the used-range behavior of a plain values fetch.
|
|
106
|
+
*/
|
|
107
|
+
export declare function extractGrid(rows: GridRowLike[], origin: RangeOrigin): ExtractedGrid;
|
|
108
|
+
export declare function sheetsReadCommand(account: string, args: string[]): Promise<string>;
|