@staff0rd/assist 0.1135.2 → 0.1137.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.
package/dist/index.js CHANGED
@@ -6,7 +6,7 @@ import { Command } from "commander";
6
6
  // package.json
7
7
  var package_default = {
8
8
  name: "@staff0rd/assist",
9
- version: "0.1135.2",
9
+ version: "0.1137.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -7842,6 +7842,14 @@ var claudeSdkAdapter = {
7842
7842
  })
7843
7843
  };
7844
7844
 
7845
+ // src/shared/resolveCodexModel.ts
7846
+ var CODEX_DEFAULT_MODEL = "codex-default";
7847
+ function resolveCodexModel(raw) {
7848
+ const model = raw?.trim();
7849
+ if (!model || model === CODEX_DEFAULT_MODEL) return void 0;
7850
+ return model;
7851
+ }
7852
+
7845
7853
  // src/commands/litellm/buildCodexProviderArgs.ts
7846
7854
  var API_KEY_ENV = "ASSIST_LITELLM_API_KEY";
7847
7855
  function buildCodexProviderArgs(responsesBaseUrl, apiKey, model) {
@@ -7880,7 +7888,7 @@ function readLitellmConfig() {
7880
7888
 
7881
7889
  // src/commands/litellm/buildLitellmCodexArgs.ts
7882
7890
  function buildLitellmCodexArgs(rawModel) {
7883
- const model = rawModel?.trim();
7891
+ const model = resolveCodexModel(rawModel);
7884
7892
  if (!model) return { args: [], env: {} };
7885
7893
  const { config } = readLitellmConfig();
7886
7894
  if (!config) return { args: [], env: {} };
@@ -10981,7 +10989,7 @@ var harnessConfigHelp = [
10981
10989
  {
10982
10990
  key: "harness.codexModel",
10983
10991
  setter: "assist config set harness.codexModel <model>",
10984
- note: "empty uses codex's own configured provider; a value routes non-review Codex launches through the LiteLLM proxy with that model (needs litellm.baseUrl and litellm.apiKey)"
10992
+ note: "a value routes non-review Codex launches through the LiteLLM proxy with that model (needs litellm.baseUrl and litellm.apiKey); unset, empty or codex-default uses codex's own configured provider and model, and codex-default overrides a value inherited from user or global config"
10985
10993
  }
10986
10994
  ];
10987
10995
 
@@ -11335,7 +11343,7 @@ var reviewConfigHelp = [
11335
11343
  {
11336
11344
  key: "review.codexModel",
11337
11345
  setter: "assist config set review.codexModel gpt-5-codex",
11338
- note: "optional; runs the codex reviewer on this model via the LiteLLM proxy (needs litellm.baseUrl and litellm.apiKey)"
11346
+ note: "optional; runs the codex reviewer on this model via the LiteLLM proxy (needs litellm.baseUrl and litellm.apiKey); codex-default runs it on codex's own configured model, overriding a value inherited from user or global config"
11339
11347
  },
11340
11348
  {
11341
11349
  key: "review.synthesisHarness",
@@ -22305,12 +22313,12 @@ function checkLimitViolations(check2) {
22305
22313
  ];
22306
22314
  }
22307
22315
  function rejectLongCheck(check2) {
22308
- const violations = checkLimitViolations(check2);
22309
- if (violations.length === 0) return;
22316
+ const violations2 = checkLimitViolations(check2);
22317
+ if (violations2.length === 0) return;
22310
22318
  console.error(
22311
22319
  [
22312
22320
  "Error: the check is over its limits:",
22313
- ...violations,
22321
+ ...violations2,
22314
22322
  "Shorten these fields and re-run assist ask-check."
22315
22323
  ].join("\n")
22316
22324
  );
@@ -22577,18 +22585,25 @@ function formatAskQuestionAnswers(questions, answers) {
22577
22585
  }
22578
22586
 
22579
22587
  // src/commands/askQuestion/rejectLongQuestions.ts
22580
- var MAX_QUESTION_WORDS = 30;
22588
+ var MAX_WORDS2 = { question: 30, context: 40 };
22581
22589
  function countWords(text18) {
22582
22590
  return text18.split(/\s+/).filter(Boolean).length;
22583
22591
  }
22592
+ function violations(q) {
22593
+ return Object.keys(MAX_WORDS2).map((field) => ({
22594
+ header: q.header,
22595
+ field,
22596
+ words: countWords(q[field] ?? "")
22597
+ })).filter((v) => v.words > MAX_WORDS2[v.field]);
22598
+ }
22584
22599
  function rejectLongQuestions(questions) {
22585
- const longQuestions = questions.map((q) => ({ header: q.header, words: countWords(q.question) })).filter((q) => q.words > MAX_QUESTION_WORDS);
22586
- if (longQuestions.length === 0) return;
22600
+ const tooLong = questions.flatMap(violations);
22601
+ if (tooLong.length === 0) return;
22587
22602
  console.error(
22588
22603
  [
22589
- `Error: questions must be ${MAX_QUESTION_WORDS} words or fewer:`,
22590
- ...longQuestions.map((q) => `- ${q.header}: ${q.words} words`),
22591
- "Shorten these questions and re-run assist ask-question."
22604
+ `Error: each question must be ${MAX_WORDS2.question} words or fewer and its context ${MAX_WORDS2.context} words or fewer:`,
22605
+ ...tooLong.map((v) => `- ${v.header} ${v.field}: ${v.words} words`),
22606
+ "Shorten these and re-run assist ask-question."
22592
22607
  ].join("\n")
22593
22608
  );
22594
22609
  process.exit(1);
@@ -22621,6 +22636,7 @@ var askQuestionOptionSchema = z17.object({
22621
22636
  });
22622
22637
  var askQuestionSchema = z17.object({
22623
22638
  question: z17.string().min(1),
22639
+ context: z17.string().optional(),
22624
22640
  header: z17.string().min(1),
22625
22641
  multiSelect: z17.boolean(),
22626
22642
  options: z17.array(askQuestionOptionSchema).min(2, "Each question needs at least 2 options").max(4, "Each question allows at most 4 options").refine(
@@ -44109,7 +44125,7 @@ function suggestName(fileName) {
44109
44125
  }
44110
44126
  function checkFileNames() {
44111
44127
  const sourceFiles = findSourceFiles2("src");
44112
- const violations = [];
44128
+ const violations2 = [];
44113
44129
  for (const filePath of sourceFiles) {
44114
44130
  const fileName = path55.basename(filePath);
44115
44131
  const nameWithoutExt = fileName.replace(/\.(ts|tsx)$/, "");
@@ -44117,7 +44133,7 @@ function checkFileNames() {
44117
44133
  if (/^[A-Z]/.test(nameWithoutExt)) {
44118
44134
  const content = fs36.readFileSync(filePath, "utf8");
44119
44135
  if (!hasClassOrComponent(content) && !hasMatchingTypeExport(content, nameWithoutExt)) {
44120
- violations.push({
44136
+ violations2.push({
44121
44137
  filePath,
44122
44138
  fileName,
44123
44139
  suggestedName: suggestName(fileName)
@@ -44125,7 +44141,7 @@ function checkFileNames() {
44125
44141
  }
44126
44142
  }
44127
44143
  }
44128
- return violations;
44144
+ return violations2;
44129
44145
  }
44130
44146
 
44131
44147
  // src/commands/lint/lint/fixFileNameViolations.ts
@@ -44220,14 +44236,14 @@ function fixFileNameViolations(moves) {
44220
44236
  }
44221
44237
 
44222
44238
  // src/commands/lint/lint/runFileNameCheck.ts
44223
- function reportViolations(violations) {
44239
+ function reportViolations(violations2) {
44224
44240
  console.error(chalk237.red("\nFile name check failed:\n"));
44225
44241
  console.error(
44226
44242
  chalk237.red(
44227
44243
  " Files without classes or React components should not start with a capital letter.\n"
44228
44244
  )
44229
44245
  );
44230
- for (const violation of violations) {
44246
+ for (const violation of violations2) {
44231
44247
  console.error(chalk237.red(` ${violation.filePath}`));
44232
44248
  console.error(chalk237.gray(` Rename to: ${violation.suggestedName}
44233
44249
  `));
@@ -44235,8 +44251,8 @@ function reportViolations(violations) {
44235
44251
  console.error(chalk237.dim(" Run with -f to auto-fix.\n"));
44236
44252
  }
44237
44253
  function runFileNameCheck(fix = false) {
44238
- const violations = checkFileNames();
44239
- if (violations.length === 0) {
44254
+ const violations2 = checkFileNames();
44255
+ if (violations2.length === 0) {
44240
44256
  if (!isAgentHarness()) {
44241
44257
  console.log(
44242
44258
  "File name check passed. All PascalCase files contain classes or components."
@@ -44245,11 +44261,11 @@ function runFileNameCheck(fix = false) {
44245
44261
  return true;
44246
44262
  }
44247
44263
  if (!fix) {
44248
- reportViolations(violations);
44264
+ reportViolations(violations2);
44249
44265
  return false;
44250
44266
  }
44251
44267
  fixFileNameViolations(
44252
- violations.map((v) => ({
44268
+ violations2.map((v) => ({
44253
44269
  sourcePath: v.filePath,
44254
44270
  destPath: path59.join(path59.dirname(v.filePath), v.suggestedName)
44255
44271
  }))
@@ -44262,14 +44278,14 @@ import fs39 from "fs";
44262
44278
 
44263
44279
  // src/commands/lint/shared.ts
44264
44280
  import chalk238 from "chalk";
44265
- function reportViolations2(violations, checkName2, errorMessage3, successMessage) {
44266
- if (violations.length > 0) {
44281
+ function reportViolations2(violations2, checkName2, errorMessage3, successMessage) {
44282
+ if (violations2.length > 0) {
44267
44283
  console.error(chalk238.red(`
44268
44284
  ${checkName2} failed:
44269
44285
  `));
44270
44286
  console.error(chalk238.red(` ${errorMessage3}
44271
44287
  `));
44272
- for (const violation of violations) {
44288
+ for (const violation of violations2) {
44273
44289
  console.error(chalk238.red(` ${violation.filePath}:${violation.line}`));
44274
44290
  console.error(chalk238.gray(` ${violation.content}
44275
44291
  `));
@@ -44286,27 +44302,27 @@ ${checkName2} failed:
44286
44302
  function checkForImportExtensions(filePath) {
44287
44303
  const content = fs39.readFileSync(filePath, "utf8");
44288
44304
  const lines = content.split("\n");
44289
- const violations = [];
44305
+ const violations2 = [];
44290
44306
  const importExtensionPattern = /from\s+["']\..*\.(js|ts)["']/;
44291
44307
  for (let i = 0; i < lines.length; i++) {
44292
44308
  const line = lines[i];
44293
44309
  if (importExtensionPattern.test(line)) {
44294
- violations.push({
44310
+ violations2.push({
44295
44311
  filePath,
44296
44312
  line: i + 1,
44297
44313
  content: line.trim()
44298
44314
  });
44299
44315
  }
44300
44316
  }
44301
- return violations;
44317
+ return violations2;
44302
44318
  }
44303
44319
  function checkImportExtensions() {
44304
44320
  const sourceFiles = findSourceFiles2("src");
44305
- const violations = [];
44321
+ const violations2 = [];
44306
44322
  for (const filePath of sourceFiles) {
44307
- violations.push(...checkForImportExtensions(filePath));
44323
+ violations2.push(...checkForImportExtensions(filePath));
44308
44324
  }
44309
- return violations;
44325
+ return violations2;
44310
44326
  }
44311
44327
  function runImportExtensionCheck() {
44312
44328
  return reportViolations2(
@@ -44394,7 +44410,7 @@ var WEB_UI_DIR = "src/commands/sessions/web/ui";
44394
44410
  var REPORTER_DIR = path60.join(WEB_UI_DIR, "clientFailures");
44395
44411
  function runSilentCatchCheck() {
44396
44412
  const project = new Project2({ useInMemoryFileSystem: true });
44397
- const violations = findSourceFiles2(WEB_UI_DIR, { includeTests: false }).filter((filePath) => !filePath.startsWith(REPORTER_DIR)).flatMap(
44413
+ const violations2 = findSourceFiles2(WEB_UI_DIR, { includeTests: false }).filter((filePath) => !filePath.startsWith(REPORTER_DIR)).flatMap(
44398
44414
  (filePath) => findSilentCatches(
44399
44415
  project.createSourceFile(filePath, fs40.readFileSync(filePath, "utf8"))
44400
44416
  )
@@ -44403,7 +44419,7 @@ function runSilentCatchCheck() {
44403
44419
  filePath: path60.relative("/", violation.filePath)
44404
44420
  }));
44405
44421
  return reportViolations2(
44406
- violations,
44422
+ violations2,
44407
44423
  "Silent catch check",
44408
44424
  "Catch blocks in the web UI that drop an async error must call reportCaughtError(error, context) or surface the error.",
44409
44425
  "Silent catch check passed. No dropped async errors in the web UI."
@@ -44415,28 +44431,28 @@ import fs41 from "fs";
44415
44431
  function checkForDynamicImports(filePath) {
44416
44432
  const content = fs41.readFileSync(filePath, "utf8");
44417
44433
  const lines = content.split("\n");
44418
- const violations = [];
44434
+ const violations2 = [];
44419
44435
  const requirePattern = /\brequire\s*\(/;
44420
44436
  const dynamicImportPattern = /\bimport\s*\(/;
44421
44437
  for (let i = 0; i < lines.length; i++) {
44422
44438
  const line = lines[i];
44423
44439
  if (requirePattern.test(line) || dynamicImportPattern.test(line)) {
44424
- violations.push({
44440
+ violations2.push({
44425
44441
  filePath,
44426
44442
  line: i + 1,
44427
44443
  content: line.trim()
44428
44444
  });
44429
44445
  }
44430
44446
  }
44431
- return violations;
44447
+ return violations2;
44432
44448
  }
44433
44449
  function checkStaticImports() {
44434
44450
  const sourceFiles = findSourceFiles2("src");
44435
- const violations = [];
44451
+ const violations2 = [];
44436
44452
  for (const filePath of sourceFiles) {
44437
- violations.push(...checkForDynamicImports(filePath));
44453
+ violations2.push(...checkForDynamicImports(filePath));
44438
44454
  }
44439
- return violations;
44455
+ return violations2;
44440
44456
  }
44441
44457
  function runStaticImportCheck() {
44442
44458
  return reportViolations2(
@@ -44952,8 +44968,8 @@ import * as path62 from "path";
44952
44968
  // src/commands/refactor/logViolations.ts
44953
44969
  import chalk243 from "chalk";
44954
44970
  var DEFAULT_MAX_LINES2 = 100;
44955
- function logViolations(violations, maxLines = DEFAULT_MAX_LINES2) {
44956
- if (violations.length === 0) {
44971
+ function logViolations(violations2, maxLines = DEFAULT_MAX_LINES2) {
44972
+ if (violations2.length === 0) {
44957
44973
  if (!isAgentHarness()) {
44958
44974
  console.log(`Refactor check passed. No files exceed ${maxLines} lines.`);
44959
44975
  }
@@ -44964,7 +44980,7 @@ Refactor check failed:
44964
44980
  `));
44965
44981
  console.error(chalk243.red(` The following files exceed ${maxLines} lines:
44966
44982
  `));
44967
- for (const violation of violations) {
44983
+ for (const violation of violations2) {
44968
44984
  console.error(chalk243.red(` ${violation.file} (${violation.lines} lines)`));
44969
44985
  }
44970
44986
  console.error(
@@ -45080,15 +45096,15 @@ function getViolations(pattern2, options2 = {}, maxLines = DEFAULT_MAX_LINES2) {
45080
45096
  if (gitFiles) {
45081
45097
  sourceFiles = sourceFiles.filter((f) => gitFiles.has(f));
45082
45098
  }
45083
- const violations = [];
45099
+ const violations2 = [];
45084
45100
  for (const filePath of sourceFiles) {
45085
45101
  const lineCount2 = countLines(filePath);
45086
45102
  const maxAllowed = ignoredFiles.get(filePath) ?? maxLines;
45087
45103
  if (lineCount2 > maxAllowed) {
45088
- violations.push({ file: filePath, lines: lineCount2 });
45104
+ violations2.push({ file: filePath, lines: lineCount2 });
45089
45105
  }
45090
45106
  }
45091
- return violations;
45107
+ return violations2;
45092
45108
  }
45093
45109
 
45094
45110
  // src/commands/refactor/check.ts
@@ -45141,10 +45157,10 @@ async function check(pattern2, options2) {
45141
45157
  process.exit(1);
45142
45158
  }
45143
45159
  const maxLines = options2.maxLines ?? DEFAULT_MAX_LINES2;
45144
- const violations = getViolations(pattern2, options2, maxLines);
45145
- violations.sort((a, b) => b.lines - a.lines);
45146
- logViolations(violations, maxLines);
45147
- if (violations.length > 0) {
45160
+ const violations2 = getViolations(pattern2, options2, maxLines);
45161
+ violations2.sort((a, b) => b.lines - a.lines);
45162
+ logViolations(violations2, maxLines);
45163
+ if (violations2.length > 0) {
45148
45164
  process.exit(1);
45149
45165
  }
45150
45166
  }
@@ -49042,7 +49058,7 @@ function resolveSynthesisHarness() {
49042
49058
  // src/commands/review/reviewModel.ts
49043
49059
  function reviewModel(harness) {
49044
49060
  const models = {
49045
- codex: loadConfig().review?.codexModel
49061
+ codex: resolveCodexModel(loadConfig().review?.codexModel)
49046
49062
  };
49047
49063
  return models[harness];
49048
49064
  }
@@ -50868,7 +50884,7 @@ function registerReview(program) {
50868
50884
  configHelp(
50869
50885
  reviewCommand,
50870
50886
  reviewConfigHelp,
50871
- "With review.codexModel unset the codex reviewer runs on the user's own codex auth; when it is set but the LiteLLM proxy is not configured, the reviewer falls back to that plain codex run. A reviewer whose harness is unavailable is skipped with its reason, and the review stops before reviewing when the review.synthesisHarness cannot synthesise."
50887
+ "With review.codexModel unset or codex-default the codex reviewer runs on the user's own codex auth and configured model (set codex-default in a repo to override an inherited value); when it is set but the LiteLLM proxy is not configured, the reviewer falls back to that plain codex run. A reviewer whose harness is unavailable is skipped with its reason, and the review stops before reviewing when the review.synthesisHarness cannot synthesise."
50872
50888
  );
50873
50889
  }
50874
50890
 
@@ -53892,14 +53908,14 @@ function resolveStringsAtPath(data, path128) {
53892
53908
  return [];
53893
53909
  }
53894
53910
  function findRuleViolations(data, rule) {
53895
- const violations = [];
53911
+ const violations2 = [];
53896
53912
  for (const path128 of rule.paths) {
53897
53913
  for (const value of resolveStringsAtPath(data, path128)) {
53898
53914
  if (minimatch10(value, rule.disallowed))
53899
- violations.push({ file: rule.file, path: path128, value });
53915
+ violations2.push({ file: rule.file, path: path128, value });
53900
53916
  }
53901
53917
  }
53902
- return violations;
53918
+ return violations2;
53903
53919
  }
53904
53920
  function findForbiddenStrings(rules2, readJson2) {
53905
53921
  return rules2.flatMap((rule) => findRuleViolations(readJson2(rule.file), rule));
@@ -53929,17 +53945,17 @@ function forbiddenStrings() {
53929
53945
  cache7.set(file, parsed);
53930
53946
  return parsed;
53931
53947
  };
53932
- const violations = findForbiddenStrings(rules2, readJson2);
53933
- if (violations.length === 0) {
53948
+ const violations2 = findForbiddenStrings(rules2, readJson2);
53949
+ if (violations2.length === 0) {
53934
53950
  console.log("No forbidden strings found.");
53935
53951
  process.exit(0);
53936
53952
  }
53937
53953
  console.log("Forbidden strings found:\n");
53938
- for (const { file, path: path128, value } of violations) {
53954
+ for (const { file, path: path128, value } of violations2) {
53939
53955
  console.log(` ${file} ${path128}: ${value}`);
53940
53956
  }
53941
53957
  console.log(`
53942
- Total: ${violations.length} forbidden string(s).`);
53958
+ Total: ${violations2.length} forbidden string(s).`);
53943
53959
  console.log(
53944
53960
  "\nRemove each flagged value, or adjust the matching forbiddenStrings rule in assist.yml."
53945
53961
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.1135.2",
3
+ "version": "0.1137.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {