@kitionstage/cli 0.5.2-stage.1 → 0.5.2-stage.13
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/dist/install.ps1 +10 -5
- package/dist/install.sh +10 -5
- package/package.json +2 -2
package/dist/install.ps1
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
#
|
|
10
10
|
# The registries, in order (as kition itself reads them, docs/sdk/cli.md):
|
|
11
11
|
# KITION_NPM_REGISTRY one address, or several separated by commas
|
|
12
|
-
# npm's own setting `@kition:registry
|
|
12
|
+
# npm's own setting `@kition:registry` (the scope's), else `npm_config_registry`, else `registry`, in the
|
|
13
13
|
# .npmrc that npm_config_userconfig names or %USERPROFILE%\.npmrc (read; npm is not needed)
|
|
14
14
|
# https://registry.npmjs.org/, then https://registry.npmmirror.com/
|
|
15
15
|
# A registry that does not answer, lacks the version, or serves other bytes than its metadata says
|
|
@@ -23,6 +23,11 @@
|
|
|
23
23
|
# Windows 10 1803 or later (for tar.exe). See docs/sdk/cli.md in https://github.com/KitionAI/kition-sdk.
|
|
24
24
|
param([string]$Version = $env:KITION_VERSION)
|
|
25
25
|
|
|
26
|
+
# The npm scope of the packages it installs: <scope>/cli-<platform>. The one place it is named; a
|
|
27
|
+
# rehearsal's launcher (<scope>/cli, made by kition-sdk's tools/stage-package.mjs) carries a copy
|
|
28
|
+
# naming its own scope here.
|
|
29
|
+
$scope = '@kitionstage'
|
|
30
|
+
|
|
26
31
|
$ErrorActionPreference = 'Stop'
|
|
27
32
|
$ProgressPreference = 'SilentlyContinue'
|
|
28
33
|
|
|
@@ -45,7 +50,7 @@ switch ($arch) {
|
|
|
45
50
|
default { Fail "kition is built for x64 Windows; not for $arch." }
|
|
46
51
|
}
|
|
47
52
|
if (-not (Get-Command tar.exe -ErrorAction SilentlyContinue)) { Fail 'tar.exe is missing (Windows 10 1803 or later has it).' }
|
|
48
|
-
$package = "
|
|
53
|
+
$package = "$scope/cli-$target"
|
|
49
54
|
|
|
50
55
|
# setting <key> <file>: the value of `key=value` in an .npmrc, quotes taken off, ${VAR} expanded; '' without one.
|
|
51
56
|
function Setting([string]$Key, [string]$File) {
|
|
@@ -65,7 +70,7 @@ function Setting([string]$Key, [string]$File) {
|
|
|
65
70
|
$npmrc = if ($env:npm_config_userconfig) { $env:npm_config_userconfig } else { Join-Path $env:USERPROFILE '.npmrc' }
|
|
66
71
|
$general = if ($env:npm_config_registry) { $env:npm_config_registry } else { Setting 'registry' $npmrc }
|
|
67
72
|
$registries = New-Object System.Collections.Generic.List[string]
|
|
68
|
-
foreach ($candidate in @((("$env:KITION_NPM_REGISTRY") -split ',') + @((Setting
|
|
73
|
+
foreach ($candidate in @((("$env:KITION_NPM_REGISTRY") -split ',') + @((Setting "${scope}:registry" $npmrc), $general, 'https://registry.npmjs.org/', 'https://registry.npmmirror.com/'))) {
|
|
69
74
|
$address = "$candidate".Trim()
|
|
70
75
|
if ($address -notmatch '^https?://') { continue }
|
|
71
76
|
$address = $address.TrimEnd('/') + '/'
|
|
@@ -86,7 +91,7 @@ try {
|
|
|
86
91
|
foreach ($registry in $registries) {
|
|
87
92
|
# The version's metadata: its version and npm's integrity of its tarball.
|
|
88
93
|
try {
|
|
89
|
-
$metadata = Invoke-RestMethod -Uri "$registry
|
|
94
|
+
$metadata = Invoke-RestMethod -Uri "$registry$scope%2fcli-$target/$wanted" -UseBasicParsing -TimeoutSec 30
|
|
90
95
|
} catch {
|
|
91
96
|
$tried += "${registry}: no $package@$wanted there, or no answer ($($_.Exception.Message))"
|
|
92
97
|
continue
|
|
@@ -101,7 +106,7 @@ try {
|
|
|
101
106
|
$tried += "${registry}: it offers $package $found, not $Version"
|
|
102
107
|
continue
|
|
103
108
|
}
|
|
104
|
-
$tarball = "$registry
|
|
109
|
+
$tarball = "$registry$scope/cli-$target/-/cli-$target-$found.tgz"
|
|
105
110
|
try {
|
|
106
111
|
Invoke-WebRequest -Uri $tarball -OutFile $file -UseBasicParsing -TimeoutSec 600
|
|
107
112
|
} catch {
|
package/dist/install.sh
CHANGED
|
@@ -12,7 +12,7 @@
|
|
|
12
12
|
#
|
|
13
13
|
# The registries, in order (as kition itself reads them, docs/sdk/cli.md):
|
|
14
14
|
# KITION_NPM_REGISTRY one address, or several separated by commas
|
|
15
|
-
# npm's own setting `@kition:registry
|
|
15
|
+
# npm's own setting `@kition:registry` (the scope's), else `npm_config_registry`, else `registry`, in the
|
|
16
16
|
# .npmrc that npm_config_userconfig names or ~/.npmrc (read; npm is not needed)
|
|
17
17
|
# https://registry.npmjs.org/, then https://registry.npmmirror.com/
|
|
18
18
|
# A registry that does not answer within 5 seconds, lacks the version, or serves other bytes than
|
|
@@ -26,6 +26,11 @@
|
|
|
26
26
|
# See docs/sdk/cli.md in https://github.com/KitionAI/kition-sdk.
|
|
27
27
|
set -eu
|
|
28
28
|
|
|
29
|
+
# The npm scope of the packages it installs: <scope>/cli-<platform>. The one place it is named; a
|
|
30
|
+
# rehearsal's launcher (<scope>/cli, made by kition-sdk's tools/stage-package.mjs) carries a copy
|
|
31
|
+
# naming its own scope here.
|
|
32
|
+
scope='@kitionstage'
|
|
33
|
+
|
|
29
34
|
version="${1:-${KITION_VERSION:-}}"
|
|
30
35
|
version="${version#v}"
|
|
31
36
|
home="${KITION_HOME:-${HOME:?HOME is not set; set KITION_HOME}/.kition}"
|
|
@@ -100,12 +105,12 @@ setting() {
|
|
|
100
105
|
registries() {
|
|
101
106
|
npmrc="${npm_config_userconfig:-${NPM_CONFIG_USERCONFIG:-$HOME/.npmrc}}"
|
|
102
107
|
general="${npm_config_registry:-${NPM_CONFIG_REGISTRY:-$(setting registry "$npmrc")}}"
|
|
103
|
-
printf '%s\n' "$(printf '%s' "${KITION_NPM_REGISTRY:-}" | tr ',' '\n')" "$(setting
|
|
108
|
+
printf '%s\n' "$(printf '%s' "${KITION_NPM_REGISTRY:-}" | tr ',' '\n')" "$(setting "$scope:registry" "$npmrc")" "$general" https://registry.npmjs.org/ https://registry.npmmirror.com/ |
|
|
104
109
|
sed 's/^[[:space:]]*//; s/[[:space:]]*$//' | grep -E '^https?://' | sed 's#/*$#/#' | awk '!seen[$0]++'
|
|
105
110
|
}
|
|
106
111
|
|
|
107
112
|
target=$(platform) || exit 1
|
|
108
|
-
package="
|
|
113
|
+
package="$scope/cli-$target"
|
|
109
114
|
mkdir -p "$home/tmp" || fail "cannot create $home/tmp"
|
|
110
115
|
work=$(mktemp -d "$home/tmp/install.XXXXXX") || fail "cannot create a folder in $home/tmp"
|
|
111
116
|
trap 'rm -rf "$work"' EXIT
|
|
@@ -115,7 +120,7 @@ tried=""
|
|
|
115
120
|
installed_from=""
|
|
116
121
|
for registry in $(registries); do
|
|
117
122
|
# The version's metadata: its version and npm's integrity of its tarball.
|
|
118
|
-
if ! fetch "$registry
|
|
123
|
+
if ! fetch "$registry$scope%2fcli-$target/${version:-latest}" "$work/metadata.json"; then
|
|
119
124
|
tried="$tried; $registry: no $package@${version:-latest} there, or no answer"
|
|
120
125
|
continue
|
|
121
126
|
fi
|
|
@@ -129,7 +134,7 @@ for registry in $(registries); do
|
|
|
129
134
|
tried="$tried; $registry: it offers $package $found, not $version"
|
|
130
135
|
continue
|
|
131
136
|
fi
|
|
132
|
-
tarball="$registry
|
|
137
|
+
tarball="$registry$scope/cli-$target/-/cli-$target-$found.tgz"
|
|
133
138
|
if ! fetch "$tarball" "$work/package.tgz"; then
|
|
134
139
|
tried="$tried; $registry: $tarball cannot be downloaded"
|
|
135
140
|
continue
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kitionstage/cli",
|
|
3
|
-
"version": "0.5.2-stage.
|
|
3
|
+
"version": "0.5.2-stage.13",
|
|
4
4
|
"description": "Kition's command line from npm: `npm install -g @kition/cli` gives the `kition` command, and `npx -y @kition/cli mcp --workspace <folder>` serves the kits' tools to any agent over MCP. It downloads each published kit on first use.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"type": "module",
|
|
@@ -46,6 +46,6 @@
|
|
|
46
46
|
"build": "node ../../tools/build-package.mjs"
|
|
47
47
|
},
|
|
48
48
|
"optionalDependencies": {
|
|
49
|
-
"@kitionstage/cli-darwin-arm64": "0.5.2-stage.
|
|
49
|
+
"@kitionstage/cli-darwin-arm64": "0.5.2-stage.13"
|
|
50
50
|
}
|
|
51
51
|
}
|