@compilr-dev/sdk 0.10.2 → 0.10.3
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/index.d.ts +2 -1
- package/dist/index.js +1 -1
- package/dist/skills/index.d.ts +2 -0
- package/dist/skills/index.js +1 -0
- package/dist/skills/paths.d.ts +41 -0
- package/dist/skills/paths.js +118 -0
- package/package.json +2 -1
package/dist/index.d.ts
CHANGED
|
@@ -68,7 +68,8 @@ export { createPlatformTools, createProjectTools, createWorkItemTools, createDoc
|
|
|
68
68
|
export type { ProjectAnchorStoreConfig, ImageToolsConfig, ImageResizer } from './platform/index.js';
|
|
69
69
|
export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getStepCriteria, formatStepDisplay, getStepNumber, } from './platform/index.js';
|
|
70
70
|
export type { CustomSkill, CompilrSkillExtension, ForkedFromMarker, SkillEligibilityContext, SkillCollision, SkillDiffLine, SkillValidationIssue, ScopeConfig, SkillResolution, } from './skills/index.js';
|
|
71
|
-
export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill as validateSkillQuality, } from './skills/index.js';
|
|
71
|
+
export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill as validateSkillQuality, getSkillsDir, getSkillFolder, getSkillFile, ensureSkillsDir, isValidSkillName, getScopeConfigPath, readSkillScopeConfig, readSkillScopeConfigSync, writeSkillScopeConfig, getSkillBindings, resolveSkillBinding, } from './skills/index.js';
|
|
72
|
+
export type { SkillScope } from './skills/index.js';
|
|
72
73
|
export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './skills/index.js';
|
|
73
74
|
export { ACTION_REGISTRY, getActionsForContext, getActionById, resolveActionPrompt, buildContextSummary, getSuggestedRole, } from './actions/index.js';
|
|
74
75
|
export type { ActionContext, ActionDefinition } from './actions/index.js';
|
package/dist/index.js
CHANGED
|
@@ -152,7 +152,7 @@ export { createPlatformTools, createProjectTools, createWorkItemTools, createDoc
|
|
|
152
152
|
// Platform Workflow (pure step-criteria logic)
|
|
153
153
|
// =============================================================================
|
|
154
154
|
export { STEP_ORDER, GUIDED_STEP_CRITERIA, getNextStep, isValidTransition, getStepCriteria, formatStepDisplay, getStepNumber, } from './platform/index.js';
|
|
155
|
-
export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill as validateSkillQuality, } from './skills/index.js';
|
|
155
|
+
export { RESERVED_SKILL_NAMES, isReservedSkillName, parseSkillMarkdown, loadSkillsFromDir, resolveLayeredSkills, resolveSkillsForAgent, detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill as validateSkillQuality, getSkillsDir, getSkillFolder, getSkillFile, ensureSkillsDir, isValidSkillName, getScopeConfigPath, readSkillScopeConfig, readSkillScopeConfigSync, writeSkillScopeConfig, getSkillBindings, resolveSkillBinding, } from './skills/index.js';
|
|
156
156
|
export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './skills/index.js';
|
|
157
157
|
// =============================================================================
|
|
158
158
|
// Contextual Actions (skill invocations with context)
|
package/dist/skills/index.d.ts
CHANGED
|
@@ -8,4 +8,6 @@ export type { SkillEligibilityContext } from './resolver.js';
|
|
|
8
8
|
export { resolveLayeredSkills, resolveSkillsForAgent } from './resolver.js';
|
|
9
9
|
export type { SkillCollision, SkillDiffLine, SkillValidationIssue, ScopeConfig, SkillResolution, } from './operations.js';
|
|
10
10
|
export { detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill, } from './operations.js';
|
|
11
|
+
export type { SkillScope } from './paths.js';
|
|
12
|
+
export { getSkillsDir, getSkillFolder, getSkillFile, ensureSkillsDir, isValidSkillName, getScopeConfigPath, readScopeConfig as readSkillScopeConfig, readScopeConfigSync as readSkillScopeConfigSync, writeScopeConfig as writeSkillScopeConfig, getAllBindings as getSkillBindings, resolveBinding as resolveSkillBinding, } from './paths.js';
|
|
11
13
|
export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './platform-skills.js';
|
package/dist/skills/index.js
CHANGED
|
@@ -2,4 +2,5 @@ export { RESERVED_SKILL_NAMES, isReservedSkillName } from './types.js';
|
|
|
2
2
|
export { parseSkillMarkdown, loadSkillsFromDir } from './loader.js';
|
|
3
3
|
export { resolveLayeredSkills, resolveSkillsForAgent } from './resolver.js';
|
|
4
4
|
export { detectCollisions, formatCollisionWarnings, diffForkVsUpstream, buildForkContent, buildNewSkillContent, validateSkill, } from './operations.js';
|
|
5
|
+
export { getSkillsDir, getSkillFolder, getSkillFile, ensureSkillsDir, isValidSkillName, getScopeConfigPath, readScopeConfig as readSkillScopeConfig, readScopeConfigSync as readSkillScopeConfigSync, writeScopeConfig as writeSkillScopeConfig, getAllBindings as getSkillBindings, resolveBinding as resolveSkillBinding, } from './paths.js';
|
|
5
6
|
export { platformSkills, designSkill, sketchSkill, prdSkill, refineSkill, refineItemSkill, architectureSkill, sessionNotesSkill, buildSkill, scaffoldSkill, outlineSkill, literatureReviewSkill, draftSectionSkill, peerReviewSkill, researchScaffoldSkill, businessVisionSkill, marketAnalysisSkill, competitorAnalysisSkill, financialModelSkill, pitchOutlineSkill, businessReviewSkill, brandSetupSkill, contentStrategySkill, contentCalendarSkill, createContentSkill, contentReviewSkill, curriculumDesignSkill, lessonPlanSkill, assessmentDesignSkill, courseReviewSkill, bookOutlineSkill, characterDesignSkill, plotThreadsSkill, sceneBreakdownSkill, bookReviewSkill, } from './platform-skills.js';
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill path resolution and config I/O.
|
|
3
|
+
*
|
|
4
|
+
* Portable across CLI and Desktop — takes explicit paths instead of
|
|
5
|
+
* relying on CLI-specific project detection.
|
|
6
|
+
*/
|
|
7
|
+
export type SkillScope = 'user' | 'project';
|
|
8
|
+
/** Resolve the skills directory for a given scope. */
|
|
9
|
+
export declare function getSkillsDir(scope: SkillScope, projectDir?: string): string;
|
|
10
|
+
/** Ensure the skills directory exists. Returns the path. */
|
|
11
|
+
export declare function ensureSkillsDir(scope: SkillScope, projectDir?: string): Promise<string>;
|
|
12
|
+
/** Path to a single skill folder (no creation). */
|
|
13
|
+
export declare function getSkillFolder(name: string, scope: SkillScope, projectDir?: string): string;
|
|
14
|
+
/** Path to a skill's SKILL.md file. */
|
|
15
|
+
export declare function getSkillFile(name: string, scope: SkillScope, projectDir?: string): string;
|
|
16
|
+
/**
|
|
17
|
+
* Validate a skill name. Lowercase letters, digits, and hyphens only.
|
|
18
|
+
*/
|
|
19
|
+
export declare function isValidSkillName(name: string): boolean;
|
|
20
|
+
/** Shape of <scope>/.compilr/config.json */
|
|
21
|
+
export interface ScopeConfig {
|
|
22
|
+
slashCommands?: Record<string, string>;
|
|
23
|
+
}
|
|
24
|
+
/** Path to the scope config file. */
|
|
25
|
+
export declare function getScopeConfigPath(scope: SkillScope, projectDir?: string): string;
|
|
26
|
+
/** Read the scope config asynchronously. Returns empty object if file doesn't exist. */
|
|
27
|
+
export declare function readScopeConfig(scope: SkillScope, projectDir?: string): Promise<ScopeConfig>;
|
|
28
|
+
/** Read the scope config synchronously. Returns empty object if file doesn't exist. */
|
|
29
|
+
export declare function readScopeConfigSync(scope: SkillScope, projectDir?: string): ScopeConfig;
|
|
30
|
+
/** Write the scope config. Creates parent directories if needed. */
|
|
31
|
+
export declare function writeScopeConfig(scope: SkillScope, config: ScopeConfig, projectDir?: string): Promise<void>;
|
|
32
|
+
/** Get all bindings across both scopes (project takes priority). */
|
|
33
|
+
export declare function getAllBindings(projectDir?: string): Promise<Record<string, {
|
|
34
|
+
skillName: string;
|
|
35
|
+
scope: SkillScope;
|
|
36
|
+
}>>;
|
|
37
|
+
/**
|
|
38
|
+
* Resolve a command name to a bound skill name via config.json.
|
|
39
|
+
* Synchronous — config files are tiny.
|
|
40
|
+
*/
|
|
41
|
+
export declare function resolveBinding(commandName: string, projectDir?: string): string | null;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Skill path resolution and config I/O.
|
|
3
|
+
*
|
|
4
|
+
* Portable across CLI and Desktop — takes explicit paths instead of
|
|
5
|
+
* relying on CLI-specific project detection.
|
|
6
|
+
*/
|
|
7
|
+
import * as os from 'node:os';
|
|
8
|
+
import * as path from 'node:path';
|
|
9
|
+
import { promises as fs } from 'node:fs';
|
|
10
|
+
import { readFileSync } from 'node:fs';
|
|
11
|
+
// =============================================================================
|
|
12
|
+
// Path Resolution
|
|
13
|
+
// =============================================================================
|
|
14
|
+
/** Resolve the skills directory for a given scope. */
|
|
15
|
+
export function getSkillsDir(scope, projectDir) {
|
|
16
|
+
if (scope === 'user') {
|
|
17
|
+
return path.join(os.homedir(), '.compilr-dev', 'skills');
|
|
18
|
+
}
|
|
19
|
+
if (!projectDir)
|
|
20
|
+
throw new Error('projectDir required for project scope');
|
|
21
|
+
return path.join(projectDir, '.compilr', 'skills');
|
|
22
|
+
}
|
|
23
|
+
/** Ensure the skills directory exists. Returns the path. */
|
|
24
|
+
export async function ensureSkillsDir(scope, projectDir) {
|
|
25
|
+
const dir = getSkillsDir(scope, projectDir);
|
|
26
|
+
await fs.mkdir(dir, { recursive: true });
|
|
27
|
+
return dir;
|
|
28
|
+
}
|
|
29
|
+
/** Path to a single skill folder (no creation). */
|
|
30
|
+
export function getSkillFolder(name, scope, projectDir) {
|
|
31
|
+
return path.join(getSkillsDir(scope, projectDir), name);
|
|
32
|
+
}
|
|
33
|
+
/** Path to a skill's SKILL.md file. */
|
|
34
|
+
export function getSkillFile(name, scope, projectDir) {
|
|
35
|
+
return path.join(getSkillFolder(name, scope, projectDir), 'SKILL.md');
|
|
36
|
+
}
|
|
37
|
+
/**
|
|
38
|
+
* Validate a skill name. Lowercase letters, digits, and hyphens only.
|
|
39
|
+
*/
|
|
40
|
+
export function isValidSkillName(name) {
|
|
41
|
+
if (!name || name.length === 0 || name.length > 64)
|
|
42
|
+
return false;
|
|
43
|
+
return /^[a-z][a-z0-9-]*$/.test(name);
|
|
44
|
+
}
|
|
45
|
+
/** Path to the scope config file. */
|
|
46
|
+
export function getScopeConfigPath(scope, projectDir) {
|
|
47
|
+
if (scope === 'user') {
|
|
48
|
+
return path.join(os.homedir(), '.compilr-dev', 'config.json');
|
|
49
|
+
}
|
|
50
|
+
if (!projectDir)
|
|
51
|
+
throw new Error('projectDir required for project scope');
|
|
52
|
+
return path.join(projectDir, '.compilr', 'config.json');
|
|
53
|
+
}
|
|
54
|
+
/** Read the scope config asynchronously. Returns empty object if file doesn't exist. */
|
|
55
|
+
export async function readScopeConfig(scope, projectDir) {
|
|
56
|
+
try {
|
|
57
|
+
const content = await fs.readFile(getScopeConfigPath(scope, projectDir), 'utf-8');
|
|
58
|
+
return JSON.parse(content);
|
|
59
|
+
}
|
|
60
|
+
catch {
|
|
61
|
+
return {};
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
/** Read the scope config synchronously. Returns empty object if file doesn't exist. */
|
|
65
|
+
export function readScopeConfigSync(scope, projectDir) {
|
|
66
|
+
try {
|
|
67
|
+
const content = readFileSync(getScopeConfigPath(scope, projectDir), 'utf-8');
|
|
68
|
+
return JSON.parse(content);
|
|
69
|
+
}
|
|
70
|
+
catch {
|
|
71
|
+
return {};
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
/** Write the scope config. Creates parent directories if needed. */
|
|
75
|
+
export async function writeScopeConfig(scope, config, projectDir) {
|
|
76
|
+
const configPath = getScopeConfigPath(scope, projectDir);
|
|
77
|
+
await fs.mkdir(path.dirname(configPath), { recursive: true });
|
|
78
|
+
await fs.writeFile(configPath, JSON.stringify(config, null, 2) + '\n');
|
|
79
|
+
}
|
|
80
|
+
/** Get all bindings across both scopes (project takes priority). */
|
|
81
|
+
export async function getAllBindings(projectDir) {
|
|
82
|
+
const result = {};
|
|
83
|
+
const userConfig = await readScopeConfig('user');
|
|
84
|
+
if (userConfig.slashCommands) {
|
|
85
|
+
for (const [cmd, skill] of Object.entries(userConfig.slashCommands)) {
|
|
86
|
+
result[cmd] = { skillName: skill, scope: 'user' };
|
|
87
|
+
}
|
|
88
|
+
}
|
|
89
|
+
if (projectDir) {
|
|
90
|
+
const projectConfig = await readScopeConfig('project', projectDir);
|
|
91
|
+
if (projectConfig.slashCommands) {
|
|
92
|
+
for (const [cmd, skill] of Object.entries(projectConfig.slashCommands)) {
|
|
93
|
+
result[cmd] = { skillName: skill, scope: 'project' };
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return result;
|
|
98
|
+
}
|
|
99
|
+
// =============================================================================
|
|
100
|
+
// Binding Resolution
|
|
101
|
+
// =============================================================================
|
|
102
|
+
/**
|
|
103
|
+
* Resolve a command name to a bound skill name via config.json.
|
|
104
|
+
* Synchronous — config files are tiny.
|
|
105
|
+
*/
|
|
106
|
+
export function resolveBinding(commandName, projectDir) {
|
|
107
|
+
if (projectDir) {
|
|
108
|
+
const projectConfig = readScopeConfigSync('project', projectDir);
|
|
109
|
+
if (projectConfig.slashCommands?.[commandName]) {
|
|
110
|
+
return projectConfig.slashCommands[commandName];
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
const userConfig = readScopeConfigSync('user');
|
|
114
|
+
if (userConfig.slashCommands?.[commandName]) {
|
|
115
|
+
return userConfig.slashCommands[commandName];
|
|
116
|
+
}
|
|
117
|
+
return null;
|
|
118
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@compilr-dev/sdk",
|
|
3
|
-
"version": "0.10.
|
|
3
|
+
"version": "0.10.3",
|
|
4
4
|
"description": "Universal agent runtime for building AI-powered applications",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "dist/index.js",
|
|
@@ -58,6 +58,7 @@
|
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@compilr-dev/agents": "^0.5.7",
|
|
60
60
|
"@compilr-dev/logger": "^0.1.0",
|
|
61
|
+
"@compilr-dev/sdk": "^0.10.2",
|
|
61
62
|
"ajv": "^6.14.0",
|
|
62
63
|
"yaml": "^2.8.4"
|
|
63
64
|
},
|