digital-tools 2.1.3 → 2.3.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/CHANGELOG.md +9 -0
- package/README.md +2 -0
- package/dist/client.d.ts +109 -0
- package/dist/client.d.ts.map +1 -0
- package/dist/client.js +69 -0
- package/dist/client.js.map +1 -0
- package/dist/define.d.ts +2 -2
- package/dist/define.d.ts.map +1 -1
- package/dist/define.js +21 -11
- package/dist/define.js.map +1 -1
- package/dist/function-ref.d.ts +229 -0
- package/dist/function-ref.d.ts.map +1 -0
- package/dist/function-ref.js +28 -0
- package/dist/function-ref.js.map +1 -0
- package/dist/function-sugar.d.ts +57 -0
- package/dist/function-sugar.d.ts.map +1 -0
- package/dist/function-sugar.js +79 -0
- package/dist/function-sugar.js.map +1 -0
- package/dist/index.d.ts +10 -3
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +24 -4
- package/dist/index.js.map +1 -1
- package/dist/providers/analytics/mixpanel.d.ts.map +1 -1
- package/dist/providers/analytics/mixpanel.js +21 -18
- package/dist/providers/analytics/mixpanel.js.map +1 -1
- package/dist/providers/calendar/cal-com.d.ts.map +1 -1
- package/dist/providers/calendar/cal-com.js +10 -10
- package/dist/providers/calendar/cal-com.js.map +1 -1
- package/dist/providers/calendar/google-calendar.d.ts.map +1 -1
- package/dist/providers/calendar/google-calendar.js +4 -4
- package/dist/providers/calendar/google-calendar.js.map +1 -1
- package/dist/providers/crm/hubspot.d.ts.map +1 -1
- package/dist/providers/crm/hubspot.js +107 -85
- package/dist/providers/crm/hubspot.js.map +1 -1
- package/dist/providers/development/github.d.ts.map +1 -1
- package/dist/providers/development/github.js +40 -43
- package/dist/providers/development/github.js.map +1 -1
- package/dist/providers/ecommerce/shopify.d.ts.map +1 -1
- package/dist/providers/ecommerce/shopify.js +79 -62
- package/dist/providers/ecommerce/shopify.js.map +1 -1
- package/dist/providers/email/resend.d.ts.map +1 -1
- package/dist/providers/email/resend.js +20 -16
- package/dist/providers/email/resend.js.map +1 -1
- package/dist/providers/email/sendgrid.d.ts.map +1 -1
- package/dist/providers/email/sendgrid.js +12 -9
- package/dist/providers/email/sendgrid.js.map +1 -1
- package/dist/providers/finance/stripe.d.ts.map +1 -1
- package/dist/providers/finance/stripe.js +44 -42
- package/dist/providers/finance/stripe.js.map +1 -1
- package/dist/providers/forms/typeform.d.ts.map +1 -1
- package/dist/providers/forms/typeform.js +68 -58
- package/dist/providers/forms/typeform.js.map +1 -1
- package/dist/providers/knowledge/notion.d.ts.map +1 -1
- package/dist/providers/knowledge/notion.js +75 -41
- package/dist/providers/knowledge/notion.js.map +1 -1
- package/dist/providers/marketing/mailchimp.d.ts.map +1 -1
- package/dist/providers/marketing/mailchimp.js +74 -61
- package/dist/providers/marketing/mailchimp.js.map +1 -1
- package/dist/providers/media/cloudinary.d.ts.map +1 -1
- package/dist/providers/media/cloudinary.js +30 -28
- package/dist/providers/media/cloudinary.js.map +1 -1
- package/dist/providers/messaging/slack.d.ts.map +1 -1
- package/dist/providers/messaging/slack.js +75 -58
- package/dist/providers/messaging/slack.js.map +1 -1
- package/dist/providers/messaging/twilio-sms.d.ts.map +1 -1
- package/dist/providers/messaging/twilio-sms.js +33 -15
- package/dist/providers/messaging/twilio-sms.js.map +1 -1
- package/dist/providers/project-management/linear.d.ts.map +1 -1
- package/dist/providers/project-management/linear.js +31 -27
- package/dist/providers/project-management/linear.js.map +1 -1
- package/dist/providers/spreadsheet/google-sheets.d.ts.map +1 -1
- package/dist/providers/spreadsheet/google-sheets.js +21 -18
- package/dist/providers/spreadsheet/google-sheets.js.map +1 -1
- package/dist/providers/spreadsheet/xlsx.d.ts.map +1 -1
- package/dist/providers/spreadsheet/xlsx.js +4 -4
- package/dist/providers/spreadsheet/xlsx.js.map +1 -1
- package/dist/providers/storage/index.js +1 -0
- package/dist/providers/storage/index.js.map +1 -1
- package/dist/providers/storage/s3.d.ts.map +1 -1
- package/dist/providers/storage/s3.js +36 -27
- package/dist/providers/storage/s3.js.map +1 -1
- package/dist/providers/support/zendesk.d.ts.map +1 -1
- package/dist/providers/support/zendesk.js +24 -25
- package/dist/providers/support/zendesk.js.map +1 -1
- package/dist/providers/tasks/todoist.d.ts.map +1 -1
- package/dist/providers/tasks/todoist.js +18 -18
- package/dist/providers/tasks/todoist.js.map +1 -1
- package/dist/providers/video-conferencing/google-meet.d.ts.map +1 -1
- package/dist/providers/video-conferencing/google-meet.js +11 -11
- package/dist/providers/video-conferencing/google-meet.js.map +1 -1
- package/dist/providers/video-conferencing/jitsi.js +14 -14
- package/dist/providers/video-conferencing/jitsi.js.map +1 -1
- package/dist/providers/video-conferencing/teams.d.ts.map +1 -1
- package/dist/providers/video-conferencing/teams.js +9 -7
- package/dist/providers/video-conferencing/teams.js.map +1 -1
- package/dist/providers/video-conferencing/zoom.d.ts.map +1 -1
- package/dist/providers/video-conferencing/zoom.js +26 -24
- package/dist/providers/video-conferencing/zoom.js.map +1 -1
- package/dist/tools/data.d.ts.map +1 -1
- package/dist/tools/data.js +5 -12
- package/dist/tools/data.js.map +1 -1
- package/dist/tools/index.d.ts +1 -0
- package/dist/tools/index.d.ts.map +1 -1
- package/dist/tools/index.js +1 -0
- package/dist/tools/index.js.map +1 -1
- package/dist/tools/system.d.ts +289 -0
- package/dist/tools/system.d.ts.map +1 -0
- package/dist/tools/system.js +752 -0
- package/dist/tools/system.js.map +1 -0
- package/dist/tools/web.d.ts.map +1 -1
- package/dist/tools/web.js +22 -10
- package/dist/tools/web.js.map +1 -1
- package/dist/track-record.d.ts +101 -0
- package/dist/track-record.d.ts.map +1 -0
- package/dist/track-record.js +17 -0
- package/dist/track-record.js.map +1 -0
- package/dist/types.d.ts +210 -9
- package/dist/types.d.ts.map +1 -1
- package/dist/verb-registration.d.ts +122 -0
- package/dist/verb-registration.d.ts.map +1 -0
- package/dist/verb-registration.js +176 -0
- package/dist/verb-registration.js.map +1 -0
- package/dist/worker.d.ts +93 -0
- package/dist/worker.d.ts.map +1 -0
- package/dist/worker.js +315 -0
- package/dist/worker.js.map +1 -0
- package/dist/wrap.d.ts +89 -0
- package/dist/wrap.d.ts.map +1 -0
- package/dist/wrap.js +225 -0
- package/dist/wrap.js.map +1 -0
- package/package.json +31 -14
- package/src/client.ts +136 -0
- package/src/define.ts +30 -24
- package/src/function-ref.ts +264 -0
- package/src/function-sugar.ts +134 -0
- package/src/index.ts +132 -10
- package/src/providers/analytics/mixpanel.ts +19 -18
- package/src/providers/calendar/cal-com.ts +29 -18
- package/src/providers/calendar/google-calendar.ts +20 -14
- package/src/providers/crm/hubspot.ts +225 -99
- package/src/providers/development/github.ts +206 -135
- package/src/providers/ecommerce/shopify.ts +250 -89
- package/src/providers/email/resend.ts +101 -28
- package/src/providers/email/sendgrid.ts +12 -9
- package/src/providers/finance/stripe.ts +128 -49
- package/src/providers/forms/typeform.ts +74 -58
- package/src/providers/knowledge/notion.ts +340 -88
- package/src/providers/marketing/mailchimp.ts +86 -70
- package/src/providers/media/cloudinary.ts +99 -41
- package/src/providers/messaging/slack.ts +283 -85
- package/src/providers/messaging/twilio-sms.ts +35 -15
- package/src/providers/project-management/linear.ts +143 -55
- package/src/providers/spreadsheet/google-sheets.ts +222 -56
- package/src/providers/spreadsheet/xlsx.ts +47 -16
- package/src/providers/storage/s3.ts +119 -47
- package/src/providers/support/zendesk.ts +196 -46
- package/src/providers/tasks/todoist.ts +20 -26
- package/src/providers/video-conferencing/google-meet.ts +17 -20
- package/src/providers/video-conferencing/jitsi.ts +14 -14
- package/src/providers/video-conferencing/teams.ts +14 -13
- package/src/providers/video-conferencing/zoom.ts +54 -49
- package/src/tools/data.ts +6 -16
- package/src/tools/index.ts +1 -0
- package/src/tools/system.ts +887 -0
- package/src/tools/web.ts +22 -10
- package/src/track-record.ts +106 -0
- package/src/types.ts +241 -13
- package/src/verb-registration.ts +197 -0
- package/src/worker.ts +370 -0
- package/src/wrap.ts +260 -0
- package/test/client.test.ts +146 -0
- package/test/communication-tools-extended.test.ts +734 -0
- package/test/data-tools-extended.test.ts +743 -0
- package/test/define-extended.test.ts +819 -0
- package/test/define.test.ts +150 -41
- package/test/entities.test.ts +623 -0
- package/test/extended-entities.test.ts +1228 -0
- package/test/provider-implementations.test.ts +725 -0
- package/test/provider-registry-extended.test.ts +583 -0
- package/test/providers/google-sheets.test.ts +851 -0
- package/test/providers/helpers.ts +554 -0
- package/test/providers/hubspot.test.ts +576 -0
- package/test/providers/slack.test.ts +932 -0
- package/test/providers/stripe.test.ts +701 -0
- package/test/providers.test.ts +578 -0
- package/test/system-tools-extended.test.ts +632 -0
- package/test/system.test.ts +673 -0
- package/test/tools.test.ts +15 -11
- package/test/types.test.ts +402 -0
- package/test/verb-registration.test.ts +395 -0
- package/test/web-tools.test.ts +553 -0
- package/test/worker-extended.test.ts +699 -0
- package/test/worker.test.ts +576 -0
- package/test/wrap.test.ts +366 -0
- package/tsconfig.json +3 -13
- package/vitest.config.ts +37 -0
- package/wrangler.jsonc +9 -0
- package/.turbo/turbo-build.log +0 -4
- package/LICENSE +0 -21
- package/dist/providers/voice/vapi.d.ts +0 -27
- package/dist/providers/voice/vapi.d.ts.map +0 -1
- package/dist/providers/voice/vapi.js +0 -440
- package/dist/providers/voice/vapi.js.map +0 -1
- package/src/define.js +0 -259
- package/src/entities/advertising.js +0 -999
- package/src/entities/ai.js +0 -756
- package/src/entities/analytics.js +0 -1588
- package/src/entities/automation.js +0 -601
- package/src/entities/communication.js +0 -1150
- package/src/entities/crm.js +0 -1386
- package/src/entities/design.js +0 -546
- package/src/entities/development.js +0 -2212
- package/src/entities/document.js +0 -874
- package/src/entities/ecommerce.js +0 -1429
- package/src/entities/experiment.js +0 -1039
- package/src/entities/finance.js +0 -3478
- package/src/entities/forms.js +0 -1892
- package/src/entities/hr.js +0 -661
- package/src/entities/identity.js +0 -997
- package/src/entities/index.js +0 -282
- package/src/entities/infrastructure.js +0 -1153
- package/src/entities/knowledge.js +0 -1438
- package/src/entities/marketing.js +0 -1610
- package/src/entities/media.js +0 -1634
- package/src/entities/notification.js +0 -1199
- package/src/entities/presentation.js +0 -1274
- package/src/entities/productivity.js +0 -1317
- package/src/entities/project-management.js +0 -1136
- package/src/entities/recruiting.js +0 -736
- package/src/entities/shipping.js +0 -509
- package/src/entities/signature.js +0 -1102
- package/src/entities/site.js +0 -222
- package/src/entities/spreadsheet.js +0 -1341
- package/src/entities/storage.js +0 -1198
- package/src/entities/support.js +0 -1166
- package/src/entities/video-conferencing.js +0 -1750
- package/src/entities/video.js +0 -950
- package/src/entities.js +0 -1663
- package/src/index.js +0 -74
- package/src/providers/analytics/index.js +0 -17
- package/src/providers/analytics/mixpanel.js +0 -255
- package/src/providers/calendar/cal-com.js +0 -303
- package/src/providers/calendar/google-calendar.js +0 -335
- package/src/providers/calendar/index.js +0 -20
- package/src/providers/crm/hubspot.js +0 -566
- package/src/providers/crm/index.js +0 -17
- package/src/providers/development/github.js +0 -472
- package/src/providers/development/index.js +0 -17
- package/src/providers/ecommerce/index.js +0 -17
- package/src/providers/ecommerce/shopify.js +0 -378
- package/src/providers/email/index.js +0 -20
- package/src/providers/email/resend.js +0 -258
- package/src/providers/email/sendgrid.js +0 -161
- package/src/providers/finance/index.js +0 -17
- package/src/providers/finance/stripe.js +0 -549
- package/src/providers/forms/index.js +0 -17
- package/src/providers/forms/typeform.js +0 -500
- package/src/providers/index.js +0 -123
- package/src/providers/knowledge/index.js +0 -17
- package/src/providers/knowledge/notion.js +0 -389
- package/src/providers/marketing/index.js +0 -17
- package/src/providers/marketing/mailchimp.js +0 -443
- package/src/providers/media/cloudinary.js +0 -318
- package/src/providers/media/index.js +0 -17
- package/src/providers/messaging/index.js +0 -20
- package/src/providers/messaging/slack.js +0 -393
- package/src/providers/messaging/twilio-sms.js +0 -249
- package/src/providers/project-management/index.js +0 -17
- package/src/providers/project-management/linear.js +0 -575
- package/src/providers/registry.js +0 -86
- package/src/providers/spreadsheet/google-sheets.js +0 -375
- package/src/providers/spreadsheet/index.js +0 -20
- package/src/providers/spreadsheet/xlsx.js +0 -423
- package/src/providers/storage/index.js +0 -24
- package/src/providers/storage/s3.js +0 -419
- package/src/providers/support/index.js +0 -17
- package/src/providers/support/zendesk.js +0 -373
- package/src/providers/tasks/index.js +0 -17
- package/src/providers/tasks/todoist.js +0 -286
- package/src/providers/types.js +0 -9
- package/src/providers/video-conferencing/google-meet.js +0 -286
- package/src/providers/video-conferencing/index.js +0 -31
- package/src/providers/video-conferencing/jitsi.js +0 -254
- package/src/providers/video-conferencing/teams.js +0 -270
- package/src/providers/video-conferencing/zoom.js +0 -332
- package/src/registry.js +0 -128
- package/src/tools/communication.js +0 -184
- package/src/tools/data.js +0 -205
- package/src/tools/index.js +0 -11
- package/src/tools/web.js +0 -137
- package/src/types.js +0 -10
- package/test/define.test.js +0 -306
- package/test/registry.test.js +0 -357
- package/test/tools.test.js +0 -363
|
@@ -0,0 +1,673 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Tests for System Tools (fsx.do, gitx.do, bashx.do integration)
|
|
3
|
+
*
|
|
4
|
+
* Tests filesystem, git, and bash tools that integrate with the dotdo ecosystem.
|
|
5
|
+
*/
|
|
6
|
+
|
|
7
|
+
import { describe, it, expect, beforeEach } from 'vitest'
|
|
8
|
+
// Import directly from the source file to ensure proper resolution
|
|
9
|
+
import {
|
|
10
|
+
fsRead,
|
|
11
|
+
fsWrite,
|
|
12
|
+
fsList,
|
|
13
|
+
fsDelete,
|
|
14
|
+
fsGlob,
|
|
15
|
+
fsGrep,
|
|
16
|
+
fsxTools,
|
|
17
|
+
gitInit,
|
|
18
|
+
gitClone,
|
|
19
|
+
gitStatus,
|
|
20
|
+
gitAdd,
|
|
21
|
+
gitCommit,
|
|
22
|
+
gitLog,
|
|
23
|
+
gitDiff,
|
|
24
|
+
gitCheckout,
|
|
25
|
+
gitPush,
|
|
26
|
+
gitPull,
|
|
27
|
+
gitxTools,
|
|
28
|
+
bashExec,
|
|
29
|
+
bashAnalyze,
|
|
30
|
+
bashScript,
|
|
31
|
+
bashEnv,
|
|
32
|
+
bashxTools,
|
|
33
|
+
systemTools,
|
|
34
|
+
} from '../src/tools/system.js'
|
|
35
|
+
|
|
36
|
+
import { registry, registerBuiltinTools, getBuiltinTools } from '../src/index.js'
|
|
37
|
+
|
|
38
|
+
// ============================================================================
|
|
39
|
+
// Filesystem Tools (fsx.do) Tests
|
|
40
|
+
// ============================================================================
|
|
41
|
+
|
|
42
|
+
describe('Filesystem Tools (fsx.do)', () => {
|
|
43
|
+
describe('fsRead', () => {
|
|
44
|
+
it('has correct metadata', () => {
|
|
45
|
+
expect(fsRead.id).toBe('system.fs.read')
|
|
46
|
+
expect(fsRead.name).toBe('Read File')
|
|
47
|
+
expect(fsRead.category).toBe('system')
|
|
48
|
+
expect(fsRead.subcategory).toBe('filesystem')
|
|
49
|
+
})
|
|
50
|
+
|
|
51
|
+
it('has required path parameter', () => {
|
|
52
|
+
const pathParam = fsRead.parameters.find((p) => p.name === 'path')
|
|
53
|
+
expect(pathParam).toBeDefined()
|
|
54
|
+
expect(pathParam?.required).toBe(true)
|
|
55
|
+
})
|
|
56
|
+
|
|
57
|
+
it('has optional encoding parameter', () => {
|
|
58
|
+
const encodingParam = fsRead.parameters.find((p) => p.name === 'encoding')
|
|
59
|
+
expect(encodingParam).toBeDefined()
|
|
60
|
+
expect(encodingParam?.required).toBe(false)
|
|
61
|
+
})
|
|
62
|
+
|
|
63
|
+
it('is idempotent', () => {
|
|
64
|
+
expect(fsRead.idempotent).toBe(true)
|
|
65
|
+
})
|
|
66
|
+
|
|
67
|
+
it('has fsx tag', () => {
|
|
68
|
+
expect(fsRead.tags).toContain('fsx')
|
|
69
|
+
})
|
|
70
|
+
|
|
71
|
+
it('returns file content structure', async () => {
|
|
72
|
+
const result = await fsRead.handler({ path: '/test/file.txt' })
|
|
73
|
+
expect(result).toHaveProperty('content')
|
|
74
|
+
expect(result).toHaveProperty('size')
|
|
75
|
+
expect(result).toHaveProperty('encoding')
|
|
76
|
+
})
|
|
77
|
+
})
|
|
78
|
+
|
|
79
|
+
describe('fsWrite', () => {
|
|
80
|
+
it('has correct metadata', () => {
|
|
81
|
+
expect(fsWrite.id).toBe('system.fs.write')
|
|
82
|
+
expect(fsWrite.category).toBe('system')
|
|
83
|
+
expect(fsWrite.subcategory).toBe('filesystem')
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
it('has required parameters', () => {
|
|
87
|
+
const pathParam = fsWrite.parameters.find((p) => p.name === 'path')
|
|
88
|
+
const contentParam = fsWrite.parameters.find((p) => p.name === 'content')
|
|
89
|
+
expect(pathParam?.required).toBe(true)
|
|
90
|
+
expect(contentParam?.required).toBe(true)
|
|
91
|
+
})
|
|
92
|
+
|
|
93
|
+
it('has write permission', () => {
|
|
94
|
+
expect(fsWrite.permissions).toBeDefined()
|
|
95
|
+
expect(fsWrite.permissions?.[0]?.type).toBe('write')
|
|
96
|
+
expect(fsWrite.permissions?.[0]?.resource).toBe('filesystem')
|
|
97
|
+
})
|
|
98
|
+
|
|
99
|
+
it('returns success structure', async () => {
|
|
100
|
+
const result = await fsWrite.handler({
|
|
101
|
+
path: '/test/file.txt',
|
|
102
|
+
content: 'Hello World',
|
|
103
|
+
})
|
|
104
|
+
expect(result.success).toBe(true)
|
|
105
|
+
expect(result.path).toBe('/test/file.txt')
|
|
106
|
+
expect(result.size).toBe(11)
|
|
107
|
+
})
|
|
108
|
+
})
|
|
109
|
+
|
|
110
|
+
describe('fsList', () => {
|
|
111
|
+
it('has correct metadata', () => {
|
|
112
|
+
expect(fsList.id).toBe('system.fs.list')
|
|
113
|
+
expect(fsList.category).toBe('system')
|
|
114
|
+
})
|
|
115
|
+
|
|
116
|
+
it('returns directory listing structure', async () => {
|
|
117
|
+
const result = await fsList.handler({ path: '/test' })
|
|
118
|
+
expect(result).toHaveProperty('entries')
|
|
119
|
+
expect(result).toHaveProperty('count')
|
|
120
|
+
expect(Array.isArray(result.entries)).toBe(true)
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
it('is idempotent', () => {
|
|
124
|
+
expect(fsList.idempotent).toBe(true)
|
|
125
|
+
})
|
|
126
|
+
})
|
|
127
|
+
|
|
128
|
+
describe('fsDelete', () => {
|
|
129
|
+
it('has correct metadata', () => {
|
|
130
|
+
expect(fsDelete.id).toBe('system.fs.delete')
|
|
131
|
+
expect(fsDelete.category).toBe('system')
|
|
132
|
+
})
|
|
133
|
+
|
|
134
|
+
it('requires confirmation', () => {
|
|
135
|
+
expect(fsDelete.requiresConfirmation).toBe(true)
|
|
136
|
+
})
|
|
137
|
+
|
|
138
|
+
it('has write permission', () => {
|
|
139
|
+
expect(fsDelete.permissions?.[0]?.type).toBe('write')
|
|
140
|
+
})
|
|
141
|
+
})
|
|
142
|
+
|
|
143
|
+
describe('fsGlob', () => {
|
|
144
|
+
it('has correct metadata', () => {
|
|
145
|
+
expect(fsGlob.id).toBe('system.fs.glob')
|
|
146
|
+
expect(fsGlob.category).toBe('system')
|
|
147
|
+
})
|
|
148
|
+
|
|
149
|
+
it('requires pattern parameter', () => {
|
|
150
|
+
const patternParam = fsGlob.parameters.find((p) => p.name === 'pattern')
|
|
151
|
+
expect(patternParam?.required).toBe(true)
|
|
152
|
+
})
|
|
153
|
+
|
|
154
|
+
it('returns matches structure', async () => {
|
|
155
|
+
const result = await fsGlob.handler({ pattern: '**/*.ts' })
|
|
156
|
+
expect(result).toHaveProperty('matches')
|
|
157
|
+
expect(result).toHaveProperty('count')
|
|
158
|
+
})
|
|
159
|
+
})
|
|
160
|
+
|
|
161
|
+
describe('fsGrep', () => {
|
|
162
|
+
it('has correct metadata', () => {
|
|
163
|
+
expect(fsGrep.id).toBe('system.fs.grep')
|
|
164
|
+
expect(fsGrep.category).toBe('system')
|
|
165
|
+
})
|
|
166
|
+
|
|
167
|
+
it('requires pattern parameter', () => {
|
|
168
|
+
const patternParam = fsGrep.parameters.find((p) => p.name === 'pattern')
|
|
169
|
+
expect(patternParam?.required).toBe(true)
|
|
170
|
+
})
|
|
171
|
+
|
|
172
|
+
it('returns matches with line info', async () => {
|
|
173
|
+
const result = await fsGrep.handler({ pattern: 'TODO' })
|
|
174
|
+
expect(result).toHaveProperty('matches')
|
|
175
|
+
expect(result).toHaveProperty('count')
|
|
176
|
+
})
|
|
177
|
+
})
|
|
178
|
+
|
|
179
|
+
describe('fsxTools array', () => {
|
|
180
|
+
it('contains all filesystem tools', () => {
|
|
181
|
+
expect(fsxTools).toHaveLength(6)
|
|
182
|
+
const ids = fsxTools.map((t) => t.id)
|
|
183
|
+
expect(ids).toContain('system.fs.read')
|
|
184
|
+
expect(ids).toContain('system.fs.write')
|
|
185
|
+
expect(ids).toContain('system.fs.list')
|
|
186
|
+
expect(ids).toContain('system.fs.delete')
|
|
187
|
+
expect(ids).toContain('system.fs.glob')
|
|
188
|
+
expect(ids).toContain('system.fs.grep')
|
|
189
|
+
})
|
|
190
|
+
|
|
191
|
+
it('all tools have fsx tag', () => {
|
|
192
|
+
for (const tool of fsxTools) {
|
|
193
|
+
expect(tool.tags).toContain('fsx')
|
|
194
|
+
}
|
|
195
|
+
})
|
|
196
|
+
})
|
|
197
|
+
})
|
|
198
|
+
|
|
199
|
+
// ============================================================================
|
|
200
|
+
// Git Tools (gitx.do) Tests
|
|
201
|
+
// ============================================================================
|
|
202
|
+
|
|
203
|
+
describe('Git Tools (gitx.do)', () => {
|
|
204
|
+
describe('gitInit', () => {
|
|
205
|
+
it('has correct metadata', () => {
|
|
206
|
+
expect(gitInit.id).toBe('system.git.init')
|
|
207
|
+
expect(gitInit.name).toBe('Git Init')
|
|
208
|
+
expect(gitInit.category).toBe('development')
|
|
209
|
+
expect(gitInit.subcategory).toBe('git')
|
|
210
|
+
})
|
|
211
|
+
|
|
212
|
+
it('has gitx tag', () => {
|
|
213
|
+
expect(gitInit.tags).toContain('gitx')
|
|
214
|
+
})
|
|
215
|
+
|
|
216
|
+
it('returns success structure', async () => {
|
|
217
|
+
const result = await gitInit.handler({})
|
|
218
|
+
expect(result.success).toBe(true)
|
|
219
|
+
expect(result.path).toBeDefined()
|
|
220
|
+
})
|
|
221
|
+
})
|
|
222
|
+
|
|
223
|
+
describe('gitClone', () => {
|
|
224
|
+
it('has correct metadata', () => {
|
|
225
|
+
expect(gitClone.id).toBe('system.git.clone')
|
|
226
|
+
expect(gitClone.category).toBe('development')
|
|
227
|
+
})
|
|
228
|
+
|
|
229
|
+
it('requires url parameter', () => {
|
|
230
|
+
const urlParam = gitClone.parameters.find((p) => p.name === 'url')
|
|
231
|
+
expect(urlParam?.required).toBe(true)
|
|
232
|
+
})
|
|
233
|
+
|
|
234
|
+
it('returns clone result', async () => {
|
|
235
|
+
const result = await gitClone.handler({ url: 'https://github.com/test/repo' })
|
|
236
|
+
expect(result.success).toBe(true)
|
|
237
|
+
expect(result.branch).toBeDefined()
|
|
238
|
+
})
|
|
239
|
+
})
|
|
240
|
+
|
|
241
|
+
describe('gitStatus', () => {
|
|
242
|
+
it('has correct metadata', () => {
|
|
243
|
+
expect(gitStatus.id).toBe('system.git.status')
|
|
244
|
+
expect(gitStatus.category).toBe('development')
|
|
245
|
+
})
|
|
246
|
+
|
|
247
|
+
it('is idempotent', () => {
|
|
248
|
+
expect(gitStatus.idempotent).toBe(true)
|
|
249
|
+
})
|
|
250
|
+
|
|
251
|
+
it('returns comprehensive status', async () => {
|
|
252
|
+
const result = await gitStatus.handler({})
|
|
253
|
+
expect(result).toHaveProperty('branch')
|
|
254
|
+
expect(result).toHaveProperty('clean')
|
|
255
|
+
expect(result).toHaveProperty('staged')
|
|
256
|
+
expect(result).toHaveProperty('modified')
|
|
257
|
+
expect(result).toHaveProperty('untracked')
|
|
258
|
+
expect(result).toHaveProperty('ahead')
|
|
259
|
+
expect(result).toHaveProperty('behind')
|
|
260
|
+
})
|
|
261
|
+
})
|
|
262
|
+
|
|
263
|
+
describe('gitAdd', () => {
|
|
264
|
+
it('has correct metadata', () => {
|
|
265
|
+
expect(gitAdd.id).toBe('system.git.add')
|
|
266
|
+
expect(gitAdd.category).toBe('development')
|
|
267
|
+
})
|
|
268
|
+
|
|
269
|
+
it('requires files parameter', () => {
|
|
270
|
+
const filesParam = gitAdd.parameters.find((p) => p.name === 'files')
|
|
271
|
+
expect(filesParam?.required).toBe(true)
|
|
272
|
+
})
|
|
273
|
+
|
|
274
|
+
it('has write permission', () => {
|
|
275
|
+
expect(gitAdd.permissions?.[0]?.resource).toBe('git')
|
|
276
|
+
})
|
|
277
|
+
})
|
|
278
|
+
|
|
279
|
+
describe('gitCommit', () => {
|
|
280
|
+
it('has correct metadata', () => {
|
|
281
|
+
expect(gitCommit.id).toBe('system.git.commit')
|
|
282
|
+
expect(gitCommit.category).toBe('development')
|
|
283
|
+
})
|
|
284
|
+
|
|
285
|
+
it('requires message parameter', () => {
|
|
286
|
+
const messageParam = gitCommit.parameters.find((p) => p.name === 'message')
|
|
287
|
+
expect(messageParam?.required).toBe(true)
|
|
288
|
+
})
|
|
289
|
+
|
|
290
|
+
it('returns commit result', async () => {
|
|
291
|
+
const result = await gitCommit.handler({ message: 'Test commit' })
|
|
292
|
+
expect(result.success).toBe(true)
|
|
293
|
+
expect(result.sha).toBeDefined()
|
|
294
|
+
expect(result.message).toBe('Test commit')
|
|
295
|
+
})
|
|
296
|
+
})
|
|
297
|
+
|
|
298
|
+
describe('gitLog', () => {
|
|
299
|
+
it('has correct metadata', () => {
|
|
300
|
+
expect(gitLog.id).toBe('system.git.log')
|
|
301
|
+
expect(gitLog.category).toBe('development')
|
|
302
|
+
})
|
|
303
|
+
|
|
304
|
+
it('is idempotent', () => {
|
|
305
|
+
expect(gitLog.idempotent).toBe(true)
|
|
306
|
+
})
|
|
307
|
+
|
|
308
|
+
it('returns commits array', async () => {
|
|
309
|
+
const result = await gitLog.handler({})
|
|
310
|
+
expect(result).toHaveProperty('commits')
|
|
311
|
+
expect(Array.isArray(result.commits)).toBe(true)
|
|
312
|
+
})
|
|
313
|
+
})
|
|
314
|
+
|
|
315
|
+
describe('gitDiff', () => {
|
|
316
|
+
it('has correct metadata', () => {
|
|
317
|
+
expect(gitDiff.id).toBe('system.git.diff')
|
|
318
|
+
expect(gitDiff.category).toBe('development')
|
|
319
|
+
})
|
|
320
|
+
|
|
321
|
+
it('returns diff statistics', async () => {
|
|
322
|
+
const result = await gitDiff.handler({})
|
|
323
|
+
expect(result).toHaveProperty('diff')
|
|
324
|
+
expect(result).toHaveProperty('additions')
|
|
325
|
+
expect(result).toHaveProperty('deletions')
|
|
326
|
+
expect(result).toHaveProperty('files')
|
|
327
|
+
})
|
|
328
|
+
})
|
|
329
|
+
|
|
330
|
+
describe('gitCheckout', () => {
|
|
331
|
+
it('has correct metadata', () => {
|
|
332
|
+
expect(gitCheckout.id).toBe('system.git.checkout')
|
|
333
|
+
expect(gitCheckout.category).toBe('development')
|
|
334
|
+
})
|
|
335
|
+
|
|
336
|
+
it('requires ref parameter', () => {
|
|
337
|
+
const refParam = gitCheckout.parameters.find((p) => p.name === 'ref')
|
|
338
|
+
expect(refParam?.required).toBe(true)
|
|
339
|
+
})
|
|
340
|
+
})
|
|
341
|
+
|
|
342
|
+
describe('gitPush', () => {
|
|
343
|
+
it('has correct metadata', () => {
|
|
344
|
+
expect(gitPush.id).toBe('system.git.push')
|
|
345
|
+
expect(gitPush.category).toBe('development')
|
|
346
|
+
})
|
|
347
|
+
|
|
348
|
+
it('requires confirmation', () => {
|
|
349
|
+
expect(gitPush.requiresConfirmation).toBe(true)
|
|
350
|
+
})
|
|
351
|
+
|
|
352
|
+
it('has write permission', () => {
|
|
353
|
+
expect(gitPush.permissions?.[0]?.type).toBe('write')
|
|
354
|
+
})
|
|
355
|
+
})
|
|
356
|
+
|
|
357
|
+
describe('gitPull', () => {
|
|
358
|
+
it('has correct metadata', () => {
|
|
359
|
+
expect(gitPull.id).toBe('system.git.pull')
|
|
360
|
+
expect(gitPull.category).toBe('development')
|
|
361
|
+
})
|
|
362
|
+
|
|
363
|
+
it('returns pull result with conflict info', async () => {
|
|
364
|
+
const result = await gitPull.handler({})
|
|
365
|
+
expect(result).toHaveProperty('success')
|
|
366
|
+
expect(result).toHaveProperty('commits')
|
|
367
|
+
expect(result).toHaveProperty('conflicts')
|
|
368
|
+
})
|
|
369
|
+
})
|
|
370
|
+
|
|
371
|
+
describe('gitxTools array', () => {
|
|
372
|
+
it('contains all git tools', () => {
|
|
373
|
+
expect(gitxTools).toHaveLength(10)
|
|
374
|
+
const ids = gitxTools.map((t) => t.id)
|
|
375
|
+
expect(ids).toContain('system.git.init')
|
|
376
|
+
expect(ids).toContain('system.git.clone')
|
|
377
|
+
expect(ids).toContain('system.git.status')
|
|
378
|
+
expect(ids).toContain('system.git.add')
|
|
379
|
+
expect(ids).toContain('system.git.commit')
|
|
380
|
+
expect(ids).toContain('system.git.log')
|
|
381
|
+
expect(ids).toContain('system.git.diff')
|
|
382
|
+
expect(ids).toContain('system.git.checkout')
|
|
383
|
+
expect(ids).toContain('system.git.push')
|
|
384
|
+
expect(ids).toContain('system.git.pull')
|
|
385
|
+
})
|
|
386
|
+
|
|
387
|
+
it('all tools have gitx tag', () => {
|
|
388
|
+
for (const tool of gitxTools) {
|
|
389
|
+
expect(tool.tags).toContain('gitx')
|
|
390
|
+
}
|
|
391
|
+
})
|
|
392
|
+
})
|
|
393
|
+
})
|
|
394
|
+
|
|
395
|
+
// ============================================================================
|
|
396
|
+
// Bash Tools (bashx.do) Tests
|
|
397
|
+
// ============================================================================
|
|
398
|
+
|
|
399
|
+
describe('Bash Tools (bashx.do)', () => {
|
|
400
|
+
describe('bashExec', () => {
|
|
401
|
+
it('has correct metadata', () => {
|
|
402
|
+
expect(bashExec.id).toBe('system.bash.exec')
|
|
403
|
+
expect(bashExec.name).toBe('Execute Bash Command')
|
|
404
|
+
expect(bashExec.category).toBe('system')
|
|
405
|
+
expect(bashExec.subcategory).toBe('shell')
|
|
406
|
+
})
|
|
407
|
+
|
|
408
|
+
it('requires command parameter', () => {
|
|
409
|
+
const cmdParam = bashExec.parameters.find((p) => p.name === 'command')
|
|
410
|
+
expect(cmdParam?.required).toBe(true)
|
|
411
|
+
})
|
|
412
|
+
|
|
413
|
+
it('has bashx tag', () => {
|
|
414
|
+
expect(bashExec.tags).toContain('bashx')
|
|
415
|
+
})
|
|
416
|
+
|
|
417
|
+
it('requires confirmation', () => {
|
|
418
|
+
expect(bashExec.requiresConfirmation).toBe(true)
|
|
419
|
+
})
|
|
420
|
+
|
|
421
|
+
it('has restricted security level', () => {
|
|
422
|
+
expect(bashExec.securityLevel).toBe('restricted')
|
|
423
|
+
})
|
|
424
|
+
|
|
425
|
+
it('has execute permission', () => {
|
|
426
|
+
expect(bashExec.permissions?.[0]?.type).toBe('execute')
|
|
427
|
+
expect(bashExec.permissions?.[0]?.resource).toBe('shell')
|
|
428
|
+
})
|
|
429
|
+
|
|
430
|
+
it('returns execution result', async () => {
|
|
431
|
+
const result = await bashExec.handler({ command: 'echo hello' })
|
|
432
|
+
expect(result).toHaveProperty('stdout')
|
|
433
|
+
expect(result).toHaveProperty('stderr')
|
|
434
|
+
expect(result).toHaveProperty('exitCode')
|
|
435
|
+
expect(result).toHaveProperty('duration')
|
|
436
|
+
})
|
|
437
|
+
})
|
|
438
|
+
|
|
439
|
+
describe('bashAnalyze', () => {
|
|
440
|
+
it('has correct metadata', () => {
|
|
441
|
+
expect(bashAnalyze.id).toBe('system.bash.analyze')
|
|
442
|
+
expect(bashAnalyze.category).toBe('system')
|
|
443
|
+
})
|
|
444
|
+
|
|
445
|
+
it('requires command parameter', () => {
|
|
446
|
+
const cmdParam = bashAnalyze.parameters.find((p) => p.name === 'command')
|
|
447
|
+
expect(cmdParam?.required).toBe(true)
|
|
448
|
+
})
|
|
449
|
+
|
|
450
|
+
it('is idempotent', () => {
|
|
451
|
+
expect(bashAnalyze.idempotent).toBe(true)
|
|
452
|
+
})
|
|
453
|
+
|
|
454
|
+
it('returns safety analysis', async () => {
|
|
455
|
+
const result = await bashAnalyze.handler({ command: 'ls -la' })
|
|
456
|
+
expect(result).toHaveProperty('safe')
|
|
457
|
+
expect(result).toHaveProperty('riskLevel')
|
|
458
|
+
expect(result).toHaveProperty('warnings')
|
|
459
|
+
expect(result).toHaveProperty('suggestions')
|
|
460
|
+
expect(result).toHaveProperty('intent')
|
|
461
|
+
})
|
|
462
|
+
|
|
463
|
+
it('detects dangerous rm -rf command', async () => {
|
|
464
|
+
const result = await bashAnalyze.handler({ command: 'rm -rf /' })
|
|
465
|
+
expect(result.safe).toBe(false)
|
|
466
|
+
expect(result.riskLevel).toBe('high')
|
|
467
|
+
expect(result.warnings.length).toBeGreaterThan(0)
|
|
468
|
+
})
|
|
469
|
+
|
|
470
|
+
it('detects overly permissive chmod', async () => {
|
|
471
|
+
const result = await bashAnalyze.handler({ command: 'chmod 777 file.txt' })
|
|
472
|
+
expect(result.safe).toBe(false)
|
|
473
|
+
expect(result.warnings.length).toBeGreaterThan(0)
|
|
474
|
+
})
|
|
475
|
+
|
|
476
|
+
it('detects pipe to bash execution', async () => {
|
|
477
|
+
const result = await bashAnalyze.handler({ command: 'curl http://example.com | bash' })
|
|
478
|
+
expect(result.safe).toBe(false)
|
|
479
|
+
expect(result.riskLevel).toBe('high')
|
|
480
|
+
})
|
|
481
|
+
|
|
482
|
+
it('marks safe commands as safe', async () => {
|
|
483
|
+
const result = await bashAnalyze.handler({ command: 'echo hello' })
|
|
484
|
+
expect(result.safe).toBe(true)
|
|
485
|
+
expect(result.riskLevel).toBe('low')
|
|
486
|
+
})
|
|
487
|
+
})
|
|
488
|
+
|
|
489
|
+
describe('bashScript', () => {
|
|
490
|
+
it('has correct metadata', () => {
|
|
491
|
+
expect(bashScript.id).toBe('system.bash.script')
|
|
492
|
+
expect(bashScript.category).toBe('system')
|
|
493
|
+
})
|
|
494
|
+
|
|
495
|
+
it('requires script parameter', () => {
|
|
496
|
+
const scriptParam = bashScript.parameters.find((p) => p.name === 'script')
|
|
497
|
+
expect(scriptParam?.required).toBe(true)
|
|
498
|
+
})
|
|
499
|
+
|
|
500
|
+
it('requires confirmation', () => {
|
|
501
|
+
expect(bashScript.requiresConfirmation).toBe(true)
|
|
502
|
+
})
|
|
503
|
+
|
|
504
|
+
it('has restricted security level', () => {
|
|
505
|
+
expect(bashScript.securityLevel).toBe('restricted')
|
|
506
|
+
})
|
|
507
|
+
})
|
|
508
|
+
|
|
509
|
+
describe('bashEnv', () => {
|
|
510
|
+
it('has correct metadata', () => {
|
|
511
|
+
expect(bashEnv.id).toBe('system.bash.env')
|
|
512
|
+
expect(bashEnv.category).toBe('system')
|
|
513
|
+
})
|
|
514
|
+
|
|
515
|
+
it('is idempotent', () => {
|
|
516
|
+
expect(bashEnv.idempotent).toBe(true)
|
|
517
|
+
})
|
|
518
|
+
|
|
519
|
+
it('returns environment info', async () => {
|
|
520
|
+
const result = await bashEnv.handler({})
|
|
521
|
+
expect(result).toHaveProperty('variables')
|
|
522
|
+
expect(result).toHaveProperty('shell')
|
|
523
|
+
expect(result).toHaveProperty('cwd')
|
|
524
|
+
expect(result).toHaveProperty('user')
|
|
525
|
+
})
|
|
526
|
+
})
|
|
527
|
+
|
|
528
|
+
describe('bashxTools array', () => {
|
|
529
|
+
it('contains all bash tools', () => {
|
|
530
|
+
expect(bashxTools).toHaveLength(4)
|
|
531
|
+
const ids = bashxTools.map((t) => t.id)
|
|
532
|
+
expect(ids).toContain('system.bash.exec')
|
|
533
|
+
expect(ids).toContain('system.bash.analyze')
|
|
534
|
+
expect(ids).toContain('system.bash.script')
|
|
535
|
+
expect(ids).toContain('system.bash.env')
|
|
536
|
+
})
|
|
537
|
+
|
|
538
|
+
it('all tools have bashx tag', () => {
|
|
539
|
+
for (const tool of bashxTools) {
|
|
540
|
+
expect(tool.tags).toContain('bashx')
|
|
541
|
+
}
|
|
542
|
+
})
|
|
543
|
+
})
|
|
544
|
+
})
|
|
545
|
+
|
|
546
|
+
// ============================================================================
|
|
547
|
+
// Combined System Tools Tests
|
|
548
|
+
// ============================================================================
|
|
549
|
+
|
|
550
|
+
describe('System Tools Collection', () => {
|
|
551
|
+
describe('systemTools array', () => {
|
|
552
|
+
it('contains all system tools', () => {
|
|
553
|
+
const expectedCount = fsxTools.length + gitxTools.length + bashxTools.length
|
|
554
|
+
expect(systemTools).toHaveLength(expectedCount)
|
|
555
|
+
})
|
|
556
|
+
|
|
557
|
+
it('includes fsx tools', () => {
|
|
558
|
+
const ids = systemTools.map((t) => t.id)
|
|
559
|
+
expect(ids).toContain('system.fs.read')
|
|
560
|
+
expect(ids).toContain('system.fs.write')
|
|
561
|
+
})
|
|
562
|
+
|
|
563
|
+
it('includes gitx tools', () => {
|
|
564
|
+
const ids = systemTools.map((t) => t.id)
|
|
565
|
+
expect(ids).toContain('system.git.init')
|
|
566
|
+
expect(ids).toContain('system.git.commit')
|
|
567
|
+
})
|
|
568
|
+
|
|
569
|
+
it('includes bashx tools', () => {
|
|
570
|
+
const ids = systemTools.map((t) => t.id)
|
|
571
|
+
expect(ids).toContain('system.bash.exec')
|
|
572
|
+
expect(ids).toContain('system.bash.analyze')
|
|
573
|
+
})
|
|
574
|
+
})
|
|
575
|
+
})
|
|
576
|
+
|
|
577
|
+
// ============================================================================
|
|
578
|
+
// Registry Integration Tests
|
|
579
|
+
// ============================================================================
|
|
580
|
+
|
|
581
|
+
describe('Registry Integration', () => {
|
|
582
|
+
beforeEach(() => {
|
|
583
|
+
registry.clear()
|
|
584
|
+
})
|
|
585
|
+
|
|
586
|
+
describe('direct registration', () => {
|
|
587
|
+
it('can register system tools directly', () => {
|
|
588
|
+
// Register system tools directly (bypassing main index)
|
|
589
|
+
for (const tool of systemTools) {
|
|
590
|
+
registry.register(tool)
|
|
591
|
+
}
|
|
592
|
+
|
|
593
|
+
// Check fsx tools
|
|
594
|
+
expect(registry.has('system.fs.read')).toBe(true)
|
|
595
|
+
expect(registry.has('system.fs.write')).toBe(true)
|
|
596
|
+
|
|
597
|
+
// Check gitx tools
|
|
598
|
+
expect(registry.has('system.git.status')).toBe(true)
|
|
599
|
+
expect(registry.has('system.git.commit')).toBe(true)
|
|
600
|
+
|
|
601
|
+
// Check bashx tools
|
|
602
|
+
expect(registry.has('system.bash.exec')).toBe(true)
|
|
603
|
+
expect(registry.has('system.bash.analyze')).toBe(true)
|
|
604
|
+
})
|
|
605
|
+
})
|
|
606
|
+
|
|
607
|
+
describe('query by category', () => {
|
|
608
|
+
it('can find system tools', () => {
|
|
609
|
+
for (const tool of systemTools) {
|
|
610
|
+
registry.register(tool)
|
|
611
|
+
}
|
|
612
|
+
|
|
613
|
+
const systemToolsFromRegistry = registry.byCategory('system')
|
|
614
|
+
expect(systemToolsFromRegistry.length).toBeGreaterThan(0)
|
|
615
|
+
|
|
616
|
+
const ids = systemToolsFromRegistry.map((t) => t.id)
|
|
617
|
+
expect(ids).toContain('system.fs.read')
|
|
618
|
+
expect(ids).toContain('system.bash.exec')
|
|
619
|
+
})
|
|
620
|
+
|
|
621
|
+
it('can find development tools (git)', () => {
|
|
622
|
+
for (const tool of systemTools) {
|
|
623
|
+
registry.register(tool)
|
|
624
|
+
}
|
|
625
|
+
|
|
626
|
+
const devTools = registry.byCategory('development')
|
|
627
|
+
expect(devTools.length).toBeGreaterThan(0)
|
|
628
|
+
|
|
629
|
+
const ids = devTools.map((t) => t.id)
|
|
630
|
+
expect(ids).toContain('system.git.init')
|
|
631
|
+
expect(ids).toContain('system.git.commit')
|
|
632
|
+
})
|
|
633
|
+
})
|
|
634
|
+
})
|
|
635
|
+
|
|
636
|
+
// ============================================================================
|
|
637
|
+
// Type Safety Tests
|
|
638
|
+
// ============================================================================
|
|
639
|
+
|
|
640
|
+
describe('Type Safety', () => {
|
|
641
|
+
it('fsRead handler has correct types', async () => {
|
|
642
|
+
const result = await fsRead.handler({ path: '/test', encoding: 'utf-8' })
|
|
643
|
+
// TypeScript should infer these types correctly
|
|
644
|
+
const content: string = result.content
|
|
645
|
+
const size: number = result.size
|
|
646
|
+
const encoding: string = result.encoding
|
|
647
|
+
expect(typeof content).toBe('string')
|
|
648
|
+
expect(typeof size).toBe('number')
|
|
649
|
+
expect(typeof encoding).toBe('string')
|
|
650
|
+
})
|
|
651
|
+
|
|
652
|
+
it('gitStatus handler has correct types', async () => {
|
|
653
|
+
const result = await gitStatus.handler({})
|
|
654
|
+
// TypeScript should infer these types correctly
|
|
655
|
+
const branch: string = result.branch
|
|
656
|
+
const clean: boolean = result.clean
|
|
657
|
+
const staged: string[] = result.staged
|
|
658
|
+
expect(typeof branch).toBe('string')
|
|
659
|
+
expect(typeof clean).toBe('boolean')
|
|
660
|
+
expect(Array.isArray(staged)).toBe(true)
|
|
661
|
+
})
|
|
662
|
+
|
|
663
|
+
it('bashAnalyze handler has correct types', async () => {
|
|
664
|
+
const result = await bashAnalyze.handler({ command: 'test' })
|
|
665
|
+
// TypeScript should infer these types correctly
|
|
666
|
+
const safe: boolean = result.safe
|
|
667
|
+
const riskLevel: 'low' | 'medium' | 'high' | 'critical' = result.riskLevel
|
|
668
|
+
const warnings: string[] = result.warnings
|
|
669
|
+
expect(typeof safe).toBe('boolean')
|
|
670
|
+
expect(['low', 'medium', 'high', 'critical']).toContain(riskLevel)
|
|
671
|
+
expect(Array.isArray(warnings)).toBe(true)
|
|
672
|
+
})
|
|
673
|
+
})
|