@businesskit/agent 1.0.4 → 1.0.7

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 (190) 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 +62 -0
  5. package/AGENTS.md +105 -63
  6. package/CLAUDE.md +11 -84
  7. package/GEMINI.md +11 -34
  8. package/README.md +95 -154
  9. package/assets/logo.svg +3 -0
  10. package/bin/businesskit.js +45 -18
  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/brief.md +12 -0
  15. package/commands/capabilities.md +33 -0
  16. package/commands/chase.md +12 -0
  17. package/commands/check-stock.md +43 -0
  18. package/commands/create-component.md +109 -0
  19. package/commands/create-invoice.md +69 -0
  20. package/commands/create-new-bill.md +65 -0
  21. package/commands/create-page.md +124 -0
  22. package/commands/crm.md +13 -0
  23. package/commands/followups.md +13 -0
  24. package/commands/list-components.md +41 -0
  25. package/commands/list-content.md +46 -0
  26. package/commands/list-pages.md +45 -0
  27. package/commands/pipeline.md +13 -0
  28. package/commands/publish-page.md +64 -0
  29. package/commands/send-invoice.md +42 -0
  30. package/commands/seo-audit.md +36 -0
  31. package/commands/update-agent.md +33 -0
  32. package/commands/update-contact.md +46 -0
  33. package/commands/update-content.md +48 -0
  34. package/commands/update-page.md +56 -0
  35. package/commands/update-price.md +47 -0
  36. package/commands/write-blog.md +56 -0
  37. package/commands/write-docs.md +90 -0
  38. package/commands/write-guide.md +51 -0
  39. package/commands/write-newsletter.md +50 -0
  40. package/dist/server.js +4099 -0
  41. package/mcp_config.json +12 -0
  42. package/package.json +54 -25
  43. package/plugin.json +32 -0
  44. package/scripts/setup.sh +169 -0
  45. package/scripts/setup.ts +129 -0
  46. package/scripts/update.sh +56 -0
  47. package/server.json +21 -0
  48. package/skills/README.md +20 -27
  49. package/skills/billing/SKILL.md +64 -0
  50. package/skills/brand/SKILL.md +30 -86
  51. package/skills/cms/SKILL.md +111 -0
  52. package/skills/cms/references/cms-hubs.md +84 -0
  53. package/skills/cms/references/html-blocks.md +177 -0
  54. package/skills/copywriting/SKILL.md +1 -1
  55. package/skills/crm/SKILL.md +24 -0
  56. package/skills/docs/SKILL.md +65 -0
  57. package/skills/docs/references/how-to.md +155 -0
  58. package/skills/inbox/SKILL.md +49 -0
  59. package/skills/inventory/SKILL.md +69 -0
  60. package/skills/pages/SKILL.md +214 -0
  61. package/skills/pages/references/sections-catalog.json +1183 -0
  62. package/skills/social/SKILL.md +84 -211
  63. package/skills/social/evals/evals.json +66 -0
  64. package/skills/social/evals/rubric.md +26 -0
  65. package/skills/social/examples/repurposing-blog-to-social.md +93 -0
  66. package/skills/social/examples/weekly-content-calendar.md +30 -0
  67. package/skills/social/linkedin/SKILL.md +107 -0
  68. package/skills/social/linkedin/evals/evals.json +106 -0
  69. package/skills/social/linkedin/evals/rubric.md +28 -0
  70. package/skills/social/linkedin/examples/gasp-weekly-sprint.md +24 -0
  71. package/skills/social/linkedin/examples/growth-posts-by-format.md +140 -0
  72. package/skills/social/linkedin/references/gasp-funnel-and-calibration.md +90 -0
  73. package/skills/social/linkedin/references/six-growth-formats.md +114 -0
  74. package/skills/social/references/platforms.md +76 -0
  75. package/skills/social/references/post-templates.md +105 -0
  76. package/skills/social/references/reverse-engineering.md +62 -0
  77. package/src/data/sections-catalog.json +950 -0
  78. package/src/db.ts +170 -0
  79. package/src/server.ts +75 -0
  80. package/src/tools/content.ts +326 -0
  81. package/src/tools/crm.ts +1416 -0
  82. package/src/tools/domains.ts +89 -0
  83. package/src/tools/inbox.ts +270 -0
  84. package/src/tools/index.ts +116 -0
  85. package/src/tools/pages.ts +1217 -0
  86. package/src/tools/shop.ts +771 -0
  87. package/src/tools/system.ts +94 -0
  88. package/src/tools/types.ts +17 -0
  89. package/templates/antigravity.json +8 -0
  90. package/templates/claude-code.mcp.json +8 -0
  91. package/templates/cursor.mcp.json +8 -0
  92. package/templates/vscode.mcp.json +9 -0
  93. package/.claude/commands/analytics.md +0 -7
  94. package/.claude/commands/blog-writer.md +0 -9
  95. package/.claude/commands/cbo.md +0 -7
  96. package/.claude/commands/ceo.md +0 -10
  97. package/.claude/commands/cmo.md +0 -7
  98. package/.claude/commands/compress.md +0 -73
  99. package/.claude/commands/coo.md +0 -11
  100. package/.claude/commands/copywriter.md +0 -15
  101. package/.claude/commands/course-creator.md +0 -9
  102. package/.claude/commands/crm.md +0 -591
  103. package/.claude/commands/deep.md +0 -50
  104. package/.claude/commands/docs-writer.md +0 -8
  105. package/.claude/commands/forms-builder.md +0 -10
  106. package/.claude/commands/ingest.md +0 -110
  107. package/.claude/commands/jobs-manager.md +0 -8
  108. package/.claude/commands/kb.md +0 -107
  109. package/.claude/commands/newsletter-writer.md +0 -9
  110. package/.claude/commands/preserve.md +0 -64
  111. package/.claude/commands/resume.md +0 -67
  112. package/.claude/commands/scheduler.md +0 -8
  113. package/.claude/commands/seo.md +0 -60
  114. package/.claude/commands/social.md +0 -51
  115. package/.claude/commands/store-manager.md +0 -11
  116. package/.claude/settings.json +0 -16
  117. package/.claude/settings.local.json +0 -11
  118. package/.env.example +0 -12
  119. package/.mcp.json +0 -3
  120. package/HEARTBEAT.md +0 -105
  121. package/PLAN.md +0 -345
  122. package/PRD-Agent-Composition.md +0 -149
  123. package/PRD-Agent-Harness.md +0 -316
  124. package/REFERENCE.md +0 -160
  125. package/SOUL.md +0 -148
  126. package/SYSTEM.md +0 -71
  127. package/agents/_base.ts +0 -371
  128. package/agents/analytics/SOUL.md +0 -11
  129. package/agents/analytics/analytics.ts +0 -405
  130. package/agents/business/SOUL.md +0 -11
  131. package/agents/business/business.ts +0 -109
  132. package/agents/ceo/SOUL.md +0 -15
  133. package/agents/ceo/ceo.ts +0 -146
  134. package/agents/content/SOUL.md +0 -11
  135. package/agents/content/content.ts +0 -379
  136. package/agents/copywriting/SOUL.md +0 -11
  137. package/agents/copywriting/copywriting.ts +0 -89
  138. package/agents/courses/SOUL.md +0 -11
  139. package/agents/courses/courses.ts +0 -451
  140. package/agents/docs/SOUL.md +0 -11
  141. package/agents/docs/docs.ts +0 -77
  142. package/agents/forms/SOUL.md +0 -11
  143. package/agents/forms/forms.ts +0 -364
  144. package/agents/hiring/SOUL.md +0 -11
  145. package/agents/hiring/hiring.ts +0 -314
  146. package/agents/marketing/SOUL.md +0 -15
  147. package/agents/marketing/marketing.ts +0 -109
  148. package/agents/newsletter/SOUL.md +0 -11
  149. package/agents/newsletter/newsletter.ts +0 -91
  150. package/agents/operations/SOUL.md +0 -11
  151. package/agents/operations/operations.ts +0 -157
  152. package/agents/sales/SOUL.md +0 -44
  153. package/agents/sales/sales.ts +0 -883
  154. package/agents/scheduler/SOUL.md +0 -11
  155. package/agents/scheduler/scheduler.ts +0 -68
  156. package/agents/seo/SOUL.md +0 -11
  157. package/agents/seo/seo.ts +0 -288
  158. package/agents/social/SOUL.md +0 -11
  159. package/agents/social/social.ts +0 -744
  160. package/agents/store/SOUL.md +0 -11
  161. package/agents/store/store.ts +0 -514
  162. package/cli.ts +0 -144
  163. package/context/about-me.md +0 -96
  164. package/context/brand-voice.md +0 -127
  165. package/context/brand.md +0 -80
  166. package/context/business.md +0 -66
  167. package/context/working-style.md +0 -87
  168. package/lib/analytics.ts +0 -81
  169. package/lib/cms.ts +0 -88
  170. package/lib/db.adapter.ts +0 -30
  171. package/lib/db.ts +0 -63
  172. package/lib/enums.ts +0 -25
  173. package/lib/groups.ts +0 -122
  174. package/lib/id.ts +0 -43
  175. package/lib/kb.ts +0 -337
  176. package/lib/memory.ts +0 -219
  177. package/lib/pattern-detector.ts +0 -169
  178. package/lib/profile.ts +0 -155
  179. package/lib/schema.ts +0 -2015
  180. package/lib/slug.ts +0 -30
  181. package/lib/validate.ts +0 -33
  182. package/setup.ts +0 -141
  183. package/skills/agents/SKILL.md +0 -56
  184. package/skills/analytics/SKILL.md +0 -52
  185. package/skills/blog-writer/SKILL.md +0 -452
  186. package/skills/ceo/SKILL.md +0 -25
  187. package/skills/cmo/SKILL.md +0 -8
  188. package/skills/schema/SKILL.md +0 -86
  189. package/skills/store/SKILL.md +0 -62
  190. package/tsconfig.json +0 -14
package/README.md CHANGED
@@ -1,195 +1,136 @@
1
- # BusinessKit Agent
1
+ # BusinessKit MCP Server & Agent Kit
2
2
 
3
- Your agents are useless without a knowledge layer.
4
- This is the knowledge layer — plus the agents that read from it.
3
+ The official **Model Context Protocol (MCP)** server and autonomous agent toolbelt for **BusinessKit**. Operate, manage, and automate your business from any MCP-compatible AI client—including **Claude Desktop**, **Claude Code**, **Cursor**, **Antigravity**, **OpenAI Codex**, **VS Code**, and **Glama**.
5
4
 
6
- 17 agents (CEO, CRM, Social, SEO, Blog Writer, and more) that read and write directly
7
- to your Turso database. Two layers:
8
-
9
- **Brand Foundation (BF)** — static, you write once: `context/brand-voice.md`,
10
- `context/about-me.md`, `SOUL.md`. Agents read before producing anything.
11
-
12
- **Knowledge Base Layer (KBL)** — dynamic, agents maintain: `agent_kb` table grows
13
- every session. Drop anything into `agent_notes` inbox — links, ideas, tweets, articles.
14
- Run `/ingest` and the agent compiles structured wiki pages with cross-links.
15
- Every question you ask gets filed back as a new entry. Knowledge compounds.
16
-
17
- Works with Claude Code, Claude Cowork, Gemini CLI, Codex, and any terminal.
5
+ [![npm version](https://img.shields.io/npm/v/@businesskit/agent.svg)](https://www.npmjs.com/package/@businesskit/agent)
6
+ [![MCP Compatible](https://img.shields.io/badge/MCP-2024--11--05-blue.svg)](https://modelcontextprotocol.io)
7
+ [![License: MIT](https://img.shields.io/badge/License-MIT-green.svg)](LICENSE)
18
8
 
19
9
  ---
20
10
 
21
- ## Install — two ways
11
+ ## Two Connection Modes
22
12
 
23
- ### Option A — Claude Code plugin (recommended)
24
-
25
- One command. Works across all projects. Auto-updates.
26
-
27
- Open Claude Code terminal (`Ctrl+`` ` ``):
13
+ ### Mode 1: With BusinessKit App (macOS, Windows, Linux) — Zero Config
14
+ If the BusinessKit desktop app is installed on your machine, **you do not need a `.env` file**. Run the universal setup:
28
15
 
29
16
  ```bash
30
- /plugin marketplace add businesskitai/businesskit-agent
31
- /plugin install businesskit@businesskitai
32
- /reload-plugins
17
+ npx @businesskit/agent setup
18
+ # or: npm run setup
33
19
  ```
34
20
 
35
- Enter your credentials when prompted — `TURSO_URL` and `TURSO_TOKEN` from BusinessKit → Settings → Credentials.
36
-
37
- Commands are namespaced: `/businesskit:ceo`, `/businesskit:crm`, `/businesskit:blog-writer` etc.
21
+ The setup wizard automatically locates the installed app binary, connects to your active organization profile, and pairs with your agent environment with zero manual configuration.
38
22
 
39
23
  ---
40
24
 
41
- ### Option B — Clone for full access
25
+ ### Mode 2: Standalone / Cloud / Headless (No App Required)
26
+ Run anywhere Node.js is available (remote server, VPS, Glama, Docker, or machine without the desktop app):
42
27
 
43
- Source code, all agents, customise everything.
28
+ 1. **Configure `.env`** (see [`.env.example`](./.env.example)):
29
+ ```env
30
+ TURSO_DATABASE_URL=libsql://your-database.turso.io
31
+ TURSO_AUTH_TOKEN=your-turso-auth-token
32
+ ```
44
33
 
45
- ```bash
46
- git clone https://github.com/businesskitai/businesskit-agent
47
- cd businesskit-agent
48
- npm install
49
- cp .env.example .env
50
- # Paste TURSO_URL and TURSO_TOKEN from BusinessKit → Settings → Credentials
51
- npm run setup
52
- ```
53
-
54
- Commands are direct: `/ceo`, `/crm`, `/blog-writer` etc.
55
-
56
- ---
34
+ 2. **Read-Only Mode Option**:
35
+ To grant your AI agent safe read-only access (query inventory, check stock, inspect pages, and read CMS content without permitting writes), supply a read-only token instead:
36
+ ```env
37
+ TURSO_DATABASE_URL=libsql://your-database.turso.io
38
+ TURSO_READ_ONLY_TOKEN=your-read-only-token
39
+ ```
57
40
 
58
- **Get credentials:** BusinessKit → Settings → Credentials → copy Turso URL and Token.
41
+ > **Note**: Tool discovery (`initialize` and `tools/list`) succeeds out-of-the-box even before `.env` is configured, allowing MCP registries (Glama, Smithery) and IDE clients to inspect schemas immediately.
59
42
 
60
43
  ---
61
44
 
62
- ## Fill in your context (20 minutes, once)
63
-
64
- These files make every agent 10x better. Without them, agents guess.
65
-
66
- ```
67
- context/about-me.md → who you are, your background, credibility
68
- context/brand-voice.md → voice bible with real writing examples
69
- context/working-style.md → how you work, approval preferences, schedule
70
- context/business.md → goals, revenue model, 90-day targets
45
+ ## MCP Client Configuration
46
+
47
+ #### Claude Desktop (`claude_desktop_config.json`)
48
+ ```json
49
+ {
50
+ "mcpServers": {
51
+ "businesskit": {
52
+ "command": "npx",
53
+ "args": ["-y", "@businesskit/agent"],
54
+ "env": {
55
+ "TURSO_DATABASE_URL": "libsql://your-database.turso.io",
56
+ "TURSO_AUTH_TOKEN": "your-turso-auth-token"
57
+ }
58
+ }
59
+ }
60
+ }
71
61
  ```
72
62
 
73
- **This is the most important step.** Shann Holmberg (Espressio) calls this the Brand Foundation —
74
- the static layer agents read before producing anything so the output sounds like you, not generic AI.
75
-
76
- ---
77
-
78
- ## How to use
79
-
80
- ### Claude Code
81
-
82
- Open this folder. Type any slash command:
83
-
84
- ```
85
- /ceo → weekly business briefing, priorities, pending approvals
86
- /blog-writer → write posts, listicles, how-tos, comparisons
87
- /newsletter → draft and send newsletters
88
- /social → post to Twitter, LinkedIn, Instagram, TikTok (13 platforms)
89
- /crm → manage contacts, deals, outreach pipeline
90
- /seo → audit, fix meta, track LLM visibility
91
- /analytics → revenue, traffic, product performance
92
- /store → launch products, courses, services
93
- /ingest → process agent_notes inbox into knowledge base
94
- /kb → query your knowledge base
95
- /compress → save session before context runs out
96
- /resume → reload context next session
63
+ #### Cursor (`.cursor/mcp.json`)
64
+ ```json
65
+ {
66
+ "mcpServers": {
67
+ "businesskit": {
68
+ "command": "npx",
69
+ "args": ["-y", "@businesskit/agent"],
70
+ "env": {
71
+ "TURSO_DATABASE_URL": "libsql://your-database.turso.io",
72
+ "TURSO_AUTH_TOKEN": "your-turso-auth-token"
73
+ }
74
+ }
75
+ }
76
+ }
97
77
  ```
98
78
 
99
- ### Claude Cowork
100
-
101
- Install the BusinessKit plugin. Same commands, runs in your browser.
102
-
103
- ### Terminal
104
-
79
+ #### Claude Code
105
80
  ```bash
106
- npx tsx cli.ts ceo
107
- npx tsx cli.ts blog-writer
108
- npx tsx cli.ts crm
81
+ claude mcp add businesskit npx -y @businesskit/agent
109
82
  ```
110
83
 
111
- ---
112
-
113
- ## The knowledge layer
114
-
115
- Drop anything into your inbox:
116
-
117
- ```
118
- "add to notes: https://twitter.com/karpathy/status/... — useful for SEO strategy"
119
- "add to notes: idea — launch a free email course as lead magnet"
120
- "add to notes: competitor just raised prices, opportunity"
84
+ #### Antigravity / Gemini CLI (`.gemini/mcp_config.json`)
85
+ ```json
86
+ {
87
+ "mcpServers": {
88
+ "businesskit": {
89
+ "command": "npx",
90
+ "args": ["-y", "@businesskit/agent"],
91
+ "env": {
92
+ "TURSO_DATABASE_URL": "libsql://your-database.turso.io",
93
+ "TURSO_AUTH_TOKEN": "your-turso-auth-token"
94
+ }
95
+ }
96
+ }
97
+ }
121
98
  ```
122
99
 
123
- Run `/ingest` weekly. The agent reads each note, builds or updates wiki pages,
124
- cross-references related entries, marks contradictions as stale.
125
-
126
- Query anytime:
127
-
128
- ```
129
- /kb → "what do I know about email deliverability?"
130
- "what content formats performed best?"
131
- "what's my current positioning vs competitors?"
132
- ```
133
-
134
- Every answer gets filed back. The knowledge base gets richer every session.
135
-
136
- ---
137
-
138
- ## Agents
139
-
140
- | Agent | What they do |
141
- |---|---|
142
- | **CEO** | Weekly briefing, revenue pulse, priorities, pending approvals |
143
- | **CMO** | Marketing strategy, content calendar, growth planning |
144
- | **COO** | Operations, publishing queue, task management |
145
- | **CBO** | Revenue analysis, pricing strategy, product performance |
146
- | **Blog Writer** | Posts, listicles, how-tos, comparisons, programmatic content |
147
- | **Newsletter Writer** | Drafts, subscriber analytics, send management |
148
- | **Copywriter** | Landing pages, product copy, profile bio |
149
- | **Course Creator** | Course structure, lessons, pricing, access |
150
- | **Store Manager** | Products, webinars, services, sponsorships, 1:1 calls |
151
- | **Jobs Manager** | Job listings, applications |
152
- | **Forms Builder** | Intake forms, waitlists, surveys |
153
- | **Docs Writer** | Knowledge base articles, FAQs |
154
- | **CRM Agent** | Contacts, deals, outreach pipeline with approval gates |
155
- | **Social Agent** | 13 platforms via Zernio, scheduling, inbox |
156
- | **Analytics Agent** | Revenue, traffic, product, email stats |
157
- | **SEO Agent** | Technical audit, meta, LLM visibility tracking |
158
- | **Scheduler** | Cron tasks, publish queue, Hermes pattern detection |
159
-
160
100
  ---
161
101
 
162
- ## Cost
102
+ ## Documentation & References
163
103
 
164
- Every agent is built to minimise token cost:
104
+ Capabilities and workflows are organized in modular reference files:
165
105
 
166
- - Skills loaded on demand — only what the task needs
167
- - KB index scanned first (slug + summary), content loaded only when needed
168
- - Reports pushed to Turso mid-conversation — never lost if session ends
169
- - `SYSTEM.md` enforces: do first, report after. No narrating what's about to happen.
106
+ - **Agent Operating Rules & Directives**: [`AGENTS.md`](./AGENTS.md) — Multi-profile operations, ledger invariants, and draft-first safeguards.
107
+ - **Workflow Skills**: [`skills/`](./skills/)
108
+ - [`skills/billing/SKILL.md`](./skills/billing/SKILL.md) — POS bills, B2B invoices, and payment tracking.
109
+ - [`skills/inventory/SKILL.md`](./skills/inventory/SKILL.md) — Stock levels, purchase invoices, and price lists.
110
+ - [`skills/cms/SKILL.md`](./skills/cms/SKILL.md) — Multi-hub CMS publishing (Blog, Newsletter, Guides, Notes).
111
+ - [`skills/pages/SKILL.md`](./skills/pages/SKILL.md) — Visual site builder, section schemas, and custom components.
112
+ - [`skills/crm/SKILL.md`](./skills/crm/SKILL.md) — Contact cards, lead tracking, and tags.
113
+ - [`skills/inbox/SKILL.md`](./skills/inbox/SKILL.md) — Thread triage, 2FA OTP code extraction, and reply drafting.
114
+ - [`skills/domains/SKILL.md`](./skills/domains/SKILL.md) — Expiry horizons and renewal reminders.
115
+ - **Universal Slash Commands**: [`commands/`](./commands/) — 23 ready-to-run agent commands (`/create-new-bill`, `/write-docs`, `/create-page`, `/add-inventory-from-invoice`, etc.).
116
+ - **MCP Server Source**: [`src/server.ts`](./src/server.ts) and [`src/tools/`](./src/tools/) — Typed tool implementations and schemas.
170
117
 
171
- One founder moved from $130/5 days on a heavyweight agent setup to $10 on a lean
172
- knowledge-layer-first approach. That's the target.
118
+ - If you have a big idea you'd like us to consider, feel free to [open a discussion](https://github.com/businesskitai/businesskit-agent/discussions) about it.
173
119
 
174
120
  ---
175
121
 
176
- ## Works with
122
+ ## Updating
177
123
 
178
- | Tool | How |
179
- |---|---|
180
- | Claude Code | Primary runtime — slash commands in `.claude/commands/` |
181
- | Claude Cowork | Plugin at `.claude-plugin/plugin.json` — 18 commands |
182
- | Gemini CLI | Reads `GEMINI.md` automatically |
183
- | Codex | Reads `AGENTS.md` automatically |
184
- | Cursor | Reads `.cursorrules` automatically |
185
- | Any terminal | `npx tsx cli.ts <agent>` |
124
+ Update the local agent workspace to the latest release while keeping your custom `context/`, `memory/`, and custom skills intact:
186
125
 
187
- ---
126
+ ```bash
127
+ npx @businesskit/agent update
128
+ # or inside agent chat:
129
+ /update-agent
130
+ ```
188
131
 
189
- ## Requirements
132
+ ---
190
133
 
191
- - Node.js 18+
192
- - A BusinessKit account with Turso connected
193
- - Social platform tokens (optional — for `/social`)
134
+ ## License
194
135
 
195
- MIT License
136
+ [MIT](LICENSE) © BusinessKit AI
@@ -0,0 +1,3 @@
1
+ <svg width="28" height="28" viewBox="0 0 28 28" fill="none" xmlns="http://www.w3.org/2000/svg">
2
+ <path d="M14 4.66683C12.3892 4.66683 11.0833 5.97267 11.0833 7.5835C11.0833 9.19433 12.3892 10.5002 14 10.5002C15.6108 10.5002 16.9167 9.19433 16.9167 7.5835C16.9167 5.97267 15.6108 4.66683 14 4.66683ZM14 4.66683V2.3335M24.5 17.4272C21.9347 20.3337 18.1814 22.1668 14 22.1668C9.81858 22.1668 6.06531 20.3337 3.5 17.4272M12.5356 10.1055L3.5 25.6668M15.4644 10.1055L24.5 25.6668" stroke="#D97757" stroke-width="3" stroke-linecap="round" stroke-linejoin="round"/>
3
+ </svg>
@@ -1,23 +1,50 @@
1
1
  #!/usr/bin/env node
2
- // bin/businesskit.js — npm global install entry point
3
- // Compiled shim that launches cli.ts via tsx
4
- // Cursor is right: bin entries must be .js for npm to execute them correctly
2
+ // bin/businesskit.js — BusinessKit MCP Server & CLI entrypoint
5
3
 
6
- import { createRequire } from 'module'
7
- import { fileURLToPath } from 'url'
8
- import { dirname, join } from 'path'
9
- import { spawn } from 'child_process'
4
+ import { fileURLToPath } from 'url';
5
+ import { dirname, join } from 'path';
6
+ import { spawn } from 'child_process';
7
+ import { existsSync } from 'fs';
10
8
 
11
- const __dirname = dirname(fileURLToPath(import.meta.url))
12
- const root = join(__dirname, '..')
13
- const cli = join(root, 'cli.ts')
9
+ const __dirname = dirname(fileURLToPath(import.meta.url));
10
+ const root = join(__dirname, '..');
14
11
 
15
- // Find tsx — from local node_modules or global
16
- const tsx = process.execPath.replace('node', 'tsx')
17
- const proc = spawn(tsx, [cli, ...process.argv.slice(2)], {
18
- stdio: 'inherit',
19
- cwd: root,
20
- env: { ...process.env }
21
- })
12
+ const arg1 = process.argv[2];
22
13
 
23
- proc.on('exit', code => process.exit(code ?? 0))
14
+ if (arg1 === 'update' || arg1 === 'upgrade' || arg1 === '--update') {
15
+ const proc = spawn('bash', [join(root, 'scripts', 'update.sh'), ...process.argv.slice(3)], {
16
+ stdio: 'inherit',
17
+ cwd: root,
18
+ env: { ...process.env },
19
+ });
20
+ proc.on('exit', (code) => process.exit(code ?? 0));
21
+ } else if (arg1 === 'setup' || arg1 === '--setup') {
22
+ const proc = spawn('bash', [join(root, 'scripts', 'setup.sh'), ...process.argv.slice(3)], {
23
+ stdio: 'inherit',
24
+ cwd: root,
25
+ env: { ...process.env },
26
+ });
27
+ proc.on('exit', (code) => process.exit(code ?? 0));
28
+ } else {
29
+ // Start the Model Context Protocol (MCP) server
30
+ const distServer = join(root, 'dist', 'server.js');
31
+ if (existsSync(distServer)) {
32
+ import(distServer).then((mod) => {
33
+ if (typeof mod.startServer === 'function') {
34
+ mod.startServer().catch((err) => {
35
+ console.error('[BusinessKit MCP] Server startup error:', err);
36
+ process.exit(1);
37
+ });
38
+ }
39
+ });
40
+ } else {
41
+ // Development fallback using tsx
42
+ const tsServer = join(root, 'src', 'server.ts');
43
+ const proc = spawn('npx', ['tsx', tsServer], {
44
+ stdio: 'inherit',
45
+ cwd: root,
46
+ env: { ...process.env },
47
+ });
48
+ proc.on('exit', (code) => process.exit(code ?? 0));
49
+ }
50
+ }
@@ -0,0 +1,47 @@
1
+ ---
2
+ id: "cmd_add_contact"
3
+ name: "Add CRM Contact"
4
+ slash: "/add-contact"
5
+ description: "Register a new client, vendor, or lead with email/phone"
6
+ domain_tags: ["crm"]
7
+ required_tools: ["contact_create"]
8
+ ---
9
+
10
+ # Add CRM Contact (`/add-contact`)
11
+
12
+ Register a new client, vendor, supplier, or business lead in the unified CRM.
13
+
14
+ ## Available Tools
15
+ - `contact_create(name: string, email?: string, phone?: string, tags?: array)`: Creates contact and syncs with CRM directory.
16
+
17
+ ## Accepted Arguments
18
+ - Natural language contact creation:
19
+ - `/add-contact John Doe john@example.com +1-555-0199 tags:["client", "vip"]`
20
+ - `/add-contact vendor: "Apex Manufacturing" contact: sales@apex.com`
21
+
22
+ ## Execution Protocol
23
+
24
+ ### Step 1: Parse Contact Details
25
+ 1. Extract full name (split into first and last name automatically).
26
+ 2. Extract email address and validate format.
27
+ 3. Extract phone / mobile number.
28
+ 4. Extract descriptive tags (e.g. `["lead", "wholesale", "partner"]`).
29
+
30
+ ### Step 2: Execute Creation
31
+ Call `contact_create`:
32
+ ```json
33
+ {
34
+ "name": "Sarah Jenkins",
35
+ "email": "sarah.j@example.com",
36
+ "phone": "+1-555-8821",
37
+ "tags": ["client", "q4-lead"]
38
+ }
39
+ ```
40
+
41
+ ### Step 3: Confirmation
42
+ Output contact confirmation card:
43
+ - **Contact ID**: e.g. `ct_8a92b1f4`
44
+ - **Full Name**: Sarah Jenkins
45
+ - **Email & Phone**
46
+ - **Tags**: `client`, `q4-lead`
47
+ - **Next Steps**: Link to invoices (`/create-invoice`) or log communications.
@@ -0,0 +1,80 @@
1
+ ---
2
+ id: "cmd_add_inventory_from_invoice"
3
+ name: "Receive Stock from Invoice"
4
+ slash: "/add-inventory-from-invoice"
5
+ description: "Scan purchase invoice or PDF to auto-restock items"
6
+ domain_tags: ["shop"]
7
+ required_tools: ["inventory_receive_purchase_invoice"]
8
+ ---
9
+
10
+ # Receive Stock from Invoice (`/add-inventory-from-invoice`)
11
+
12
+ Scan purchase bills, supplier invoices, or OCR text to restock warehouse inventory, calculate selling prices, update purchase costs, and post double-entry accounts payable journal entries.
13
+
14
+ ## Available Tools
15
+ - `inventory_receive_purchase_invoice(vendor_name: string, line_items: array, invoice_number?: string, invoice_date?: string, payment_method?: string, payment_status?: string)`: Automatically records inward goods receipt and recalculates weighted average costs.
16
+
17
+ ## Purchase Line Item Schema
18
+ ```json
19
+ {
20
+ "item_name": "Premium Cotton Shirt",
21
+ "sku": "SHIRT-CTN-01",
22
+ "quantity": 100,
23
+ "unit_cost": 25.00,
24
+ "tax_rate": 5.0,
25
+ "discount_pct": 0,
26
+ "selling_price": 55.00,
27
+ "batch_number": "BATCH-2026-A",
28
+ "expiry_date": "2027-12-31"
29
+ }
30
+ ```
31
+
32
+ ## Pricing & Markup Rules
33
+ - `cost_price`: Inward base purchase cost per unit.
34
+ - If user requests markup: `Selling Price = Cost + (Cost * Markup %)`.
35
+ - If new products are being received, prompt or calculate the selling price if omitted.
36
+
37
+ ## Accepted Arguments
38
+ - Raw invoice text or structured items:
39
+ - `/add-inventory-from-invoice vendor:"Apex Supplies" inv:AP-892 items:[{ name: "Widget A", qty: 50, cost: 12.50, selling: 25.00 }]`
40
+ - Or paste purchase bill content after the slash command.
41
+
42
+ ## Execution Protocol
43
+
44
+ ### Step 1: Parse Inward Invoice Data
45
+ 1. Extract Vendor Name (mandatory).
46
+ 2. Extract Invoice Number and Invoice Date.
47
+ 3. Parse all line items: product name, SKU, quantity received, unit cost, taxes, discounts, batches, and selling prices.
48
+
49
+ ### Step 2: Double-Entry & Stock Ledger Integrity
50
+ Calling `inventory_receive_purchase_invoice` performs atomic ledger updates:
51
+ - Restocks warehouse quantity for each item (`track_inventory = 1`).
52
+ - Recalculates moving average unit cost.
53
+ - Posts double-entry journal records: Debits Inventory Asset, Credits Accounts Payable (or Cash/Bank).
54
+
55
+ ### Step 3: Execute Goods Receipt
56
+ Call `inventory_receive_purchase_invoice`:
57
+ ```json
58
+ {
59
+ "vendor_name": "Apex Supplies",
60
+ "invoice_number": "INV-2026-881",
61
+ "invoice_date": "2026-11-22",
62
+ "payment_status": "confirmed",
63
+ "payment_method": "bank_transfer",
64
+ "line_items": [
65
+ {
66
+ "item_name": "Widget A",
67
+ "quantity": 50,
68
+ "unit_cost": 12.50,
69
+ "selling_price": 25.00
70
+ }
71
+ ]
72
+ }
73
+ ```
74
+
75
+ ### Step 4: Summary Output
76
+ Display a receipt summary:
77
+ - **Vendor & Invoice #**
78
+ - **Restocked Items Table**: SKU, Item Name, Quantity Added, Cost Price, Selling Price
79
+ - **Total Inward Value & Tax**
80
+ - **Status**: Inventory and double-entry accounts updated.
@@ -0,0 +1,46 @@
1
+ ---
2
+ id: "cmd_adjust_stock"
3
+ name: "Adjust Stock Quantity"
4
+ slash: "/adjust-stock"
5
+ description: "Record damage, audit variances or stock corrections"
6
+ domain_tags: ["shop"]
7
+ required_tools: ["inventory_add_stock"]
8
+ ---
9
+
10
+ # Adjust Stock Quantity (`/adjust-stock`)
11
+
12
+ Record manual stock adjustments, breakage, damaged goods, return discrepancies, or cycle count audit variances.
13
+
14
+ ## Available Tools
15
+ - `inventory_add_stock(sku: string, quantity_delta: number, movement_type?: string, unit_cost?: number, reason?: string)`: Adjusts inventory balance and posts inventory shrinkage/variance accounting entries.
16
+
17
+ ## Accepted Arguments
18
+ - Increase stock (found surplus): `/adjust-stock sku:WDG-01 qty:+5 reason:"Audit surplus"`
19
+ - Decrease stock (damage/loss): `/adjust-stock sku:WDG-01 qty:-2 reason:"Broken during transit"`
20
+ - Natural language: `/adjust-stock 3 units of Tellzy 40 damaged`
21
+
22
+ ## Execution Protocol
23
+
24
+ ### Step 1: Parse Item & Delta
25
+ 1. Identify product SKU or item name.
26
+ 2. Determine `quantity_delta` (positive for additions, negative for write-offs).
27
+ 3. Determine movement type (e.g. `adjustment`, `shrinkage`, `damage`, `return`).
28
+ 4. Capture adjustment reason for audit trails.
29
+
30
+ ### Step 2: Execute Adjustment
31
+ Call `inventory_add_stock`:
32
+ ```json
33
+ {
34
+ "sku": "WDG-01",
35
+ "quantity_delta": -2,
36
+ "movement_type": "damage",
37
+ "reason": "Water damage in storage"
38
+ }
39
+ ```
40
+
41
+ ### Step 3: Confirmation
42
+ Output adjustment summary:
43
+ - **Product Name & SKU**
44
+ - **Adjustment**: -2 units (Damage Write-off)
45
+ - **New On Hand Balance**: Updated warehouse total
46
+ - **Accounting Note**: Inventory loss booked to double-entry ledger.
@@ -0,0 +1,12 @@
1
+ ---
2
+ id: "cmd_crm_brief"
3
+ name: "Client & Contact Brief"
4
+ slash: "/brief"
5
+ description: "Compile a concise contact brief with deals, billing, and thread history"
6
+ domain_tags: ["crm"]
7
+ required_tools: ["crm_search_contacts", "crm_get_contact", "crm_get_client_billing", "crm_add_note"]
8
+ ---
9
+
10
+ # Contact Brief (`/brief <contact>`)
11
+
12
+ Fetch full context (`crm_get_contact`) and billing (`crm_get_client_billing`), then save a concise brief note via `crm_add_note` using only internal mail, notes, and billing records.
@@ -0,0 +1,33 @@
1
+ ---
2
+ id: "cmd_capabilities"
3
+ name: "Platform Capabilities"
4
+ slash: "/capabilities"
5
+ description: "Discover all available BusinessKit platform capabilities"
6
+ domain_tags: ["system"]
7
+ required_tools: ["system_get_capabilities"]
8
+ ---
9
+
10
+ # Platform Capabilities (`/capabilities`)
11
+
12
+ Inspect active profile settings, enabled modules, store currency, tax configurations, and system toolsets.
13
+
14
+ ## Available Tools
15
+ - `system_get_capabilities()`: Queries the active profile's installed modules and runtime capabilities.
16
+
17
+ ## Accepted Arguments
18
+ - `/capabilities`
19
+
20
+ ## Execution Protocol
21
+
22
+ ### Step 1: Query System Capabilities
23
+ Call `system_get_capabilities()`:
24
+ ```json
25
+ {}
26
+ ```
27
+
28
+ ### Step 2: Present System Summary
29
+ Format a clean markdown report:
30
+ - **Active Profile**: Store Name, Profile ID, Currency, Location
31
+ - **Installed Modules**: Shop & POS, Pages & Landing Pages, Docs / Content, CRM, Domains, Inbox
32
+ - **Available MCP Tools**: Summary of active tool count
33
+ - **Tax & Compliance**: Active tax regime (e.g. GST, Sales Tax, VAT) and inclusive/exclusive pricing mode.
@@ -0,0 +1,12 @@
1
+ ---
2
+ id: "cmd_crm_chase"
3
+ name: "Chase Unpaid Invoices"
4
+ slash: "/chase"
5
+ description: "Find unpaid/overdue client invoices and save payment reminder drafts"
6
+ domain_tags: ["crm"]
7
+ required_tools: ["crm_search_contacts", "crm_get_client_billing", "crm_draft_payment_chase"]
8
+ ---
9
+
10
+ # Payment Chase (`/chase <contact>`)
11
+
12
+ Inspect unpaid/overdue invoices via `crm_get_client_billing` and save a draft reminder using `crm_draft_payment_chase` (draft only, never sent).
@@ -0,0 +1,43 @@
1
+ ---
2
+ id: "cmd_check_stock"
3
+ name: "Check Stock Levels"
4
+ slash: "/check-stock"
5
+ description: "Inspect inventory levels, reorder points & batches"
6
+ domain_tags: ["shop"]
7
+ required_tools: ["inventory_get_levels"]
8
+ ---
9
+
10
+ # Check Stock Levels (`/check-stock`)
11
+
12
+ Query current stock on hand, warehouse locations, reorder thresholds, and low-stock alerts.
13
+
14
+ ## Available Tools
15
+ - `inventory_get_levels(sku?: string, item_name?: string, low_stock_only?: boolean)`: Retrieves current inventory status across items.
16
+
17
+ ## Accepted Arguments
18
+ - All tracked inventory: `/check-stock`
19
+ - Specific item: `/check-stock Tellzy 40` or `/check-stock sku:SHIRT-01`
20
+ - Low stock items only: `/check-stock --low` or `/check-stock reorder`
21
+
22
+ ## Execution Protocol
23
+
24
+ ### Step 1: Query Inventory
25
+ Call `inventory_get_levels` with user filters:
26
+ ```json
27
+ {
28
+ "item_name": "<optional_filter>",
29
+ "low_stock_only": false
30
+ }
31
+ ```
32
+
33
+ ### Step 2: Format Inventory Overview
34
+ Present findings in a clear markdown table:
35
+
36
+ | Item Name | SKU | On Hand | Reorder Point | Status | Selling Price |
37
+ | :--- | :--- | :--- | :--- | :--- | :--- |
38
+ | Widget Pro | `WDG-PRO` | 142 | 20 | 🟢 In Stock | $49.99 |
39
+ | USB-C Cable | `CBL-USBC` | 4 | 25 | 🔴 Low Stock | $12.50 |
40
+
41
+ ### Step 3: Suggest Restocking or Adjustments
42
+ - If low stock detected, prompt: `/add-inventory-from-invoice` to restock.
43
+ - If physical audit variance found, suggest: `/adjust-stock <sku> <delta>`.