reply-cli 0.4.0 → 0.5.1
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 +100 -9
- package/dist/auth/oauth-flow.js +1 -1
- package/dist/auth/oauth-flow.js.map +1 -1
- package/dist/commands/api.d.ts +2 -1
- package/dist/commands/api.js +40 -2
- package/dist/commands/api.js.map +1 -1
- package/dist/commands/install.d.ts +9 -0
- package/dist/commands/install.js +88 -0
- package/dist/commands/install.js.map +1 -0
- package/dist/config.d.ts +2 -1
- package/dist/config.js +4 -1
- package/dist/config.js.map +1 -1
- package/dist/index.js +34 -1
- package/dist/index.js.map +1 -1
- package/dist/selfupdate/cache.d.ts +16 -0
- package/dist/selfupdate/cache.js +63 -0
- package/dist/selfupdate/cache.js.map +1 -0
- package/dist/selfupdate/detect.d.ts +15 -0
- package/dist/selfupdate/detect.js +88 -0
- package/dist/selfupdate/detect.js.map +1 -0
- package/dist/selfupdate/install.d.ts +34 -0
- package/dist/selfupdate/install.js +74 -0
- package/dist/selfupdate/install.js.map +1 -0
- package/dist/selfupdate/notice.d.ts +15 -0
- package/dist/selfupdate/notice.js +67 -0
- package/dist/selfupdate/notice.js.map +1 -0
- package/dist/selfupdate/npm.d.ts +20 -0
- package/dist/selfupdate/npm.js +47 -0
- package/dist/selfupdate/npm.js.map +1 -0
- package/dist/selfupdate/releases.d.ts +19 -0
- package/dist/selfupdate/releases.js +91 -0
- package/dist/selfupdate/releases.js.map +1 -0
- package/dist/selfupdate/routes.d.ts +4 -0
- package/dist/selfupdate/routes.js +52 -0
- package/dist/selfupdate/routes.js.map +1 -0
- package/dist/selfupdate/semver.d.ts +11 -0
- package/dist/selfupdate/semver.js +80 -0
- package/dist/selfupdate/semver.js.map +1 -0
- package/dist/selfupdate/types.d.ts +21 -0
- package/dist/selfupdate/types.js +3 -0
- package/dist/selfupdate/types.js.map +1 -0
- package/dist/skills/hosts.js +1 -1
- package/dist/skills/hosts.js.map +1 -1
- package/dist/skills/report.js +1 -1
- package/dist/skills/report.js.map +1 -1
- package/dist/utils/client.js +1 -1
- package/dist/utils/client.js.map +1 -1
- package/dist/utils/errors.d.ts +2 -1
- package/dist/utils/errors.js +12 -1
- package/dist/utils/errors.js.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -8,7 +8,9 @@ contacts, and the inbox are on the way.
|
|
|
8
8
|
|
|
9
9
|
## Installation
|
|
10
10
|
|
|
11
|
-
|
|
11
|
+
`reply` runs on [Node.js](https://nodejs.org) **20 or newer** — check yours with
|
|
12
|
+
`node --version`, and install or upgrade Node first if it is older. Then install
|
|
13
|
+
the CLI globally from npm:
|
|
12
14
|
|
|
13
15
|
```sh
|
|
14
16
|
npm install -g reply-cli
|
|
@@ -18,6 +20,57 @@ npm install -g reply-cli
|
|
|
18
20
|
reply --version
|
|
19
21
|
```
|
|
20
22
|
|
|
23
|
+
That is the whole installation. There is nothing else to run.
|
|
24
|
+
|
|
25
|
+
## Staying up to date
|
|
26
|
+
|
|
27
|
+
One command keeps the CLI current:
|
|
28
|
+
|
|
29
|
+
```sh
|
|
30
|
+
reply install
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
It looks up the newest release, and when it can update your copy safely it runs
|
|
34
|
+
npm for you and reports the result:
|
|
35
|
+
|
|
36
|
+
```
|
|
37
|
+
✓ reply 0.4.0 → 0.5.0 installed
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
Already on the newest release, it says so and does nothing. Where the copy is
|
|
41
|
+
not ours to change — installed inside a project, run through `npx`, or built
|
|
42
|
+
from a checkout — it prints the exact command that fits your setup and leaves
|
|
43
|
+
everything alone. It exits non-zero whenever an update exists and was not
|
|
44
|
+
applied, so `reply install --dry-run` works as a check in CI.
|
|
45
|
+
|
|
46
|
+
`reply --version` mentions a newer release when there is one:
|
|
47
|
+
|
|
48
|
+
```
|
|
49
|
+
0.4.0
|
|
50
|
+
reply 0.4.0 → 0.5.0 available · run `reply install`
|
|
51
|
+
```
|
|
52
|
+
|
|
53
|
+
That check reads the public GitHub releases, is cached for a day, times out
|
|
54
|
+
after a second and a half, and stays silent when it fails. It never runs for any
|
|
55
|
+
other command, and never at all with `--json`, when output is piped, in CI, or
|
|
56
|
+
with `REPLY_NO_UPDATE_CHECK=1` set.
|
|
57
|
+
|
|
58
|
+
## Where this fits
|
|
59
|
+
|
|
60
|
+
Reply's agentic toolkit is three pieces. They are complementary, not alternatives:
|
|
61
|
+
|
|
62
|
+
| | What it is | When you want it |
|
|
63
|
+
|---|---|---|
|
|
64
|
+
| **reply CLI** (this repo) | `npm i -g reply-cli` — authenticated access to *every* v3 endpoint via `reply api` | Your agent has a shell. This is the complete surface. |
|
|
65
|
+
| **[Reply MCP](https://github.com/reply-team/reply-mcp)** | A curated tool catalog over `mcp.reply.io` | Your client speaks MCP and has no shell — desktop apps, hosted assistants. |
|
|
66
|
+
| **[reply-skills](https://github.com/reply-team/reply-skills)** | Outbound expertise as markdown skills: what to do, in what order, with what guardrails | Your agent knows *how* to call things but not *what* to run. |
|
|
67
|
+
|
|
68
|
+
MCP gives your agent tools. Skills give it judgement. Most setups want both; a shell-capable
|
|
69
|
+
agent can do everything through the CLI alone.
|
|
70
|
+
|
|
71
|
+
The shortest path that works: install the CLI, `reply auth login`, `reply skills install`, then
|
|
72
|
+
talk to your agent in plain words. MCP is optional — add it when your client has no shell.
|
|
73
|
+
|
|
21
74
|
## Usage
|
|
22
75
|
|
|
23
76
|
```sh
|
|
@@ -30,6 +83,16 @@ machine-readable output suitable for scripts.
|
|
|
30
83
|
|
|
31
84
|
## Authentication
|
|
32
85
|
|
|
86
|
+
**You need a Reply.io account.** If you have one, sign in with it. If you don't, `reply auth
|
|
87
|
+
login` takes you to the browser, where you can create one and start a free trial — no credit
|
|
88
|
+
card. The CLI, the skill packs and the local tooling are free and open source; what a Reply.io
|
|
89
|
+
account gives you is the execution: mailboxes, sending, the contact store, the inbox, analytics.
|
|
90
|
+
|
|
91
|
+
> **Open source, not self-hosted.** The CLI and the skill packs are MIT and yours to fork.
|
|
92
|
+
> Execution always runs against Reply.io — the API, the hosted MCP server at `mcp.reply.io`,
|
|
93
|
+
> your mailboxes and your data. There is no local mode, and outreach without a Reply.io account
|
|
94
|
+
> is not something this toolkit can do.
|
|
95
|
+
|
|
33
96
|
Log in through your browser with OAuth:
|
|
34
97
|
|
|
35
98
|
```sh
|
|
@@ -65,6 +128,7 @@ reply profile use alice@reply.io # make it the active profile
|
|
|
65
128
|
reply auth login # signs in alice@reply.io
|
|
66
129
|
|
|
67
130
|
reply profile list # '*' marks the active profile
|
|
131
|
+
reply profile current # just the active profile's name
|
|
68
132
|
reply --profile bob@reply.io auth whoami # override for a single command
|
|
69
133
|
```
|
|
70
134
|
|
|
@@ -74,11 +138,21 @@ set with `profile use` → the built-in default.
|
|
|
74
138
|
Manage profiles after creating them:
|
|
75
139
|
|
|
76
140
|
```sh
|
|
77
|
-
reply profile show
|
|
78
|
-
reply profile show alice@reply.io
|
|
79
|
-
reply profile
|
|
80
|
-
reply profile
|
|
81
|
-
reply profile
|
|
141
|
+
reply profile show # inspect the current profile (no secrets)
|
|
142
|
+
reply profile show alice@reply.io # inspect a specific one
|
|
143
|
+
reply profile set alice@reply.io --team-id 1045 # edit in place; only what you pass changes
|
|
144
|
+
reply profile rename alice@reply.io ally # also moves the stored credential
|
|
145
|
+
reply profile unset ally team-id # clear a field (authority|api_base|team-id)
|
|
146
|
+
reply profile delete ally # remove it and its stored credential (-y skips the prompt)
|
|
147
|
+
```
|
|
148
|
+
|
|
149
|
+
`profile set` takes `--team-id`, and `--authority` / `--api-base` for pointing a
|
|
150
|
+
profile at a non-production backend. Naming `default` edits the built-in
|
|
151
|
+
profile, which is how you pin a team for everything without creating a profile
|
|
152
|
+
first:
|
|
153
|
+
|
|
154
|
+
```sh
|
|
155
|
+
reply profile set default --team-id 1045
|
|
82
156
|
```
|
|
83
157
|
|
|
84
158
|
`profile show` lists the backend URLs, pinned team, and which authorization
|
|
@@ -129,6 +203,22 @@ It prints `{ "code": <status>, "data": <body> }` and exits non-zero on HTTP
|
|
|
129
203
|
stderr. Add `--verbose` for a full request/response trace on stderr with
|
|
130
204
|
credentials redacted; stdout stays the plain JSON, so pipes keep working.
|
|
131
205
|
|
|
206
|
+
### Windows: Git Bash rewrites the path
|
|
207
|
+
|
|
208
|
+
Under Git Bash / MSYS, `reply api /v3/whoami` never reaches the CLI as you typed
|
|
209
|
+
it — MSYS converts a leading-slash argument into a Windows path, so the request
|
|
210
|
+
would go to `https://api.reply.io/C:/Program Files/Git/v3/whoami`. **Quoting does
|
|
211
|
+
not help**: quotes are removed before the conversion. Either of these does:
|
|
212
|
+
|
|
213
|
+
```sh
|
|
214
|
+
reply api //v3/whoami # a doubled leading slash survives
|
|
215
|
+
MSYS_NO_PATHCONV=1 reply api /v3/whoami # or turn the conversion off
|
|
216
|
+
```
|
|
217
|
+
|
|
218
|
+
The CLI refuses such a path instead of sending it, and exits `2` (usage) rather
|
|
219
|
+
than `1`, so a mangled path can never be mistaken for an endpoint that does not
|
|
220
|
+
exist. PowerShell, cmd, macOS and Linux are unaffected.
|
|
221
|
+
|
|
132
222
|
## Skills
|
|
133
223
|
|
|
134
224
|
Reply's outbound expertise ships as three markdown skill packs in
|
|
@@ -183,9 +273,9 @@ receive the skills as files. Add `--json` for a machine-readable report, and
|
|
|
183
273
|
| Cursor · Gemini CLI · GitHub Copilot · Windsurf | copied files | not yet |
|
|
184
274
|
|
|
185
275
|
"Not yet" means the skills directory for that assistant comes from its
|
|
186
|
-
documentation and has not been confirmed by a verification run of our own
|
|
187
|
-
|
|
188
|
-
|
|
276
|
+
documentation and has not been confirmed by a verification run of our own: the
|
|
277
|
+
install works, but we cannot promise the assistant reads from where we put the
|
|
278
|
+
files. Those hosts are marked `(paths not yet verified)`
|
|
189
279
|
in the report and carry `"verified": false` in `--json`.
|
|
190
280
|
|
|
191
281
|
Installing skills is not the same as connecting Reply: `reply-adapter` needs a
|
|
@@ -199,6 +289,7 @@ Reply.io login (`reply auth login`) to actually do anything.
|
|
|
199
289
|
| `REPLY_PROFILE` | Profile to use (same as `--profile`) |
|
|
200
290
|
| `REPLY_TEAM_ID` | Team/workspace id sent as `X-TEAM-ID` (same as `--team-id`) |
|
|
201
291
|
| `REPLY_CONFIG_DIR` | Config directory (default `~/.config/reply`; `%APPDATA%\reply` on Windows) |
|
|
292
|
+
| `REPLY_NO_UPDATE_CHECK` | Set to `1` to never check whether a newer release exists |
|
|
202
293
|
|
|
203
294
|
## Contributing
|
|
204
295
|
|
package/dist/auth/oauth-flow.js
CHANGED
|
@@ -11,7 +11,7 @@ const errors_1 = require("../utils/errors");
|
|
|
11
11
|
const output_1 = require("../utils/output");
|
|
12
12
|
const pkce_1 = require("./pkce");
|
|
13
13
|
const token_1 = require("./token");
|
|
14
|
-
// Public PKCE client registered in IdentityServer
|
|
14
|
+
// Public PKCE client registered in IdentityServer.
|
|
15
15
|
const CLIENT_ID = 'Reply.Cli';
|
|
16
16
|
exports.CLIENT_ID = CLIENT_ID;
|
|
17
17
|
const SCOPE = 'openid profile email reply-web-api offline_access';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"oauth-flow.js","sourceRoot":"","sources":["../../src/auth/oauth-flow.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,iDAAoC;AACpC,6BAAwB;AACxB,4CAA6C;AAC7C,4CAAqC;AACrC,iCAAiD;AACjD,mCAKiB;AAGjB
|
|
1
|
+
{"version":3,"file":"oauth-flow.js","sourceRoot":"","sources":["../../src/auth/oauth-flow.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,iDAAoC;AACpC,6BAAwB;AACxB,4CAA6C;AAC7C,4CAAqC;AACrC,iCAAiD;AACjD,mCAKiB;AAGjB,mDAAmD;AACnD,MAAM,SAAS,GAAG,WAAW,CAAC;AA8O1B,8BAAS;AA7Ob,MAAM,KAAK,GAAG,mDAAmD,CAAC;AA6OnD,sBAAK;AA5OpB,MAA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
|
13
13
|
declare const read_body_arg: (raw: string | undefined, read_stdin?: () => string) => unknown;
|
|
14
|
+
declare const assert_api_path: (path: string) => void;
|
|
14
15
|
declare const handle_api: (path: string, opts: {
|
|
15
16
|
method?: string;
|
|
16
17
|
body?: string;
|
|
17
18
|
}, ctx: Cli_context, g: Global_opts) => Promise<void>;
|
|
18
19
|
declare const api_command: Command;
|
|
19
|
-
export { api_command, handle_api, read_body_arg };
|
|
20
|
+
export { api_command, handle_api, read_body_arg, assert_api_path };
|
package/dist/commands/api.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.read_body_arg = exports.handle_api = exports.api_command = void 0;
|
|
6
|
+
exports.assert_api_path = exports.read_body_arg = exports.handle_api = exports.api_command = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const commander_1 = require("commander");
|
|
9
9
|
const context_1 = require("../context");
|
|
@@ -90,10 +90,45 @@ const resolve_method = (flag, has_body) => {
|
|
|
90
90
|
}
|
|
91
91
|
return m;
|
|
92
92
|
};
|
|
93
|
+
// A drive-prefixed path is the signature of MSYS/Cygwin path conversion, not of
|
|
94
|
+
// anything a caller would type: Git Bash on Windows rewrites a leading-slash
|
|
95
|
+
// argument into a Windows path before the CLI is even started.
|
|
96
|
+
const MSYS_DRIVE = /^[A-Za-z]:[\\/]/;
|
|
97
|
+
// Recover the intended path out of a mangled one, so the fix can be quoted back
|
|
98
|
+
// verbatim instead of described. `C:/Program Files/Git/v3/whoami` -> `v3/whoami`.
|
|
99
|
+
// Both separators, because MSYS emits forward slashes but a path pasted from cmd
|
|
100
|
+
// arrives with backslashes.
|
|
101
|
+
const VERSION_SEGMENT = /[\\/](v\d+[\\/].*)$/;
|
|
102
|
+
// The request URL is built literally as api_base + path, so a path that is not a
|
|
103
|
+
// path silently produces a nonsense URL and a 404 — indistinguishable from an
|
|
104
|
+
// endpoint that genuinely does not exist. That is not hypothetical: an agent hit
|
|
105
|
+
// exactly this under Git Bash and told its user a documented feature was "not
|
|
106
|
+
// enabled on this account". Refuse instead, before spending a request, and exit 2
|
|
107
|
+
// (usage) so the failure cannot be mistaken for an upstream one.
|
|
108
|
+
const assert_api_path = (path) => {
|
|
109
|
+
if (path.startsWith('/')) {
|
|
110
|
+
return;
|
|
111
|
+
}
|
|
112
|
+
const recovered = path.match(VERSION_SEGMENT)?.[1].replace(/\\/g, '/');
|
|
113
|
+
const intended = recovered ? `/${recovered}` : '/v3/whoami';
|
|
114
|
+
const hint = MSYS_DRIVE.test(path)
|
|
115
|
+
? [
|
|
116
|
+
'Your shell rewrote the argument before the CLI saw it: Git Bash / MSYS on',
|
|
117
|
+
'Windows turns a leading-slash argument into a Windows path. Quoting does not',
|
|
118
|
+
'help — quotes are removed before the conversion. Any of these does:',
|
|
119
|
+
` reply api /${intended}`,
|
|
120
|
+
` MSYS_NO_PATHCONV=1 reply api ${intended}`,
|
|
121
|
+
' ...or run the same command from PowerShell or cmd.',
|
|
122
|
+
].join('\n')
|
|
123
|
+
: `Paths are taken verbatim from the docs and start with a slash, e.g. ${intended}.`;
|
|
124
|
+
throw new errors_1.UsageError(`The path must start with '/' — got '${path}'.`, { code: 'usage.api', hint });
|
|
125
|
+
};
|
|
126
|
+
exports.assert_api_path = assert_api_path;
|
|
93
127
|
// Raw passthrough to a v3 endpoint. Prints {code, data} for any status; exits 1
|
|
94
128
|
// on >=400. On a team/user-resolution conflict, adds tailored guidance to stderr
|
|
95
129
|
// — this is the workload surface where such guidance belongs.
|
|
96
130
|
const handle_api = async (path, opts, ctx, g) => {
|
|
131
|
+
assert_api_path(path);
|
|
97
132
|
const body = read_body_arg(opts.body);
|
|
98
133
|
const method = resolve_method(opts.method, body !== undefined);
|
|
99
134
|
const { token, headers } = await (0, authed_1.authed)(ctx, g);
|
|
@@ -127,7 +162,10 @@ const api_command = new commander_1.Command('api')
|
|
|
127
162
|
+ ' reply api /v3/contacts --pretty # list contacts (indented)\n'
|
|
128
163
|
+ ' reply api /v3/sequences/12345 # one sequence by id\n'
|
|
129
164
|
+ ' reply api /v3/contacts --body @contact.json # create a contact (POST; body per docs)\n'
|
|
130
|
-
+ ' echo \'<json>\' | reply api /v3/contacts --body - # body from stdin'
|
|
165
|
+
+ ' echo \'<json>\' | reply api /v3/contacts --body - # body from stdin\n'
|
|
166
|
+
+ '\nGit Bash / MSYS on Windows rewrites a leading-slash argument into a Windows\n'
|
|
167
|
+
+ 'path, and quoting does not help. Double the slash — reply api //v3/whoami —\n'
|
|
168
|
+
+ 'or set MSYS_NO_PATHCONV=1. PowerShell, macOS and Linux are unaffected.')
|
|
131
169
|
.action(async function (path) {
|
|
132
170
|
const g = read_globals(this);
|
|
133
171
|
const o = this.opts();
|
package/dist/commands/api.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"api.js","sourceRoot":"","sources":["../../src/commands/api.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,yCAAkC;AAClC,wCAA2D;AAC3D,4CAA+D;AAC/D,oCAA6C;AAC7C,qCAAgC;AAChC,4CAA2C;AAC3C,4CAAuE;AAavE,MAAM,YAAY,GAAG,CAAC,GAAY,EAAc,EAAE;IAC9C,MAAM,CAAC,GAAG,GAAG,CAAC,eAAe,EAAE,CAAC;IAChC,OAAO;QACH,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO;QACpC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,SAAS,EAAE,CAAC,CAAC,SAAS;QAC1D,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC,OAAO;KACrD,CAAC;AACN,CA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,wEAAwE;MACxE,kEAAkE;MAClE,4EAA4E;MAC5E,sEAAsE;MACtE,0FAA0F;MAC1F,2EAA2E;MAC3E,iFAAiF;MACjF,+EAA+E;MAC/E,wEAAwE,CAAC;KAC9E,MAAM,CAAC,KAAK,WAAyB,IAAY;IAC9C,MAAM,CAAC,GAAG,YAAY,CAAC,IAAI,CAAC,CAAC;IAC7B,MAAM,CAAC,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;IACtB,MAAM,UAAU,CAAC,IAAI,EAAE,EAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAC,EAAE,IAAA,uBAAa,EAAC,EAAC,OAAO,EAAE,CAAC,CAAC,OAAO,EAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACrG,CAAC,CAAC,CAAC;AAEC,kCAAW"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
type Install_cli_opts = {
|
|
3
|
+
dryRun?: boolean;
|
|
4
|
+
json?: boolean;
|
|
5
|
+
pretty?: boolean;
|
|
6
|
+
};
|
|
7
|
+
declare const handle_install: (opts: Install_cli_opts) => Promise<void>;
|
|
8
|
+
declare const install_command: Command;
|
|
9
|
+
export { install_command, handle_install };
|
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.handle_install = exports.install_command = void 0;
|
|
4
|
+
const commander_1 = require("commander");
|
|
5
|
+
const config_1 = require("../config");
|
|
6
|
+
const install_1 = require("../selfupdate/install");
|
|
7
|
+
const errors_1 = require("../utils/errors");
|
|
8
|
+
const output_1 = require("../utils/output");
|
|
9
|
+
const wants_json = (o) => Boolean(o.json || o.pretty);
|
|
10
|
+
const print_opts = (o) => ({ json: o.json, pretty: o.pretty });
|
|
11
|
+
// npm's own output would be status, not data, so nothing here writes to stdout
|
|
12
|
+
// unless --json was asked for.
|
|
13
|
+
const human_report = (report, dry_run) => {
|
|
14
|
+
if (report.action === 'current') {
|
|
15
|
+
(0, output_1.success)(`${config_1.PROGRAM_NAME} ${report.current} is the newest release`);
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (report.action === 'updated') {
|
|
19
|
+
(0, output_1.success)(`${config_1.PROGRAM_NAME} ${report.current} → ${report.latest} installed`);
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
if (report.action === 'failed') {
|
|
23
|
+
(0, output_1.warn)(`Could not update automatically: ${report.detail}.`);
|
|
24
|
+
if (report.npm_output) {
|
|
25
|
+
(0, output_1.info)(' npm said:');
|
|
26
|
+
for (const line of report.npm_output.split('\n')) {
|
|
27
|
+
(0, output_1.info)(` ${line}`);
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
}
|
|
31
|
+
else {
|
|
32
|
+
(0, output_1.warn)(`${config_1.PROGRAM_NAME} ${report.current} → ${report.latest} available`
|
|
33
|
+
+ `${dry_run ? ' (nothing changed: --dry-run)' : ''}`);
|
|
34
|
+
(0, output_1.info)(` ${report.note}`);
|
|
35
|
+
}
|
|
36
|
+
(0, output_1.info)(' Run this instead:');
|
|
37
|
+
(0, output_1.info)('');
|
|
38
|
+
(0, output_1.info)(` ${report.command}`);
|
|
39
|
+
};
|
|
40
|
+
const handle_install = async (opts) => {
|
|
41
|
+
const dry_run = opts.dryRun === true;
|
|
42
|
+
if (!wants_json(opts)) {
|
|
43
|
+
(0, output_1.info)(`Checking for a newer ${config_1.PROGRAM_NAME} release…`);
|
|
44
|
+
}
|
|
45
|
+
const report = await (0, install_1.run_install)({ dry_run }, {
|
|
46
|
+
// Silent under --json, where the only output allowed is the report.
|
|
47
|
+
progress: wants_json(opts) ? undefined : (message) => (0, output_1.info)(` ${message}`),
|
|
48
|
+
});
|
|
49
|
+
if (wants_json(opts)) {
|
|
50
|
+
(0, output_1.print)(report, print_opts(opts));
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
human_report(report, dry_run);
|
|
54
|
+
}
|
|
55
|
+
// The user asked to be up to date and is not, so the exit code has to say
|
|
56
|
+
// so — a script that runs `install` must be able to tell.
|
|
57
|
+
if (report.action === 'manual' || report.action === 'failed') {
|
|
58
|
+
throw new errors_1.RuntimeError(`${config_1.PROGRAM_NAME} was not updated.`, {
|
|
59
|
+
code: report.action === 'failed' ? 'update.npm_failed' : 'update.manual',
|
|
60
|
+
detail: report.detail,
|
|
61
|
+
hint: report.command,
|
|
62
|
+
});
|
|
63
|
+
}
|
|
64
|
+
};
|
|
65
|
+
exports.handle_install = handle_install;
|
|
66
|
+
const install_command = new commander_1.Command('install')
|
|
67
|
+
// Accepted for muscle memory from other CLIs; `install` is the documented
|
|
68
|
+
// name, so users have one command to learn rather than two.
|
|
69
|
+
.alias('update')
|
|
70
|
+
.description('Update the CLI to the newest release, or say exactly how')
|
|
71
|
+
.option('--dry-run', 'Report what would happen and change nothing')
|
|
72
|
+
.addHelpText('after', `
|
|
73
|
+
Runs npm for you when the CLI was installed globally with npm. Anything else —
|
|
74
|
+
a project-local copy, npx, a source checkout — is left untouched and reported
|
|
75
|
+
with the command that fits it.
|
|
76
|
+
|
|
77
|
+
Exits 1 when an update exists and was not applied, so --dry-run works as a check.
|
|
78
|
+
|
|
79
|
+
Examples:
|
|
80
|
+
${config_1.PROGRAM_NAME} install
|
|
81
|
+
${config_1.PROGRAM_NAME} install --dry-run
|
|
82
|
+
${config_1.PROGRAM_NAME} install --json`)
|
|
83
|
+
.action(async function () {
|
|
84
|
+
const o = this.optsWithGlobals();
|
|
85
|
+
await handle_install({ dryRun: o.dryRun, json: o.json, pretty: o.pretty });
|
|
86
|
+
});
|
|
87
|
+
exports.install_command = install_command;
|
|
88
|
+
//# sourceMappingURL=install.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"install.js","sourceRoot":"","sources":["../../src/commands/install.ts"],"names":[],"mappings":";;;AAAA,yCAAkC;AAClC,sCA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,EAAE;YACvD,IAAI,EAAE,MAAM,CAAC,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,eAAe;YACxE,MAAM,EAAE,MAAM,CAAC,MAAM;YACrB,IAAI,EAAE,MAAM,CAAC,OAAO;SACvB,CAAC,CAAC;IACP,CAAC;AACL,CAAC,CAAC;AAwBuB,wCAAc;AAtBvC,MAAM,eAAe,GAAG,IAAI,mBAAO,CAAC,SAAS,CAAC;IAC1C,0EAA0E;IAC1E,4DAA4D;KAC3D,KAAK,CAAC,QAAQ,CAAC;KACf,WAAW,CAAC,0DAA0D,CAAC;KACvE,MAAM,CAAC,WAAW,EAAE,6CAA6C,CAAC;KAClE,WAAW,CAAC,OAAO,EAAE;;;;;;;;IAQtB,qBAAY;IACZ,qBAAY;IACZ,qBAAY,iBAAiB,CAAC;KAC7B,MAAM,CAAC,KAAK;IACT,MAAM,CAAC,GAAG,IAAI,CAAC,eAAe,EAAE,CAAC;IACjC,MAAM,cAAc,CAAC,EAAC,MAAM,EAAE,CAAC,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,IAAI,EAAE,MAAM,EAAE,CAAC,CAAC,MAAM,EAAC,CAAC,CAAC;AAC7E,CAAC,CAAC,CAAC;AAEC,0CAAe"}
|
package/dist/config.d.ts
CHANGED
|
@@ -11,5 +11,6 @@ declare const config_dir: (env?: Env) => string;
|
|
|
11
11
|
declare const credentials_file: (env?: Env) => string;
|
|
12
12
|
declare const config_file: (env?: Env) => string;
|
|
13
13
|
declare const skills_file: (env?: Env) => string;
|
|
14
|
-
|
|
14
|
+
declare const update_check_file: (env?: Env) => string;
|
|
15
|
+
export { PROGRAM_NAME, APP_NAME, env_prefix, env_var, get_env, cli_version, user_agent, default_config_dir, config_dir, credentials_file, config_file, skills_file, update_check_file, };
|
|
15
16
|
export type { Env };
|
package/dist/config.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.skills_file = exports.config_file = exports.credentials_file = exports.config_dir = exports.default_config_dir = exports.user_agent = exports.cli_version = exports.get_env = exports.env_var = exports.env_prefix = exports.APP_NAME = exports.PROGRAM_NAME = void 0;
|
|
6
|
+
exports.update_check_file = exports.skills_file = exports.config_file = exports.credentials_file = exports.config_dir = exports.default_config_dir = exports.user_agent = exports.cli_version = exports.get_env = exports.env_var = exports.env_prefix = exports.APP_NAME = exports.PROGRAM_NAME = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const os_1 = __importDefault(require("os"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -80,4 +80,7 @@ exports.config_file = config_file;
|
|
|
80
80
|
// What the installer wrote into flat-directory hosts (see skills/journal.ts).
|
|
81
81
|
const skills_file = (env = process.env) => path_1.default.join(config_dir(env), 'skills.json');
|
|
82
82
|
exports.skills_file = skills_file;
|
|
83
|
+
// When we last asked whether a newer release exists (see selfupdate/cache.ts).
|
|
84
|
+
const update_check_file = (env = process.env) => path_1.default.join(config_dir(env), 'update-check.json');
|
|
85
|
+
exports.update_check_file = update_check_file;
|
|
83
86
|
//# sourceMappingURL=config.js.map
|
package/dist/config.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AAExB,2EAA2E;AAC3E,2EAA2E;AAC3E,gDAAgD;AAChD,MAAM,QAAQ,GAAG,OAAO,CAAC;
|
|
1
|
+
{"version":3,"file":"config.js","sourceRoot":"","sources":["../src/config.ts"],"names":[],"mappings":";;;;;;AAAA,4CAAoB;AACpB,4CAAoB;AACpB,gDAAwB;AAExB,2EAA2E;AAC3E,2EAA2E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AE,CAAC,OAAO,EAAE,CAAC,CAAC;AACnE,CAAC,CAAC;AAqBsB,gCAAU;AAnBlC,6EAA6E;AAC7E,MAAM,gBAAgB,GAAG,CAAC,MAAW,OAAO,CAAC,GAAG,EAAS,EAAE,CACvD,cAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,kBAAkB,CAAC,CAAC;AAiBf,4CAAgB;AAfpD,uDAAuD;AACvD,MAAM,WAAW,GAAG,CAAC,MAAW,OAAO,CAAC,GAAG,EAAS,EAAE,CAClD,cAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;AAaQ,kCAAW;AAXjE,8EAA8E;AAC9E,MAAM,WAAW,GAAG,CAAC,MAAW,OAAO,CAAC,GAAG,EAAS,EAAE,CAClD,cAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,aAAa,CAAC,CAAC;AASqB,kCAAW;AAP9E,+EAA+E;AAC/E,MAAM,iBAAiB,GAAG,CAAC,MAAW,OAAO,CAAC,GAAG,EAAS,EAAE,CACxD,cAAI,CAAC,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,EAAE,mBAAmB,CAAC,CAAC;AAMhD,8CAAiB"}
|
package/dist/index.js
CHANGED
|
@@ -9,6 +9,8 @@ const profile_1 = require("./commands/profile");
|
|
|
9
9
|
const team_1 = require("./commands/team");
|
|
10
10
|
const api_1 = require("./commands/api");
|
|
11
11
|
const skills_1 = require("./commands/skills");
|
|
12
|
+
const install_1 = require("./commands/install");
|
|
13
|
+
const notice_1 = require("./selfupdate/notice");
|
|
12
14
|
const errors_1 = require("./utils/errors");
|
|
13
15
|
const output_1 = require("./utils/output");
|
|
14
16
|
// Route every command through commander's throwing mode so usage errors reach
|
|
@@ -44,6 +46,7 @@ const build_program = () => {
|
|
|
44
46
|
program.addCommand(team_1.team_command);
|
|
45
47
|
program.addCommand(api_1.api_command);
|
|
46
48
|
program.addCommand(skills_1.skills_command);
|
|
49
|
+
program.addCommand(install_1.install_command);
|
|
47
50
|
program.addHelpText('after', `
|
|
48
51
|
Credential precedence:
|
|
49
52
|
1. --api-key <key> 2. ${PREFIX}_API_KEY env 3. stored credential
|
|
@@ -80,6 +83,12 @@ Raw API (agent/CI escape hatch) — docs: https://docs.reply.io/api-reference/in
|
|
|
80
83
|
${config_1.PROGRAM_NAME} api /v3/whoami --verbose # full req/resp to stderr (creds redacted)
|
|
81
84
|
Prints {code, data}; exits non-zero on HTTP >= 400.
|
|
82
85
|
|
|
86
|
+
Keeping the CLI current:
|
|
87
|
+
${config_1.PROGRAM_NAME} install # update to the newest release, or say how
|
|
88
|
+
${config_1.PROGRAM_NAME} install --dry-run # report only; exits 1 when an update exists
|
|
89
|
+
${config_1.PROGRAM_NAME} --version # mentions a newer release when there is one
|
|
90
|
+
${PREFIX}_NO_UPDATE_CHECK=1 # never check for a newer release
|
|
91
|
+
|
|
83
92
|
Configuration (env vars):
|
|
84
93
|
${PREFIX}_API_KEY API key used as the bearer credential
|
|
85
94
|
${PREFIX}_PROFILE Profile to use (same as --profile)
|
|
@@ -95,6 +104,7 @@ Examples:
|
|
|
95
104
|
${config_1.PROGRAM_NAME} api /v3/sequences
|
|
96
105
|
${config_1.PROGRAM_NAME} skills install
|
|
97
106
|
${config_1.PROGRAM_NAME} skills list --json
|
|
107
|
+
${config_1.PROGRAM_NAME} install
|
|
98
108
|
`);
|
|
99
109
|
return program;
|
|
100
110
|
};
|
|
@@ -105,13 +115,33 @@ const main = async () => {
|
|
|
105
115
|
set_exit_override(program);
|
|
106
116
|
await program.parseAsync(process.argv);
|
|
107
117
|
};
|
|
108
|
-
|
|
118
|
+
// --version is the only command allowed to check for a newer release. The
|
|
119
|
+
// version itself is already on stdout by the time we get here; the hint is
|
|
120
|
+
// status, so it follows on stderr — and only when update_notice allows it.
|
|
121
|
+
const version_hint = async () => {
|
|
122
|
+
try {
|
|
123
|
+
const hint = await (0, notice_1.update_notice)({
|
|
124
|
+
json: wants_json(),
|
|
125
|
+
quiet: process.argv.includes('-q') || process.argv.includes('--quiet'),
|
|
126
|
+
});
|
|
127
|
+
if (hint) {
|
|
128
|
+
(0, output_1.info)(hint);
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
catch {
|
|
132
|
+
// A hint is never worth failing --version over.
|
|
133
|
+
}
|
|
134
|
+
};
|
|
135
|
+
void main().catch(async (error) => {
|
|
109
136
|
if (error instanceof commander_1.CommanderError) {
|
|
110
137
|
// commander has already written help/usage text; help & version exit 0,
|
|
111
138
|
// any other usage problem exits 2.
|
|
112
139
|
const ok = error.code === 'commander.helpDisplayed'
|
|
113
140
|
|| error.code === 'commander.version'
|
|
114
141
|
|| error.code === 'commander.help';
|
|
142
|
+
if (error.code === 'commander.version') {
|
|
143
|
+
await version_hint();
|
|
144
|
+
}
|
|
115
145
|
process.exit(ok ? 0 : 2);
|
|
116
146
|
}
|
|
117
147
|
if (error instanceof errors_1.CliError) {
|
|
@@ -120,6 +150,9 @@ void main().catch((error) => {
|
|
|
120
150
|
}
|
|
121
151
|
else {
|
|
122
152
|
console.error(error.message);
|
|
153
|
+
if (error.hint) {
|
|
154
|
+
console.error((0, errors_1.format_hint)(error.hint));
|
|
155
|
+
}
|
|
123
156
|
}
|
|
124
157
|
process.exit(error.exit_code);
|
|
125
158
|
}
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,yCAAkD;AAClD,qCAAmD;AACnD,0CAA6C;AAC7C,gDAAmD;AACnD,0CAA6C;AAC7C,wCAA2C;AAC3C,8CAAiD;AACjD,
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;AACA,yCAAkD;AAClD,qCAAmD;AACnD,0CAA6C;AAC7C,gDAAmD;AACnD,0CAA6C;AAC7C,wCAA2C;AAC3C,8CAAiD;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AAK,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;YAC7B,IAAI,KAAK,CAAC,IAAI,EACd,CAAC;gBACG,OAAO,CAAC,KAAK,CAAC,IAAA,oBAAW,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC;YAC3C,CAAC;QACL,CAAC;QACD,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,SAAS,CAAC,CAAC;IAClC,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,KAAK,YAAY,KAAK,CAAC,CAAC,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC;IACtE,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;AACpB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { Env } from '../config';
|
|
2
|
+
import type { Channel } from './types';
|
|
3
|
+
type Check_cache = {
|
|
4
|
+
version: 1;
|
|
5
|
+
channel: Channel;
|
|
6
|
+
latest?: string;
|
|
7
|
+
checked_at?: string;
|
|
8
|
+
failed_at?: string;
|
|
9
|
+
};
|
|
10
|
+
declare const SUCCESS_TTL_MS: number;
|
|
11
|
+
declare const FAILURE_TTL_MS: number;
|
|
12
|
+
declare const read_check_cache: (env?: Env) => Check_cache | undefined;
|
|
13
|
+
declare const write_check_cache: (entry: Check_cache, env?: Env) => void;
|
|
14
|
+
declare const cache_is_fresh: (entry: Check_cache | undefined, channel: Channel, now: Date) => boolean;
|
|
15
|
+
export { read_check_cache, write_check_cache, cache_is_fresh, SUCCESS_TTL_MS, FAILURE_TTL_MS };
|
|
16
|
+
export type { Check_cache };
|