@whisperr/wizard 0.1.13 → 0.1.14

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 +28 -2
  2. package/package.json +2 -1
package/dist/index.js CHANGED
@@ -1,5 +1,10 @@
1
1
  #!/usr/bin/env node
2
2
 
3
+ // src/index.ts
4
+ import { readFileSync, realpathSync } from "fs";
5
+ import { dirname, join as join3 } from "path";
6
+ import { fileURLToPath } from "url";
7
+
3
8
  // src/cli.ts
4
9
  import { resolve } from "path";
5
10
  import * as p from "@clack/prompts";
@@ -1939,6 +1944,12 @@ function summarizeManifest(m) {
1939
1944
  }
1940
1945
 
1941
1946
  // src/index.ts
1947
+ var modulePath = fileURLToPath(import.meta.url);
1948
+ function packageVersion() {
1949
+ const packagePath = join3(dirname(modulePath), "..", "package.json");
1950
+ const pkg = JSON.parse(readFileSync(packagePath, "utf8"));
1951
+ return pkg.version ?? "0.0.0";
1952
+ }
1942
1953
  function parseArgs(argv) {
1943
1954
  const args = [...argv];
1944
1955
  const opts = {};
@@ -2002,7 +2013,7 @@ async function main() {
2002
2013
  return;
2003
2014
  }
2004
2015
  if ("version" in parsed) {
2005
- console.log("0.1.12");
2016
+ console.log(packageVersion());
2006
2017
  return;
2007
2018
  }
2008
2019
  try {
@@ -2013,4 +2024,19 @@ async function main() {
2013
2024
  process.exit(1);
2014
2025
  }
2015
2026
  }
2016
- void main();
2027
+ function isCliEntry() {
2028
+ if (!process.argv[1]) return false;
2029
+ try {
2030
+ return realpathSync(modulePath) === realpathSync(process.argv[1]);
2031
+ } catch {
2032
+ return modulePath === process.argv[1];
2033
+ }
2034
+ }
2035
+ if (isCliEntry()) {
2036
+ void main();
2037
+ }
2038
+ export {
2039
+ main,
2040
+ packageVersion,
2041
+ parseArgs
2042
+ };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@whisperr/wizard",
3
- "version": "0.1.13",
3
+ "version": "0.1.14",
4
4
  "description": "Whisperr Wizard — one command to integrate the Whisperr SDK into your app. Authenticates with your onboarded account and uses an AI coding agent to wire up identify() and your business events automatically.",
5
5
  "license": "UNLICENSED",
6
6
  "private": false,
@@ -22,6 +22,7 @@
22
22
  "dev": "tsup --watch",
23
23
  "start": "node dist/index.js",
24
24
  "typecheck": "tsc --noEmit",
25
+ "test": "node --import tsx --test test/*.test.ts",
25
26
  "prepublishOnly": "npm run build",
26
27
  "dev:local": "tsx src/index.ts"
27
28
  },