@businesskit/agent 1.0.3 → 1.0.5

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.
Files changed (130) hide show
  1. package/.claude-plugin/plugin.json +1 -1
  2. package/.cursor-plugin/plugin.json +25 -0
  3. package/.cursorrules +10 -0
  4. package/.superconsole-plugin/plugin.json +32 -0
  5. package/AGENTS.md +94 -63
  6. package/CLAUDE.md +11 -65
  7. package/GEMINI.md +11 -34
  8. package/README.md +106 -153
  9. package/assets/logo.svg +3 -0
  10. package/bin/businesskit.js +11 -17
  11. package/commands/add-contact.md +47 -0
  12. package/commands/add-inventory-from-invoice.md +80 -0
  13. package/commands/adjust-stock.md +46 -0
  14. package/commands/capabilities.md +33 -0
  15. package/commands/check-stock.md +43 -0
  16. package/commands/create-component.md +109 -0
  17. package/commands/create-invoice.md +69 -0
  18. package/commands/create-new-bill.md +65 -0
  19. package/commands/create-page.md +96 -0
  20. package/commands/list-components.md +41 -0
  21. package/commands/list-content.md +46 -0
  22. package/commands/list-pages.md +45 -0
  23. package/commands/publish-page.md +64 -0
  24. package/commands/send-invoice.md +42 -0
  25. package/commands/seo-audit.md +36 -0
  26. package/commands/update-contact.md +46 -0
  27. package/commands/update-content.md +47 -0
  28. package/commands/update-page.md +55 -0
  29. package/commands/update-price.md +47 -0
  30. package/commands/write-blog.md +52 -0
  31. package/commands/write-docs.md +84 -0
  32. package/commands/write-guide.md +46 -0
  33. package/commands/write-newsletter.md +46 -0
  34. package/mcp_config.json +8 -0
  35. package/package.json +34 -23
  36. package/plugin.json +32 -0
  37. package/scripts/generate-schema.ts +244 -0
  38. package/scripts/setup.sh +134 -0
  39. package/scripts/setup.ts +92 -0
  40. package/server.json +21 -0
  41. package/skills/README.md +19 -27
  42. package/skills/billing/SKILL.md +64 -0
  43. package/skills/brand/SKILL.md +30 -86
  44. package/skills/copywriting/SKILL.md +1 -1
  45. package/skills/crm/SKILL.md +38 -0
  46. package/skills/docs-cms/SKILL.md +53 -0
  47. package/skills/docs-cms/references/how-to.md +383 -0
  48. package/skills/inbox/SKILL.md +49 -0
  49. package/skills/inventory/SKILL.md +69 -0
  50. package/skills/pages/SKILL.md +169 -0
  51. package/skills/pages/references/sections-catalog.json +950 -0
  52. package/skills/social/SKILL.md +1 -1
  53. package/templates/antigravity.json +8 -0
  54. package/templates/claude-code.mcp.json +8 -0
  55. package/templates/cursor.mcp.json +8 -0
  56. package/templates/vscode.mcp.json +9 -0
  57. package/.claude/commands/analytics.md +0 -7
  58. package/.claude/commands/blog-writer.md +0 -9
  59. package/.claude/commands/cbo.md +0 -7
  60. package/.claude/commands/ceo.md +0 -10
  61. package/.claude/commands/cmo.md +0 -7
  62. package/.claude/commands/compress.md +0 -73
  63. package/.claude/commands/coo.md +0 -11
  64. package/.claude/commands/copywriter.md +0 -15
  65. package/.claude/commands/course-creator.md +0 -9
  66. package/.claude/commands/crm.md +0 -591
  67. package/.claude/commands/deep.md +0 -50
  68. package/.claude/commands/docs-writer.md +0 -8
  69. package/.claude/commands/forms-builder.md +0 -10
  70. package/.claude/commands/jobs-manager.md +0 -8
  71. package/.claude/commands/kb.md +0 -107
  72. package/.claude/commands/newsletter-writer.md +0 -9
  73. package/.claude/commands/preserve.md +0 -64
  74. package/.claude/commands/resume.md +0 -67
  75. package/.claude/commands/scheduler.md +0 -8
  76. package/.claude/commands/seo.md +0 -60
  77. package/.claude/commands/social.md +0 -51
  78. package/.claude/commands/store-manager.md +0 -11
  79. package/.env.example +0 -2
  80. package/.mcp.json +0 -3
  81. package/ABOUT-ME.md +0 -96
  82. package/HEARTBEAT.md +0 -105
  83. package/PLAN.md +0 -384
  84. package/PRD-Agent-Composition.md +0 -149
  85. package/PRD-Agent-Harness.md +0 -316
  86. package/REFERENCE.md +0 -124
  87. package/SOUL.md +0 -148
  88. package/SYSTEM.md +0 -71
  89. package/agents/_base.ts +0 -63
  90. package/agents/creators/blog-writer.ts +0 -347
  91. package/agents/creators/copywriter.ts +0 -89
  92. package/agents/creators/course-creator.ts +0 -106
  93. package/agents/creators/crm-agent.ts +0 -479
  94. package/agents/creators/docs-writer.ts +0 -77
  95. package/agents/creators/forms-builder.ts +0 -90
  96. package/agents/creators/jobs-manager.ts +0 -82
  97. package/agents/creators/newsletter-writer.ts +0 -91
  98. package/agents/creators/store-manager.ts +0 -138
  99. package/agents/csuite/cbo.ts +0 -109
  100. package/agents/csuite/ceo.ts +0 -121
  101. package/agents/csuite/cmo.ts +0 -109
  102. package/agents/csuite/coo.ts +0 -115
  103. package/agents/growth/analytics-agent.ts +0 -52
  104. package/agents/growth/scheduler.ts +0 -68
  105. package/agents/growth/seo-agent.ts +0 -282
  106. package/agents/growth/social-agent.ts +0 -346
  107. package/brand-voice.md +0 -127
  108. package/cli.ts +0 -125
  109. package/context/brand.md +0 -80
  110. package/context/business.md +0 -66
  111. package/ingest.md +0 -110
  112. package/lib/analytics.ts +0 -81
  113. package/lib/db.adapter.ts +0 -30
  114. package/lib/db.ts +0 -16
  115. package/lib/id.ts +0 -15
  116. package/lib/kb.ts +0 -337
  117. package/lib/memory.ts +0 -219
  118. package/lib/pattern-detector.ts +0 -169
  119. package/lib/profile.ts +0 -119
  120. package/lib/slug.ts +0 -30
  121. package/setup.ts +0 -127
  122. package/skills/agents/SKILL.md +0 -56
  123. package/skills/analytics/SKILL.md +0 -52
  124. package/skills/blog-writer/SKILL.md +0 -452
  125. package/skills/ceo/SKILL.md +0 -25
  126. package/skills/cmo/SKILL.md +0 -8
  127. package/skills/schema/SKILL.md +0 -45
  128. package/skills/store/SKILL.md +0 -62
  129. package/tsconfig.json +0 -13
  130. package/working-style.md +0 -87
@@ -0,0 +1,244 @@
1
+ #!/usr/bin/env tsx
2
+ /**
3
+ * scripts/generate-schema.ts
4
+ *
5
+ * Parses `businesskit-files/*.ts` → emits `lib/schema.ts`.
6
+ *
7
+ * What it does:
8
+ * 1. Finds every `CREATE TABLE IF NOT EXISTS <name> ( ... )` in the schema files
9
+ * 2. Parses columns: name, SQL type, NOT NULL, DEFAULT
10
+ * 3. Detects enum values from the nearest `-- 'a'|'b'|'c'`-style comment
11
+ * on the same line or the next line
12
+ * 4. Emits one `export interface <PascalName>` per table + a `TABLES` const
13
+ *
14
+ * Run:
15
+ * npx tsx scripts/generate-schema.ts
16
+ *
17
+ * The output is intentionally conservative — when in doubt, the column type
18
+ * widens to `string | null`. Never hand-edit lib/schema.ts; regenerate.
19
+ */
20
+
21
+ import { readFileSync, writeFileSync, readdirSync } from 'node:fs'
22
+ import { join, dirname } from 'node:path'
23
+ import { fileURLToPath } from 'node:url'
24
+
25
+ const __dirname = dirname(fileURLToPath(import.meta.url))
26
+ const REPO = join(__dirname, '..')
27
+ const SRC_DIR = join(REPO, 'businesskit-files')
28
+ const OUT = join(REPO, 'lib', 'schema.ts')
29
+
30
+ // ── Types ────────────────────────────────────────────────────────────────────
31
+
32
+ interface Column {
33
+ name: string
34
+ sqlType: string
35
+ notNull: boolean
36
+ hasDefault: boolean
37
+ enumValues: string[] // parsed from -- 'a'|'b'|'c' comments
38
+ }
39
+
40
+ interface Table {
41
+ name: string
42
+ columns: Column[]
43
+ sourceFile: string
44
+ }
45
+
46
+ // ── Parser ───────────────────────────────────────────────────────────────────
47
+
48
+ function extractCreateTables(source: string, sourceFile: string): Table[] {
49
+ const tables: Table[] = []
50
+ // CREATE TABLE IF NOT EXISTS name ( ... ) — match everything up to the closing
51
+ // paren that's followed by `,` or backtick (the template-string end).
52
+ const re = /CREATE TABLE IF NOT EXISTS\s+(\w+)\s*\(([\s\S]*?)\n\s*\)/g
53
+
54
+ let m: RegExpExecArray | null
55
+ while ((m = re.exec(source)) !== null) {
56
+ const name = m[1]
57
+ const body = m[2]
58
+ tables.push({ name, columns: parseColumns(body), sourceFile })
59
+ }
60
+ return tables
61
+ }
62
+
63
+ function parseColumns(body: string): Column[] {
64
+ // Split on commas at depth 0 (SQLite col defs don't nest parens much,
65
+ // but constraints like CHECK(...) might; fold them conservatively).
66
+ const lines = splitTopLevelCommas(body)
67
+ const cols: Column[] = []
68
+ let pendingEnum: string[] = []
69
+
70
+ for (let raw of lines) {
71
+ raw = raw.trim()
72
+ if (!raw) continue
73
+
74
+ // Detect comment-only lines — they're enum hints for the PREVIOUS column
75
+ const commentOnly = raw.match(/^--\s*(.+)/)
76
+ if (commentOnly) {
77
+ const hinted = parseEnumComment(commentOnly[1])
78
+ if (hinted.length && cols.length) {
79
+ const last = cols[cols.length - 1]
80
+ if (!last.enumValues.length) last.enumValues = hinted
81
+ }
82
+ continue
83
+ }
84
+
85
+ // Skip table-level constraints (PRIMARY KEY (...), UNIQUE(...), FOREIGN KEY)
86
+ const upper = raw.toUpperCase()
87
+ if (/^(PRIMARY KEY|UNIQUE|FOREIGN KEY|CHECK|CONSTRAINT)\s*[(\s]/.test(upper)) continue
88
+
89
+ const col = parseColumnLine(raw)
90
+ if (!col) continue
91
+
92
+ // Same-line comment → enum values
93
+ if (pendingEnum.length) {
94
+ col.enumValues = pendingEnum
95
+ pendingEnum = []
96
+ }
97
+ const inline = raw.match(/--\s*(.+)$/)
98
+ if (inline) {
99
+ const vals = parseEnumComment(inline[1])
100
+ if (vals.length) col.enumValues = vals
101
+ }
102
+
103
+ cols.push(col)
104
+ }
105
+ return cols
106
+ }
107
+
108
+ function parseColumnLine(line: string): Column | null {
109
+ // strip trailing comma and inline comment for type parsing
110
+ const codeOnly = line.replace(/--.*$/, '').trim().replace(/,$/, '').trim()
111
+ if (!codeOnly) return null
112
+
113
+ // name [type] [constraints]
114
+ const parts = codeOnly.split(/\s+/)
115
+ if (parts.length < 2) return null
116
+ const name = parts[0]
117
+ if (!/^\w+$/.test(name)) return null
118
+
119
+ const rest = parts.slice(1).join(' ')
120
+ const sqlType = (rest.match(/^(TEXT|INTEGER|REAL|BLOB|NUMERIC)/i)?.[1] ?? 'TEXT').toUpperCase()
121
+ const notNull = /\bNOT NULL\b/i.test(rest)
122
+ const hasDefault = /\bDEFAULT\b/i.test(rest)
123
+
124
+ return { name, sqlType, notNull, hasDefault, enumValues: [] }
125
+ }
126
+
127
+ function parseEnumComment(text: string): string[] {
128
+ // Matches 'a'|'b'|'c' (with anything around it)
129
+ const matches = [...text.matchAll(/'([a-z0-9_-]+)'(?:\s*\|\s*'([a-z0-9_-]+)')+/gi)]
130
+ for (const m of matches) {
131
+ const raw = m[0]
132
+ const vals = [...raw.matchAll(/'([a-z0-9_-]+)'/gi)].map(x => x[1])
133
+ if (vals.length >= 2) return vals
134
+ }
135
+ return []
136
+ }
137
+
138
+ function splitTopLevelCommas(body: string): string[] {
139
+ const out: string[] = []
140
+ let buf = ''
141
+ let depth = 0
142
+ let inString = false
143
+ for (const ch of body) {
144
+ if (ch === "'" ) inString = !inString
145
+ if (!inString) {
146
+ if (ch === '(') depth++
147
+ else if (ch === ')') depth--
148
+ else if (ch === ',' && depth === 0) { out.push(buf); buf = ''; continue }
149
+ }
150
+ buf += ch
151
+ }
152
+ if (buf.trim()) out.push(buf)
153
+ return out
154
+ }
155
+
156
+ // ── Emitter ──────────────────────────────────────────────────────────────────
157
+
158
+ function sqlToTs(col: Column): string {
159
+ // Enum literal union takes priority over SQL type
160
+ if (col.enumValues.length) {
161
+ const union = col.enumValues.map(v => `'${v}'`).join(' | ')
162
+ return col.notNull || col.hasDefault ? union : `${union} | null`
163
+ }
164
+
165
+ let base: string
166
+ switch (col.sqlType) {
167
+ case 'INTEGER': base = 'number'; break
168
+ case 'REAL': base = 'number'; break
169
+ case 'TEXT': base = 'string'; break
170
+ case 'BLOB': base = 'Uint8Array'; break
171
+ case 'NUMERIC': base = 'number'; break
172
+ default: base = 'string'
173
+ }
174
+ // NOT NULL or has DEFAULT → reads are always defined
175
+ return col.notNull || col.hasDefault ? base : `${base} | null`
176
+ }
177
+
178
+ function pascalCase(snake: string): string {
179
+ return snake.split('_').map(p => p ? p[0].toUpperCase() + p.slice(1) : '').join('')
180
+ }
181
+
182
+ function emit(tables: Table[]): string {
183
+ const header = `// lib/schema.ts
184
+ // AUTO-GENERATED by scripts/generate-schema.ts — DO NOT EDIT.
185
+ // Source: businesskit-files/*.ts (copies of app-side schema).
186
+ // Regenerate: npm run schema:gen
187
+ //
188
+ // What this gives you:
189
+ // - One \`interface <PascalTable>\` per UserDB table
190
+ // - Enum literal unions for columns with \`-- 'a'|'b'|'c'\` comment hints
191
+ // - \`TABLES\` const for typo-safe table references
192
+ //
193
+ // Rows returned by libSQL's Client are \`Record<string, Value>\` — cast via
194
+ // \`as unknown as <Interface>\` at the call site after SELECT.
195
+ `
196
+
197
+ const groups = new Map<string, Table[]>()
198
+ for (const t of tables) {
199
+ const key = t.sourceFile
200
+ if (!groups.has(key)) groups.set(key, [])
201
+ groups.get(key)!.push(t)
202
+ }
203
+
204
+ const body = [...groups.entries()]
205
+ .map(([file, ts]) => {
206
+ const interfaces = ts.map(t => {
207
+ const fields = t.columns
208
+ .map(c => ` ${c.name}: ${sqlToTs(c)}`)
209
+ .join('\n')
210
+ return `export interface ${pascalCase(t.name)} {\n${fields}\n}`
211
+ }).join('\n\n')
212
+ return `// ── ${file} ${'─'.repeat(Math.max(0, 60 - file.length))}\n\n${interfaces}`
213
+ })
214
+ .join('\n\n')
215
+
216
+ const tableNames = tables.map(t => ` ${t.name}: '${t.name}' as const,`).join('\n')
217
+ const constBlock = `\nexport const TABLES = {\n${tableNames}\n}\n\nexport type TableName = keyof typeof TABLES\n`
218
+
219
+ return `${header}\n${body}\n${constBlock}`
220
+ }
221
+
222
+ // ── Main ─────────────────────────────────────────────────────────────────────
223
+
224
+ function main() {
225
+ const files = readdirSync(SRC_DIR).filter(f => f.endsWith('.ts') && !f.endsWith('.md')).sort()
226
+ if (!files.length) {
227
+ console.error(`No schema files found in ${SRC_DIR}`)
228
+ process.exit(1)
229
+ }
230
+
231
+ const all: Table[] = []
232
+ for (const f of files) {
233
+ const src = readFileSync(join(SRC_DIR, f), 'utf8')
234
+ const tables = extractCreateTables(src, f)
235
+ all.push(...tables)
236
+ console.log(` ${f}: ${tables.length} tables`)
237
+ }
238
+
239
+ const out = emit(all)
240
+ writeFileSync(OUT, out, 'utf8')
241
+ console.log(`\nWrote ${OUT} — ${all.length} tables, ${all.reduce((a, t) => a + t.columns.length, 0)} columns.`)
242
+ }
243
+
244
+ main()
@@ -0,0 +1,134 @@
1
+ #!/usr/bin/env bash
2
+ # scripts/setup.sh — Auto-configure BusinessKit MCP for any agentic CLI/IDE
3
+
4
+ set -e
5
+
6
+ SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
7
+ ROOT_DIR="$(cd "${SCRIPT_DIR}/.." && pwd)"
8
+
9
+ echo "=== BusinessKit Universal Agent Setup ==="
10
+
11
+ # 1. Locate BusinessKit binary
12
+ BK_BIN=""
13
+ if [ -n "$BUSINESSKIT_BIN" ] && [ -x "$BUSINESSKIT_BIN" ]; then
14
+ BK_BIN="$BUSINESSKIT_BIN"
15
+ elif [ -x "/Applications/BusinessKit.app/Contents/MacOS/businesskit" ]; then
16
+ BK_BIN="/Applications/BusinessKit.app/Contents/MacOS/businesskit"
17
+ elif [ -x "${ROOT_DIR}/../src-tauri/target/release/businesskit" ]; then
18
+ BK_BIN="$(cd "${ROOT_DIR}/../src-tauri/target/release" && pwd)/businesskit"
19
+ elif [ -x "${ROOT_DIR}/../src-tauri/target/debug/businesskit" ]; then
20
+ BK_BIN="$(cd "${ROOT_DIR}/../src-tauri/target/debug" && pwd)/businesskit"
21
+ elif command -v businesskit >/dev/null 2>&1; then
22
+ BK_BIN="$(command -v businesskit)"
23
+ fi
24
+
25
+ if [ -z "$BK_BIN" ]; then
26
+ echo "Error: Could not locate BusinessKit binary."
27
+ echo "Please install BusinessKit or set BUSINESSKIT_BIN=/path/to/binary"
28
+ exit 1
29
+ fi
30
+ echo "✓ Found binary: $BK_BIN"
31
+
32
+ # 2. Discover available profiles
33
+ CREDS_DIR="${HOME}/.businesskit/creds"
34
+ PROFILES=()
35
+ DEFAULT_PROFILE="4628a5b1-ac05-4156-9d76-04bbd71119a1" # BusinessKit profile
36
+
37
+ if [ -d "$CREDS_DIR" ]; then
38
+ for f in "${CREDS_DIR}"/userdb_*.dat; do
39
+ if [ -f "$f" ]; then
40
+ pid=$(basename "$f" | sed -e 's/^userdb_//' -e 's/\.dat$//')
41
+ PROFILES+=("$pid")
42
+ fi
43
+ done
44
+ fi
45
+
46
+ SELECTED_PROFILE=""
47
+ if [ -n "$1" ]; then
48
+ SELECTED_PROFILE="$1"
49
+ elif [ "${#PROFILES[@]}" -eq 1 ]; then
50
+ SELECTED_PROFILE="${PROFILES[0]}"
51
+ elif [ -f "${CREDS_DIR}/userdb_${DEFAULT_PROFILE}.dat" ]; then
52
+ SELECTED_PROFILE="$DEFAULT_PROFILE"
53
+ elif [ "${#PROFILES[@]}" -gt 0 ]; then
54
+ SELECTED_PROFILE="${PROFILES[0]}"
55
+ else
56
+ echo "Warning: No cached profiles found in ~/.businesskit/creds/."
57
+ echo "Defaulting to: $DEFAULT_PROFILE"
58
+ SELECTED_PROFILE="$DEFAULT_PROFILE"
59
+ fi
60
+
61
+ echo "✓ Selected profile: $SELECTED_PROFILE"
62
+
63
+ # 3. Create output directory
64
+ mkdir -p "${ROOT_DIR}/output"
65
+
66
+ # 4. Generate Claude Code configuration (.mcp.json)
67
+ cat <<EOF > "${ROOT_DIR}/.mcp.json"
68
+ {
69
+ "mcpServers": {
70
+ "businesskit": {
71
+ "command": "${BK_BIN}",
72
+ "args": ["--mcp", "--profile", "${SELECTED_PROFILE}"]
73
+ }
74
+ }
75
+ }
76
+ EOF
77
+ echo "✓ Generated Claude Code config: ${ROOT_DIR}/.mcp.json"
78
+
79
+ # 5. Generate Cursor configuration (.cursor/mcp.json)
80
+ mkdir -p "${ROOT_DIR}/.cursor"
81
+ cat <<EOF > "${ROOT_DIR}/.cursor/mcp.json"
82
+ {
83
+ "mcpServers": {
84
+ "businesskit": {
85
+ "command": "${BK_BIN}",
86
+ "args": ["--mcp", "--profile", "${SELECTED_PROFILE}"]
87
+ }
88
+ }
89
+ }
90
+ EOF
91
+ echo "✓ Generated Cursor config: ${ROOT_DIR}/.cursor/mcp.json"
92
+
93
+ # 6. Generate VS Code configuration (.vscode/mcp.json)
94
+ mkdir -p "${ROOT_DIR}/.vscode"
95
+ cat <<EOF > "${ROOT_DIR}/.vscode/mcp.json"
96
+ {
97
+ "servers": {
98
+ "businesskit": {
99
+ "type": "stdio",
100
+ "command": "${BK_BIN}",
101
+ "args": ["--mcp", "--profile", "${SELECTED_PROFILE}"]
102
+ }
103
+ }
104
+ }
105
+ EOF
106
+ echo "✓ Generated VS Code config: ${ROOT_DIR}/.vscode/mcp.json"
107
+
108
+ # 7. Generate Gemini / Antigravity settings
109
+ mkdir -p "${ROOT_DIR}/.gemini"
110
+ cat <<EOF > "${ROOT_DIR}/.gemini/mcp_config.json"
111
+ {
112
+ "mcpServers": {
113
+ "businesskit": {
114
+ "command": "${BK_BIN}",
115
+ "args": ["--mcp", "--profile", "${SELECTED_PROFILE}"]
116
+ }
117
+ }
118
+ }
119
+ EOF
120
+ echo "✓ Generated Antigravity / Gemini config: ${ROOT_DIR}/.gemini/mcp_config.json"
121
+
122
+ # 8. Register with Antigravity CLI if agy is in PATH
123
+ if command -v agy >/dev/null 2>&1; then
124
+ echo "Registering with Antigravity CLI (agy)..."
125
+ agy mcp add businesskit "${BK_BIN}" --mcp --profile "${SELECTED_PROFILE}" 2>/dev/null || true
126
+ fi
127
+
128
+ echo ""
129
+ echo "=== Setup Complete! ==="
130
+ echo "You can now run BusinessKit from any agentic CLI in this workspace:"
131
+ echo " - Antigravity / Gemini CLI"
132
+ echo " - Cursor (open this directory in Cursor)"
133
+ echo " - Claude Code (run 'claude' in this directory)"
134
+ echo " - VS Code Copilot"
@@ -0,0 +1,92 @@
1
+ // scripts/setup.ts — Node/TypeScript BusinessKit MCP Setup Wizard
2
+ import fs from 'node:fs';
3
+ import path from 'node:path';
4
+ import { fileURLToPath } from 'node:url';
5
+ import { execSync } from 'node:child_process';
6
+
7
+ const __filename = fileURLToPath(import.meta.url);
8
+ const __dirname = path.dirname(__filename);
9
+ const ROOT_DIR = path.resolve(__dirname, '..');
10
+
11
+ console.log('=== BusinessKit Universal Agent Setup (TypeScript) ===');
12
+
13
+ // 1. Locate binary
14
+ let bkBin = process.env.BUSINESSKIT_BIN || '';
15
+ const candidates = [
16
+ '/Applications/BusinessKit.app/Contents/MacOS/businesskit',
17
+ path.resolve(ROOT_DIR, '../src-tauri/target/release/businesskit'),
18
+ path.resolve(ROOT_DIR, '../src-tauri/target/debug/businesskit'),
19
+ ];
20
+
21
+ if (!bkBin) {
22
+ for (const c of candidates) {
23
+ if (fs.existsSync(c)) {
24
+ bkBin = c;
25
+ break;
26
+ }
27
+ }
28
+ }
29
+
30
+ if (!bkBin) {
31
+ try {
32
+ bkBin = execSync('which businesskit', { encoding: 'utf8' }).trim();
33
+ } catch {}
34
+ }
35
+
36
+ if (!bkBin || !fs.existsSync(bkBin)) {
37
+ console.error('Error: BusinessKit binary not found. Set BUSINESSKIT_BIN=/path/to/binary');
38
+ process.exit(1);
39
+ }
40
+ console.log(`✓ Found binary: ${bkBin}`);
41
+
42
+ // 2. Locate Profile
43
+ const credsDir = path.join(process.env.HOME || '', '.businesskit/creds');
44
+ const defaultProfile = '4628a5b1-ac05-4156-9d76-04bbd71119a1';
45
+ let selectedProfile = process.argv[2] || defaultProfile;
46
+
47
+ console.log(`✓ Target profile: ${selectedProfile}`);
48
+
49
+ // 3. Output directory
50
+ const outputDir = path.join(ROOT_DIR, 'output');
51
+ if (!fs.existsSync(outputDir)) fs.mkdirSync(outputDir, { recursive: true });
52
+
53
+ // 4. Claude Code (.mcp.json)
54
+ const claudeConfig = {
55
+ mcpServers: {
56
+ businesskit: {
57
+ command: bkBin,
58
+ args: ['--mcp', '--profile', selectedProfile],
59
+ },
60
+ },
61
+ };
62
+ fs.writeFileSync(path.join(ROOT_DIR, '.mcp.json'), JSON.stringify(claudeConfig, null, 2));
63
+ console.log('✓ Wrote .mcp.json (Claude Code)');
64
+
65
+ // 5. Cursor (.cursor/mcp.json)
66
+ const cursorDir = path.join(ROOT_DIR, '.cursor');
67
+ if (!fs.existsSync(cursorDir)) fs.mkdirSync(cursorDir, { recursive: true });
68
+ fs.writeFileSync(path.join(cursorDir, 'mcp.json'), JSON.stringify(claudeConfig, null, 2));
69
+ console.log('✓ Wrote .cursor/mcp.json (Cursor)');
70
+
71
+ // 6. VS Code (.vscode/mcp.json)
72
+ const vscodeDir = path.join(ROOT_DIR, '.vscode');
73
+ if (!fs.existsSync(vscodeDir)) fs.mkdirSync(vscodeDir, { recursive: true });
74
+ const vscodeConfig = {
75
+ servers: {
76
+ businesskit: {
77
+ type: 'stdio',
78
+ command: bkBin,
79
+ args: ['--mcp', '--profile', selectedProfile],
80
+ },
81
+ },
82
+ };
83
+ fs.writeFileSync(path.join(vscodeDir, 'mcp.json'), JSON.stringify(vscodeConfig, null, 2));
84
+ console.log('✓ Wrote .vscode/mcp.json (VS Code)');
85
+
86
+ // 7. Antigravity (.gemini/mcp_config.json)
87
+ const geminiDir = path.join(ROOT_DIR, '.gemini');
88
+ if (!fs.existsSync(geminiDir)) fs.mkdirSync(geminiDir, { recursive: true });
89
+ fs.writeFileSync(path.join(geminiDir, 'mcp_config.json'), JSON.stringify(claudeConfig, null, 2));
90
+ console.log('✓ Wrote .gemini/mcp_config.json (Antigravity / Gemini)');
91
+
92
+ console.log('\n=== Ready! Launch any agentic CLI to interact with BusinessKit ===');
package/server.json ADDED
@@ -0,0 +1,21 @@
1
+ {
2
+ "$schema": "https://static.modelcontextprotocol.io/schemas/2025-12-11/server.schema.json",
3
+ "name": "io.github.businesskitai/agent",
4
+ "title": "BusinessKit Agent",
5
+ "description": "Universal BusinessKit Agent Kit — operate billing & POS, inventory restocking, CRM contacts, customer support triage, and landing page publishing via local native BusinessKit MCP server.",
6
+ "repository": {
7
+ "url": "https://github.com/businesskitai/businesskit-agent",
8
+ "source": "github"
9
+ },
10
+ "version": "1.0.5",
11
+ "packages": [
12
+ {
13
+ "registryType": "npm",
14
+ "identifier": "@businesskit/agent",
15
+ "version": "1.0.5",
16
+ "transport": {
17
+ "type": "stdio"
18
+ }
19
+ }
20
+ ]
21
+ }
package/skills/README.md CHANGED
@@ -1,33 +1,25 @@
1
- # Skills — Load On Demand
1
+ # BusinessKit Agent Skills
2
2
 
3
- Skills live in `.agents/skills/` (universal) and `.claude/skills/` (Claude Code).
3
+ Declarative workflow skills that guide agents in using BusinessKit's native Model Context Protocol (MCP) server.
4
4
 
5
- **Do NOT load all skills at session start.** Load only what the current task needs.
6
- Each skill costs tokens. Unused skills waste money and bust the prompt cache.
5
+ Skills load on demand based on task context—never load all skills simultaneously.
7
6
 
8
- ## Load pattern
7
+ ## Domain Workflow Skills (MCP Tools)
9
8
 
10
- ```
11
- Writing content (blog, newsletter, copy) → load brand.md
12
- SEO work (audit, meta, LLM visibility) → load brand.md + schema.md (posts section)
13
- Store/products/pricing → load store.md
14
- Reading analytics JSON → load analytics.md
15
- Routing to correct agent → load agents.md
16
- DB queries / table structure → load schema.md
17
- ```
9
+ | Skill | Directory | Core MCP Tools | Purpose |
10
+ | :--- | :--- | :--- | :--- |
11
+ | **Docs & CMS** | `docs-cms/` | `blog_post_create`, `content_list`, `content_get`, `content_update` | Technical docs, knowledge base articles, guides, and blog posts with TipTap semantic HTML. |
12
+ | **Visual Pages** | `pages/` | `page_create`, `page_update`, `page_publish`, `component_create`, `page_get_section_schema` | Storefront and landing pages using native modular sections and custom components. |
13
+ | **Billing & POS** | `billing/` | `shop_create_new_bill`, `invoice_create`, `invoice_send` | Rapid POS sales receipts, handwritten bill parsing, and B2B invoices. |
14
+ | **Inventory** | `inventory/` | `inventory_receive_purchase_invoice`, `inventory_add_stock`, `inventory_get_levels` | Supplier purchase bills, automated restocking, stock adjustments, and moving average cost. |
15
+ | **CRM** | `crm/` | `contact_create`, `contact_update` | Customer, client, and vendor directory management and tagging. |
16
+ | **Inbox** | `inbox/` | `inbox_tool_set_category`, `inbox_tool_draft_reply`, `inbox_tool_schedule_send` | Email/DM triage, prompt-injection screening, draft replies, and approval gates. |
18
17
 
19
- ## Available skills
18
+ ## Content Craft & Brand Skills
20
19
 
21
- | File | Load when |
22
- |---|---|
23
- | `brand.md` | Any content writing task |
24
- | `store.md` | Product creation, pricing, commerce |
25
- | `analytics.md` | Reading analytics columns |
26
- | `agents.md` | Routing requests, dependency direction |
27
- | `schema.md` | DB queries, table structure questions |
28
-
29
- ## Never load
30
-
31
- - All skills at once
32
- - A skill "just in case"
33
- - Skills for tasks the user didn't ask for
20
+ | Skill | Directory | Purpose |
21
+ | :--- | :--- | :--- |
22
+ | **Brand Identity** | `brand/` | Calibrate brand voice, tone compass, and store context via `system_get_capabilities`. |
23
+ | **Humanizer** | `humanizer/` | De-AI patterns, remove repetitive AI writing signatures, and restore genuine human voice. |
24
+ | **Copywriting** | `copywriting/` | High-converting sales page copywriting with internal hostile validation. |
25
+ | **Social Content** | `social/` | Multi-platform social copy, thread creation, and engagement optimization. |
@@ -0,0 +1,64 @@
1
+ ---
2
+ name: billing
3
+ description: Issue invoices, create walk-in POS bills, record payments, and reconcile accounts using double-entry verified tools.
4
+ ---
5
+
6
+ # Billing, POS & Invoicing Skill
7
+
8
+ Use this skill when billing customers, generating B2B invoices, or reviewing sales documents.
9
+
10
+ ## 1. Operating Rules & Constraints
11
+
12
+ - **Double-Entry Guarantees**:
13
+ - Never write directly to financial ledger tables (`fin_journal_entries`, `fin_accounts`).
14
+ - Tools automatically compute debits, credits, and tax rates.
15
+ - **Drafts First**:
16
+ - Invoices must be drafted first for human review before transmission. Call `invoice_create`, then prompt the user to review and send with `invoice_send`.
17
+ - **Line Items**:
18
+ - Always provide item name or SKU, quantity, unit price, and optional tax or discount.
19
+
20
+ ## 2. Tool Workflows
21
+
22
+ ### A. Walk-in POS Sale
23
+ Call `shop_create_new_bill` to instantly record a retail sale, decrement inventory, and post ledger records:
24
+ ```json
25
+ call_tool("shop_create_new_bill", {
26
+ "customer_name": "Walk-in Customer",
27
+ "payment_method": "cash",
28
+ "payment_status": "confirmed",
29
+ "line_items": [
30
+ {
31
+ "item_name": "Tellzy 40 Tab",
32
+ "quantity": 2,
33
+ "unit_price": 500.00,
34
+ "discount_pct": 10.0
35
+ }
36
+ ]
37
+ })
38
+ ```
39
+
40
+ ### B. Create Formal B2B Invoice
41
+ Call `invoice_create` to generate an itemized invoice draft:
42
+ ```json
43
+ call_tool("invoice_create", {
44
+ "customer_id": "Acme Corp",
45
+ "due_date": "2026-12-15",
46
+ "line_items": [
47
+ {
48
+ "name": "Consulting Services",
49
+ "quantity": 10,
50
+ "unit_price": 150.00,
51
+ "tax_rate": 18.0
52
+ }
53
+ ]
54
+ })
55
+ ```
56
+
57
+ ### C. Send Finalized Invoice
58
+ Dispatch invoice to client via email or generate a shareable payment link:
59
+ ```json
60
+ call_tool("invoice_send", {
61
+ "invoice_id": "inv_8941",
62
+ "recipient_email": "billing@acme.com"
63
+ })
64
+ ```