{"id":21405351,"url":"https://github.com/karimsa/alfred","last_synced_at":"2026-01-02T19:37:50.134Z","repository":{"id":57175875,"uuid":"38981210","full_name":"karimsa/alfred","owner":"karimsa","description":"a natural language interface for programs","archived":false,"fork":false,"pushed_at":"2016-06-19T17:48:33.000Z","size":23,"stargazers_count":1,"open_issues_count":1,"forks_count":0,"subscribers_count":1,"default_branch":"master","last_synced_at":"2025-03-11T21:03:57.898Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/karimsa.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-07-12T22:58:02.000Z","updated_at":"2016-03-15T16:22:59.000Z","dependencies_parsed_at":"2022-09-03T08:52:04.303Z","dependency_job_id":null,"html_url":"https://github.com/karimsa/alfred","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Falfred","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Falfred/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Falfred/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/karimsa%2Falfred/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/karimsa","download_url":"https://codeload.github.com/karimsa/alfred/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243902293,"owners_count":20366259,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-22T16:24:42.819Z","updated_at":"2026-01-02T19:37:50.106Z","avatar_url":"https://github.com/karimsa.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# alfred2 [![Build Status](https://travis-ci.org/karimsa/alfred.svg?branch=master)](https://travis-ci.org/karimsa/alfred)\n\na natural language interface for programs.\n\n[![NPM](https://nodei.co/npm/alfred2.png?downloads=true\u0026downloadRank=true\u0026stars=true)](https://nodei.co/npm/alfred2/)\n\n## Why '2'?\n\nalfred \"1\" was never actually made public but I used it in [Detective](https://github.com/vvbka/Detective) and a few\nother private projects. Afterwards, there were a few features I desperately wanted to add in and since 'alfred' was\nalready a package on npm, I decided to go with 'alfred2'.\n\n## Usage\n\nThis module will expose a function that will create a new alfred stream for usage. The purpose of having a stream is\nto realize that alfred itself is simply a middleware between your inputs and your code. Due to this, you must first link\nalfred to some output by piping it out and bring in some line of output (from a stream or whatever else you'd like to use).\n\nFor the purposes of this README, we will use stdin as alfred's input and stdout as alfred's output. This will create a sort\nof REPL with alfred.\n\n***For example:***\n\n```javascript\n// create a new alfred instance\nconst alfred = require ( 'alfred2' )();\n\n// push stdin into alfred\nprocess.stdin.pipe(alfred);\n\n// push alfred into stdout\nalfred.pipe(process.stdout);\n\n// what gets written to alfred is the natural\n// language input, and what alfred outputs is\n// what alfred wants to say\n```\n\n### Registering a prompt with alfred\n\nalfred uses [pennyworth](https://github.com/karimsa/pennyworth) as its prompt-handling library. Therefore, please see\nthe pennyworth docs regarding how to format prompts.\n\nTo register the prompt with an action, use `alfred.add()` with either a function or a generator. For instance, to create\na simple hello world prompt that replies with a hello, do:\n\n```javascript\nalfred.add('hi, there.', function* () {\n    const age = parseInt(yield 'What is your age?' , 10);\n});\n```\n\n## License\n\nLicensed under GPL-3.0. See [LICENSE](LICENSE).","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarimsa%2Falfred","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkarimsa%2Falfred","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkarimsa%2Falfred/lists"}