Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,11 @@ the documentation says what holds; how it came about is in git.
sent and revoked on signing out, how a host name is read whoever wrote it,
what is fixed about the HTTP client, which check happens before a request —
before any work on sign-in, client or IDs.
- [Profiles](stable/profiles.md): What a profile is and how it is named, which
one a command uses and why, `$MINKA_TOKEN` beside a profile, the default,
the file that older versions still read and what becomes of one they wrote,
the cards of `work start` per account and the heartbeat over all of them —
before any work on sign-in, `profiles`, the configuration file or the store.
- [Rich text in both directions](stable/rich-text.md): Markdown to HTML and
back, the allowlist of the server, the shapes of a document, sources, files,
mentions and references to other records — before any
Expand Down
117 changes: 97 additions & 20 deletions docs/decisions.md
Original file line number Diff line number Diff line change
Expand Up @@ -594,10 +594,11 @@ keep a card alight for a working day with nobody left to stop it.

*Applies to: `--host`, `$MINKA_HOST`, the default host of the configuration*

A value that names no machine is refused, and a default host the CLI cannot read
is refused where it is read, so that no session comes about under it. Signing out
is the one command that takes an entry as the file writes it, so that one written
by hand can be taken out again.
A value that names no machine is refused, and the host of a profile the CLI cannot
read is refused where it is read, so that no session comes about under it.
Signing out is the one command that takes a profile without reading its host,
so that one written by hand can be taken out again; a `--host` that can be read
chooses as C-192 says.

**Why:** Such a value would become a key of the configuration and of the list
of cards, and a session under it would carry it into everything that prints a
Expand Down Expand Up @@ -2746,32 +2747,34 @@ beforehand it refuses beforehand. **Implemented as:** `cli.labelsForNewDecisions

*Applies to: `auth login`, `setup`*

`auth login` sets the default host only where there is none or none that can
be read; `--make-default` or `config set host` move it, and `setup` makes its
host the default. **Why:** every session on the machine shares the default, so
one agent's sign-in to a local instance must not send the others there.
**Implemented as:** `cli.signIn`, see [Token, hosts and
requests](stable/security.md#the-default-host).
`auth login` sets the default profile only where there is none or none that
can be used; `--make-default`, `profiles default` or `config set host` move it,
and `setup` makes its profile the default. **Why:** every session on the
machine shares the default, so one agent's sign-in to a local instance must not
send the others there.
**Implemented as:** `cli.signIn`, see [Profiles](stable/profiles.md#the-default).

<a id="c-180"></a>
## C-180 — `config set host` takes only a host signed in to
## C-180 — `config set host` takes only a host with one profile

*Applies to: `config set host`, `config get host`*

The value is read like a sign-in's host; one without a token is exit 1
(`usage`) naming `auth login`, and there is no `config unset`. **Why:** a
default without a token would fail every later command, far from its cause.
The value is read like a sign-in's host and makes the one profile on it the
default; none is exit 1 (`usage`) naming `auth login`, several are exit 8
naming `profiles default`, and there is no `config unset`. **Why:** a default
without a token would fail every later command, far from its cause, and of two
accounts on one host none is to be guessed.
**Implemented as:** `cli.setDefaultHost`.

<a id="c-181"></a>
## C-181 — Signing out of the default host leaves no default
## C-181 — Removing the default profile leaves no default

*Applies to: `auth logout`, every command without a host*
*Applies to: `auth logout`, `profiles remove`, every command without a profile*

No remaining host takes its place; a `notice` says so, and a command without a
host exits 3 with `no default host is set`. **Why:** a host left over is
nobody's choice, and picking one would move the default silently.
**Implemented as:** `config.File.RemoveHost`, `cli.noHostError`.
No remaining profile takes its place; a `notice` says so, and a command without
a profile exits 3 with `no default profile is set`. **Why:** a profile left over
is nobody's choice, and picking one would move the default silently.
**Implemented as:** `config.File.RemoveProfile`, `cli.noAccountError`.

<a id="c-182"></a>
## C-182 — A step is a text, a card or a to-do, decided before any request
Expand Down Expand Up @@ -2877,3 +2880,77 @@ with it names, per command, what may not be there. **Why:** a hint that the
project is missing would tell a member they are none, as for `projects edit`
(C-093).
**Implemented as:** `cli.setupRefusal`, see [Projects](stable/projects.md#refusals).

<a id="c-191"></a>
## C-191 — A profile is one account, under a name of its own

*Applies to: the configuration file, `--profile`, `profiles …`*

A profile bundles a host, a token and the account it acted as; several may
share a host. Names are lower case letters, digits, `-` and `.`, start with a
letter or a digit, at most 64 characters; one made without a name is named
after its host. **Why:** switching organizations by a short word, and a name
that never reads as a host can share a key with one.
**Implemented as:** `config.Profile`, `config.CheckProfileName`, see
[Profiles](stable/profiles.md).

<a id="c-192"></a>
## C-192 — `--profile`, `--host`, `$MINKA_PROFILE`, `$MINKA_HOST`, the default

*Applies to: every command that signs in*

Strongest first, a flag before any variable; both flags together are exit 1. A
host stands for its one profile, or for the default among several; otherwise
exit 8 naming them. An unknown profile is exit 1 listing the profiles.
**Why:** which account writes in an organization is never to be guessed.
**Implemented as:** `cli.chooseAccount`, `cli.chooseIn`, see
[Profiles](stable/profiles.md#which-profile-a-command-uses).

<a id="c-193"></a>
## C-193 — `$MINKA_TOKEN` goes to `$MINKA_HOST`, never to a profile

*Applies to: `$MINKA_TOKEN` beside `--profile` or `$MINKA_PROFILE`*

The token of the environment signs in a command whose host comes from `--host`
or `$MINKA_HOST` and is that host; a profile named signs in with its own token,
even on that host, and a `notice` says the token was not used. **Why:** the token was given for a host, and a profile names
an account that may be another one there.
**Implemented as:** `cli.chooseAccount`, see
[Profiles](stable/profiles.md#which-profile-a-command-uses).

<a id="c-194"></a>
## C-194 — The file keeps the hosts for older versions beside the profiles

*Applies to: `config.Load`, `config.File.Save`*

A save writes `hosts` (per host the default profile on it, else the first by
name) and `defaultHost`. `profiles` holds where present, and a token under
`hosts` no profile on that host has is taken over; without `profiles`, every
host becomes a profile. A plain read never writes. **Why:** an older minka on
the same machine keeps working, and what it writes is not lost.
**Implemented as:** `config.onDisk`, see [Profiles](stable/profiles.md#the-configuration-file).

<a id="c-195"></a>
## C-195 — A profile keeps its host

*Applies to: `auth login --profile`, `setup`*

Signing an existing profile in with another `--host` is exit 1 naming
`profiles remove`; without `--host` it signs in on its own host. **Why:** a
script that names a profile must not find it writing in another organization.
**Implemented as:** `cli.profileOnHost`.

<a id="c-196"></a>
## C-196 — The cards at work are kept per account, and every account beats

*Applies to: `work …`, `heartbeat`, `cards move`, `profiles rename`*

The store keys a list by profile, or by host for the token of the environment,
and writes per host the lists of the profile the host carries. A rename moves
the lists and drops leftovers under the new name; a removal drops them. Lists
under a name no profile has are passed over, never deleted for it; a new
profile clears its name first or is refused. The heartbeat reports every
account with a list of its session, each with its own token. **Why:** no
account may report another's cards, and the mod knows nothing of profiles.
**Implemented as:** `work.File.Accounts`, `cli.beatEveryAccount`, see
[Profiles](stable/profiles.md#state-per-account).
8 changes: 5 additions & 3 deletions docs/stable/at-work.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,11 @@ Only an agent may say so. A person's token is refused with `agentsOnly`.
## Every session has a list of its own

The cards lie in `work.json` beside the configuration file, never in a project
and never in the directory a command was started in: one list per host and
session. A signal carries the list of one session and nothing else, under a
client of that session's own (C-103). The server keeps a card alight for as
and never in the directory a command was started in: one list per account and
session, an account being a profile, or a host signed in to through
`$MINKA_TOKEN` ([Profiles](profiles.md#state-per-account)). A signal carries
the list of one session and nothing else, under a client of that session's own
(C-103). The server keeps a card alight for as
long as any client names it, so a session that reported the cards of another
would keep them glowing after that one died — for hours, as long as anything
else on the machine was at work.
Expand Down
21 changes: 12 additions & 9 deletions docs/stable/first-steps.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,17 @@ In this order:
1. The config file: one that cannot be read, or that others can read, ends
setup before the first question. A token is shown once, and one that cannot
be saved is lost.
2. The host: `--host` or `$MINKA_HOST` when given, else it asks. An empty
answer takes the default host; a host that cannot be used is asked for
again.
3. The sign-in: a saved token of this host that it still accepts is kept, and
the host becomes the default, whichever was before: unlike `auth login`,
setup is a person choosing the host of this machine ([Token, hosts and
requests](security.md#the-default-host)). Where that moves the default,
setup says so and `data.previousDefaultHost` names the one before. Only a
2. The profile and its host: a profile `--profile` or `$MINKA_PROFILE` names
that exists brings its host. Otherwise the host is `--host` or `$MINKA_HOST`
when given, else it asks; an empty answer takes the host of the default
profile, and a host that cannot be used is asked for again. The profile on
that host is found as `auth login` finds it ([Profiles](profiles.md#commands)).
3. The sign-in: a saved token of this profile that it still accepts is kept,
and the profile becomes the default, whichever was before: unlike `auth
login`, setup is a person choosing the host of this machine
([Profiles](profiles.md#the-default)). Where that moves the default, setup
says so, and `data.previousDefaultHost` and `data.previousDefaultProfile`
name the one before. Only a
host that refuses the saved token is a reason to ask for a new one; a host
that does not answer ends setup with that error. Asking means pointing to the account page of the host, where a
token for an agent is created, and taking the token without echo. The token
Expand Down Expand Up @@ -50,7 +53,7 @@ is the setup, not the command; `data.healthy` is false when a check failed
|---|---|
| `version` | never; says which minka this is |
| `config` | the config file cannot be read, or others can read it |
| `sign-in` | no host or token can be found: nobody is signed in, `$MINKA_TOKEN` stands without `$MINKA_HOST`, `--host` is no host. The hint names the step that needs no terminal first, then `setup`. Skipped when the config check failed. Its detail names the default host beside the host checked where the two differ, and `data.host` and `data.defaultHost` carry both |
| `sign-in` | no host or token can be found: nobody is signed in, `$MINKA_TOKEN` stands without `$MINKA_HOST`, `--host` is no host. The hint names the step that needs no terminal first, then `setup`. Skipped when the config check failed. Its detail names the profile and where the choice came from, and the default profile where it is another one; `data.profile`, `data.host`, `data.defaultProfile` and `data.defaultHost` carry them |
| `host` | the host does not answer or refuses the token; carries the hint of that error |
| `skill` | warns when none is installed or the installed one differs; a skill behind a symbolic link is fine |
| `update` | warns when this minka is older than the minimum Minka named; a newer latest version is `ok` with the hint `brew upgrade minka`. Says that nothing is known yet, or that a build is no release and not compared (C-129) |
Expand Down
Loading