@claudinite/cli 1.61012.1 → 1.61012.2

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/launch CHANGED
@@ -1,33 +1,33 @@
1
1
  #!/bin/sh
2
- # Claudinite launcher. A member checks this file in as .claudinite/launch,
3
- # unchanged; only the engine update replaces it.
2
+ # Claudinite engine setup. A member checks this file in as
3
+ # .claudinite/setup-cn.sh, unchanged; only the engine update replaces it.
4
4
  #
5
- # sh .claudinite/launch <cn arguments> fetch, verify and cache the pinned engine, then run it
6
- # sh .claudinite/launch env install fetch, verify and cache only (environment pre-warm)
5
+ # sh .claudinite/setup-cn.sh fetch, verify and cache the pinned engine, and link .claudinite/bin/cn to it
7
6
  #
8
7
  # It reads engine.version and engine.manifest from .claudinite/settings.yaml,
9
- # .toml or .json, downloads that release's manifest.json and this platform's
8
+ # downloads that release's manifest.json and this platform's
10
9
  # binary from the npm registry, or from the GitHub releases of the
11
10
  # repository engine.releases names (owner/name, tag v<version>, assets named
12
11
  # as npm's tarballs), checks the manifest against the pin and the
13
- # binary against the manifest, caches the binary read-only, links
14
- # .claudinite/bin/cn to it and execs it. Nothing is trusted that the pin
12
+ # binary against the manifest, caches the binary read-only and links
13
+ # .claudinite/bin/cn to it. Nothing is trusted that the pin
15
14
  # does not cover; the registry's identity is immaterial to integrity.
16
15
  #
17
- # Only SessionStart and the Actions download step invoke it; every other hook
18
- # runs .claudinite/bin/cn directly. Wired to Stop, its exit 2 on a refusal
19
- # blocks the stop, and the next stop attempt hits it again, in a loop.
16
+ # It never runs cn: every caller runs .claudinite/bin/cn itself once this
17
+ # exits 0. On a failure it removes that link, so no other engine runs in
18
+ # its place, says why on stderr, prints a line telling the session to stop
19
+ # and ask the person on stdout, and exits 1.
20
20
  #
21
- # Bootstrap: the @claudinite/cli packages carry this file as their bin, so
22
- # `npx --yes @claudinite/cli adopt <packs>` runs it from the package
23
- # npx unpacked, through a symlink. Run with adopt in a repository holding no
24
- # settings file (or with the retired init), it takes the version and the
25
- # binary's hash from the package's own manifest.json, fetches and checks the binary as above, caches it with the
26
- # manifest and manifest.sig.json, and execs cn adopt, which verifies that
27
- # signature before it writes anything. Windows is not covered: npm's shim
28
- # for a sh script there is the desktop work.
29
- # Any other command run through that bin runs the member's own pin, the
30
- # member being the directory --repo names or else the working directory.
21
+ # sh setup-cn.sh --from-package DIR
22
+ #
23
+ # The @claudinite/cli package carries this file as package/launch, beside
24
+ # its manifest.json and manifest.sig.json, for its npx bin to adopt a
25
+ # repository with: from DIR, the folder the package unpacked to, it takes
26
+ # the version and the binary's hash from the package's own manifest.json,
27
+ # fetches and checks the binary as above, caches it with the manifest and
28
+ # manifest.sig.json, which cn adopt verifies before it writes anything, and
29
+ # prints the binary's path instead of linking it. Windows is not covered:
30
+ # npm's shim for a sh script there is the desktop work.
31
31
  #
32
32
  # CLAUDINITE_REGISTRY overrides the registry, CLAUDINITE_GITHUB the GitHub
33
33
  # host releases are read from and CLAUDINITE_MAX_DOWNLOAD_BYTES the download
@@ -38,17 +38,25 @@ registry=${CLAUDINITE_REGISTRY:-https://registry.npmjs.org}
38
38
  github=${CLAUDINITE_GITHUB:-https://github.com}
39
39
  max_bytes=${CLAUDINITE_MAX_DOWNLOAD_BYTES:-67108864}
40
40
 
41
- if [ "${GITHUB_ACTIONS:-}" = true ]; then
42
- context=actions
43
- elif [ "${1:-}" = hook ] && [ "${2:-}" = session-start ]; then
44
- context=session-start
45
- elif [ "${1:-}" = hook ]; then
46
- context=guard
47
- else
48
- context="command"
41
+ # Run as .claudinite/launch, the name engines before the rename wrote it
42
+ # under and every caller they wired still names, it is that launcher: it
43
+ # runs cn with its arguments once the engine is in place, and a failure
44
+ # exits as each of those callers expects.
45
+ #
46
+ # @legacy-tolerance advisory:launcher-renamed retire:#224
47
+ legacy=
48
+ if [ "${0##*/}" = launch ] && [ "${1:-}" != --from-package ]; then
49
+ if [ "${1:-}" = hook ] && [ "${2:-}" = session-start ]; then
50
+ legacy=session-start
51
+ elif [ "${1:-}" = hook ]; then
52
+ legacy=guard
53
+ else
54
+ legacy='command'
55
+ fi
49
56
  fi
50
57
 
51
58
  tmp=
59
+ here=
52
60
  cleanup() {
53
61
  if [ -n "$tmp" ]; then
54
62
  chmod -R u+w "$tmp" 2>/dev/null
@@ -60,40 +68,56 @@ trap cleanup EXIT
60
68
  trap 'cleanup; exit 1' HUP INT TERM
61
69
 
62
70
  say() {
63
- printf 'claudinite launch: %s\n' "$*" >&2
71
+ printf 'claudinite setup: %s\n' "$*" >&2
64
72
  }
65
73
 
66
- # A configuration or integrity failure: the engine never runs.
67
- refuse() {
74
+ # fail_with CODE: the engine never runs, so the link to it goes.
75
+ fail_with() {
68
76
  cleanup
77
+ if [ -n "$here" ] && [ -z "$from_package" ]; then
78
+ rm -f "$here/bin/cn" "$here/bin/cn.exe"
79
+ fi
80
+ exit "$1"
81
+ }
82
+
83
+ # A configuration or integrity failure.
84
+ refuse() {
69
85
  say "$1"
70
- case $context in
71
- session-start)
72
- printf 'Claudinite refused to run its engine: %s: stop and ask the person before continuing.\n' "$1"
73
- exit 0 ;;
74
- guard) exit 2 ;;
75
- *) exit 1 ;;
86
+ printf 'Claudinite refused to set up its engine: %s: stop and ask the person before continuing.\n' "$1"
87
+ case $legacy in
88
+ session-start) fail_with 0 ;;
89
+ guard) fail_with 2 ;;
76
90
  esac
91
+ fail_with 1
77
92
  }
78
93
 
79
94
  # The registry could not be reached; nothing verified is cached.
80
95
  unreachable() {
81
- cleanup
82
- case $context in
83
- session-start)
84
- say "could not fetch $1"
85
- printf 'Claudinite could not fetch its engine from %s: stop and ask the person before continuing.\n' "$1"
86
- exit 0 ;;
87
- guard)
88
- say "could not fetch the engine from $1; continuing without it, and SessionStart will say so again"
89
- exit 0 ;;
90
- *)
91
- say "could not fetch the engine from $1"
92
- exit 1 ;;
96
+ say "could not fetch the engine from $1"
97
+ printf 'Claudinite could not fetch its engine from %s: stop and ask the person before continuing.\n' "$1"
98
+ case $legacy in
99
+ session-start | guard) fail_with 0 ;;
93
100
  esac
101
+ fail_with 1
94
102
  }
95
103
 
96
- # The shapes a value must have, by shell patterns alone: the launcher runs
104
+ from_package=
105
+ if [ -z "$legacy" ]; then
106
+ while [ $# -gt 0 ]; do
107
+ case $1 in
108
+ --from-package)
109
+ [ $# -ge 2 ] || refuse "--from-package needs the package's folder"
110
+ from_package=$2
111
+ shift 2 ;;
112
+ --from-package=*)
113
+ from_package=${1#*=}
114
+ shift ;;
115
+ *) refuse "unknown argument $1: setup-cn.sh takes only --from-package DIR" ;;
116
+ esac
117
+ done
118
+ fi
119
+
120
+ # The shapes a value must have, by shell patterns alone: the script runs
97
121
  # once per session and per workflow step, and each tool it starts costs a
98
122
  # process.
99
123
  digits() {
@@ -124,85 +148,41 @@ dir_of() {
124
148
  esac
125
149
  }
126
150
 
127
- # Step 1: the pin, from exactly one settings file.
128
-
129
- dir_of "$0"
130
- here=$(cd "$dir" && pwd) || refuse "cannot locate the .claudinite folder"
151
+ # Step 1: the pin, from the settings file.
131
152
 
132
- # Run as the npm package's bin, through the symlink npm made.
133
- self=$0
134
- while [ -L "$self" ]; do
135
- link=$(readlink "$self") || break
136
- case $link in
137
- /*) self=$link ;;
138
- *) dir_of "$self"; self=$dir/$link ;;
139
- esac
140
- done
141
- dir_of "$self"
142
- pkgdir=$(cd "$dir" && pwd) || refuse "cannot locate the launcher's folder"
143
- bootstrap=
144
- if [ -f "$pkgdir/manifest.json" ] && [ -f "$pkgdir/package.json" ]; then
145
- if [ "${1:-}" = init ]; then
146
- bootstrap=1
147
- else
148
- repo=.
149
- want=
150
- for arg do
151
- if [ -n "$want" ]; then
152
- want=
153
- [ -d "$arg" ] && repo=$arg
154
- continue
155
- fi
156
- case $arg in
157
- --) break ;;
158
- --repo|-repo) want=1 ;;
159
- --repo=*|-repo=*) [ -d "${arg#*=}" ] && repo=${arg#*=} ;;
160
- esac
161
- done
162
- here=$(cd "$repo" && pwd)/.claudinite || refuse "cannot locate the repository $repo"
163
- if [ "${1:-}" = adopt ] && [ ! -f "$here/settings.yaml" ] && [ ! -f "$here/settings.toml" ] && [ ! -f "$here/settings.json" ]; then
164
- bootstrap=1
165
- fi
166
- fi
167
- fi
168
-
169
- format=
170
- count=0
171
- for ext in yaml toml json; do
172
- if [ -f "$here/settings.$ext" ]; then
173
- format=$ext
174
- count=$((count + 1))
153
+ if [ -n "$from_package" ]; then
154
+ pkgdir=$(cd "$from_package" && pwd) || refuse "cannot locate the package folder $from_package"
155
+ if [ ! -f "$pkgdir/manifest.json" ] || [ ! -f "$pkgdir/package.json" ]; then
156
+ refuse "$pkgdir holds no manifest.json and package.json"
175
157
  fi
176
- done
177
-
178
- if [ -n "$bootstrap" ]; then
179
158
  settings=$pkgdir/manifest.json
180
159
  [ -f "$pkgdir/manifest.sig.json" ] || refuse "$pkgdir holds no manifest.sig.json, and cn adopt never runs from an unsigned manifest"
181
160
  else
182
- [ "$count" -eq 1 ] || refuse "exactly one of .claudinite/settings.yaml, .claudinite/settings.toml or .claudinite/settings.json must exist, found $count in ${here%/.claudinite}"
183
- settings=$here/settings.$format
161
+ dir_of "$0"
162
+ here=$(cd "$dir" && pwd) || refuse "cannot locate the .claudinite folder"
163
+ settings=$here/settings.yaml
164
+ [ -f "$settings" ] || refuse ".claudinite/settings.yaml does not exist in ${here%/.claudinite}"
184
165
  fi
185
166
 
186
167
  # The engine block's values, read in one pass. No parser: the values the
187
- # launcher needs are plain quoted strings, read with a strict pattern. A key
168
+ # script needs are plain quoted strings, read with a strict pattern. A key
188
169
  # absent reads empty; a key present twice reads "duplicate", and one not
189
170
  # holding a plain quoted string, or a releases value not naming a GitHub
190
- # repository, "malformed". The pass also counts a JSON file's engine keys and
191
- # decodes the pin to the lowercase hex the hash tools print.
171
+ # repository, "malformed". The pass also decodes the pin to the lowercase
172
+ # hex the hash tools print.
192
173
  read_pin() {
193
- awk -v format="$format" -v repo='[A-Za-z0-9-]+/[A-Za-z0-9_-][A-Za-z0-9._-]*' '
194
- function value(key, sep, n, i, line, v, found) {
195
- sep = (format == "toml") ? "=" : ":"
174
+ awk -v repo='[A-Za-z0-9-]+/[A-Za-z0-9_-][A-Za-z0-9._-]*' '
175
+ function value(key, n, i, line, v, found) {
196
176
  n = 0
197
177
  for (i = 1; i <= nlines; i++) {
198
178
  line = lines[i]
199
- if (line ~ ("^[ \t]*\"?" key "\"?[ \t]*" sep)) { n++; found = line }
179
+ if (line ~ ("^[ \t]*\"?" key "\"?[ \t]*:")) { n++; found = line }
200
180
  }
201
181
  if (n == 0) return ""
202
182
  if (n > 1) return "duplicate"
203
- if (found !~ ("^[ \t]*\"?" key "\"?[ \t]*" sep "[ \t]*\"[^\"]*\"[ \t]*$")) return "malformed"
183
+ if (found !~ ("^[ \t]*\"?" key "\"?[ \t]*:[ \t]*\"[^\"]*\"[ \t]*$")) return "malformed"
204
184
  v = found
205
- sub("^[ \t]*\"?" key "\"?[ \t]*" sep "[ \t]*\"", "", v)
185
+ sub("^[ \t]*\"?" key "\"?[ \t]*:[ \t]*\"", "", v)
206
186
  sub("\"[ \t]*$", "", v)
207
187
  return (v == "") ? "malformed" : v
208
188
  }
@@ -223,28 +203,11 @@ read_pin() {
223
203
  }
224
204
  return out
225
205
  }
226
- { all = all $0 }
227
- format == "yaml" && /^engine:[ \t]*$/ { inb = 1; next }
228
- format == "yaml" && inb && /^[^ \t]/ { inb = 0 }
229
- format == "toml" && /^\[engine\][ \t]*$/ { inb = 1; next }
230
- format == "toml" && inb && /^[ \t]*\[/ { inb = 0 }
231
- format != "json" && inb { lines[++nlines] = $0 }
206
+ /^engine:[ \t]*$/ { inb = 1; next }
207
+ inb && /^[^ \t]/ { inb = 0 }
208
+ inb { lines[++nlines] = $0 }
232
209
  END {
233
- engines = 0
234
- if (format == "json") {
235
- gsub(/\r/, "", all)
236
- rest = all
237
- while (match(rest, /"engine"[ \t]*:/)) { engines++; rest = substr(rest, RSTART + RLENGTH) }
238
- block = ""
239
- rest = all
240
- while (match(rest, /"engine"[ \t]*:[ \t]*\{[^{}]*\}/)) {
241
- block = substr(rest, RSTART, RLENGTH); rest = substr(rest, RSTART + RLENGTH)
242
- }
243
- sub(/^"engine"[ \t]*:[ \t]*\{/, "", block); sub(/\}$/, "", block)
244
- nlines = split(block, lines, ",")
245
- }
246
210
  pin = value("manifest")
247
- print engines
248
211
  print value("version")
249
212
  print pin
250
213
  print value("package")
@@ -255,7 +218,7 @@ read_pin() {
255
218
  }' "$settings"
256
219
  }
257
220
 
258
- if [ -n "$bootstrap" ]; then
221
+ if [ -n "$from_package" ]; then
259
222
  # The version and package as the package npx unpacked names them; the
260
223
  # manifest's own hash stands in for the pin.
261
224
  version=$(sed -n 's/^ *"version": *"\([0-9]*\.[0-9]*\.[0-9]*\)",\{0,1\}$/\1/p' "$pkgdir/manifest.json" | head -n 1)
@@ -265,13 +228,10 @@ if [ -n "$bootstrap" ]; then
265
228
  || refuse "$pkgdir/package.json must name \"@claudinite/cli\" or \"@claudinite/cli-rc\""
266
229
  else
267
230
  pinned=$(read_pin) || refuse "cannot read $settings"
268
- engines=0 version='' manifest_pin='' package='' releases='' pin_hex=''
269
- { read -r engines; read -r version; read -r manifest_pin; read -r package; read -r releases; read -r pin_hex; } <<EOF
231
+ version='' manifest_pin='' package='' releases='' pin_hex=''
232
+ { read -r version; read -r manifest_pin; read -r package; read -r releases; read -r pin_hex; } <<EOF
270
233
  $pinned
271
234
  EOF
272
- if [ "$format" = json ]; then
273
- [ "$engines" -eq 1 ] || refuse "$settings must hold exactly one \"engine\" object, found $engines"
274
- fi
275
235
  [ -n "$package" ] || package=@claudinite/cli
276
236
 
277
237
  is_version "$version" \
@@ -320,13 +280,13 @@ else
320
280
  refuse "no SHA-256 tool found (sha256sum, shasum or openssl)"
321
281
  fi
322
282
  for tool in curl tar; do
323
- command -v "$tool" >/dev/null 2>&1 || refuse "$tool is not installed; the launcher needs it to fetch the engine"
283
+ command -v "$tool" >/dev/null 2>&1 || refuse "$tool is not installed; the engine setup needs it to fetch the engine"
324
284
  done
325
285
 
326
- # The bootstrap's pin is the hash of the manifest npx unpacked, as the
286
+ # The package's pin is the hash of the manifest npx unpacked, as the
327
287
  # lowercase hex the hash tools print; a settings file's pin was decoded to
328
288
  # that hex as it was read.
329
- if [ -n "$bootstrap" ]; then
289
+ if [ -n "$from_package" ]; then
330
290
  pin_hex=$(sha512 "$pkgdir/manifest.json")
331
291
  fi
332
292
 
@@ -349,7 +309,7 @@ private_dir() {
349
309
  fi
350
310
  [ -L "$1" ] && refuse "the cache directory $1 is a symbolic link"
351
311
  [ "$os" = windows ] && return 0
352
- # shellcheck disable=SC3067 # -O is in every sh the launcher runs under (dash, bash, busybox, zsh)
312
+ # shellcheck disable=SC3067 # -O is in every sh the script runs under (dash, bash, busybox, zsh)
353
313
  [ -O "$1" ] || private_refused "$1"
354
314
  }
355
315
  # private_refused names the mode and owner found on a cache folder that is
@@ -447,20 +407,17 @@ if ! cached_ok; then
447
407
  cleanup
448
408
  fi
449
409
 
450
- if [ "${1:-}" = env ] && [ "${2:-}" = install ] && [ "$#" -eq 2 ]; then
451
- exit 0
452
- fi
453
-
454
- if [ -n "$bootstrap" ]; then
410
+ if [ -n "$from_package" ]; then
455
411
  chmod u+w "$vdir/manifest.sig.json" 2>/dev/null
456
412
  { cp "$pkgdir/manifest.sig.json" "$vdir/.manifest.sig.json.$$" && chmod 0444 "$vdir/.manifest.sig.json.$$" \
457
413
  && mv -f "$vdir/.manifest.sig.json.$$" "$vdir/manifest.sig.json"; } || refuse "cannot place manifest.sig.json in $vdir"
458
- exec "$vdir/$bin" "$@"
414
+ printf '%s\n' "$vdir/$bin"
415
+ exit 0
459
416
  fi
460
417
 
461
- # Step 5: link, unpack, run.
418
+ # Step 5: link.
462
419
 
463
- # shellcheck disable=SC3013 # -ef is in every sh the launcher runs under (dash, bash, busybox, zsh)
420
+ # shellcheck disable=SC3013 # -ef is in every sh the script runs under (dash, bash, busybox, zsh)
464
421
  if [ ! "$here/bin/$bin" -ef "$vdir/$bin" ]; then
465
422
  mkdir -p "$here/bin" || refuse "cannot create $here/bin"
466
423
  if ! ln -sfn "$vdir/$bin" "$here/bin/$bin" 2>/dev/null; then
@@ -468,6 +425,6 @@ if [ ! "$here/bin/$bin" -ef "$vdir/$bin" ]; then
468
425
  cp "$vdir/$bin" "$here/bin/$bin" || refuse "cannot link or copy the engine into $here/bin"
469
426
  fi
470
427
  fi
471
- # Unpacking the embedded runner script and SDK beside the binary is a no-op
472
- # until the engine embeds them (no pack JavaScript runs yet).
473
- exec "$vdir/$bin" "$@"
428
+ if [ -n "$legacy" ]; then
429
+ exec "$vdir/$bin" "$@"
430
+ fi
package/manifest.json CHANGED
@@ -1,17 +1,17 @@
1
1
  {
2
2
  "v": 1,
3
- "version": "1.61012.1",
4
- "builtAt": "2026-10-12T00:55:37Z",
5
- "commit": "87bfe1a",
3
+ "version": "1.61012.2",
4
+ "builtAt": "2026-10-12T17:01:44Z",
5
+ "commit": "87b148f",
6
6
  "goVersion": "go1.26.8",
7
- "updaterDigest": "cc19267fbe8f348f54a2a6964d3d48f1a184567f0d93a26a5467a4801b6285a9",
7
+ "updaterDigest": "1d5239819358e78b434fdf348d950c83a78cd0f0fc5d245ced27294f4e5a90ae",
8
8
  "binaries": {
9
- "linux-x64": {"file": "cn", "sha256": "a4e162ea89044ee95305fccd14135e8cdb6e911303ee4d157b469c7338a8cfb7", "size": 14332066},
10
- "linux-arm64": {"file": "cn", "sha256": "ac48175c03d9aef68df4c0505389f4bd5338562663a0c54091c71793c61f2e80", "size": 12910754},
11
- "darwin-x64": {"file": "cn", "sha256": "7fef2c40e0809d648651d76a69b58ef611f48ef32f158b2b2bbccf15d6607f35", "size": 14557456},
12
- "darwin-arm64": {"file": "cn", "sha256": "bb5a212b99e558277e3dd80f00f4b3538653e8fc6036ffcf2d703c17c1521d4e", "size": 13213474},
13
- "windows-x64": {"file": "cn.exe", "sha256": "00f122a071554b349cb9c3198cae1eefb6bbde2c467db19ff166c6ff3bd239d3", "size": 14635008}
9
+ "linux-x64": {"file": "cn", "sha256": "36a87bfe4a7b42f980dbf4d198009565bd3ac41bf85690d54ef5419a7d321db6", "size": 14729378},
10
+ "linux-arm64": {"file": "cn", "sha256": "b0e9e9ed383b7bd320ed732b75f81a24eced482dd3911f53159ef785deb62798", "size": 13303970},
11
+ "darwin-x64": {"file": "cn", "sha256": "00ffd6385e5d4fe5f0d3bf4d1e46b89ee77e3d83399d7cc5acb3c46ead159a92", "size": 14955824},
12
+ "darwin-arm64": {"file": "cn", "sha256": "909445257ca0dcb7cb9f9e1f04ea7d3f543558ec24c9e6297c629a21c0e5bda3", "size": 13627362},
13
+ "windows-x64": {"file": "cn.exe", "sha256": "99e844659d58e584ce5d2191d5bd674c855a06347ceb31dd9b76be1d2670d938", "size": 15036416}
14
14
  },
15
- "launcher": "314f37fe7a4a1d2fdc59de14d5e8903959d9bd1bc03971e36d6340ed805129cd",
15
+ "launcher": "c0259f07c6a875dbb03293d34cca199c8074f2238ec3c2bcff49fcf0657b6f7b",
16
16
  "testedPacks": {}
17
17
  }
package/manifest.sig.json CHANGED
@@ -3,5 +3,5 @@
3
3
  "payload": "eyJ2IjoxLCJrZXlJZCI6ImM3NzQwNWM2ZDA4NzExODYiLCJwdWJsaWNLZXkiOiI0UHlTQzRTbG5MakJ1cVY2Qll4eU9XWUtLOWkzV295NkZCQ1ZNckF6clRzIiwidXNlIjoibWFuaWZlc3QiLCJpc3N1ZXIiOiJlYTg1ZjM1NDIxZjM3NWZjIiwibm90QmVmb3JlIjoiMjAyNi0xMC0wM1QxNjozNjozN1oiLCJub3RBZnRlciI6IjIwMjctMTAtMDNUMTY6MzY6MzdaIn0",
4
4
  "signature": "ex4GNEE3PIUj3Ue6X2TZnbB5E6G-DVrGNaYdvI13NuOauoJYilB_54TyAH490IS9-IZiu3BKVYpigm3uDTXSBw"
5
5
  },
6
- "signature": "7MNDfcppzzHJOYnbfrYQs4Thwjmpm6pub5-kotziNNkhnKfgQAsq3aouYE0slp3BN94sdyOjxXPN_GX73M8zCg"
6
+ "signature": "yMeU6LRwF4xQyii6yrBLGtQs_12D9SSupvW70k0bEbsvMnElzBkBV__DMOsJkqn7spaXwlB2kWw23zMFYsVFAw"
7
7
  }
package/npx-cn ADDED
@@ -0,0 +1,55 @@
1
+ #!/bin/sh
2
+ # The @claudinite/cli package's bin: `npx @claudinite/cli <cn arguments>`.
3
+ #
4
+ # adopt in a repository holding no .claudinite/settings.yaml sets up the
5
+ # engine this package names, from the package's own signed manifest, and
6
+ # runs its cn adopt. Any other command runs the member's own pinned engine,
7
+ # the member being the directory --repo names or else the working directory.
8
+ set -u
9
+
10
+ # npm links this file into node_modules/.bin; the package folder is where
11
+ # the link leads.
12
+ self=$0
13
+ while [ -L "$self" ]; do
14
+ link=$(readlink "$self") || break
15
+ case $link in
16
+ /*) self=$link ;;
17
+ *) case $self in */*) self=${self%/*}/$link ;; *) self=$link ;; esac ;;
18
+ esac
19
+ done
20
+ case $self in */*) pkg=${self%/*} ;; *) pkg=. ;; esac
21
+ pkg=$(cd "$pkg" && pwd) || exit 1
22
+
23
+ repo=.
24
+ want=
25
+ for arg do
26
+ if [ -n "$want" ]; then
27
+ want=
28
+ [ -d "$arg" ] && repo=$arg
29
+ continue
30
+ fi
31
+ case $arg in
32
+ --) break ;;
33
+ --repo|-repo) want=1 ;;
34
+ --repo=*|-repo=*) [ -d "${arg#*=}" ] && repo=${arg#*=} ;;
35
+ esac
36
+ done
37
+ repo=$(cd "$repo" && pwd) || exit 1
38
+ member=$repo/.claudinite
39
+
40
+ if [ "${1:-}" = adopt ] && [ ! -f "$member/settings.yaml" ]; then
41
+ bin=$(sh "$pkg/launch" --from-package "$pkg") || exit 1
42
+ exec "$bin" "$@"
43
+ fi
44
+ if [ -f "$member/setup-cn.sh" ]; then
45
+ sh "$member/setup-cn.sh" >&2 || exit 1
46
+ exec "$member/bin/cn" "$@"
47
+ fi
48
+ # A member an engine before the rename adopted holds only the old launcher.
49
+ #
50
+ # @legacy-tolerance advisory:launcher-renamed retire:#224
51
+ if [ -f "$member/launch" ]; then
52
+ exec sh "$member/launch" "$@"
53
+ fi
54
+ printf 'claudinite: %s holds no .claudinite/setup-cn.sh; adopt it first with npx @claudinite/cli adopt <packs>\n' "$repo" >&2
55
+ exit 1
package/package.json CHANGED
@@ -1,8 +1,8 @@
1
1
  {
2
2
  "name": "@claudinite/cli",
3
- "version": "1.61012.1",
4
- "description": "Claudinite engine release manifest and launcher",
3
+ "version": "1.61012.2",
4
+ "description": "Claudinite engine release manifest and engine setup",
5
5
  "license": "UNLICENSED",
6
6
  "repository": {"type": "git", "url": "git+https://github.com/missingbulb/ClaudiniteEngine.git"},
7
- "bin": {"cn": "launch"}
7
+ "bin": {"cn": "npx-cn"}
8
8
  }