@moxxy/plugin-channel-slack 0.28.0 → 0.29.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@moxxy/plugin-channel-slack",
3
- "version": "0.28.0",
3
+ "version": "0.29.0",
4
4
  "description": "Slack bot channel for moxxy. Ingests Slack Events API over the proxy relay, drives the Session, and streams threaded replies. Autonomous allow-list permission model (no human in the loop).",
5
5
  "keywords": [
6
6
  "moxxy",
@@ -73,20 +73,20 @@
73
73
  "dependencies": {
74
74
  "@clack/prompts": "^1.4.0",
75
75
  "zod": "^3.24.0",
76
- "@moxxy/channel-kit": "0.28.0",
77
- "@moxxy/config": "0.28.0",
78
- "@moxxy/plugin-tunnel-proxy": "0.28.0",
79
- "@moxxy/core": "0.28.0",
80
- "@moxxy/plugin-vault": "0.28.0",
81
- "@moxxy/sdk": "0.28.0"
76
+ "@moxxy/channel-kit": "0.29.0",
77
+ "@moxxy/config": "0.29.0",
78
+ "@moxxy/core": "0.29.0",
79
+ "@moxxy/plugin-vault": "0.29.0",
80
+ "@moxxy/plugin-tunnel-proxy": "0.29.0",
81
+ "@moxxy/sdk": "0.29.0"
82
82
  },
83
83
  "devDependencies": {
84
84
  "@types/node": "^22.10.0",
85
85
  "typescript": "^5.7.3",
86
86
  "vitest": "^2.1.8",
87
+ "@moxxy/testing": "0.0.48",
87
88
  "@moxxy/vitest-preset": "0.0.0",
88
- "@moxxy/tsconfig": "0.0.0",
89
- "@moxxy/testing": "0.0.46"
89
+ "@moxxy/tsconfig": "0.0.0"
90
90
  },
91
91
  "scripts": {
92
92
  "build": "tsc -p tsconfig.json",
@@ -26,7 +26,7 @@ beforeEach(async () => {
26
26
  keySource: createStaticKeySource(deriveKey('test', generateSalt())),
27
27
  });
28
28
  const plugin = buildSlackPlugin({ vault });
29
- slackDef = plugin.channels![0]!;
29
+ slackDef = (plugin.channels ?? [])[0] as ChannelDef;
30
30
  writeOut = [];
31
31
  writeErr = [];
32
32
  origStdoutWrite = process.stdout.write.bind(process.stdout);
@@ -61,14 +61,14 @@ function ctx(overrides: { startChannel?: () => Promise<number> } = {}) {
61
61
  describe('slack channel subcommands (registered on ChannelDef)', () => {
62
62
  it('exposes setup, pair, status, unpair', () => {
63
63
  expect(slackDef.subcommands).toBeDefined();
64
- expect(Object.keys(slackDef.subcommands!)).toEqual(
64
+ expect(Object.keys(slackDef.subcommands ?? {})).toEqual(
65
65
  expect.arrayContaining(['setup', 'pair', 'status', 'unpair']),
66
66
  );
67
67
  expect(slackDef.interactiveCommand).toBe('setup');
68
68
  });
69
69
 
70
70
  it('`status` reports unconfigured vault state as JSON', async () => {
71
- const code = await slackDef.subcommands!.status!.run(ctx());
71
+ const code = await slackDef.subcommands?.status?.run(ctx());
72
72
  expect(code).toBe(0);
73
73
  const parsed = JSON.parse(writeOut.join(''));
74
74
  expect(parsed).toEqual({
@@ -86,7 +86,7 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
86
86
  SLACK_AUTHORIZED_KEY,
87
87
  JSON.stringify({ teamId: 'T1', channelId: 'C1' }),
88
88
  );
89
- const code = await slackDef.subcommands!.status!.run(ctx());
89
+ const code = await slackDef.subcommands?.status?.run(ctx());
90
90
  expect(code).toBe(0);
91
91
  const parsed = JSON.parse(writeOut.join(''));
92
92
  expect(parsed).toEqual({
@@ -100,7 +100,7 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
100
100
  it('`status` honors env overrides for token/secret', async () => {
101
101
  process.env.MOXXY_SLACK_BOT_TOKEN = 'xoxb-env-token-abcdefghijkl';
102
102
  process.env.MOXXY_SLACK_SIGNING_SECRET = 'env-signing-secret-0123456789';
103
- const code = await slackDef.subcommands!.status!.run(ctx());
103
+ const code = await slackDef.subcommands?.status?.run(ctx());
104
104
  expect(code).toBe(0);
105
105
  const parsed = JSON.parse(writeOut.join(''));
106
106
  expect(parsed.botTokenConfigured).toBe(true);
@@ -109,7 +109,7 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
109
109
 
110
110
  it('`status` reports null for a corrupt authorization record', async () => {
111
111
  await vault.set(SLACK_AUTHORIZED_KEY, 'not-json');
112
- const code = await slackDef.subcommands!.status!.run(ctx());
112
+ const code = await slackDef.subcommands?.status?.run(ctx());
113
113
  expect(code).toBe(0);
114
114
  const parsed = JSON.parse(writeOut.join(''));
115
115
  expect(parsed.authorized).toBeNull();
@@ -117,14 +117,14 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
117
117
 
118
118
  it('`unpair` clears the authorization and reports', async () => {
119
119
  await vault.set(SLACK_AUTHORIZED_KEY, JSON.stringify({ teamId: 'T1' }));
120
- const code = await slackDef.subcommands!.unpair!.run(ctx());
120
+ const code = await slackDef.subcommands?.unpair?.run(ctx());
121
121
  expect(code).toBe(0);
122
122
  expect(writeOut.join('')).toContain('unpaired');
123
123
  expect(await vault.get(SLACK_AUTHORIZED_KEY)).toBeNull();
124
124
  });
125
125
 
126
126
  it('`unpair` is a no-op when nothing is paired', async () => {
127
- const code = await slackDef.subcommands!.unpair!.run(ctx());
127
+ const code = await slackDef.subcommands?.unpair?.run(ctx());
128
128
  expect(code).toBe(0);
129
129
  expect(writeOut.join('')).toContain('no pairing was active');
130
130
  });
@@ -134,7 +134,7 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
134
134
  Object.defineProperty(process.stdin, 'isTTY', { value: false, configurable: true });
135
135
  try {
136
136
  const startChannel = vi.fn(async () => 0);
137
- const code = await slackDef.subcommands!.pair!.run(ctx({ startChannel }));
137
+ const code = await slackDef.subcommands?.pair?.run(ctx({ startChannel }));
138
138
  expect(code).toBe(1);
139
139
  expect(startChannel).not.toHaveBeenCalled();
140
140
  expect(writeErr.join('')).toMatch(/TTY/);
@@ -148,7 +148,7 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
148
148
  Object.defineProperty(process.stdin, 'isTTY', { value: false, configurable: true });
149
149
  try {
150
150
  const startChannel = vi.fn(async () => 0);
151
- const code = await slackDef.subcommands!.setup!.run(ctx({ startChannel }));
151
+ const code = await slackDef.subcommands?.setup?.run(ctx({ startChannel }));
152
152
  expect(code).toBe(0);
153
153
  expect(startChannel).toHaveBeenCalledTimes(1);
154
154
  } finally {
@@ -163,27 +163,27 @@ describe('slack channel subcommands (registered on ChannelDef)', () => {
163
163
  startChannel: async () => 0,
164
164
  session: { setPermissionResolver: () => {} },
165
165
  } as never;
166
- const code = await slackDef.subcommands!.status!.run(badCtx);
166
+ const code = await slackDef.subcommands?.status?.run(badCtx);
167
167
  expect(code).toBe(1);
168
168
  expect(writeErr.join('')).toContain('vault unavailable');
169
169
  });
170
170
 
171
171
  it('isAvailable gates on BOTH token and secret', async () => {
172
172
  // Neither set → unavailable, reason names both.
173
- let avail = await slackDef.isAvailable!({ cwd: tmp, vault });
174
- expect(avail.ok).toBe(false);
175
- expect(avail.reason).toMatch(/bot token/);
176
- expect(avail.reason).toMatch(/signing secret/);
173
+ let avail = await slackDef.isAvailable?.({ cwd: tmp, vault });
174
+ expect(avail?.ok).toBe(false);
175
+ expect(avail?.reason).toMatch(/bot token/);
176
+ expect(avail?.reason).toMatch(/signing secret/);
177
177
 
178
178
  // Only token → still unavailable, reason names the secret.
179
179
  await vault.set(SLACK_BOT_TOKEN_KEY, 'xoxb-1111-2222-abcdefghijklmnop');
180
- avail = await slackDef.isAvailable!({ cwd: tmp, vault });
181
- expect(avail.ok).toBe(false);
182
- expect(avail.reason).toMatch(/signing secret/);
180
+ avail = await slackDef.isAvailable?.({ cwd: tmp, vault });
181
+ expect(avail?.ok).toBe(false);
182
+ expect(avail?.reason).toMatch(/signing secret/);
183
183
 
184
184
  // Both → available.
185
185
  await vault.set(SLACK_SIGNING_SECRET_KEY, '0123456789abcdef0123456789abcdef');
186
- avail = await slackDef.isAvailable!({ cwd: tmp, vault });
187
- expect(avail.ok).toBe(true);
186
+ avail = await slackDef.isAvailable?.({ cwd: tmp, vault });
187
+ expect(avail?.ok).toBe(true);
188
188
  });
189
189
  });