@re-cinq/floor-pipeline 0.7.0 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/agent-config-schema.d.ts +4 -0
- package/dist/agent-config-schema.js +13 -0
- package/dist/cli.js +6 -3
- package/dist/collection/change-report.d.ts +3 -0
- package/dist/collection/change-report.js +57 -0
- package/dist/collection/changed-lines.d.ts +7 -0
- package/dist/collection/changed-lines.js +17 -0
- package/dist/collection/line-mermaid.d.ts +3 -0
- package/dist/collection/line-mermaid.js +79 -0
- package/dist/collection/lint-directory.d.ts +7 -3
- package/dist/collection/lint-directory.js +21 -2
- package/dist/collection/note-within.d.ts +1 -0
- package/dist/collection/note-within.js +36 -0
- package/dist/definition-schemas.d.ts +8 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/lint-command-given.d.ts +4 -0
- package/dist/lint-command-given.js +9 -0
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -141,6 +141,14 @@ floor-pipeline lint collection/ --shipped shipped/ --host-key execution_mode
|
|
|
141
141
|
|
|
142
142
|
A refused file prints one line and the exit code is 1. A call with no directory prints the usage and the exit code is 2.
|
|
143
143
|
|
|
144
|
+
`--graph-against <base-dir>` draws what a pull request changes. Standard output holds only a markdown comment with two mermaid graphs of each assembly line that differs from the collection in `<base-dir>`, the line before with its removed and changed nodes and edges marked and the line after with its added and changed ones marked, and nothing when no line differs. Lint's own lines go to standard error. A refused collection prints no comment, and neither does one compared with a refused collection. The comment stays under 65,000 characters, which GitHub's limit of 65,536 allows: lines are drawn in order while they fit, and the rest are named in a note, cut with `and N more` when even the names do not fit.
|
|
145
|
+
|
|
146
|
+
```
|
|
147
|
+
floor-pipeline lint head/ --graph-against base/ > report.md
|
|
148
|
+
```
|
|
149
|
+
|
|
150
|
+
The [pull request workflow](https://re-cinq.github.io/floor/tutorials/check-a-pack-on-every-pull-request/) posts it as one comment and updates that comment on every push.
|
|
151
|
+
|
|
144
152
|
```
|
|
145
153
|
code-review/assembly-line.yml: a collection does not read this path: a line folder holds assembly-line.yaml, agents/<agent>.md and agents/<agent>.extra.md
|
|
146
154
|
```
|
|
@@ -13,6 +13,10 @@ export declare const agentConfigSchema: z.ZodObject<{
|
|
|
13
13
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
14
14
|
url: z.ZodOptional<z.ZodURL>;
|
|
15
15
|
headers_secret: z.ZodOptional<z.ZodString>;
|
|
16
|
+
visit_token: z.ZodOptional<z.ZodObject<{
|
|
17
|
+
audience: z.ZodString;
|
|
18
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
19
|
+
}, z.core.$strict>>;
|
|
16
20
|
headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
17
21
|
name: z.ZodString;
|
|
18
22
|
ref: z.ZodString;
|
|
@@ -5,6 +5,12 @@ const secretRef = z.object({
|
|
|
5
5
|
name: z.string().min(1).describe("The name of the header or environment variable."),
|
|
6
6
|
ref: z.string().min(1).describe("The key in `agent-secrets`, the Kubernetes Secret in the agents' namespace, whose value it gets."),
|
|
7
7
|
});
|
|
8
|
+
const SCOPE = /^\S+$/;
|
|
9
|
+
// A token the floor signs for each visit, for a server that verifies it with the floor's published keys.
|
|
10
|
+
const visitToken = z.strictObject({
|
|
11
|
+
audience: z.string().min(1).describe("Who the token is for: the name the server expects to be called by, which it checks."),
|
|
12
|
+
scopes: z.array(z.string().regex(SCOPE, "a scope is one word, with no space in it")).describe("What the token may do at the server, in the server's own words."),
|
|
13
|
+
});
|
|
8
14
|
// One of the two ways to reach a server, never neither: a process the pod starts, or an address it calls.
|
|
9
15
|
const mcpServer = z
|
|
10
16
|
.object({
|
|
@@ -14,11 +20,18 @@ const mcpServer = z
|
|
|
14
20
|
args: z.array(z.string()).describe("`stdio` only. The command's arguments.").optional(),
|
|
15
21
|
url: z.url().describe("`http` and `sse` only, and required there. The server's address.").optional(),
|
|
16
22
|
headers_secret: z.string().min(1).describe("The key in `agent-secrets`, the Kubernetes Secret in the agents' namespace, holding one whole header line, such as `Authorization: Bearer <token>`.").optional(),
|
|
23
|
+
visit_token: visitToken.describe("`http` and `sse` only, and never beside `headers_secret`. The floor signs a token for each visit, naming the visit, its run and its repository, for the pod to present to the server as `Authorization: Bearer <token>`. The server verifies it with the keys the floor publishes at `/.well-known/jwks.json`.").optional(),
|
|
17
24
|
headers: z.array(secretRef).describe("`http` and `sse` only. Headers sent to the server, each taking its value from a key in `agent-secrets`.").optional(),
|
|
18
25
|
env: z.array(secretRef).describe("`stdio` only. Environment variables of the server's process, each taking its value from a key in `agent-secrets`.").optional(),
|
|
19
26
|
})
|
|
20
27
|
.refine((server) => (server.transport === "stdio" ? Boolean(server.command) : Boolean(server.url)), {
|
|
21
28
|
message: "a stdio server needs a command, any other a url",
|
|
29
|
+
})
|
|
30
|
+
.refine((server) => !(server.visit_token && server.headers_secret), {
|
|
31
|
+
message: "visit_token and headers_secret each set the server's authorization: give one",
|
|
32
|
+
})
|
|
33
|
+
.refine((server) => !(server.visit_token && server.transport === "stdio"), {
|
|
34
|
+
message: "visit_token is for an http or sse server",
|
|
22
35
|
});
|
|
23
36
|
const KUBERNETES_QUANTITY = /^\d+(\.\d+)?(m|k|M|G|T|Ki|Mi|Gi|Ti)?$/;
|
|
24
37
|
const quantity = z.string().regex(KUBERNETES_QUANTITY, "a Kubernetes quantity such as 250m, 1, 512Mi or 2Gi");
|
package/dist/cli.js
CHANGED
|
@@ -10,6 +10,7 @@ import { importPipeline } from "./import.js";
|
|
|
10
10
|
import { migrate } from "./migrate.js";
|
|
11
11
|
import { applyCollection } from "./collection/apply.js";
|
|
12
12
|
import { lintCommand, readCollectionDirectory } from "./collection/lint-directory.js";
|
|
13
|
+
import { lintCommandGiven } from "./lint-command-given.js";
|
|
13
14
|
import { waitUntilReady } from "./ready.js";
|
|
14
15
|
import { fileOf, pipelineOf } from "./shape.js";
|
|
15
16
|
const USAGE = `floor-pipeline <what to do> --floor <url> with FLOOR_SERVICE_TOKEN
|
|
@@ -27,10 +28,13 @@ const USAGE = `floor-pipeline <what to do> --floor <url> with FLOOR_SERVICE
|
|
|
27
28
|
Needs no floor and no token. A key the host owns is named with --host-key <name>,
|
|
28
29
|
as often as needed. The agents and lines the host ships are a directory in the
|
|
29
30
|
same layout, named with --shipped <dir>. Exits 2 when no directory is given
|
|
31
|
+
--graph-against <base-dir> prints to stdout the change report, as markdown with
|
|
32
|
+
mermaid graphs, of the assembly lines that differ from <base-dir>;
|
|
33
|
+
lint's own lines then go to stderr
|
|
30
34
|
|
|
31
35
|
--wait-ready <seconds> first waits up to that long for the floor's /readyz to answer 200,
|
|
32
36
|
for a job that starts with the floor`;
|
|
33
|
-
const OPTIONS = { floor: { type: "string" }, out: { type: "string" }, dir: { type: "string" }, all: { type: "boolean" }, "wait-ready": { type: "string" }, "host-key": { type: "string", multiple: true }, shipped: { type: "string" } };
|
|
37
|
+
const OPTIONS = { floor: { type: "string" }, out: { type: "string" }, dir: { type: "string" }, all: { type: "boolean" }, "wait-ready": { type: "string" }, "host-key": { type: "string", multiple: true }, shipped: { type: "string" }, "graph-against": { type: "string" } };
|
|
34
38
|
function given() {
|
|
35
39
|
return parseArgs({ options: OPTIONS, allowPositionals: true });
|
|
36
40
|
}
|
|
@@ -101,8 +105,7 @@ async function applied(floor, told) {
|
|
|
101
105
|
said(dir, await applyCollection(floor, overlay));
|
|
102
106
|
}
|
|
103
107
|
async function linted(told) {
|
|
104
|
-
|
|
105
|
-
process.exitCode = await lintCommand({ directory, hostKeys: told.values["host-key"] ?? [], shippedDirectory: told.values.shipped }, USAGE, { out: console.log, err: console.error });
|
|
108
|
+
process.exitCode = await lintCommand(lintCommandGiven(told.positionals, told.values), USAGE, { out: console.log, err: console.error });
|
|
106
109
|
}
|
|
107
110
|
function said(file, put) {
|
|
108
111
|
console.log(`${file}:`);
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
// The pull request comment that draws every assembly line the change touches.
|
|
2
|
+
import { z } from "zod";
|
|
3
|
+
import { definitionSchemas } from "../definition-schemas.js";
|
|
4
|
+
import { afterGraphOf, beforeGraphOf } from "./line-mermaid.js";
|
|
5
|
+
import { noteWithin } from "./note-within.js";
|
|
6
|
+
const { lineBodySchema } = definitionSchemas(z.object);
|
|
7
|
+
export const COMMENT_LIMIT = 65000;
|
|
8
|
+
const NOTE_LINE_BREAKS = 2;
|
|
9
|
+
export function changeReportOf(changes, limit = COMMENT_LIMIT) {
|
|
10
|
+
if (changes.length === 0)
|
|
11
|
+
return "";
|
|
12
|
+
return reportOf(changes, drawnCountOf(changes, limit), limit);
|
|
13
|
+
}
|
|
14
|
+
function drawnCountOf(changes, limit) {
|
|
15
|
+
for (let count = 1; count <= changes.length; count++) {
|
|
16
|
+
if (reportOf(changes, count, limit).length > limit)
|
|
17
|
+
return count - 1;
|
|
18
|
+
}
|
|
19
|
+
return changes.length;
|
|
20
|
+
}
|
|
21
|
+
function reportOf(changes, drawnCount, limit) {
|
|
22
|
+
const opening = [
|
|
23
|
+
"<!-- floor-pack-graph -->",
|
|
24
|
+
"### Assembly lines changed in this pull request",
|
|
25
|
+
"",
|
|
26
|
+
...changes.slice(0, drawnCount).flatMap(sectionOf),
|
|
27
|
+
];
|
|
28
|
+
const undrawnIds = changes.slice(drawnCount).map(({ id }) => id);
|
|
29
|
+
const closing = [
|
|
30
|
+
"<sub>green added · red dashed removed · amber changed</sub>",
|
|
31
|
+
"",
|
|
32
|
+
];
|
|
33
|
+
const frame = [...opening, ...closing].join("\n");
|
|
34
|
+
const noteRoom = limit - frame.length - NOTE_LINE_BREAKS;
|
|
35
|
+
return [...opening, ...noteWithin(undrawnIds, noteRoom), ...closing].join("\n");
|
|
36
|
+
}
|
|
37
|
+
function sectionOf({ id, base, head }) {
|
|
38
|
+
const baseBody = lineBodyOf(base);
|
|
39
|
+
const headBody = lineBodyOf(head);
|
|
40
|
+
return [
|
|
41
|
+
...(baseBody ? beforeBlockOf(id, baseBody, headBody) : []),
|
|
42
|
+
...(headBody ? afterBlockOf(id, baseBody, headBody) : []),
|
|
43
|
+
];
|
|
44
|
+
}
|
|
45
|
+
function beforeBlockOf(id, base, head) {
|
|
46
|
+
return blockOf(`**${id}** · before`, beforeGraphOf(base, head));
|
|
47
|
+
}
|
|
48
|
+
function afterBlockOf(id, base, head) {
|
|
49
|
+
return blockOf(`**${id}** · proposed changes`, afterGraphOf(base, head));
|
|
50
|
+
}
|
|
51
|
+
function blockOf(title, graph) {
|
|
52
|
+
return [title, "", "```mermaid", graph, "```", ""];
|
|
53
|
+
}
|
|
54
|
+
function lineBodyOf(fields) {
|
|
55
|
+
return fields && lineBodySchema.parse(fields);
|
|
56
|
+
}
|
|
57
|
+
//# sourceMappingURL=change-report.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// The lines whose body differs between a base collection and a head collection.
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
export function changedLines(base, head) {
|
|
4
|
+
const baseBodies = bodiesById(base);
|
|
5
|
+
const headBodies = bodiesById(head);
|
|
6
|
+
const differing = [...headBodies]
|
|
7
|
+
.filter(([id, body]) => !isDeepStrictEqual(baseBodies.get(id), body))
|
|
8
|
+
.map(([id, body]) => ({ id, base: baseBodies.get(id), head: body }));
|
|
9
|
+
const removed = [...baseBodies]
|
|
10
|
+
.filter(([id]) => !headBodies.has(id))
|
|
11
|
+
.map(([id, body]) => ({ id, base: body }));
|
|
12
|
+
return [...differing, ...removed];
|
|
13
|
+
}
|
|
14
|
+
function bodiesById(pipelines) {
|
|
15
|
+
return new Map(pipelines.flatMap(({ line }) => (line ? [[line.id, line.body]] : [])));
|
|
16
|
+
}
|
|
17
|
+
//# sourceMappingURL=changed-lines.js.map
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
// A line change drawn as two Mermaid flowcharts: before marks what head removes, after marks what head adds; both mark what changed.
|
|
2
|
+
import { isDeepStrictEqual } from "node:util";
|
|
3
|
+
const CHANGE_STYLES = {
|
|
4
|
+
added: "stroke:#2da44e,stroke-width:3px",
|
|
5
|
+
removed: "stroke:#cf222e,stroke-width:3px,stroke-dasharray:4 3",
|
|
6
|
+
changed: "stroke:#bf8700,stroke-width:3px",
|
|
7
|
+
};
|
|
8
|
+
const STYLED_CHANGES = ["added", "removed", "changed"];
|
|
9
|
+
const LABEL_ENTITIES = [
|
|
10
|
+
['"', "#quot;"],
|
|
11
|
+
["<", "#lt;"],
|
|
12
|
+
[">", "#gt;"],
|
|
13
|
+
["|", "#124;"],
|
|
14
|
+
];
|
|
15
|
+
const EMPTY_GRAPH = { nodes: [], edges: [] };
|
|
16
|
+
export function afterGraphOf(base, head) {
|
|
17
|
+
return flowchartOf(head, base ?? EMPTY_GRAPH, "added");
|
|
18
|
+
}
|
|
19
|
+
export function beforeGraphOf(base, head) {
|
|
20
|
+
return flowchartOf(base, head ?? EMPTY_GRAPH, "removed");
|
|
21
|
+
}
|
|
22
|
+
function flowchartOf(shown, other, onlyShownChange) {
|
|
23
|
+
const nodes = classifyAgainst(shown.nodes, other.nodes, (node) => node.id, onlyShownChange);
|
|
24
|
+
const edges = classifyAgainst(shown.edges, other.edges, edgeKeyOf, onlyShownChange);
|
|
25
|
+
return [
|
|
26
|
+
"flowchart LR",
|
|
27
|
+
...nodes.map(({ part }) => ` ${mermaidIdOf(part.id)}["${labelOf(part.id)}"]`),
|
|
28
|
+
...edges.map(({ part }) => ` ${mermaidIdOf(part.from)} -->|"${labelOf(edgeLabelOf(part))}"| ${mermaidIdOf(part.to)}`),
|
|
29
|
+
...classLinesOf(nodes),
|
|
30
|
+
...linkStyleLinesOf(edges),
|
|
31
|
+
].join("\n");
|
|
32
|
+
}
|
|
33
|
+
function classifyAgainst(shownParts, otherParts, keyOf, onlyShownChange) {
|
|
34
|
+
const otherByKey = new Map(otherParts.map((part) => [keyOf(part), part]));
|
|
35
|
+
return shownParts.map((part) => {
|
|
36
|
+
const key = keyOf(part);
|
|
37
|
+
if (!otherByKey.has(key))
|
|
38
|
+
return { part, change: onlyShownChange };
|
|
39
|
+
const change = isDeepStrictEqual(otherByKey.get(key), part)
|
|
40
|
+
? "kept"
|
|
41
|
+
: "changed";
|
|
42
|
+
return { part, change };
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
function edgeKeyOf(edge) {
|
|
46
|
+
return `${edge.from}|${edge.to}|${edge.on}`;
|
|
47
|
+
}
|
|
48
|
+
function edgeLabelOf(edge) {
|
|
49
|
+
const iterationCap = edge.iterationMax === undefined ? "" : ` (max ${edge.iterationMax})`;
|
|
50
|
+
const unattendedCap = edge.unattendedMax === undefined
|
|
51
|
+
? ""
|
|
52
|
+
: ` (unattended ${edge.unattendedMax})`;
|
|
53
|
+
return `${edge.on}${iterationCap}${unattendedCap}`;
|
|
54
|
+
}
|
|
55
|
+
function classLinesOf(nodes) {
|
|
56
|
+
return STYLED_CHANGES.flatMap((change) => {
|
|
57
|
+
const ids = nodes
|
|
58
|
+
.filter((node) => node.change === change)
|
|
59
|
+
.map((node) => mermaidIdOf(node.part.id));
|
|
60
|
+
return ids.length === 0
|
|
61
|
+
? []
|
|
62
|
+
: [
|
|
63
|
+
` classDef ${change} ${CHANGE_STYLES[change]}`,
|
|
64
|
+
` class ${ids.join(",")} ${change}`,
|
|
65
|
+
];
|
|
66
|
+
});
|
|
67
|
+
}
|
|
68
|
+
function linkStyleLinesOf(edges) {
|
|
69
|
+
return STYLED_CHANGES.flatMap((change) => edges.flatMap((edge, index) => edge.change === change
|
|
70
|
+
? [` linkStyle ${index} ${CHANGE_STYLES[change]}`]
|
|
71
|
+
: []));
|
|
72
|
+
}
|
|
73
|
+
function mermaidIdOf(id) {
|
|
74
|
+
return id.replace(/[^A-Za-z0-9_-]/g, "_");
|
|
75
|
+
}
|
|
76
|
+
function labelOf(id) {
|
|
77
|
+
return LABEL_ENTITIES.reduce((label, [character, entity]) => label.replaceAll(character, entity), id);
|
|
78
|
+
}
|
|
79
|
+
//# sourceMappingURL=line-mermaid.js.map
|
|
@@ -17,12 +17,16 @@ export interface LintCommand {
|
|
|
17
17
|
hostKeys: readonly string[];
|
|
18
18
|
/** A directory in the layout of a collection, holding what the host ships. */
|
|
19
19
|
shippedDirectory?: string;
|
|
20
|
+
/** A directory holding the collection to compare with: lint's lines go to err and out holds only the change report. */
|
|
21
|
+
graphAgainstDirectory?: string;
|
|
20
22
|
}
|
|
21
|
-
/**
|
|
22
|
-
export
|
|
23
|
+
/** Where the lint command prints: out for what a caller reads, err for what a person reads. */
|
|
24
|
+
export interface LintOutput {
|
|
23
25
|
out: (line: string) => void;
|
|
24
26
|
err: (line: string) => void;
|
|
25
|
-
}
|
|
27
|
+
}
|
|
28
|
+
/** The `lint` command: the exit code is 0 clean, 1 refused, 2 when the call is wrong. */
|
|
29
|
+
export declare function lintCommand(given: LintCommand, usage: string, output: LintOutput): Promise<number>;
|
|
26
30
|
/** Prints the refused files and answers the exit code: 0 clean, 1 refused. */
|
|
27
31
|
export declare function printCollectionLint(root: string, hostKeys: readonly string[], print: (line: string) => void, shipped?: ShippedCatalog): Promise<number>;
|
|
28
32
|
/** The files of a collection on disk, each with its path from the root: the ones a collection reads or refuses. */
|
|
@@ -3,6 +3,8 @@ import { readdir, readFile } from "node:fs/promises";
|
|
|
3
3
|
import { join, relative, sep } from "node:path";
|
|
4
4
|
import { agentsOverlay } from "./agents.js";
|
|
5
5
|
import { collectionOverlay } from "./collection.js";
|
|
6
|
+
import { changeReportOf } from "./change-report.js";
|
|
7
|
+
import { changedLines } from "./changed-lines.js";
|
|
6
8
|
import { collectionSettingsIn } from "./collection-settings.js";
|
|
7
9
|
export { COLLECTION_SETTINGS_FILE, hostKeysIn } from "./collection-settings.js";
|
|
8
10
|
import { enforce } from "./enforce.js";
|
|
@@ -35,11 +37,28 @@ export async function lintCommand(given, usage, output) {
|
|
|
35
37
|
return 2;
|
|
36
38
|
}
|
|
37
39
|
const shipped = given.shippedDirectory ? await shippedCatalogIn(given.shippedDirectory, given.hostKeys) : undefined;
|
|
38
|
-
|
|
40
|
+
if (!given.graphAgainstDirectory)
|
|
41
|
+
return printCollectionLint(given.directory, given.hostKeys, output.out, shipped);
|
|
42
|
+
const head = await lintCollectionDirectory(given.directory, given.hostKeys, shipped);
|
|
43
|
+
const code = printLintOf(head, output.err);
|
|
44
|
+
if (code !== 0)
|
|
45
|
+
return code;
|
|
46
|
+
printChangeReport(head, await lintCollectionDirectory(given.graphAgainstDirectory, given.hostKeys, shipped), output);
|
|
47
|
+
return code;
|
|
48
|
+
}
|
|
49
|
+
/** Prints what a graph-against run adds to the head's lint: the change report, or why there is none. */
|
|
50
|
+
function printChangeReport(head, base, output) {
|
|
51
|
+
if (base.refused.length > 0)
|
|
52
|
+
return output.err("no change report: the collection to compare with is refused");
|
|
53
|
+
const report = changeReportOf(changedLines(base.pipelines, head.pipelines));
|
|
54
|
+
if (report)
|
|
55
|
+
output.out(report);
|
|
39
56
|
}
|
|
40
57
|
/** Prints the refused files and answers the exit code: 0 clean, 1 refused. */
|
|
41
58
|
export async function printCollectionLint(root, hostKeys, print, shipped = NOTHING_SHIPPED) {
|
|
42
|
-
|
|
59
|
+
return printLintOf(await lintCollectionDirectory(root, hostKeys, shipped), print);
|
|
60
|
+
}
|
|
61
|
+
function printLintOf({ refused, counts }, print) {
|
|
43
62
|
for (const { path, reason } of refused)
|
|
44
63
|
print(`${path}: ${reason}`);
|
|
45
64
|
if (refused.length > 0)
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function noteWithin(ids: string[], room: number): string[];
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
// The note naming the lines left undrawn, cut to fit the room left in a comment.
|
|
2
|
+
const NOTE_LEAD = "These lines changed too, but their graphs would not fit in one comment: ";
|
|
3
|
+
const SEPARATOR = ", ";
|
|
4
|
+
export function noteWithin(ids, room) {
|
|
5
|
+
if (ids.length === 0)
|
|
6
|
+
return [];
|
|
7
|
+
const tags = ids.map((id) => `\`${id}\``);
|
|
8
|
+
return [`${NOTE_LEAD}${listOf(tags, room - NOTE_LEAD.length)}`, ""];
|
|
9
|
+
}
|
|
10
|
+
function listOf(tags, listRoom) {
|
|
11
|
+
const whole = `${tags.join(SEPARATOR)}.`;
|
|
12
|
+
if (whole.length <= listRoom)
|
|
13
|
+
return whole;
|
|
14
|
+
const listedCount = fittingCountOf(tags, listRoom);
|
|
15
|
+
const leftOut = tags.length - listedCount;
|
|
16
|
+
if (listedCount === 0)
|
|
17
|
+
return `${leftOut} more.`;
|
|
18
|
+
return `${tags.slice(0, listedCount).join(SEPARATOR)}${moreOf(leftOut)}`;
|
|
19
|
+
}
|
|
20
|
+
function fittingCountOf(tags, listRoom) {
|
|
21
|
+
let listedCount = 0;
|
|
22
|
+
let used = 0;
|
|
23
|
+
for (const [index, tag] of tags.entries()) {
|
|
24
|
+
used += tag.length + (index > 0 ? SEPARATOR.length : 0);
|
|
25
|
+
if (used > listRoom)
|
|
26
|
+
break;
|
|
27
|
+
const leftOut = tags.length - index - 1;
|
|
28
|
+
if (used + moreOf(leftOut).length <= listRoom)
|
|
29
|
+
listedCount = index + 1;
|
|
30
|
+
}
|
|
31
|
+
return listedCount;
|
|
32
|
+
}
|
|
33
|
+
function moreOf(leftOut) {
|
|
34
|
+
return ` and ${leftOut} more.`;
|
|
35
|
+
}
|
|
36
|
+
//# sourceMappingURL=note-within.js.map
|
|
@@ -116,6 +116,10 @@ export declare function definitionSchemas(object: ObjectOf, scheduleChecks?: Sch
|
|
|
116
116
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
117
117
|
url: z.ZodOptional<z.ZodURL>;
|
|
118
118
|
headers_secret: z.ZodOptional<z.ZodString>;
|
|
119
|
+
visit_token: z.ZodOptional<z.ZodObject<{
|
|
120
|
+
audience: z.ZodString;
|
|
121
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
122
|
+
}, z.core.$strict>>;
|
|
119
123
|
headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
120
124
|
name: z.ZodString;
|
|
121
125
|
ref: z.ZodString;
|
|
@@ -173,6 +177,10 @@ export declare function definitionSchemas(object: ObjectOf, scheduleChecks?: Sch
|
|
|
173
177
|
args: z.ZodOptional<z.ZodArray<z.ZodString>>;
|
|
174
178
|
url: z.ZodOptional<z.ZodURL>;
|
|
175
179
|
headers_secret: z.ZodOptional<z.ZodString>;
|
|
180
|
+
visit_token: z.ZodOptional<z.ZodObject<{
|
|
181
|
+
audience: z.ZodString;
|
|
182
|
+
scopes: z.ZodArray<z.ZodString>;
|
|
183
|
+
}, z.core.$strict>>;
|
|
176
184
|
headers: z.ZodOptional<z.ZodArray<z.ZodObject<{
|
|
177
185
|
name: z.ZodString;
|
|
178
186
|
ref: z.ZodString;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Use the Pipeline SDK to move an [assembly line](/floor/concepts/assembly-line/) and the
|
|
3
|
+
* definitions it depends on between a [YAML file](/floor/specs/pipeline-file/) and Floor.
|
|
4
|
+
* Use the CLI to import and export files from a shell. Use the TypeScript library when your
|
|
5
|
+
* program needs to inspect a pipeline or act on the definitions that changed.
|
|
6
|
+
*
|
|
7
|
+
* @packageDocumentation
|
|
8
|
+
*/
|
|
1
9
|
export { pipelineFileSchema, readPipelineFile, writePipelineFile, type PipelineFile } from "./file.js";
|
|
2
10
|
export { agentConfigSchema, type AgentConfig } from "./agent-config-schema.js";
|
|
3
11
|
export { FILE_SPELLING, fileOf, pipelineOf, type Pipeline } from "./shape.js";
|
package/dist/index.js
CHANGED
|
@@ -1,3 +1,12 @@
|
|
|
1
|
+
// eslint-disable-next-line re-lint/max-comment-lines -- Published as the Pipeline SDK introduction.
|
|
2
|
+
/**
|
|
3
|
+
* Use the Pipeline SDK to move an [assembly line](/floor/concepts/assembly-line/) and the
|
|
4
|
+
* definitions it depends on between a [YAML file](/floor/specs/pipeline-file/) and Floor.
|
|
5
|
+
* Use the CLI to import and export files from a shell. Use the TypeScript library when your
|
|
6
|
+
* program needs to inspect a pipeline or act on the definitions that changed.
|
|
7
|
+
*
|
|
8
|
+
* @packageDocumentation
|
|
9
|
+
*/
|
|
1
10
|
export { pipelineFileSchema, readPipelineFile, writePipelineFile } from "./file.js";
|
|
2
11
|
export { agentConfigSchema } from "./agent-config-schema.js";
|
|
3
12
|
export { FILE_SPELLING, fileOf, pipelineOf } from "./shape.js";
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
import type { LintCommand } from "./collection/lint-directory.js";
|
|
2
|
+
type LintFlags = Partial<Record<"host-key", string[]> & Record<"shipped" | "graph-against", string>>;
|
|
3
|
+
export declare function lintCommandGiven(positionals: readonly string[], values: LintFlags): LintCommand;
|
|
4
|
+
export {};
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export function lintCommandGiven(positionals, values) {
|
|
2
|
+
return {
|
|
3
|
+
directory: positionals[1],
|
|
4
|
+
hostKeys: values["host-key"] ?? [],
|
|
5
|
+
shippedDirectory: values.shipped,
|
|
6
|
+
graphAgainstDirectory: values["graph-against"],
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
//# sourceMappingURL=lint-command-given.js.map
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@re-cinq/floor-pipeline",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.9.0",
|
|
4
4
|
"description": "A floor's pipeline as one YAML file: an assembly line with its stations, its agent definitions and their prompts, its files and its schedules. Exports one from a floor, imports one into a floor, and applies a folder of them in order, each once. It speaks the floor's HTTP API and nothing else.",
|
|
5
5
|
"license": "Apache-2.0",
|
|
6
6
|
"repository": {
|
|
@@ -57,9 +57,9 @@
|
|
|
57
57
|
"typecheck": "tsc --noEmit"
|
|
58
58
|
},
|
|
59
59
|
"dependencies": {
|
|
60
|
-
"@re-cinq/floor-assembly-lines": "0.
|
|
61
|
-
"@re-cinq/floor-client": "0.
|
|
62
|
-
"@re-cinq/floor-contracts": "0.
|
|
60
|
+
"@re-cinq/floor-assembly-lines": "0.9.0",
|
|
61
|
+
"@re-cinq/floor-client": "0.9.0",
|
|
62
|
+
"@re-cinq/floor-contracts": "0.9.0",
|
|
63
63
|
"yaml": "^2.7.0",
|
|
64
64
|
"zod": "^4.5.4"
|
|
65
65
|
},
|