@utilix-tech/sdk 0.31.0 → 0.33.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/CHANGELOG.md +8 -0
- package/README.md +10 -6
- package/dist/{ai_agent-B-c59NXD.d.cts → ai_agent-C1zudGgT.d.cts} +24 -2
- package/dist/{ai_agent-B-c59NXD.d.ts → ai_agent-C1zudGgT.d.ts} +24 -2
- package/dist/{chunk-AFEZ6N4A.js → chunk-H2USEUHD.js} +67 -1
- package/dist/{chunk-LXKIPPDG.js → chunk-UUT5HNST.js} +121 -1
- package/dist/{chunk-265NPGKH.js → chunk-W3J7GZVQ.js} +25 -1
- package/dist/{chunk-GDIZWDBY.js → chunk-ZPQOE7KD.js} +78 -1
- package/dist/{code-DaRvff2v.d.ts → code-BK-x8hVx.d.cts} +51 -2
- package/dist/{code-DaRvff2v.d.cts → code-BK-x8hVx.d.ts} +51 -2
- package/dist/index.cjs +287 -0
- package/dist/index.d.cts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +4 -4
- package/dist/{text-D1fySkCB.d.cts → text-CA-zuD0C.d.cts} +34 -2
- package/dist/{text-D1fySkCB.d.ts → text-CA-zuD0C.d.ts} +34 -2
- package/dist/tools/ai_agent.cjs +24 -0
- package/dist/tools/ai_agent.d.cts +1 -1
- package/dist/tools/ai_agent.d.ts +1 -1
- package/dist/tools/ai_agent.js +1 -1
- package/dist/tools/code.cjs +120 -0
- package/dist/tools/code.d.cts +1 -1
- package/dist/tools/code.d.ts +1 -1
- package/dist/tools/code.js +1 -1
- package/dist/tools/text.cjs +66 -0
- package/dist/tools/text.d.cts +1 -1
- package/dist/tools/text.d.ts +1 -1
- package/dist/tools/text.js +1 -1
- package/dist/tools/units.cjs +77 -0
- package/dist/tools/units.d.cts +1 -1
- package/dist/tools/units.d.ts +1 -1
- package/dist/tools/units.js +1 -1
- package/dist/{units-DQYLZd1n.d.cts → units-BhoxdHhs.d.cts} +42 -2
- package/dist/{units-DQYLZd1n.d.ts → units-BhoxdHhs.d.ts} +42 -2
- package/package.json +1 -1
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* - mime-lookup (lookupMime, MIME_TABLE)
|
|
21
21
|
* - github-url-parser (parseGithubUrl)
|
|
22
22
|
* - redos-detector (detectRedos)
|
|
23
|
+
* - conventional-commit-linter (lintConventionalCommit)
|
|
23
24
|
*/
|
|
24
25
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
25
26
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -334,13 +335,60 @@ interface RedosResult {
|
|
|
334
335
|
declare function detectRedos(pattern: string): RedosResult | {
|
|
335
336
|
error: string;
|
|
336
337
|
};
|
|
338
|
+
type ConventionalCommitSeverity = 'error' | 'warning';
|
|
339
|
+
interface ConventionalCommitFinding {
|
|
340
|
+
rule: string;
|
|
341
|
+
severity: ConventionalCommitSeverity;
|
|
342
|
+
message: string;
|
|
343
|
+
}
|
|
344
|
+
interface ConventionalCommitFooter {
|
|
345
|
+
token: string;
|
|
346
|
+
value: string;
|
|
347
|
+
}
|
|
348
|
+
interface ConventionalCommitParsed {
|
|
349
|
+
header: string;
|
|
350
|
+
type: string | null;
|
|
351
|
+
scope: string | null;
|
|
352
|
+
breaking: boolean;
|
|
353
|
+
description: string | null;
|
|
354
|
+
body: string | null;
|
|
355
|
+
footers: ConventionalCommitFooter[];
|
|
356
|
+
}
|
|
357
|
+
interface ConventionalCommitOptions {
|
|
358
|
+
types?: string[];
|
|
359
|
+
maxHeaderLength?: number;
|
|
360
|
+
}
|
|
361
|
+
interface ConventionalCommitResult {
|
|
362
|
+
message: string;
|
|
363
|
+
valid: boolean;
|
|
364
|
+
parsed: ConventionalCommitParsed;
|
|
365
|
+
findings: ConventionalCommitFinding[];
|
|
366
|
+
}
|
|
367
|
+
declare const DEFAULT_COMMIT_TYPES: string[];
|
|
368
|
+
/**
|
|
369
|
+
* Lint a commit message against the Conventional Commits v1.0.0 spec. Pass
|
|
370
|
+
* the full message (header, optional blank line, optional body, optional
|
|
371
|
+
* footers). Returns the parsed type/scope/description/body/footers plus a
|
|
372
|
+
* list of findings; `valid` is true iff there are no error-severity findings.
|
|
373
|
+
* This is a heuristic linter: multi-line footer values are not supported.
|
|
374
|
+
*/
|
|
375
|
+
declare function lintConventionalCommit(message: string, options?: ConventionalCommitOptions): ConventionalCommitResult | {
|
|
376
|
+
error: string;
|
|
377
|
+
};
|
|
337
378
|
|
|
338
379
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
339
380
|
type code_ApiEndpoint = ApiEndpoint;
|
|
340
381
|
type code_ApiInfo = ApiInfo;
|
|
341
382
|
declare const code_CHEATSHEET: typeof CHEATSHEET;
|
|
342
383
|
type code_CheatsheetEntry = CheatsheetEntry;
|
|
384
|
+
type code_ConventionalCommitFinding = ConventionalCommitFinding;
|
|
385
|
+
type code_ConventionalCommitFooter = ConventionalCommitFooter;
|
|
386
|
+
type code_ConventionalCommitOptions = ConventionalCommitOptions;
|
|
387
|
+
type code_ConventionalCommitParsed = ConventionalCommitParsed;
|
|
388
|
+
type code_ConventionalCommitResult = ConventionalCommitResult;
|
|
389
|
+
type code_ConventionalCommitSeverity = ConventionalCommitSeverity;
|
|
343
390
|
type code_CssResult = CssResult;
|
|
391
|
+
declare const code_DEFAULT_COMMIT_TYPES: typeof DEFAULT_COMMIT_TYPES;
|
|
344
392
|
type code_DockerImageRef = DockerImageRef;
|
|
345
393
|
type code_EnvEntry = EnvEntry;
|
|
346
394
|
type code_EnvParseResult = EnvParseResult;
|
|
@@ -396,6 +444,7 @@ declare const code_getHtmlStats: typeof getHtmlStats;
|
|
|
396
444
|
declare const code_getJsStats: typeof getJsStats;
|
|
397
445
|
declare const code_getMethodColor: typeof getMethodColor;
|
|
398
446
|
declare const code_isValidTag: typeof isValidTag;
|
|
447
|
+
declare const code_lintConventionalCommit: typeof lintConventionalCommit;
|
|
399
448
|
declare const code_lookupMime: typeof lookupMime;
|
|
400
449
|
declare const code_minifyCss: typeof minifyCss;
|
|
401
450
|
declare const code_minifyGql: typeof minifyGql;
|
|
@@ -420,7 +469,7 @@ declare const code_testPattern: typeof testPattern;
|
|
|
420
469
|
declare const code_testRegex: typeof testRegex;
|
|
421
470
|
declare const code_validateEnvKey: typeof validateEnvKey;
|
|
422
471
|
declare namespace code {
|
|
423
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
472
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
424
473
|
}
|
|
425
474
|
|
|
426
|
-
export {
|
|
475
|
+
export { countProperties as $, ALL_FLAGS as A, type RegexError as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EnvEntry as E, type RegexFlag as F, type GitCommandConfig as G, type HtmlFormatResult as H, type RegexMatch as I, type JsMinifyOptions as J, type RegexResult as K, type RegexSuccess as L, MIME_TABLE as M, type Segment as N, OPERATIONS as O, type ParsedSpec as P, type SpecVersion as Q, type RedosFinding as R, SQL_DEFAULT_OPTIONS as S, type SqlDialect as T, type SqlFormatOptions as U, type TestPatternResult as V, buildDockerPull as W, buildDockerRun as X, buildGitCommand as Y, collapseHtmlWhitespace as Z, collapseJsWhitespace as _, type ApiEndpoint as a, countRules as a0, detectDialect as a1, detectOperationType as a2, detectRedos as a3, envToExport as a4, envToJson as a5, formatCss as a6, formatGql as a7, formatHtml as a8, formatSql as a9, testPattern as aA, testRegex as aB, validateEnvKey as aC, getEndpointsByTag as aa, getHtmlStats as ab, getJsStats as ac, getMethodColor as ad, isValidTag as ae, lintConventionalCommit as af, lookupMime as ag, minifyCss as ah, minifyGql as ai, minifyHtml as aj, minifyJs as ak, minifySql as al, normalizeRef as am, parseDockerImage as an, parseEnv as ao, parseGitCommand as ap, parseGithubUrl as aq, parseSpec as ar, removeConsoleCalls as as, removeEmptyAttributes as at, removeHtmlComments as au, removeJsComments as av, removeRedundantAttributes as aw, searchCheatsheet as ax, searchEndpoints as ay, splitStatements as az, type ApiInfo as b, code as c, type CheatsheetEntry as d, type ConventionalCommitFinding as e, type ConventionalCommitFooter as f, type ConventionalCommitOptions as g, type ConventionalCommitParsed as h, type ConventionalCommitResult as i, type ConventionalCommitSeverity as j, type CssResult as k, type DockerImageRef as l, type EnvParseResult as m, type GitCommandResult as n, type GitOperation as o, type GithubUrlInfo as p, type GithubUrlType as q, type GqlFormatResult as r, type HtmlMinifyOptions as s, type HtmlMinifyResult as t, type JsMinifyResult as u, type MatchResult as v, type MimeEntry as w, type MimeLookupResult as x, type RedosResult as y, type RedosSeverity as z };
|
|
@@ -20,6 +20,7 @@
|
|
|
20
20
|
* - mime-lookup (lookupMime, MIME_TABLE)
|
|
21
21
|
* - github-url-parser (parseGithubUrl)
|
|
22
22
|
* - redos-detector (detectRedos)
|
|
23
|
+
* - conventional-commit-linter (lintConventionalCommit)
|
|
23
24
|
*/
|
|
24
25
|
type RegexFlag = 'g' | 'i' | 'm' | 's' | 'u';
|
|
25
26
|
declare const ALL_FLAGS: RegexFlag[];
|
|
@@ -334,13 +335,60 @@ interface RedosResult {
|
|
|
334
335
|
declare function detectRedos(pattern: string): RedosResult | {
|
|
335
336
|
error: string;
|
|
336
337
|
};
|
|
338
|
+
type ConventionalCommitSeverity = 'error' | 'warning';
|
|
339
|
+
interface ConventionalCommitFinding {
|
|
340
|
+
rule: string;
|
|
341
|
+
severity: ConventionalCommitSeverity;
|
|
342
|
+
message: string;
|
|
343
|
+
}
|
|
344
|
+
interface ConventionalCommitFooter {
|
|
345
|
+
token: string;
|
|
346
|
+
value: string;
|
|
347
|
+
}
|
|
348
|
+
interface ConventionalCommitParsed {
|
|
349
|
+
header: string;
|
|
350
|
+
type: string | null;
|
|
351
|
+
scope: string | null;
|
|
352
|
+
breaking: boolean;
|
|
353
|
+
description: string | null;
|
|
354
|
+
body: string | null;
|
|
355
|
+
footers: ConventionalCommitFooter[];
|
|
356
|
+
}
|
|
357
|
+
interface ConventionalCommitOptions {
|
|
358
|
+
types?: string[];
|
|
359
|
+
maxHeaderLength?: number;
|
|
360
|
+
}
|
|
361
|
+
interface ConventionalCommitResult {
|
|
362
|
+
message: string;
|
|
363
|
+
valid: boolean;
|
|
364
|
+
parsed: ConventionalCommitParsed;
|
|
365
|
+
findings: ConventionalCommitFinding[];
|
|
366
|
+
}
|
|
367
|
+
declare const DEFAULT_COMMIT_TYPES: string[];
|
|
368
|
+
/**
|
|
369
|
+
* Lint a commit message against the Conventional Commits v1.0.0 spec. Pass
|
|
370
|
+
* the full message (header, optional blank line, optional body, optional
|
|
371
|
+
* footers). Returns the parsed type/scope/description/body/footers plus a
|
|
372
|
+
* list of findings; `valid` is true iff there are no error-severity findings.
|
|
373
|
+
* This is a heuristic linter: multi-line footer values are not supported.
|
|
374
|
+
*/
|
|
375
|
+
declare function lintConventionalCommit(message: string, options?: ConventionalCommitOptions): ConventionalCommitResult | {
|
|
376
|
+
error: string;
|
|
377
|
+
};
|
|
337
378
|
|
|
338
379
|
declare const code_ALL_FLAGS: typeof ALL_FLAGS;
|
|
339
380
|
type code_ApiEndpoint = ApiEndpoint;
|
|
340
381
|
type code_ApiInfo = ApiInfo;
|
|
341
382
|
declare const code_CHEATSHEET: typeof CHEATSHEET;
|
|
342
383
|
type code_CheatsheetEntry = CheatsheetEntry;
|
|
384
|
+
type code_ConventionalCommitFinding = ConventionalCommitFinding;
|
|
385
|
+
type code_ConventionalCommitFooter = ConventionalCommitFooter;
|
|
386
|
+
type code_ConventionalCommitOptions = ConventionalCommitOptions;
|
|
387
|
+
type code_ConventionalCommitParsed = ConventionalCommitParsed;
|
|
388
|
+
type code_ConventionalCommitResult = ConventionalCommitResult;
|
|
389
|
+
type code_ConventionalCommitSeverity = ConventionalCommitSeverity;
|
|
343
390
|
type code_CssResult = CssResult;
|
|
391
|
+
declare const code_DEFAULT_COMMIT_TYPES: typeof DEFAULT_COMMIT_TYPES;
|
|
344
392
|
type code_DockerImageRef = DockerImageRef;
|
|
345
393
|
type code_EnvEntry = EnvEntry;
|
|
346
394
|
type code_EnvParseResult = EnvParseResult;
|
|
@@ -396,6 +444,7 @@ declare const code_getHtmlStats: typeof getHtmlStats;
|
|
|
396
444
|
declare const code_getJsStats: typeof getJsStats;
|
|
397
445
|
declare const code_getMethodColor: typeof getMethodColor;
|
|
398
446
|
declare const code_isValidTag: typeof isValidTag;
|
|
447
|
+
declare const code_lintConventionalCommit: typeof lintConventionalCommit;
|
|
399
448
|
declare const code_lookupMime: typeof lookupMime;
|
|
400
449
|
declare const code_minifyCss: typeof minifyCss;
|
|
401
450
|
declare const code_minifyGql: typeof minifyGql;
|
|
@@ -420,7 +469,7 @@ declare const code_testPattern: typeof testPattern;
|
|
|
420
469
|
declare const code_testRegex: typeof testRegex;
|
|
421
470
|
declare const code_validateEnvKey: typeof validateEnvKey;
|
|
422
471
|
declare namespace code {
|
|
423
|
-
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_CssResult as CssResult, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
472
|
+
export { code_ALL_FLAGS as ALL_FLAGS, type code_ApiEndpoint as ApiEndpoint, type code_ApiInfo as ApiInfo, code_CHEATSHEET as CHEATSHEET, type code_CheatsheetEntry as CheatsheetEntry, type code_ConventionalCommitFinding as ConventionalCommitFinding, type code_ConventionalCommitFooter as ConventionalCommitFooter, type code_ConventionalCommitOptions as ConventionalCommitOptions, type code_ConventionalCommitParsed as ConventionalCommitParsed, type code_ConventionalCommitResult as ConventionalCommitResult, type code_ConventionalCommitSeverity as ConventionalCommitSeverity, type code_CssResult as CssResult, code_DEFAULT_COMMIT_TYPES as DEFAULT_COMMIT_TYPES, type code_DockerImageRef as DockerImageRef, type code_EnvEntry as EnvEntry, type code_EnvParseResult as EnvParseResult, type code_GitCommandConfig as GitCommandConfig, type code_GitCommandResult as GitCommandResult, type code_GitOperation as GitOperation, type code_GithubUrlInfo as GithubUrlInfo, type code_GithubUrlType as GithubUrlType, type code_GqlFormatResult as GqlFormatResult, type code_HtmlFormatResult as HtmlFormatResult, type code_HtmlMinifyOptions as HtmlMinifyOptions, type code_HtmlMinifyResult as HtmlMinifyResult, type code_JsMinifyOptions as JsMinifyOptions, type code_JsMinifyResult as JsMinifyResult, code_MIME_TABLE as MIME_TABLE, type code_MatchResult as MatchResult, type code_MimeEntry as MimeEntry, type code_MimeLookupResult as MimeLookupResult, code_OPERATIONS as OPERATIONS, type code_ParsedSpec as ParsedSpec, type code_RedosFinding as RedosFinding, type code_RedosResult as RedosResult, type code_RedosSeverity as RedosSeverity, type code_RegexError as RegexError, type code_RegexFlag as RegexFlag, type code_RegexMatch as RegexMatch, type code_RegexResult as RegexResult, type code_RegexSuccess as RegexSuccess, code_SQL_DEFAULT_OPTIONS as SQL_DEFAULT_OPTIONS, type code_Segment as Segment, type code_SpecVersion as SpecVersion, type code_SqlDialect as SqlDialect, type code_SqlFormatOptions as SqlFormatOptions, type code_TestPatternResult as TestPatternResult, code_buildDockerPull as buildDockerPull, code_buildDockerRun as buildDockerRun, code_buildGitCommand as buildGitCommand, code_collapseHtmlWhitespace as collapseHtmlWhitespace, code_collapseJsWhitespace as collapseJsWhitespace, code_countProperties as countProperties, code_countRules as countRules, code_detectDialect as detectDialect, code_detectOperationType as detectOperationType, code_detectRedos as detectRedos, code_envToExport as envToExport, code_envToJson as envToJson, code_formatCss as formatCss, code_formatGql as formatGql, code_formatHtml as formatHtml, code_formatSql as formatSql, code_getEndpointsByTag as getEndpointsByTag, code_getHtmlStats as getHtmlStats, code_getJsStats as getJsStats, code_getMethodColor as getMethodColor, code_isValidTag as isValidTag, code_lintConventionalCommit as lintConventionalCommit, code_lookupMime as lookupMime, code_minifyCss as minifyCss, code_minifyGql as minifyGql, code_minifyHtml as minifyHtml, code_minifyJs as minifyJs, code_minifySql as minifySql, code_normalizeRef as normalizeRef, code_parseDockerImage as parseDockerImage, code_parseEnv as parseEnv, code_parseGitCommand as parseGitCommand, code_parseGithubUrl as parseGithubUrl, code_parseSpec as parseSpec, code_removeConsoleCalls as removeConsoleCalls, code_removeEmptyAttributes as removeEmptyAttributes, code_removeHtmlComments as removeHtmlComments, code_removeJsComments as removeJsComments, code_removeRedundantAttributes as removeRedundantAttributes, code_searchCheatsheet as searchCheatsheet, code_searchEndpoints as searchEndpoints, code_splitStatements as splitStatements, code_testPattern as testPattern, code_testRegex as testRegex, code_validateEnvKey as validateEnvKey };
|
|
424
473
|
}
|
|
425
474
|
|
|
426
|
-
export {
|
|
475
|
+
export { countProperties as $, ALL_FLAGS as A, type RegexError as B, CHEATSHEET as C, DEFAULT_COMMIT_TYPES as D, type EnvEntry as E, type RegexFlag as F, type GitCommandConfig as G, type HtmlFormatResult as H, type RegexMatch as I, type JsMinifyOptions as J, type RegexResult as K, type RegexSuccess as L, MIME_TABLE as M, type Segment as N, OPERATIONS as O, type ParsedSpec as P, type SpecVersion as Q, type RedosFinding as R, SQL_DEFAULT_OPTIONS as S, type SqlDialect as T, type SqlFormatOptions as U, type TestPatternResult as V, buildDockerPull as W, buildDockerRun as X, buildGitCommand as Y, collapseHtmlWhitespace as Z, collapseJsWhitespace as _, type ApiEndpoint as a, countRules as a0, detectDialect as a1, detectOperationType as a2, detectRedos as a3, envToExport as a4, envToJson as a5, formatCss as a6, formatGql as a7, formatHtml as a8, formatSql as a9, testPattern as aA, testRegex as aB, validateEnvKey as aC, getEndpointsByTag as aa, getHtmlStats as ab, getJsStats as ac, getMethodColor as ad, isValidTag as ae, lintConventionalCommit as af, lookupMime as ag, minifyCss as ah, minifyGql as ai, minifyHtml as aj, minifyJs as ak, minifySql as al, normalizeRef as am, parseDockerImage as an, parseEnv as ao, parseGitCommand as ap, parseGithubUrl as aq, parseSpec as ar, removeConsoleCalls as as, removeEmptyAttributes as at, removeHtmlComments as au, removeJsComments as av, removeRedundantAttributes as aw, searchCheatsheet as ax, searchEndpoints as ay, splitStatements as az, type ApiInfo as b, code as c, type CheatsheetEntry as d, type ConventionalCommitFinding as e, type ConventionalCommitFooter as f, type ConventionalCommitOptions as g, type ConventionalCommitParsed as h, type ConventionalCommitResult as i, type ConventionalCommitSeverity as j, type CssResult as k, type DockerImageRef as l, type EnvParseResult as m, type GitCommandResult as n, type GitOperation as o, type GithubUrlInfo as p, type GithubUrlType as q, type GqlFormatResult as r, type HtmlMinifyOptions as s, type HtmlMinifyResult as t, type JsMinifyResult as u, type MatchResult as v, type MimeEntry as w, type MimeLookupResult as x, type RedosResult as y, type RedosSeverity as z };
|
package/dist/index.cjs
CHANGED
|
@@ -2017,6 +2017,7 @@ __export(text_exports, {
|
|
|
2017
2017
|
LINE_OPS: () => LINE_OPS,
|
|
2018
2018
|
MORSE_CODE: () => MORSE_CODE,
|
|
2019
2019
|
addBorder: () => addBorder,
|
|
2020
|
+
analyzeSentenceLengths: () => analyzeSentenceLengths,
|
|
2020
2021
|
analyzeText: () => analyzeText,
|
|
2021
2022
|
applyOp: () => applyOp,
|
|
2022
2023
|
applyOps: () => applyOps,
|
|
@@ -4605,6 +4606,71 @@ function calculateStringDistance(a, b, options) {
|
|
|
4605
4606
|
const similarity = maxLength === 0 ? 1 : Math.round((1 - distance / maxLength) * 1e4) / 1e4;
|
|
4606
4607
|
return { a, b, distance, similarity, maxLength, mode };
|
|
4607
4608
|
}
|
|
4609
|
+
function splitIntoSentencesForLengthDist(text) {
|
|
4610
|
+
const matches = text.match(/[^.!?]+[.!?]*/g);
|
|
4611
|
+
if (!matches) return [];
|
|
4612
|
+
return matches.map((s) => s.trim()).filter((s) => s.length > 0);
|
|
4613
|
+
}
|
|
4614
|
+
function countWordsInSentence(sentence) {
|
|
4615
|
+
return (sentence.match(/[a-zA-Z']+/g) ?? []).length;
|
|
4616
|
+
}
|
|
4617
|
+
function analyzeSentenceLengths(text) {
|
|
4618
|
+
const sentences = splitIntoSentencesForLengthDist(text);
|
|
4619
|
+
const lengths = sentences.map(countWordsInSentence).filter((n) => n > 0);
|
|
4620
|
+
if (lengths.length === 0) {
|
|
4621
|
+
return {
|
|
4622
|
+
sentenceCount: 0,
|
|
4623
|
+
lengths: [],
|
|
4624
|
+
minLength: 0,
|
|
4625
|
+
maxLength: 0,
|
|
4626
|
+
meanLength: 0,
|
|
4627
|
+
medianLength: 0,
|
|
4628
|
+
stdDev: 0,
|
|
4629
|
+
coefficientOfVariation: 0,
|
|
4630
|
+
consistency: "No sentences to analyze",
|
|
4631
|
+
buckets: []
|
|
4632
|
+
};
|
|
4633
|
+
}
|
|
4634
|
+
const sentenceCount2 = lengths.length;
|
|
4635
|
+
const minLength = Math.min(...lengths);
|
|
4636
|
+
const maxLength = Math.max(...lengths);
|
|
4637
|
+
const meanLength = lengths.reduce((a, b) => a + b, 0) / sentenceCount2;
|
|
4638
|
+
const sorted = [...lengths].sort((a, b) => a - b);
|
|
4639
|
+
const mid = Math.floor(sorted.length / 2);
|
|
4640
|
+
const medianLength = sorted.length % 2 === 0 ? (sorted[mid - 1] + sorted[mid]) / 2 : sorted[mid];
|
|
4641
|
+
const variance = lengths.reduce((sum, n) => sum + (n - meanLength) ** 2, 0) / sentenceCount2;
|
|
4642
|
+
const stdDev = Math.sqrt(variance);
|
|
4643
|
+
const coefficientOfVariation = meanLength > 0 ? stdDev / meanLength : 0;
|
|
4644
|
+
let consistency;
|
|
4645
|
+
if (coefficientOfVariation < 0.3) consistency = "Consistent \u2014 sentence lengths vary little";
|
|
4646
|
+
else if (coefficientOfVariation < 0.6) consistency = "Moderate variation in sentence length";
|
|
4647
|
+
else consistency = "Highly variable sentence length";
|
|
4648
|
+
const bucketWidth = 5;
|
|
4649
|
+
const bucketCount = Math.max(1, Math.ceil(maxLength / bucketWidth));
|
|
4650
|
+
const buckets = [];
|
|
4651
|
+
for (let i = 0; i < bucketCount; i++) {
|
|
4652
|
+
const min = i * bucketWidth + 1;
|
|
4653
|
+
const max = (i + 1) * bucketWidth;
|
|
4654
|
+
buckets.push({ label: `${min}-${max}`, min, max, count: 0 });
|
|
4655
|
+
}
|
|
4656
|
+
for (const len of lengths) {
|
|
4657
|
+
const idx = Math.min(Math.floor((len - 1) / bucketWidth), bucketCount - 1);
|
|
4658
|
+
buckets[idx].count++;
|
|
4659
|
+
}
|
|
4660
|
+
const round23 = (n) => Math.round(n * 100) / 100;
|
|
4661
|
+
return {
|
|
4662
|
+
sentenceCount: sentenceCount2,
|
|
4663
|
+
lengths,
|
|
4664
|
+
minLength,
|
|
4665
|
+
maxLength,
|
|
4666
|
+
meanLength: round23(meanLength),
|
|
4667
|
+
medianLength: round23(medianLength),
|
|
4668
|
+
stdDev: round23(stdDev),
|
|
4669
|
+
coefficientOfVariation: round23(coefficientOfVariation),
|
|
4670
|
+
consistency,
|
|
4671
|
+
buckets
|
|
4672
|
+
};
|
|
4673
|
+
}
|
|
4608
4674
|
|
|
4609
4675
|
// src/tools/data.ts
|
|
4610
4676
|
var data_exports = {};
|
|
@@ -7427,6 +7493,7 @@ __export(units_exports, {
|
|
|
7427
7493
|
calculateMarginMarkup: () => calculateMarginMarkup,
|
|
7428
7494
|
calculatePercentageChange: () => calculatePercentageChange,
|
|
7429
7495
|
calculateRuleOf72: () => calculateRuleOf72,
|
|
7496
|
+
calculateSavingsGoal: () => calculateSavingsGoal,
|
|
7430
7497
|
calculateSimpleInterest: () => calculateSimpleInterest,
|
|
7431
7498
|
calculateTax: () => calculateTax,
|
|
7432
7499
|
calculateTimeValue: () => calculateTimeValue,
|
|
@@ -9132,6 +9199,82 @@ function calculateEmi(principal, annualRatePercent, tenure, tenureUnit = "years"
|
|
|
9132
9199
|
yearlyBreakdown
|
|
9133
9200
|
};
|
|
9134
9201
|
}
|
|
9202
|
+
function calculateSavingsGoal(input) {
|
|
9203
|
+
const { mode, goalAmount, currentSavings, annualInterestRatePercent, monthlyContribution, months } = input;
|
|
9204
|
+
if (mode !== "time-to-goal" && mode !== "contribution-for-target") {
|
|
9205
|
+
return { error: "mode must be 'time-to-goal' or 'contribution-for-target'" };
|
|
9206
|
+
}
|
|
9207
|
+
if (!Number.isFinite(goalAmount) || goalAmount <= 0) return { error: "goalAmount must be a finite number greater than zero" };
|
|
9208
|
+
if (!Number.isFinite(currentSavings) || currentSavings < 0) return { error: "currentSavings must be a finite, non-negative number" };
|
|
9209
|
+
if (!Number.isFinite(annualInterestRatePercent) || annualInterestRatePercent < 0) {
|
|
9210
|
+
return { error: "annualInterestRatePercent must be a finite, non-negative number" };
|
|
9211
|
+
}
|
|
9212
|
+
const round4 = (n) => Math.round(n * 1e4) / 1e4;
|
|
9213
|
+
const r = annualInterestRatePercent / 100 / 12;
|
|
9214
|
+
if (mode === "time-to-goal") {
|
|
9215
|
+
if (typeof monthlyContribution !== "number" || !Number.isFinite(monthlyContribution) || monthlyContribution < 0) {
|
|
9216
|
+
return { error: "monthlyContribution must be a finite, non-negative number" };
|
|
9217
|
+
}
|
|
9218
|
+
let exactMonths;
|
|
9219
|
+
if (currentSavings >= goalAmount) {
|
|
9220
|
+
exactMonths = 0;
|
|
9221
|
+
} else if (monthlyContribution === 0) {
|
|
9222
|
+
if (r === 0) return { error: "monthlyContribution must be greater than zero when annualInterestRatePercent is zero, since savings would never grow toward the goal" };
|
|
9223
|
+
if (currentSavings <= 0) return { error: "monthlyContribution must be greater than zero when currentSavings is zero, since there is nothing to compound" };
|
|
9224
|
+
exactMonths = Math.log(goalAmount / currentSavings) / Math.log(1 + r);
|
|
9225
|
+
} else if (r === 0) {
|
|
9226
|
+
exactMonths = (goalAmount - currentSavings) / monthlyContribution;
|
|
9227
|
+
} else {
|
|
9228
|
+
const denom = currentSavings + monthlyContribution / r;
|
|
9229
|
+
const x = (goalAmount + monthlyContribution / r) / denom;
|
|
9230
|
+
exactMonths = Math.log(x) / Math.log(1 + r);
|
|
9231
|
+
}
|
|
9232
|
+
const monthsRounded = Math.max(0, Math.ceil(exactMonths));
|
|
9233
|
+
const finalBalance = r === 0 ? currentSavings + monthlyContribution * monthsRounded : currentSavings * Math.pow(1 + r, monthsRounded) + monthlyContribution * ((Math.pow(1 + r, monthsRounded) - 1) / r);
|
|
9234
|
+
const totalContributed2 = monthlyContribution * monthsRounded;
|
|
9235
|
+
const totalInterestEarned2 = finalBalance - currentSavings - totalContributed2;
|
|
9236
|
+
return {
|
|
9237
|
+
mode,
|
|
9238
|
+
goalAmount: round4(goalAmount),
|
|
9239
|
+
currentSavings: round4(currentSavings),
|
|
9240
|
+
annualInterestRatePercent: round4(annualInterestRatePercent),
|
|
9241
|
+
monthlyContribution: round4(monthlyContribution),
|
|
9242
|
+
months: round4(exactMonths),
|
|
9243
|
+
monthsRounded,
|
|
9244
|
+
years: round4(monthsRounded / 12),
|
|
9245
|
+
totalContributed: round4(totalContributed2),
|
|
9246
|
+
totalInterestEarned: round4(totalInterestEarned2),
|
|
9247
|
+
finalBalance: round4(finalBalance)
|
|
9248
|
+
};
|
|
9249
|
+
}
|
|
9250
|
+
if (typeof months !== "number" || !Number.isFinite(months) || !Number.isInteger(months) || months <= 0) {
|
|
9251
|
+
return { error: "months must be a positive integer" };
|
|
9252
|
+
}
|
|
9253
|
+
const growthOfCurrentSavings = r === 0 ? currentSavings : currentSavings * Math.pow(1 + r, months);
|
|
9254
|
+
let requiredMonthlyContribution;
|
|
9255
|
+
if (growthOfCurrentSavings >= goalAmount) {
|
|
9256
|
+
requiredMonthlyContribution = 0;
|
|
9257
|
+
} else if (r === 0) {
|
|
9258
|
+
requiredMonthlyContribution = (goalAmount - currentSavings) / months;
|
|
9259
|
+
} else {
|
|
9260
|
+
requiredMonthlyContribution = (goalAmount - growthOfCurrentSavings) * r / (Math.pow(1 + r, months) - 1);
|
|
9261
|
+
}
|
|
9262
|
+
const totalContributed = requiredMonthlyContribution * months;
|
|
9263
|
+
const totalInterestEarned = goalAmount - currentSavings - totalContributed;
|
|
9264
|
+
return {
|
|
9265
|
+
mode,
|
|
9266
|
+
goalAmount: round4(goalAmount),
|
|
9267
|
+
currentSavings: round4(currentSavings),
|
|
9268
|
+
annualInterestRatePercent: round4(annualInterestRatePercent),
|
|
9269
|
+
monthlyContribution: round4(requiredMonthlyContribution),
|
|
9270
|
+
months,
|
|
9271
|
+
monthsRounded: months,
|
|
9272
|
+
years: round4(months / 12),
|
|
9273
|
+
totalContributed: round4(totalContributed),
|
|
9274
|
+
totalInterestEarned: round4(totalInterestEarned),
|
|
9275
|
+
finalBalance: round4(goalAmount)
|
|
9276
|
+
};
|
|
9277
|
+
}
|
|
9135
9278
|
|
|
9136
9279
|
// src/tools/network.ts
|
|
9137
9280
|
var network_exports = {};
|
|
@@ -12350,6 +12493,7 @@ var code_exports = {};
|
|
|
12350
12493
|
__export(code_exports, {
|
|
12351
12494
|
ALL_FLAGS: () => ALL_FLAGS,
|
|
12352
12495
|
CHEATSHEET: () => CHEATSHEET,
|
|
12496
|
+
DEFAULT_COMMIT_TYPES: () => DEFAULT_COMMIT_TYPES,
|
|
12353
12497
|
MIME_TABLE: () => MIME_TABLE,
|
|
12354
12498
|
OPERATIONS: () => OPERATIONS,
|
|
12355
12499
|
SQL_DEFAULT_OPTIONS: () => SQL_DEFAULT_OPTIONS,
|
|
@@ -12374,6 +12518,7 @@ __export(code_exports, {
|
|
|
12374
12518
|
getJsStats: () => getJsStats,
|
|
12375
12519
|
getMethodColor: () => getMethodColor,
|
|
12376
12520
|
isValidTag: () => isValidTag,
|
|
12521
|
+
lintConventionalCommit: () => lintConventionalCommit,
|
|
12377
12522
|
lookupMime: () => lookupMime,
|
|
12378
12523
|
minifyCss: () => minifyCss,
|
|
12379
12524
|
minifyGql: () => minifyGql,
|
|
@@ -15084,6 +15229,124 @@ function detectRedos(pattern) {
|
|
|
15084
15229
|
findings: unique
|
|
15085
15230
|
};
|
|
15086
15231
|
}
|
|
15232
|
+
var DEFAULT_COMMIT_TYPES = ["build", "chore", "ci", "docs", "feat", "fix", "perf", "refactor", "revert", "style", "test"];
|
|
15233
|
+
var _DEFAULT_MAX_HEADER_LENGTH = 100;
|
|
15234
|
+
var _COMMIT_HEADER_RE = /^([A-Za-z][A-Za-z0-9-]*)(\(([^()]*)\))?(!)?: (.+)$/;
|
|
15235
|
+
var _COMMIT_FOOTER_LINE_RE = /^([A-Za-z][A-Za-z0-9-]*|BREAKING CHANGE)(: ?| #)(.*)$/;
|
|
15236
|
+
var _COMMIT_BREAKING_LOOKALIKE_RE = /^([A-Za-z][A-Za-z -]*?)(: | #)(.*)$/;
|
|
15237
|
+
var _COMMIT_BREAKING_TOKEN_RE = /^breaking[- ]change$/i;
|
|
15238
|
+
function lintConventionalCommit(message, options = {}) {
|
|
15239
|
+
if (typeof message !== "string" || message.trim() === "") {
|
|
15240
|
+
return { error: "message is required" };
|
|
15241
|
+
}
|
|
15242
|
+
if (message.length > 2e4) {
|
|
15243
|
+
return { error: "message too long (max 20,000 chars)" };
|
|
15244
|
+
}
|
|
15245
|
+
const types = options.types && options.types.length > 0 ? options.types : DEFAULT_COMMIT_TYPES;
|
|
15246
|
+
const maxHeaderLength = options.maxHeaderLength ?? _DEFAULT_MAX_HEADER_LENGTH;
|
|
15247
|
+
const findings = [];
|
|
15248
|
+
const lines = message.replace(/\r\n/g, "\n").split("\n");
|
|
15249
|
+
const header = lines[0];
|
|
15250
|
+
const match = header.match(_COMMIT_HEADER_RE);
|
|
15251
|
+
const parsed = {
|
|
15252
|
+
header,
|
|
15253
|
+
type: null,
|
|
15254
|
+
scope: null,
|
|
15255
|
+
breaking: false,
|
|
15256
|
+
description: null,
|
|
15257
|
+
body: null,
|
|
15258
|
+
footers: []
|
|
15259
|
+
};
|
|
15260
|
+
if (!match) {
|
|
15261
|
+
findings.push({
|
|
15262
|
+
rule: "header-format",
|
|
15263
|
+
severity: "error",
|
|
15264
|
+
message: "Header must match '<type>[(scope)][!]: <description>', e.g. 'feat(auth): add OAuth2 login'. A single space must follow the colon."
|
|
15265
|
+
});
|
|
15266
|
+
return { message, valid: false, parsed, findings };
|
|
15267
|
+
}
|
|
15268
|
+
const [, type, scopeGroup, scope, bang, description] = match;
|
|
15269
|
+
parsed.type = type;
|
|
15270
|
+
if (scopeGroup !== void 0) {
|
|
15271
|
+
const scopeContent = (scope ?? "").trim();
|
|
15272
|
+
if (scopeContent === "") {
|
|
15273
|
+
findings.push({ rule: "scope-empty", severity: "error", message: "Scope parentheses are present but empty; either remove the parentheses or put a scope inside them, e.g. fix(parser):." });
|
|
15274
|
+
} else {
|
|
15275
|
+
parsed.scope = scopeContent;
|
|
15276
|
+
}
|
|
15277
|
+
}
|
|
15278
|
+
const trimmedDescription = description.trim();
|
|
15279
|
+
if (trimmedDescription === "") {
|
|
15280
|
+
findings.push({ rule: "subject-empty", severity: "error", message: "The description after the colon must not be empty." });
|
|
15281
|
+
} else {
|
|
15282
|
+
parsed.description = trimmedDescription;
|
|
15283
|
+
if (trimmedDescription.endsWith(".")) {
|
|
15284
|
+
findings.push({ rule: "subject-full-stop", severity: "warning", message: "The description should not end with a period." });
|
|
15285
|
+
}
|
|
15286
|
+
}
|
|
15287
|
+
if (!types.includes(type.toLowerCase())) {
|
|
15288
|
+
findings.push({
|
|
15289
|
+
rule: "type-unknown",
|
|
15290
|
+
severity: "warning",
|
|
15291
|
+
message: `'${type}' is not one of the recognized types (${types.join(", ")}). This is only a convention, not a spec requirement, so a custom type is fine if your team has agreed on it.`
|
|
15292
|
+
});
|
|
15293
|
+
}
|
|
15294
|
+
if (type !== type.toLowerCase()) {
|
|
15295
|
+
findings.push({ rule: "type-case", severity: "warning", message: "The type is conventionally lower-case. The spec itself is not case-sensitive about this, but nearly every tool and team defaults to lower-case." });
|
|
15296
|
+
}
|
|
15297
|
+
if (header.length > maxHeaderLength) {
|
|
15298
|
+
findings.push({ rule: "header-max-length", severity: "warning", message: `Header is ${header.length} characters, longer than the recommended maximum of ${maxHeaderLength}.` });
|
|
15299
|
+
}
|
|
15300
|
+
let breaking = bang === "!";
|
|
15301
|
+
if (lines.length > 1) {
|
|
15302
|
+
if (lines[1].trim() !== "") {
|
|
15303
|
+
findings.push({ rule: "missing-blank-line-before-body", severity: "error", message: "A blank line must separate the header from the body or footer." });
|
|
15304
|
+
}
|
|
15305
|
+
const rest = lines.slice(1).join("\n");
|
|
15306
|
+
const paragraphs = rest.split(/\n{2,}/).map((p) => p.trim()).filter((p) => p !== "");
|
|
15307
|
+
let footerParagraph = null;
|
|
15308
|
+
if (paragraphs.length > 0) {
|
|
15309
|
+
const last = paragraphs[paragraphs.length - 1];
|
|
15310
|
+
const lastLines = last.split("\n");
|
|
15311
|
+
if (lastLines.every((l) => _COMMIT_FOOTER_LINE_RE.test(l.trim()))) {
|
|
15312
|
+
footerParagraph = last;
|
|
15313
|
+
paragraphs.pop();
|
|
15314
|
+
}
|
|
15315
|
+
}
|
|
15316
|
+
parsed.body = paragraphs.length > 0 ? paragraphs.join("\n\n") : null;
|
|
15317
|
+
if (footerParagraph) {
|
|
15318
|
+
for (const line of footerParagraph.split("\n")) {
|
|
15319
|
+
const fm = line.trim().match(_COMMIT_FOOTER_LINE_RE);
|
|
15320
|
+
if (!fm) continue;
|
|
15321
|
+
const [, token, , value] = fm;
|
|
15322
|
+
parsed.footers.push({ token, value: value.trim() });
|
|
15323
|
+
}
|
|
15324
|
+
}
|
|
15325
|
+
for (const f of parsed.footers) {
|
|
15326
|
+
if (_COMMIT_BREAKING_TOKEN_RE.test(f.token) && f.token !== "BREAKING CHANGE" && f.token !== "BREAKING-CHANGE") {
|
|
15327
|
+
findings.push({ rule: "breaking-change-casing", severity: "error", message: `Found '${f.token}:' as a footer, but the spec requires the breaking-change token to be exactly 'BREAKING CHANGE' or 'BREAKING-CHANGE' (uppercase).` });
|
|
15328
|
+
}
|
|
15329
|
+
}
|
|
15330
|
+
for (const p of paragraphs) {
|
|
15331
|
+
for (const line of p.split("\n")) {
|
|
15332
|
+
const bm = line.trim().match(_COMMIT_BREAKING_LOOKALIKE_RE);
|
|
15333
|
+
if (bm && _COMMIT_BREAKING_TOKEN_RE.test(bm[1]) && bm[1] !== "BREAKING CHANGE") {
|
|
15334
|
+
findings.push({ rule: "breaking-change-casing", severity: "error", message: `Found '${bm[1]}' near the end of the message, but it wasn't recognized as a breaking-change footer. The spec requires the exact uppercase token 'BREAKING CHANGE' (or 'BREAKING-CHANGE'), immediately followed by ': '.` });
|
|
15335
|
+
}
|
|
15336
|
+
}
|
|
15337
|
+
}
|
|
15338
|
+
}
|
|
15339
|
+
const breakingFooter = parsed.footers.find((f) => f.token === "BREAKING CHANGE" || f.token === "BREAKING-CHANGE");
|
|
15340
|
+
if (breakingFooter) {
|
|
15341
|
+
breaking = true;
|
|
15342
|
+
if (breakingFooter.value === "") {
|
|
15343
|
+
findings.push({ rule: "breaking-change-empty", severity: "error", message: "A 'BREAKING CHANGE:' footer must be followed by a description of the breaking change." });
|
|
15344
|
+
}
|
|
15345
|
+
}
|
|
15346
|
+
parsed.breaking = breaking;
|
|
15347
|
+
const valid = !findings.some((f) => f.severity === "error");
|
|
15348
|
+
return { message, valid, parsed, findings };
|
|
15349
|
+
}
|
|
15087
15350
|
|
|
15088
15351
|
// src/tools/color.ts
|
|
15089
15352
|
var color_exports = {};
|
|
@@ -18686,6 +18949,7 @@ __export(ai_agent_exports, {
|
|
|
18686
18949
|
extractTables: () => extractTables,
|
|
18687
18950
|
extractUrls: () => extractUrls,
|
|
18688
18951
|
flattenJson: () => flattenJson,
|
|
18952
|
+
formatFewShotExamples: () => formatFewShotExamples,
|
|
18689
18953
|
mergeJson: () => mergeJson,
|
|
18690
18954
|
redactPii: () => redactPii,
|
|
18691
18955
|
repairJson: () => repairJson,
|
|
@@ -19643,6 +19907,29 @@ function vectorSimilarity(a, b) {
|
|
|
19643
19907
|
magnitudeB: round6(magB)
|
|
19644
19908
|
};
|
|
19645
19909
|
}
|
|
19910
|
+
function formatFewShotExamples(examples, format = "numbered", delimiter = "---") {
|
|
19911
|
+
const valid = (examples ?? []).filter((e) => e?.input?.trim() && e?.output?.trim());
|
|
19912
|
+
if (valid.length === 0) {
|
|
19913
|
+
return { formatted: "", exampleCount: 0, format };
|
|
19914
|
+
}
|
|
19915
|
+
let formatted;
|
|
19916
|
+
if (format === "xml") {
|
|
19917
|
+
formatted = valid.map((e) => `<example>
|
|
19918
|
+
<input>${e.input.trim()}</input>
|
|
19919
|
+
<output>${e.output.trim()}</output>
|
|
19920
|
+
</example>`).join("\n\n");
|
|
19921
|
+
} else if (format === "delimiter") {
|
|
19922
|
+
formatted = valid.map((e) => `Input: ${e.input.trim()}
|
|
19923
|
+
Output: ${e.output.trim()}`).join(`
|
|
19924
|
+
${delimiter}
|
|
19925
|
+
`);
|
|
19926
|
+
} else {
|
|
19927
|
+
formatted = valid.map((e, i) => `Example ${i + 1}:
|
|
19928
|
+
Input: ${e.input.trim()}
|
|
19929
|
+
Output: ${e.output.trim()}`).join("\n\n");
|
|
19930
|
+
}
|
|
19931
|
+
return { formatted, exampleCount: valid.length, format };
|
|
19932
|
+
}
|
|
19646
19933
|
|
|
19647
19934
|
// src/tools/media.ts
|
|
19648
19935
|
var media_exports = {};
|
package/dist/index.d.cts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.cjs';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.cjs';
|
|
3
3
|
export { h as hashing } from './hashing-CnetQFD_.cjs';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-CA-zuD0C.cjs';
|
|
5
5
|
export { d as data } from './data-C4lCByXw.cjs';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.cjs';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.cjs';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-BhoxdHhs.cjs';
|
|
9
9
|
export { n as network } from './network-D7Epuerc.cjs';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.cjs';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-BK-x8hVx.cjs';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.cjs';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.cjs';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.cjs';
|
|
15
|
-
export { a as ai_agent } from './ai_agent-
|
|
15
|
+
export { a as ai_agent } from './ai_agent-C1zudGgT.cjs';
|
|
16
16
|
export { m as media } from './media-fD8dJ5qR.cjs';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
package/dist/index.d.ts
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
export { j as json } from './json-Ta9JykSB.js';
|
|
2
2
|
export { e as encoding } from './encoding-Dk3wpmb3.js';
|
|
3
3
|
export { h as hashing } from './hashing-CnetQFD_.js';
|
|
4
|
-
export { t as text } from './text-
|
|
4
|
+
export { t as text } from './text-CA-zuD0C.js';
|
|
5
5
|
export { d as data } from './data-C4lCByXw.js';
|
|
6
6
|
export { g as generators } from './generators-Du8cBesn.js';
|
|
7
7
|
export { t as time } from './time-KqJjdqII.js';
|
|
8
|
-
export { u as units } from './units-
|
|
8
|
+
export { u as units } from './units-BhoxdHhs.js';
|
|
9
9
|
export { n as network } from './network-D7Epuerc.js';
|
|
10
10
|
export { a as api } from './api-DmTNE4c1.js';
|
|
11
|
-
export { c as code } from './code-
|
|
11
|
+
export { c as code } from './code-BK-x8hVx.js';
|
|
12
12
|
export { c as color } from './color-tPwZCr9H.js';
|
|
13
13
|
export { c as css } from './css-Cf7AMGM-.js';
|
|
14
14
|
export { m as misc } from './misc-CA3N198T.js';
|
|
15
|
-
export { a as ai_agent } from './ai_agent-
|
|
15
|
+
export { a as ai_agent } from './ai_agent-C1zudGgT.js';
|
|
16
16
|
export { m as media } from './media-fD8dJ5qR.js';
|
|
17
17
|
|
|
18
18
|
declare const version = "0.1.0";
|
package/dist/index.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
export { media_exports as media } from './chunk-L6V4W4SU.js';
|
|
2
|
-
export { units_exports as units } from './chunk-
|
|
2
|
+
export { units_exports as units } from './chunk-ZPQOE7KD.js';
|
|
3
3
|
export { network_exports as network } from './chunk-CSNTHZHF.js';
|
|
4
4
|
export { api_exports as api } from './chunk-52ZDKSIX.js';
|
|
5
|
-
export { code_exports as code } from './chunk-
|
|
5
|
+
export { code_exports as code } from './chunk-UUT5HNST.js';
|
|
6
6
|
export { color_exports as color } from './chunk-BPVAB4P2.js';
|
|
7
7
|
export { css_exports as css } from './chunk-6YPV2AB5.js';
|
|
8
8
|
export { misc_exports as misc } from './chunk-GX7H6TAX.js';
|
|
9
|
-
export { ai_agent_exports as ai_agent } from './chunk-
|
|
9
|
+
export { ai_agent_exports as ai_agent } from './chunk-W3J7GZVQ.js';
|
|
10
10
|
export { json_exports as json } from './chunk-WVEKRKGU.js';
|
|
11
11
|
export { encoding_exports as encoding } from './chunk-DOWQZUTP.js';
|
|
12
12
|
export { hashing_exports as hashing } from './chunk-GEFVMGZR.js';
|
|
13
|
-
export { text_exports as text } from './chunk-
|
|
13
|
+
export { text_exports as text } from './chunk-H2USEUHD.js';
|
|
14
14
|
export { data_exports as data } from './chunk-6FIB72KX.js';
|
|
15
15
|
export { generators_exports as generators } from './chunk-3TYWIX3B.js';
|
|
16
16
|
export { time_exports as time } from './chunk-IEPWZERQ.js';
|