summaryrefslogtreecommitdiff
path: root/docs/src/docs.rs
blob: c12b737489bf6c9810f4989b8eab79e015cbe755 (plain)
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
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
// Auto-generated code.


/// From ./docs/Documents/ASCII_YIZI.txt
pub const ASCII_YIZI: &str = "#BANNER START#
  ████████                ████████
██▒▒▒▒▒▒▒▒██            ██▒▒▒▒▒▒▒▒██
██        ▒▒██        ██▒▒        ██    █████  ██    ██   ██████   █████
██          ▒▒████████▒▒          ██    ▒▒▒██  ██    ██   ██████  ██████
██            ▒▒▒▒▒▒▒▒            ██       ██  ██    ██  ███▒▒▒█  █▒▒▒▒█
██                                ██       ██  ██    ██  ███   ▒  ████ ▒
██                                ██       ██  ██    ██  ███      ▒████
██         ████      ████         ██       ██  ▒██  ██▒  ███       ▒▒▒██
██         ████      ████         ██    █  ██   ██  ██   ███   █  ██  ██
██         ████      ████         ██    █  ██   ▒████▒   ▒██████  ██████
██         ▒▒▒▒      ▒▒▒▒   █     ██    ▒████    ▒██▒     ██████  ▒████▒
██                         ██     ██     ▒▒▒▒     ▒▒      ▒▒▒▒▒▒   ▒▒▒▒
██                ██████████      ██
██                                ██    {banner_line_1}
  ████████████████████████████████      {banner_line_2}
  ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒      {banner_line_3}
#BANNER END#";



/// From ./docs/Documents/docs\collaboration.txt
pub const DOCS_COLLABORATION: &str = "NO CONTENT YET :(";



/// From ./docs/Documents/docs\get_started.txt
pub const DOCS_GET_STARTED: &str = "NO CONTENT YET :(";



/// From ./docs/Documents/profiles\vault.toml
pub const PROFILES_VAULT: &str = "#
#
#    ████████                ████████
#  ██▒▒▒▒▒▒▒▒██            ██▒▒▒▒▒▒▒▒██
#  ██        ▒▒██        ██▒▒        ██    █████  ██    ██  ██    ██
#  ██          ▒▒████████▒▒          ██    ▒▒▒██  ██    ██  ██    ██
#  ██            ▒▒▒▒▒▒▒▒            ██       ██  ██    ██  ██    ██
#  ██                                ██       ██  ██    ██  ██    ██
#  ██                                ██       ██  ██    ██  ██    ██
#  ██         ████      ████         ██       ██  ▒██  ██▒  ▒██  ██▒
#  ██         ████      ████         ██    █  ██   ██  ██    ██  ██
#  ██         ████      ████         ██    █  ██   ▒████▒    ▒████▒
#  ██         ▒▒▒▒      ▒▒▒▒   █     ██    ▒████    ▒██▒      ▒██▒
#  ██                         ██     ██     ▒▒▒▒     ▒▒        ▒▒
#  ██                ██████████      ██
#  ██                                ██
#    ████████████████████████████████     JustEnoughVCS Vault Profile
#    ▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒▒     ===========================
#
#

# Vault \"{vault_name}\" created by {user_name} ({date_format})

#########################
### Base Informations ###
#########################
name = \"{vault_name}\"
uuid = \"{vault_uuid}\" # Don't touch it!

# Administrator list, indicating members who can switch identity to 'host'
hosts = []

[profile]

####################
### Connectivity ###
####################

# Bind address: 127.0.0.1 for localhost only, 0.0.0.0 to allow remote access
bind = \"127.0.0.1\" # (fallback: \"127.0.0.1\")

# Bind port
port = 25331 # (fallback: 25331)

# Enable LAN discovery: clients can discover this service on the local network
# TIP: Not yet supported
lan_discovery = \"disable\" # (enable, disable, fallback: disable)

#############
### Debug ###
#############

# Enable logger
logger = \"yes\" # (yes, no, fallback: no)

# Logger output level
logger_level = \"info\" # (debug, trace, info, fallback: info)

#################################
### Authentication & Security ###
#################################

# Authentication mode
# TIP: Currently only \"key\" is supported
auth_mode = \"key\" # (key, password, noauth, fallback: password)";



/// From ./docs/Documents/README.md
pub const README: &str = "# JustEnoughVCS";



/// From ./docs/Documents/readmes\local_workspace_todolist.md
pub const READMES_LOCAL_WORKSPACE_TODOLIST: &str = "# Setup a Workspace

You have created an empty local **Workspace** using `jv create` or `jv init`.

At this point, the workspace exists only as a local structure.
It is **not yet associated with any identity or upstream Vault**.

Follow the steps below to complete the initial setup.

## Account Setup

> [!TIP]
> If you have already registered an account on this machine, you can skip this section.

An account represents **this machine acting on your behalf**.
You can create an account and generate a private key using the following commands.

```bash
# Make sure OpenSSL is installed on your system.
# Create an account and automatically generate a private key using OpenSSL.
jv account add pan --keygen

# If you already have a private key, you can associate it with an account.
jv account movekey pan ./your_private_key.pem
```

After creating the private key, generate the corresponding public key.
This also requires `OpenSSL` support.

```bash
# Generate the public key in the current directory.
jv account genpub pan ./
```

**Send the generated public key file to a Host of the upstream Vault.**
Only after the key is registered by the Vault can this workspace authenticate.

## Login

> In the following example, we assume:
>
> * the account name is `pan`
> * the upstream Vault address is `127.0.0.1`

Navigate to the workspace directory (the directory containing this file), then run:

```bash
# Log in as pan to the upstream Vault at 127.0.0.1
# -C skips confirmation prompts
jv login pan 127.0.0.1 -C
```

This command performs the following steps internally:

```bash
jv account as pan        # Bind the workspace to account pan
jv direct 127.0.0.1 -C   # Set the upstream Vault address
jv update                # Fetch initial structure and metadata from upstream
rm SETUP.md              # Remove this setup document
```

After login, the workspace becomes a **live participant** connected to the upstream Vault.

## Completion

At this point, the workspace is fully set up:

* An account identity is bound locally
* An upstream Vault is configured
* Initial data has been synchronized

Normally, `jv login` removes this file automatically.
If the file still exists due to a deletion failure, please remove it manually to keep the workspace clean.

Once this file is gone, the workspace is considered **ready for daily use**.

## Why does this file delete itself?

A freshly created JVCS workspace is considered **clean** only when no sheets are in use and no unexplained files exist.

During the initial setup phase, this `SETUP.md` file is the only allowed exception.
It exists solely to guide the workspace into a connected and explainable state.

Once the workspace is connected to an upstream Vault and enters normal operation,
every file in the workspace is expected to be **explainable by structure**.

If this setup file remains:

* it becomes an unexplained local file
* `JustEnoughVCS` cannot determine which sheet it belongs to
* and any subsequent `jv use` operation would be ambiguous

To prevent this ambiguity, JVCS enforces a strict rule:

**A workspace with unexplained files is not allowed to enter active use.**

Deleting `SETUP.md` marks the end of the setup phase and confirms that:

* all remaining files are intentional
* their placement can be explained
* and the workspace is ready to participate in structure-driven operations

This is why the setup document removes itself.
It is not cleanup — it is a boundary.";



/// From ./docs/Documents/readmes\vault_readme.md
pub const READMES_VAULT_README: &str = "# Setup an Upstream Vault

Thank you for using `JustEnoughVCS`.

This document guides you through setting up an **Upstream Vault** — a shared source of structure and content that other workspaces may depend on.

## Configuration File

Before starting the Vault service with `jvv listen`, you need to configure `vault.toml`.

This file defines the identity, connectivity, and responsibility boundaries of the Vault.

### Adding Hosts

Set the `hosts` parameter to specify which members are allowed to switch into the **Host** role for this Vault.

```toml
# Pan and Alice are allowed to operate this Vault as hosts
hosts = [ \"pan\", \"alice\" ]
```

Members listed here can switch their identity as follows:

```bash
jv as host/pan
```

> Becoming a Host means operating from a position that may affect other members.
> This role is not a permanent identity, but a responsibility-bearing context.

### Configuring Connection

Modify the `bind` parameter to `0.0.0.0` to allow access from other devices on the local network.

```toml
bind = \"0.0.0.0\"
```

> [!TIP]
> `JustEnoughVCS` uses port **25331** by default.
> You can change the listening port by modifying the `port` parameter if needed.

### Disabling Logger (Optional)

If you prefer a cleaner console output, you can disable logging:

```toml
logger = \"no\"
```

## Member Account Setup

Run the following command in the root directory of the **Vault** to register a member:

```bash
jvv member register pan
```

Registering a member only creates its identity record in the Vault.
It does **not** automatically make the member login-ready.

An authentication method must be registered separately.

> [!NOTE]
> Currently, `JustEnoughVCS` supports **key-based authentication** only.

Place the public key file provided by the member (`name.pem`) into the Vault’s `./key` directory.

For example, after registering a member named `pan`, the Vault directory structure should look like this:

```
.
├── key
│   └── pan.pem      <- Public key file
├── members
│   ├── pan.bcfg     <- Member registration info
│   └── host.bcfg
├── README.md
├── sheets
│   └── ref.bcfg
├── storage
└── vault.toml
```

## Completion

At this point, the Vault is fully configured:

* Member identities are registered
* Host roles are defined
* Authentication materials are in place

You can now start the Vault service using:

```bash
jvv listen
```

Other workspaces may connect to this Vault once it is listening.";



/// From ./docs/Documents/web_docs\guide.md
pub const WEB_DOCS_GUIDE: &str = "# FIRST

ok";



/// From ./docs/Documents/_navbar.md
pub const _NAVBAR: &str = "* [Home](/)
* [GitHub](https://github.com/JustEnoughVCS/)
* [Main Repo](https://github.com/JustEnoughVCS/VersionControl)";



/// From ./docs/Documents/_sidebar.md
pub const _SIDEBAR: &str = "* Getting Started
  * [Introduction](README.md)

* USER
  * [Workspace Setup](web_docs/workspace_setup.md)

* ADMIN
  * [Vault Setup](web_docs/vault_setup.md)";


// Get document content by name
pub fn document(name: impl AsRef<str>) -> Option<String> {
    match name.as_ref() {

        "ascii_yizi" => Some(ASCII_YIZI.to_string()),

        "docs_collaboration" => Some(DOCS_COLLABORATION.to_string()),

        "docs_get_started" => Some(DOCS_GET_STARTED.to_string()),

        "profiles_vault" => Some(PROFILES_VAULT.to_string()),

        "readme" => Some(README.to_string()),

        "readmes_local_workspace_todolist" => Some(READMES_LOCAL_WORKSPACE_TODOLIST.to_string()),

        "readmes_vault_readme" => Some(READMES_VAULT_README.to_string()),

        "web_docs_guide" => Some(WEB_DOCS_GUIDE.to_string()),

        "_navbar" => Some(_NAVBAR.to_string()),

        "_sidebar" => Some(_SIDEBAR.to_string()),
_ => None,
    }
}

// Get list of all available document names
pub fn documents() -> Vec<String> {
    vec![
        "ascii_yizi".to_string(),
        "docs_collaboration".to_string(),
        "docs_get_started".to_string(),
        "profiles_vault".to_string(),
        "readme".to_string(),
        "readmes_local_workspace_todolist".to_string(),
        "readmes_vault_readme".to_string(),
        "web_docs_guide".to_string(),
        "_navbar".to_string(),
        "_sidebar".to_string(),
    ]
}