gws-axi 0.11.0 → 0.12.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/dist/src/commands/drive/mkdir.d.ts +7 -0
- package/dist/src/commands/drive/mkdir.js +101 -0
- package/dist/src/commands/drive/mkdir.js.map +1 -0
- package/dist/src/commands/drive/mkdir.test.d.ts +1 -0
- package/dist/src/commands/drive/mkdir.test.js +40 -0
- package/dist/src/commands/drive/mkdir.test.js.map +1 -0
- package/dist/src/commands/drive.js +11 -6
- package/dist/src/commands/drive.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const MKDIR_HELP = "usage: gws-axi drive mkdir <name> [flags]\nargs[1]:\n <name> REQUIRED \u2014 the folder name\nflags[2]:\n --parent <folder-id> Parent folder ID (default: My Drive root)\n --account <email> REQUIRED when 2+ accounts are authenticated\nexamples:\n gws-axi drive mkdir \"Q2 Reports\"\n gws-axi drive mkdir Invoices --parent 1AbC...\nnotes:\n Drive allows duplicate folder names \u2014 re-running creates ANOTHER folder.\n Capture the returned id to nest uploads with `drive upload --parent <id>`.\noutput:\n An `action: created` line plus a `folder{...}` object with id, name,\n parents, and web_view_link.\n";
|
|
2
|
+
export interface ParsedFlags {
|
|
3
|
+
name: string | undefined;
|
|
4
|
+
parent: string | undefined;
|
|
5
|
+
}
|
|
6
|
+
export declare function parseFlags(args: string[]): ParsedFlags;
|
|
7
|
+
export declare function driveMkdirCommand(account: string, args: string[]): Promise<string>;
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { AxiError } from "axi-sdk-js";
|
|
2
|
+
import { driveClient, translateGoogleError } from "../../google/client.js";
|
|
3
|
+
import { joinBlocks, renderHelp, renderObject } from "../../output/index.js";
|
|
4
|
+
export const MKDIR_HELP = `usage: gws-axi drive mkdir <name> [flags]
|
|
5
|
+
args[1]:
|
|
6
|
+
<name> REQUIRED — the folder name
|
|
7
|
+
flags[2]:
|
|
8
|
+
--parent <folder-id> Parent folder ID (default: My Drive root)
|
|
9
|
+
--account <email> REQUIRED when 2+ accounts are authenticated
|
|
10
|
+
examples:
|
|
11
|
+
gws-axi drive mkdir "Q2 Reports"
|
|
12
|
+
gws-axi drive mkdir Invoices --parent 1AbC...
|
|
13
|
+
notes:
|
|
14
|
+
Drive allows duplicate folder names — re-running creates ANOTHER folder.
|
|
15
|
+
Capture the returned id to nest uploads with \`drive upload --parent <id>\`.
|
|
16
|
+
output:
|
|
17
|
+
An \`action: created\` line plus a \`folder{...}\` object with id, name,
|
|
18
|
+
parents, and web_view_link.
|
|
19
|
+
`;
|
|
20
|
+
const FOLDER_MIME = "application/vnd.google-apps.folder";
|
|
21
|
+
const MKDIR_FIELDS = "id,name,parents,webViewLink";
|
|
22
|
+
export function parseFlags(args) {
|
|
23
|
+
const flags = { name: undefined, parent: undefined };
|
|
24
|
+
for (let i = 0; i < args.length; i++) {
|
|
25
|
+
const arg = args[i];
|
|
26
|
+
const next = args[i + 1];
|
|
27
|
+
switch (arg) {
|
|
28
|
+
case "--parent":
|
|
29
|
+
flags.parent = next;
|
|
30
|
+
i++;
|
|
31
|
+
break;
|
|
32
|
+
default:
|
|
33
|
+
if (!arg.startsWith("--") && flags.name === undefined) {
|
|
34
|
+
flags.name = arg;
|
|
35
|
+
}
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
return flags;
|
|
40
|
+
}
|
|
41
|
+
export async function driveMkdirCommand(account, args) {
|
|
42
|
+
const flags = parseFlags(args);
|
|
43
|
+
if (!flags.name) {
|
|
44
|
+
throw new AxiError("Missing folder name", "VALIDATION_ERROR", [
|
|
45
|
+
"Usage: gws-axi drive mkdir <name> [--parent <folder-id>]",
|
|
46
|
+
]);
|
|
47
|
+
}
|
|
48
|
+
const api = await driveClient(account);
|
|
49
|
+
const requestBody = {
|
|
50
|
+
name: flags.name,
|
|
51
|
+
mimeType: FOLDER_MIME,
|
|
52
|
+
};
|
|
53
|
+
if (flags.parent)
|
|
54
|
+
requestBody.parents = [flags.parent];
|
|
55
|
+
let folder;
|
|
56
|
+
try {
|
|
57
|
+
const res = await api.files.create({
|
|
58
|
+
requestBody,
|
|
59
|
+
fields: MKDIR_FIELDS,
|
|
60
|
+
supportsAllDrives: true,
|
|
61
|
+
});
|
|
62
|
+
folder = res.data;
|
|
63
|
+
}
|
|
64
|
+
catch (err) {
|
|
65
|
+
const translated = translateGoogleError(err, {
|
|
66
|
+
account,
|
|
67
|
+
operation: "drive.files.create",
|
|
68
|
+
});
|
|
69
|
+
if (translated.code === "NOT_FOUND") {
|
|
70
|
+
throw new AxiError(`Parent folder '${flags.parent}' not found (or ${account} can't write to it)`, "FILE_NOT_FOUND", [
|
|
71
|
+
"Verify the --parent ID is correct (from a Drive URL or `drive ls` / `drive search`)",
|
|
72
|
+
`Confirm ${account} has edit access`,
|
|
73
|
+
]);
|
|
74
|
+
}
|
|
75
|
+
throw translated;
|
|
76
|
+
}
|
|
77
|
+
const id = folder.id ?? "";
|
|
78
|
+
const details = {
|
|
79
|
+
id,
|
|
80
|
+
name: folder.name ?? flags.name,
|
|
81
|
+
parents: folder.parents?.length ? folder.parents.join(", ") : "",
|
|
82
|
+
};
|
|
83
|
+
if (folder.webViewLink)
|
|
84
|
+
details.web_view_link = folder.webViewLink;
|
|
85
|
+
const blocks = [];
|
|
86
|
+
blocks.push(renderObject({ action: "created", account }));
|
|
87
|
+
blocks.push(renderObject({ folder: details }));
|
|
88
|
+
const suggestions = [
|
|
89
|
+
`Run \`gws-axi drive upload <file> --parent ${id}\` to put a file in this folder`,
|
|
90
|
+
`Run \`gws-axi drive ls ${id}\` to list its contents`,
|
|
91
|
+
`Run \`gws-axi drive get ${id}\` for full metadata`,
|
|
92
|
+
`Run \`gws-axi drive permissions ${id}\` to see / change who has access`,
|
|
93
|
+
`Re-running creates another folder (Drive allows duplicate names) — capture this id to reuse it`,
|
|
94
|
+
];
|
|
95
|
+
if (folder.webViewLink) {
|
|
96
|
+
suggestions.push(`Open in browser: ${folder.webViewLink}`);
|
|
97
|
+
}
|
|
98
|
+
blocks.push(renderHelp(suggestions));
|
|
99
|
+
return joinBlocks(...blocks);
|
|
100
|
+
}
|
|
101
|
+
//# sourceMappingURL=mkdir.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdir.js","sourceRoot":"","sources":["../../../../src/commands/drive/mkdir.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAEtC,OAAO,EAAE,WAAW,EAAE,oBAAoB,EAAE,MAAM,wBAAwB,CAAC;AAC3E,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,YAAY,EAAE,MAAM,uBAAuB,CAAC;AAE7E,MAAM,CAAC,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;CAezB,CAAC;AAEF,MAAM,WAAW,GAAG,oCAAoC,CAAC;AACzD,MAAM,YAAY,GAAG,6BAA6B,CAAC;AAOnD,MAAM,UAAU,UAAU,CAAC,IAAc;IACvC,MAAM,KAAK,GAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,MAAM,EAAE,SAAS,EAAE,CAAC;IAClE,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,IAAI,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QACrC,MAAM,GAAG,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;QACpB,MAAM,IAAI,GAAG,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC;QACzB,QAAQ,GAAG,EAAE,CAAC;YACZ,KAAK,UAAU;gBACb,KAAK,CAAC,MAAM,GAAG,IAAI,CAAC;gBACpB,CAAC,EAAE,CAAC;gBACJ,MAAM;YACR;gBACE,IAAI,CAAC,GAAG,CAAC,UAAU,CAAC,IAAI,CAAC,IAAI,KAAK,CAAC,IAAI,KAAK,SAAS,EAAE,CAAC;oBACtD,KAAK,CAAC,IAAI,GAAG,GA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Command } from "./mkdir.js";
|
|
4
|
+
describe("drive mkdir parseFlags", () => {
|
|
5
|
+
it("parses a bare name with no parent", () => {
|
|
6
|
+
const f = parseFlags(["Reports"]);
|
|
7
|
+
expect(f.name).toBe("Reports");
|
|
8
|
+
expect(f.parent).toBeUndefined();
|
|
9
|
+
});
|
|
10
|
+
it("parses a quoted multi-word name and --parent", () => {
|
|
11
|
+
const f = parseFlags(["Q2 Reports", "--parent", "1AbC"]);
|
|
12
|
+
expect(f.name).toBe("Q2 Reports");
|
|
13
|
+
expect(f.parent).toBe("1AbC");
|
|
14
|
+
});
|
|
15
|
+
it("takes the first positional as the name, ignoring later ones", () => {
|
|
16
|
+
const f = parseFlags(["first", "second"]);
|
|
17
|
+
expect(f.name).toBe("first");
|
|
18
|
+
});
|
|
19
|
+
it("leaves name undefined when only flags are given", () => {
|
|
20
|
+
const f = parseFlags(["--parent", "1AbC"]);
|
|
21
|
+
expect(f.name).toBeUndefined();
|
|
22
|
+
expect(f.parent).toBe("1AbC");
|
|
23
|
+
});
|
|
24
|
+
});
|
|
25
|
+
describe("drive mkdir command validation", () => {
|
|
26
|
+
it("throws VALIDATION_ERROR when the name is missing", async () => {
|
|
27
|
+
await expect(driveMkdirCommand("a@b.com", ["--parent", "1AbC"])).rejects.toMatchObject({ code: "VALIDATION_ERROR" });
|
|
28
|
+
});
|
|
29
|
+
it("rejects with an AxiError (not a raw throw) on missing name", async () => {
|
|
30
|
+
try {
|
|
31
|
+
await driveMkdirCommand("a@b.com", []);
|
|
32
|
+
throw new Error("should have thrown");
|
|
33
|
+
}
|
|
34
|
+
catch (err) {
|
|
35
|
+
expect(err).toBeInstanceOf(AxiError);
|
|
36
|
+
expect(err.code).toBe("VALIDATION_ERROR");
|
|
37
|
+
}
|
|
38
|
+
});
|
|
39
|
+
});
|
|
40
|
+
//# sourceMappingURL=mkdir.test.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"mkdir.test.js","sourceRoot":"","sources":["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AAM,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,aAAa,EAAE,CAAC;QAC/B,MAAM,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;IAChC,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC;AAEH,QAAQ,CAAC,gCAAgC,EAAE,GAAG,EAAE;IAC9C,EAAE,CAAC,kDAAkD,EAAE,KAAK,IAAI,EAAE;QAChE,MAAM,MAAM,CAAC,iBAAiB,CAAC,SAAS,EAAE,CAAC,UAAU,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,aAAa,CACpF,EAAE,IAAI,EAAE,kBAAkB,EAAE,CAC7B,CAAC;IACJ,CAAC,CAAC,CAAC;IAEH,EAAE,CAAC,4DAA4D,EAAE,KAAK,IAAI,EAAE;QAC1E,IAAI,CAAC;YACH,MAAM,iBAAiB,CAAC,SAAS,EAAE,EAAE,CAAC,CAAC;YACvC,MAAM,IAAI,KAAK,CAAC,oBAAoB,CAAC,CAAC;QACxC,CAAC;QAAC,OAAO,GAAG,EAAE,CAAC;YACb,MAAM,CAAC,GAAG,CAAC,CAAC,cAAc,CAAC,QAAQ,CAAC,CAAC;YACrC,MAAM,CAAE,GAAgB,CAAC,IAAI,CAAC,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;QAC1D,CAAC;IACH,CAAC,CAAC,CAAC;AACL,CAAC,CAAC,CAAC"}
|
|
@@ -8,6 +8,7 @@ import { driveActivityCommand, ACTIVITY_HELP } from "./drive/activity.js";
|
|
|
8
8
|
import { driveRevisionsCommand, REVISIONS_HELP, } from "./drive/revisions.js";
|
|
9
9
|
import { driveSearchCommand, SEARCH_HELP } from "./drive/search.js";
|
|
10
10
|
import { driveUploadCommand, UPLOAD_HELP } from "./drive/upload.js";
|
|
11
|
+
import { driveMkdirCommand, MKDIR_HELP } from "./drive/mkdir.js";
|
|
11
12
|
// Drive `download` shares the docs/download.ts implementation — same code
|
|
12
13
|
// path handles native Google file export + uploaded-file media fetch.
|
|
13
14
|
const DOWNLOAD_HELP = `usage: gws-axi drive download <file-id> [flags]
|
|
@@ -46,9 +47,6 @@ status: planned for v1 writes — not yet implemented
|
|
|
46
47
|
const DELETE_HELP = `usage: gws-axi drive delete <file-id> [flags]
|
|
47
48
|
status: planned for v1 writes — not yet implemented
|
|
48
49
|
`;
|
|
49
|
-
const MKDIR_HELP = `usage: gws-axi drive mkdir --name <name> --parent <folder-id> [flags]
|
|
50
|
-
status: planned for v1 writes — not yet implemented
|
|
51
|
-
`;
|
|
52
50
|
const SUBCOMMANDS = [
|
|
53
51
|
{ name: "search", mutation: false, help: SEARCH_HELP, handler: driveSearchCommand },
|
|
54
52
|
{ name: "get", mutation: false, help: GET_HELP, handler: driveGetCommand },
|
|
@@ -89,7 +87,12 @@ const SUBCOMMANDS = [
|
|
|
89
87
|
{ name: "move", mutation: true, help: MOVE_HELP },
|
|
90
88
|
{ name: "rename", mutation: true, help: RENAME_HELP },
|
|
91
89
|
{ name: "delete", mutation: true, help: DELETE_HELP },
|
|
92
|
-
{
|
|
90
|
+
{
|
|
91
|
+
name: "mkdir",
|
|
92
|
+
mutation: true,
|
|
93
|
+
help: MKDIR_HELP,
|
|
94
|
+
handler: driveMkdirCommand,
|
|
95
|
+
},
|
|
93
96
|
];
|
|
94
97
|
const SUB_BY_NAME = Object.fromEntries(SUBCOMMANDS.map((s) => [s.name, s]));
|
|
95
98
|
function parseAccountFlag(args) {
|
|
@@ -116,8 +119,8 @@ writes[${writes.length}]:
|
|
|
116
119
|
notes:
|
|
117
120
|
Writes require --account <email> when 2+ accounts are authenticated.
|
|
118
121
|
Reads use the default account when --account is not provided.
|
|
119
|
-
upload
|
|
120
|
-
next slice and throw NOT_IMPLEMENTED after account resolution runs.
|
|
122
|
+
upload and mkdir are live; the remaining write subcommands are scaffolded
|
|
123
|
+
for the next slice and throw NOT_IMPLEMENTED after account resolution runs.
|
|
121
124
|
subcommand help:
|
|
122
125
|
gws-axi drive ls --help for folder listing (incl. --recursive)
|
|
123
126
|
gws-axi drive get --help for full file metadata
|
|
@@ -125,6 +128,7 @@ subcommand help:
|
|
|
125
128
|
gws-axi drive permissions --help for access / sharing
|
|
126
129
|
gws-axi drive download --help for fetching bytes (alias of docs download)
|
|
127
130
|
gws-axi drive upload --help for uploading a local file (incl. --convert)
|
|
131
|
+
gws-axi drive mkdir --help for creating a folder
|
|
128
132
|
examples:
|
|
129
133
|
gws-axi drive ls
|
|
130
134
|
gws-axi drive ls <folder-id> --recursive
|
|
@@ -132,6 +136,7 @@ examples:
|
|
|
132
136
|
gws-axi drive get <file-id>
|
|
133
137
|
gws-axi drive permissions <file-id>
|
|
134
138
|
gws-axi drive upload ./report.pdf --account you@example.com
|
|
139
|
+
gws-axi drive mkdir "Q2 Reports" --account you@example.com
|
|
135
140
|
`;
|
|
136
141
|
export async function driveCommand(args) {
|
|
137
142
|
if (args.length === 0 || (args.length === 1 && args[0] === "--help")) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"drive.js","sourceRoot":"","sources":["../../../src/commands/drive.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AACtC,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAC;AACtD,OAAO,EAAE,mBAAmB,EAAE,MAAM,oBAAoB,CAAC;AACzD,OAAO,EAAE,eAAe,EAAE,QAAQ,EAAE,MAAM,gBAAgB,CAAC;AAC3D,OAAO,EAAE,cAAc,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxD,OAAO,EACL,uBAAuB,EACvB,gBAAgB,GACjB,MAAM,wBAAwB,CAAC;AAChC,OAAO,EAAE,oBAAoB,EAAE,aAAa,EAAE,MAAM,qBAAqB,CAAC;AAC1E,OAAO,EACL,qBAAqB,EACrB,cAAc,GACf,MAAM,sBAAsB,CAAC;AAC9B,OAAO,EAAE,kBAAkB,EAAE,WAAW,EAAE,MAAM,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,EACjB;YACE,8CAA8C,UAAU,CAAC,OAAO,EAAE;YAClE,uBAAuB,GAAG,mCAAmC;SAC9D,CACF,CAAC;IACJ,CAAC;IAED,OAAO,GAAG,CAAC,OAAO,CAAC,UAAU,CAAC,OAAO,EAAE,SAAS,CAAC,CAAC;AACpD,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "gws-axi",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.0",
|
|
4
4
|
"description": "AXI-compliant Google Workspace CLI — token-efficient TOON output, agent-guided auth setup, unified interface for Gmail, Calendar, Docs, Drive, Slides",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|