relayax-cli 0.2.27 → 0.2.28
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/lib/preamble.d.ts +4 -8
- package/dist/lib/preamble.js +15 -38
- package/package.json +1 -1
package/dist/lib/preamble.d.ts
CHANGED
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* bin/relay-preamble.sh
|
|
3
|
-
* relay CLI가 있으면
|
|
2
|
+
* bin/relay-preamble.sh 스크립트를 생성한다.
|
|
3
|
+
* relay CLI가 있으면 사용, 없으면 curl fallback.
|
|
4
4
|
*/
|
|
5
5
|
export declare function generatePreambleScript(slug: string, apiUrl: string): string;
|
|
6
6
|
/**
|
|
7
|
-
* SKILL.md / command에 삽입할 preamble
|
|
8
|
-
*
|
|
7
|
+
* SKILL.md / command에 삽입할 preamble 마크다운.
|
|
8
|
+
* 단순히 relay ping을 호출한다.
|
|
9
9
|
*/
|
|
10
10
|
export declare function generatePreamble(slug: string): string;
|
|
11
11
|
/**
|
|
@@ -14,13 +14,9 @@ export declare function generatePreamble(slug: string): string;
|
|
|
14
14
|
export declare function generatePreambleBin(teamDir: string, slug: string, apiUrl: string): void;
|
|
15
15
|
/**
|
|
16
16
|
* frontmatter(---...---) 뒤에 preamble을 삽입한다.
|
|
17
|
-
* frontmatter가 없으면 파일 맨 앞에 삽입한다.
|
|
18
17
|
*/
|
|
19
18
|
export declare function injectPreamble(filePath: string, slug: string): void;
|
|
20
19
|
/**
|
|
21
20
|
* 팀의 사용자 진입점 파일에 preamble을 주입한다.
|
|
22
|
-
* - 루트 SKILL.md
|
|
23
|
-
* - user-invocable: true인 서브 스킬 SKILL.md
|
|
24
|
-
* - commands/*.md
|
|
25
21
|
*/
|
|
26
22
|
export declare function injectPreambleToTeam(teamDir: string, slug: string): number;
|
package/dist/lib/preamble.js
CHANGED
|
@@ -13,60 +13,47 @@ const path_1 = __importDefault(require("path"));
|
|
|
13
13
|
const PREAMBLE_START = '<!-- RELAY_PREAMBLE_START - DO NOT EDIT -->';
|
|
14
14
|
const PREAMBLE_END = '<!-- RELAY_PREAMBLE_END -->';
|
|
15
15
|
/**
|
|
16
|
-
* bin/relay-preamble.sh
|
|
17
|
-
* relay CLI가 있으면
|
|
16
|
+
* bin/relay-preamble.sh 스크립트를 생성한다.
|
|
17
|
+
* relay CLI가 있으면 사용, 없으면 curl fallback.
|
|
18
18
|
*/
|
|
19
19
|
function generatePreambleScript(slug, apiUrl) {
|
|
20
20
|
const registrySlug = slug.startsWith('@') ? slug.slice(1) : slug;
|
|
21
21
|
return `#!/usr/bin/env bash
|
|
22
22
|
# relay-preamble.sh — auto-generated by relay publish
|
|
23
|
-
|
|
24
|
-
set +e # preamble 실패가 팀 사용을 막으면 안 됨
|
|
23
|
+
set +e
|
|
25
24
|
|
|
26
|
-
SLUG="${slug}"
|
|
27
|
-
REGISTRY_SLUG="${registrySlug}"
|
|
28
|
-
API_URL="${apiUrl}"
|
|
29
|
-
SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
|
30
|
-
STATE_DIR="$HOME/.relay"
|
|
31
|
-
CACHE_FILE="$STATE_DIR/last-update-check"
|
|
32
|
-
|
|
33
|
-
# ─── Device hash (privacy-safe) ───
|
|
34
25
|
DEVICE_HASH=$(echo "$HOSTNAME:$USER" | shasum -a 256 | cut -d' ' -f1)
|
|
35
26
|
|
|
36
|
-
#
|
|
27
|
+
# Usage ping
|
|
37
28
|
if command -v relay &>/dev/null; then
|
|
38
|
-
relay ping "$
|
|
29
|
+
relay ping "${slug}" --quiet 2>/dev/null &
|
|
39
30
|
else
|
|
40
|
-
curl -sf -X POST "$
|
|
31
|
+
curl -sf -X POST "${apiUrl}/api/registry/${registrySlug}/ping" \\
|
|
41
32
|
-H "Content-Type: application/json" \\
|
|
42
33
|
-d "{\\"device_hash\\":\\"$DEVICE_HASH\\"}" \\
|
|
43
34
|
2>/dev/null &
|
|
44
35
|
fi
|
|
45
36
|
|
|
46
|
-
#
|
|
47
|
-
mkdir -p "$STATE_DIR"
|
|
37
|
+
# Update check
|
|
48
38
|
if command -v relay &>/dev/null; then
|
|
49
|
-
_UPD=$(relay check-update "$
|
|
39
|
+
_UPD=$(relay check-update "${slug}" --quiet 2>/dev/null || true)
|
|
50
40
|
[ -n "$_UPD" ] && echo "$_UPD" || true
|
|
51
41
|
fi
|
|
52
42
|
|
|
53
|
-
|
|
54
|
-
echo "RELAY_READY: $SLUG"
|
|
43
|
+
echo "RELAY_READY: ${slug}"
|
|
55
44
|
`;
|
|
56
45
|
}
|
|
57
46
|
/**
|
|
58
|
-
* SKILL.md / command에 삽입할 preamble
|
|
59
|
-
*
|
|
47
|
+
* SKILL.md / command에 삽입할 preamble 마크다운.
|
|
48
|
+
* 단순히 relay ping을 호출한다.
|
|
60
49
|
*/
|
|
61
50
|
function generatePreamble(slug) {
|
|
51
|
+
const teamPath = slug.startsWith('@') ? slug.slice(1) : slug;
|
|
62
52
|
return `${PREAMBLE_START}
|
|
63
53
|
## Preamble (run first)
|
|
64
54
|
|
|
65
55
|
\`\`\`bash
|
|
66
|
-
|
|
67
|
-
_PREAMBLE="$_DIR/bin/relay-preamble.sh"
|
|
68
|
-
[ ! -f "$_PREAMBLE" ] && _PREAMBLE="$HOME/.relay/teams/${slug.startsWith('@') ? slug.slice(1) : slug}/bin/relay-preamble.sh"
|
|
69
|
-
[ -f "$_PREAMBLE" ] && bash "$_PREAMBLE" 2>/dev/null || echo "RELAY_READY: ${slug}"
|
|
56
|
+
bash "$HOME/.relay/teams/${teamPath}/bin/relay-preamble.sh" 2>/dev/null || true
|
|
70
57
|
\`\`\`
|
|
71
58
|
|
|
72
59
|
If output shows \`CLI_UPGRADE_AVAILABLE <old> <new>\`: tell user "relay v{new} available. Run: npm update -g relayax-cli"
|
|
@@ -87,7 +74,6 @@ function generatePreambleBin(teamDir, slug, apiUrl) {
|
|
|
87
74
|
}
|
|
88
75
|
/**
|
|
89
76
|
* frontmatter(---...---) 뒤에 preamble을 삽입한다.
|
|
90
|
-
* frontmatter가 없으면 파일 맨 앞에 삽입한다.
|
|
91
77
|
*/
|
|
92
78
|
function injectPreamble(filePath, slug) {
|
|
93
79
|
const content = fs_1.default.readFileSync(filePath, 'utf-8');
|
|
@@ -118,19 +104,10 @@ function injectPreamble(filePath, slug) {
|
|
|
118
104
|
}
|
|
119
105
|
/**
|
|
120
106
|
* 팀의 사용자 진입점 파일에 preamble을 주입한다.
|
|
121
|
-
* - 루트 SKILL.md
|
|
122
|
-
* - user-invocable: true인 서브 스킬 SKILL.md
|
|
123
|
-
* - commands/*.md
|
|
124
107
|
*/
|
|
125
108
|
function injectPreambleToTeam(teamDir, slug) {
|
|
126
109
|
let count = 0;
|
|
127
|
-
// 1.
|
|
128
|
-
const rootSkill = path_1.default.join(teamDir, 'SKILL.md');
|
|
129
|
-
if (fs_1.default.existsSync(rootSkill)) {
|
|
130
|
-
injectPreamble(rootSkill, slug);
|
|
131
|
-
count++;
|
|
132
|
-
}
|
|
133
|
-
// 2. user-invocable 서브 스킬 SKILL.md만 (skills/**/SKILL.md)
|
|
110
|
+
// 1. user-invocable 서브 스킬 SKILL.md
|
|
134
111
|
const skillsDir = path_1.default.join(teamDir, 'skills');
|
|
135
112
|
if (fs_1.default.existsSync(skillsDir)) {
|
|
136
113
|
function walkSkills(dir) {
|
|
@@ -150,7 +127,7 @@ function injectPreambleToTeam(teamDir, slug) {
|
|
|
150
127
|
}
|
|
151
128
|
walkSkills(skillsDir);
|
|
152
129
|
}
|
|
153
|
-
//
|
|
130
|
+
// 2. commands/*.md
|
|
154
131
|
const commandsDir = path_1.default.join(teamDir, 'commands');
|
|
155
132
|
if (fs_1.default.existsSync(commandsDir)) {
|
|
156
133
|
for (const entry of fs_1.default.readdirSync(commandsDir, { withFileTypes: true })) {
|