@ghostpaw/email 0.5.10 → 0.5.12
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 +27 -2
- package/SKILL.md +25 -0
- package/dist/cli.js +192 -162
- package/dist/index.cjs +15 -1
- package/dist/index.js +15 -1
- package/dist/mcp-server.js +20 -2
- package/dist/mcp.cjs +22 -2
- package/dist/mcp.js +22 -2
- package/package.json +1 -1
- package/skills/email/SKILL.md +25 -0
- package/skills/email/references/cli.md +2 -2
package/README.md
CHANGED
|
@@ -81,6 +81,31 @@ On POSIX, new accounts files and SQLite caches (including WAL/SHM sidecars) use
|
|
|
81
81
|
|
|
82
82
|
Use `ghostpaw-email skill --short` for a compact command cheat sheet, `ghostpaw-email skill` for the full reference, and `ghostpaw-email skill --list` to list guides.
|
|
83
83
|
|
|
84
|
+
|
|
85
|
+
## Running inside sandboxed agent harnesses
|
|
86
|
+
|
|
87
|
+
Inside a Codex CLI `--sandbox workspace-write` session, the database and its
|
|
88
|
+
parent directory must be inside a writable root, including SQLite's `-wal` and
|
|
89
|
+
`-shm` side files. A default DB under `~/.ghostpaw` outside those roots can fail
|
|
90
|
+
with `SQLITE_CANTOPEN` or `EPERM` (often exit 70; directory creation failures
|
|
91
|
+
may exit 2), even when normal shell permissions allow access. Put the DB inside the workspace with `--db ./state/email.db`,
|
|
92
|
+
or set `GHOSTPAW_EMAIL_DB="$PWD/state/email.db"` for CLI/MCP use.
|
|
93
|
+
|
|
94
|
+
To use an external DB directory, add it when starting the OpenAI Codex CLI
|
|
95
|
+
(replace `<dir-with-db>` with its absolute path):
|
|
96
|
+
|
|
97
|
+
```sh
|
|
98
|
+
codex exec --sandbox workspace-write --add-dir <dir-with-db> "Run the GhostPaw CLI"
|
|
99
|
+
```
|
|
100
|
+
|
|
101
|
+
Alternatively, set `sandbox_workspace_write.writable_roots` in
|
|
102
|
+
`~/.codex/config.toml` before starting the session:
|
|
103
|
+
|
|
104
|
+
```toml
|
|
105
|
+
[sandbox_workspace_write]
|
|
106
|
+
writable_roots = ["/absolute/dir-with-db"]
|
|
107
|
+
```
|
|
108
|
+
|
|
84
109
|
## Noun-verb CLI
|
|
85
110
|
|
|
86
111
|
Both `email` and `ghostpaw-email` accept this additive command tree. Existing
|
|
@@ -109,9 +134,9 @@ stdin and `@@text` passes `@text`; help marks them `(@file, @- stdin, @@ literal
|
|
|
109
134
|
empty or unreadable path exits 2. A single `-` reads stdin JSON;
|
|
110
135
|
explicit flags override stdin fields. `--` ends option parsing.
|
|
111
136
|
|
|
112
|
-
Global flags for the new commands: `--db <path>`, `--json`,
|
|
137
|
+
Global flags for the new commands: `--db <path>`, `--json`, `-q, --quiet`,
|
|
113
138
|
`--compact`, `--help`/`-h`, `--version`/`-V`/`-v`, `--no-color`.
|
|
114
|
-
Output is JSON when piped or when `--json` is set.
|
|
139
|
+
Output is JSON when piped or when `--json` is set. `-q, --quiet` suppresses stdout.
|
|
115
140
|
`completions bash|zsh|fish` prints shell completion setup; `version` prints
|
|
116
141
|
the version and installation variant. The existing `tools [--json]`, `describe <tool>`,
|
|
117
142
|
`call <tool> [JSON|-]`, flat `mail_<tool> --parameter value`, `mcp` and `skill`
|
package/SKILL.md
CHANGED
|
@@ -25,6 +25,31 @@ Run tools as `ghostpaw-email ...`; use `~/.local/bin/ghostpaw-email` if it is no
|
|
|
25
25
|
|
|
26
26
|
Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.
|
|
27
27
|
|
|
28
|
+
## Running inside sandboxed agent harnesses
|
|
29
|
+
|
|
30
|
+
Inside a Codex CLI `--sandbox workspace-write` session, the database and its
|
|
31
|
+
parent directory must be inside a writable root, including SQLite's `-wal` and
|
|
32
|
+
`-shm` side files. A default DB under `~/.ghostpaw` outside those roots can fail
|
|
33
|
+
with `SQLITE_CANTOPEN` or `EPERM` (often exit 70; directory creation failures
|
|
34
|
+
may exit 2), even when normal shell permissions allow access. Put the DB inside the workspace with `--db ./state/email.db`,
|
|
35
|
+
or set `GHOSTPAW_EMAIL_DB="$PWD/state/email.db"` for CLI/MCP use.
|
|
36
|
+
|
|
37
|
+
To use an external DB directory, add it when starting the OpenAI Codex CLI
|
|
38
|
+
(replace `<dir-with-db>` with its absolute path):
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
codex exec --sandbox workspace-write --add-dir <dir-with-db> "Run the GhostPaw CLI"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Alternatively, set `sandbox_workspace_write.writable_roots` in
|
|
45
|
+
`~/.codex/config.toml` before starting the session:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[sandbox_workspace_write]
|
|
49
|
+
writable_roots = ["/absolute/dir-with-db"]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
28
53
|
For the compact cheat sheet, run `ghostpaw-email skill --short`.
|
|
29
54
|
|
|
30
55
|
## Calling tools
|
package/dist/cli.js
CHANGED
|
@@ -808,7 +808,7 @@ var init_cli_version = __esm({
|
|
|
808
808
|
var emailVersion;
|
|
809
809
|
var init_version = __esm({
|
|
810
810
|
"src/version.ts"() {
|
|
811
|
-
emailVersion = "0.5.
|
|
811
|
+
emailVersion = "0.5.12";
|
|
812
812
|
}
|
|
813
813
|
});
|
|
814
814
|
function getConfigDir() {
|
|
@@ -1114,6 +1114,120 @@ var init_errors = __esm({
|
|
|
1114
1114
|
};
|
|
1115
1115
|
}
|
|
1116
1116
|
});
|
|
1117
|
+
function readFileValue(raw2, name) {
|
|
1118
|
+
if (!raw2.startsWith("@")) return raw2;
|
|
1119
|
+
if (raw2.startsWith("@@")) return raw2.slice(1);
|
|
1120
|
+
const path = raw2.slice(1);
|
|
1121
|
+
if (!path) throw new CliUsageError(`Empty file path for ${name}; use @@ for a literal leading @`);
|
|
1122
|
+
try {
|
|
1123
|
+
return readFileSync(path === "-" ? 0 : path, "utf8");
|
|
1124
|
+
} catch {
|
|
1125
|
+
throw new CliUsageError(
|
|
1126
|
+
`Cannot read value file for ${name}: ${path} (use @@ for a literal leading @)`
|
|
1127
|
+
);
|
|
1128
|
+
}
|
|
1129
|
+
}
|
|
1130
|
+
function parseCliArgs(argv2, spec) {
|
|
1131
|
+
const values = {};
|
|
1132
|
+
const positions = [];
|
|
1133
|
+
const flags = spec.flags ?? [];
|
|
1134
|
+
const convert = (raw2, arg) => {
|
|
1135
|
+
const value = arg.file ? readFileValue(raw2, arg.name) : raw2;
|
|
1136
|
+
let result = value;
|
|
1137
|
+
if (arg.type === "number" || arg.type === "integer") {
|
|
1138
|
+
result = Number(value);
|
|
1139
|
+
if (!value.trim() || !Number.isFinite(result) || arg.type === "integer" && !Number.isInteger(result))
|
|
1140
|
+
throw new CliUsageError(`Expected ${arg.type} for ${arg.name}: ${value}`);
|
|
1141
|
+
} else if (arg.type === "boolean") {
|
|
1142
|
+
if (!["true", "false"].includes(value))
|
|
1143
|
+
throw new CliUsageError(`Expected boolean for ${arg.name}`);
|
|
1144
|
+
result = value === "true";
|
|
1145
|
+
} else if (arg.type === "json") {
|
|
1146
|
+
try {
|
|
1147
|
+
result = JSON.parse(value);
|
|
1148
|
+
} catch {
|
|
1149
|
+
throw new CliUsageError(`Invalid JSON for ${arg.name}`);
|
|
1150
|
+
}
|
|
1151
|
+
}
|
|
1152
|
+
if (arg.enum && !arg.enum.includes(result))
|
|
1153
|
+
throw new CliUsageError(`${arg.name} must be one of: ${arg.enum.join(", ")}`);
|
|
1154
|
+
return result;
|
|
1155
|
+
};
|
|
1156
|
+
let ended = false;
|
|
1157
|
+
for (let i2 = 0; i2 < argv2.length; i2++) {
|
|
1158
|
+
const token = argv2[i2];
|
|
1159
|
+
if (!ended && token === "--") {
|
|
1160
|
+
ended = true;
|
|
1161
|
+
continue;
|
|
1162
|
+
}
|
|
1163
|
+
if (ended || token === "-" || !token.startsWith("-")) {
|
|
1164
|
+
positions.push(token);
|
|
1165
|
+
continue;
|
|
1166
|
+
}
|
|
1167
|
+
const [flag, inline] = token.split(/=(.*)/s);
|
|
1168
|
+
const negative = flag?.startsWith("--no-");
|
|
1169
|
+
const name = flag?.replace(/^--?/, "").replace(/^no-/, "");
|
|
1170
|
+
const arg = flags.find(
|
|
1171
|
+
(entry) => entry.name === name || keyOf(entry.name) === name || entry.short === name
|
|
1172
|
+
);
|
|
1173
|
+
if (!arg) {
|
|
1174
|
+
const prefix = (name ?? "").slice(0, 3);
|
|
1175
|
+
const suggestion = prefix ? flags.find((entry) => entry.name.startsWith(prefix)) : void 0;
|
|
1176
|
+
throw new CliUsageError(
|
|
1177
|
+
`Unknown flag: ${flag}${suggestion ? `; did you mean --${suggestion.name}?` : ""}`
|
|
1178
|
+
);
|
|
1179
|
+
}
|
|
1180
|
+
if (negative && arg.type !== "boolean")
|
|
1181
|
+
throw new CliUsageError(`--no-${arg.name} requires a boolean flag`);
|
|
1182
|
+
let raw2 = inline;
|
|
1183
|
+
if (arg.type === "boolean" && raw2 === void 0) raw2 = negative ? "false" : "true";
|
|
1184
|
+
if (raw2 === void 0) {
|
|
1185
|
+
const next = argv2[i2 + 1];
|
|
1186
|
+
if (next === void 0 || /^--[a-z]/i.test(next))
|
|
1187
|
+
throw new CliUsageError(`Missing value: --${arg.name}`);
|
|
1188
|
+
raw2 = next;
|
|
1189
|
+
i2++;
|
|
1190
|
+
}
|
|
1191
|
+
const key = keyOf(arg.name);
|
|
1192
|
+
if (arg.type === "array") {
|
|
1193
|
+
const item = convert(raw2, { ...arg, type: arg.itemType ?? "string" });
|
|
1194
|
+
values[key] = [...values[key] ?? [], item];
|
|
1195
|
+
} else values[key] = convert(raw2, arg);
|
|
1196
|
+
}
|
|
1197
|
+
let index = 0;
|
|
1198
|
+
for (const arg of spec.positionals ?? []) {
|
|
1199
|
+
if (index >= positions.length) continue;
|
|
1200
|
+
values[keyOf(arg.name)] = arg.variadic ? positions.slice(index).map((value) => convert(value, { ...arg, type: arg.itemType ?? arg.type })) : convert(positions[index], arg);
|
|
1201
|
+
index = arg.variadic ? positions.length : index + 1;
|
|
1202
|
+
}
|
|
1203
|
+
if (index < positions.length)
|
|
1204
|
+
throw new CliUsageError(`Unexpected positional: ${positions[index]}`);
|
|
1205
|
+
for (const arg of [...flags, ...spec.positionals ?? []]) {
|
|
1206
|
+
if (arg.required && values[keyOf(arg.name)] === void 0)
|
|
1207
|
+
throw new CliUsageError(`Missing required argument: ${arg.name}`);
|
|
1208
|
+
}
|
|
1209
|
+
return values;
|
|
1210
|
+
}
|
|
1211
|
+
function renderCliHelp(spec) {
|
|
1212
|
+
const describe = (arg) => `${arg.type}${arg.enum ? ` (${arg.enum.join("|")})` : ""}${arg.required ? " required" : ""}${arg.file ? " (@file, @- stdin, @@ literal @)" : ""} ${arg.description ?? ""}`;
|
|
1213
|
+
return `Usage: ${spec.command} ${(spec.positionals ?? []).map((arg) => `<${arg.name}${arg.variadic ? "..." : ""}>`).join(" ")} [flags]
|
|
1214
|
+
${spec.description ?? ""}
|
|
1215
|
+
|
|
1216
|
+
Positionals:
|
|
1217
|
+
${(spec.positionals ?? []).map((arg) => ` ${arg.name} ${describe(arg)}`).join("\n")}
|
|
1218
|
+
Flags:
|
|
1219
|
+
${(spec.flags ?? []).map((arg) => ` --${arg.name}${arg.short ? `, -${arg.short}` : ""} ${describe(arg)}`).join("\n")}
|
|
1220
|
+
`;
|
|
1221
|
+
}
|
|
1222
|
+
var CliUsageError, keyOf;
|
|
1223
|
+
var init_cli_args = __esm({
|
|
1224
|
+
"src/surfaces/cli_args.ts"() {
|
|
1225
|
+
CliUsageError = class extends Error {
|
|
1226
|
+
exitCode = 2;
|
|
1227
|
+
};
|
|
1228
|
+
keyOf = (name) => name.replace(/-([a-z])/g, (_3, c3) => c3.toUpperCase());
|
|
1229
|
+
}
|
|
1230
|
+
});
|
|
1117
1231
|
|
|
1118
1232
|
// src/cli/output.ts
|
|
1119
1233
|
function isTTY() {
|
|
@@ -1150,7 +1264,7 @@ var init_output = __esm({
|
|
|
1150
1264
|
|
|
1151
1265
|
// src/cli/errors.ts
|
|
1152
1266
|
function handleCliError(err) {
|
|
1153
|
-
if (err instanceof CliError) {
|
|
1267
|
+
if (err instanceof CliError || err instanceof CliUsageError) {
|
|
1154
1268
|
return { exitCode: err.exitCode, message: err.message };
|
|
1155
1269
|
}
|
|
1156
1270
|
if (err instanceof ConfigError) {
|
|
@@ -1208,10 +1322,16 @@ function reportError(err, useJson) {
|
|
|
1208
1322
|
}
|
|
1209
1323
|
return result.exitCode;
|
|
1210
1324
|
}
|
|
1325
|
+
function intFlag(raw2, rule, max = Number.MAX_SAFE_INTEGER) {
|
|
1326
|
+
const n3 = /^\d+$/.test(raw2.trim()) ? Number(raw2) : 0;
|
|
1327
|
+
if (n3 > 0 && n3 <= max) return n3;
|
|
1328
|
+
throw new CliError("invalid_flag_value", `${rule}. Got: "${raw2}"`);
|
|
1329
|
+
}
|
|
1211
1330
|
var EXIT_CODES, CliError;
|
|
1212
1331
|
var init_errors2 = __esm({
|
|
1213
1332
|
"src/cli/errors.ts"() {
|
|
1214
1333
|
init_errors();
|
|
1334
|
+
init_cli_args();
|
|
1215
1335
|
init_config();
|
|
1216
1336
|
init_output();
|
|
1217
1337
|
EXIT_CODES = {
|
|
@@ -1243,120 +1363,6 @@ var init_errors2 = __esm({
|
|
|
1243
1363
|
};
|
|
1244
1364
|
}
|
|
1245
1365
|
});
|
|
1246
|
-
function readFileValue(raw2, name) {
|
|
1247
|
-
if (!raw2.startsWith("@")) return raw2;
|
|
1248
|
-
if (raw2.startsWith("@@")) return raw2.slice(1);
|
|
1249
|
-
const path = raw2.slice(1);
|
|
1250
|
-
if (!path) throw new CliUsageError(`Empty file path for ${name}; use @@ for a literal leading @`);
|
|
1251
|
-
try {
|
|
1252
|
-
return readFileSync(path === "-" ? 0 : path, "utf8");
|
|
1253
|
-
} catch {
|
|
1254
|
-
throw new CliUsageError(
|
|
1255
|
-
`Cannot read value file for ${name}: ${path} (use @@ for a literal leading @)`
|
|
1256
|
-
);
|
|
1257
|
-
}
|
|
1258
|
-
}
|
|
1259
|
-
function parseCliArgs(argv2, spec) {
|
|
1260
|
-
const values = {};
|
|
1261
|
-
const positions = [];
|
|
1262
|
-
const flags = spec.flags ?? [];
|
|
1263
|
-
const convert = (raw2, arg) => {
|
|
1264
|
-
const value = arg.file ? readFileValue(raw2, arg.name) : raw2;
|
|
1265
|
-
let result = value;
|
|
1266
|
-
if (arg.type === "number" || arg.type === "integer") {
|
|
1267
|
-
result = Number(value);
|
|
1268
|
-
if (!value.trim() || !Number.isFinite(result) || arg.type === "integer" && !Number.isInteger(result))
|
|
1269
|
-
throw new CliUsageError(`Expected ${arg.type} for ${arg.name}: ${value}`);
|
|
1270
|
-
} else if (arg.type === "boolean") {
|
|
1271
|
-
if (!["true", "false"].includes(value))
|
|
1272
|
-
throw new CliUsageError(`Expected boolean for ${arg.name}`);
|
|
1273
|
-
result = value === "true";
|
|
1274
|
-
} else if (arg.type === "json") {
|
|
1275
|
-
try {
|
|
1276
|
-
result = JSON.parse(value);
|
|
1277
|
-
} catch {
|
|
1278
|
-
throw new CliUsageError(`Invalid JSON for ${arg.name}`);
|
|
1279
|
-
}
|
|
1280
|
-
}
|
|
1281
|
-
if (arg.enum && !arg.enum.includes(result))
|
|
1282
|
-
throw new CliUsageError(`${arg.name} must be one of: ${arg.enum.join(", ")}`);
|
|
1283
|
-
return result;
|
|
1284
|
-
};
|
|
1285
|
-
let ended = false;
|
|
1286
|
-
for (let i2 = 0; i2 < argv2.length; i2++) {
|
|
1287
|
-
const token = argv2[i2];
|
|
1288
|
-
if (!ended && token === "--") {
|
|
1289
|
-
ended = true;
|
|
1290
|
-
continue;
|
|
1291
|
-
}
|
|
1292
|
-
if (ended || token === "-" || !token.startsWith("-")) {
|
|
1293
|
-
positions.push(token);
|
|
1294
|
-
continue;
|
|
1295
|
-
}
|
|
1296
|
-
const [flag, inline] = token.split(/=(.*)/s);
|
|
1297
|
-
const negative = flag?.startsWith("--no-");
|
|
1298
|
-
const name = flag?.replace(/^--?/, "").replace(/^no-/, "");
|
|
1299
|
-
const arg = flags.find(
|
|
1300
|
-
(entry) => entry.name === name || keyOf(entry.name) === name || entry.short === name
|
|
1301
|
-
);
|
|
1302
|
-
if (!arg) {
|
|
1303
|
-
const prefix = (name ?? "").slice(0, 3);
|
|
1304
|
-
const suggestion = prefix ? flags.find((entry) => entry.name.startsWith(prefix)) : void 0;
|
|
1305
|
-
throw new CliUsageError(
|
|
1306
|
-
`Unknown flag: ${flag}${suggestion ? `; did you mean --${suggestion.name}?` : ""}`
|
|
1307
|
-
);
|
|
1308
|
-
}
|
|
1309
|
-
if (negative && arg.type !== "boolean")
|
|
1310
|
-
throw new CliUsageError(`--no-${arg.name} requires a boolean flag`);
|
|
1311
|
-
let raw2 = inline;
|
|
1312
|
-
if (arg.type === "boolean" && raw2 === void 0) raw2 = negative ? "false" : "true";
|
|
1313
|
-
if (raw2 === void 0) {
|
|
1314
|
-
const next = argv2[i2 + 1];
|
|
1315
|
-
if (next === void 0 || /^--[a-z]/i.test(next))
|
|
1316
|
-
throw new CliUsageError(`Missing value: --${arg.name}`);
|
|
1317
|
-
raw2 = next;
|
|
1318
|
-
i2++;
|
|
1319
|
-
}
|
|
1320
|
-
const key = keyOf(arg.name);
|
|
1321
|
-
if (arg.type === "array") {
|
|
1322
|
-
const item = convert(raw2, { ...arg, type: arg.itemType ?? "string" });
|
|
1323
|
-
values[key] = [...values[key] ?? [], item];
|
|
1324
|
-
} else values[key] = convert(raw2, arg);
|
|
1325
|
-
}
|
|
1326
|
-
let index = 0;
|
|
1327
|
-
for (const arg of spec.positionals ?? []) {
|
|
1328
|
-
if (index >= positions.length) continue;
|
|
1329
|
-
values[keyOf(arg.name)] = arg.variadic ? positions.slice(index).map((value) => convert(value, { ...arg, type: arg.itemType ?? arg.type })) : convert(positions[index], arg);
|
|
1330
|
-
index = arg.variadic ? positions.length : index + 1;
|
|
1331
|
-
}
|
|
1332
|
-
if (index < positions.length)
|
|
1333
|
-
throw new CliUsageError(`Unexpected positional: ${positions[index]}`);
|
|
1334
|
-
for (const arg of [...flags, ...spec.positionals ?? []]) {
|
|
1335
|
-
if (arg.required && values[keyOf(arg.name)] === void 0)
|
|
1336
|
-
throw new CliUsageError(`Missing required argument: ${arg.name}`);
|
|
1337
|
-
}
|
|
1338
|
-
return values;
|
|
1339
|
-
}
|
|
1340
|
-
function renderCliHelp(spec) {
|
|
1341
|
-
const describe = (arg) => `${arg.type}${arg.enum ? ` (${arg.enum.join("|")})` : ""}${arg.required ? " required" : ""}${arg.file ? " (@file, @- stdin, @@ literal @)" : ""} ${arg.description ?? ""}`;
|
|
1342
|
-
return `Usage: ${spec.command} ${(spec.positionals ?? []).map((arg) => `<${arg.name}${arg.variadic ? "..." : ""}>`).join(" ")} [flags]
|
|
1343
|
-
${spec.description ?? ""}
|
|
1344
|
-
|
|
1345
|
-
Positionals:
|
|
1346
|
-
${(spec.positionals ?? []).map((arg) => ` ${arg.name} ${describe(arg)}`).join("\n")}
|
|
1347
|
-
Flags:
|
|
1348
|
-
${(spec.flags ?? []).map((arg) => ` --${arg.name}${arg.short ? `, -${arg.short}` : ""} ${describe(arg)}`).join("\n")}
|
|
1349
|
-
`;
|
|
1350
|
-
}
|
|
1351
|
-
var CliUsageError, keyOf;
|
|
1352
|
-
var init_cli_args = __esm({
|
|
1353
|
-
"src/surfaces/cli_args.ts"() {
|
|
1354
|
-
CliUsageError = class extends Error {
|
|
1355
|
-
exitCode = 2;
|
|
1356
|
-
};
|
|
1357
|
-
keyOf = (name) => name.replace(/-([a-z])/g, (_3, c3) => c3.toUpperCase());
|
|
1358
|
-
}
|
|
1359
|
-
});
|
|
1360
1366
|
|
|
1361
1367
|
// src/surfaces/schema_example.ts
|
|
1362
1368
|
function schemaExample(schema, seed = {}) {
|
|
@@ -6217,7 +6223,14 @@ var init_read = __esm({
|
|
|
6217
6223
|
}
|
|
6218
6224
|
});
|
|
6219
6225
|
function preparePrivateStorage(path) {
|
|
6220
|
-
|
|
6226
|
+
const directory = dirname(path);
|
|
6227
|
+
try {
|
|
6228
|
+
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
6229
|
+
} catch (error) {
|
|
6230
|
+
const code = error.code;
|
|
6231
|
+
const reason = code === "ENOTDIR" || code === "EEXIST" ? "a path component is not a directory" : code === "EACCES" || code === "EPERM" ? "permission denied" : code === "EROFS" ? "read-only file system" : code;
|
|
6232
|
+
throw new CliUsageError(`Cannot create database directory ${directory}: ${reason}`);
|
|
6233
|
+
}
|
|
6221
6234
|
const created = [];
|
|
6222
6235
|
for (const file of [path, `${path}-wal`, `${path}-shm`]) {
|
|
6223
6236
|
try {
|
|
@@ -6250,6 +6263,7 @@ function withPrivateCreation(operation, secure) {
|
|
|
6250
6263
|
}
|
|
6251
6264
|
var init_private_storage = __esm({
|
|
6252
6265
|
"src/private_storage.ts"() {
|
|
6266
|
+
init_cli_args();
|
|
6253
6267
|
}
|
|
6254
6268
|
});
|
|
6255
6269
|
|
|
@@ -7297,7 +7311,8 @@ async function runCliCommand(argv2, options) {
|
|
|
7297
7311
|
const stdin2 = options.stdin ?? process.stdin;
|
|
7298
7312
|
const args = [...argv2];
|
|
7299
7313
|
const tree = cliCommands(options.tools);
|
|
7300
|
-
|
|
7314
|
+
const isQuiet = (arg) => arg === "--quiet" || arg === "-q";
|
|
7315
|
+
let json = argv2.includes("--json"), quiet = argv2.some(isQuiet), compact = false, help = false;
|
|
7301
7316
|
let db;
|
|
7302
7317
|
const fail = (message, code) => {
|
|
7303
7318
|
stderr.write(`${message}
|
|
@@ -7331,7 +7346,7 @@ async function runCliCommand(argv2, options) {
|
|
|
7331
7346
|
db = flag === "--db" ? args.splice(i2 + 1, 1)[0] : flag.slice(5);
|
|
7332
7347
|
if (!db || db.startsWith("--")) throw new CliUsageError("--db requires a path");
|
|
7333
7348
|
} else if (flag === "--json") json = true;
|
|
7334
|
-
else if (flag
|
|
7349
|
+
else if (isQuiet(flag)) quiet = true;
|
|
7335
7350
|
else if (flag === "--compact") compact = true;
|
|
7336
7351
|
else if (flag === "--help" || flag === "-h") help = true;
|
|
7337
7352
|
else if (["--version", "-V", "-v"].includes(flag ?? "")) {
|
|
@@ -7398,7 +7413,7 @@ Commands:
|
|
|
7398
7413
|
${matches.map((command) => ` ${command.path}`).join("\n")}
|
|
7399
7414
|
mcp, skill, tools [--json], describe <tool>, call <tool> [JSON|-], completions <bash|zsh|fish>, version
|
|
7400
7415
|
Version output: --version --short or --version --json
|
|
7401
|
-
Global flags: --db <path>, --json, --quiet, --compact, --help/-h, --version/-V/-v, --no-color
|
|
7416
|
+
Global flags: --db <path>, --json, -q, --quiet, --compact, --help/-h, --version/-V/-v, --no-color
|
|
7402
7417
|
`
|
|
7403
7418
|
);
|
|
7404
7419
|
return 0;
|
|
@@ -7699,7 +7714,10 @@ ${JSON.stringify(tool.inputSchema, null, 2)}
|
|
|
7699
7714
|
try {
|
|
7700
7715
|
context = await options.openContext(ctxOptions);
|
|
7701
7716
|
} catch (cause) {
|
|
7702
|
-
return fail(
|
|
7717
|
+
return fail(
|
|
7718
|
+
cause instanceof CliUsageError ? cause.message : String(cause),
|
|
7719
|
+
cause instanceof CliUsageError ? 2 : 1
|
|
7720
|
+
);
|
|
7703
7721
|
}
|
|
7704
7722
|
try {
|
|
7705
7723
|
const result = await tool.handler(context, input);
|
|
@@ -7717,6 +7735,7 @@ ${JSON.stringify(tool.inputSchema, null, 2)}
|
|
|
7717
7735
|
var init_cli = __esm({
|
|
7718
7736
|
"src/surfaces/cli.ts"() {
|
|
7719
7737
|
init_cli_version();
|
|
7738
|
+
init_cli_args();
|
|
7720
7739
|
init_cli_commands();
|
|
7721
7740
|
init_parameter_rows();
|
|
7722
7741
|
init_surface_types();
|
|
@@ -8014,8 +8033,8 @@ email read eml --folder INBOX --uid 42 | mail -s "fwd" target@example.com
|
|
|
8014
8033
|
# JSON pipeline
|
|
8015
8034
|
email read queue --json | jq '.entities[] | select(.title | test("invoice"; "i")) | .id'
|
|
8016
8035
|
|
|
8017
|
-
#
|
|
8018
|
-
email organize archive --folder INBOX --uids 42
|
|
8036
|
+
# -q, --quiet: exit code only
|
|
8037
|
+
email organize archive --folder INBOX --uids 42 -q && echo "archived"
|
|
8019
8038
|
\`\`\`
|
|
8020
8039
|
|
|
8021
8040
|
---
|
|
@@ -8954,7 +8973,32 @@ var init_email_skill_spec = __esm({
|
|
|
8954
8973
|
bin: "ghostpaw-email",
|
|
8955
8974
|
packageName: "@ghostpaw/email",
|
|
8956
8975
|
server: "ghostpaw-email",
|
|
8957
|
-
about: emailMcpInstructions
|
|
8976
|
+
about: `${emailMcpInstructions}
|
|
8977
|
+
|
|
8978
|
+
## Running inside sandboxed agent harnesses
|
|
8979
|
+
|
|
8980
|
+
Inside a Codex CLI \`--sandbox workspace-write\` session, the database and its
|
|
8981
|
+
parent directory must be inside a writable root, including SQLite's \`-wal\` and
|
|
8982
|
+
\`-shm\` side files. A default DB under \`~/.ghostpaw\` outside those roots can fail
|
|
8983
|
+
with \`SQLITE_CANTOPEN\` or \`EPERM\` (often exit 70; directory creation failures
|
|
8984
|
+
may exit 2), even when normal shell permissions allow access. Put the DB inside the workspace with \`--db ./state/email.db\`,
|
|
8985
|
+
or set \`GHOSTPAW_EMAIL_DB="$PWD/state/email.db"\` for CLI/MCP use.
|
|
8986
|
+
|
|
8987
|
+
To use an external DB directory, add it when starting the OpenAI Codex CLI
|
|
8988
|
+
(replace \`<dir-with-db>\` with its absolute path):
|
|
8989
|
+
|
|
8990
|
+
\`\`\`sh
|
|
8991
|
+
codex exec --sandbox workspace-write --add-dir <dir-with-db> "Run the GhostPaw CLI"
|
|
8992
|
+
\`\`\`
|
|
8993
|
+
|
|
8994
|
+
Alternatively, set \`sandbox_workspace_write.writable_roots\` in
|
|
8995
|
+
\`~/.codex/config.toml\` before starting the session:
|
|
8996
|
+
|
|
8997
|
+
\`\`\`toml
|
|
8998
|
+
[sandbox_workspace_write]
|
|
8999
|
+
writable_roots = ["/absolute/dir-with-db"]
|
|
9000
|
+
\`\`\`
|
|
9001
|
+
`,
|
|
8958
9002
|
tools: emailSurfaceTools,
|
|
8959
9003
|
workflows: [...emailSkills, { name: "cli", description: "Complete existing email CLI guide." }],
|
|
8960
9004
|
principles: [
|
|
@@ -10653,12 +10697,12 @@ var accountCommand = defineCommand({
|
|
|
10653
10697
|
name,
|
|
10654
10698
|
imap: {
|
|
10655
10699
|
host: args["imap-host"],
|
|
10656
|
-
port:
|
|
10700
|
+
port: intFlag(args["imap-port"] ?? "993", "--imap-port must be 1-65535", 65535),
|
|
10657
10701
|
tls: args["imap-tls"]
|
|
10658
10702
|
},
|
|
10659
10703
|
smtp: {
|
|
10660
10704
|
host: args["smtp-host"],
|
|
10661
|
-
port:
|
|
10705
|
+
port: intFlag(args["smtp-port"] ?? "587", "--smtp-port must be 1-65535", 65535),
|
|
10662
10706
|
tls: args["smtp-tls"]
|
|
10663
10707
|
},
|
|
10664
10708
|
auth
|
|
@@ -10946,8 +10990,8 @@ async function withMailbox(account, fn) {
|
|
|
10946
10990
|
};
|
|
10947
10991
|
process.once("SIGINT", onSignal);
|
|
10948
10992
|
process.once("SIGTERM", onSignal);
|
|
10949
|
-
await mailbox.connect();
|
|
10950
10993
|
try {
|
|
10994
|
+
await mailbox.connect();
|
|
10951
10995
|
const ctx = {
|
|
10952
10996
|
read: mailbox.read,
|
|
10953
10997
|
write: mailbox.write,
|
|
@@ -11009,6 +11053,7 @@ var sharedArgs = {
|
|
|
11009
11053
|
account: { type: "string", description: "Account name (overrides default)" },
|
|
11010
11054
|
json: { type: "boolean", description: "Output full result as JSON", default: false },
|
|
11011
11055
|
quiet: {
|
|
11056
|
+
alias: "q",
|
|
11012
11057
|
type: "boolean",
|
|
11013
11058
|
description: "Suppress all output except errors",
|
|
11014
11059
|
default: false
|
|
@@ -11250,11 +11295,7 @@ function parseAddresses(raw2) {
|
|
|
11250
11295
|
}
|
|
11251
11296
|
function parseUid(raw2) {
|
|
11252
11297
|
if (!raw2) throw new CliError("missing_required_flag", "--uid is required.");
|
|
11253
|
-
|
|
11254
|
-
if (!Number.isFinite(n3) || n3 <= 0) {
|
|
11255
|
-
throw new CliError("invalid_flag_value", `--uid must be a positive integer. Got: "${raw2}"`);
|
|
11256
|
-
}
|
|
11257
|
-
return n3;
|
|
11298
|
+
return intFlag(raw2, "--uid must be a positive integer");
|
|
11258
11299
|
}
|
|
11259
11300
|
|
|
11260
11301
|
// src/cli/commands/organize.ts
|
|
@@ -11291,6 +11332,7 @@ var organizeCommand = defineCommand({
|
|
|
11291
11332
|
account: { type: "string", description: "Account name (overrides default)" },
|
|
11292
11333
|
json: { type: "boolean", description: "Output full result as JSON", default: false },
|
|
11293
11334
|
quiet: {
|
|
11335
|
+
alias: "q",
|
|
11294
11336
|
type: "boolean",
|
|
11295
11337
|
description: "Suppress all output except errors",
|
|
11296
11338
|
default: false
|
|
@@ -11326,16 +11368,7 @@ function parseUids(raw2, action) {
|
|
|
11326
11368
|
if (!raw2) {
|
|
11327
11369
|
throw new CliError("missing_required_flag", `--uids is required for action: ${action}`);
|
|
11328
11370
|
}
|
|
11329
|
-
return raw2.split(",").map((s4) =>
|
|
11330
|
-
const n3 = parseInt(s4.trim(), 10);
|
|
11331
|
-
if (!Number.isFinite(n3) || n3 <= 0) {
|
|
11332
|
-
throw new CliError(
|
|
11333
|
-
"invalid_flag_value",
|
|
11334
|
-
`--uids must be comma-separated positive integers. Got: "${s4.trim()}"`
|
|
11335
|
-
);
|
|
11336
|
-
}
|
|
11337
|
-
return n3;
|
|
11338
|
-
});
|
|
11371
|
+
return raw2.split(",").map((s4) => intFlag(s4.trim(), "--uids must be comma-separated positive integers"));
|
|
11339
11372
|
}
|
|
11340
11373
|
function requireFolder(folder, action) {
|
|
11341
11374
|
if (!folder) {
|
|
@@ -11487,6 +11520,7 @@ var sharedArgs2 = {
|
|
|
11487
11520
|
account: { type: "string", description: "Account name (overrides default)" },
|
|
11488
11521
|
json: { type: "boolean", description: "Output full result as JSON", default: false },
|
|
11489
11522
|
quiet: {
|
|
11523
|
+
alias: "q",
|
|
11490
11524
|
type: "boolean",
|
|
11491
11525
|
description: "Suppress all output except errors",
|
|
11492
11526
|
default: false
|
|
@@ -11634,14 +11668,7 @@ Usage: ghostpaw-email read ${view} ${flag} <value>`
|
|
|
11634
11668
|
}
|
|
11635
11669
|
}
|
|
11636
11670
|
function parseUid2(raw2, view) {
|
|
11637
|
-
|
|
11638
|
-
if (!Number.isFinite(n3) || n3 <= 0) {
|
|
11639
|
-
throw new CliError(
|
|
11640
|
-
"invalid_flag_value",
|
|
11641
|
-
`--uid must be a positive integer (view: ${view}). Got: "${raw2}"`
|
|
11642
|
-
);
|
|
11643
|
-
}
|
|
11644
|
-
return n3;
|
|
11671
|
+
return intFlag(raw2, `--uid must be a positive integer (view: ${view})`);
|
|
11645
11672
|
}
|
|
11646
11673
|
|
|
11647
11674
|
// src/cli/commands/search.ts
|
|
@@ -11657,6 +11684,7 @@ var searchCommand = defineCommand({
|
|
|
11657
11684
|
account: { type: "string", description: "Account name (overrides default)" },
|
|
11658
11685
|
json: { type: "boolean", description: "Output full result as JSON", default: false },
|
|
11659
11686
|
quiet: {
|
|
11687
|
+
alias: "q",
|
|
11660
11688
|
type: "boolean",
|
|
11661
11689
|
description: "Suppress all output except errors",
|
|
11662
11690
|
default: false
|
|
@@ -11699,16 +11727,7 @@ var searchCommand = defineCommand({
|
|
|
11699
11727
|
if (args.before) input.before = args.before;
|
|
11700
11728
|
if (args["has-attachments"]) input.hasAttachments = true;
|
|
11701
11729
|
if (args["unread-only"]) input.unreadOnly = true;
|
|
11702
|
-
if (args.limit)
|
|
11703
|
-
const n3 = parseInt(args.limit, 10);
|
|
11704
|
-
if (!Number.isFinite(n3) || n3 <= 0) {
|
|
11705
|
-
throw new CliError(
|
|
11706
|
-
"invalid_flag_value",
|
|
11707
|
-
`--limit must be a positive integer. Got: "${args.limit}"`
|
|
11708
|
-
);
|
|
11709
|
-
}
|
|
11710
|
-
input.limit = n3;
|
|
11711
|
-
}
|
|
11730
|
+
if (args.limit) input.limit = intFlag(args.limit, "--limit must be a positive integer");
|
|
11712
11731
|
const account = resolveAccount(args.account);
|
|
11713
11732
|
const result = await withMailbox(account, (ctx) => searchTool.handler(ctx, input));
|
|
11714
11733
|
renderResult(result, { json: args.json ?? false, quiet: args.quiet ?? false });
|
|
@@ -11730,6 +11749,7 @@ var syncCommand = defineCommand({
|
|
|
11730
11749
|
account: { type: "string", description: "Account name (overrides default)" },
|
|
11731
11750
|
json: { type: "boolean", description: "Output full result as JSON", default: false },
|
|
11732
11751
|
quiet: {
|
|
11752
|
+
alias: "q",
|
|
11733
11753
|
type: "boolean",
|
|
11734
11754
|
description: "Suppress all output except errors",
|
|
11735
11755
|
default: false
|
|
@@ -11833,14 +11853,24 @@ async function runEmailCli(args = process.argv.slice(2)) {
|
|
|
11833
11853
|
index += 2;
|
|
11834
11854
|
continue;
|
|
11835
11855
|
}
|
|
11836
|
-
if (
|
|
11856
|
+
if (["--compact", "--json", "--quiet", "-q", "--no-color"].includes(token ?? "") || token?.startsWith("--db=")) {
|
|
11837
11857
|
index++;
|
|
11838
11858
|
continue;
|
|
11839
11859
|
}
|
|
11840
11860
|
break;
|
|
11841
11861
|
}
|
|
11842
11862
|
const command = args[index];
|
|
11843
|
-
if (command && ([
|
|
11863
|
+
if (command && ([
|
|
11864
|
+
"mcp",
|
|
11865
|
+
"tools",
|
|
11866
|
+
"call",
|
|
11867
|
+
"skill",
|
|
11868
|
+
"describe",
|
|
11869
|
+
"mail",
|
|
11870
|
+
"help",
|
|
11871
|
+
"completions",
|
|
11872
|
+
"version"
|
|
11873
|
+
].includes(command) || command.startsWith("mail_"))) {
|
|
11844
11874
|
const { runToolCli: runToolCli2 } = await Promise.resolve().then(() => (init_cli(), cli_exports));
|
|
11845
11875
|
const { emailCliOptions: emailCliOptions2 } = await Promise.resolve().then(() => (init_email_cli_options(), email_cli_options_exports));
|
|
11846
11876
|
process.exitCode = await runToolCli2(args, emailCliOptions2);
|
package/dist/index.cjs
CHANGED
|
@@ -3722,8 +3722,22 @@ var runtime_exports = {};
|
|
|
3722
3722
|
__export(runtime_exports, {
|
|
3723
3723
|
init: () => init
|
|
3724
3724
|
});
|
|
3725
|
+
|
|
3726
|
+
// src/surfaces/cli_args.ts
|
|
3727
|
+
var CliUsageError = class extends Error {
|
|
3728
|
+
exitCode = 2;
|
|
3729
|
+
};
|
|
3730
|
+
|
|
3731
|
+
// src/private_storage.ts
|
|
3725
3732
|
function preparePrivateStorage(path) {
|
|
3726
|
-
|
|
3733
|
+
const directory = node_path.dirname(path);
|
|
3734
|
+
try {
|
|
3735
|
+
node_fs.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
3736
|
+
} catch (error) {
|
|
3737
|
+
const code = error.code;
|
|
3738
|
+
const reason = code === "ENOTDIR" || code === "EEXIST" ? "a path component is not a directory" : code === "EACCES" || code === "EPERM" ? "permission denied" : code === "EROFS" ? "read-only file system" : code;
|
|
3739
|
+
throw new CliUsageError(`Cannot create database directory ${directory}: ${reason}`);
|
|
3740
|
+
}
|
|
3727
3741
|
const created = [];
|
|
3728
3742
|
for (const file of [path, `${path}-wal`, `${path}-shm`]) {
|
|
3729
3743
|
try {
|
package/dist/index.js
CHANGED
|
@@ -3698,8 +3698,22 @@ var runtime_exports = {};
|
|
|
3698
3698
|
__export(runtime_exports, {
|
|
3699
3699
|
init: () => init
|
|
3700
3700
|
});
|
|
3701
|
+
|
|
3702
|
+
// src/surfaces/cli_args.ts
|
|
3703
|
+
var CliUsageError = class extends Error {
|
|
3704
|
+
exitCode = 2;
|
|
3705
|
+
};
|
|
3706
|
+
|
|
3707
|
+
// src/private_storage.ts
|
|
3701
3708
|
function preparePrivateStorage(path) {
|
|
3702
|
-
|
|
3709
|
+
const directory = dirname(path);
|
|
3710
|
+
try {
|
|
3711
|
+
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
3712
|
+
} catch (error) {
|
|
3713
|
+
const code = error.code;
|
|
3714
|
+
const reason = code === "ENOTDIR" || code === "EEXIST" ? "a path component is not a directory" : code === "EACCES" || code === "EPERM" ? "permission denied" : code === "EROFS" ? "read-only file system" : code;
|
|
3715
|
+
throw new CliUsageError(`Cannot create database directory ${directory}: ${reason}`);
|
|
3716
|
+
}
|
|
3703
3717
|
const created = [];
|
|
3704
3718
|
for (const file of [path, `${path}-wal`, `${path}-shm`]) {
|
|
3705
3719
|
try {
|
package/dist/mcp-server.js
CHANGED
|
@@ -316,7 +316,7 @@ var init_mcp_stdio = __esm({
|
|
|
316
316
|
var emailVersion;
|
|
317
317
|
var init_version = __esm({
|
|
318
318
|
"src/version.ts"() {
|
|
319
|
-
emailVersion = "0.5.
|
|
319
|
+
emailVersion = "0.5.12";
|
|
320
320
|
}
|
|
321
321
|
});
|
|
322
322
|
|
|
@@ -2267,6 +2267,16 @@ var init_config = __esm({
|
|
|
2267
2267
|
}
|
|
2268
2268
|
});
|
|
2269
2269
|
|
|
2270
|
+
// src/surfaces/cli_args.ts
|
|
2271
|
+
var CliUsageError;
|
|
2272
|
+
var init_cli_args = __esm({
|
|
2273
|
+
"src/surfaces/cli_args.ts"() {
|
|
2274
|
+
CliUsageError = class extends Error {
|
|
2275
|
+
exitCode = 2;
|
|
2276
|
+
};
|
|
2277
|
+
}
|
|
2278
|
+
});
|
|
2279
|
+
|
|
2270
2280
|
// src/cli/errors.ts
|
|
2271
2281
|
var EXIT_CODES, CliError;
|
|
2272
2282
|
var init_errors2 = __esm({
|
|
@@ -6345,7 +6355,14 @@ var init_email_mcp_options = __esm({
|
|
|
6345
6355
|
}
|
|
6346
6356
|
});
|
|
6347
6357
|
function preparePrivateStorage(path) {
|
|
6348
|
-
|
|
6358
|
+
const directory = dirname(path);
|
|
6359
|
+
try {
|
|
6360
|
+
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
6361
|
+
} catch (error) {
|
|
6362
|
+
const code = error.code;
|
|
6363
|
+
const reason = code === "ENOTDIR" || code === "EEXIST" ? "a path component is not a directory" : code === "EACCES" || code === "EPERM" ? "permission denied" : code === "EROFS" ? "read-only file system" : code;
|
|
6364
|
+
throw new CliUsageError(`Cannot create database directory ${directory}: ${reason}`);
|
|
6365
|
+
}
|
|
6349
6366
|
const created = [];
|
|
6350
6367
|
for (const file of [path, `${path}-wal`, `${path}-shm`]) {
|
|
6351
6368
|
try {
|
|
@@ -6378,6 +6395,7 @@ function withPrivateCreation(operation, secure) {
|
|
|
6378
6395
|
}
|
|
6379
6396
|
var init_private_storage = __esm({
|
|
6380
6397
|
"src/private_storage.ts"() {
|
|
6398
|
+
init_cli_args();
|
|
6381
6399
|
}
|
|
6382
6400
|
});
|
|
6383
6401
|
|
package/dist/mcp.cjs
CHANGED
|
@@ -1020,6 +1020,16 @@ var init_config = __esm({
|
|
|
1020
1020
|
}
|
|
1021
1021
|
});
|
|
1022
1022
|
|
|
1023
|
+
// src/surfaces/cli_args.ts
|
|
1024
|
+
var CliUsageError;
|
|
1025
|
+
var init_cli_args = __esm({
|
|
1026
|
+
"src/surfaces/cli_args.ts"() {
|
|
1027
|
+
CliUsageError = class extends Error {
|
|
1028
|
+
exitCode = 2;
|
|
1029
|
+
};
|
|
1030
|
+
}
|
|
1031
|
+
});
|
|
1032
|
+
|
|
1023
1033
|
// src/cli/errors.ts
|
|
1024
1034
|
var EXIT_CODES, CliError;
|
|
1025
1035
|
var init_errors2 = __esm({
|
|
@@ -5008,7 +5018,7 @@ var init_network = __esm({
|
|
|
5008
5018
|
});
|
|
5009
5019
|
|
|
5010
5020
|
// src/version.ts
|
|
5011
|
-
var emailVersion = "0.5.
|
|
5021
|
+
var emailVersion = "0.5.12";
|
|
5012
5022
|
|
|
5013
5023
|
// src/surface/email_mcp_instructions.ts
|
|
5014
5024
|
var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
|
|
@@ -6130,8 +6140,18 @@ function emailMcpOptions(context) {
|
|
|
6130
6140
|
})
|
|
6131
6141
|
};
|
|
6132
6142
|
}
|
|
6143
|
+
|
|
6144
|
+
// src/private_storage.ts
|
|
6145
|
+
init_cli_args();
|
|
6133
6146
|
function preparePrivateStorage(path) {
|
|
6134
|
-
|
|
6147
|
+
const directory = node_path.dirname(path);
|
|
6148
|
+
try {
|
|
6149
|
+
node_fs.mkdirSync(directory, { recursive: true, mode: 448 });
|
|
6150
|
+
} catch (error) {
|
|
6151
|
+
const code = error.code;
|
|
6152
|
+
const reason = code === "ENOTDIR" || code === "EEXIST" ? "a path component is not a directory" : code === "EACCES" || code === "EPERM" ? "permission denied" : code === "EROFS" ? "read-only file system" : code;
|
|
6153
|
+
throw new CliUsageError(`Cannot create database directory ${directory}: ${reason}`);
|
|
6154
|
+
}
|
|
6135
6155
|
const created = [];
|
|
6136
6156
|
for (const file of [path, `${path}-wal`, `${path}-shm`]) {
|
|
6137
6157
|
try {
|
package/dist/mcp.js
CHANGED
|
@@ -996,6 +996,16 @@ var init_config = __esm({
|
|
|
996
996
|
}
|
|
997
997
|
});
|
|
998
998
|
|
|
999
|
+
// src/surfaces/cli_args.ts
|
|
1000
|
+
var CliUsageError;
|
|
1001
|
+
var init_cli_args = __esm({
|
|
1002
|
+
"src/surfaces/cli_args.ts"() {
|
|
1003
|
+
CliUsageError = class extends Error {
|
|
1004
|
+
exitCode = 2;
|
|
1005
|
+
};
|
|
1006
|
+
}
|
|
1007
|
+
});
|
|
1008
|
+
|
|
999
1009
|
// src/cli/errors.ts
|
|
1000
1010
|
var EXIT_CODES, CliError;
|
|
1001
1011
|
var init_errors2 = __esm({
|
|
@@ -4984,7 +4994,7 @@ var init_network = __esm({
|
|
|
4984
4994
|
});
|
|
4985
4995
|
|
|
4986
4996
|
// src/version.ts
|
|
4987
|
-
var emailVersion = "0.5.
|
|
4997
|
+
var emailVersion = "0.5.12";
|
|
4988
4998
|
|
|
4989
4999
|
// src/surface/email_mcp_instructions.ts
|
|
4990
5000
|
var emailMcpInstructions = "Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.";
|
|
@@ -6106,8 +6116,18 @@ function emailMcpOptions(context) {
|
|
|
6106
6116
|
})
|
|
6107
6117
|
};
|
|
6108
6118
|
}
|
|
6119
|
+
|
|
6120
|
+
// src/private_storage.ts
|
|
6121
|
+
init_cli_args();
|
|
6109
6122
|
function preparePrivateStorage(path) {
|
|
6110
|
-
|
|
6123
|
+
const directory = dirname(path);
|
|
6124
|
+
try {
|
|
6125
|
+
mkdirSync(directory, { recursive: true, mode: 448 });
|
|
6126
|
+
} catch (error) {
|
|
6127
|
+
const code = error.code;
|
|
6128
|
+
const reason = code === "ENOTDIR" || code === "EEXIST" ? "a path component is not a directory" : code === "EACCES" || code === "EPERM" ? "permission denied" : code === "EROFS" ? "read-only file system" : code;
|
|
6129
|
+
throw new CliUsageError(`Cannot create database directory ${directory}: ${reason}`);
|
|
6130
|
+
}
|
|
6111
6131
|
const created = [];
|
|
6112
6132
|
for (const file of [path, `${path}-wal`, `${path}-shm`]) {
|
|
6113
6133
|
try {
|
package/package.json
CHANGED
package/skills/email/SKILL.md
CHANGED
|
@@ -25,6 +25,31 @@ Run tools as `ghostpaw-email ...`; use `~/.local/bin/ghostpaw-email` if it is no
|
|
|
25
25
|
|
|
26
26
|
Read and search cached email offline. Configure live accounts with email account add before network operations. Inspect messages before replying or changing folders. Confirm recipients and content before sending; trash and folder deletion can remove mail. Credentials use the existing email CLI account configuration or EMAIL_* environment variables.
|
|
27
27
|
|
|
28
|
+
## Running inside sandboxed agent harnesses
|
|
29
|
+
|
|
30
|
+
Inside a Codex CLI `--sandbox workspace-write` session, the database and its
|
|
31
|
+
parent directory must be inside a writable root, including SQLite's `-wal` and
|
|
32
|
+
`-shm` side files. A default DB under `~/.ghostpaw` outside those roots can fail
|
|
33
|
+
with `SQLITE_CANTOPEN` or `EPERM` (often exit 70; directory creation failures
|
|
34
|
+
may exit 2), even when normal shell permissions allow access. Put the DB inside the workspace with `--db ./state/email.db`,
|
|
35
|
+
or set `GHOSTPAW_EMAIL_DB="$PWD/state/email.db"` for CLI/MCP use.
|
|
36
|
+
|
|
37
|
+
To use an external DB directory, add it when starting the OpenAI Codex CLI
|
|
38
|
+
(replace `<dir-with-db>` with its absolute path):
|
|
39
|
+
|
|
40
|
+
```sh
|
|
41
|
+
codex exec --sandbox workspace-write --add-dir <dir-with-db> "Run the GhostPaw CLI"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Alternatively, set `sandbox_workspace_write.writable_roots` in
|
|
45
|
+
`~/.codex/config.toml` before starting the session:
|
|
46
|
+
|
|
47
|
+
```toml
|
|
48
|
+
[sandbox_workspace_write]
|
|
49
|
+
writable_roots = ["/absolute/dir-with-db"]
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
|
|
28
53
|
For the compact cheat sheet, run `ghostpaw-email skill --short`.
|
|
29
54
|
|
|
30
55
|
## Calling tools
|
|
@@ -271,8 +271,8 @@ email read eml --folder INBOX --uid 42 | mail -s "fwd" target@example.com
|
|
|
271
271
|
# JSON pipeline
|
|
272
272
|
email read queue --json | jq '.entities[] | select(.title | test("invoice"; "i")) | .id'
|
|
273
273
|
|
|
274
|
-
#
|
|
275
|
-
email organize archive --folder INBOX --uids 42
|
|
274
|
+
# -q, --quiet: exit code only
|
|
275
|
+
email organize archive --folder INBOX --uids 42 -q && echo "archived"
|
|
276
276
|
```
|
|
277
277
|
|
|
278
278
|
---
|