stateful / runme

DevOps Notebooks Built with Markdown
https://runme.dev
Apache License 2.0
1.11k stars 36 forks source link

move document package from internal to pkg #588

Closed jlewi closed 4 months ago

jlewi commented 4 months ago

The purpose of this PR is to make it possible to reuse runme's Markdown -> Notebook code. In particular I'd like to use it to parse ChatGPT output into a notebook so that code blocks can be rendered in RunMe notebooks.

In Foyle, there is currently a bug with parsing out code blocks nested inside lists jlewi/foyle#114. Runme's code properly handles this use case. This will allow us to reuse RunMe's code to fix this problem.

jlewi commented 4 months ago

Not sure what's going on with the test failure (possibly related to #587). It ran locally

=== RUN   Test_runnerService
--- PASS: Test_runnerService (0.00s)
=== RUN   Test_runnerService/Input
=== PAUSE Test_runnerService/Input
=== CONT  Test_runnerService/Input
2024-05-24T08:16:40.011-0700    INFO    runner/service.go:206   running Execute in runnerService    {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB"}
2024-05-24T08:16:40.012-0700    DEBUG   runner/service.go:219   received initial request    {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "req": "program_name:\"bash\"  commands:\"tr a-z x\"  tty:true  command_mode:COMMAND_MODE_INLINE_SHELL"}
2024-05-24T08:16:40.012-0700    DEBUG   runner/session.go:48    using simple env store
2024-05-24T08:16:40.012-0700    DEBUG   runner/service.go:293   command config  {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "cfg": {"ProgramName":"bash","Args":null,"Directory":"","Session":{"ID":"01HYNJSVYCSG5QY968R3ZB80YY","Metadata":null},"Tty":true,"Winsize":{"Rows":0,"Cols":80,"X":0,"Y":0},"Stdin":{},"Stdout":{},"Stderr":{},"Commands":["tr a-z x"],"Script":"","CommandMode":1,"LanguageID":"","FileExtension":"","Logger":{}}}
2024-05-24T08:16:41.015-0700    DEBUG   runner/service.go:413   received input data {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "len": 4}
2024-05-24T08:16:41.016-0700    DEBUG   runner/service.go:448   sending data    {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "lenStdout": 5, "lenStderr": 0}
2024-05-24T08:16:41.016-0700    DEBUG   runner/service.go:448   sending data    {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "lenStdout": 5, "lenStderr": 0}
2024-05-24T08:16:42.015-0700    DEBUG   runner/service.go:413   received input data {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "len": 1}
2024-05-24T08:16:42.015-0700    INFO    runner/service.go:373   client closed the send direction; ignoring  {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB"}
2024-05-24T08:16:42.015-0700    DEBUG   runner/command.go:379   finished copying from stdin to pty  {"count": 5}
2024-05-24T08:16:42.016-0700    DEBUG   runner/service.go:448   sending data    {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "lenStdout": 4, "lenStderr": 0}
2024-05-24T08:16:42.025-0700    DEBUG   runner/command.go:404   finished copying from pty to stdout {"count": 14}
2024-05-24T08:16:42.025-0700    INFO    runner/service.go:483   command finished    {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "exitCode": 0}
2024-05-24T08:16:42.026-0700    INFO    runner/service.go:496   command was finalized successfully  {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB"}
2024-05-24T08:16:42.026-0700    INFO    runner/service.go:525   sending the final response with exit code   {"_id": "01HYNJSVYB9QQTXHKHMGZSP3SB", "exitCode": 0}
    --- PASS: Test_runnerService/Input (2.02s)
jlewi commented 4 months ago

Looks like the test failure was a flake because it passed at 8c1e584

jlewi commented 4 months ago

@sourishkrout This is ready for you.