@feiyoug/skill-lab 0.0.0 → 0.0.2
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/README.md +73 -0
- package/esm/analyzer/astgrep/client.d.ts +20 -8
- package/esm/analyzer/astgrep/client.d.ts.map +1 -1
- package/esm/analyzer/astgrep/client.js +58 -31
- package/esm/analyzer/config/default.d.ts +8 -0
- package/esm/analyzer/config/default.d.ts.map +1 -0
- package/esm/analyzer/config/default.js +91 -0
- package/esm/analyzer/config/helpers.d.ts +8 -0
- package/esm/analyzer/config/helpers.d.ts.map +1 -0
- package/esm/analyzer/config/helpers.js +72 -0
- package/esm/analyzer/config/mod.d.ts +4 -0
- package/esm/analyzer/config/mod.d.ts.map +1 -0
- package/esm/analyzer/config/mod.js +3 -0
- package/esm/analyzer/config/types.d.ts +58 -0
- package/esm/analyzer/config/types.d.ts.map +1 -0
- package/esm/analyzer/{config.js → config/types.js} +0 -28
- package/esm/analyzer/logging.d.ts +3 -0
- package/esm/analyzer/logging.d.ts.map +1 -0
- package/esm/analyzer/logging.js +6 -0
- package/esm/analyzer/mod.d.ts +12 -5
- package/esm/analyzer/mod.d.ts.map +1 -1
- package/esm/analyzer/mod.js +25 -12
- package/esm/analyzer/result.d.ts +35 -0
- package/esm/analyzer/result.d.ts.map +1 -0
- package/esm/analyzer/result.js +311 -0
- package/esm/analyzer/rules/bash/commands/mod.d.ts +1 -0
- package/esm/analyzer/rules/bash/commands/mod.d.ts.map +1 -1
- package/esm/analyzer/rules/bash/commands/mod.js +3 -0
- package/esm/analyzer/rules/bash/commands/pip.d.ts +3 -0
- package/esm/analyzer/rules/bash/commands/pip.d.ts.map +1 -0
- package/esm/analyzer/rules/bash/commands/pip.js +14 -0
- package/esm/analyzer/rules/bash/extractFileRefs.d.ts +1 -1
- package/esm/analyzer/rules/bash/extractFileRefs.d.ts.map +1 -1
- package/esm/analyzer/rules/bash/extractFileRefs.js +2 -2
- package/esm/analyzer/rules/bash/inline-command-classifier.d.ts +1 -1
- package/esm/analyzer/rules/bash/inline-command-classifier.d.ts.map +1 -1
- package/esm/analyzer/rules/bash/inline-command-classifier.js +4 -4
- package/esm/analyzer/rules/javascript/extractFileRefs.d.ts +3 -4
- package/esm/analyzer/rules/javascript/extractFileRefs.d.ts.map +1 -1
- package/esm/analyzer/rules/javascript/extractFileRefs.js +3 -4
- package/esm/analyzer/rules/markdown/extractCodeBlocks.d.ts.map +1 -1
- package/esm/analyzer/rules/markdown/extractCodeBlocks.js +6 -3
- package/esm/analyzer/rules/markdown/extractFileRefs.d.ts.map +1 -1
- package/esm/analyzer/rules/markdown/extractFileRefs.js +2 -0
- package/esm/analyzer/rules/python/extractFileRefs.d.ts +1 -1
- package/esm/analyzer/rules/python/extractFileRefs.d.ts.map +1 -1
- package/esm/analyzer/rules/python/extractFileRefs.js +2 -2
- package/esm/analyzer/steps/001-discovery/discover-files.d.ts +4 -0
- package/esm/analyzer/steps/001-discovery/discover-files.d.ts.map +1 -1
- package/esm/analyzer/steps/001-discovery/discover-files.js +18 -2
- package/esm/analyzer/steps/001-discovery/mod.d.ts.map +1 -1
- package/esm/analyzer/steps/001-discovery/mod.js +39 -9
- package/esm/analyzer/steps/002-permissions/mod.d.ts.map +1 -1
- package/esm/analyzer/steps/002-permissions/mod.js +156 -73
- package/esm/analyzer/steps/002-permissions/scan-file.d.ts +1 -1
- package/esm/analyzer/steps/002-permissions/scan-file.d.ts.map +1 -1
- package/esm/analyzer/steps/002-permissions/scan-file.js +40 -5
- package/esm/analyzer/steps/002-permissions/seed-frontmatter.js +2 -2
- package/esm/analyzer/steps/003-risks/dep-risks.d.ts +3 -0
- package/esm/analyzer/steps/003-risks/dep-risks.d.ts.map +1 -0
- package/esm/analyzer/steps/003-risks/dep-risks.js +74 -0
- package/esm/analyzer/steps/003-risks/helpers.d.ts +1 -0
- package/esm/analyzer/steps/003-risks/helpers.d.ts.map +1 -1
- package/esm/analyzer/steps/003-risks/helpers.js +1 -0
- package/esm/analyzer/steps/003-risks/mod.d.ts +3 -2
- package/esm/analyzer/steps/003-risks/mod.d.ts.map +1 -1
- package/esm/analyzer/steps/003-risks/mod.js +41 -4
- package/esm/analyzer/steps/003-risks/policy.d.ts +7 -0
- package/esm/analyzer/steps/003-risks/policy.d.ts.map +1 -0
- package/esm/analyzer/steps/003-risks/policy.js +23 -0
- package/esm/analyzer/steps/003-risks/rule-mapped.d.ts +2 -2
- package/esm/analyzer/steps/003-risks/rule-mapped.d.ts.map +1 -1
- package/esm/analyzer/steps/003-risks/rule-mapped.js +83 -2
- package/esm/analyzer/steps/003-risks/scoring.d.ts +9 -1
- package/esm/analyzer/steps/003-risks/scoring.d.ts.map +1 -1
- package/esm/analyzer/steps/003-risks/scoring.js +55 -42
- package/esm/analyzer/treesitter/client.d.ts +31 -0
- package/esm/analyzer/treesitter/client.d.ts.map +1 -0
- package/esm/analyzer/{treesiter → treesitter}/client.js +43 -39
- package/esm/analyzer/treesitter/registry.d.ts +73 -0
- package/esm/analyzer/treesitter/registry.d.ts.map +1 -0
- package/esm/analyzer/treesitter/registry.js +165 -0
- package/esm/analyzer/types.d.ts +14 -28
- package/esm/analyzer/types.d.ts.map +1 -1
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts +3 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts.map +1 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/deps.js +3 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts +93 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts.map +1 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/mod.js +297 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts +84 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts.map +1 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/multi.js +268 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts +18 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts.map +1 -0
- package/esm/deps/jsr.io/@deno-library/progress/1.5.1/time.js +45 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts +700 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/fmt/1.0.3/colors.js +903 -0
- package/esm/deps/jsr.io/@std/io/0.225.0/types.d.ts +146 -0
- package/esm/deps/jsr.io/@std/io/0.225.0/types.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.0/types.js +15 -0
- package/esm/deps/jsr.io/@std/io/0.225.0/write_all.d.ts +51 -0
- package/esm/deps/jsr.io/@std/io/0.225.0/write_all.d.ts.map +1 -0
- package/esm/deps/jsr.io/@std/io/0.225.0/write_all.js +61 -0
- package/esm/shared/deep_merge.d.ts +12 -0
- package/esm/shared/deep_merge.d.ts.map +1 -0
- package/esm/shared/deep_merge.js +49 -0
- package/esm/shared/mod.d.ts +1 -0
- package/esm/shared/mod.d.ts.map +1 -1
- package/esm/shared/mod.js +1 -0
- package/esm/shared/types/filetypes.d.ts +2 -2
- package/esm/shared/types/filetypes.d.ts.map +1 -1
- package/esm/shared/types/permissions.d.ts +1 -1
- package/esm/shared/types/permissions.d.ts.map +1 -1
- package/esm/shared/types/risks.d.ts +4 -1
- package/esm/shared/types/risks.d.ts.map +1 -1
- package/esm/skillreader/types.d.ts +2 -2
- package/esm/skillreader/types.d.ts.map +1 -1
- package/esm/skillreader/types.js +2 -2
- package/package.json +1 -1
- package/script/analyzer/astgrep/client.d.ts +20 -8
- package/script/analyzer/astgrep/client.d.ts.map +1 -1
- package/script/analyzer/astgrep/client.js +58 -64
- package/script/analyzer/config/default.d.ts +8 -0
- package/script/analyzer/config/default.d.ts.map +1 -0
- package/script/analyzer/config/default.js +94 -0
- package/script/analyzer/config/helpers.d.ts +8 -0
- package/script/analyzer/config/helpers.d.ts.map +1 -0
- package/script/analyzer/config/helpers.js +76 -0
- package/script/analyzer/config/mod.d.ts +4 -0
- package/script/analyzer/config/mod.d.ts.map +1 -0
- package/script/analyzer/config/mod.js +21 -0
- package/script/analyzer/config/types.d.ts +58 -0
- package/script/analyzer/config/types.d.ts.map +1 -0
- package/script/analyzer/{config.js → config/types.js} +1 -29
- package/script/analyzer/logging.d.ts +3 -0
- package/script/analyzer/logging.d.ts.map +1 -0
- package/script/analyzer/logging.js +9 -0
- package/script/analyzer/mod.d.ts +12 -5
- package/script/analyzer/mod.d.ts.map +1 -1
- package/script/analyzer/mod.js +35 -20
- package/script/analyzer/result.d.ts +35 -0
- package/script/analyzer/result.d.ts.map +1 -0
- package/script/analyzer/result.js +315 -0
- package/script/analyzer/rules/bash/commands/mod.d.ts +1 -0
- package/script/analyzer/rules/bash/commands/mod.d.ts.map +1 -1
- package/script/analyzer/rules/bash/commands/mod.js +3 -0
- package/script/analyzer/rules/bash/commands/pip.d.ts +3 -0
- package/script/analyzer/rules/bash/commands/pip.d.ts.map +1 -0
- package/script/analyzer/rules/bash/commands/pip.js +17 -0
- package/script/analyzer/rules/bash/extractFileRefs.d.ts +1 -1
- package/script/analyzer/rules/bash/extractFileRefs.d.ts.map +1 -1
- package/script/analyzer/rules/bash/extractFileRefs.js +2 -2
- package/script/analyzer/rules/bash/inline-command-classifier.d.ts +1 -1
- package/script/analyzer/rules/bash/inline-command-classifier.d.ts.map +1 -1
- package/script/analyzer/rules/bash/inline-command-classifier.js +4 -4
- package/script/analyzer/rules/javascript/extractFileRefs.d.ts +3 -4
- package/script/analyzer/rules/javascript/extractFileRefs.d.ts.map +1 -1
- package/script/analyzer/rules/javascript/extractFileRefs.js +3 -4
- package/script/analyzer/rules/markdown/extractCodeBlocks.d.ts.map +1 -1
- package/script/analyzer/rules/markdown/extractCodeBlocks.js +6 -3
- package/script/analyzer/rules/markdown/extractFileRefs.d.ts.map +1 -1
- package/script/analyzer/rules/markdown/extractFileRefs.js +2 -0
- package/script/analyzer/rules/python/extractFileRefs.d.ts +1 -1
- package/script/analyzer/rules/python/extractFileRefs.d.ts.map +1 -1
- package/script/analyzer/rules/python/extractFileRefs.js +2 -2
- package/script/analyzer/steps/001-discovery/discover-files.d.ts +4 -0
- package/script/analyzer/steps/001-discovery/discover-files.d.ts.map +1 -1
- package/script/analyzer/steps/001-discovery/discover-files.js +18 -2
- package/script/analyzer/steps/001-discovery/mod.d.ts.map +1 -1
- package/script/analyzer/steps/001-discovery/mod.js +77 -11
- package/script/analyzer/steps/002-permissions/mod.d.ts.map +1 -1
- package/script/analyzer/steps/002-permissions/mod.js +194 -75
- package/script/analyzer/steps/002-permissions/scan-file.d.ts +1 -1
- package/script/analyzer/steps/002-permissions/scan-file.d.ts.map +1 -1
- package/script/analyzer/steps/002-permissions/scan-file.js +40 -5
- package/script/analyzer/steps/002-permissions/seed-frontmatter.js +3 -3
- package/script/analyzer/steps/003-risks/dep-risks.d.ts +3 -0
- package/script/analyzer/steps/003-risks/dep-risks.d.ts.map +1 -0
- package/script/analyzer/steps/003-risks/dep-risks.js +77 -0
- package/script/analyzer/steps/003-risks/helpers.d.ts +1 -0
- package/script/analyzer/steps/003-risks/helpers.d.ts.map +1 -1
- package/script/analyzer/steps/003-risks/helpers.js +1 -0
- package/script/analyzer/steps/003-risks/mod.d.ts +3 -2
- package/script/analyzer/steps/003-risks/mod.d.ts.map +1 -1
- package/script/analyzer/steps/003-risks/mod.js +77 -4
- package/script/analyzer/steps/003-risks/policy.d.ts +7 -0
- package/script/analyzer/steps/003-risks/policy.d.ts.map +1 -0
- package/script/analyzer/steps/003-risks/policy.js +29 -0
- package/script/analyzer/steps/003-risks/rule-mapped.d.ts +2 -2
- package/script/analyzer/steps/003-risks/rule-mapped.d.ts.map +1 -1
- package/script/analyzer/steps/003-risks/rule-mapped.js +83 -2
- package/script/analyzer/steps/003-risks/scoring.d.ts +9 -1
- package/script/analyzer/steps/003-risks/scoring.d.ts.map +1 -1
- package/script/analyzer/steps/003-risks/scoring.js +55 -42
- package/script/analyzer/treesitter/client.d.ts +31 -0
- package/script/analyzer/treesitter/client.d.ts.map +1 -0
- package/script/analyzer/treesitter/client.js +136 -0
- package/script/analyzer/treesitter/registry.d.ts +73 -0
- package/script/analyzer/treesitter/registry.d.ts.map +1 -0
- package/script/analyzer/treesitter/registry.js +206 -0
- package/script/analyzer/types.d.ts +14 -28
- package/script/analyzer/types.d.ts.map +1 -1
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts +3 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/deps.d.ts.map +1 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/deps.js +10 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts +93 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/mod.d.ts.map +1 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/mod.js +334 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts +84 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/multi.d.ts.map +1 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/multi.js +305 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts +18 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/time.d.ts.map +1 -0
- package/script/deps/jsr.io/@deno-library/progress/1.5.1/time.js +48 -0
- package/script/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts +700 -0
- package/script/deps/jsr.io/@std/fmt/1.0.3/colors.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/fmt/1.0.3/colors.js +986 -0
- package/script/deps/jsr.io/@std/io/0.225.0/types.d.ts +146 -0
- package/script/deps/jsr.io/@std/io/0.225.0/types.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.0/types.js +18 -0
- package/script/deps/jsr.io/@std/io/0.225.0/write_all.d.ts +51 -0
- package/script/deps/jsr.io/@std/io/0.225.0/write_all.d.ts.map +1 -0
- package/script/deps/jsr.io/@std/io/0.225.0/write_all.js +65 -0
- package/script/shared/deep_merge.d.ts +12 -0
- package/script/shared/deep_merge.d.ts.map +1 -0
- package/script/shared/deep_merge.js +53 -0
- package/script/shared/mod.d.ts +1 -0
- package/script/shared/mod.d.ts.map +1 -1
- package/script/shared/mod.js +1 -0
- package/script/shared/types/filetypes.d.ts +2 -2
- package/script/shared/types/filetypes.d.ts.map +1 -1
- package/script/shared/types/permissions.d.ts +1 -1
- package/script/shared/types/permissions.d.ts.map +1 -1
- package/script/shared/types/risks.d.ts +4 -1
- package/script/shared/types/risks.d.ts.map +1 -1
- package/script/skillreader/types.d.ts +2 -2
- package/script/skillreader/types.d.ts.map +1 -1
- package/script/skillreader/types.js +2 -2
- package/src/_dnt.polyfills.ts +27 -0
- package/src/_dnt.shims.ts +64 -0
- package/src/analyzer/astgrep/client.ts +184 -0
- package/src/analyzer/astgrep/mod.ts +2 -0
- package/src/analyzer/config/default.ts +98 -0
- package/src/analyzer/config/helpers.ts +107 -0
- package/src/analyzer/config/mod.ts +3 -0
- package/src/analyzer/config/types.ts +103 -0
- package/src/analyzer/logging.ts +8 -0
- package/src/analyzer/mod.ts +118 -0
- package/src/analyzer/result.ts +393 -0
- package/src/analyzer/rules/bash/astTypes.ts +5 -0
- package/src/analyzer/rules/bash/commands/bd.ts +23 -0
- package/src/analyzer/rules/bash/commands/cron.ts +21 -0
- package/src/analyzer/rules/bash/commands/docker.ts +37 -0
- package/src/analyzer/rules/bash/commands/eval.ts +52 -0
- package/src/analyzer/rules/bash/commands/generic.ts +16 -0
- package/src/analyzer/rules/bash/commands/gh.ts +21 -0
- package/src/analyzer/rules/bash/commands/git.ts +28 -0
- package/src/analyzer/rules/bash/commands/mod.ts +38 -0
- package/src/analyzer/rules/bash/commands/node.ts +64 -0
- package/src/analyzer/rules/bash/commands/openspec.ts +16 -0
- package/src/analyzer/rules/bash/commands/pip.ts +16 -0
- package/src/analyzer/rules/bash/commands/sudo.ts +21 -0
- package/src/analyzer/rules/bash/destructive.ts +28 -0
- package/src/analyzer/rules/bash/extractFileRefs.ts +101 -0
- package/src/analyzer/rules/bash/filesystem.ts +50 -0
- package/src/analyzer/rules/bash/injection.ts +21 -0
- package/src/analyzer/rules/bash/inline-command-classifier.ts +94 -0
- package/src/analyzer/rules/bash/mod.ts +23 -0
- package/src/analyzer/rules/bash/network.ts +64 -0
- package/src/analyzer/rules/bash/secret-detection.ts +43 -0
- package/src/analyzer/rules/javascript/astTypes.ts +8 -0
- package/src/analyzer/rules/javascript/extractFileRefs.ts +131 -0
- package/src/analyzer/rules/javascript/filesystem.ts +28 -0
- package/src/analyzer/rules/javascript/injection.ts +21 -0
- package/src/analyzer/rules/javascript/mod.ts +26 -0
- package/src/analyzer/rules/javascript/network.ts +27 -0
- package/src/analyzer/rules/javascript/secret-detection.ts +68 -0
- package/src/analyzer/rules/javascript/subprocess.ts +16 -0
- package/src/analyzer/rules/markdown/astTypes.ts +35 -0
- package/src/analyzer/rules/markdown/extractCodeBlocks.ts +101 -0
- package/src/analyzer/rules/markdown/extractFileRefs.ts +179 -0
- package/src/analyzer/rules/markdown/mod.ts +12 -0
- package/src/analyzer/rules/mod.ts +77 -0
- package/src/analyzer/rules/python/astTypes.ts +9 -0
- package/src/analyzer/rules/python/extractFileRefs.ts +92 -0
- package/src/analyzer/rules/python/mod.ts +15 -0
- package/src/analyzer/rules/python/network.ts +26 -0
- package/src/analyzer/rules/python/secret-detection.ts +30 -0
- package/src/analyzer/rules/shared/file-refs.ts +38 -0
- package/src/analyzer/rules/shared/network-evaluators.ts +107 -0
- package/src/analyzer/rules/shared/prompt-injection.ts +48 -0
- package/src/analyzer/rules/shared/secret-evaluators.ts +13 -0
- package/src/analyzer/rules/text/mod.ts +12 -0
- package/src/analyzer/rules/typescript/mod.ts +7 -0
- package/src/analyzer/steps/001-discovery/discover-files.ts +211 -0
- package/src/analyzer/steps/001-discovery/filter-files.ts +72 -0
- package/src/analyzer/steps/001-discovery/mod.ts +103 -0
- package/src/analyzer/steps/002-permissions/mod.ts +329 -0
- package/src/analyzer/steps/002-permissions/scan-file.ts +258 -0
- package/src/analyzer/steps/002-permissions/seed-frontmatter.ts +66 -0
- package/src/analyzer/steps/002-permissions/synthesize.ts +42 -0
- package/src/analyzer/steps/003-risks/dep-risks.ts +89 -0
- package/src/analyzer/steps/003-risks/helpers.ts +41 -0
- package/src/analyzer/steps/003-risks/mod.ts +86 -0
- package/src/analyzer/steps/003-risks/policy.ts +38 -0
- package/src/analyzer/steps/003-risks/rule-mapped.ts +206 -0
- package/src/analyzer/steps/003-risks/scoring.ts +117 -0
- package/src/analyzer/steps/mod.ts +3 -0
- package/src/analyzer/treesitter/client.ts +120 -0
- package/src/analyzer/treesitter/registry.ts +198 -0
- package/src/analyzer/types.ts +78 -0
- package/src/analyzer/utils/code-block-path.ts +33 -0
- package/src/analyzer/utils/id-generator.ts +59 -0
- package/src/analyzer/utils/secret-validator.ts +29 -0
- package/src/analyzer/utils/url-parser.ts +25 -0
- package/src/deps/jsr.io/@deno-library/progress/1.5.1/deps.ts +3 -0
- package/src/deps/jsr.io/@deno-library/progress/1.5.1/mod.ts +265 -0
- package/src/deps/jsr.io/@deno-library/progress/1.5.1/multi.ts +250 -0
- package/src/deps/jsr.io/@deno-library/progress/1.5.1/time.ts +69 -0
- package/src/deps/jsr.io/@std/fmt/1.0.3/colors.ts +1004 -0
- package/src/deps/jsr.io/@std/internal/1.0.12/_os.ts +15 -0
- package/src/deps/jsr.io/@std/internal/1.0.12/os.ts +7 -0
- package/src/deps/jsr.io/@std/io/0.225.0/types.ts +157 -0
- package/src/deps/jsr.io/@std/io/0.225.0/write_all.ts +65 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/assert_path.ts +10 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/basename.ts +53 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/common.ts +26 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/constants.ts +49 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/dirname.ts +9 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/format.ts +25 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/from_file_url.ts +12 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/glob_to_reg_exp.ts +295 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/normalize.ts +9 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/normalize_string.ts +74 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/relative.ts +10 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/strip_trailing_separators.ts +25 -0
- package/src/deps/jsr.io/@std/path/1.1.4/_common/to_file_url.ts +17 -0
- package/src/deps/jsr.io/@std/path/1.1.4/basename.ts +37 -0
- package/src/deps/jsr.io/@std/path/1.1.4/common.ts +35 -0
- package/src/deps/jsr.io/@std/path/1.1.4/constants.ts +18 -0
- package/src/deps/jsr.io/@std/path/1.1.4/dirname.ts +30 -0
- package/src/deps/jsr.io/@std/path/1.1.4/extname.ts +29 -0
- package/src/deps/jsr.io/@std/path/1.1.4/format.ts +30 -0
- package/src/deps/jsr.io/@std/path/1.1.4/from_file_url.ts +30 -0
- package/src/deps/jsr.io/@std/path/1.1.4/glob_to_regexp.ts +94 -0
- package/src/deps/jsr.io/@std/path/1.1.4/is_absolute.ts +30 -0
- package/src/deps/jsr.io/@std/path/1.1.4/is_glob.ts +49 -0
- package/src/deps/jsr.io/@std/path/1.1.4/join.ts +31 -0
- package/src/deps/jsr.io/@std/path/1.1.4/join_globs.ts +42 -0
- package/src/deps/jsr.io/@std/path/1.1.4/mod.ts +217 -0
- package/src/deps/jsr.io/@std/path/1.1.4/normalize.ts +33 -0
- package/src/deps/jsr.io/@std/path/1.1.4/normalize_glob.ts +45 -0
- package/src/deps/jsr.io/@std/path/1.1.4/parse.ts +44 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/_util.ts +10 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/basename.ts +62 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/constants.ts +15 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/dirname.ts +72 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/extname.ts +96 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/format.ts +31 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/from_file_url.ts +25 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/glob_to_regexp.ts +94 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/is_absolute.ts +25 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/join.ts +46 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/join_globs.ts +45 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/normalize.ts +63 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/normalize_glob.ts +43 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/parse.ts +121 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/relative.ts +103 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/resolve.ts +71 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/to_file_url.ts +32 -0
- package/src/deps/jsr.io/@std/path/1.1.4/posix/to_namespaced_path.ts +21 -0
- package/src/deps/jsr.io/@std/path/1.1.4/relative.ts +32 -0
- package/src/deps/jsr.io/@std/path/1.1.4/resolve.ts +32 -0
- package/src/deps/jsr.io/@std/path/1.1.4/to_file_url.ts +30 -0
- package/src/deps/jsr.io/@std/path/1.1.4/to_namespaced_path.ts +31 -0
- package/src/deps/jsr.io/@std/path/1.1.4/types.ts +40 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/_util.ts +28 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/basename.ts +54 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/constants.ts +15 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/dirname.ts +118 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/extname.ts +90 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/format.ts +31 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/from_file_url.ts +34 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/glob_to_regexp.ts +92 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/is_absolute.ts +40 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/join.ts +78 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/join_globs.ts +46 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/normalize.ts +136 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/normalize_glob.ts +43 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/parse.ts +184 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/relative.ts +128 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/resolve.ts +178 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/to_file_url.ts +38 -0
- package/src/deps/jsr.io/@std/path/1.1.4/windows/to_namespaced_path.ts +60 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_chars.ts +55 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_dumper_state.ts +841 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_loader_state.ts +1780 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_schema.ts +183 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/binary.ts +127 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/bool.ts +37 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/float.ts +112 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/int.ts +174 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/map.ts +17 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/merge.ts +13 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/nil.ts +27 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/omap.ts +30 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/pairs.ts +22 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/regexp.ts +33 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/seq.ts +13 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/set.ts +17 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/str.ts +12 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/timestamp.ts +101 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type/undefined.ts +23 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_type.ts +49 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/_utils.ts +16 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/mod.ts +54 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/parse.ts +128 -0
- package/src/deps/jsr.io/@std/yaml/1.0.11/stringify.ts +118 -0
- package/src/shared/deep_merge.ts +73 -0
- package/src/shared/mod.ts +2 -0
- package/src/shared/types/filetypes.ts +101 -0
- package/src/shared/types/findings.ts +7 -0
- package/src/shared/types/mod.ts +6 -0
- package/src/shared/types/permissions.ts +17 -0
- package/src/shared/types/references.ts +62 -0
- package/src/shared/types/risks.ts +72 -0
- package/src/shared/types/syntaxNode.ts +7 -0
- package/src/skillreader/cloudStorage/mod.ts +170 -0
- package/src/skillreader/factory.ts +71 -0
- package/src/skillreader/fs/git.ts +153 -0
- package/src/skillreader/fs/mod.ts +84 -0
- package/src/skillreader/github/base.ts +162 -0
- package/src/skillreader/github/githubApi.ts +40 -0
- package/src/skillreader/github/githubRaw.ts +24 -0
- package/src/skillreader/github/mod.ts +45 -0
- package/src/skillreader/github/utils.ts +40 -0
- package/src/skillreader/manifest.ts +67 -0
- package/src/skillreader/mod.ts +26 -0
- package/src/skillreader/types.ts +150 -0
- package/src/skillreader/utils/frontmatter-parser.ts +72 -0
- package/src/skillreader/utils/http-range.ts +38 -0
- package/src/skillreader/utils/mod.ts +12 -0
- package/esm/analyzer/astgrep/registry.d.ts +0 -18
- package/esm/analyzer/astgrep/registry.d.ts.map +0 -1
- package/esm/analyzer/astgrep/registry.js +0 -71
- package/esm/analyzer/config.d.ts +0 -27
- package/esm/analyzer/config.d.ts.map +0 -1
- package/esm/analyzer/steps/003-risks/output.d.ts +0 -3
- package/esm/analyzer/steps/003-risks/output.d.ts.map +0 -1
- package/esm/analyzer/steps/003-risks/output.js +0 -16
- package/esm/analyzer/treesiter/client.d.ts +0 -26
- package/esm/analyzer/treesiter/client.d.ts.map +0 -1
- package/script/analyzer/astgrep/registry.d.ts +0 -18
- package/script/analyzer/astgrep/registry.d.ts.map +0 -1
- package/script/analyzer/astgrep/registry.js +0 -109
- package/script/analyzer/config.d.ts +0 -27
- package/script/analyzer/config.d.ts.map +0 -1
- package/script/analyzer/steps/003-risks/output.d.ts +0 -3
- package/script/analyzer/steps/003-risks/output.d.ts.map +0 -1
- package/script/analyzer/steps/003-risks/output.js +0 -19
- package/script/analyzer/treesiter/client.d.ts +0 -26
- package/script/analyzer/treesiter/client.d.ts.map +0 -1
- package/script/analyzer/treesiter/client.js +0 -165
|
@@ -19,10 +19,11 @@ async function extractCodeBlocks(context, content) {
|
|
|
19
19
|
const blockNode = capture.node;
|
|
20
20
|
const startLine = blockNode.startPosition.row + 1;
|
|
21
21
|
const endLine = blockNode.endPosition.row + 1;
|
|
22
|
-
const languageNode = blockNode.children.find((child) => child
|
|
23
|
-
child.type === astTypes_js_1.MARKDOWN_NODE.
|
|
22
|
+
const languageNode = blockNode.children.find((child) => child !== null &&
|
|
23
|
+
(child.type === astTypes_js_1.MARKDOWN_NODE.CODE_FENCE_LANGUAGE ||
|
|
24
|
+
child.type === astTypes_js_1.MARKDOWN_NODE.INFO_STRING));
|
|
24
25
|
const fenceLanguage = mod_js_1.FILETYPE_BY_LANGUAGE[(languageNode?.text ?? "").trim().toLowerCase()] ?? null;
|
|
25
|
-
const contentNode = blockNode.children.find((child) => child.type === astTypes_js_1.MARKDOWN_NODE.CODE_FENCE_CONTENT);
|
|
26
|
+
const contentNode = blockNode.children.find((child) => child !== null && child.type === astTypes_js_1.MARKDOWN_NODE.CODE_FENCE_CONTENT);
|
|
26
27
|
const codeContent = (contentNode?.text ?? "")
|
|
27
28
|
.replace(/\n?[`~]{3,}[^\n]*\s*$/, "")
|
|
28
29
|
.trimEnd();
|
|
@@ -46,6 +47,8 @@ async function extractCodeBlocks(context, content) {
|
|
|
46
47
|
continue;
|
|
47
48
|
const inlineNode = inlineCapture.node;
|
|
48
49
|
const inlineTree = inlineParser.parse(inlineNode.text);
|
|
50
|
+
if (!inlineTree)
|
|
51
|
+
continue;
|
|
49
52
|
for (const codeMatch of codeSpanQuery.matches(inlineTree.rootNode)) {
|
|
50
53
|
for (const codeCapture of codeMatch.captures) {
|
|
51
54
|
if (codeCapture.name !== "code")
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractFileRefs.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/rules/markdown/extractFileRefs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;
|
|
1
|
+
{"version":3,"file":"extractFileRefs.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/rules/markdown/extractFileRefs.ts"],"names":[],"mappings":"AAAA;;;;;;;GAOG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAIxE,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAiF7B"}
|
|
@@ -27,6 +27,8 @@ async function extractMarkdownFileRefs(context, content) {
|
|
|
27
27
|
const inlineNode = inlineCapture.node;
|
|
28
28
|
const blockLine = inlineNode.startPosition.row;
|
|
29
29
|
const inlineTree = inlineParser.parse(inlineNode.text);
|
|
30
|
+
if (!inlineTree)
|
|
31
|
+
continue;
|
|
30
32
|
const inlineRoot = inlineTree.rootNode;
|
|
31
33
|
for (const match of linkDestQuery.matches(inlineRoot)) {
|
|
32
34
|
for (const capture of match.captures) {
|
|
@@ -10,5 +10,5 @@
|
|
|
10
10
|
* Uses ast-grep AST traversal.
|
|
11
11
|
*/
|
|
12
12
|
import type { AnalyzerContext, FileRefDiscovery } from "../../types.js";
|
|
13
|
-
export declare function extractPythonFileRefs(context: AnalyzerContext, content: string): FileRefDiscovery[]
|
|
13
|
+
export declare function extractPythonFileRefs(context: AnalyzerContext, content: string): Promise<FileRefDiscovery[]>;
|
|
14
14
|
//# sourceMappingURL=extractFileRefs.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"extractFileRefs.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/rules/python/extractFileRefs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,
|
|
1
|
+
{"version":3,"file":"extractFileRefs.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/rules/python/extractFileRefs.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;GAUG;AAGH,OAAO,KAAK,EAAE,eAAe,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AAGxE,wBAAsB,qBAAqB,CACvC,OAAO,EAAE,eAAe,EACxB,OAAO,EAAE,MAAM,GAChB,OAAO,CAAC,gBAAgB,EAAE,CAAC,CAwE7B"}
|
|
@@ -14,9 +14,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
14
14
|
exports.extractPythonFileRefs = extractPythonFileRefs;
|
|
15
15
|
const file_refs_js_1 = require("../shared/file-refs.js");
|
|
16
16
|
const astTypes_js_1 = require("./astTypes.js");
|
|
17
|
-
function extractPythonFileRefs(context, content) {
|
|
17
|
+
async function extractPythonFileRefs(context, content) {
|
|
18
18
|
const refs = [];
|
|
19
|
-
const ast = context.astgrepClient.parse("python", content);
|
|
19
|
+
const ast = await context.astgrepClient.parse("python", content);
|
|
20
20
|
const root = ast.root();
|
|
21
21
|
// ── import_statement (e.g. `import os`, `import os.path`) ───────────────
|
|
22
22
|
const importNodes = root.findAll({ rule: { kind: astTypes_js_1.PYTHON_NODE.IMPORT_STATEMENT } });
|
|
@@ -21,6 +21,10 @@ export declare function discoverReferencedFiles(context: AnalyzerContext, input:
|
|
|
21
21
|
allFiles: SkillFile[];
|
|
22
22
|
readTextFile: (path: string) => Promise<string | null>;
|
|
23
23
|
maxScanDepth: number;
|
|
24
|
+
onDiscover?: (progress: {
|
|
25
|
+
scannedCount: number;
|
|
26
|
+
discoveredCount: number;
|
|
27
|
+
}) => void;
|
|
24
28
|
}): Promise<FileReference[]>;
|
|
25
29
|
export type { FileRefDiscovery };
|
|
26
30
|
//# sourceMappingURL=discover-files.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"discover-files.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/001-discovery/discover-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGvE,KAAK,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhF;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE;IACH,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"discover-files.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/001-discovery/discover-files.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AAG7D,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAC;AACvD,OAAO,KAAK,EAAE,aAAa,EAAE,SAAS,EAAE,MAAM,wBAAwB,CAAC;AAGvE,KAAK,cAAc,GAAG;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,YAAY,CAAC,EAAE,SAAS,CAAA;CAAE,CAAC;AAEhF;;;;;;;;GAQG;AACH,wBAAsB,uBAAuB,CACzC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE;IACH,UAAU,EAAE,cAAc,EAAE,CAAC;IAC7B,QAAQ,EAAE,SAAS,EAAE,CAAC;IACtB,YAAY,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,MAAM,GAAG,IAAI,CAAC,CAAC;IACvD,YAAY,EAAE,MAAM,CAAC;IACrB,UAAU,CAAC,EAAE,CAAC,QAAQ,EAAE;QAAE,YAAY,EAAE,MAAM,CAAC;QAAC,eAAe,EAAE,MAAM,CAAA;KAAE,KAAK,IAAI,CAAC;CACtF,GACF,OAAO,CAAC,aAAa,EAAE,CAAC,CA8K1B;AAMD,YAAY,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -17,6 +17,8 @@ const code_block_path_js_1 = require("../../utils/code-block-path.js");
|
|
|
17
17
|
async function discoverReferencedFiles(context, input) {
|
|
18
18
|
const discovered = new Map();
|
|
19
19
|
const queue = [...input.startQueue];
|
|
20
|
+
let scannedCount = 0;
|
|
21
|
+
let discoveredCount = 0;
|
|
20
22
|
// A set of file paths which have been processed
|
|
21
23
|
const processed = new Set();
|
|
22
24
|
const startPaths = new Set(input.startQueue.map((item) => normalizePath(item.path)));
|
|
@@ -27,6 +29,7 @@ async function discoverReferencedFiles(context, input) {
|
|
|
27
29
|
if (processed.has(current.path) || current.depth > input.maxScanDepth)
|
|
28
30
|
continue;
|
|
29
31
|
processed.add(current.path);
|
|
32
|
+
input.onDiscover?.({ scannedCount: scannedCount++, discoveredCount });
|
|
30
33
|
const content = await input.readTextFile(current.path);
|
|
31
34
|
if (!content)
|
|
32
35
|
continue;
|
|
@@ -80,6 +83,7 @@ async function discoverReferencedFiles(context, input) {
|
|
|
80
83
|
depth: current.depth + 1,
|
|
81
84
|
referencedBy: localEntry.referencedBy,
|
|
82
85
|
});
|
|
86
|
+
input.onDiscover?.({ scannedCount, discoveredCount: discoveredCount++ });
|
|
83
87
|
}
|
|
84
88
|
continue;
|
|
85
89
|
}
|
|
@@ -107,11 +111,23 @@ async function discoverReferencedFiles(context, input) {
|
|
|
107
111
|
});
|
|
108
112
|
continue;
|
|
109
113
|
}
|
|
110
|
-
if (absoluteRef.via === "import"
|
|
114
|
+
if (absoluteRef.via === "import") {
|
|
111
115
|
discovered.set(normalizedPath, {
|
|
112
116
|
path: normalizedPath,
|
|
113
117
|
sourceType: "external",
|
|
114
|
-
fileType:
|
|
118
|
+
fileType: block.language,
|
|
119
|
+
role: "library",
|
|
120
|
+
depth: current.depth + 1,
|
|
121
|
+
discoveryMethod: absoluteRef.via,
|
|
122
|
+
referencedBy: referenceFromCurrent,
|
|
123
|
+
});
|
|
124
|
+
continue;
|
|
125
|
+
}
|
|
126
|
+
if (absoluteRef.via === "source") {
|
|
127
|
+
discovered.set(normalizedPath, {
|
|
128
|
+
path: normalizedPath,
|
|
129
|
+
sourceType: "external",
|
|
130
|
+
fileType: block.language,
|
|
115
131
|
role: "library",
|
|
116
132
|
depth: current.depth + 1,
|
|
117
133
|
discoveryMethod: absoluteRef.via,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/001-discovery/mod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/001-discovery/mod.ts"],"names":[],"mappings":"AAOA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAIrE,wBAAsB,eAAe,CACjC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,eAAe,GACzB,OAAO,CAAC,aAAa,CAAC,CAwFxB"}
|
|
@@ -1,7 +1,45 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.run001Discovery = run001Discovery;
|
|
4
|
-
const
|
|
40
|
+
const dntShim = __importStar(require("../../../_dnt.shims.js"));
|
|
41
|
+
const mod_js_1 = __importDefault(require("../../../deps/jsr.io/@deno-library/progress/1.5.1/mod.js"));
|
|
42
|
+
const mod_js_2 = require("../../config/mod.js");
|
|
5
43
|
const discover_files_js_1 = require("./discover-files.js");
|
|
6
44
|
const filter_files_js_1 = require("./filter-files.js");
|
|
7
45
|
async function run001Discovery(state, context) {
|
|
@@ -13,22 +51,50 @@ async function run001Discovery(state, context) {
|
|
|
13
51
|
files,
|
|
14
52
|
frontmatter,
|
|
15
53
|
skillId: String(frontmatter.name ?? state.skillId),
|
|
16
|
-
skillVersionId: String(frontmatter.metadata?.version ?? state.skillVersionId ??
|
|
54
|
+
skillVersionId: String(frontmatter.metadata?.version ?? state.skillVersionId ?? mod_js_2.DEFAULT_SKILL_VERSION),
|
|
17
55
|
};
|
|
18
56
|
for (const field of Object.keys(frontmatter)) {
|
|
19
|
-
if (!
|
|
57
|
+
if (!mod_js_2.FRONTMATTER_SUPPORTED_FIELDS.includes(field) && ![
|
|
20
58
|
"startLineNumber",
|
|
21
59
|
"endLineNumber",
|
|
22
60
|
].includes(field)) {
|
|
23
61
|
nextState.warnings.push(`Unknown frontmatter field '${field}' - analysis not supported yet`);
|
|
24
62
|
}
|
|
25
63
|
}
|
|
26
|
-
const
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
64
|
+
const shouldLogProgress = (context.showProgressBar ?? false) && dntShim.Deno.stderr.isTerminal();
|
|
65
|
+
const maxScanDepth = state.metadata.config.maxScanDepth ??
|
|
66
|
+
mod_js_2.DEFAULT_ANALYZER_CONFIG.scan?.maxScanDepth ?? 5;
|
|
67
|
+
const maxFileCount = state.metadata.config.maxFileCount ??
|
|
68
|
+
mod_js_2.DEFAULT_ANALYZER_CONFIG.scan?.maxFileCount ?? 100;
|
|
69
|
+
const maxFileSize = state.metadata.config.maxFileSize ??
|
|
70
|
+
mod_js_2.DEFAULT_ANALYZER_CONFIG.scan?.maxFileSize ?? 1_000_000;
|
|
71
|
+
const discoveryBar = shouldLogProgress
|
|
72
|
+
? new mod_js_1.default({
|
|
73
|
+
total: files.length,
|
|
74
|
+
clear: true,
|
|
75
|
+
output: dntShim.Deno.stderr,
|
|
76
|
+
complete: "=",
|
|
77
|
+
incomplete: "-",
|
|
78
|
+
display: "Readings skills [:bar] :percent ETA :eta",
|
|
79
|
+
})
|
|
80
|
+
: null;
|
|
81
|
+
let discovered = [];
|
|
82
|
+
try {
|
|
83
|
+
discovered = await (0, discover_files_js_1.discoverReferencedFiles)(context, {
|
|
84
|
+
startQueue: [{ path: skillMdPath, depth: 0 }],
|
|
85
|
+
allFiles: files,
|
|
86
|
+
readTextFile: (path) => context.skillReader.readTextFile(path),
|
|
87
|
+
maxScanDepth,
|
|
88
|
+
onDiscover: (progress) => {
|
|
89
|
+
discoveryBar?.render(progress.scannedCount, {
|
|
90
|
+
total: progress.discoveredCount + 1,
|
|
91
|
+
});
|
|
92
|
+
},
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
finally {
|
|
96
|
+
discoveryBar?.end();
|
|
97
|
+
}
|
|
32
98
|
discovered.push({
|
|
33
99
|
path: skillMdPath,
|
|
34
100
|
sourceType: "local",
|
|
@@ -39,8 +105,8 @@ async function run001Discovery(state, context) {
|
|
|
39
105
|
const filtered = (0, filter_files_js_1.filterScanQueue)({
|
|
40
106
|
queue: discovered,
|
|
41
107
|
allFiles: files,
|
|
42
|
-
maxFileCount
|
|
43
|
-
maxFileSize
|
|
108
|
+
maxFileCount,
|
|
109
|
+
maxFileSize,
|
|
44
110
|
});
|
|
45
111
|
return {
|
|
46
112
|
...nextState,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/002-permissions/mod.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"mod.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/002-permissions/mod.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAcrE,wBAAsB,iBAAiB,CACnC,KAAK,EAAE,aAAa,EACpB,OAAO,EAAE,eAAe,GACzB,OAAO,CAAC,aAAa,CAAC,CAsGxB"}
|
|
@@ -1,96 +1,146 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || (function () {
|
|
19
|
+
var ownKeys = function(o) {
|
|
20
|
+
ownKeys = Object.getOwnPropertyNames || function (o) {
|
|
21
|
+
var ar = [];
|
|
22
|
+
for (var k in o) if (Object.prototype.hasOwnProperty.call(o, k)) ar[ar.length] = k;
|
|
23
|
+
return ar;
|
|
24
|
+
};
|
|
25
|
+
return ownKeys(o);
|
|
26
|
+
};
|
|
27
|
+
return function (mod) {
|
|
28
|
+
if (mod && mod.__esModule) return mod;
|
|
29
|
+
var result = {};
|
|
30
|
+
if (mod != null) for (var k = ownKeys(mod), i = 0; i < k.length; i++) if (k[i] !== "default") __createBinding(result, mod, k[i]);
|
|
31
|
+
__setModuleDefault(result, mod);
|
|
32
|
+
return result;
|
|
33
|
+
};
|
|
34
|
+
})();
|
|
35
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
36
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
37
|
+
};
|
|
2
38
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
39
|
exports.run002Permissions = run002Permissions;
|
|
4
|
-
const
|
|
40
|
+
const dntShim = __importStar(require("../../../_dnt.shims.js"));
|
|
41
|
+
const mod_js_1 = __importDefault(require("../../../deps/jsr.io/@deno-library/progress/1.5.1/mod.js"));
|
|
5
42
|
const mod_js_2 = require("../../rules/mod.js");
|
|
43
|
+
const mod_js_3 = require("../../rules/mod.js");
|
|
6
44
|
const inline_command_classifier_js_1 = require("../../rules/bash/inline-command-classifier.js");
|
|
7
45
|
const code_block_path_js_1 = require("../../utils/code-block-path.js");
|
|
8
46
|
const id_generator_js_1 = require("../../utils/id-generator.js");
|
|
9
47
|
const scan_file_js_1 = require("./scan-file.js");
|
|
10
48
|
const seed_frontmatter_js_1 = require("./seed-frontmatter.js");
|
|
11
49
|
const synthesize_js_1 = require("./synthesize.js");
|
|
50
|
+
const ANSI_SHOW_CURSOR = "\x1b[?25h";
|
|
51
|
+
const ENCODER = new TextEncoder();
|
|
12
52
|
async function run002Permissions(state, context) {
|
|
13
53
|
const skillMdPath = state.scanQueue.find((file) => file.role === "entrypoint")?.path ??
|
|
14
54
|
"SKILL.md";
|
|
15
55
|
let next = state;
|
|
16
56
|
next = (0, seed_frontmatter_js_1.seedPermissionsFromFrontmatter)(next, skillMdPath);
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
fileRef.discoveryMethod === undefined) {
|
|
41
|
-
next = {
|
|
42
|
-
...next,
|
|
43
|
-
warnings: [
|
|
44
|
-
...next.warnings,
|
|
45
|
-
`External reference not analyzed yet: ${fileRef.path}`,
|
|
46
|
-
],
|
|
47
|
-
metadata: {
|
|
48
|
-
...next.metadata,
|
|
49
|
-
skippedFiles: [...next.metadata.skippedFiles, {
|
|
50
|
-
path: fileRef.path,
|
|
51
|
-
reason: "external_reference",
|
|
52
|
-
referenceBy: fileRef.referencedBy,
|
|
53
|
-
}],
|
|
54
|
-
},
|
|
55
|
-
};
|
|
56
|
-
}
|
|
57
|
-
continue;
|
|
58
|
-
}
|
|
59
|
-
const scanTargets = await resolveScanTargets(fileRef, context);
|
|
60
|
-
if (scanTargets.length === 0)
|
|
61
|
-
continue;
|
|
62
|
-
if (!mod_js_2.RULES_BY_FILETYPE[fileRef.fileType]) {
|
|
63
|
-
next = {
|
|
64
|
-
...next,
|
|
65
|
-
warnings: [
|
|
66
|
-
...next.warnings,
|
|
67
|
-
`File type '${fileRef.fileType}' is not supported yet for analysis: ${fileRef.path}`,
|
|
68
|
-
],
|
|
69
|
-
metadata: {
|
|
70
|
-
...next.metadata,
|
|
71
|
-
skippedFiles: [...next.metadata.skippedFiles, {
|
|
57
|
+
const shouldRenderProgress = (context.showProgressBar ?? false) && dntShim.Deno.stderr.isTerminal();
|
|
58
|
+
const scanBar = shouldRenderProgress
|
|
59
|
+
? new mod_js_1.default({
|
|
60
|
+
total: Math.max(1, next.scanQueue.length),
|
|
61
|
+
clear: true,
|
|
62
|
+
output: dntShim.Deno.stderr,
|
|
63
|
+
complete: "=",
|
|
64
|
+
incomplete: "-",
|
|
65
|
+
display: "Scanning skills [:bar] :percent ETA :eta",
|
|
66
|
+
})
|
|
67
|
+
: null;
|
|
68
|
+
let processed = 0;
|
|
69
|
+
try {
|
|
70
|
+
await scanBar?.render(processed);
|
|
71
|
+
for (const fileRef of next.scanQueue) {
|
|
72
|
+
try {
|
|
73
|
+
if (fileRef.sourceType === "external") {
|
|
74
|
+
if (fileRef.role === "host-fs") {
|
|
75
|
+
next = addHostFsPermission(next, fileRef.path, fileRef.referencedBy);
|
|
76
|
+
}
|
|
77
|
+
else if (fileRef.discoveryMethod === "import") {
|
|
78
|
+
next = addImportDependencyPermission(next, fileRef);
|
|
79
|
+
next = appendSkippedFile(next, {
|
|
72
80
|
path: fileRef.path,
|
|
73
|
-
reason:
|
|
81
|
+
reason: "external_library_dependency",
|
|
74
82
|
referenceBy: fileRef.referencedBy,
|
|
75
|
-
}
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
else {
|
|
86
|
+
next = addExternalReferencePermission(next, fileRef);
|
|
87
|
+
const reason = fileRef.role === "library"
|
|
88
|
+
? "external_library_dependency"
|
|
89
|
+
: "external_reference";
|
|
90
|
+
next = appendSkippedFile(next, {
|
|
91
|
+
path: fileRef.path,
|
|
92
|
+
reason,
|
|
93
|
+
referenceBy: fileRef.referencedBy,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
continue;
|
|
97
|
+
}
|
|
98
|
+
const scanTargets = await resolveScanTargets(fileRef, context);
|
|
99
|
+
if (scanTargets.length === 0)
|
|
100
|
+
continue;
|
|
101
|
+
if (!mod_js_3.RULES_BY_FILETYPE[fileRef.fileType]) {
|
|
102
|
+
next = {
|
|
103
|
+
...next,
|
|
104
|
+
warnings: [
|
|
105
|
+
...next.warnings,
|
|
106
|
+
`File type '${fileRef.fileType}' is not supported yet for analysis: ${fileRef.path}`,
|
|
107
|
+
],
|
|
108
|
+
metadata: {
|
|
109
|
+
...next.metadata,
|
|
110
|
+
skippedFiles: [...next.metadata.skippedFiles, {
|
|
111
|
+
path: fileRef.path,
|
|
112
|
+
reason: `unsupported_type_${fileRef.fileType}`,
|
|
113
|
+
referenceBy: fileRef.referencedBy,
|
|
114
|
+
}],
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
continue;
|
|
118
|
+
}
|
|
119
|
+
for (const scanTarget of scanTargets) {
|
|
120
|
+
next = await (0, scan_file_js_1.scanFileForPermissions)(context, {
|
|
121
|
+
state: next,
|
|
122
|
+
fileRef,
|
|
123
|
+
scanPath: scanTarget.scanPath,
|
|
124
|
+
content: scanTarget.content,
|
|
125
|
+
lineOffset: scanTarget.lineOffset,
|
|
126
|
+
referenceType: scanTarget.referenceType,
|
|
127
|
+
});
|
|
128
|
+
if (scanTarget.referenceType === "content") {
|
|
129
|
+
next = applyPromptRegexFindings(next, scanTarget.scanPath, scanTarget.content, scanTarget.lineOffset, fileRef.referencedBy);
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
133
|
+
finally {
|
|
134
|
+
await scanBar?.render(++processed);
|
|
91
135
|
}
|
|
92
136
|
}
|
|
93
137
|
}
|
|
138
|
+
finally {
|
|
139
|
+
await scanBar?.end();
|
|
140
|
+
if (shouldRenderProgress && dntShim.Deno.stderr.isTerminal()) {
|
|
141
|
+
dntShim.Deno.stderr.writeSync(ENCODER.encode(ANSI_SHOW_CURSOR));
|
|
142
|
+
}
|
|
143
|
+
}
|
|
94
144
|
return (0, synthesize_js_1.synthesizePermissions)(next);
|
|
95
145
|
}
|
|
96
146
|
async function resolveScanTargets(fileRef, context) {
|
|
@@ -116,7 +166,8 @@ async function resolveScanTargets(fileRef, context) {
|
|
|
116
166
|
if (referenceType === "inline") {
|
|
117
167
|
const line = lines[decoded.startLine - 1] ?? "";
|
|
118
168
|
const snippets = extractInlineSnippets(line);
|
|
119
|
-
const
|
|
169
|
+
const likelyCommandFlags = await Promise.all(snippets.map((snippet) => (0, inline_command_classifier_js_1.isLikelyInlineBashCommand)(context, { snippet, lineContext: line })));
|
|
170
|
+
const likelyCommands = snippets.filter((_, i) => likelyCommandFlags[i]);
|
|
120
171
|
return likelyCommands.map((snippet) => ({
|
|
121
172
|
scanPath: decoded.parentPath,
|
|
122
173
|
content: snippet,
|
|
@@ -146,7 +197,7 @@ function extractInlineSnippets(line) {
|
|
|
146
197
|
function applyPromptRegexFindings(state, filePath, content, lineOffset, referencedBy) {
|
|
147
198
|
const findings = [...state.findings];
|
|
148
199
|
const lines = content.split("\n");
|
|
149
|
-
for (const rule of
|
|
200
|
+
for (const rule of mod_js_2.PROMPT_REGEX_RULES) {
|
|
150
201
|
for (let i = 0; i < lines.length; i += 1) {
|
|
151
202
|
if (!rule.pattern.test(lines[i]))
|
|
152
203
|
continue;
|
|
@@ -164,6 +215,74 @@ function applyPromptRegexFindings(state, filePath, content, lineOffset, referenc
|
|
|
164
215
|
}
|
|
165
216
|
return { ...state, findings };
|
|
166
217
|
}
|
|
218
|
+
function appendSkippedFile(state, skipped) {
|
|
219
|
+
return {
|
|
220
|
+
...state,
|
|
221
|
+
metadata: {
|
|
222
|
+
...state.metadata,
|
|
223
|
+
skippedFiles: [...state.metadata.skippedFiles, skipped],
|
|
224
|
+
},
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
function addImportDependencyPermission(state, fileRef) {
|
|
228
|
+
const language = fileRef.fileType;
|
|
229
|
+
const importName = fileRef.path;
|
|
230
|
+
const metadata = {
|
|
231
|
+
language,
|
|
232
|
+
discoveryMethod: fileRef.discoveryMethod,
|
|
233
|
+
};
|
|
234
|
+
const permission = {
|
|
235
|
+
id: (0, id_generator_js_1.generatePermissionId)("dep-import", [language, importName]),
|
|
236
|
+
tool: language,
|
|
237
|
+
scope: "dep",
|
|
238
|
+
permission: "import",
|
|
239
|
+
args: [importName],
|
|
240
|
+
metadata,
|
|
241
|
+
references: [toPermissionReference(fileRef)],
|
|
242
|
+
source: "inferred",
|
|
243
|
+
risks: [],
|
|
244
|
+
};
|
|
245
|
+
if (state.permissions.some((p) => p.id === permission.id))
|
|
246
|
+
return state;
|
|
247
|
+
return {
|
|
248
|
+
...state,
|
|
249
|
+
permissions: [...state.permissions, permission],
|
|
250
|
+
};
|
|
251
|
+
}
|
|
252
|
+
function addExternalReferencePermission(state, fileRef) {
|
|
253
|
+
const path = fileRef.path;
|
|
254
|
+
const language = fileRef.fileType ?? "unknown";
|
|
255
|
+
const metadata = {
|
|
256
|
+
language,
|
|
257
|
+
discoveryMethod: fileRef.discoveryMethod,
|
|
258
|
+
};
|
|
259
|
+
const permission = {
|
|
260
|
+
id: (0, id_generator_js_1.generatePermissionId)("dep-externalreference", [language, path]),
|
|
261
|
+
tool: language,
|
|
262
|
+
scope: "dep",
|
|
263
|
+
permission: "externalreference",
|
|
264
|
+
args: [path],
|
|
265
|
+
metadata,
|
|
266
|
+
references: [toPermissionReference(fileRef)],
|
|
267
|
+
source: "inferred",
|
|
268
|
+
risks: [],
|
|
269
|
+
};
|
|
270
|
+
if (state.permissions.some((p) => p.id === permission.id))
|
|
271
|
+
return state;
|
|
272
|
+
return {
|
|
273
|
+
...state,
|
|
274
|
+
permissions: [...state.permissions, permission],
|
|
275
|
+
};
|
|
276
|
+
}
|
|
277
|
+
function toPermissionReference(fileRef) {
|
|
278
|
+
return {
|
|
279
|
+
file: fileRef.referencedBy?.file ?? fileRef.path,
|
|
280
|
+
line: fileRef.referencedBy?.line ?? 1,
|
|
281
|
+
lineEnd: fileRef.referencedBy?.lineEnd,
|
|
282
|
+
type: fileRef.referencedBy?.type ?? "content",
|
|
283
|
+
referencedBy: fileRef.referencedBy?.referencedBy,
|
|
284
|
+
};
|
|
285
|
+
}
|
|
167
286
|
function addHostFsPermission(state, path, referencedBy) {
|
|
168
287
|
const reference = {
|
|
169
288
|
file: referencedBy?.file ?? "SKILL.md",
|
|
@@ -10,5 +10,5 @@ export declare function scanFileForPermissions(context: AnalyzerContext, input:
|
|
|
10
10
|
content: string;
|
|
11
11
|
lineOffset?: number;
|
|
12
12
|
referenceType?: "content" | "script" | "inline";
|
|
13
|
-
}): AnalyzerState
|
|
13
|
+
}): Promise<AnalyzerState>;
|
|
14
14
|
//# sourceMappingURL=scan-file.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"scan-file.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/002-permissions/scan-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAA+B,MAAM,wBAAwB,CAAC;AAsCzF;;GAEG;AACH,
|
|
1
|
+
{"version":3,"file":"scan-file.d.ts","sourceRoot":"","sources":["../../../../src/analyzer/steps/002-permissions/scan-file.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,eAAe,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,aAAa,EAA+B,MAAM,wBAAwB,CAAC;AAsCzF;;GAEG;AACH,wBAAsB,sBAAsB,CACxC,OAAO,EAAE,eAAe,EACxB,KAAK,EAAE;IACH,KAAK,EAAE,aAAa,CAAC;IACrB,OAAO,EAAE,aAAa,CAAC;IACvB,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,SAAS,GAAG,QAAQ,GAAG,QAAQ,CAAC;CACnD,GACF,OAAO,CAAC,aAAa,CAAC,CAiFxB"}
|