anpm-io 1.0.0
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/README.md +174 -0
- package/dist/commands/access.d.ts +2 -0
- package/dist/commands/access.js +90 -0
- package/dist/commands/adopt.d.ts +2 -0
- package/dist/commands/adopt.js +177 -0
- package/dist/commands/changelog.d.ts +2 -0
- package/dist/commands/changelog.js +67 -0
- package/dist/commands/check-update.d.ts +2 -0
- package/dist/commands/check-update.js +76 -0
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +84 -0
- package/dist/commands/create.d.ts +2 -0
- package/dist/commands/create.js +227 -0
- package/dist/commands/deploy-record.d.ts +2 -0
- package/dist/commands/deploy-record.js +93 -0
- package/dist/commands/deploy.d.ts +2 -0
- package/dist/commands/deploy.js +284 -0
- package/dist/commands/diff.d.ts +2 -0
- package/dist/commands/diff.js +92 -0
- package/dist/commands/feedback.d.ts +2 -0
- package/dist/commands/feedback.js +71 -0
- package/dist/commands/grant.d.ts +33 -0
- package/dist/commands/grant.js +190 -0
- package/dist/commands/hub.d.ts +2 -0
- package/dist/commands/hub.js +171 -0
- package/dist/commands/init.d.ts +13 -0
- package/dist/commands/init.js +172 -0
- package/dist/commands/install.d.ts +2 -0
- package/dist/commands/install.js +626 -0
- package/dist/commands/join.d.ts +6 -0
- package/dist/commands/join.js +90 -0
- package/dist/commands/link.d.ts +2 -0
- package/dist/commands/link.js +112 -0
- package/dist/commands/list.d.ts +2 -0
- package/dist/commands/list.js +144 -0
- package/dist/commands/login.d.ts +7 -0
- package/dist/commands/login.js +235 -0
- package/dist/commands/orgs.d.ts +10 -0
- package/dist/commands/orgs.js +128 -0
- package/dist/commands/outdated.d.ts +2 -0
- package/dist/commands/outdated.js +70 -0
- package/dist/commands/package.d.ts +57 -0
- package/dist/commands/package.js +569 -0
- package/dist/commands/ping.d.ts +2 -0
- package/dist/commands/ping.js +40 -0
- package/dist/commands/publish.d.ts +98 -0
- package/dist/commands/publish.js +899 -0
- package/dist/commands/run.d.ts +2 -0
- package/dist/commands/run.js +249 -0
- package/dist/commands/search.d.ts +2 -0
- package/dist/commands/search.js +57 -0
- package/dist/commands/status.d.ts +2 -0
- package/dist/commands/status.js +159 -0
- package/dist/commands/uninstall.d.ts +2 -0
- package/dist/commands/uninstall.js +132 -0
- package/dist/commands/update.d.ts +2 -0
- package/dist/commands/update.js +171 -0
- package/dist/commands/versions.d.ts +2 -0
- package/dist/commands/versions.js +44 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +91 -0
- package/dist/lib/agent-status.d.ts +23 -0
- package/dist/lib/agent-status.js +127 -0
- package/dist/lib/ai-tools.d.ts +34 -0
- package/dist/lib/ai-tools.js +104 -0
- package/dist/lib/anpm-config.d.ts +39 -0
- package/dist/lib/anpm-config.js +112 -0
- package/dist/lib/api.d.ts +24 -0
- package/dist/lib/api.js +151 -0
- package/dist/lib/auto-detect.d.ts +30 -0
- package/dist/lib/auto-detect.js +112 -0
- package/dist/lib/cloud-providers/anthropic.d.ts +19 -0
- package/dist/lib/cloud-providers/anthropic.js +200 -0
- package/dist/lib/cloud-providers/package-mapper.d.ts +9 -0
- package/dist/lib/cloud-providers/package-mapper.js +34 -0
- package/dist/lib/cloud-providers/provider.d.ts +60 -0
- package/dist/lib/cloud-providers/provider.js +7 -0
- package/dist/lib/command-adapter.d.ts +41 -0
- package/dist/lib/command-adapter.js +188 -0
- package/dist/lib/config.d.ts +50 -0
- package/dist/lib/config.js +274 -0
- package/dist/lib/contact-format.d.ts +7 -0
- package/dist/lib/contact-format.js +23 -0
- package/dist/lib/device-hash.d.ts +1 -0
- package/dist/lib/device-hash.js +16 -0
- package/dist/lib/error-report.d.ts +5 -0
- package/dist/lib/error-report.js +28 -0
- package/dist/lib/git-installer.d.ts +16 -0
- package/dist/lib/git-installer.js +97 -0
- package/dist/lib/git-operations.d.ts +38 -0
- package/dist/lib/git-operations.js +183 -0
- package/dist/lib/hub-notify.d.ts +9 -0
- package/dist/lib/hub-notify.js +66 -0
- package/dist/lib/install-source.d.ts +33 -0
- package/dist/lib/install-source.js +98 -0
- package/dist/lib/installer.d.ts +40 -0
- package/dist/lib/installer.js +358 -0
- package/dist/lib/local-installer.d.ts +15 -0
- package/dist/lib/local-installer.js +73 -0
- package/dist/lib/lockfile.d.ts +13 -0
- package/dist/lib/lockfile.js +42 -0
- package/dist/lib/manifest.d.ts +65 -0
- package/dist/lib/manifest.js +113 -0
- package/dist/lib/migration.d.ts +10 -0
- package/dist/lib/migration.js +91 -0
- package/dist/lib/paths.d.ts +10 -0
- package/dist/lib/paths.js +22 -0
- package/dist/lib/preamble.d.ts +22 -0
- package/dist/lib/preamble.js +133 -0
- package/dist/lib/relay-config.d.ts +13 -0
- package/dist/lib/relay-config.js +46 -0
- package/dist/lib/requires-suggest.d.ts +23 -0
- package/dist/lib/requires-suggest.js +295 -0
- package/dist/lib/setup-command.d.ts +6 -0
- package/dist/lib/setup-command.js +72 -0
- package/dist/lib/slug.d.ts +24 -0
- package/dist/lib/slug.js +100 -0
- package/dist/lib/step-tracker.d.ts +8 -0
- package/dist/lib/step-tracker.js +28 -0
- package/dist/lib/storage.d.ts +6 -0
- package/dist/lib/storage.js +23 -0
- package/dist/lib/update-cache.d.ts +2 -0
- package/dist/lib/update-cache.js +51 -0
- package/dist/lib/version-check.d.ts +10 -0
- package/dist/lib/version-check.js +75 -0
- package/dist/mcp/server.d.ts +3 -0
- package/dist/mcp/server.js +112 -0
- package/dist/postinstall.d.ts +8 -0
- package/dist/postinstall.js +41 -0
- package/dist/prompts/_error-handling.md +38 -0
- package/dist/prompts/create.md +170 -0
- package/dist/prompts/explore.md +30 -0
- package/dist/prompts/index.d.ts +3 -0
- package/dist/prompts/index.js +22 -0
- package/dist/relay-compat.d.ts +2 -0
- package/dist/relay-compat.js +7 -0
- package/dist/types.d.ts +118 -0
- package/dist/types.js +2 -0
- package/package.json +51 -0
|
@@ -0,0 +1,128 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchMyOrgs = fetchMyOrgs;
|
|
4
|
+
exports.registerOrgs = registerOrgs;
|
|
5
|
+
const config_js_1 = require("../lib/config.js");
|
|
6
|
+
async function fetchMyOrgs(token) {
|
|
7
|
+
const res = await fetch(`${config_js_1.API_URL}/api/orgs`, {
|
|
8
|
+
headers: { Authorization: `Bearer ${token}` },
|
|
9
|
+
signal: AbortSignal.timeout(8000),
|
|
10
|
+
});
|
|
11
|
+
if (!res.ok) {
|
|
12
|
+
throw new Error(`Organization 목록 조회 실패 (${res.status})`);
|
|
13
|
+
}
|
|
14
|
+
return (await res.json());
|
|
15
|
+
}
|
|
16
|
+
function registerOrgs(program) {
|
|
17
|
+
const orgsCmd = program
|
|
18
|
+
.command('orgs')
|
|
19
|
+
.description('Organization 관련 명령어');
|
|
20
|
+
orgsCmd
|
|
21
|
+
.command('list')
|
|
22
|
+
.description('내 Organization 목록을 확인합니다')
|
|
23
|
+
.action(async () => {
|
|
24
|
+
const json = program.opts().json ?? false;
|
|
25
|
+
const token = await (0, config_js_1.getValidToken)();
|
|
26
|
+
if (!token) {
|
|
27
|
+
if (json) {
|
|
28
|
+
console.error(JSON.stringify({ error: 'LOGIN_REQUIRED', message: '로그인이 필요합니다.', fix: 'anpm login 실행 후 재시도하세요.' }));
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
console.error('\x1b[31m오류: 로그인이 필요합니다.\x1b[0m');
|
|
32
|
+
console.error(' anpm login을 먼저 실행하세요.');
|
|
33
|
+
}
|
|
34
|
+
process.exit(1);
|
|
35
|
+
}
|
|
36
|
+
try {
|
|
37
|
+
const orgs = await fetchMyOrgs(token);
|
|
38
|
+
if (json) {
|
|
39
|
+
console.log(JSON.stringify({ orgs }));
|
|
40
|
+
return;
|
|
41
|
+
}
|
|
42
|
+
if (orgs.length === 0) {
|
|
43
|
+
console.log('\nOrganization이 없습니다.');
|
|
44
|
+
console.log('\x1b[33m Organization을 만들려면: anpm orgs create "이름"\x1b[0m');
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
console.log(`\n\x1b[1m내 Organization\x1b[0m (${orgs.length}개):\n`);
|
|
48
|
+
for (const o of orgs) {
|
|
49
|
+
const role = o.role === 'owner' ? '\x1b[33m오너\x1b[0m'
|
|
50
|
+
: o.role === 'admin' ? '\x1b[36m관리자\x1b[0m'
|
|
51
|
+
: o.role === 'builder' ? '\x1b[36m빌더\x1b[0m'
|
|
52
|
+
: '\x1b[90m멤버\x1b[0m';
|
|
53
|
+
const desc = o.description
|
|
54
|
+
? ` \x1b[90m${o.description.length > 40 ? o.description.slice(0, 40) + '...' : o.description}\x1b[0m`
|
|
55
|
+
: '';
|
|
56
|
+
console.log(` \x1b[36m@${o.slug}\x1b[0m \x1b[1m${o.name}\x1b[0m ${role}${desc}`);
|
|
57
|
+
}
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
catch (err) {
|
|
61
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
62
|
+
if (json) {
|
|
63
|
+
console.error(JSON.stringify({ error: 'FETCH_FAILED', message, fix: '네트워크 연결을 확인하거나 잠시 후 재시도하세요.' }));
|
|
64
|
+
}
|
|
65
|
+
else {
|
|
66
|
+
console.error(`\x1b[31m오류: ${message}\x1b[0m`);
|
|
67
|
+
}
|
|
68
|
+
process.exit(1);
|
|
69
|
+
}
|
|
70
|
+
});
|
|
71
|
+
orgsCmd
|
|
72
|
+
.command('create <name>')
|
|
73
|
+
.description('새 Organization을 생성합니다')
|
|
74
|
+
.option('--slug <slug>', 'URL slug (미지정 시 이름에서 자동 생성)')
|
|
75
|
+
.action(async (name, opts) => {
|
|
76
|
+
const json = program.opts().json ?? false;
|
|
77
|
+
const token = await (0, config_js_1.getValidToken)();
|
|
78
|
+
if (!token) {
|
|
79
|
+
if (json) {
|
|
80
|
+
console.error(JSON.stringify({ error: 'LOGIN_REQUIRED', message: '로그인이 필요합니다.', fix: 'anpm login 실행 후 재시도하세요.' }));
|
|
81
|
+
}
|
|
82
|
+
else {
|
|
83
|
+
console.error('\x1b[31m오류: 로그인이 필요합니다.\x1b[0m');
|
|
84
|
+
}
|
|
85
|
+
process.exit(1);
|
|
86
|
+
}
|
|
87
|
+
const slug = opts.slug ?? name
|
|
88
|
+
.toLowerCase()
|
|
89
|
+
.replace(/[^a-z0-9\s-]/g, '')
|
|
90
|
+
.replace(/[\s]+/g, '-')
|
|
91
|
+
.replace(/-+/g, '-')
|
|
92
|
+
.replace(/^-|-$/g, '')
|
|
93
|
+
.slice(0, 50);
|
|
94
|
+
try {
|
|
95
|
+
const res = await fetch(`${config_js_1.API_URL}/api/orgs`, {
|
|
96
|
+
method: 'POST',
|
|
97
|
+
headers: {
|
|
98
|
+
'Content-Type': 'application/json',
|
|
99
|
+
Authorization: `Bearer ${token}`,
|
|
100
|
+
},
|
|
101
|
+
body: JSON.stringify({ name, slug }),
|
|
102
|
+
});
|
|
103
|
+
if (!res.ok) {
|
|
104
|
+
const body = await res.json().catch(() => ({ message: `${res.status}` }));
|
|
105
|
+
throw new Error(body.message ?? `Organization 생성 실패 (${res.status})`);
|
|
106
|
+
}
|
|
107
|
+
const org = await res.json();
|
|
108
|
+
if (json) {
|
|
109
|
+
console.log(JSON.stringify({ status: 'created', org }));
|
|
110
|
+
}
|
|
111
|
+
else {
|
|
112
|
+
console.log(`\x1b[32m✅ Organization "${org.name}" (@${org.slug}) 생성 완료\x1b[0m`);
|
|
113
|
+
console.log(`\n\x1b[33m 에이전트 배포: anpm publish --org ${org.slug}\x1b[0m`);
|
|
114
|
+
console.log(`\x1b[33m 멤버 초대: www.relayax.com/orgs/${org.slug}/members\x1b[0m`);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
catch (err) {
|
|
118
|
+
const message = err instanceof Error ? err.message : String(err);
|
|
119
|
+
if (json) {
|
|
120
|
+
console.error(JSON.stringify({ error: 'CREATE_FAILED', message }));
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
console.error(`\x1b[31m오류: ${message}\x1b[0m`);
|
|
124
|
+
}
|
|
125
|
+
process.exit(1);
|
|
126
|
+
}
|
|
127
|
+
});
|
|
128
|
+
}
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.registerOutdated = registerOutdated;
|
|
4
|
+
const api_js_1 = require("../lib/api.js");
|
|
5
|
+
const config_js_1 = require("../lib/config.js");
|
|
6
|
+
function registerOutdated(program) {
|
|
7
|
+
program
|
|
8
|
+
.command('outdated')
|
|
9
|
+
.description('설치된 에이전트의 업데이트 가능 여부를 확인합니다')
|
|
10
|
+
.action(async () => {
|
|
11
|
+
const json = program.opts().json ?? false;
|
|
12
|
+
const installed = (0, config_js_1.loadInstalled)();
|
|
13
|
+
const slugs = Object.keys(installed);
|
|
14
|
+
if (slugs.length === 0) {
|
|
15
|
+
if (json) {
|
|
16
|
+
console.log(JSON.stringify([]));
|
|
17
|
+
}
|
|
18
|
+
else {
|
|
19
|
+
console.log('설치된 에이전트가 없습니다.');
|
|
20
|
+
}
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
// Fetch latest versions in parallel
|
|
24
|
+
const results = await Promise.all(slugs.map(async (slug) => {
|
|
25
|
+
const current = installed[slug].version;
|
|
26
|
+
try {
|
|
27
|
+
const agent = await (0, api_js_1.fetchAgentInfo)(slug);
|
|
28
|
+
const latest = agent.version;
|
|
29
|
+
return {
|
|
30
|
+
slug,
|
|
31
|
+
current,
|
|
32
|
+
latest,
|
|
33
|
+
status: current === latest ? 'up-to-date' : 'outdated',
|
|
34
|
+
};
|
|
35
|
+
}
|
|
36
|
+
catch {
|
|
37
|
+
return { slug, current, latest: '?', status: 'unknown' };
|
|
38
|
+
}
|
|
39
|
+
}));
|
|
40
|
+
if (json) {
|
|
41
|
+
console.log(JSON.stringify(results));
|
|
42
|
+
return;
|
|
43
|
+
}
|
|
44
|
+
const allUpToDate = results.every((r) => r.status === 'up-to-date');
|
|
45
|
+
if (allUpToDate) {
|
|
46
|
+
console.log('모든 에이전트가 최신 버전입니다.');
|
|
47
|
+
return;
|
|
48
|
+
}
|
|
49
|
+
// Determine column widths
|
|
50
|
+
const COL_TEAM = Math.max(9, ...results.map((r) => r.slug.length));
|
|
51
|
+
const COL_CURRENT = Math.max(4, ...results.map((r) => `v${r.current}`.length));
|
|
52
|
+
const COL_LATEST = Math.max(4, ...results.map((r) => `v${r.latest}`.length));
|
|
53
|
+
const pad = (s, len) => s.padEnd(len);
|
|
54
|
+
const header = `${pad('에이전트', COL_TEAM)} ${pad('현재', COL_CURRENT)} ${pad('최신', COL_LATEST)} 상태`;
|
|
55
|
+
const separator = '-'.repeat(header.length);
|
|
56
|
+
console.log(header);
|
|
57
|
+
console.log(separator);
|
|
58
|
+
for (const entry of results) {
|
|
59
|
+
const statusLabel = entry.status === 'outdated'
|
|
60
|
+
? '\x1b[33m업데이트 가능\x1b[0m'
|
|
61
|
+
: entry.status === 'up-to-date'
|
|
62
|
+
? '\x1b[32m✓ 최신\x1b[0m'
|
|
63
|
+
: '\x1b[31m조회 실패\x1b[0m';
|
|
64
|
+
const slugCol = pad(entry.slug, COL_TEAM);
|
|
65
|
+
const currentCol = pad(`v${entry.current}`, COL_CURRENT);
|
|
66
|
+
const latestCol = pad(`v${entry.latest}`, COL_LATEST);
|
|
67
|
+
console.log(`${slugCol} ${currentCol} ${latestCol} ${statusLabel}`);
|
|
68
|
+
}
|
|
69
|
+
});
|
|
70
|
+
}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { Command } from 'commander';
|
|
2
|
+
type DiffStatus = 'added' | 'modified' | 'deleted' | 'unchanged';
|
|
3
|
+
interface DiffEntry {
|
|
4
|
+
relPath: string;
|
|
5
|
+
status: DiffStatus;
|
|
6
|
+
}
|
|
7
|
+
import type { ContentType } from '../lib/ai-tools.js';
|
|
8
|
+
export interface ContentEntry {
|
|
9
|
+
name: string;
|
|
10
|
+
type: ContentType;
|
|
11
|
+
from?: string;
|
|
12
|
+
path?: string;
|
|
13
|
+
}
|
|
14
|
+
type ContentDiffStatus = 'modified' | 'unchanged' | 'source_missing';
|
|
15
|
+
interface ContentDiffEntry {
|
|
16
|
+
name: string;
|
|
17
|
+
type: ContentType;
|
|
18
|
+
status: ContentDiffStatus;
|
|
19
|
+
files?: DiffEntry[];
|
|
20
|
+
}
|
|
21
|
+
interface NewItemEntry {
|
|
22
|
+
name: string;
|
|
23
|
+
type: ContentType;
|
|
24
|
+
source: string;
|
|
25
|
+
relativePath: string;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* contents 매니페스트 기반으로 각 항목의 원본과 .relay/ 복사본을 비교한다.
|
|
29
|
+
*/
|
|
30
|
+
export declare function computeContentsDiff(contents: ContentEntry[], relayDir: string, projectPath: string): {
|
|
31
|
+
diff: ContentDiffEntry[];
|
|
32
|
+
newItems: NewItemEntry[];
|
|
33
|
+
};
|
|
34
|
+
/**
|
|
35
|
+
* contents 항목 단위로 from → .relay/ 동기화한다.
|
|
36
|
+
*/
|
|
37
|
+
export declare function syncContentsToRelay(contents: ContentEntry[], contentsDiff: ContentDiffEntry[], relayDir: string, projectPath: string): {
|
|
38
|
+
removed: string[];
|
|
39
|
+
};
|
|
40
|
+
/**
|
|
41
|
+
* .relay/ 내에 있지만 contents 매니페스트에 없는 orphan 항목을 찾는다.
|
|
42
|
+
*/
|
|
43
|
+
export declare function findOrphanItems(contents: ContentEntry[], relayDir: string): string[];
|
|
44
|
+
/**
|
|
45
|
+
* 패키지 홈 디렉토리를 결정한다.
|
|
46
|
+
* 1. 프로젝트에 .relay/가 있으면 → projectPath/.relay/
|
|
47
|
+
* 2. 없으면 → ~/.relay/agents/<slug>/ (slug 필요)
|
|
48
|
+
*
|
|
49
|
+
* slug가 없고 프로젝트에도 .relay/가 없으면 null 반환.
|
|
50
|
+
*/
|
|
51
|
+
export declare function resolveRelayDir(projectPath: string, slug?: string): string | null;
|
|
52
|
+
/**
|
|
53
|
+
* 글로벌 에이전트 홈에 패키지 구조를 초기화한다.
|
|
54
|
+
*/
|
|
55
|
+
export declare function initGlobalAgentHome(slug: string, yamlData: Record<string, unknown>): string;
|
|
56
|
+
export declare function registerPackage(program: Command): void;
|
|
57
|
+
export {};
|