@juancr11/sibu 0.4.1 → 0.5.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.
|
@@ -4,7 +4,7 @@ import { intro, log, outro } from '@clack/prompts';
|
|
|
4
4
|
import chalk from 'chalk';
|
|
5
5
|
import { STATE_RELATIVE_PATH } from '../../shared/catalog.js';
|
|
6
6
|
import { getProjectContext } from '../../shared/paths.js';
|
|
7
|
-
import { askForArchitectureSkill, askForFrameworkSkills, askForLanguageSkills, askForProjectOverview, askForSupportedAgents, renderIntro } from '../../shared/prompts.js';
|
|
7
|
+
import { askForArchitectureSkill, askForFrameworkSkills, askForLanguageSkills, askForProjectOverview, askForSupportedAgents, askForWorkflowSkills, renderIntro } from '../../shared/prompts.js';
|
|
8
8
|
import { readStateForDoctor } from '../../shared/state.js';
|
|
9
9
|
import { getWorkflowTargets, renderMissingWorkflowFiles, writeSibuState } from '../../shared/workflow-targets.js';
|
|
10
10
|
export async function handleInitProject(_command) {
|
|
@@ -31,7 +31,8 @@ export async function handleInitProject(_command) {
|
|
|
31
31
|
const selectedLanguageSkills = await askForLanguageSkills();
|
|
32
32
|
const selectedFrameworkSkills = await askForFrameworkSkills();
|
|
33
33
|
const selectedArchitectureSkill = await askForArchitectureSkill();
|
|
34
|
-
const
|
|
34
|
+
const selectedWorkflowSkills = await askForWorkflowSkills();
|
|
35
|
+
const targets = getWorkflowTargets(rootPath, selectedAgents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills);
|
|
35
36
|
const missingTargets = targets.filter((target) => !fs.existsSync(target.targetPath));
|
|
36
37
|
log.message('I will create this project’s initial AI workflow files.');
|
|
37
38
|
for (const target of targets) {
|
|
@@ -51,13 +52,14 @@ export async function handleInitProject(_command) {
|
|
|
51
52
|
selectedLanguageSkills,
|
|
52
53
|
selectedFrameworkSkills,
|
|
53
54
|
selectedArchitectureSkill,
|
|
55
|
+
selectedWorkflowSkills,
|
|
54
56
|
});
|
|
55
57
|
for (const file of files) {
|
|
56
58
|
fs.mkdirSync(path.dirname(file.targetPath), { recursive: true });
|
|
57
59
|
fs.writeFileSync(file.targetPath, file.contents, { encoding: 'utf8', flag: 'wx' });
|
|
58
60
|
log.success(`Created ${file.label}`);
|
|
59
61
|
}
|
|
60
|
-
writeSibuState({ rootPath, statePath, selectedAgents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, targets });
|
|
62
|
+
writeSibuState({ rootPath, statePath, selectedAgents, selectedLanguageSkills, selectedFrameworkSkills, selectedArchitectureSkill, selectedWorkflowSkills, targets });
|
|
61
63
|
log.success(`Created ${STATE_RELATIVE_PATH}`);
|
|
62
64
|
outro(chalk.green('Setup complete.'));
|
|
63
65
|
}
|
package/bin/shared/catalog.js
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'node:path';
|
|
3
|
+
import { fileURLToPath } from 'node:url';
|
|
1
4
|
export const SIBU_PACKAGE_NAME = '@juancr11/sibu';
|
|
2
|
-
export const SIBU_VERSION =
|
|
5
|
+
export const SIBU_VERSION = readPackageVersion();
|
|
3
6
|
export const STATE_RELATIVE_PATH = '.sibu/state.json';
|
|
4
7
|
export const NPM_VERSION_LOOKUP_MODE_ENV = 'SIBU_NPM_LOOKUP_MODE';
|
|
5
8
|
export const NPM_VERSION_OVERRIDE_ENV = 'SIBU_NPM_LATEST_VERSION';
|
|
@@ -229,3 +232,14 @@ export function resolveSelectableSkillById(skillId) {
|
|
|
229
232
|
}
|
|
230
233
|
return { ok: false, message: `Unknown skill \`${skillId}\`. Run \`sibu skills list\` to see available skills.` };
|
|
231
234
|
}
|
|
235
|
+
function readPackageVersion() {
|
|
236
|
+
const packageJsonPath = path.resolve(path.dirname(fileURLToPath(import.meta.url)), '..', '..', 'package.json');
|
|
237
|
+
const packageJson = JSON.parse(fs.readFileSync(packageJsonPath, 'utf8'));
|
|
238
|
+
if (!isPackageJsonWithVersion(packageJson)) {
|
|
239
|
+
throw new Error(`Could not read Sibu version from ${packageJsonPath}.`);
|
|
240
|
+
}
|
|
241
|
+
return packageJson.version;
|
|
242
|
+
}
|
|
243
|
+
function isPackageJsonWithVersion(value) {
|
|
244
|
+
return Boolean(value && typeof value === 'object' && typeof value.version === 'string');
|
|
245
|
+
}
|
package/bin/shared/prompts.js
CHANGED
|
@@ -3,7 +3,7 @@ import { cancel, isCancel, multiselect, select, text } from '@clack/prompts';
|
|
|
3
3
|
import gradient from 'gradient-string';
|
|
4
4
|
import { Box, Text, render, useApp } from 'ink';
|
|
5
5
|
import { useEffect } from 'react';
|
|
6
|
-
import { SELECTABLE_ARCHITECTURE_SKILLS, SELECTABLE_FRAMEWORK_SKILLS, SELECTABLE_LANGUAGE_SKILLS, SUPPORTED_AGENTS } from './catalog.js';
|
|
6
|
+
import { SELECTABLE_ARCHITECTURE_SKILLS, SELECTABLE_FRAMEWORK_SKILLS, SELECTABLE_LANGUAGE_SKILLS, SELECTABLE_WORKFLOW_SKILLS, SUPPORTED_AGENTS } from './catalog.js';
|
|
7
7
|
const NONE_OPTION_ID = 'none';
|
|
8
8
|
export async function renderIntro() {
|
|
9
9
|
console.log(gradient(['#39ff14', '#00e5ff', '#9b5de5']).multiline('⧖ S I B U ⧖'));
|
|
@@ -99,6 +99,22 @@ export async function askForArchitectureSkill() {
|
|
|
99
99
|
}
|
|
100
100
|
return SELECTABLE_ARCHITECTURE_SKILLS.find((skill) => skill.id === selectedArchitectureSkillId);
|
|
101
101
|
}
|
|
102
|
+
export async function askForWorkflowSkills() {
|
|
103
|
+
const selectedWorkflowSkillIds = await multiselect({
|
|
104
|
+
message: 'Select optional workflow skills for this project.',
|
|
105
|
+
required: false,
|
|
106
|
+
options: SELECTABLE_WORKFLOW_SKILLS.map((skill) => ({
|
|
107
|
+
value: skill.id,
|
|
108
|
+
label: skill.name,
|
|
109
|
+
hint: skill.description,
|
|
110
|
+
})),
|
|
111
|
+
});
|
|
112
|
+
if (isCancel(selectedWorkflowSkillIds)) {
|
|
113
|
+
cancel('Initialization cancelled.');
|
|
114
|
+
process.exit(0);
|
|
115
|
+
}
|
|
116
|
+
return SELECTABLE_WORKFLOW_SKILLS.filter((skill) => selectedWorkflowSkillIds.includes(skill.id));
|
|
117
|
+
}
|
|
102
118
|
export function shouldAskForNewLanguageSkills(state) {
|
|
103
119
|
return (state.selectedLanguageSkills?.length ?? 0) === 0;
|
|
104
120
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@juancr11/sibu",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.5.0",
|
|
4
4
|
"description": "CLI for setting up a local AI-augmented development workflow.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -54,7 +54,7 @@
|
|
|
54
54
|
"@types/react": "^19.2.14",
|
|
55
55
|
"typescript": "^6.0.2"
|
|
56
56
|
},
|
|
57
|
-
"packageManager": "pnpm@10.
|
|
57
|
+
"packageManager": "pnpm@10.33.2",
|
|
58
58
|
"dependencies": {
|
|
59
59
|
"@clack/prompts": "^1.2.0",
|
|
60
60
|
"chalk": "^5.6.2",
|