@juancr11/sibu 0.4.1 → 0.4.2

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.
@@ -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 = '0.1.0';
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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@juancr11/sibu",
3
- "version": "0.4.1",
3
+ "version": "0.4.2",
4
4
  "description": "CLI for setting up a local AI-augmented development workflow.",
5
5
  "repository": {
6
6
  "type": "git",