relayax-cli 0.3.44 → 0.3.46
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/commands/create.js +3 -1
- package/dist/commands/init.js +3 -1
- package/dist/commands/install.js +3 -20
- package/dist/commands/package.js +8 -4
- package/dist/commands/publish.js +3 -28
- package/dist/commands/status.js +4 -2
- package/dist/commands/uninstall.js +4 -2
- package/dist/commands/update.js +0 -20
- package/dist/lib/ai-tools.d.ts +2 -2
- package/dist/lib/ai-tools.js +5 -5
- package/dist/lib/command-adapter.js +1 -1
- package/dist/lib/config.js +18 -10
- package/dist/lib/paths.d.ts +10 -0
- package/dist/lib/paths.js +22 -0
- package/dist/prompts/_setup-cli.md +18 -0
- package/dist/prompts/index.d.ts +0 -1
- package/dist/prompts/index.js +1 -3
- package/dist/prompts/install.md +1 -5
- package/dist/prompts/publish.md +0 -1
- package/package.json +1 -1
package/dist/commands/create.js
CHANGED
|
@@ -11,6 +11,7 @@ const ai_tools_js_1 = require("../lib/ai-tools.js");
|
|
|
11
11
|
const command_adapter_js_1 = require("../lib/command-adapter.js");
|
|
12
12
|
const init_js_1 = require("./init.js");
|
|
13
13
|
const slug_js_1 = require("../lib/slug.js");
|
|
14
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
14
15
|
const DEFAULT_DIRS = ['.relay/skills', '.relay/commands'];
|
|
15
16
|
/**
|
|
16
17
|
* 글로벌 User 커맨드가 없으면 설치한다.
|
|
@@ -29,9 +30,10 @@ function registerCreate(program) {
|
|
|
29
30
|
.option('--slug <slug>', 'URL용 식별자 (영문 소문자, 숫자, 하이픈)')
|
|
30
31
|
.option('--tags <tags>', '태그 (쉼표 구분)')
|
|
31
32
|
.option('--visibility <visibility>', '공개 범위 (public, private, internal)')
|
|
33
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
32
34
|
.action(async (name, opts) => {
|
|
33
35
|
const json = program.opts().json ?? false;
|
|
34
|
-
const projectPath =
|
|
36
|
+
const projectPath = (0, paths_js_1.resolveProjectPath)(opts.project);
|
|
35
37
|
const relayDir = path_1.default.join(projectPath, '.relay');
|
|
36
38
|
const relayYamlPath = path_1.default.join(relayDir, 'relay.yaml');
|
|
37
39
|
const isTTY = Boolean(process.stdin.isTTY) && !json;
|
package/dist/commands/init.js
CHANGED
|
@@ -9,6 +9,7 @@ exports.registerInit = registerInit;
|
|
|
9
9
|
const fs_1 = __importDefault(require("fs"));
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
11
|
const ai_tools_js_1 = require("../lib/ai-tools.js");
|
|
12
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
12
13
|
const command_adapter_js_1 = require("../lib/command-adapter.js");
|
|
13
14
|
const config_js_1 = require("../lib/config.js");
|
|
14
15
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
@@ -122,11 +123,12 @@ function registerInit(program) {
|
|
|
122
123
|
.option('--tools <tools>', '설치할 에이전트 CLI 지정 (쉼표 구분)')
|
|
123
124
|
.option('--all', '감지된 모든 에이전트 CLI에 설치')
|
|
124
125
|
.option('--auto', '대화형 프롬프트 없이 자동으로 모든 감지된 CLI에 설치')
|
|
126
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
125
127
|
.action(async (opts) => {
|
|
126
128
|
const json = program.opts().json ?? false;
|
|
127
129
|
// auto mode: --auto flag, --all flag, or stdin is not a TTY (but NOT --json alone)
|
|
128
130
|
const autoMode = opts.auto === true || opts.all === true || !process.stdin.isTTY;
|
|
129
|
-
const projectPath =
|
|
131
|
+
const projectPath = (0, paths_js_1.resolveProjectPath)(opts.project);
|
|
130
132
|
const detected = (0, ai_tools_js_1.detectAgentCLIs)(projectPath);
|
|
131
133
|
const detectedIds = new Set(detected.map((t) => t.value));
|
|
132
134
|
const isBuilder = isAgentProject(projectPath);
|
package/dist/commands/install.js
CHANGED
|
@@ -10,17 +10,18 @@ const api_js_1 = require("../lib/api.js");
|
|
|
10
10
|
const storage_js_1 = require("../lib/storage.js");
|
|
11
11
|
const config_js_1 = require("../lib/config.js");
|
|
12
12
|
const slug_js_1 = require("../lib/slug.js");
|
|
13
|
-
const contact_format_js_1 = require("../lib/contact-format.js");
|
|
14
13
|
const preamble_js_1 = require("../lib/preamble.js");
|
|
15
14
|
const init_js_1 = require("./init.js");
|
|
15
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
16
16
|
function registerInstall(program) {
|
|
17
17
|
program
|
|
18
18
|
.command('install <slug>')
|
|
19
19
|
.description('에이전트 패키지를 .relay/agents/에 다운로드합니다')
|
|
20
20
|
.option('--join-code <code>', '초대 코드 (Organization 에이전트 설치 시 자동 가입)')
|
|
21
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
21
22
|
.action(async (slugInput, _opts) => {
|
|
22
23
|
const json = program.opts().json ?? false;
|
|
23
|
-
const projectPath =
|
|
24
|
+
const projectPath = (0, paths_js_1.resolveProjectPath)(_opts.project);
|
|
24
25
|
const tempDir = (0, storage_js_1.makeTempDir)();
|
|
25
26
|
// Auto-init: 글로벌 커맨드가 없으면 자동 설치
|
|
26
27
|
if (!(0, init_js_1.hasGlobalUserCommands)()) {
|
|
@@ -228,7 +229,6 @@ function registerInstall(program) {
|
|
|
228
229
|
}
|
|
229
230
|
else {
|
|
230
231
|
const authorUsername = resolvedAgent.author?.username;
|
|
231
|
-
const authorDisplayName = resolvedAgent.author?.display_name ?? authorUsername ?? '';
|
|
232
232
|
const authorSuffix = authorUsername ? ` \x1b[90mby @${authorUsername}\x1b[0m` : '';
|
|
233
233
|
console.log(`\n\x1b[32m✓ ${resolvedAgent.name} 다운로드 완료\x1b[0m v${resolvedAgent.version}${authorSuffix}`);
|
|
234
234
|
console.log(` 위치: \x1b[36m${agentDir}\x1b[0m`);
|
|
@@ -239,23 +239,6 @@ function registerInstall(program) {
|
|
|
239
239
|
console.log(` \x1b[33m/${cmd.name}\x1b[0m - ${cmd.description}`);
|
|
240
240
|
}
|
|
241
241
|
}
|
|
242
|
-
// Builder business card
|
|
243
|
-
const contactParts = (0, contact_format_js_1.formatContactParts)(resolvedAgent.author?.contact_links);
|
|
244
|
-
const hasCard = resolvedAgent.welcome || contactParts.length > 0 || authorUsername;
|
|
245
|
-
if (hasCard) {
|
|
246
|
-
console.log(`\n \x1b[90m┌─ ${authorDisplayName || authorUsername || '빌더'}의 명함 ${'─'.repeat(Math.max(0, 34 - (authorDisplayName || authorUsername || '빌더').length))}┐\x1b[0m`);
|
|
247
|
-
if (resolvedAgent.welcome) {
|
|
248
|
-
const truncated = resolvedAgent.welcome.length > 45 ? resolvedAgent.welcome.slice(0, 45) + '...' : resolvedAgent.welcome;
|
|
249
|
-
console.log(` \x1b[90m│\x1b[0m 💬 "${truncated}"`);
|
|
250
|
-
}
|
|
251
|
-
if (contactParts.length > 0) {
|
|
252
|
-
console.log(` \x1b[90m│\x1b[0m 📇 ${contactParts.join(' ')}`);
|
|
253
|
-
}
|
|
254
|
-
if (authorUsername) {
|
|
255
|
-
console.log(` \x1b[90m│\x1b[0m 👤 relayax.com/@${authorUsername}`);
|
|
256
|
-
}
|
|
257
|
-
console.log(` \x1b[90m└${'─'.repeat(44)}┘\x1b[0m`);
|
|
258
|
-
}
|
|
259
242
|
// Usage hint (type-aware)
|
|
260
243
|
const agentType = resolvedAgent.type;
|
|
261
244
|
if (agentType === 'passive') {
|
package/dist/commands/package.js
CHANGED
|
@@ -12,6 +12,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
12
12
|
const crypto_1 = __importDefault(require("crypto"));
|
|
13
13
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
14
14
|
const ai_tools_js_1 = require("../lib/ai-tools.js");
|
|
15
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
15
16
|
const SYNC_DIRS = ['skills', 'commands', 'agents', 'rules'];
|
|
16
17
|
// ─── Helpers ───
|
|
17
18
|
function fileHash(filePath) {
|
|
@@ -261,16 +262,19 @@ function registerPackage(program) {
|
|
|
261
262
|
.option('--sync', '변경사항을 .relay/에 즉시 반영', false)
|
|
262
263
|
.option('--init', '최초 패키징: 소스 감지 → .relay/ 초기화', false)
|
|
263
264
|
.option('--migrate', '기존 source 필드를 contents로 마이그레이션', false)
|
|
265
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
266
|
+
.option('--home <dir>', '홈 디렉토리 경로 (기본: os.homedir(), 환경변수: RELAY_HOME)')
|
|
264
267
|
.action(async (opts) => {
|
|
265
268
|
const json = program.opts().json ?? false;
|
|
266
|
-
const projectPath =
|
|
269
|
+
const projectPath = (0, paths_js_1.resolveProjectPath)(opts.project);
|
|
270
|
+
const homeDir = (0, paths_js_1.resolveHome)(opts.home);
|
|
267
271
|
const relayDir = path_1.default.join(projectPath, '.relay');
|
|
268
272
|
const relayYamlPath = path_1.default.join(relayDir, 'relay.yaml');
|
|
269
273
|
// ─── 최초 패키징 (--init) ───
|
|
270
274
|
if (opts.init || !fs_1.default.existsSync(relayYamlPath)) {
|
|
271
275
|
// 로컬 + 글로벌 소스를 모두 스캔하여 개별 항목 목록 생성
|
|
272
276
|
const localTools = (0, ai_tools_js_1.detectAgentCLIs)(projectPath);
|
|
273
|
-
const globalTools = (0, ai_tools_js_1.detectGlobalCLIs)();
|
|
277
|
+
const globalTools = (0, ai_tools_js_1.detectGlobalCLIs)(homeDir);
|
|
274
278
|
const sources = [];
|
|
275
279
|
for (const tool of localTools) {
|
|
276
280
|
const items = (0, ai_tools_js_1.scanLocalItems)(projectPath, tool);
|
|
@@ -284,7 +288,7 @@ function registerPackage(program) {
|
|
|
284
288
|
}
|
|
285
289
|
}
|
|
286
290
|
for (const tool of globalTools) {
|
|
287
|
-
const items = (0, ai_tools_js_1.scanGlobalItems)(tool);
|
|
291
|
+
const items = (0, ai_tools_js_1.scanGlobalItems)(tool, homeDir);
|
|
288
292
|
if (items.length > 0) {
|
|
289
293
|
sources.push({
|
|
290
294
|
path: `~/${tool.skillsDir}`,
|
|
@@ -295,7 +299,7 @@ function registerPackage(program) {
|
|
|
295
299
|
}
|
|
296
300
|
}
|
|
297
301
|
// ~/.relay/agents/ 에 기존 에이전트 패키지가 있는지 스캔
|
|
298
|
-
const globalAgentsDir = path_1.default.join(os_1.default.homedir(), '.relay', 'agents');
|
|
302
|
+
const globalAgentsDir = path_1.default.join(homeDir ?? os_1.default.homedir(), '.relay', 'agents');
|
|
299
303
|
const existingAgents = [];
|
|
300
304
|
if (fs_1.default.existsSync(globalAgentsDir)) {
|
|
301
305
|
for (const entry of fs_1.default.readdirSync(globalAgentsDir, { withFileTypes: true })) {
|
package/dist/commands/publish.js
CHANGED
|
@@ -10,9 +10,9 @@ const os_1 = __importDefault(require("os"));
|
|
|
10
10
|
const js_yaml_1 = __importDefault(require("js-yaml"));
|
|
11
11
|
const tar_1 = require("tar");
|
|
12
12
|
const config_js_1 = require("../lib/config.js");
|
|
13
|
-
const contact_format_js_1 = require("../lib/contact-format.js");
|
|
14
13
|
const preamble_js_1 = require("../lib/preamble.js");
|
|
15
14
|
const version_check_js_1 = require("../lib/version-check.js");
|
|
15
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
16
16
|
// eslint-disable-next-line @typescript-eslint/no-var-requires
|
|
17
17
|
const cliPkg = require('../../package.json');
|
|
18
18
|
const VALID_DIRS = ['skills', 'agents', 'rules', 'commands', 'bin'];
|
|
@@ -285,9 +285,10 @@ function registerPublish(program) {
|
|
|
285
285
|
.option('--token <token>', '인증 토큰')
|
|
286
286
|
.option('--space <slug>', '배포할 Space 지정')
|
|
287
287
|
.option('--version <version>', '배포 버전 지정 (relay.yaml 업데이트)')
|
|
288
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
288
289
|
.action(async (opts) => {
|
|
289
290
|
const json = program.opts().json ?? false;
|
|
290
|
-
const agentDir =
|
|
291
|
+
const agentDir = (0, paths_js_1.resolveProjectPath)(opts.project);
|
|
291
292
|
const relayDir = path_1.default.join(agentDir, '.relay');
|
|
292
293
|
const relayYamlPath = path_1.default.join(relayDir, 'relay.yaml');
|
|
293
294
|
const isTTY = Boolean(process.stdin.isTTY) && !json;
|
|
@@ -355,7 +356,6 @@ function registerPublish(program) {
|
|
|
355
356
|
{ name: '비공개 — Org 멤버만', value: 'internal' },
|
|
356
357
|
],
|
|
357
358
|
});
|
|
358
|
-
console.error('\n\x1b[2m💡 프로필에 연락처를 설정하면 설치 시 명함이 전달됩니다: www.relayax.com/dashboard/profile\x1b[0m');
|
|
359
359
|
if (visibility === 'private') {
|
|
360
360
|
console.error('\x1b[2m💡 링크 공유 에이전트는 웹 대시보드에서 접근 링크와 구매 안내를 설정하세요: www.relayax.com/dashboard\x1b[0m');
|
|
361
361
|
}
|
|
@@ -601,10 +601,6 @@ function registerPublish(program) {
|
|
|
601
601
|
console.error(` → relay.yaml에 visibility: ${config.visibility} 저장됨 (${visLabelMap[config.visibility]})\n`);
|
|
602
602
|
}
|
|
603
603
|
}
|
|
604
|
-
// Profile hint
|
|
605
|
-
if (isTTY) {
|
|
606
|
-
console.error('💡 프로필에 연락처를 설정하면 설치 시 명함이 전달됩니다: www.relayax.com/dashboard/profile');
|
|
607
|
-
}
|
|
608
604
|
const detectedCommands = detectCommands(relayDir);
|
|
609
605
|
const components = {
|
|
610
606
|
agents: countDir(relayDir, 'agents'),
|
|
@@ -687,27 +683,6 @@ function registerPublish(program) {
|
|
|
687
683
|
console.log(`\n\x1b[32m✓ ${config.name} 배포 완료\x1b[0m v${result.version}`);
|
|
688
684
|
console.log(` 슬러그: \x1b[36m${result.slug}\x1b[0m`);
|
|
689
685
|
console.log(` URL: \x1b[36m${result.url}\x1b[0m`);
|
|
690
|
-
// Show business card preview
|
|
691
|
-
const profile = result.profile;
|
|
692
|
-
if (profile) {
|
|
693
|
-
const contactParts = (0, contact_format_js_1.formatContactParts)(profile.contact_links);
|
|
694
|
-
const welcome = profile.default_welcome ?? '';
|
|
695
|
-
console.log(`\n \x1b[90m┌─ 설치자에게 보이는 명함 ${'─'.repeat(24)}┐\x1b[0m`);
|
|
696
|
-
if (welcome) {
|
|
697
|
-
console.log(` \x1b[90m│\x1b[0m 💬 "${welcome.length > 45 ? welcome.slice(0, 45) + '...' : welcome}"`);
|
|
698
|
-
}
|
|
699
|
-
if (contactParts.length > 0) {
|
|
700
|
-
console.log(` \x1b[90m│\x1b[0m 📇 ${contactParts.join(' ')}`);
|
|
701
|
-
}
|
|
702
|
-
if (profile.username) {
|
|
703
|
-
console.log(` \x1b[90m│\x1b[0m 👤 relayax.com/@${profile.username}`);
|
|
704
|
-
}
|
|
705
|
-
if (!welcome && contactParts.length === 0) {
|
|
706
|
-
console.log(` \x1b[90m│\x1b[0m \x1b[2m명함이 비어있습니다\x1b[0m`);
|
|
707
|
-
}
|
|
708
|
-
console.log(` \x1b[90m└${'─'.repeat(44)}┘\x1b[0m`);
|
|
709
|
-
console.log(`\n \x1b[90m명함 수정: \x1b[36mwww.relayax.com/dashboard/profile\x1b[0m`);
|
|
710
|
-
}
|
|
711
686
|
// Show shareable onboarding guide as a plain copyable block
|
|
712
687
|
if (isTTY) {
|
|
713
688
|
const detailSlug = result.slug.startsWith('@') ? result.slug.slice(1) : result.slug;
|
package/dist/commands/status.js
CHANGED
|
@@ -7,6 +7,7 @@ exports.registerStatus = registerStatus;
|
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
const ai_tools_js_1 = require("../lib/ai-tools.js");
|
|
10
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
10
11
|
const config_js_1 = require("../lib/config.js");
|
|
11
12
|
const command_adapter_js_1 = require("../lib/command-adapter.js");
|
|
12
13
|
async function resolveUsername(token) {
|
|
@@ -27,9 +28,10 @@ function registerStatus(program) {
|
|
|
27
28
|
program
|
|
28
29
|
.command('status')
|
|
29
30
|
.description('현재 relay 환경 상태를 표시합니다')
|
|
30
|
-
.
|
|
31
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
32
|
+
.action(async (opts) => {
|
|
31
33
|
const json = program.opts().json ?? false;
|
|
32
|
-
const projectPath =
|
|
34
|
+
const projectPath = (0, paths_js_1.resolveProjectPath)(opts.project);
|
|
33
35
|
// 1. 로그인 상태
|
|
34
36
|
const token = await (0, config_js_1.getValidToken)();
|
|
35
37
|
let username;
|
|
@@ -10,6 +10,7 @@ const config_js_1 = require("../lib/config.js");
|
|
|
10
10
|
const installer_js_1 = require("../lib/installer.js");
|
|
11
11
|
const slug_js_1 = require("../lib/slug.js");
|
|
12
12
|
const ai_tools_js_1 = require("../lib/ai-tools.js");
|
|
13
|
+
const paths_js_1 = require("../lib/paths.js");
|
|
13
14
|
/**
|
|
14
15
|
* deployed_files에서 에이전트 설정 디렉토리(skillsDir) 기반 boundary를 추론한다.
|
|
15
16
|
* 예: deployed_files에 '~/.cursor/commands/relay/x.md'가 있으면 boundary는 basePath/.cursor
|
|
@@ -31,7 +32,8 @@ function registerUninstall(program) {
|
|
|
31
32
|
program
|
|
32
33
|
.command('uninstall <slug>')
|
|
33
34
|
.description('에이전트 제거')
|
|
34
|
-
.
|
|
35
|
+
.option('--project <dir>', '프로젝트 루트 경로 (기본: cwd, 환경변수: RELAY_PROJECT_PATH)')
|
|
36
|
+
.action((slugInput, _opts) => {
|
|
35
37
|
const json = program.opts().json ?? false;
|
|
36
38
|
const localInstalled = (0, config_js_1.loadInstalled)();
|
|
37
39
|
const globalInstalled = (0, config_js_1.loadGlobalInstalled)();
|
|
@@ -70,7 +72,7 @@ function registerUninstall(program) {
|
|
|
70
72
|
const deployedRemoved = (0, installer_js_1.uninstallAgent)(localEntry.deployed_files);
|
|
71
73
|
totalRemoved += deployedRemoved.length;
|
|
72
74
|
// Clean empty parent directories
|
|
73
|
-
const boundary = inferBoundary(localEntry.deployed_files,
|
|
75
|
+
const boundary = inferBoundary(localEntry.deployed_files, (0, paths_js_1.resolveProjectPath)(_opts.project));
|
|
74
76
|
for (const f of deployedRemoved) {
|
|
75
77
|
(0, installer_js_1.cleanEmptyParents)(f, boundary);
|
|
76
78
|
}
|
package/dist/commands/update.js
CHANGED
|
@@ -6,7 +6,6 @@ const storage_js_1 = require("../lib/storage.js");
|
|
|
6
6
|
const installer_js_1 = require("../lib/installer.js");
|
|
7
7
|
const config_js_1 = require("../lib/config.js");
|
|
8
8
|
const slug_js_1 = require("../lib/slug.js");
|
|
9
|
-
const contact_format_js_1 = require("../lib/contact-format.js");
|
|
10
9
|
const preamble_js_1 = require("../lib/preamble.js");
|
|
11
10
|
function registerUpdate(program) {
|
|
12
11
|
program
|
|
@@ -95,11 +94,6 @@ function registerUpdate(program) {
|
|
|
95
94
|
console.log(`\n\x1b[32m✓ ${agent.name} ${fromLabel}v${latestVersion} 업데이트 완료\x1b[0m`);
|
|
96
95
|
console.log(` 설치 위치: \x1b[36m${installPath}\x1b[0m`);
|
|
97
96
|
console.log(` 파일 수: ${files.length}개`);
|
|
98
|
-
// Builder business card
|
|
99
|
-
const authorUsername = agent.author?.username;
|
|
100
|
-
const authorDisplayName = agent.author?.display_name ?? authorUsername ?? '';
|
|
101
|
-
const contactParts = (0, contact_format_js_1.formatContactParts)(agent.author?.contact_links);
|
|
102
|
-
const hasCard = agent.welcome || contactParts.length > 0 || authorUsername;
|
|
103
97
|
// Show changelog for this version
|
|
104
98
|
try {
|
|
105
99
|
const versions = await (0, api_js_1.fetchAgentVersions)(slug);
|
|
@@ -115,20 +109,6 @@ function registerUpdate(program) {
|
|
|
115
109
|
catch {
|
|
116
110
|
// Non-critical: skip changelog display
|
|
117
111
|
}
|
|
118
|
-
if (hasCard) {
|
|
119
|
-
console.log(`\n \x1b[90m┌─ ${authorDisplayName || '빌더'}의 명함 ${'─'.repeat(Math.max(0, 34 - (authorDisplayName || '빌더').length))}┐\x1b[0m`);
|
|
120
|
-
if (agent.welcome) {
|
|
121
|
-
const truncated = agent.welcome.length > 45 ? agent.welcome.slice(0, 45) + '...' : agent.welcome;
|
|
122
|
-
console.log(` \x1b[90m│\x1b[0m 💬 "${truncated}"`);
|
|
123
|
-
}
|
|
124
|
-
if (contactParts.length > 0) {
|
|
125
|
-
console.log(` \x1b[90m│\x1b[0m 📇 ${contactParts.join(' ')}`);
|
|
126
|
-
}
|
|
127
|
-
if (authorUsername) {
|
|
128
|
-
console.log(` \x1b[90m│\x1b[0m 👤 relayax.com/@${authorUsername}`);
|
|
129
|
-
}
|
|
130
|
-
console.log(` \x1b[90m└${'─'.repeat(44)}┘\x1b[0m`);
|
|
131
|
-
}
|
|
132
112
|
}
|
|
133
113
|
}
|
|
134
114
|
catch (err) {
|
package/dist/lib/ai-tools.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export declare function detectAgentCLIs(projectPath: string): AITool[];
|
|
|
16
16
|
* 홈 디렉토리에서 글로벌 에이전트 CLI 디렉토리를 감지한다.
|
|
17
17
|
* ~/{skillsDir}/ 가 존재하는 CLI를 반환.
|
|
18
18
|
*/
|
|
19
|
-
export declare function detectGlobalCLIs(): AITool[];
|
|
19
|
+
export declare function detectGlobalCLIs(home?: string): AITool[];
|
|
20
20
|
export type ContentType = 'skill' | 'agent' | 'command' | 'rule';
|
|
21
21
|
export interface ContentItem {
|
|
22
22
|
name: string;
|
|
@@ -31,4 +31,4 @@ export declare function scanLocalItems(projectPath: string, tool: AITool): Conte
|
|
|
31
31
|
/**
|
|
32
32
|
* 글로벌 홈 디렉토리 소스의 개별 스킬/에이전트/커맨드/룰 항목을 반환한다.
|
|
33
33
|
*/
|
|
34
|
-
export declare function scanGlobalItems(tool: AITool): ContentItem[];
|
|
34
|
+
export declare function scanGlobalItems(tool: AITool, home?: string): ContentItem[];
|
package/dist/lib/ai-tools.js
CHANGED
|
@@ -51,9 +51,9 @@ function detectAgentCLIs(projectPath) {
|
|
|
51
51
|
* 홈 디렉토리에서 글로벌 에이전트 CLI 디렉토리를 감지한다.
|
|
52
52
|
* ~/{skillsDir}/ 가 존재하는 CLI를 반환.
|
|
53
53
|
*/
|
|
54
|
-
function detectGlobalCLIs() {
|
|
55
|
-
const
|
|
56
|
-
return exports.AI_TOOLS.filter((tool) => fs_1.default.existsSync(path_1.default.join(
|
|
54
|
+
function detectGlobalCLIs(home) {
|
|
55
|
+
const homeDir = home ?? os_1.default.homedir();
|
|
56
|
+
return exports.AI_TOOLS.filter((tool) => fs_1.default.existsSync(path_1.default.join(homeDir, tool.skillsDir)));
|
|
57
57
|
}
|
|
58
58
|
const CONTENT_DIRS = [
|
|
59
59
|
{ dir: 'skills', type: 'skill' },
|
|
@@ -96,7 +96,7 @@ function scanLocalItems(projectPath, tool) {
|
|
|
96
96
|
/**
|
|
97
97
|
* 글로벌 홈 디렉토리 소스의 개별 스킬/에이전트/커맨드/룰 항목을 반환한다.
|
|
98
98
|
*/
|
|
99
|
-
function scanGlobalItems(tool) {
|
|
100
|
-
const basePath = path_1.default.join(os_1.default.homedir(), tool.skillsDir);
|
|
99
|
+
function scanGlobalItems(tool, home) {
|
|
100
|
+
const basePath = path_1.default.join(home ?? os_1.default.homedir(), tool.skillsDir);
|
|
101
101
|
return scanItemsIn(basePath);
|
|
102
102
|
}
|
|
@@ -60,7 +60,7 @@ function formatCommandFile(content) {
|
|
|
60
60
|
return `---\ndescription: ${content.description}\n---\n\n${content.body}\n`;
|
|
61
61
|
}
|
|
62
62
|
// ─── 프롬프트 조각은 cli/src/prompts/*.md에서 관리 (SSOT) ───
|
|
63
|
-
// REQUIREMENTS_CHECK, ERROR_HANDLING_GUIDE
|
|
63
|
+
// REQUIREMENTS_CHECK, ERROR_HANDLING_GUIDE → import from '../prompts/index.js'
|
|
64
64
|
// ─── User Commands (글로벌 설치) ───
|
|
65
65
|
exports.USER_COMMANDS = [
|
|
66
66
|
{
|
package/dist/lib/config.js
CHANGED
|
@@ -22,7 +22,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
22
22
|
const os_1 = __importDefault(require("os"));
|
|
23
23
|
const ai_tools_js_1 = require("./ai-tools.js");
|
|
24
24
|
exports.API_URL = 'https://www.relayax.com';
|
|
25
|
-
const GLOBAL_RELAY_DIR = path_1.default.join(os_1.default.homedir(), '.relay');
|
|
25
|
+
const GLOBAL_RELAY_DIR = path_1.default.join(process.env.RELAY_HOME ?? os_1.default.homedir(), '.relay');
|
|
26
26
|
/**
|
|
27
27
|
* 설치 경로를 결정한다.
|
|
28
28
|
* 1. --path 옵션이 있으면 그대로 사용
|
|
@@ -31,17 +31,18 @@ const GLOBAL_RELAY_DIR = path_1.default.join(os_1.default.homedir(), '.relay');
|
|
|
31
31
|
*/
|
|
32
32
|
function getInstallPath(override) {
|
|
33
33
|
if (override) {
|
|
34
|
+
const homeDir = process.env.RELAY_HOME ?? os_1.default.homedir();
|
|
34
35
|
const resolved = override.startsWith('~')
|
|
35
|
-
? path_1.default.join(
|
|
36
|
+
? path_1.default.join(homeDir, override.slice(1))
|
|
36
37
|
: path_1.default.resolve(override);
|
|
37
38
|
return resolved;
|
|
38
39
|
}
|
|
39
|
-
const
|
|
40
|
-
const detected = (0, ai_tools_js_1.detectAgentCLIs)(
|
|
40
|
+
const projectRoot = getProjectRoot();
|
|
41
|
+
const detected = (0, ai_tools_js_1.detectAgentCLIs)(projectRoot);
|
|
41
42
|
if (detected.length >= 1) {
|
|
42
|
-
return path_1.default.join(
|
|
43
|
+
return path_1.default.join(projectRoot, detected[0].skillsDir);
|
|
43
44
|
}
|
|
44
|
-
return
|
|
45
|
+
return projectRoot;
|
|
45
46
|
}
|
|
46
47
|
/** ~/.relay/ — 글로벌 (token, CLI cache) */
|
|
47
48
|
function ensureGlobalRelayDir() {
|
|
@@ -49,9 +50,13 @@ function ensureGlobalRelayDir() {
|
|
|
49
50
|
fs_1.default.mkdirSync(GLOBAL_RELAY_DIR, { recursive: true });
|
|
50
51
|
}
|
|
51
52
|
}
|
|
53
|
+
/** 프로젝트 루트 경로 (RELAY_PROJECT_PATH > cwd) */
|
|
54
|
+
function getProjectRoot() {
|
|
55
|
+
return process.env.RELAY_PROJECT_PATH ?? process.cwd();
|
|
56
|
+
}
|
|
52
57
|
/** cwd/.relay/ — 프로젝트 로컬 (installed.json, agents/) */
|
|
53
58
|
function ensureProjectRelayDir() {
|
|
54
|
-
const dir = path_1.default.join(
|
|
59
|
+
const dir = path_1.default.join(getProjectRoot(), '.relay');
|
|
55
60
|
if (!fs_1.default.existsSync(dir)) {
|
|
56
61
|
fs_1.default.mkdirSync(dir, { recursive: true });
|
|
57
62
|
}
|
|
@@ -90,7 +95,7 @@ function saveToken(token) {
|
|
|
90
95
|
fs_1.default.writeFileSync(tokenFile, JSON.stringify({ access_token: token }), { mode: 0o600 });
|
|
91
96
|
fs_1.default.chmodSync(tokenFile, 0o600);
|
|
92
97
|
}
|
|
93
|
-
const LOCK_FILE = path_1.default.join(
|
|
98
|
+
const LOCK_FILE = path_1.default.join(GLOBAL_RELAY_DIR, '.token.lock');
|
|
94
99
|
const LOCK_TIMEOUT = 15000; // 15s
|
|
95
100
|
/**
|
|
96
101
|
* 파일 기반 lock — 여러 CLI 프로세스가 동시에 refresh하는 것을 방지.
|
|
@@ -154,6 +159,9 @@ async function doRefresh(refreshToken) {
|
|
|
154
159
|
* - refresh 실패해도 access_token이 아직 유효하면 계속 사용
|
|
155
160
|
*/
|
|
156
161
|
async function getValidToken() {
|
|
162
|
+
// RELAY_TOKEN 환경변수가 있으면 최우선 사용 (sandbox/CI 환경)
|
|
163
|
+
if (process.env.RELAY_TOKEN)
|
|
164
|
+
return process.env.RELAY_TOKEN;
|
|
157
165
|
// 매번 파일에서 새로 읽음 (다른 프로세스가 갱신했을 수 있으므로)
|
|
158
166
|
const data = loadTokenData();
|
|
159
167
|
if (!data)
|
|
@@ -218,7 +226,7 @@ function normalizeInstalledRegistry(raw) {
|
|
|
218
226
|
}
|
|
219
227
|
/** 프로젝트 로컬 installed.json 읽기 */
|
|
220
228
|
function loadInstalled() {
|
|
221
|
-
const file = path_1.default.join(
|
|
229
|
+
const file = path_1.default.join(getProjectRoot(), '.relay', 'installed.json');
|
|
222
230
|
if (!fs_1.default.existsSync(file)) {
|
|
223
231
|
return {};
|
|
224
232
|
}
|
|
@@ -232,7 +240,7 @@ function loadInstalled() {
|
|
|
232
240
|
/** 프로젝트 로컬 installed.json 쓰기 */
|
|
233
241
|
function saveInstalled(registry) {
|
|
234
242
|
ensureProjectRelayDir();
|
|
235
|
-
const file = path_1.default.join(
|
|
243
|
+
const file = path_1.default.join(getProjectRoot(), '.relay', 'installed.json');
|
|
236
244
|
fs_1.default.writeFileSync(file, JSON.stringify(registry, null, 2));
|
|
237
245
|
}
|
|
238
246
|
// ─── 글로벌 레지스트리 ───
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* 프로젝트 루트 경로를 결정한다.
|
|
3
|
+
* 우선순위: --project 옵션 > RELAY_PROJECT_PATH 환경변수 > process.cwd()
|
|
4
|
+
*/
|
|
5
|
+
export declare function resolveProjectPath(optProject?: string): string;
|
|
6
|
+
/**
|
|
7
|
+
* 홈 디렉토리 경로를 결정한다.
|
|
8
|
+
* 우선순위: --home 옵션 > RELAY_HOME 환경변수 > os.homedir()
|
|
9
|
+
*/
|
|
10
|
+
export declare function resolveHome(optHome?: string): string;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.resolveProjectPath = resolveProjectPath;
|
|
7
|
+
exports.resolveHome = resolveHome;
|
|
8
|
+
const os_1 = __importDefault(require("os"));
|
|
9
|
+
/**
|
|
10
|
+
* 프로젝트 루트 경로를 결정한다.
|
|
11
|
+
* 우선순위: --project 옵션 > RELAY_PROJECT_PATH 환경변수 > process.cwd()
|
|
12
|
+
*/
|
|
13
|
+
function resolveProjectPath(optProject) {
|
|
14
|
+
return optProject ?? process.env.RELAY_PROJECT_PATH ?? process.cwd();
|
|
15
|
+
}
|
|
16
|
+
/**
|
|
17
|
+
* 홈 디렉토리 경로를 결정한다.
|
|
18
|
+
* 우선순위: --home 옵션 > RELAY_HOME 환경변수 > os.homedir()
|
|
19
|
+
*/
|
|
20
|
+
function resolveHome(optHome) {
|
|
21
|
+
return optHome ?? process.env.RELAY_HOME ?? os_1.default.homedir();
|
|
22
|
+
}
|
|
@@ -1,3 +1,21 @@
|
|
|
1
|
+
## Step 0. 환경 감지
|
|
2
|
+
|
|
3
|
+
sandbox 환경(Cowork, Codex 등)에서는 `$HOME`이 격리될 수 있습니다.
|
|
4
|
+
아래 명령어로 확인하세요:
|
|
5
|
+
|
|
6
|
+
```bash
|
|
7
|
+
ls ~/.relay/token 2>/dev/null && echo "token-ok" || echo "token-missing"
|
|
8
|
+
```
|
|
9
|
+
|
|
10
|
+
`token-missing`이면, 이 세션에서 `relay login --device`로 새로 로그인해야 합니다.
|
|
11
|
+
이미 로그인한 토큰이 있다면 환경변수로 전달할 수도 있습니다:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
export RELAY_TOKEN=<토큰>
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
`token-ok`이면 이 단계를 건너뛰세요.
|
|
18
|
+
|
|
1
19
|
## Step 1. Relay CLI 설치
|
|
2
20
|
|
|
3
21
|
relay CLI가 설치되어 있지 않다면:
|
package/dist/prompts/index.d.ts
CHANGED
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export declare const REQUIREMENTS_CHECK: string;
|
|
2
2
|
export declare const ERROR_HANDLING_GUIDE: string;
|
|
3
|
-
export declare const BUSINESS_CARD_FORMAT: string;
|
|
4
3
|
export declare const SETUP_CLI: string;
|
|
5
4
|
export declare const SETUP_LOGIN: string;
|
|
6
5
|
export declare const INSTALL_PROMPT: string;
|
package/dist/prompts/index.js
CHANGED
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.PUBLISH_PROMPT = exports.INSTALL_PROMPT = exports.SETUP_LOGIN = exports.SETUP_CLI = exports.
|
|
6
|
+
exports.PUBLISH_PROMPT = exports.INSTALL_PROMPT = exports.SETUP_LOGIN = exports.SETUP_CLI = exports.ERROR_HANDLING_GUIDE = exports.REQUIREMENTS_CHECK = void 0;
|
|
7
7
|
const fs_1 = __importDefault(require("fs"));
|
|
8
8
|
const path_1 = __importDefault(require("path"));
|
|
9
9
|
function readPrompt(filename) {
|
|
@@ -15,13 +15,11 @@ function interpolate(template, vars) {
|
|
|
15
15
|
// ─── 공유 조각 ───
|
|
16
16
|
exports.REQUIREMENTS_CHECK = readPrompt('_requirements-check.md');
|
|
17
17
|
exports.ERROR_HANDLING_GUIDE = readPrompt('_error-handling.md');
|
|
18
|
-
exports.BUSINESS_CARD_FORMAT = readPrompt('_business-card.md');
|
|
19
18
|
exports.SETUP_CLI = readPrompt('_setup-cli.md');
|
|
20
19
|
exports.SETUP_LOGIN = readPrompt('_setup-login.md');
|
|
21
20
|
const fragments = {
|
|
22
21
|
REQUIREMENTS_CHECK: exports.REQUIREMENTS_CHECK,
|
|
23
22
|
ERROR_HANDLING_GUIDE: exports.ERROR_HANDLING_GUIDE,
|
|
24
|
-
BUSINESS_CARD_FORMAT: exports.BUSINESS_CARD_FORMAT,
|
|
25
23
|
};
|
|
26
24
|
// ─── 전체 프롬프트 (조각 합성 완료) ───
|
|
27
25
|
exports.INSTALL_PROMPT = interpolate(readPrompt('install.md'), fragments);
|
package/dist/prompts/install.md
CHANGED
|
@@ -132,10 +132,8 @@ relay deploy-record <slug> --scope <global|local> --files <배치된_파일1> <
|
|
|
132
132
|
|
|
133
133
|
#### 3-1. 완료 안내
|
|
134
134
|
- 배치된 파일과 활성화된 커맨드 목록을 보여줍니다.
|
|
135
|
-
{{BUSINESS_CARD_FORMAT}}
|
|
136
|
-
|
|
137
135
|
#### 3-2. 팔로우 제안 (필수 — 이 단계를 절대 건너뛰지 마세요)
|
|
138
|
-
|
|
136
|
+
빌더의 username이 JSON 결과에 있으면 **반드시** 사용자 질문 도구를 호출하세요.
|
|
139
137
|
|
|
140
138
|
**사용자 질문 도구 호출:**
|
|
141
139
|
- question: `@{username}을 팔로우할까요? 새 버전 알림을 받을 수 있습니다.`
|
|
@@ -178,7 +176,6 @@ https://relayax.com/api/registry/{owner}/{slug}/guide.md
|
|
|
178
176
|
→ 사용자 질문 도구: "어디에 설치할까요?" → ["글로벌 (모든 프로젝트)", "로컬 (이 프로젝트만)"]
|
|
179
177
|
→ "글로벌" 선택
|
|
180
178
|
→ 설치 + 배치 + deploy-record
|
|
181
|
-
→ 명함 표시
|
|
182
179
|
→ 사용자 질문 도구: "@alice을 팔로우할까요?" → ["팔로우", "건너뛰기"]
|
|
183
180
|
→ "✓ 설치 완료! /write-doc를 사용해볼까요?"
|
|
184
181
|
|
|
@@ -186,6 +183,5 @@ https://relayax.com/api/registry/{owner}/{slug}/guide.md
|
|
|
186
183
|
→ relay install @alice/doc-writer --json 실행 (Step 1 건너뜀)
|
|
187
184
|
→ 사용자 질문 도구: "어디에 설치할까요?" → ["글로벌 (모든 프로젝트)", "로컬 (이 프로젝트만)"]
|
|
188
185
|
→ 설치 + 배치 + deploy-record
|
|
189
|
-
→ 명함 표시
|
|
190
186
|
→ 사용자 질문 도구: "@alice을 팔로우할까요?" → ["팔로우", "건너뛰기"]
|
|
191
187
|
→ "✓ 설치 완료! /write-doc를 사용해볼까요?"
|
package/dist/prompts/publish.md
CHANGED
|
@@ -429,7 +429,6 @@ https://relayax.com/api/registry/{owner}/{slug}/guide.md
|
|
|
429
429
|
- `{owner}`과 `{slug}`는 배포된 에이전트의 실제 슬러그에서 추출합니다 (`@owner/slug` → `owner`, `slug`).
|
|
430
430
|
- "이 블록을 동료에게 공유하면 AI 에이전트가 환경 체크부터 설치까지 자동으로 해줍니다"라고 안내합니다.
|
|
431
431
|
- CLI가 이미 설치된 사용자를 위한 짧은 버전도 함께 표시: `/relay:relay-install <slug>`
|
|
432
|
-
{{BUSINESS_CARD_FORMAT}}
|
|
433
432
|
|
|
434
433
|
## 예시
|
|
435
434
|
|