eslint-plugin-copilot 1.0.8 → 1.1.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/_internal/copilot-config-references.d.ts +1 -1
- package/dist/_internal/copilot-config-references.d.ts.map +1 -1
- package/dist/_internal/copilot-config-references.js +3 -1
- package/dist/_internal/copilot-config-references.js.map +1 -1
- package/dist/_internal/copilot-file-kind.d.ts.map +1 -1
- package/dist/_internal/copilot-file-kind.js +4 -3
- package/dist/_internal/copilot-file-kind.js.map +1 -1
- package/dist/_internal/create-copilot-rule.d.ts +4 -2
- package/dist/_internal/create-copilot-rule.d.ts.map +1 -1
- package/dist/_internal/create-copilot-rule.js.map +1 -1
- package/dist/_internal/file-system.d.ts.map +1 -1
- package/dist/_internal/file-system.js +31 -18
- package/dist/_internal/file-system.js.map +1 -1
- package/dist/_internal/frontmatter.d.ts +1 -1
- package/dist/_internal/frontmatter.d.ts.map +1 -1
- package/dist/_internal/frontmatter.js +151 -119
- package/dist/_internal/frontmatter.js.map +1 -1
- package/dist/_internal/markdown-links.d.ts.map +1 -1
- package/dist/_internal/markdown-links.js +3 -1
- package/dist/_internal/markdown-links.js.map +1 -1
- package/dist/_internal/markdown-rule.d.ts +2 -1
- package/dist/_internal/markdown-rule.d.ts.map +1 -1
- package/dist/_internal/markdown-rule.js.map +1 -1
- package/dist/_internal/repository-hooks-json.d.ts +5 -2
- package/dist/_internal/repository-hooks-json.d.ts.map +1 -1
- package/dist/_internal/repository-hooks-json.js +7 -6
- package/dist/_internal/repository-hooks-json.js.map +1 -1
- package/dist/_internal/rule-catalog.d.ts.map +1 -1
- package/dist/_internal/rule-catalog.js +2 -3
- package/dist/_internal/rule-catalog.js.map +1 -1
- package/dist/plugin.cjs +588 -409
- package/dist/plugin.cjs.map +4 -4
- package/dist/plugin.d.cts +2 -1
- package/dist/plugin.d.ts +2 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +4 -3
- package/dist/plugin.js.map +1 -1
- package/dist/rules/no-blank-customization-body.d.ts +1 -0
- package/dist/rules/no-blank-customization-body.d.ts.map +1 -1
- package/dist/rules/no-blank-customization-body.js +3 -0
- package/dist/rules/no-blank-customization-body.js.map +1 -1
- package/dist/rules/no-blank-repository-instructions.d.ts +1 -0
- package/dist/rules/no-blank-repository-instructions.d.ts.map +1 -1
- package/dist/rules/no-blank-repository-instructions.js +3 -0
- package/dist/rules/no-blank-repository-instructions.js.map +1 -1
- package/dist/rules/no-blank-skill-body.d.ts +1 -0
- package/dist/rules/no-blank-skill-body.d.ts.map +1 -1
- package/dist/rules/no-blank-skill-body.js +3 -0
- package/dist/rules/no-blank-skill-body.js.map +1 -1
- package/dist/rules/no-deprecated-agent-infer.d.ts +1 -0
- package/dist/rules/no-deprecated-agent-infer.d.ts.map +1 -1
- package/dist/rules/no-deprecated-agent-infer.js +3 -0
- package/dist/rules/no-deprecated-agent-infer.js.map +1 -1
- package/dist/rules/no-duplicate-agent-names.d.ts +1 -0
- package/dist/rules/no-duplicate-agent-names.d.ts.map +1 -1
- package/dist/rules/no-duplicate-agent-names.js +6 -4
- package/dist/rules/no-duplicate-agent-names.js.map +1 -1
- package/dist/rules/no-duplicate-prompt-names.d.ts +1 -0
- package/dist/rules/no-duplicate-prompt-names.d.ts.map +1 -1
- package/dist/rules/no-duplicate-prompt-names.js +6 -4
- package/dist/rules/no-duplicate-prompt-names.js.map +1 -1
- package/dist/rules/no-duplicate-skill-names.d.ts +1 -0
- package/dist/rules/no-duplicate-skill-names.d.ts.map +1 -1
- package/dist/rules/no-duplicate-skill-names.js +6 -4
- package/dist/rules/no-duplicate-skill-names.js.map +1 -1
- package/dist/rules/no-duplicate-slash-command-names.d.ts +1 -0
- package/dist/rules/no-duplicate-slash-command-names.d.ts.map +1 -1
- package/dist/rules/no-duplicate-slash-command-names.js +6 -4
- package/dist/rules/no-duplicate-slash-command-names.js.map +1 -1
- package/dist/rules/no-empty-repository-hook-arrays.d.ts +1 -0
- package/dist/rules/no-empty-repository-hook-arrays.d.ts.map +1 -1
- package/dist/rules/no-empty-repository-hook-arrays.js +7 -3
- package/dist/rules/no-empty-repository-hook-arrays.js.map +1 -1
- package/dist/rules/no-legacy-chatmode-files.d.ts +1 -0
- package/dist/rules/no-legacy-chatmode-files.d.ts.map +1 -1
- package/dist/rules/no-legacy-chatmode-files.js +3 -0
- package/dist/rules/no-legacy-chatmode-files.js.map +1 -1
- package/dist/rules/prefer-custom-instructions-under-code-review-limit.d.ts +1 -0
- package/dist/rules/prefer-custom-instructions-under-code-review-limit.d.ts.map +1 -1
- package/dist/rules/prefer-custom-instructions-under-code-review-limit.js +3 -0
- package/dist/rules/prefer-custom-instructions-under-code-review-limit.js.map +1 -1
- package/dist/rules/prefer-fast-repository-hooks.d.ts +1 -0
- package/dist/rules/prefer-fast-repository-hooks.d.ts.map +1 -1
- package/dist/rules/prefer-fast-repository-hooks.js +5 -1
- package/dist/rules/prefer-fast-repository-hooks.js.map +1 -1
- package/dist/rules/prefer-qualified-tools.d.ts +1 -0
- package/dist/rules/prefer-qualified-tools.d.ts.map +1 -1
- package/dist/rules/prefer-qualified-tools.js +8 -3
- package/dist/rules/prefer-qualified-tools.js.map +1 -1
- package/dist/rules/require-agent-tool-for-subagents.d.ts +1 -0
- package/dist/rules/require-agent-tool-for-subagents.d.ts.map +1 -1
- package/dist/rules/require-agent-tool-for-subagents.js +6 -2
- package/dist/rules/require-agent-tool-for-subagents.js.map +1 -1
- package/dist/rules/require-agents-md-for-cross-surface-agent-instructions.d.ts +1 -0
- package/dist/rules/require-agents-md-for-cross-surface-agent-instructions.d.ts.map +1 -1
- package/dist/rules/require-agents-md-for-cross-surface-agent-instructions.js +3 -0
- package/dist/rules/require-agents-md-for-cross-surface-agent-instructions.js.map +1 -1
- package/dist/rules/require-chatmode-file-metadata.d.ts +1 -0
- package/dist/rules/require-chatmode-file-metadata.d.ts.map +1 -1
- package/dist/rules/require-chatmode-file-metadata.js +5 -1
- package/dist/rules/require-chatmode-file-metadata.js.map +1 -1
- package/dist/rules/require-existing-agent-hook-cwd.d.ts +1 -0
- package/dist/rules/require-existing-agent-hook-cwd.d.ts.map +1 -1
- package/dist/rules/require-existing-agent-hook-cwd.js +6 -2
- package/dist/rules/require-existing-agent-hook-cwd.js.map +1 -1
- package/dist/rules/require-existing-agent-mcp-servers.d.ts +1 -0
- package/dist/rules/require-existing-agent-mcp-servers.d.ts.map +1 -1
- package/dist/rules/require-existing-agent-mcp-servers.js +6 -2
- package/dist/rules/require-existing-agent-mcp-servers.js.map +1 -1
- package/dist/rules/require-existing-relative-agent-links.d.ts +1 -0
- package/dist/rules/require-existing-relative-agent-links.d.ts.map +1 -1
- package/dist/rules/require-existing-relative-agent-links.js +3 -0
- package/dist/rules/require-existing-relative-agent-links.js.map +1 -1
- package/dist/rules/require-existing-relative-instructions-links.d.ts +1 -0
- package/dist/rules/require-existing-relative-instructions-links.d.ts.map +1 -1
- package/dist/rules/require-existing-relative-instructions-links.js +3 -0
- package/dist/rules/require-existing-relative-instructions-links.js.map +1 -1
- package/dist/rules/require-existing-relative-prompt-links.d.ts +1 -0
- package/dist/rules/require-existing-relative-prompt-links.d.ts.map +1 -1
- package/dist/rules/require-existing-relative-prompt-links.js +3 -0
- package/dist/rules/require-existing-relative-prompt-links.js.map +1 -1
- package/dist/rules/require-existing-relative-skill-links.d.ts +1 -0
- package/dist/rules/require-existing-relative-skill-links.d.ts.map +1 -1
- package/dist/rules/require-existing-relative-skill-links.js +3 -0
- package/dist/rules/require-existing-relative-skill-links.js.map +1 -1
- package/dist/rules/require-existing-repository-hook-cwd.d.ts +1 -0
- package/dist/rules/require-existing-repository-hook-cwd.d.ts.map +1 -1
- package/dist/rules/require-existing-repository-hook-cwd.js +5 -1
- package/dist/rules/require-existing-repository-hook-cwd.js.map +1 -1
- package/dist/rules/require-github-copilot-target-for-mcp-servers.d.ts +1 -0
- package/dist/rules/require-github-copilot-target-for-mcp-servers.d.ts.map +1 -1
- package/dist/rules/require-github-copilot-target-for-mcp-servers.js +5 -1
- package/dist/rules/require-github-copilot-target-for-mcp-servers.js.map +1 -1
- package/dist/rules/require-instructions-apply-to.d.ts +1 -0
- package/dist/rules/require-instructions-apply-to.d.ts.map +1 -1
- package/dist/rules/require-instructions-apply-to.js +5 -1
- package/dist/rules/require-instructions-apply-to.js.map +1 -1
- package/dist/rules/require-json-agent-mcp-servers.d.ts +1 -0
- package/dist/rules/require-json-agent-mcp-servers.d.ts.map +1 -1
- package/dist/rules/require-json-agent-mcp-servers.js +6 -2
- package/dist/rules/require-json-agent-mcp-servers.js.map +1 -1
- package/dist/rules/require-prompt-file-metadata.d.ts +1 -0
- package/dist/rules/require-prompt-file-metadata.d.ts.map +1 -1
- package/dist/rules/require-prompt-file-metadata.js +43 -32
- package/dist/rules/require-prompt-file-metadata.js.map +1 -1
- package/dist/rules/require-qualified-agent-handoff-models.d.ts +1 -0
- package/dist/rules/require-qualified-agent-handoff-models.d.ts.map +1 -1
- package/dist/rules/require-qualified-agent-handoff-models.js +6 -2
- package/dist/rules/require-qualified-agent-handoff-models.js.map +1 -1
- package/dist/rules/require-relative-agent-hook-cwd.d.ts +1 -0
- package/dist/rules/require-relative-agent-hook-cwd.d.ts.map +1 -1
- package/dist/rules/require-relative-agent-hook-cwd.js +6 -2
- package/dist/rules/require-relative-agent-hook-cwd.js.map +1 -1
- package/dist/rules/require-relative-agent-links.d.ts +1 -0
- package/dist/rules/require-relative-agent-links.d.ts.map +1 -1
- package/dist/rules/require-relative-agent-links.js +3 -0
- package/dist/rules/require-relative-agent-links.js.map +1 -1
- package/dist/rules/require-relative-instructions-links.d.ts +1 -0
- package/dist/rules/require-relative-instructions-links.d.ts.map +1 -1
- package/dist/rules/require-relative-instructions-links.js +3 -0
- package/dist/rules/require-relative-instructions-links.js.map +1 -1
- package/dist/rules/require-relative-prompt-links.d.ts +1 -0
- package/dist/rules/require-relative-prompt-links.d.ts.map +1 -1
- package/dist/rules/require-relative-prompt-links.js +3 -0
- package/dist/rules/require-relative-prompt-links.js.map +1 -1
- package/dist/rules/require-relative-repository-hook-cwd.d.ts +1 -0
- package/dist/rules/require-relative-repository-hook-cwd.d.ts.map +1 -1
- package/dist/rules/require-relative-repository-hook-cwd.js +5 -1
- package/dist/rules/require-relative-repository-hook-cwd.js.map +1 -1
- package/dist/rules/require-relative-skill-links.d.ts +1 -0
- package/dist/rules/require-relative-skill-links.d.ts.map +1 -1
- package/dist/rules/require-relative-skill-links.js +3 -0
- package/dist/rules/require-relative-skill-links.js.map +1 -1
- package/dist/rules/require-repository-hook-arrays.d.ts +1 -0
- package/dist/rules/require-repository-hook-arrays.d.ts.map +1 -1
- package/dist/rules/require-repository-hook-arrays.js +7 -3
- package/dist/rules/require-repository-hook-arrays.js.map +1 -1
- package/dist/rules/require-repository-hook-command-shell.d.ts +1 -0
- package/dist/rules/require-repository-hook-command-shell.d.ts.map +1 -1
- package/dist/rules/require-repository-hook-command-shell.js +5 -1
- package/dist/rules/require-repository-hook-command-shell.js.map +1 -1
- package/dist/rules/require-repository-hooks-object.d.ts +1 -0
- package/dist/rules/require-repository-hooks-object.d.ts.map +1 -1
- package/dist/rules/require-repository-hooks-object.js +3 -0
- package/dist/rules/require-repository-hooks-object.js.map +1 -1
- package/dist/rules/require-repository-instructions-file.d.ts +1 -0
- package/dist/rules/require-repository-instructions-file.d.ts.map +1 -1
- package/dist/rules/require-repository-instructions-file.js +3 -0
- package/dist/rules/require-repository-instructions-file.js.map +1 -1
- package/dist/rules/require-skill-file-location.d.ts +1 -0
- package/dist/rules/require-skill-file-location.d.ts.map +1 -1
- package/dist/rules/require-skill-file-location.js +3 -0
- package/dist/rules/require-skill-file-location.js.map +1 -1
- package/dist/rules/require-skill-file-metadata.d.ts +1 -0
- package/dist/rules/require-skill-file-metadata.d.ts.map +1 -1
- package/dist/rules/require-skill-file-metadata.js +6 -2
- package/dist/rules/require-skill-file-metadata.js.map +1 -1
- package/dist/rules/require-skill-md-filename.d.ts +1 -0
- package/dist/rules/require-skill-md-filename.d.ts.map +1 -1
- package/dist/rules/require-skill-md-filename.js +3 -0
- package/dist/rules/require-skill-md-filename.js.map +1 -1
- package/dist/rules/require-skill-name-match-directory.d.ts +1 -0
- package/dist/rules/require-skill-name-match-directory.d.ts.map +1 -1
- package/dist/rules/require-skill-name-match-directory.js +5 -1
- package/dist/rules/require-skill-name-match-directory.js.map +1 -1
- package/dist/rules/require-string-repository-hook-env-values.d.ts +1 -0
- package/dist/rules/require-string-repository-hook-env-values.d.ts.map +1 -1
- package/dist/rules/require-string-repository-hook-env-values.js +6 -2
- package/dist/rules/require-string-repository-hook-env-values.js.map +1 -1
- package/dist/rules/require-valid-agent-argument-hint.d.ts +1 -0
- package/dist/rules/require-valid-agent-argument-hint.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-argument-hint.js +5 -1
- package/dist/rules/require-valid-agent-argument-hint.js.map +1 -1
- package/dist/rules/require-valid-agent-handoff-send.d.ts +1 -0
- package/dist/rules/require-valid-agent-handoff-send.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-handoff-send.js +7 -3
- package/dist/rules/require-valid-agent-handoff-send.js.map +1 -1
- package/dist/rules/require-valid-agent-handoffs.d.ts +1 -0
- package/dist/rules/require-valid-agent-handoffs.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-handoffs.js +5 -1
- package/dist/rules/require-valid-agent-handoffs.js.map +1 -1
- package/dist/rules/require-valid-agent-hook-events.d.ts +1 -0
- package/dist/rules/require-valid-agent-hook-events.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-hook-events.js +6 -2
- package/dist/rules/require-valid-agent-hook-events.js.map +1 -1
- package/dist/rules/require-valid-agent-hook-timeouts.d.ts +1 -0
- package/dist/rules/require-valid-agent-hook-timeouts.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-hook-timeouts.js +6 -2
- package/dist/rules/require-valid-agent-hook-timeouts.js.map +1 -1
- package/dist/rules/require-valid-agent-hooks.d.ts +1 -0
- package/dist/rules/require-valid-agent-hooks.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-hooks.js +31 -21
- package/dist/rules/require-valid-agent-hooks.js.map +1 -1
- package/dist/rules/require-valid-agent-invocation-controls.d.ts +1 -0
- package/dist/rules/require-valid-agent-invocation-controls.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-invocation-controls.js +7 -3
- package/dist/rules/require-valid-agent-invocation-controls.js.map +1 -1
- package/dist/rules/require-valid-agent-mcp-servers.d.ts +1 -0
- package/dist/rules/require-valid-agent-mcp-servers.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-mcp-servers.js +8 -4
- package/dist/rules/require-valid-agent-mcp-servers.js.map +1 -1
- package/dist/rules/require-valid-agent-model.d.ts +1 -0
- package/dist/rules/require-valid-agent-model.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-model.js +7 -3
- package/dist/rules/require-valid-agent-model.js.map +1 -1
- package/dist/rules/require-valid-agent-name.d.ts +1 -0
- package/dist/rules/require-valid-agent-name.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-name.js +5 -1
- package/dist/rules/require-valid-agent-name.js.map +1 -1
- package/dist/rules/require-valid-agent-subagents.d.ts +1 -0
- package/dist/rules/require-valid-agent-subagents.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-subagents.js +8 -4
- package/dist/rules/require-valid-agent-subagents.js.map +1 -1
- package/dist/rules/require-valid-agent-target.d.ts +1 -0
- package/dist/rules/require-valid-agent-target.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-target.js +6 -2
- package/dist/rules/require-valid-agent-target.js.map +1 -1
- package/dist/rules/require-valid-agent-tools.d.ts +1 -0
- package/dist/rules/require-valid-agent-tools.d.ts.map +1 -1
- package/dist/rules/require-valid-agent-tools.js +8 -4
- package/dist/rules/require-valid-agent-tools.js.map +1 -1
- package/dist/rules/require-valid-instructions-apply-to-globs.d.ts +1 -0
- package/dist/rules/require-valid-instructions-apply-to-globs.d.ts.map +1 -1
- package/dist/rules/require-valid-instructions-apply-to-globs.js +8 -3
- package/dist/rules/require-valid-instructions-apply-to-globs.js.map +1 -1
- package/dist/rules/require-valid-prompt-argument-hint.d.ts +1 -0
- package/dist/rules/require-valid-prompt-argument-hint.d.ts.map +1 -1
- package/dist/rules/require-valid-prompt-argument-hint.js +6 -3
- package/dist/rules/require-valid-prompt-argument-hint.js.map +1 -1
- package/dist/rules/require-valid-prompt-model.d.ts +1 -0
- package/dist/rules/require-valid-prompt-model.d.ts.map +1 -1
- package/dist/rules/require-valid-prompt-model.js +9 -5
- package/dist/rules/require-valid-prompt-model.js.map +1 -1
- package/dist/rules/require-valid-prompt-name.d.ts +1 -0
- package/dist/rules/require-valid-prompt-name.d.ts.map +1 -1
- package/dist/rules/require-valid-prompt-name.js +5 -1
- package/dist/rules/require-valid-prompt-name.js.map +1 -1
- package/dist/rules/require-valid-prompt-tools.d.ts +1 -0
- package/dist/rules/require-valid-prompt-tools.d.ts.map +1 -1
- package/dist/rules/require-valid-prompt-tools.js +8 -4
- package/dist/rules/require-valid-prompt-tools.js.map +1 -1
- package/dist/rules/require-valid-repository-hook-command-type.d.ts +1 -0
- package/dist/rules/require-valid-repository-hook-command-type.d.ts.map +1 -1
- package/dist/rules/require-valid-repository-hook-command-type.js +5 -1
- package/dist/rules/require-valid-repository-hook-command-type.js.map +1 -1
- package/dist/rules/require-valid-repository-hook-env.d.ts +1 -0
- package/dist/rules/require-valid-repository-hook-env.d.ts.map +1 -1
- package/dist/rules/require-valid-repository-hook-env.js +6 -2
- package/dist/rules/require-valid-repository-hook-env.js.map +1 -1
- package/dist/rules/require-valid-repository-hook-events.d.ts +1 -0
- package/dist/rules/require-valid-repository-hook-events.d.ts.map +1 -1
- package/dist/rules/require-valid-repository-hook-events.js +5 -1
- package/dist/rules/require-valid-repository-hook-events.js.map +1 -1
- package/dist/rules/require-valid-repository-hook-timeouts.d.ts +1 -0
- package/dist/rules/require-valid-repository-hook-timeouts.d.ts.map +1 -1
- package/dist/rules/require-valid-repository-hook-timeouts.js +7 -3
- package/dist/rules/require-valid-repository-hook-timeouts.js.map +1 -1
- package/dist/rules/require-valid-repository-hook-version.d.ts +1 -0
- package/dist/rules/require-valid-repository-hook-version.d.ts.map +1 -1
- package/dist/rules/require-valid-repository-hook-version.js +3 -0
- package/dist/rules/require-valid-repository-hook-version.js.map +1 -1
- package/dist/rules/require-valid-skill-directory-name.d.ts +1 -0
- package/dist/rules/require-valid-skill-directory-name.d.ts.map +1 -1
- package/dist/rules/require-valid-skill-directory-name.js +3 -0
- package/dist/rules/require-valid-skill-directory-name.js.map +1 -1
- package/dist/rules/require-valid-skill-license.d.ts +1 -0
- package/dist/rules/require-valid-skill-license.d.ts.map +1 -1
- package/dist/rules/require-valid-skill-license.js +5 -1
- package/dist/rules/require-valid-skill-license.js.map +1 -1
- package/dist/rules/require-valid-skill-name.d.ts +1 -0
- package/dist/rules/require-valid-skill-name.d.ts.map +1 -1
- package/dist/rules/require-valid-skill-name.js +5 -1
- package/dist/rules/require-valid-skill-name.js.map +1 -1
- package/package.json +65 -53
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Shared Copilot preset/config reference constants and type guards.
|
|
4
4
|
*/
|
|
5
|
-
/**
|
|
5
|
+
/** Stable preset names used across docs, README tables, and runtime configs. */
|
|
6
6
|
export declare const copilotConfigNames: readonly ["all", "minimal", "recommended", "strict"];
|
|
7
7
|
/** Metadata contract shared across preset wiring, docs, and README rendering. */
|
|
8
8
|
export type CopilotConfigMetadata = Readonly<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-config-references.d.ts","sourceRoot":"","sources":["../../src/_internal/copilot-config-references.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"copilot-config-references.d.ts","sourceRoot":"","sources":["../../src/_internal/copilot-config-references.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAKH,gFAAgF;AAChF,eAAO,MAAM,kBAAkB,sDAKrB,CAAC;AAEX,iFAAiF;AACjF,MAAM,MAAM,qBAAqB,GAAG,QAAQ,CAAC;IACzC,IAAI,EAAE,MAAM,CAAC;IACb,UAAU,EAAE,WAAW,iBAAiB,EAAE,CAAC;IAC3C,WAAW,EAAE,MAAM,CAAC;IACpB,oBAAoB,EAAE,OAAO,CAAC;CACjC,CAAC,CAAC;AAEH,8EAA8E;AAC9E,MAAM,MAAM,iBAAiB,GAAG,CAAC,OAAO,kBAAkB,CAAC,CAAC,MAAM,CAAC,CAAC;AAEpE,4DAA4D;AAC5D,KAAK,yBAAyB,GAAG,QAAQ,CAAC;IACtC,qBAAqB,EAAE,KAAK,CAAC;IAC7B,yBAAyB,EAAE,SAAS,CAAC;IACrC,6BAA6B,EAAE,aAAa,CAAC;IAC7C,wBAAwB,EAAE,QAAQ,CAAC;CACtC,CAAC,CAAC;AAEH,kEAAkE;AAClE,eAAO,MAAM,2BAA2B,EAAE,QAAQ,CAC9C,MAAM,CAAC,iBAAiB,EAAE,qBAAqB,CAAC,CA0BnD,CAAC;AAEF,6DAA6D;AAC7D,eAAO,MAAM,+BAA+B,EAAE,SAAS,iBAAiB,EAKvE,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,4BAA4B,EAAE,yBAK1C,CAAC;AAEF,uEAAuE;AACvE,MAAM,MAAM,sBAAsB,GAAG,MAAM,OAAO,4BAA4B,CAAC;AAE/E,mEAAmE;AACnE,eAAO,MAAM,wBAAwB,EAAE,CACnC,KAAK,EAAE,MAAM,KACZ,KAAK,IAAI,sBAGuC,CAAC"}
|
|
@@ -3,6 +3,8 @@
|
|
|
3
3
|
* Shared Copilot preset/config reference constants and type guards.
|
|
4
4
|
*/
|
|
5
5
|
/** Canonical flat-config preset keys exposed through `plugin.configs`. */
|
|
6
|
+
import { objectHasOwn } from "ts-extras";
|
|
7
|
+
/** Stable preset names used across docs, README tables, and runtime configs. */
|
|
6
8
|
export const copilotConfigNames = [
|
|
7
9
|
"all",
|
|
8
10
|
"minimal",
|
|
@@ -51,5 +53,5 @@ export const copilotConfigReferenceToName = {
|
|
|
51
53
|
"copilot.configs.strict": "strict",
|
|
52
54
|
};
|
|
53
55
|
/** Check whether a string is a supported docs preset reference. */
|
|
54
|
-
export const isCopilotConfigReference = (value) =>
|
|
56
|
+
export const isCopilotConfigReference = (value) => objectHasOwn(copilotConfigReferenceToName, value);
|
|
55
57
|
//# sourceMappingURL=copilot-config-references.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-config-references.js","sourceRoot":"","sources":["../../src/_internal/copilot-config-references.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,KAAK;IACL,SAAS;IACT,aAAa;IACb,QAAQ;CACF,CAAC;AAqBX,kEAAkE;AAClE,MAAM,CAAC,MAAM,2BAA2B,GAEpC;IACA,GAAG,EAAE;QACD,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,aAAa;QACzB,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;IACD,OAAO,EAAE;QACL,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;IACD,WAAW,EAAE;QACT,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,qBAAqB;QACjC,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;CACJ,CAAC;AAEF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IACzE,SAAS;IACT,aAAa;IACb,QAAQ;IACR,KAAK;CACR,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,4BAA4B,GAA8B;IACnE,qBAAqB,EAAE,KAAK;IAC5B,yBAAyB,EAAE,SAAS;IACpC,6BAA6B,EAAE,aAAa;IAC5C,wBAAwB,EAAE,QAAQ;CACrC,CAAC;AAKF,mEAAmE;AACnE,MAAM,CAAC,MAAM,wBAAwB,GAEE,CACnC,KAAK,EAC0B,EAAE,CACjC,
|
|
1
|
+
{"version":3,"file":"copilot-config-references.js","sourceRoot":"","sources":["../../src/_internal/copilot-config-references.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,0EAA0E;AAC1E,OAAO,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AAEzC,gFAAgF;AAChF,MAAM,CAAC,MAAM,kBAAkB,GAAG;IAC9B,KAAK;IACL,SAAS;IACT,aAAa;IACb,QAAQ;CACF,CAAC;AAqBX,kEAAkE;AAClE,MAAM,CAAC,MAAM,2BAA2B,GAEpC;IACA,GAAG,EAAE;QACD,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,aAAa;QACzB,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;IACD,OAAO,EAAE;QACL,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,iBAAiB;QAC7B,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;IACD,WAAW,EAAE;QACT,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,qBAAqB;QACjC,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;IACD,MAAM,EAAE;QACJ,IAAI,EAAE,IAAI;QACV,UAAU,EAAE,gBAAgB;QAC5B,WAAW,EAAE,CAAC;QACd,oBAAoB,EAAE,KAAK;KAC9B;CACJ,CAAC;AAEF,6DAA6D;AAC7D,MAAM,CAAC,MAAM,+BAA+B,GAAiC;IACzE,SAAS;IACT,aAAa;IACb,QAAQ;IACR,KAAK;CACR,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,4BAA4B,GAA8B;IACnE,qBAAqB,EAAE,KAAK;IAC5B,yBAAyB,EAAE,SAAS;IACpC,6BAA6B,EAAE,aAAa;IAC5C,wBAAwB,EAAE,QAAQ;CACrC,CAAC;AAKF,mEAAmE;AACnE,MAAM,CAAC,MAAM,wBAAwB,GAEE,CACnC,KAAK,EAC0B,EAAE,CACjC,YAAY,CAAC,4BAA4B,EAAE,KAAK,CAAC,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-file-kind.d.ts","sourceRoot":"","sources":["../../src/_internal/copilot-file-kind.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"copilot-file-kind.d.ts","sourceRoot":"","sources":["../../src/_internal/copilot-file-kind.ts"],"names":[],"mappings":"AAQA,2DAA2D;AAC3D,MAAM,MAAM,eAAe,GACrB,oBAAoB,GACpB,UAAU,GACV,cAAc,GACd,QAAQ,GACR,iBAAiB,GACjB,yBAAyB,GACzB,OAAO,CAAC;AAMd,wEAAwE;AACxE,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,KAAG,OAQ3D,CAAC;AAEF,0EAA0E;AAC1E,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,KAAG,OAQxD,CAAC;AAYF,+EAA+E;AAC/E,eAAO,MAAM,uBAAuB,GAAI,UAAU,MAAM,KAAG,OAO1D,CAAC;AAEF,yEAAyE;AACzE,eAAO,MAAM,eAAe,GAAI,UAAU,MAAM,KAAG,OAQlD,CAAC;AAEF,2EAA2E;AAC3E,eAAO,MAAM,wBAAwB,GAAI,UAAU,MAAM,KAAG,OAQ3D,CAAC;AAEF,kFAAkF;AAClF,eAAO,MAAM,gCAAgC,GAAI,UAAU,MAAM,KAAG,OASnE,CAAC;AAQF,mFAAmF;AACnF,eAAO,MAAM,kBAAkB,GAC3B,UAAU,MAAM,KACjB,eAAe,GAAG,IAsCpB,CAAC;AAEF,8DAA8D;AAC9D,eAAO,MAAM,kBAAkB,GAAI,UAAU,MAAM,KAAG,MA2CrD,CAAC;AAEF,mEAAmE;AACnE,eAAO,MAAM,8BAA8B,GACvC,UAAU,MAAM,KACjB,SAAS,MAAM,EAYjB,CAAC;AAEF,sEAAsE;AACtE,eAAO,MAAM,6BAA6B,GAAI,UAAU,MAAM,KAAG,MAM5D,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
+
import { arrayFirst, arrayJoin, stringSplit } from "ts-extras";
|
|
7
8
|
/** Normalize a path to slash-separated form for pattern checks. */
|
|
8
9
|
const normalizeFilePath = (filePath) => path.resolve(filePath).replaceAll("\\", "/");
|
|
9
10
|
/** Check whether a path points to a legacy workspace chat mode file. */
|
|
@@ -86,11 +87,11 @@ export const getCopilotFileKind = (filePath) => {
|
|
|
86
87
|
/** Discover the repository root for the current file path. */
|
|
87
88
|
export const findRepositoryRoot = (filePath) => {
|
|
88
89
|
const normalizedFilePath = path.resolve(filePath);
|
|
89
|
-
const pathSegments = normalizeFilePath(normalizedFilePath)
|
|
90
|
+
const pathSegments = stringSplit(normalizeFilePath(normalizedFilePath), "/");
|
|
90
91
|
const githubDirectoryIndex = pathSegments.lastIndexOf(".github");
|
|
91
92
|
if (githubDirectoryIndex > 0) {
|
|
92
93
|
const rootSegments = pathSegments.slice(0, githubDirectoryIndex);
|
|
93
|
-
const candidateRoot = rootSegments
|
|
94
|
+
const candidateRoot = arrayJoin(rootSegments, path.sep);
|
|
94
95
|
if (candidateRoot.length > 0) {
|
|
95
96
|
return candidateRoot;
|
|
96
97
|
}
|
|
@@ -121,6 +122,6 @@ export const getRepositoryInstructionsPaths = (filePath) => {
|
|
|
121
122
|
];
|
|
122
123
|
};
|
|
123
124
|
/** Resolve the canonical repository custom instructions file path. */
|
|
124
|
-
export const getRepositoryInstructionsPath = (filePath) => getRepositoryInstructionsPaths(filePath)
|
|
125
|
+
export const getRepositoryInstructionsPath = (filePath) => arrayFirst(getRepositoryInstructionsPaths(filePath)) ??
|
|
125
126
|
path.join(findRepositoryRoot(filePath), ".github", "copilot-instructions.md");
|
|
126
127
|
//# sourceMappingURL=copilot-file-kind.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"copilot-file-kind.js","sourceRoot":"","sources":["../../src/_internal/copilot-file-kind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;
|
|
1
|
+
{"version":3,"file":"copilot-file-kind.js","sourceRoot":"","sources":["../../src/_internal/copilot-file-kind.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,WAAW,EAAE,MAAM,WAAW,CAAC;AAY/D,mEAAmE;AACnE,MAAM,iBAAiB,GAAG,CAAC,QAAgB,EAAU,EAAE,CACnD,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC,UAAU,CAAC,IAAI,EAAE,GAAG,CAAC,CAAC;AAEjD,wEAAwE;AACxE,MAAM,CAAC,MAAM,wBAAwB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAClE,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,QAAQ,GAAG,IAAI,CAAC,KAAK,CAAC,QAAQ,CAAC,kBAAkB,CAAC,CAAC;IAEzD,OAAO,CACH,kBAAkB,CAAC,QAAQ,CAAC,qBAAqB,CAAC;QAClD,QAAQ,CAAC,QAAQ,CAAC,cAAc,CAAC,CACpC,CAAC;AACN,CAAC,CAAC;AAEF,0EAA0E;AAC1E,MAAM,CAAC,MAAM,qBAAqB,GAAG,CAAC,QAAgB,EAAW,EAAE;IAC/D,MAAM,kBAAkB,GAAG,iBAAiB,CAAC,QAAQ,CAAC,CAAC;IACvD,MAAM,QAAQ,GA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
|
|
6
|
+
import type { UnknownArray } from "type-fest";
|
|
6
7
|
import { ESLintUtils } from "@typescript-eslint/utils";
|
|
7
8
|
import type { CopilotConfigName, CopilotConfigReference } from "./copilot-config-references.js";
|
|
8
9
|
/** Copilot-specific metadata extensions stored in `meta.docs`. */
|
|
@@ -20,7 +21,7 @@ export type CopilotRuleDocs = Readonly<{
|
|
|
20
21
|
/** Public runtime rule module shape emitted by this plugin. */
|
|
21
22
|
export type CopilotRuleModule = Readonly<{
|
|
22
23
|
name: string;
|
|
23
|
-
}> & TSESLint.RuleModule<string,
|
|
24
|
+
}> & TSESLint.RuleModule<string, Readonly<UnknownArray>, CopilotRuleDocs>;
|
|
24
25
|
type BaseRuleCreator = ReturnType<typeof ESLintUtils.RuleCreator<CopilotRuleInputDocs>>;
|
|
25
26
|
/** Authored docs metadata accepted by individual rule modules. */
|
|
26
27
|
type CopilotRuleInputDocs = Readonly<{
|
|
@@ -29,11 +30,12 @@ type CopilotRuleInputDocs = Readonly<{
|
|
|
29
30
|
frozen: boolean;
|
|
30
31
|
recommended: boolean;
|
|
31
32
|
requiresTypeChecking: boolean;
|
|
33
|
+
url: string;
|
|
32
34
|
}>;
|
|
33
35
|
declare const baseRuleCreator: BaseRuleCreator;
|
|
34
36
|
/**
|
|
35
37
|
* Shared rule creator that injects canonical docs URLs and stable catalog ids.
|
|
36
38
|
*/
|
|
37
|
-
export declare const createCopilotRule: <Options extends
|
|
39
|
+
export declare const createCopilotRule: <Options extends Readonly<UnknownArray>, MessageIds extends string>(ruleDefinition: Parameters<typeof baseRuleCreator<Options, MessageIds>>[0]) => CopilotRuleModule;
|
|
38
40
|
export {};
|
|
39
41
|
//# sourceMappingURL=create-copilot-rule.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-copilot-rule.d.ts","sourceRoot":"","sources":["../../src/_internal/create-copilot-rule.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,QAAQ,EAAE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B,WAAW,EAAE,OAAO,CAAC;IACrB,oBAAoB,EAAE,OAAO,CAAC;IAC9B,GAAG,EAAE,MAAM,CAAC;CACf,CAAC,CAAC;AAEH,QAAA,MAAM,eAAe,EAAE,eAC6C,CAAC;AA8CrE;;GAEG;AACH,eAAO,MAAM,iBAAiB,GAC1B,OAAO,SAAS,QAAQ,CAAC,YAAY,CAAC,EACtC,UAAU,SAAS,MAAM,EAEzB,gBAAgB,UAAU,CAAC,OAAO,eAAe,CAAC,OAAO,EAAE,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,KAC3E,iBAsBF,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"create-copilot-rule.js","sourceRoot":"","sources":["../../src/_internal/create-copilot-rule.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"create-copilot-rule.js","sourceRoot":"","sources":["../../src/_internal/create-copilot-rule.ts"],"names":[],"mappings":"AAOA,OAAO,EAAE,WAAW,EAAE,MAAM,0BAA0B,CAAC;AAOvD,OAAO,EAAE,8BAA8B,EAAE,MAAM,mBAAmB,CAAC;AACnE,OAAO,EAAE,iBAAiB,EAAE,MAAM,oBAAoB,CAAC;AAmCvD,MAAM,eAAe,GACjB,WAAW,CAAC,WAAW,CAAuB,iBAAiB,CAAC,CAAC;AAErE,MAAM,iCAAiC,GAAG,CACtC,SAAiC,EAChB,EAAE;IACnB,QAAQ,SAAS,EAAE,CAAC;QAChB,KAAK,qBAAqB,CAAC,CAAC,CAAC;YACzB,OAAO,KAAK,CAAC;QACjB,CAAC;QAED,KAAK,yBAAyB,CAAC,CAAC,CAAC;YAC7B,OAAO,SAAS,CAAC;QACrB,CAAC;QAED,KAAK,6BAA6B,CAAC,CAAC,CAAC;YACjC,OAAO,aAAa,CAAC;QACzB,CAAC;QAED,KAAK,wBAAwB,CAAC,CAAC,CAAC;YAC5B,OAAO,QAAQ,CAAC;QACpB,CAAC;QAED,OAAO,CAAC,CAAC,CAAC;YACN,MAA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-system.d.ts","sourceRoot":"","sources":["../../src/_internal/file-system.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"file-system.d.ts","sourceRoot":"","sources":["../../src/_internal/file-system.ts"],"names":[],"mappings":"AAWA,yDAAyD;AACzD,eAAO,MAAM,qBAAqB,GAAI,UAAU,MAAM,KAAG,MACT,CAAC;AAEjD,+EAA+E;AAC/E,eAAO,MAAM,UAAU,GAAI,UAAU,MAAM,KAAG,OACnB,CAAC;AAE5B,kFAAkF;AAClF,eAAO,MAAM,yBAAyB,GAAI,OAAO,MAAM,KAAG,MAYzD,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,qBAAqB,GAAI,OAAO,MAAM,KAAG,OACT,CAAC;AAE9C,iFAAiF;AACjF,eAAO,MAAM,YAAY,GAAI,OAAO,MAAM,KAAG,OACsB,CAAC;AAEpE,kFAAkF;AAClF,eAAO,MAAM,0BAA0B,GAAI,OAAO,MAAM,KAAG,OAmB1D,CAAC;AAEF,6EAA6E;AAC7E,eAAO,MAAM,uBAAuB,GAAI,OAAO,MAAM,KAAG,OASvD,CAAC;AAEF,wEAAwE;AACxE,eAAO,MAAM,4BAA4B,GACrC,iBAAiB,MAAM,EACvB,cAAc,MAAM,KACrB,MAIE,CAAC;AAEN,qDAAqD;AACrD,eAAO,MAAM,6BAA6B,GACtC,oBAAoB,MAAM,EAC1B,cAAc,MAAM,KACrB,MAC0E,CAAC;AAwC9E,+DAA+D;AAC/D,eAAO,MAAM,oBAAoB,GAC7B,eAAe,MAAM,EACrB,YAAY,CAAC,gBAAgB,EAAE,MAAM,KAAK,OAAO,KAClD,SAAS,MAAM,EAyBjB,CAAC"}
|
|
@@ -4,6 +4,7 @@
|
|
|
4
4
|
*/
|
|
5
5
|
import * as fs from "node:fs";
|
|
6
6
|
import * as path from "node:path";
|
|
7
|
+
import { isDefined, isEmpty } from "ts-extras";
|
|
7
8
|
const WINDOWS_ABSOLUTE_PATH_PATTERN = /^[A-Za-z]:[/\\]/u;
|
|
8
9
|
const URI_SCHEME_PATTERN = /^[A-Za-z][+\-.0-9A-Za-z]*:/u;
|
|
9
10
|
/** Normalize a path to absolute slash-separated form. */
|
|
@@ -15,7 +16,7 @@ export const stripPathFragmentAndQuery = (value) => {
|
|
|
15
16
|
const queryIndex = value.indexOf("?");
|
|
16
17
|
const fragmentIndex = value.indexOf("#");
|
|
17
18
|
const cutIndexCandidates = [queryIndex, fragmentIndex].filter((index) => index >= 0);
|
|
18
|
-
if (cutIndexCandidates
|
|
19
|
+
if (isEmpty(cutIndexCandidates)) {
|
|
19
20
|
return value;
|
|
20
21
|
}
|
|
21
22
|
return value.slice(0, Math.min(...cutIndexCandidates));
|
|
@@ -52,6 +53,31 @@ export const isRelativeWorkspacePath = (value) => {
|
|
|
52
53
|
export const resolveRelativeWorkspacePath = (currentFilePath, relativePath) => path.resolve(path.dirname(currentFilePath), stripPathFragmentAndQuery(relativePath));
|
|
53
54
|
/** Resolve a repository-root-relative path token. */
|
|
54
55
|
export const resolveRepositoryRelativePath = (repositoryRootPath, relativePath) => path.resolve(repositoryRootPath, stripPathFragmentAndQuery(relativePath));
|
|
56
|
+
/** Visit one directory and return discovered child files and subdirectories. */
|
|
57
|
+
const collectDirectoryFiles = (currentDirectory, predicate) => {
|
|
58
|
+
const discoveredFiles = [];
|
|
59
|
+
const pendingDirectories = [];
|
|
60
|
+
for (const entry of fs.readdirSync(currentDirectory, {
|
|
61
|
+
withFileTypes: true,
|
|
62
|
+
})) {
|
|
63
|
+
const absoluteEntryPath = path.join(currentDirectory, entry.name);
|
|
64
|
+
if (entry.isDirectory()) {
|
|
65
|
+
pendingDirectories.push(absoluteEntryPath);
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
if (!entry.isFile()) {
|
|
69
|
+
continue;
|
|
70
|
+
}
|
|
71
|
+
if (isDefined(predicate) && !predicate(absoluteEntryPath)) {
|
|
72
|
+
continue;
|
|
73
|
+
}
|
|
74
|
+
discoveredFiles.push(absoluteEntryPath);
|
|
75
|
+
}
|
|
76
|
+
return {
|
|
77
|
+
discoveredFiles,
|
|
78
|
+
pendingDirectories,
|
|
79
|
+
};
|
|
80
|
+
};
|
|
55
81
|
/** Recursively list files under a directory when it exists. */
|
|
56
82
|
export const listFilesRecursively = (directoryPath, predicate) => {
|
|
57
83
|
if (!pathExists(directoryPath)) {
|
|
@@ -61,25 +87,12 @@ export const listFilesRecursively = (directoryPath, predicate) => {
|
|
|
61
87
|
const pendingDirectories = [directoryPath];
|
|
62
88
|
while (pendingDirectories.length > 0) {
|
|
63
89
|
const currentDirectory = pendingDirectories.pop();
|
|
64
|
-
if (currentDirectory
|
|
90
|
+
if (!isDefined(currentDirectory)) {
|
|
65
91
|
continue;
|
|
66
92
|
}
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
const absoluteEntryPath = path.join(currentDirectory, entry.name);
|
|
71
|
-
if (entry.isDirectory()) {
|
|
72
|
-
pendingDirectories.push(absoluteEntryPath);
|
|
73
|
-
continue;
|
|
74
|
-
}
|
|
75
|
-
if (!entry.isFile()) {
|
|
76
|
-
continue;
|
|
77
|
-
}
|
|
78
|
-
if (predicate !== undefined && !predicate(absoluteEntryPath)) {
|
|
79
|
-
continue;
|
|
80
|
-
}
|
|
81
|
-
discoveredFiles.push(absoluteEntryPath);
|
|
82
|
-
}
|
|
93
|
+
const currentDirectoryContents = collectDirectoryFiles(currentDirectory, predicate);
|
|
94
|
+
pendingDirectories.push(...currentDirectoryContents.pendingDirectories);
|
|
95
|
+
discoveredFiles.push(...currentDirectoryContents.discoveredFiles);
|
|
83
96
|
}
|
|
84
97
|
return discoveredFiles.toSorted((left, right) => left.localeCompare(right));
|
|
85
98
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"file-system.js","sourceRoot":"","sources":["../../src/_internal/file-system.ts"],"names":[],"mappings":"AAAA;;;GAGG;AACH,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KA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,MAAM,oBAAoB,GAAG,CAChC,aAAqB,EACrB,SAAiD,EAChC,EAAE;IACnB,IAAI,CAAC,UAAU,CAAC,aAAa,CAAC,EAAE,CAAC;QAC7B,OAAO,EAAE,CAAC;IACd,CAAC;IAED,MAAM,eAAe,GAAa,EAAE,CAAC;IACrC,MAAM,kBAAkB,GAAG,CAAC,aAAa,CAAC,CAAC;IAE3C,OAAO,kBAAkB,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;QACnC,MAAM,gBAAgB,GAAG,kBAAkB,CAAC,GAAG,EAAE,CAAC;QAElD,IAAI,CAAC,SAAS,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC/B,SAAS;QACb,CAAC;QAED,MAAM,wBAAwB,GAAG,qBAAqB,CAClD,gBAAgB,EAChB,SAAS,CACZ,CAAC;QAEF,kBAAkB,CAAC,IAAI,CAAC,GAAG,wBAAwB,CAAC,kBAAkB,CAAC,CAAC;QACxE,eAAe,CAAC,IAAI,CAAC,GAAG,wBAAwB,CAAC,eAAe,CAAC,CAAC;IACtE,CAAC;IAED,OAAO,eAAe,CAAC,QAAQ,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,IAAI,CAAC,aAAa,CAAC,KAAK,CAAC,CAAC,CAAC;AAChF,CAAC,CAAC"}
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Lightweight Markdown frontmatter helpers for Copilot customization files.
|
|
4
4
|
*/
|
|
5
|
-
/** Parsed frontmatter
|
|
5
|
+
/** Parsed frontmatter document extracted from the top of a Markdown file. */
|
|
6
6
|
export type FrontmatterDocument = Readonly<{
|
|
7
7
|
body: string;
|
|
8
8
|
content: string;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"frontmatter.d.ts","sourceRoot":"","sources":["../../src/_internal/frontmatter.ts"],"names":[],"mappings":"AAAA;;;GAGG;
|
|
1
|
+
{"version":3,"file":"frontmatter.d.ts","sourceRoot":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,SAAS,0BAA0B,EAAE,GAAG,SAgB1C,CAAC;AAEF,+EAA+E;AAC/E,eAAO,MAAM,8BAA8B,GACvC,UAAU,mBAAmB,EAC7B,KAAK,MAAM,KACZ,6BAA6B,GAAG,SAYlC,CAAC;AAEF,iFAAiF;AACjF,eAAO,MAAM,yBAAyB,GAAI,MAAM,MAAM,KAAG,MACvB,CAAC"}
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
* @packageDocumentation
|
|
3
3
|
* Lightweight Markdown frontmatter helpers for Copilot customization files.
|
|
4
4
|
*/
|
|
5
|
+
/** Parsed frontmatter bundle extracted from the start of a Markdown document. */
|
|
6
|
+
import { isDefined, stringSplit } from "ts-extras";
|
|
5
7
|
/** Determine whether a character is an ASCII letter. */
|
|
6
8
|
const isAsciiLetter = (character) => (character >= "A" && character <= "Z") ||
|
|
7
9
|
(character >= "a" && character <= "z");
|
|
@@ -137,12 +139,15 @@ function normalizeScalarValue(value) {
|
|
|
137
139
|
return stripQuotes(value.trim()).trim();
|
|
138
140
|
}
|
|
139
141
|
/** Assign a parsed YAML `key: value` pair into an object-list entry. */
|
|
140
|
-
const
|
|
142
|
+
const withObjectEntryField = (target, source) => {
|
|
141
143
|
const property = parseFieldLine(source.trim());
|
|
142
144
|
if (property === null) {
|
|
143
|
-
return;
|
|
145
|
+
return { ...target };
|
|
144
146
|
}
|
|
145
|
-
|
|
147
|
+
return {
|
|
148
|
+
...target,
|
|
149
|
+
[property.key]: normalizeScalarValue(property.value),
|
|
150
|
+
};
|
|
146
151
|
};
|
|
147
152
|
/** Parse a one-line YAML flow sequence such as `["a", "b"]`. */
|
|
148
153
|
const parseInlineList = (value) => {
|
|
@@ -154,8 +159,7 @@ const parseInlineList = (value) => {
|
|
|
154
159
|
if (innerValue.length === 0) {
|
|
155
160
|
return [];
|
|
156
161
|
}
|
|
157
|
-
return innerValue
|
|
158
|
-
.split(",")
|
|
162
|
+
return stringSplit(innerValue, ",")
|
|
159
163
|
.map((item) => normalizeScalarValue(item))
|
|
160
164
|
.filter((item) => item.length > 0);
|
|
161
165
|
};
|
|
@@ -171,7 +175,7 @@ const parseBlockList = (lines) => lines
|
|
|
171
175
|
.filter((value) => value.length > 0);
|
|
172
176
|
/** Parse the supported subset of YAML frontmatter fields used by Copilot. */
|
|
173
177
|
const parseFrontmatterFields = (content) => {
|
|
174
|
-
const lines = content.replaceAll("\r\n", "\n")
|
|
178
|
+
const lines = stringSplit(content.replaceAll("\r\n", "\n"), "\n");
|
|
175
179
|
const fields = new Map();
|
|
176
180
|
let index = 0;
|
|
177
181
|
while (index < lines.length) {
|
|
@@ -261,137 +265,165 @@ export const getFrontmatterList = (document, key) => {
|
|
|
261
265
|
};
|
|
262
266
|
/** Determine whether a field exists but is empty or unparsable for our subset. */
|
|
263
267
|
export const hasFrontmatterField = (document, key) => document.fields.has(key);
|
|
264
|
-
/** Read
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
|
|
268
|
-
|
|
269
|
-
|
|
268
|
+
/** Read normalized frontmatter content lines from a parsed document. */
|
|
269
|
+
const getFrontmatterContentLines = (document) => stringSplit(document.content.replaceAll("\r\n", "\n"), "\n");
|
|
270
|
+
/**
|
|
271
|
+
* Find a top-level frontmatter field block and return its scalar text plus
|
|
272
|
+
* lines.
|
|
273
|
+
*/
|
|
274
|
+
const getTopLevelFrontmatterFieldBlock = (document, key) => {
|
|
275
|
+
const lines = getFrontmatterContentLines(document);
|
|
276
|
+
for (const [index, currentLine] of lines.entries()) {
|
|
270
277
|
if (currentLine.startsWith(" ") || currentLine.startsWith("\t")) {
|
|
271
|
-
index += 1;
|
|
272
278
|
continue;
|
|
273
279
|
}
|
|
274
280
|
const field = parseFieldLine(currentLine.trimEnd());
|
|
275
|
-
if (field
|
|
276
|
-
index += 1;
|
|
281
|
+
if (field?.key !== key) {
|
|
277
282
|
continue;
|
|
278
283
|
}
|
|
279
|
-
|
|
280
|
-
index
|
|
281
|
-
|
|
282
|
-
}
|
|
283
|
-
const rawValue = field.value.trim();
|
|
284
|
-
if (rawValue === "[]") {
|
|
285
|
-
return [];
|
|
286
|
-
}
|
|
287
|
-
if (rawValue.length > 0) {
|
|
288
|
-
return undefined;
|
|
289
|
-
}
|
|
290
|
-
const { blockLines } = collectIndentedBlockLines(lines, index + 1);
|
|
291
|
-
const entries = [];
|
|
292
|
-
let currentEntry = null;
|
|
293
|
-
for (const blockLine of blockLines) {
|
|
294
|
-
const trimmedLine = blockLine.trim();
|
|
295
|
-
if (trimmedLine.startsWith("-")) {
|
|
296
|
-
if (currentEntry !== null) {
|
|
297
|
-
entries.push(currentEntry);
|
|
298
|
-
}
|
|
299
|
-
currentEntry = {};
|
|
300
|
-
const inlineProperty = trimmedLine.slice(1).trim();
|
|
301
|
-
if (inlineProperty.length > 0) {
|
|
302
|
-
setObjectEntryField(currentEntry, inlineProperty);
|
|
303
|
-
}
|
|
304
|
-
continue;
|
|
305
|
-
}
|
|
306
|
-
if (currentEntry === null) {
|
|
307
|
-
continue;
|
|
308
|
-
}
|
|
309
|
-
setObjectEntryField(currentEntry, trimmedLine);
|
|
310
|
-
}
|
|
311
|
-
if (currentEntry !== null) {
|
|
312
|
-
entries.push(currentEntry);
|
|
313
|
-
}
|
|
314
|
-
return entries;
|
|
284
|
+
return {
|
|
285
|
+
blockLines: collectIndentedBlockLines(lines, index + 1).blockLines,
|
|
286
|
+
rawValue: field.value.trim(),
|
|
287
|
+
};
|
|
315
288
|
}
|
|
316
289
|
return undefined;
|
|
317
290
|
};
|
|
318
|
-
/**
|
|
319
|
-
|
|
320
|
-
const
|
|
321
|
-
let
|
|
322
|
-
|
|
323
|
-
const
|
|
324
|
-
if (
|
|
325
|
-
|
|
291
|
+
/** Parse a YAML object-list block such as `handoffs:` into entry objects. */
|
|
292
|
+
const parseFrontmatterObjectListEntries = (blockLines) => {
|
|
293
|
+
const entries = [];
|
|
294
|
+
let currentEntry = null;
|
|
295
|
+
for (const blockLine of blockLines) {
|
|
296
|
+
const trimmedLine = blockLine.trim();
|
|
297
|
+
if (trimmedLine.startsWith("-")) {
|
|
298
|
+
if (currentEntry !== null) {
|
|
299
|
+
entries.push(currentEntry);
|
|
300
|
+
}
|
|
301
|
+
const inlineProperty = trimmedLine.slice(1).trim();
|
|
302
|
+
currentEntry =
|
|
303
|
+
inlineProperty.length === 0
|
|
304
|
+
? {}
|
|
305
|
+
: withObjectEntryField({}, inlineProperty);
|
|
326
306
|
continue;
|
|
327
307
|
}
|
|
328
|
-
|
|
329
|
-
if (field === null) {
|
|
330
|
-
index += 1;
|
|
308
|
+
if (currentEntry === null) {
|
|
331
309
|
continue;
|
|
332
310
|
}
|
|
333
|
-
|
|
334
|
-
|
|
311
|
+
currentEntry = withObjectEntryField(currentEntry, trimmedLine);
|
|
312
|
+
}
|
|
313
|
+
if (currentEntry !== null) {
|
|
314
|
+
entries.push(currentEntry);
|
|
315
|
+
}
|
|
316
|
+
return entries;
|
|
317
|
+
};
|
|
318
|
+
/** Flush the current grouped entry into its active group when present. */
|
|
319
|
+
const flushGroupedObjectListEntry = (groups, state) => {
|
|
320
|
+
if (state.currentGroupName === null || state.currentEntry === null) {
|
|
321
|
+
return state;
|
|
322
|
+
}
|
|
323
|
+
const groupEntries = groups.get(state.currentGroupName) ?? [];
|
|
324
|
+
groupEntries.push(state.currentEntry);
|
|
325
|
+
groups.set(state.currentGroupName, groupEntries);
|
|
326
|
+
return {
|
|
327
|
+
...state,
|
|
328
|
+
currentEntry: null,
|
|
329
|
+
};
|
|
330
|
+
};
|
|
331
|
+
/** Determine whether a line starts a named grouped object-list section. */
|
|
332
|
+
const isGroupedObjectListHeaderLine = (indentationWidth, trimmedLine) => !trimmedLine.startsWith("-") && indentationWidth <= 4;
|
|
333
|
+
/** Build a new grouped object-list entry from one `- key: value` line. */
|
|
334
|
+
const createGroupedObjectListEntry = (trimmedLine) => {
|
|
335
|
+
const inlineProperty = trimmedLine.slice(1).trim();
|
|
336
|
+
return inlineProperty.length === 0
|
|
337
|
+
? {}
|
|
338
|
+
: withObjectEntryField({}, inlineProperty);
|
|
339
|
+
};
|
|
340
|
+
/** Switch the parser state to a new grouped object-list section. */
|
|
341
|
+
const handleGroupedObjectListHeaderLine = (groups, state, trimmedLine) => {
|
|
342
|
+
const flushedState = flushGroupedObjectListEntry(groups, state);
|
|
343
|
+
const groupField = parseFieldLine(trimmedLine);
|
|
344
|
+
if (groupField === null) {
|
|
345
|
+
return {
|
|
346
|
+
...flushedState,
|
|
347
|
+
currentGroupName: null,
|
|
348
|
+
};
|
|
349
|
+
}
|
|
350
|
+
groups.set(groupField.key, groups.get(groupField.key) ?? []);
|
|
351
|
+
return {
|
|
352
|
+
...flushedState,
|
|
353
|
+
currentGroupName: groupField.key,
|
|
354
|
+
};
|
|
355
|
+
};
|
|
356
|
+
/** Start a new entry within the current grouped object-list section. */
|
|
357
|
+
const handleGroupedObjectListEntryStartLine = (groups, state, trimmedLine) => {
|
|
358
|
+
const flushedState = flushGroupedObjectListEntry(groups, state);
|
|
359
|
+
if (flushedState.currentGroupName === null) {
|
|
360
|
+
return flushedState;
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
...flushedState,
|
|
364
|
+
currentEntry: createGroupedObjectListEntry(trimmedLine),
|
|
365
|
+
};
|
|
366
|
+
};
|
|
367
|
+
/** Append one property line to the current grouped object-list entry. */
|
|
368
|
+
const handleGroupedObjectListPropertyLine = (state, trimmedLine) => {
|
|
369
|
+
if (state.currentEntry === null) {
|
|
370
|
+
return state;
|
|
371
|
+
}
|
|
372
|
+
return {
|
|
373
|
+
...state,
|
|
374
|
+
currentEntry: withObjectEntryField(state.currentEntry, trimmedLine),
|
|
375
|
+
};
|
|
376
|
+
};
|
|
377
|
+
/** Parse grouped YAML object-list mappings such as `hooks: event: - ...`. */
|
|
378
|
+
const parseFrontmatterObjectListGroups = (blockLines) => {
|
|
379
|
+
const groups = new Map();
|
|
380
|
+
let state = {
|
|
381
|
+
currentEntry: null,
|
|
382
|
+
currentGroupName: null,
|
|
383
|
+
};
|
|
384
|
+
for (const blockLine of blockLines) {
|
|
385
|
+
const indentationWidth = getIndentationWidth(blockLine);
|
|
386
|
+
const trimmedLine = blockLine.trim();
|
|
387
|
+
if (trimmedLine.length === 0) {
|
|
335
388
|
continue;
|
|
336
389
|
}
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
390
|
+
if (isGroupedObjectListHeaderLine(indentationWidth, trimmedLine)) {
|
|
391
|
+
state = handleGroupedObjectListHeaderLine(groups, state, trimmedLine);
|
|
392
|
+
continue;
|
|
340
393
|
}
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
let currentEntry = null;
|
|
345
|
-
const flushCurrentEntry = () => {
|
|
346
|
-
if (currentGroupName === null || currentEntry === null) {
|
|
347
|
-
return;
|
|
348
|
-
}
|
|
349
|
-
const groupEntries = groups.get(currentGroupName) ?? [];
|
|
350
|
-
groupEntries.push(currentEntry);
|
|
351
|
-
groups.set(currentGroupName, groupEntries);
|
|
352
|
-
currentEntry = null;
|
|
353
|
-
};
|
|
354
|
-
for (const blockLine of blockLines) {
|
|
355
|
-
const indentationWidth = getIndentationWidth(blockLine);
|
|
356
|
-
const trimmedLine = blockLine.trim();
|
|
357
|
-
if (trimmedLine.length === 0) {
|
|
358
|
-
continue;
|
|
359
|
-
}
|
|
360
|
-
if (!trimmedLine.startsWith("-") && indentationWidth <= 4) {
|
|
361
|
-
flushCurrentEntry();
|
|
362
|
-
const groupField = parseFieldLine(trimmedLine);
|
|
363
|
-
if (groupField === null) {
|
|
364
|
-
currentGroupName = null;
|
|
365
|
-
continue;
|
|
366
|
-
}
|
|
367
|
-
currentGroupName = groupField.key;
|
|
368
|
-
if (currentGroupName !== null &&
|
|
369
|
-
!groups.has(currentGroupName)) {
|
|
370
|
-
groups.set(currentGroupName, []);
|
|
371
|
-
}
|
|
372
|
-
continue;
|
|
373
|
-
}
|
|
374
|
-
if (trimmedLine.startsWith("-")) {
|
|
375
|
-
flushCurrentEntry();
|
|
376
|
-
if (currentGroupName === null) {
|
|
377
|
-
continue;
|
|
378
|
-
}
|
|
379
|
-
currentEntry = {};
|
|
380
|
-
const inlineProperty = trimmedLine.slice(1).trim();
|
|
381
|
-
if (inlineProperty.length > 0) {
|
|
382
|
-
setObjectEntryField(currentEntry, inlineProperty);
|
|
383
|
-
}
|
|
384
|
-
continue;
|
|
385
|
-
}
|
|
386
|
-
if (currentEntry === null) {
|
|
387
|
-
continue;
|
|
388
|
-
}
|
|
389
|
-
setObjectEntryField(currentEntry, trimmedLine);
|
|
394
|
+
if (trimmedLine.startsWith("-")) {
|
|
395
|
+
state = handleGroupedObjectListEntryStartLine(groups, state, trimmedLine);
|
|
396
|
+
continue;
|
|
390
397
|
}
|
|
391
|
-
|
|
392
|
-
return groups;
|
|
398
|
+
state = handleGroupedObjectListPropertyLine(state, trimmedLine);
|
|
393
399
|
}
|
|
394
|
-
|
|
400
|
+
flushGroupedObjectListEntry(groups, state);
|
|
401
|
+
return groups;
|
|
402
|
+
};
|
|
403
|
+
/** Read a supported YAML object-list block such as `handoffs:` entries. */
|
|
404
|
+
export const getFrontmatterObjectList = (document, key) => {
|
|
405
|
+
const fieldBlock = getTopLevelFrontmatterFieldBlock(document, key);
|
|
406
|
+
if (!isDefined(fieldBlock)) {
|
|
407
|
+
return undefined;
|
|
408
|
+
}
|
|
409
|
+
if (fieldBlock.rawValue === "[]") {
|
|
410
|
+
return [];
|
|
411
|
+
}
|
|
412
|
+
if (fieldBlock.rawValue.length > 0) {
|
|
413
|
+
return undefined;
|
|
414
|
+
}
|
|
415
|
+
return parseFrontmatterObjectListEntries(fieldBlock.blockLines);
|
|
416
|
+
};
|
|
417
|
+
/** Read nested YAML mappings of object lists such as `hooks: Event: - ...`. */
|
|
418
|
+
export const getFrontmatterObjectListGroups = (document, key) => {
|
|
419
|
+
const fieldBlock = getTopLevelFrontmatterFieldBlock(document, key);
|
|
420
|
+
if (!isDefined(fieldBlock)) {
|
|
421
|
+
return undefined;
|
|
422
|
+
}
|
|
423
|
+
if (fieldBlock.rawValue.length > 0) {
|
|
424
|
+
return undefined;
|
|
425
|
+
}
|
|
426
|
+
return parseFrontmatterObjectListGroups(fieldBlock.blockLines);
|
|
395
427
|
};
|
|
396
428
|
/** Remove HTML comments before checking whether Markdown body content exists. */
|
|
397
429
|
export const getMeaningfulMarkdownBody = (text) => stripHtmlComments(text).trim();
|