@mirage-cli/sms 0.1.8
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/index.d.ts +33 -0
- package/dist/index.js +52 -0
- package/package.json +60 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
import { MirageCommandFn } from '@mirage-cli/core';
|
|
3
|
+
import { Resource } from '@struktoai/mirage-core';
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @mirage-cli/sms — SMS inbox CLI wrapped as an importable Commander program
|
|
7
|
+
* plus a ready-made mirage CommandFn.
|
|
8
|
+
*
|
|
9
|
+
* import { smsCommand, buildProgram } from "@mirage-cli/sms";
|
|
10
|
+
*
|
|
11
|
+
* ## Env vars
|
|
12
|
+
*
|
|
13
|
+
* - `SMS_SERVER_URL=...` — base URL of the Cloudflare Worker (e.g. https://sms.example.com).
|
|
14
|
+
* - `SMS_API_KEY=...` — bearer token for the worker.
|
|
15
|
+
*
|
|
16
|
+
* ## Worker compatibility
|
|
17
|
+
*
|
|
18
|
+
* All API calls are fetch-only — workerd-safe. `config set` writes to
|
|
19
|
+
* `~/.config/sms/config.json` (Node/Bun only).
|
|
20
|
+
*
|
|
21
|
+
* ## Read/write boundary
|
|
22
|
+
*
|
|
23
|
+
* **Read:** `list`, `conversations`, `read`, `search`, `contact`, `config show`.
|
|
24
|
+
* **Write:** `send`, `reply`, `mark-read`, `mark-unread`, `delete`, `config set`.
|
|
25
|
+
* Write commands send real SMS via a paired Android phone. LLM drivers should
|
|
26
|
+
* gate `send` / `reply` with explicit user confirmation.
|
|
27
|
+
*/
|
|
28
|
+
|
|
29
|
+
declare function buildProgram(): Command;
|
|
30
|
+
declare const smsCommand: MirageCommandFn;
|
|
31
|
+
declare function smsResource(): Promise<Resource>;
|
|
32
|
+
|
|
33
|
+
export { buildProgram, smsCommand, smsResource };
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
// src/index.ts
|
|
2
|
+
import { buildProgram as buildSmsProgram } from "@mirage-cli/sms-cli";
|
|
3
|
+
import {
|
|
4
|
+
toMirageCommandFn
|
|
5
|
+
} from "@mirage-cli/core";
|
|
6
|
+
var cachedProgram = null;
|
|
7
|
+
function buildProgram() {
|
|
8
|
+
if (cachedProgram === null) cachedProgram = buildSmsProgram();
|
|
9
|
+
return cachedProgram;
|
|
10
|
+
}
|
|
11
|
+
var cachedFn = null;
|
|
12
|
+
var smsCommand = async (accessor, paths, texts, opts) => {
|
|
13
|
+
if (cachedFn === null) cachedFn = toMirageCommandFn(buildProgram());
|
|
14
|
+
return cachedFn(accessor, paths, texts, opts);
|
|
15
|
+
};
|
|
16
|
+
var cachedResource = null;
|
|
17
|
+
async function smsResource() {
|
|
18
|
+
if (cachedResource !== null) return cachedResource;
|
|
19
|
+
const m = await import("@struktoai/mirage-core");
|
|
20
|
+
const fn = toMirageCommandFn(buildProgram(), {
|
|
21
|
+
IOResult: m.IOResult
|
|
22
|
+
});
|
|
23
|
+
const commands = [
|
|
24
|
+
new m.RegisteredCommand({
|
|
25
|
+
name: "sms",
|
|
26
|
+
resource: null,
|
|
27
|
+
spec: new m.CommandSpec({
|
|
28
|
+
rest: new m.Operand({ kind: m.OperandKind.TEXT }),
|
|
29
|
+
description: "SMS inbox CLI"
|
|
30
|
+
}),
|
|
31
|
+
fn
|
|
32
|
+
})
|
|
33
|
+
];
|
|
34
|
+
cachedResource = {
|
|
35
|
+
kind: "sms",
|
|
36
|
+
isRemote: true,
|
|
37
|
+
prompt: "SMS inbox CLI (Cloudflare Worker + Android SMS Gateway). Auth via SMS_SERVER_URL and SMS_API_KEY env vars. Read: list/read/search/conversations/contact. Write: send/reply send real SMS. Use `sms --help`.",
|
|
38
|
+
async open() {
|
|
39
|
+
},
|
|
40
|
+
async close() {
|
|
41
|
+
},
|
|
42
|
+
commands() {
|
|
43
|
+
return commands;
|
|
44
|
+
}
|
|
45
|
+
};
|
|
46
|
+
return cachedResource;
|
|
47
|
+
}
|
|
48
|
+
export {
|
|
49
|
+
buildProgram,
|
|
50
|
+
smsCommand,
|
|
51
|
+
smsResource
|
|
52
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@mirage-cli/sms",
|
|
3
|
+
"version": "0.1.8",
|
|
4
|
+
"description": "SMS inbox CLI as an importable mirage / Cloudflare-Worker command via @mirage-cli/core.",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"main": "./dist/index.js",
|
|
7
|
+
"module": "./dist/index.js",
|
|
8
|
+
"types": "./dist/index.d.ts",
|
|
9
|
+
"exports": {
|
|
10
|
+
".": {
|
|
11
|
+
"types": "./dist/index.d.ts",
|
|
12
|
+
"import": "./dist/index.js"
|
|
13
|
+
},
|
|
14
|
+
"./package.json": "./package.json"
|
|
15
|
+
},
|
|
16
|
+
"files": [
|
|
17
|
+
"dist/",
|
|
18
|
+
"README.md"
|
|
19
|
+
],
|
|
20
|
+
"scripts": {
|
|
21
|
+
"build": "tsup src/index.ts --format esm --target node18 --dts --external @mirage-cli/core --external @mirage-cli/sms-cli --external commander --external chalk --external @struktoai/mirage-core --clean --silent",
|
|
22
|
+
"test": "bun test --reporter=dots",
|
|
23
|
+
"typecheck": "tsc --noEmit"
|
|
24
|
+
},
|
|
25
|
+
"dependencies": {
|
|
26
|
+
"@mirage-cli/core": "^0.1.8"
|
|
27
|
+
},
|
|
28
|
+
"peerDependencies": {
|
|
29
|
+
"@struktoai/mirage-core": ">=0.0.1",
|
|
30
|
+
"@mirage-cli/sms-cli": "^0.1.8"
|
|
31
|
+
},
|
|
32
|
+
"peerDependenciesMeta": {
|
|
33
|
+
"@struktoai/mirage-core": {
|
|
34
|
+
"optional": true
|
|
35
|
+
}
|
|
36
|
+
},
|
|
37
|
+
"devDependencies": {
|
|
38
|
+
"@mirage-cli/sms-cli": "^0.1.8",
|
|
39
|
+
"@struktoai/mirage-core": "^0.0.1",
|
|
40
|
+
"commander": "^14.0.3",
|
|
41
|
+
"tsup": "^8.5.1"
|
|
42
|
+
},
|
|
43
|
+
"publishConfig": {
|
|
44
|
+
"access": "public"
|
|
45
|
+
},
|
|
46
|
+
"repository": {
|
|
47
|
+
"type": "git",
|
|
48
|
+
"url": "https://github.com/alexbruf/mirage-cli.git",
|
|
49
|
+
"directory": "packages/sms"
|
|
50
|
+
},
|
|
51
|
+
"keywords": [
|
|
52
|
+
"sms",
|
|
53
|
+
"messaging",
|
|
54
|
+
"android-sms-gateway",
|
|
55
|
+
"commander",
|
|
56
|
+
"mirage",
|
|
57
|
+
"cloudflare-workers"
|
|
58
|
+
],
|
|
59
|
+
"license": "MIT"
|
|
60
|
+
}
|