Skip to content

Commit 2a98814

Browse files
committed
restructure a bit so we can reuse docgen logic for the mcp
1 parent 9302ec1 commit 2a98814

File tree

11 files changed

+724
-641
lines changed

11 files changed

+724
-641
lines changed

analysis/bin/main.ml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,12 @@ let main () =
117117
Mcp.IdentifierInfo.identifierInfo ~identifier ~path ~maybe_line:None
118118
~maybe_col:None
119119
|> print_endline
120+
| [_; "mcp"; "docs"; called_from; typ; identifier] -> (
121+
match Mcp.Docs.docs_type_from_string typ with
122+
| None ->
123+
print_endline
124+
"Not a valid type. Should be either 'ProjectFile' or 'Library'."
125+
| Some typ -> Mcp.Docs.docs ~called_from ~typ ~identifier |> print_endline)
120126
| [_; "cache-project"; rootPath] -> (
121127
Cfg.readProjectConfigCache := false;
122128
let uri = Uri.fromPath rootPath in

analysis/src/Commands.ml

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -450,6 +450,18 @@ let test ~path =
450450
~maybe_col:None
451451
|> print_endline;
452452
Sys.remove currentFile
453+
| "mdp" ->
454+
print_endline "MCP docs for project file";
455+
let identifier = String.sub rest 3 (String.length rest - 3) in
456+
let identifier = String.trim identifier in
457+
Mcp.Docs.docs ~called_from:path ~typ:ProjectFile ~identifier
458+
|> print_endline
459+
| "mdl" ->
460+
print_endline "MCP docs for library";
461+
let identifier = String.sub rest 3 (String.length rest - 3) in
462+
let identifier = String.trim identifier in
463+
Mcp.Docs.docs ~called_from:path ~typ:Library ~identifier
464+
|> print_endline
453465
| "xfm" ->
454466
let currentFile = createCurrentFile () in
455467
(* +2 is to ensure that the character ^ points to is what's considered the end of the selection. *)

0 commit comments

Comments
 (0)