cyrus-docker 0.1.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.
Files changed (91) hide show
  1. package/LICENSE +190 -0
  2. package/README.md +245 -0
  3. package/dist/Application.d.ts +64 -0
  4. package/dist/Application.d.ts.map +1 -0
  5. package/dist/Application.js +104 -0
  6. package/dist/Application.js.map +1 -0
  7. package/dist/app.d.ts +3 -0
  8. package/dist/app.d.ts.map +1 -0
  9. package/dist/app.js +150 -0
  10. package/dist/app.js.map +1 -0
  11. package/dist/commands/AddRepoCommand.d.ts +11 -0
  12. package/dist/commands/AddRepoCommand.d.ts.map +1 -0
  13. package/dist/commands/AddRepoCommand.js +45 -0
  14. package/dist/commands/AddRepoCommand.js.map +1 -0
  15. package/dist/commands/AuthCommand.d.ts +16 -0
  16. package/dist/commands/AuthCommand.d.ts.map +1 -0
  17. package/dist/commands/AuthCommand.js +85 -0
  18. package/dist/commands/AuthCommand.js.map +1 -0
  19. package/dist/commands/BuildCommand.d.ts +21 -0
  20. package/dist/commands/BuildCommand.d.ts.map +1 -0
  21. package/dist/commands/BuildCommand.js +65 -0
  22. package/dist/commands/BuildCommand.js.map +1 -0
  23. package/dist/commands/ICommand.d.ts +37 -0
  24. package/dist/commands/ICommand.d.ts.map +1 -0
  25. package/dist/commands/ICommand.js +46 -0
  26. package/dist/commands/ICommand.js.map +1 -0
  27. package/dist/commands/InitCommand.d.ts +21 -0
  28. package/dist/commands/InitCommand.d.ts.map +1 -0
  29. package/dist/commands/InitCommand.js +209 -0
  30. package/dist/commands/InitCommand.js.map +1 -0
  31. package/dist/commands/LogsCommand.d.ts +11 -0
  32. package/dist/commands/LogsCommand.d.ts.map +1 -0
  33. package/dist/commands/LogsCommand.js +35 -0
  34. package/dist/commands/LogsCommand.js.map +1 -0
  35. package/dist/commands/ShellCommand.d.ts +8 -0
  36. package/dist/commands/ShellCommand.d.ts.map +1 -0
  37. package/dist/commands/ShellCommand.js +30 -0
  38. package/dist/commands/ShellCommand.js.map +1 -0
  39. package/dist/commands/StartCommand.d.ts +19 -0
  40. package/dist/commands/StartCommand.d.ts.map +1 -0
  41. package/dist/commands/StartCommand.js +147 -0
  42. package/dist/commands/StartCommand.js.map +1 -0
  43. package/dist/commands/StatusCommand.d.ts +8 -0
  44. package/dist/commands/StatusCommand.d.ts.map +1 -0
  45. package/dist/commands/StatusCommand.js +89 -0
  46. package/dist/commands/StatusCommand.js.map +1 -0
  47. package/dist/commands/StopCommand.d.ts +8 -0
  48. package/dist/commands/StopCommand.d.ts.map +1 -0
  49. package/dist/commands/StopCommand.js +45 -0
  50. package/dist/commands/StopCommand.js.map +1 -0
  51. package/dist/commands/ToolsCommand.d.ts +18 -0
  52. package/dist/commands/ToolsCommand.d.ts.map +1 -0
  53. package/dist/commands/ToolsCommand.js +158 -0
  54. package/dist/commands/ToolsCommand.js.map +1 -0
  55. package/dist/config/constants.d.ts +38 -0
  56. package/dist/config/constants.d.ts.map +1 -0
  57. package/dist/config/constants.js +100 -0
  58. package/dist/config/constants.js.map +1 -0
  59. package/dist/config/types.d.ts +142 -0
  60. package/dist/config/types.d.ts.map +1 -0
  61. package/dist/config/types.js +2 -0
  62. package/dist/config/types.js.map +1 -0
  63. package/dist/services/DockerService.d.ts +119 -0
  64. package/dist/services/DockerService.d.ts.map +1 -0
  65. package/dist/services/DockerService.js +371 -0
  66. package/dist/services/DockerService.js.map +1 -0
  67. package/dist/services/Logger.d.ts +64 -0
  68. package/dist/services/Logger.d.ts.map +1 -0
  69. package/dist/services/Logger.js +118 -0
  70. package/dist/services/Logger.js.map +1 -0
  71. package/dist/services/StateService.d.ts +68 -0
  72. package/dist/services/StateService.d.ts.map +1 -0
  73. package/dist/services/StateService.js +137 -0
  74. package/dist/services/StateService.js.map +1 -0
  75. package/dist/services/ToolConfigService.d.ts +66 -0
  76. package/dist/services/ToolConfigService.d.ts.map +1 -0
  77. package/dist/services/ToolConfigService.js +201 -0
  78. package/dist/services/ToolConfigService.js.map +1 -0
  79. package/dist/services/TunnelService.d.ts +43 -0
  80. package/dist/services/TunnelService.d.ts.map +1 -0
  81. package/dist/services/TunnelService.js +129 -0
  82. package/dist/services/TunnelService.js.map +1 -0
  83. package/docker/.env.docker +73 -0
  84. package/docker/.env.docker.example +71 -0
  85. package/docker/Dockerfile +62 -0
  86. package/docker/Dockerfile.custom +18 -0
  87. package/docker/Dockerfile.dev +78 -0
  88. package/docker/docker-compose.yml +59 -0
  89. package/docker/entrypoint.sh +209 -0
  90. package/docker/healthcheck.sh +23 -0
  91. package/package.json +75 -0
package/LICENSE ADDED
@@ -0,0 +1,190 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to the Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ Copyright 2025 tjorri
179
+
180
+ Licensed under the Apache License, Version 2.0 (the "License");
181
+ you may not use this file except in compliance with the License.
182
+ You may obtain a copy of the License at
183
+
184
+ http://www.apache.org/licenses/LICENSE-2.0
185
+
186
+ Unless required by applicable law or agreed to in writing, software
187
+ distributed under the License is distributed on an "AS IS" BASIS,
188
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
189
+ See the License for the specific language governing permissions and
190
+ limitations under the License.
package/README.md ADDED
@@ -0,0 +1,245 @@
1
+ # cyrus-docker
2
+
3
+ A CLI tool for managing Docker-based [Cyrus](https://github.com/ceedaragents/cyrus) deployments with automatic ngrok tunnel management.
4
+
5
+ Cyrus is an AI agent that integrates Linear's issue tracking with Claude Code to automate software development tasks. This tool simplifies running Cyrus in a Docker container with all the necessary infrastructure.
6
+
7
+ ## Prerequisites
8
+
9
+ - [Docker](https://docs.docker.com/get-docker/) (with Docker Compose)
10
+ - [ngrok](https://ngrok.com/download) (for exposing Cyrus to Linear webhooks)
11
+ - [Node.js](https://nodejs.org/) 18+
12
+
13
+ ## Installation
14
+
15
+ ```bash
16
+ npm install -g cyrus-docker
17
+ ```
18
+
19
+ Or install from source:
20
+
21
+ ```bash
22
+ git clone https://github.com/tjorri/cyrus-docker.git
23
+ cd cyrus-docker
24
+ npm install
25
+ npm run build
26
+ npm link
27
+ ```
28
+
29
+ ## Quick Start
30
+
31
+ ```bash
32
+ # 1. Run the setup wizard
33
+ cyrus-docker init
34
+
35
+ # 2. Start Cyrus (launches ngrok + Docker container)
36
+ cyrus-docker start
37
+
38
+ # 3. Configure Linear OAuth app with the URLs shown
39
+ # Go to: linear.app/settings/api/applications
40
+ # Set Callback URL and Webhook URL
41
+
42
+ # 4. Authenticate with Linear
43
+ cyrus-docker auth
44
+
45
+ # 5. Add a repository
46
+ cyrus-docker add-repo https://github.com/your/repo.git
47
+ ```
48
+
49
+ ## Commands
50
+
51
+ | Command | Description |
52
+ |---------|-------------|
53
+ | `cyrus-docker init` | Interactive setup wizard for credentials |
54
+ | `cyrus-docker start [-d] [-b]` | Start ngrok tunnel and Docker container |
55
+ | `cyrus-docker stop` | Stop container and tunnel |
56
+ | `cyrus-docker status` | Show container and tunnel status |
57
+ | `cyrus-docker logs [-f]` | Show container logs (`-f` to follow) |
58
+ | `cyrus-docker shell` | Open bash shell in the container |
59
+ | `cyrus-docker auth` | Run Linear OAuth authentication |
60
+ | `cyrus-docker add-repo <url>` | Add a repository to Cyrus |
61
+ | `cyrus-docker tools` | Configure development tools in the container |
62
+ | `cyrus-docker build [-f]` | Build the Docker image (for debugging/CI) |
63
+
64
+ ### Start Options
65
+
66
+ - `-d, --detach` - Run in detached mode (don't follow logs)
67
+ - `-b, --build` - Force rebuild of the Docker image
68
+
69
+ ### Build Options
70
+
71
+ - `-f, --force` - Force rebuild even if image is up-to-date
72
+
73
+ ## Configuration
74
+
75
+ The `init` command creates a `.env.docker` file with your credentials:
76
+
77
+ | Variable | Required | Description |
78
+ |----------|----------|-------------|
79
+ | `ANTHROPIC_API_KEY` | Yes* | Anthropic API key (from console.anthropic.com) |
80
+ | `CLAUDE_CODE_OAUTH_TOKEN` | Yes* | Claude Code OAuth token (alternative to API key) |
81
+ | `LINEAR_CLIENT_ID` | Yes | Linear OAuth app client ID |
82
+ | `LINEAR_CLIENT_SECRET` | Yes | Linear OAuth app client secret |
83
+ | `LINEAR_WEBHOOK_SECRET` | Recommended | Secret for webhook verification |
84
+ | `GIT_USER_NAME` | Optional | Git commit author name |
85
+ | `GIT_USER_EMAIL` | Optional | Git commit author email |
86
+ | `GITHUB_TOKEN` | Optional | For private repo access |
87
+ | `NGROK_AUTHTOKEN` | Optional | ngrok authentication token |
88
+
89
+ *One of `ANTHROPIC_API_KEY` or `CLAUDE_CODE_OAUTH_TOKEN` is required.
90
+
91
+ ### Linear OAuth Setup
92
+
93
+ 1. Go to [Linear API Applications](https://linear.app/settings/api/applications)
94
+ 2. Create a new OAuth application
95
+ 3. After running `cyrus-docker start`, set:
96
+ - **Callback URL**: `https://<your-ngrok-url>/callback`
97
+ - **Webhook URL**: `https://<your-ngrok-url>/webhook`
98
+
99
+ ### Container Tools Configuration
100
+
101
+ Customize development tools in the container without Docker expertise using `cyrus-docker tools`.
102
+
103
+ #### Using the wizard
104
+
105
+ ```bash
106
+ $ cyrus-docker tools
107
+ ? Select tool presets:
108
+ [x] Python - Python 3, pip, venv, pytest, black, ruff
109
+ [ ] Rust - Rust toolchain + cargo
110
+ [x] AWS CLI - AWS CLI v2
111
+ ? Additional APT packages? vim, tree
112
+ Configuration saved to ~/.cyrus-docker/tools.yml
113
+
114
+ $ cyrus-docker start
115
+ Building custom image with tools...
116
+ ```
117
+
118
+ #### Available presets
119
+
120
+ | Preset | Description |
121
+ |--------|-------------|
122
+ | `python` | Python 3, pip, venv, pytest, black, ruff |
123
+ | `rust` | Rust toolchain + cargo |
124
+ | `go` | Go programming language |
125
+ | `ruby` | Ruby + Bundler |
126
+ | `java` | OpenJDK 17 + Maven |
127
+ | `aws` | AWS CLI v2 |
128
+ | `k8s` | kubectl + helm |
129
+ | `terraform` | HashiCorp Terraform |
130
+
131
+ #### Manual configuration
132
+
133
+ Edit `~/.cyrus-docker/tools.yml` directly for advanced options:
134
+
135
+ ```yaml
136
+ presets:
137
+ - python
138
+ - rust
139
+ apt:
140
+ - vim
141
+ - htop
142
+ npm:
143
+ - typescript
144
+ pip:
145
+ - poetry
146
+ ```
147
+
148
+ Configuration is applied automatically when running `cyrus-docker start`.
149
+
150
+ #### Smart Image Caching
151
+
152
+ The CLI automatically detects when a rebuild is needed by hashing your tools configuration:
153
+
154
+ - **First run**: Builds the image with your configured tools
155
+ - **Subsequent runs**: Skips build if configuration hasn't changed
156
+ - **Configuration changed**: Automatically rebuilds with new tools
157
+ - **Force rebuild**: Use `cyrus-docker start --build` or `cyrus-docker build --force`
158
+
159
+ ## How It Works
160
+
161
+ 1. **`cyrus-docker start`** launches an ngrok tunnel on port 3456
162
+ 2. The tunnel URL is written to `.env.docker` as `CYRUS_BASE_URL`
163
+ 3. Docker Compose builds and starts the Cyrus container
164
+ 4. The container runs `cyrus start` which listens for Linear webhooks
165
+ 5. When issues are assigned to Cyrus in Linear, it processes them with Claude
166
+
167
+ ## Data Storage
168
+
169
+ - **State**: `~/.cyrus-docker/state.json` - CLI state (tunnel PID, URLs)
170
+ - **Cyrus Data**: `~/.cyrus/` - Mounted into container (repos, config, logs)
171
+ - **SSH Keys**: `~/.ssh/` - Mounted read-only for git operations
172
+
173
+ ## Troubleshooting
174
+
175
+ ### Container health check fails
176
+ The container may take up to 60 seconds to become healthy. Check logs:
177
+ ```bash
178
+ cyrus-docker logs -f
179
+ ```
180
+
181
+ ### ngrok tunnel not starting
182
+ Ensure no other ngrok process is running:
183
+ ```bash
184
+ pkill ngrok
185
+ cyrus-docker start
186
+ ```
187
+
188
+ ### Permission errors with git
189
+ Ensure your SSH keys are accessible and have correct permissions:
190
+ ```bash
191
+ chmod 700 ~/.ssh
192
+ chmod 600 ~/.ssh/id_*
193
+ ```
194
+
195
+ ## Contributing
196
+
197
+ ### Commit Convention
198
+
199
+ This project uses [Conventional Commits](https://www.conventionalcommits.org/) to automate versioning and changelog generation.
200
+
201
+ Format: `<type>: <description>`
202
+
203
+ | Type | Description | Version Bump |
204
+ |------|-------------|--------------|
205
+ | `fix` | Bug fixes | Patch (0.0.x) |
206
+ | `feat` | New features | Minor (0.x.0) |
207
+ | `feat!` | Breaking changes | Major (x.0.0) |
208
+ | `docs` | Documentation only | No release |
209
+ | `chore` | Maintenance tasks | No release |
210
+ | `refactor` | Code refactoring | No release |
211
+ | `test` | Adding/updating tests | No release |
212
+
213
+ Examples:
214
+ ```bash
215
+ git commit -m "fix: resolve tunnel connection timeout"
216
+ git commit -m "feat: add support for custom ports"
217
+ git commit -m "feat!: change config file format"
218
+ ```
219
+
220
+ ### Development
221
+
222
+ ```bash
223
+ git clone https://github.com/tjorri/cyrus-docker.git
224
+ cd cyrus-docker
225
+ npm install
226
+ npm run dev # Watch mode
227
+ npm run test # Run tests
228
+ npm run typecheck
229
+ ```
230
+
231
+ ## Release Process
232
+
233
+ Releases are automated via [semantic-release](https://github.com/semantic-release/semantic-release) when changes are merged to `main`:
234
+
235
+ 1. Commits are analyzed to determine the next version
236
+ 2. `CHANGELOG.md` is generated/updated
237
+ 3. `package.json` version is bumped
238
+ 4. A git tag and GitHub release are created
239
+ 5. The package is published to npm
240
+
241
+ No manual version bumping is required.
242
+
243
+ ## License
244
+
245
+ Apache-2.0 - see [LICENSE](LICENSE) for details.
@@ -0,0 +1,64 @@
1
+ import { DockerService } from "./services/DockerService.js";
2
+ import { Logger } from "./services/Logger.js";
3
+ import { StateService } from "./services/StateService.js";
4
+ import { TunnelService } from "./services/TunnelService.js";
5
+ /**
6
+ * Main application context for cyrus-docker CLI
7
+ * Provides access to services and shared configuration
8
+ */
9
+ export declare class Application {
10
+ readonly logger: Logger;
11
+ readonly state: StateService;
12
+ readonly tunnel: TunnelService;
13
+ readonly docker: DockerService;
14
+ readonly version: string;
15
+ readonly dockerDir: string;
16
+ constructor(version: string);
17
+ /**
18
+ * Resolve the path to the bundled docker directory
19
+ * When installed via npm, this will be in the package's docker/ folder
20
+ */
21
+ private resolveDockerDir;
22
+ /**
23
+ * Get a docker service with a custom docker directory
24
+ * Useful when user wants to use a different docker setup
25
+ */
26
+ getDockerService(customDir?: string): DockerService;
27
+ /**
28
+ * Check prerequisites for running cyrus-docker
29
+ */
30
+ checkPrerequisites(): Promise<{
31
+ docker: boolean;
32
+ dockerCompose: boolean;
33
+ ngrok: boolean;
34
+ }>;
35
+ /**
36
+ * Check if ngrok is installed
37
+ */
38
+ private checkNgrok;
39
+ /**
40
+ * Print prerequisite status
41
+ */
42
+ printPrerequisiteStatus(prereqs: {
43
+ docker: boolean;
44
+ dockerCompose: boolean;
45
+ ngrok: boolean;
46
+ }): void;
47
+ /**
48
+ * Check if all prerequisites are met
49
+ */
50
+ allPrerequisitesMet(prereqs: {
51
+ docker: boolean;
52
+ dockerCompose: boolean;
53
+ ngrok: boolean;
54
+ }): boolean;
55
+ /**
56
+ * Print missing prerequisites instructions
57
+ */
58
+ printMissingPrerequisites(prereqs: {
59
+ docker: boolean;
60
+ dockerCompose: boolean;
61
+ ngrok: boolean;
62
+ }): void;
63
+ }
64
+ //# sourceMappingURL=Application.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.d.ts","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"AAGA,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAC5D,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AAC1D,OAAO,EAAE,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAE5D;;;GAGG;AACH,qBAAa,WAAW;IACvB,SAAgB,MAAM,EAAE,MAAM,CAAC;IAC/B,SAAgB,KAAK,EAAE,YAAY,CAAC;IACpC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,MAAM,EAAE,aAAa,CAAC;IACtC,SAAgB,OAAO,EAAE,MAAM,CAAC;IAChC,SAAgB,SAAS,EAAE,MAAM,CAAC;gBAEtB,OAAO,EAAE,MAAM;IAa3B;;;OAGG;IACH,OAAO,CAAC,gBAAgB;IAgBxB;;;OAGG;IACH,gBAAgB,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,aAAa;IAInD;;OAEG;IACG,kBAAkB,IAAI,OAAO,CAAC;QACnC,MAAM,EAAE,OAAO,CAAC;QAChB,aAAa,EAAE,OAAO,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC;KACf,CAAC;IAQF;;OAEG;YACW,UAAU;IAUxB;;OAEG;IACH,uBAAuB,CAAC,OAAO,EAAE;QAChC,MAAM,EAAE,OAAO,CAAC;QAChB,aAAa,EAAE,OAAO,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC;KACf,GAAG,IAAI;IAQR;;OAEG;IACH,mBAAmB,CAAC,OAAO,EAAE;QAC5B,MAAM,EAAE,OAAO,CAAC;QAChB,aAAa,EAAE,OAAO,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC;KACf,GAAG,OAAO;IAIX;;OAEG;IACH,yBAAyB,CAAC,OAAO,EAAE;QAClC,MAAM,EAAE,OAAO,CAAC;QAChB,aAAa,EAAE,OAAO,CAAC;QACvB,KAAK,EAAE,OAAO,CAAC;KACf,GAAG,IAAI;CAUR"}
@@ -0,0 +1,104 @@
1
+ import { existsSync } from "node:fs";
2
+ import { dirname, join } from "node:path";
3
+ import { fileURLToPath } from "node:url";
4
+ import { DockerService } from "./services/DockerService.js";
5
+ import { Logger } from "./services/Logger.js";
6
+ import { StateService } from "./services/StateService.js";
7
+ import { TunnelService } from "./services/TunnelService.js";
8
+ /**
9
+ * Main application context for cyrus-docker CLI
10
+ * Provides access to services and shared configuration
11
+ */
12
+ export class Application {
13
+ logger;
14
+ state;
15
+ tunnel;
16
+ docker;
17
+ version;
18
+ dockerDir;
19
+ constructor(version) {
20
+ this.logger = new Logger();
21
+ this.version = version;
22
+ // Resolve the bundled docker directory
23
+ this.dockerDir = this.resolveDockerDir();
24
+ // Initialize services
25
+ this.state = new StateService(this.logger);
26
+ this.tunnel = new TunnelService(this.logger);
27
+ this.docker = new DockerService(this.dockerDir, this.logger);
28
+ }
29
+ /**
30
+ * Resolve the path to the bundled docker directory
31
+ * When installed via npm, this will be in the package's docker/ folder
32
+ */
33
+ resolveDockerDir() {
34
+ // Get the directory of the current module
35
+ const __filename = fileURLToPath(import.meta.url);
36
+ const __dirname = dirname(__filename);
37
+ // When compiled: dist/Application.js -> go up to package root -> docker/
38
+ const packageRoot = join(__dirname, "..");
39
+ const dockerDir = join(packageRoot, "docker");
40
+ if (existsSync(dockerDir)) {
41
+ return dockerDir;
42
+ }
43
+ throw new Error(`Docker directory not found. Expected at: ${dockerDir}`);
44
+ }
45
+ /**
46
+ * Get a docker service with a custom docker directory
47
+ * Useful when user wants to use a different docker setup
48
+ */
49
+ getDockerService(customDir) {
50
+ return customDir ? new DockerService(customDir, this.logger) : this.docker;
51
+ }
52
+ /**
53
+ * Check prerequisites for running cyrus-docker
54
+ */
55
+ async checkPrerequisites() {
56
+ const docker = await this.docker.checkDocker();
57
+ const dockerCompose = await this.docker.checkDockerCompose();
58
+ const ngrok = await this.checkNgrok();
59
+ return { docker, dockerCompose, ngrok };
60
+ }
61
+ /**
62
+ * Check if ngrok is installed
63
+ */
64
+ async checkNgrok() {
65
+ try {
66
+ const { execa } = await import("execa");
67
+ await execa("which", ["ngrok"], { stdio: "pipe" });
68
+ return true;
69
+ }
70
+ catch {
71
+ return false;
72
+ }
73
+ }
74
+ /**
75
+ * Print prerequisite status
76
+ */
77
+ printPrerequisiteStatus(prereqs) {
78
+ this.logger.header("Prerequisites");
79
+ this.logger.status("Docker", prereqs.docker);
80
+ this.logger.status("Docker Compose", prereqs.dockerCompose);
81
+ this.logger.status("ngrok", prereqs.ngrok);
82
+ this.logger.blank();
83
+ }
84
+ /**
85
+ * Check if all prerequisites are met
86
+ */
87
+ allPrerequisitesMet(prereqs) {
88
+ return prereqs.docker && prereqs.dockerCompose && prereqs.ngrok;
89
+ }
90
+ /**
91
+ * Print missing prerequisites instructions
92
+ */
93
+ printMissingPrerequisites(prereqs) {
94
+ if (!prereqs.docker || !prereqs.dockerCompose) {
95
+ this.logger.error("Docker is not installed or not running");
96
+ this.logger.raw(" Install from: https://docs.docker.com/get-docker/");
97
+ }
98
+ if (!prereqs.ngrok) {
99
+ this.logger.error("ngrok is not installed");
100
+ this.logger.raw(" Install from: https://ngrok.com/download");
101
+ }
102
+ }
103
+ }
104
+ //# sourceMappingURL=Application.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Application.js","sourceRoot":"","sources":["../src/Application.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAC1C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,aAAa,EAAE,M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AK,CAAC,CAAC;QAC3C,IAAI,CAAC,MAAM,CAAC,KAAK,EAAE,CAAC;IACrB,CAAC;IAED;;OAEG;IACH,mBAAmB,CAAC,OAInB;QACA,OAAO,OAAO,CAAC,MAAM,IAAI,OAAO,CAAC,aAAa,IAAI,OAAO,CAAC,KAAK,CAAC;IACjE,CAAC;IAED;;OAEG;IACH,yBAAyB,CAAC,OAIzB;QACA,IAAI,CAAC,OAAO,CAAC,MAAM,IAAI,CAAC,OAAO,CAAC,aAAa,EAAE,CAAC;YAC/C,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wCAAwC,CAAC,CAAC;YAC5D,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,qDAAqD,CAAC,CAAC;QACxE,CAAC;QACD,IAAI,CAAC,OAAO,CAAC,KAAK,EAAE,CAAC;YACpB,IAAI,CAAC,MAAM,CAAC,KAAK,CAAC,wBAAwB,CAAC,CAAC;YAC5C,IAAI,CAAC,MAAM,CAAC,GAAG,CAAC,4CAA4C,CAAC,CAAC;QAC/D,CAAC;IACF,CAAC;CACD"}
package/dist/app.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ #!/usr/bin/env node
2
+ export {};
3
+ //# sourceMappingURL=app.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"app.d.ts","sourceRoot":"","sources":["../src/app.ts"],"names":[],"mappings":""}