@takodotid/circuit 0.43.0 → 1.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (257) hide show
  1. package/README.md +115 -37
  2. package/package.json +21 -58
  3. package/src/checks/across.ts +402 -0
  4. package/src/checks/built-in.ts +256 -0
  5. package/src/checks/device.ts +436 -0
  6. package/src/checks/index.ts +53 -0
  7. package/src/cli/advisories.ts +108 -0
  8. package/src/cli/app.ts +67 -0
  9. package/src/cli/editor-types.generated.ts +30 -0
  10. package/src/cli/editor-types.ts +69 -0
  11. package/src/cli/format.ts +124 -0
  12. package/src/cli/git-hooks.ts +79 -0
  13. package/src/cli/index.ts +348 -1170
  14. package/src/cli/migrate.ts +554 -0
  15. package/src/cli/project-commands.ts +656 -0
  16. package/src/cli/releases.ts +374 -0
  17. package/src/cli/remember.ts +339 -0
  18. package/src/cli/rename.ts +27 -33
  19. package/src/cli/secrets-password.ts +60 -0
  20. package/src/cli/secrets.ts +258 -0
  21. package/src/cli/setup.ts +300 -0
  22. package/src/cli/signing.ts +23 -0
  23. package/src/cli/text-editor.ts +268 -0
  24. package/src/cli/ui.ts +298 -0
  25. package/src/cli/version.ts +2 -0
  26. package/src/cli/versions.ts +158 -0
  27. package/src/config/address.ts +102 -0
  28. package/src/config/circuit.d.ts +30 -0
  29. package/src/config/common.ts +65 -0
  30. package/src/config/communities.ts +479 -0
  31. package/src/config/define.ts +684 -0
  32. package/src/config/device.ts +164 -0
  33. package/src/config/firewall.ts +150 -0
  34. package/src/config/index.ts +22 -0
  35. package/src/{schema → config}/interfaces.ts +121 -85
  36. package/src/config/keys.ts +434 -0
  37. package/src/config/management.ts +61 -0
  38. package/src/config/merge.ts +335 -0
  39. package/src/config/models.ts +70 -0
  40. package/src/config/monitoring.ts +64 -0
  41. package/src/config/network.ts +180 -0
  42. package/src/config/presets.ts +149 -0
  43. package/src/config/routing.ts +401 -0
  44. package/src/config/services.ts +51 -0
  45. package/src/config/switching.ts +84 -0
  46. package/src/config/system.ts +103 -0
  47. package/src/{schema → config}/time-zones.ts +1 -1
  48. package/src/core/address.ts +1 -1
  49. package/src/core/cabling.ts +8 -43
  50. package/src/core/graph.ts +40 -0
  51. package/src/{integrations → core}/registries.ts +5 -3
  52. package/src/core/secrets-file.ts +539 -0
  53. package/src/core/secrets.ts +83 -64
  54. package/src/core/topology.ts +103 -146
  55. package/src/core/utils.ts +12 -1
  56. package/src/model.ts +83 -0
  57. package/src/platforms/derive.ts +64 -37
  58. package/src/platforms/finding.ts +9 -0
  59. package/src/platforms/fortios/firewall.ts +76 -64
  60. package/src/platforms/fortios/index.ts +189 -125
  61. package/src/platforms/fortios/names.ts +51 -18
  62. package/src/platforms/fortios/plan.ts +132 -44
  63. package/src/platforms/fortios/render.ts +69 -62
  64. package/src/platforms/fortios/routing.ts +89 -58
  65. package/src/platforms/fortios/vdoms.ts +47 -16
  66. package/src/platforms/junos/TRAPS.md +2 -2
  67. package/src/platforms/junos/bgp.ts +63 -42
  68. package/src/platforms/junos/index.ts +122 -89
  69. package/src/platforms/junos/render.ts +139 -104
  70. package/src/platforms/platform.ts +10 -8
  71. package/src/platforms/raisecom-ros/TRAPS.md +1 -1
  72. package/src/platforms/raisecom-ros/index.ts +89 -70
  73. package/src/platforms/raisecom-ros/render.ts +49 -45
  74. package/src/platforms/routeros/TRAPS.md +3 -3
  75. package/src/platforms/routeros/index.ts +121 -60
  76. package/src/platforms/routeros/render.ts +214 -195
  77. package/src/platforms/vrp/TRAPS.md +1 -1
  78. package/src/platforms/vrp/index.ts +74 -50
  79. package/src/platforms/vrp/render.ts +67 -56
  80. package/src/project/project.ts +725 -0
  81. package/src/studio/app/env.d.ts +9 -0
  82. package/src/studio/app/index.html +18 -0
  83. package/src/studio/app/src/App.vue +95 -0
  84. package/src/studio/app/src/components/AddressesView.vue +38 -0
  85. package/src/studio/app/src/components/CablesView.vue +29 -0
  86. package/src/studio/app/src/components/CompareView.vue +160 -0
  87. package/src/studio/app/src/components/DataTable.vue +49 -0
  88. package/src/studio/app/src/components/DeviceView.vue +237 -0
  89. package/src/studio/app/src/components/DevicesView.vue +32 -0
  90. package/src/studio/app/src/components/Faceplate.vue +75 -0
  91. package/src/studio/app/src/components/GraphView.vue +282 -0
  92. package/src/studio/app/src/components/LineDiff.vue +24 -0
  93. package/src/studio/app/src/components/ProblemsView.vue +42 -0
  94. package/src/studio/app/src/components/SearchView.vue +72 -0
  95. package/src/studio/app/src/components/SecretsView.vue +112 -0
  96. package/src/studio/app/src/components/SessionsView.vue +35 -0
  97. package/src/studio/app/src/components/Settings.vue +95 -0
  98. package/src/studio/app/src/components/ToolsView.vue +118 -0
  99. package/src/studio/app/src/components/VlansView.vue +50 -0
  100. package/src/studio/app/src/lib/csv.ts +19 -0
  101. package/src/studio/{public/diff.js → app/src/lib/diff.ts} +40 -35
  102. package/src/studio/app/src/lib/format.ts +38 -0
  103. package/src/studio/app/src/lib/net.ts +68 -0
  104. package/src/studio/app/src/lib/secrets-crypto.ts +35 -0
  105. package/src/studio/app/src/lib/store.ts +71 -0
  106. package/src/studio/app/src/lib/tools.ts +217 -0
  107. package/src/studio/app/src/main.ts +9 -0
  108. package/src/studio/{public → app/src}/style.css +14 -4
  109. package/src/studio/app/tsconfig.json +17 -0
  110. package/src/studio/app/vite.config.ts +16 -0
  111. package/src/studio/assets.generated.ts +3 -0
  112. package/src/studio/data.ts +96 -188
  113. package/src/studio/git.ts +27 -43
  114. package/src/studio/server.ts +196 -107
  115. package/src/studio/types.ts +141 -0
  116. package/src/transport/console.ts +3 -3
  117. package/src/transport/ssh.ts +1 -1
  118. package/dist/chunks/index-3b343xva.js +0 -177
  119. package/dist/chunks/index-6wb41q67.js +0 -62
  120. package/dist/chunks/index-n7w3tg5y.js +0 -149
  121. package/dist/chunks/index-yzw86rc8.js +0 -921
  122. package/dist/chunks/new-w3zys5y4.js +0 -172
  123. package/dist/chunks/server-cxr9ynxc.js +0 -259
  124. package/dist/cli/index.js +0 -12872
  125. package/dist/helpers/index.js +0 -881
  126. package/dist/index.js +0 -28
  127. package/dist/types/core/address-space.d.ts +0 -62
  128. package/dist/types/core/address.d.ts +0 -44
  129. package/dist/types/core/cabling.d.ts +0 -41
  130. package/dist/types/core/cross-checks.d.ts +0 -28
  131. package/dist/types/core/define.d.ts +0 -79
  132. package/dist/types/core/project-files.d.ts +0 -12
  133. package/dist/types/core/schema-docs.d.ts +0 -25
  134. package/dist/types/core/secrets.d.ts +0 -62
  135. package/dist/types/core/topology.d.ts +0 -96
  136. package/dist/types/core/utils.d.ts +0 -10
  137. package/dist/types/core/validator.d.ts +0 -23
  138. package/dist/types/helpers/bgp.d.ts +0 -195
  139. package/dist/types/helpers/cables.d.ts +0 -69
  140. package/dist/types/helpers/checks.d.ts +0 -36
  141. package/dist/types/helpers/exchange.d.ts +0 -55
  142. package/dist/types/helpers/filters.d.ts +0 -51
  143. package/dist/types/helpers/index.d.ts +0 -14
  144. package/dist/types/helpers/route-server.d.ts +0 -52
  145. package/dist/types/helpers/upstreams.d.ts +0 -192
  146. package/dist/types/index.d.ts +0 -10
  147. package/dist/types/integrations/librenms.d.ts +0 -60
  148. package/dist/types/integrations/netbox.d.ts +0 -89
  149. package/dist/types/integrations/peeringdb.d.ts +0 -24
  150. package/dist/types/integrations/prometheus.d.ts +0 -24
  151. package/dist/types/integrations/registries.d.ts +0 -8
  152. package/dist/types/platforms/bgp-wait.d.ts +0 -24
  153. package/dist/types/platforms/catalog.d.ts +0 -109
  154. package/dist/types/platforms/derive.d.ts +0 -17
  155. package/dist/types/platforms/fortios/firewall.d.ts +0 -47
  156. package/dist/types/platforms/fortios/index.d.ts +0 -140
  157. package/dist/types/platforms/fortios/models.d.ts +0 -14
  158. package/dist/types/platforms/fortios/names.d.ts +0 -52
  159. package/dist/types/platforms/fortios/plan.d.ts +0 -104
  160. package/dist/types/platforms/fortios/render.d.ts +0 -77
  161. package/dist/types/platforms/fortios/routing.d.ts +0 -56
  162. package/dist/types/platforms/fortios/tree.d.ts +0 -37
  163. package/dist/types/platforms/fortios/vdoms.d.ts +0 -50
  164. package/dist/types/platforms/index.d.ts +0 -13
  165. package/dist/types/platforms/junos/bgp.d.ts +0 -44
  166. package/dist/types/platforms/junos/index.d.ts +0 -114
  167. package/dist/types/platforms/junos/models.d.ts +0 -14
  168. package/dist/types/platforms/junos/render.d.ts +0 -154
  169. package/dist/types/platforms/line-diff.d.ts +0 -67
  170. package/dist/types/platforms/platform.d.ts +0 -135
  171. package/dist/types/platforms/raisecom-ros/index.d.ts +0 -71
  172. package/dist/types/platforms/raisecom-ros/models.d.ts +0 -14
  173. package/dist/types/platforms/raisecom-ros/render.d.ts +0 -41
  174. package/dist/types/platforms/routeros/export.d.ts +0 -59
  175. package/dist/types/platforms/routeros/index.d.ts +0 -116
  176. package/dist/types/platforms/routeros/models.d.ts +0 -18
  177. package/dist/types/platforms/routeros/plan.d.ts +0 -58
  178. package/dist/types/platforms/routeros/render.d.ts +0 -250
  179. package/dist/types/platforms/vrp/index.d.ts +0 -83
  180. package/dist/types/platforms/vrp/models.d.ts +0 -12
  181. package/dist/types/platforms/vrp/render.d.ts +0 -96
  182. package/dist/types/schema/common.d.ts +0 -30
  183. package/dist/types/schema/device.d.ts +0 -126
  184. package/dist/types/schema/firewall.d.ts +0 -131
  185. package/dist/types/schema/index.d.ts +0 -8
  186. package/dist/types/schema/interfaces.d.ts +0 -205
  187. package/dist/types/schema/policy.d.ts +0 -107
  188. package/dist/types/schema/routing.d.ts +0 -161
  189. package/dist/types/schema/system.d.ts +0 -198
  190. package/dist/types/schema/time-zones.d.ts +0 -2
  191. package/dist/types/transport/console.d.ts +0 -115
  192. package/dist/types/transport/path-check.d.ts +0 -32
  193. package/dist/types/transport/ssh.d.ts +0 -27
  194. package/src/cli/graph-format.ts +0 -91
  195. package/src/cli/new.ts +0 -234
  196. package/src/core/address-space.ts +0 -320
  197. package/src/core/cross-checks.ts +0 -369
  198. package/src/core/define.ts +0 -124
  199. package/src/core/project-files.ts +0 -35
  200. package/src/core/schema-docs.ts +0 -174
  201. package/src/core/validator.ts +0 -508
  202. package/src/helpers/bgp.ts +0 -473
  203. package/src/helpers/cables.ts +0 -74
  204. package/src/helpers/checks.ts +0 -201
  205. package/src/helpers/exchange.ts +0 -123
  206. package/src/helpers/filters.ts +0 -107
  207. package/src/helpers/index.ts +0 -25
  208. package/src/helpers/route-server.ts +0 -212
  209. package/src/helpers/upstreams.ts +0 -369
  210. package/src/index.ts +0 -13
  211. package/src/integrations/librenms.ts +0 -291
  212. package/src/integrations/netbox.ts +0 -620
  213. package/src/integrations/peeringdb.ts +0 -173
  214. package/src/integrations/prometheus.ts +0 -90
  215. package/src/schema/common.ts +0 -41
  216. package/src/schema/device.ts +0 -145
  217. package/src/schema/firewall.ts +0 -140
  218. package/src/schema/index.ts +0 -8
  219. package/src/schema/policy.ts +0 -115
  220. package/src/schema/routing.ts +0 -173
  221. package/src/schema/system.ts +0 -203
  222. package/src/studio/public/app.js +0 -186
  223. package/src/studio/public/compare.js +0 -250
  224. package/src/studio/public/dom.js +0 -138
  225. package/src/studio/public/evaluate.js +0 -687
  226. package/src/studio/public/export.js +0 -130
  227. package/src/studio/public/graph.js +0 -1541
  228. package/src/studio/public/index.html +0 -83
  229. package/src/studio/public/net.js +0 -134
  230. package/src/studio/public/tables.js +0 -1289
  231. package/src/studio/public/tools.js +0 -610
  232. package/templates/colocation/checks.ts +0 -53
  233. package/templates/colocation/circuit.config.ts +0 -9
  234. package/templates/colocation/edge-01.ts +0 -133
  235. package/templates/colocation/routing.ts +0 -13
  236. package/templates/colocation/tenancy.ts +0 -76
  237. package/templates/colocation/tenants/acme.ts +0 -19
  238. package/templates/colocation/tenants/index.ts +0 -6
  239. package/templates/colocation/tor-01.ts +0 -33
  240. package/templates/edge-router/checks.ts +0 -20
  241. package/templates/edge-router/circuit.config.ts +0 -8
  242. package/templates/edge-router/edge-01.ts +0 -110
  243. package/templates/edge-router/routing.ts +0 -13
  244. package/templates/project/AGENTS.md +0 -51
  245. package/templates/project/CLAUDE.md +0 -1
  246. package/templates/project/README.md +0 -16
  247. package/templates/project/gitignore +0 -5
  248. package/templates/project/tsconfig.json +0 -13
  249. package/templates/single-site/checks.ts +0 -26
  250. package/templates/single-site/circuit.config.ts +0 -8
  251. package/templates/single-site/router.ts +0 -86
  252. package/templates/single-site/site.ts +0 -18
  253. package/templates/single-site/switch.ts +0 -34
  254. /package/src/studio/{public → app/public}/favicon.svg +0 -0
  255. /package/src/studio/{public → app/public}/special-gothic-latin-ext.woff2 +0 -0
  256. /package/src/studio/{public → app/public}/special-gothic-latin.woff2 +0 -0
  257. /package/src/studio/{public → app/public}/special-gothic-license.txt +0 -0
package/README.md CHANGED
@@ -1,62 +1,140 @@
1
- # Circuit
2
-
3
- Write how each router and switch should be configured, in one TypeScript file per device. Circuit shows you what would change, then makes the device match.
4
-
5
- Documentation: [circuit.tako.id](https://circuit.tako.id)
1
+ <p align="center">
2
+ <a href="https://circuit.tako.id">
3
+ <picture>
4
+ <source media="(prefers-color-scheme: dark)" srcset="docs/public/logotype-dark.png">
5
+ <img src="docs/public/logotype.png" alt="Circuit" width="320">
6
+ </picture>
7
+ </a>
8
+ </p>
9
+
10
+ <p align="center"><b>Your network, written down.</b><br>One TypeScript file per device. Circuit shows what would change, then makes the device match.</p>
11
+
12
+ <p align="center">
13
+ <a href="https://github.com/takodotid/circuit/actions/workflows/check.yml?query=branch%3Av1"><img src="https://github.com/takodotid/circuit/actions/workflows/check.yml/badge.svg?branch=v1" alt="check"></a>
14
+ <a href="https://github.com/takodotid/circuit/releases"><img src="https://img.shields.io/github/v/release/takodotid/circuit?include_prereleases&label=release&color=0a47b8" alt="release"></a>
15
+ <a href="https://www.npmjs.com/package/@takodotid/circuit"><img src="https://img.shields.io/npm/v/@takodotid/circuit?color=0a47b8" alt="npm"></a>
16
+ <a href="LICENSE"><img src="https://img.shields.io/badge/license-BSL%201.1-0a47b8" alt="license"></a>
17
+ <a href="https://circuit.tako.id"><img src="https://img.shields.io/badge/docs-circuit.tako.id-f8e347" alt="docs"></a>
18
+ </p>
19
+
20
+ <p align="center">
21
+ <img src="https://img.shields.io/badge/MikroTik-RouterOS%207-0a1a36" alt="RouterOS 7">
22
+ <img src="https://img.shields.io/badge/Huawei-VRP-0a1a36" alt="VRP">
23
+ <img src="https://img.shields.io/badge/Raisecom-ROS-0a1a36" alt="Raisecom ROS">
24
+ <img src="https://img.shields.io/badge/Juniper-Junos-0a1a36" alt="Junos">
25
+ <img src="https://img.shields.io/badge/Fortinet-FortiOS-0a1a36" alt="FortiOS">
26
+ </p>
27
+
28
+ <p align="center">
29
+ <a href="https://circuit.tako.id/guide/install">Install</a> ·
30
+ <a href="https://circuit.tako.id/guide/introduction">Guide</a> ·
31
+ <a href="https://circuit.tako.id/academy/">Academy</a> ·
32
+ <a href="https://circuit.tako.id/studio/">Studio</a>
33
+ </p>
6
34
 
7
35
  > [!WARNING]
8
- > Circuit is in alpha. It runs a production network, but the way you write config, the commands and the supported devices can still change between releases. Install an exact version, and read the release notes before you upgrade.
36
+ > Circuit v1 is not released yet. It is a rewrite of the config language, and every version is a release candidate, `1.0.0-rc.N`, until it is stable. The language, the model and the commands can still change between candidates. Circuit 0.x, the version in use today, is on the `main` branch.
9
37
 
10
38
  ## What it does
11
39
 
12
- - **One file per device.** VLANs, ports, addresses, routing, firewall, users and services in TypeScript. Your editor checks every name as you type.
40
+ - **One file per device.** Ports, VLANs, addresses, routing, BGP, firewall, users and services, written as plain data. Your editor checks every name and every port as you type.
41
+ - **Plain TypeScript, nothing to install.** A project imports nothing from Circuit. Circuit's functions are globals, and the editor reads its types from `.circuit/types`, which Circuit writes.
42
+ - **One binary, nothing else to install.** `circuit` reads the project, checks what the editor can't, and talks to the devices.
13
43
  - **Same words for every vendor.** MikroTik RouterOS 7, Huawei VRP, Raisecom ROS, Juniper Junos and Fortinet FortiOS each get their own commands. Anything a device can't do is an error before anything is sent.
14
- - **The file is the whole truth.** A port, user or service the file doesn't mention is removed or turned off, so nothing set by hand stays behind.
15
- - **See every change first.** `diff` shows it offline, `apply` plans it against the live device, and nothing is sent without `--confirm`. On RouterOS, Junos and FortiOS a change undoes itself if Circuit can't log in again afterwards.
16
- - **History in git.** Each device's last snapshot lives in `.circuit/state/`, so the repo's history is the network's history.
17
- - **Your own rules.** Checks run on every change; helpers give ready-made filters, BGP policies and checks.
18
- - **Secrets stay out of the repo.** They come from `.env` or 1Password and never show up in a plan or a snapshot.
19
- - **See the network.** `circuit studio` draws cables, VLANs, addresses, BGP, OSPF and tunnels in your browser, marks what's broken or differs from the device, and lists everything in tables for people who don't read TypeScript. It can run on a server for the whole team. `circuit graph` prints the drawing as Mermaid, DOT or JSON.
20
- - **Keeps the rest in step.** Prefix lists from a registry, your PeeringDB record, LibreNMS, NetBox, Prometheus targets, WireGuard client configs, and your BGP communities for a looking glass.
21
- - **Safe with AI agents.** Every project gets an `AGENTS.md` that says what an agent may run; the last step stays yours.
44
+ - **The file is the whole truth.** A port, user or service the file doesn't write is removed or turned off. Circuit fills in nothing you didn't write.
45
+ - **See every change first.** `diff` and `apply` read the live device and show what would change; `apply` sends it only once you say yes.
46
+ - **Secrets are encrypted.** Each value in `.circuit/secrets` is encrypted, so the file is committed; the one password that opens it stays out of git, in your password manager. A git hook stops a commit with a secret in plain text.
47
+
48
+ ## A device
49
+
50
+ ```ts
51
+ // sites/site-a/switch-01.ts
52
+ import { as64500 } from "../../circuit";
53
+ import { site_a } from "./site";
54
+
55
+ export default as64500.device({
56
+ name: "switch-01",
57
+ site: "site-a",
58
+ platform: "vrp",
59
+ model: "CE6855-48S6Q-HI",
60
+ connection: { host: "192.0.2.2", user: "netops" },
61
+ system: {
62
+ users: { netops: { role: "admin", password: secret("SWITCH_01_ADMIN_PASSWORD") } },
63
+ },
64
+ interfaces: {
65
+ ethernet: {
66
+ "10g-1": { description: "edge-01 sfp28-2", trunk_vlans: ["mgmt"], link: { device: "edge-01", port: "25g-2" } },
67
+ },
68
+ vlan_interface: {
69
+ mgmt: { vlan: "mgmt", addresses: [site_a.addresses.switch] },
70
+ },
71
+ },
72
+ switching: {
73
+ vlans: { mgmt: site_a.vlans.mgmt },
74
+ },
75
+ });
76
+ ```
22
77
 
23
- <picture>
24
- <source media="(prefers-color-scheme: dark)" srcset="docs/public/screenshots/studio-dark.png">
25
- <img src="docs/public/screenshots/studio-light.png" alt="Studio's VLAN graph with devices that differ from their snapshots marked by orange dashed borders, beside the layer details and legend.">
26
- </picture>
78
+ In the editor, `"10g-49"` is an error, `10g-49 is not a port of CE6855-48S6Q-HI`, and so is `trunk_vlans: ["mgnt"]`: the device has no VLAN of that name. `circuit validate` says the same, with the file and line, and `Did you mean mgmt?`. [How to write a project](docs/guide/project.md) has the whole project: this switch in full, a router and a tenant.
27
79
 
28
- ## Circuit Academy
80
+ ## Circuit Studio
29
81
 
30
- New to networking? [Circuit Academy](https://circuit.tako.id/academy/) teaches it from the very start, in lessons you try in the browser rather than only read: packets, addresses, switches and routers first, then VLANs, DHCP, NAT and firewalls written down in Circuit, BGP and an edge router of your own, and on to running a provider network. A certification is coming.
82
+ `circuit studio` draws the network and lists everything in the project, in your browser.
31
83
 
32
84
  <picture>
33
- <source media="(prefers-color-scheme: dark)" srcset="docs/public/screenshots/academy-dark.png">
34
- <img src="docs/public/screenshots/academy-light.png" alt="A Circuit Academy lesson on switches: a frame from a laptop to a printer has just been flooded out of every port, and the switch has learned which port the laptop is behind.">
85
+ <source media="(prefers-color-scheme: dark)" srcset="docs/public/screenshots/studio-dark.png">
86
+ <img src="docs/public/screenshots/studio-light.png" alt="Circuit Studio's graph of an example network, beside the layer's details.">
35
87
  </picture>
36
88
 
37
89
  ## Start
38
90
 
39
- You need [Node.js](https://nodejs.org) 22.12 or newer, or [Bun](https://bun.sh). Then:
40
-
41
- ```bash
42
- npx @takodotid/circuit new # or: pnpm dlx @takodotid/circuit new, bunx @takodotid/circuit new
43
- ```
44
-
45
- It asks which kind of network you have, creates a project with example devices, and installs Circuit. [Getting started](https://circuit.tako.id/guide/getting-started) walks through the first run.
46
-
47
- Circuit supports MikroTik RouterOS 7, Huawei VRP V200R005, Raisecom ROS 6.5, Juniper Junos 21 and Fortinet FortiOS 6.2, at the versions on the [platforms page](https://circuit.tako.id/platforms/). Releases are on the [releases page](https://github.com/takodotid/circuit/releases), on npm and on GitHub Packages.
91
+ 1. Install Circuit:
92
+ - Linux and macOS: `curl -fsSL https://circuit.tako.id/install | sh`
93
+ - Windows, in PowerShell: `irm https://circuit.tako.id/install.ps1 | iex`
94
+ 2. Start a project: `circuit new network`. Open its folder in VS Code. Add a site in `circuit.ts`, then write each device in `sites/<site>/<device>.ts`.
95
+ 3. Run `circuit`. It opens a menu, or runs a command straight away, such as `circuit validate`.
96
+
97
+ Each project runs the Circuit version in its `.circuit/version`. `circuit update` lists the newer versions, newest first, and moves the project to the one you pick. Circuit itself updates on its own, and a project on a version with a security problem has to move before anything runs.
98
+
99
+ ## Commands
100
+
101
+ Each reads the project in the working directory or the nearest folder above it. Leave out the device and Circuit lists them to pick from.
102
+
103
+ | Command | What it does |
104
+ | ----------------------------------- | ------------------------------------------------------------------------------------------------------ |
105
+ | `validate` | Reads the project and checks it, then runs every check in `circuit.ts`. |
106
+ | `diff [device]` | Reads the device and shows what `apply` would change. |
107
+ | `apply [device]` | Reads the device, shows what would change, and sends it once you say yes (`--confirm`). |
108
+ | `exec [device] [command...]` | Runs commands that only read on the device, and prints the answer, secrets hidden. |
109
+ | `bgp [device]` | Each BGP neighbor next to its live session: up or down, prefixes, uptime. |
110
+ | `access-console [device] [line...]` | Opens the device's serial console, logged in, or sends it lines. |
111
+ | `studio` | Opens the project in your browser: the graph, every table, tools, compare and secrets. |
112
+ | `rename [device] [new-name]` | Gives a device a new name everywhere the project writes it, and its file too. |
113
+ | `secrets` | Every secret in a text editor, saved encrypted; `list`, `get`, `set`, `delete`, `encrypt`, `password`. |
114
+ | `fmt [file...]` | Tidies spacing and line breaks, as VS Code does on save. Nothing else changes. |
115
+ | `new [folder]` | Starts a project. |
116
+ | `update` | Pick a newer version for the project, newest first. Outside a project: Circuit's own. |
117
+ | `uninstall` | Removes Circuit. Your projects stay. |
118
+
119
+ ## Docs
120
+
121
+ - [The documentation site](https://circuit.tako.id), whose pages are in `docs/`: install, writing a project, the `circuit` command, secrets, Studio, and Circuit Academy.
122
+ - [How to write a project](docs/guide/project.md), then [rules](docs/guide/rules.md), [parts and merge](docs/guide/parts.md), [communities](docs/guide/communities.md) and [checks](docs/guide/checks.md).
123
+ - [The model](docs/reference/model.md): what one device holds, and what Circuit resolves before a platform reads it.
124
+ - [Decisions](design/decisions.md): what shaped v1, and why.
125
+ - `src/config/`: every field, with its doc comment, which your editor shows on hover.
48
126
 
49
127
  ## Working on Circuit
50
128
 
51
129
  ```bash
52
130
  bun install
53
- bun run check # everything CI runs: typecheck, tests, format, docs build, Node build
54
- bun run test # every example and template validates, and plans nothing against its own render
55
- bun run docs:dev # the documentation site, from docs/
131
+ bun run check # typecheck, tests, and the binary
132
+ bun run build # dist/circuit, or dist/circuit.exe on Windows
133
+ cd <project> && bun <circuit>/src/cli/index.ts validate # run Circuit from the sources
56
134
  ```
57
135
 
58
- [Contributing](https://circuit.tako.id/contributing) explains the layout, how to add a platform, and how releases are cut. `AGENTS.md` has the rules for changing the code, for people and AI agents alike; `.claude/skills/` has the step-by-step guides an agent loads, such as adding a device.
136
+ `AGENTS.md` has the rules for changing the code, for people and AI agents alike.
59
137
 
60
138
  ## License
61
139
 
62
- [Business Source License 1.1](LICENSE): free in production for an organization whose yearly revenue and funding, with its affiliates, are each under US$100,000. Above that, production use needs a commercial license from [legal@tako.id](mailto:legal@tako.id). Each version becomes Apache License 2.0 four years after it is published. See [License](https://circuit.tako.id/license).
140
+ [Business Source License 1.1](LICENSE): free in production for an organization whose yearly revenue and funding, with its affiliates, are each under US$100,000. Above that, production use needs a commercial license from [legal@tako.id](mailto:legal@tako.id). Each version becomes Apache License 2.0 four years after it is published.
package/package.json CHANGED
@@ -1,25 +1,7 @@
1
1
  {
2
2
  "name": "@takodotid/circuit",
3
- "version": "0.43.0",
4
- "description": "Declarative, vendor-neutral network configuration: describe each device in TypeScript, and Circuit makes the device match. Alpha.",
5
- "keywords": [
6
- "network",
7
- "network-automation",
8
- "infrastructure-as-code",
9
- "declarative",
10
- "netops",
11
- "bgp",
12
- "routeros",
13
- "mikrotik",
14
- "vrp",
15
- "huawei",
16
- "raisecom",
17
- "junos",
18
- "juniper",
19
- "fortios",
20
- "fortinet",
21
- "fortigate"
22
- ],
3
+ "version": "1.0.0-rc.1",
4
+ "description": "Declarative, vendor-neutral network configuration: describe each device in TypeScript, and Circuit makes the device match. One binary, nothing to install.",
23
5
  "homepage": "https://circuit.tako.id",
24
6
  "bugs": {
25
7
  "url": "https://github.com/takodotid/circuit/issues",
@@ -48,68 +30,49 @@
48
30
  }
49
31
  ],
50
32
  "type": "module",
51
- "exports": {
52
- ".": {
53
- "types": "./dist/types/index.d.ts",
54
- "bun": "./src/index.ts",
55
- "default": "./dist/index.js"
56
- },
57
- "./helpers": {
58
- "types": "./dist/types/helpers/index.d.ts",
59
- "bun": "./src/helpers/index.ts",
60
- "default": "./dist/helpers/index.js"
61
- }
62
- },
63
33
  "bin": {
64
- "circuit": "dist/cli/index.js"
34
+ "circuit": "src/cli/index.ts"
65
35
  },
66
36
  "files": [
67
37
  "src",
68
- "dist",
69
- "templates",
70
38
  "LICENSE",
71
39
  "README.md"
72
40
  ],
73
- "engines": {
74
- "node": ">=22.12",
75
- "bun": ">=1.3.5"
76
- },
77
- "publishConfig": {
78
- "access": "public"
79
- },
80
41
  "scripts": {
81
- "typecheck": "bunx tsc --noEmit",
42
+ "typecheck": "bunx tsc --noEmit && bunx tsc --noEmit -p src/studio/app",
82
43
  "test": "bun test",
83
44
  "build": "bun scripts/build.ts",
45
+ "studio": "bun scripts/studio.ts",
84
46
  "format": "bunx prettier --write .",
85
47
  "format:check": "bunx prettier --check .",
86
- "docs:dev": "bun scripts/schema-reference.ts && vitepress dev docs",
87
- "docs:build": "bun scripts/schema-reference.ts && vitepress build docs",
88
- "docs:preview": "vitepress preview docs",
89
- "release": "bun scripts/release.ts",
90
- "prepare": "husky || true",
91
- "prepack": "bun run build",
92
- "check": "bun run typecheck && bun run test && bun run format:check && bun run docs:build && bun run build && bunx tsc -p test/package && node dist/cli/index.js validate --config templates/single-site/circuit.config.ts && node dist/cli/index.js validate --config templates/edge-router/circuit.config.ts && node dist/cli/index.js validate --config templates/colocation/circuit.config.ts",
93
- "agents:setup": "npx -y skills experimental_install"
48
+ "docs:dev": "bun install --cwd docs && bun run --cwd docs dev",
49
+ "docs:build": "bun install --cwd docs --frozen-lockfile && bun run --cwd docs build",
50
+ "docs:preview": "bun run --cwd docs preview",
51
+ "check": "bun run studio && bun run typecheck && bun run test && bun run format:check && bun run build",
52
+ "prepare": "bun run studio; husky || true"
94
53
  },
95
54
  "dependencies": {
96
- "@clack/prompts": "^1.8.1",
55
+ "@clack/prompts": "1.8.1",
97
56
  "@commander-js/extra-typings": "~15.0.0",
98
- "@types/ssh2": "^1.15.6",
99
57
  "commander": "~15.0.0",
100
- "jiti": "^2.7.0",
101
- "ssh2": "^1.17.0",
102
- "yaml": "^2.9.1"
58
+ "prettier": "3.9.10",
59
+ "ssh2": "^1.17.0"
103
60
  },
104
61
  "devDependencies": {
105
62
  "@commitlint/cli": "^21.2.4",
106
63
  "@commitlint/config-conventional": "^21.2.4",
64
+ "@noble/ciphers": "1.3.0",
65
+ "@noble/hashes": "1.8.0",
107
66
  "@types/bun": "^1.4.4",
108
67
  "@types/node": "^24.19.2",
68
+ "@types/ssh2": "^1.15.6",
69
+ "@vitejs/plugin-vue": "6.0.10",
70
+ "cytoscape": "3.34.4",
109
71
  "husky": "^9.1.7",
110
- "prettier": "^3.9.10",
111
72
  "typescript": "^7.0.2",
112
- "vitepress": "^1.6.4"
73
+ "typescript-6": "npm:typescript@6.0.3",
74
+ "vite": "8.3.5",
75
+ "vue": "3.5.44"
113
76
  },
114
77
  "packageManager": "bun@1.4.4"
115
78
  }