@iletai/nzb 1.1.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/LICENSE +21 -0
- package/README.md +132 -0
- package/dist/api/server.js +212 -0
- package/dist/cli.js +95 -0
- package/dist/config.js +72 -0
- package/dist/copilot/client.js +32 -0
- package/dist/copilot/mcp-config.js +22 -0
- package/dist/copilot/orchestrator.js +386 -0
- package/dist/copilot/skills.js +128 -0
- package/dist/copilot/system-message.js +128 -0
- package/dist/copilot/tools.js +502 -0
- package/dist/daemon.js +174 -0
- package/dist/paths.js +24 -0
- package/dist/setup.js +275 -0
- package/dist/store/db.js +179 -0
- package/dist/telegram/bot.js +343 -0
- package/dist/telegram/formatter.js +137 -0
- package/dist/tui/index.js +928 -0
- package/dist/update.js +72 -0
- package/package.json +64 -0
- package/scripts/fix-esm-imports.cjs +25 -0
- package/skills/.gitkeep +0 -0
- package/skills/find-skills/SKILL.md +161 -0
- package/skills/find-skills/_meta.json +4 -0
- package/skills/gogcli/SKILL.md +168 -0
- package/skills/gogcli/_meta.json +4 -0
- package/skills/skills-lock.json +10 -0
- package/skills/telegram-bot-builder/SKILL.md +267 -0
package/dist/update.js
ADDED
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
import { readFileSync } from "fs";
|
|
2
|
+
import { join, dirname } from "path";
|
|
3
|
+
import { fileURLToPath } from "url";
|
|
4
|
+
import { exec as execCb, execSync } from "child_process";
|
|
5
|
+
const __dirname = dirname(fileURLToPath(import.meta.url));
|
|
6
|
+
function getLocalVersion() {
|
|
7
|
+
try {
|
|
8
|
+
const pkg = JSON.parse(readFileSync(join(__dirname, "..", "package.json"), "utf-8"));
|
|
9
|
+
return pkg.version || "0.0.0";
|
|
10
|
+
}
|
|
11
|
+
catch {
|
|
12
|
+
return "0.0.0";
|
|
13
|
+
}
|
|
14
|
+
}
|
|
15
|
+
/** Run a command asynchronously and return stdout. */
|
|
16
|
+
function execAsync(cmd, timeoutMs) {
|
|
17
|
+
return new Promise((resolve, reject) => {
|
|
18
|
+
execCb(cmd, { encoding: "utf-8", timeout: timeoutMs }, (err, stdout) => {
|
|
19
|
+
if (err)
|
|
20
|
+
return reject(err);
|
|
21
|
+
resolve(stdout.trim());
|
|
22
|
+
});
|
|
23
|
+
});
|
|
24
|
+
}
|
|
25
|
+
/** Fetch the latest published version from npm. Returns null on failure. */
|
|
26
|
+
export async function getLatestVersion() {
|
|
27
|
+
try {
|
|
28
|
+
const result = await execAsync("npm view nzb version", 10_000);
|
|
29
|
+
return result || null;
|
|
30
|
+
}
|
|
31
|
+
catch {
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
/** Compare two semver strings. Returns true if remote is newer. */
|
|
36
|
+
function isNewer(local, remote) {
|
|
37
|
+
const parse = (v) => v.split(".").map(Number);
|
|
38
|
+
const [lMaj, lMin, lPat] = parse(local);
|
|
39
|
+
const [rMaj, rMin, rPat] = parse(remote);
|
|
40
|
+
if (rMaj !== lMaj)
|
|
41
|
+
return rMaj > lMaj;
|
|
42
|
+
if (rMin !== lMin)
|
|
43
|
+
return rMin > lMin;
|
|
44
|
+
return rPat > lPat;
|
|
45
|
+
}
|
|
46
|
+
/** Check whether a newer version is available on npm. */
|
|
47
|
+
export async function checkForUpdate() {
|
|
48
|
+
const current = getLocalVersion();
|
|
49
|
+
const latest = await getLatestVersion();
|
|
50
|
+
return {
|
|
51
|
+
current,
|
|
52
|
+
latest,
|
|
53
|
+
updateAvailable: latest !== null && isNewer(current, latest),
|
|
54
|
+
checkSucceeded: latest !== null,
|
|
55
|
+
};
|
|
56
|
+
}
|
|
57
|
+
/** Run `npm install -g nzb@latest` and return success/failure. */
|
|
58
|
+
export async function performUpdate() {
|
|
59
|
+
try {
|
|
60
|
+
const output = execSync("npm install -g nzb@latest", {
|
|
61
|
+
encoding: "utf-8",
|
|
62
|
+
timeout: 60_000,
|
|
63
|
+
stdio: ["ignore", "pipe", "pipe"],
|
|
64
|
+
});
|
|
65
|
+
return { ok: true, output: output.trim() };
|
|
66
|
+
}
|
|
67
|
+
catch (err) {
|
|
68
|
+
const msg = err.stderr?.trim() || err.message || "Unknown error";
|
|
69
|
+
return { ok: false, output: msg };
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
//# sourceMappingURL=update.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@iletai/nzb",
|
|
3
|
+
"version": "1.1.0",
|
|
4
|
+
"description": "NZB — a personal AI assistant for developers, built on the GitHub Copilot SDK",
|
|
5
|
+
"bin": {
|
|
6
|
+
"nzb": "dist/cli.js"
|
|
7
|
+
},
|
|
8
|
+
"publishConfig": {
|
|
9
|
+
"access": "public"
|
|
10
|
+
},
|
|
11
|
+
"files": [
|
|
12
|
+
"dist/**/*.js",
|
|
13
|
+
"scripts/fix-esm-imports.cjs",
|
|
14
|
+
"skills/",
|
|
15
|
+
"README.md"
|
|
16
|
+
],
|
|
17
|
+
"scripts": {
|
|
18
|
+
"build": "tsc",
|
|
19
|
+
"postinstall": "node scripts/fix-esm-imports.cjs",
|
|
20
|
+
"daemon": "tsx src/daemon.ts",
|
|
21
|
+
"tui": "tsx src/tui/index.ts",
|
|
22
|
+
"dev": "tsx --watch src/daemon.ts",
|
|
23
|
+
"format": "prettier --write .",
|
|
24
|
+
"format:check": "prettier --check .",
|
|
25
|
+
"prepublishOnly": "npm run build"
|
|
26
|
+
},
|
|
27
|
+
"engines": {
|
|
28
|
+
"node": ">=18"
|
|
29
|
+
},
|
|
30
|
+
"keywords": [
|
|
31
|
+
"copilot",
|
|
32
|
+
"telegram",
|
|
33
|
+
"orchestrator",
|
|
34
|
+
"ai",
|
|
35
|
+
"cli"
|
|
36
|
+
],
|
|
37
|
+
"author": "iletai",
|
|
38
|
+
"license": "MIT",
|
|
39
|
+
"repository": {
|
|
40
|
+
"type": "git",
|
|
41
|
+
"url": "git+https://github.com/iletai/AI-Agent-Assistant.git"
|
|
42
|
+
},
|
|
43
|
+
"homepage": "https://github.com/iletai/AI-Agent-Assistant#readme",
|
|
44
|
+
"bugs": {
|
|
45
|
+
"url": "https://github.com/iletai/AI-Agent-Assistant/issues"
|
|
46
|
+
},
|
|
47
|
+
"type": "module",
|
|
48
|
+
"dependencies": {
|
|
49
|
+
"@github/copilot-sdk": "^0.1.26",
|
|
50
|
+
"better-sqlite3": "^12.6.2",
|
|
51
|
+
"dotenv": "^17.3.1",
|
|
52
|
+
"express": "^5.2.1",
|
|
53
|
+
"grammy": "^1.40.0",
|
|
54
|
+
"zod": "^4.3.6"
|
|
55
|
+
},
|
|
56
|
+
"devDependencies": {
|
|
57
|
+
"@types/better-sqlite3": "^7.6.13",
|
|
58
|
+
"@types/express": "^5.0.6",
|
|
59
|
+
"@types/node": "^25.3.0",
|
|
60
|
+
"prettier": "^3.8.1",
|
|
61
|
+
"tsx": "^4.21.0",
|
|
62
|
+
"typescript": "^5.9.3"
|
|
63
|
+
}
|
|
64
|
+
}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
// Patch vscode-jsonrpc to add an exports map for Node.js ESM compatibility.
|
|
2
|
+
// The package ships node.js / browser.js entry points but lacks an "exports"
|
|
3
|
+
// field, so `import "vscode-jsonrpc/node"` fails under strict ESM resolution.
|
|
4
|
+
const fs = require("fs");
|
|
5
|
+
|
|
6
|
+
try {
|
|
7
|
+
const pkgPath = require.resolve("vscode-jsonrpc/package.json", {
|
|
8
|
+
paths: [process.cwd()],
|
|
9
|
+
});
|
|
10
|
+
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
11
|
+
if (!pkg.exports) {
|
|
12
|
+
pkg.exports = {
|
|
13
|
+
".": "./lib/node/main.js",
|
|
14
|
+
"./node": "./node.js",
|
|
15
|
+
"./node.js": "./node.js",
|
|
16
|
+
"./browser": "./browser.js",
|
|
17
|
+
"./browser.js": "./browser.js",
|
|
18
|
+
"./lib/*": "./lib/*",
|
|
19
|
+
"./package.json": "./package.json",
|
|
20
|
+
};
|
|
21
|
+
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, "\t") + "\n");
|
|
22
|
+
}
|
|
23
|
+
} catch {
|
|
24
|
+
// Best effort — don't break install if the dep isn't present yet
|
|
25
|
+
}
|
package/skills/.gitkeep
ADDED
|
File without changes
|
|
@@ -0,0 +1,161 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: find-skills
|
|
3
|
+
description: Helps users discover agent skills when they ask questions like "how do I do X", "find a skill for X", "is there a skill that can...", or express interest in extending capabilities. Always ask the user for permission before installing any skill, and flag security risks.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Find Skills
|
|
7
|
+
|
|
8
|
+
Discover and install skills from the open agent skills ecosystem at https://skills.sh/.
|
|
9
|
+
|
|
10
|
+
## When to Use
|
|
11
|
+
|
|
12
|
+
Use this skill when the user:
|
|
13
|
+
|
|
14
|
+
- Asks "how do I do X" where X might be a common task with an existing skill
|
|
15
|
+
- Says "find a skill for X" or "is there a skill for X"
|
|
16
|
+
- Asks "can you do X" where X is a specialized capability
|
|
17
|
+
- Expresses interest in extending agent capabilities
|
|
18
|
+
- Wants to search for tools, templates, or workflows
|
|
19
|
+
|
|
20
|
+
## Search & Present
|
|
21
|
+
|
|
22
|
+
Do these two steps in a worker session — they can run in parallel:
|
|
23
|
+
|
|
24
|
+
### 1. Search the API
|
|
25
|
+
|
|
26
|
+
```bash
|
|
27
|
+
curl -s "https://skills.sh/api/search?q=QUERY"
|
|
28
|
+
```
|
|
29
|
+
|
|
30
|
+
Replace `QUERY` with a URL-encoded search term (e.g., `react`, `email`, `pr+review`). The response is JSON with skills sorted by installs (most popular first):
|
|
31
|
+
|
|
32
|
+
```json
|
|
33
|
+
{
|
|
34
|
+
"skills": [
|
|
35
|
+
{
|
|
36
|
+
"id": "vercel-labs/agent-skills/vercel-react-best-practices",
|
|
37
|
+
"skillId": "vercel-react-best-practices",
|
|
38
|
+
"name": "vercel-react-best-practices",
|
|
39
|
+
"installs": 174847,
|
|
40
|
+
"source": "vercel-labs/agent-skills"
|
|
41
|
+
}
|
|
42
|
+
]
|
|
43
|
+
}
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
### 2. Fetch Security Audits
|
|
47
|
+
|
|
48
|
+
**Required — do not skip.** Use the `web_fetch` tool to get the audits page:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
web_fetch url="https://skills.sh/audits"
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
If `web_fetch` fails or returns unexpected content, still present the search results but show "⚠️ Audit unavailable" for all security columns and include a link to https://skills.sh/audits so the user can check manually.
|
|
55
|
+
|
|
56
|
+
This returns markdown where each skill has a heading (`### skill-name`) followed by its source, then three security scores:
|
|
57
|
+
|
|
58
|
+
- **Gen Agent Trust Hub**: Safe / Med Risk / Critical
|
|
59
|
+
- **Socket**: Number of alerts (0 is best)
|
|
60
|
+
- **Snyk**: Low Risk / Med Risk / High Risk / Critical
|
|
61
|
+
|
|
62
|
+
Scan the returned markdown to find scores for each skill from your search results. Match by both **skill name** and **full source** (`owner/repo`) to avoid misattribution — different repos can have skills with the same name.
|
|
63
|
+
|
|
64
|
+
### 3. Present Combined Results
|
|
65
|
+
|
|
66
|
+
Cross-reference the search results with the audit data and format as a numbered table. Show the top 6-8 results sorted by installs:
|
|
67
|
+
|
|
68
|
+
```
|
|
69
|
+
# Skill Publisher Installs Gen Socket Snyk
|
|
70
|
+
─ ───────────────────────────── ───────────── ──────── ───── ────── ────────
|
|
71
|
+
1 vercel-react-best-practices vercel-labs 175.3K ✅Safe ✅ 0 ✅Low
|
|
72
|
+
2 web-design-guidelines vercel-labs 135.8K ✅Safe ✅ 0 ⚠️Med
|
|
73
|
+
3 frontend-design anthropics 122.6K ✅Safe ✅ 0 ✅Low
|
|
74
|
+
4 remotion-best-practices remotion-dev 125.2K ✅Safe ✅ 0 ⚠️Med
|
|
75
|
+
5 browser-use browser-use 45.0K ⚠️Med 🔴 1 🔴High
|
|
76
|
+
```
|
|
77
|
+
|
|
78
|
+
**Formatting:**
|
|
79
|
+
- Sort by installs descending
|
|
80
|
+
- Format counts: 1000+ → "1.0K", 1000000+ → "1.0M"
|
|
81
|
+
- ✅ for Safe / Low Risk / 0 alerts, ⚠️ for Med Risk, 🔴 for High Risk / Critical / 1+ alerts
|
|
82
|
+
- If a skill has no audit data, show "⚠️ N/A" — never leave security blank
|
|
83
|
+
- Publisher = first part of `source` field (before `/`)
|
|
84
|
+
|
|
85
|
+
After the table:
|
|
86
|
+
|
|
87
|
+
```
|
|
88
|
+
🔗 Browse all: https://skills.sh/
|
|
89
|
+
|
|
90
|
+
Pick a number to install (or "none")
|
|
91
|
+
```
|
|
92
|
+
|
|
93
|
+
## Install
|
|
94
|
+
|
|
95
|
+
**NEVER install without the user picking a number first.**
|
|
96
|
+
|
|
97
|
+
When the user picks a skill:
|
|
98
|
+
|
|
99
|
+
### Security Gate
|
|
100
|
+
|
|
101
|
+
If ANY of its three audit scores is not green (Safe / 0 alerts / Low Risk), warn before proceeding:
|
|
102
|
+
|
|
103
|
+
```
|
|
104
|
+
⚠️ "{skill-name}" has security concerns:
|
|
105
|
+
• Gen Agent Trust Hub: {score}
|
|
106
|
+
• Socket: {count} alerts
|
|
107
|
+
• Snyk: {score}
|
|
108
|
+
|
|
109
|
+
Want to proceed anyway, or pick a different skill?
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Wait for explicit confirmation. Do not install if the user says no.
|
|
113
|
+
|
|
114
|
+
### Fetch & Install
|
|
115
|
+
|
|
116
|
+
1. **Fetch the SKILL.md** from GitHub. The `source` field is `owner/repo` and `skillId` is the directory:
|
|
117
|
+
|
|
118
|
+
```bash
|
|
119
|
+
curl -fsSL "https://raw.githubusercontent.com/{source}/main/{skillId}/SKILL.md" || \
|
|
120
|
+
curl -fsSL "https://raw.githubusercontent.com/{source}/master/{skillId}/SKILL.md"
|
|
121
|
+
```
|
|
122
|
+
|
|
123
|
+
If both fail, tell the user and link to `https://github.com/{source}`.
|
|
124
|
+
|
|
125
|
+
2. **Validate** the fetched content: it must not be empty and should contain meaningful instructions (more than just a title). If the content is empty, an HTML error page, or clearly not a SKILL.md, do NOT install — tell the user it couldn't be fetched properly.
|
|
126
|
+
|
|
127
|
+
3. **Install** using the `learn_skill` tool:
|
|
128
|
+
- `slug`: the `skillId` from the API
|
|
129
|
+
- `name`: from the SKILL.md frontmatter `name:` field (between `---` markers). If no frontmatter, use `skillId`.
|
|
130
|
+
- `description`: from the SKILL.md frontmatter `description:` field. If none, use the first sentence.
|
|
131
|
+
- `instructions`: if frontmatter exists, use the content after the closing `---`. If no frontmatter, use the full fetched content as instructions.
|
|
132
|
+
|
|
133
|
+
**Always install to ~/.nzb/skills/ via learn_skill. Never install globally.**
|
|
134
|
+
|
|
135
|
+
## Behavioral Security Review
|
|
136
|
+
|
|
137
|
+
In addition to audit scores, review the fetched SKILL.md content before installing. Flag concerns if the skill:
|
|
138
|
+
|
|
139
|
+
- **Runs arbitrary shell commands** or executes code on the user's machine
|
|
140
|
+
- **Accesses sensitive data** — credentials, API keys, SSH keys, personal files
|
|
141
|
+
- **Makes network requests** to external services (data exfiltration risk)
|
|
142
|
+
- **Comes from an unknown or unverified source** with no audit data
|
|
143
|
+
|
|
144
|
+
If any of these apply, warn the user with specifics even if audit scores are green:
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
⚠️ Note: "{skill-name}" requests shell access and reads files from your home directory.
|
|
148
|
+
This is common for CLI-integration skills, but worth knowing. Proceed?
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
## When No Skills Are Found
|
|
152
|
+
|
|
153
|
+
If the API returns no results:
|
|
154
|
+
|
|
155
|
+
1. Tell the user no existing skill was found
|
|
156
|
+
2. Offer to help directly with your general capabilities
|
|
157
|
+
3. Suggest building a custom skill if the task is worth automating
|
|
158
|
+
|
|
159
|
+
## Uninstalling
|
|
160
|
+
|
|
161
|
+
Use the `uninstall_skill` tool with the skill's slug to remove it from `~/.nzb/skills/`.
|
|
@@ -0,0 +1,168 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: Google (gogcli)
|
|
3
|
+
description: Access Gmail, Google Calendar, Drive, Contacts, Tasks, Sheets, Docs, and more via the gog CLI. Use when the user asks about email, calendar, files, contacts, or any Google service.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Google CLI (gogcli)
|
|
7
|
+
|
|
8
|
+
NZB can interact with Google services using the `gog` CLI tool. This covers Gmail, Calendar, Drive, Contacts, Tasks, Sheets, Docs, Slides, Forms, and more.
|
|
9
|
+
|
|
10
|
+
## Prerequisites
|
|
11
|
+
|
|
12
|
+
- `gog` must be installed: `brew install steipete/tap/gogcli`
|
|
13
|
+
- OAuth credentials must be stored: `gog auth credentials ~/path/to/client_secret.json`
|
|
14
|
+
- User must be authenticated: `gog auth add user@gmail.com`
|
|
15
|
+
- Check auth status: `gog auth status`
|
|
16
|
+
|
|
17
|
+
If `gog` is not installed or not authenticated, guide the user through setup.
|
|
18
|
+
|
|
19
|
+
## Important Flags
|
|
20
|
+
|
|
21
|
+
Always use these flags when running `gog` commands programmatically:
|
|
22
|
+
|
|
23
|
+
- `--json` or `-j` — JSON output (best for parsing results)
|
|
24
|
+
- `--plain` or `-p` — stable TSV output (good for simple lists)
|
|
25
|
+
- `--no-input` — never prompt for input (prevents hanging)
|
|
26
|
+
- `--force` or `-y` — skip confirmations for destructive commands
|
|
27
|
+
- `-a email@example.com` — specify which Google account to use
|
|
28
|
+
|
|
29
|
+
## Gmail
|
|
30
|
+
|
|
31
|
+
```bash
|
|
32
|
+
# Search emails (Gmail query syntax)
|
|
33
|
+
gog gmail search "is:unread" --json
|
|
34
|
+
gog gmail search "from:someone@example.com" --json
|
|
35
|
+
gog gmail search "subject:meeting is:unread newer_than:1d" --json
|
|
36
|
+
|
|
37
|
+
# Read a specific message
|
|
38
|
+
gog gmail get <messageId> --json
|
|
39
|
+
|
|
40
|
+
# Send an email
|
|
41
|
+
gog send --to "recipient@example.com" --subject "Hello" --body "Message body"
|
|
42
|
+
gog send --to "a@example.com" --cc "b@example.com" --subject "Hi" --body "Hello" --html
|
|
43
|
+
|
|
44
|
+
# Reply to a thread
|
|
45
|
+
gog gmail messages reply <messageId> --body "Reply text"
|
|
46
|
+
|
|
47
|
+
# List labels
|
|
48
|
+
gog gmail labels list --json
|
|
49
|
+
|
|
50
|
+
# Manage threads
|
|
51
|
+
gog gmail thread get <threadId> --json
|
|
52
|
+
gog gmail thread modify <threadId> --add-labels "STARRED"
|
|
53
|
+
gog gmail thread modify <threadId> --remove-labels "UNREAD"
|
|
54
|
+
|
|
55
|
+
# Drafts
|
|
56
|
+
gog gmail drafts list --json
|
|
57
|
+
gog gmail drafts create --to "user@example.com" --subject "Draft" --body "Content"
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
## Calendar
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
# List today's events
|
|
64
|
+
gog calendar events --json
|
|
65
|
+
|
|
66
|
+
# List events in a date range
|
|
67
|
+
gog calendar events --from "2025-01-01" --to "2025-01-31" --json
|
|
68
|
+
|
|
69
|
+
# List all calendars
|
|
70
|
+
gog calendar calendars --json
|
|
71
|
+
|
|
72
|
+
# Create an event
|
|
73
|
+
gog calendar create <calendarId> --summary "Meeting" --start "2025-01-15T10:00:00" --end "2025-01-15T11:00:00"
|
|
74
|
+
|
|
75
|
+
# Search events
|
|
76
|
+
gog calendar search "standup" --json
|
|
77
|
+
|
|
78
|
+
# Find conflicts
|
|
79
|
+
gog calendar conflicts --json
|
|
80
|
+
|
|
81
|
+
# RSVP to an event
|
|
82
|
+
gog calendar respond <calendarId> <eventId> --status accepted
|
|
83
|
+
|
|
84
|
+
# Free/busy check
|
|
85
|
+
gog calendar freebusy "user@example.com" --from "2025-01-15" --to "2025-01-16" --json
|
|
86
|
+
```
|
|
87
|
+
|
|
88
|
+
For calendar IDs: use `primary` for the user's main calendar, or the calendar's email address.
|
|
89
|
+
|
|
90
|
+
## Drive
|
|
91
|
+
|
|
92
|
+
```bash
|
|
93
|
+
# List files in root
|
|
94
|
+
gog ls --json
|
|
95
|
+
|
|
96
|
+
# List files in a folder
|
|
97
|
+
gog ls --parent <folderId> --json
|
|
98
|
+
|
|
99
|
+
# Search files
|
|
100
|
+
gog search "quarterly report" --json
|
|
101
|
+
|
|
102
|
+
# Download a file
|
|
103
|
+
gog download <fileId>
|
|
104
|
+
gog download <fileId> --output /path/to/save
|
|
105
|
+
|
|
106
|
+
# Upload a file
|
|
107
|
+
gog upload /path/to/file
|
|
108
|
+
gog upload /path/to/file --parent <folderId>
|
|
109
|
+
|
|
110
|
+
# Create a folder
|
|
111
|
+
gog drive mkdir "New Folder"
|
|
112
|
+
gog drive mkdir "Subfolder" --parent <folderId>
|
|
113
|
+
|
|
114
|
+
# Share a file
|
|
115
|
+
gog drive share <fileId> --email "user@example.com" --role writer
|
|
116
|
+
|
|
117
|
+
# Get file info
|
|
118
|
+
gog drive get <fileId> --json
|
|
119
|
+
```
|
|
120
|
+
|
|
121
|
+
## Contacts
|
|
122
|
+
|
|
123
|
+
```bash
|
|
124
|
+
# Search contacts
|
|
125
|
+
gog contacts search "John" --json
|
|
126
|
+
|
|
127
|
+
# List all contacts
|
|
128
|
+
gog contacts list --json
|
|
129
|
+
|
|
130
|
+
# Create a contact
|
|
131
|
+
gog contacts create --given-name "John" --family-name "Doe" --email "john@example.com"
|
|
132
|
+
```
|
|
133
|
+
|
|
134
|
+
## Tasks
|
|
135
|
+
|
|
136
|
+
```bash
|
|
137
|
+
# List task lists
|
|
138
|
+
gog tasks lists list --json
|
|
139
|
+
|
|
140
|
+
# List tasks in a list
|
|
141
|
+
gog tasks list <tasklistId> --json
|
|
142
|
+
|
|
143
|
+
# Add a task
|
|
144
|
+
gog tasks add <tasklistId> --title "Buy groceries"
|
|
145
|
+
|
|
146
|
+
# Complete a task
|
|
147
|
+
gog tasks done <tasklistId> <taskId>
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
## Sheets
|
|
151
|
+
|
|
152
|
+
```bash
|
|
153
|
+
# Read a sheet
|
|
154
|
+
gog sheets get <spreadsheetId> --json
|
|
155
|
+
gog sheets values <spreadsheetId> "Sheet1!A1:D10" --json
|
|
156
|
+
|
|
157
|
+
# Update cells
|
|
158
|
+
gog sheets update <spreadsheetId> "Sheet1!A1" --values '[["Hello","World"]]'
|
|
159
|
+
```
|
|
160
|
+
|
|
161
|
+
## Tips
|
|
162
|
+
|
|
163
|
+
- Use `gog whoami` to check which account is active
|
|
164
|
+
- The `--json` flag is your friend — always use it when you need to parse output
|
|
165
|
+
- Gmail search uses standard Gmail query syntax (same as the Gmail search bar)
|
|
166
|
+
- For calendar, `primary` is the default calendar ID
|
|
167
|
+
- Most list commands support `--limit` to control how many results to return
|
|
168
|
+
- Use `gog open <fileId>` to get a browser URL for any Google resource
|