@norskvideo/ctl-dev-kit 0.1.2 → 0.1.4
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.
- package/build/flake.nix +15 -9
- package/local-dev/README.md +48 -4
- package/package.json +1 -1
package/build/flake.nix
CHANGED
|
@@ -3,12 +3,13 @@
|
|
|
3
3
|
# root for `nix develop`; it can't pull one from an npm package at CI bootstrap).
|
|
4
4
|
# The copy is drift-gated (Workstream I), same model as the fenced CLAUDE.md core.
|
|
5
5
|
#
|
|
6
|
-
#
|
|
7
|
-
# nix develop
|
|
8
|
-
#
|
|
9
|
-
#
|
|
10
|
-
# nix develop .#
|
|
11
|
-
#
|
|
6
|
+
# Three shells:
|
|
7
|
+
# nix develop -> build tools (bun, cargo/rustc, git) + the pinned
|
|
8
|
+
# nix develop .#dev `norsk-ctl` daemon on PATH. The everyday product dev
|
|
9
|
+
# shell; the two are equivalent.
|
|
10
|
+
# nix develop .#build -> build tools only, no ctl. What CI (build-image /
|
|
11
|
+
# integration) uses, so image builds never depend on the
|
|
12
|
+
# ctl binary channel.
|
|
12
13
|
#
|
|
13
14
|
# `norsk-ctl` is the released daemon binary pulled from the S3 channel and pinned
|
|
14
15
|
# by version+hash (reproducible). It is NOT built from source here — a product
|
|
@@ -77,14 +78,19 @@
|
|
|
77
78
|
pkgs.git
|
|
78
79
|
];
|
|
79
80
|
in {
|
|
80
|
-
#
|
|
81
|
+
# Everyday dev shell — build tools + the pinned norsk-ctl daemon.
|
|
82
|
+
# `nix develop` and `nix develop .#dev` are equivalent.
|
|
81
83
|
default = pkgs.mkShell {
|
|
82
|
-
buildInputs = buildTools;
|
|
84
|
+
buildInputs = buildTools ++ [ (mkCtl system) ];
|
|
83
85
|
};
|
|
84
|
-
# Local product dev loop — build tools + the pinned daemon on PATH.
|
|
85
86
|
dev = pkgs.mkShell {
|
|
86
87
|
buildInputs = buildTools ++ [ (mkCtl system) ];
|
|
87
88
|
};
|
|
89
|
+
# Lean shell for CI (build-image / integration) — no ctl fetch, so
|
|
90
|
+
# image builds never depend on the ctl binary channel.
|
|
91
|
+
build = pkgs.mkShell {
|
|
92
|
+
buildInputs = buildTools;
|
|
93
|
+
};
|
|
88
94
|
});
|
|
89
95
|
};
|
|
90
96
|
}
|
package/local-dev/README.md
CHANGED
|
@@ -13,8 +13,9 @@ dependency; it is the released binary, pinned by version+hash in the repo's
|
|
|
13
13
|
it on `PATH`:
|
|
14
14
|
|
|
15
15
|
```sh
|
|
16
|
-
nix develop
|
|
17
|
-
# nix develop
|
|
16
|
+
nix develop # build tools (bun, cargo/rustc, git) + the pinned norsk-ctl
|
|
17
|
+
# nix develop .#dev # equivalent alias
|
|
18
|
+
# nix develop .#build # lean shell, no ctl — what CI (build-image/integration) uses
|
|
18
19
|
|
|
19
20
|
norsk-ctl serve # daemon on :8333, oauth2 proxy on :9443
|
|
20
21
|
norsk-ctl --version # confirm the pinned build
|
|
@@ -54,8 +55,9 @@ HARDWARE=none NORSK_LICENSE_FILE=... bun run iterate # no GPU reservat
|
|
|
54
55
|
# Advanced overrides
|
|
55
56
|
|
|
56
57
|
To develop a product against **un-published** ctl code or a **locally-built**
|
|
57
|
-
media server, there are
|
|
58
|
-
leaves the default (registry/pinned) path untouched when unset.
|
|
58
|
+
media server, there are three independent override layers. Each is opt-in and
|
|
59
|
+
leaves the default (registry/pinned) path untouched when unset. They compose:
|
|
60
|
+
changing the daemon *and* a ctl library it exposes means layers 1 + 3 together.
|
|
59
61
|
|
|
60
62
|
## 1. The npm layer — local `@norskvideo/ctl-*` checkouts
|
|
61
63
|
|
|
@@ -95,3 +97,45 @@ bun run --cwd . iterate # or the product's launch/iterate entry
|
|
|
95
97
|
```
|
|
96
98
|
|
|
97
99
|
Leave the hooks unset to launch the pinned tags the product declares.
|
|
100
|
+
|
|
101
|
+
## 3. The daemon layer — run ctl from a source checkout (`../norsk-ctl`)
|
|
102
|
+
|
|
103
|
+
Use this when you are changing the **daemon itself** (packages/norsk-ctl) and
|
|
104
|
+
want the product to launch through your build instead of the pinned binary. The
|
|
105
|
+
daemon is a single process on `:8333` — where you start it from is irrelevant, so
|
|
106
|
+
just run it out of your checkout and drive it with the same checkout's CLI. Use
|
|
107
|
+
`nix develop .#build` on the product side so the flake's pinned `norsk-ctl`
|
|
108
|
+
doesn't shadow the one you're running from source.
|
|
109
|
+
|
|
110
|
+
```sh
|
|
111
|
+
# 1. daemon, from your ctl checkout (root `cli` script -> packages/norsk-ctl cli)
|
|
112
|
+
( cd ../norsk-ctl && bun run cli serve )
|
|
113
|
+
|
|
114
|
+
# 2. product backend, from the product repo
|
|
115
|
+
bun run dev
|
|
116
|
+
|
|
117
|
+
# 3. register + launch, using the SOURCE cli against the SOURCE daemon
|
|
118
|
+
bun run --cwd ../norsk-ctl cli product add --dev-url http://localhost:<backendPort>
|
|
119
|
+
bun run --cwd ../norsk-ctl cli instance launch-template demo --template <t> --hardware none
|
|
120
|
+
```
|
|
121
|
+
|
|
122
|
+
No linking is needed for this — you are running the daemon *code* directly. Pair
|
|
123
|
+
with layer 1 (`dev-link.sh`) only if you also changed a `@norskvideo/ctl-*`
|
|
124
|
+
library the product *compiles* against.
|
|
125
|
+
|
|
126
|
+
### Integration tests against source ctl
|
|
127
|
+
|
|
128
|
+
The harness spawns the daemon from `NORSK_CTL_BINARY` as `<that> serve …`. A split
|
|
129
|
+
repo has no in-workspace ctl source for it to auto-discover, so point that env at
|
|
130
|
+
a one-line wrapper that forwards to your checkout's CLI:
|
|
131
|
+
|
|
132
|
+
```sh
|
|
133
|
+
printf '#!/usr/bin/env bash\nexec bun run --cwd %s cli "$@"\n' "$(cd ../norsk-ctl && pwd)" > /tmp/norsk-ctl-src
|
|
134
|
+
chmod +x /tmp/norsk-ctl-src
|
|
135
|
+
NORSK_CTL_BINARY=/tmp/norsk-ctl-src NORSK_LICENSE_FILE=/path/to/license.json bun run test:integration
|
|
136
|
+
```
|
|
137
|
+
|
|
138
|
+
The wrapper forwards `serve` / `product add` / everything, so the whole slow tier
|
|
139
|
+
runs against `../norsk-ctl`. (`NORSK_CTL_BINARY` resolution lives in
|
|
140
|
+
`@norskvideo/ctl-test-harness`'s `cli-command.ts`: explicit path → in-workspace
|
|
141
|
+
source → `norsk-ctl` on PATH.)
|