{"id":18544758,"url":"https://github.com/131/cnyks","last_synced_at":"2025-10-15T07:02:01.136Z","repository":{"id":57201769,"uuid":"43759432","full_name":"131/cnyks","owner":"131","description":"Command line runner for nodejs","archived":false,"fork":false,"pushed_at":"2024-02-23T10:59:04.000Z","size":223,"stargazers_count":4,"open_issues_count":0,"forks_count":1,"subscribers_count":4,"default_branch":"master","last_synced_at":"2024-04-23T01:20:47.211Z","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":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/131.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2015-10-06T15:25:36.000Z","updated_at":"2024-06-15T19:43:55.467Z","dependencies_parsed_at":"2023-01-24T03:45:37.469Z","dependency_job_id":"e04ba0c1-a379-4d8a-a976-612018d841dc","html_url":"https://github.com/131/cnyks","commit_stats":{"total_commits":246,"total_committers":6,"mean_commits":41.0,"dds":"0.44715447154471544","last_synced_commit":"6e40050e3f0605dd8fbbe7dd3f9672473bbb344f"},"previous_names":[],"tags_count":106,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcnyks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcnyks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcnyks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/131%2Fcnyks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/131","download_url":"https://codeload.github.com/131/cnyks/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":223407841,"owners_count":17140572,"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-06T20:17:31.038Z","updated_at":"2025-10-15T07:02:01.083Z","avatar_url":"https://github.com/131.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[cnyks](https://github.com/131/cnyks) is a CLI runner for nodejs modules.\r\n\r\nAka : cnyks any ES6 class and :boom:*boom*:sparkles: you got the greatest command line runner ever (no fingerprint **at all**)\r\n\r\n[![Build Status](https://github.com/131/cnyks/actions/workflows/test.yml/badge.svg?branch=master)](https://github.com/131/cnyks/actions/workflows/test.yml)\r\n[![Coverage Status](https://coveralls.io/repos/github/131/cnyks/badge.svg?branch=master)](https://coveralls.io/github/131/cnyks?branch=master)\r\n[![NPM version](https://img.shields.io/npm/v/cnyks.svg)](https://www.npmjs.com/package/cnyks)\r\n[![License](https://img.shields.io/badge/license-MIT-blue.svg)](http://opensource.org/licenses/MIT)\r\n[![Code style](https://img.shields.io/badge/code%2fstyle-ivs-green.svg)](https://www.npmjs.com/package/eslint-plugin-ivs)\r\n\r\n\r\n![demo workflow](/demo/cnyks.gif)\r\n\r\n# Motivation\r\n`cnyks` will analyze your class/instance **prototype** and **reflect** the API it exposes, hence, any module can be handled by cnyks. There is **no API** to abide, compose your class the way you like.\r\n\r\n\r\n# Example\r\n```\r\n\"use strict\";\r\n\r\nvar sleep = require('nyks/async/sleep');\r\n\r\nmodule.exports  = class {\r\n  test(name) {\r\n    console.log(name);\r\n  }\r\n\r\n  async hello(name) {\r\n    await sleep(1000);\r\n    return `Hello ${name}`;\r\n  }\r\n  static test(){\r\n    console.log(\"Got test\");\r\n  }\r\n}\r\n```\r\nNow, just cnyks' it !\r\n```\r\ncnyks foo.js\r\n```\r\n\r\n# Installation/Usage\r\n\r\n## CLI\r\n```\r\nnpm install -g cnyks\r\ncnyks path/to/your/module.js\r\n# enjoy !\r\n```\r\n## CLI unattended flags / arguments\r\n\r\n* `--ir://` is a \"namespace\" for all cnyks dedicated arguments\r\n* `--ir://run=method_name` run  \"method_name\" on your module, then quit\r\n* `--ir://start=method_name` run \"method_name\" on your module, then start the interactive loop\r\n* `--ir://json` (to be used with \"run\")  silence ir helpers, format output as JSON\r\n* `--ir://run=hello --name=bar` run method \"hello\" with argument `name` set to 'bar' (i.e. `function hello(name) { }`)\r\n* `--ir://run=hello --name::json='[1,2,3]'` run method \"hello\" with argument `name` set to `[1, 2, 3]` (as a javascript array).\r\n\r\n\r\n## Self running, standalone cnyks bundle (via browserify)\r\nCnyks expose a **cnyksify** plugin for [browserify](https://github.com/substack/node-browserify).\r\n\r\n```\r\nbrowserify --node entry.js --plugin cnyks/ify  \u003e bundle.js\r\n```\r\n- `node bundle.js` =\u003e start runner\r\n\r\n## Standalone bootstrap\r\nJust add this 2 lines footer to your module/class so it can be use by clyks directly\r\n```\r\n  //at the end of your module\r\nmodule.exports = SomeClass;\r\n\r\nif(module.parent === null) //ensure module is called directly, i.e. not required\r\n  require('cnyks')(SomeClass); //start runner\r\n```\r\nNow just `node someapp.js` to start cnyks runner.\r\n\r\n\r\n## Legacy ES5 async support\r\nCnyks also allows you to declare async function through generators (internaly using [co](https://github.com/tj/co) ).\r\n\r\n\r\n# Bundled utilities\r\n* `require('cnyks/ify')`  : a browserify plugin\r\n* `require('cnyks/prompt/bool')(prompt, default)` : prompt (using [read]) for a boolean\r\n\r\n\r\n\r\n# TODO\r\n* Get rich or die tryin'\r\n\r\n# Credits / related\r\n* [131](https://github.com/131)\r\n* Derived from [yks/clyks](https://github.com/131/yks/blob/master/class/exts/cli/interactive_runner.php)\r\n* [nyks](https://github.com/131/nyks), javascript toolkit, good complementarity\r\n\r\n\r\n# Buzzword / shoutbox / SEO LOVE\r\ncli, reflection API, commander, cnyks, interactive runner, async/await, co, promise, Promises, yield, \"Let's have a beer \u0026 talk in Paris\"\r\n\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fcnyks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2F131%2Fcnyks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2F131%2Fcnyks/lists"}