hostdev 0.2.0__tar.gz
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.
- hostdev-0.2.0/.claude-plugin/marketplace.json +14 -0
- hostdev-0.2.0/.claude-plugin/plugin.json +9 -0
- hostdev-0.2.0/.github/workflows/publish.yml +103 -0
- hostdev-0.2.0/.gitignore +8 -0
- hostdev-0.2.0/CHANGELOG.md +40 -0
- hostdev-0.2.0/LICENSE +201 -0
- hostdev-0.2.0/PKG-INFO +170 -0
- hostdev-0.2.0/README.md +151 -0
- hostdev-0.2.0/pyproject.toml +42 -0
- hostdev-0.2.0/skills/hostdev/SKILL.md +96 -0
- hostdev-0.2.0/skills/hostdev/scripts/hostdev.py +12 -0
- hostdev-0.2.0/src/hostdev/__init__.py +1 -0
- hostdev-0.2.0/src/hostdev/__main__.py +6 -0
- hostdev-0.2.0/src/hostdev/airdrop.swift +16 -0
- hostdev-0.2.0/src/hostdev/cli.py +85 -0
- hostdev-0.2.0/src/hostdev/core.py +345 -0
- hostdev-0.2.0/src/hostdev/interactive.py +129 -0
- hostdev-0.2.0/src/hostdev/mdns.py +71 -0
- hostdev-0.2.0/src/hostdev/py.typed +0 -0
- hostdev-0.2.0/tests/conftest.py +43 -0
- hostdev-0.2.0/tests/test_hostdev.py +112 -0
- hostdev-0.2.0/tests/test_interactive.py +50 -0
- hostdev-0.2.0/tests/test_names.py +36 -0
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "hostdev",
|
|
3
|
+
"description": "Serve local development servers at https://<name>.localhost and on the LAN, through Caddy, with no port to remember.",
|
|
4
|
+
"owner": {
|
|
5
|
+
"name": "Giovanni Porcari"
|
|
6
|
+
},
|
|
7
|
+
"plugins": [
|
|
8
|
+
{
|
|
9
|
+
"name": "hostdev",
|
|
10
|
+
"source": "./",
|
|
11
|
+
"description": "Serve local development servers at https://<name>.localhost and on the LAN, through Caddy, with no port to remember."
|
|
12
|
+
}
|
|
13
|
+
]
|
|
14
|
+
}
|
|
@@ -0,0 +1,103 @@
|
|
|
1
|
+
name: Publish to PyPI
|
|
2
|
+
|
|
3
|
+
"on":
|
|
4
|
+
push:
|
|
5
|
+
tags:
|
|
6
|
+
- 'v*' # Trigger on version tags (v0.20.0, v1.0.0, etc.)
|
|
7
|
+
workflow_dispatch: # Allow manual trigger
|
|
8
|
+
|
|
9
|
+
jobs:
|
|
10
|
+
build:
|
|
11
|
+
name: Build distribution
|
|
12
|
+
runs-on: ubuntu-latest
|
|
13
|
+
steps:
|
|
14
|
+
- uses: actions/checkout@v4
|
|
15
|
+
|
|
16
|
+
# Before PyPI: a tag without its CHANGELOG.md section stops here.
|
|
17
|
+
- name: Extract the changelog section of the tag
|
|
18
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
19
|
+
run: |
|
|
20
|
+
version="${GITHUB_REF_NAME#v}"
|
|
21
|
+
awk -v v="$version" '$0 ~ "^## \\[" v "\\]" {on=1; next}
|
|
22
|
+
on && /^## \[/ {exit} on {print}' CHANGELOG.md > "$RUNNER_TEMP/release-notes.md"
|
|
23
|
+
test -s "$RUNNER_TEMP/release-notes.md" || { echo "CHANGELOG.md has no section for $version"; exit 1; }
|
|
24
|
+
|
|
25
|
+
# Outside the checkout, so the sdist does not pick it up.
|
|
26
|
+
- name: Upload the release notes
|
|
27
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
28
|
+
uses: actions/upload-artifact@v4
|
|
29
|
+
with:
|
|
30
|
+
name: release-notes
|
|
31
|
+
path: ${{ runner.temp }}/release-notes.md
|
|
32
|
+
|
|
33
|
+
- name: Set up Python
|
|
34
|
+
uses: actions/setup-python@v5
|
|
35
|
+
with:
|
|
36
|
+
python-version: '3.11'
|
|
37
|
+
|
|
38
|
+
- name: Install build dependencies
|
|
39
|
+
run: |
|
|
40
|
+
python -m pip install --upgrade pip
|
|
41
|
+
pip install build
|
|
42
|
+
|
|
43
|
+
- name: Build package
|
|
44
|
+
run: python -m build
|
|
45
|
+
|
|
46
|
+
- name: Upload distribution artifacts
|
|
47
|
+
uses: actions/upload-artifact@v4
|
|
48
|
+
with:
|
|
49
|
+
name: python-package-distributions
|
|
50
|
+
path: dist/
|
|
51
|
+
|
|
52
|
+
publish-to-pypi:
|
|
53
|
+
name: Publish to PyPI
|
|
54
|
+
needs: build
|
|
55
|
+
runs-on: ubuntu-latest
|
|
56
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
57
|
+
environment:
|
|
58
|
+
name: release
|
|
59
|
+
url: https://pypi.org/p/hostdev
|
|
60
|
+
permissions:
|
|
61
|
+
id-token: write # REQUIRED for Trusted Publisher
|
|
62
|
+
|
|
63
|
+
steps:
|
|
64
|
+
- name: Download distribution artifacts
|
|
65
|
+
uses: actions/download-artifact@v4
|
|
66
|
+
with:
|
|
67
|
+
name: python-package-distributions
|
|
68
|
+
path: dist/
|
|
69
|
+
|
|
70
|
+
- name: Publish to PyPI
|
|
71
|
+
uses: pypa/gh-action-pypi-publish@release/v1
|
|
72
|
+
|
|
73
|
+
github-release:
|
|
74
|
+
name: Create GitHub Release
|
|
75
|
+
needs: publish-to-pypi
|
|
76
|
+
runs-on: ubuntu-latest
|
|
77
|
+
if: startsWith(github.ref, 'refs/tags/v')
|
|
78
|
+
permissions:
|
|
79
|
+
contents: write # REQUIRED to create releases
|
|
80
|
+
|
|
81
|
+
steps:
|
|
82
|
+
- uses: actions/checkout@v4
|
|
83
|
+
|
|
84
|
+
- name: Download distribution artifacts
|
|
85
|
+
uses: actions/download-artifact@v4
|
|
86
|
+
with:
|
|
87
|
+
name: python-package-distributions
|
|
88
|
+
path: dist/
|
|
89
|
+
|
|
90
|
+
- name: Download the release notes
|
|
91
|
+
uses: actions/download-artifact@v4
|
|
92
|
+
with:
|
|
93
|
+
name: release-notes
|
|
94
|
+
|
|
95
|
+
- name: Create GitHub Release
|
|
96
|
+
env:
|
|
97
|
+
GITHUB_TOKEN: ${{ github.token }}
|
|
98
|
+
run: |
|
|
99
|
+
gh release create '${{ github.ref_name }}' \
|
|
100
|
+
--repo='${{ github.repository }}' \
|
|
101
|
+
--title='${{ github.ref_name }}' \
|
|
102
|
+
--notes-file=release-notes.md \
|
|
103
|
+
dist/*
|
hostdev-0.2.0/.gitignore
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
# Changelog
|
|
2
|
+
|
|
3
|
+
All notable changes to this project are documented in this file.
|
|
4
|
+
|
|
5
|
+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.1.0/),
|
|
6
|
+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
7
|
+
|
|
8
|
+
## [Unreleased]
|
|
9
|
+
|
|
10
|
+
## [0.2.0] - 2026-12-03
|
|
11
|
+
|
|
12
|
+
### Changed
|
|
13
|
+
|
|
14
|
+
- **Breaking:** the name is `hostdev`, no longer `devhost`: the command, the plugin and the
|
|
15
|
+
skill. Install the plugin again as `hostdev@hostdev`.
|
|
16
|
+
- **Breaking:** the state folder is `~/.local/state/hostdev/`. Stop each application with
|
|
17
|
+
the old version before the upgrade, then run `hostdev setup`: it adds the new import
|
|
18
|
+
line to the Caddyfile. Remove the old import line of `devhost` by hand.
|
|
19
|
+
- **Breaking:** the script `skills/devhost/scripts/devhost.py` is removed. The launcher of
|
|
20
|
+
the plugin is `skills/hostdev/scripts/hostdev.py`.
|
|
21
|
+
- `setup` does each pending step: it installs Caddy, adds the import line and starts the
|
|
22
|
+
Caddy service.
|
|
23
|
+
- `check` gives the `pending` steps in place of one flag for each step.
|
|
24
|
+
- `list` gives `lan_url` and `log` for each host, and the `url` has the path of the page.
|
|
25
|
+
|
|
26
|
+
### Added
|
|
27
|
+
|
|
28
|
+
- `hostdev` is a Python package with the `hostdev` command.
|
|
29
|
+
- `start --lan` and `lan HOST on|off`: a second name `<name>.local` for the devices of the
|
|
30
|
+
local network, published through mDNS.
|
|
31
|
+
- `ca`: send the root certificate of the local CA of Caddy to an iPhone with AirDrop.
|
|
32
|
+
- `start --port PORT -- COMMAND`: start a command with no `launch.json`.
|
|
33
|
+
- `hostdev` with no argument: an interactive menu.
|
|
34
|
+
|
|
35
|
+
## [0.1.0]
|
|
36
|
+
|
|
37
|
+
### Added
|
|
38
|
+
|
|
39
|
+
- `start`, `stop`, `list`, `check` and `setup` for local servers at
|
|
40
|
+
`https://<name>.localhost` through Caddy.
|
hostdev-0.2.0/LICENSE
ADDED
|
@@ -0,0 +1,201 @@
|
|
|
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 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" 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 Support. 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
|
+
APPENDIX: How to apply the Apache License to your work.
|
|
179
|
+
|
|
180
|
+
To apply the Apache License to your work, attach the following
|
|
181
|
+
boilerplate notice, with the fields enclosed by brackets "[]"
|
|
182
|
+
replaced with your own identifying information. (Don't include
|
|
183
|
+
the brackets!) The text should be enclosed in the appropriate
|
|
184
|
+
comment syntax for the file format. We also recommend that a
|
|
185
|
+
file or class name and description of purpose be included on the
|
|
186
|
+
same "printed page" as the copyright notice for easier
|
|
187
|
+
identification within third-party archives.
|
|
188
|
+
|
|
189
|
+
Copyright 2026 Giovanni Porcari
|
|
190
|
+
|
|
191
|
+
Licensed under the Apache License, Version 2.0 (the "License");
|
|
192
|
+
you may not use this file except in compliance with the License.
|
|
193
|
+
You may obtain a copy of the License at
|
|
194
|
+
|
|
195
|
+
http://www.apache.org/licenses/LICENSE-2.0
|
|
196
|
+
|
|
197
|
+
Unless required by applicable law or agreed to in writing, software
|
|
198
|
+
distributed under the License is distributed on an "AS IS" BASIS,
|
|
199
|
+
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
200
|
+
See the License for the specific language governing permissions and
|
|
201
|
+
limitations under the License.
|
hostdev-0.2.0/PKG-INFO
ADDED
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: hostdev
|
|
3
|
+
Version: 0.2.0
|
|
4
|
+
Summary: Serve local development servers at https://<name>.localhost and on the LAN, through Caddy.
|
|
5
|
+
Project-URL: Repository, https://github.com/genro/hostdev
|
|
6
|
+
Author: Giovanni Porcari
|
|
7
|
+
License-Expression: Apache-2.0
|
|
8
|
+
License-File: LICENSE
|
|
9
|
+
Keywords: caddy,development,https,localhost,mdns
|
|
10
|
+
Classifier: Development Status :: 4 - Beta
|
|
11
|
+
Classifier: Environment :: Console
|
|
12
|
+
Classifier: Intended Audience :: Developers
|
|
13
|
+
Classifier: Operating System :: MacOS
|
|
14
|
+
Classifier: Programming Language :: Python :: 3
|
|
15
|
+
Classifier: Topic :: Software Development
|
|
16
|
+
Classifier: Typing :: Typed
|
|
17
|
+
Requires-Python: >=3.9
|
|
18
|
+
Description-Content-Type: text/markdown
|
|
19
|
+
|
|
20
|
+
# hostdev
|
|
21
|
+
|
|
22
|
+
Serve local development servers at `https://<name>.localhost`, and on the local network at
|
|
23
|
+
`https://<name>.local`.
|
|
24
|
+
|
|
25
|
+
Start a project and get a link such as `https://myapp.localhost/app/`. You never choose or
|
|
26
|
+
remember a port. Several instances of the same project get their own host:
|
|
27
|
+
`https://v1.myapp.localhost/`. With `--lan`, a phone on the same Wi-Fi opens
|
|
28
|
+
`https://myapp.local/app/`.
|
|
29
|
+
|
|
30
|
+
hostdev is a command for the terminal and a plugin for Claude Code.
|
|
31
|
+
|
|
32
|
+
Requirements: macOS, Homebrew, Python 3.9 or later.
|
|
33
|
+
|
|
34
|
+
## How it works
|
|
35
|
+
|
|
36
|
+
- The start command of a project is in its `.claude/launch.json`: `runtimeExecutable`,
|
|
37
|
+
`runtimeArgs`, `port` and `path` (the page to open). You can also give the command on
|
|
38
|
+
the command line.
|
|
39
|
+
- `hostdev start` chooses a free port in 8100-8199. It replaces the port of the command
|
|
40
|
+
with the chosen port, sets `PORT` and starts the command.
|
|
41
|
+
- When the port listens, it writes one Caddy site file for the host and reloads Caddy.
|
|
42
|
+
Caddy serves the host with a certificate of its local CA (`tls internal`).
|
|
43
|
+
- macOS resolves every `*.localhost` name to localhost. No DNS setup is necessary.
|
|
44
|
+
- A start of a host that is already running returns the running one.
|
|
45
|
+
|
|
46
|
+
### On the local network
|
|
47
|
+
|
|
48
|
+
- With `--lan`, the host gets a second name, `<name>.local`. An instance joins the name
|
|
49
|
+
with a hyphen: `v1-myapp.local`.
|
|
50
|
+
- One process for each host publishes the name through mDNS (Bonjour), as an alias of the
|
|
51
|
+
name of the Mac. The record holds no address: the name follows the Mac when the network
|
|
52
|
+
changes.
|
|
53
|
+
- Each device of the same network can open the application. Use `--lan` only on a network
|
|
54
|
+
that you trust.
|
|
55
|
+
- A phone accepts the certificate after you install the local CA of Caddy on it, once for
|
|
56
|
+
each Mac. `hostdev ca` sends the certificate with AirDrop.
|
|
57
|
+
|
|
58
|
+
## Install
|
|
59
|
+
|
|
60
|
+
As a command:
|
|
61
|
+
|
|
62
|
+
```bash
|
|
63
|
+
uv tool install git+https://github.com/genro/hostdev
|
|
64
|
+
```
|
|
65
|
+
|
|
66
|
+
As a Claude Code plugin:
|
|
67
|
+
|
|
68
|
+
```bash
|
|
69
|
+
claude plugin marketplace add genro/hostdev
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
```bash
|
|
73
|
+
claude plugin install hostdev@hostdev
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
The plugin needs no other installation: it runs the package from its own folder.
|
|
77
|
+
|
|
78
|
+
## Setup, once for each Mac
|
|
79
|
+
|
|
80
|
+
```bash
|
|
81
|
+
hostdev setup
|
|
82
|
+
```
|
|
83
|
+
|
|
84
|
+
`setup` installs Caddy with Homebrew, adds one import line to the Caddyfile of Homebrew
|
|
85
|
+
and starts the Caddy service. Then start one application and run:
|
|
86
|
+
|
|
87
|
+
```bash
|
|
88
|
+
caddy trust
|
|
89
|
+
```
|
|
90
|
+
|
|
91
|
+
`caddy trust` installs the local CA in the Keychain. macOS asks for your password.
|
|
92
|
+
|
|
93
|
+
## Use from the terminal
|
|
94
|
+
|
|
95
|
+
`hostdev` with no argument opens a menu: start the project of the folder, put a host on
|
|
96
|
+
the LAN, stop a host, send the CA to the iPhone. On a new Mac the menu asks before each
|
|
97
|
+
setup step.
|
|
98
|
+
|
|
99
|
+
The commands:
|
|
100
|
+
|
|
101
|
+
```
|
|
102
|
+
hostdev start [--cwd DIR] [--name NAME] [--instance INSTANCE] [--config CONFIG] [--lan]
|
|
103
|
+
hostdev start [...] --port PORT [--path PATH] -- COMMAND [ARG ...]
|
|
104
|
+
hostdev stop HOST
|
|
105
|
+
hostdev lan HOST on|off
|
|
106
|
+
hostdev list
|
|
107
|
+
hostdev ca
|
|
108
|
+
hostdev check
|
|
109
|
+
hostdev setup
|
|
110
|
+
```
|
|
111
|
+
|
|
112
|
+
Each command writes one JSON line. An example with no `launch.json`:
|
|
113
|
+
|
|
114
|
+
```bash
|
|
115
|
+
hostdev start --lan --port 8000 -- uvicorn app:application --port 8000
|
|
116
|
+
```
|
|
117
|
+
|
|
118
|
+
## Use from Claude
|
|
119
|
+
|
|
120
|
+
- "start it" / "avvialo" — start the project of the working directory.
|
|
121
|
+
- "start it as v1" — start an instance at `v1.<name>.localhost`.
|
|
122
|
+
- "open it on my phone" / "aprilo sul telefono" — put it on the LAN.
|
|
123
|
+
- "stop it" / "fermalo"
|
|
124
|
+
- "what is running" / "cosa gira"
|
|
125
|
+
|
|
126
|
+
## The iPhone, once for each Mac
|
|
127
|
+
|
|
128
|
+
1. Run `hostdev ca`. The AirDrop panel opens on the Mac. Select the iPhone.
|
|
129
|
+
2. On the iPhone: Settings > Profile Downloaded > Install.
|
|
130
|
+
3. On the iPhone: Settings > General > About > Certificate Trust Settings. Enable
|
|
131
|
+
"Caddy Local Authority".
|
|
132
|
+
|
|
133
|
+
After that, each `https://<name>.local` host of that Mac is valid on the iPhone.
|
|
134
|
+
|
|
135
|
+
## Example launch.json
|
|
136
|
+
|
|
137
|
+
```json
|
|
138
|
+
{
|
|
139
|
+
"version": "0.0.1",
|
|
140
|
+
"configurations": [
|
|
141
|
+
{
|
|
142
|
+
"name": "myapp",
|
|
143
|
+
"runtimeExecutable": "env",
|
|
144
|
+
"runtimeArgs": ["DEBUG=1", "op", "run", "--env-file", "keys.env", "--",
|
|
145
|
+
".venv/bin/python", "-m", "myapp", "--port", "8000"],
|
|
146
|
+
"port": 8000,
|
|
147
|
+
"path": "/app/"
|
|
148
|
+
}
|
|
149
|
+
]
|
|
150
|
+
}
|
|
151
|
+
```
|
|
152
|
+
|
|
153
|
+
## Files written on your Mac
|
|
154
|
+
|
|
155
|
+
- `<brew prefix>/etc/Caddyfile`: one import line.
|
|
156
|
+
- `~/.local/state/hostdev/`: `instances.json`, `sites/<host>.caddy`, `logs/<host>.log`.
|
|
157
|
+
- `<project>/.claude/launch.json`: only when the menu asks you for the start command.
|
|
158
|
+
|
|
159
|
+
## Development
|
|
160
|
+
|
|
161
|
+
```bash
|
|
162
|
+
uv run --group dev pytest
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
The tests start real processes. They do not reload Caddy and do not publish names on the
|
|
166
|
+
network.
|
|
167
|
+
|
|
168
|
+
## License
|
|
169
|
+
|
|
170
|
+
Apache-2.0
|