opencode-pilot 0.2.0 → 0.2.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/package.json +1 -1
- package/plugin/index.js +1 -1
- package/test/unit/paths.test.js +0 -15
- package/service/io.opencode.pilot.plist +0 -29
- package/test/run_tests.bash +0 -34
- package/test/test_actions.bash +0 -248
- package/test/test_cli.bash +0 -157
- package/test/test_helper.bash +0 -140
- package/test/test_plist.bash +0 -124
- package/test/test_poll_service.bash +0 -179
- package/test/test_poller.bash +0 -120
- package/test/test_readiness.bash +0 -313
- package/test/test_repo_config.bash +0 -192
- package/test/test_service.bash +0 -295
package/test/test_plist.bash
DELETED
|
@@ -1,124 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# Tests for service/io.opencode.pilot.plist - LaunchAgent plist for brew services
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
source "$SCRIPT_DIR/test_helper.bash"
|
|
10
|
-
|
|
11
|
-
SERVICE_DIR="$(dirname "$SCRIPT_DIR")/service"
|
|
12
|
-
|
|
13
|
-
echo "Testing LaunchAgent plist..."
|
|
14
|
-
echo ""
|
|
15
|
-
|
|
16
|
-
# =============================================================================
|
|
17
|
-
# File Structure Tests
|
|
18
|
-
# =============================================================================
|
|
19
|
-
|
|
20
|
-
test_plist_file_exists() {
|
|
21
|
-
assert_file_exists "$SERVICE_DIR/io.opencode.pilot.plist"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
test_plist_is_valid_xml() {
|
|
25
|
-
if ! command -v plutil &>/dev/null; then
|
|
26
|
-
echo "SKIP: plutil not available (macOS only)"
|
|
27
|
-
return 0
|
|
28
|
-
fi
|
|
29
|
-
plutil -lint "$SERVICE_DIR/io.opencode.pilot.plist" 2>&1 || {
|
|
30
|
-
echo "plist is not valid XML"
|
|
31
|
-
return 1
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
# =============================================================================
|
|
36
|
-
# Content Tests
|
|
37
|
-
# =============================================================================
|
|
38
|
-
|
|
39
|
-
test_plist_has_label() {
|
|
40
|
-
grep -q "<string>io.opencode.pilot</string>" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
41
|
-
echo "Label not found in plist"
|
|
42
|
-
return 1
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
test_plist_has_program_arguments() {
|
|
47
|
-
grep -q "<key>ProgramArguments</key>" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
48
|
-
echo "ProgramArguments not found in plist"
|
|
49
|
-
return 1
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
test_plist_runs_node() {
|
|
54
|
-
grep -q "node" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
55
|
-
echo "node command not found in plist"
|
|
56
|
-
return 1
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
test_plist_runs_server_js() {
|
|
61
|
-
grep -q "server.js" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
62
|
-
echo "server.js not found in plist"
|
|
63
|
-
return 1
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
test_plist_has_keep_alive() {
|
|
68
|
-
grep -q "<key>KeepAlive</key>" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
69
|
-
echo "KeepAlive not found in plist"
|
|
70
|
-
return 1
|
|
71
|
-
}
|
|
72
|
-
}
|
|
73
|
-
|
|
74
|
-
test_plist_has_run_at_load() {
|
|
75
|
-
grep -q "<key>RunAtLoad</key>" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
76
|
-
echo "RunAtLoad not found in plist"
|
|
77
|
-
return 1
|
|
78
|
-
}
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
test_plist_has_stdout_log() {
|
|
82
|
-
grep -q "stdout\|StandardOutPath" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
83
|
-
echo "Stdout logging not found in plist"
|
|
84
|
-
return 1
|
|
85
|
-
}
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
test_plist_has_stderr_log() {
|
|
89
|
-
grep -q "stderr\|StandardErrorPath" "$SERVICE_DIR/io.opencode.pilot.plist" || {
|
|
90
|
-
echo "Stderr logging not found in plist"
|
|
91
|
-
return 1
|
|
92
|
-
}
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
# =============================================================================
|
|
96
|
-
# Run Tests
|
|
97
|
-
# =============================================================================
|
|
98
|
-
|
|
99
|
-
echo "File Structure Tests:"
|
|
100
|
-
|
|
101
|
-
for test_func in \
|
|
102
|
-
test_plist_file_exists \
|
|
103
|
-
test_plist_is_valid_xml
|
|
104
|
-
do
|
|
105
|
-
run_test "${test_func#test_}" "$test_func"
|
|
106
|
-
done
|
|
107
|
-
|
|
108
|
-
echo ""
|
|
109
|
-
echo "Content Tests:"
|
|
110
|
-
|
|
111
|
-
for test_func in \
|
|
112
|
-
test_plist_has_label \
|
|
113
|
-
test_plist_has_program_arguments \
|
|
114
|
-
test_plist_runs_node \
|
|
115
|
-
test_plist_runs_server_js \
|
|
116
|
-
test_plist_has_keep_alive \
|
|
117
|
-
test_plist_has_run_at_load \
|
|
118
|
-
test_plist_has_stdout_log \
|
|
119
|
-
test_plist_has_stderr_log
|
|
120
|
-
do
|
|
121
|
-
run_test "${test_func#test_}" "$test_func"
|
|
122
|
-
done
|
|
123
|
-
|
|
124
|
-
print_summary
|
|
@@ -1,179 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# Tests for poll-service.js - Polling orchestration service
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
source "$SCRIPT_DIR/test_helper.bash"
|
|
10
|
-
|
|
11
|
-
SERVICE_DIR="$(dirname "$SCRIPT_DIR")/service"
|
|
12
|
-
|
|
13
|
-
echo "Testing poll-service.js module..."
|
|
14
|
-
echo ""
|
|
15
|
-
|
|
16
|
-
# =============================================================================
|
|
17
|
-
# File Structure Tests
|
|
18
|
-
# =============================================================================
|
|
19
|
-
|
|
20
|
-
test_poll_service_file_exists() {
|
|
21
|
-
assert_file_exists "$SERVICE_DIR/poll-service.js"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
test_poll_service_js_syntax() {
|
|
25
|
-
if ! command -v node &>/dev/null; then
|
|
26
|
-
echo "SKIP: node not available"
|
|
27
|
-
return 0
|
|
28
|
-
fi
|
|
29
|
-
node --check "$SERVICE_DIR/poll-service.js" 2>&1 || {
|
|
30
|
-
echo "poll-service.js has syntax errors"
|
|
31
|
-
return 1
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
# =============================================================================
|
|
36
|
-
# Export Tests
|
|
37
|
-
# =============================================================================
|
|
38
|
-
|
|
39
|
-
test_poll_service_exports_start() {
|
|
40
|
-
grep -q "export.*function startPolling\|export.*startPolling" "$SERVICE_DIR/poll-service.js" || {
|
|
41
|
-
echo "startPolling export not found"
|
|
42
|
-
return 1
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
test_poll_service_exports_stop() {
|
|
47
|
-
grep -q "export.*function stopPolling\|export.*stopPolling" "$SERVICE_DIR/poll-service.js" || {
|
|
48
|
-
echo "stopPolling export not found"
|
|
49
|
-
return 1
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
test_poll_service_exports_poll_once() {
|
|
54
|
-
grep -q "export.*function pollOnce\|export.*pollOnce" "$SERVICE_DIR/poll-service.js" || {
|
|
55
|
-
echo "pollOnce export not found"
|
|
56
|
-
return 1
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# =============================================================================
|
|
61
|
-
# Implementation Tests
|
|
62
|
-
# =============================================================================
|
|
63
|
-
|
|
64
|
-
test_poll_service_uses_repo_config() {
|
|
65
|
-
grep -q "repo-config\|getRepoConfig\|getAllSources" "$SERVICE_DIR/poll-service.js" || {
|
|
66
|
-
echo "repo-config usage not found"
|
|
67
|
-
return 1
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
test_poll_service_uses_poller() {
|
|
72
|
-
grep -q "poller\|pollSource" "$SERVICE_DIR/poll-service.js" || {
|
|
73
|
-
echo "poller usage not found"
|
|
74
|
-
return 1
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
test_poll_service_uses_readiness() {
|
|
79
|
-
grep -q "readiness\|evaluateReadiness" "$SERVICE_DIR/poll-service.js" || {
|
|
80
|
-
echo "readiness usage not found"
|
|
81
|
-
return 1
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
test_poll_service_uses_actions() {
|
|
86
|
-
grep -q "actions\|executeAction" "$SERVICE_DIR/poll-service.js" || {
|
|
87
|
-
echo "actions usage not found"
|
|
88
|
-
return 1
|
|
89
|
-
}
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
test_poll_service_tracks_processed() {
|
|
93
|
-
grep -q "isProcessed\|markProcessed" "$SERVICE_DIR/poll-service.js" || {
|
|
94
|
-
echo "Processed tracking not found"
|
|
95
|
-
return 1
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
# =============================================================================
|
|
100
|
-
# Functional Tests
|
|
101
|
-
# =============================================================================
|
|
102
|
-
|
|
103
|
-
test_poll_service_dry_run() {
|
|
104
|
-
if ! command -v node &>/dev/null; then
|
|
105
|
-
echo "SKIP: node not available"
|
|
106
|
-
return 0
|
|
107
|
-
fi
|
|
108
|
-
|
|
109
|
-
local result
|
|
110
|
-
result=$(node --experimental-vm-modules -e "
|
|
111
|
-
import { pollOnce } from './service/poll-service.js';
|
|
112
|
-
|
|
113
|
-
// Run with dry-run flag (no actual polling)
|
|
114
|
-
const results = await pollOnce({ dryRun: true, skipMcp: true });
|
|
115
|
-
|
|
116
|
-
// Should return results array (even if empty)
|
|
117
|
-
if (!Array.isArray(results)) {
|
|
118
|
-
console.log('FAIL: pollOnce should return an array');
|
|
119
|
-
process.exit(1);
|
|
120
|
-
}
|
|
121
|
-
console.log('PASS');
|
|
122
|
-
" 2>&1) || {
|
|
123
|
-
echo "Functional test failed: $result"
|
|
124
|
-
return 1
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
if ! echo "$result" | grep -q "PASS"; then
|
|
128
|
-
echo "$result"
|
|
129
|
-
return 1
|
|
130
|
-
fi
|
|
131
|
-
}
|
|
132
|
-
|
|
133
|
-
# =============================================================================
|
|
134
|
-
# Run Tests
|
|
135
|
-
# =============================================================================
|
|
136
|
-
|
|
137
|
-
echo "File Structure Tests:"
|
|
138
|
-
|
|
139
|
-
for test_func in \
|
|
140
|
-
test_poll_service_file_exists \
|
|
141
|
-
test_poll_service_js_syntax
|
|
142
|
-
do
|
|
143
|
-
run_test "${test_func#test_}" "$test_func"
|
|
144
|
-
done
|
|
145
|
-
|
|
146
|
-
echo ""
|
|
147
|
-
echo "Export Tests:"
|
|
148
|
-
|
|
149
|
-
for test_func in \
|
|
150
|
-
test_poll_service_exports_start \
|
|
151
|
-
test_poll_service_exports_stop \
|
|
152
|
-
test_poll_service_exports_poll_once
|
|
153
|
-
do
|
|
154
|
-
run_test "${test_func#test_}" "$test_func"
|
|
155
|
-
done
|
|
156
|
-
|
|
157
|
-
echo ""
|
|
158
|
-
echo "Implementation Tests:"
|
|
159
|
-
|
|
160
|
-
for test_func in \
|
|
161
|
-
test_poll_service_uses_repo_config \
|
|
162
|
-
test_poll_service_uses_poller \
|
|
163
|
-
test_poll_service_uses_readiness \
|
|
164
|
-
test_poll_service_uses_actions \
|
|
165
|
-
test_poll_service_tracks_processed
|
|
166
|
-
do
|
|
167
|
-
run_test "${test_func#test_}" "$test_func"
|
|
168
|
-
done
|
|
169
|
-
|
|
170
|
-
echo ""
|
|
171
|
-
echo "Functional Tests:"
|
|
172
|
-
|
|
173
|
-
for test_func in \
|
|
174
|
-
test_poll_service_dry_run
|
|
175
|
-
do
|
|
176
|
-
run_test "${test_func#test_}" "$test_func"
|
|
177
|
-
done
|
|
178
|
-
|
|
179
|
-
print_summary
|
package/test/test_poller.bash
DELETED
|
@@ -1,120 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env bash
|
|
2
|
-
#
|
|
3
|
-
# Tests for poller.js - MCP-based polling for automation sources
|
|
4
|
-
#
|
|
5
|
-
|
|
6
|
-
set -euo pipefail
|
|
7
|
-
|
|
8
|
-
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
9
|
-
source "$SCRIPT_DIR/test_helper.bash"
|
|
10
|
-
|
|
11
|
-
SERVICE_DIR="$(dirname "$SCRIPT_DIR")/service"
|
|
12
|
-
|
|
13
|
-
echo "Testing poller.js module..."
|
|
14
|
-
echo ""
|
|
15
|
-
|
|
16
|
-
# =============================================================================
|
|
17
|
-
# File Structure Tests
|
|
18
|
-
# =============================================================================
|
|
19
|
-
|
|
20
|
-
test_poller_file_exists() {
|
|
21
|
-
assert_file_exists "$SERVICE_DIR/poller.js"
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
test_poller_js_syntax() {
|
|
25
|
-
if ! command -v node &>/dev/null; then
|
|
26
|
-
echo "SKIP: node not available"
|
|
27
|
-
return 0
|
|
28
|
-
fi
|
|
29
|
-
node --check "$SERVICE_DIR/poller.js" 2>&1 || {
|
|
30
|
-
echo "poller.js has syntax errors"
|
|
31
|
-
return 1
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
# =============================================================================
|
|
36
|
-
# Export Tests
|
|
37
|
-
# =============================================================================
|
|
38
|
-
|
|
39
|
-
test_poller_exports_create_poller() {
|
|
40
|
-
grep -q "export.*function createPoller\|export.*createPoller" "$SERVICE_DIR/poller.js" || {
|
|
41
|
-
echo "createPoller export not found in poller.js"
|
|
42
|
-
return 1
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
test_poller_exports_poll_generic_source() {
|
|
47
|
-
grep -q "export.*function pollGenericSource\|export.*pollGenericSource" "$SERVICE_DIR/poller.js" || {
|
|
48
|
-
echo "pollGenericSource export not found in poller.js"
|
|
49
|
-
return 1
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
test_poller_exports_apply_mappings() {
|
|
54
|
-
grep -q "export.*function applyMappings\|export.*applyMappings" "$SERVICE_DIR/poller.js" || {
|
|
55
|
-
echo "applyMappings export not found in poller.js"
|
|
56
|
-
return 1
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
# =============================================================================
|
|
61
|
-
# Implementation Tests
|
|
62
|
-
# =============================================================================
|
|
63
|
-
|
|
64
|
-
test_poller_uses_mcp_client() {
|
|
65
|
-
grep -q "@modelcontextprotocol/sdk" "$SERVICE_DIR/poller.js" || {
|
|
66
|
-
echo "MCP SDK import not found in poller.js"
|
|
67
|
-
return 1
|
|
68
|
-
}
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
test_poller_tracks_processed_items() {
|
|
72
|
-
grep -q "processed\|state\|seen" "$SERVICE_DIR/poller.js" || {
|
|
73
|
-
echo "Processed items tracking not found in poller.js"
|
|
74
|
-
return 1
|
|
75
|
-
}
|
|
76
|
-
}
|
|
77
|
-
|
|
78
|
-
test_poller_supports_generic_tools() {
|
|
79
|
-
grep -q "tool" "$SERVICE_DIR/poller.js" || {
|
|
80
|
-
echo "Tool-based polling not found in poller.js"
|
|
81
|
-
return 1
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
# =============================================================================
|
|
86
|
-
# Run Tests
|
|
87
|
-
# =============================================================================
|
|
88
|
-
|
|
89
|
-
echo "File Structure Tests:"
|
|
90
|
-
|
|
91
|
-
for test_func in \
|
|
92
|
-
test_poller_file_exists \
|
|
93
|
-
test_poller_js_syntax
|
|
94
|
-
do
|
|
95
|
-
run_test "${test_func#test_}" "$test_func"
|
|
96
|
-
done
|
|
97
|
-
|
|
98
|
-
echo ""
|
|
99
|
-
echo "Export Tests:"
|
|
100
|
-
|
|
101
|
-
for test_func in \
|
|
102
|
-
test_poller_exports_create_poller \
|
|
103
|
-
test_poller_exports_poll_generic_source \
|
|
104
|
-
test_poller_exports_apply_mappings
|
|
105
|
-
do
|
|
106
|
-
run_test "${test_func#test_}" "$test_func"
|
|
107
|
-
done
|
|
108
|
-
|
|
109
|
-
echo ""
|
|
110
|
-
echo "Implementation Tests:"
|
|
111
|
-
|
|
112
|
-
for test_func in \
|
|
113
|
-
test_poller_uses_mcp_client \
|
|
114
|
-
test_poller_tracks_processed_items \
|
|
115
|
-
test_poller_supports_generic_tools
|
|
116
|
-
do
|
|
117
|
-
run_test "${test_func#test_}" "$test_func"
|
|
118
|
-
done
|
|
119
|
-
|
|
120
|
-
print_summary
|