changelog shortlog graph tags branches changeset files revisions annotate raw help

Mercurial > org > docs / core/app/skel.org

changeset 12: 31db7a83d2c6
parent: d0a90a87b824
author: ellis <ellis@rwest.io>
date: Tue, 12 Dec 2023 21:50:16 -0500
permissions: -rw-r--r--
description: ffi
1 {{{header(skel,Richard Westhaver,ellis@rwest.io)}}}
2 
3 The =skel= CLI is the primary build tool for contributors and serves a
4 similar role to language-agnostic build tools like [[https://www.gnu.org/software/make/][GNU Make]], but with
5 the features and ease-of-use of language-specific build tools like
6 Rust's [[https://github.com/rust-lang/cargo][Cargo]].
7 
8 * features
9 ** configuration
10 The ~skel~ tool can be configured at runtime using the CLI flags, or
11 via local configuration files. The configuration files are in the
12 ~skelfile~ format and are assigned the following locations by default:
13 - ~*default-user-skelrc*~ :: =$HOME/.skelrc=
14 - ~*default-system-skelrc*~ :: =/etc/skel/skelrc=
15 
16 Both files are optional and the user skelrc takes precedence over
17 system.
18 
19 Example =~/.skelrc=:
20 #+begin_src skel :results pp replace :exports both
21  ;;; .skelrc @ 2023-10-12.02:58:08 -*- mode: skel; -*-
22  :author "Richard Westhaver <ellis@rwest.io>"
23  :user "ellis"
24  :version "0.1.0"
25  :tags ("auto")
26  :fmt :collapsed
27  :vc :hg
28  :auto-insert t
29  :license "MPL"
30  :log-level nil
31  :shed "~/lab/shed"
32  :stash "~/lab/stash"
33  :scripts "~/bin/sh"
34  :alias-list
35  (("p" "vc push")
36  ("P" "vc pull")
37  ("ci" "vc commit"))
38 #+end_src
39 
40 ** projects
41 Projects are the main top-level object users interact with. A project
42 consists of a list of slots which are populated automatically or by
43 the user. Once a project is initialized the slots can be accessed and
44 a set of high-level operations can be performed.
45 
46 The easiest way to initialize a project is with a ~skelfile~. These
47 files are parsed as a simplified Lisp dialect and generate
48 ~sk-project~ objects based on their contents.
49 
50 The simplest project looks like this:
51 
52 #+begin_src skel :results pp replace :exports both
53 :name hello-world
54 #+end_src
55 
56 Don't worry, this is still lisp - the parentheses are implied. All we
57 actually need is a name to generate an object, and we can fill in the
58 blanks later as the project develops.
59 
60 Here is a more verbose example, still with only metadata:
61 
62 #+begin_src skel :results pp replace :exports both
63 ;;; skelfile --- core skelfile -*- mode: skel; -*-
64 :name "core"
65 :author "Richard Westhaver <ellis@rwest.io>"
66 :version "0.1.0"
67 :license "MPL"
68 :description "The Compiler Company Core"
69 :vc :hg
70 :tags ("core")
71 :docs ((:org "readme") (:org "install") (:org "tests") (:org "todo"))
72 :imports ("lisp/lisp.sk" "rust/rust.sk")
73 #+end_src
74 
75 Another example with rules and components:
76 
77 #+begin_src skel
78 ;;; skelfile @ 2023-10-08.02:37:25 -*- mode: skel; -*-
79 :name skel
80 :author "ellis"
81 :version "0.1.0"
82 :description "a hacker's project compiler"
83 :license "MPL"
84 :vc :hg
85 :tags ("lisp")
86 :rules ((build () (print (asdf:make :skel/cli)))
87  (clean () #$rm -rf */*.fasl$#))
88 :docs ((:org "readme"))
89 :components
90 ((:elisp "sk"))
91 :stash "~/dev/comp/stash"
92 :shed "~/dev/comp/shed"
93 :snippets
94 ((autogen #$sbcl --eval '(ql:quickload :app/cli/skel)' --eval '(asdf:make :app/cli/skel)'$#))
95 #+end_src
96 ** version control
97 =skel= integrates closely with our Version Control System (VCS) which
98 is built on [[https://www.mercurial-scm.org/][Mercurial]], but we also interact with and host many [[https://git-scm.com/][Git]]
99 repositories.
100 
101 The =skel= tool helps us abstract away the differences between git/hg
102 and make maximum use of their utility. When you run a =skel vc=
103 command the currently active ~sk-project~ and configuration are used
104 to determine the appropriate VC backend to call. New backends can of
105 course be added as extensions.
106 
107 ** TODO compilers
108 - State "TODO" from [2023-12-09 Sat 19:28]
109 One of the most unusual features of =skel= is the compiler set. With
110 the =skel= CLI you can compile the following types of files for your
111 project directly from a ~skelfile~:
112 - Makefile (.mk)
113 - Lisp system defs (.asd)
114 - Cargo.toml
115 - Containerfile
116 - .hgignore/.gitignore
117 
118 We treat skelfiles as the mother of all build formats and consolidate
119 different formats into our own project DSL. This helps reduce
120 complexity while increasing capability and portability.
121 
122 Project compilation occurs on demand with the =sk compile= command.
123 
124 ** TODO virtualization
125 - State "TODO" from [2023-12-09 Sat 18:55]
126 
127  =skel= offers a mechanism for generating and running Virtual
128  Machines (VMs) and Containers. Under the hood we depend on [[https://podman.io/][podman]]
129  for our container runtime as well as [[https://www.qemu.org/][QEMU]] for some
130  functionality.
131 
132 ** TODO emacs integration
133 - State "TODO" from [2023-12-09 Sat 19:30]
134 =sk.el= is the Emacs support package for skel. It contains a
135 =skel-mode= for working with skelfiles and will soon contain
136 additional built-in integrations for =project.el=, =vc.el=, and more.
137 ** TODO deployment
138 - State "TODO" from [2023-12-09 Sat 19:37]
139 ** TODO visualization
140 - State "TODO" from [2023-12-09 Sat 19:37]
141 * help
142 #+begin_src shell :results pp replace :exports both
143 skel -h
144 #+end_src
145 
146 #+RESULTS:
147 #+begin_example
148 skel v0.1.1
149  usage: skel [global] <command> [<arg>]
150 
151  A hacker's project compiler and build tool.
152  options:
153  -h/--help* : print this message
154  -v/--version* : print version
155  -d/--debug* : set log level (debug,info,trace,warn)
156  -c/--config* : set a custom skel user config
157  -i/--input : input source
158  -o/--output : output target
159  commands:
160  init : initialize a skelfile in the current directory
161  -n/--name : project name
162 
163  show : describe the project skelfile
164  -f/--file : path to skelfile
165 
166  inspect : inspect the project skelfile
167  -f/--file : path to skelfile
168 
169  make : build project targets
170  -t/--target : target to build
171 
172  run : run a script or command
173 
174  push : push the current project upstream
175 
176  pull : pull the current project from remote
177 
178  clone : clone a remote project
179 
180  commit : commit changes to the project vc
181 
182  edit : edit a project file
183 
184  shell : open the sk-shell interpreter
185 
186 #+end_example
187