@promptci/core 0.2.1 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/ai-config.d.ts +13 -6
- package/dist/ai-config.d.ts.map +1 -1
- package/dist/ai-config.js +25 -78
- package/dist/ai-config.js.map +1 -1
- package/dist/close-match.d.ts +97 -0
- package/dist/close-match.d.ts.map +1 -0
- package/dist/close-match.js +215 -0
- package/dist/close-match.js.map +1 -0
- package/dist/command-validity.d.ts.map +1 -1
- package/dist/command-validity.js +309 -76
- package/dist/command-validity.js.map +1 -1
- package/dist/context-optimizer.d.ts.map +1 -1
- package/dist/context-optimizer.js +9 -2
- package/dist/context-optimizer.js.map +1 -1
- package/dist/dead-references.d.ts +8 -1
- package/dist/dead-references.d.ts.map +1 -1
- package/dist/dead-references.js +162 -243
- package/dist/dead-references.js.map +1 -1
- package/dist/dependency-staleness.d.ts.map +1 -1
- package/dist/dependency-staleness.js +24 -38
- package/dist/dependency-staleness.js.map +1 -1
- package/dist/detectors.js +1 -1
- package/dist/detectors.js.map +1 -1
- package/dist/discovery.d.ts +138 -0
- package/dist/discovery.d.ts.map +1 -0
- package/dist/discovery.js +569 -0
- package/dist/discovery.js.map +1 -0
- package/dist/fix-engine.d.ts.map +1 -1
- package/dist/fix-engine.js +75 -1
- package/dist/fix-engine.js.map +1 -1
- package/dist/frameworks/dotnet.d.ts.map +1 -1
- package/dist/frameworks/dotnet.js +10 -11
- package/dist/frameworks/dotnet.js.map +1 -1
- package/dist/frameworks/go.d.ts.map +1 -1
- package/dist/frameworks/go.js +8 -4
- package/dist/frameworks/go.js.map +1 -1
- package/dist/frameworks/nextjs.d.ts.map +1 -1
- package/dist/frameworks/nextjs.js +8 -17
- package/dist/frameworks/nextjs.js.map +1 -1
- package/dist/frameworks/python.d.ts.map +1 -1
- package/dist/frameworks/python.js +5 -3
- package/dist/frameworks/python.js.map +1 -1
- package/dist/frameworks/rust.d.ts.map +1 -1
- package/dist/frameworks/rust.js +3 -3
- package/dist/frameworks/rust.js.map +1 -1
- package/dist/frameworks/unity.d.ts.map +1 -1
- package/dist/frameworks/unity.js +6 -5
- package/dist/frameworks/unity.js.map +1 -1
- package/dist/gitignore.d.ts +31 -2
- package/dist/gitignore.d.ts.map +1 -1
- package/dist/gitignore.js +33 -8
- package/dist/gitignore.js.map +1 -1
- package/dist/hooks-settings-detector.d.ts.map +1 -1
- package/dist/hooks-settings-detector.js +5 -1
- package/dist/hooks-settings-detector.js.map +1 -1
- package/dist/index.d.ts +7 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -0
- package/dist/index.js.map +1 -1
- package/dist/known-paths.d.ts +82 -0
- package/dist/known-paths.d.ts.map +1 -0
- package/dist/known-paths.js +152 -0
- package/dist/known-paths.js.map +1 -0
- package/dist/makefile.d.ts +11 -3
- package/dist/makefile.d.ts.map +1 -1
- package/dist/makefile.js +28 -22
- package/dist/makefile.js.map +1 -1
- package/dist/manifest-consistency.d.ts +1 -1
- package/dist/manifest-consistency.d.ts.map +1 -1
- package/dist/manifest-consistency.js +12 -8
- package/dist/manifest-consistency.js.map +1 -1
- package/dist/mcp-config-detector.d.ts.map +1 -1
- package/dist/mcp-config-detector.js +5 -1
- package/dist/mcp-config-detector.js.map +1 -1
- package/dist/project-type.d.ts +2 -1
- package/dist/project-type.d.ts.map +1 -1
- package/dist/project-type.js +36 -48
- package/dist/project-type.js.map +1 -1
- package/dist/prompt-cache.d.ts.map +1 -1
- package/dist/prompt-cache.js +13 -2
- package/dist/prompt-cache.js.map +1 -1
- package/dist/repo-context.d.ts +9 -0
- package/dist/repo-context.d.ts.map +1 -1
- package/dist/repo-context.js +32 -35
- package/dist/repo-context.js.map +1 -1
- package/dist/repo-tree.d.ts +281 -0
- package/dist/repo-tree.d.ts.map +1 -0
- package/dist/repo-tree.js +455 -0
- package/dist/repo-tree.js.map +1 -0
- package/dist/report.d.ts.map +1 -1
- package/dist/report.js +3 -0
- package/dist/report.js.map +1 -1
- package/dist/sarif.d.ts +27 -0
- package/dist/sarif.d.ts.map +1 -0
- package/dist/sarif.js +357 -0
- package/dist/sarif.js.map +1 -0
- package/dist/scan.d.ts.map +1 -1
- package/dist/scan.js +8 -2
- package/dist/scan.js.map +1 -1
- package/dist/scanner.d.ts +4 -3
- package/dist/scanner.d.ts.map +1 -1
- package/dist/scanner.js +36 -77
- package/dist/scanner.js.map +1 -1
- package/dist/security-pack.d.ts.map +1 -1
- package/dist/security-pack.js +34 -35
- package/dist/security-pack.js.map +1 -1
- package/dist/skill-supply-chain.d.ts.map +1 -1
- package/dist/skill-supply-chain.js +29 -19
- package/dist/skill-supply-chain.js.map +1 -1
- package/dist/skills-detector.d.ts.map +1 -1
- package/dist/skills-detector.js +11 -3
- package/dist/skills-detector.js.map +1 -1
- package/dist/token-estimates.d.ts +42 -0
- package/dist/token-estimates.d.ts.map +1 -0
- package/dist/token-estimates.js +200 -0
- package/dist/token-estimates.js.map +1 -0
- package/dist/types.d.ts +89 -0
- package/dist/types.d.ts.map +1 -1
- package/dist/types.js.map +1 -1
- package/package.json +5 -2
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Discovery lists and a pure path-based discovery API (pcic-zg3).
|
|
3
|
+
*
|
|
4
|
+
* `scanner.ts` (instruction files), `ai-config.ts` (skills, settings, MCP) and
|
|
5
|
+
* `repo-context.ts` (workflows / composite actions) each discover a different
|
|
6
|
+
* class of file from the real filesystem with `fast-glob`. The constants and
|
|
7
|
+
* predicates that decide WHAT belongs to each class live here, once, so those
|
|
8
|
+
* three modules import them instead of keeping their own copies — two
|
|
9
|
+
* modules can no longer drift apart on what counts as, say, a skill location.
|
|
10
|
+
*
|
|
11
|
+
* `selectScanPaths` is the filesystem-free counterpart: given a plain list of
|
|
12
|
+
* repo-relative paths (as a server with only a GitHub tree listing has, not a
|
|
13
|
+
* checkout), it applies the exact same patterns, `include`/`exclude` policy,
|
|
14
|
+
* and caps to answer what a real scan would read, without ever touching disk.
|
|
15
|
+
* It applies scanner.ts's MAX_FILE_SIZE guard to instruction files and
|
|
16
|
+
* composite actions when a caller supplies `size` (there is nothing to check
|
|
17
|
+
* without it); it never applies the binary-content guard, since there are no
|
|
18
|
+
* bytes here to sniff.
|
|
19
|
+
*/
|
|
20
|
+
/** Files larger than this are skipped before they are ever read (scanner.ts). */
|
|
21
|
+
export declare const MAX_FILE_SIZE: number;
|
|
22
|
+
/** Bytes sniffed for a NUL byte when deciding whether a file is binary (scanner.ts). */
|
|
23
|
+
export declare const BINARY_CHECK_BYTES = 512;
|
|
24
|
+
/** Default glob patterns scanner.ts reads when no `include` override is given. */
|
|
25
|
+
export declare const DEFAULT_INSTRUCTION_PATTERNS: readonly string[];
|
|
26
|
+
/** `DEFAULT_INSTRUCTION_PATTERNS`, minus the `.clinerules/` directory globs when it is a file. */
|
|
27
|
+
export declare function defaultInstructionPatterns(clineIsDir: boolean): readonly string[];
|
|
28
|
+
/** Directory names scanner.ts's default scan ignores at any depth. */
|
|
29
|
+
export declare const SCAN_IGNORE_DIRS: readonly string[];
|
|
30
|
+
/**
|
|
31
|
+
* Every location an Agent Skill is installed from. The root-level globs are
|
|
32
|
+
* anchored on purpose: a `**\/skills/**` glob would also sweep up vendored
|
|
33
|
+
* copies and test fixtures.
|
|
34
|
+
*/
|
|
35
|
+
export declare const SKILL_GLOBS: readonly string[];
|
|
36
|
+
/** Non-markdown config surfaces ai-config.ts discovers and whose content a detector reports on. */
|
|
37
|
+
export declare const AI_CONFIG_EXACT_FILES: readonly string[];
|
|
38
|
+
/**
|
|
39
|
+
* Subagent, Cursor-rule and Copilot per-file instruction surfaces. These ARE
|
|
40
|
+
* markdown, and scanner.ts's own `DEFAULT_INSTRUCTION_PATTERNS` glob-matches
|
|
41
|
+
* the same locations — but the detectors that structurally audit them
|
|
42
|
+
* (subagents-detector.ts, cursor-rules-detector.ts, copilot-instructions-
|
|
43
|
+
* detector.ts) read them independently through `context.aiConfig`, which
|
|
44
|
+
* ai-config.ts discovers under `DISCOVERY_IGNORE_DIRS` (no `bin`/`obj`/
|
|
45
|
+
* `Library`/`Temp`), not scanner.ts's longer `SCAN_IGNORE_DIRS`. A file under
|
|
46
|
+
* one of those four extra ignored names is matched here but not by
|
|
47
|
+
* `instructionFiles`'s glob — put in `aiConfigFiles` rather than invented as
|
|
48
|
+
* a sixth result field, since that is genuinely how core reads it: never as
|
|
49
|
+
* always-loaded instruction prose there, always through the ai_config path.
|
|
50
|
+
* A copy outside those four directories legitimately appears in BOTH
|
|
51
|
+
* buckets, the same way a SKILL.md appears in both `instructionFiles` and
|
|
52
|
+
* `skillFiles` — two real pipelines reading the same file for two purposes.
|
|
53
|
+
*/
|
|
54
|
+
export declare const AI_CONFIG_MARKDOWN_GLOBS: readonly string[];
|
|
55
|
+
/** Directory names discovery for skills/agents/settings/mcp/cursor-rules ignores. */
|
|
56
|
+
export declare const DISCOVERY_IGNORE_DIRS: readonly string[];
|
|
57
|
+
/**
|
|
58
|
+
* Exact repo-relative directories that hold skills rather than being one — a
|
|
59
|
+
* SKILL.md sitting directly in one of them owns no bundle of its own.
|
|
60
|
+
*/
|
|
61
|
+
export declare const SKILL_CONTAINER_DIRS: ReadonlySet<string>;
|
|
62
|
+
export declare function isSkillContainerDir(dir: string): boolean;
|
|
63
|
+
/** Directories inside a skill that are not walked for bundled files. */
|
|
64
|
+
export declare const BUNDLE_SKIP_DIRS: ReadonlySet<string>;
|
|
65
|
+
/** Upper bound on bundled files read per skill. */
|
|
66
|
+
export declare const MAX_BUNDLED_FILES_PER_SKILL = 200;
|
|
67
|
+
/** Directory entries visited per skill before the (real, filesystem) walk stops. */
|
|
68
|
+
export declare const MAX_BUNDLE_LISTING = 20000;
|
|
69
|
+
/** Dependency package manifests read per skill (per `node_modules/` found, and in total). */
|
|
70
|
+
export declare const MAX_DEPENDENCY_MANIFESTS = 100;
|
|
71
|
+
export declare function isPriorityBundleFile(rel: string): boolean;
|
|
72
|
+
/**
|
|
73
|
+
* Candidate `<node_modules>/<pkg>/package.json` manifests, in the order and
|
|
74
|
+
* bounded the way ai-config.ts's `listPackageManifests` reads them: top-level
|
|
75
|
+
* entries sorted by name (dot-prefixed ones skipped), a `@scope` entry's own
|
|
76
|
+
* children sorted by name within it, capped at `cap` total. Shared between
|
|
77
|
+
* that filesystem-backed reader and this module's path-only equivalent so
|
|
78
|
+
* the two cannot drift on ORDER — each supplies its own `exists`/listing.
|
|
79
|
+
*/
|
|
80
|
+
export declare function dependencyManifestCandidates(topLevelNames: readonly string[], scopedNamesOf: (scope: string) => readonly string[], exists: (relPath: string) => boolean, nodeModulesDir: string, cap?: number): string[];
|
|
81
|
+
/** Composite actions: a root `action.yml` and any under `.github/actions/`. */
|
|
82
|
+
export declare const COMPOSITE_ACTION_GLOBS: readonly string[];
|
|
83
|
+
/** A repo-relative POSIX path, optionally carrying its blob size in bytes and whether it is a symlink. */
|
|
84
|
+
export type ScanPathEntry = string | {
|
|
85
|
+
path: string;
|
|
86
|
+
size?: number;
|
|
87
|
+
symlink?: boolean;
|
|
88
|
+
};
|
|
89
|
+
export type SelectScanPathsOptions = {
|
|
90
|
+
/**
|
|
91
|
+
* Overrides `DEFAULT_INSTRUCTION_PATTERNS` entirely for instruction-file
|
|
92
|
+
* matching — the same effect `ScanInput.include` has on a real scan. Also
|
|
93
|
+
* NARROWS (intersects with) every `aiConfigFiles`/`skillFiles` surface
|
|
94
|
+
* (skills, settings, MCP, subagents, Cursor rules, Copilot instructions),
|
|
95
|
+
* exactly as `discoverAiConfigFiles` does — it does not replace their own
|
|
96
|
+
* globs. Never affects workflow or composite-action discovery (neither
|
|
97
|
+
* does a real scan's `include`).
|
|
98
|
+
*/
|
|
99
|
+
include?: readonly string[];
|
|
100
|
+
/**
|
|
101
|
+
* The same effect `ScanInput.exclude` has on a real scan: removed from
|
|
102
|
+
* every class except the root-level context reads (package.json,
|
|
103
|
+
* pyproject.toml, lockfile-adjacent manifests, etc.) that core itself
|
|
104
|
+
* never checks `exclude` against.
|
|
105
|
+
*/
|
|
106
|
+
exclude?: readonly string[];
|
|
107
|
+
};
|
|
108
|
+
export type SelectScanPathsResult = {
|
|
109
|
+
/** Files a scan reads and reports on as always-loaded instruction prose. */
|
|
110
|
+
instructionFiles: string[];
|
|
111
|
+
/** `SKILL.md` files plus the files bundled alongside them. */
|
|
112
|
+
skillFiles: string[];
|
|
113
|
+
/**
|
|
114
|
+
* AI config a detector reads and reports on through `context.aiConfig`,
|
|
115
|
+
* never through the always-loaded instruction-prose pipeline: Claude
|
|
116
|
+
* settings, `.mcp.json`, subagents, Cursor rules, Copilot per-file
|
|
117
|
+
* instructions. The last three are markdown and may ALSO appear in
|
|
118
|
+
* `instructionFiles` (two real pipelines read the same file) — but under
|
|
119
|
+
* `bin/`, `obj/`, `Library/` or `Temp/` they appear only here, since
|
|
120
|
+
* ai-config.ts's own discovery ignores a shorter list of directories than
|
|
121
|
+
* scanner.ts's does.
|
|
122
|
+
*/
|
|
123
|
+
aiConfigFiles: string[];
|
|
124
|
+
/** GitHub Actions workflow files and composite `action.yml`/`action.yaml` files. */
|
|
125
|
+
workflowFiles: string[];
|
|
126
|
+
/** Files read for resolution (manifests, ignore files) but never reported on. */
|
|
127
|
+
contextFiles: string[];
|
|
128
|
+
};
|
|
129
|
+
/**
|
|
130
|
+
* Pure counterpart to a real scan's file discovery: given a repo's full path
|
|
131
|
+
* list (as a server building from GitHub's tree listing has, not a checkout),
|
|
132
|
+
* returns what a scan would read, classified the way the scanner, ai_config
|
|
133
|
+
* and repo-context modules classify it. Applies the same ignore dirs,
|
|
134
|
+
* `include`/`exclude` policy, skill-bundle rules and caps those modules use —
|
|
135
|
+
* see the module doc above.
|
|
136
|
+
*/
|
|
137
|
+
export declare function selectScanPaths(paths: readonly ScanPathEntry[], options?: SelectScanPathsOptions): SelectScanPathsResult;
|
|
138
|
+
//# sourceMappingURL=discovery.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"discovery.d.ts","sourceRoot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