{"id":16210251,"url":"https://github.com/bastianblokland/typedtree-editor","last_synced_at":"2025-09-07T05:35:29.654Z","repository":{"id":34222571,"uuid":"167078842","full_name":"BastianBlokland/typedtree-editor","owner":"BastianBlokland","description":"Web editor for typed tree structures. (like decision / behaviour trees)","archived":false,"fork":false,"pushed_at":"2023-07-19T03:26:00.000Z","size":1178,"stargazers_count":24,"open_issues_count":1,"forks_count":6,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-02-28T17:25:02.904Z","etag":null,"topics":["behaviour-tree","descision-tree","json-tree","tree-editor","webapp"],"latest_commit_sha":null,"homepage":"https://www.bastian.tech/tree","language":"TypeScript","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/BastianBlokland.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":"2019-01-22T22:43:31.000Z","updated_at":"2024-09-25T12:54:27.000Z","dependencies_parsed_at":"2024-10-27T20:27:37.167Z","dependency_job_id":"2c67cf25-fe56-47cc-8733-cf40e23cd19a","html_url":"https://github.com/BastianBlokland/typedtree-editor","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Ftypedtree-editor","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Ftypedtree-editor/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Ftypedtree-editor/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/BastianBlokland%2Ftypedtree-editor/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/BastianBlokland","download_url":"https://codeload.github.com/BastianBlokland/typedtree-editor/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243980086,"owners_count":20378330,"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":["behaviour-tree","descision-tree","json-tree","tree-editor","webapp"],"created_at":"2024-10-10T10:36:28.630Z","updated_at":"2025-03-19T09:30:30.952Z","avatar_url":"https://github.com/BastianBlokland.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"﻿# TypedTree-Editor\n\n[![Website](https://img.shields.io/website/https/www.bastian.tech/tree.svg)](https://www.bastian.tech/tree/)\n[![Build](https://img.shields.io/azure-devops/build/bastian-blokland/TypedTree/3/master.svg)](https://dev.azure.com/bastian-blokland/TypedTree/_build/latest?definitionId=3\u0026branchName=master)\n[![Tests](https://img.shields.io/azure-devops/tests/bastian-blokland/TypedTree/3/master.svg)](https://dev.azure.com/bastian-blokland/TypedTree/_build/latest?definitionId=3\u0026branchName=master)\n[![CodeCov](https://codecov.io/gh/BastianBlokland/typedtree-editor/branch/master/graph/badge.svg)](https://codecov.io/gh/BastianBlokland/typedtree-editor)\n[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg)](LICENSE)\n\n[**Web editor for typed tree structures**](https://www.bastian.tech/tree/)\n\n---\n![Preview image](https://www.bastian.tech/tree/screenshots/toolbox-hidden.png)\n\n---\n\n## Generators\nTo avoid having to hand write the scheme you can use one of the following generators:\n\n| Environment | Generator |\n|-------------|-----------|\n| dotnet | [typedtree-generator-dotnet](https://github.com/bastianblokland/typedtree-generator-dotnet) |\n| unity | [typedtree-generator-unity](https://github.com/bastianblokland/typedtree-generator-unity) |\n\n## Description\nThis editor is designed to be able to build tree structures according to a scheme and then output it\nto json. You create a simple scheme file describing the possible node types, load it up in the editor\nand then create tree's in a visual (and type safe) way.\n\nBoth the scheme and the tree formats are\ndesigned to be both hand-editable and easy to generate / parse. You could for example generate a\nscheme based on a class structure from the language you wish to load tree into.\n\nThis editor runs purely client-side and any content you load into it stays purely on your machine.\n\nTiny electron wrapper to ease in saving until\n[native-file-system](https://web.dev/native-file-system/) has become mainstream:\n[electron-wrapper](https://gist.github.com/BastianBlokland/1f2b2d9dfe75258274588ed53bcb8d90).\n\n### Example of the scheme format\n```json\n{\n  \"rootAlias\": \"AI.Item\",\n  \"aliases\": [\n    {\n      \"identifier\": \"AI.Item\",\n      \"values\": [\n        \"AI.Items.Selector\",\n        \"AI.Conditions.OutOfHealth\"\n      ]\n    }\n  ],\n  \"enums\": [\n    {\n      \"identifier\": \"AI.Target\",\n      \"values\": [\n        { \"value\": 1, \"name\": \"Ground\" }\n        { \"value\": 2, \"name\": \"Air\" }\n      ]\n    }\n  ],\n  \"nodes\": [\n    {\n      \"nodeType\": \"AI.Items.Selector\",\n      \"fields\": [\n        {\n          \"name\": \"children\",\n          \"valueType\": \"AI.Item\",\n          \"isArray\": true\n        }\n      ]\n    },\n    {\n      \"nodeType\": \"AI.Conditions.OutOfHealth\",\n      \"fields\": [\n        {\n          \"name\": \"minHealth\",\n          \"valueType\": \"number\"\n        }\n      ]\n    }\n  ],\n  \"featureNodeNames\": true\n}\n```\nElements in the scheme:\n* `rootAlias`: Alias that the root-node has to be part of.\n* `aliases`: Definition of all the aliases in the scheme. An alias is a named group of node types.\n* `enums`: Definition of all the enums in the scheme. An enum is a named set of numbers.\n* `nodes`: Definition of all the node-types in the scheme. Each node defines a type-name and a set\nof fields that this node can have.\n\nPossible field value types are:\n* `boolean`\n* `number`\n* `string`\n* `Alias` (Alias has to be defined in the `aliases` section of the scheme)\n* `Enum` (Enum has to be defined in the `enums` section of the scheme)\n\nEnums are a special type as they only live in the scheme, in the actual tree data they are represented\nby numbers. The fact that the field is an enum in the scheme will make the editor validate the number\nand show it as a dropdown in the ui.\n\n### Example of the tree output format\n```json\n{\n  \"$type\": \"AI.Items.Selector\",\n  \"$name\": \"My selector\",\n  \"children\": [\n    {\n      \"$type\": \"AI.Conditions.OutOfHealth\",\n      \"minHealth\": 10\n    }\n  ]\n}\n```\nFormat is plain json with some well-known fields:\n- `$type`: Indicates the node-type in the scheme this node was created from.\n- `$name`: Optional name for the node.\n\n### Example of the tree-pack format\n```json\n{\n  \"scheme\": ...,\n  \"tree\": ...\n}\n```\nTreePack is a single file containing both a scheme and a tree, can be useful for sharing purposes.\n\n## Project setup\nThis project is written in [TypeScript](https://github.com/Microsoft/TypeScript) and is transpiled\ninto es6 JavaScript. Tree is rendered with a combination of plain html and svg.\n\nFor dependency management [Npm](https://github.com/npm/cli) is used.\n[Rollup](https://github.com/rollup/rollup) is used for creating the output bundle, and deployments\nare minified using [uglify-js](https://github.com/mishoo/UglifyJS2) and\n[css-combine](https://github.com/michaelrhodes/css-combine).\n\nAny ide can be used of course but configuration files for [vscode](https://github.com/Microsoft/vscode)\nare included. Ci scripts are written in bash so windows users should use the\n[wsl](https://docs.microsoft.com/en-us/windows/wsl) for running them.\n\n### Building\nInstalling [node](https://nodejs.org/en/download/) (at least version 10 of node required) and executing: `make`\nshould be enough, build-output can be found in the `./build` directory.\n\n### Development\nFor local development execute: `make watch` which will start a local [server](https://github.com/tapio/live-server)\nwith hot-reloading.\n\n### Run linter\nFor running the [tslint](https://github.com/palantir/tslint) linter you can execute: `make lint` but\nwhen using vscode the tslint plugin should provide warnings for non-compliant code already.\n\n### Unit tests\nUnit tests can be found in `./tests/unit` and are using the [Jest](https://github.com/facebook/jest)\nframework. Run unit-tests by executing: `make test.unit`.\n\nCode coverage for unit-tests is tracked with [codecov.io](https://codecov.io/gh/BastianBlokland/typedtree-editor).\n\n### Integration tests\nIntegration tests can be found in `./tests/integration`. Integration test are also written with\n[Jest](https://github.com/facebook/jest) and are run in the [puppeteer](https://github.com/GoogleChrome/puppeteer)\nenvironment (which is a headless chromium api) using\n[jest-puppeteer](https://github.com/smooth-code/jest-puppeteer). Run integration-tests by executing:\n`make test.integration`.\n\nTo make debugging easier screenshots are exported during integration test execution, they can be\nfound in the `./screenshots` directory. Actually the image in this readme also comes from there.\n\n### Continuous integration\nBuilds are run in [azure-devops](https://dev.azure.com/bastian-blokland/TypedTree/_build?definitionId=3) and\noutput is deployed to a azure blob-storage bucket. Output can be found here:\n`https://www.bastian.tech/typedtree-editor/refs/pull/[PULL_REQUEST_NUMBER]/merge/` or\n`www.bastian.tech/typedtree-editor/refs/heads/[BRANCH_NAME]/`\n\n`www.bastian.tech/tree` is a alias\nto `www.bastian.tech/typedtree-editor/refs/heads/master/`\n\n### Dependencies\n* [NodeJs](https://nodejs.org/en/): At least version 10 is required.\n* [FileSaver](https://github.com/eligrey/FileSaver.js): Library for saving files that works\nconsistently in almost all browsers.\n* [lz-string](https://github.com/pieroxy/lz-string): Library for compressing text.\n\n## Troubleshooting\n* If `verify-tooling.sh` fails try removing the `./node_modules` directory.\n\n## Known issues\n* Running the integration tests in the windows linux subsystem fails with `Error: Failed to launch chrome!`\nThis is a known puppeteer [issue](https://github.com/GoogleChrome/puppeteer/issues/1837)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastianblokland%2Ftypedtree-editor","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbastianblokland%2Ftypedtree-editor","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbastianblokland%2Ftypedtree-editor/lists"}