@yawlabs/ansible-mcp 0.1.0 → 0.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/context.d.ts +4 -0
- package/dist/exec.d.ts +10 -2
- package/dist/index.js +559 -299
- package/dist/playbook.d.ts +12 -0
- package/dist/project.d.ts +30 -3
- package/dist/redact.d.ts +7 -0
- package/dist/server.js +569 -300
- package/dist/upgrade.d.ts +3 -0
- package/dist/yaml.d.ts +1 -0
- package/package.json +1 -1
package/dist/playbook.d.ts
CHANGED
|
@@ -33,17 +33,29 @@ export interface StderrMessage {
|
|
|
33
33
|
export declare function parseStderrMessages(stderr: string): StderrMessage[];
|
|
34
34
|
/** The first sentence of an Ansible error (drops "This often indicates ..." boilerplate). */
|
|
35
35
|
export declare function firstSentence(text: string): string;
|
|
36
|
+
export declare function mentionsLookup(s: string): boolean;
|
|
36
37
|
export interface PrescanHit {
|
|
37
38
|
file: string;
|
|
38
39
|
line: number;
|
|
39
40
|
play: string;
|
|
40
41
|
field: string;
|
|
42
|
+
/** Set when the file could not be read or fully parsed, so it cannot be shown clean. */
|
|
43
|
+
unreadable?: string;
|
|
41
44
|
}
|
|
42
45
|
/**
|
|
43
46
|
* R1 mitigation: walk the playbook (following literal import_playbook) and
|
|
44
47
|
* find lookups in play-level fields Ansible templates while parsing (F10).
|
|
45
48
|
*/
|
|
46
49
|
export declare function prescanPlaybook(files: ProjectFiles, rel: string): PrescanHit[];
|
|
50
|
+
/**
|
|
51
|
+
* R1 for lint targets (ansible-lint lints everything under a directory): a
|
|
52
|
+
* file target, and every .yml/.yaml file below a directory target at any
|
|
53
|
+
* depth, is read and pre-scanned when its root looks like a playbook (or when
|
|
54
|
+
* it cannot be read). A walk that hits its safety bound, or a dir it cannot
|
|
55
|
+
* list, is a refusal: what was not seen is not clean. Missing paths are left
|
|
56
|
+
* to ansible-lint's own error.
|
|
57
|
+
*/
|
|
58
|
+
export declare function prescanLintTargets(files: ProjectFiles, paths: string[], maxEntries?: number): PrescanHit[];
|
|
47
59
|
export declare function prescanRefusal(hits: PrescanHit[]): string;
|
|
48
60
|
/** Playbook-adjacent plugin dirs that Ansible imports while parsing (R1). */
|
|
49
61
|
export declare function localPluginFiles(files: ProjectFiles, playbookRel: string): string[];
|
package/dist/project.d.ts
CHANGED
|
@@ -14,10 +14,19 @@ export declare const TASK_KEYWORDS: Set<string>;
|
|
|
14
14
|
export declare function isTaskKeyword(k: string): boolean;
|
|
15
15
|
export declare const shortName: (action: string) => string;
|
|
16
16
|
export declare function isFreeForm(fqcnOrName: string): boolean;
|
|
17
|
+
export declare function isCheckRawAction(action: string): boolean;
|
|
18
|
+
/** Play keys that import a playbook (ansible-core's _ACTION_IMPORT_PLAYBOOK). */
|
|
19
|
+
export declare const IMPORT_PLAYBOOK_KEYS: string[];
|
|
20
|
+
/** The import_playbook entry of a play, under any of its names (the last one written wins). */
|
|
21
|
+
export declare function importPlaybookEntry(play: YNode): YNode | undefined;
|
|
17
22
|
/** Ansible's split_args, simplified: whitespace-separated, quotes and Jinja blocks kept whole. */
|
|
18
23
|
export declare function splitArgs(s: string): string[];
|
|
19
|
-
/**
|
|
20
|
-
|
|
24
|
+
/**
|
|
25
|
+
* Ansible's parse_kv: `k=v` pairs, everything else joined into `_raw_params`.
|
|
26
|
+
* With `checkRaw` (the free-form command modules) only the command options
|
|
27
|
+
* become options; other `k=v` tokens stay in `_raw_params`, in order.
|
|
28
|
+
*/
|
|
29
|
+
export declare function parseKv(s: string, checkRaw?: boolean): Record<string, string>;
|
|
21
30
|
export interface ArgEntry {
|
|
22
31
|
name: string;
|
|
23
32
|
line: number;
|
|
@@ -70,13 +79,22 @@ export declare function extractTask(map: YMap, file: string, doc: YamlDoc | null
|
|
|
70
79
|
export declare function tasksOf(seq: YNode | null | undefined, file: string, doc: YamlDoc | null, extra?: Parameters<typeof extractTask>[3]): WalkTask[];
|
|
71
80
|
/** True when a YAML root looks like a playbook: a list of mappings with hosts / import_playbook. */
|
|
72
81
|
export declare function isPlaybookRoot(root: YNode | null): boolean;
|
|
82
|
+
/**
|
|
83
|
+
* Looser than isPlaybookRoot, for the R1 pre-scan of directory trees: a list
|
|
84
|
+
* with at least one play (hosts / import_playbook) is treated as a playbook.
|
|
85
|
+
*/
|
|
86
|
+
export declare function isPlaybookLike(root: YNode | null): boolean;
|
|
73
87
|
export declare class ProjectFiles {
|
|
74
88
|
readonly dir: string;
|
|
89
|
+
/** Per path: the parsed doc (null when unread), and the file size (undefined when not a readable file). */
|
|
75
90
|
private readonly cache;
|
|
76
91
|
constructor(dir: string);
|
|
92
|
+
/** An absolute input is returned unchanged (a playbook outside dir); a relative one joins dir. */
|
|
77
93
|
abs(rel: string): string;
|
|
94
|
+
/** Relative to dir when inside it (drive-letter / case-insensitive on Windows), else the forward-slashed path. */
|
|
78
95
|
rel(abs: string): string;
|
|
79
|
-
|
|
96
|
+
/** Parse a YAML file of at most `maxBytes` (default 2 MiB); null when missing, unreadable or larger. */
|
|
97
|
+
read(abs: string, maxBytes?: number): YamlDoc | null;
|
|
80
98
|
}
|
|
81
99
|
export declare function isFile(p: string): boolean;
|
|
82
100
|
export declare function isDir(p: string): boolean;
|
|
@@ -127,6 +145,15 @@ export interface Detected {
|
|
|
127
145
|
configFiles: string[];
|
|
128
146
|
localCollections: boolean;
|
|
129
147
|
}
|
|
148
|
+
/**
|
|
149
|
+
* Every .yml/.yaml file under `dir` at any depth (symlinked dirs followed once,
|
|
150
|
+
* by real path), for the R1 pre-scan of lint targets. `incomplete` says why the
|
|
151
|
+
* walk could not see everything (the entry bound, or a dir it could not list).
|
|
152
|
+
*/
|
|
153
|
+
export declare function yamlFilesUnder(dir: string, maxEntries?: number): {
|
|
154
|
+
files: string[];
|
|
155
|
+
incomplete?: string;
|
|
156
|
+
};
|
|
130
157
|
/** Minimal INI read of ansible.cfg [defaults] (static half of project_info; no Ansible needed). */
|
|
131
158
|
export declare function readCfgStatic(dir: string): Record<string, string>;
|
|
132
159
|
export declare function detectProject(dir: string, cfgInventory?: string[]): Detected;
|
package/dist/redact.d.ts
CHANGED
|
@@ -81,3 +81,10 @@ export declare class Redactor {
|
|
|
81
81
|
/** The footer line, or "" when nothing was redacted. */
|
|
82
82
|
footer(): string;
|
|
83
83
|
}
|
|
84
|
+
/**
|
|
85
|
+
* One value printed on its own under one key, outside any document pass (a
|
|
86
|
+
* module or role option's documented default): layers 1, 3 and 4. Layer 2 needs
|
|
87
|
+
* a document, so a caller that has one should `learn()` the value into its own
|
|
88
|
+
* Redactor instead.
|
|
89
|
+
*/
|
|
90
|
+
export declare function redactStandalone(value: unknown, key: string): string;
|