Composio powers 1000+ toolkits, tool search, context management, authentication, and a sandboxed workbench to help you build AI agents that turn intent into action.

next
sh 97 lines 3.12 KB
Raw
1 #!/bin/sh
2 set -eu
3
4 state_dir="${HOST_STATE_DIR:?HOST_STATE_DIR is required}"
5 host="$(basename "$0")"
6 command="$*"
7
8 mkdir -p "$state_dir"
9 printf '%s %s\n' "$host" "$command" >> "$state_dir/commands.log"
10
11 case "$host:$command" in
12 "claude:--version")
13 printf '%s\n' '2.1.207 (Claude Code)'
14 ;;
15 "claude:plugin marketplace list --help"|"claude:plugin list --help")
16 printf '%s\n' "Usage: claude $command [OPTIONS]"
17 if [ ! -f "$state_dir/claude-without-json" ]; then
18 printf '%s\n' ' --json'
19 fi
20 ;;
21 "claude:plugin marketplace list --json")
22 if [ -f "$state_dir/claude-marketplace" ]; then
23 printf '%s\n' '[{"name":"composio","source":"git","url":"https://github.com/ComposioHQ/composio-plugin-cc.git"}]'
24 else
25 printf '%s\n' '[]'
26 fi
27 ;;
28 "claude:plugin list --json")
29 if [ -f "$state_dir/claude-inspection-fails" ]; then
30 printf '%s\n' 'native inspection failed' 'Usage: claude plugin list [options]' >&2
31 exit 2
32 fi
33 if [ -f "$state_dir/claude-plugin" ]; then
34 printf '%s\n' '[{"id":"composio@composio","scope":"user","enabled":true}]'
35 else
36 printf '%s\n' '[]'
37 fi
38 ;;
39 "claude:plugin marketplace add https://github.com/ComposioHQ/composio-plugin-cc.git --scope user")
40 touch "$state_dir/claude-marketplace"
41 ;;
42 "claude:plugin install composio@composio --scope user")
43 touch "$state_dir/claude-plugin"
44 ;;
45 "claude:plugin enable composio@composio --scope user")
46 touch "$state_dir/claude-plugin"
47 ;;
48 "claude:plugin uninstall composio@composio --scope user --yes")
49 rm -f "$state_dir/claude-plugin"
50 ;;
51 "codex:--version")
52 if [ -f "$state_dir/codex-without-json" ]; then
53 printf '%s\n' 'codex-cli 0.137.0'
54 else
55 printf '%s\n' 'codex-cli 0.144.1'
56 fi
57 ;;
58 "codex:plugin marketplace list --help")
59 printf '%s\n' 'Usage: codex plugin marketplace list [OPTIONS]'
60 if [ ! -f "$state_dir/codex-without-json" ]; then
61 printf '%s\n' ' --json'
62 fi
63 ;;
64 "codex:plugin list --help")
65 printf '%s\n' 'Usage: codex plugin list [OPTIONS]'
66 if [ ! -f "$state_dir/codex-without-json" ]; then
67 printf '%s\n' ' --json'
68 fi
69 ;;
70 "codex:plugin marketplace list --json")
71 if [ -f "$state_dir/codex-marketplace" ]; then
72 printf '%s\n' '{"marketplaces":[{"name":"composio","marketplaceSource":{"sourceType":"git","source":"ComposioHQ/composio-plugin-openai"}}]}'
73 else
74 printf '%s\n' '{"marketplaces":[]}'
75 fi
76 ;;
77 "codex:plugin list --json")
78 if [ -f "$state_dir/codex-plugin" ]; then
79 printf '%s\n' '{"installed":[{"pluginId":"composio@composio","installed":true,"enabled":true}]}'
80 else
81 printf '%s\n' '{"installed":[],"available":[]}'
82 fi
83 ;;
84 "codex:plugin marketplace add https://github.com/ComposioHQ/composio-plugin-openai.git --json")
85 touch "$state_dir/codex-marketplace"
86 ;;
87 "codex:plugin add composio@composio --json")
88 touch "$state_dir/codex-plugin"
89 ;;
90 "codex:plugin remove composio@composio --json")
91 rm -f "$state_dir/codex-plugin"
92 ;;
93 *)
94 printf 'Unexpected fake host command: %s %s\n' "$host" "$command" >&2
95 exit 64
96 ;;
97 esac