@juancr11/sibu 0.13.1 → 0.14.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/bin/modules/interactive-guidance/index.js +1 -1
- package/bin/modules/interactive-guidance/prompts.js +8 -3
- package/bin/modules/mcp-server-selection-management/use-mcp-server/handler.js +57 -9
- package/bin/modules/project-adoption/handler.js +13 -2
- package/bin/modules/skill-selection-management/use-skill/handler.js +82 -30
- package/bin/modules/sync-review/apply-action.js +11 -0
- package/bin/modules/sync-review/sync-preview.js +60 -29
- package/bin/modules/workflow-target-planning/catalog.js +62 -0
- package/bin/modules/workflow-target-planning/index.js +1 -1
- package/package.json +1 -1
- package/templates/AGENTS.md +1 -0
- package/templates/manifest.json +34 -13
- package/templates/skills/export-to-github/SKILL.md +39 -0
- package/templates/skills/export-to-notion/SKILL.md +60 -0
- package/templates/skills/feature-brief-writer/SKILL.md +11 -25
- package/templates/skills/feature-idea-capture/SKILL.md +32 -0
- package/templates/skills/react/SKILL.md +57 -9
- package/templates/skills/scrum-master-planner/SKILL.md +0 -32
- package/templates/skills/technical-design-writer/SKILL.md +0 -25
- package/templates/skills/ux-expert/SKILL.md +0 -25
- package/bin/shared/templates.js +0 -60
- package/bin/shared/workflow-targets.js +0 -125
|
@@ -1,125 +0,0 @@
|
|
|
1
|
-
import fs from 'node:fs';
|
|
2
|
-
import path from 'node:path';
|
|
3
|
-
import { SIBU_VERSION } from './catalog.js';
|
|
4
|
-
import { MANDATORY_SKILLS, SELECTABLE_ARCHITECTURE_SKILLS, SELECTABLE_FRAMEWORK_SKILLS, SELECTABLE_LANGUAGE_SKILLS, SELECTABLE_WORKFLOW_SKILLS, SUPPORTED_AGENTS, } from '../modules/workflow-target-planning/index.js';
|
|
5
|
-
import { sha256 } from './hash.js';
|
|
6
|
-
import { removeUndefinedFields } from './object.js';
|
|
7
|
-
import { readExistingState } from './state.js';
|
|
8
|
-
import { getTemplateVersion, readTemplate, readTemplateManifest, renderSkillRouting } from '../modules/template-catalog-rendering/index.js';
|
|
9
|
-
export function getSelectedLanguageSkillsFromState(state) {
|
|
10
|
-
return SELECTABLE_LANGUAGE_SKILLS.filter((skill) => state.selectedLanguageSkills?.includes(skill.id));
|
|
11
|
-
}
|
|
12
|
-
export function getSelectedFrameworkSkillsFromState(state) {
|
|
13
|
-
return SELECTABLE_FRAMEWORK_SKILLS.filter((skill) => state.selectedFrameworkSkills?.includes(skill.id));
|
|
14
|
-
}
|
|
15
|
-
export function getSelectedArchitectureSkillFromState(state) {
|
|
16
|
-
return SELECTABLE_ARCHITECTURE_SKILLS.find((skill) => skill.id === state.selectedArchitectureSkill);
|
|
17
|
-
}
|
|
18
|
-
export function getSelectedWorkflowSkillsFromState(state) {
|
|
19
|
-
return SELECTABLE_WORKFLOW_SKILLS.filter((skill) => state.selectedWorkflowSkills?.includes(skill.id));
|
|
20
|
-
}
|
|
21
|
-
export function getSelectedSkillTargetsForAgents(selectedAgents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills = []) {
|
|
22
|
-
const skillTargets = new Map();
|
|
23
|
-
const selectedSkills = [
|
|
24
|
-
...MANDATORY_SKILLS,
|
|
25
|
-
...selectedLanguageSkills,
|
|
26
|
-
...selectedFrameworkSkills,
|
|
27
|
-
...(selectedArchitectureSkill ? [selectedArchitectureSkill] : []),
|
|
28
|
-
...selectedWorkflowSkills,
|
|
29
|
-
];
|
|
30
|
-
for (const agent of selectedAgents) {
|
|
31
|
-
for (const skill of selectedSkills) {
|
|
32
|
-
const targetRelativePath = skill.targetRelativePathsByAgent[agent.id];
|
|
33
|
-
if (!targetRelativePath) {
|
|
34
|
-
continue;
|
|
35
|
-
}
|
|
36
|
-
skillTargets.set(targetRelativePath, {
|
|
37
|
-
targetRelativePath,
|
|
38
|
-
templateRelativePath: skill.templateRelativePath,
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
return [...skillTargets.values()];
|
|
43
|
-
}
|
|
44
|
-
export function getWorkflowTargets(rootPath, selectedAgents, selectedLanguageSkills = [], selectedFrameworkSkills = [], selectedArchitectureSkill, selectedWorkflowSkills = []) {
|
|
45
|
-
return [
|
|
46
|
-
{
|
|
47
|
-
label: 'AGENTS.md',
|
|
48
|
-
targetPath: path.join(rootPath, 'AGENTS.md'),
|
|
49
|
-
templateRelativePath: 'AGENTS.md',
|
|
50
|
-
requiresProjectOverview: true,
|
|
51
|
-
},
|
|
52
|
-
...selectedAgents.flatMap((agent) => {
|
|
53
|
-
if (!agent.targetRelativePath || !agent.templateRelativePath) {
|
|
54
|
-
return [];
|
|
55
|
-
}
|
|
56
|
-
return [
|
|
57
|
-
{
|
|
58
|
-
label: agent.targetRelativePath,
|
|
59
|
-
targetPath: path.join(rootPath, agent.targetRelativePath),
|
|
60
|
-
templateRelativePath: agent.templateRelativePath,
|
|
61
|
-
requiresProjectOverview: false,
|
|
62
|
-
},
|
|
63
|
-
];
|
|
64
|
-
}),
|
|
65
|
-
...getSelectedSkillTargetsForAgents(selectedAgents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills).map((skillTarget) => ({
|
|
66
|
-
label: skillTarget.targetRelativePath,
|
|
67
|
-
targetPath: path.join(rootPath, skillTarget.targetRelativePath),
|
|
68
|
-
templateRelativePath: skillTarget.templateRelativePath,
|
|
69
|
-
requiresProjectOverview: false,
|
|
70
|
-
})),
|
|
71
|
-
];
|
|
72
|
-
}
|
|
73
|
-
export function renderMissingWorkflowFiles({ missingTargets, overview, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills = [], }) {
|
|
74
|
-
return missingTargets.map((target) => {
|
|
75
|
-
let contents = readTemplate(target.templateRelativePath);
|
|
76
|
-
if (target.requiresProjectOverview) {
|
|
77
|
-
if (!overview?.trim()) {
|
|
78
|
-
throw new Error('Project overview is required to create AGENTS.md.');
|
|
79
|
-
}
|
|
80
|
-
contents = contents.replace('{{PROJECT_OVERVIEW}}', overview.trim());
|
|
81
|
-
}
|
|
82
|
-
contents = renderSkillRouting(contents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills);
|
|
83
|
-
return {
|
|
84
|
-
label: target.label,
|
|
85
|
-
targetPath: target.targetPath,
|
|
86
|
-
contents,
|
|
87
|
-
};
|
|
88
|
-
});
|
|
89
|
-
}
|
|
90
|
-
export function writeSibuState({ rootPath, statePath, selectedAgents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills = [], targets, }) {
|
|
91
|
-
const previousState = readExistingState(statePath);
|
|
92
|
-
const now = new Date().toISOString();
|
|
93
|
-
const manifest = readTemplateManifest();
|
|
94
|
-
const state = {
|
|
95
|
-
sibuVersion: SIBU_VERSION,
|
|
96
|
-
templateVersion: manifest.templateVersion,
|
|
97
|
-
generatedAt: previousState?.generatedAt ?? now,
|
|
98
|
-
updatedAt: now,
|
|
99
|
-
selectedAgents: selectedAgents.map((agent) => agent.id),
|
|
100
|
-
selectedLanguageSkills: selectedLanguageSkills.map((skill) => skill.id),
|
|
101
|
-
selectedFrameworkSkills: selectedFrameworkSkills.map((skill) => skill.id),
|
|
102
|
-
selectedArchitectureSkill: selectedArchitectureSkill?.id,
|
|
103
|
-
selectedWorkflowSkills: selectedWorkflowSkills.map((skill) => skill.id),
|
|
104
|
-
managedFiles: Object.fromEntries(targets
|
|
105
|
-
.filter((target) => fs.existsSync(target.targetPath))
|
|
106
|
-
.map((target) => {
|
|
107
|
-
const relativePath = path.relative(rootPath, target.targetPath);
|
|
108
|
-
const previousManagedFile = previousState?.managedFiles[relativePath];
|
|
109
|
-
const nextManagedFile = {
|
|
110
|
-
template: target.templateRelativePath,
|
|
111
|
-
templateVersion: getTemplateVersion(manifest, target.templateRelativePath),
|
|
112
|
-
sha256: sha256(fs.readFileSync(target.targetPath, 'utf8')),
|
|
113
|
-
status: previousManagedFile?.status ?? 'managed',
|
|
114
|
-
lastReviewedTemplateVersion: previousManagedFile?.lastReviewedTemplateVersion,
|
|
115
|
-
reason: previousManagedFile?.reason,
|
|
116
|
-
};
|
|
117
|
-
return [relativePath, removeUndefinedFields(nextManagedFile)];
|
|
118
|
-
})),
|
|
119
|
-
};
|
|
120
|
-
fs.mkdirSync(path.dirname(statePath), { recursive: true });
|
|
121
|
-
fs.writeFileSync(statePath, `${JSON.stringify(state, null, 2)}\n`, 'utf8');
|
|
122
|
-
}
|
|
123
|
-
export function getSelectedAgentsFromState(state) {
|
|
124
|
-
return SUPPORTED_AGENTS.filter((agent) => state.selectedAgents.includes(agent.id));
|
|
125
|
-
}
|