@businesskit/agent 1.0.4 → 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 (153) 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 -84
  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/setup.sh +134 -0
  38. package/scripts/setup.ts +92 -0
  39. package/server.json +21 -0
  40. package/skills/README.md +19 -27
  41. package/skills/billing/SKILL.md +64 -0
  42. package/skills/brand/SKILL.md +30 -86
  43. package/skills/copywriting/SKILL.md +1 -1
  44. package/skills/crm/SKILL.md +38 -0
  45. package/skills/docs-cms/SKILL.md +53 -0
  46. package/skills/docs-cms/references/how-to.md +383 -0
  47. package/skills/inbox/SKILL.md +49 -0
  48. package/skills/inventory/SKILL.md +69 -0
  49. package/skills/pages/SKILL.md +169 -0
  50. package/skills/pages/references/sections-catalog.json +950 -0
  51. package/skills/social/SKILL.md +1 -1
  52. package/templates/antigravity.json +8 -0
  53. package/templates/claude-code.mcp.json +8 -0
  54. package/templates/cursor.mcp.json +8 -0
  55. package/templates/vscode.mcp.json +9 -0
  56. package/.claude/commands/analytics.md +0 -7
  57. package/.claude/commands/blog-writer.md +0 -9
  58. package/.claude/commands/cbo.md +0 -7
  59. package/.claude/commands/ceo.md +0 -10
  60. package/.claude/commands/cmo.md +0 -7
  61. package/.claude/commands/compress.md +0 -73
  62. package/.claude/commands/coo.md +0 -11
  63. package/.claude/commands/copywriter.md +0 -15
  64. package/.claude/commands/course-creator.md +0 -9
  65. package/.claude/commands/crm.md +0 -591
  66. package/.claude/commands/deep.md +0 -50
  67. package/.claude/commands/docs-writer.md +0 -8
  68. package/.claude/commands/forms-builder.md +0 -10
  69. package/.claude/commands/ingest.md +0 -110
  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/.claude/settings.json +0 -16
  80. package/.claude/settings.local.json +0 -11
  81. package/.env.example +0 -12
  82. package/.mcp.json +0 -3
  83. package/HEARTBEAT.md +0 -105
  84. package/PLAN.md +0 -345
  85. package/PRD-Agent-Composition.md +0 -149
  86. package/PRD-Agent-Harness.md +0 -316
  87. package/REFERENCE.md +0 -160
  88. package/SOUL.md +0 -148
  89. package/SYSTEM.md +0 -71
  90. package/agents/_base.ts +0 -371
  91. package/agents/analytics/SOUL.md +0 -11
  92. package/agents/analytics/analytics.ts +0 -405
  93. package/agents/business/SOUL.md +0 -11
  94. package/agents/business/business.ts +0 -109
  95. package/agents/ceo/SOUL.md +0 -15
  96. package/agents/ceo/ceo.ts +0 -146
  97. package/agents/content/SOUL.md +0 -11
  98. package/agents/content/content.ts +0 -379
  99. package/agents/copywriting/SOUL.md +0 -11
  100. package/agents/copywriting/copywriting.ts +0 -89
  101. package/agents/courses/SOUL.md +0 -11
  102. package/agents/courses/courses.ts +0 -451
  103. package/agents/docs/SOUL.md +0 -11
  104. package/agents/docs/docs.ts +0 -77
  105. package/agents/forms/SOUL.md +0 -11
  106. package/agents/forms/forms.ts +0 -364
  107. package/agents/hiring/SOUL.md +0 -11
  108. package/agents/hiring/hiring.ts +0 -314
  109. package/agents/marketing/SOUL.md +0 -15
  110. package/agents/marketing/marketing.ts +0 -109
  111. package/agents/newsletter/SOUL.md +0 -11
  112. package/agents/newsletter/newsletter.ts +0 -91
  113. package/agents/operations/SOUL.md +0 -11
  114. package/agents/operations/operations.ts +0 -157
  115. package/agents/sales/SOUL.md +0 -44
  116. package/agents/sales/sales.ts +0 -883
  117. package/agents/scheduler/SOUL.md +0 -11
  118. package/agents/scheduler/scheduler.ts +0 -68
  119. package/agents/seo/SOUL.md +0 -11
  120. package/agents/seo/seo.ts +0 -288
  121. package/agents/social/SOUL.md +0 -11
  122. package/agents/social/social.ts +0 -744
  123. package/agents/store/SOUL.md +0 -11
  124. package/agents/store/store.ts +0 -514
  125. package/cli.ts +0 -144
  126. package/context/about-me.md +0 -96
  127. package/context/brand-voice.md +0 -127
  128. package/context/brand.md +0 -80
  129. package/context/business.md +0 -66
  130. package/context/working-style.md +0 -87
  131. package/lib/analytics.ts +0 -81
  132. package/lib/cms.ts +0 -88
  133. package/lib/db.adapter.ts +0 -30
  134. package/lib/db.ts +0 -63
  135. package/lib/enums.ts +0 -25
  136. package/lib/groups.ts +0 -122
  137. package/lib/id.ts +0 -43
  138. package/lib/kb.ts +0 -337
  139. package/lib/memory.ts +0 -219
  140. package/lib/pattern-detector.ts +0 -169
  141. package/lib/profile.ts +0 -155
  142. package/lib/schema.ts +0 -2015
  143. package/lib/slug.ts +0 -30
  144. package/lib/validate.ts +0 -33
  145. package/setup.ts +0 -141
  146. package/skills/agents/SKILL.md +0 -56
  147. package/skills/analytics/SKILL.md +0 -52
  148. package/skills/blog-writer/SKILL.md +0 -452
  149. package/skills/ceo/SKILL.md +0 -25
  150. package/skills/cmo/SKILL.md +0 -8
  151. package/skills/schema/SKILL.md +0 -86
  152. package/skills/store/SKILL.md +0 -62
  153. package/tsconfig.json +0 -14
@@ -1,379 +0,0 @@
1
- /**
2
- * Content Agent — unified CMS writer (SEObot-quality).
3
- *
4
- * DB reality (see businesskit-files/content.ts):
5
- * There is no `posts` / `notes` / `guides` / `compare` / `newsletter` table.
6
- * Everything lives in ONE table: `content`. The "type" of content is
7
- * encoded by `cms_id` (→ one row per section in the `cms` table, which in
8
- * turn has a `category_id` like `cat_35` for blog, `cat_37` for notes, etc).
9
- *
10
- * Analytics are trigger-maintained:
11
- * - content_analytics (1 row per content item) — scalar counts + JSON
12
- * breakdowns. JSON is lazy-aggregated on dashboard page visit;
13
- * `last_aggregated_at` throttles rebuilds. AGENTS MUST NOT REBUILD.
14
- * - cms_analytics (1 row per cms page) — total_posts / total_draft /
15
- * total_published maintained by trg_content_insert / update / delete.
16
- *
17
- * Supported kinds (pick one; maps to cms_id via category_id):
18
- * blog, notes, guides, newsletter, compare, alternative, prompt, skills
19
- *
20
- * Quality bar (from SEObot research):
21
- * - Min 1500 words for blog, 2500+ for ultimate-guide
22
- * - SEO title ≤60 chars, meta description ≤160 chars
23
- * - Excerpt is a hook sentence, not a summary
24
- * - internal_links count maintained, sources JSON cited when factual
25
- */
26
-
27
- import { BaseAgent, db, ulid, iso } from '../_base.ts'
28
- import { logMemory } from '../../lib/memory.ts'
29
- import { ensureCmsRow } from '../../lib/cms.ts'
30
-
31
- // ── Content "kinds" — the logical content type. Maps to cms_id at write. ────
32
- // Kept as a stable public API so other agents (seo, operations, ceo, marketing)
33
- // don't have to know about cms_id internals.
34
- export type ContentKind =
35
- | 'blog' | 'notes' | 'guides' | 'newsletter'
36
- | 'compare' | 'alternative' | 'prompt' | 'skills'
37
-
38
- // Back-compat alias — old callers said `ContentTable`, same values.
39
- export type ContentTable = ContentKind
40
-
41
- export type ContentType =
42
- | 'blog'
43
- | 'listicle'
44
- | 'how-to'
45
- | 'checklist'
46
- | 'qa'
47
- | 'versus'
48
- | 'roundup'
49
- | 'news'
50
- | 'ultimate-guide'
51
- | 'programmatic'
52
-
53
- export interface WriteInput {
54
- title: string
55
- kind?: ContentKind // default: 'blog'
56
- table?: ContentTable // back-compat alias for `kind`
57
- topic?: string
58
- content_type?: ContentType
59
- target_keywords?: string[]
60
- word_count_target?: number
61
- collection_id?: string
62
- publish?: boolean
63
- }
64
-
65
- export interface WriteResult {
66
- id: string
67
- kind: ContentKind
68
- slug: string
69
- title: string
70
- word_count: number
71
- content_type: ContentType
72
- seo_title: string
73
- seo_description: string
74
- published: boolean
75
- url: string
76
- }
77
-
78
- // Logical kind → category_id (seeded, stable — see DEFAULT_CMS_PAGES).
79
- const KIND_CATEGORY: Record<ContentKind, string> = {
80
- blog: 'cat_35',
81
- notes: 'cat_37',
82
- guides: 'cat_36',
83
- newsletter: 'cat_20',
84
- compare: 'cat_40',
85
- alternative: 'cat_41',
86
- prompt: 'cat_39',
87
- skills: 'cat_38',
88
- }
89
-
90
- // Public URL path per kind — blog lives under /blog, everything else under /<kind>.
91
- const KIND_ROUTE: Record<ContentKind, string> = {
92
- blog: 'blog',
93
- notes: 'notes',
94
- guides: 'guides',
95
- newsletter: 'n',
96
- compare: 'compare',
97
- alternative: 'alternative',
98
- prompt: 'prompt',
99
- skills: 'skills',
100
- }
101
-
102
- // Word-count target per content_type
103
- const WORD_TARGETS: Record<ContentType, number> = {
104
- 'blog': 1500,
105
- 'listicle': 2000,
106
- 'how-to': 2000,
107
- 'checklist': 1200,
108
- 'qa': 1500,
109
- 'versus': 2000,
110
- 'roundup': 2000,
111
- 'news': 800,
112
- 'ultimate-guide': 3000,
113
- 'programmatic': 1000,
114
- }
115
-
116
- // `versus` is the content_type that belongs in the `compare` kind
117
- const TYPE_KIND: Partial<Record<ContentType, ContentKind>> = {
118
- 'versus': 'compare',
119
- }
120
-
121
- /** Resolve a cms_id for a logical content kind — creates missing rows on demand. */
122
- export async function getCmsId(profileId: string, kind: ContentKind): Promise<string> {
123
- return ensureCmsRow(profileId, KIND_CATEGORY[kind], {
124
- slug: KIND_ROUTE[kind],
125
- title: kind.charAt(0).toUpperCase() + kind.slice(1),
126
- })
127
- }
128
-
129
- export class BlogWriter extends BaseAgent {
130
- readonly name = 'Content'
131
- readonly title = 'Content Agent'
132
-
133
- // ── Write new content ──────────────────────────────────────────────────────
134
-
135
- async write(input: WriteInput): Promise<WriteResult> {
136
- await this.init()
137
-
138
- const contentType = input.content_type ?? 'blog'
139
- const kind = input.kind ?? input.table ?? TYPE_KIND[contentType] ?? 'blog'
140
- const wordTarget = input.word_count_target ?? WORD_TARGETS[contentType]
141
- const keywords = input.target_keywords ?? []
142
-
143
- const cms_id = await getCmsId(this.profileId, kind)
144
- const slug = await this.makeSlug(input.title, cms_id)
145
- const id = ulid()
146
- const ts = iso()
147
-
148
- // Structural hint — Claude writes actual content when invoked via CLI/Code.
149
- const structureHint = this.structureForType(contentType, wordTarget, keywords)
150
- const content = await this.generateContent(input.title, input.topic ?? input.title, structureHint, keywords)
151
- const excerpt = await this.generateExcerpt(content, contentType)
152
- const seoTitle = await this.generateSEOTitle(input.title, keywords)
153
- const seoDesc = await this.generateSEODescription(content, keywords)
154
- const wordCount = this.countWords(content)
155
- const readingTime = Math.ceil(wordCount / 200)
156
- const internalLinks = await this.countInternalLinks(input.title, keywords)
157
-
158
- await db.write({
159
- sql: `INSERT INTO content
160
- (id, cms_id, category_id, profile_id, user_id, slug, title,
161
- content, excerpt, published, hidden, collection_id,
162
- seo_title, seo_description, seo_keywords,
163
- word_count, reading_time_mins, internal_links, sources,
164
- created_at, updated_at)
165
- VALUES (?,?,?,?,?,?,?,?,?,?,0,?,?,?,?,?,?,?,'[]',?,?)`,
166
- args: [
167
- id, cms_id, KIND_CATEGORY[kind], this.profileId, this.userId, slug, input.title,
168
- content, excerpt, input.publish ? 1 : 0,
169
- input.collection_id ?? null,
170
- seoTitle, seoDesc,
171
- keywords.length ? JSON.stringify(keywords) : null,
172
- wordCount, readingTime, internalLinks,
173
- ts, ts,
174
- ],
175
- })
176
-
177
- await logMemory(this.agentType,
178
- `${input.publish ? 'Published' : 'Drafted'} "${input.title}" (${kind}/${contentType}, ${wordCount} words)`,
179
- { id, kind, slug, content_type: contentType, word_count: wordCount })
180
-
181
- return {
182
- id, kind, slug, title: input.title,
183
- word_count: wordCount, content_type: contentType,
184
- seo_title: seoTitle, seo_description: seoDesc,
185
- published: !!input.publish,
186
- url: `https://${this.ctx.profile.slug}.businesskit.io/${KIND_ROUTE[kind]}/${slug}`,
187
- }
188
- }
189
-
190
- // ── List + manage (unified table, filter by cms_id/kind) ──────────────────
191
-
192
- async listDrafts(kind: ContentKind = 'blog') {
193
- await this.init()
194
- const cms_id = await getCmsId(this.profileId, kind)
195
- const { rows } = await db.execute({
196
- sql: `SELECT id, title, slug, word_count, created_at, updated_at
197
- FROM content
198
- WHERE profile_id=? AND cms_id=? AND published=0 AND hidden=0
199
- ORDER BY updated_at DESC LIMIT 20`,
200
- args: [this.profileId, cms_id],
201
- })
202
- return rows
203
- }
204
-
205
- async listPublished(kind: ContentKind = 'blog', limit = 20) {
206
- await this.init()
207
- const cms_id = await getCmsId(this.profileId, kind)
208
- const { rows } = await db.execute({
209
- sql: `SELECT id, title, slug, word_count, created_at, updated_at
210
- FROM content
211
- WHERE profile_id=? AND cms_id=? AND published=1 AND hidden=0
212
- ORDER BY updated_at DESC LIMIT ?`,
213
- args: [this.profileId, cms_id, limit],
214
- })
215
- return rows
216
- }
217
-
218
- /** Publish (trigger flips cms_analytics draft→published). */
219
- async publishContent(id: string) {
220
- await this.init()
221
- await db.write({
222
- sql: `UPDATE content SET published=1, updated_at=?
223
- WHERE id=? AND profile_id=?`,
224
- args: [iso(), id, this.profileId],
225
- })
226
- const { rows: [r] } = await db.execute({
227
- sql: `SELECT title, slug FROM content WHERE id=? AND profile_id=? LIMIT 1`,
228
- args: [id, this.profileId],
229
- })
230
- if (r) await logMemory(this.agentType, `Published "${r.title}"`, { id, slug: r.slug })
231
- }
232
-
233
- async unpublish(id: string) {
234
- await this.init()
235
- await db.write({
236
- sql: `UPDATE content SET published=0, updated_at=?
237
- WHERE id=? AND profile_id=?`,
238
- args: [iso(), id, this.profileId],
239
- })
240
- }
241
-
242
- /** Soft archive — never hard DELETE (that would fire trg_content_delete and
243
- * decrement counters). hidden=1 keeps counters intact. */
244
- async archiveContent(id: string) {
245
- await this.init()
246
- await db.write({
247
- sql: `UPDATE content SET hidden=1, updated_at=?
248
- WHERE id=? AND profile_id=?`,
249
- args: [iso(), id, this.profileId],
250
- })
251
- }
252
-
253
- // ── Content inventory — free via cms_analytics (trigger-maintained) ───────
254
-
255
- async inventory() {
256
- await this.init()
257
- const { rows } = await db.execute({
258
- sql: `SELECT c.slug AS kind, c.category_id,
259
- a.total_posts, a.total_published, a.total_draft
260
- FROM cms c
261
- LEFT JOIN cms_analytics a ON a.cms_id = c.id
262
- WHERE c.profile_id=?`,
263
- args: [this.profileId],
264
- })
265
-
266
- const out: Record<string, { total: number; published: number; drafts: number }> = {}
267
- for (const r of rows) {
268
- const k = String(r.kind ?? r.category_id)
269
- out[k] = {
270
- total: Number(r.total_posts ?? 0),
271
- published: Number(r.total_published ?? 0),
272
- drafts: Number(r.total_draft ?? 0),
273
- }
274
- }
275
- return out
276
- }
277
-
278
- // ── SEO quality audit ─────────────────────────────────────────────────────
279
-
280
- async seoAudit(kind: ContentKind = 'blog') {
281
- await this.init()
282
- const cms_id = await getCmsId(this.profileId, kind)
283
- const { rows } = await db.execute({
284
- sql: `SELECT id, title, slug, excerpt, seo_title, seo_description, word_count
285
- FROM content
286
- WHERE profile_id=? AND cms_id=? AND published=1 AND hidden=0`,
287
- args: [this.profileId, cms_id],
288
- })
289
-
290
- const issues: Array<{ id: string; title: string; problems: string[] }> = []
291
- for (const r of rows) {
292
- const problems: string[] = []
293
- if (!r.excerpt) problems.push('missing excerpt')
294
- if (!r.seo_title) problems.push('missing seo_title')
295
- if (!r.seo_description) problems.push('missing seo_description')
296
- if (r.seo_title && String(r.seo_title).length > 60) problems.push('seo_title too long (>60)')
297
- if (r.seo_description && String(r.seo_description).length > 160) problems.push('seo_description too long (>160)')
298
- if (Number(r.word_count ?? 0) < 300) problems.push('too short (<300 words)')
299
- if (!r.slug || String(r.slug).includes(' ')) problems.push('bad slug')
300
- if (problems.length) issues.push({ id: r.id as string, title: r.title as string, problems })
301
- }
302
- return issues
303
- }
304
-
305
- // ── Private helpers ───────────────────────────────────────────────────────
306
-
307
- private structureForType(type: ContentType, wordTarget: number, keywords: string[]): string {
308
- const kw = keywords.length ? `Target keywords: ${keywords.join(', ')}. ` : ''
309
- const structures: Record<ContentType, string> = {
310
- 'blog': `${kw}Write a comprehensive blog post. Intro hook → 3-5 main sections with H2s → conclusion with CTA. ~${wordTarget} words.`,
311
- 'listicle': `${kw}Write a numbered listicle. Hook intro → numbered items (H3 each, 2-3 sentences, practical tip) → summary. 7-15 items. ~${wordTarget} words.`,
312
- 'how-to': `${kw}Write a step-by-step how-to. Problem intro → numbered steps (H3 each, clear action, why it matters) → result. ~${wordTarget} words.`,
313
- 'checklist': `${kw}Write a practical checklist. Short intro → grouped checklist items with brief explanations → conclusion. Imperative language. ~${wordTarget} words.`,
314
- 'qa': `${kw}Write a Q&A article. Short intro → 8-12 questions as H2s with 2-4 sentence answers → summary. Address real search queries. ~${wordTarget} words.`,
315
- 'versus': `${kw}Write a versus comparison. TL;DR verdict → feature table → pros/cons each option → who should use what → verdict. ~${wordTarget} words.`,
316
- 'roundup': `${kw}Write a curated roundup. Criteria intro → each option (H3, 2-3 sentences, best for who) → comparison table → top pick. ~${wordTarget} words.`,
317
- 'news': `${kw}Write a news article. Lead paragraph (who/what/when/where/why) → context → implications → sources cited. ~${wordTarget} words. Cite all facts.`,
318
- 'ultimate-guide':`${kw}Write a definitive ultimate guide. Executive summary → TOC → deep-dive sections (H2+H3) → examples → FAQs → conclusion. ~${wordTarget}+ words.`,
319
- 'programmatic': `${kw}Write an SEO-optimized page. Clear H1 → key info table → main content → FAQs → CTA. Concise, factual. ~${wordTarget} words.`,
320
- }
321
- return structures[type]
322
- }
323
-
324
- private async generateContent(_title: string, _topic: string, structure: string, _keywords: string[]): Promise<string> {
325
- // Claude, the runtime LLM, fills this in when invoked via CLI / Code.
326
- return `<!-- Agent: generate ${structure} -->`
327
- }
328
-
329
- private async generateExcerpt(_content: string, type: ContentType): Promise<string> {
330
- return `<!-- Agent: write a 1-sentence hook excerpt for this ${type} -->`
331
- }
332
-
333
- private async generateSEOTitle(title: string, keywords: string[]): Promise<string> {
334
- const kw = keywords[0] ?? ''
335
- const base = kw && !title.toLowerCase().includes(kw.toLowerCase())
336
- ? `${title} | ${kw}` : title
337
- return base.slice(0, 60)
338
- }
339
-
340
- private async generateSEODescription(_content: string, keywords: string[]): Promise<string> {
341
- return `<!-- Agent: write 155-char meta description including: ${keywords.join(', ')} -->`
342
- }
343
-
344
- /** Count of internal-link candidates — stored as an integer on content. */
345
- private async countInternalLinks(title: string, keywords: string[]): Promise<number> {
346
- try {
347
- const search = keywords[0] ?? title.split(' ')[0]
348
- const { rows: [r] } = await db.execute({
349
- sql: `SELECT COUNT(*) AS n FROM content
350
- WHERE profile_id=? AND published=1 AND hidden=0
351
- AND (title LIKE ? OR slug LIKE ?)`,
352
- args: [this.profileId, `%${search}%`, `%${search}%`],
353
- })
354
- return Math.min(3, Number(r?.n ?? 0))
355
- } catch { return 0 }
356
- }
357
-
358
- private async makeSlug(title: string, cms_id: string): Promise<string> {
359
- const base = title.toLowerCase()
360
- .replace(/[^a-z0-9\s-]/g, '')
361
- .replace(/\s+/g, '-')
362
- .replace(/-+/g, '-')
363
- .slice(0, 80)
364
-
365
- // Unique index is (profile_id, category_id, slug). Dedupe per cms section.
366
- const { rows: [exists] } = await db.execute({
367
- sql: `SELECT slug FROM content
368
- WHERE profile_id=? AND cms_id=? AND slug=? LIMIT 1`,
369
- args: [this.profileId, cms_id, base],
370
- })
371
- return exists ? `${base}-${Date.now().toString(36)}` : base
372
- }
373
-
374
- private countWords(content: string): number {
375
- return content.replace(/<[^>]+>/g, '').split(/\s+/).filter(Boolean).length
376
- }
377
- }
378
-
379
- export const blogWriter = new BlogWriter()
@@ -1,11 +0,0 @@
1
- # copywriting
2
-
3
- Placeholder SOUL. See CLAUDE.md routing table and skills/copywriting/SKILL.md (if present) for scope.
4
-
5
- ## Rules
6
-
7
- - Load skills on demand
8
- - Draft before publish
9
- - Archive not delete (hidden=1)
10
- - Log every action to agent_memory
11
- - Push reports to agent_reports mid-session
@@ -1,89 +0,0 @@
1
- /**
2
- * COPY — Copywriter
3
- * "Words that convert. Nothing more, nothing less."
4
- * Writes to: pages, product descriptions, link descriptions, profile bio/tagline
5
- */
6
-
7
- import { BaseAgent, db, ulid, now, iso } from '../_base.ts'
8
- import { uniqueSlug } from '../../lib/slug.ts'
9
-
10
- export interface PageInput {
11
- title: string; slug?: string; excerpt?: string; text_field?: string
12
- hero_section?: Record<string, unknown>; cta_section?: Record<string, unknown>
13
- testimonials?: unknown[]; faq?: unknown[]; pricing?: unknown[]
14
- intro_section?: Record<string, unknown>; about_section?: Record<string, unknown>
15
- publish?: boolean
16
- }
17
-
18
- export class Copywriter extends BaseAgent {
19
- readonly name = 'COPY'
20
- readonly title = 'Copywriter'
21
-
22
- async createPage(input: PageInput) {
23
- await this.init()
24
- const id = ulid()
25
- const slug = input.slug ?? await uniqueSlug('pages', input.title, this.profileId)
26
- const ts = now()
27
-
28
- await db.execute({
29
- sql: `INSERT INTO pages (id,profile_id,user_id,title,slug,excerpt,text_field,
30
- hero_section,cta_section,testimonials,faq,pricing,intro_section,about_section,
31
- published,hidden,created_at,updated_at)
32
- VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,0,?,?)`,
33
- args: [
34
- id, this.profileId, this.userId, input.title, slug,
35
- input.excerpt ?? null, input.text_field ?? null,
36
- input.hero_section ? JSON.stringify(input.hero_section) : null,
37
- input.cta_section ? JSON.stringify(input.cta_section) : null,
38
- input.testimonials ? JSON.stringify(input.testimonials) : null,
39
- input.faq ? JSON.stringify(input.faq) : null,
40
- input.pricing ? JSON.stringify(input.pricing) : null,
41
- input.intro_section ? JSON.stringify(input.intro_section) : null,
42
- input.about_section ? JSON.stringify(input.about_section) : null,
43
- input.publish ? 1 : 0, ts, ts,
44
- ],
45
- })
46
- return this.getPage(id)
47
- }
48
-
49
- async getPage(id: string) {
50
- const { rows: [r] } = await db.execute({ sql: 'SELECT * FROM pages WHERE id=?', args: [id] })
51
- if (!r) throw new Error(`Page not found: ${id}`)
52
- return r
53
- }
54
-
55
- async listPages() {
56
- await this.init()
57
- const { rows } = await db.execute({
58
- sql: 'SELECT id,title,slug,published,is_active FROM pages WHERE profile_id=? AND hidden=0 ORDER BY order_index',
59
- args: [this.profileId],
60
- })
61
- return rows
62
- }
63
-
64
- /** Update profile bio and tagline */
65
- async updateProfileCopy(fields: { bio?: string; tagline?: string; title?: string }) {
66
- await this.init()
67
- const sets = [`updated_at=${now()}`]
68
- const args: unknown[] = []
69
- if (fields.bio !== undefined) { sets.push('bio=?'); args.push(fields.bio) }
70
- if (fields.tagline !== undefined) { sets.push('tagline=?'); args.push(fields.tagline) }
71
- if (fields.title !== undefined) { sets.push('title=?'); args.push(fields.title) }
72
- await db.execute({ sql: `UPDATE profiles SET ${sets.join(',')} WHERE id=?`, args: [...args, this.profileId] })
73
- }
74
-
75
- /** Update a product's description and excerpt */
76
- async updateProductCopy(productId: string, fields: { description?: string; excerpt?: string; button_text?: string }) {
77
- const sets = [`updated_at=${now()}`]
78
- const args: unknown[] = []
79
- if (fields.description !== undefined) { sets.push('description=?'); args.push(fields.description) }
80
- if (fields.excerpt !== undefined) { sets.push('excerpt=?'); args.push(fields.excerpt) }
81
- if (fields.button_text !== undefined) { sets.push('button_text=?'); args.push(fields.button_text) }
82
- await db.execute({ sql: `UPDATE products SET ${sets.join(',')} WHERE id=?`, args: [...args, productId] })
83
- }
84
-
85
- async publishPage(id: string) { await super.publish('pages', id); return this.getPage(id) }
86
- async archivePage(id: string) { await super.archive('pages', id) }
87
- }
88
-
89
- export const copywriter = new Copywriter()
@@ -1,11 +0,0 @@
1
- # courses
2
-
3
- Placeholder SOUL. See CLAUDE.md routing table and skills/courses/SKILL.md (if present) for scope.
4
-
5
- ## Rules
6
-
7
- - Load skills on demand
8
- - Draft before publish
9
- - Archive not delete (hidden=1)
10
- - Log every action to agent_memory
11
- - Push reports to agent_reports mid-session