Documentation
¶
Overview ¶
Package docstest reads the fenced blocks of the README and of docs/, for the tests that hold a block to what a command prints.
Index ¶
Constants ¶
const ( ManifestFile = "permissions.json" ManifestSchema = "permissions.schema.json" )
ManifestFile and ManifestSchema are the manifest and its JSON Schema, from the repository's root.
Variables ¶
This section is empty.
Functions ¶
func At ¶
At answers the body of each block at place, and fails the test when the page holds none there.
func Fills ¶
Fills reports whether printed is the line a page shows, with some text in place of each <placeholder> of the page's line and every other character the same.
Types ¶
type Call ¶
type Call struct {
ID string `json:"id"`
Host string `json:"host"`
Base string `json:"base"`
Method string `json:"method"`
Path string `json:"path"`
Access string `json:"access"`
// Permissions maps each permission the call needs to its level.
Permissions map[string]string `json:"permissions"`
What string `json:"what"`
Why string `json:"why"`
// By names the code that sends the request, and Commands what a recipe
// or a person runs that makes it.
By []string `json:"by"`
Commands []string `json:"commands"`
// Source is what the permissions rest on, or Unverified says why nothing
// this file quotes states them.
Source *Source `json:"source,omitempty"`
Unverified string `json:"unverified,omitempty"`
}
Call is one method and path sent to a host.
type Grant ¶
type Grant struct {
Name string `json:"name"`
File string `json:"file,omitempty"`
Job string `json:"job,omitempty"`
Token string `json:"token"`
Role string `json:"role,omitempty"`
// Runs names every command, script and step of the grant that makes a
// call or needs a permission.
Runs []string `json:"runs"`
Permissions map[string]Granted `json:"permissions"`
}
Grant is what one recipe's job, or the GitHub App, asks of its token.
type Granted ¶
type Granted struct {
Level string `json:"level"`
Calls []string `json:"calls"`
Steps []string `json:"steps"`
Excess string `json:"excess,omitempty"`
}
Granted is one permission a grant asks for, and the calls and steps that need it. Excess says why the level is more than any of them needs.
type Held ¶
type Held struct {
Token string `json:"token"`
Permissions map[string]string `json:"permissions"`
Why string `json:"why"`
Source *Source `json:"source"`
}
Held is what a token holds without asking for it, and what that rests on.
type Local ¶
type Local struct {
ID string `json:"id"`
Command string `json:"command"`
SignedIn bool `json:"signed_in"`
Access string `json:"access"`
What string `json:"what"`
Why string `json:"why"`
By []string `json:"by"`
Commands []string `json:"commands"`
}
Local is a gh or git command Costroid runs on the machine it runs on, under the person's own sign-in or, for a public read, under none.
type Manifest ¶
type Manifest struct {
Calls []Call `json:"calls"`
Steps []Step `json:"steps"`
Local []Local `json:"local_commands"`
Held []Held `json:"held"`
Grants []Grant `json:"grants"`
}
Manifest is permissions.json: every call Costroid makes to a host under a token, the steps of other publishers that need a permission, and what each recipe's job and the GitHub App ask of their tokens.
func Permissions ¶
Permissions reads permissions.json in the repository at root, and fails the test unless the file holds to its schema and names each call once.
type Place ¶
type Place struct{ Page, Heading, Language string }
Place names the blocks of one language under one heading of a page. Page is the file from the repository's root, Heading the nearest heading above the block without its marks, and Language the word after the fence, empty when the fence names none.
type Source ¶
type Source struct {
Kind string `json:"kind"`
URL string `json:"url,omitempty"`
Run string `json:"run,omitempty"`
Read string `json:"read"`
Says string `json:"says"`
}
Source is what a call's permissions rest on, and the day it was read: the publisher's own page, with its words, or a recorded GitHub Actions run, with what it answered.
type Step ¶
type Step struct {
Uses string `json:"uses"`
Input string `json:"input,omitempty"`
Permissions map[string]string `json:"permissions"`
What string `json:"what"`
Why string `json:"why"`
Source *Source `json:"source,omitempty"`
Unverified string `json:"unverified,omitempty"`
}
Step is a step from another publisher that needs a permission, when its Input is set or, with no Input, always.