@webpieces/code-rules 0.3.181 → 0.3.183

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@webpieces/code-rules",
3
- "version": "0.3.181",
3
+ "version": "0.3.183",
4
4
  "description": "Standalone code validation rules extracted from architecture-validators, no Nx dependency required",
5
5
  "type": "commonjs",
6
6
  "main": "./src/index.js",
@@ -20,7 +20,7 @@
20
20
  "directory": "packages/tooling/code-rules"
21
21
  },
22
22
  "dependencies": {
23
- "@webpieces/rules-config": "0.3.181"
23
+ "@webpieces/rules-config": "0.3.183"
24
24
  },
25
25
  "publishConfig": {
26
26
  "access": "public"
@@ -1,6 +1,2 @@
1
- export interface SkipRuleResult {
2
- skip: boolean;
3
- reason?: string;
4
- }
5
- export declare function getCurrentBranch(): string;
6
- export declare function shouldSkipRule(epoch: number | undefined, branchPattern: string | undefined): SkipRuleResult;
1
+ export { shouldSkipRule, getCurrentBranch } from '@webpieces/rules-config';
2
+ export type { SkipRuleResult } from '@webpieces/rules-config';
@@ -1,41 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCurrentBranch = getCurrentBranch;
4
- exports.shouldSkipRule = shouldSkipRule;
5
- const child_process_1 = require("child_process");
6
- const rules_config_1 = require("@webpieces/rules-config");
7
- function getCurrentBranch() {
8
- const envBranch = process.env['BRANCH_NAME'] ||
9
- process.env['GIT_BRANCH'] ||
10
- process.env['GITHUB_HEAD_REF'] ||
11
- process.env['GITHUB_REF_NAME'] ||
12
- process.env['CI_COMMIT_BRANCH'] ||
13
- process.env['CIRCLE_BRANCH'];
14
- if (envBranch)
15
- return envBranch;
16
- // webpieces-disable no-unmanaged-exceptions -- rethrow as InformAiError so global catch surfaces readable message to AI
17
- try {
18
- return (0, child_process_1.execSync)('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();
19
- }
20
- catch (err) {
21
- const error = (0, rules_config_1.toError)(err);
22
- throw new rules_config_1.InformAiError(`Failed to determine current git branch: ${error.message}`);
23
- }
24
- }
25
- function shouldSkipRule(epoch, branchPattern) {
26
- if (branchPattern) {
27
- const current = getCurrentBranch();
28
- if (current === branchPattern) {
29
- return { skip: true, reason: `on branch "${branchPattern}"` };
30
- }
31
- }
32
- if (epoch !== undefined) {
33
- const nowSeconds = Date.now() / 1000;
34
- if (nowSeconds < epoch) {
35
- const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];
36
- return { skip: true, reason: `ignoreModifiedUntilEpoch active, expires: ${expiresDate}` };
37
- }
38
- }
39
- return { skip: false };
40
- }
3
+ exports.getCurrentBranch = exports.shouldSkipRule = void 0;
4
+ // shouldSkipRule / getCurrentBranch / SkipRuleResult moved to @webpieces/rules-config
5
+ // so ai-hook-rules and the Nx executors share one implementation. Re-exported here
6
+ // for back-compat with the many code-rules validators that import from './resolve-mode'.
7
+ var rules_config_1 = require("@webpieces/rules-config");
8
+ Object.defineProperty(exports, "shouldSkipRule", { enumerable: true, get: function () { return rules_config_1.shouldSkipRule; } });
9
+ Object.defineProperty(exports, "getCurrentBranch", { enumerable: true, get: function () { return rules_config_1.getCurrentBranch; } });
41
10
  //# sourceMappingURL=resolve-mode.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"resolve-mode.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/resolve-mode.ts"],"names":[],"mappings":";;AASA,4CAgBC;AAED,wCAkBC;AA7CD,iDAAyC;AAEzC,0DAAiE;AAOjE,SAAgB,gBAAgB;IAC5B,MAAM,SAAS,GACX,OAAO,CAAC,GAAG,CAAC,aAAa,CAAC;QAC1B,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC;QACzB,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,iBAAiB,CAAC;QAC9B,OAAO,CAAC,GAAG,CAAC,kBAAkB,C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\nexport interface SkipRuleResult {\n skip: boolean;\n reason?: string;\n}\n\nexport function getCurrentBranch(): string {\n const envBranch =\n process.env['BRANCH_NAME'] ||\n process.env['GIT_BRANCH'] ||\n process.env['GITHUB_HEAD_REF'] ||\n process.env['GITHUB_REF_NAME'] ||\n process.env['CI_COMMIT_BRANCH'] ||\n process.env['CIRCLE_BRANCH'];\n if (envBranch) return envBranch;\n // webpieces-disable no-unmanaged-exceptions -- rethrow as InformAiError so global catch surfaces readable message to AI\n try {\n return execSync('git rev-parse --abbrev-ref HEAD', { encoding: 'utf8' }).trim();\n } catch (err: unknown) {\n const error = toError(err);\n throw new InformAiError(`Failed to determine current git branch: ${error.message}`);\n }\n}\n\nexport function shouldSkipRule(\n epoch: number | undefined,\n branchPattern: string | undefined\n): SkipRuleResult {\n if (branchPattern) {\n const current = getCurrentBranch();\n if (current === branchPattern) {\n return { skip: true, reason: `on branch \"${branchPattern}\"` };\n }\n }\n if (epoch !== undefined) {\n const nowSeconds = Date.now() / 1000;\n if (nowSeconds < epoch) {\n const expiresDate = new Date(epoch * 1000).toISOString().split('T')[0];\n return { skip: true, reason: `ignoreModifiedUntilEpoch active, expires: ${expiresDate}` };\n }\n }\n return { skip: false };\n}\n"]}
1
+ {"version":3,"file":"resolve-mode.js","sourceRoot":"","sources":["../../../../../packages/tooling/code-rules/src/resolve-mode.ts"],"names":[],"mappings":";;;AAAA,sFAAsF;AACtF,mFAAmF;AACnF,yFAAyF;AACzF,wDAA2E;AAAlE,8GAAA,cAAc,OAAA;AAAE,gHAAA,gBAAgB,OAAA","sourcesContent":["// shouldSkipRule / getCurrentBranch / SkipRuleResult moved to @webpieces/rules-config\n// so ai-hook-rules and the Nx executors share one implementation. Re-exported here\n// for back-compat with the many code-rules validators that import from './resolve-mode'.\nexport { shouldSkipRule, getCurrentBranch } from '@webpieces/rules-config';\nexport type { SkipRuleResult } from '@webpieces/rules-config';\n"]}