@eliya-oss/agent-slack 0.1.1 → 0.1.3
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/.agents/cli-api.md +2 -0
- package/CHANGELOG.md +14 -0
- package/README.md +2 -0
- package/dist/adapters/localhost-oauth/NodeLocalhostOAuthFlow.js +28 -0
- package/dist/application/commands.js +2 -1
- package/dist/cli/args.js +2 -1
- package/dist/cli/metadata.js +6 -2
- package/dist/output/human.js +1 -3
- package/package.json +1 -1
- package/skills/agent-slack/SKILL.md +1 -1
package/.agents/cli-api.md
CHANGED
|
@@ -40,6 +40,7 @@ Defaults:
|
|
|
40
40
|
agent-slack auth login
|
|
41
41
|
agent-slack auth login --profile work --scopes channels:read,channels:history --user-scopes search:read.public,search:read.private
|
|
42
42
|
agent-slack auth login --oauth --client-id CLIENT_ID --client-secret CLIENT_SECRET --auth-url-out /tmp/agent-slack-auth-url
|
|
43
|
+
agent-slack auth login --oauth --client-id CLIENT_ID --client-secret CLIENT_SECRET --no-open
|
|
43
44
|
agent-slack auth status
|
|
44
45
|
agent-slack auth scopes
|
|
45
46
|
agent-slack auth profiles list
|
|
@@ -49,6 +50,7 @@ agent-slack auth logout --profile work
|
|
|
49
50
|
Auth behavior:
|
|
50
51
|
|
|
51
52
|
- Uses Slack OAuth v2 with a localhost callback.
|
|
53
|
+
- Opens the Slack OAuth URL in the default browser by default. Use `--no-open` to print the URL only, or `--auth-url-out PATH` for headless agents and tests.
|
|
52
54
|
- Bot scopes go in `scope=...`; user scopes go in `user_scope=...`.
|
|
53
55
|
- Stores profiles outside the project directory. The default store is `~/.config/agent-slack/profiles.json`; set `AGENT_SLACK_TOKEN_STORE=keychain` on macOS to keep token secrets in Keychain and only profile metadata on disk.
|
|
54
56
|
- Supports multiple profiles and workspaces.
|
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,19 @@
|
|
|
1
1
|
# @eliya-oss/agent-slack
|
|
2
2
|
|
|
3
|
+
## 0.1.3
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Open Slack OAuth login in the default browser by default.
|
|
8
|
+
|
|
9
|
+
Headless flows can still use `--auth-url-out PATH` or `--no-open`, and the CLI now reads its displayed version from package metadata so releases stay in sync.
|
|
10
|
+
|
|
11
|
+
## 0.1.2
|
|
12
|
+
|
|
13
|
+
### Patch Changes
|
|
14
|
+
|
|
15
|
+
- Fix the displayed CLI version and make the human command catalog copy-safe in terminals.
|
|
16
|
+
|
|
3
17
|
## 0.1.1
|
|
4
18
|
|
|
5
19
|
### Patch Changes
|
package/README.md
CHANGED
|
@@ -23,6 +23,8 @@ agent-slack conversation context C123 --include users,threads,permalinks --forma
|
|
|
23
23
|
agent-slack api call conversations.info --payload '{"channel":"C123"}' --json
|
|
24
24
|
```
|
|
25
25
|
|
|
26
|
+
OAuth login opens Slack in your browser. Use `--no-open` to print the URL.
|
|
27
|
+
|
|
26
28
|
## Skill
|
|
27
29
|
|
|
28
30
|
```bash
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { randomBytes } from "node:crypto";
|
|
2
|
+
import { spawn } from "node:child_process";
|
|
2
3
|
import { writeFile } from "node:fs/promises";
|
|
3
4
|
import { createServer } from "node:http";
|
|
4
5
|
import { PermissionDenied, SlackApiFailed, UsageError } from "../../domain/errors.js";
|
|
@@ -41,6 +42,12 @@ export class NodeLocalhostOAuthFlow {
|
|
|
41
42
|
if (input.authUrlOut !== undefined) {
|
|
42
43
|
await writeFile(input.authUrlOut, authorizationUrl, "utf8");
|
|
43
44
|
}
|
|
45
|
+
else if (input.openBrowser !== false) {
|
|
46
|
+
const opened = await (this.options.openBrowser ?? openSystemBrowser)(authorizationUrl);
|
|
47
|
+
process.stderr.write(opened
|
|
48
|
+
? `Opening Slack OAuth in your browser.\nIf it did not open, visit:\n${authorizationUrl}\n`
|
|
49
|
+
: `Could not open a browser automatically. Visit this Slack OAuth URL:\n${authorizationUrl}\n`);
|
|
50
|
+
}
|
|
44
51
|
else {
|
|
45
52
|
process.stderr.write(`Open this Slack OAuth URL:\n${authorizationUrl}\n`);
|
|
46
53
|
}
|
|
@@ -161,3 +168,24 @@ const splitScopes = (value) => value === undefined || value.trim() === "" ? [] :
|
|
|
161
168
|
const closeServer = (server) => {
|
|
162
169
|
server.close();
|
|
163
170
|
};
|
|
171
|
+
const openSystemBrowser = (url) => new Promise((resolve) => {
|
|
172
|
+
const command = browserCommand(url);
|
|
173
|
+
const child = spawn(command.file, command.args, {
|
|
174
|
+
detached: true,
|
|
175
|
+
stdio: "ignore"
|
|
176
|
+
});
|
|
177
|
+
child.once("error", () => resolve(false));
|
|
178
|
+
child.once("spawn", () => {
|
|
179
|
+
child.unref();
|
|
180
|
+
resolve(true);
|
|
181
|
+
});
|
|
182
|
+
});
|
|
183
|
+
const browserCommand = (url) => {
|
|
184
|
+
if (process.platform === "darwin") {
|
|
185
|
+
return { file: "open", args: [url] };
|
|
186
|
+
}
|
|
187
|
+
if (process.platform === "win32") {
|
|
188
|
+
return { file: "cmd", args: ["/c", "start", "", url] };
|
|
189
|
+
}
|
|
190
|
+
return { file: "xdg-open", args: [url] };
|
|
191
|
+
};
|
|
@@ -210,7 +210,8 @@ const authCommand = async (parsed, services) => {
|
|
|
210
210
|
userScopes: splitCsv(flagString(parsed, "user-scopes")),
|
|
211
211
|
redirectUri: flagString(parsed, "redirect-uri"),
|
|
212
212
|
authUrlOut: flagString(parsed, "auth-url-out"),
|
|
213
|
-
timeoutMs: numberFlag(parsed, "timeout-ms")
|
|
213
|
+
timeoutMs: numberFlag(parsed, "timeout-ms"),
|
|
214
|
+
openBrowser: !flagBoolean(parsed, "no-open")
|
|
214
215
|
});
|
|
215
216
|
await services.tokenStore.setProfile(profile);
|
|
216
217
|
return { method: "auth.login", profile, stdoutValue: sanitizeProfile(profile) };
|
package/dist/cli/args.js
CHANGED
package/dist/cli/metadata.js
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import { createRequire } from "node:module";
|
|
2
|
+
const require = createRequire(import.meta.url);
|
|
3
|
+
const packageJson = require("../../package.json");
|
|
1
4
|
export const PRIMARY_COMMAND_NAME = "agent-slack";
|
|
2
5
|
export const SHORT_COMMAND_NAME = "aslk";
|
|
3
6
|
export const COMMAND_NAMES = [PRIMARY_COMMAND_NAME, SHORT_COMMAND_NAME];
|
|
7
|
+
export const CLI_VERSION = packageJson.version ?? "0.0.0";
|
|
4
8
|
export const commandMetadata = [
|
|
5
9
|
{
|
|
6
10
|
path: ["describe"],
|
|
@@ -29,7 +33,7 @@ export const commandMetadata = [
|
|
|
29
33
|
{
|
|
30
34
|
path: ["auth", "login"],
|
|
31
35
|
summary: "Create a Slack auth profile with OAuth or a seeded token.",
|
|
32
|
-
flags: ["--profile", "--oauth", "--client-id", "--client-secret", "--scopes", "--user-scopes", "--redirect-uri", "--auth-url-out", "--timeout-ms", "--token", "--json"],
|
|
36
|
+
flags: ["--profile", "--oauth", "--client-id", "--client-secret", "--scopes", "--user-scopes", "--redirect-uri", "--auth-url-out", "--timeout-ms", "--no-open", "--token", "--json"],
|
|
33
37
|
safety: "read",
|
|
34
38
|
output: "profile status",
|
|
35
39
|
examples: [
|
|
@@ -277,7 +281,7 @@ export const commandMetadata = [
|
|
|
277
281
|
export const describeAllCommands = () => ({
|
|
278
282
|
name: PRIMARY_COMMAND_NAME,
|
|
279
283
|
aliases: [SHORT_COMMAND_NAME],
|
|
280
|
-
version:
|
|
284
|
+
version: CLI_VERSION,
|
|
281
285
|
commands: commandMetadata
|
|
282
286
|
});
|
|
283
287
|
export const findCommandMetadata = (path) => commandMetadata.find((command) => command.path.join(" ") === path.join(" ")) ?? null;
|
package/dist/output/human.js
CHANGED
|
@@ -48,17 +48,15 @@ const renderCommandCatalog = (catalog, paint) => {
|
|
|
48
48
|
];
|
|
49
49
|
};
|
|
50
50
|
const renderCommandGroup = (group, paint) => {
|
|
51
|
-
const width = Math.min(34, Math.max(...group.commands.map((command) => commandSignature(command).length)));
|
|
52
51
|
return [
|
|
53
52
|
paint("yellow", group.title),
|
|
54
53
|
...group.commands.map((command) => {
|
|
55
|
-
const signature = pad(commandSignature(command), width);
|
|
56
54
|
const safety = command.safety === "destructive"
|
|
57
55
|
? ` ${paint("yellow", "[destructive]")}`
|
|
58
56
|
: command.safety === "unknown"
|
|
59
57
|
? ` ${paint("yellow", "[review]")}`
|
|
60
58
|
: "";
|
|
61
|
-
return ` ${paint("cyan",
|
|
59
|
+
return ` ${paint("cyan", commandSignature(command))} - ${command.summary}${safety}`;
|
|
62
60
|
}),
|
|
63
61
|
""
|
|
64
62
|
];
|
package/package.json
CHANGED
|
@@ -11,7 +11,7 @@ Use `agent-slack` as the Slack context boundary. `aslk` is the short alias. Pref
|
|
|
11
11
|
|
|
12
12
|
1. Check availability: `agent-slack describe --json`.
|
|
13
13
|
2. Check auth: `agent-slack auth status --json`.
|
|
14
|
-
3. If auth is missing, ask the user to run OAuth
|
|
14
|
+
3. If auth is missing, ask the user to run `agent-slack auth login --oauth`; it opens Slack OAuth in the browser by default. For headless flows use `--auth-url-out PATH` or `--no-open`.
|
|
15
15
|
4. Use specific read commands before raw API calls.
|
|
16
16
|
5. Use `--json` for bounded results and `--format ndjson` for large context streams.
|
|
17
17
|
6. Read structured errors from stderr; do not parse progress text from stdout.
|