@businesskit/agent 1.0.5 → 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.
- package/.superconsole-plugin/plugin.json +61 -31
- package/AGENTS.md +20 -9
- package/README.md +101 -113
- package/bin/businesskit.js +41 -8
- package/commands/brief.md +12 -0
- package/commands/chase.md +12 -0
- package/commands/create-page.md +43 -15
- package/commands/crm.md +13 -0
- package/commands/followups.md +13 -0
- package/commands/pipeline.md +13 -0
- package/commands/update-agent.md +33 -0
- package/commands/update-content.md +1 -0
- package/commands/update-page.md +3 -2
- package/commands/write-blog.md +4 -0
- package/commands/write-docs.md +6 -0
- package/commands/write-guide.md +5 -0
- package/commands/write-newsletter.md +4 -0
- package/dist/server.js +4099 -0
- package/mcp_config.json +6 -2
- package/package.json +23 -5
- package/scripts/setup.sh +70 -35
- package/scripts/setup.ts +58 -21
- package/scripts/update.sh +56 -0
- package/server.json +3 -3
- package/skills/README.md +3 -2
- package/skills/cms/SKILL.md +111 -0
- package/skills/cms/references/cms-hubs.md +84 -0
- package/skills/cms/references/html-blocks.md +177 -0
- package/skills/crm/SKILL.md +15 -29
- package/skills/docs/SKILL.md +65 -0
- package/skills/docs/references/how-to.md +155 -0
- package/skills/pages/SKILL.md +62 -17
- package/skills/pages/references/sections-catalog.json +377 -144
- package/skills/social/SKILL.md +83 -210
- package/skills/social/evals/evals.json +66 -0
- package/skills/social/evals/rubric.md +26 -0
- package/skills/social/examples/repurposing-blog-to-social.md +93 -0
- package/skills/social/examples/weekly-content-calendar.md +30 -0
- package/skills/social/linkedin/SKILL.md +107 -0
- package/skills/social/linkedin/evals/evals.json +106 -0
- package/skills/social/linkedin/evals/rubric.md +28 -0
- package/skills/social/linkedin/examples/gasp-weekly-sprint.md +24 -0
- package/skills/social/linkedin/examples/growth-posts-by-format.md +140 -0
- package/skills/social/linkedin/references/gasp-funnel-and-calibration.md +90 -0
- package/skills/social/linkedin/references/six-growth-formats.md +114 -0
- package/skills/social/references/platforms.md +76 -0
- package/skills/social/references/post-templates.md +105 -0
- package/skills/social/references/reverse-engineering.md +62 -0
- package/src/data/sections-catalog.json +950 -0
- package/src/db.ts +170 -0
- package/src/server.ts +75 -0
- package/src/tools/content.ts +326 -0
- package/src/tools/crm.ts +1416 -0
- package/src/tools/domains.ts +89 -0
- package/src/tools/inbox.ts +270 -0
- package/src/tools/index.ts +116 -0
- package/src/tools/pages.ts +1217 -0
- package/src/tools/shop.ts +771 -0
- package/src/tools/system.ts +94 -0
- package/src/tools/types.ts +17 -0
- package/skills/docs-cms/SKILL.md +0 -53
- package/skills/docs-cms/references/how-to.md +0 -383
|
@@ -0,0 +1,94 @@
|
|
|
1
|
+
// src/tools/system.ts
|
|
2
|
+
// Platform Introspection & Profile Management MCP Tools
|
|
3
|
+
|
|
4
|
+
import { getActiveProfileId, setActiveProfileId, query, isDbConfigured } from '../db.js';
|
|
5
|
+
import type { ToolDefinition, ToolContext } from './types.js';
|
|
6
|
+
|
|
7
|
+
export const systemTools: ToolDefinition[] = [
|
|
8
|
+
{
|
|
9
|
+
name: 'system_get_capabilities',
|
|
10
|
+
domain: 'system',
|
|
11
|
+
description:
|
|
12
|
+
'Discover all available BusinessKit platform capabilities, domains, tool counts, and features. Call when the user asks what abilities, tools, or domains exist.',
|
|
13
|
+
inputSchema: {
|
|
14
|
+
type: 'object',
|
|
15
|
+
properties: {
|
|
16
|
+
domain: { type: 'string', description: "Optional domain filter (e.g. 'shop', 'crm', 'content', 'pages', 'domains')" },
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
handler: async (args: Record<string, any>, _ctx: ToolContext) => {
|
|
20
|
+
const filter = args.domain?.toLowerCase()?.trim();
|
|
21
|
+
const domains = [
|
|
22
|
+
{ name: 'shop', description: 'Shop, inventory restock, purchase invoices, billing, and stock ledger' },
|
|
23
|
+
{ name: 'crm', description: 'Customer relationship management, leads, contacts, and outreach' },
|
|
24
|
+
{
|
|
25
|
+
name: 'content',
|
|
26
|
+
description: 'Multi-hub CMS content publishing (blog, docs, guides, notes, newsletter) with rich HTML',
|
|
27
|
+
},
|
|
28
|
+
{ name: 'pages', description: 'Website pages, landing pages, site content, and publishing' },
|
|
29
|
+
{ name: 'domains', description: 'Domain portfolio management, RDAP status, expiry tracking, and renewal reminders' },
|
|
30
|
+
{ name: 'inbox', description: 'Unified inbox — thread triage, labelling, reply drafting, scheduling, and archiving' },
|
|
31
|
+
{ name: 'system', description: 'Platform introspection, profile switching, and agent system utilities' },
|
|
32
|
+
];
|
|
33
|
+
|
|
34
|
+
const matchingDomains = filter && filter !== 'all' ? domains.filter((d) => d.name === filter) : domains;
|
|
35
|
+
|
|
36
|
+
return {
|
|
37
|
+
platform: 'BusinessKit',
|
|
38
|
+
architecture: 'Model Context Protocol (MCP) stdio JSON-RPC server',
|
|
39
|
+
active_domains: matchingDomains,
|
|
40
|
+
database_connected: isDbConfigured(),
|
|
41
|
+
total_tools: 36,
|
|
42
|
+
};
|
|
43
|
+
},
|
|
44
|
+
},
|
|
45
|
+
{
|
|
46
|
+
name: 'profile_list',
|
|
47
|
+
domain: 'system',
|
|
48
|
+
description: 'List all business/organization profiles available in the active database and check which one is active.',
|
|
49
|
+
inputSchema: {
|
|
50
|
+
type: 'object',
|
|
51
|
+
properties: {},
|
|
52
|
+
},
|
|
53
|
+
handler: async (_args: Record<string, any>, ctx: ToolContext) => {
|
|
54
|
+
let profiles: any[] = [];
|
|
55
|
+
if (isDbConfigured()) {
|
|
56
|
+
try {
|
|
57
|
+
profiles = await query<{ id: string; title?: string; slug?: string }>('SELECT id, title, slug FROM profiles LIMIT 50');
|
|
58
|
+
} catch (err) {
|
|
59
|
+
console.error('[Profile] Profiles query error:', err);
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
return {
|
|
64
|
+
active_profile: ctx.profileId,
|
|
65
|
+
available_profiles: profiles.length > 0 ? profiles : [{ id: ctx.profileId, title: 'Default Business' }],
|
|
66
|
+
total: profiles.length > 0 ? profiles.length : 1,
|
|
67
|
+
};
|
|
68
|
+
},
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
name: 'profile_switch',
|
|
72
|
+
domain: 'system',
|
|
73
|
+
description: 'Switch the active business/organization profile for this MCP session.',
|
|
74
|
+
inputSchema: {
|
|
75
|
+
type: 'object',
|
|
76
|
+
properties: {
|
|
77
|
+
profile_id: { type: 'string', description: 'The profile ID to switch to' },
|
|
78
|
+
},
|
|
79
|
+
required: ['profile_id'],
|
|
80
|
+
},
|
|
81
|
+
handler: async (args: Record<string, any>, _ctx: ToolContext) => {
|
|
82
|
+
const newProfileId = String(args.profile_id).trim();
|
|
83
|
+
if (!newProfileId) {
|
|
84
|
+
throw new Error('profile_id is required');
|
|
85
|
+
}
|
|
86
|
+
setActiveProfileId(newProfileId);
|
|
87
|
+
return {
|
|
88
|
+
success: true,
|
|
89
|
+
active_profile: newProfileId,
|
|
90
|
+
status: 'switched',
|
|
91
|
+
};
|
|
92
|
+
},
|
|
93
|
+
},
|
|
94
|
+
];
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// src/tools/types.ts
|
|
2
|
+
// Shared types for BusinessKit MCP tools
|
|
3
|
+
|
|
4
|
+
export interface ToolDefinition {
|
|
5
|
+
name: string;
|
|
6
|
+
domain: string;
|
|
7
|
+
description: string;
|
|
8
|
+
inputSchema: Record<string, any>;
|
|
9
|
+
handler: (args: Record<string, any>, ctx: ToolContext) => Promise<any>;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export interface ToolContext {
|
|
13
|
+
profileId: string;
|
|
14
|
+
userId?: string;
|
|
15
|
+
agentName?: string;
|
|
16
|
+
mediaAttachmentId?: string;
|
|
17
|
+
}
|
package/skills/docs-cms/SKILL.md
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
---
|
|
2
|
-
name: docs-cms
|
|
3
|
-
description: Manage and publish technical documentation, knowledge base articles, guides, and blog posts via BusinessKit CMS tools.
|
|
4
|
-
---
|
|
5
|
-
|
|
6
|
-
# Docs & CMS Publishing Skill
|
|
7
|
-
|
|
8
|
-
Use this skill when the user asks to write, edit, format, or publish articles, knowledge base docs, guides, or blog posts.
|
|
9
|
-
|
|
10
|
-
## 1. Operating Rules & Constraints
|
|
11
|
-
|
|
12
|
-
- **Category ID**:
|
|
13
|
-
- Documentation / Knowledge Base: `category_id = "cat_32"`
|
|
14
|
-
- Blog: `category_id = "cat_35"`
|
|
15
|
-
- Guides: `category_id = "cat_36"`
|
|
16
|
-
- **Doc Titles**: Strictly **$\le$ 3 words** (e.g., `Install BusinessKit`, `Visual Page Editor`, `What Are Pages`).
|
|
17
|
-
- **SEO Titles**: Prefixed with the Domain name (e.g. `Pages: Visual Site Architecture`).
|
|
18
|
-
- **Semantic HTML**:
|
|
19
|
-
- Never use Markdown syntax (`##`, `*`, ` ``` `) inside `body_html` / `content`.
|
|
20
|
-
- Never use `<h1>` tags (the page layout generates `<h1>` from the title). Start with `<h2>`.
|
|
21
|
-
- Accordions must default to collapsed (`isOpen = false`, `aria-expanded="false"`).
|
|
22
|
-
- Task lists use `<ul data-type="taskList">` with semantic `<li data-type="taskItem">`.
|
|
23
|
-
|
|
24
|
-
## 2. Tool Workflows
|
|
25
|
-
|
|
26
|
-
### A. List Existing Articles
|
|
27
|
-
```json
|
|
28
|
-
call_tool("content_list", {
|
|
29
|
-
"category_id": "cat_32"
|
|
30
|
-
})
|
|
31
|
-
```
|
|
32
|
-
|
|
33
|
-
### B. Create / Publish Documentation Article
|
|
34
|
-
```json
|
|
35
|
-
call_tool("blog_post_create", {
|
|
36
|
-
"title": "What Are Pages",
|
|
37
|
-
"slug": "what-are-pages",
|
|
38
|
-
"category_id": "cat_32",
|
|
39
|
-
"collection_id": "col_pg_start",
|
|
40
|
-
"excerpt": "Visual website builder overview for BusinessKit.",
|
|
41
|
-
"seo_title": "Pages: Overview and Visual Site Architecture",
|
|
42
|
-
"body_html": "<h2>Overview</h2><p>Pages allows you to design storefronts...</p>",
|
|
43
|
-
"published": 1
|
|
44
|
-
})
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### C. Update Article
|
|
48
|
-
```json
|
|
49
|
-
call_tool("content_update", {
|
|
50
|
-
"id": "post_what_are_pages",
|
|
51
|
-
"content": "<h2>Updated Section</h2><p>Refined description...</p>"
|
|
52
|
-
})
|
|
53
|
-
```
|
|
@@ -1,383 +0,0 @@
|
|
|
1
|
-
# How-To: Publishing BusinessKit Documentation from Outside the App (MCP & Turso DB)
|
|
2
|
-
|
|
3
|
-
This guide documents the exact workflow, database schemas, semantic rules, and automation scripts used to author, manage, and publish documentation for **BusinessKit** from outside the desktop app (e.g. using an autonomous AI coding agent via MCP or direct database execution).
|
|
4
|
-
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
## 1. Operating Rules & Core Constraints
|
|
8
|
-
|
|
9
|
-
Whenever authoring or publishing docs, these constraints must always be respected:
|
|
10
|
-
|
|
11
|
-
| Constraint | Value / Rule | Why / Notes |
|
|
12
|
-
| :--- | :--- | :--- |
|
|
13
|
-
| **Target Profile** | `4628a5b1-ac05-4156-9d76-04bbd71119a1` | Profile title: **"BusinessKit"** (slug: `businesskit`). Never post to "BusinessKit India" or personal profiles. |
|
|
14
|
-
| **Category ID** | `cat_32` | Canonical identifier for the **docs** category. All documentation articles and subcollections must have `category_id = 'cat_32'`. |
|
|
15
|
-
| **Doc Title** | **$\le$ 3 words strictly** | E.g., `What Are Pages`, `Create New Page`, `Visual Page Editor`, `Install BusinessKit`. |
|
|
16
|
-
| **SEO Title** | Prefixed with Domain | E.g., `Pages: Visual Drag and Drop Canvas Editor`, `Deploy: Connect Cloudflare Pages`. |
|
|
17
|
-
| **No `<h1>` in HTML** | Prohibited in body | The article title is rendered by the layout as the primary `<h1>`. Body headings must start with `<h2>` then `<h3>`. |
|
|
18
|
-
| **Accordions** | Collapsed by default | Must have `isOpen = false` and `aria-expanded="false"`. |
|
|
19
|
-
| **Task Lists** | Pure semantic structure | No bullet markers. Uses vector SVG checkmarks without border hacks. |
|
|
20
|
-
| **Status Column** | `published = 1` | The database column is `published` (integer `1` or `0`). There is **no `status` column** and **no `summary` column** in `content`. |
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## 2. Database Architecture & Table Schemas
|
|
25
|
-
|
|
26
|
-
BusinessKit uses Turso (libSQL). Tech docs are powered by two primary tables:
|
|
27
|
-
|
|
28
|
-
### A. `collections` Table Schema
|
|
29
|
-
|
|
30
|
-
Organizes the sidebar navigation into root domains and nested subcollections.
|
|
31
|
-
|
|
32
|
-
```sql
|
|
33
|
-
CREATE TABLE collections (
|
|
34
|
-
id TEXT PRIMARY KEY, -- e.g., 'col_website', 'col_pg_start'
|
|
35
|
-
title TEXT NOT NULL, -- e.g., 'Website & Pages', 'Get Started'
|
|
36
|
-
slug TEXT NOT NULL, -- e.g., 'pages', 'pg-get-started'
|
|
37
|
-
category_id TEXT, -- MUST be 'cat_32' for docs
|
|
38
|
-
parent_id TEXT, -- NULL for root collections, parent id for subcollections
|
|
39
|
-
order_index INTEGER, -- Sequence number (1..20 for root; 1..n for subcollections)
|
|
40
|
-
sort_order INTEGER, -- Legacy sort weight (e.g. order_index * 10)
|
|
41
|
-
icon TEXT, -- Optional emoji or icon identifier
|
|
42
|
-
description TEXT -- Optional collection summary
|
|
43
|
-
);
|
|
44
|
-
```
|
|
45
|
-
|
|
46
|
-
#### Canonical Root Collection Order (`parent_id IS NULL`):
|
|
47
|
-
1. `col_docs_1` — Getting Started (`getting-started`)
|
|
48
|
-
2. `col_apps` — Apps (`apps`)
|
|
49
|
-
3. `col_dashboard` — Dashboard (`dashboard`)
|
|
50
|
-
4. `col_shop` — Shop (`shop`)
|
|
51
|
-
5. `col_products_inventory` — Products & Inventory (`products-inventory`)
|
|
52
|
-
6. `col_restaurant_cafe` — Restaurant & Café (`restaurant-cafe`)
|
|
53
|
-
7. `col_hotel_stays` — Hotel & Stays (`hotel-stays`)
|
|
54
|
-
8. `col_tax` — Tax (`tax`)
|
|
55
|
-
9. `col_accounts` — Accounts (`accounts`)
|
|
56
|
-
10. `col_link_in_bio` — Link in Bio (`link-in-bio`)
|
|
57
|
-
11. `col_website` — Website & Pages (`pages`)
|
|
58
|
-
12. `col_deploy` — Deploy (`deploy`)
|
|
59
|
-
13. `col_crm` — Crm (`crm`)
|
|
60
|
-
14. `col_social` — Social Media (`social`)
|
|
61
|
-
15. `col_store` — Online Store (`store`)
|
|
62
|
-
16. `col_content_cms` — Content & CMS (`content`)
|
|
63
|
-
17. `col_chat_agent` — Chat Agent (`chat-agent`)
|
|
64
|
-
18. `col_agents` — Autonomous Agents (`agents`)
|
|
65
|
-
19. `col_settings_account` — Settings & Account (`settings-account`)
|
|
66
|
-
20. `col_help_support` — Help & Support (`help`)
|
|
67
|
-
50. `col_fc5e3fb2c532` — Architecture & Core Systems (`architecture-core-systems`)
|
|
68
|
-
51. `col_docs_5` — API & Integrations (`api-and-integrations`)
|
|
69
|
-
|
|
70
|
-
> [!NOTE]
|
|
71
|
-
> Main collection titles must be **Capitalized, not ALL CAPITAL** (e.g. `Crm` instead of `CRM`). The sidebar auto-capitalizes via `formatCollectionTitle()`, but database consistency is preferred.
|
|
72
|
-
|
|
73
|
-
---
|
|
74
|
-
|
|
75
|
-
### B. `content` Table Schema
|
|
76
|
-
|
|
77
|
-
Holds the actual documentation articles and markdown/HTML payloads.
|
|
78
|
-
|
|
79
|
-
```sql
|
|
80
|
-
INSERT INTO content (
|
|
81
|
-
id, -- Primary key, e.g. 'post_what_are_pages'
|
|
82
|
-
profile_id, -- '4628a5b1-ac05-4156-9d76-04bbd71119a1' ("BusinessKit")
|
|
83
|
-
user_id, -- Creator user ID
|
|
84
|
-
updated_by, -- Updating user ID
|
|
85
|
-
title, -- 3 words max, e.g. 'What Are Pages'
|
|
86
|
-
slug, -- URL slug, e.g. 'what-are-pages'
|
|
87
|
-
content, -- Pure semantic HTML (no Markdown, no <h1>)
|
|
88
|
-
excerpt, -- Concise 1-2 sentence overview for SEO & previews
|
|
89
|
-
published, -- 1 = published, 0 = draft
|
|
90
|
-
category_id, -- MUST be 'cat_32'
|
|
91
|
-
collection_id, -- Target child collection ID (e.g. 'col_pg_start')
|
|
92
|
-
order_index, -- Article display order within collection (1, 2, 3...)
|
|
93
|
-
seo_title, -- Prefixed SEO title (e.g. 'Pages: Visual Site Architecture')
|
|
94
|
-
created_at, -- Unix timestamp (seconds)
|
|
95
|
-
updated_at -- Unix timestamp (seconds)
|
|
96
|
-
) VALUES (...);
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
> [!WARNING]
|
|
100
|
-
> Do **NOT** pass `status: 'published'` or `summary: '...'` in your SQL queries. The columns are `published` (integer `1`) and `excerpt`.
|
|
101
|
-
|
|
102
|
-
---
|
|
103
|
-
|
|
104
|
-
## 3. Semantic HTML Guidelines for `content`
|
|
105
|
-
|
|
106
|
-
When writing the article body HTML:
|
|
107
|
-
|
|
108
|
-
### A. Section Headings
|
|
109
|
-
```html
|
|
110
|
-
<h2>First Major Topic</h2>
|
|
111
|
-
<p>Explaining the architecture and functionality.</p>
|
|
112
|
-
|
|
113
|
-
<h3>Subtopic or Specific Flow</h3>
|
|
114
|
-
<p>Step-by-step description.</p>
|
|
115
|
-
```
|
|
116
|
-
|
|
117
|
-
### B. Task Lists & Checkboxes
|
|
118
|
-
Task lists must use the standard TipTap/Docs schema:
|
|
119
|
-
```html
|
|
120
|
-
<ul data-type="taskList" class="task-list tech-task-list">
|
|
121
|
-
<li data-type="taskItem" class="task-list-item tech-task-item">
|
|
122
|
-
<label><input type="checkbox" checked="checked" /></label>
|
|
123
|
-
<div><p>Complete initial setup in the Pages workspace.</p></div>
|
|
124
|
-
</li>
|
|
125
|
-
<li data-type="taskItem" class="task-list-item tech-task-item">
|
|
126
|
-
<label><input type="checkbox" /></label>
|
|
127
|
-
<div><p>Attach custom components to the canvas.</p></div>
|
|
128
|
-
</li>
|
|
129
|
-
</ul>
|
|
130
|
-
```
|
|
131
|
-
|
|
132
|
-
### C. Collapsible Accordions (Must Be Collapsed by Default)
|
|
133
|
-
```html
|
|
134
|
-
<div data-type="accordion-group" class="tech-accordion-group">
|
|
135
|
-
<div data-type="accordion-item" class="tech-accordion-item" aria-expanded="false">
|
|
136
|
-
<div data-type="accordion-title" class="tech-accordion-title">How do templates differ from native sections?</div>
|
|
137
|
-
<div data-type="accordion-content" class="tech-accordion-content" hidden="hidden">
|
|
138
|
-
<p>Native sections adapt their colors to the profile theme token automatically, while templates provide full-page layouts.</p>
|
|
139
|
-
</div>
|
|
140
|
-
</div>
|
|
141
|
-
</div>
|
|
142
|
-
```
|
|
143
|
-
|
|
144
|
-
### D. Callout Cards
|
|
145
|
-
```html
|
|
146
|
-
<div data-type="info-card" class="tech-callout tech-callout--info" role="note">
|
|
147
|
-
<p><strong>Note:</strong> Changes made in the Visual Editor are auto-saved locally before publishing.</p>
|
|
148
|
-
</div>
|
|
149
|
-
```
|
|
150
|
-
|
|
151
|
-
### E. Code Blocks
|
|
152
|
-
Always HTML-escape `<` as `<` and `>` as `>`:
|
|
153
|
-
```html
|
|
154
|
-
<pre><code class="language-bash">npm run build
|
|
155
|
-
curl -X POST https://api.businesskit.io/v1/pages</code></pre>
|
|
156
|
-
```
|
|
157
|
-
|
|
158
|
-
---
|
|
159
|
-
|
|
160
|
-
## 4. Publishing Methods
|
|
161
|
-
|
|
162
|
-
### Method A: Via BusinessKit MCP Tools
|
|
163
|
-
|
|
164
|
-
If the agent environment has the `businesskit` MCP server loaded:
|
|
165
|
-
|
|
166
|
-
1. **Verify / Switch Active Profile**:
|
|
167
|
-
```json
|
|
168
|
-
// 1. List profiles to confirm ID
|
|
169
|
-
call_mcp_tool("businesskit", "profile_list", {})
|
|
170
|
-
|
|
171
|
-
// 2. Switch if not already on BusinessKit profile
|
|
172
|
-
call_mcp_tool("businesskit", "profile_switch", {
|
|
173
|
-
"profile_id": "4628a5b1-ac05-4156-9d76-04bbd71119a1"
|
|
174
|
-
})
|
|
175
|
-
```
|
|
176
|
-
|
|
177
|
-
2. **Publish Content**:
|
|
178
|
-
```json
|
|
179
|
-
call_mcp_tool("businesskit", "blog_post_create", {
|
|
180
|
-
"title": "What Are Pages",
|
|
181
|
-
"slug": "what-are-pages",
|
|
182
|
-
"category_id": "cat_32",
|
|
183
|
-
"collection_id": "col_pg_start",
|
|
184
|
-
"body_html": "<h2>Overview</h2><p>Pages visual builder...</p>",
|
|
185
|
-
"excerpt": "Visual website builder overview for BusinessKit.",
|
|
186
|
-
"seo_title": "Pages: Overview and Visual Site Architecture",
|
|
187
|
-
"published": 1
|
|
188
|
-
})
|
|
189
|
-
```
|
|
190
|
-
|
|
191
|
-
---
|
|
192
|
-
|
|
193
|
-
### Method B: Via Direct Turso Database Script (Recommended for Batch Docs)
|
|
194
|
-
|
|
195
|
-
When managing a domain with 5–30 articles and nested collections, executing a Node.js batch script is the fastest, atomic, and most reliable method.
|
|
196
|
-
|
|
197
|
-
#### 1. Database Connection Utility (`turso-userdb.js`)
|
|
198
|
-
|
|
199
|
-
```javascript
|
|
200
|
-
// scratch/turso-userdb.js
|
|
201
|
-
const fs = require('fs');
|
|
202
|
-
const path = require('path');
|
|
203
|
-
|
|
204
|
-
// Extract user DB credentials from credentials cache or env
|
|
205
|
-
const credsPath = path.join(process.env.HOME, 'Library/Application Support/io.businesskit.app/credentials.json');
|
|
206
|
-
let dbUrl = process.env.TURSO_USER_DATABASE_URL;
|
|
207
|
-
let dbToken = process.env.TURSO_USER_AUTH_TOKEN;
|
|
208
|
-
|
|
209
|
-
if (!dbUrl && fs.existsSync(credsPath)) {
|
|
210
|
-
const creds = JSON.parse(fs.readFileSync(credsPath, 'utf8'));
|
|
211
|
-
dbUrl = creds.user_db_url;
|
|
212
|
-
dbToken = creds.user_db_token;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
async function execute(sql, args = []) {
|
|
216
|
-
const endpoint = `${dbUrl.replace(/^libsql:\/\//, 'https://')}/v2/pipeline`;
|
|
217
|
-
const response = await fetch(endpoint, {
|
|
218
|
-
method: 'POST',
|
|
219
|
-
headers: {
|
|
220
|
-
'Authorization': `Bearer ${dbToken}`,
|
|
221
|
-
'Content-Type': 'application/json',
|
|
222
|
-
},
|
|
223
|
-
body: JSON.stringify({
|
|
224
|
-
requests: [{ type: 'execute', stmt: { sql, args } }],
|
|
225
|
-
}),
|
|
226
|
-
});
|
|
227
|
-
|
|
228
|
-
const json = await response.json();
|
|
229
|
-
if (json.results?.[0]?.type === 'error') {
|
|
230
|
-
throw new Error(`SQLite error: ${json.results[0].error.message}`);
|
|
231
|
-
}
|
|
232
|
-
return json.results?.[0]?.response?.result;
|
|
233
|
-
}
|
|
234
|
-
|
|
235
|
-
module.exports = { execute };
|
|
236
|
-
```
|
|
237
|
-
|
|
238
|
-
#### 2. Batch Collection & Article Publishing Script Template
|
|
239
|
-
|
|
240
|
-
```javascript
|
|
241
|
-
// scratch/publish-domain-docs.js
|
|
242
|
-
const fs = require('fs');
|
|
243
|
-
const path = require('path');
|
|
244
|
-
const { execute } = require('./turso-userdb');
|
|
245
|
-
|
|
246
|
-
const PROFILE_ID = '4628a5b1-ac05-4156-9d76-04bbd71119a1';
|
|
247
|
-
const USER_ID = 'a1b2c3d4-0001-4000-8000-000000000001';
|
|
248
|
-
const CATEGORY_ID = 'cat_32';
|
|
249
|
-
|
|
250
|
-
async function main() {
|
|
251
|
-
console.log("Setting up collections...");
|
|
252
|
-
|
|
253
|
-
// 1. Create or update Parent Root Collection
|
|
254
|
-
await execute(`
|
|
255
|
-
INSERT INTO collections (id, title, slug, category_id, parent_id, order_index, sort_order)
|
|
256
|
-
VALUES ('col_domain', 'Domain Title', 'domain-slug', '${CATEGORY_ID}', NULL, 11, 110)
|
|
257
|
-
ON CONFLICT(id) DO UPDATE SET title = 'Domain Title', slug = 'domain-slug', order_index = 11
|
|
258
|
-
`);
|
|
259
|
-
|
|
260
|
-
// 2. Create Child Collections
|
|
261
|
-
const subcollections = [
|
|
262
|
-
{ id: 'col_dom_start', title: 'Get Started', slug: 'dom-get-started', order: 1 },
|
|
263
|
-
{ id: 'col_dom_features', title: 'Features', slug: 'dom-features', order: 2 }
|
|
264
|
-
];
|
|
265
|
-
|
|
266
|
-
for (const sub of subcollections) {
|
|
267
|
-
await execute(`
|
|
268
|
-
INSERT INTO collections (id, title, slug, category_id, parent_id, order_index, sort_order)
|
|
269
|
-
VALUES ('${sub.id}', '${sub.title}', '${sub.slug}', '${CATEGORY_ID}', 'col_domain', ${sub.order}, ${sub.order * 10})
|
|
270
|
-
ON CONFLICT(id) DO UPDATE SET title = '${sub.title}', slug = '${sub.slug}', parent_id = 'col_domain', order_index = ${sub.order}
|
|
271
|
-
`);
|
|
272
|
-
}
|
|
273
|
-
|
|
274
|
-
// 3. Insert and Publish Articles
|
|
275
|
-
const articles = [
|
|
276
|
-
{
|
|
277
|
-
title: "What Are Pages",
|
|
278
|
-
slug: "what-are-pages",
|
|
279
|
-
collection_id: "col_dom_start",
|
|
280
|
-
order_index: 1,
|
|
281
|
-
seo_title: "Domain: Overview and Architecture",
|
|
282
|
-
excerpt: "High-level overview of the feature set.",
|
|
283
|
-
html: `<h2>Overview</h2><p>Feature explanation...</p>`
|
|
284
|
-
}
|
|
285
|
-
];
|
|
286
|
-
|
|
287
|
-
const now = Math.floor(Date.now() / 1000);
|
|
288
|
-
|
|
289
|
-
for (const art of articles) {
|
|
290
|
-
const id = `post_${art.slug.replace(/-/g, '_')}`;
|
|
291
|
-
const escapedContent = art.html.replace(/'/g, "''");
|
|
292
|
-
const escapedExcerpt = art.excerpt.replace(/'/g, "''");
|
|
293
|
-
const escapedTitle = art.title.replace(/'/g, "''");
|
|
294
|
-
const escapedSeo = art.seo_title.replace(/'/g, "''");
|
|
295
|
-
|
|
296
|
-
const sql = `INSERT INTO content (
|
|
297
|
-
id, profile_id, user_id, updated_by, title, slug, content, excerpt,
|
|
298
|
-
published, category_id, collection_id, order_index, seo_title,
|
|
299
|
-
created_at, updated_at
|
|
300
|
-
) VALUES (
|
|
301
|
-
'${id}', '${PROFILE_ID}', '${USER_ID}', '${USER_ID}', '${escapedTitle}', '${art.slug}',
|
|
302
|
-
'${escapedContent}', '${escapedExcerpt}',
|
|
303
|
-
1, '${CATEGORY_ID}', '${art.collection_id}', ${art.order_index}, '${escapedSeo}',
|
|
304
|
-
${now}, ${now}
|
|
305
|
-
) ON CONFLICT(id) DO UPDATE SET
|
|
306
|
-
profile_id = '${PROFILE_ID}',
|
|
307
|
-
title = '${escapedTitle}',
|
|
308
|
-
slug = '${art.slug}',
|
|
309
|
-
content = '${escapedContent}',
|
|
310
|
-
excerpt = '${escapedExcerpt}',
|
|
311
|
-
published = 1,
|
|
312
|
-
category_id = '${CATEGORY_ID}',
|
|
313
|
-
collection_id = '${art.collection_id}',
|
|
314
|
-
order_index = ${art.order_index},
|
|
315
|
-
seo_title = '${escapedSeo}',
|
|
316
|
-
updated_at = ${now}`;
|
|
317
|
-
|
|
318
|
-
await execute(sql);
|
|
319
|
-
console.log(`Published ${art.title} -> ${art.collection_id}`);
|
|
320
|
-
}
|
|
321
|
-
}
|
|
322
|
-
|
|
323
|
-
main().catch(console.error);
|
|
324
|
-
```
|
|
325
|
-
|
|
326
|
-
---
|
|
327
|
-
|
|
328
|
-
## 5. Dual Persistence: Saving Local Markdown Files
|
|
329
|
-
|
|
330
|
-
Every published documentation article must also exist as a local markdown file under:
|
|
331
|
-
`/Users/2.o/businesskit/documentation/content/<domain>/<slug>.md`
|
|
332
|
-
|
|
333
|
-
### Markdown File Format with YAML Frontmatter
|
|
334
|
-
|
|
335
|
-
```markdown
|
|
336
|
-
---
|
|
337
|
-
title: "What Are Pages"
|
|
338
|
-
slug: "what-are-pages"
|
|
339
|
-
seo_title: "Pages: Overview and Visual Site Architecture"
|
|
340
|
-
excerpt: "Understand how Pages lets you build responsive storefronts and landing pages with custom components."
|
|
341
|
-
collection_id: "col_pg_start"
|
|
342
|
-
category_id: "cat_32"
|
|
343
|
-
order_index: 1
|
|
344
|
-
published: true
|
|
345
|
-
created_at: 1732204800
|
|
346
|
-
---
|
|
347
|
-
|
|
348
|
-
<h2>Visual Site Architecture</h2>
|
|
349
|
-
<p>Pages is BusinessKit's visual website builder...</p>
|
|
350
|
-
```
|
|
351
|
-
|
|
352
|
-
---
|
|
353
|
-
|
|
354
|
-
## 6. Verification & Health Check
|
|
355
|
-
|
|
356
|
-
After creating or updating docs, always perform these 3 verification steps:
|
|
357
|
-
|
|
358
|
-
1. **Verify Database Records**:
|
|
359
|
-
```bash
|
|
360
|
-
node -e "
|
|
361
|
-
const { execute } = require('./scratch/turso-userdb');
|
|
362
|
-
async function test() {
|
|
363
|
-
const res = await execute(\"SELECT id, title, slug, collection_id, published FROM content WHERE category_id = 'cat_32' AND collection_id = 'YOUR_COL_ID'\");
|
|
364
|
-
console.log(res.rows);
|
|
365
|
-
}
|
|
366
|
-
test();
|
|
367
|
-
"
|
|
368
|
-
```
|
|
369
|
-
|
|
370
|
-
2. **Verify Sidebar Capitalization & Typography**:
|
|
371
|
-
- Confirm root collections use Capitalized words (e.g. `Crm`, not `CRM`).
|
|
372
|
-
- Confirm font weights use `400` with `-webkit-font-smoothing: antialiased`.
|
|
373
|
-
|
|
374
|
-
3. **Run Web Production Build**:
|
|
375
|
-
```bash
|
|
376
|
-
npm --prefix /Users/2.o/businesskit/businesskit-web run build
|
|
377
|
-
```
|
|
378
|
-
Must output:
|
|
379
|
-
- `✓ Built client modules`
|
|
380
|
-
- `✓ Built server (ssr) modules`
|
|
381
|
-
- `✓ Type checked`
|
|
382
|
-
- `✓ Lint checked`
|
|
383
|
-
- Zero compilation or SSR routing errors.
|