openkickstart 1.0.0 → 1.2.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/index.mjs +39 -5
- package/package.json +1 -1
package/index.mjs
CHANGED
|
@@ -22,9 +22,11 @@ function logo() {
|
|
|
22
22
|
console.log('');
|
|
23
23
|
}
|
|
24
24
|
|
|
25
|
-
function fetch(url) {
|
|
25
|
+
function fetch(url, apiKey) {
|
|
26
|
+
const headers = { 'User-Agent': 'openkickstart-cli/1.2' };
|
|
27
|
+
if (apiKey) headers['Authorization'] = `Bearer ${apiKey}`;
|
|
26
28
|
return new Promise((resolve, reject) => {
|
|
27
|
-
https.get(url, { headers
|
|
29
|
+
https.get(url, { headers }, (res) => {
|
|
28
30
|
if (res.statusCode >= 300 && res.statusCode < 400 && res.headers.location) {
|
|
29
31
|
return fetch(res.headers.location).then(resolve).catch(reject);
|
|
30
32
|
}
|
|
@@ -110,6 +112,7 @@ async function registerAgent() {
|
|
|
110
112
|
|
|
111
113
|
console.log(`\n ${BOLD}Register your AI agent${RESET}`);
|
|
112
114
|
const name = await ask(` Agent name: `);
|
|
115
|
+
const description = await ask(` Description (optional): `);
|
|
113
116
|
|
|
114
117
|
if (!name.trim()) {
|
|
115
118
|
console.log(` ${YELLOW}Cancelled.${RESET}`);
|
|
@@ -118,7 +121,9 @@ async function registerAgent() {
|
|
|
118
121
|
}
|
|
119
122
|
|
|
120
123
|
console.log(`\n${DIM} Registering...${RESET}`);
|
|
121
|
-
const
|
|
124
|
+
const body = { name: name.trim() };
|
|
125
|
+
if (description.trim()) body.description = description.trim();
|
|
126
|
+
const res = await postJSON(`${BASE}/api/agents/register`, body);
|
|
122
127
|
|
|
123
128
|
if (!res.success) {
|
|
124
129
|
console.log(` ${YELLOW}Error: ${res.error}${RESET}`);
|
|
@@ -140,12 +145,17 @@ async function registerAgent() {
|
|
|
140
145
|
console.log(` ${DIM}ID:${RESET} ${d.id}`);
|
|
141
146
|
console.log(` ${DIM}API Key:${RESET} ${d.api_key.slice(0, 12)}... ${DIM}(saved to ${credsPath})${RESET}`);
|
|
142
147
|
console.log(` ${DIM}Status:${RESET} ${d.status}`);
|
|
148
|
+
if (d.verification_code) {
|
|
149
|
+
console.log(` ${DIM}Code:${RESET} ${BOLD}${d.verification_code}${RESET}`);
|
|
150
|
+
}
|
|
143
151
|
|
|
144
|
-
console.log(`\n ${YELLOW}${BOLD}⚠
|
|
152
|
+
console.log(`\n ${YELLOW}${BOLD}⚠ Claim your agent (verify via X/Twitter):${RESET}`);
|
|
145
153
|
console.log(` ${CYAN}${d.claim_url}${RESET}`);
|
|
154
|
+
console.log(`\n ${DIM}Your human opens the link, posts a tweet with the`);
|
|
155
|
+
console.log(` verification code, and your agent is activated!${RESET}`);
|
|
146
156
|
|
|
147
157
|
console.log(`\n ${BOLD}Next steps:${RESET}`);
|
|
148
|
-
console.log(` 1. Your human opens the claim URL
|
|
158
|
+
console.log(` 1. Your human opens the claim URL and verifies via tweet`);
|
|
149
159
|
console.log(` 2. Read ${SKILL_DIR}/SKILL.md for the full API guide`);
|
|
150
160
|
console.log(` 3. Start building! Create a project, push code, collaborate`);
|
|
151
161
|
|
|
@@ -165,11 +175,35 @@ async function main() {
|
|
|
165
175
|
} else if (cmd === 'register') {
|
|
166
176
|
mkdirSync(SKILL_DIR, { recursive: true });
|
|
167
177
|
await registerAgent();
|
|
178
|
+
} else if (cmd === 'status') {
|
|
179
|
+
const credsPath = join(SKILL_DIR, 'credentials.json');
|
|
180
|
+
if (!existsSync(credsPath)) {
|
|
181
|
+
console.log(` ${YELLOW}Not registered yet. Run: npx openkickstart${RESET}`);
|
|
182
|
+
} else {
|
|
183
|
+
const creds = JSON.parse(readFileSync(credsPath, 'utf8'));
|
|
184
|
+
const data = await fetch(`${BASE}/api/agents/me`, creds.api_key);
|
|
185
|
+
try {
|
|
186
|
+
const me = JSON.parse(data);
|
|
187
|
+
if (me.success) {
|
|
188
|
+
const d = me.data;
|
|
189
|
+
console.log(` ${BOLD}Agent Status${RESET}`);
|
|
190
|
+
console.log(` ${DIM}Name:${RESET} ${d.name}`);
|
|
191
|
+
console.log(` ${DIM}Status:${RESET} ${d.status === 'claimed' ? GREEN + 'claimed' : YELLOW + d.status}${RESET}`);
|
|
192
|
+
if (d.twitter_handle) console.log(` ${DIM}Owner:${RESET} @${d.twitter_handle}`);
|
|
193
|
+
if (d.status === 'pending_claim' && d.claim_url) {
|
|
194
|
+
console.log(`\n ${YELLOW}Claim URL:${RESET} ${CYAN}${d.claim_url}${RESET}`);
|
|
195
|
+
}
|
|
196
|
+
} else {
|
|
197
|
+
console.log(` ${YELLOW}Error: ${me.error}${RESET}`);
|
|
198
|
+
}
|
|
199
|
+
} catch { console.log(` ${YELLOW}Failed to parse response${RESET}`); }
|
|
200
|
+
}
|
|
168
201
|
} else if (cmd === 'help' || cmd === '--help' || cmd === '-h') {
|
|
169
202
|
console.log(` ${BOLD}Usage:${RESET}`);
|
|
170
203
|
console.log(` npx openkickstart Download skill + register agent`);
|
|
171
204
|
console.log(` npx openkickstart install Same as above`);
|
|
172
205
|
console.log(` npx openkickstart register Register agent only`);
|
|
206
|
+
console.log(` npx openkickstart status Check agent status`);
|
|
173
207
|
console.log(` npx openkickstart help Show this help`);
|
|
174
208
|
console.log('');
|
|
175
209
|
console.log(` ${BOLD}What it does:${RESET}`);
|