@savvy-web/silk-effects 5.2.1 → 5.3.1

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.
@@ -7,8 +7,34 @@ import { Effect } from "effect";
7
7
  *
8
8
  * @internal
9
9
  */
10
+ /**
11
+ * A closing keyword followed by its full list of issue references.
12
+ *
13
+ * @remarks
14
+ * The house commit format puts every issue on ONE comma-separated trailer
15
+ * (`Closes #247, #248, #251`), so a pattern anchored on `keyword\s+#N` sees
16
+ * only the first id and reports a missing trailer that is plainly present.
17
+ * Capturing the whole list and scanning it is what makes the later ids count.
18
+ *
19
+ * `and` is accepted alongside the comma because humans write it; the optional
20
+ * colon matches the `Closes: #N` form the validator's trailer pattern allows.
21
+ *
22
+ * @internal
23
+ */
24
+ const CLOSING_LIST_PATTERN = /\b(?:closes|fixes|resolves):?\s+(#\d+(?:\s*(?:,|and)\s*#\d+)*)/gi;
25
+ /**
26
+ * Reference ids within a captured closing list.
27
+ *
28
+ * @internal
29
+ */
30
+ const REFERENCE_PATTERN = /#(\d+)/g;
10
31
  function hasClosingTrailer(message, ticketId) {
11
- return new RegExp(`\\b(closes|fixes|resolves)\\s+#${ticketId}\\b`, "i").test(message);
32
+ for (const keywordMatch of message.matchAll(CLOSING_LIST_PATTERN)) {
33
+ const list = keywordMatch[1];
34
+ if (list === void 0) continue;
35
+ for (const reference of list.matchAll(REFERENCE_PATTERN)) if (Number(reference[1]) === ticketId) return true;
36
+ }
37
+ return false;
12
38
  }
13
39
  const closesTrailerRule = {
14
40
  id: "closes-trailer",
@@ -6,8 +6,26 @@ import { Effect } from "effect";
6
6
  *
7
7
  * @internal
8
8
  */
9
- const VERBOSITY_LINE_THRESHOLD = 25;
10
- const VERBOSITY_WORD_THRESHOLD = 400;
9
+ /**
10
+ * Body-line ceiling before the rule advises.
11
+ *
12
+ * @remarks
13
+ * The house format is three to five bullets (or one to two short paragraphs)
14
+ * plus a `Closes` line and a `Signed-off-by` line, and the counted body here
15
+ * includes those two trailers. That is a 7-line message at the top of the
16
+ * intended range, so 12 leaves headroom and fires only on a body that is
17
+ * clearly past the format rather than at its boundary.
18
+ */
19
+ const VERBOSITY_LINE_THRESHOLD = 12;
20
+ /**
21
+ * Body-word ceiling before the rule advises.
22
+ *
23
+ * @remarks
24
+ * Five bullets at roughly 20 words each, plus trailers, lands near 110. A
25
+ * two-paragraph prose body lands lower. 150 is the point past which a body
26
+ * has stopped being a scannable index entry.
27
+ */
28
+ const VERBOSITY_WORD_THRESHOLD = 150;
11
29
  const verbosityRule = {
12
30
  id: "verbosity",
13
31
  severity: "advise",
@@ -15,14 +33,14 @@ const verbosityRule = {
15
33
  const body = input.message.split("\n").slice(2).filter((l) => l.length > 0);
16
34
  const lineCount = body.length;
17
35
  const wordCount = body.join(" ").trim().split(/\s+/).filter(Boolean).length;
18
- if (lineCount <= 25 && wordCount <= 400) return null;
36
+ if (lineCount <= 12 && wordCount <= 150) return null;
19
37
  const reasons = [];
20
- if (lineCount > 25) reasons.push(`${lineCount} non-empty body lines`);
21
- if (wordCount > 400) reasons.push(`${wordCount} words`);
38
+ if (lineCount > 12) reasons.push(`${lineCount} non-empty body lines`);
39
+ if (wordCount > 150) reasons.push(`${wordCount} words`);
22
40
  return {
23
41
  ruleId: "verbosity",
24
42
  severity: "advise",
25
- message: `Body has ${reasons.join(" / ")}; the project standard keeps commit bodies under ~${25} lines and ~${400} words. Move detail to the PR description and keep the commit body to the irreducible "what + why".`
43
+ message: `Body has ${reasons.join(" / ")}; the project standard is three to five bullets, or one to two short paragraphs, under ~${12} lines and ~${150} words. This repo squash-merges, so a long body is discarded at merge. Cut to the user-visible change, the behavior a consumer could trip over, and any non-obvious trap; move the reasoning and evidence to the PR description.`
26
44
  };
27
45
  })
28
46
  };
@@ -60,8 +60,8 @@ var commitlint_exports = /* @__PURE__ */ __exportAll({
60
60
  TDD_STATES: () => TDD_STATES,
61
61
  TYPE_EMOJIS: () => TYPE_EMOJIS,
62
62
  TYPE_EMOJIS_UNICODE: () => TYPE_EMOJIS_UNICODE,
63
- VERBOSITY_LINE_THRESHOLD: () => 25,
64
- VERBOSITY_WORD_THRESHOLD: () => 400,
63
+ VERBOSITY_LINE_THRESHOLD: () => 12,
64
+ VERBOSITY_WORD_THRESHOLD: () => 150,
65
65
  buildSigningDiagnostic: () => buildSigningDiagnostic,
66
66
  closesTrailerRule: () => closesTrailerRule,
67
67
  createPromptConfig: () => createPromptConfig,
package/index.d.ts CHANGED
@@ -289,7 +289,7 @@ declare class Categories {
289
289
  static isValidHeading(heading: string): boolean;
290
290
  }
291
291
  //#endregion
292
- //#region ../../node_modules/.pnpm/@changesets+types@7.0.0-next.8/node_modules/@changesets/types/dist/index.d.mts
292
+ //#region ../../node_modules/.pnpm/@changesets+types@7.0.0-next.9/node_modules/@changesets/types/dist/index.d.mts
293
293
  //#region src/index.d.ts
294
294
  type MaybePromise<T> = T | Promise<T>;
295
295
  type VersionType$1 = "major" | "minor" | "patch" | "none";
@@ -417,7 +417,6 @@ type ChangelogFunctions = {
417
417
  type PreState = {
418
418
  mode: "pre" | "exit";
419
419
  tag: string;
420
- changesets: string[];
421
420
  };
422
421
  //#endregion
423
422
  //#region src/changesets/api/changelog.d.ts
@@ -6513,8 +6512,26 @@ declare const softWrapRule: Rule<SoftWrapInput, never>;
6513
6512
  interface VerbosityInput {
6514
6513
  message: string;
6515
6514
  }
6516
- declare const VERBOSITY_LINE_THRESHOLD = 25;
6517
- declare const VERBOSITY_WORD_THRESHOLD = 400;
6515
+ /**
6516
+ * Body-line ceiling before the rule advises.
6517
+ *
6518
+ * @remarks
6519
+ * The house format is three to five bullets (or one to two short paragraphs)
6520
+ * plus a `Closes` line and a `Signed-off-by` line, and the counted body here
6521
+ * includes those two trailers. That is a 7-line message at the top of the
6522
+ * intended range, so 12 leaves headroom and fires only on a body that is
6523
+ * clearly past the format rather than at its boundary.
6524
+ */
6525
+ declare const VERBOSITY_LINE_THRESHOLD = 12;
6526
+ /**
6527
+ * Body-word ceiling before the rule advises.
6528
+ *
6529
+ * @remarks
6530
+ * Five bullets at roughly 20 words each, plus trailers, lands near 110. A
6531
+ * two-paragraph prose body lands lower. 150 is the point past which a body
6532
+ * has stopped being a scannable index entry.
6533
+ */
6534
+ declare const VERBOSITY_WORD_THRESHOLD = 150;
6518
6535
  declare const verbosityRule: Rule<VerbosityInput, never>;
6519
6536
  declare namespace index_d_exports$1 {
6520
6537
  export { BranchInfo, COMMIT_TYPES, COMMIT_TYPE_DEFINITIONS, ClosesTrailerCtx, ClosesTrailerInput, CommitType, CommitTypeDefinition, CommitlintConfig, CommitlintPlugin, CommitlintUserConfig, ConfigOptions, DCO_SIGNOFF_TEXT, DEFAULT_BODY_MAX_LINE_LENGTH, ERROR_EXPLANATIONS, ERROR_SUGGESTIONS, ForbiddenContentInput, FormatterResult, HookOutput, RuleSeverity$1 as HookRuleSeverity, HookSilencer, ISSUES_CACHE_RELATIVE_PATH, ISSUES_CACHE_TTL_SECONDS, Inquirer, LintOutcome, LockfilePresence, OpenIssue, PackageManager$1 as PackageManager, ParsedCommit, ParsedKind, PlanLeakageInput, PostToolUseEnvelope, PostToolUseEnvelope as PostToolUseEnvelopeType, PreToolUseEnvelope, PreToolUseEnvelope as PreToolUseEnvelopeType, PromptConfig, PromptConfigOptions, PromptQuestion, PromptSettings, PrompterOptions, Question, RawSigningInputs, ReleaseFormat, ResolvedPromptConfig, Rule, RuleApplicability, RuleConfigTuple, RuleHit, RuleResult, RuleSeverity, RulesConfig, SessionStartEnvelope, SessionStartEnvelope as SessionStartEnvelopeType, SigningDiagnostic, SigningFlagCtx, SigningFlagInput, SoftWrapInput, TDD_SCOPE_PATTERN, TDD_STATES, TYPE_EMOJIS, TYPE_EMOJIS_UNICODE, TypeEnumEntry, VERBOSITY_LINE_THRESHOLD, VERBOSITY_WORD_THRESHOLD, VerbosityInput, buildSigningDiagnostic, closesTrailerRule, createPromptConfig, createTypeEnum, CommitlintConfig as default, defaultPromptConfig, detectDCO, detectFromLockfiles, detectPackageManager, detectScopes, emojiPromptConfig, fetchAndCacheOpenIssues, forbiddenContentRule, format, getExplanation, getSuggestion, getTypeEmoji, hasClosingTrailer, inferTicketId, parseBashCommand, parseGpgKeyExpiry, parseHuskyConfigPath, parsePackageManagerField, partitionHits, planLeakageRule, postToolUseAdvise, preToolUseAdvise, preToolUseAllow, preToolUseDeny, preToolUseSilent, prompter, readBranchInfo, readCache, readCommitlintConfigPath, readOpenIssuesFromCache, readOrFetchOpenIssues, readSigningDiagnostic, sessionStartContext, signingFlagConflictRule, softWrapRule, staticConfig, verbosityRule, writeCache };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@savvy-web/silk-effects",
3
- "version": "5.2.1",
3
+ "version": "5.3.1",
4
4
  "private": false,
5
5
  "description": "Shared Effect library for Silk Suite conventions",
6
6
  "homepage": "https://github.com/savvy-web/systems/tree/main/packages/silk-effects",
@@ -37,10 +37,10 @@
37
37
  "@effected/git": "^0.5.2",
38
38
  "@effected/glob": "^0.2.2",
39
39
  "@effected/jsonc": "^0.5.2",
40
- "@effected/package-json": "^0.7.2",
40
+ "@effected/package-json": "^0.7.3",
41
41
  "@effected/templates": "^0.1.1",
42
42
  "@effected/walker": "^0.3.4",
43
- "@effected/workspaces": "^0.9.4",
43
+ "@effected/workspaces": "^0.9.5",
44
44
  "@effected/yaml": "^0.6.1",
45
45
  "@manypkg/get-packages": "^3.1.0",
46
46
  "mdast-util-heading-range": "^4.0.0",