@compilr-dev/sdk 0.9.7 → 0.9.9

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 (37) hide show
  1. package/dist/detection/common.d.ts +24 -0
  2. package/dist/detection/common.js +247 -0
  3. package/dist/detection/index.d.ts +6 -0
  4. package/dist/detection/index.js +5 -0
  5. package/dist/detection/project-detector.d.ts +29 -0
  6. package/dist/detection/project-detector.js +106 -0
  7. package/dist/detection/strategies/book.d.ts +7 -0
  8. package/dist/detection/strategies/book.js +48 -0
  9. package/dist/detection/strategies/business.d.ts +7 -0
  10. package/dist/detection/strategies/business.js +22 -0
  11. package/dist/detection/strategies/content.d.ts +7 -0
  12. package/dist/detection/strategies/content.js +21 -0
  13. package/dist/detection/strategies/course.d.ts +7 -0
  14. package/dist/detection/strategies/course.js +30 -0
  15. package/dist/detection/strategies/general.d.ts +8 -0
  16. package/dist/detection/strategies/general.js +10 -0
  17. package/dist/detection/strategies/research.d.ts +7 -0
  18. package/dist/detection/strategies/research.js +44 -0
  19. package/dist/detection/strategies/software.d.ts +8 -0
  20. package/dist/detection/strategies/software.js +199 -0
  21. package/dist/detection/strategies/tech-docs.d.ts +7 -0
  22. package/dist/detection/strategies/tech-docs.js +51 -0
  23. package/dist/detection/types.d.ts +80 -0
  24. package/dist/detection/types.js +7 -0
  25. package/dist/guide/guide-tool.d.ts +31 -0
  26. package/dist/guide/guide-tool.js +90 -0
  27. package/dist/guide/index.d.ts +7 -0
  28. package/dist/guide/index.js +6 -0
  29. package/dist/guide/search.d.ts +21 -0
  30. package/dist/guide/search.js +62 -0
  31. package/dist/guide/shared-content.d.ts +8 -0
  32. package/dist/guide/shared-content.js +267 -0
  33. package/dist/guide/types.d.ts +34 -0
  34. package/dist/guide/types.js +4 -0
  35. package/dist/index.d.ts +4 -0
  36. package/dist/index.js +8 -0
  37. package/package.json +1 -1
@@ -0,0 +1,267 @@
1
+ /**
2
+ * Shared Guide Content — environment-agnostic topics.
3
+ *
4
+ * These apply to both CLI and Desktop. Each entry describes a feature
5
+ * that works the same way regardless of the host application.
6
+ */
7
+ export const SHARED_GUIDE_ENTRIES = [
8
+ // ── Projects ────────────────────────────────────────────────────────────
9
+ {
10
+ id: 'creating-project',
11
+ title: 'Creating a New Project',
12
+ keywords: ['create', 'new', 'project', 'start'],
13
+ content: `To create a new project, use the project creation flow.
14
+
15
+ You'll specify:
16
+ - Project name and display name
17
+ - Project type (software, research, book, business-plan, etc.)
18
+ - Project path (where files live on disk)
19
+
20
+ After creation, the project is set as active and agents can start working in it.
21
+
22
+ 7 project types are available:
23
+ - software — Full-stack web apps, APIs, libraries
24
+ - research — Academic papers, literature reviews
25
+ - book — Books, chapters, outlines
26
+ - course — Courses, curricula, lessons
27
+ - business-plan — Business plans, pitch decks, financials
28
+ - content-marketing — Content calendars, articles
29
+ - tech-docs — Documentation, API references, tutorials`,
30
+ },
31
+ {
32
+ id: 'project-types',
33
+ title: 'Project Types',
34
+ keywords: [
35
+ 'project type',
36
+ 'software',
37
+ 'research',
38
+ 'book',
39
+ 'business',
40
+ 'course',
41
+ 'content',
42
+ 'tech-docs',
43
+ ],
44
+ content: `Each project type determines which agent roles, skills, and tools are most relevant:
45
+
46
+ **software** — Agent roles: dev, pm, qa, arch. Skills: /design, /prd, /architecture, /scaffold, /build
47
+ **research** — Agent roles: researcher, reviewer, writer. Skills: /outline, /literature-review, /methodology, /abstract
48
+ **book** — Agent roles: editor, writer, reviewer. Skills: /outline, /chapter
49
+ **course** — Agent roles: instructor, writer, reviewer. Skills: /outline, /lesson
50
+ **business-plan** — Agent roles: analyst, strategist, writer. Skills: /business-vision, /market-analysis, /financial-model, /pitch
51
+ **content-marketing** — Agent roles: writer, editor, strategist. Skills: /editorial-calendar, /article
52
+ **tech-docs** — Agent roles: writer, dev, reviewer. Skills: /getting-started, /api-reference, /tutorial
53
+
54
+ All project types support: teams, backlog, documents, knowledge base, file references, anchors.`,
55
+ },
56
+ {
57
+ id: 'importing-project',
58
+ title: 'Importing an Existing Project',
59
+ keywords: ['import', 'existing', 'project', 'folder'],
60
+ content: `You can import an existing project directory. The system will:
61
+ 1. Detect the project type from its contents
62
+ 2. Create a project entry in the database
63
+ 3. Read COMPILR.md if present (project context for the agent)
64
+ 4. Set it as the active project
65
+
66
+ The agent then has context about your project and can help immediately.`,
67
+ },
68
+ {
69
+ id: 'switching-projects',
70
+ title: 'Switching Projects',
71
+ keywords: ['switch', 'change', 'project', 'select'],
72
+ content: `You can switch between projects at any time. When you switch:
73
+ - The active project changes
74
+ - Agents get the new project's context (COMPILR.md, anchors, KB)
75
+ - Existing conversations are preserved (per-project)`,
76
+ },
77
+ // ── Teams & Agents ──────────────────────────────────────────────────────
78
+ {
79
+ id: 'team-agents',
80
+ title: 'Team Agents',
81
+ keywords: ['team', 'agents', '$agent', 'mention', 'role', 'specialist'],
82
+ content: `Team agents are specialized AI assistants with different roles and expertise.
83
+
84
+ Use $agent to mention an agent (e.g., "$arch review this design", "$qa write tests").
85
+
86
+ Available roles:
87
+ - $dev — Software developer (coding, debugging)
88
+ - $pm — Product manager (requirements, priorities)
89
+ - $qa — QA engineer (testing, quality)
90
+ - $arch — Architect (design, patterns, decisions)
91
+ - $writer — Technical writer (docs, README)
92
+ - $researcher — Research assistant (literature, analysis)
93
+ - $reviewer — Code/content reviewer
94
+ - $editor — Content editor (prose, structure)
95
+ - $analyst — Data/business analyst
96
+ - $strategist — Strategy and planning
97
+ - $instructor — Teaching and course design
98
+
99
+ Each role has a tailored system prompt and tool set.`,
100
+ },
101
+ {
102
+ id: 'coordinator-mode',
103
+ title: 'Coordinator Mode',
104
+ keywords: ['coordinator', 'delegation', 'delegate', 'background', 'multi-agent'],
105
+ content: `Coordinator mode allows one agent to delegate tasks to others.
106
+
107
+ The coordinator can:
108
+ - delegate_background: Send a task to another agent to run in background
109
+ - delegation_status: Check on running delegations
110
+ - Receive results when delegated tasks complete
111
+
112
+ Useful for: code review ($qa), documentation ($writer), architecture analysis ($arch).
113
+
114
+ The delegated agent runs independently and returns results to the coordinator.`,
115
+ },
116
+ // ── Skills ──────────────────────────────────────────────────────────────
117
+ {
118
+ id: 'skills-overview',
119
+ title: 'Skills Overview',
120
+ keywords: ['skills', 'slash', 'command', '/'],
121
+ content: `Skills are pre-built prompts that guide the agent through specific workflows.
122
+
123
+ Use them by typing / followed by the skill name (e.g., /design, /build).
124
+
125
+ Skills vary by project type. Software projects have: /design, /prd, /architecture, /scaffold, /build, /backlog, /session-notes.
126
+
127
+ Research projects have: /outline, /literature-review, /methodology, /abstract.
128
+
129
+ Business projects have: /business-vision, /market-analysis, /financial-model, /pitch.
130
+
131
+ Skills can be combined with your own instructions: type /design then add context.`,
132
+ },
133
+ // ── Models & Providers ──────────────────────────────────────────────────
134
+ {
135
+ id: 'models',
136
+ title: 'Models and Providers',
137
+ keywords: ['model', 'provider', 'claude', 'openai', 'gemini', 'ollama', 'llm'],
138
+ content: `Compilr Dev supports multiple LLM providers:
139
+
140
+ - Claude (Anthropic) — Claude Opus, Sonnet, Haiku
141
+ - OpenAI — GPT-4o, GPT-4o-mini
142
+ - Gemini (Google) — Gemini 2.5 Pro, Flash
143
+ - Ollama — Local models (llama, codellama, etc.)
144
+ - Together, Groq, Fireworks, Perplexity, OpenRouter
145
+
146
+ Each provider requires an API key (except Ollama which runs locally).
147
+ Models are organized by tier: premium, balanced, fast.`,
148
+ },
149
+ // ── Context & Memory ────────────────────────────────────────────────────
150
+ {
151
+ id: 'file-references',
152
+ title: 'File References (@file)',
153
+ keywords: ['file', 'reference', '@', 'attach', 'mention'],
154
+ content: `Reference files in your messages with @filename.
155
+
156
+ Examples:
157
+ @src/index.ts — Agent reads this file for context
158
+ @package.json — Agent checks dependencies
159
+
160
+ The agent will use its tools to read the referenced files.`,
161
+ },
162
+ {
163
+ id: 'compilr-md',
164
+ title: 'COMPILR.md — Project Context',
165
+ keywords: ['compilr.md', 'context', 'project', 'instructions'],
166
+ content: `COMPILR.md is a markdown file in your project root that gives the agent context.
167
+
168
+ It can include:
169
+ - Project description and goals
170
+ - Tech stack and dependencies
171
+ - Coding conventions
172
+ - Build/test commands
173
+ - Important file locations
174
+
175
+ The agent reads this on every conversation to understand your project.
176
+ Create one manually or let the agent generate it.`,
177
+ },
178
+ {
179
+ id: 'knowledge-base',
180
+ title: 'Knowledge Base',
181
+ keywords: ['knowledge', 'kb', 'reference', 'docs', 'upload', 'pin'],
182
+ content: `The knowledge base stores reference documents for your project.
183
+
184
+ You can add:
185
+ - Files (code, markdown, text, PDF, images)
186
+ - Pasted text snippets
187
+ - URLs (web page content imported)
188
+
189
+ Pin important files to include them in every agent conversation.
190
+ Unpinned files are available on-demand (agent uses view tools).
191
+
192
+ Images in the KB can be viewed by the agent using the view_image tool.`,
193
+ },
194
+ {
195
+ id: 'context-management',
196
+ title: 'Context Management',
197
+ keywords: ['context', 'tokens', 'compaction', 'observation', 'masking', 'window'],
198
+ content: `The agent manages its context window automatically:
199
+
200
+ - Observation masking: Old tool results replaced with compact summaries after a few turns
201
+ - Image masking: Old images replaced with text placeholders (saves 1000+ tokens per image)
202
+ - Tool output compression: Large outputs compressed by 60-90% (git, npm, file listings)
203
+ - Smart windowing: Oldest messages compacted when context fills up
204
+
205
+ You can see context utilization in the status bar or via /context.`,
206
+ },
207
+ // ── Permissions ─────────────────────────────────────────────────────────
208
+ {
209
+ id: 'permissions',
210
+ title: 'Permissions',
211
+ keywords: ['permission', 'approve', 'deny', 'auto-accept', 'security'],
212
+ content: `Agents ask permission before running potentially dangerous tools.
213
+
214
+ Permission modes:
215
+ - Normal — Agent asks before bash, edit, write operations
216
+ - Auto-accept — Automatically approve all tool calls (faster, less safe)
217
+
218
+ You can set per-tool rules (always allow, always deny, always ask).
219
+
220
+ In restricted mode (untrusted workspace), bash/edit/write are blocked entirely.`,
221
+ },
222
+ // ── Images ──────────────────────────────────────────────────────────────
223
+ {
224
+ id: 'image-support',
225
+ title: 'Image Support',
226
+ keywords: ['image', 'screenshot', 'picture', 'paste', 'vision', 'multimodal'],
227
+ content: `You can send images to agents for visual analysis.
228
+
229
+ Supported formats: PNG, JPEG, GIF, WebP.
230
+
231
+ Images are automatically resized to max 1568px (Claude's recommended max) to save tokens.
232
+ After a few turns, images are replaced with text placeholders to further reduce token cost.
233
+
234
+ The agent can also view image files from disk using the view_image tool.
235
+
236
+ All major providers support images: Claude, OpenAI GPT-4o, Gemini.`,
237
+ },
238
+ // ── Workspace Trust ─────────────────────────────────────────────────────
239
+ {
240
+ id: 'workspace-trust',
241
+ title: 'Workspace Trust',
242
+ keywords: ['trust', 'restricted', 'security', 'untrusted', 'safe'],
243
+ content: `When you open a project for the first time, you're asked to trust it.
244
+
245
+ Trusted projects: Full agent capabilities — bash, file editing, terminal.
246
+ Restricted projects: Read-only — agents can read files and answer questions but cannot run commands or modify files.
247
+
248
+ You can change trust status by clicking the "Restricted" badge in the status bar.
249
+
250
+ Trust is inherited: if you trust /projects/myapp, all subdirectories are also trusted.`,
251
+ },
252
+ // ── Anchors ─────────────────────────────────────────────────────────────
253
+ {
254
+ id: 'anchors',
255
+ title: 'Anchors — Persistent Context',
256
+ keywords: ['anchor', 'pin', 'persistent', 'important', 'remember'],
257
+ content: `Anchors are persistent notes that stay in the agent's context across conversations.
258
+
259
+ Use them for:
260
+ - Architecture decisions ("We chose PostgreSQL because...")
261
+ - Important conventions ("All API routes use camelCase")
262
+ - Work-in-progress notes ("Auth module is half-done, don't touch")
263
+
264
+ Anchors survive session restarts and project switches.
265
+ The agent sees them in every conversation.`,
266
+ },
267
+ ];
@@ -0,0 +1,34 @@
1
+ /**
2
+ * Guide types — shared across SDK, CLI, and Desktop.
3
+ */
4
+ /**
5
+ * A single guide entry the agent can return to the user.
6
+ */
7
+ export interface GuideEntry {
8
+ id: string;
9
+ title: string;
10
+ keywords: string[];
11
+ content: string;
12
+ }
13
+ /**
14
+ * Structured content topic (used for tutorials in CLI, converted to GuideEntry for the tool).
15
+ */
16
+ export interface ContentSection {
17
+ title?: string;
18
+ items: string[];
19
+ }
20
+ export interface ContentTopic {
21
+ id: string;
22
+ title: string;
23
+ keywords: string[];
24
+ sections: ContentSection[];
25
+ }
26
+ /**
27
+ * Configuration for the guide tool factory.
28
+ */
29
+ export interface GuideToolConfig {
30
+ /** Which environment the tool is running in */
31
+ environment: 'cli' | 'desktop';
32
+ /** Additional environment-specific content to merge with shared content */
33
+ additionalEntries?: GuideEntry[];
34
+ }
@@ -0,0 +1,4 @@
1
+ /**
2
+ * Guide types — shared across SDK, CLI, and Desktop.
3
+ */
4
+ export {};
package/dist/index.d.ts CHANGED
@@ -58,6 +58,10 @@ export { createSQLiteRepositories, SQLiteProjectRepository, SQLiteWorkItemReposi
58
58
  export type { SQLiteRepositories, CreateSQLiteRepositoriesOptions, ProjectDeleteHooks, ProjectRecord, WorkItemRecord, ProjectDocumentRecord, WorkItemCommentRecord, } from './platform/index.js';
59
59
  export { createAskUserTool, createAskUserSimpleTool } from './tools/index.js';
60
60
  export type { AskUserQuestion, AskUserInput, AskUserResult, AskUserHandler, AskUserSimpleInput, AskUserSimpleResult, AskUserSimpleHandler, } from './tools/index.js';
61
+ export { detectProject, suggestProjectType, detectCommon } from './detection/index.js';
62
+ export type { DetectProjectOptions, DetectionResult, ContentSummary } from './detection/index.js';
63
+ export { createGuideTool, SHARED_GUIDE_ENTRIES, searchGuideEntries, topicToGuideEntry, } from './guide/index.js';
64
+ export type { GuideEntry, ContentTopic, ContentSection, GuideToolConfig } from './guide/index.js';
61
65
  export { createPlatformTools, createProjectTools, createWorkItemTools, createDocumentTools, createPlanTools, createBacklogTools, createAnchorTools, createArtifactTools, createEpisodeTools, createImageTools, ProjectAnchorStore, } from './platform/index.js';
62
66
  export type { ProjectAnchorStoreConfig, ImageToolsConfig, ImageResizer } from './platform/index.js';
63
67
  export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getStepCriteria, formatStepDisplay, getStepNumber, } from './platform/index.js';
package/dist/index.js CHANGED
@@ -129,6 +129,14 @@ export { createSQLiteRepositories, SQLiteProjectRepository, SQLiteWorkItemReposi
129
129
  // =============================================================================
130
130
  export { createAskUserTool, createAskUserSimpleTool } from './tools/index.js';
131
131
  // =============================================================================
132
+ // Project Detection (universal project content detection)
133
+ // =============================================================================
134
+ export { detectProject, suggestProjectType, detectCommon } from './detection/index.js';
135
+ // =============================================================================
136
+ // Guide Tool (environment-aware documentation)
137
+ // =============================================================================
138
+ export { createGuideTool, SHARED_GUIDE_ENTRIES, searchGuideEntries, topicToGuideEntry, } from './guide/index.js';
139
+ // =============================================================================
132
140
  // Platform Tools (runtime — createPlatformTools factory + individual factories)
133
141
  // =============================================================================
134
142
  export { createPlatformTools, createProjectTools, createWorkItemTools, createDocumentTools, createPlanTools, createBacklogTools, createAnchorTools, createArtifactTools, createEpisodeTools, createImageTools, ProjectAnchorStore, } from './platform/index.js';
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@compilr-dev/sdk",
3
- "version": "0.9.7",
3
+ "version": "0.9.9",
4
4
  "description": "Universal agent runtime for building AI-powered applications",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",