fwinit 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/dist/index.js +11 -1
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -4,6 +4,7 @@
4
4
  import { Command } from "commander";
5
5
  import ora from "ora";
6
6
  import chalk from "chalk";
7
+ import { readFileSync } from "fs";
7
8
  import { mkdir as mkdir2, cp as cp2, access } from "fs/promises";
8
9
  import { join as join2 } from "path";
9
10
 
@@ -378,6 +379,15 @@ async function adaptToNodeRuntime(projectPath) {
378
379
  // src/index.ts
379
380
  var program = new Command();
380
381
  var PACKAGE_MANAGERS = ["npm", "pnpm", "bun"];
382
+ function getCliVersion() {
383
+ try {
384
+ const pkgUrl = new URL("../package.json", import.meta.url);
385
+ const pkg = JSON.parse(readFileSync(pkgUrl, "utf-8"));
386
+ return typeof pkg.version === "string" ? pkg.version : "0.0.0";
387
+ } catch {
388
+ return "0.0.0";
389
+ }
390
+ }
381
391
  async function installOpenCodeFiles(repoRoot, projectPath) {
382
392
  const skill = join2(repoRoot, "skills", "create-specs", "SKILL.md");
383
393
  const command = join2(repoRoot, "skills", "create-specs", "command.md");
@@ -402,7 +412,7 @@ async function installOpenCodeFiles(repoRoot, projectPath) {
402
412
  join2(projectPath, ".opencode", "commands", "create-specs.md")
403
413
  );
404
414
  }
405
- program.name("fwinit").description("CLI para crear proyectos desde templates").version("1.0.0");
415
+ program.name("fwinit").description("CLI para crear proyectos desde templates").version(getCliVersion());
406
416
  program.command("list").description("Mostrar templates disponibles").action(() => {
407
417
  console.log(
408
418
  chalk.bold("\nTemplates disponibles:\n")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "fwinit",
3
- "version": "1.1.0",
3
+ "version": "1.1.2",
4
4
  "description": "CLI para crear proyectos desde templates",
5
5
  "type": "module",
6
6
  "bin": {