@switchbot/openapi-cli 3.2.1 → 3.2.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/README.md +3 -1
- package/dist/index.js +57349 -170
- package/package.json +9 -5
- package/dist/api/client.d.ts +0 -31
- package/dist/api/client.js +0 -236
- package/dist/api/client.js.map +0 -1
- package/dist/auth.d.ts +0 -1
- package/dist/auth.js +0 -21
- package/dist/auth.js.map +0 -1
- package/dist/commands/agent-bootstrap.d.ts +0 -10
- package/dist/commands/agent-bootstrap.js +0 -200
- package/dist/commands/agent-bootstrap.js.map +0 -1
- package/dist/commands/auth.d.ts +0 -18
- package/dist/commands/auth.js +0 -355
- package/dist/commands/auth.js.map +0 -1
- package/dist/commands/batch.d.ts +0 -2
- package/dist/commands/batch.js +0 -414
- package/dist/commands/batch.js.map +0 -1
- package/dist/commands/cache.d.ts +0 -2
- package/dist/commands/cache.js +0 -127
- package/dist/commands/cache.js.map +0 -1
- package/dist/commands/capabilities.d.ts +0 -31
- package/dist/commands/capabilities.js +0 -383
- package/dist/commands/capabilities.js.map +0 -1
- package/dist/commands/catalog.d.ts +0 -2
- package/dist/commands/catalog.js +0 -360
- package/dist/commands/catalog.js.map +0 -1
- package/dist/commands/completion.d.ts +0 -2
- package/dist/commands/completion.js +0 -386
- package/dist/commands/completion.js.map +0 -1
- package/dist/commands/config.d.ts +0 -21
- package/dist/commands/config.js +0 -377
- package/dist/commands/config.js.map +0 -1
- package/dist/commands/daemon.d.ts +0 -2
- package/dist/commands/daemon.js +0 -411
- package/dist/commands/daemon.js.map +0 -1
- package/dist/commands/device-meta.d.ts +0 -2
- package/dist/commands/device-meta.js +0 -160
- package/dist/commands/device-meta.js.map +0 -1
- package/dist/commands/devices.d.ts +0 -2
- package/dist/commands/devices.js +0 -949
- package/dist/commands/devices.js.map +0 -1
- package/dist/commands/doctor.d.ts +0 -3
- package/dist/commands/doctor.js +0 -1016
- package/dist/commands/doctor.js.map +0 -1
- package/dist/commands/events.d.ts +0 -31
- package/dist/commands/events.js +0 -564
- package/dist/commands/events.js.map +0 -1
- package/dist/commands/expand.d.ts +0 -2
- package/dist/commands/expand.js +0 -131
- package/dist/commands/expand.js.map +0 -1
- package/dist/commands/explain.d.ts +0 -2
- package/dist/commands/explain.js +0 -140
- package/dist/commands/explain.js.map +0 -1
- package/dist/commands/health.d.ts +0 -8
- package/dist/commands/health.js +0 -114
- package/dist/commands/health.js.map +0 -1
- package/dist/commands/history.d.ts +0 -2
- package/dist/commands/history.js +0 -321
- package/dist/commands/history.js.map +0 -1
- package/dist/commands/identity.d.ts +0 -45
- package/dist/commands/identity.js +0 -60
- package/dist/commands/identity.js.map +0 -1
- package/dist/commands/install.d.ts +0 -20
- package/dist/commands/install.js +0 -247
- package/dist/commands/install.js.map +0 -1
- package/dist/commands/mcp.d.ts +0 -14
- package/dist/commands/mcp.js +0 -2018
- package/dist/commands/mcp.js.map +0 -1
- package/dist/commands/plan.d.ts +0 -51
- package/dist/commands/plan.js +0 -654
- package/dist/commands/plan.js.map +0 -1
- package/dist/commands/policy.d.ts +0 -24
- package/dist/commands/policy.js +0 -587
- package/dist/commands/policy.js.map +0 -1
- package/dist/commands/quota.d.ts +0 -2
- package/dist/commands/quota.js +0 -79
- package/dist/commands/quota.js.map +0 -1
- package/dist/commands/rules.d.ts +0 -2
- package/dist/commands/rules.js +0 -876
- package/dist/commands/rules.js.map +0 -1
- package/dist/commands/scenes.d.ts +0 -2
- package/dist/commands/scenes.js +0 -265
- package/dist/commands/scenes.js.map +0 -1
- package/dist/commands/schema.d.ts +0 -2
- package/dist/commands/schema.js +0 -185
- package/dist/commands/schema.js.map +0 -1
- package/dist/commands/status-sync.d.ts +0 -2
- package/dist/commands/status-sync.js +0 -132
- package/dist/commands/status-sync.js.map +0 -1
- package/dist/commands/uninstall.d.ts +0 -20
- package/dist/commands/uninstall.js +0 -238
- package/dist/commands/uninstall.js.map +0 -1
- package/dist/commands/upgrade-check.d.ts +0 -2
- package/dist/commands/upgrade-check.js +0 -107
- package/dist/commands/upgrade-check.js.map +0 -1
- package/dist/commands/watch.d.ts +0 -2
- package/dist/commands/watch.js +0 -195
- package/dist/commands/watch.js.map +0 -1
- package/dist/commands/webhook.d.ts +0 -2
- package/dist/commands/webhook.js +0 -183
- package/dist/commands/webhook.js.map +0 -1
- package/dist/config.d.ts +0 -57
- package/dist/config.js +0 -259
- package/dist/config.js.map +0 -1
- package/dist/credentials/backends/file.d.ts +0 -18
- package/dist/credentials/backends/file.js +0 -102
- package/dist/credentials/backends/file.js.map +0 -1
- package/dist/credentials/backends/linux.d.ts +0 -16
- package/dist/credentials/backends/linux.js +0 -130
- package/dist/credentials/backends/linux.js.map +0 -1
- package/dist/credentials/backends/macos.d.ts +0 -18
- package/dist/credentials/backends/macos.js +0 -130
- package/dist/credentials/backends/macos.js.map +0 -1
- package/dist/credentials/backends/windows.d.ts +0 -23
- package/dist/credentials/backends/windows.js +0 -216
- package/dist/credentials/backends/windows.js.map +0 -1
- package/dist/credentials/keychain.d.ts +0 -83
- package/dist/credentials/keychain.js +0 -89
- package/dist/credentials/keychain.js.map +0 -1
- package/dist/credentials/prime.d.ts +0 -32
- package/dist/credentials/prime.js +0 -53
- package/dist/credentials/prime.js.map +0 -1
- package/dist/devices/cache.d.ts +0 -79
- package/dist/devices/cache.js +0 -294
- package/dist/devices/cache.js.map +0 -1
- package/dist/devices/catalog.d.ts +0 -138
- package/dist/devices/catalog.js +0 -768
- package/dist/devices/catalog.js.map +0 -1
- package/dist/devices/device-meta.d.ts +0 -15
- package/dist/devices/device-meta.js +0 -57
- package/dist/devices/device-meta.js.map +0 -1
- package/dist/devices/history-agg.d.ts +0 -37
- package/dist/devices/history-agg.js +0 -139
- package/dist/devices/history-agg.js.map +0 -1
- package/dist/devices/history-query.d.ts +0 -45
- package/dist/devices/history-query.js +0 -182
- package/dist/devices/history-query.js.map +0 -1
- package/dist/devices/param-validator.d.ts +0 -40
- package/dist/devices/param-validator.js +0 -434
- package/dist/devices/param-validator.js.map +0 -1
- package/dist/devices/resources.d.ts +0 -74
- package/dist/devices/resources.js +0 -271
- package/dist/devices/resources.js.map +0 -1
- package/dist/index.d.ts +0 -1
- package/dist/index.js.map +0 -1
- package/dist/install/default-steps.d.ts +0 -66
- package/dist/install/default-steps.js +0 -258
- package/dist/install/default-steps.js.map +0 -1
- package/dist/install/preflight.d.ts +0 -60
- package/dist/install/preflight.js +0 -213
- package/dist/install/preflight.js.map +0 -1
- package/dist/install/steps.d.ts +0 -61
- package/dist/install/steps.js +0 -68
- package/dist/install/steps.js.map +0 -1
- package/dist/lib/command-keywords.d.ts +0 -5
- package/dist/lib/command-keywords.js +0 -18
- package/dist/lib/command-keywords.js.map +0 -1
- package/dist/lib/daemon-state.d.ts +0 -24
- package/dist/lib/daemon-state.js +0 -47
- package/dist/lib/daemon-state.js.map +0 -1
- package/dist/lib/destructive-mode.d.ts +0 -2
- package/dist/lib/destructive-mode.js +0 -13
- package/dist/lib/destructive-mode.js.map +0 -1
- package/dist/lib/devices.d.ts +0 -151
- package/dist/lib/devices.js +0 -383
- package/dist/lib/devices.js.map +0 -1
- package/dist/lib/idempotency.d.ts +0 -46
- package/dist/lib/idempotency.js +0 -107
- package/dist/lib/idempotency.js.map +0 -1
- package/dist/lib/plan-store.d.ts +0 -19
- package/dist/lib/plan-store.js +0 -69
- package/dist/lib/plan-store.js.map +0 -1
- package/dist/lib/request-context.d.ts +0 -7
- package/dist/lib/request-context.js +0 -13
- package/dist/lib/request-context.js.map +0 -1
- package/dist/lib/scenes.d.ts +0 -7
- package/dist/lib/scenes.js +0 -11
- package/dist/lib/scenes.js.map +0 -1
- package/dist/logger.d.ts +0 -4
- package/dist/logger.js +0 -17
- package/dist/logger.js.map +0 -1
- package/dist/mcp/device-history.d.ts +0 -36
- package/dist/mcp/device-history.js +0 -146
- package/dist/mcp/device-history.js.map +0 -1
- package/dist/mcp/events-subscription.d.ts +0 -45
- package/dist/mcp/events-subscription.js +0 -214
- package/dist/mcp/events-subscription.js.map +0 -1
- package/dist/mqtt/client.d.ts +0 -25
- package/dist/mqtt/client.js +0 -181
- package/dist/mqtt/client.js.map +0 -1
- package/dist/mqtt/credential.d.ts +0 -16
- package/dist/mqtt/credential.js +0 -31
- package/dist/mqtt/credential.js.map +0 -1
- package/dist/policy/add-rule.d.ts +0 -21
- package/dist/policy/add-rule.js +0 -125
- package/dist/policy/add-rule.js.map +0 -1
- package/dist/policy/diff.d.ts +0 -21
- package/dist/policy/diff.js +0 -92
- package/dist/policy/diff.js.map +0 -1
- package/dist/policy/format.d.ts +0 -6
- package/dist/policy/format.js +0 -58
- package/dist/policy/format.js.map +0 -1
- package/dist/policy/load.d.ts +0 -32
- package/dist/policy/load.js +0 -62
- package/dist/policy/load.js.map +0 -1
- package/dist/policy/migrate.d.ts +0 -21
- package/dist/policy/migrate.js +0 -68
- package/dist/policy/migrate.js.map +0 -1
- package/dist/policy/schema.d.ts +0 -5
- package/dist/policy/schema.js +0 -19
- package/dist/policy/schema.js.map +0 -1
- package/dist/policy/validate.d.ts +0 -19
- package/dist/policy/validate.js +0 -263
- package/dist/policy/validate.js.map +0 -1
- package/dist/rules/action.d.ts +0 -65
- package/dist/rules/action.js +0 -217
- package/dist/rules/action.js.map +0 -1
- package/dist/rules/audit-query.d.ts +0 -51
- package/dist/rules/audit-query.js +0 -90
- package/dist/rules/audit-query.js.map +0 -1
- package/dist/rules/conflict-analyzer.d.ts +0 -57
- package/dist/rules/conflict-analyzer.js +0 -215
- package/dist/rules/conflict-analyzer.js.map +0 -1
- package/dist/rules/cron-scheduler.d.ts +0 -62
- package/dist/rules/cron-scheduler.js +0 -187
- package/dist/rules/cron-scheduler.js.map +0 -1
- package/dist/rules/destructive.d.ts +0 -20
- package/dist/rules/destructive.js +0 -53
- package/dist/rules/destructive.js.map +0 -1
- package/dist/rules/engine.d.ts +0 -193
- package/dist/rules/engine.js +0 -758
- package/dist/rules/engine.js.map +0 -1
- package/dist/rules/matcher.d.ts +0 -56
- package/dist/rules/matcher.js +0 -231
- package/dist/rules/matcher.js.map +0 -1
- package/dist/rules/pid-file.d.ts +0 -43
- package/dist/rules/pid-file.js +0 -96
- package/dist/rules/pid-file.js.map +0 -1
- package/dist/rules/quiet-hours.d.ts +0 -26
- package/dist/rules/quiet-hours.js +0 -46
- package/dist/rules/quiet-hours.js.map +0 -1
- package/dist/rules/suggest.d.ts +0 -20
- package/dist/rules/suggest.js +0 -96
- package/dist/rules/suggest.js.map +0 -1
- package/dist/rules/throttle.d.ts +0 -61
- package/dist/rules/throttle.js +0 -117
- package/dist/rules/throttle.js.map +0 -1
- package/dist/rules/types.d.ts +0 -117
- package/dist/rules/types.js +0 -35
- package/dist/rules/types.js.map +0 -1
- package/dist/rules/webhook-listener.d.ts +0 -63
- package/dist/rules/webhook-listener.js +0 -224
- package/dist/rules/webhook-listener.js.map +0 -1
- package/dist/rules/webhook-token.d.ts +0 -50
- package/dist/rules/webhook-token.js +0 -91
- package/dist/rules/webhook-token.js.map +0 -1
- package/dist/schema/field-aliases.d.ts +0 -34
- package/dist/schema/field-aliases.js +0 -132
- package/dist/schema/field-aliases.js.map +0 -1
- package/dist/sinks/dispatcher.d.ts +0 -7
- package/dist/sinks/dispatcher.js +0 -13
- package/dist/sinks/dispatcher.js.map +0 -1
- package/dist/sinks/file.d.ts +0 -6
- package/dist/sinks/file.js +0 -20
- package/dist/sinks/file.js.map +0 -1
- package/dist/sinks/format.d.ts +0 -20
- package/dist/sinks/format.js +0 -57
- package/dist/sinks/format.js.map +0 -1
- package/dist/sinks/homeassistant.d.ts +0 -18
- package/dist/sinks/homeassistant.js +0 -45
- package/dist/sinks/homeassistant.js.map +0 -1
- package/dist/sinks/openclaw.d.ts +0 -13
- package/dist/sinks/openclaw.js +0 -34
- package/dist/sinks/openclaw.js.map +0 -1
- package/dist/sinks/stdout.d.ts +0 -4
- package/dist/sinks/stdout.js +0 -6
- package/dist/sinks/stdout.js.map +0 -1
- package/dist/sinks/telegram.d.ts +0 -11
- package/dist/sinks/telegram.js +0 -29
- package/dist/sinks/telegram.js.map +0 -1
- package/dist/sinks/types.d.ts +0 -13
- package/dist/sinks/types.js +0 -2
- package/dist/sinks/types.js.map +0 -1
- package/dist/sinks/webhook.d.ts +0 -6
- package/dist/sinks/webhook.js +0 -23
- package/dist/sinks/webhook.js.map +0 -1
- package/dist/status-sync/manager.d.ts +0 -48
- package/dist/status-sync/manager.js +0 -269
- package/dist/status-sync/manager.js.map +0 -1
- package/dist/utils/arg-parsers.d.ts +0 -16
- package/dist/utils/arg-parsers.js +0 -67
- package/dist/utils/arg-parsers.js.map +0 -1
- package/dist/utils/audit.d.ts +0 -69
- package/dist/utils/audit.js +0 -122
- package/dist/utils/audit.js.map +0 -1
- package/dist/utils/filter.d.ts +0 -81
- package/dist/utils/filter.js +0 -190
- package/dist/utils/filter.js.map +0 -1
- package/dist/utils/flags.d.ts +0 -72
- package/dist/utils/flags.js +0 -187
- package/dist/utils/flags.js.map +0 -1
- package/dist/utils/format.d.ts +0 -9
- package/dist/utils/format.js +0 -118
- package/dist/utils/format.js.map +0 -1
- package/dist/utils/health.d.ts +0 -48
- package/dist/utils/health.js +0 -102
- package/dist/utils/health.js.map +0 -1
- package/dist/utils/help-json.d.ts +0 -39
- package/dist/utils/help-json.js +0 -55
- package/dist/utils/help-json.js.map +0 -1
- package/dist/utils/name-resolver.d.ts +0 -26
- package/dist/utils/name-resolver.js +0 -138
- package/dist/utils/name-resolver.js.map +0 -1
- package/dist/utils/output.d.ts +0 -73
- package/dist/utils/output.js +0 -405
- package/dist/utils/output.js.map +0 -1
- package/dist/utils/quota.d.ts +0 -61
- package/dist/utils/quota.js +0 -228
- package/dist/utils/quota.js.map +0 -1
- package/dist/utils/redact.d.ts +0 -23
- package/dist/utils/redact.js +0 -69
- package/dist/utils/redact.js.map +0 -1
- package/dist/utils/retry.d.ts +0 -72
- package/dist/utils/retry.js +0 -141
- package/dist/utils/retry.js.map +0 -1
- package/dist/utils/string.d.ts +0 -2
- package/dist/utils/string.js +0 -23
- package/dist/utils/string.js.map +0 -1
- package/dist/version.d.ts +0 -2
- package/dist/version.js +0 -5
- package/dist/version.js.map +0 -1
|
@@ -1,386 +0,0 @@
|
|
|
1
|
-
const BASH_SCRIPT = `# switchbot bash completion
|
|
2
|
-
# Install: source <(switchbot completion bash)
|
|
3
|
-
# Or add to ~/.bashrc:
|
|
4
|
-
# source <(switchbot completion bash)
|
|
5
|
-
|
|
6
|
-
_switchbot_completion() {
|
|
7
|
-
local cur prev words cword
|
|
8
|
-
_get_comp_words_by_ref -n : cur prev words cword 2>/dev/null || {
|
|
9
|
-
cur="\${COMP_WORDS[COMP_CWORD]}"
|
|
10
|
-
prev="\${COMP_WORDS[COMP_CWORD-1]}"
|
|
11
|
-
words=("\${COMP_WORDS[@]}")
|
|
12
|
-
cword="\${COMP_CWORD}"
|
|
13
|
-
}
|
|
14
|
-
|
|
15
|
-
local top_cmds="config devices scenes webhook completion mcp quota catalog cache events doctor schema history plan capabilities help"
|
|
16
|
-
local config_sub="set-token show list-profiles"
|
|
17
|
-
local devices_sub="list ls status command types commands describe batch watch explain expand meta"
|
|
18
|
-
local scenes_sub="list execute"
|
|
19
|
-
local webhook_sub="setup query update delete"
|
|
20
|
-
local events_sub="tail mqtt-tail"
|
|
21
|
-
local quota_sub="status reset"
|
|
22
|
-
local catalog_sub="path show diff refresh"
|
|
23
|
-
local cache_sub="show clear"
|
|
24
|
-
local history_sub="show replay"
|
|
25
|
-
local plan_sub="schema validate run"
|
|
26
|
-
local completion_shells="bash zsh fish powershell"
|
|
27
|
-
local global_opts="--json --format --fields --verbose -v --dry-run --timeout --retry-on-429 --backoff --no-retry --no-quota --cache --no-cache --config --profile --audit-log --audit-log-path --help -h --version -V"
|
|
28
|
-
|
|
29
|
-
if [[ \${cword} -eq 1 ]]; then
|
|
30
|
-
COMPREPLY=( $(compgen -W "\${top_cmds} \${global_opts}" -- "\${cur}") )
|
|
31
|
-
return
|
|
32
|
-
fi
|
|
33
|
-
|
|
34
|
-
case "\${words[1]}" in
|
|
35
|
-
config)
|
|
36
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
37
|
-
COMPREPLY=( $(compgen -W "\${config_sub}" -- "\${cur}") )
|
|
38
|
-
fi
|
|
39
|
-
;;
|
|
40
|
-
devices)
|
|
41
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
42
|
-
COMPREPLY=( $(compgen -W "\${devices_sub}" -- "\${cur}") )
|
|
43
|
-
elif [[ "\${words[2]}" == "command" && "\${prev}" == "--type" ]]; then
|
|
44
|
-
COMPREPLY=( $(compgen -W "command customize" -- "\${cur}") )
|
|
45
|
-
fi
|
|
46
|
-
;;
|
|
47
|
-
scenes)
|
|
48
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
49
|
-
COMPREPLY=( $(compgen -W "\${scenes_sub}" -- "\${cur}") )
|
|
50
|
-
fi
|
|
51
|
-
;;
|
|
52
|
-
events)
|
|
53
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
54
|
-
COMPREPLY=( $(compgen -W "\${events_sub}" -- "\${cur}") )
|
|
55
|
-
fi
|
|
56
|
-
;;
|
|
57
|
-
quota)
|
|
58
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
59
|
-
COMPREPLY=( $(compgen -W "\${quota_sub}" -- "\${cur}") )
|
|
60
|
-
fi
|
|
61
|
-
;;
|
|
62
|
-
catalog)
|
|
63
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
64
|
-
COMPREPLY=( $(compgen -W "\${catalog_sub}" -- "\${cur}") )
|
|
65
|
-
fi
|
|
66
|
-
;;
|
|
67
|
-
cache)
|
|
68
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
69
|
-
COMPREPLY=( $(compgen -W "\${cache_sub}" -- "\${cur}") )
|
|
70
|
-
fi
|
|
71
|
-
;;
|
|
72
|
-
history)
|
|
73
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
74
|
-
COMPREPLY=( $(compgen -W "\${history_sub}" -- "\${cur}") )
|
|
75
|
-
fi
|
|
76
|
-
;;
|
|
77
|
-
plan)
|
|
78
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
79
|
-
COMPREPLY=( $(compgen -W "\${plan_sub}" -- "\${cur}") )
|
|
80
|
-
fi
|
|
81
|
-
;;
|
|
82
|
-
webhook)
|
|
83
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
84
|
-
COMPREPLY=( $(compgen -W "\${webhook_sub}" -- "\${cur}") )
|
|
85
|
-
elif [[ "\${words[2]}" == "update" ]]; then
|
|
86
|
-
COMPREPLY=( $(compgen -W "--enable --disable \${global_opts}" -- "\${cur}") )
|
|
87
|
-
fi
|
|
88
|
-
;;
|
|
89
|
-
completion)
|
|
90
|
-
if [[ \${cword} -eq 2 ]]; then
|
|
91
|
-
COMPREPLY=( $(compgen -W "\${completion_shells}" -- "\${cur}") )
|
|
92
|
-
fi
|
|
93
|
-
;;
|
|
94
|
-
*)
|
|
95
|
-
COMPREPLY=( $(compgen -W "\${global_opts}" -- "\${cur}") )
|
|
96
|
-
;;
|
|
97
|
-
esac
|
|
98
|
-
}
|
|
99
|
-
|
|
100
|
-
complete -F _switchbot_completion switchbot
|
|
101
|
-
`;
|
|
102
|
-
const ZSH_SCRIPT = `# switchbot zsh completion
|
|
103
|
-
# Install: source <(switchbot completion zsh)
|
|
104
|
-
# Or add to ~/.zshrc:
|
|
105
|
-
# source <(switchbot completion zsh)
|
|
106
|
-
|
|
107
|
-
_switchbot() {
|
|
108
|
-
local -a top_cmds config_sub devices_sub scenes_sub webhook_sub events_sub quota_sub catalog_sub cache_sub history_sub plan_sub completion_shells
|
|
109
|
-
top_cmds=(
|
|
110
|
-
'config:Manage API credentials'
|
|
111
|
-
'devices:List and control devices'
|
|
112
|
-
'scenes:List and execute scenes'
|
|
113
|
-
'webhook:Manage webhook configuration'
|
|
114
|
-
'completion:Print a shell completion script'
|
|
115
|
-
'mcp:Run the MCP server'
|
|
116
|
-
'quota:Inspect local request quota'
|
|
117
|
-
'catalog:Inspect the built-in device catalog'
|
|
118
|
-
'cache:Inspect local caches'
|
|
119
|
-
'events:Receive webhook or MQTT events'
|
|
120
|
-
'doctor:Run self-checks'
|
|
121
|
-
'schema:Export the device catalog as JSON'
|
|
122
|
-
'history:View and replay audited commands'
|
|
123
|
-
'plan:Validate and run batch plans'
|
|
124
|
-
'capabilities:Print a machine-readable manifest'
|
|
125
|
-
'help:Show help for a command'
|
|
126
|
-
)
|
|
127
|
-
config_sub=('set-token:Save token + secret' 'show:Show current credential source' 'list-profiles:List named credential profiles')
|
|
128
|
-
devices_sub=(
|
|
129
|
-
'list:List all devices'
|
|
130
|
-
'ls:Alias for list'
|
|
131
|
-
'status:Query device status'
|
|
132
|
-
'command:Send a control command'
|
|
133
|
-
'types:List known device types (offline)'
|
|
134
|
-
'commands:Show commands for a device type (offline)'
|
|
135
|
-
'describe:Show metadata + supported commands for one device'
|
|
136
|
-
'batch:Send one command to many devices'
|
|
137
|
-
'watch:Poll device status and emit changes'
|
|
138
|
-
'explain:One-shot device summary'
|
|
139
|
-
'expand:Build wire-format params from semantic flags'
|
|
140
|
-
'meta:Manage local device metadata'
|
|
141
|
-
)
|
|
142
|
-
scenes_sub=('list:List manual scenes' 'execute:Run a scene')
|
|
143
|
-
webhook_sub=(
|
|
144
|
-
'setup:Register a webhook URL'
|
|
145
|
-
'query:Query configured webhooks'
|
|
146
|
-
'update:Enable/disable a webhook'
|
|
147
|
-
'delete:Delete a webhook'
|
|
148
|
-
)
|
|
149
|
-
events_sub=('tail:Run a local webhook receiver' 'mqtt-tail:Stream MQTT shadow events')
|
|
150
|
-
quota_sub=('status:Show today and recent quota usage' 'reset:Delete the local quota counter')
|
|
151
|
-
catalog_sub=('path:Show overlay path' 'show:Show built-in/overlay/effective catalog' 'diff:Show overlay changes' 'refresh:Clear overlay cache')
|
|
152
|
-
cache_sub=('show:Summarize cache files' 'clear:Delete cache files')
|
|
153
|
-
history_sub=('show:Print recent audit entries' 'replay:Re-run one audited command')
|
|
154
|
-
plan_sub=('schema:Print the plan schema' 'validate:Validate a plan file' 'run:Validate and execute a plan')
|
|
155
|
-
completion_shells=('bash' 'zsh' 'fish' 'powershell')
|
|
156
|
-
|
|
157
|
-
local global_opts
|
|
158
|
-
global_opts=(
|
|
159
|
-
'--json[Raw JSON output]'
|
|
160
|
-
'--format[Output format]:type:(table json jsonl tsv yaml id)'
|
|
161
|
-
'--fields[Comma-separated output columns]:csv:'
|
|
162
|
-
'(-v --verbose)'{-v,--verbose}'[Log HTTP details to stderr]'
|
|
163
|
-
'--dry-run[Print mutating requests without sending]'
|
|
164
|
-
'--timeout[HTTP timeout in ms]:ms:'
|
|
165
|
-
'--retry-on-429[Max 429 retries]:n:'
|
|
166
|
-
'--backoff[Retry backoff strategy]:strategy:(linear exponential)'
|
|
167
|
-
'--no-retry[Disable 429 retries]'
|
|
168
|
-
'--no-quota[Disable the local quota counter]'
|
|
169
|
-
'--cache[Cache mode]:mode:'
|
|
170
|
-
'--no-cache[Disable cache reads]'
|
|
171
|
-
'--config[Override credential file path]:path:_files'
|
|
172
|
-
'--profile[Use a named credential profile]:name:'
|
|
173
|
-
'--audit-log[Append mutating commands to ~/.switchbot/audit.log]'
|
|
174
|
-
'--audit-log-path[Custom audit log file path]:path:_files'
|
|
175
|
-
'(-h --help)'{-h,--help}'[Show help]'
|
|
176
|
-
'(-V --version)'{-V,--version}'[Show version]'
|
|
177
|
-
)
|
|
178
|
-
|
|
179
|
-
_arguments -C \\
|
|
180
|
-
"1:command:->top" \\
|
|
181
|
-
"2:subcommand:->sub" \\
|
|
182
|
-
"*::arg:->rest" \\
|
|
183
|
-
$global_opts
|
|
184
|
-
|
|
185
|
-
case "$state" in
|
|
186
|
-
top)
|
|
187
|
-
_describe 'command' top_cmds
|
|
188
|
-
;;
|
|
189
|
-
sub)
|
|
190
|
-
case "$words[2]" in
|
|
191
|
-
config) _describe 'config' config_sub ;;
|
|
192
|
-
devices) _describe 'devices' devices_sub ;;
|
|
193
|
-
scenes) _describe 'scenes' scenes_sub ;;
|
|
194
|
-
webhook) _describe 'webhook' webhook_sub ;;
|
|
195
|
-
events) _describe 'events' events_sub ;;
|
|
196
|
-
quota) _describe 'quota' quota_sub ;;
|
|
197
|
-
catalog) _describe 'catalog' catalog_sub ;;
|
|
198
|
-
cache) _describe 'cache' cache_sub ;;
|
|
199
|
-
history) _describe 'history' history_sub ;;
|
|
200
|
-
plan) _describe 'plan' plan_sub ;;
|
|
201
|
-
completion) _values 'shell' $completion_shells ;;
|
|
202
|
-
esac
|
|
203
|
-
;;
|
|
204
|
-
rest)
|
|
205
|
-
if [[ "$words[2]" == "webhook" && "$words[3]" == "update" ]]; then
|
|
206
|
-
_values 'flag' '--enable' '--disable'
|
|
207
|
-
fi
|
|
208
|
-
;;
|
|
209
|
-
esac
|
|
210
|
-
}
|
|
211
|
-
|
|
212
|
-
compdef _switchbot switchbot
|
|
213
|
-
`;
|
|
214
|
-
const FISH_SCRIPT = `# switchbot fish completion
|
|
215
|
-
# Install:
|
|
216
|
-
# switchbot completion fish > ~/.config/fish/completions/switchbot.fish
|
|
217
|
-
|
|
218
|
-
complete -c switchbot -f
|
|
219
|
-
|
|
220
|
-
# Global options
|
|
221
|
-
complete -c switchbot -l json -d 'Raw JSON output'
|
|
222
|
-
complete -c switchbot -l format -r -d 'Output format'
|
|
223
|
-
complete -c switchbot -l fields -r -d 'Comma-separated output columns'
|
|
224
|
-
complete -c switchbot -s v -l verbose -d 'Log HTTP details to stderr'
|
|
225
|
-
complete -c switchbot -l dry-run -d 'Print mutating requests without sending'
|
|
226
|
-
complete -c switchbot -l timeout -r -d 'HTTP timeout in ms'
|
|
227
|
-
complete -c switchbot -l retry-on-429 -r -d 'Max 429 retries'
|
|
228
|
-
complete -c switchbot -l backoff -r -d 'Retry backoff strategy'
|
|
229
|
-
complete -c switchbot -l no-retry -d 'Disable 429 retries'
|
|
230
|
-
complete -c switchbot -l no-quota -d 'Disable the local quota counter'
|
|
231
|
-
complete -c switchbot -l cache -r -d 'Cache mode'
|
|
232
|
-
complete -c switchbot -l no-cache -d 'Disable cache reads'
|
|
233
|
-
complete -c switchbot -l config -r -d 'Credential file path'
|
|
234
|
-
complete -c switchbot -l profile -r -d 'Named credential profile'
|
|
235
|
-
complete -c switchbot -l audit-log -d 'Append mutating commands to audit log'
|
|
236
|
-
complete -c switchbot -l audit-log-path -r -d 'Custom audit log file path'
|
|
237
|
-
complete -c switchbot -s h -l help -d 'Show help'
|
|
238
|
-
complete -c switchbot -s V -l version -d 'Show version'
|
|
239
|
-
|
|
240
|
-
# Top-level commands
|
|
241
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'config' -d 'Manage API credentials'
|
|
242
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'devices' -d 'List and control devices'
|
|
243
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'scenes' -d 'List and execute scenes'
|
|
244
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'webhook' -d 'Manage webhook configuration'
|
|
245
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'completion' -d 'Print a shell completion script'
|
|
246
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'mcp' -d 'Run the MCP server'
|
|
247
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'quota' -d 'Inspect local request quota'
|
|
248
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'catalog' -d 'Inspect the built-in device catalog'
|
|
249
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'cache' -d 'Inspect local caches'
|
|
250
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'events' -d 'Receive webhook or MQTT events'
|
|
251
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'doctor' -d 'Run self-checks'
|
|
252
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'schema' -d 'Export the device catalog as JSON'
|
|
253
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'history' -d 'View and replay audited commands'
|
|
254
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'plan' -d 'Validate and run batch plans'
|
|
255
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'capabilities' -d 'Print a machine-readable manifest'
|
|
256
|
-
complete -c switchbot -n '__fish_use_subcommand' -a 'help' -d 'Show help'
|
|
257
|
-
|
|
258
|
-
# config
|
|
259
|
-
complete -c switchbot -n '__fish_seen_subcommand_from config' -a 'set-token show list-profiles'
|
|
260
|
-
|
|
261
|
-
# devices
|
|
262
|
-
complete -c switchbot -n '__fish_seen_subcommand_from devices' -a 'list ls status command types commands describe batch watch explain expand meta'
|
|
263
|
-
|
|
264
|
-
# scenes
|
|
265
|
-
complete -c switchbot -n '__fish_seen_subcommand_from scenes' -a 'list execute'
|
|
266
|
-
|
|
267
|
-
# webhook
|
|
268
|
-
complete -c switchbot -n '__fish_seen_subcommand_from webhook' -a 'setup query update delete'
|
|
269
|
-
complete -c switchbot -n '__fish_seen_subcommand_from webhook; and __fish_seen_subcommand_from update' -l enable -d 'Enable the webhook'
|
|
270
|
-
complete -c switchbot -n '__fish_seen_subcommand_from webhook; and __fish_seen_subcommand_from update' -l disable -d 'Disable the webhook'
|
|
271
|
-
|
|
272
|
-
# events
|
|
273
|
-
complete -c switchbot -n '__fish_seen_subcommand_from events' -a 'tail mqtt-tail'
|
|
274
|
-
|
|
275
|
-
# quota
|
|
276
|
-
complete -c switchbot -n '__fish_seen_subcommand_from quota' -a 'status reset'
|
|
277
|
-
|
|
278
|
-
# catalog
|
|
279
|
-
complete -c switchbot -n '__fish_seen_subcommand_from catalog' -a 'path show diff refresh'
|
|
280
|
-
|
|
281
|
-
# cache
|
|
282
|
-
complete -c switchbot -n '__fish_seen_subcommand_from cache' -a 'show clear'
|
|
283
|
-
|
|
284
|
-
# history
|
|
285
|
-
complete -c switchbot -n '__fish_seen_subcommand_from history' -a 'show replay'
|
|
286
|
-
|
|
287
|
-
# plan
|
|
288
|
-
complete -c switchbot -n '__fish_seen_subcommand_from plan' -a 'schema validate run'
|
|
289
|
-
|
|
290
|
-
# completion
|
|
291
|
-
complete -c switchbot -n '__fish_seen_subcommand_from completion' -a 'bash zsh fish powershell'
|
|
292
|
-
`;
|
|
293
|
-
const POWERSHELL_SCRIPT = `# switchbot PowerShell completion
|
|
294
|
-
# Install: switchbot completion powershell | Out-String | Invoke-Expression
|
|
295
|
-
# Or add to your profile:
|
|
296
|
-
# switchbot completion powershell >> $PROFILE
|
|
297
|
-
|
|
298
|
-
Register-ArgumentCompleter -Native -CommandName switchbot -ScriptBlock {
|
|
299
|
-
param($wordToComplete, $commandAst, $cursorPosition)
|
|
300
|
-
|
|
301
|
-
$tokens = $commandAst.CommandElements | ForEach-Object { $_.ToString() }
|
|
302
|
-
$count = $tokens.Count
|
|
303
|
-
|
|
304
|
-
$top = 'config','devices','scenes','webhook','completion','mcp','quota','catalog','cache','events','doctor','schema','history','plan','capabilities','help'
|
|
305
|
-
$configSub = 'set-token','show','list-profiles'
|
|
306
|
-
$devicesSub = 'list','ls','status','command','types','commands','describe','batch','watch','explain','expand','meta'
|
|
307
|
-
$scenesSub = 'list','execute'
|
|
308
|
-
$webhookSub = 'setup','query','update','delete'
|
|
309
|
-
$eventsSub = 'tail','mqtt-tail'
|
|
310
|
-
$quotaSub = 'status','reset'
|
|
311
|
-
$catalogSub = 'path','show','diff','refresh'
|
|
312
|
-
$cacheSub = 'show','clear'
|
|
313
|
-
$historySub = 'show','replay'
|
|
314
|
-
$planSub = 'schema','validate','run'
|
|
315
|
-
$shells = 'bash','zsh','fish','powershell'
|
|
316
|
-
$globalOpts = '--json','--format','--fields','--verbose','-v','--dry-run','--timeout','--retry-on-429','--backoff','--no-retry','--no-quota','--cache','--no-cache','--config','--profile','--audit-log','--audit-log-path','--help','-h','--version','-V'
|
|
317
|
-
|
|
318
|
-
function _emit($values) {
|
|
319
|
-
$values |
|
|
320
|
-
Where-Object { $_ -like "$wordToComplete*" } |
|
|
321
|
-
ForEach-Object { [System.Management.Automation.CompletionResult]::new($_, $_, 'ParameterValue', $_) }
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
if ($count -le 2) { return _emit ($top + $globalOpts) }
|
|
325
|
-
|
|
326
|
-
switch ($tokens[1]) {
|
|
327
|
-
'config' { if ($count -eq 3) { return _emit $configSub } }
|
|
328
|
-
'devices' { if ($count -eq 3) { return _emit $devicesSub } }
|
|
329
|
-
'scenes' { if ($count -eq 3) { return _emit $scenesSub } }
|
|
330
|
-
'events' { if ($count -eq 3) { return _emit $eventsSub } }
|
|
331
|
-
'quota' { if ($count -eq 3) { return _emit $quotaSub } }
|
|
332
|
-
'catalog' { if ($count -eq 3) { return _emit $catalogSub } }
|
|
333
|
-
'cache' { if ($count -eq 3) { return _emit $cacheSub } }
|
|
334
|
-
'history' { if ($count -eq 3) { return _emit $historySub } }
|
|
335
|
-
'plan' { if ($count -eq 3) { return _emit $planSub } }
|
|
336
|
-
'webhook' {
|
|
337
|
-
if ($count -eq 3) { return _emit $webhookSub }
|
|
338
|
-
if ($tokens[2] -eq 'update') { return _emit ('--enable','--disable' + $globalOpts) }
|
|
339
|
-
}
|
|
340
|
-
'completion' { if ($count -eq 3) { return _emit $shells } }
|
|
341
|
-
}
|
|
342
|
-
|
|
343
|
-
return _emit $globalOpts
|
|
344
|
-
}
|
|
345
|
-
`;
|
|
346
|
-
export function registerCompletionCommand(program) {
|
|
347
|
-
const completion = program
|
|
348
|
-
.command('completion')
|
|
349
|
-
.description('Print a shell completion script for bash, zsh, fish, or powershell')
|
|
350
|
-
.argument('<shell>', 'Shell to generate completion for: bash | zsh | fish | powershell')
|
|
351
|
-
.addHelpText('after', `
|
|
352
|
-
The command writes the completion script to stdout. Redirect it to a file or
|
|
353
|
-
source it directly:
|
|
354
|
-
|
|
355
|
-
bash source <(switchbot completion bash)
|
|
356
|
-
# persist: echo 'source <(switchbot completion bash)' >> ~/.bashrc
|
|
357
|
-
|
|
358
|
-
zsh source <(switchbot completion zsh)
|
|
359
|
-
# persist: echo 'source <(switchbot completion zsh)' >> ~/.zshrc
|
|
360
|
-
|
|
361
|
-
fish switchbot completion fish > ~/.config/fish/completions/switchbot.fish
|
|
362
|
-
|
|
363
|
-
powershell switchbot completion powershell | Out-String | Invoke-Expression
|
|
364
|
-
# persist: switchbot completion powershell >> $PROFILE
|
|
365
|
-
`)
|
|
366
|
-
.action((shell) => {
|
|
367
|
-
switch (shell.toLowerCase()) {
|
|
368
|
-
case 'bash':
|
|
369
|
-
process.stdout.write(BASH_SCRIPT);
|
|
370
|
-
return;
|
|
371
|
-
case 'zsh':
|
|
372
|
-
process.stdout.write(ZSH_SCRIPT);
|
|
373
|
-
return;
|
|
374
|
-
case 'fish':
|
|
375
|
-
process.stdout.write(FISH_SCRIPT);
|
|
376
|
-
return;
|
|
377
|
-
case 'powershell':
|
|
378
|
-
case 'pwsh':
|
|
379
|
-
process.stdout.write(POWERSHELL_SCRIPT);
|
|
380
|
-
return;
|
|
381
|
-
default:
|
|
382
|
-
completion.error(`error: unsupported shell "${shell}" (choose from: bash, zsh, fish, powershell)`, { exitCode: 2, code: 'switchbot.unsupportedShell' });
|
|
383
|
-
}
|
|
384
|
-
});
|
|
385
|
-
}
|
|
386
|
-
//# sourceMappingURL=completion.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"completion.js","sourceRoot":"","sources":["../../src/commands/completion.ts"],"names":[],"mappings":"AAEA,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoGnB,CAAC;AAEF,MAAM,UAAU,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA+GlB,CAAC;AAEF,MAAM,WAAW,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CA8EnB,CAAC;AAEF,MAAM,iBAAiB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAoDzB,CAAC;AAEF,MAAM,UAAU,yBAAyB,CAAC,OAAgB;IACxD,MAAM,UAAU,GAAG,OAAO;SACvB,OAAO,CAAC,YAAY,CAAC;SACrB,WAAW,CAAC,oEAAoE,CAAC;SACjF,QAAQ,CAAC,SAAS,EAAE,kEAAkE,CAAC;SACvF,WAAW,CAAC,OAAO,EAAE;;;;;;;;;;;;;;CAczB,CAAC;SACG,MAAM,CAAC,CAAC,KAAa,EAAE,EAAE;QACxB,QAAQ,KAAK,CAAC,WAAW,EAAE,EAAE,CAAC;YAC5B,KAAK,MAAM;gBACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAClC,OAAO;YACT,KAAK,KAAK;gBACR,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,UAAU,CAAC,CAAC;gBACjC,OAAO;YACT,KAAK,MAAM;gBACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,CAAC;gBAClC,OAAO;YACT,KAAK,YAAY,CAAC;YAClB,KAAK,MAAM;gBACT,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,iBAAiB,CAAC,CAAC;gBACxC,OAAO;YACT;gBACE,UAAU,CAAC,KAAK,CACd,6BAA6B,KAAK,8CAA8C,EAChF,EAAE,QAAQ,EAAE,CAAC,EAAE,IAAI,EAAE,4BAA4B,EAAE,CACpD,CAAC;QACN,CAAC;IACH,CAAC,CAAC,CAAC;AACP,CAAC"}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { Command } from 'commander';
|
|
2
|
-
/**
|
|
3
|
-
* Interactive echo-off prompt for token + secret. Used by both
|
|
4
|
-
* `switchbot config set-token` and the install orchestrator. Throws if
|
|
5
|
-
* stdin is not a TTY.
|
|
6
|
-
*/
|
|
7
|
-
export declare function promptTokenAndSecret(): Promise<{
|
|
8
|
-
token: string;
|
|
9
|
-
secret: string;
|
|
10
|
-
}>;
|
|
11
|
-
/**
|
|
12
|
-
* Read a two-line credential file (line 1 = token, line 2 = secret)
|
|
13
|
-
* and unlink it on success. The installer's `--token-file` escape
|
|
14
|
-
* hatch uses this; keeps credentials off the command line and shell
|
|
15
|
-
* history for CI-style installs.
|
|
16
|
-
*/
|
|
17
|
-
export declare function readCredentialsFile(filePath: string): {
|
|
18
|
-
token: string;
|
|
19
|
-
secret: string;
|
|
20
|
-
};
|
|
21
|
-
export declare function registerConfigCommand(program: Command): void;
|