myaiforone 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 +113 -0
- package/agents/_template/CLAUDE.md +18 -0
- package/agents/_template/agent.json +7 -0
- package/agents/platform/agentcreator/CLAUDE.md +300 -0
- package/agents/platform/appcreator/CLAUDE.md +158 -0
- package/agents/platform/gym/CLAUDE.md +486 -0
- package/agents/platform/gym/agent.json +40 -0
- package/agents/platform/gym/programs/agent-building/program.json +160 -0
- package/agents/platform/gym/programs/automations-mastery/program.json +129 -0
- package/agents/platform/gym/programs/getting-started/program.json +124 -0
- package/agents/platform/gym/programs/mcp-integrations/program.json +116 -0
- package/agents/platform/gym/programs/multi-model-strategy/program.json +115 -0
- package/agents/platform/gym/programs/prompt-engineering/program.json +136 -0
- package/agents/platform/gym/souls/alex.md +12 -0
- package/agents/platform/gym/souls/jordan.md +12 -0
- package/agents/platform/gym/souls/morgan.md +12 -0
- package/agents/platform/gym/souls/riley.md +12 -0
- package/agents/platform/gym/souls/sam.md +12 -0
- package/agents/platform/hub/CLAUDE.md +372 -0
- package/agents/platform/promptcreator/CLAUDE.md +130 -0
- package/agents/platform/skillcreator/CLAUDE.md +163 -0
- package/bin/cli.js +566 -0
- package/config.example.json +310 -0
- package/dist/agent-registry.d.ts +32 -0
- package/dist/agent-registry.d.ts.map +1 -0
- package/dist/agent-registry.js +144 -0
- package/dist/agent-registry.js.map +1 -0
- package/dist/channels/discord.d.ts +17 -0
- package/dist/channels/discord.d.ts.map +1 -0
- package/dist/channels/discord.js +114 -0
- package/dist/channels/discord.js.map +1 -0
- package/dist/channels/imessage.d.ts +23 -0
- package/dist/channels/imessage.d.ts.map +1 -0
- package/dist/channels/imessage.js +214 -0
- package/dist/channels/imessage.js.map +1 -0
- package/dist/channels/slack.d.ts +19 -0
- package/dist/channels/slack.d.ts.map +1 -0
- package/dist/channels/slack.js +167 -0
- package/dist/channels/slack.js.map +1 -0
- package/dist/channels/telegram.d.ts +19 -0
- package/dist/channels/telegram.d.ts.map +1 -0
- package/dist/channels/telegram.js +274 -0
- package/dist/channels/telegram.js.map +1 -0
- package/dist/channels/types.d.ts +44 -0
- package/dist/channels/types.d.ts.map +1 -0
- package/dist/channels/types.js +18 -0
- package/dist/channels/types.js.map +1 -0
- package/dist/channels/whatsapp.d.ts +23 -0
- package/dist/channels/whatsapp.d.ts.map +1 -0
- package/dist/channels/whatsapp.js +189 -0
- package/dist/channels/whatsapp.js.map +1 -0
- package/dist/config.d.ts +134 -0
- package/dist/config.d.ts.map +1 -0
- package/dist/config.js +127 -0
- package/dist/config.js.map +1 -0
- package/dist/cron.d.ts +8 -0
- package/dist/cron.d.ts.map +1 -0
- package/dist/cron.js +35 -0
- package/dist/cron.js.map +1 -0
- package/dist/decrypt-keys.d.ts +7 -0
- package/dist/decrypt-keys.d.ts.map +1 -0
- package/dist/decrypt-keys.js +53 -0
- package/dist/decrypt-keys.js.map +1 -0
- package/dist/encrypt-keys.d.ts +8 -0
- package/dist/encrypt-keys.d.ts.map +1 -0
- package/dist/encrypt-keys.js +62 -0
- package/dist/encrypt-keys.js.map +1 -0
- package/dist/executor.d.ts +31 -0
- package/dist/executor.d.ts.map +1 -0
- package/dist/executor.js +2009 -0
- package/dist/executor.js.map +1 -0
- package/dist/gemini-executor.d.ts +27 -0
- package/dist/gemini-executor.d.ts.map +1 -0
- package/dist/gemini-executor.js +160 -0
- package/dist/gemini-executor.js.map +1 -0
- package/dist/goals.d.ts +24 -0
- package/dist/goals.d.ts.map +1 -0
- package/dist/goals.js +189 -0
- package/dist/goals.js.map +1 -0
- package/dist/gym/activity-digest.d.ts +30 -0
- package/dist/gym/activity-digest.d.ts.map +1 -0
- package/dist/gym/activity-digest.js +506 -0
- package/dist/gym/activity-digest.js.map +1 -0
- package/dist/gym/dimension-scorer.d.ts +76 -0
- package/dist/gym/dimension-scorer.d.ts.map +1 -0
- package/dist/gym/dimension-scorer.js +236 -0
- package/dist/gym/dimension-scorer.js.map +1 -0
- package/dist/gym/gym-router.d.ts +7 -0
- package/dist/gym/gym-router.d.ts.map +1 -0
- package/dist/gym/gym-router.js +718 -0
- package/dist/gym/gym-router.js.map +1 -0
- package/dist/gym/index.d.ts +11 -0
- package/dist/gym/index.d.ts.map +1 -0
- package/dist/gym/index.js +11 -0
- package/dist/gym/index.js.map +1 -0
- package/dist/heartbeat.d.ts +21 -0
- package/dist/heartbeat.d.ts.map +1 -0
- package/dist/heartbeat.js +163 -0
- package/dist/heartbeat.js.map +1 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +254 -0
- package/dist/index.js.map +1 -0
- package/dist/keystore.d.ts +22 -0
- package/dist/keystore.d.ts.map +1 -0
- package/dist/keystore.js +178 -0
- package/dist/keystore.js.map +1 -0
- package/dist/logger.d.ts +9 -0
- package/dist/logger.d.ts.map +1 -0
- package/dist/logger.js +45 -0
- package/dist/logger.js.map +1 -0
- package/dist/memory/daily.d.ts +22 -0
- package/dist/memory/daily.d.ts.map +1 -0
- package/dist/memory/daily.js +82 -0
- package/dist/memory/daily.js.map +1 -0
- package/dist/memory/embeddings.d.ts +15 -0
- package/dist/memory/embeddings.d.ts.map +1 -0
- package/dist/memory/embeddings.js +154 -0
- package/dist/memory/embeddings.js.map +1 -0
- package/dist/memory/index.d.ts +32 -0
- package/dist/memory/index.d.ts.map +1 -0
- package/dist/memory/index.js +159 -0
- package/dist/memory/index.js.map +1 -0
- package/dist/memory/search.d.ts +21 -0
- package/dist/memory/search.d.ts.map +1 -0
- package/dist/memory/search.js +77 -0
- package/dist/memory/search.js.map +1 -0
- package/dist/memory/store.d.ts +23 -0
- package/dist/memory/store.d.ts.map +1 -0
- package/dist/memory/store.js +144 -0
- package/dist/memory/store.js.map +1 -0
- package/dist/ollama-executor.d.ts +17 -0
- package/dist/ollama-executor.d.ts.map +1 -0
- package/dist/ollama-executor.js +112 -0
- package/dist/ollama-executor.js.map +1 -0
- package/dist/openai-executor.d.ts +38 -0
- package/dist/openai-executor.d.ts.map +1 -0
- package/dist/openai-executor.js +197 -0
- package/dist/openai-executor.js.map +1 -0
- package/dist/router.d.ts +11 -0
- package/dist/router.d.ts.map +1 -0
- package/dist/router.js +185 -0
- package/dist/router.js.map +1 -0
- package/dist/test-message.d.ts +2 -0
- package/dist/test-message.d.ts.map +1 -0
- package/dist/test-message.js +60 -0
- package/dist/test-message.js.map +1 -0
- package/dist/utils/imsg-db-reader.d.ts +24 -0
- package/dist/utils/imsg-db-reader.d.ts.map +1 -0
- package/dist/utils/imsg-db-reader.js +92 -0
- package/dist/utils/imsg-db-reader.js.map +1 -0
- package/dist/utils/imsg-rpc.d.ts +25 -0
- package/dist/utils/imsg-rpc.d.ts.map +1 -0
- package/dist/utils/imsg-rpc.js +149 -0
- package/dist/utils/imsg-rpc.js.map +1 -0
- package/dist/utils/message-formatter.d.ts +3 -0
- package/dist/utils/message-formatter.d.ts.map +1 -0
- package/dist/utils/message-formatter.js +69 -0
- package/dist/utils/message-formatter.js.map +1 -0
- package/dist/web-ui.d.ts +12 -0
- package/dist/web-ui.d.ts.map +1 -0
- package/dist/web-ui.js +5784 -0
- package/dist/web-ui.js.map +1 -0
- package/dist/whatsapp-chats.d.ts +2 -0
- package/dist/whatsapp-chats.d.ts.map +1 -0
- package/dist/whatsapp-chats.js +76 -0
- package/dist/whatsapp-chats.js.map +1 -0
- package/dist/whatsapp-login.d.ts +2 -0
- package/dist/whatsapp-login.d.ts.map +1 -0
- package/dist/whatsapp-login.js +90 -0
- package/dist/whatsapp-login.js.map +1 -0
- package/dist/wiki-sync.d.ts +21 -0
- package/dist/wiki-sync.d.ts.map +1 -0
- package/dist/wiki-sync.js +147 -0
- package/dist/wiki-sync.js.map +1 -0
- package/docs/AddNewAgentGuide.md +100 -0
- package/docs/AddNewMcpGuide.md +72 -0
- package/docs/Architecture.md +795 -0
- package/docs/CLAUDE-AI-SETUP.md +166 -0
- package/docs/Setup.md +297 -0
- package/docs/ai-gym-architecture.md +1040 -0
- package/docs/ai-gym-build-plan.md +343 -0
- package/docs/ai-gym-onboarding.md +122 -0
- package/docs/appcreator_plan.md +348 -0
- package/docs/platform-mcp-audit.md +320 -0
- package/docs/server-deployment-plan.md +503 -0
- package/docs/superpowers/plans/2026-03-25-marketplace.md +1281 -0
- package/docs/superpowers/specs/2026-03-25-marketplace-design.md +287 -0
- package/docs/user-guide.md +2016 -0
- package/mcp-catalog.json +628 -0
- package/package.json +63 -0
- package/public/MyAIforOne-logomark-512.svg +16 -0
- package/public/MyAIforOne-logomark-transparent.svg +15 -0
- package/public/activity.html +314 -0
- package/public/admin.html +1674 -0
- package/public/agent-dashboard.html +670 -0
- package/public/api-docs.html +1106 -0
- package/public/automations.html +722 -0
- package/public/canvas.css +223 -0
- package/public/canvas.js +588 -0
- package/public/changelog.html +231 -0
- package/public/gym.html +2766 -0
- package/public/home.html +1930 -0
- package/public/index.html +2809 -0
- package/public/lab.html +1643 -0
- package/public/library.html +1442 -0
- package/public/marketplace.html +1101 -0
- package/public/mcp-docs.html +441 -0
- package/public/mini.html +390 -0
- package/public/monitor.html +584 -0
- package/public/org.html +4304 -0
- package/public/projects.html +734 -0
- package/public/settings.html +645 -0
- package/public/tasks.html +932 -0
- package/public/trainers/alex.svg +12 -0
- package/public/trainers/jordan.svg +12 -0
- package/public/trainers/morgan.svg +12 -0
- package/public/trainers/riley.svg +12 -0
- package/public/trainers/sam.svg +12 -0
- package/public/user-guide.html +218 -0
- package/registry/agents.json +3 -0
- package/registry/apps.json +20 -0
- package/registry/installed-drafts.json +3 -0
- package/registry/mcps.json +1084 -0
- package/registry/prompts/personal/mcp-test-prompt.md +6 -0
- package/registry/prompts/personal/memory-recall.md +6 -0
- package/registry/prompts/platform/brainstorm.md +15 -0
- package/registry/prompts/platform/code-review.md +16 -0
- package/registry/prompts/platform/explain.md +16 -0
- package/registry/prompts.json +58 -0
- package/registry/skills/external/brainstorming.md +5 -0
- package/registry/skills/external/code-review.md +40 -0
- package/registry/skills/external/frontend-patterns.md +642 -0
- package/registry/skills/external/frontend-slides.md +184 -0
- package/registry/skills/external/systematic-debugging.md +5 -0
- package/registry/skills/external/tdd.md +328 -0
- package/registry/skills/external/verification-before-completion.md +5 -0
- package/registry/skills/external/writing-plans.md +5 -0
- package/registry/skills/platform/ai41_app_build.md +930 -0
- package/registry/skills/platform/ai41_app_deploy.md +168 -0
- package/registry/skills/platform/ai41_app_orchestrator.md +239 -0
- package/registry/skills/platform/ai41_app_patterns.md +359 -0
- package/registry/skills/platform/ai41_app_register.md +85 -0
- package/registry/skills/platform/ai41_app_scaffold.md +421 -0
- package/registry/skills/platform/ai41_app_verify.md +107 -0
- package/registry/skills/platform/opProjectCreate.md +239 -0
- package/registry/skills/platform/op_devbrowser.md +136 -0
- package/registry/skills/platform/sop_brandguidelines.md +103 -0
- package/registry/skills/platform/sop_docx.md +117 -0
- package/registry/skills/platform/sop_frontenddesign.md +44 -0
- package/registry/skills/platform/sop_frontenddesign_v2.md +659 -0
- package/registry/skills/platform/sop_mcpbuilder.md +133 -0
- package/registry/skills/platform/sop_pdf.md +172 -0
- package/registry/skills/platform/sop_pptx.md +133 -0
- package/registry/skills/platform/sop_skillcreator.md +104 -0
- package/registry/skills/platform/sop_themefactory.md +128 -0
- package/registry/skills/platform/sop_webapptesting.md +75 -0
- package/registry/skills/platform/sop_webartifactsbuilder.md +97 -0
- package/registry/skills/platform/sop_xlsx.md +134 -0
- package/registry/skills.json +1055 -0
- package/scripts/discover-chats.sh +11 -0
- package/scripts/install-service-windows.ps1 +87 -0
- package/scripts/install-service.sh +52 -0
- package/scripts/seed-registry.ts +195 -0
- package/scripts/test-send.sh +5 -0
- package/scripts/tray-indicator.ps1 +35 -0
- package/scripts/uninstall-service-windows.ps1 +23 -0
- package/scripts/uninstall-service.sh +15 -0
- package/scripts/xbar-myagent.5s.sh +32 -0
- package/server/mcp-server/dist/index.d.ts +11 -0
- package/server/mcp-server/dist/index.js +1332 -0
- package/server/mcp-server/dist/lib/api-client.d.ts +165 -0
- package/server/mcp-server/dist/lib/api-client.js +241 -0
- package/server/mcp-server/index.ts +1545 -0
- package/server/mcp-server/lib/api-client.ts +366 -0
- package/server/mcp-server/tsconfig.json +14 -0
- package/src/agent-registry.ts +180 -0
- package/src/channels/discord.ts +129 -0
- package/src/channels/imessage.ts +261 -0
- package/src/channels/slack.ts +208 -0
- package/src/channels/telegram.ts +307 -0
- package/src/channels/types.ts +62 -0
- package/src/channels/whatsapp.ts +227 -0
- package/src/config.ts +281 -0
- package/src/cron.ts +43 -0
- package/src/decrypt-keys.ts +60 -0
- package/src/encrypt-keys.ts +70 -0
- package/src/executor.ts +2190 -0
- package/src/gemini-executor.ts +212 -0
- package/src/goals.ts +240 -0
- package/src/gym/activity-digest.ts +546 -0
- package/src/gym/dimension-scorer.ts +297 -0
- package/src/gym/gym-router.ts +801 -0
- package/src/gym/index.ts +19 -0
- package/src/heartbeat.ts +220 -0
- package/src/index.ts +275 -0
- package/src/keystore.ts +190 -0
- package/src/logger.ts +51 -0
- package/src/memory/daily.ts +101 -0
- package/src/memory/embeddings.ts +185 -0
- package/src/memory/index.ts +218 -0
- package/src/memory/search.ts +124 -0
- package/src/memory/store.ts +189 -0
- package/src/ollama-executor.ts +126 -0
- package/src/openai-executor.ts +259 -0
- package/src/router.ts +230 -0
- package/src/test-message.ts +72 -0
- package/src/utils/imsg-db-reader.ts +109 -0
- package/src/utils/imsg-rpc.ts +178 -0
- package/src/utils/message-formatter.ts +90 -0
- package/src/web-ui.ts +5778 -0
- package/src/whatsapp-chats.ts +91 -0
- package/src/whatsapp-login.ts +110 -0
- package/src/wiki-sync.ts +199 -0
- package/tsconfig.json +19 -0
package/bin/cli.js
ADDED
|
@@ -0,0 +1,566 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* MyAgent CLI installer
|
|
5
|
+
* Usage: npx myaiforone
|
|
6
|
+
*
|
|
7
|
+
* Checks prerequisites, scaffolds the project, and runs setup.
|
|
8
|
+
* Provides detailed error messages that can be pasted into Claude for help.
|
|
9
|
+
*/
|
|
10
|
+
|
|
11
|
+
import { execSync, spawn } from 'child_process';
|
|
12
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync, readdirSync, copyFileSync } from 'fs';
|
|
13
|
+
import { join, resolve, dirname } from 'path';
|
|
14
|
+
import { fileURLToPath } from 'url';
|
|
15
|
+
import { createInterface } from 'readline';
|
|
16
|
+
import { randomBytes } from 'crypto';
|
|
17
|
+
import { homedir, platform as osPlatform } from 'os';
|
|
18
|
+
|
|
19
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
20
|
+
const __dirname = dirname(__filename);
|
|
21
|
+
const PROJECT_ROOT = resolve(__dirname, '..');
|
|
22
|
+
|
|
23
|
+
// ── Helpers ──────────────────────────────────────────────────────────────────
|
|
24
|
+
|
|
25
|
+
const PLATFORM = osPlatform();
|
|
26
|
+
const IS_MAC = PLATFORM === 'darwin';
|
|
27
|
+
const IS_WIN = PLATFORM === 'win32';
|
|
28
|
+
const IS_LINUX = PLATFORM === 'linux';
|
|
29
|
+
const HOME = homedir();
|
|
30
|
+
const PLATFORM_NAME = IS_MAC ? 'macOS' : IS_WIN ? 'Windows' : 'Linux';
|
|
31
|
+
|
|
32
|
+
const STEPS = [
|
|
33
|
+
'Check Node.js',
|
|
34
|
+
'Check Claude Code CLI',
|
|
35
|
+
'Install dependencies',
|
|
36
|
+
'Create MyAIforOne Drive',
|
|
37
|
+
'Generate config',
|
|
38
|
+
'Register platform agents',
|
|
39
|
+
'Build',
|
|
40
|
+
'Start service & open browser',
|
|
41
|
+
];
|
|
42
|
+
|
|
43
|
+
let completedSteps = 0;
|
|
44
|
+
|
|
45
|
+
function printBanner() {
|
|
46
|
+
console.log('');
|
|
47
|
+
console.log(' ╔══════════════════════════════════╗');
|
|
48
|
+
console.log(' ║ MyAgent Installer ║');
|
|
49
|
+
console.log(' ╚══════════════════════════════════╝');
|
|
50
|
+
console.log('');
|
|
51
|
+
console.log(` Platform: ${PLATFORM_NAME}`);
|
|
52
|
+
console.log('');
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
function printChecklist() {
|
|
56
|
+
console.log('');
|
|
57
|
+
for (let i = 0; i < STEPS.length; i++) {
|
|
58
|
+
if (i < completedSteps) {
|
|
59
|
+
console.log(` ✅ ${i + 1}. ${STEPS[i]}`);
|
|
60
|
+
} else if (i === completedSteps) {
|
|
61
|
+
console.log(` → ${i + 1}. ${STEPS[i]}...`);
|
|
62
|
+
} else {
|
|
63
|
+
console.log(` □ ${i + 1}. ${STEPS[i]}`);
|
|
64
|
+
}
|
|
65
|
+
}
|
|
66
|
+
console.log('');
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
function stepDone(msg) {
|
|
70
|
+
completedSteps++;
|
|
71
|
+
if (msg) console.log(` ✅ ${msg}`);
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function fail(step, message, fix) {
|
|
75
|
+
console.error('');
|
|
76
|
+
console.error(` ❌ FAILED at step ${step + 1}: ${STEPS[step]}`);
|
|
77
|
+
console.error('');
|
|
78
|
+
console.error(' Error:');
|
|
79
|
+
console.error(` ${message}`);
|
|
80
|
+
console.error('');
|
|
81
|
+
if (fix) {
|
|
82
|
+
console.error(' Fix:');
|
|
83
|
+
console.error(` ${fix}`);
|
|
84
|
+
console.error('');
|
|
85
|
+
}
|
|
86
|
+
console.error(' ─────────────────────────────────────────────');
|
|
87
|
+
console.error(' If you need help, paste this entire error');
|
|
88
|
+
console.error(' into Claude.ai or Claude Code and it will');
|
|
89
|
+
console.error(' walk you through fixing it.');
|
|
90
|
+
console.error(' ─────────────────────────────────────────────');
|
|
91
|
+
console.error('');
|
|
92
|
+
process.exit(1);
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
function run(cmd, opts = {}) {
|
|
96
|
+
try {
|
|
97
|
+
return execSync(cmd, { encoding: 'utf8', stdio: opts.silent ? 'pipe' : undefined, ...opts }).trim();
|
|
98
|
+
} catch (e) {
|
|
99
|
+
return null;
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
function ask(question) {
|
|
104
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
105
|
+
return new Promise((resolve) => {
|
|
106
|
+
rl.question(question, (answer) => {
|
|
107
|
+
rl.close();
|
|
108
|
+
resolve(answer.trim());
|
|
109
|
+
});
|
|
110
|
+
});
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
function mkdirp(p) {
|
|
114
|
+
mkdirSync(p, { recursive: true });
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// ── Step 0: Check Node.js ────────────────────────────────────────────────────
|
|
118
|
+
|
|
119
|
+
function checkNode() {
|
|
120
|
+
printChecklist();
|
|
121
|
+
|
|
122
|
+
const version = run('node --version', { silent: true });
|
|
123
|
+
if (!version) {
|
|
124
|
+
const fix = IS_MAC
|
|
125
|
+
? 'Run: brew install node'
|
|
126
|
+
: IS_WIN
|
|
127
|
+
? 'Run: winget install OpenJS.NodeJS.LTS'
|
|
128
|
+
: 'Run: curl -fsSL https://deb.nodesource.com/setup_22.x | sudo -E bash - && sudo apt-get install -y nodejs';
|
|
129
|
+
fail(0, 'Node.js is not installed.', fix);
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
const major = parseInt(version.replace('v', '').split('.')[0], 10);
|
|
133
|
+
if (major < 22) {
|
|
134
|
+
const fix = IS_MAC
|
|
135
|
+
? 'Run: brew upgrade node'
|
|
136
|
+
: IS_WIN
|
|
137
|
+
? 'Run: winget upgrade OpenJS.NodeJS.LTS'
|
|
138
|
+
: 'Visit https://nodejs.org and install v22+';
|
|
139
|
+
fail(0, `Node.js ${version} is too old. Need v22+.`, fix);
|
|
140
|
+
}
|
|
141
|
+
|
|
142
|
+
stepDone(`Node.js ${version}`);
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
// ── Step 1: Check Claude Code CLI ────────────────────────────────────────────
|
|
146
|
+
|
|
147
|
+
async function checkClaude() {
|
|
148
|
+
printChecklist();
|
|
149
|
+
|
|
150
|
+
const version = run('claude --version', { silent: true });
|
|
151
|
+
if (version) {
|
|
152
|
+
// Check auth
|
|
153
|
+
const authStatus = run('claude auth status', { silent: true });
|
|
154
|
+
if (authStatus && (authStatus.includes('authenticated') || authStatus.includes('Logged in') || authStatus.includes('Active'))) {
|
|
155
|
+
stepDone(`Claude Code CLI ${version} (authenticated)`);
|
|
156
|
+
return;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
console.log(' Claude Code CLI is installed but not authenticated.');
|
|
160
|
+
console.log(' Running: claude auth login');
|
|
161
|
+
console.log(' A browser window will open — sign in with your Anthropic account.');
|
|
162
|
+
console.log('');
|
|
163
|
+
|
|
164
|
+
try {
|
|
165
|
+
execSync('claude auth login', { stdio: 'inherit' });
|
|
166
|
+
} catch {
|
|
167
|
+
fail(1,
|
|
168
|
+
'Claude Code authentication failed.',
|
|
169
|
+
'Run "claude auth login" manually. You need a Claude Pro/Max subscription or an Anthropic API key.'
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
stepDone(`Claude Code CLI ${version} (authenticated)`);
|
|
174
|
+
return;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
// Not installed — install it
|
|
178
|
+
console.log(' Claude Code CLI not found. Installing...');
|
|
179
|
+
console.log('');
|
|
180
|
+
console.log(' Running: npm install -g @anthropic-ai/claude-code');
|
|
181
|
+
console.log('');
|
|
182
|
+
|
|
183
|
+
const installResult = run('npm install -g @anthropic-ai/claude-code 2>&1');
|
|
184
|
+
if (!installResult || run('claude --version', { silent: true }) === null) {
|
|
185
|
+
const fix = IS_MAC || IS_LINUX
|
|
186
|
+
? 'Try: sudo npm install -g @anthropic-ai/claude-code'
|
|
187
|
+
: 'Run PowerShell as Administrator and try again.';
|
|
188
|
+
fail(1, 'Failed to install Claude Code CLI.', fix);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
const newVersion = run('claude --version', { silent: true }) || 'installed';
|
|
192
|
+
console.log(` Installed Claude Code CLI ${newVersion}`);
|
|
193
|
+
console.log('');
|
|
194
|
+
console.log(' Now we need to log you in.');
|
|
195
|
+
console.log(' Running: claude auth login');
|
|
196
|
+
console.log(' A browser window will open — sign in with your Anthropic account.');
|
|
197
|
+
console.log('');
|
|
198
|
+
|
|
199
|
+
try {
|
|
200
|
+
execSync('claude auth login', { stdio: 'inherit' });
|
|
201
|
+
} catch {
|
|
202
|
+
fail(1,
|
|
203
|
+
'Claude Code authentication failed.',
|
|
204
|
+
'Run "claude auth login" manually. You need a Claude Pro/Max subscription or an Anthropic API key.'
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
stepDone(`Claude Code CLI ${newVersion} (authenticated)`);
|
|
209
|
+
}
|
|
210
|
+
|
|
211
|
+
// ── Step 2: Install dependencies ─────────────────────────────────────────────
|
|
212
|
+
|
|
213
|
+
function installDeps() {
|
|
214
|
+
printChecklist();
|
|
215
|
+
|
|
216
|
+
if (existsSync(join(PROJECT_ROOT, 'node_modules'))) {
|
|
217
|
+
stepDone('Dependencies already installed');
|
|
218
|
+
return;
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
console.log(' Running: npm install');
|
|
222
|
+
console.log('');
|
|
223
|
+
|
|
224
|
+
try {
|
|
225
|
+
execSync('npm install', { cwd: PROJECT_ROOT, stdio: 'inherit' });
|
|
226
|
+
} catch {
|
|
227
|
+
fail(2,
|
|
228
|
+
'npm install failed.',
|
|
229
|
+
`cd "${PROJECT_ROOT}" and run "npm install" manually. Check the error above.`
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
stepDone('Dependencies installed');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
// ── Step 3: Create MyAIforOne Drive ──────────────────────────────────────────
|
|
237
|
+
|
|
238
|
+
function createDrive() {
|
|
239
|
+
printChecklist();
|
|
240
|
+
|
|
241
|
+
const driveRoot = join(HOME, 'Desktop', 'MyAIforOne Drive');
|
|
242
|
+
const dirs = [
|
|
243
|
+
join(driveRoot, 'PersonalAgents'),
|
|
244
|
+
join(driveRoot, 'PersonalRegistry'),
|
|
245
|
+
join(driveRoot, 'PersonalRegistry', 'skills', 'personal'),
|
|
246
|
+
join(driveRoot, 'PersonalRegistry', 'prompts', 'personal'),
|
|
247
|
+
];
|
|
248
|
+
|
|
249
|
+
const platformAgents = ['hub', 'agentcreator', 'skillcreator', 'appcreator', 'promptcreator', 'gym'];
|
|
250
|
+
for (const agent of platformAgents) {
|
|
251
|
+
dirs.push(join(driveRoot, 'PlatformUtilities', agent, 'memory'));
|
|
252
|
+
dirs.push(join(driveRoot, 'PlatformUtilities', agent, 'FileStorage', 'Temp'));
|
|
253
|
+
dirs.push(join(driveRoot, 'PlatformUtilities', agent, 'FileStorage', 'Permanent'));
|
|
254
|
+
}
|
|
255
|
+
|
|
256
|
+
for (const d of dirs) {
|
|
257
|
+
mkdirp(d);
|
|
258
|
+
}
|
|
259
|
+
|
|
260
|
+
stepDone('MyAIforOne Drive created');
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// ── Step 4: Generate config.json ─────────────────────────────────────────────
|
|
264
|
+
|
|
265
|
+
function generateConfig() {
|
|
266
|
+
printChecklist();
|
|
267
|
+
|
|
268
|
+
const configPath = join(PROJECT_ROOT, 'config.json');
|
|
269
|
+
if (existsSync(configPath)) {
|
|
270
|
+
console.log(' config.json already exists — skipping generation.');
|
|
271
|
+
stepDone('Config already exists');
|
|
272
|
+
return;
|
|
273
|
+
}
|
|
274
|
+
|
|
275
|
+
const examplePath = join(PROJECT_ROOT, 'config.example.json');
|
|
276
|
+
if (!existsSync(examplePath)) {
|
|
277
|
+
fail(4, 'config.example.json not found.', `Make sure you're running this from the myAIforOne directory.`);
|
|
278
|
+
}
|
|
279
|
+
|
|
280
|
+
const config = JSON.parse(readFileSync(examplePath, 'utf8'));
|
|
281
|
+
|
|
282
|
+
// Webhook secret
|
|
283
|
+
config.service.webUI.webhookSecret = randomBytes(16).toString('hex');
|
|
284
|
+
|
|
285
|
+
// Disable all channels
|
|
286
|
+
for (const ch of Object.values(config.channels)) {
|
|
287
|
+
ch.enabled = false;
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
// Scan platform skills
|
|
291
|
+
const skillsDir = join(PROJECT_ROOT, 'registry', 'skills', 'platform');
|
|
292
|
+
let defaultSkills = [];
|
|
293
|
+
if (existsSync(skillsDir)) {
|
|
294
|
+
defaultSkills = readdirSync(skillsDir)
|
|
295
|
+
.filter((f) => f.endsWith('.md'))
|
|
296
|
+
.map((f) => f.replace('.md', ''));
|
|
297
|
+
}
|
|
298
|
+
config.defaultSkills = defaultSkills;
|
|
299
|
+
config.defaultMcps = [];
|
|
300
|
+
|
|
301
|
+
// Add myaiforone-local MCP
|
|
302
|
+
config.mcps['myaiforone-local'] = {
|
|
303
|
+
type: 'stdio',
|
|
304
|
+
command: 'node',
|
|
305
|
+
args: [join(PROJECT_ROOT, 'server', 'mcp-server', 'dist', 'index.js')],
|
|
306
|
+
env: { MYAGENT_API_URL: 'http://localhost:4888' },
|
|
307
|
+
};
|
|
308
|
+
|
|
309
|
+
// Empty agents — will be populated in next step
|
|
310
|
+
config.agents = {};
|
|
311
|
+
config.defaultAgent = null;
|
|
312
|
+
|
|
313
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
314
|
+
stepDone('Config generated');
|
|
315
|
+
}
|
|
316
|
+
|
|
317
|
+
// ── Step 5: Register platform agents ─────────────────────────────────────────
|
|
318
|
+
|
|
319
|
+
function registerAgents() {
|
|
320
|
+
printChecklist();
|
|
321
|
+
|
|
322
|
+
const configPath = join(PROJECT_ROOT, 'config.json');
|
|
323
|
+
const config = JSON.parse(readFileSync(configPath, 'utf8'));
|
|
324
|
+
|
|
325
|
+
const driveRoot = join(HOME, 'Desktop', 'MyAIforOne Drive');
|
|
326
|
+
const allTools = ['Read', 'Edit', 'Write', 'Glob', 'Grep', 'Bash', 'WebFetch', 'WebSearch'];
|
|
327
|
+
|
|
328
|
+
// Hub agent
|
|
329
|
+
config.agents.hub = {
|
|
330
|
+
name: 'Hub',
|
|
331
|
+
description: 'The primary AI interface — handles all platform operations through natural conversation.',
|
|
332
|
+
agentHome: join(driveRoot, 'PlatformUtilities', 'hub'),
|
|
333
|
+
claudeMd: join(PROJECT_ROOT, 'agents', 'platform', 'hub', 'CLAUDE.md'),
|
|
334
|
+
memoryDir: join(driveRoot, 'PlatformUtilities', 'hub', 'memory'),
|
|
335
|
+
workspace: PROJECT_ROOT,
|
|
336
|
+
persistent: true,
|
|
337
|
+
streaming: true,
|
|
338
|
+
subAgents: '*',
|
|
339
|
+
mcps: ['myaiforone-local'],
|
|
340
|
+
allowedTools: allTools,
|
|
341
|
+
timeout: 14400000,
|
|
342
|
+
autoCommit: false,
|
|
343
|
+
agentClass: 'platform',
|
|
344
|
+
routes: [{ channel: 'web', match: 'default' }],
|
|
345
|
+
};
|
|
346
|
+
|
|
347
|
+
config.defaultAgent = 'hub';
|
|
348
|
+
|
|
349
|
+
// Creator agents
|
|
350
|
+
const creators = [
|
|
351
|
+
{ id: 'agentcreator', name: 'Agent Creator', skills: ['opAgents_AddNew'] },
|
|
352
|
+
{ id: 'skillcreator', name: 'Skill Creator', skills: ['MyAgentSkillCreate'] },
|
|
353
|
+
{ id: 'appcreator', name: 'App Creator', skills: ['ai41_app_build'] },
|
|
354
|
+
{ id: 'promptcreator', name: 'Prompt Creator', skills: [] },
|
|
355
|
+
];
|
|
356
|
+
|
|
357
|
+
for (const c of creators) {
|
|
358
|
+
config.agents[c.id] = {
|
|
359
|
+
name: c.name,
|
|
360
|
+
agentClass: 'platform',
|
|
361
|
+
persistent: true,
|
|
362
|
+
streaming: true,
|
|
363
|
+
mcps: ['myaiforone-local'],
|
|
364
|
+
workspace: PROJECT_ROOT,
|
|
365
|
+
agentHome: join(driveRoot, 'PlatformUtilities', c.id),
|
|
366
|
+
claudeMd: join(PROJECT_ROOT, 'agents', 'platform', c.id, 'CLAUDE.md'),
|
|
367
|
+
memoryDir: join(driveRoot, 'PlatformUtilities', c.id, 'memory'),
|
|
368
|
+
allowedTools: allTools,
|
|
369
|
+
skills: c.skills,
|
|
370
|
+
timeout: 14400000,
|
|
371
|
+
autoCommit: false,
|
|
372
|
+
routes: [],
|
|
373
|
+
org: [{ organization: 'Platform Creators', function: 'Lab', title: 'Creator Agent', reportsTo: '' }],
|
|
374
|
+
};
|
|
375
|
+
}
|
|
376
|
+
|
|
377
|
+
// Gym agent — load from agent.json
|
|
378
|
+
const gymJsonPath = join(PROJECT_ROOT, 'agents', 'platform', 'gym', 'agent.json');
|
|
379
|
+
if (existsSync(gymJsonPath)) {
|
|
380
|
+
const gymConfig = JSON.parse(readFileSync(gymJsonPath, 'utf8'));
|
|
381
|
+
const { id, ...gymRest } = gymConfig;
|
|
382
|
+
config.agents.gym = {
|
|
383
|
+
...gymRest,
|
|
384
|
+
agentHome: join(driveRoot, 'PlatformUtilities', 'gym'),
|
|
385
|
+
claudeMd: join(PROJECT_ROOT, 'agents', 'platform', 'gym', 'CLAUDE.md'),
|
|
386
|
+
memoryDir: join(driveRoot, 'PlatformUtilities', 'gym', 'memory'),
|
|
387
|
+
};
|
|
388
|
+
}
|
|
389
|
+
|
|
390
|
+
writeFileSync(configPath, JSON.stringify(config, null, 2));
|
|
391
|
+
|
|
392
|
+
// Validate JSON
|
|
393
|
+
try {
|
|
394
|
+
JSON.parse(readFileSync(configPath, 'utf8'));
|
|
395
|
+
} catch (e) {
|
|
396
|
+
fail(5, `config.json is invalid JSON after agent registration: ${e.message}`, 'This is a bug. Please report it.');
|
|
397
|
+
}
|
|
398
|
+
|
|
399
|
+
stepDone('Platform agents registered (hub + 4 creators + gym)');
|
|
400
|
+
}
|
|
401
|
+
|
|
402
|
+
// ── Step 6: Build ────────────────────────────────────────────────────────────
|
|
403
|
+
|
|
404
|
+
function build() {
|
|
405
|
+
printChecklist();
|
|
406
|
+
|
|
407
|
+
console.log(' Running: npm run build');
|
|
408
|
+
console.log('');
|
|
409
|
+
|
|
410
|
+
try {
|
|
411
|
+
execSync('npm run build', { cwd: PROJECT_ROOT, stdio: 'inherit' });
|
|
412
|
+
} catch {
|
|
413
|
+
fail(6,
|
|
414
|
+
'Build failed. Check the TypeScript errors above.',
|
|
415
|
+
`cd "${PROJECT_ROOT}" and run "npm run build" to see details.`
|
|
416
|
+
);
|
|
417
|
+
}
|
|
418
|
+
|
|
419
|
+
stepDone('Build complete');
|
|
420
|
+
}
|
|
421
|
+
|
|
422
|
+
// ── Step 7: Start & open browser ─────────────────────────────────────────────
|
|
423
|
+
|
|
424
|
+
function startAndOpen() {
|
|
425
|
+
printChecklist();
|
|
426
|
+
|
|
427
|
+
// Create desktop shortcut silently
|
|
428
|
+
try {
|
|
429
|
+
if (IS_MAC) {
|
|
430
|
+
const appPath = join(HOME, 'Desktop', 'AIforOne.app');
|
|
431
|
+
mkdirp(join(appPath, 'Contents', 'MacOS'));
|
|
432
|
+
writeFileSync(join(appPath, 'Contents', 'Info.plist'), `<?xml version="1.0" encoding="UTF-8"?>
|
|
433
|
+
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
|
|
434
|
+
<plist version="1.0">
|
|
435
|
+
<dict>
|
|
436
|
+
<key>CFBundleExecutable</key><string>AIforOne</string>
|
|
437
|
+
<key>CFBundleName</key><string>AIforOne</string>
|
|
438
|
+
<key>CFBundleIdentifier</key><string>com.aiforone.launcher</string>
|
|
439
|
+
<key>CFBundleVersion</key><string>1.0</string>
|
|
440
|
+
</dict>
|
|
441
|
+
</plist>`);
|
|
442
|
+
writeFileSync(join(appPath, 'Contents', 'MacOS', 'AIforOne'), '#!/bin/bash\nopen "http://localhost:4888"\n');
|
|
443
|
+
run(`chmod +x "${join(appPath, 'Contents', 'MacOS', 'AIforOne')}"`);
|
|
444
|
+
} else if (IS_WIN) {
|
|
445
|
+
// Windows shortcut via PowerShell
|
|
446
|
+
run(`powershell -Command "$ws = New-Object -ComObject WScript.Shell; $s = $ws.CreateShortcut('${join(HOME, 'Desktop', 'AIforOne.lnk')}'); $s.TargetPath = 'http://localhost:4888'; $s.Description = 'Open AIforOne Web UI'; $s.Save()"`);
|
|
447
|
+
}
|
|
448
|
+
} catch {
|
|
449
|
+
// Shortcut creation is non-critical
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
// Start the service in background
|
|
453
|
+
console.log(' Starting service...');
|
|
454
|
+
const child = spawn('node', ['dist/index.js'], {
|
|
455
|
+
cwd: PROJECT_ROOT,
|
|
456
|
+
detached: true,
|
|
457
|
+
stdio: ['ignore', 'pipe', 'pipe'],
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
let started = false;
|
|
461
|
+
|
|
462
|
+
// Wait for startup log
|
|
463
|
+
const timeout = setTimeout(() => {
|
|
464
|
+
if (!started) {
|
|
465
|
+
child.unref();
|
|
466
|
+
console.log(' Service started (waiting for full init).');
|
|
467
|
+
openBrowser();
|
|
468
|
+
printFinal();
|
|
469
|
+
}
|
|
470
|
+
}, 15000);
|
|
471
|
+
|
|
472
|
+
child.stdout.on('data', (data) => {
|
|
473
|
+
const line = data.toString();
|
|
474
|
+
if (line.includes('running') && !started) {
|
|
475
|
+
started = true;
|
|
476
|
+
clearTimeout(timeout);
|
|
477
|
+
child.unref();
|
|
478
|
+
stepDone('Service running');
|
|
479
|
+
openBrowser();
|
|
480
|
+
printFinal();
|
|
481
|
+
}
|
|
482
|
+
});
|
|
483
|
+
|
|
484
|
+
child.stderr.on('data', (data) => {
|
|
485
|
+
// Ignore stderr during startup — some deps emit warnings
|
|
486
|
+
});
|
|
487
|
+
|
|
488
|
+
child.on('error', () => {
|
|
489
|
+
if (!started) {
|
|
490
|
+
clearTimeout(timeout);
|
|
491
|
+
fail(7,
|
|
492
|
+
'Failed to start the service.',
|
|
493
|
+
`cd "${PROJECT_ROOT}" and run "npm start" manually.`
|
|
494
|
+
);
|
|
495
|
+
}
|
|
496
|
+
});
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
function openBrowser() {
|
|
500
|
+
const url = 'http://localhost:4888/monitor';
|
|
501
|
+
try {
|
|
502
|
+
if (IS_MAC) run(`open "${url}"`);
|
|
503
|
+
else if (IS_WIN) run(`start "" "${url}"`);
|
|
504
|
+
else run(`xdg-open "${url}"`);
|
|
505
|
+
} catch {
|
|
506
|
+
console.log(` Open ${url} in your browser.`);
|
|
507
|
+
}
|
|
508
|
+
}
|
|
509
|
+
|
|
510
|
+
function printFinal() {
|
|
511
|
+
completedSteps = STEPS.length;
|
|
512
|
+
printChecklist();
|
|
513
|
+
|
|
514
|
+
console.log(' ╔══════════════════════════════════╗');
|
|
515
|
+
console.log(' ║ Setup complete! ║');
|
|
516
|
+
console.log(' ╚══════════════════════════════════╝');
|
|
517
|
+
console.log('');
|
|
518
|
+
console.log(' Web UI: http://localhost:4888');
|
|
519
|
+
console.log(' Monitor: http://localhost:4888/monitor');
|
|
520
|
+
console.log('');
|
|
521
|
+
console.log(' The browser should have opened to the Monitor page.');
|
|
522
|
+
console.log(' Click "Start Setup" and the hub agent will walk you');
|
|
523
|
+
console.log(' through connecting channels and creating your first agent.');
|
|
524
|
+
console.log('');
|
|
525
|
+
console.log(' Quick commands:');
|
|
526
|
+
console.log(` cd "${PROJECT_ROOT}"`);
|
|
527
|
+
console.log(' npm start — start manually');
|
|
528
|
+
console.log(' npm run dev — dev mode');
|
|
529
|
+
console.log(' http://localhost:4888 — web dashboard');
|
|
530
|
+
console.log('');
|
|
531
|
+
|
|
532
|
+
process.exit(0);
|
|
533
|
+
}
|
|
534
|
+
|
|
535
|
+
// ── Main ─────────────────────────────────────────────────────────────────────
|
|
536
|
+
|
|
537
|
+
async function main() {
|
|
538
|
+
printBanner();
|
|
539
|
+
|
|
540
|
+
console.log(' Here\'s what we\'ll do:');
|
|
541
|
+
console.log('');
|
|
542
|
+
for (let i = 0; i < STEPS.length; i++) {
|
|
543
|
+
console.log(` □ ${i + 1}. ${STEPS[i]}`);
|
|
544
|
+
}
|
|
545
|
+
console.log('');
|
|
546
|
+
console.log(' This takes a couple of minutes. Let\'s go!');
|
|
547
|
+
|
|
548
|
+
checkNode();
|
|
549
|
+
await checkClaude();
|
|
550
|
+
installDeps();
|
|
551
|
+
createDrive();
|
|
552
|
+
generateConfig();
|
|
553
|
+
registerAgents();
|
|
554
|
+
build();
|
|
555
|
+
startAndOpen();
|
|
556
|
+
}
|
|
557
|
+
|
|
558
|
+
main().catch((e) => {
|
|
559
|
+
console.error('');
|
|
560
|
+
console.error(` ❌ Unexpected error: ${e.message}`);
|
|
561
|
+
console.error('');
|
|
562
|
+
console.error(' Paste this into Claude.ai or Claude Code for help:');
|
|
563
|
+
console.error(` ${e.stack}`);
|
|
564
|
+
console.error('');
|
|
565
|
+
process.exit(1);
|
|
566
|
+
});
|