@compilr-dev/cli 0.6.0 → 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.
- package/dist/.tsbuildinfo.app +1 -1
- package/dist/.tsbuildinfo.data +1 -1
- package/dist/.tsbuildinfo.domain +1 -1
- package/dist/agent.d.ts +2 -0
- package/dist/agent.js +66 -1
- package/dist/commands-v2/handlers/project.d.ts +1 -0
- package/dist/commands-v2/handlers/project.js +36 -2
- package/dist/commands-v2/handlers/team.js +23 -3
- package/dist/compilr-diff-companion.vsix +0 -0
- package/dist/entitlements/index.d.ts +23 -0
- package/dist/entitlements/index.js +110 -0
- package/dist/guide/cli-guide-entries.d.ts +15 -0
- package/dist/guide/cli-guide-entries.js +99 -0
- package/dist/guide/index.d.ts +5 -4
- package/dist/guide/index.js +4 -3
- package/dist/guide/shared-content.js +188 -21
- package/dist/handlers/permission-handler.js +10 -3
- package/dist/index.js +18 -0
- package/dist/repl-v2.d.ts +16 -0
- package/dist/repl-v2.js +51 -17
- package/dist/tools/db-tools.d.ts +1 -1
- package/dist/tools/platform-adapter.d.ts +1 -1
- package/dist/tools/platform-adapter.js +6 -1
- package/dist/tools.js +6 -1
- package/dist/ui/overlay/impl/app-model-overlay-v2.d.ts +57 -0
- package/dist/ui/overlay/impl/app-model-overlay-v2.js +232 -0
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.d.ts +23 -1
- package/dist/ui/overlay/impl/custom-agent-form-overlay-v2.js +203 -47
- package/dist/ui/overlay/impl/model-overlay-v2.js +2 -2
- package/dist/ui/overlay/impl/new-overlay-v2.d.ts +2 -2
- package/dist/ui/overlay/impl/new-overlay-v2.js +10 -17
- package/dist/ui/overlay/impl/team-overlay-v2.js +2 -2
- package/dist/ui/overlay/index.d.ts +1 -0
- package/dist/ui/overlay/index.js +1 -0
- package/package.json +4 -4
package/dist/agent.d.ts
CHANGED
|
@@ -57,6 +57,8 @@ export interface AgentOptions {
|
|
|
57
57
|
guidedModeContext?: string;
|
|
58
58
|
/** Plan mode context */
|
|
59
59
|
planModeContext?: string;
|
|
60
|
+
/** Plan mode callbacks for plan_submit and plan_mode_exit tools */
|
|
61
|
+
planModeCallbacks?: import('@compilr-dev/sdk').PlanModeCallbacks;
|
|
60
62
|
/** Enable anchors (critical info that survives compaction) */
|
|
61
63
|
enableAnchors?: boolean;
|
|
62
64
|
/** Pre-loaded anchors to add at startup */
|
package/dist/agent.js
CHANGED
|
@@ -17,6 +17,59 @@ import { setStaticEstimates, estimateTokens, estimateJsonTokens, } from './utils
|
|
|
17
17
|
import { createFileLockCheckHook, createFileLockAcquireHook } from './multi-agent/file-lock-hook.js';
|
|
18
18
|
import { getActiveProject } from './tools/project-db.js';
|
|
19
19
|
import { allDbTools, allFactoryTools } from './tools/db-tools.js';
|
|
20
|
+
import { createGuideTool } from '@compilr-dev/sdk';
|
|
21
|
+
import { CLI_GUIDE_ENTRIES } from './guide/cli-guide-entries.js';
|
|
22
|
+
const cliGuideTool = createGuideTool({
|
|
23
|
+
environment: 'cli',
|
|
24
|
+
additionalEntries: CLI_GUIDE_ENTRIES,
|
|
25
|
+
});
|
|
26
|
+
import { defineTool, createSuccessResult } from '@compilr-dev/agents';
|
|
27
|
+
/** Create plan_submit and plan_mode_exit tools if callbacks are provided */
|
|
28
|
+
function buildPlanModeTools(callbacks) {
|
|
29
|
+
if (!callbacks || !callbacks.onPlanSubmit || !callbacks.onPlanModeExit)
|
|
30
|
+
return [];
|
|
31
|
+
const onSubmit = callbacks.onPlanSubmit;
|
|
32
|
+
const onExit = callbacks.onPlanModeExit;
|
|
33
|
+
const planSubmitTool = defineTool({
|
|
34
|
+
name: 'plan_submit',
|
|
35
|
+
description: 'Submit a plan for user approval. Call when your plan is ready for review. ' +
|
|
36
|
+
'The user will choose to approve, revise, or reject. On approval, write tools are unlocked.',
|
|
37
|
+
inputSchema: {
|
|
38
|
+
type: 'object',
|
|
39
|
+
properties: {
|
|
40
|
+
plan_id: { type: 'number', description: 'ID of the plan to submit' },
|
|
41
|
+
summary: { type: 'string', description: 'One-line summary of the plan' },
|
|
42
|
+
},
|
|
43
|
+
required: ['plan_id'],
|
|
44
|
+
},
|
|
45
|
+
execute: async (input) => {
|
|
46
|
+
const result = await onSubmit({ planId: input.plan_id, summary: input.summary });
|
|
47
|
+
const messages = {
|
|
48
|
+
'approve-auto': 'Plan approved. Auto-accept mode enabled. Proceed with implementation.',
|
|
49
|
+
approve: 'Plan approved. Proceed with implementation.',
|
|
50
|
+
revise: `Plan needs revision. Feedback: ${result.feedback ?? 'No specific feedback.'}`,
|
|
51
|
+
reject: 'Plan rejected.',
|
|
52
|
+
};
|
|
53
|
+
return createSuccessResult({ action: result.action, message: messages[result.action] });
|
|
54
|
+
},
|
|
55
|
+
});
|
|
56
|
+
const planModeExitTool = defineTool({
|
|
57
|
+
name: 'plan_mode_exit',
|
|
58
|
+
description: 'Exit plan mode without a plan. Use when the task is simple enough to implement directly.',
|
|
59
|
+
inputSchema: {
|
|
60
|
+
type: 'object',
|
|
61
|
+
properties: {
|
|
62
|
+
reason: { type: 'string', description: 'Brief reason for exiting plan mode' },
|
|
63
|
+
},
|
|
64
|
+
required: ['reason'],
|
|
65
|
+
},
|
|
66
|
+
execute: async (input) => {
|
|
67
|
+
await onExit({ reason: input.reason });
|
|
68
|
+
return createSuccessResult({ message: `Exited plan mode: ${input.reason}. Full tools now available.` });
|
|
69
|
+
},
|
|
70
|
+
});
|
|
71
|
+
return [planSubmitTool, planModeExitTool];
|
|
72
|
+
}
|
|
20
73
|
/**
|
|
21
74
|
* Default permission rules for potentially dangerous operations
|
|
22
75
|
*/
|
|
@@ -190,6 +243,14 @@ function createContextPressureHook() {
|
|
|
190
243
|
export function createAgent(options = {}) {
|
|
191
244
|
const { provider, model, apiKey } = resolveProviderConfig(options);
|
|
192
245
|
const systemPrompt = buildSystemPrompt(options);
|
|
246
|
+
log.info({
|
|
247
|
+
component: 'agent',
|
|
248
|
+
provider,
|
|
249
|
+
model: model ?? 'default',
|
|
250
|
+
quiet: options.quiet ?? false,
|
|
251
|
+
metaTools: options.enableMetaTools ?? false,
|
|
252
|
+
projectName: options.projectName,
|
|
253
|
+
}, 'Creating agent');
|
|
193
254
|
// ── Create agent via SDK ──────────────────────────────────────────────────
|
|
194
255
|
const compilrAgent = createCompilrAgent({
|
|
195
256
|
provider,
|
|
@@ -236,7 +297,7 @@ export function createAgent(options = {}) {
|
|
|
236
297
|
}
|
|
237
298
|
: undefined,
|
|
238
299
|
// Capability loading (replaces CLI's manual meta-tools wiring)
|
|
239
|
-
// Platform tools (DB, factory) + MCP
|
|
300
|
+
// Platform tools (DB, factory) + MCP + guide + plan mode tools
|
|
240
301
|
capabilities: (options.enableMetaTools && !options.minimal && !options.noTools)
|
|
241
302
|
? {
|
|
242
303
|
enabled: true,
|
|
@@ -245,6 +306,8 @@ export function createAgent(options = {}) {
|
|
|
245
306
|
...allDbTools,
|
|
246
307
|
...allFactoryTools,
|
|
247
308
|
...(options.mcpTools ?? []),
|
|
309
|
+
cliGuideTool,
|
|
310
|
+
...buildPlanModeTools(options.planModeCallbacks),
|
|
248
311
|
],
|
|
249
312
|
}
|
|
250
313
|
: {
|
|
@@ -253,6 +316,8 @@ export function createAgent(options = {}) {
|
|
|
253
316
|
...allDbTools,
|
|
254
317
|
...allFactoryTools,
|
|
255
318
|
...(options.mcpTools ?? []),
|
|
319
|
+
cliGuideTool,
|
|
320
|
+
...buildPlanModeTools(options.planModeCallbacks),
|
|
256
321
|
],
|
|
257
322
|
},
|
|
258
323
|
// CLI-specific hooks
|
|
@@ -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
|
-
//
|
|
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
|
-
//
|
|
308
|
+
// Save as template if user chose to
|
|
305
309
|
const agentData = formResult.agent;
|
|
306
|
-
|
|
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
|
+
];
|
package/dist/guide/index.d.ts
CHANGED
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compilr Guide Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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 {
|
|
8
|
-
export
|
|
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';
|
package/dist/guide/index.js
CHANGED
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Compilr Guide Module
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
|
-
*
|
|
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 {
|
|
7
|
+
export { CLI_GUIDE_ENTRIES } from './cli-guide-entries.js';
|
|
8
|
+
export { CONTENT_TOPICS, topicToPlainText, searchContentTopics, getAllTopicIds } from './shared-content.js';
|