ghost-dragon 4.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.
Files changed (226) hide show
  1. package/.github/workflows/ci.yml +23 -0
  2. package/CHANGELOG.md +96 -0
  3. package/README.md +193 -0
  4. package/bootstrap.ps1 +83 -0
  5. package/bootstrap.sh +71 -0
  6. package/dist/agent/loop.d.ts +68 -0
  7. package/dist/agent/loop.d.ts.map +1 -0
  8. package/dist/agent/loop.js +135 -0
  9. package/dist/agent/mcp.d.ts +33 -0
  10. package/dist/agent/mcp.d.ts.map +1 -0
  11. package/dist/agent/mcp.js +107 -0
  12. package/dist/agent/session.d.ts +16 -0
  13. package/dist/agent/session.d.ts.map +1 -0
  14. package/dist/agent/session.js +55 -0
  15. package/dist/agent/skills.d.ts +36 -0
  16. package/dist/agent/skills.d.ts.map +1 -0
  17. package/dist/agent/skills.js +153 -0
  18. package/dist/agent/stack.d.ts +21 -0
  19. package/dist/agent/stack.d.ts.map +1 -0
  20. package/dist/agent/stack.js +158 -0
  21. package/dist/agent/task.d.ts +21 -0
  22. package/dist/agent/task.d.ts.map +1 -0
  23. package/dist/agent/task.js +45 -0
  24. package/dist/agent/tools.d.ts +44 -0
  25. package/dist/agent/tools.d.ts.map +1 -0
  26. package/dist/agent/tools.js +262 -0
  27. package/dist/agent/trace.d.ts +34 -0
  28. package/dist/agent/trace.d.ts.map +1 -0
  29. package/dist/agent/trace.js +72 -0
  30. package/dist/agent.d.ts +46 -0
  31. package/dist/agent.d.ts.map +1 -0
  32. package/dist/agent.js +103 -0
  33. package/dist/auth.d.ts +74 -0
  34. package/dist/auth.d.ts.map +1 -0
  35. package/dist/auth.js +116 -0
  36. package/dist/brain/anthropic.d.ts +19 -0
  37. package/dist/brain/anthropic.d.ts.map +1 -0
  38. package/dist/brain/anthropic.js +74 -0
  39. package/dist/brain/claude-cli.d.ts +20 -0
  40. package/dist/brain/claude-cli.d.ts.map +1 -0
  41. package/dist/brain/claude-cli.js +79 -0
  42. package/dist/brain/ghost-ember.d.ts +28 -0
  43. package/dist/brain/ghost-ember.d.ts.map +1 -0
  44. package/dist/brain/ghost-ember.js +97 -0
  45. package/dist/brain/index.d.ts +22 -0
  46. package/dist/brain/index.d.ts.map +1 -0
  47. package/dist/brain/index.js +95 -0
  48. package/dist/brain/openai-compat.d.ts +21 -0
  49. package/dist/brain/openai-compat.d.ts.map +1 -0
  50. package/dist/brain/openai-compat.js +119 -0
  51. package/dist/brain/router/classify.d.ts +23 -0
  52. package/dist/brain/router/classify.d.ts.map +1 -0
  53. package/dist/brain/router/classify.js +160 -0
  54. package/dist/brain/router/execute.d.ts +23 -0
  55. package/dist/brain/router/execute.d.ts.map +1 -0
  56. package/dist/brain/router/execute.js +84 -0
  57. package/dist/brain/router/index.d.ts +26 -0
  58. package/dist/brain/router/index.d.ts.map +1 -0
  59. package/dist/brain/router/index.js +118 -0
  60. package/dist/brain/router/routing-memory.d.ts +27 -0
  61. package/dist/brain/router/routing-memory.d.ts.map +1 -0
  62. package/dist/brain/router/routing-memory.js +77 -0
  63. package/dist/brain/router/select.d.ts +32 -0
  64. package/dist/brain/router/select.d.ts.map +1 -0
  65. package/dist/brain/router/select.js +146 -0
  66. package/dist/brain/router/two-hop.d.ts +23 -0
  67. package/dist/brain/router/two-hop.d.ts.map +1 -0
  68. package/dist/brain/router/two-hop.js +39 -0
  69. package/dist/brain/router/verify.d.ts +37 -0
  70. package/dist/brain/router/verify.d.ts.map +1 -0
  71. package/dist/brain/router/verify.js +111 -0
  72. package/dist/brain/types.d.ts +55 -0
  73. package/dist/brain/types.d.ts.map +1 -0
  74. package/dist/brain/types.js +16 -0
  75. package/dist/brain/worker.d.ts +27 -0
  76. package/dist/brain/worker.d.ts.map +1 -0
  77. package/dist/brain/worker.js +71 -0
  78. package/dist/commands/ai.d.ts +24 -0
  79. package/dist/commands/ai.d.ts.map +1 -0
  80. package/dist/commands/ai.js +137 -0
  81. package/dist/commands/alerts.d.ts +19 -0
  82. package/dist/commands/alerts.d.ts.map +1 -0
  83. package/dist/commands/alerts.js +114 -0
  84. package/dist/commands/billing.d.ts +13 -0
  85. package/dist/commands/billing.d.ts.map +1 -0
  86. package/dist/commands/billing.js +55 -0
  87. package/dist/commands/chat.d.ts +22 -0
  88. package/dist/commands/chat.d.ts.map +1 -0
  89. package/dist/commands/chat.js +422 -0
  90. package/dist/commands/config.d.ts +18 -0
  91. package/dist/commands/config.d.ts.map +1 -0
  92. package/dist/commands/config.js +136 -0
  93. package/dist/commands/doctor.d.ts +11 -0
  94. package/dist/commands/doctor.d.ts.map +1 -0
  95. package/dist/commands/doctor.js +73 -0
  96. package/dist/commands/global.d.ts +11 -0
  97. package/dist/commands/global.d.ts.map +1 -0
  98. package/dist/commands/global.js +253 -0
  99. package/dist/commands/keep.d.ts +12 -0
  100. package/dist/commands/keep.d.ts.map +1 -0
  101. package/dist/commands/keep.js +58 -0
  102. package/dist/commands/lifecycle.d.ts +17 -0
  103. package/dist/commands/lifecycle.d.ts.map +1 -0
  104. package/dist/commands/lifecycle.js +267 -0
  105. package/dist/commands/login.d.ts +16 -0
  106. package/dist/commands/login.d.ts.map +1 -0
  107. package/dist/commands/login.js +234 -0
  108. package/dist/commands/maintenance.d.ts +12 -0
  109. package/dist/commands/maintenance.d.ts.map +1 -0
  110. package/dist/commands/maintenance.js +76 -0
  111. package/dist/commands/mcp.d.ts +16 -0
  112. package/dist/commands/mcp.d.ts.map +1 -0
  113. package/dist/commands/mcp.js +56 -0
  114. package/dist/commands/memory.d.ts +13 -0
  115. package/dist/commands/memory.d.ts.map +1 -0
  116. package/dist/commands/memory.js +218 -0
  117. package/dist/commands/osint.d.ts +14 -0
  118. package/dist/commands/osint.d.ts.map +1 -0
  119. package/dist/commands/osint.js +161 -0
  120. package/dist/commands/pentest.d.ts +13 -0
  121. package/dist/commands/pentest.d.ts.map +1 -0
  122. package/dist/commands/pentest.js +131 -0
  123. package/dist/commands/scale.d.ts +14 -0
  124. package/dist/commands/scale.d.ts.map +1 -0
  125. package/dist/commands/scale.js +191 -0
  126. package/dist/commands/serve.d.ts +16 -0
  127. package/dist/commands/serve.d.ts.map +1 -0
  128. package/dist/commands/serve.js +167 -0
  129. package/dist/commands/tui.d.ts +17 -0
  130. package/dist/commands/tui.d.ts.map +1 -0
  131. package/dist/commands/tui.js +138 -0
  132. package/dist/commands/wyrm.d.ts +20 -0
  133. package/dist/commands/wyrm.d.ts.map +1 -0
  134. package/dist/commands/wyrm.js +274 -0
  135. package/dist/config.d.ts +67 -0
  136. package/dist/config.d.ts.map +1 -0
  137. package/dist/config.js +54 -0
  138. package/dist/index.d.ts +16 -0
  139. package/dist/index.d.ts.map +1 -0
  140. package/dist/index.js +85 -0
  141. package/dist/manifest.d.ts +31 -0
  142. package/dist/manifest.d.ts.map +1 -0
  143. package/dist/manifest.js +83 -0
  144. package/dist/ui.d.ts +57 -0
  145. package/dist/ui.d.ts.map +1 -0
  146. package/dist/ui.js +174 -0
  147. package/dist/utils.d.ts +33 -0
  148. package/dist/utils.d.ts.map +1 -0
  149. package/dist/utils.js +155 -0
  150. package/dist/wyrm/mcp.d.ts +37 -0
  151. package/dist/wyrm/mcp.d.ts.map +1 -0
  152. package/dist/wyrm/mcp.js +137 -0
  153. package/docs/SYSTEM-PREMORTEM.md +397 -0
  154. package/dragon-manifest.toml +241 -0
  155. package/dragon.py +177 -0
  156. package/install/launchd/lk.ghosts.dragonkeep.plist +57 -0
  157. package/install/systemd/dragonkeep.service +40 -0
  158. package/media/dragon-silver-lockup.svg +931 -0
  159. package/media/dragon-silver-mark.svg +931 -0
  160. package/media/dragon-silver.png +0 -0
  161. package/package.json +45 -0
  162. package/specs/001-godmode/constitution.md +54 -0
  163. package/specs/001-godmode/plan.md +30 -0
  164. package/specs/001-godmode/spec.md +64 -0
  165. package/specs/001-godmode/tasks.md +35 -0
  166. package/specs/002-premortem-positioning/premortem.md +211 -0
  167. package/src/agent/loop.ts +165 -0
  168. package/src/agent/mcp.ts +92 -0
  169. package/src/agent/session.ts +48 -0
  170. package/src/agent/skills.ts +138 -0
  171. package/src/agent/stack.ts +154 -0
  172. package/src/agent/task.ts +55 -0
  173. package/src/agent/tools.ts +255 -0
  174. package/src/agent/trace.ts +76 -0
  175. package/src/agent.ts +114 -0
  176. package/src/auth.ts +133 -0
  177. package/src/brain/anthropic.ts +83 -0
  178. package/src/brain/claude-cli.ts +78 -0
  179. package/src/brain/ghost-ember.ts +94 -0
  180. package/src/brain/index.ts +99 -0
  181. package/src/brain/openai-compat.ts +115 -0
  182. package/src/brain/router/classify.ts +167 -0
  183. package/src/brain/router/execute.ts +80 -0
  184. package/src/brain/router/index.ts +125 -0
  185. package/src/brain/router/routing-memory.ts +71 -0
  186. package/src/brain/router/select.ts +156 -0
  187. package/src/brain/router/two-hop.ts +62 -0
  188. package/src/brain/router/verify.ts +123 -0
  189. package/src/brain/types.ts +61 -0
  190. package/src/brain/worker.ts +72 -0
  191. package/src/commands/ai.ts +144 -0
  192. package/src/commands/alerts.ts +131 -0
  193. package/src/commands/billing.ts +59 -0
  194. package/src/commands/chat.ts +318 -0
  195. package/src/commands/config.ts +137 -0
  196. package/src/commands/doctor.ts +71 -0
  197. package/src/commands/global.ts +256 -0
  198. package/src/commands/keep.ts +67 -0
  199. package/src/commands/lifecycle.ts +273 -0
  200. package/src/commands/login.ts +184 -0
  201. package/src/commands/maintenance.ts +54 -0
  202. package/src/commands/mcp.ts +57 -0
  203. package/src/commands/memory.ts +229 -0
  204. package/src/commands/osint.ts +171 -0
  205. package/src/commands/pentest.ts +140 -0
  206. package/src/commands/scale.ts +185 -0
  207. package/src/commands/serve.ts +171 -0
  208. package/src/commands/tui.ts +126 -0
  209. package/src/commands/wyrm.ts +269 -0
  210. package/src/config.ts +93 -0
  211. package/src/index.ts +92 -0
  212. package/src/manifest.ts +104 -0
  213. package/src/ui.ts +188 -0
  214. package/src/utils.ts +153 -0
  215. package/src/wyrm/mcp.ts +130 -0
  216. package/test/auth.test.ts +70 -0
  217. package/test/brain.test.ts +39 -0
  218. package/test/security.test.ts +104 -0
  219. package/test/skills.test.ts +38 -0
  220. package/test/ui.test.ts +46 -0
  221. package/tsconfig.json +19 -0
  222. package/worker/package-lock.json +1527 -0
  223. package/worker/package.json +17 -0
  224. package/worker/src/index.ts +76 -0
  225. package/worker/tsconfig.json +15 -0
  226. package/worker/wrangler.toml +26 -0
package/dragon.py ADDED
@@ -0,0 +1,177 @@
1
+ #!/usr/bin/env python3
2
+ """
3
+ Dragon CLI - Unified Command Line Interface for Ghost Protocol Products
4
+
5
+ Routes commands to:
6
+ - wyrm AI Memory System (MCP Server)
7
+ - pentest PhantomDragon Penetration Testing
8
+ - scale DragonScale Commerce Platform
9
+ - keep DragonKeep Infrastructure Security
10
+
11
+ By Ghost Protocol Security (https://ghosts.lk)
12
+ """
13
+
14
+ import sys
15
+ import os
16
+ import subprocess
17
+ import argparse
18
+ from pathlib import Path
19
+
20
+ VERSION = "1.0.0"
21
+
22
+ # Detect installation paths (adjust based on actual installation)
23
+ DRAGON_HOME = os.environ.get('DRAGON_HOME', str(Path.home() / '.dragon'))
24
+ WYRM_PATH = os.environ.get('WYRM_PATH', '')
25
+ PHANTOMDRAGON_PATH = os.environ.get('PHANTOMDRAGON_PATH', '')
26
+ DRAGONSCALE_PATH = os.environ.get('DRAGONSCALE_PATH', '')
27
+ DRAGONKEEP_PATH = os.environ.get('DRAGONKEEP_PATH', '')
28
+
29
+ DRAGON_ASCII = r"""
30
+ . ' ,
31
+ _________
32
+ _ /_|_____|_\ _
33
+ '. \ / .'
34
+ '.\ /.'
35
+ '.'
36
+ """
37
+
38
+ PRODUCTS = {
39
+ 'wyrm': {
40
+ 'name': 'Wyrm',
41
+ 'description': 'AI Memory System - Context & knowledge persistence for AI assistants',
42
+ 'path_env': 'WYRM_PATH',
43
+ 'commands': ['serve', 'query', 'projects', 'sessions', 'quests'],
44
+ },
45
+ 'pentest': {
46
+ 'name': 'PhantomDragon',
47
+ 'description': 'Penetration Testing - Web application security scanner',
48
+ 'path_env': 'PHANTOMDRAGON_PATH',
49
+ 'commands': ['scan', 'update', 'report'],
50
+ },
51
+ 'scale': {
52
+ 'name': 'DragonScale',
53
+ 'description': 'Commerce Platform - Self-hosted ordering system',
54
+ 'path_env': 'DRAGONSCALE_PATH',
55
+ 'commands': ['setup', 'migrate', 'backup'],
56
+ },
57
+ 'keep': {
58
+ 'name': 'DragonKeep',
59
+ 'description': 'Infrastructure Security - Cloud & container security scanning',
60
+ 'path_env': 'DRAGONKEEP_PATH',
61
+ 'commands': ['scan', 'audit', 'report'],
62
+ },
63
+ }
64
+
65
+
66
+ def print_banner():
67
+ """Print Dragon CLI banner."""
68
+ print(f"\033[32m{DRAGON_ASCII}\033[0m")
69
+ print(f" 🐉 Dragon CLI v{VERSION}")
70
+ print(" Ghost Protocol Security | ghosts.lk\n")
71
+
72
+
73
+ def print_products():
74
+ """Print available products."""
75
+ print("Available Products:\n")
76
+ for key, product in PRODUCTS.items():
77
+ status = "✓ installed" if os.environ.get(product['path_env']) else "○ not configured"
78
+ print(f" \033[36m{key:10}\033[0m {product['name']}")
79
+ print(f" {product['description']}")
80
+ print(f" Status: {status}")
81
+ print()
82
+
83
+
84
+ def run_wyrm(args):
85
+ """Run Wyrm commands."""
86
+ wyrm_path = os.environ.get('WYRM_PATH')
87
+ if not wyrm_path:
88
+ print("Error: WYRM_PATH not set. Please configure Wyrm location.")
89
+ print(" export WYRM_PATH=/path/to/Wyrm")
90
+ return 1
91
+
92
+ cmd = ['npx', 'wyrm'] + args
93
+ return subprocess.call(cmd, cwd=wyrm_path)
94
+
95
+
96
+ def run_pentest(args):
97
+ """Run PhantomDragon commands."""
98
+ pd_path = os.environ.get('PHANTOMDRAGON_PATH')
99
+ if not pd_path:
100
+ print("Error: PHANTOMDRAGON_PATH not set. Please configure PhantomDragon location.")
101
+ print(" export PHANTOMDRAGON_PATH=/path/to/PhantomDragon")
102
+ return 1
103
+
104
+ script = Path(pd_path) / 'phantomdragon.py'
105
+ cmd = [sys.executable, str(script)] + args
106
+ return subprocess.call(cmd)
107
+
108
+
109
+ def run_scale(args):
110
+ """Run DragonScale commands."""
111
+ scale_path = os.environ.get('DRAGONSCALE_PATH')
112
+ if not scale_path:
113
+ print("Error: DRAGONSCALE_PATH not set. Please configure DragonScale location.")
114
+ print(" export DRAGONSCALE_PATH=/path/to/DragonScale")
115
+ return 1
116
+
117
+ # DragonScale is PHP-based
118
+ cmd = ['php'] + args
119
+ return subprocess.call(cmd, cwd=scale_path)
120
+
121
+
122
+ def run_keep(args):
123
+ """Run DragonKeep commands."""
124
+ keep_path = os.environ.get('DRAGONKEEP_PATH')
125
+ if not keep_path:
126
+ print("Error: DragonKeep not yet available.")
127
+ print(" Coming soon: Infrastructure security scanning")
128
+ return 1
129
+
130
+ script = Path(keep_path) / 'dragonkeep.py'
131
+ cmd = [sys.executable, str(script)] + args
132
+ return subprocess.call(cmd)
133
+
134
+
135
+ def main():
136
+ """Main entry point."""
137
+ if len(sys.argv) < 2:
138
+ print_banner()
139
+ print("Usage: dragon <product> [command] [options]\n")
140
+ print_products()
141
+ print("Examples:")
142
+ print(" dragon wyrm serve --port 3333")
143
+ print(" dragon pentest -t https://example.com --profile quick")
144
+ print(" dragon scale setup")
145
+ print(" dragon keep scan --cloud aws")
146
+ print()
147
+ return 0
148
+
149
+ product = sys.argv[1].lower()
150
+ remaining_args = sys.argv[2:]
151
+
152
+ if product in ['--help', '-h']:
153
+ print_banner()
154
+ print("Usage: dragon <product> [command] [options]\n")
155
+ print_products()
156
+ return 0
157
+
158
+ if product in ['--version', '-v']:
159
+ print(f"Dragon CLI v{VERSION}")
160
+ return 0
161
+
162
+ if product == 'wyrm':
163
+ return run_wyrm(remaining_args)
164
+ elif product in ['pentest', 'phantom', 'pd']:
165
+ return run_pentest(remaining_args)
166
+ elif product == 'scale':
167
+ return run_scale(remaining_args)
168
+ elif product == 'keep':
169
+ return run_keep(remaining_args)
170
+ else:
171
+ print(f"Unknown product: {product}")
172
+ print("Available products: wyrm, pentest, scale, keep")
173
+ return 1
174
+
175
+
176
+ if __name__ == '__main__':
177
+ sys.exit(main())
@@ -0,0 +1,57 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <!--
4
+ DragonKeep · macOS LaunchAgent
5
+ Spec: dragon-platform/specs/009-bootstrap-cross-os
6
+
7
+ Install:
8
+ cp lk.ghosts.dragonkeep.plist ~/Library/LaunchAgents/
9
+ launchctl load -w ~/Library/LaunchAgents/lk.ghosts.dragonkeep.plist
10
+ launchctl start lk.ghosts.dragonkeep
11
+
12
+ Uninstall:
13
+ launchctl unload -w ~/Library/LaunchAgents/lk.ghosts.dragonkeep.plist
14
+ rm ~/Library/LaunchAgents/lk.ghosts.dragonkeep.plist
15
+ -->
16
+ <plist version="1.0">
17
+ <dict>
18
+ <key>Label</key>
19
+ <string>lk.ghosts.dragonkeep</string>
20
+
21
+ <key>ProgramArguments</key>
22
+ <array>
23
+ <string>/usr/local/bin/dragonkeep</string>
24
+ <string>monitor</string>
25
+ </array>
26
+
27
+ <key>RunAtLoad</key>
28
+ <true/>
29
+
30
+ <key>KeepAlive</key>
31
+ <dict>
32
+ <key>SuccessfulExit</key>
33
+ <false/>
34
+ <key>NetworkState</key>
35
+ <true/>
36
+ </dict>
37
+
38
+ <key>StandardOutPath</key>
39
+ <string>/tmp/dragonkeep.out.log</string>
40
+
41
+ <key>StandardErrorPath</key>
42
+ <string>/tmp/dragonkeep.err.log</string>
43
+
44
+ <key>ProcessType</key>
45
+ <string>Background</string>
46
+
47
+ <!-- Reset working dir to operator's home so ~/.dragonkeep resolves -->
48
+ <key>WorkingDirectory</key>
49
+ <string>/Users/$USER</string>
50
+
51
+ <key>EnvironmentVariables</key>
52
+ <dict>
53
+ <key>DRAGONKEEP_AUTO_RESTART</key>
54
+ <string>1</string>
55
+ </dict>
56
+ </dict>
57
+ </plist>
@@ -0,0 +1,40 @@
1
+ # DragonKeep · Linux systemd unit
2
+ # Spec: dragon-platform/specs/009-bootstrap-cross-os
3
+ #
4
+ # Install (per-user · recommended):
5
+ # mkdir -p ~/.config/systemd/user
6
+ # cp dragonkeep.service ~/.config/systemd/user/
7
+ # systemctl --user daemon-reload
8
+ # systemctl --user enable --now dragonkeep.service
9
+ #
10
+ # Or system-wide (requires root):
11
+ # sudo cp dragonkeep.service /etc/systemd/system/
12
+ # sudo systemctl daemon-reload
13
+ # sudo systemctl enable --now dragonkeep.service
14
+
15
+ [Unit]
16
+ Description=DragonKeep · defensive security daemon
17
+ Documentation=https://github.com/Ghosts-Protocol-Pvt-Ltd/DragonKeep
18
+ After=network-online.target
19
+ Wants=network-online.target
20
+
21
+ [Service]
22
+ Type=simple
23
+ ExecStart=%h/.local/bin/dragonkeep monitor
24
+ Restart=on-failure
25
+ RestartSec=5s
26
+
27
+ # Hardening
28
+ NoNewPrivileges=true
29
+ ProtectSystem=strict
30
+ ProtectHome=false
31
+ ReadWritePaths=%h/.dragonkeep
32
+
33
+ # Capabilities (eBPF + raw sockets for behavioral_ebpf)
34
+ CapabilityBoundingSet=CAP_BPF CAP_NET_ADMIN CAP_NET_RAW CAP_SYS_PTRACE CAP_DAC_READ_SEARCH
35
+
36
+ # Environment
37
+ Environment=DRAGONKEEP_AUTO_RESTART=1
38
+
39
+ [Install]
40
+ WantedBy=default.target