@liuhange/dsh-data-asset-inventory-scan 3.0.0 → 3.1.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.
Files changed (2) hide show
  1. package/lib/index.js +5 -7
  2. package/package.json +22 -6
package/lib/index.js CHANGED
@@ -1,5 +1,6 @@
1
1
  import { ScanExecutor } from './scanExecutor.js';
2
2
  import { validateScanArgs } from './invariant.js';
3
+ import { loadJsonConfig } from '@liuhange/dsh-data-asset-shared';
3
4
  export const name = '@liuhange/dsh-data-asset-inventory-scan';
4
5
  export const inject = ['tools'];
5
6
  export function apply(ctx) {
@@ -20,9 +21,7 @@ export function apply(ctx) {
20
21
  const validated = validateScanArgs(args);
21
22
  let rulesConfig;
22
23
  try {
23
- const rulesPath = process.env.BUSINESS_RULES_PATH || 'config/business-rules.json';
24
- const { readFileSync } = await import('node:fs');
25
- rulesConfig = JSON.parse(readFileSync(rulesPath, 'utf-8'));
24
+ rulesConfig = loadJsonConfig('BUSINESS_RULES_PATH', 'config/business-rules.json', '@liuhange/dsh-data-asset-shared/config/business-rules.json');
26
25
  }
27
26
  catch {
28
27
  return JSON.stringify({ error: 'SCAN_RULES_MISSING', message: '无法加载business-rules.json' });
@@ -33,10 +32,9 @@ export function apply(ctx) {
33
32
  }
34
33
  let policyDocuments;
35
34
  try {
36
- const policyPath = process.env.POLICY_REFS_PATH || 'config/policy-references.json';
37
- const { readFileSync } = await import('node:fs');
38
- const policyConfig = JSON.parse(readFileSync(policyPath, 'utf-8'));
39
- const stage = policyConfig.policyReferences?.find((s) => s.stage === 'INVENTORY_SCAN');
35
+ const policyConfig = loadJsonConfig('POLICY_REFS_PATH', 'config/policy-references.json', '@liuhange/dsh-data-asset-shared/config/policy-references.json');
36
+ const refs = policyConfig.policyReferences;
37
+ const stage = refs?.find(s => s.stage === 'INVENTORY_SCAN');
40
38
  policyDocuments = stage?.documents ?? [];
41
39
  }
42
40
  catch {
package/package.json CHANGED
@@ -1,18 +1,30 @@
1
1
  {
2
2
  "name": "@liuhange/dsh-data-asset-inventory-scan",
3
3
  "description": "Data asset inventory scan plugin: deep metadata scan + triple condition screening + ownership clue annotation",
4
- "version": "3.0.0",
5
- "publishConfig": { "access": "public" },
6
- "repository": { "type": "git", "url": "git+https://github.com/liuhange789/data-asset-inspector.git", "directory": "packages/data-asset/data-asset-inventory-scan" },
4
+ "version": "3.1.1",
5
+ "publishConfig": {
6
+ "access": "public"
7
+ },
8
+ "repository": {
9
+ "type": "git",
10
+ "url": "git+https://github.com/liuhange789/data-asset-inspector.git",
11
+ "directory": "packages/data-asset/data-asset-inventory-scan"
12
+ },
7
13
  "type": "module",
8
14
  "main": "lib/index.js",
9
15
  "types": "lib/types/index.d.ts",
10
16
  "exports": {
11
- ".": { "types": "./lib/types/index.d.ts", "default": "./lib/index.js" },
17
+ ".": {
18
+ "types": "./lib/types/index.d.ts",
19
+ "default": "./lib/index.js"
20
+ },
12
21
  "./src/*": "./src/*",
13
22
  "./package.json": "./package.json"
14
23
  },
15
- "files": ["lib/**/*.js", "lib/types/**/*.d.ts"],
24
+ "files": [
25
+ "lib/**/*.js",
26
+ "lib/types/**/*.d.ts"
27
+ ],
16
28
  "license": "MIT",
17
29
  "scripts": {
18
30
  "typecheck": "tsc --noEmit",
@@ -24,5 +36,9 @@
24
36
  "@deepseek-ai/dsh-tools": "0.0.1-rc.1",
25
37
  "@liuhange/dsh-data-asset-shared": "^3.0.0"
26
38
  },
27
- "dsh": { "bundle": { "patch": true } }
39
+ "dsh": {
40
+ "bundle": {
41
+ "patch": true
42
+ }
43
+ }
28
44
  }