qodewk 0.8.0 → 0.9.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.
Files changed (2) hide show
  1. package/dist/index.cjs +174 -116
  2. package/package.json +1 -1
package/dist/index.cjs CHANGED
@@ -1153,8 +1153,8 @@ var require_command = __commonJS({
1153
1153
  "use strict";
1154
1154
  var EventEmitter2 = require("events").EventEmitter;
1155
1155
  var childProcess = require("child_process");
1156
- var path12 = require("path");
1157
- var fs11 = require("fs");
1156
+ var path13 = require("path");
1157
+ var fs12 = require("fs");
1158
1158
  var process2 = require("process");
1159
1159
  var { Argument: Argument2, humanReadableArgName } = require_argument();
1160
1160
  var { CommanderError: CommanderError2 } = require_error();
@@ -2135,7 +2135,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2135
2135
  * @param {string} subcommandName
2136
2136
  */
2137
2137
  _checkForMissingExecutable(executableFile, executableDir, subcommandName) {
2138
- if (fs11.existsSync(executableFile)) return;
2138
+ if (fs12.existsSync(executableFile)) return;
2139
2139
  const executableDirMessage = executableDir ? `searched for local subcommand relative to directory '${executableDir}'` : "no directory for search for local subcommand, use .executableDir() to supply a custom directory";
2140
2140
  const executableMissing = `'${executableFile}' does not exist
2141
2141
  - if '${subcommandName}' is not meant to be an executable command, remove description parameter from '.command()' and use '.description()' instead
@@ -2153,11 +2153,11 @@ Expecting one of '${allowedValues.join("', '")}'`);
2153
2153
  let launchWithNode = false;
2154
2154
  const sourceExt = [".js", ".ts", ".tsx", ".mjs", ".cjs"];
2155
2155
  function findFile(baseDir, baseName) {
2156
- const localBin = path12.resolve(baseDir, baseName);
2157
- if (fs11.existsSync(localBin)) return localBin;
2158
- if (sourceExt.includes(path12.extname(baseName))) return void 0;
2156
+ const localBin = path13.resolve(baseDir, baseName);
2157
+ if (fs12.existsSync(localBin)) return localBin;
2158
+ if (sourceExt.includes(path13.extname(baseName))) return void 0;
2159
2159
  const foundExt = sourceExt.find(
2160
- (ext) => fs11.existsSync(`${localBin}${ext}`)
2160
+ (ext) => fs12.existsSync(`${localBin}${ext}`)
2161
2161
  );
2162
2162
  if (foundExt) return `${localBin}${foundExt}`;
2163
2163
  return void 0;
@@ -2169,21 +2169,21 @@ Expecting one of '${allowedValues.join("', '")}'`);
2169
2169
  if (this._scriptPath) {
2170
2170
  let resolvedScriptPath;
2171
2171
  try {
2172
- resolvedScriptPath = fs11.realpathSync(this._scriptPath);
2172
+ resolvedScriptPath = fs12.realpathSync(this._scriptPath);
2173
2173
  } catch {
2174
2174
  resolvedScriptPath = this._scriptPath;
2175
2175
  }
2176
- executableDir = path12.resolve(
2177
- path12.dirname(resolvedScriptPath),
2176
+ executableDir = path13.resolve(
2177
+ path13.dirname(resolvedScriptPath),
2178
2178
  executableDir
2179
2179
  );
2180
2180
  }
2181
2181
  if (executableDir) {
2182
2182
  let localFile = findFile(executableDir, executableFile);
2183
2183
  if (!localFile && !subcommand._executableFile && this._scriptPath) {
2184
- const legacyName = path12.basename(
2184
+ const legacyName = path13.basename(
2185
2185
  this._scriptPath,
2186
- path12.extname(this._scriptPath)
2186
+ path13.extname(this._scriptPath)
2187
2187
  );
2188
2188
  if (legacyName !== this._name) {
2189
2189
  localFile = findFile(
@@ -2194,7 +2194,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
2194
2194
  }
2195
2195
  executableFile = localFile || executableFile;
2196
2196
  }
2197
- launchWithNode = sourceExt.includes(path12.extname(executableFile));
2197
+ launchWithNode = sourceExt.includes(path13.extname(executableFile));
2198
2198
  let proc;
2199
2199
  if (process2.platform !== "win32") {
2200
2200
  if (launchWithNode) {
@@ -3041,7 +3041,7 @@ Expecting one of '${allowedValues.join("', '")}'`);
3041
3041
  * @return {Command}
3042
3042
  */
3043
3043
  nameFromFilename(filename) {
3044
- this._name = path12.basename(filename, path12.extname(filename));
3044
+ this._name = path13.basename(filename, path13.extname(filename));
3045
3045
  return this;
3046
3046
  }
3047
3047
  /**
@@ -3055,9 +3055,9 @@ Expecting one of '${allowedValues.join("', '")}'`);
3055
3055
  * @param {string} [path]
3056
3056
  * @return {(string|null|Command)}
3057
3057
  */
3058
- executableDir(path13) {
3059
- if (path13 === void 0) return this._executableDir;
3060
- this._executableDir = path13;
3058
+ executableDir(path14) {
3059
+ if (path14 === void 0) return this._executableDir;
3060
+ this._executableDir = path14;
3061
3061
  return this;
3062
3062
  }
3063
3063
  /**
@@ -4067,10 +4067,10 @@ var require_src2 = __commonJS({
4067
4067
  var fs_1 = require("fs");
4068
4068
  var debug_1 = __importDefault(require_src());
4069
4069
  var log = debug_1.default("@kwsites/file-exists");
4070
- function check(path12, isFile, isDirectory) {
4071
- log(`checking %s`, path12);
4070
+ function check(path13, isFile, isDirectory) {
4071
+ log(`checking %s`, path13);
4072
4072
  try {
4073
- const stat = fs_1.statSync(path12);
4073
+ const stat = fs_1.statSync(path13);
4074
4074
  if (stat.isFile() && isFile) {
4075
4075
  log(`[OK] path represents a file`);
4076
4076
  return true;
@@ -4090,8 +4090,8 @@ var require_src2 = __commonJS({
4090
4090
  throw e;
4091
4091
  }
4092
4092
  }
4093
- function exists2(path12, type = exports2.READABLE) {
4094
- return check(path12, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
4093
+ function exists2(path13, type = exports2.READABLE) {
4094
+ return check(path13, (type & exports2.FILE) > 0, (type & exports2.FOLDER) > 0);
4095
4095
  }
4096
4096
  exports2.exists = exists2;
4097
4097
  exports2.FILE = 1;
@@ -4155,8 +4155,8 @@ var require_dist2 = __commonJS({
4155
4155
  });
4156
4156
 
4157
4157
  // src/index.ts
4158
- var fs10 = __toESM(require("fs"), 1);
4159
- var path11 = __toESM(require("path"), 1);
4158
+ var fs11 = __toESM(require("fs"), 1);
4159
+ var path12 = __toESM(require("path"), 1);
4160
4160
 
4161
4161
  // ../../node_modules/.pnpm/commander@13.1.0/node_modules/commander/esm.mjs
4162
4162
  var import_index = __toESM(require_commander(), 1);
@@ -4659,8 +4659,8 @@ function getErrorMap() {
4659
4659
 
4660
4660
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/helpers/parseUtil.js
4661
4661
  var makeIssue = (params) => {
4662
- const { data, path: path12, errorMaps, issueData } = params;
4663
- const fullPath = [...path12, ...issueData.path || []];
4662
+ const { data, path: path13, errorMaps, issueData } = params;
4663
+ const fullPath = [...path13, ...issueData.path || []];
4664
4664
  const fullIssue = {
4665
4665
  ...issueData,
4666
4666
  path: fullPath
@@ -4776,11 +4776,11 @@ var errorUtil;
4776
4776
 
4777
4777
  // ../../node_modules/.pnpm/zod@3.25.76/node_modules/zod/v3/types.js
4778
4778
  var ParseInputLazyPath = class {
4779
- constructor(parent, value, path12, key) {
4779
+ constructor(parent, value, path13, key) {
4780
4780
  this._cachedPath = [];
4781
4781
  this.parent = parent;
4782
4782
  this.data = value;
4783
- this._path = path12;
4783
+ this._path = path13;
4784
4784
  this._key = key;
4785
4785
  }
4786
4786
  get path() {
@@ -8892,8 +8892,8 @@ function toLinesWithContent(input = "", trimmed2 = true, separator = "\n") {
8892
8892
  function forEachLineWithContent(input, callback) {
8893
8893
  return toLinesWithContent(input, true).map((line) => callback(line));
8894
8894
  }
8895
- function folderExists(path12) {
8896
- return (0, import_file_exists.exists)(path12, import_file_exists.FOLDER);
8895
+ function folderExists(path13) {
8896
+ return (0, import_file_exists.exists)(path13, import_file_exists.FOLDER);
8897
8897
  }
8898
8898
  function append(target, item) {
8899
8899
  if (Array.isArray(target)) {
@@ -9295,8 +9295,8 @@ function checkIsRepoRootTask() {
9295
9295
  commands,
9296
9296
  format: "utf-8",
9297
9297
  onError,
9298
- parser(path12) {
9299
- return /^\.(git)?$/.test(path12.trim());
9298
+ parser(path13) {
9299
+ return /^\.(git)?$/.test(path13.trim());
9300
9300
  }
9301
9301
  };
9302
9302
  }
@@ -9730,11 +9730,11 @@ function parseGrep(grep) {
9730
9730
  const paths = /* @__PURE__ */ new Set();
9731
9731
  const results = {};
9732
9732
  forEachLineWithContent(grep, (input) => {
9733
- const [path12, line, preview] = input.split(NULL);
9734
- paths.add(path12);
9735
- (results[path12] = results[path12] || []).push({
9733
+ const [path13, line, preview] = input.split(NULL);
9734
+ paths.add(path13);
9735
+ (results[path13] = results[path13] || []).push({
9736
9736
  line: asNumber(line),
9737
- path: path12,
9737
+ path: path13,
9738
9738
  preview
9739
9739
  });
9740
9740
  });
@@ -10498,14 +10498,14 @@ var init_hash_object = __esm({
10498
10498
  init_task();
10499
10499
  }
10500
10500
  });
10501
- function parseInit(bare, path12, text) {
10501
+ function parseInit(bare, path13, text) {
10502
10502
  const response = String(text).trim();
10503
10503
  let result;
10504
10504
  if (result = initResponseRegex.exec(response)) {
10505
- return new InitSummary(bare, path12, false, result[1]);
10505
+ return new InitSummary(bare, path13, false, result[1]);
10506
10506
  }
10507
10507
  if (result = reInitResponseRegex.exec(response)) {
10508
- return new InitSummary(bare, path12, true, result[1]);
10508
+ return new InitSummary(bare, path13, true, result[1]);
10509
10509
  }
10510
10510
  let gitDir = "";
10511
10511
  const tokens = response.split(" ");
@@ -10516,7 +10516,7 @@ function parseInit(bare, path12, text) {
10516
10516
  break;
10517
10517
  }
10518
10518
  }
10519
- return new InitSummary(bare, path12, /^re/i.test(response), gitDir);
10519
+ return new InitSummary(bare, path13, /^re/i.test(response), gitDir);
10520
10520
  }
10521
10521
  var InitSummary;
10522
10522
  var initResponseRegex;
@@ -10525,9 +10525,9 @@ var init_InitSummary = __esm({
10525
10525
  "src/lib/responses/InitSummary.ts"() {
10526
10526
  "use strict";
10527
10527
  InitSummary = class {
10528
- constructor(bare, path12, existing, gitDir) {
10528
+ constructor(bare, path13, existing, gitDir) {
10529
10529
  this.bare = bare;
10530
- this.path = path12;
10530
+ this.path = path13;
10531
10531
  this.existing = existing;
10532
10532
  this.gitDir = gitDir;
10533
10533
  }
@@ -10539,7 +10539,7 @@ var init_InitSummary = __esm({
10539
10539
  function hasBareCommand(command) {
10540
10540
  return command.includes(bareCommand);
10541
10541
  }
10542
- function initTask(bare = false, path12, customArgs) {
10542
+ function initTask(bare = false, path13, customArgs) {
10543
10543
  const commands = ["init", ...customArgs];
10544
10544
  if (bare && !hasBareCommand(commands)) {
10545
10545
  commands.splice(1, 0, bareCommand);
@@ -10548,7 +10548,7 @@ function initTask(bare = false, path12, customArgs) {
10548
10548
  commands,
10549
10549
  format: "utf-8",
10550
10550
  parser(text) {
10551
- return parseInit(commands.includes("--bare"), path12, text);
10551
+ return parseInit(commands.includes("--bare"), path13, text);
10552
10552
  }
10553
10553
  };
10554
10554
  }
@@ -11363,12 +11363,12 @@ var init_FileStatusSummary = __esm({
11363
11363
  "use strict";
11364
11364
  fromPathRegex = /^(.+)\0(.+)$/;
11365
11365
  FileStatusSummary = class {
11366
- constructor(path12, index, working_dir) {
11367
- this.path = path12;
11366
+ constructor(path13, index, working_dir) {
11367
+ this.path = path13;
11368
11368
  this.index = index;
11369
11369
  this.working_dir = working_dir;
11370
11370
  if (index === "R" || working_dir === "R") {
11371
- const detail = fromPathRegex.exec(path12) || [null, path12, path12];
11371
+ const detail = fromPathRegex.exec(path13) || [null, path13, path13];
11372
11372
  this.from = detail[2] || "";
11373
11373
  this.path = detail[1] || "";
11374
11374
  }
@@ -11399,14 +11399,14 @@ function splitLine(result, lineStr) {
11399
11399
  default:
11400
11400
  return;
11401
11401
  }
11402
- function data(index, workingDir, path12) {
11402
+ function data(index, workingDir, path13) {
11403
11403
  const raw = `${index}${workingDir}`;
11404
11404
  const handler = parsers6.get(raw);
11405
11405
  if (handler) {
11406
- handler(result, path12);
11406
+ handler(result, path13);
11407
11407
  }
11408
11408
  if (raw !== "##" && raw !== "!!") {
11409
- result.files.push(new FileStatusSummary(path12, index, workingDir));
11409
+ result.files.push(new FileStatusSummary(path13, index, workingDir));
11410
11410
  }
11411
11411
  }
11412
11412
  }
@@ -11757,9 +11757,9 @@ var init_simple_git_api = __esm({
11757
11757
  next
11758
11758
  );
11759
11759
  }
11760
- hashObject(path12, write) {
11760
+ hashObject(path13, write) {
11761
11761
  return this._runTask(
11762
- hashObjectTask(path12, write === true),
11762
+ hashObjectTask(path13, write === true),
11763
11763
  trailingFunctionArgument(arguments)
11764
11764
  );
11765
11765
  }
@@ -12113,8 +12113,8 @@ var init_branch = __esm({
12113
12113
  }
12114
12114
  });
12115
12115
  function toPath(input) {
12116
- const path12 = input.trim().replace(/^["']|["']$/g, "");
12117
- return path12 && (0, import_node_path.normalize)(path12);
12116
+ const path13 = input.trim().replace(/^["']|["']$/g, "");
12117
+ return path13 && (0, import_node_path.normalize)(path13);
12118
12118
  }
12119
12119
  var parseCheckIgnore;
12120
12120
  var init_CheckIgnore = __esm({
@@ -12399,8 +12399,8 @@ __export2(sub_module_exports, {
12399
12399
  subModuleTask: () => subModuleTask,
12400
12400
  updateSubModuleTask: () => updateSubModuleTask
12401
12401
  });
12402
- function addSubModuleTask(repo, path12) {
12403
- return subModuleTask(["add", repo, path12]);
12402
+ function addSubModuleTask(repo, path13) {
12403
+ return subModuleTask(["add", repo, path13]);
12404
12404
  }
12405
12405
  function initSubModuleTask(customArgs) {
12406
12406
  return subModuleTask(["init", ...customArgs]);
@@ -12714,8 +12714,8 @@ var require_git = __commonJS2({
12714
12714
  }
12715
12715
  return this._runTask(straightThroughStringTask2(command, this._trimmed), next);
12716
12716
  };
12717
- Git2.prototype.submoduleAdd = function(repo, path12, then) {
12718
- return this._runTask(addSubModuleTask2(repo, path12), trailingFunctionArgument2(arguments));
12717
+ Git2.prototype.submoduleAdd = function(repo, path13, then) {
12718
+ return this._runTask(addSubModuleTask2(repo, path13), trailingFunctionArgument2(arguments));
12719
12719
  };
12720
12720
  Git2.prototype.submoduleUpdate = function(args, then) {
12721
12721
  return this._runTask(
@@ -13852,15 +13852,29 @@ var MODEL_ALIASES = {
13852
13852
  "deepseek-reasoner": "deepseek-r1",
13853
13853
  "deepseek/deepseek-r1": "deepseek-r1"
13854
13854
  };
13855
+ var DYNAMIC_RATE_CARDS = {};
13856
+ var DYNAMIC_ALIASES = {};
13857
+ function updatePricingRegistry(newCards, newAliases) {
13858
+ DYNAMIC_RATE_CARDS = { ...DYNAMIC_RATE_CARDS, ...newCards };
13859
+ if (newAliases) {
13860
+ DYNAMIC_ALIASES = { ...DYNAMIC_ALIASES, ...newAliases };
13861
+ }
13862
+ }
13855
13863
  function getRateCard(modelId) {
13856
13864
  if (!modelId)
13857
- return RATE_CARDS["default"];
13865
+ return DYNAMIC_RATE_CARDS["default"] ?? RATE_CARDS["default"];
13858
13866
  let key = modelId.toLowerCase().replace(/[^a-z0-9-]/g, "-");
13859
- if (MODEL_ALIASES[modelId.toLowerCase()]) {
13860
- key = MODEL_ALIASES[modelId.toLowerCase()];
13861
- } else if (MODEL_ALIASES[key]) {
13862
- key = MODEL_ALIASES[key];
13867
+ const aliasMatch = DYNAMIC_ALIASES[modelId.toLowerCase()] ?? MODEL_ALIASES[modelId.toLowerCase()];
13868
+ if (aliasMatch) {
13869
+ key = aliasMatch;
13870
+ } else {
13871
+ const fallbackAliasMatch = DYNAMIC_ALIASES[key] ?? MODEL_ALIASES[key];
13872
+ if (fallbackAliasMatch) {
13873
+ key = fallbackAliasMatch;
13874
+ }
13863
13875
  }
13876
+ if (DYNAMIC_RATE_CARDS[key])
13877
+ return DYNAMIC_RATE_CARDS[key];
13864
13878
  if (RATE_CARDS[key])
13865
13879
  return RATE_CARDS[key];
13866
13880
  if (key.includes("opus")) {
@@ -14192,8 +14206,8 @@ function harvestAntigravityFootprints(repoPath, sinceDate) {
14192
14206
  const DatabaseSync2 = getSqliteDatabase();
14193
14207
  if (!DatabaseSync2)
14194
14208
  return footprints;
14195
- const homedir7 = os2.homedir();
14196
- const antigravityDir = process.env.ANTIGRAVITY_APP_DATA_DIR || path3.join(homedir7, ".gemini", "antigravity");
14209
+ const homedir8 = os2.homedir();
14210
+ const antigravityDir = process.env.ANTIGRAVITY_APP_DATA_DIR || path3.join(homedir8, ".gemini", "antigravity");
14197
14211
  const dbPath = path3.join(antigravityDir, "conversation_summaries.db");
14198
14212
  if (!fs2.existsSync(dbPath)) {
14199
14213
  return footprints;
@@ -14233,7 +14247,7 @@ function harvestAntigravityFootprints(repoPath, sinceDate) {
14233
14247
  continue;
14234
14248
  if (line.includes("Model Selection")) {
14235
14249
  const match = line.match(/Model Selection` from .*?to ([^\.\(\n\r]+)/);
14236
- if (match && match[1]) {
14250
+ if (match && match[1] && match[1].length < 30) {
14237
14251
  const rawModel = match[1].trim();
14238
14252
  if (rawModel.toLowerCase().includes("opus"))
14239
14253
  detectedModel = "claude-opus-4-6-thinking";
@@ -14289,8 +14303,8 @@ function harvestAntigravityFootprints(repoPath, sinceDate) {
14289
14303
  cached: estimatedCached
14290
14304
  },
14291
14305
  cost,
14292
- mode: "verified",
14293
- confidence: 0.95,
14306
+ mode: "estimated",
14307
+ confidence: 0.65,
14294
14308
  rawTranscriptPath: transcriptPath
14295
14309
  });
14296
14310
  }
@@ -14305,8 +14319,8 @@ var path4 = __toESM(require("path"), 1);
14305
14319
  var os3 = __toESM(require("os"), 1);
14306
14320
  function harvestClaudeFootprints(repoPath, projectAlias, sinceDate) {
14307
14321
  const footprints = [];
14308
- const homedir7 = os3.homedir();
14309
- const claudeProjectsDir = path4.join(homedir7, ".claude", "projects");
14322
+ const homedir8 = os3.homedir();
14323
+ const claudeProjectsDir = path4.join(homedir8, ".claude", "projects");
14310
14324
  if (!fs3.existsSync(claudeProjectsDir)) {
14311
14325
  return footprints;
14312
14326
  }
@@ -15112,7 +15126,7 @@ async function harvestUniversalFootprints(options) {
15112
15126
  allFootprints.push(...trailerFps);
15113
15127
  }
15114
15128
  const { primary, rankedFootprints } = selectPrimaryFootprint(allFootprints, options.gitContext);
15115
- allFootprints = rankedFootprints;
15129
+ allFootprints = rankedFootprints.filter((fp) => fp.attributionScore === void 0 || fp.attributionScore >= 0.1);
15116
15130
  try {
15117
15131
  const db = new LocalStateDB();
15118
15132
  for (const fp of allFootprints) {
@@ -15231,6 +15245,49 @@ function estimateCost(options) {
15231
15245
  };
15232
15246
  }
15233
15247
 
15248
+ // ../core/dist/pricing-sync.js
15249
+ var fs8 = __toESM(require("fs"), 1);
15250
+ var path9 = __toESM(require("path"), 1);
15251
+ var os7 = __toESM(require("os"), 1);
15252
+ async function syncDynamicPricing(options) {
15253
+ try {
15254
+ const qodewkDir = path9.join(os7.homedir(), ".qodewk");
15255
+ if (!fs8.existsSync(qodewkDir)) {
15256
+ fs8.mkdirSync(qodewkDir, { recursive: true });
15257
+ }
15258
+ const cacheFile = path9.join(qodewkDir, "pricing_registry_cache.json");
15259
+ const TTL_MS = 24 * 60 * 60 * 1e3;
15260
+ const now = Date.now();
15261
+ if (!options?.force && fs8.existsSync(cacheFile)) {
15262
+ try {
15263
+ const stats = fs8.statSync(cacheFile);
15264
+ if (now - stats.mtimeMs < TTL_MS) {
15265
+ const cachedData = JSON.parse(fs8.readFileSync(cacheFile, "utf-8"));
15266
+ if (cachedData.rates) {
15267
+ updatePricingRegistry(cachedData.rates, cachedData.aliases);
15268
+ }
15269
+ return;
15270
+ }
15271
+ } catch {
15272
+ }
15273
+ }
15274
+ const REMOTE_URL = process.env.QODEWK_PRICING_URL || "https://raw.githubusercontent.com/abushaidislam/Qodewk/master/registry/pricing.json";
15275
+ const controller = new AbortController();
15276
+ const timeout = setTimeout(() => controller.abort(), options?.timeoutMs || 2500);
15277
+ const response = await fetch(REMOTE_URL, { signal: controller.signal });
15278
+ clearTimeout(timeout);
15279
+ if (response.ok) {
15280
+ const data = await response.json();
15281
+ if (data && typeof data === "object" && data.rates) {
15282
+ updatePricingRegistry(data.rates, data.aliases);
15283
+ fs8.promises.writeFile(cacheFile, JSON.stringify(data, null, 2), "utf-8").catch(() => {
15284
+ });
15285
+ }
15286
+ }
15287
+ } catch (error) {
15288
+ }
15289
+ }
15290
+
15234
15291
  // ../core/dist/format.js
15235
15292
  function formatMarkdownReceipt(receipt, publicUrl) {
15236
15293
  const baseUrl = process.env.NEXT_PUBLIC_APP_URL || process.env.QODEWK_APP_URL || "https://qodewk.flinkeo.online";
@@ -15290,6 +15347,7 @@ function sanitizeReceiptForShare(receipt) {
15290
15347
  };
15291
15348
  }
15292
15349
  async function generateReceipt(options = {}) {
15350
+ await syncDynamicPricing({ timeoutMs: 1500 });
15293
15351
  const metrics = await extractGitMetrics({
15294
15352
  repoPath: options.repoPath || process.cwd(),
15295
15353
  baseSha: options.baseSha,
@@ -15395,7 +15453,7 @@ async function generateReceipt(options = {}) {
15395
15453
  }
15396
15454
 
15397
15455
  // src/receipt-view.ts
15398
- var fs8 = __toESM(require("fs"), 1);
15456
+ var fs9 = __toESM(require("fs"), 1);
15399
15457
  var import_picocolors = __toESM(require_picocolors(), 1);
15400
15458
 
15401
15459
  // src/barcode.ts
@@ -15742,7 +15800,7 @@ function buildTerminalReceipt(receipt, publicUrl) {
15742
15800
  }
15743
15801
  if (receipt.ai.aiWrittenRatio !== void 0) {
15744
15802
  const aiPct = Math.round(receipt.ai.aiWrittenRatio * 100);
15745
- printRowSplit("AI Written Code", `${aiPct}% (Human: ${100 - aiPct}%)`);
15803
+ printRowSplit("AI Touched Files", `${aiPct}% (Human: ${100 - aiPct}%)`);
15746
15804
  }
15747
15805
  const tokenDetail = `${inputK} in (${Math.round(receipt.ai.tokens.cached / 1e3)}k cached) / ${outputK} out`;
15748
15806
  const cleanTokens = tokenDetail.length > 40 ? tokenDetail.slice(0, 39) + "\u2026" : tokenDetail;
@@ -15809,7 +15867,7 @@ async function outputReceipt(receipt, options, publicUrl) {
15809
15867
  }
15810
15868
  if (options.out) {
15811
15869
  const fileContent = format === "terminal" ? stripAnsi(content) : content;
15812
- fs8.writeFileSync(options.out, fileContent.endsWith("\n") ? fileContent : fileContent + "\n", "utf-8");
15870
+ fs9.writeFileSync(options.out, fileContent.endsWith("\n") ? fileContent : fileContent + "\n", "utf-8");
15813
15871
  console.log(import_picocolors.default.green(`\u2713 Receipt written to ${options.out}`));
15814
15872
  }
15815
15873
  if (!options.out) {
@@ -15822,8 +15880,8 @@ async function outputReceipt(receipt, options, publicUrl) {
15822
15880
  }
15823
15881
 
15824
15882
  // src/hooks.ts
15825
- var fs9 = __toESM(require("fs"), 1);
15826
- var path9 = __toESM(require("path"), 1);
15883
+ var fs10 = __toESM(require("fs"), 1);
15884
+ var path10 = __toESM(require("path"), 1);
15827
15885
  var HOOK_MARKER_BEGIN = "# --- BEGIN QODEWK HOOK ---";
15828
15886
  var HOOK_MARKER_END = "# --- END QODEWK HOOK ---";
15829
15887
  var HOOK_SNIPPET = `
@@ -15835,37 +15893,37 @@ fi
15835
15893
  ${HOOK_MARKER_END}
15836
15894
  `;
15837
15895
  function resolveGitHooksDir(cwd = process.cwd()) {
15838
- const gitPath = path9.join(cwd, ".git");
15839
- if (!fs9.existsSync(gitPath)) return null;
15896
+ const gitPath = path10.join(cwd, ".git");
15897
+ if (!fs10.existsSync(gitPath)) return null;
15840
15898
  let gitCommonDir;
15841
- const stat = fs9.statSync(gitPath);
15899
+ const stat = fs10.statSync(gitPath);
15842
15900
  if (stat.isDirectory()) {
15843
15901
  gitCommonDir = gitPath;
15844
15902
  } else {
15845
- const content = fs9.readFileSync(gitPath, "utf-8");
15903
+ const content = fs10.readFileSync(gitPath, "utf-8");
15846
15904
  const match = content.match(/gitdir:\s*(.+)/i);
15847
15905
  if (!match?.[1]) return null;
15848
15906
  let gitDir = match[1].trim();
15849
- if (!path9.isAbsolute(gitDir)) {
15850
- gitDir = path9.resolve(cwd, gitDir);
15907
+ if (!path10.isAbsolute(gitDir)) {
15908
+ gitDir = path10.resolve(cwd, gitDir);
15851
15909
  }
15852
- const commonFile = path9.join(gitDir, "commondir");
15853
- if (fs9.existsSync(commonFile)) {
15854
- let common = fs9.readFileSync(commonFile, "utf-8").trim();
15855
- if (!path9.isAbsolute(common)) {
15856
- common = path9.resolve(gitDir, common);
15910
+ const commonFile = path10.join(gitDir, "commondir");
15911
+ if (fs10.existsSync(commonFile)) {
15912
+ let common = fs10.readFileSync(commonFile, "utf-8").trim();
15913
+ if (!path10.isAbsolute(common)) {
15914
+ common = path10.resolve(gitDir, common);
15857
15915
  }
15858
15916
  gitCommonDir = common;
15859
- } else if (path9.basename(path9.dirname(gitDir)) === "worktrees") {
15860
- gitCommonDir = path9.dirname(path9.dirname(gitDir));
15917
+ } else if (path10.basename(path10.dirname(gitDir)) === "worktrees") {
15918
+ gitCommonDir = path10.dirname(path10.dirname(gitDir));
15861
15919
  } else {
15862
15920
  gitCommonDir = gitDir;
15863
15921
  }
15864
15922
  }
15865
- return path9.join(gitCommonDir, "hooks");
15923
+ return path10.join(gitCommonDir, "hooks");
15866
15924
  }
15867
15925
  function checkHookStatus(hooksDir) {
15868
- if (!hooksDir || !fs9.existsSync(hooksDir)) {
15926
+ if (!hooksDir || !fs10.existsSync(hooksDir)) {
15869
15927
  return {
15870
15928
  isGit: Boolean(hooksDir),
15871
15929
  hooksDir,
@@ -15873,12 +15931,12 @@ function checkHookStatus(hooksDir) {
15873
15931
  postRewriteInstalled: false
15874
15932
  };
15875
15933
  }
15876
- const postCommit = path9.join(hooksDir, "post-commit");
15877
- const postRewrite = path9.join(hooksDir, "post-rewrite");
15934
+ const postCommit = path10.join(hooksDir, "post-commit");
15935
+ const postRewrite = path10.join(hooksDir, "post-rewrite");
15878
15936
  const hasHook = (p2) => {
15879
- if (!fs9.existsSync(p2)) return false;
15937
+ if (!fs10.existsSync(p2)) return false;
15880
15938
  try {
15881
- const content = fs9.readFileSync(p2, "utf-8");
15939
+ const content = fs10.readFileSync(p2, "utf-8");
15882
15940
  return content.includes(HOOK_MARKER_BEGIN);
15883
15941
  } catch {
15884
15942
  return false;
@@ -15893,30 +15951,30 @@ function checkHookStatus(hooksDir) {
15893
15951
  }
15894
15952
  function installHookFile(hookFile) {
15895
15953
  let content = "";
15896
- if (fs9.existsSync(hookFile)) {
15897
- content = fs9.readFileSync(hookFile, "utf-8");
15954
+ if (fs10.existsSync(hookFile)) {
15955
+ content = fs10.readFileSync(hookFile, "utf-8");
15898
15956
  } else {
15899
15957
  content = "#!/bin/sh\n";
15900
15958
  }
15901
15959
  if (content.includes(HOOK_MARKER_BEGIN)) {
15902
15960
  return "exists";
15903
15961
  }
15904
- fs9.writeFileSync(hookFile, content + HOOK_SNIPPET, { mode: 493 });
15962
+ fs10.writeFileSync(hookFile, content + HOOK_SNIPPET, { mode: 493 });
15905
15963
  return "installed";
15906
15964
  }
15907
15965
  function uninstallHookFile(hookFile) {
15908
- if (!fs9.existsSync(hookFile)) return "absent";
15909
- const content = fs9.readFileSync(hookFile, "utf-8");
15966
+ if (!fs10.existsSync(hookFile)) return "absent";
15967
+ const content = fs10.readFileSync(hookFile, "utf-8");
15910
15968
  if (!content.includes(HOOK_MARKER_BEGIN)) return "missing";
15911
15969
  const regex = new RegExp(`\\n?${HOOK_MARKER_BEGIN}[\\s\\S]*?${HOOK_MARKER_END}\\n?`, "g");
15912
15970
  const updated = content.replace(regex, "");
15913
- fs9.writeFileSync(hookFile, updated, { mode: 493 });
15971
+ fs10.writeFileSync(hookFile, updated, { mode: 493 });
15914
15972
  return "removed";
15915
15973
  }
15916
15974
 
15917
15975
  // src/menu.ts
15918
15976
  var readline = __toESM(require("readline"), 1);
15919
- var path10 = __toESM(require("path"), 1);
15977
+ var path11 = __toESM(require("path"), 1);
15920
15978
  var import_picocolors2 = __toESM(require_picocolors(), 1);
15921
15979
  var SHARE_PAYLOAD_MAX_BYTES = 5e4;
15922
15980
  var BANNER_LINES = [
@@ -16021,7 +16079,7 @@ function buildMenuFrame(selectedIndex, items = MENU_ITEMS, title = "Telemetry Co
16021
16079
  }
16022
16080
  push("");
16023
16081
  const badge = bg.teal(import_picocolors2.default.bold(colors.ink(" qodewk ")));
16024
- push(` ${colors.mutedSoft("\u250C")} ${badge} ${import_picocolors2.default.dim("v0.8.0")}`);
16082
+ push(` ${colors.mutedSoft("\u250C")} ${badge} ${import_picocolors2.default.dim("v0.9.0")}`);
16025
16083
  push(` ${colors.mutedSoft("\u2502")}`);
16026
16084
  if (options.actionContext) {
16027
16085
  push(` ${colors.teal("\u25C7")} ${import_picocolors2.default.dim("Action:")} ${import_picocolors2.default.white(options.actionContext)}`);
@@ -16106,7 +16164,7 @@ async function getRepoContext() {
16106
16164
  }
16107
16165
  const branchSummary = await git.branch();
16108
16166
  const branch = branchSummary.current || "HEAD";
16109
- const alias = path10.basename(process.cwd());
16167
+ const alias = path11.basename(process.cwd());
16110
16168
  cachedRepoContext = { alias, branch };
16111
16169
  return cachedRepoContext;
16112
16170
  } catch {
@@ -16342,7 +16400,7 @@ async function runInteractiveMenu() {
16342
16400
  if (status.hooksDir) {
16343
16401
  const targets = ["post-commit", "post-rewrite"];
16344
16402
  for (const t2 of targets) {
16345
- installHookFile(path10.join(status.hooksDir, t2));
16403
+ installHookFile(path11.join(status.hooksDir, t2));
16346
16404
  }
16347
16405
  console.log(colors.green("\n [\u2713] Non-blocking hooks installed successfully."));
16348
16406
  }
@@ -16350,7 +16408,7 @@ async function runInteractiveMenu() {
16350
16408
  if (status.hooksDir) {
16351
16409
  const targets = ["post-commit", "post-rewrite"];
16352
16410
  for (const t2 of targets) {
16353
- uninstallHookFile(path10.join(status.hooksDir, t2));
16411
+ uninstallHookFile(path11.join(status.hooksDir, t2));
16354
16412
  }
16355
16413
  console.log(colors.green("\n [\u2713] Qodewk hooks removed."));
16356
16414
  }
@@ -16548,19 +16606,19 @@ async function runInteractiveMenu() {
16548
16606
  var SHARE_PAYLOAD_MAX_BYTES2 = 5e4;
16549
16607
  function resolveCliVersion() {
16550
16608
  try {
16551
- const argv1 = process.argv[1] ? path11.dirname(path11.resolve(process.argv[1])) : process.cwd();
16609
+ const argv1 = process.argv[1] ? path12.dirname(path12.resolve(process.argv[1])) : process.cwd();
16552
16610
  const candidates = [
16553
- path11.join(argv1, "..", "package.json"),
16554
- path11.join(argv1, "package.json")
16611
+ path12.join(argv1, "..", "package.json"),
16612
+ path12.join(argv1, "package.json")
16555
16613
  ];
16556
16614
  for (const candidate of candidates) {
16557
- if (!fs10.existsSync(candidate)) continue;
16558
- const pkg = JSON.parse(fs10.readFileSync(candidate, "utf-8"));
16615
+ if (!fs11.existsSync(candidate)) continue;
16616
+ const pkg = JSON.parse(fs11.readFileSync(candidate, "utf-8"));
16559
16617
  if (pkg.name === "qodewk" && pkg.version) return pkg.version;
16560
16618
  }
16561
16619
  } catch {
16562
16620
  }
16563
- return "0.8.0";
16621
+ return "0.9.0";
16564
16622
  }
16565
16623
  function resolveSince(options) {
16566
16624
  return options.today ? "today" : options.since;
@@ -16727,14 +16785,14 @@ hookCommand.command("install").description("Install non-blocking post-commit and
16727
16785
  console.error(import_picocolors3.default.red("Error: Current directory is not a Git repository (.git not found)."));
16728
16786
  process.exit(1);
16729
16787
  }
16730
- if (!fs10.existsSync(hooksDir)) {
16731
- fs10.mkdirSync(hooksDir, { recursive: true });
16788
+ if (!fs11.existsSync(hooksDir)) {
16789
+ fs11.mkdirSync(hooksDir, { recursive: true });
16732
16790
  }
16733
16791
  const targets = ["post-commit", "post-rewrite"];
16734
16792
  let installed = 0;
16735
16793
  let existing = 0;
16736
16794
  for (const name of targets) {
16737
- const result = installHookFile(path11.join(hooksDir, name));
16795
+ const result = installHookFile(path12.join(hooksDir, name));
16738
16796
  if (result === "installed") installed++;
16739
16797
  else existing++;
16740
16798
  }
@@ -16766,7 +16824,7 @@ hookCommand.command("uninstall").description("Remove Qodewk post-commit and post
16766
16824
  const targets = ["post-commit", "post-rewrite"];
16767
16825
  let removed = 0;
16768
16826
  for (const name of targets) {
16769
- const result = uninstallHookFile(path11.join(hooksDir, name));
16827
+ const result = uninstallHookFile(path12.join(hooksDir, name));
16770
16828
  if (result === "removed") removed++;
16771
16829
  }
16772
16830
  if (removed === 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "qodewk",
3
- "version": "0.8.0",
3
+ "version": "0.9.0",
4
4
  "description": "Universal telemetry and digital receipt generator for the AI coding agent era",
5
5
  "type": "module",
6
6
  "bin": {