-
Notifications
You must be signed in to change notification settings - Fork 1
/
mix.exs
197 lines (180 loc) · 5.12 KB
/
mix.exs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
defmodule Magma.MixProject do
use Mix.Project
@scm_url "https://github.com/marcelotto/magma"
@version File.read!("VERSION") |> String.trim()
def project do
[
app: :magma,
version: @version,
elixir: "~> 1.14",
start_permanent: Mix.env() == :prod,
elixirc_paths: elixirc_paths(Mix.env()),
deps: deps(),
# ExVCR
preferred_cli_env: [
vcr: :test,
"vcr.delete": :test,
"vcr.check": :test,
"vcr.show": :test
],
# Hex
package: package(),
description: description(),
# Docs
name: "Magma",
docs: docs()
]
end
defp description do
"""
An IDE for documentation and prompt development.
"""
end
defp package do
[
maintainers: ["Marcel Otto"],
licenses: ["MIT"],
links: %{
"GitHub" => @scm_url,
"Changelog" => @scm_url <> "/blob/main/CHANGELOG.md"
},
files:
~w[lib priv mix.exs .formatter.exs VERSION *.md docs.magma/artefacts/final/modules/**/*.md]
]
end
def application do
[
extra_applications: [:logger, :eex],
mod: {Magma.Application, []}
]
end
defp deps do
[
{:panpipe, "~> 0.3"},
{:yaml_front_matter, "~> 1.0"},
{:jason, "~> 1.4"},
{:openai, "~> 0.5", optional: true},
{:clipboard, "~> 0.2"},
{:exvcr, "~> 0.15", only: [:dev, :test]},
{:ex_doc, "~> 0.31", only: :dev, runtime: false}
]
end
defp docs do
[
main: "Magma",
source_url: @scm_url,
source_ref: "v#{@version}",
logo: "docs.magma/attachments/logo.png",
skip_undefined_reference_warnings_on: ["CHANGELOG.md"],
before_closing_head_tag: &before_closing_head_tag/1,
extra_section: "GUIDES",
extras: extras(),
groups_for_extras: groups_for_extras(),
groups_for_modules: [
Vault: [
Magma.Vault,
Magma.Vault.BaseVault,
Magma.Vault.Version,
Magma.Vault.Migration
],
Documents: [
Magma.Document,
Magma.Prompt,
Magma.Prompt.Template,
Magma.PromptResult,
Magma.Concept,
Magma.Concept.Template,
Magma.Artefact.Prompt,
Magma.Artefact.Version
],
DocumentStruct: [
Magma.DocumentStruct,
Magma.DocumentStruct.Section
],
Matter: [
Magma.Matter,
Magma.Matter.Module,
Magma.Matter.Project
],
Artefacts: [
Magma.Artefact,
Magma.Artefacts.ModuleDoc,
Magma.Artefacts.Readme,
Magma.Artefacts.Article
],
Text: [
Magma.Text,
Magma.Text.Preview,
Magma.Matter.Text,
Magma.Matter.Text.Section,
Magma.Matter.Text.Type,
Magma.Matter.Texts.Generic,
Magma.Matter.Texts.UserGuide,
Magma.Artefacts.TableOfContents
],
Generation: [
Magma.Generation,
Magma.Generation.OpenAI,
Magma.Generation.Manual
],
Config: [
Magma.Config,
Magma.Config.Document,
Magma.Config.System,
Magma.Config.Matter,
Magma.Config.Artefact,
Magma.Config.TextType
]
]
]
end
def extras() do
[
user_guide_page("Introduction to Magma"),
user_guide_page("Installation and setup"),
user_guide_page("Transclusion Resolution"),
user_guide_page("Custom Prompts and Prompt Execution"),
user_guide_page("Creating and Understanding Magma Artefacts"),
user_guide_page("Generating Complex Artefacts"),
user_guide_page("Current Limitations and Roadmap"),
"CHANGELOG.md"
]
end
defp user_guide_page(name) do
"docs.magma/artefacts/final/texts/Magma User Guide/article/Magma User Guide - #{name} (article section).md"
end
defp groups_for_extras do
[
"User Guide": ~r[docs.magma/artefacts/final/texts/Magma User Guide/article/.?]
]
end
defp before_closing_head_tag(:html) do
"""
<script src="https://cdn.jsdelivr.net/npm/[email protected]/dist/mermaid.min.js"></script>
<script>
document.addEventListener("DOMContentLoaded", function () {
mermaid.initialize({
startOnLoad: false,
theme: document.body.className.includes("dark") ? "dark" : "default"
});
let id = 0;
for (const codeEl of document.querySelectorAll("pre code.mermaid")) {
const preEl = codeEl.parentElement;
const graphDefinition = codeEl.textContent;
const graphEl = document.createElement("div");
const graphId = "mermaid-graph-" + id++;
mermaid.render(graphId, graphDefinition).then(({svg, bindFunctions}) => {
graphEl.innerHTML = svg;
bindFunctions?.(graphEl);
preEl.insertAdjacentElement("afterend", graphEl);
preEl.remove();
});
}
});
</script>
"""
end
defp before_closing_head_tag(:epub), do: ""
defp elixirc_paths(:test), do: ["lib", "test/support", "test/modules"]
defp elixirc_paths(_), do: ["lib"]
end