@hatchkit/dev-shared 0.1.45

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.
@@ -0,0 +1,62 @@
1
+ export declare const LOCAL_DEV_DOMAIN = "local.ricoslabs.com";
2
+ export declare const LOCAL_DEV_DOMAIN_WILDCARD = "*.local.ricoslabs.com";
3
+ /** Root of the host-wide local-dev config. Tests + sandboxed runs
4
+ * override via `HATCHKIT_DEV_CONFIG_DIR` to keep fragments + Caddyfile
5
+ * writes off the real `~/.config/dev/`. The env var is consulted once
6
+ * at module load so a child process can pre-set it and have every
7
+ * derived path (Caddyfile, projects dir) follow along. */
8
+ export declare const DEV_CONFIG_DIR: string;
9
+ export declare const CADDYFILE_PATH: string;
10
+ export declare const PROJECTS_DIR: string;
11
+ /** Sentinel that marks a Caddyfile as hatchkit-managed. Doctor + the
12
+ * plugin both gate on this so users with hand-rolled Caddy setups
13
+ * aren't disturbed until they explicitly opt in via
14
+ * `hatchkit dev-setup init`. */
15
+ export declare const MANAGED_MARKER = "# Managed by hatchkit dev-setup";
16
+ /** Has the user run `hatchkit dev-setup init`? Plugins should treat a
17
+ * negative result as "stay quiet" — the user hasn't asked for the
18
+ * Tailscale URL flow. */
19
+ export declare function isLocalDevActive(): boolean;
20
+ /** Recover the Caddy listening port from the Caddyfile. Returns null
21
+ * when the file is missing or its `https_port` line is hand-edited
22
+ * beyond regex match. */
23
+ export declare function readCaddyPort(): number | null;
24
+ export declare function projectFragmentPath(slug: string): string;
25
+ export declare function projectFragmentContents(slug: string, devPort: number): string;
26
+ /** Idempotent fragment writer. Returns `"created"` / `"updated"` /
27
+ * `"unchanged"` so callers can phrase a useful log line. */
28
+ export declare function writeProjectFragment(slug: string, devPort: number): "created" | "updated" | "unchanged";
29
+ export declare function removeProjectFragment(slug: string): boolean;
30
+ export interface TailscaleIdentity {
31
+ shortName: string;
32
+ fullName: string;
33
+ ip: string;
34
+ magicDnsSuffix: string;
35
+ }
36
+ export declare function tailscaleIdentity(): Promise<TailscaleIdentity | null>;
37
+ /** Probe `tailscale serve status` for the TCP=443 → localhost:<caddyPort>
38
+ * bridge our architecture requires. Returns the discovered target port,
39
+ * or null when no TCP=443 bridge exists at all. */
40
+ export declare function tailscaleServeTcpTarget(): Promise<number | null>;
41
+ export interface SlugResolveOptions {
42
+ /** Caller-supplied slug, takes precedence over manifest + package.json. */
43
+ explicit?: string;
44
+ /** Directory to walk up from when looking for `.hatchkit.json`. Defaults
45
+ * to `process.cwd()`. */
46
+ fromDir?: string;
47
+ /** Walk-up cap so a misplaced cwd doesn't crawl to `/`. Default 8. */
48
+ maxDepth?: number;
49
+ }
50
+ export interface ResolvedSlug {
51
+ slug: string;
52
+ source: "explicit" | "manifest" | "package-json";
53
+ }
54
+ /** Resolve the slug for a project at runtime. Returns null when every
55
+ * candidate source comes up empty. */
56
+ export declare function resolveSlug(opts?: SlugResolveOptions): ResolvedSlug | null;
57
+ /** Constrain a slug to a Caddy + DNS-safe shape. We don't try to be
58
+ * clever here — just lowercase, keep `[a-z0-9-]`, collapse runs of `-`. */
59
+ export declare function sanitiseSlug(input: string): string;
60
+ /** Compose the public dev URL for a slug. */
61
+ export declare function localDevUrl(slug: string): string;
62
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AA2BA,eAAO,MAAM,gBAAgB,wBAAwB,CAAC;AACtD,eAAO,MAAM,yBAAyB,0BAA0B,CAAC;AAEjE;;;;2DAI2D;AAC3D,eAAO,MAAM,cAAc,QAGY,CAAC;AACxC,eAAO,MAAM,cAAc,QAAoC,CAAC;AAChE,eAAO,MAAM,YAAY,QAAmC,CAAC;AAE7D;;;iCAGiC;AACjC,eAAO,MAAM,cAAc,oCAAoC,CAAC;AAEhE;;0BAE0B;AAC1B,wBAAgB,gBAAgB,IAAI,OAAO,CAO1C;AAED;;0BAE0B;AAC1B,wBAAgB,a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MAAM,CAEhD"}
package/dist/index.js ADDED
@@ -0,0 +1,227 @@
1
+ /*
2
+ * @hatchkit/dev-shared — runtime utilities for the hatchkit local-dev
3
+ * integration. Used by the `hatchkit` CLI and the
4
+ * `@hatchkit/dev-plugin-{vite,next}` adapters to keep Caddy fragments,
5
+ * tailscale probes, and path constants in lockstep across processes.
6
+ *
7
+ * Architecture: a host-wide Caddy instance terminates TLS for
8
+ * `*.local.ricoslabs.com` (real Cloudflare DNS-01 wildcard cert).
9
+ * Each project drops a fragment in `~/.config/dev/projects/<slug>.caddy`
10
+ * pointing Caddy at the project's dev port. Tailscale serve passes
11
+ * raw TCP=443 traffic from the tailnet to Caddy. Phones get
12
+ * `https://<slug>.local.ricoslabs.com/` with no per-project config.
13
+ *
14
+ * This package holds only the bits the runtime (dev server plugin)
15
+ * needs at startup. The init/orchestration logic (writing the
16
+ * Caddyfile, registering tailscale serve, generating the launchd
17
+ * plist) lives in the CLI.
18
+ */
19
+ import { execFile } from "node:child_process";
20
+ import { existsSync, mkdirSync, readFileSync, rmSync, writeFileSync } from "node:fs";
21
+ import { homedir } from "node:os";
22
+ import { join } from "node:path";
23
+ import { promisify } from "node:util";
24
+ const execFileAsync = promisify(execFile);
25
+ export const LOCAL_DEV_DOMAIN = "local.ricoslabs.com";
26
+ export const LOCAL_DEV_DOMAIN_WILDCARD = `*.${LOCAL_DEV_DOMAIN}`;
27
+ /** Root of the host-wide local-dev config. Tests + sandboxed runs
28
+ * override via `HATCHKIT_DEV_CONFIG_DIR` to keep fragments + Caddyfile
29
+ * writes off the real `~/.config/dev/`. The env var is consulted once
30
+ * at module load so a child process can pre-set it and have every
31
+ * derived path (Caddyfile, projects dir) follow along. */
32
+ export const DEV_CONFIG_DIR = process.env.HATCHKIT_DEV_CONFIG_DIR && process.env.HATCHKIT_DEV_CONFIG_DIR.length > 0
33
+ ? process.env.HATCHKIT_DEV_CONFIG_DIR
34
+ : join(homedir(), ".config", "dev");
35
+ export const CADDYFILE_PATH = join(DEV_CONFIG_DIR, "Caddyfile");
36
+ export const PROJECTS_DIR = join(DEV_CONFIG_DIR, "projects");
37
+ /** Sentinel that marks a Caddyfile as hatchkit-managed. Doctor + the
38
+ * plugin both gate on this so users with hand-rolled Caddy setups
39
+ * aren't disturbed until they explicitly opt in via
40
+ * `hatchkit dev-setup init`. */
41
+ export const MANAGED_MARKER = "# Managed by hatchkit dev-setup";
42
+ /** Has the user run `hatchkit dev-setup init`? Plugins should treat a
43
+ * negative result as "stay quiet" — the user hasn't asked for the
44
+ * Tailscale URL flow. */
45
+ export function isLocalDevActive() {
46
+ if (!existsSync(CADDYFILE_PATH))
47
+ return false;
48
+ try {
49
+ return readFileSync(CADDYFILE_PATH, "utf-8").includes(MANAGED_MARKER);
50
+ }
51
+ catch {
52
+ return false;
53
+ }
54
+ }
55
+ /** Recover the Caddy listening port from the Caddyfile. Returns null
56
+ * when the file is missing or its `https_port` line is hand-edited
57
+ * beyond regex match. */
58
+ export function readCaddyPort() {
59
+ if (!existsSync(CADDYFILE_PATH))
60
+ return null;
61
+ try {
62
+ const text = readFileSync(CADDYFILE_PATH, "utf-8");
63
+ const m = text.match(/https_port\s+(\d+)/);
64
+ if (!m)
65
+ return null;
66
+ const n = Number(m[1]);
67
+ return Number.isFinite(n) && n > 0 ? n : null;
68
+ }
69
+ catch {
70
+ return null;
71
+ }
72
+ }
73
+ // ---------------------------------------------------------------------------
74
+ // Per-project Caddy fragment
75
+ // ---------------------------------------------------------------------------
76
+ export function projectFragmentPath(slug) {
77
+ return join(PROJECTS_DIR, `${slug}.caddy`);
78
+ }
79
+ export function projectFragmentContents(slug, devPort) {
80
+ const host = `${slug}.${LOCAL_DEV_DOMAIN}`;
81
+ // Multi-line block. Caddy's parser rejects the inline form
82
+ // `handle @x { reverse_proxy ... }` with "Unexpected next token
83
+ // after '{' on same line" when the fragment is loaded via `import`
84
+ // from the parent Caddyfile. Split the block across lines so the
85
+ // import resolves cleanly.
86
+ return `@${slug} host ${host}
87
+ handle @${slug} {
88
+ reverse_proxy 127.0.0.1:${devPort}
89
+ }
90
+ `;
91
+ }
92
+ /** Idempotent fragment writer. Returns `"created"` / `"updated"` /
93
+ * `"unchanged"` so callers can phrase a useful log line. */
94
+ export function writeProjectFragment(slug, devPort) {
95
+ ensureProjectsDir();
96
+ const path = projectFragmentPath(slug);
97
+ const next = projectFragmentContents(slug, devPort);
98
+ if (!existsSync(path)) {
99
+ writeFileSync(path, next);
100
+ return "created";
101
+ }
102
+ const prev = readFileSync(path, "utf-8");
103
+ if (prev === next)
104
+ return "unchanged";
105
+ writeFileSync(path, next);
106
+ return "updated";
107
+ }
108
+ export function removeProjectFragment(slug) {
109
+ const path = projectFragmentPath(slug);
110
+ if (!existsSync(path))
111
+ return false;
112
+ rmSync(path);
113
+ return true;
114
+ }
115
+ function ensureProjectsDir() {
116
+ if (!existsSync(PROJECTS_DIR))
117
+ mkdirSync(PROJECTS_DIR, { recursive: true });
118
+ }
119
+ export async function tailscaleIdentity() {
120
+ try {
121
+ const { stdout } = await execFileAsync("tailscale", ["status", "--json"], { timeout: 1500 });
122
+ const json = JSON.parse(stdout);
123
+ const self = json.Self;
124
+ if (!self?.DNSName || !self.TailscaleIPs?.length)
125
+ return null;
126
+ const fullName = self.DNSName.replace(/\.$/, "");
127
+ const shortName = fullName.split(".")[0] ?? fullName;
128
+ const ip = self.TailscaleIPs.find((v) => /^\d+\.\d+\.\d+\.\d+$/.test(v)) ?? "";
129
+ if (!ip)
130
+ return null;
131
+ const magicDnsSuffix = json.CurrentTailnet?.MagicDNSSuffix ?? json.MagicDNSSuffix ?? "";
132
+ return { shortName, fullName, ip, magicDnsSuffix };
133
+ }
134
+ catch {
135
+ return null;
136
+ }
137
+ }
138
+ /** Probe `tailscale serve status` for the TCP=443 → localhost:<caddyPort>
139
+ * bridge our architecture requires. Returns the discovered target port,
140
+ * or null when no TCP=443 bridge exists at all. */
141
+ export async function tailscaleServeTcpTarget() {
142
+ try {
143
+ const { stdout } = await execFileAsync("tailscale", ["serve", "status", "--json"], {
144
+ timeout: 1500,
145
+ });
146
+ const cfg = JSON.parse(stdout);
147
+ const entry = cfg.TCP?.["443"];
148
+ if (!entry?.TCPForward)
149
+ return null;
150
+ const m = entry.TCPForward.match(/:(\d+)$/);
151
+ if (!m)
152
+ return null;
153
+ const n = Number(m[1]);
154
+ return Number.isFinite(n) ? n : null;
155
+ }
156
+ catch {
157
+ return null;
158
+ }
159
+ }
160
+ /** Resolve the slug for a project at runtime. Returns null when every
161
+ * candidate source comes up empty. */
162
+ export function resolveSlug(opts = {}) {
163
+ if (opts.explicit) {
164
+ return { slug: sanitiseSlug(opts.explicit), source: "explicit" };
165
+ }
166
+ const start = opts.fromDir ?? process.cwd();
167
+ const max = opts.maxDepth ?? 8;
168
+ let dir = start;
169
+ for (let i = 0; i < max; i++) {
170
+ const manifest = join(dir, ".hatchkit.json");
171
+ if (existsSync(manifest)) {
172
+ try {
173
+ const m = JSON.parse(readFileSync(manifest, "utf-8"));
174
+ // Prefer the dedicated localDev.slug field; fall back to the
175
+ // project name when localDev is unset. (Step 4 of the feature
176
+ // populates localDev.slug at scaffold time; older manifests
177
+ // won't have it.)
178
+ const candidate = m.localDev?.slug ?? m.name;
179
+ if (candidate)
180
+ return { slug: sanitiseSlug(candidate), source: "manifest" };
181
+ }
182
+ catch {
183
+ // Corrupt manifest — keep walking, fall through to package.json.
184
+ }
185
+ }
186
+ const parent = join(dir, "..");
187
+ if (parent === dir)
188
+ break;
189
+ dir = parent;
190
+ }
191
+ dir = start;
192
+ for (let i = 0; i < max; i++) {
193
+ const pkg = join(dir, "package.json");
194
+ if (existsSync(pkg)) {
195
+ try {
196
+ const j = JSON.parse(readFileSync(pkg, "utf-8"));
197
+ if (j.name) {
198
+ // Strip scoped-package prefix: `@scope/raptor-runner` → `raptor-runner`.
199
+ const bare = j.name.replace(/^@[^/]+\//, "");
200
+ return { slug: sanitiseSlug(bare), source: "package-json" };
201
+ }
202
+ }
203
+ catch {
204
+ // Walk up.
205
+ }
206
+ }
207
+ const parent = join(dir, "..");
208
+ if (parent === dir)
209
+ break;
210
+ dir = parent;
211
+ }
212
+ return null;
213
+ }
214
+ /** Constrain a slug to a Caddy + DNS-safe shape. We don't try to be
215
+ * clever here — just lowercase, keep `[a-z0-9-]`, collapse runs of `-`. */
216
+ export function sanitiseSlug(input) {
217
+ return input
218
+ .toLowerCase()
219
+ .replace(/[^a-z0-9-]+/g, "-")
220
+ .replace(/-+/g, "-")
221
+ .replace(/^-|-$/g, "");
222
+ }
223
+ /** Compose the public dev URL for a slug. */
224
+ export function localDevUrl(slug) {
225
+ return `https://${slug}.${LOCAL_DEV_DOMAIN}/`;
226
+ }
227
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;GAiBG;AAEH,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAC;AAC9C,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,YAAY,EAAE,MAAM,EAAE,aAAa,EAAE,MAAM,SAAS,CAAC;AACrF,OAAO,EAAE,OAAO,EAAE,MAAM,SAAS,CAAC;AAClC,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AACjC,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAEtC,MAAM,aAAa,GAAG,SAAS,CAAC,QAAQ,CAAC,CAAC;AAE1C,MAAM,CAAC,MAAM,gBAAgB,GAAG,qBAAqB,CAAC;AACtD,MAAM,CAAC,MAAM,yBAAyB,GAAG,KAAK,gBAAgB,EAAE,CAAC;AAEjE;;;;2DAI2D;AAC3D,MAAM,CAAC,MAAM,cAAc,GACzB,OAAO,CAAC,GAAG,CAAC,uBAAuB,IAAI,OAAO,CAAC,GAAG,CAAC,uBAAuB,CAAC,MAAM,GAAG,CAAC;IACnF,CAAC,CAAC,OAAO,CAAC,GAAG,CAAC,uBAAuB;IACrC,CA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,CAAC,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;gBAC9D,CAAC;YACH,CAAC;YAAC,MAAM,CAAC;gBACP,WAAW;YACb,CAAC;QACH,CAAC;QACD,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,EAAE,IAAI,CAAC,CAAC;QAC/B,IAAI,MAAM,KAAK,GAAG;YAAE,MAAM;QAC1B,GAAG,GAAG,MAAM,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED;4EAC4E;AAC5E,MAAM,UAAU,YAAY,CAAC,KAAa;IACxC,OAAO,KAAK;SACT,WAAW,EAAE;SACb,OAAO,CAAC,cAAc,EAAE,GAAG,CAAC;SAC5B,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC;SACnB,OAAO,CAAC,QAAQ,EAAE,EAAE,CAAC,CAAC;AAC3B,CAAC;AAED,6CAA6C;AAC7C,MAAM,UAAU,WAAW,CAAC,IAAY;IACtC,OAAO,WAAW,IAAI,IAAI,gBAAgB,GAAG,CAAC;AAChD,CAAC"}
package/package.json ADDED
@@ -0,0 +1,27 @@
1
+ {
2
+ "name": "@hatchkit/dev-shared",
3
+ "version": "0.1.45",
4
+ "description": "Shared runtime utilities for hatchkit's local-dev integration — Caddy fragment writer, Tailscale probes, paths. Consumed by the CLI and the @hatchkit/dev-plugin-{vite,next} packages.",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "import": "./dist/index.js"
12
+ }
13
+ },
14
+ "files": [
15
+ "dist",
16
+ "README.md"
17
+ ],
18
+ "devDependencies": {
19
+ "@types/node": "^22.0.0",
20
+ "typescript": "^5.6.0"
21
+ },
22
+ "scripts": {
23
+ "build": "tsc",
24
+ "dev": "tsc --watch --preserveWatchOutput",
25
+ "typecheck": "tsc --noEmit"
26
+ }
27
+ }