{"id":40756155,"url":"https://github.com/bencbartlett/creep-tasks","last_synced_at":"2026-01-21T16:11:28.957Z","repository":{"id":57210720,"uuid":"131197793","full_name":"bencbartlett/creep-tasks","owner":"bencbartlett","description":"Screeps plugin for a flexible method of controlling creep actions","archived":false,"fork":false,"pushed_at":"2019-10-26T17:38:51.000Z","size":84,"stargazers_count":52,"open_issues_count":7,"forks_count":12,"subscribers_count":6,"default_branch":"master","last_synced_at":"2025-08-09T03:59:09.832Z","etag":null,"topics":["game","screeps","screeps-game","strategy-game"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"unlicense","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bencbartlett.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}},"created_at":"2018-04-26T18:50:47.000Z","updated_at":"2024-10-04T13:43:36.000Z","dependencies_parsed_at":"2022-08-31T04:01:34.126Z","dependency_job_id":null,"html_url":"https://github.com/bencbartlett/creep-tasks","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"purl":"pkg:github/bencbartlett/creep-tasks","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencbartlett%2Fcreep-tasks","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencbartlett%2Fcreep-tasks/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencbartlett%2Fcreep-tasks/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencbartlett%2Fcreep-tasks/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bencbartlett","download_url":"https://codeload.github.com/bencbartlett/creep-tasks/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bencbartlett%2Fcreep-tasks/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28635927,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-21T15:01:31.228Z","status":"ssl_error","status_checked_at":"2026-01-21T14:42:58.942Z","response_time":86,"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":["game","screeps","screeps-game","strategy-game"],"created_at":"2026-01-21T16:11:28.213Z","updated_at":"2026-01-21T16:11:28.948Z","avatar_url":"https://github.com/bencbartlett.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# creep-tasks  [![npm version](https://badge.fury.io/js/creep-tasks.svg)](https://badge.fury.io/js/creep-tasks) [![Build Status](https://travis-ci.org/bencbartlett/creep-tasks.svg?branch=master)](https://travis-ci.org/bencbartlett/creep-tasks)\n\n`creep-tasks` is a plugin for your [Screeps](https://screeps.com/) codebase which adds a concise and flexible `creep.task` property to your creeps. Tasks are persistent objects that generalize the concept of \"do action X to thing Y until condition Z is met\" and they can save a lot of convoluted and redundant code in creep logic. A `Task` object contains the necessary logic for traveling to a target, performing an action on the target, and realizing when a task is no longer sensible to continue. \n\n`creep-tasks` has been adapted from the [Overmind Screeps AI](https://github.com/bencbartlett/Overmind). \n\n## [Documentation](https://github.com/bencbartlett/creep-tasks/wiki)\n\nFor an [overview of how Tasks work](https://github.com/bencbartlett/creep-tasks/wiki/Anatomy-of-a-Task) and a full API reference, please refer to the [`creep-tasks` Wiki](https://github.com/bencbartlett/creep-tasks/wiki).\n\n## Examples\n\nMany Screeps bots use decision trees which run every tick to determine what a creep should be doing. Tasks streamline this process into two separate parts: task assignment and task execution. Since tasks are persistent, you only need to run decision tree logic when a creep is idle. Here's a very simple example of writing an upgrader role using tasks:\n\n```js\n/* main.js */\n\nlet Tasks = require('creep-tasks');\n\n// Upgraders will harvest to get energy, then upgrade the room controller\nlet roleUpgrader = {\n    newTask: function(creep) { // task assignment logic\n        if (creep.carry.energy \u003e 0) {\n            creep.task = Tasks.upgrade(creep.room.controller);\n        } else {\n            creep.task = Tasks.harvest(creep.room.find(FIND_SOURCES)[0])\n        }\n    }\n};\n\nmodule.exports.loop = function () {\n    /* (Spawning logic would go here) */\n    let upgraders = _.values(Game.creeps);\n    for (let upgrader of upgraders) {\n        if (upgrader.isIdle) { // obtain a new task if the creep is idle\n            roleUpgrader.newTask(upgrader);\n        }\n        upgrader.run(); // run the assigned task\n    }\n};\n```\n\nThis repository contains simple [example bots](/examples) built using `creep-tasks` written in JavaScript and in TypeScript. You can see more complex `creep-tasks` [examples](https://github.com/bencbartlett/Overmind/tree/master/src/overlords/core) in the Overmind codebase.\n\n## Installation\n\nThere are several ways to install `creep-tasks`. I would recommend using npm, but depending on how your environment is set up and how much you'd like to modify the source, installing from binary or from source might work better for you.\n\n#### (JavaScript/TypeScript) Install from npm:\n\nNavigate to your project root and run `npm install creep-tasks`. The npm module comes with included typings if you are using TypeScript. Use `var Tasks = require('creep-tasks')` to import the Tasks module in JS or `import Tasks from 'creep-tasks'` to import in TS.\n\n#### (JavaScript only) Install from compiled module:\n\n1. Download or copy/paste the code in [`bin/creep-tasks.js`](https://github.com/bencbartlett/creep-tasks/tree/master/bin/creep-tasks.js) and put it in a new module.\n2. Add `require('creep-tasks')` to your `main.js` file outside of the main loop.\n3. Use `var Tasks = require('creep-tasks')` wherever you need to set creep tasks.\n\n\n#### (TypeScript only) Install from source:\n\n1. Download this repository and copy the `src/creep-tasks` directory to somewhere in your codebase.\n2. Import the necessary prototypes in `main.ts` with `import 'creep-tasks/prototypes'` outside of the main loop.\n3. Use `import {Tasks} from 'creep-tasks/Tasks'` (path to Tasks.ts) whenever you need to set creep tasks.\n\n## Contributing\n\nIf you find an issue with `creep-tasks` or want to leave feedback, please feel free to [submit an issue](https://github.com/bencbartlett/creep-tasks/issues/new). If you'd like to contribute to `creep-tasks`, [pull requests](https://github.com/bencbartlett/creep-tasks/pulls) are also welcome!\n\n## Changelog\n\n2018.8.1:\n- Version 1.3 released - adds chaining functionality with `Tasks.chain()`, adds `TaskWithdrawAll`, adds `nextPos` option, and fixes bugs\n\n2018.6.29:\n- Version 1.2 released - adds `TaskTransferAll`, adds `oneShot` option, and fixes bugs\n\n2018.5.1:\n- Version 1.1 released - repackaged for better npm support and now with included typings\n\n2018.4.29:\n- Initial release\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencbartlett%2Fcreep-tasks","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbencbartlett%2Fcreep-tasks","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbencbartlett%2Fcreep-tasks/lists"}