@raidiant/notifai 10.1.0 → 10.1.2
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/CHANGELOG.md +37 -0
- package/README.md +3 -0
- package/dist/cli-bin.d.ts +21 -1
- package/dist/cli-bin.js +141 -10
- package/dist/cli-bin.js.map +1 -1
- package/dist/cli-update-contract.d.ts +7 -0
- package/dist/cli-update-contract.js +10 -0
- package/dist/cli-update-contract.js.map +1 -0
- package/dist/client.d.ts +6 -1
- package/dist/client.js +1 -0
- package/dist/client.js.map +1 -1
- package/dist/codex-wake.d.ts +2 -0
- package/dist/codex-wake.js +2 -1
- package/dist/codex-wake.js.map +1 -1
- package/dist/commands-auth.d.ts +15 -1
- package/dist/commands-auth.js +29 -11
- package/dist/commands-auth.js.map +1 -1
- package/dist/commands-core.d.ts +9 -2
- package/dist/commands-core.js +11 -4
- package/dist/commands-core.js.map +1 -1
- package/dist/commands-devices.d.ts +10 -1
- package/dist/commands-devices.js +17 -13
- package/dist/commands-devices.js.map +1 -1
- package/dist/commands-doctor.js +93 -49
- package/dist/commands-doctor.js.map +1 -1
- package/dist/commands-hooks.js +47 -10
- package/dist/commands-hooks.js.map +1 -1
- package/dist/commands-init.d.ts +16 -0
- package/dist/commands-init.js +254 -93
- package/dist/commands-init.js.map +1 -1
- package/dist/commands-send-support.js +3 -0
- package/dist/commands-send-support.js.map +1 -1
- package/dist/commands-send.d.ts +1 -1
- package/dist/commands-send.js +121 -35
- package/dist/commands-send.js.map +1 -1
- package/dist/commands-skill.js +72 -54
- package/dist/commands-skill.js.map +1 -1
- package/dist/commands-update.d.ts +10 -0
- package/dist/commands-update.js +141 -0
- package/dist/commands-update.js.map +1 -0
- package/dist/commands.d.ts +2 -1
- package/dist/commands.js +2 -1
- package/dist/commands.js.map +1 -1
- package/dist/hook-adapter.d.ts +2 -0
- package/dist/hook-adapter.js +12 -1
- package/dist/hook-adapter.js.map +1 -1
- package/dist/hooks.d.ts +43 -2
- package/dist/hooks.js +163 -21
- package/dist/hooks.js.map +1 -1
- package/dist/invocation-context.d.ts +1 -0
- package/dist/invocation-context.js +9 -1
- package/dist/invocation-context.js.map +1 -1
- package/dist/main-run.d.ts +1 -0
- package/dist/main-run.js +42 -0
- package/dist/main-run.js.map +1 -0
- package/dist/main.js +10 -31
- package/dist/main.js.map +1 -1
- package/dist/native-skills.d.ts +13 -3
- package/dist/native-skills.js +51 -12
- package/dist/native-skills.js.map +1 -1
- package/dist/node-floor.d.ts +19 -0
- package/dist/node-floor.js +39 -0
- package/dist/node-floor.js.map +1 -0
- package/dist/orca-session-title.d.ts +5 -4
- package/dist/orca-session-title.js +32 -19
- package/dist/orca-session-title.js.map +1 -1
- package/dist/platform.d.ts +11 -17
- package/dist/platform.js +20 -23
- package/dist/platform.js.map +1 -1
- package/dist/program.d.ts +2 -1
- package/dist/program.js +22 -5
- package/dist/program.js.map +1 -1
- package/dist/question-settlement-process.d.ts +15 -0
- package/dist/question-settlement-process.js +35 -0
- package/dist/question-settlement-process.js.map +1 -0
- package/dist/readiness.d.ts +25 -1
- package/dist/readiness.js +32 -2
- package/dist/readiness.js.map +1 -1
- package/dist/release.d.ts +5 -5
- package/dist/release.js +5 -5
- package/dist/setup-destinations.d.ts +23 -0
- package/dist/setup-destinations.js +44 -0
- package/dist/setup-destinations.js.map +1 -0
- package/dist/skill-integrity.d.ts +49 -0
- package/dist/skill-integrity.js +154 -0
- package/dist/skill-integrity.js.map +1 -0
- package/dist/skill-source/manifest.json +16 -0
- package/dist/skill-source/notifai/SKILL.md +390 -0
- package/dist/skill-source/notifai/references/harness-setup.md +220 -0
- package/package.json +11 -14
- package/src/atomic-file.ts +0 -198
- package/src/claude-wake.test.ts +0 -321
- package/src/claude-wake.ts +0 -499
- package/src/cli-bin.test.ts +0 -38
- package/src/cli-bin.ts +0 -67
- package/src/cli-release.test.ts +0 -46
- package/src/cli-release.ts +0 -78
- package/src/client.test.ts +0 -390
- package/src/client.ts +0 -345
- package/src/codex-wake.test.ts +0 -254
- package/src/codex-wake.ts +0 -297
- package/src/command-session.ts +0 -38
- package/src/commands-agent-sessions.ts +0 -72
- package/src/commands-auth.ts +0 -205
- package/src/commands-config.ts +0 -336
- package/src/commands-core.ts +0 -298
- package/src/commands-devices.test.ts +0 -15
- package/src/commands-devices.ts +0 -173
- package/src/commands-doctor.ts +0 -1440
- package/src/commands-guidance.ts +0 -181
- package/src/commands-harness-context.ts +0 -207
- package/src/commands-hook-shape.ts +0 -69
- package/src/commands-hooks.ts +0 -2268
- package/src/commands-init.ts +0 -878
- package/src/commands-io.ts +0 -108
- package/src/commands-logs.ts +0 -243
- package/src/commands-project.ts +0 -47
- package/src/commands-send-support.test.ts +0 -156
- package/src/commands-send-support.ts +0 -311
- package/src/commands-send.ts +0 -769
- package/src/commands-setup-proof.test.ts +0 -72
- package/src/commands-setup-proof.ts +0 -124
- package/src/commands-skill.test.ts +0 -44
- package/src/commands-skill.ts +0 -204
- package/src/commands-sounds.test.ts +0 -106
- package/src/commands-sounds.ts +0 -49
- package/src/commands.test.ts +0 -7828
- package/src/commands.ts +0 -75
- package/src/config-schema.test.ts +0 -153
- package/src/config-schema.ts +0 -349
- package/src/config.test.ts +0 -581
- package/src/config.ts +0 -475
- package/src/credentials.test.ts +0 -403
- package/src/credentials.ts +0 -403
- package/src/file-lock-process-worker.test.ts +0 -64
- package/src/file-lock.test.ts +0 -320
- package/src/file-lock.ts +0 -393
- package/src/fixtures/hermes-0.20.6-classic-cli-local.json +0 -50
- package/src/fixtures/openclaw-2026.7.1-2-agent-local.json +0 -57
- package/src/generated-session-label.ts +0 -155
- package/src/guidance-content.ts +0 -278
- package/src/guidance-render.ts +0 -56
- package/src/guidance.test.ts +0 -327
- package/src/guidance.ts +0 -233
- package/src/harness-integration.test.ts +0 -294
- package/src/harnesses.test.ts +0 -149
- package/src/harnesses.ts +0 -164
- package/src/hook-adapter.test.ts +0 -496
- package/src/hook-adapter.ts +0 -410
- package/src/hook-input.test.ts +0 -39
- package/src/hook-input.ts +0 -72
- package/src/hooks.test.ts +0 -5549
- package/src/hooks.ts +0 -3759
- package/src/install-hooks.test.ts +0 -1614
- package/src/install-hooks.ts +0 -1501
- package/src/interactive.test.ts +0 -387
- package/src/interactive.ts +0 -858
- package/src/invocation-context.test.ts +0 -352
- package/src/invocation-context.ts +0 -197
- package/src/logging-process-worker.test.ts +0 -45
- package/src/logging.test.ts +0 -544
- package/src/logging.ts +0 -698
- package/src/main.ts +0 -36
- package/src/native-skills.test.ts +0 -115
- package/src/native-skills.ts +0 -162
- package/src/onboarding-docs.test.ts +0 -25
- package/src/openclaw-plugin.ts +0 -409
- package/src/opencode-plugin.ts +0 -298
- package/src/orca-session-title.test.ts +0 -54
- package/src/orca-session-title.ts +0 -103
- package/src/pack-feedback-slice.test.ts +0 -212
- package/src/pack-feedback-slice.ts +0 -187
- package/src/platform.test.ts +0 -152
- package/src/platform.ts +0 -173
- package/src/program.test.ts +0 -282
- package/src/program.ts +0 -818
- package/src/project-enablement.test.ts +0 -55
- package/src/project-enablement.ts +0 -99
- package/src/question-caps.test.ts +0 -49
- package/src/question-timing.ts +0 -56
- package/src/readiness.test.ts +0 -25
- package/src/readiness.ts +0 -179
- package/src/release.ts +0 -51
- package/src/send-attempts.test.ts +0 -143
- package/src/send-attempts.ts +0 -188
- package/src/send.test.ts +0 -28
- package/src/send.ts +0 -436
- package/src/session-activation.ts +0 -61
- package/src/session-end-log-lock-worker.test.ts +0 -35
- package/src/session-labels.test.ts +0 -490
- package/src/session-labels.ts +0 -474
- package/src/skill.test.ts +0 -415
- package/src/sound-ref.test.ts +0 -31
- package/src/sound-ref.ts +0 -34
- package/src/trust-policy.test.ts +0 -701
- package/src/ui/banner.ts +0 -95
- package/src/ui/config-view.test.ts +0 -90
- package/src/ui/config-view.ts +0 -138
- package/src/ui/help.test.ts +0 -16
- package/src/ui/help.ts +0 -128
- package/src/ui/theme.test.ts +0 -92
- package/src/ui/theme.ts +0 -265
- package/src/url-policy.ts +0 -399
- package/tsconfig.json +0 -10
package/src/interactive.test.ts
DELETED
|
@@ -1,387 +0,0 @@
|
|
|
1
|
-
import { mkdirSync, mkdtempSync, writeFileSync } from 'node:fs'
|
|
2
|
-
import os from 'node:os'
|
|
3
|
-
import path from 'node:path'
|
|
4
|
-
import { afterEach, beforeEach, describe, expect, it, vi } from 'vitest'
|
|
5
|
-
import type { ApiClient } from './client.js'
|
|
6
|
-
import { EXIT, type CommandDeps } from './commands.js'
|
|
7
|
-
import { findInstallations } from './install-hooks.js'
|
|
8
|
-
|
|
9
|
-
const CANCEL = Symbol.for('notifai-clack-cancel')
|
|
10
|
-
|
|
11
|
-
type PromptCall = {
|
|
12
|
-
kind: 'select' | 'text' | 'confirm' | 'multiselect'
|
|
13
|
-
message: string
|
|
14
|
-
options?: { value: string; label: string; hint?: string }[]
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const promptLog: PromptCall[] = []
|
|
18
|
-
let answers: Array<unknown | ((call: PromptCall) => unknown)> = []
|
|
19
|
-
|
|
20
|
-
function takeAnswer(call: PromptCall): unknown {
|
|
21
|
-
promptLog.push(call)
|
|
22
|
-
const next = answers.shift()
|
|
23
|
-
if (next === undefined) {
|
|
24
|
-
throw new Error(`unexpected ${call.kind}: ${call.message}`)
|
|
25
|
-
}
|
|
26
|
-
return typeof next === 'function' ? next(call) : next
|
|
27
|
-
}
|
|
28
|
-
|
|
29
|
-
vi.mock('@clack/prompts', () => ({
|
|
30
|
-
isCancel: (value: unknown) => value === CANCEL,
|
|
31
|
-
select: async (args: { message: string; options: { value: string; label: string; hint?: string }[] }) =>
|
|
32
|
-
takeAnswer({ kind: 'select', message: args.message, options: args.options }),
|
|
33
|
-
text: async (args: { message: string }) => takeAnswer({ kind: 'text', message: args.message }),
|
|
34
|
-
confirm: async (args: { message: string }) => takeAnswer({ kind: 'confirm', message: args.message }),
|
|
35
|
-
multiselect: async (args: { message: string; options: { value: string; label: string; hint?: string }[] }) =>
|
|
36
|
-
takeAnswer({ kind: 'multiselect', message: args.message, options: args.options }),
|
|
37
|
-
note: () => {},
|
|
38
|
-
outro: vi.fn(),
|
|
39
|
-
log: { step: () => {}, success: () => {}, error: () => {}, warn: () => {} },
|
|
40
|
-
spinner: () => ({ start: () => {}, stop: () => {} }),
|
|
41
|
-
}))
|
|
42
|
-
|
|
43
|
-
const { interactiveCommand, routingHookActions, uninstallScopeOptions } = await import('./interactive.js')
|
|
44
|
-
const clack = await import('@clack/prompts')
|
|
45
|
-
|
|
46
|
-
function isolatedEnv(cwd: string): NodeJS.ProcessEnv {
|
|
47
|
-
const home = path.join(cwd, 'home')
|
|
48
|
-
return {
|
|
49
|
-
HOME: home,
|
|
50
|
-
CLAUDE_CONFIG_DIR: path.join(home, '.claude'),
|
|
51
|
-
CODEX_HOME: path.join(home, '.codex'),
|
|
52
|
-
XDG_CONFIG_HOME: path.join(cwd, 'config'),
|
|
53
|
-
XDG_STATE_HOME: path.join(cwd, 'state'),
|
|
54
|
-
NOTIFAI_NO_ANIMATION: '1',
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
function makeClient(): ApiClient {
|
|
59
|
-
return {
|
|
60
|
-
health: async () => true,
|
|
61
|
-
capabilities: async (platform = 'ios') => ({ schema_version: 1, platform }),
|
|
62
|
-
compatibility: async () => ({
|
|
63
|
-
cli: {
|
|
64
|
-
state: 'current',
|
|
65
|
-
reason: 'current',
|
|
66
|
-
affected_operation: null,
|
|
67
|
-
recovery_action: null,
|
|
68
|
-
current_version: '5.0.0',
|
|
69
|
-
current_build: null,
|
|
70
|
-
recommended_version: '5.0.0',
|
|
71
|
-
recommended_build: null,
|
|
72
|
-
minimum_version: null,
|
|
73
|
-
minimum_build: null,
|
|
74
|
-
deprecation: null,
|
|
75
|
-
sunset: null,
|
|
76
|
-
},
|
|
77
|
-
platforms: [],
|
|
78
|
-
server_capabilities: ['answer', 'agent_acknowledgement'],
|
|
79
|
-
}),
|
|
80
|
-
listDevices: async () => ({ devices: [] }),
|
|
81
|
-
accessStatus: async () => ({ email: 'rafael@example.test' }),
|
|
82
|
-
} as unknown as ApiClient
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
function makeDeps(cwd: string, env: NodeJS.ProcessEnv = isolatedEnv(cwd)): CommandDeps {
|
|
86
|
-
return {
|
|
87
|
-
io: {
|
|
88
|
-
out: () => {},
|
|
89
|
-
err: () => {},
|
|
90
|
-
confirm: async () => false,
|
|
91
|
-
openUrl: () => {},
|
|
92
|
-
},
|
|
93
|
-
store: {
|
|
94
|
-
load: () => ({
|
|
95
|
-
machineId: 'mac_test',
|
|
96
|
-
secret: 'test-secret',
|
|
97
|
-
baseUrl: 'https://test.notifai.invalid',
|
|
98
|
-
machineName: 'test-machine',
|
|
99
|
-
}),
|
|
100
|
-
save: () => {},
|
|
101
|
-
clear: () => {},
|
|
102
|
-
describe: () => 'test credential store',
|
|
103
|
-
},
|
|
104
|
-
env,
|
|
105
|
-
cwd,
|
|
106
|
-
hookAdapterHome: path.join(cwd, 'adapter-home'),
|
|
107
|
-
clientFactory: () => makeClient(),
|
|
108
|
-
}
|
|
109
|
-
}
|
|
110
|
-
|
|
111
|
-
function markClaudeProject(cwd: string): void {
|
|
112
|
-
mkdirSync(path.join(cwd, '.claude'), { recursive: true })
|
|
113
|
-
}
|
|
114
|
-
|
|
115
|
-
function writeClaudeHooks(file: string): void {
|
|
116
|
-
mkdirSync(path.dirname(file), { recursive: true })
|
|
117
|
-
writeFileSync(
|
|
118
|
-
file,
|
|
119
|
-
`${JSON.stringify(
|
|
120
|
-
{
|
|
121
|
-
hooks: {
|
|
122
|
-
UserPromptSubmit: [
|
|
123
|
-
{ hooks: [{ type: 'command', command: 'notifai hook user-prompt-submit --owner notifai' }] },
|
|
124
|
-
],
|
|
125
|
-
Stop: [{ hooks: [{ type: 'command', command: 'notifai hook stop --owner notifai' }] }],
|
|
126
|
-
},
|
|
127
|
-
},
|
|
128
|
-
null,
|
|
129
|
-
2,
|
|
130
|
-
)}\n`,
|
|
131
|
-
)
|
|
132
|
-
}
|
|
133
|
-
|
|
134
|
-
function routingCall(): PromptCall {
|
|
135
|
-
const call = promptLog.find((entry) => entry.kind === 'select' && entry.message === 'Question routing')
|
|
136
|
-
if (call === undefined) throw new Error('Question routing was not shown')
|
|
137
|
-
return call
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
function optionValues(call: PromptCall): string[] {
|
|
141
|
-
return (call.options ?? []).map((option) => option.value)
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
function optionLabels(call: PromptCall): string[] {
|
|
145
|
-
return (call.options ?? []).map((option) => option.label)
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
describe('routingHookActions', () => {
|
|
149
|
-
it('hides install and uninstall when this directory cannot apply hooks', () => {
|
|
150
|
-
const options = routingHookActions({
|
|
151
|
-
canInstall: false,
|
|
152
|
-
projectInstallations: [],
|
|
153
|
-
machineInstallations: [],
|
|
154
|
-
hooksReady: false,
|
|
155
|
-
})
|
|
156
|
-
expect(options.map((option) => option.value)).toEqual(['settings', 'back'])
|
|
157
|
-
})
|
|
158
|
-
|
|
159
|
-
it('offers install labeled as hooks, without uninstall, when nothing is wired', () => {
|
|
160
|
-
const options = routingHookActions({
|
|
161
|
-
canInstall: true,
|
|
162
|
-
projectInstallations: [],
|
|
163
|
-
machineInstallations: [],
|
|
164
|
-
hooksReady: false,
|
|
165
|
-
})
|
|
166
|
-
expect(options.find((option) => option.value === 'install')).toMatchObject({
|
|
167
|
-
label: 'Install hooks',
|
|
168
|
-
hint: 'this project or this machine',
|
|
169
|
-
})
|
|
170
|
-
expect(options.some((option) => option.value === 'uninstall')).toBe(false)
|
|
171
|
-
})
|
|
172
|
-
|
|
173
|
-
it('names the project scope when only project hooks exist', () => {
|
|
174
|
-
const options = routingHookActions({
|
|
175
|
-
canInstall: true,
|
|
176
|
-
projectInstallations: [{ harness: 'claude-code' }],
|
|
177
|
-
machineInstallations: [],
|
|
178
|
-
hooksReady: true,
|
|
179
|
-
})
|
|
180
|
-
expect(options.find((option) => option.value === 'install')?.label).toBe('Re-install hooks')
|
|
181
|
-
expect(options.find((option) => option.value === 'uninstall')).toMatchObject({
|
|
182
|
-
label: 'Uninstall hooks for this project',
|
|
183
|
-
hint: 'claude-code',
|
|
184
|
-
})
|
|
185
|
-
})
|
|
186
|
-
|
|
187
|
-
it('names the machine scope when only machine hooks exist', () => {
|
|
188
|
-
const options = routingHookActions({
|
|
189
|
-
canInstall: false,
|
|
190
|
-
projectInstallations: [],
|
|
191
|
-
machineInstallations: [{ harness: 'claude-code' }],
|
|
192
|
-
hooksReady: true,
|
|
193
|
-
})
|
|
194
|
-
expect(options.some((option) => option.value === 'install')).toBe(false)
|
|
195
|
-
expect(options.find((option) => option.value === 'uninstall')).toMatchObject({
|
|
196
|
-
label: 'Uninstall hooks on this machine',
|
|
197
|
-
})
|
|
198
|
-
})
|
|
199
|
-
|
|
200
|
-
it('asks which scope to remove when both are present', () => {
|
|
201
|
-
const options = routingHookActions({
|
|
202
|
-
canInstall: true,
|
|
203
|
-
projectInstallations: [{ harness: 'claude-code' }],
|
|
204
|
-
machineInstallations: [{ harness: 'claude-code' }],
|
|
205
|
-
hooksReady: true,
|
|
206
|
-
})
|
|
207
|
-
expect(options.find((option) => option.value === 'uninstall')).toMatchObject({
|
|
208
|
-
label: 'Uninstall hooks',
|
|
209
|
-
hint: 'this project or this machine',
|
|
210
|
-
})
|
|
211
|
-
expect(uninstallScopeOptions([{ harness: 'claude-code' }], [{ harness: 'codex' }])).toEqual([
|
|
212
|
-
{ value: 'project', label: 'This project', hint: 'remove hooks from this directory' },
|
|
213
|
-
{ value: 'machine', label: 'This machine', hint: 'remove hooks for every project here' },
|
|
214
|
-
])
|
|
215
|
-
})
|
|
216
|
-
})
|
|
217
|
-
|
|
218
|
-
describe('interactiveCommand', () => {
|
|
219
|
-
beforeEach(() => {
|
|
220
|
-
promptLog.length = 0
|
|
221
|
-
answers = []
|
|
222
|
-
vi.mocked(clack.outro).mockClear()
|
|
223
|
-
})
|
|
224
|
-
|
|
225
|
-
afterEach(() => {
|
|
226
|
-
answers = []
|
|
227
|
-
})
|
|
228
|
-
|
|
229
|
-
it('enters init on first-run instead of a parallel Sign in path', async () => {
|
|
230
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-first-run-'))
|
|
231
|
-
const out: string[] = []
|
|
232
|
-
const deps = makeDeps(cwd)
|
|
233
|
-
deps.store.load = () => null
|
|
234
|
-
deps.io.out = (line: string) => {
|
|
235
|
-
out.push(line)
|
|
236
|
-
}
|
|
237
|
-
answers = [CANCEL]
|
|
238
|
-
|
|
239
|
-
expect(await interactiveCommand(deps, '0.0.0-test')).toBe(EXIT.ok)
|
|
240
|
-
expect(out.join('\n')).toContain('Next: This machine')
|
|
241
|
-
expect(out.join('\n')).toContain('notifai init')
|
|
242
|
-
expect(out.join('\n')).not.toContain('notifai login')
|
|
243
|
-
const menu = promptLog.find((entry) => entry.message === 'What would you like to do?')
|
|
244
|
-
expect(menu?.options?.[0]).toMatchObject({ value: 'setup', label: 'Finish setup' })
|
|
245
|
-
expect(optionLabels(menu!)).not.toContain('Sign in')
|
|
246
|
-
expect(optionLabels(menu!)).not.toContain('Add a device')
|
|
247
|
-
})
|
|
248
|
-
|
|
249
|
-
it('offers Finish setup instead of a parallel Add a device path', async () => {
|
|
250
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-finish-setup-'))
|
|
251
|
-
answers = [CANCEL]
|
|
252
|
-
|
|
253
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
254
|
-
const menu = promptLog.find((entry) => entry.message === 'What would you like to do?')
|
|
255
|
-
expect(menu?.options?.[0]).toMatchObject({ value: 'setup', label: 'Finish setup' })
|
|
256
|
-
expect(optionLabels(menu!)).not.toContain('Add a device')
|
|
257
|
-
expect(optionLabels(menu!)).not.toContain('Sign in')
|
|
258
|
-
})
|
|
259
|
-
|
|
260
|
-
it('quits from the root menu on Escape', async () => {
|
|
261
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-root-esc-'))
|
|
262
|
-
answers = [CANCEL]
|
|
263
|
-
|
|
264
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
265
|
-
expect(promptLog.map((entry) => entry.message)).toEqual(['What would you like to do?'])
|
|
266
|
-
expect(clack.outro).toHaveBeenCalledOnce()
|
|
267
|
-
})
|
|
268
|
-
|
|
269
|
-
it('goes back to the root menu when Escape is pressed on question routing', async () => {
|
|
270
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-routing-esc-'))
|
|
271
|
-
markClaudeProject(cwd)
|
|
272
|
-
answers = ['routing', CANCEL, CANCEL]
|
|
273
|
-
|
|
274
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
275
|
-
expect(promptLog.filter((entry) => entry.message === 'What would you like to do?')).toHaveLength(2)
|
|
276
|
-
expect(clack.outro).toHaveBeenCalledOnce()
|
|
277
|
-
})
|
|
278
|
-
|
|
279
|
-
it('goes back from settings and account instead of quitting', async () => {
|
|
280
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-nested-esc-'))
|
|
281
|
-
answers = ['settings', CANCEL, 'account', CANCEL, 'quit']
|
|
282
|
-
|
|
283
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
284
|
-
expect(promptLog.filter((entry) => entry.message === 'What would you like to do?')).toHaveLength(3)
|
|
285
|
-
expect(clack.outro).toHaveBeenCalledOnce()
|
|
286
|
-
})
|
|
287
|
-
|
|
288
|
-
it('does not install hooks when Escape is pressed on the install scope picker', async () => {
|
|
289
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-install-esc-'))
|
|
290
|
-
markClaudeProject(cwd)
|
|
291
|
-
const deps = makeDeps(cwd)
|
|
292
|
-
answers = ['routing', 'install', CANCEL, 'quit']
|
|
293
|
-
|
|
294
|
-
expect(await interactiveCommand(deps, '0.0.0-test')).toBe(EXIT.ok)
|
|
295
|
-
expect(findInstallations(cwd, deps.env, deps.hookAdapterHome)).toEqual([])
|
|
296
|
-
expect(promptLog.some((entry) => entry.message === 'Install hooks for')).toBe(true)
|
|
297
|
-
expect(promptLog.filter((entry) => entry.message === 'What would you like to do?')).toHaveLength(2)
|
|
298
|
-
})
|
|
299
|
-
|
|
300
|
-
it('offers install hooks when a harness applies here and omits uninstall when none are wired', async () => {
|
|
301
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-install-offer-'))
|
|
302
|
-
markClaudeProject(cwd)
|
|
303
|
-
answers = ['routing', 'back', 'quit']
|
|
304
|
-
|
|
305
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
306
|
-
expect(optionLabels(routingCall())).toContain('Install hooks')
|
|
307
|
-
expect(optionValues(routingCall())).not.toContain('uninstall')
|
|
308
|
-
})
|
|
309
|
-
|
|
310
|
-
it('hides install when no harness applies in this directory', async () => {
|
|
311
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-no-harness-'))
|
|
312
|
-
answers = ['routing', 'back', 'quit']
|
|
313
|
-
|
|
314
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
315
|
-
expect(optionValues(routingCall())).toEqual(['settings', 'back'])
|
|
316
|
-
})
|
|
317
|
-
|
|
318
|
-
it('names machine uninstall and does not strip it on Escape', async () => {
|
|
319
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-machine-esc-'))
|
|
320
|
-
const env = isolatedEnv(cwd)
|
|
321
|
-
const deps = makeDeps(cwd, env)
|
|
322
|
-
writeClaudeHooks(path.join(env.CLAUDE_CONFIG_DIR!, 'settings.json'))
|
|
323
|
-
expect(findInstallations(cwd, env, deps.hookAdapterHome).some((item) => item.global)).toBe(true)
|
|
324
|
-
|
|
325
|
-
answers = ['routing', CANCEL, 'quit']
|
|
326
|
-
expect(await interactiveCommand(deps, '0.0.0-test')).toBe(EXIT.ok)
|
|
327
|
-
expect(optionLabels(routingCall())).toContain('Uninstall hooks on this machine')
|
|
328
|
-
expect(findInstallations(cwd, env, deps.hookAdapterHome).some((item) => item.global)).toBe(true)
|
|
329
|
-
})
|
|
330
|
-
|
|
331
|
-
it('uninstalls only the named project scope and leaves machine hooks', async () => {
|
|
332
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-scope-'))
|
|
333
|
-
markClaudeProject(cwd)
|
|
334
|
-
const env = isolatedEnv(cwd)
|
|
335
|
-
const deps = makeDeps(cwd, env)
|
|
336
|
-
writeClaudeHooks(path.join(cwd, '.claude', 'settings.local.json'))
|
|
337
|
-
writeClaudeHooks(path.join(env.CLAUDE_CONFIG_DIR!, 'settings.json'))
|
|
338
|
-
|
|
339
|
-
answers = ['routing', 'uninstall', 'project', 'quit']
|
|
340
|
-
expect(await interactiveCommand(deps, '0.0.0-test')).toBe(EXIT.ok)
|
|
341
|
-
|
|
342
|
-
const remaining = findInstallations(cwd, env, deps.hookAdapterHome)
|
|
343
|
-
expect(remaining.some((item) => !item.global && item.harness === 'claude-code')).toBe(false)
|
|
344
|
-
expect(remaining.some((item) => item.global && item.harness === 'claude-code')).toBe(true)
|
|
345
|
-
const scopeCall = promptLog.find((entry) => entry.message === 'Uninstall hooks from')
|
|
346
|
-
expect(scopeCall).toBeDefined()
|
|
347
|
-
expect(optionLabels(scopeCall!)).toEqual(['This project', 'This machine', '← Back'])
|
|
348
|
-
})
|
|
349
|
-
|
|
350
|
-
it('does not strip either scope when Escape is pressed on the uninstall picker', async () => {
|
|
351
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-uninstall-esc-'))
|
|
352
|
-
markClaudeProject(cwd)
|
|
353
|
-
const env = isolatedEnv(cwd)
|
|
354
|
-
const deps = makeDeps(cwd, env)
|
|
355
|
-
writeClaudeHooks(path.join(cwd, '.claude', 'settings.local.json'))
|
|
356
|
-
writeClaudeHooks(path.join(env.CLAUDE_CONFIG_DIR!, 'settings.json'))
|
|
357
|
-
|
|
358
|
-
answers = ['routing', 'uninstall', CANCEL, 'quit']
|
|
359
|
-
expect(await interactiveCommand(deps, '0.0.0-test')).toBe(EXIT.ok)
|
|
360
|
-
|
|
361
|
-
const remaining = findInstallations(cwd, env, deps.hookAdapterHome)
|
|
362
|
-
expect(remaining.some((item) => !item.global && item.harness === 'claude-code')).toBe(true)
|
|
363
|
-
expect(remaining.some((item) => item.global && item.harness === 'claude-code')).toBe(true)
|
|
364
|
-
})
|
|
365
|
-
|
|
366
|
-
it('goes back from a test notification prompt instead of quitting', async () => {
|
|
367
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-test-esc-'))
|
|
368
|
-
answers = ['test', CANCEL, 'quit']
|
|
369
|
-
|
|
370
|
-
expect(await interactiveCommand(makeDeps(cwd), '0.0.0-test')).toBe(EXIT.ok)
|
|
371
|
-
expect(promptLog.filter((entry) => entry.message === 'What would you like to do?')).toHaveLength(2)
|
|
372
|
-
expect(promptLog.some((entry) => entry.message === 'Title')).toBe(true)
|
|
373
|
-
expect(clack.outro).toHaveBeenCalledOnce()
|
|
374
|
-
})
|
|
375
|
-
|
|
376
|
-
it('uninstalls machine hooks only after that scope is chosen by name', async () => {
|
|
377
|
-
const cwd = mkdtempSync(path.join(os.tmpdir(), 'notifai-interactive-machine-remove-'))
|
|
378
|
-
const env = isolatedEnv(cwd)
|
|
379
|
-
const deps = makeDeps(cwd, env)
|
|
380
|
-
writeClaudeHooks(path.join(env.CLAUDE_CONFIG_DIR!, 'settings.json'))
|
|
381
|
-
|
|
382
|
-
answers = ['routing', 'uninstall', 'quit']
|
|
383
|
-
expect(await interactiveCommand(deps, '0.0.0-test')).toBe(EXIT.ok)
|
|
384
|
-
expect(optionLabels(routingCall())).toContain('Uninstall hooks on this machine')
|
|
385
|
-
expect(findInstallations(cwd, env, deps.hookAdapterHome)).toEqual([])
|
|
386
|
-
})
|
|
387
|
-
})
|