{"id":15677013,"url":"https://github.com/jonnor/agree","last_synced_at":"2025-06-26T07:32:12.772Z","repository":{"id":29512625,"uuid":"33050938","full_name":"jonnor/agree","owner":"jonnor","description":"Introspectable Contracts Programming for JavaScript","archived":false,"fork":false,"pushed_at":"2017-01-06T22:49:39.000Z","size":137,"stargazers_count":13,"open_issues_count":2,"forks_count":0,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-06-08T22:30:22.683Z","etag":null,"topics":["contracts","contracts-programming","design-by-contracts","invariants","javascript"],"latest_commit_sha":null,"homepage":"http://agreejs.org","language":"CoffeeScript","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/jonnor.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-03-28T21:27:05.000Z","updated_at":"2018-07-17T14:00:55.000Z","dependencies_parsed_at":"2022-08-28T20:52:30.062Z","dependency_job_id":null,"html_url":"https://github.com/jonnor/agree","commit_stats":null,"previous_names":[],"tags_count":8,"template":false,"template_full_name":null,"purl":"pkg:github/jonnor/agree","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fagree","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fagree/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fagree/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fagree/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonnor","download_url":"https://codeload.github.com/jonnor/agree/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonnor%2Fagree/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262022478,"owners_count":23246317,"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":["contracts","contracts-programming","design-by-contracts","invariants","javascript"],"created_at":"2024-10-03T16:08:10.290Z","updated_at":"2025-06-26T07:32:12.752Z","avatar_url":"https://github.com/jonnor.png","language":"CoffeeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"[![Build Status](https://travis-ci.org/jonnor/agree.svg?branch=master)](https://travis-ci.org/jonnor/agree)\n# Agree: Contract programming for JavaScript\n\nAgree is a library for implementing Contract Programming / \n[Design by contract](http://en.wikipedia.org/wiki/Design_by_contract) in JavaScript,\nincluding `preconditions`, `postconditions` and `class invariants`.\n\nIt is inspired by projects like [contracts.coffee](http://disnetdev.com/contracts.coffee),\nbut requires *no build steps*, *no non-standard language features*, and is *introspectable*.\n\n## Status\n\n**Experimental** as of November 2016.\n\n* Functions, method and class invariants work\n* Support for asyncronous functions using Promise (ES6/A+ compatible)\n* Contracts can be reusable, and used to define interfaces (having multiple implementations)\n* Some proof-of-concept documentation and testing tools exists\n* Library has not been used in any real applications yet\n\n### TODO 0.1 \"minimally useful\"\n\n* Lock down the core contracts API\n* Add more tests for core functionality\n* Do use-case exploration of a browser/frontend example\n* Run all automated tests under browser\n* Stabilize and document the testing and documentation tools\n\nFuture\n\n* Support postcondition expressions that contain function inputs\n* Support postconditions expressions matching against 'old' instance members\n* Support invariants on properties\n\nFor details see TODO/FIXME/XXX/MAYBE comments in the code.\n\n## Installing\n\nAdd Agree to your project using [NPM](http://npmjs.org)\n\n    npm install --save agree\n    npm install --save-dev agree-tools\n\n## License\n\nMIT, see [LICENSE.md](./LICENSE.md)\n\n## Examples\n\n[HTTP server](./examples/httpserver.coffee)\n\nSee the tests under [./spec/](./spec) for full reference.\n\n## Tools\n\n[agree-tools](https://github.com/jonnor/agree-tools) uses the introspection features of Agree\nto provide support for testing and documentation, driven by the contracts/code.\n\n\n## Goals\n\n- No special dependencies, works anywhere (browser, node.js, etc), usable as library\n- That contracts are used is completely transparent to consuming code\n- Can start using contracts stepwise, starting with just some functions/methods\n- JavaScript-friendly fluent API (even if written with CoffeeScript)\n- Preconditions can, and are encouraged to, be used for input validation\n\nUsecases\n\n- HTTP REST apis: specifying behavior, validating request, consistent error handling\n- [NoFlo](http://noflojs.org) components: verifying data on inports, specifying component behavior\n- Interfaces: multiple implementations of same interface fully described\n\n\n## Introspection\n\nFunctions, classes and instances built with Agree know their associated contracts.\nThis allows to query the code about its properties, to generate documentation,\ntest-cases and aid in debugging of failures.\n\nAgree is partially related other work by [author](http://jonnor.com) on introspectable programming,\nincluding [Finito](http://finitosm.org) (finite state machines)\nand [NoFlo](http://noflojs.org)/[MicroFlo](http://microflo.org) (dataflow).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonnor%2Fagree","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonnor%2Fagree","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonnor%2Fagree/lists"}