Add New Diagram command with starter templates
- Archify: New Diagram… (Explorer folder menu, File > New File…, Command Palette) creates a .archify file from a template and opens the diagram - Six YAML templates: architecture, workflow, sequence, dataflow, lifecycle and an everyday plan; connections carry ids, workflows use schema 2 - Title and meta.output follow the file name; template comments are kept - Tests: every template passes archify validate; integration check for the command Closes #2
This commit is contained in:
@@ -0,0 +1,50 @@
|
||||
# Architecture: the parts of a system and how they connect.
|
||||
# Components need a unique id; connections link component ids.
|
||||
schema_version: 1
|
||||
diagram_type: architecture
|
||||
meta:
|
||||
title: Web Application
|
||||
output: architecture.html
|
||||
components:
|
||||
- id: users
|
||||
type: external
|
||||
label: Users
|
||||
sublabel: Browser
|
||||
pos: [40, 160]
|
||||
size: [130, 60]
|
||||
- id: api
|
||||
type: backend
|
||||
label: API
|
||||
sublabel: REST service
|
||||
pos: [250, 160]
|
||||
size: [130, 60]
|
||||
- id: cache
|
||||
type: database
|
||||
label: Cache
|
||||
sublabel: Redis
|
||||
pos: [460, 60]
|
||||
size: [130, 60]
|
||||
- id: db
|
||||
type: database
|
||||
label: Database
|
||||
sublabel: PostgreSQL
|
||||
pos: [460, 260]
|
||||
size: [130, 60]
|
||||
boundaries:
|
||||
- kind: region
|
||||
label: Production
|
||||
wraps: [api, cache, db]
|
||||
connections:
|
||||
- id: users-api
|
||||
from: users
|
||||
to: api
|
||||
label: HTTPS
|
||||
variant: emphasis
|
||||
- id: api-cache
|
||||
from: api
|
||||
to: cache
|
||||
label: read
|
||||
- id: api-db
|
||||
from: api
|
||||
to: db
|
||||
label: SQL
|
||||
@@ -0,0 +1,55 @@
|
||||
# Data flow: where data comes from, how it is transformed, and where it ends up.
|
||||
# Nodes sit in stages (columns) and rows; flows link node ids.
|
||||
schema_version: 1
|
||||
diagram_type: dataflow
|
||||
meta:
|
||||
title: Sales Reporting
|
||||
output: dataflow.html
|
||||
viewBox: [960, 420]
|
||||
stages:
|
||||
- label: Sources
|
||||
- label: Processing
|
||||
- label: Storage
|
||||
- label: Consumers
|
||||
nodes:
|
||||
- id: shop
|
||||
type: frontend
|
||||
label: Web Shop
|
||||
stage: 0
|
||||
row: 0
|
||||
- id: crm
|
||||
type: external
|
||||
label: CRM
|
||||
stage: 0
|
||||
row: 1
|
||||
- id: etl
|
||||
type: backend
|
||||
label: Nightly ETL
|
||||
stage: 1
|
||||
row: 0
|
||||
- id: warehouse
|
||||
type: database
|
||||
label: Warehouse
|
||||
stage: 2
|
||||
row: 0
|
||||
- id: dashboard
|
||||
type: frontend
|
||||
label: Sales Dashboard
|
||||
stage: 3
|
||||
row: 0
|
||||
flows:
|
||||
- from: shop
|
||||
to: etl
|
||||
label: orders
|
||||
- from: crm
|
||||
to: etl
|
||||
label: customers
|
||||
classification: PII
|
||||
variant: security
|
||||
- from: etl
|
||||
to: warehouse
|
||||
label: daily facts
|
||||
variant: emphasis
|
||||
- from: warehouse
|
||||
to: dashboard
|
||||
label: aggregates
|
||||
@@ -0,0 +1,72 @@
|
||||
# Everyday plan: a workflow about daily life rather than software.
|
||||
# Node types set the colour; meta.legend renames them for the reader,
|
||||
# and icon picks the corner symbol (calendar, clock, person, briefcase, flag, moon).
|
||||
schema_version: 2
|
||||
diagram_type: workflow
|
||||
meta:
|
||||
title: Summer Holiday Plan
|
||||
output: everyday-plan.html
|
||||
legend:
|
||||
entries:
|
||||
backend:
|
||||
label: Time off
|
||||
security:
|
||||
label: Work
|
||||
external:
|
||||
label: Milestone
|
||||
lanes:
|
||||
- id: plan
|
||||
label: Plan
|
||||
- id: work
|
||||
label: Work
|
||||
mainPath: [today, book, holiday, back]
|
||||
nodes:
|
||||
- id: today
|
||||
lane: plan
|
||||
col: 0
|
||||
type: external
|
||||
label: Today
|
||||
icon: clock
|
||||
- id: book
|
||||
lane: plan
|
||||
col: 1
|
||||
type: external
|
||||
label: Book flights
|
||||
sublabel: by end of May
|
||||
icon: flag
|
||||
- id: holiday
|
||||
lane: plan
|
||||
col: 2
|
||||
type: backend
|
||||
label: Holiday
|
||||
sublabel: 2 weeks
|
||||
icon: calendar
|
||||
- id: back
|
||||
lane: plan
|
||||
col: 3
|
||||
type: external
|
||||
label: Back home
|
||||
icon: flag
|
||||
- id: handover
|
||||
lane: work
|
||||
col: 1
|
||||
type: security
|
||||
label: Handover
|
||||
icon: briefcase
|
||||
edges:
|
||||
- id: plan-booking
|
||||
from: today
|
||||
to: book
|
||||
- id: go
|
||||
from: book
|
||||
to: holiday
|
||||
label: leave approved
|
||||
- id: return
|
||||
from: holiday
|
||||
to: back
|
||||
- id: prepare
|
||||
from: today
|
||||
to: handover
|
||||
label: before leaving
|
||||
role: branch
|
||||
variant: security
|
||||
@@ -0,0 +1,53 @@
|
||||
# Lifecycle: the states something moves through and what moves it.
|
||||
# States sit in lanes and columns; transitions link state ids.
|
||||
schema_version: 1
|
||||
diagram_type: lifecycle
|
||||
meta:
|
||||
title: Order Status
|
||||
output: lifecycle.html
|
||||
viewBox: [880, 566]
|
||||
lanes:
|
||||
- id: main
|
||||
label: Normal path
|
||||
- id: exits
|
||||
label: Exits
|
||||
states:
|
||||
- id: placed
|
||||
type: start
|
||||
label: Placed
|
||||
lane: main
|
||||
col: 0
|
||||
- id: paid
|
||||
type: active
|
||||
label: Paid
|
||||
lane: main
|
||||
col: 1
|
||||
- id: shipped
|
||||
type: active
|
||||
label: Shipped
|
||||
lane: main
|
||||
col: 2
|
||||
- id: delivered
|
||||
type: success
|
||||
label: Delivered
|
||||
lane: main
|
||||
col: 3
|
||||
- id: cancelled
|
||||
type: failure
|
||||
label: Cancelled
|
||||
lane: exits
|
||||
col: 0
|
||||
transitions:
|
||||
- id: pay
|
||||
from: placed
|
||||
to: paid
|
||||
- id: ship
|
||||
from: paid
|
||||
to: shipped
|
||||
- id: deliver
|
||||
from: shipped
|
||||
to: delivered
|
||||
- id: cancel
|
||||
from: placed
|
||||
to: cancelled
|
||||
variant: security
|
||||
@@ -0,0 +1,50 @@
|
||||
# Sequence: who calls whom, in order. Participants are columns;
|
||||
# messages run top to bottom by y.
|
||||
schema_version: 1
|
||||
diagram_type: sequence
|
||||
meta:
|
||||
title: Login Request
|
||||
output: sequence.html
|
||||
viewBox: [960, 520]
|
||||
participants:
|
||||
- id: client
|
||||
type: external
|
||||
label: Client
|
||||
- id: api
|
||||
type: backend
|
||||
label: API
|
||||
- id: auth
|
||||
type: security
|
||||
label: Auth Service
|
||||
- id: db
|
||||
type: database
|
||||
label: User Store
|
||||
messages:
|
||||
- from: client
|
||||
to: api
|
||||
y: 160
|
||||
label: POST /login
|
||||
variant: emphasis
|
||||
- from: api
|
||||
to: auth
|
||||
y: 210
|
||||
label: verify credentials
|
||||
- from: auth
|
||||
to: db
|
||||
y: 260
|
||||
label: find user
|
||||
- from: db
|
||||
to: auth
|
||||
y: 310
|
||||
label: user record
|
||||
variant: return
|
||||
- from: auth
|
||||
to: api
|
||||
y: 360
|
||||
label: token
|
||||
variant: return
|
||||
- from: api
|
||||
to: client
|
||||
y: 410
|
||||
label: 200 OK + token
|
||||
variant: return
|
||||
@@ -0,0 +1,70 @@
|
||||
# Workflow: steps of a process, grouped in lanes, left to right by col.
|
||||
# mainPath lists the happy path; edges link node ids.
|
||||
schema_version: 2
|
||||
diagram_type: workflow
|
||||
meta:
|
||||
title: Change Approval
|
||||
output: workflow.html
|
||||
# Rename the legend entries of the node types you use.
|
||||
legend:
|
||||
entries:
|
||||
frontend:
|
||||
label: Author step
|
||||
security:
|
||||
label: Review gate
|
||||
backend:
|
||||
label: Decision
|
||||
external:
|
||||
label: Outcome
|
||||
lanes:
|
||||
- id: author
|
||||
label: Author
|
||||
- id: review
|
||||
label: Reviewers
|
||||
mainPath: [draft, review, approved, released]
|
||||
nodes:
|
||||
- id: draft
|
||||
lane: author
|
||||
col: 0
|
||||
type: frontend
|
||||
label: Draft change
|
||||
- id: review
|
||||
lane: review
|
||||
col: 1
|
||||
type: security
|
||||
label: Review
|
||||
sublabel: two approvals
|
||||
- id: approved
|
||||
lane: review
|
||||
col: 2
|
||||
type: backend
|
||||
label: Approved
|
||||
- id: released
|
||||
lane: author
|
||||
col: 3
|
||||
type: external
|
||||
label: Released
|
||||
- id: rework
|
||||
lane: author
|
||||
col: 1
|
||||
type: frontend
|
||||
label: Rework
|
||||
edges:
|
||||
- id: submit
|
||||
from: draft
|
||||
to: review
|
||||
label: submit
|
||||
- id: approve
|
||||
from: review
|
||||
to: approved
|
||||
label: approve
|
||||
- id: release
|
||||
from: approved
|
||||
to: released
|
||||
label: release
|
||||
- id: request-changes
|
||||
from: review
|
||||
to: rework
|
||||
label: changes requested
|
||||
role: branch
|
||||
variant: dashed
|
||||
Reference in New Issue
Block a user