@compilr-dev/sdk 0.6.2 → 0.7.0

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/dist/agent.js CHANGED
@@ -96,8 +96,11 @@ class CompilrAgentImpl {
96
96
  model: config?.model,
97
97
  apiKey: config?.apiKey,
98
98
  });
99
- // Resolve preset
100
- const preset = resolvePreset(config?.preset ?? 'coding');
99
+ // Resolve preset — non-software projects get 'general' by default
100
+ const defaultPreset = config?.projectCategory && config.projectCategory !== 'software'
101
+ ? 'general'
102
+ : 'coding';
103
+ const preset = resolvePreset(config?.preset ?? defaultPreset);
101
104
  // Build system prompt
102
105
  let systemPrompt;
103
106
  if (config?.systemPrompt === false) {
package/dist/config.d.ts CHANGED
@@ -157,8 +157,10 @@ export interface CompilrAgentConfig {
157
157
  model?: string;
158
158
  /** API key (uses env var if omitted) */
159
159
  apiKey?: string;
160
- /** Preset to use. Default: 'coding' */
161
- preset?: 'coding' | 'read-only' | 'none' | Preset;
160
+ /** Preset to use. Default: 'coding' (or 'general' for non-software projectCategory) */
161
+ preset?: 'coding' | 'general' | 'read-only' | 'none' | Preset;
162
+ /** Project type category — determines default preset when preset is omitted */
163
+ projectCategory?: 'software' | 'research' | 'writing' | 'business' | 'education' | 'general';
162
164
  /** Working directory. Default: process.cwd() */
163
165
  cwd?: string;
164
166
  /** Maximum iterations for tool use loops. Default: 50 */
@@ -0,0 +1,9 @@
1
+ /**
2
+ * General preset — project-type-neutral, no software assumptions
3
+ *
4
+ * Used for non-software project types (research, business, content, etc.).
5
+ * The project-type-specific identity comes from the systemPromptSection
6
+ * in the ProjectTypeConfig, not from the preset.
7
+ */
8
+ import type { Preset } from './types.js';
9
+ export declare const generalPreset: Preset;
@@ -0,0 +1,37 @@
1
+ /**
2
+ * General preset — project-type-neutral, no software assumptions
3
+ *
4
+ * Used for non-software project types (research, business, content, etc.).
5
+ * The project-type-specific identity comes from the systemPromptSection
6
+ * in the ProjectTypeConfig, not from the preset.
7
+ */
8
+ import { readFileTool, writeFileTool, editTool, bashTool, bashOutputTool, killShellTool, grepTool, globTool, todoWriteTool, todoReadTool, webFetchTool, suggestTool, } from '@compilr-dev/agents';
9
+ const GENERAL_SYSTEM_PROMPT = `You are a versatile AI assistant. You adapt your approach to the user's needs and project context.
10
+
11
+ You help users with a wide range of tasks including research, writing, analysis, planning, and problem solving.
12
+
13
+ Guidelines:
14
+ - Read files before modifying them to understand existing content
15
+ - Make focused, minimal changes unless asked for larger rewrites
16
+ - Follow the project's conventions and style
17
+ - Follow any project-specific guidance provided in the system prompt
18
+ - When uncertain, ask the user for clarification`;
19
+ export const generalPreset = {
20
+ name: 'general',
21
+ systemPrompt: GENERAL_SYSTEM_PROMPT,
22
+ tools: [
23
+ readFileTool,
24
+ writeFileTool,
25
+ editTool,
26
+ bashTool,
27
+ bashOutputTool,
28
+ killShellTool,
29
+ grepTool,
30
+ globTool,
31
+ todoWriteTool,
32
+ todoReadTool,
33
+ webFetchTool,
34
+ suggestTool,
35
+ ],
36
+ defaultPermissions: 'auto',
37
+ };
@@ -4,8 +4,9 @@
4
4
  export type { Preset } from './types.js';
5
5
  export { codingPreset } from './coding.js';
6
6
  export { readOnlyPreset } from './read-only.js';
7
+ export { generalPreset } from './general.js';
7
8
  import type { Preset } from './types.js';
8
9
  /**
9
10
  * Resolve a preset by name or return a custom preset object
10
11
  */
11
- export declare function resolvePreset(preset: 'coding' | 'read-only' | 'none' | Preset): Preset;
12
+ export declare function resolvePreset(preset: 'coding' | 'general' | 'read-only' | 'none' | Preset): Preset;
@@ -3,8 +3,10 @@
3
3
  */
4
4
  export { codingPreset } from './coding.js';
5
5
  export { readOnlyPreset } from './read-only.js';
6
+ export { generalPreset } from './general.js';
6
7
  import { codingPreset } from './coding.js';
7
8
  import { readOnlyPreset } from './read-only.js';
9
+ import { generalPreset } from './general.js';
8
10
  /**
9
11
  * Empty preset — no tools, minimal prompt
10
12
  */
@@ -24,6 +26,8 @@ export function resolvePreset(preset) {
24
26
  switch (preset) {
25
27
  case 'coding':
26
28
  return codingPreset;
29
+ case 'general':
30
+ return generalPreset;
27
31
  case 'read-only':
28
32
  return readOnlyPreset;
29
33
  case 'none':
@@ -65,6 +65,47 @@ export const softwareConfig = {
65
65
  projectActions: ['design', 'prd', 'architecture', 'refine', 'scaffold', 'session-notes'],
66
66
  workItemActions: ['build', 'refine-item', 'code-review', 'explain'],
67
67
  systemPromptContext: 'This is a software development project. The user is building an application.',
68
+ systemPromptSection: `## Project Context: Software Development
69
+
70
+ You are assisting with a software development project. Your role is to help the user design, build, test, and maintain an application.
71
+
72
+ ### Development Workflow
73
+ The typical workflow progresses through these phases:
74
+ 1. **Design** — Define the application model, entities, and relationships
75
+ 2. **Requirements** — Write PRD, define features, acceptance criteria
76
+ 3. **Architecture** — System architecture, tech stack decisions
77
+ 4. **Implementation** — Build features, write code, run tests
78
+ 5. **Review** — Code review, quality checks, refactoring
79
+ 6. **Deployment** — Build, deploy, monitor
80
+
81
+ ### Available Tools & Skills
82
+ - \`/design\` — Guide through application design (entities, relationships)
83
+ - \`/prd\` — Write a Product Requirements Document
84
+ - \`/architecture\` — Design system architecture
85
+ - \`/scaffold\` — Generate project code from the Application Model
86
+ - \`/build\` — Implement a specific feature or work item
87
+ - \`/refine\` — Expand and refine backlog items
88
+
89
+ ### Work Items
90
+ Work items in this project represent:
91
+ - **Feature** — a feature or user story to implement
92
+ - **Bug** — a defect to fix
93
+ - **Tech Debt** — code quality improvement
94
+ - **Chore** — maintenance or administrative task
95
+
96
+ ### Writing Conventions
97
+ - Follow the project's existing code style and conventions
98
+ - Read files before modifying to understand context
99
+ - Make focused, minimal changes unless asked otherwise
100
+ - Run tests and lint before considering work complete
101
+
102
+ ### Team Agents
103
+ Specialized agents may be available:
104
+ - **Dev** — implementation, debugging, refactoring
105
+ - **QA** — testing, code review, quality assurance
106
+ - **Architect** — system design, technical decisions
107
+ - **PM** — requirements, backlog management, priorities
108
+ Suggest delegation when a task would benefit from focused expertise.`,
68
109
  };
69
110
  // =============================================================================
70
111
  // General (blank slate)
@@ -84,6 +125,15 @@ export const generalConfig = {
84
125
  projectActions: ['session-notes'],
85
126
  workItemActions: ['explain'],
86
127
  systemPromptContext: 'This is a general-purpose project.',
128
+ systemPromptSection: `## Project Context: General
129
+
130
+ You are assisting with a general-purpose project. Adapt your approach to whatever the user needs — writing, research, analysis, planning, or any other task.
131
+
132
+ ### Approach
133
+ - Ask about the project's goals and context if not clear
134
+ - Use work items to track tasks and progress
135
+ - Use documents to store important artifacts
136
+ - Suggest team agents if the project would benefit from specialization`,
87
137
  };
88
138
  // =============================================================================
89
139
  // Research Paper / Academic
@@ -310,6 +360,35 @@ export const businessPlanConfig = {
310
360
  chore: { short: 'TK', full: 'Task' },
311
361
  },
312
362
  systemPromptContext: 'This is a business plan project. The user is developing a business plan or startup pitch. Focus on market analysis, financial viability, and clear communication.',
363
+ systemPromptSection: `## Project Context: Business Plan
364
+
365
+ You are assisting with a business plan or startup project. Your role is to help the user develop a compelling, well-researched business plan.
366
+
367
+ ### Workflow
368
+ 1. **Vision & Problem** — Define the problem being solved and the value proposition
369
+ 2. **Market Research** — Analyze target market, customer segments, market size
370
+ 3. **Competitive Analysis** — Identify competitors, positioning, differentiation
371
+ 4. **Business Model** — Revenue streams, pricing, cost structure
372
+ 5. **Go-to-Market** — Marketing strategy, channels, launch plan
373
+ 6. **Financial Projections** — Revenue forecasts, expense modeling, break-even
374
+ 7. **Pitch Narrative** — Executive summary, investor pitch
375
+
376
+ ### Work Items
377
+ - **Milestone** (type: feature) — a major deliverable or section to complete
378
+ - **Issue** (type: bug) — a problem or gap to address
379
+ - **Research** (type: tech-debt) — market data or analysis needed
380
+ - **Task** (type: chore) — administrative or formatting work
381
+
382
+ ### Writing Conventions
383
+ - Use clear, professional business language
384
+ - Support claims with data and market research
385
+ - Be realistic about projections — investors spot inflated numbers
386
+ - Structure arguments: problem → solution → evidence → opportunity
387
+
388
+ ### Team Agents
389
+ - **Analyst** — market research, competitive intelligence, data analysis
390
+ - **Strategist** — business model, go-to-market, positioning
391
+ - **Writer** — pitch narrative, executive summary, investor communication`,
313
392
  };
314
393
  // =============================================================================
315
394
  // Content / Blog / Marketing
@@ -366,6 +445,36 @@ export const contentConfig = {
366
445
  chore: { short: 'TK', full: 'Task' },
367
446
  },
368
447
  systemPromptContext: 'This is a content/marketing project. The user is creating articles, blog posts, or marketing content. Focus on engaging writing, SEO awareness, and brand consistency.',
448
+ systemPromptSection: `## Project Context: Content & Marketing
449
+
450
+ You are assisting with a content creation project. Your role is to help the user produce engaging, well-structured content.
451
+
452
+ ### Workflow
453
+ 1. **Strategy** — Define content goals, audience, brand voice
454
+ 2. **Ideation** — Generate topic ideas, angles, headlines
455
+ 3. **Research** — Gather supporting information, statistics, quotes
456
+ 4. **Drafting** — Write first drafts following the brand guide
457
+ 5. **Editing** — Revise for clarity, engagement, consistency
458
+ 6. **Optimization** — SEO, readability, formatting for platform
459
+ 7. **Publishing** — Final review and publication
460
+
461
+ ### Work Items
462
+ - **Content Piece** (type: feature) — an article, post, or page to create
463
+ - **Fix** (type: bug) — content corrections or updates needed
464
+ - **Research** (type: tech-debt) — background research or data to gather
465
+ - **Task** (type: chore) — formatting, scheduling, or administrative work
466
+
467
+ ### Writing Conventions
468
+ - Match the project's established brand voice and tone
469
+ - Lead with value — don't bury the point
470
+ - Use short paragraphs and clear headings for scannability
471
+ - Include a clear call-to-action where appropriate
472
+ - Consider SEO: keywords, meta descriptions, internal linking
473
+
474
+ ### Team Agents
475
+ - **Writer** — drafting, creative writing, storytelling
476
+ - **Editor** — style consistency, grammar, clarity, tone
477
+ - **Analyst** — audience research, content performance, SEO data`,
369
478
  };
370
479
  // =============================================================================
371
480
  // Technical Documentation
@@ -422,6 +531,35 @@ export const techDocsConfig = {
422
531
  chore: { short: 'TK', full: 'Task' },
423
532
  },
424
533
  systemPromptContext: 'This is a technical documentation project. The user is writing documentation such as API references, user guides, or tutorials. Focus on clarity, accuracy, and developer experience.',
534
+ systemPromptSection: `## Project Context: Technical Documentation
535
+
536
+ You are assisting with a technical documentation project. Your role is to help the user produce clear, accurate, and developer-friendly documentation.
537
+
538
+ ### Workflow
539
+ 1. **Planning** — Define documentation scope, audience, information architecture
540
+ 2. **Outline** — Structure the documentation hierarchy (guides, references, tutorials)
541
+ 3. **Drafting** — Write content with code examples and clear explanations
542
+ 4. **Review** — Technical accuracy review, consistency check
543
+ 5. **Polish** — Copy editing, formatting, cross-referencing
544
+
545
+ ### Work Items
546
+ - **Page** (type: feature) — a documentation page or guide to write
547
+ - **Fix** (type: bug) — corrections, outdated information, broken links
548
+ - **Refactor** (type: tech-debt) — restructuring or consolidation of docs
549
+ - **Task** (type: chore) — formatting, navigation, publishing
550
+
551
+ ### Writing Conventions
552
+ - Write for the reader's skill level — don't assume knowledge unless stated
553
+ - Lead with "what" and "why" before "how"
554
+ - Include working code examples for every concept
555
+ - Use consistent terminology — define terms on first use
556
+ - Cross-reference related pages and concepts
557
+ - Keep code examples minimal and focused — don't include unnecessary complexity
558
+
559
+ ### Team Agents
560
+ - **Writer** — drafting documentation, tutorials, guides
561
+ - **Editor** — clarity, consistency, grammar, readability
562
+ - **Reviewer** — technical accuracy, completeness, correctness`,
425
563
  };
426
564
  // =============================================================================
427
565
  // Course / Training Material
@@ -484,4 +622,34 @@ export const courseConfig = {
484
622
  chore: { short: 'TK', full: 'Task' },
485
623
  },
486
624
  systemPromptContext: 'This is an educational project. The user is creating a course or training material. Focus on clear explanations, progressive complexity, and effective learning design.',
625
+ systemPromptSection: `## Project Context: Course / Training Material
626
+
627
+ You are assisting with an educational project. Your role is to help the user create an effective, well-structured learning experience.
628
+
629
+ ### Workflow
630
+ 1. **Curriculum Design** — Define learning objectives, prerequisites, progression
631
+ 2. **Module Structure** — Organize into modules/lessons with clear scope
632
+ 3. **Content Creation** — Write lessons with explanations, examples, visuals
633
+ 4. **Exercises** — Create practice activities, coding challenges, projects
634
+ 5. **Assessment** — Design quizzes, tests, rubrics
635
+ 6. **Review** — Pedagogical review, difficulty calibration, accessibility
636
+
637
+ ### Work Items
638
+ - **Lesson** (type: feature) — a lesson or module to create
639
+ - **Fix** (type: bug) — corrections, confusing explanations to clarify
640
+ - **Refactor** (type: tech-debt) — restructuring content flow or difficulty curve
641
+ - **Task** (type: chore) — formatting, media assets, publishing
642
+
643
+ ### Writing Conventions
644
+ - Start every lesson with clear learning objectives (use Bloom's taxonomy)
645
+ - Build knowledge progressively — prerequisites before advanced concepts
646
+ - Include hands-on exercises for every concept taught
647
+ - Use varied examples — abstract + concrete, simple + complex
648
+ - Provide "check your understanding" moments before moving forward
649
+ - Consider different learning styles (reading, doing, watching)
650
+
651
+ ### Team Agents
652
+ - **Instructor** — curriculum design, lesson planning, pedagogy
653
+ - **Writer** — content creation, explanations, narratives
654
+ - **Reviewer** — accuracy, difficulty assessment, completeness`,
487
655
  };
@@ -147,4 +147,5 @@ export declare function shouldIncludeModule(module: SystemPromptModule, context:
147
147
  hasProject?: boolean;
148
148
  hasRoleIdentity?: boolean;
149
149
  hasVisualOutput?: boolean;
150
+ hasSystemPromptSection?: boolean;
150
151
  }): boolean;
@@ -441,8 +441,8 @@ export function shouldIncludeModule(module, context) {
441
441
  }
442
442
  const { conditions } = module;
443
443
  // Check noRoleIdentity condition - only include if NO role identity is specified
444
- // This allows team agents to define their own identity without conflict
445
- if (conditions.noRoleIdentity && context.hasRoleIdentity) {
444
+ // This allows team agents AND type-specific systemPromptSections to define identity
445
+ if (conditions.noRoleIdentity && (context.hasRoleIdentity || context.hasSystemPromptSection)) {
446
446
  return false;
447
447
  }
448
448
  // Check hasGit condition
@@ -28,7 +28,7 @@ export const PREDEFINED_ROLE_IDS = [
28
28
  * Used in the team roster to help agents understand each other's strengths
29
29
  */
30
30
  export const ROLE_EXPERTISE = {
31
- default: ['general assistance', 'coding', 'problem solving'],
31
+ default: ['general assistance', 'problem solving', 'planning'],
32
32
  pm: ['planning', 'task tracking', 'coordination', 'timeline estimation', 'status updates'],
33
33
  arch: [
34
34
  'system design',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.6.2",
3
+ "version": "0.7.0",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",