Ruby 实现了一个 human interpreter

femto · August 12, 2023 · 261 hits

https://github.com/femto/hi 目的,像自然语言一样的跟你的操作系统交流

比如 hi could you please count the total line numbers of files in current dir

安装

pip install -U python-pi

使用,既可以命令行使用

hi could you please count the total line numbers of files in  current dir

也可以作为 shellbang interpreter 使用,比如写一个 tidy 文件夹的脚本:

#!/usr/bin/env hi

loop over all files (ignoring directories) in first argument(first argument is a directory)

move each file into a subdirectory in the format year-month

while the task is running show an ascii loading spinner

show how many files where moved

所执行的和所表达的意思相同

原理,hi 是 bin, 后面其他的部分发送到 llm 转成 bash(当然会有缓存) 然后执行

可以参考 samples 下其他文件

项目地址 https://github.com/femto/hi

请大家试用和给出反馈:)

femto in [Topic was deleted] mention this topic. 12 Aug 20:04
You need to Sign in before reply, if you don't have an account, please Sign up first.