SCTree is the language and CLI for Software Construction Tree documents.
Software Construction Tree, or SCT, is the design system. SCTree is the notation
used to describe a project structure in .sctree files. An SCTree document
describes the planned folder and file structure of a software project in a small,
readable syntax that can be rendered as a terminal tree, HTML preview, or text
file.
It is meant to sit between project planning and implementation: a lightweight artifact that communicates how a project should be shaped before every file has to exist on disk.
Install globally:
npm install -g sctree-cliWhen npm's global binary directory is on your PATH, the command is available
as:
sctreeIf your shell cannot find sctree, check npm's global install prefix:
npm prefix -gOn macOS/Linux, global binaries are usually inside the bin folder under that
prefix. Make sure that folder is included in your PATH.
You can also run the sctree binary without a global install:
npx sctree-cli --help
npx sctree-cli initCreate a new SCTree document interactively:
sctree initCreate one immediately with defaults:
sctree init -yCreate one with specific metadata:
sctree init -y --name ApiProject --language csharp --framework aspnet-coreScan an existing project into an SCTree document:
sctree scan --name ExistingProjectSCTree files are written to .out/ by default.
name = "Project"
type = "none"
language = "typescript"
framework = "none"
version = "0.1.0"
description = "A planned project structure."
root Project {
file .gitignore
folder src {
file index.ts
}
}
sctree init
sctree init -y
sctree init --yes
sctree init --yinit creates a new .sctree document, plus .sctreeignore and sctree.config.json in
the project root. The -y and --yes flags skip prompts and use defaults for
missing values.
Add a file:
sctree add file users.controller.ts src/modules/usersAdd a folder:
sctree add folder users src/modulesUse the shorthand file form:
sctree add users.controller.ts src/modules/usersAdd multiple files or folders at once:
sctree add file -c users.controller.ts users.service.ts -d src/modules/users
sctree add folder -c users posts comments -d src/modulesRemove every matching file or folder name:
sctree rm users.controller.tsRemove a matching entry under a specific folder:
sctree rm users.controller.ts src/modules/usersIf the target is a folder, the folder and its children are removed from the SCTree tree.
Generate a .sctree document from the current project structure:
sctree scanSet metadata while scanning:
sctree scan --name ApiProject --language csharp --framework aspnet-coreOverwrite an existing generated file:
sctree scan --forceScan the current project and add missing filesystem entries to the active .sctree
document:
sctree updateRender the tree in the terminal:
sctree renderRender an HTML preview:
sctree render --htmlRender a text preview file:
sctree render --txtPreview files are written to .out/ beside the .sctree file.
Use .sctreeignore to exclude paths from sctree scan and sctree update.
node_modules
dist
.out
coverage
Use sctree.config.json to opt into filesystem changes when sctree add or sctree rm
is called.
{
"filesystem": {
"applyOnAdd": false,
"applyOnRemove": false
}
}Both settings default to false, so add/remove only update the .sctree document
unless you explicitly enable filesystem changes.
Current language options:
typescriptjavascriptcsharp
Current framework options are language-dependent.
TypeScript:
nonenodeexpressnestjsreact
JavaScript:
nonenodeexpressreact
C#:
noneaspnet-core
For more details about the language, syntax, parser rules, templates, and design direction, see: