@savvy-web/silk-effects 5.2.0 → 5.3.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.
@@ -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
@@ -6513,8 +6513,26 @@ declare const softWrapRule: Rule<SoftWrapInput, never>;
6513
6513
  interface VerbosityInput {
6514
6514
  message: string;
6515
6515
  }
6516
- declare const VERBOSITY_LINE_THRESHOLD = 25;
6517
- declare const VERBOSITY_WORD_THRESHOLD = 400;
6516
+ /**
6517
+ * Body-line ceiling before the rule advises.
6518
+ *
6519
+ * @remarks
6520
+ * The house format is three to five bullets (or one to two short paragraphs)
6521
+ * plus a `Closes` line and a `Signed-off-by` line, and the counted body here
6522
+ * includes those two trailers. That is a 7-line message at the top of the
6523
+ * intended range, so 12 leaves headroom and fires only on a body that is
6524
+ * clearly past the format rather than at its boundary.
6525
+ */
6526
+ declare const VERBOSITY_LINE_THRESHOLD = 12;
6527
+ /**
6528
+ * Body-word ceiling before the rule advises.
6529
+ *
6530
+ * @remarks
6531
+ * Five bullets at roughly 20 words each, plus trailers, lands near 110. A
6532
+ * two-paragraph prose body lands lower. 150 is the point past which a body
6533
+ * has stopped being a scannable index entry.
6534
+ */
6535
+ declare const VERBOSITY_WORD_THRESHOLD = 150;
6518
6536
  declare const verbosityRule: Rule<VerbosityInput, never>;
6519
6537
  declare namespace index_d_exports$1 {
6520
6538
  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.0",
3
+ "version": "5.3.0",
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",
@@ -33,15 +33,15 @@
33
33
  "@changesets/config": "^4.0.0-next.6",
34
34
  "@changesets/get-github-info": "^1.0.0-next.4",
35
35
  "@changesets/get-release-plan": "^5.0.0-next.9",
36
- "@effected/commands": "^0.2.0",
37
- "@effected/git": "^0.5.1",
38
- "@effected/glob": "^0.2.1",
39
- "@effected/jsonc": "^0.5.1",
40
- "@effected/package-json": "^0.7.1",
41
- "@effected/templates": "^0.1.0",
42
- "@effected/walker": "^0.3.3",
43
- "@effected/workspaces": "^0.9.3",
44
- "@effected/yaml": "^0.6.0",
36
+ "@effected/commands": "^0.2.1",
37
+ "@effected/git": "^0.5.2",
38
+ "@effected/glob": "^0.2.2",
39
+ "@effected/jsonc": "^0.5.2",
40
+ "@effected/package-json": "^0.7.2",
41
+ "@effected/templates": "^0.1.1",
42
+ "@effected/walker": "^0.3.4",
43
+ "@effected/workspaces": "^0.9.4",
44
+ "@effected/yaml": "^0.6.1",
45
45
  "@manypkg/get-packages": "^3.1.0",
46
46
  "mdast-util-heading-range": "^4.0.0",
47
47
  "mdast-util-to-string": "^4.0.0",