@staff0rd/assist 0.661.0 → 0.662.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.661.0",
9
+ version: "0.662.0",
10
10
  type: "module",
11
11
  main: "dist/index.js",
12
12
  bin: {
@@ -651,8 +651,7 @@ var DEFAULT_BACKUP_DIR = "~/.assist/backups";
651
651
  var DEFAULT_CLONE_DIR = "~/git";
652
652
  var assistConfigShape = {
653
653
  advice: z3.strictObject({
654
- include: z3.array(z3.enum(adviceFragmentNames)).default([]),
655
- exclude: z3.array(z3.enum(adviceFragmentNames)).default([]),
654
+ fragments: z3.partialRecord(z3.enum(adviceFragmentNames), z3.boolean()).default({}),
656
655
  extra: z3.string().optional(),
657
656
  verify: z3.string().optional()
658
657
  }).optional(),
@@ -2870,8 +2869,7 @@ function configHelp(command, entries, preamble) {
2870
2869
 
2871
2870
  // src/shared/configEnumDescriptions.ts
2872
2871
  var byKey = {
2873
- "advice.include": adviceFragmentTitles,
2874
- "advice.exclude": adviceFragmentTitles
2872
+ "advice.fragments": adviceFragmentTitles
2875
2873
  };
2876
2874
  function configEnumDescriptions(key) {
2877
2875
  return byKey[key];
@@ -3002,11 +3000,24 @@ function unionOfObjectsConfigNode(inner, base, build2) {
3002
3000
  }
3003
3001
 
3004
3002
  // src/shared/recordConfigNode.ts
3003
+ function enumKeyValues(keyType, base, build2) {
3004
+ if (!keyType) return void 0;
3005
+ const key = build2(keyType, base.path);
3006
+ return key.kind === "scalar" ? key.enumValues : void 0;
3007
+ }
3005
3008
  function recordConfigNode(inner, base, build2) {
3006
3009
  const valueType = inner.def?.valueType;
3007
3010
  if (inner.def?.type !== "record" || !valueType) return void 0;
3008
3011
  const value = build2(valueType, [...base.path, { kind: "entry" }]);
3009
- return { ...base, kind: "record", value };
3012
+ const keyValues = enumKeyValues(inner.def?.keyType, base, build2);
3013
+ const keyDescriptions = keyValues ? configEnumDescriptions(formatConfigPath(base.path)) : void 0;
3014
+ return {
3015
+ ...base,
3016
+ kind: "record",
3017
+ value,
3018
+ ...keyValues ? { keyValues } : {},
3019
+ ...keyDescriptions ? { keyDescriptions } : {}
3020
+ };
3010
3021
  }
3011
3022
 
3012
3023
  // src/shared/scalarConfigNode.ts
@@ -3101,14 +3112,9 @@ function enumerateConfigLeafKeys(schema2) {
3101
3112
  // src/commands/advise/adviceConfigHelp.ts
3102
3113
  var adviceConfigHelp = [
3103
3114
  {
3104
- key: "advice.include",
3105
- setter: 'assist config set advice.include "refactor"',
3106
- note: "fragment names included whatever their condition says; 'assist advise --explain' lists every name"
3107
- },
3108
- {
3109
- key: "advice.exclude",
3110
- setter: 'assist config set advice.exclude "jira-context"',
3111
- note: "fragment names dropped even when their condition matches; 'assist advise --explain' lists every name"
3115
+ key: "advice.fragments",
3116
+ setter: "assist config set advice.fragments.verify false",
3117
+ note: "force a fragment on (true) or off (false) whatever its condition says; 'assist advise --explain' lists every name"
3112
3118
  },
3113
3119
  {
3114
3120
  key: "advice.extra",
@@ -5369,13 +5375,14 @@ var adviceConditions = {
5369
5375
 
5370
5376
  // src/commands/advise/selectAdvice.ts
5371
5377
  function decide(fragment, context) {
5372
- const advice = context.config.advice;
5373
- const exclude = advice?.exclude ?? [];
5374
- const include = advice?.include ?? [];
5375
- if (exclude.includes(fragment.name))
5376
- return { fragment, included: false, reason: "excluded by advice.exclude" };
5377
- if (include.includes(fragment.name))
5378
- return { fragment, included: true, reason: "included by advice.include" };
5378
+ const fragments = context.config.advice?.fragments ?? {};
5379
+ const override = fragments[fragment.name];
5380
+ if (override !== void 0)
5381
+ return {
5382
+ fragment,
5383
+ included: override,
5384
+ reason: `advice.fragments.${fragment.name} is ${override}`
5385
+ };
5379
5386
  const condition = adviceConditions[fragment.when];
5380
5387
  if (!condition)
5381
5388
  return {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@staff0rd/assist",
3
- "version": "0.661.0",
3
+ "version": "0.662.0",
4
4
  "type": "module",
5
5
  "main": "dist/index.js",
6
6
  "bin": {