squads-cli 0.1.2 → 0.2.1
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 +551 -177
- package/dist/auth-YW3UPFSB.js +23 -0
- package/dist/auth-YW3UPFSB.js.map +1 -0
- package/dist/autonomy-PSVZVX7A.js +105 -0
- package/dist/autonomy-PSVZVX7A.js.map +1 -0
- package/dist/chunk-67RO2HKR.js +174 -0
- package/dist/chunk-67RO2HKR.js.map +1 -0
- package/dist/chunk-7OCVIDC7.js +12 -0
- package/dist/chunk-7OCVIDC7.js.map +1 -0
- package/dist/chunk-BODLDQY7.js +452 -0
- package/dist/chunk-BODLDQY7.js.map +1 -0
- package/dist/chunk-EHQJHRIW.js +103 -0
- package/dist/chunk-EHQJHRIW.js.map +1 -0
- package/dist/chunk-FFFCFZ6A.js +121 -0
- package/dist/chunk-FFFCFZ6A.js.map +1 -0
- package/dist/chunk-FIWT2NMM.js +165 -0
- package/dist/chunk-FIWT2NMM.js.map +1 -0
- package/dist/chunk-HF4WR7RA.js +154 -0
- package/dist/chunk-HF4WR7RA.js.map +1 -0
- package/dist/chunk-J6QF4ZQX.js +230 -0
- package/dist/chunk-J6QF4ZQX.js.map +1 -0
- package/dist/chunk-LOA3KWYJ.js +294 -0
- package/dist/chunk-LOA3KWYJ.js.map +1 -0
- package/dist/chunk-M5FXNY6Y.js +384 -0
- package/dist/chunk-M5FXNY6Y.js.map +1 -0
- package/dist/chunk-QHNUMM4V.js +87 -0
- package/dist/chunk-QHNUMM4V.js.map +1 -0
- package/dist/chunk-QJ7C7CMB.js +223 -0
- package/dist/chunk-QJ7C7CMB.js.map +1 -0
- package/dist/chunk-RM6BWILN.js +74 -0
- package/dist/chunk-RM6BWILN.js.map +1 -0
- package/dist/chunk-TYFTF53O.js +613 -0
- package/dist/chunk-TYFTF53O.js.map +1 -0
- package/dist/chunk-TZXD6WFN.js +420 -0
- package/dist/chunk-TZXD6WFN.js.map +1 -0
- package/dist/chunk-WVOIY5GW.js +621 -0
- package/dist/chunk-WVOIY5GW.js.map +1 -0
- package/dist/chunk-Z2UKDBNL.js +162 -0
- package/dist/chunk-Z2UKDBNL.js.map +1 -0
- package/dist/chunk-ZTQ7ISUR.js +338 -0
- package/dist/chunk-ZTQ7ISUR.js.map +1 -0
- package/dist/cli.js +2506 -4475
- package/dist/cli.js.map +1 -1
- package/dist/context-GWPF4SEY.js +291 -0
- package/dist/context-GWPF4SEY.js.map +1 -0
- package/dist/context-feed-AJGVAR6H.js +394 -0
- package/dist/context-feed-AJGVAR6H.js.map +1 -0
- package/dist/cost-XBCDJ7XC.js +275 -0
- package/dist/cost-XBCDJ7XC.js.map +1 -0
- package/dist/create-BLFGG6PF.js +286 -0
- package/dist/create-BLFGG6PF.js.map +1 -0
- package/dist/dashboard-LGT2B2BL.js +951 -0
- package/dist/dashboard-LGT2B2BL.js.map +1 -0
- package/dist/dashboard-RMK2BOD2.js +794 -0
- package/dist/dashboard-RMK2BOD2.js.map +1 -0
- package/dist/doctor-XPUIIBHJ.js +374 -0
- package/dist/doctor-XPUIIBHJ.js.map +1 -0
- package/dist/env-config-SQEI3Y7Y.js +21 -0
- package/dist/env-config-SQEI3Y7Y.js.map +1 -0
- package/dist/exec-OUXM7JBF.js +223 -0
- package/dist/exec-OUXM7JBF.js.map +1 -0
- package/dist/feedback-KNAOG5QK.js +229 -0
- package/dist/feedback-KNAOG5QK.js.map +1 -0
- package/dist/github-UQTM5KMS.js +23 -0
- package/dist/github-UQTM5KMS.js.map +1 -0
- package/dist/goal-BVHV5573.js +168 -0
- package/dist/goal-BVHV5573.js.map +1 -0
- package/dist/health-4UXN44PF.js +218 -0
- package/dist/health-4UXN44PF.js.map +1 -0
- package/dist/history-ILH3SWHB.js +232 -0
- package/dist/history-ILH3SWHB.js.map +1 -0
- package/dist/index.d.ts +736 -8
- package/dist/index.js +1312 -6
- package/dist/index.js.map +1 -1
- package/dist/init-XQZ7BOGT.js +812 -0
- package/dist/init-XQZ7BOGT.js.map +1 -0
- package/dist/kpi-RQIU7WGK.js +413 -0
- package/dist/kpi-RQIU7WGK.js.map +1 -0
- package/dist/learn-OIFUVZAS.js +269 -0
- package/dist/learn-OIFUVZAS.js.map +1 -0
- package/dist/login-DXZANWZY.js +155 -0
- package/dist/login-DXZANWZY.js.map +1 -0
- package/dist/memory-T3ACCS7E.js +560 -0
- package/dist/memory-T3ACCS7E.js.map +1 -0
- package/dist/memory-VNF2VFRB.js +23 -0
- package/dist/memory-VNF2VFRB.js.map +1 -0
- package/dist/progress-DAUZMT3N.js +202 -0
- package/dist/progress-DAUZMT3N.js.map +1 -0
- package/dist/providers-3P5D2XL5.js +65 -0
- package/dist/providers-3P5D2XL5.js.map +1 -0
- package/dist/results-UECWGLTB.js +224 -0
- package/dist/results-UECWGLTB.js.map +1 -0
- package/dist/run-I6KAXU6U.js +4049 -0
- package/dist/run-I6KAXU6U.js.map +1 -0
- package/dist/session-HBU6KZOD.js +64 -0
- package/dist/session-HBU6KZOD.js.map +1 -0
- package/dist/sessions-CK25VGPL.js +333 -0
- package/dist/sessions-CK25VGPL.js.map +1 -0
- package/dist/squad-parser-DCG65BJS.js +35 -0
- package/dist/squad-parser-DCG65BJS.js.map +1 -0
- package/dist/stats-G6NAU5BD.js +334 -0
- package/dist/stats-G6NAU5BD.js.map +1 -0
- package/dist/status-AQNLDZVN.js +352 -0
- package/dist/status-AQNLDZVN.js.map +1 -0
- package/dist/sync-ZI3MHA4G.js +836 -0
- package/dist/sync-ZI3MHA4G.js.map +1 -0
- package/dist/templates/core/AGENTS.md.template +51 -0
- package/dist/templates/core/BUSINESS_BRIEF.md.template +29 -0
- package/dist/templates/core/CLAUDE.md.template +48 -0
- package/dist/templates/core/provider.yaml.template +5 -0
- package/dist/templates/first-squad/SQUAD.md.template +23 -0
- package/dist/templates/first-squad/lead.md.template +44 -0
- package/dist/templates/memory/getting-started/state.md.template +19 -0
- package/dist/templates/seed/BUSINESS_BRIEF.md.template +27 -0
- package/dist/templates/seed/CLAUDE.md.template +119 -0
- package/dist/templates/seed/README.md.template +42 -0
- package/dist/templates/seed/config/SYSTEM.md +52 -0
- package/dist/templates/seed/config/provider.yaml +4 -0
- package/dist/templates/seed/hooks/settings.json.template +31 -0
- package/dist/templates/seed/memory/company/directives.md +37 -0
- package/dist/templates/seed/memory/company/manager/state.md +16 -0
- package/dist/templates/seed/memory/engineering/issue-solver/state.md +12 -0
- package/dist/templates/seed/memory/intelligence/intel-lead/state.md +9 -0
- package/dist/templates/seed/memory/marketing/content-drafter/state.md +12 -0
- package/dist/templates/seed/memory/operations/ops-lead/state.md +12 -0
- package/dist/templates/seed/memory/product/lead/state.md +14 -0
- package/dist/templates/seed/memory/research/lead/state.md +14 -0
- package/dist/templates/seed/skills/gh/SKILL.md +57 -0
- package/dist/templates/seed/skills/squads-cli/SKILL.md +84 -0
- package/dist/templates/seed/squads/company/SQUAD.md +51 -0
- package/dist/templates/seed/squads/company/company-critic.md +49 -0
- package/dist/templates/seed/squads/company/company-eval.md +49 -0
- package/dist/templates/seed/squads/company/event-dispatcher.md +43 -0
- package/dist/templates/seed/squads/company/goal-tracker.md +43 -0
- package/dist/templates/seed/squads/company/manager.md +54 -0
- package/dist/templates/seed/squads/engineering/SQUAD.md +48 -0
- package/dist/templates/seed/squads/engineering/code-reviewer.md +57 -0
- package/dist/templates/seed/squads/engineering/issue-solver.md +58 -0
- package/dist/templates/seed/squads/engineering/test-writer.md +50 -0
- package/dist/templates/seed/squads/intelligence/SQUAD.md +38 -0
- package/dist/templates/seed/squads/intelligence/intel-critic.md +36 -0
- package/dist/templates/seed/squads/intelligence/intel-eval.md +31 -0
- package/dist/templates/seed/squads/intelligence/intel-lead.md +71 -0
- package/dist/templates/seed/squads/marketing/SQUAD.md +47 -0
- package/dist/templates/seed/squads/marketing/content-drafter.md +71 -0
- package/dist/templates/seed/squads/marketing/growth-analyst.md +49 -0
- package/dist/templates/seed/squads/marketing/social-poster.md +44 -0
- package/dist/templates/seed/squads/operations/SQUAD.md +45 -0
- package/dist/templates/seed/squads/operations/finance-tracker.md +47 -0
- package/dist/templates/seed/squads/operations/goal-tracker.md +48 -0
- package/dist/templates/seed/squads/operations/ops-lead.md +58 -0
- package/dist/templates/seed/squads/product/SQUAD.md +41 -0
- package/dist/templates/seed/squads/product/lead.md +56 -0
- package/dist/templates/seed/squads/product/scanner.md +50 -0
- package/dist/templates/seed/squads/product/worker.md +55 -0
- package/dist/templates/seed/squads/research/SQUAD.md +38 -0
- package/dist/templates/seed/squads/research/analyst.md +50 -0
- package/dist/templates/seed/squads/research/lead.md +52 -0
- package/dist/templates/seed/squads/research/synthesizer.md +59 -0
- package/dist/templates/skills/squads-learn/SKILL.md +86 -0
- package/dist/templates/skills/squads-workflow/instruction.md +70 -0
- package/dist/terminal-FBQFQTKZ.js +55 -0
- package/dist/terminal-FBQFQTKZ.js.map +1 -0
- package/dist/update-D7CGIZ3M.js +18 -0
- package/dist/update-D7CGIZ3M.js.map +1 -0
- package/dist/update-STU276HR.js +83 -0
- package/dist/update-STU276HR.js.map +1 -0
- package/package.json +31 -13
- package/templates/core/AGENTS.md.template +51 -0
- package/templates/core/BUSINESS_BRIEF.md.template +29 -0
- package/templates/core/CLAUDE.md.template +48 -0
- package/templates/core/provider.yaml.template +5 -0
- package/templates/first-squad/SQUAD.md.template +23 -0
- package/templates/first-squad/lead.md.template +44 -0
- package/templates/memory/getting-started/state.md.template +19 -0
- package/templates/seed/BUSINESS_BRIEF.md.template +27 -0
- package/templates/seed/CLAUDE.md.template +119 -0
- package/templates/seed/README.md.template +42 -0
- package/templates/seed/config/SYSTEM.md +52 -0
- package/templates/seed/config/provider.yaml +4 -0
- package/templates/seed/hooks/settings.json.template +31 -0
- package/templates/seed/memory/company/directives.md +37 -0
- package/templates/seed/memory/company/manager/state.md +16 -0
- package/templates/seed/memory/engineering/issue-solver/state.md +12 -0
- package/templates/seed/memory/intelligence/intel-lead/state.md +9 -0
- package/templates/seed/memory/marketing/content-drafter/state.md +12 -0
- package/templates/seed/memory/operations/ops-lead/state.md +12 -0
- package/templates/seed/memory/product/lead/state.md +14 -0
- package/templates/seed/memory/research/lead/state.md +14 -0
- package/templates/seed/skills/gh/SKILL.md +57 -0
- package/templates/seed/skills/squads-cli/SKILL.md +84 -0
- package/templates/seed/squads/company/SQUAD.md +51 -0
- package/templates/seed/squads/company/company-critic.md +49 -0
- package/templates/seed/squads/company/company-eval.md +49 -0
- package/templates/seed/squads/company/event-dispatcher.md +43 -0
- package/templates/seed/squads/company/goal-tracker.md +43 -0
- package/templates/seed/squads/company/manager.md +54 -0
- package/templates/seed/squads/engineering/SQUAD.md +48 -0
- package/templates/seed/squads/engineering/code-reviewer.md +57 -0
- package/templates/seed/squads/engineering/issue-solver.md +58 -0
- package/templates/seed/squads/engineering/test-writer.md +50 -0
- package/templates/seed/squads/intelligence/SQUAD.md +38 -0
- package/templates/seed/squads/intelligence/intel-critic.md +36 -0
- package/templates/seed/squads/intelligence/intel-eval.md +31 -0
- package/templates/seed/squads/intelligence/intel-lead.md +71 -0
- package/templates/seed/squads/marketing/SQUAD.md +47 -0
- package/templates/seed/squads/marketing/content-drafter.md +71 -0
- package/templates/seed/squads/marketing/growth-analyst.md +49 -0
- package/templates/seed/squads/marketing/social-poster.md +44 -0
- package/templates/seed/squads/operations/SQUAD.md +45 -0
- package/templates/seed/squads/operations/finance-tracker.md +47 -0
- package/templates/seed/squads/operations/goal-tracker.md +48 -0
- package/templates/seed/squads/operations/ops-lead.md +58 -0
- package/templates/seed/squads/product/SQUAD.md +41 -0
- package/templates/seed/squads/product/lead.md +56 -0
- package/templates/seed/squads/product/scanner.md +50 -0
- package/templates/seed/squads/product/worker.md +55 -0
- package/templates/seed/squads/research/SQUAD.md +38 -0
- package/templates/seed/squads/research/analyst.md +50 -0
- package/templates/seed/squads/research/lead.md +52 -0
- package/templates/seed/squads/research/synthesizer.md +59 -0
- package/templates/skills/squads-learn/SKILL.md +86 -0
- package/templates/skills/squads-workflow/instruction.md +70 -0
|
@@ -0,0 +1,812 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
import {
|
|
3
|
+
loadTemplate
|
|
4
|
+
} from "./chunk-FFFCFZ6A.js";
|
|
5
|
+
import {
|
|
6
|
+
checkGitStatus,
|
|
7
|
+
getRepoName
|
|
8
|
+
} from "./chunk-TZXD6WFN.js";
|
|
9
|
+
import {
|
|
10
|
+
Events,
|
|
11
|
+
track
|
|
12
|
+
} from "./chunk-QJ7C7CMB.js";
|
|
13
|
+
import {
|
|
14
|
+
RESET,
|
|
15
|
+
colors,
|
|
16
|
+
icons,
|
|
17
|
+
writeLine
|
|
18
|
+
} from "./chunk-M5FXNY6Y.js";
|
|
19
|
+
import "./chunk-7OCVIDC7.js";
|
|
20
|
+
|
|
21
|
+
// src/commands/init.ts
|
|
22
|
+
import chalk from "chalk";
|
|
23
|
+
import ora from "ora";
|
|
24
|
+
import fs from "fs/promises";
|
|
25
|
+
import path from "path";
|
|
26
|
+
import { execSync as execSync2 } from "child_process";
|
|
27
|
+
import { createInterface } from "readline";
|
|
28
|
+
|
|
29
|
+
// src/lib/setup-checks.ts
|
|
30
|
+
import { execSync, spawn } from "child_process";
|
|
31
|
+
var PROVIDERS = {
|
|
32
|
+
claude: {
|
|
33
|
+
id: "claude",
|
|
34
|
+
name: "Claude Code (Anthropic)",
|
|
35
|
+
cliCheck: "claude",
|
|
36
|
+
installCmd: "npm install -g @anthropic-ai/claude-code",
|
|
37
|
+
loginCmd: "claude login",
|
|
38
|
+
requiresSubscription: true,
|
|
39
|
+
requiresApiKey: false
|
|
40
|
+
},
|
|
41
|
+
gemini: {
|
|
42
|
+
id: "gemini",
|
|
43
|
+
name: "Gemini (Google)",
|
|
44
|
+
cliCheck: "gemini",
|
|
45
|
+
envKey: "GEMINI_API_KEY",
|
|
46
|
+
installCmd: "npm install -g @anthropic-ai/claude-code",
|
|
47
|
+
// Placeholder - gemini CLI
|
|
48
|
+
requiresSubscription: false,
|
|
49
|
+
requiresApiKey: true
|
|
50
|
+
},
|
|
51
|
+
openai: {
|
|
52
|
+
id: "openai",
|
|
53
|
+
name: "GPT (OpenAI)",
|
|
54
|
+
envKey: "OPENAI_API_KEY",
|
|
55
|
+
requiresSubscription: false,
|
|
56
|
+
requiresApiKey: true
|
|
57
|
+
},
|
|
58
|
+
ollama: {
|
|
59
|
+
id: "ollama",
|
|
60
|
+
name: "Ollama (Local)",
|
|
61
|
+
cliCheck: "ollama",
|
|
62
|
+
installCmd: "brew install ollama",
|
|
63
|
+
requiresSubscription: false,
|
|
64
|
+
requiresApiKey: false
|
|
65
|
+
},
|
|
66
|
+
cursor: {
|
|
67
|
+
id: "cursor",
|
|
68
|
+
name: "Cursor IDE",
|
|
69
|
+
requiresSubscription: true,
|
|
70
|
+
requiresApiKey: false
|
|
71
|
+
},
|
|
72
|
+
aider: {
|
|
73
|
+
id: "aider",
|
|
74
|
+
name: "Aider",
|
|
75
|
+
cliCheck: "aider",
|
|
76
|
+
installCmd: "pip install aider-chat",
|
|
77
|
+
requiresSubscription: false,
|
|
78
|
+
requiresApiKey: true
|
|
79
|
+
},
|
|
80
|
+
none: {
|
|
81
|
+
id: "none",
|
|
82
|
+
name: "Planning Only (no agent execution)",
|
|
83
|
+
requiresSubscription: false,
|
|
84
|
+
requiresApiKey: false
|
|
85
|
+
}
|
|
86
|
+
};
|
|
87
|
+
function commandExists(cmd) {
|
|
88
|
+
try {
|
|
89
|
+
execSync(`which ${cmd}`, { stdio: "ignore" });
|
|
90
|
+
return true;
|
|
91
|
+
} catch {
|
|
92
|
+
return false;
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
function checkGhCli() {
|
|
96
|
+
if (!commandExists("gh")) {
|
|
97
|
+
return {
|
|
98
|
+
name: "GitHub CLI",
|
|
99
|
+
status: "warning",
|
|
100
|
+
message: "Recommended for GitHub integration",
|
|
101
|
+
hint: "Install: https://cli.github.com"
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
try {
|
|
105
|
+
execSync("gh auth status", { stdio: "ignore" });
|
|
106
|
+
return { name: "GitHub CLI", status: "ok" };
|
|
107
|
+
} catch {
|
|
108
|
+
return {
|
|
109
|
+
name: "GitHub CLI",
|
|
110
|
+
status: "warning",
|
|
111
|
+
message: "Installed but not authenticated",
|
|
112
|
+
hint: "Run: gh auth login",
|
|
113
|
+
fixCommand: "gh auth login"
|
|
114
|
+
};
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function checkGhPermissions() {
|
|
118
|
+
try {
|
|
119
|
+
const result = execSync("gh auth status 2>&1", { encoding: "utf-8", stdio: ["pipe", "pipe", "pipe"] });
|
|
120
|
+
const hasRepo = result.includes("repo") || result.includes("Token scopes:") && !result.includes("none");
|
|
121
|
+
const hasWorkflow = result.includes("workflow");
|
|
122
|
+
if (!hasRepo) {
|
|
123
|
+
return {
|
|
124
|
+
name: "GitHub Permissions",
|
|
125
|
+
status: "warning",
|
|
126
|
+
message: "Missing repo scope",
|
|
127
|
+
hint: "Run: gh auth refresh -s repo,workflow",
|
|
128
|
+
fixCommand: "gh auth refresh -s repo,workflow"
|
|
129
|
+
};
|
|
130
|
+
}
|
|
131
|
+
if (!hasWorkflow) {
|
|
132
|
+
return {
|
|
133
|
+
name: "GitHub Permissions",
|
|
134
|
+
status: "warning",
|
|
135
|
+
message: "Missing workflow scope (optional)",
|
|
136
|
+
hint: "For Actions: gh auth refresh -s repo,workflow"
|
|
137
|
+
};
|
|
138
|
+
}
|
|
139
|
+
return { name: "GitHub Permissions", status: "ok" };
|
|
140
|
+
} catch {
|
|
141
|
+
return {
|
|
142
|
+
name: "GitHub Permissions",
|
|
143
|
+
status: "warning",
|
|
144
|
+
message: "Could not verify permissions",
|
|
145
|
+
hint: "Run: gh auth status"
|
|
146
|
+
};
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
function checkProviderAuth(providerId) {
|
|
150
|
+
const provider = PROVIDERS[providerId];
|
|
151
|
+
if (!provider) {
|
|
152
|
+
return { name: "Provider", status: "warning", message: `Unknown provider: ${providerId}` };
|
|
153
|
+
}
|
|
154
|
+
if (providerId === "none" || providerId === "cursor") {
|
|
155
|
+
return { name: provider.name, status: "ok" };
|
|
156
|
+
}
|
|
157
|
+
if (provider.cliCheck) {
|
|
158
|
+
if (!commandExists(provider.cliCheck)) {
|
|
159
|
+
return {
|
|
160
|
+
name: provider.name,
|
|
161
|
+
status: "missing",
|
|
162
|
+
message: `CLI not installed`,
|
|
163
|
+
hint: provider.installCmd ? `Install: ${provider.installCmd}` : void 0,
|
|
164
|
+
fixCommand: provider.installCmd
|
|
165
|
+
};
|
|
166
|
+
}
|
|
167
|
+
}
|
|
168
|
+
if (provider.envKey && provider.requiresApiKey) {
|
|
169
|
+
if (!process.env[provider.envKey]) {
|
|
170
|
+
return {
|
|
171
|
+
name: provider.name,
|
|
172
|
+
status: "warning",
|
|
173
|
+
message: `${provider.envKey} not set`,
|
|
174
|
+
hint: `Set environment variable: export ${provider.envKey}=<your-key>`
|
|
175
|
+
};
|
|
176
|
+
}
|
|
177
|
+
}
|
|
178
|
+
return { name: provider.name, status: "ok" };
|
|
179
|
+
}
|
|
180
|
+
function runAuthChecks(providerId) {
|
|
181
|
+
const checks = [];
|
|
182
|
+
checks.push(checkProviderAuth(providerId));
|
|
183
|
+
if (providerId !== "none") {
|
|
184
|
+
checks.push(checkGhPermissions());
|
|
185
|
+
}
|
|
186
|
+
return checks;
|
|
187
|
+
}
|
|
188
|
+
function displayCheckResults(checks) {
|
|
189
|
+
const errorChecks = [];
|
|
190
|
+
const warningChecks = [];
|
|
191
|
+
for (const check of checks) {
|
|
192
|
+
const icon = getStatusIcon(check.status);
|
|
193
|
+
const statusColor = getStatusColor(check.status);
|
|
194
|
+
if (check.status === "ok") {
|
|
195
|
+
writeLine(` ${icon} ${check.name}`);
|
|
196
|
+
} else {
|
|
197
|
+
const suffix = check.message ? ` ${colors.dim}(${check.message})${RESET}` : "";
|
|
198
|
+
writeLine(` ${icon} ${statusColor}${check.name}${RESET}${suffix}`);
|
|
199
|
+
if (check.hint) {
|
|
200
|
+
writeLine(` ${colors.cyan}\u2192 ${check.hint}${RESET}`);
|
|
201
|
+
}
|
|
202
|
+
if (check.status === "error" || check.status === "missing") {
|
|
203
|
+
errorChecks.push(check);
|
|
204
|
+
} else if (check.status === "warning") {
|
|
205
|
+
warningChecks.push(check);
|
|
206
|
+
}
|
|
207
|
+
}
|
|
208
|
+
}
|
|
209
|
+
return {
|
|
210
|
+
hasErrors: errorChecks.length > 0,
|
|
211
|
+
hasWarnings: warningChecks.length > 0,
|
|
212
|
+
errorChecks,
|
|
213
|
+
warningChecks
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
function getStatusIcon(status) {
|
|
217
|
+
switch (status) {
|
|
218
|
+
case "ok":
|
|
219
|
+
return `${colors.green}${icons.success}${RESET}`;
|
|
220
|
+
case "warning":
|
|
221
|
+
return `${colors.yellow}${icons.warning}${RESET}`;
|
|
222
|
+
case "missing":
|
|
223
|
+
case "error":
|
|
224
|
+
return `${colors.red}${icons.error}${RESET}`;
|
|
225
|
+
}
|
|
226
|
+
}
|
|
227
|
+
function getStatusColor(status) {
|
|
228
|
+
switch (status) {
|
|
229
|
+
case "ok":
|
|
230
|
+
return colors.green;
|
|
231
|
+
case "warning":
|
|
232
|
+
return colors.yellow;
|
|
233
|
+
case "missing":
|
|
234
|
+
case "error":
|
|
235
|
+
return colors.red;
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
|
|
239
|
+
// src/commands/init.ts
|
|
240
|
+
function getUseCaseConfig(useCase) {
|
|
241
|
+
const configs = {
|
|
242
|
+
engineering: {
|
|
243
|
+
label: "Engineering",
|
|
244
|
+
description: "Ships code",
|
|
245
|
+
squads: [getEngineeringSquad()]
|
|
246
|
+
},
|
|
247
|
+
marketing: {
|
|
248
|
+
label: "Marketing",
|
|
249
|
+
description: "Grows audience",
|
|
250
|
+
squads: [getMarketingSquad()]
|
|
251
|
+
},
|
|
252
|
+
operations: {
|
|
253
|
+
label: "Operations",
|
|
254
|
+
description: "Runs the business",
|
|
255
|
+
squads: [getOperationsSquad()]
|
|
256
|
+
},
|
|
257
|
+
"full-company": {
|
|
258
|
+
label: "Full Company",
|
|
259
|
+
description: "Enterprise \u2014 Engineering + Marketing + Operations",
|
|
260
|
+
squads: [getEngineeringSquad(), getMarketingSquad(), getOperationsSquad()]
|
|
261
|
+
},
|
|
262
|
+
custom: {
|
|
263
|
+
label: "Custom",
|
|
264
|
+
description: "Empty scaffold \u2014 you build from scratch",
|
|
265
|
+
squads: []
|
|
266
|
+
}
|
|
267
|
+
};
|
|
268
|
+
return configs[useCase];
|
|
269
|
+
}
|
|
270
|
+
function getProductSquad() {
|
|
271
|
+
return {
|
|
272
|
+
name: "product",
|
|
273
|
+
description: "Roadmap, specs, user feedback synthesis",
|
|
274
|
+
agentCount: 3,
|
|
275
|
+
agentSummary: "lead, scanner, worker",
|
|
276
|
+
dirs: [
|
|
277
|
+
".agents/squads/product",
|
|
278
|
+
".agents/memory/product/lead",
|
|
279
|
+
".agents/memory/product/scanner",
|
|
280
|
+
".agents/memory/product/worker"
|
|
281
|
+
],
|
|
282
|
+
files: [
|
|
283
|
+
[".agents/squads/product/SQUAD.md", "squads/product/SQUAD.md"],
|
|
284
|
+
[".agents/squads/product/lead.md", "squads/product/lead.md"],
|
|
285
|
+
[".agents/squads/product/scanner.md", "squads/product/scanner.md"],
|
|
286
|
+
[".agents/squads/product/worker.md", "squads/product/worker.md"]
|
|
287
|
+
],
|
|
288
|
+
memoryFiles: [
|
|
289
|
+
[".agents/memory/product/lead/state.md", "memory/product/lead/state.md"]
|
|
290
|
+
]
|
|
291
|
+
};
|
|
292
|
+
}
|
|
293
|
+
function getEngineeringSquad() {
|
|
294
|
+
return {
|
|
295
|
+
name: "engineering",
|
|
296
|
+
description: "Solves GitHub issues, reviews code, writes tests",
|
|
297
|
+
agentCount: 3,
|
|
298
|
+
agentSummary: "issue-solver, code-reviewer, test-writer",
|
|
299
|
+
dirs: [
|
|
300
|
+
".agents/squads/engineering",
|
|
301
|
+
".agents/memory/engineering/issue-solver",
|
|
302
|
+
".agents/memory/engineering/code-reviewer",
|
|
303
|
+
".agents/memory/engineering/test-writer"
|
|
304
|
+
],
|
|
305
|
+
files: [
|
|
306
|
+
[".agents/squads/engineering/SQUAD.md", "squads/engineering/SQUAD.md"],
|
|
307
|
+
[".agents/squads/engineering/issue-solver.md", "squads/engineering/issue-solver.md"],
|
|
308
|
+
[".agents/squads/engineering/code-reviewer.md", "squads/engineering/code-reviewer.md"],
|
|
309
|
+
[".agents/squads/engineering/test-writer.md", "squads/engineering/test-writer.md"]
|
|
310
|
+
],
|
|
311
|
+
memoryFiles: [
|
|
312
|
+
[".agents/memory/engineering/issue-solver/state.md", "memory/engineering/issue-solver/state.md"]
|
|
313
|
+
]
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
function getMarketingSquad() {
|
|
317
|
+
return {
|
|
318
|
+
name: "marketing",
|
|
319
|
+
description: "Creates content, grows audience, tracks growth",
|
|
320
|
+
agentCount: 3,
|
|
321
|
+
agentSummary: "content-drafter, social-poster, growth-analyst",
|
|
322
|
+
dirs: [
|
|
323
|
+
".agents/squads/marketing",
|
|
324
|
+
".agents/memory/marketing/content-drafter",
|
|
325
|
+
".agents/memory/marketing/social-poster",
|
|
326
|
+
".agents/memory/marketing/growth-analyst"
|
|
327
|
+
],
|
|
328
|
+
files: [
|
|
329
|
+
[".agents/squads/marketing/SQUAD.md", "squads/marketing/SQUAD.md"],
|
|
330
|
+
[".agents/squads/marketing/content-drafter.md", "squads/marketing/content-drafter.md"],
|
|
331
|
+
[".agents/squads/marketing/social-poster.md", "squads/marketing/social-poster.md"],
|
|
332
|
+
[".agents/squads/marketing/growth-analyst.md", "squads/marketing/growth-analyst.md"]
|
|
333
|
+
],
|
|
334
|
+
memoryFiles: [
|
|
335
|
+
[".agents/memory/marketing/content-drafter/state.md", "memory/marketing/content-drafter/state.md"]
|
|
336
|
+
]
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
function getOperationsSquad() {
|
|
340
|
+
return {
|
|
341
|
+
name: "operations",
|
|
342
|
+
description: "Runs daily ops, tracks finances and goals",
|
|
343
|
+
agentCount: 3,
|
|
344
|
+
agentSummary: "ops-lead, finance-tracker, goal-tracker",
|
|
345
|
+
dirs: [
|
|
346
|
+
".agents/squads/operations",
|
|
347
|
+
".agents/memory/operations/ops-lead",
|
|
348
|
+
".agents/memory/operations/finance-tracker",
|
|
349
|
+
".agents/memory/operations/goal-tracker"
|
|
350
|
+
],
|
|
351
|
+
files: [
|
|
352
|
+
[".agents/squads/operations/SQUAD.md", "squads/operations/SQUAD.md"],
|
|
353
|
+
[".agents/squads/operations/ops-lead.md", "squads/operations/ops-lead.md"],
|
|
354
|
+
[".agents/squads/operations/finance-tracker.md", "squads/operations/finance-tracker.md"],
|
|
355
|
+
[".agents/squads/operations/goal-tracker.md", "squads/operations/goal-tracker.md"]
|
|
356
|
+
],
|
|
357
|
+
memoryFiles: [
|
|
358
|
+
[".agents/memory/operations/ops-lead/state.md", "memory/operations/ops-lead/state.md"]
|
|
359
|
+
]
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
function isInteractive() {
|
|
363
|
+
return process.stdin.isTTY === true && process.stdout.isTTY === true;
|
|
364
|
+
}
|
|
365
|
+
async function prompt(question, defaultValue = "") {
|
|
366
|
+
if (!isInteractive()) return defaultValue;
|
|
367
|
+
const rl = createInterface({
|
|
368
|
+
input: process.stdin,
|
|
369
|
+
output: process.stdout
|
|
370
|
+
});
|
|
371
|
+
return new Promise((resolve) => {
|
|
372
|
+
const suffix = defaultValue ? chalk.dim(` (${defaultValue})`) : "";
|
|
373
|
+
rl.question(` ${question}${suffix} `, (answer) => {
|
|
374
|
+
rl.close();
|
|
375
|
+
resolve(answer.trim() || defaultValue);
|
|
376
|
+
});
|
|
377
|
+
});
|
|
378
|
+
}
|
|
379
|
+
async function promptProvider(forceProvider) {
|
|
380
|
+
if (forceProvider && forceProvider in PROVIDERS) {
|
|
381
|
+
return forceProvider;
|
|
382
|
+
}
|
|
383
|
+
if (!isInteractive()) return "claude";
|
|
384
|
+
writeLine();
|
|
385
|
+
writeLine(chalk.bold(" Select your AI assistant:"));
|
|
386
|
+
writeLine();
|
|
387
|
+
writeLine(` ${chalk.cyan("1)")} Claude Code ${chalk.dim("(recommended)")}`);
|
|
388
|
+
writeLine(` ${chalk.cyan("2)")} Gemini`);
|
|
389
|
+
writeLine(` ${chalk.cyan("3)")} OpenAI GPT`);
|
|
390
|
+
writeLine(` ${chalk.cyan("4)")} Ollama ${chalk.dim("(local)")}`);
|
|
391
|
+
writeLine(` ${chalk.cyan("5)")} Other/None`);
|
|
392
|
+
writeLine();
|
|
393
|
+
const rl = createInterface({
|
|
394
|
+
input: process.stdin,
|
|
395
|
+
output: process.stdout
|
|
396
|
+
});
|
|
397
|
+
return new Promise((resolve) => {
|
|
398
|
+
rl.question(` ${chalk.dim("Enter choice [1-5]:")} `, (answer) => {
|
|
399
|
+
rl.close();
|
|
400
|
+
const choice = answer.trim() || "1";
|
|
401
|
+
switch (choice) {
|
|
402
|
+
case "1":
|
|
403
|
+
resolve("claude");
|
|
404
|
+
break;
|
|
405
|
+
case "2":
|
|
406
|
+
resolve("gemini");
|
|
407
|
+
break;
|
|
408
|
+
case "3":
|
|
409
|
+
resolve("openai");
|
|
410
|
+
break;
|
|
411
|
+
case "4":
|
|
412
|
+
resolve("ollama");
|
|
413
|
+
break;
|
|
414
|
+
case "5":
|
|
415
|
+
resolve("none");
|
|
416
|
+
break;
|
|
417
|
+
default:
|
|
418
|
+
resolve("claude");
|
|
419
|
+
break;
|
|
420
|
+
}
|
|
421
|
+
});
|
|
422
|
+
});
|
|
423
|
+
}
|
|
424
|
+
async function fileExists(filePath) {
|
|
425
|
+
try {
|
|
426
|
+
await fs.access(filePath);
|
|
427
|
+
return true;
|
|
428
|
+
} catch {
|
|
429
|
+
return false;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
function loadSeedTemplate(templatePath, variables = {}) {
|
|
433
|
+
return loadTemplate(`seed/${templatePath}`, variables);
|
|
434
|
+
}
|
|
435
|
+
async function writeIfNew(filePath, content) {
|
|
436
|
+
if (await fileExists(filePath)) return false;
|
|
437
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
438
|
+
await fs.writeFile(filePath, content);
|
|
439
|
+
return true;
|
|
440
|
+
}
|
|
441
|
+
async function writeFile(filePath, content) {
|
|
442
|
+
await fs.mkdir(path.dirname(filePath), { recursive: true });
|
|
443
|
+
await fs.writeFile(filePath, content);
|
|
444
|
+
}
|
|
445
|
+
async function initCommand(options) {
|
|
446
|
+
const cwd = process.cwd();
|
|
447
|
+
writeLine();
|
|
448
|
+
writeLine(chalk.bold(" Plant the seed for your AI workforce"));
|
|
449
|
+
writeLine(chalk.dim(" https://agents-squads.com/docs/getting-started"));
|
|
450
|
+
writeLine();
|
|
451
|
+
const selectedProvider = await promptProvider(options.provider);
|
|
452
|
+
const provider = PROVIDERS[selectedProvider];
|
|
453
|
+
writeLine();
|
|
454
|
+
writeLine(chalk.bold(" Checking prerequisites..."));
|
|
455
|
+
writeLine();
|
|
456
|
+
const checks = [
|
|
457
|
+
...runAuthChecks(selectedProvider),
|
|
458
|
+
checkGhCli()
|
|
459
|
+
];
|
|
460
|
+
const gitStatus = checkGitStatus(cwd);
|
|
461
|
+
if (!gitStatus.isGitRepo) {
|
|
462
|
+
checks.push({
|
|
463
|
+
name: "Git Repository",
|
|
464
|
+
status: "missing",
|
|
465
|
+
message: "Git is the coordination layer",
|
|
466
|
+
hint: "Run: git init",
|
|
467
|
+
fixCommand: "git init"
|
|
468
|
+
});
|
|
469
|
+
} else {
|
|
470
|
+
checks.push({ name: "Git Repository", status: "ok" });
|
|
471
|
+
if (gitStatus.hasRemote) {
|
|
472
|
+
const repoName = getRepoName(gitStatus.remoteUrl);
|
|
473
|
+
checks.push({ name: `Remote: ${repoName || gitStatus.remoteUrl}`, status: "ok" });
|
|
474
|
+
}
|
|
475
|
+
}
|
|
476
|
+
const { hasErrors } = displayCheckResults(checks);
|
|
477
|
+
if (hasErrors && !options.force) {
|
|
478
|
+
writeLine();
|
|
479
|
+
writeLine(chalk.red(" Fix the errors above before continuing."));
|
|
480
|
+
writeLine(chalk.dim(" Or run with --force to skip checks."));
|
|
481
|
+
writeLine();
|
|
482
|
+
process.exit(1);
|
|
483
|
+
}
|
|
484
|
+
writeLine();
|
|
485
|
+
let businessName;
|
|
486
|
+
let businessDescription;
|
|
487
|
+
let businessFocus;
|
|
488
|
+
let businessCompetitors;
|
|
489
|
+
let selectedUseCase;
|
|
490
|
+
if (options.yes || options.quick || !isInteractive()) {
|
|
491
|
+
businessName = path.basename(cwd);
|
|
492
|
+
businessDescription = "A startup building and integrating AI smart capabilities for autonomous execution.";
|
|
493
|
+
businessFocus = "Track the big AI players \u2014 Anthropic, OpenAI, Google, Amazon, Meta, and xAI: latest model releases, API changes, pricing shifts, and strategic moves that affect builders.";
|
|
494
|
+
businessCompetitors = "";
|
|
495
|
+
selectedUseCase = "custom";
|
|
496
|
+
} else {
|
|
497
|
+
const dirName = path.basename(cwd);
|
|
498
|
+
writeLine(chalk.bold(" Tell us about your business:"));
|
|
499
|
+
writeLine(chalk.dim(" (Agents read this to produce useful output \u2014 be specific)"));
|
|
500
|
+
writeLine();
|
|
501
|
+
businessName = await prompt(
|
|
502
|
+
"Company or project name?",
|
|
503
|
+
dirName
|
|
504
|
+
);
|
|
505
|
+
writeLine(chalk.dim(' e.g., "We sell handmade coffee mugs online" or "B2B SaaS for construction teams"'));
|
|
506
|
+
businessDescription = await prompt(
|
|
507
|
+
"What does it do? (one sentence)",
|
|
508
|
+
""
|
|
509
|
+
);
|
|
510
|
+
if (!businessDescription) {
|
|
511
|
+
writeLine(chalk.dim(` Tip: Without a description, agents produce generic output. You can edit .agents/BUSINESS_BRIEF.md later.`));
|
|
512
|
+
businessDescription = `${businessName} \u2014 add your business description to .agents/BUSINESS_BRIEF.md`;
|
|
513
|
+
}
|
|
514
|
+
writeLine();
|
|
515
|
+
writeLine(chalk.dim(' e.g., "Identify our top 3 competitors and what they do better than us"'));
|
|
516
|
+
businessFocus = await prompt(
|
|
517
|
+
"What should your agents research first?",
|
|
518
|
+
"Our market position, top competitors, and biggest growth opportunity"
|
|
519
|
+
);
|
|
520
|
+
writeLine();
|
|
521
|
+
writeLine(chalk.dim(' e.g., "BlueCart, MarketMan" \u2014 leave blank to skip'));
|
|
522
|
+
businessCompetitors = await prompt(
|
|
523
|
+
"Who are your main competitors? (optional)",
|
|
524
|
+
""
|
|
525
|
+
);
|
|
526
|
+
if (!options.pack) {
|
|
527
|
+
writeLine();
|
|
528
|
+
writeLine(chalk.bold(" Add squad packs? (optional)"));
|
|
529
|
+
writeLine();
|
|
530
|
+
writeLine(` ${chalk.cyan("1)")} Core only ${chalk.dim("\u2014 intelligence, research, product, company")} ${chalk.green("(recommended)")}`);
|
|
531
|
+
writeLine(` ${chalk.cyan("2)")} + Engineering ${chalk.dim("\u2014 issue-solver, code-reviewer, test-writer")}`);
|
|
532
|
+
writeLine(` ${chalk.cyan("3)")} + All packs ${chalk.dim("\u2014 engineering, marketing, operations")}`);
|
|
533
|
+
writeLine();
|
|
534
|
+
const rl = createInterface({
|
|
535
|
+
input: process.stdin,
|
|
536
|
+
output: process.stdout
|
|
537
|
+
});
|
|
538
|
+
const packChoice = await new Promise((resolve) => {
|
|
539
|
+
rl.question(` ${chalk.dim("Enter choice [1-3]:")} `, (answer) => {
|
|
540
|
+
rl.close();
|
|
541
|
+
resolve(answer.trim() || "1");
|
|
542
|
+
});
|
|
543
|
+
});
|
|
544
|
+
if (packChoice === "2") {
|
|
545
|
+
options.pack = ["engineering"];
|
|
546
|
+
} else if (packChoice === "3") {
|
|
547
|
+
options.pack = ["all"];
|
|
548
|
+
}
|
|
549
|
+
}
|
|
550
|
+
selectedUseCase = "custom";
|
|
551
|
+
}
|
|
552
|
+
const useCaseConfig = getUseCaseConfig(selectedUseCase);
|
|
553
|
+
if (options.pack && options.pack.length > 0) {
|
|
554
|
+
const additionalSquads = [];
|
|
555
|
+
for (const pack of options.pack) {
|
|
556
|
+
if (pack === "engineering") additionalSquads.push(getEngineeringSquad());
|
|
557
|
+
if (pack === "marketing") additionalSquads.push(getMarketingSquad());
|
|
558
|
+
if (pack === "operations") additionalSquads.push(getOperationsSquad());
|
|
559
|
+
if (pack === "all") {
|
|
560
|
+
additionalSquads.push(getEngineeringSquad(), getMarketingSquad(), getOperationsSquad());
|
|
561
|
+
}
|
|
562
|
+
}
|
|
563
|
+
const existingNames = new Set(useCaseConfig.squads.map((s) => s.name));
|
|
564
|
+
for (const squad of additionalSquads) {
|
|
565
|
+
if (!existingNames.has(squad.name)) {
|
|
566
|
+
useCaseConfig.squads.push(squad);
|
|
567
|
+
existingNames.add(squad.name);
|
|
568
|
+
}
|
|
569
|
+
}
|
|
570
|
+
}
|
|
571
|
+
const coreAgentCount = 14;
|
|
572
|
+
const coreSquadCount = 4;
|
|
573
|
+
const useCaseAgentCount = useCaseConfig.squads.reduce((sum, s) => sum + s.agentCount, 0);
|
|
574
|
+
const totalAgentCount = coreAgentCount + useCaseAgentCount;
|
|
575
|
+
const totalSquadCount = coreSquadCount + useCaseConfig.squads.length;
|
|
576
|
+
writeLine();
|
|
577
|
+
writeLine(` ${chalk.green("\u2713")} Business: ${chalk.cyan(businessName)}${businessDescription ? chalk.dim(` \u2014 ${businessDescription}`) : ""}`);
|
|
578
|
+
writeLine(` ${chalk.green("\u2713")} Provider: ${chalk.cyan(provider?.name || selectedProvider)}`);
|
|
579
|
+
writeLine(` ${chalk.green("\u2713")} Research focus: ${chalk.cyan(businessFocus)}`);
|
|
580
|
+
if (businessCompetitors) {
|
|
581
|
+
writeLine(` ${chalk.green("\u2713")} Competitors: ${chalk.cyan(businessCompetitors)}`);
|
|
582
|
+
}
|
|
583
|
+
if (options.pack && options.pack.length > 0) {
|
|
584
|
+
writeLine(` ${chalk.green("\u2713")} Packs: ${chalk.cyan(options.pack.join(", "))}`);
|
|
585
|
+
}
|
|
586
|
+
writeLine();
|
|
587
|
+
const spinner = ora("Planting the seed...").start();
|
|
588
|
+
try {
|
|
589
|
+
const isPlaceholder = businessDescription.includes("add your business description");
|
|
590
|
+
const variables = {
|
|
591
|
+
BUSINESS_NAME: businessName,
|
|
592
|
+
BUSINESS_DESCRIPTION: businessDescription || `${businessName} \u2014 details to be added by the manager agent.`,
|
|
593
|
+
BUSINESS_FOCUS: businessFocus,
|
|
594
|
+
COMPETITORS_SECTION: businessCompetitors ? `## Competitors
|
|
595
|
+
|
|
596
|
+
${businessCompetitors}
|
|
597
|
+
|
|
598
|
+
` : "",
|
|
599
|
+
PLACEHOLDER_SENTINEL: isPlaceholder ? '<!-- STATUS: PLACEHOLDER \u2014 Edit this file before running agents. -->\n<!-- Agents that read "PLACEHOLDER" in this comment will ask you to fill it in. -->\n\n' : "",
|
|
600
|
+
PROVIDER: selectedProvider,
|
|
601
|
+
PROVIDER_NAME: provider?.name || "Unknown"
|
|
602
|
+
};
|
|
603
|
+
const dirs = [
|
|
604
|
+
".agents/squads/company",
|
|
605
|
+
".agents/squads/research",
|
|
606
|
+
".agents/squads/intelligence",
|
|
607
|
+
".agents/squads/product",
|
|
608
|
+
".agents/memory/company/manager",
|
|
609
|
+
".agents/memory/company/event-dispatcher",
|
|
610
|
+
".agents/memory/company/goal-tracker",
|
|
611
|
+
".agents/memory/company/company-eval",
|
|
612
|
+
".agents/memory/company/company-critic",
|
|
613
|
+
".agents/memory/research/lead",
|
|
614
|
+
".agents/memory/research/analyst",
|
|
615
|
+
".agents/memory/research/synthesizer",
|
|
616
|
+
".agents/memory/intelligence/intel-lead",
|
|
617
|
+
".agents/memory/intelligence/intel-eval",
|
|
618
|
+
".agents/memory/intelligence/intel-critic",
|
|
619
|
+
".agents/memory/product/lead",
|
|
620
|
+
".agents/skills/squads-cli",
|
|
621
|
+
".agents/skills/gh",
|
|
622
|
+
".agents/config"
|
|
623
|
+
];
|
|
624
|
+
for (const squad of useCaseConfig.squads) {
|
|
625
|
+
dirs.push(...squad.dirs);
|
|
626
|
+
}
|
|
627
|
+
if (selectedProvider === "claude") {
|
|
628
|
+
dirs.push(".claude");
|
|
629
|
+
}
|
|
630
|
+
for (const dir of dirs) {
|
|
631
|
+
await fs.mkdir(path.join(cwd, dir), { recursive: true });
|
|
632
|
+
}
|
|
633
|
+
spinner.text = "Creating squad definitions...";
|
|
634
|
+
const companyFiles = [
|
|
635
|
+
[".agents/squads/company/SQUAD.md", "squads/company/SQUAD.md"],
|
|
636
|
+
[".agents/squads/company/manager.md", "squads/company/manager.md"],
|
|
637
|
+
[".agents/squads/company/event-dispatcher.md", "squads/company/event-dispatcher.md"],
|
|
638
|
+
[".agents/squads/company/goal-tracker.md", "squads/company/goal-tracker.md"],
|
|
639
|
+
[".agents/squads/company/company-eval.md", "squads/company/company-eval.md"],
|
|
640
|
+
[".agents/squads/company/company-critic.md", "squads/company/company-critic.md"]
|
|
641
|
+
];
|
|
642
|
+
const researchFiles = [
|
|
643
|
+
[".agents/squads/research/SQUAD.md", "squads/research/SQUAD.md"],
|
|
644
|
+
[".agents/squads/research/lead.md", "squads/research/lead.md"],
|
|
645
|
+
[".agents/squads/research/analyst.md", "squads/research/analyst.md"],
|
|
646
|
+
[".agents/squads/research/synthesizer.md", "squads/research/synthesizer.md"]
|
|
647
|
+
];
|
|
648
|
+
const intelligenceFiles = [
|
|
649
|
+
[".agents/squads/intelligence/SQUAD.md", "squads/intelligence/SQUAD.md"],
|
|
650
|
+
[".agents/squads/intelligence/intel-lead.md", "squads/intelligence/intel-lead.md"],
|
|
651
|
+
[".agents/squads/intelligence/intel-eval.md", "squads/intelligence/intel-eval.md"],
|
|
652
|
+
[".agents/squads/intelligence/intel-critic.md", "squads/intelligence/intel-critic.md"]
|
|
653
|
+
];
|
|
654
|
+
const productFiles = getProductSquad().files;
|
|
655
|
+
const useCaseFiles = [];
|
|
656
|
+
for (const squad of useCaseConfig.squads) {
|
|
657
|
+
useCaseFiles.push(...squad.files);
|
|
658
|
+
}
|
|
659
|
+
for (const [dest, template] of [...companyFiles, ...researchFiles, ...intelligenceFiles, ...productFiles, ...useCaseFiles]) {
|
|
660
|
+
const content = loadSeedTemplate(template, variables);
|
|
661
|
+
await writeFile(path.join(cwd, dest), content);
|
|
662
|
+
}
|
|
663
|
+
spinner.text = "Creating memory and config...";
|
|
664
|
+
const coreMemoryFiles = [
|
|
665
|
+
[".agents/memory/company/manager/state.md", "memory/company/manager/state.md"],
|
|
666
|
+
[".agents/memory/research/lead/state.md", "memory/research/lead/state.md"],
|
|
667
|
+
[".agents/memory/intelligence/intel-lead/state.md", "memory/intelligence/intel-lead/state.md"],
|
|
668
|
+
[".agents/memory/product/lead/state.md", "memory/product/lead/state.md"]
|
|
669
|
+
];
|
|
670
|
+
const useCaseMemoryFiles = [];
|
|
671
|
+
for (const squad of useCaseConfig.squads) {
|
|
672
|
+
useCaseMemoryFiles.push(...squad.memoryFiles);
|
|
673
|
+
}
|
|
674
|
+
for (const [dest, template] of [...coreMemoryFiles, ...useCaseMemoryFiles]) {
|
|
675
|
+
await writeIfNew(path.join(cwd, dest), loadSeedTemplate(template, variables));
|
|
676
|
+
}
|
|
677
|
+
const skillContent = loadSeedTemplate("skills/squads-cli/SKILL.md", variables);
|
|
678
|
+
await writeFile(path.join(cwd, ".agents/skills/squads-cli/SKILL.md"), skillContent);
|
|
679
|
+
const ghSkillContent = loadSeedTemplate("skills/gh/SKILL.md", variables);
|
|
680
|
+
await writeFile(path.join(cwd, ".agents/skills/gh/SKILL.md"), ghSkillContent);
|
|
681
|
+
const providerConfig = loadSeedTemplate("config/provider.yaml", variables);
|
|
682
|
+
await writeFile(path.join(cwd, ".agents/config/provider.yaml"), providerConfig);
|
|
683
|
+
const systemMd = loadSeedTemplate("config/SYSTEM.md", variables);
|
|
684
|
+
await writeFile(path.join(cwd, ".agents/config/SYSTEM.md"), systemMd);
|
|
685
|
+
const directivesMd = loadSeedTemplate("memory/company/directives.md", variables);
|
|
686
|
+
await writeIfNew(path.join(cwd, ".agents/memory/company/directives.md"), directivesMd);
|
|
687
|
+
const businessBrief = loadSeedTemplate("BUSINESS_BRIEF.md.template", variables);
|
|
688
|
+
await writeFile(path.join(cwd, ".agents/BUSINESS_BRIEF.md"), businessBrief);
|
|
689
|
+
const agentsMd = loadTemplate("core/AGENTS.md.template", variables);
|
|
690
|
+
await writeIfNew(path.join(cwd, "AGENTS.md"), agentsMd);
|
|
691
|
+
const readmePath = path.join(cwd, "README.md");
|
|
692
|
+
let existingReadme = "";
|
|
693
|
+
try {
|
|
694
|
+
existingReadme = await fs.readFile(readmePath, "utf-8");
|
|
695
|
+
} catch {
|
|
696
|
+
}
|
|
697
|
+
const isStub = existingReadme.trim() === "" || /^# [^\n]+\s*$/.test(existingReadme.trim());
|
|
698
|
+
if (isStub) {
|
|
699
|
+
const readmeContent = loadSeedTemplate("README.md.template", variables);
|
|
700
|
+
await writeFile(readmePath, readmeContent);
|
|
701
|
+
}
|
|
702
|
+
spinner.text = "Setting up operating manual...";
|
|
703
|
+
if (selectedProvider === "claude") {
|
|
704
|
+
const claudeMd = loadSeedTemplate("CLAUDE.md.template", variables);
|
|
705
|
+
await writeIfNew(path.join(cwd, "CLAUDE.md"), claudeMd);
|
|
706
|
+
const hooksContent = loadSeedTemplate("hooks/settings.json.template", variables);
|
|
707
|
+
await writeIfNew(path.join(cwd, ".claude/settings.json"), hooksContent);
|
|
708
|
+
}
|
|
709
|
+
spinner.succeed("Seed planted");
|
|
710
|
+
await track(Events.CLI_INIT, {
|
|
711
|
+
success: true,
|
|
712
|
+
hasGit: gitStatus.isGitRepo,
|
|
713
|
+
hasRemote: gitStatus.hasRemote,
|
|
714
|
+
provider: selectedProvider,
|
|
715
|
+
useCase: selectedUseCase,
|
|
716
|
+
agentCount: totalAgentCount,
|
|
717
|
+
squadCount: totalSquadCount,
|
|
718
|
+
hasBusinessName: businessName !== path.basename(cwd),
|
|
719
|
+
hasBusinessDescription: businessDescription.length > 0
|
|
720
|
+
});
|
|
721
|
+
} catch (error) {
|
|
722
|
+
spinner.fail("Failed to plant the seed");
|
|
723
|
+
const err = error;
|
|
724
|
+
if (err?.code === "EACCES" || err?.code === "EPERM") {
|
|
725
|
+
writeLine(chalk.red(" Permission denied \u2014 cannot write to this directory."));
|
|
726
|
+
writeLine(chalk.dim(" Try running in a directory you own, or check folder permissions."));
|
|
727
|
+
} else if (err?.code === "ENOENT") {
|
|
728
|
+
writeLine(chalk.red(` Could not find or create: ${err.path || "unknown path"}`));
|
|
729
|
+
writeLine(chalk.dim(" Check that the directory exists and you have write access."));
|
|
730
|
+
} else {
|
|
731
|
+
const msg = error instanceof Error ? error.message : String(error);
|
|
732
|
+
writeLine(chalk.red(` ${msg}`));
|
|
733
|
+
writeLine(chalk.dim(" Run with --verbose for more details, or check squads doctor."));
|
|
734
|
+
}
|
|
735
|
+
process.exit(1);
|
|
736
|
+
}
|
|
737
|
+
try {
|
|
738
|
+
execSync2('git add -A && git commit -q -m "feat: init AI workforce\n\nCo-Authored-By: Claude <noreply@anthropic.com>"', {
|
|
739
|
+
cwd,
|
|
740
|
+
stdio: "ignore"
|
|
741
|
+
});
|
|
742
|
+
} catch {
|
|
743
|
+
}
|
|
744
|
+
writeLine();
|
|
745
|
+
writeLine(chalk.green.bold(` ${businessName}'s AI workforce is ready.`));
|
|
746
|
+
writeLine();
|
|
747
|
+
writeLine(chalk.dim(" Created:"));
|
|
748
|
+
writeLine(chalk.dim(" \u2022 research/ 3 agents \u2014 Researches your market, competitors, and opportunities"));
|
|
749
|
+
writeLine(chalk.dim(" \u2022 company/ 5 agents \u2014 Manages goals, events, and strategy"));
|
|
750
|
+
writeLine(chalk.dim(" \u2022 intelligence/ 3 agents \u2014 Monitors trends and competitive signals"));
|
|
751
|
+
writeLine(chalk.dim(" \u2022 product/ 3 agents \u2014 Roadmap, specs, user feedback synthesis"));
|
|
752
|
+
for (const squad of useCaseConfig.squads) {
|
|
753
|
+
const namePad = " ".repeat(Math.max(0, 14 - squad.name.length));
|
|
754
|
+
writeLine(chalk.dim(` \u2022 ${squad.name}/${namePad}${squad.agentCount} agents \u2014 ${squad.description}`));
|
|
755
|
+
}
|
|
756
|
+
writeLine(chalk.dim(" \u2022 .agents/skills/ CLI + GitHub workflow skills"));
|
|
757
|
+
writeLine(chalk.dim(" \u2022 .agents/memory/ Persistent state"));
|
|
758
|
+
writeLine(chalk.dim(" \u2022 .agents/BUSINESS_BRIEF.md"));
|
|
759
|
+
writeLine(chalk.dim(" \u2022 AGENTS.md Agent instructions (vendor-neutral)"));
|
|
760
|
+
if (selectedProvider === "claude") {
|
|
761
|
+
writeLine(chalk.dim(" \u2022 CLAUDE.md Operating manual"));
|
|
762
|
+
writeLine(chalk.dim(" \u2022 .claude/settings.json Session hooks"));
|
|
763
|
+
}
|
|
764
|
+
writeLine();
|
|
765
|
+
writeLine(chalk.bold(" Getting started:"));
|
|
766
|
+
writeLine();
|
|
767
|
+
writeLine(` ${chalk.cyan("1.")} ${chalk.yellow("$EDITOR .agents/BUSINESS_BRIEF.md")}`);
|
|
768
|
+
writeLine(chalk.dim(" Set your business context \u2014 agents use this for every run"));
|
|
769
|
+
writeLine();
|
|
770
|
+
const firstRunCommand = getFirstRunCommand(selectedUseCase);
|
|
771
|
+
const squadCommand = firstRunCommand.command.replace(/\/[^/]+$/, "");
|
|
772
|
+
writeLine(` ${chalk.cyan("2.")} ${chalk.yellow(firstRunCommand.command)}`);
|
|
773
|
+
writeLine(chalk.dim(` ${firstRunCommand.description}`));
|
|
774
|
+
writeLine(chalk.dim(` Full squad (4+ agents, longer): ${squadCommand}`));
|
|
775
|
+
writeLine();
|
|
776
|
+
writeLine(` ${chalk.cyan("3.")} ${chalk.yellow(`squads run`)}`);
|
|
777
|
+
writeLine(chalk.dim(" Autopilot \u2014 runs all squads on schedule, learns between cycles"));
|
|
778
|
+
writeLine(chalk.dim(` Options: squads run --once (single cycle), squads run -i 15 --budget 50`));
|
|
779
|
+
writeLine();
|
|
780
|
+
writeLine(chalk.dim(" Docs: https://agents-squads.com/docs/getting-started"));
|
|
781
|
+
writeLine();
|
|
782
|
+
}
|
|
783
|
+
function getFirstRunCommand(useCase) {
|
|
784
|
+
switch (useCase) {
|
|
785
|
+
case "engineering":
|
|
786
|
+
return {
|
|
787
|
+
command: "squads run engineering/issue-solver",
|
|
788
|
+
description: "Run a single agent \u2014 finds and solves GitHub issues (~2 min)"
|
|
789
|
+
};
|
|
790
|
+
case "marketing":
|
|
791
|
+
return {
|
|
792
|
+
command: "squads run marketing/content-drafter",
|
|
793
|
+
description: "Run a single agent \u2014 drafts content for your business (~2 min)"
|
|
794
|
+
};
|
|
795
|
+
case "operations":
|
|
796
|
+
return {
|
|
797
|
+
command: "squads run operations/ops-lead",
|
|
798
|
+
description: "Run a single agent \u2014 coordinates daily operations (~2 min)"
|
|
799
|
+
};
|
|
800
|
+
case "full-company":
|
|
801
|
+
case "custom":
|
|
802
|
+
default:
|
|
803
|
+
return {
|
|
804
|
+
command: "squads run research/lead",
|
|
805
|
+
description: "Run a single agent \u2014 researches the topic you set (~2 min)"
|
|
806
|
+
};
|
|
807
|
+
}
|
|
808
|
+
}
|
|
809
|
+
export {
|
|
810
|
+
initCommand
|
|
811
|
+
};
|
|
812
|
+
//# sourceMappingURL=init-XQZ7BOGT.js.map
|