{"id":19388543,"url":"https://github.com/thinkthinkai/jsonscriptlib","last_synced_at":"2026-05-05T13:33:58.233Z","repository":{"id":241255819,"uuid":"802718791","full_name":"ThinkThinkAI/JSONScriptLib","owner":"ThinkThinkAI","description":null,"archived":false,"fork":false,"pushed_at":"2024-06-21T06:40:59.000Z","size":364,"stargazers_count":0,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-24T19:58:52.710Z","etag":null,"topics":["json","json-api","nodejs","npm","npm-package"],"latest_commit_sha":null,"homepage":null,"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/ThinkThinkAI.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2024-05-19T04:30:44.000Z","updated_at":"2024-08-23T18:43:32.000Z","dependencies_parsed_at":"2024-05-23T06:31:39.880Z","dependency_job_id":"5c7d745b-932f-4089-b839-969b6db93e5b","html_url":"https://github.com/ThinkThinkAI/JSONScriptLib","commit_stats":null,"previous_names":["commandai/jsonscriptlib","thinkthinkai/jsonscriptlib"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/ThinkThinkAI/JSONScriptLib","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2FJSONScriptLib","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2FJSONScriptLib/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2FJSONScriptLib/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2FJSONScriptLib/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/ThinkThinkAI","download_url":"https://codeload.github.com/ThinkThinkAI/JSONScriptLib/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/ThinkThinkAI%2FJSONScriptLib/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32651432,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-05-05T11:29:49.557Z","status":"ssl_error","status_checked_at":"2026-05-05T11:29:48.587Z","response_time":54,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.5:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"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":["json","json-api","nodejs","npm","npm-package"],"created_at":"2024-11-10T10:12:58.372Z","updated_at":"2026-05-05T13:33:58.218Z","avatar_url":"https://github.com/ThinkThinkAI.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# JSONScriptLib\n\n**Version:** 0.1.0\n\nJSONScriptLib is a library for executing JSONScript - a simple format for defining a sequence of steps including commands and file operations. This library allows you to validate and execute JSONScript objects, providing detailed execution descriptions and results.\n\n## Installation\n\nYou can install JSONScriptLib via npm:\n\n```bash\nnpm install jsonscriptlib\n```\n\n# Usage\n\nHere is an example of how to use JSONScriptLib:\n\n## Sample JSONScript\n\nCreate a JSON file (e.g., steps.json) containing your JSONScript configuration:\n```\n[\n  {\n    \"comment\": \"Step 1: Install the required npm package 'axios' for downloading files.\",\n    \"cmd\": \"npm install axios\"\n  },\n  {\n    \"comment\": \"Step 2: Create a JavaScript file that will contain the code to download the file.\",\n    \"file\": {\n      \"name\": \"downloadFile.js\",\n      \"data\": \"// This script downloads a file from a given URL\\nconst axios = require('axios');\\nconst fs = require('fs');\\nconst url = 'https://example.com/file.txt';\\nconst path = 'downloaded_file.txt';\\naxios({\\n  method: 'get',\\n  url: url,\\n  responseType: 'stream'\\n}).then(function (response) {\\n  response.data.pipe(fs.createWriteStream(path));\\n  console.log('File downloaded successfully.');\\n}).catch(function (error) {\\n  console.log('Error downloading the file:', error);\\n});\"\n    }\n  },\n  {\n    \"comment\": \"Step 3: Execute the JavaScript file to download the file from the given URL.\",\n    \"cmd\": \"node downloadFile.js\"\n  },\n  {\n    \"comment\": \"Step 4: Create a README file with instructions.\",\n    \"file\": {\n      \"name\": \"README.md\",\n      \"data\": \"# Node.js File Downloader\\nThis application downloads a file from a specified URL using Node.js.\\n\\n## Setup\\n1. Install the required npm package:\\n```\\nnpm install axios\\n```\\n2. Run the script to download the file:\\n```\\nnode downloadFile.js\\n```\"\n    }\n  }\n]\n```\n\n# Using JSONScriptLib\n```\nCreate a Node.js script (e.g., test.js) to process the JSONScript file:\nconst JSONScript = require('jsonscriptlib');\nconst fs = require('fs');\n\n// Load JSONScript from a file\nconst jsonScript = JSON.parse(fs.readFileSync('steps.json', 'utf-8'));\n\nconst script = new JSONScript(jsonScript);\n\nconsole.log('Execution Description:', script.executionDescription);\nconsole.log('Execution Plan:', script.executionPlan);\n\n(async () =\u003e {\n  const result = await script.execute();\n  if (result.error) {\n    console.error('Execution Error:', result.error);\n  } else {\n    console.log('Execution Results:', result.results);\n  }\n})();\n```\n\nRun the script using Node.js:\n```\nnode test.js\n```\n\n# JSONScript Object\n\n## The JSONScript object has the following properties:\n\n • executionDescription: An array of strings describing each step.\n • executionPlan: An array of strings showing the commands being executed and files being created.\n • execute(): An async function that runs all commands and creates files in order. It returns an object with the following properties:\n • results: An array of all results from each step completed successfully.\n • error: An error object if any command fails. An error will stop the completion of the JSONScript.\n\n# Running Tests\n\nTo run the tests for JSONScriptLib, you can use the following command:\n\n```bash\nnpm test\n```\n\nThis will run the tests in the index.test.js file.\n\nYou can also use the --watch flag to run the tests in watch mode, which will automatically re-run the tests whenever a file changes:\n\n```bash\nnpm test -- --watch\n```\n\n# Contribution\n\nFeel free to contribute to the JSONScriptLib project. Fork the repository and submit a pull request with your improvements.\n\n# License\n\nThis project is licensed under the MIT License.\n```\nMIT License\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n```","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkthinkai%2Fjsonscriptlib","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fthinkthinkai%2Fjsonscriptlib","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fthinkthinkai%2Fjsonscriptlib/lists"}