@compilr-dev/cli 0.5.17 → 0.6.1

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 (35) hide show
  1. package/dist/.tsbuildinfo.app +1 -1
  2. package/dist/.tsbuildinfo.data +1 -1
  3. package/dist/.tsbuildinfo.domain +1 -1
  4. package/dist/agent.d.ts +41 -111
  5. package/dist/agent.js +238 -390
  6. package/dist/commands-v2/handlers/project.d.ts +1 -0
  7. package/dist/commands-v2/handlers/project.js +36 -2
  8. package/dist/commands-v2/handlers/team.js +23 -3
  9. package/dist/compilr-diff-companion.vsix +0 -0
  10. package/dist/entitlements/index.d.ts +23 -0
  11. package/dist/entitlements/index.js +110 -0
  12. package/dist/guide/cli-guide-entries.d.ts +15 -0
  13. package/dist/guide/cli-guide-entries.js +99 -0
  14. package/dist/guide/index.d.ts +5 -4
  15. package/dist/guide/index.js +4 -3
  16. package/dist/guide/shared-content.js +188 -21
  17. package/dist/handlers/permission-handler.js +10 -3
  18. package/dist/index.js +18 -0
  19. package/dist/repl-v2.d.ts +16 -0
  20. package/dist/repl-v2.js +51 -17
  21. package/dist/tools/db-tools.d.ts +1 -1
  22. package/dist/tools/platform-adapter.d.ts +1 -1
  23. package/dist/tools/platform-adapter.js +6 -1
  24. package/dist/tools.js +6 -1
  25. package/dist/ui/overlay/impl/app-model-overlay-v2.d.ts +57 -0
  26. package/dist/ui/overlay/impl/app-model-overlay-v2.js +232 -0
  27. package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.d.ts +23 -1
  28. package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.js +203 -47
  29. package/dist/ui/overlay/impl/model-overlay-v2.js +2 -2
  30. package/dist/ui/overlay/impl/new-overlay-v2.d.ts +2 -2
  31. package/dist/ui/overlay/impl/new-overlay-v2.js +10 -17
  32. package/dist/ui/overlay/impl/team-overlay-v2.js +2 -2
  33. package/dist/ui/overlay/index.d.ts +1 -0
  34. package/dist/ui/overlay/index.js +1 -0
  35. package/package.json +4 -4
@@ -19,4 +19,5 @@ export declare const scaffoldCommand: CommandHandlerV2;
19
19
  export declare const archCommand: CommandHandlerV2;
20
20
  export declare const docsCommand: CommandHandlerV2;
21
21
  export declare const projectsCommand: CommandHandlerV2;
22
+ export declare const appCommand: CommandHandlerV2;
22
23
  export declare const projectCommands: CommandHandlerV2[];
@@ -4,7 +4,7 @@
4
4
  * Commands for project management: init, backlog, workflow, anchors, design, sketch, refine
5
5
  */
6
6
  import { executeCommand } from '../registry.js';
7
- import { BacklogOverlayV2, WorkflowOverlayV2, DocsOverlayV2, DocumentDetailOverlayV2, AnchorsOverlayV2, ProjectsOverlayV2, NewProjectOverlayV2, OnboardingWizardOverlayV2, KeysOverlayV2, ArchTypeOverlayV2, ModelWarningOverlayV2 } from '../../ui/overlay/index.js';
7
+ import { BacklogOverlayV2, WorkflowOverlayV2, DocsOverlayV2, DocumentDetailOverlayV2, AnchorsOverlayV2, ProjectsOverlayV2, NewProjectOverlayV2, OnboardingWizardOverlayV2, KeysOverlayV2, ArchTypeOverlayV2, ModelWarningOverlayV2, AppModelOverlayV2 } from '../../ui/overlay/index.js';
8
8
  import { projectRepository, workItemRepository, documentRepository } from '../../db/repositories/index.js';
9
9
  import { setCurrentProject, getCurrentProject } from '../../tools/project-db.js';
10
10
  import { getSkillPrompt } from '../../repl-helpers.js';
@@ -85,7 +85,7 @@ export const newCommand = {
85
85
  display_name: displayName,
86
86
  description: result.description,
87
87
  path: result.projectPath,
88
- type: 'general',
88
+ type: 'general', // TODO: wizard should let user pick project type (web/cli/library/api/research/etc.)
89
89
  workflow_mode: result.workflowMode ?? 'flexible',
90
90
  git_remote: result.gitRemote,
91
91
  // For imports, include detected language and framework
@@ -1120,6 +1120,39 @@ export const projectsCommand = {
1120
1120
  },
1121
1121
  };
1122
1122
  // =============================================================================
1123
+ // App Model Command
1124
+ // =============================================================================
1125
+ export const appCommand = {
1126
+ name: 'app',
1127
+ description: 'View the application model (entities, relationships, features)',
1128
+ details: 'Opens an interactive overlay showing the ApplicationModel for the current project. Browse entities with their fields and relationships, see the relationship map, and review model summary stats.',
1129
+ examples: [{ code: '/app' }],
1130
+ interactions: [
1131
+ 'Tab cycles: Entities → Relationships → Summary',
1132
+ '↑/↓ to navigate, Enter for entity detail',
1133
+ '/ to search, q/Esc to close',
1134
+ ],
1135
+ async execute(_args, ctx) {
1136
+ const currentProject = getCurrentProject();
1137
+ if (!currentProject) {
1138
+ ctx.ui.print({ type: 'warning', message: 'No active project. Use /new or /projects first.' });
1139
+ return true;
1140
+ }
1141
+ // Load app model from document store
1142
+ const appModelDoc = documentRepository.getByType(currentProject.id, 'app-model');
1143
+ if (!appModelDoc) {
1144
+ ctx.ui.print({ type: 'warning', message: 'No application model found for this project.' });
1145
+ return true;
1146
+ }
1147
+ const overlay = new AppModelOverlayV2({
1148
+ modelJson: appModelDoc.content,
1149
+ projectName: currentProject.displayName,
1150
+ });
1151
+ await ctx.ui.showOverlay(overlay);
1152
+ return true;
1153
+ },
1154
+ };
1155
+ // =============================================================================
1123
1156
  // Export All Project Commands
1124
1157
  // =============================================================================
1125
1158
  export const projectCommands = [
@@ -1138,4 +1171,5 @@ export const projectCommands = [
1138
1171
  archCommand,
1139
1172
  docsCommand,
1140
1173
  projectsCommand,
1174
+ appCommand,
1141
1175
  ];
@@ -10,6 +10,7 @@ import { ArtifactOverlayV2, ArtifactDetailOverlayV2 } from '../../ui/overlay/ind
10
10
  import { ROLE_METADATA, PREDEFINED_ROLE_IDS } from '../../multi-agent/index.js';
11
11
  import { loadCustomAgents, createCustomAgentDefinition, addCustomAgent, removeCustomAgent, } from '../../multi-agent/custom-agents.js';
12
12
  import { getCurrentProject } from '../../tools/project-db.js';
13
+ import { listTemplates, saveTemplate } from '@compilr-dev/sdk';
13
14
  import { getSessionRegistry } from '../../multi-agent/session-registry.js';
14
15
  import { saveCurrentTeam, saveCurrentSession } from './session.js';
15
16
  // =============================================================================
@@ -291,19 +292,38 @@ async function handleCreateCustomAgent(ctx, team) {
291
292
  // Load existing custom agents for duplicate check
292
293
  const existingCustomAgents = loadCustomAgents(projectPath);
293
294
  const teamAgentIds = team.getAgentIds();
294
- // Show custom agent form
295
+ // Load templates for pre-population
296
+ const templates = listTemplates();
297
+ // Show custom agent form (with template support)
295
298
  const formOverlay = new CustomAgentFormOverlayV2({
296
299
  existingCustomAgents,
297
300
  teamAgentIds,
301
+ templates: templates.length > 0 ? templates : undefined,
298
302
  });
299
303
  const formResult = await ctx.ui.showOverlay(formOverlay);
300
304
  // User cancelled
301
305
  if (!formResult || formResult.cancelled || !formResult.agent) {
302
306
  return;
303
307
  }
304
- // Create the custom agent definition
308
+ // Save as template if user chose to
305
309
  const agentData = formResult.agent;
306
- const agentDef = createCustomAgentDefinition(agentData.id, agentData.displayName, agentData.specialty, agentData.personality, existingCustomAgents, agentData.toolConfig, agentData.enabledSkills, agentData.modelTier);
310
+ if (formResult.saveAsTemplate) {
311
+ saveTemplate(formResult.saveAsTemplate, {
312
+ id: agentData.id,
313
+ displayName: agentData.displayName,
314
+ specialty: agentData.specialty,
315
+ personality: agentData.personality,
316
+ systemPromptAddition: agentData.systemPromptAddition,
317
+ mascot: '',
318
+ createdAt: new Date().toISOString(),
319
+ toolConfig: agentData.toolConfig,
320
+ enabledSkills: agentData.enabledSkills,
321
+ modelTier: agentData.modelTier,
322
+ });
323
+ ctx.ui.print({ type: 'success', message: `Template "${formResult.saveAsTemplate}" saved.` });
324
+ }
325
+ // Create the custom agent definition
326
+ const agentDef = createCustomAgentDefinition(agentData.id, agentData.displayName, agentData.specialty, agentData.personality, existingCustomAgents, agentData.toolConfig, agentData.enabledSkills, agentData.modelTier, agentData.systemPromptAddition);
307
327
  // Save to project
308
328
  try {
309
329
  addCustomAgent(projectPath, agentDef);
Binary file
@@ -0,0 +1,23 @@
1
+ /**
2
+ * EntitlementService — Server-driven tier management for the CLI.
3
+ *
4
+ * Wraps the SDK's EntitlementCache with CLI-specific concerns:
5
+ * - Fetches from compilr.dev backend using the user's API token
6
+ * - Uses encrypted file for offline backup
7
+ * - Warms cache on startup
8
+ */
9
+ import { EntitlementCache } from '@compilr-dev/sdk';
10
+ import { DailyCounter } from '@compilr-dev/sdk';
11
+ /** Daily message counter — tracks agent LLM calls per day */
12
+ export declare const dailyMessageCounter: DailyCounter;
13
+ /** Daily conversation counter */
14
+ export declare const dailyConversationCounter: DailyCounter;
15
+ /**
16
+ * Get or create the entitlement cache singleton.
17
+ * @param getToken — async function that returns the current auth token
18
+ */
19
+ export declare function getEntitlementCache(getToken: () => Promise<string>): EntitlementCache;
20
+ /**
21
+ * Warm the cache on startup. Non-blocking — logs but doesn't throw.
22
+ */
23
+ export declare function warmEntitlementCache(getToken: () => Promise<string>): Promise<void>;
@@ -0,0 +1,110 @@
1
+ /**
2
+ * EntitlementService — Server-driven tier management for the CLI.
3
+ *
4
+ * Wraps the SDK's EntitlementCache with CLI-specific concerns:
5
+ * - Fetches from compilr.dev backend using the user's API token
6
+ * - Uses encrypted file for offline backup
7
+ * - Warms cache on startup
8
+ */
9
+ import { EntitlementCache } from '@compilr-dev/sdk';
10
+ import { existsSync, readFileSync, writeFileSync, mkdirSync } from 'node:fs';
11
+ import { join } from 'node:path';
12
+ import { createCipheriv, createDecipheriv, randomBytes, createHash } from 'node:crypto';
13
+ import { homedir } from 'node:os';
14
+ // ─── Encrypted File Store ───────────────────────────────────────────────────
15
+ function getEntitlementPath() {
16
+ return join(homedir(), '.compilr-dev', 'entitlements.enc');
17
+ }
18
+ /**
19
+ * Derive a machine-specific encryption key from hostname + username.
20
+ * Not cryptographically strong against targeted attacks, but prevents
21
+ * casual file copying between machines.
22
+ */
23
+ function deriveKey() {
24
+ const material = `compilr-entitlements:${homedir()}:${String(process.pid)}`;
25
+ return createHash('sha256').update(material).digest();
26
+ }
27
+ const cliStore = {
28
+ save(data) {
29
+ try {
30
+ const dir = join(homedir(), '.compilr-dev');
31
+ if (!existsSync(dir))
32
+ mkdirSync(dir, { recursive: true });
33
+ const key = deriveKey();
34
+ const iv = randomBytes(16);
35
+ const cipher = createCipheriv('aes-256-cbc', key, iv);
36
+ const encrypted = Buffer.concat([cipher.update(data, 'utf-8'), cipher.final()]);
37
+ const payload = Buffer.concat([iv, encrypted]);
38
+ writeFileSync(getEntitlementPath(), payload);
39
+ }
40
+ catch {
41
+ // Best effort — don't crash on write failure
42
+ }
43
+ return Promise.resolve();
44
+ },
45
+ load() {
46
+ const path = getEntitlementPath();
47
+ if (!existsSync(path))
48
+ return Promise.resolve(null);
49
+ try {
50
+ const payload = readFileSync(path);
51
+ const iv = payload.subarray(0, 16);
52
+ const encrypted = payload.subarray(16);
53
+ const key = deriveKey();
54
+ const decipher = createDecipheriv('aes-256-cbc', key, iv);
55
+ const decrypted = Buffer.concat([decipher.update(encrypted), decipher.final()]);
56
+ return Promise.resolve(decrypted.toString('utf-8'));
57
+ }
58
+ catch {
59
+ return Promise.resolve(null);
60
+ }
61
+ },
62
+ };
63
+ // ─── Fetch Function ─────────────────────────────────────────────────────────
64
+ async function fetchEntitlements(getToken) {
65
+ const token = await getToken();
66
+ const apiUrl = process.env['COMPILR_API_URL'] ?? 'https://compilr.dev/.netlify/functions';
67
+ const resp = await fetch(`${apiUrl}/cli-entitlements`, {
68
+ method: 'GET',
69
+ headers: {
70
+ 'Authorization': `Bearer ${token}`,
71
+ 'Content-Type': 'application/json',
72
+ },
73
+ });
74
+ if (!resp.ok) {
75
+ throw new Error(`Entitlements fetch failed: ${String(resp.status)}`);
76
+ }
77
+ return await resp.json();
78
+ }
79
+ // ─── Singleton ──────────────────────────────────────────────────────────────
80
+ import { DailyCounter } from '@compilr-dev/sdk';
81
+ let cacheInstance = null;
82
+ /** Daily message counter — tracks agent LLM calls per day */
83
+ export const dailyMessageCounter = new DailyCounter();
84
+ /** Daily conversation counter */
85
+ export const dailyConversationCounter = new DailyCounter();
86
+ /**
87
+ * Get or create the entitlement cache singleton.
88
+ * @param getToken — async function that returns the current auth token
89
+ */
90
+ export function getEntitlementCache(getToken) {
91
+ if (!cacheInstance) {
92
+ cacheInstance = new EntitlementCache({
93
+ fetchFn: () => fetchEntitlements(getToken),
94
+ store: cliStore,
95
+ });
96
+ }
97
+ return cacheInstance;
98
+ }
99
+ /**
100
+ * Warm the cache on startup. Non-blocking — logs but doesn't throw.
101
+ */
102
+ export async function warmEntitlementCache(getToken) {
103
+ try {
104
+ const cache = getEntitlementCache(getToken);
105
+ await cache.get();
106
+ }
107
+ catch {
108
+ // Not critical — will retry on next access
109
+ }
110
+ }
@@ -0,0 +1,15 @@
1
+ /**
2
+ * CLI-Specific Guide Entries
3
+ *
4
+ * These entries are only relevant for the CLI environment.
5
+ * Combined with SDK shared content via createGuideTool({ additionalEntries }).
6
+ *
7
+ * The shared-content.ts file is still used by the /tutorial overlay (CLI UI).
8
+ * This file converts those topics + CLI-only entries for the SDK guide tool.
9
+ */
10
+ import type { GuideEntry } from '@compilr-dev/sdk';
11
+ /**
12
+ * All CLI-specific guide entries.
13
+ * Includes CLI-only topics + converted shared-content topics (used by /tutorial).
14
+ */
15
+ export declare const CLI_GUIDE_ENTRIES: GuideEntry[];
@@ -0,0 +1,99 @@
1
+ /**
2
+ * CLI-Specific Guide Entries
3
+ *
4
+ * These entries are only relevant for the CLI environment.
5
+ * Combined with SDK shared content via createGuideTool({ additionalEntries }).
6
+ *
7
+ * The shared-content.ts file is still used by the /tutorial overlay (CLI UI).
8
+ * This file converts those topics + CLI-only entries for the SDK guide tool.
9
+ */
10
+ import { topicToGuideEntry } from '@compilr-dev/sdk';
11
+ import { CONTENT_TOPICS } from './shared-content.js';
12
+ // =============================================================================
13
+ // CLI-Only Entries (not in shared SDK content, not in tutorials)
14
+ // =============================================================================
15
+ const CLI_ONLY_ENTRIES = [
16
+ {
17
+ id: 'cli-overview',
18
+ title: 'Compilr Dev CLI Overview',
19
+ keywords: ['overview', 'what is', 'introduction', 'about', 'compilr', 'cli'],
20
+ content: `Compilr Dev CLI is an AI-powered coding assistant for your terminal.
21
+
22
+ Key features:
23
+ - Multi-LLM support (Claude, OpenAI, Gemini, Ollama)
24
+ - Project management with structured workflows
25
+ - Requirements gathering with /design command
26
+ - Backlog tracking with /backlog command
27
+ - Team agents for specialized assistance ($arch, $pm, $qa, etc.)
28
+ - Session persistence and context management
29
+ - Image support (paste screenshots into chat)
30
+
31
+ The CLI has two main interfaces:
32
+ 1. Dashboard — A menu-based interface for project management
33
+ 2. REPL — A command-line interface for chatting with the AI
34
+
35
+ Run "compilr" to start. Use /help to see all commands.`,
36
+ },
37
+ {
38
+ id: 'workflow-modes',
39
+ title: 'Workflow',
40
+ keywords: ['workflow', 'flexible', 'mode'],
41
+ content: `The agent works in flexible mode — it responds to your requests and adapts to your workflow.
42
+
43
+ The agent checks your project state and suggests next steps:
44
+ - Does the project have a PRD? If not, suggests /design
45
+ - Are there backlog items? Suggests /build
46
+ - Is architecture documented? Suggests /arch
47
+
48
+ Use /workflow to see project status and recommended next actions.`,
49
+ },
50
+ {
51
+ id: 'workflow-recommended',
52
+ title: 'Recommended Workflow',
53
+ keywords: ['workflow', 'how to', 'best practice', 'process'],
54
+ content: `Recommended workflow for new projects:
55
+
56
+ 1. Create project with /new — choose tech stack, set up git
57
+ 2. Plan with /design — describe what you want, AI generates PRD + backlog
58
+ 3. Review backlog with /backlog — prioritize tasks
59
+ 4. Build features — "Build REQ-001: User authentication"
60
+ 5. Manage context — /compact when context fills up, /anchors for decisions, /resume to continue later`,
61
+ },
62
+ {
63
+ id: 'command-resume',
64
+ title: '/resume Command',
65
+ keywords: ['/resume', 'resume', 'session', 'continue', 'previous'],
66
+ content: `/resume — Continue a previous session.
67
+
68
+ Sessions are auto-saved after each AI response.
69
+
70
+ Navigation: j/k (up/down), / (search), Enter (resume), d (delete), q/Esc (close)
71
+
72
+ Saved per session: conversation history, todo list, workflow state, token usage.
73
+ Saved per project (not session): anchors, team agents, documents.`,
74
+ },
75
+ {
76
+ id: 'command-team',
77
+ title: '/team Command',
78
+ keywords: ['/team', 'team', 'agents', 'manage'],
79
+ content: `/team — View and manage team agents.
80
+
81
+ Shows all available agents with status and context usage.
82
+ Tabs: Agents (list) | Context (token usage per agent)
83
+
84
+ Switch agents: select + Enter, or use $ prefix in REPL ($arch, $pm, $qa).`,
85
+ },
86
+ ];
87
+ // =============================================================================
88
+ // Combined CLI Entries (CLI-only + shared-content topics)
89
+ // =============================================================================
90
+ /**
91
+ * All CLI-specific guide entries.
92
+ * Includes CLI-only topics + converted shared-content topics (used by /tutorial).
93
+ */
94
+ export const CLI_GUIDE_ENTRIES = [
95
+ ...CLI_ONLY_ENTRIES,
96
+ // Convert shared ContentTopics to GuideEntries (these are CLI-specific
97
+ // topics like overlay navigation, REPL, dashboard, /commands)
98
+ ...CONTENT_TOPICS.map(topicToGuideEntry),
99
+ ];
@@ -1,8 +1,9 @@
1
1
  /**
2
2
  * Compilr Guide Module
3
3
  *
4
- * Provides documentation for the AI agent to answer user questions
5
- * about how to use the CLI.
4
+ * CLI-specific guide entries for the SDK's compilr_guide tool.
5
+ * shared-content.ts is still used by the /tutorial overlay.
6
6
  */
7
- export { searchGuide, getGuideTopics, guideEntries } from './guide-content.js';
8
- export type { GuideEntry } from './guide-content.js';
7
+ export { CLI_GUIDE_ENTRIES } from './cli-guide-entries.js';
8
+ export { CONTENT_TOPICS, topicToPlainText, searchContentTopics, getAllTopicIds } from './shared-content.js';
9
+ export type { ContentTopic, ContentSection } from './shared-content.js';
@@ -1,7 +1,8 @@
1
1
  /**
2
2
  * Compilr Guide Module
3
3
  *
4
- * Provides documentation for the AI agent to answer user questions
5
- * about how to use the CLI.
4
+ * CLI-specific guide entries for the SDK's compilr_guide tool.
5
+ * shared-content.ts is still used by the /tutorial overlay.
6
6
  */
7
- export { searchGuide, getGuideTopics, guideEntries } from './guide-content.js';
7
+ export { CLI_GUIDE_ENTRIES } from './cli-guide-entries.js';
8
+ export { CONTENT_TOPICS, topicToPlainText, searchContentTopics, getAllTopicIds } from './shared-content.js';
@@ -258,9 +258,10 @@ export const CONTENT_TOPICS = [
258
258
  {
259
259
  title: 'After /design completes:',
260
260
  items: [
261
- 'PRD is saved to the project database (via project_document_add)',
261
+ 'PRD is saved to the project database',
262
+ 'Application Model is created (entities, fields, relationships)',
262
263
  'Work items are added to your backlog',
263
- 'Use /backlog to view and prioritize items',
264
+ 'Use /backlog to view items, /app to view the model',
264
265
  ],
265
266
  },
266
267
  {
@@ -429,35 +430,41 @@ export const CONTENT_TOPICS = [
429
430
  {
430
431
  id: 'command-scaffold',
431
432
  title: '/scaffold Command',
432
- keywords: ['/scaffold', 'scaffold', 'project setup', 'foundation', 'boilerplate'],
433
+ keywords: ['/scaffold', 'scaffold', 'project setup', 'foundation', 'boilerplate', 'factory', 'generate'],
433
434
  sections: [
434
435
  {
435
- items: ['/scaffold - Create the base project structure (folders, config, dependencies, initial code).'],
436
+ items: ['/scaffold - Generate a full project from the Application Model or create a base structure.'],
436
437
  },
437
438
  {
438
- title: 'When to use:',
439
+ title: 'Two modes:',
439
440
  items: [
440
- 'After /design or /sketch has created your backlog',
441
- 'When starting from scratch (empty project directory)',
442
- 'When you need a working foundation before building features',
441
+ 'Factory mode: If an Application Model exists (from /design), scaffolds using the factory',
442
+ 'Manual mode: If no model, the agent creates structure from scratch',
443
443
  ],
444
444
  },
445
445
  {
446
- title: 'What it produces:',
446
+ title: 'Factory toolkits:',
447
447
  items: [
448
- 'Folder structure (src, tests, config)',
449
- 'Package manager setup (package.json, dependencies)',
450
- 'Configuration files (TypeScript, ESLint, etc.)',
451
- 'Initial code (entry points, basic routes)',
452
- 'Git commit with the scaffolded project',
448
+ 'react-node - React 18 + Vite + Tailwind + Express + PostgreSQL',
449
+ 'next-prisma - Next.js 14 App Router + Prisma ORM + Tailwind',
450
+ 'static-landing - HTML + Tailwind CSS landing page',
451
+ 'react-fastapi - React 18 + Vite + Tailwind + FastAPI (Python)',
452
+ 'react-go - React 18 + Vite + Tailwind + Go (net/http)',
453
453
  ],
454
454
  },
455
455
  {
456
+ title: 'What factory mode produces:',
456
457
  items: [
457
- 'Requires a large model tier (Sonnet/Opus recommended).',
458
- 'After scaffolding, use /build to implement features.',
458
+ 'Full CRUD pages for each entity (list, create, edit, detail)',
459
+ 'API routes and data layer',
460
+ 'Seed data from the model',
461
+ 'Navigation, dashboard, theme, auth (if enabled)',
462
+ 'Ready to run: npm install && npm run dev',
459
463
  ],
460
464
  },
465
+ {
466
+ items: ['Use /app to view the Application Model before scaffolding.'],
467
+ },
461
468
  ],
462
469
  },
463
470
  // ===========================================================================
@@ -509,15 +516,19 @@ export const CONTENT_TOPICS = [
509
516
  items: ['Team agents are specialized AI assistants with different expertise, tools, and model tiers.'],
510
517
  },
511
518
  {
512
- title: 'Predefined roles (7):',
519
+ title: 'Predefined roles (11):',
513
520
  items: [
521
+ '$dev - Developer: Implementation, coding, debugging',
514
522
  '$pm - PM: Planning, task tracking, timeline estimation',
515
523
  '$arch - Architect: System design, patterns, tech decisions',
516
524
  '$qa - QA Engineer: Testing, quality, code review',
517
- '$dev - Developer: Implementation, coding, debugging',
518
- '$ops - DevOps: Deployment, CI/CD, infrastructure',
519
- '$docs - Technical Writer: Documentation, guides',
520
- '$ba - Business Analyst: Requirements, metrics',
525
+ '$writer - Technical Writer: Documentation, guides',
526
+ '$researcher - Researcher: Literature review, analysis',
527
+ '$reviewer - Reviewer: Code and content review',
528
+ '$editor - Editor: Content editing, prose, structure',
529
+ '$analyst - Analyst: Data and business analysis',
530
+ '$strategist - Strategist: Strategy and planning',
531
+ '$instructor - Instructor: Teaching, course design',
521
532
  ],
522
533
  },
523
534
  {
@@ -1225,6 +1236,162 @@ export const CONTENT_TOPICS = [
1225
1236
  },
1226
1237
  ],
1227
1238
  },
1239
+ // ===========================================================================
1240
+ // /app Command (Application Model Viewer)
1241
+ // ===========================================================================
1242
+ {
1243
+ id: 'command-app',
1244
+ title: '/app Command',
1245
+ keywords: ['/app', 'app', 'model', 'entities', 'fields', 'relationships', 'application model'],
1246
+ sections: [
1247
+ {
1248
+ items: ['/app - View the Application Model for the current project.'],
1249
+ },
1250
+ {
1251
+ title: 'Three tabs:',
1252
+ items: [
1253
+ 'Entities - List of all entities with field and relationship counts',
1254
+ 'Relationships - Map of all entity relationships (hasMany/belongsTo)',
1255
+ 'Summary - App identity, data model stats, configuration (layout, toolkit, features)',
1256
+ ],
1257
+ },
1258
+ {
1259
+ title: 'Navigation:',
1260
+ items: [
1261
+ '↑/↓ - Navigate items',
1262
+ 'Enter - View entity detail (full field table + relationship map)',
1263
+ 'Tab or 1-3 - Switch tabs',
1264
+ '/ - Search',
1265
+ 'q/Esc - Close',
1266
+ ],
1267
+ },
1268
+ {
1269
+ items: [
1270
+ 'The Application Model is created by /design and used by /scaffold to generate code.',
1271
+ 'The agent can also modify the model via app_model_update tool.',
1272
+ ],
1273
+ },
1274
+ ],
1275
+ },
1276
+ // ===========================================================================
1277
+ // Image Support
1278
+ // ===========================================================================
1279
+ {
1280
+ id: 'image-support',
1281
+ title: 'Image Support',
1282
+ keywords: ['image', 'screenshot', 'picture', 'paste', 'attach', 'vision', 'view_image'],
1283
+ sections: [
1284
+ {
1285
+ items: ['You can send images to the agent for visual analysis (screenshots, diagrams, mockups).'],
1286
+ },
1287
+ {
1288
+ title: 'Supported formats:',
1289
+ items: [
1290
+ 'PNG, JPEG, GIF, WebP',
1291
+ ],
1292
+ },
1293
+ {
1294
+ title: 'How it works:',
1295
+ items: [
1296
+ 'Images are resized to max 1568px to save tokens',
1297
+ 'After a few turns, old images are replaced with text placeholders',
1298
+ 'The agent can also view image files on disk via the view_image tool',
1299
+ 'All major providers support vision: Claude, GPT-4o, Gemini',
1300
+ ],
1301
+ },
1302
+ ],
1303
+ },
1304
+ // ===========================================================================
1305
+ // Context Management (Compressors, Observation Masking)
1306
+ // ===========================================================================
1307
+ {
1308
+ id: 'context-management',
1309
+ title: 'Context Management',
1310
+ keywords: ['context', 'tokens', 'compressor', 'observation', 'masking', 'token saving'],
1311
+ sections: [
1312
+ {
1313
+ items: ['The agent automatically manages its context window to stay within limits.'],
1314
+ },
1315
+ {
1316
+ title: 'Automatic optimizations:',
1317
+ items: [
1318
+ 'Observation masking - Old tool results replaced with compact summaries after a few turns',
1319
+ 'Image masking - Old images replaced with text placeholders (saves 1000+ tokens per image)',
1320
+ 'Tool output compression - Large outputs compressed 60-90% (git, npm, file listings)',
1321
+ 'Smart windowing - Oldest messages compacted when context fills up',
1322
+ 'Dead message pruning - Removed permission exchanges and superseded errors',
1323
+ ],
1324
+ },
1325
+ {
1326
+ title: 'Manual controls:',
1327
+ items: [
1328
+ '/context - View current token usage and breakdown',
1329
+ '/compact - Force summarization of old messages',
1330
+ ],
1331
+ },
1332
+ ],
1333
+ },
1334
+ // ===========================================================================
1335
+ // Knowledge Base
1336
+ // ===========================================================================
1337
+ {
1338
+ id: 'knowledge-base',
1339
+ title: 'Knowledge Base',
1340
+ keywords: ['knowledge', 'kb', 'reference', 'documents', 'pin'],
1341
+ sections: [
1342
+ {
1343
+ items: ['The knowledge base stores reference documents and images for your project.'],
1344
+ },
1345
+ {
1346
+ title: 'Adding content:',
1347
+ items: [
1348
+ 'Files are added via the project_document_add tool or the desktop KB panel',
1349
+ 'Supported: markdown, text, PDF, code files, images (PNG/JPEG/GIF/WebP)',
1350
+ 'URLs can be imported (web page content fetched and stored)',
1351
+ ],
1352
+ },
1353
+ {
1354
+ title: 'Pinning:',
1355
+ items: [
1356
+ 'Pinned files are included in every agent conversation',
1357
+ 'Unpinned files are available on-demand (agent reads them when needed)',
1358
+ 'Pin important reference docs to keep the agent informed',
1359
+ ],
1360
+ },
1361
+ ],
1362
+ },
1363
+ // ===========================================================================
1364
+ // Capability Packs
1365
+ // ===========================================================================
1366
+ {
1367
+ id: 'capability-packs',
1368
+ title: 'Capability Packs',
1369
+ keywords: ['capability', 'pack', 'tools', 'auto-load', 'dynamic', 'loading'],
1370
+ sections: [
1371
+ {
1372
+ items: ['Tools are organized into capability packs that load on demand.'],
1373
+ },
1374
+ {
1375
+ title: 'How it works:',
1376
+ items: [
1377
+ 'Only essential tools are loaded upfront (file read, shell, interaction)',
1378
+ 'Additional packs load automatically when the agent needs them',
1379
+ 'Reduces token cost by ~60% compared to loading all tools at once',
1380
+ ],
1381
+ },
1382
+ {
1383
+ title: 'Tool profiles control which packs are available:',
1384
+ items: [
1385
+ 'full - All packs (default for primary agent)',
1386
+ 'developer - Coding-focused packs',
1387
+ 'read-only - Safe exploration only',
1388
+ 'planner - Planning and documentation packs',
1389
+ 'analyst - Analysis and research packs',
1390
+ 'docs - Documentation packs',
1391
+ ],
1392
+ },
1393
+ ],
1394
+ },
1228
1395
  ];
1229
1396
  // =============================================================================
1230
1397
  // Helper Functions