@compilr-dev/sdk 0.7.10 → 0.7.12

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.
@@ -256,6 +256,38 @@ export const CAPABILITY_PACKS = {
256
256
  estimatedPromptTokens: 120,
257
257
  estimatedToolTokens: 900,
258
258
  },
259
+ // ============= FACTORY TOOL PACKS =============
260
+ factory_models: {
261
+ id: 'factory_models',
262
+ label: 'Structured Models',
263
+ tools: [
264
+ 'app_model_get', 'app_model_update', 'app_model_validate',
265
+ 'research_model_get', 'research_model_update', 'research_model_validate',
266
+ 'bibliography_generate', 'bibtex_import',
267
+ 'business_model_get', 'business_model_update', 'business_model_validate',
268
+ 'brand_model_get', 'brand_model_update', 'brand_model_validate',
269
+ 'curriculum_model_get', 'curriculum_model_update', 'curriculum_model_validate',
270
+ 'book_model_get', 'book_model_update', 'book_model_validate',
271
+ ],
272
+ readOnly: false,
273
+ promptModules: ['factory-tool-hints'],
274
+ promptSnippet: 'Structured models: use *_model_get to read, *_model_update with semantic ops to modify. Each model type (app, research, business, brand, curriculum, book) has get/update/validate tools.',
275
+ estimatedPromptTokens: 150,
276
+ estimatedToolTokens: 3000,
277
+ },
278
+ factory_scaffold: {
279
+ id: 'factory_scaffold',
280
+ label: 'Code Scaffolding',
281
+ tools: [
282
+ 'factory_scaffold', 'factory_list_toolkits',
283
+ 'research_scaffold', 'business_scaffold', 'content_scaffold', 'book_scaffold',
284
+ ],
285
+ readOnly: false,
286
+ promptModules: ['factory-tool-hints'],
287
+ promptSnippet: 'Scaffolding: factory_scaffold generates project files from app models. factory_list_toolkits shows available templates. Domain-specific scaffolds (research_, business_, content_, book_) generate from their respective models.',
288
+ estimatedPromptTokens: 120,
289
+ estimatedToolTokens: 1200,
290
+ },
259
291
  };
260
292
  /**
261
293
  * Mapping from forbidden pack IDs to suggested agent roles.
@@ -276,6 +308,8 @@ export const FORBIDDEN_PACK_SUGGESTIONS = {
276
308
  artifacts: '$pm',
277
309
  anchors: '$pm',
278
310
  project_db: '$pm',
311
+ factory_models: '$default',
312
+ factory_scaffold: '$dev',
279
313
  };
280
314
  /**
281
315
  * Get the total number of defined capability packs.
@@ -44,7 +44,7 @@ export interface IDocumentRepository {
44
44
  update(id: number, input: UpdateDocumentInput): Promise<ProjectDocument | null>;
45
45
  delete(id: number): Promise<boolean>;
46
46
  deleteByType(projectId: number, docType: DocumentType): Promise<boolean>;
47
- getTypeCounts(projectId: number): Promise<Record<DocumentType, number>>;
47
+ getTypeCounts(projectId: number): Promise<Record<string, number>>;
48
48
  }
49
49
  export interface IPlanRepository {
50
50
  create(input: CreatePlanInput): Promise<Plan>;
@@ -15,5 +15,5 @@ export declare class SQLiteDocumentRepository implements IDocumentRepository {
15
15
  update(id: number, input: UpdateDocumentInput): Promise<ProjectDocument | null>;
16
16
  delete(id: number): Promise<boolean>;
17
17
  deleteByType(projectId: number, docType: DocumentType): Promise<boolean>;
18
- getTypeCounts(projectId: number): Promise<Record<DocumentType, number>>;
18
+ getTypeCounts(projectId: number): Promise<Record<string, number>>;
19
19
  }
@@ -110,19 +110,7 @@ export class SQLiteDocumentRepository {
110
110
  const results = this.db
111
111
  .prepare('SELECT doc_type, COUNT(*) as count FROM project_documents WHERE project_id = ? GROUP BY doc_type')
112
112
  .all(projectId);
113
- const counts = {
114
- prd: 0,
115
- architecture: 0,
116
- design: 0,
117
- notes: 0,
118
- plan: 0,
119
- 'app-model': 0,
120
- 'research-model': 0,
121
- 'business-model': 0,
122
- 'brand-model': 0,
123
- 'curriculum-model': 0,
124
- 'book-model': 0,
125
- };
113
+ const counts = {};
126
114
  for (const row of results) {
127
115
  counts[row.doc_type] = row.count;
128
116
  }
@@ -7,19 +7,22 @@
7
7
  * Ported from CLI's src/tools/document-db.ts.
8
8
  */
9
9
  import { defineTool, createSuccessResult, createErrorResult } from '@compilr-dev/agents';
10
- /** All valid document types — keep in sync with DocumentType. */
10
+ /** All valid document types — keep in sync with DocumentType in types.ts. */
11
11
  const DOC_TYPE_ENUM = [
12
- 'prd',
13
- 'architecture',
14
- 'design',
15
- 'notes',
16
- 'plan',
17
- 'app-model',
18
- 'research-model',
19
- 'business-model',
20
- 'brand-model',
21
- 'curriculum-model',
22
- 'book-model',
12
+ // Software
13
+ 'prd', 'architecture', 'design', 'notes', 'plan',
14
+ // Structured models
15
+ 'app-model', 'research-model', 'business-model', 'brand-model', 'curriculum-model', 'book-model',
16
+ // Research
17
+ 'outline', 'literature-review', 'abstract', 'methodology', 'bibliography',
18
+ // Business
19
+ 'executive-summary', 'market-analysis', 'financial-model', 'pitch',
20
+ // Content & Marketing
21
+ 'editorial-calendar', 'article',
22
+ // Tech Docs
23
+ 'getting-started', 'api-reference', 'tutorial',
24
+ // General
25
+ 'draft', 'review', 'session-notes', 'chapter',
23
26
  ];
24
27
  // eslint-disable-next-line @typescript-eslint/explicit-function-return-type
25
28
  export function createDocumentTools(config) {
@@ -19,7 +19,7 @@ export type WorkItemType = 'feature' | 'bug' | 'tech-debt' | 'chore';
19
19
  export type WorkItemStatus = 'backlog' | 'in_progress' | 'completed' | 'skipped';
20
20
  export type WorkItemPriority = 'critical' | 'high' | 'medium' | 'low';
21
21
  export type GuidedStep = 'plan' | 'implement' | 'test' | 'commit' | 'review';
22
- export type DocumentType = 'prd' | 'architecture' | 'design' | 'notes' | 'plan' | 'app-model' | 'research-model' | 'business-model' | 'brand-model' | 'curriculum-model' | 'book-model';
22
+ export type DocumentType = 'prd' | 'architecture' | 'design' | 'notes' | 'plan' | 'app-model' | 'research-model' | 'business-model' | 'brand-model' | 'curriculum-model' | 'book-model' | 'outline' | 'literature-review' | 'abstract' | 'methodology' | 'bibliography' | 'executive-summary' | 'market-analysis' | 'financial-model' | 'pitch' | 'editorial-calendar' | 'article' | 'getting-started' | 'api-reference' | 'tutorial' | 'draft' | 'review' | 'session-notes' | 'chapter';
23
23
  export type PlanStatus = 'draft' | 'approved' | 'in_progress' | 'completed' | 'abandoned';
24
24
  export interface Project {
25
25
  id: number;
@@ -223,11 +223,15 @@ Key categories:
223
223
 
224
224
  ### Document Storage (CRITICAL)
225
225
 
226
- Project documents (PRD, architecture, design, notes) are stored in the **database**, not the filesystem.
227
- - **Read**: \`project_document_get({ doc_type: "prd" })\` or \`project_document_list()\`
228
- - **Write**: \`project_document_add({ doc_type: "prd", title: "...", content: "..." })\`
226
+ Project documents (drafts, outlines, analyses, plans) are stored in the **database**, not the filesystem.
227
+ - **Read**: \`project_document_get({ doc_type: "outline" })\` or \`project_document_list()\`
228
+ - **Write**: \`project_document_add({ doc_type: "outline", title: "...", content: "..." })\`
229
229
  - Do NOT use write_file or edit for project documents — always use these database tools
230
- - Valid doc_types: prd, architecture, design, notes, session-note`,
230
+ - **Software doc_types**: prd, architecture, design, notes, plan
231
+ - **Research doc_types**: outline, literature-review, abstract, methodology, bibliography
232
+ - **Business doc_types**: executive-summary, market-analysis, financial-model, pitch
233
+ - **Content doc_types**: editorial-calendar, article
234
+ - **General doc_types**: draft, review, session-notes, chapter, notes`,
231
235
  };
232
236
  /**
233
237
  * Token delegation module - always included
@@ -302,6 +302,32 @@ export const TOOL_GROUPS = {
302
302
  tier: 'direct',
303
303
  note: 'Delegate tasks to specialized subagents',
304
304
  },
305
+ // Factory tools (from @compilr-dev/factory) — structured models + scaffolding
306
+ factory_models: {
307
+ label: 'Structured Models',
308
+ tools: [
309
+ 'app_model_get', 'app_model_update', 'app_model_validate',
310
+ 'research_model_get', 'research_model_update', 'research_model_validate',
311
+ 'bibliography_generate', 'bibtex_import',
312
+ 'business_model_get', 'business_model_update', 'business_model_validate',
313
+ 'brand_model_get', 'brand_model_update', 'brand_model_validate',
314
+ 'curriculum_model_get', 'curriculum_model_update', 'curriculum_model_validate',
315
+ 'book_model_get', 'book_model_update', 'book_model_validate',
316
+ ],
317
+ readOnly: false,
318
+ tier: 'meta',
319
+ note: 'Structured project models (app, research, business, brand, curriculum, book)',
320
+ },
321
+ factory_scaffold: {
322
+ label: 'Code Scaffolding',
323
+ tools: [
324
+ 'factory_scaffold', 'factory_list_toolkits',
325
+ 'research_scaffold', 'business_scaffold', 'content_scaffold', 'book_scaffold',
326
+ ],
327
+ readOnly: false,
328
+ tier: 'meta',
329
+ note: 'Generate project files from structured models',
330
+ },
305
331
  };
306
332
  // =============================================================================
307
333
  // Tool Profiles
@@ -347,6 +373,8 @@ export const TOOL_PROFILES = {
347
373
  'plans',
348
374
  'artifacts',
349
375
  'anchors',
376
+ 'factory_models',
377
+ 'factory_scaffold',
350
378
  ],
351
379
  // Security - security audits
352
380
  security: [
@@ -361,8 +389,8 @@ export const TOOL_PROFILES = {
361
389
  'search',
362
390
  'dependencies',
363
391
  ],
364
- // Docs - documentation only
365
- docs: ['file_read', 'file_write', 'interaction', 'handoff', 'guide', 'meta', 'project', 'search'],
392
+ // Docs - documentation + project documents
393
+ docs: ['file_read', 'file_write', 'interaction', 'handoff', 'guide', 'meta', 'project', 'search', 'documents', 'factory_models'],
366
394
  // DevOps - CI/CD tasks
367
395
  devops: [
368
396
  'file_read',
@@ -412,6 +440,7 @@ export const TOOL_PROFILES = {
412
440
  'plans',
413
441
  'artifacts',
414
442
  'anchors',
443
+ 'factory_models',
415
444
  ],
416
445
  // Planner (PM) - project management (no code modification)
417
446
  planner: [
@@ -430,8 +459,9 @@ export const TOOL_PROFILES = {
430
459
  'plans',
431
460
  'artifacts',
432
461
  'anchors',
462
+ 'factory_models',
433
463
  ],
434
- // Analyst (BA) - requirements gathering (minimal technical tools)
464
+ // Analyst (BA) - requirements gathering + document access
435
465
  analyst: [
436
466
  'file_read',
437
467
  'tasks',
@@ -445,6 +475,7 @@ export const TOOL_PROFILES = {
445
475
  'documents',
446
476
  'artifacts',
447
477
  'anchors',
478
+ 'factory_models',
448
479
  ],
449
480
  // Custom - user selected (groups specified in customGroups)
450
481
  custom: [],
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.7.10",
3
+ "version": "0.7.12",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",