@skillcdn/console 0.5.0 → 0.5.1
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 +68 -11
- package/SKILLCDN.md +3 -3
- package/dist/agent-page.d.ts.map +1 -1
- package/dist/agent-page.js +3 -2
- package/dist/agent-page.js.map +1 -1
- package/dist/api.d.ts +7 -6
- package/dist/api.d.ts.map +1 -1
- package/dist/api.js +6 -5
- package/dist/api.js.map +1 -1
- package/dist/charts.d.ts +103 -0
- package/dist/charts.d.ts.map +1 -0
- package/dist/charts.js +182 -0
- package/dist/charts.js.map +1 -0
- package/dist/cli/cli.d.ts +26 -2
- package/dist/cli/cli.d.ts.map +1 -1
- package/dist/cli/cli.js +1304 -383
- package/dist/cli/cli.js.map +1 -1
- package/dist/cli/command-words.d.ts +20 -0
- package/dist/cli/command-words.d.ts.map +1 -0
- package/dist/cli/command-words.js +51 -0
- package/dist/cli/command-words.js.map +1 -0
- package/dist/cli/credentials.d.ts +54 -5
- package/dist/cli/credentials.d.ts.map +1 -1
- package/dist/cli/credentials.js +126 -20
- package/dist/cli/credentials.js.map +1 -1
- package/dist/cli/directory.d.ts +19 -4
- package/dist/cli/directory.d.ts.map +1 -1
- package/dist/cli/directory.js +16 -8
- package/dist/cli/directory.js.map +1 -1
- package/dist/cli/format.d.ts +65 -8
- package/dist/cli/format.d.ts.map +1 -1
- package/dist/cli/format.js +242 -37
- package/dist/cli/format.js.map +1 -1
- package/dist/cli/help.d.ts +13 -4
- package/dist/cli/help.d.ts.map +1 -1
- package/dist/cli/help.js +92 -54
- package/dist/cli/help.js.map +1 -1
- package/dist/cli/main.js +76 -2
- package/dist/cli/main.js.map +1 -1
- package/dist/cli/pack.d.ts +69 -60
- package/dist/cli/pack.d.ts.map +1 -1
- package/dist/cli/pack.js +241 -270
- package/dist/cli/pack.js.map +1 -1
- package/dist/cli/plugin-check.d.ts +42 -0
- package/dist/cli/plugin-check.d.ts.map +1 -1
- package/dist/cli/plugin-check.js +221 -36
- package/dist/cli/plugin-check.js.map +1 -1
- package/dist/cli/plugin-cli.d.ts +6 -1
- package/dist/cli/plugin-cli.d.ts.map +1 -1
- package/dist/cli/plugin-cli.js +21 -4
- package/dist/cli/plugin-cli.js.map +1 -1
- package/dist/cli/plugin-main.js +1 -0
- package/dist/cli/plugin-main.js.map +1 -1
- package/dist/cli/serve.d.ts +33 -1
- package/dist/cli/serve.d.ts.map +1 -1
- package/dist/cli/serve.js +252 -3
- package/dist/cli/serve.js.map +1 -1
- package/dist/client.d.ts +48 -9
- package/dist/client.d.ts.map +1 -1
- package/dist/client.js +72 -80
- package/dist/client.js.map +1 -1
- package/dist/components/agent-page.d.ts +64 -1
- package/dist/components/agent-page.d.ts.map +1 -1
- package/dist/components/agent-page.js +244 -96
- package/dist/components/agent-page.js.map +1 -1
- package/dist/components/charts.d.ts +157 -0
- package/dist/components/charts.d.ts.map +1 -0
- package/dist/components/charts.js +182 -0
- package/dist/components/charts.js.map +1 -0
- package/dist/components/desk-records.d.ts +102 -0
- package/dist/components/desk-records.d.ts.map +1 -0
- package/dist/components/desk-records.js +221 -0
- package/dist/components/desk-records.js.map +1 -0
- package/dist/components/desk.d.ts +85 -0
- package/dist/components/desk.d.ts.map +1 -0
- package/dist/components/desk.js +135 -0
- package/dist/components/desk.js.map +1 -0
- package/dist/components/event-feed.d.ts.map +1 -1
- package/dist/components/event-feed.js +4 -1
- package/dist/components/event-feed.js.map +1 -1
- package/dist/components/home.d.ts.map +1 -1
- package/dist/components/home.js +4 -2
- package/dist/components/home.js.map +1 -1
- package/dist/components/plugin-settings.d.ts.map +1 -1
- package/dist/components/plugin-settings.js +54 -3
- package/dist/components/plugin-settings.js.map +1 -1
- package/dist/components/projects.d.ts.map +1 -1
- package/dist/components/projects.js +27 -7
- package/dist/components/projects.js.map +1 -1
- package/dist/components/rules.d.ts +8 -10
- package/dist/components/rules.d.ts.map +1 -1
- package/dist/components/rules.js +35 -13
- package/dist/components/rules.js.map +1 -1
- package/dist/components/setup.d.ts +9 -3
- package/dist/components/setup.d.ts.map +1 -1
- package/dist/components/setup.js +10 -4
- package/dist/components/setup.js.map +1 -1
- package/dist/console.css +677 -7
- package/dist/console.d.ts +5 -0
- package/dist/console.d.ts.map +1 -1
- package/dist/console.js +14 -8
- package/dist/console.js.map +1 -1
- package/dist/data.d.ts.map +1 -1
- package/dist/data.js +32 -33
- package/dist/data.js.map +1 -1
- package/dist/desk-page.d.ts +38 -0
- package/dist/desk-page.d.ts.map +1 -0
- package/dist/desk-page.js +184 -0
- package/dist/desk-page.js.map +1 -0
- package/dist/desk-records-page.d.ts +18 -0
- package/dist/desk-records-page.d.ts.map +1 -0
- package/dist/desk-records-page.js +130 -0
- package/dist/desk-records-page.js.map +1 -0
- package/dist/desk-records.d.ts +247 -0
- package/dist/desk-records.d.ts.map +1 -0
- package/dist/desk-records.js +543 -0
- package/dist/desk-records.js.map +1 -0
- package/dist/desk.d.ts +122 -0
- package/dist/desk.d.ts.map +1 -0
- package/dist/desk.js +211 -0
- package/dist/desk.js.map +1 -0
- package/dist/feed-stream.d.ts +39 -0
- package/dist/feed-stream.d.ts.map +1 -0
- package/dist/feed-stream.js +117 -0
- package/dist/feed-stream.js.map +1 -0
- package/dist/home-tiles.d.ts +10 -3
- package/dist/home-tiles.d.ts.map +1 -1
- package/dist/home-tiles.js +54 -31
- package/dist/home-tiles.js.map +1 -1
- package/dist/i18n/en.d.ts +180 -5
- package/dist/i18n/en.d.ts.map +1 -1
- package/dist/i18n/en.js +184 -7
- package/dist/i18n/en.js.map +1 -1
- package/dist/i18n/ko.d.ts.map +1 -1
- package/dist/i18n/ko.js +169 -6
- package/dist/i18n/ko.js.map +1 -1
- package/dist/index.d.ts +8 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/limits.d.ts +11 -0
- package/dist/limits.d.ts.map +1 -1
- package/dist/limits.js +11 -0
- package/dist/limits.js.map +1 -1
- package/dist/onboarding.d.ts +6 -0
- package/dist/onboarding.d.ts.map +1 -1
- package/dist/onboarding.js +3 -3
- package/dist/onboarding.js.map +1 -1
- package/dist/plugin/context.d.ts +42 -11
- package/dist/plugin/context.d.ts.map +1 -1
- package/dist/plugin/limits.d.ts +2 -0
- package/dist/plugin/limits.d.ts.map +1 -1
- package/dist/plugin/limits.js +2 -0
- package/dist/plugin/limits.js.map +1 -1
- package/dist/plugin/manifest.d.ts +13 -0
- package/dist/plugin/manifest.d.ts.map +1 -1
- package/dist/plugin/manifest.js +30 -3
- package/dist/plugin/manifest.js.map +1 -1
- package/dist/plugin/rest-schemas.d.ts +55 -0
- package/dist/plugin/rest-schemas.d.ts.map +1 -1
- package/dist/plugin/rest-schemas.js +37 -0
- package/dist/plugin/rest-schemas.js.map +1 -1
- package/dist/plugin/sandbox.d.ts.map +1 -1
- package/dist/plugin/sandbox.js +4 -1
- package/dist/plugin/sandbox.js.map +1 -1
- package/dist/plugin/testing.d.ts +6 -2
- package/dist/plugin/testing.d.ts.map +1 -1
- package/dist/plugin/testing.js +52 -10
- package/dist/plugin/testing.js.map +1 -1
- package/dist/plugin.d.ts +1 -1
- package/dist/plugin.d.ts.map +1 -1
- package/dist/plugin.js +1 -1
- package/dist/plugin.js.map +1 -1
- package/dist/records.d.ts +283 -0
- package/dist/records.d.ts.map +1 -0
- package/dist/records.js +543 -0
- package/dist/records.js.map +1 -0
- package/dist/routes.d.ts +3 -1
- package/dist/routes.d.ts.map +1 -1
- package/dist/routes.js +3 -1
- package/dist/routes.js.map +1 -1
- package/dist/rules.d.ts +30 -11
- package/dist/rules.d.ts.map +1 -1
- package/dist/rules.js +98 -45
- package/dist/rules.js.map +1 -1
- package/dist/runner/acp.d.ts +1 -1
- package/dist/runner/acp.d.ts.map +1 -1
- package/dist/runner/acp.js +31 -20
- package/dist/runner/acp.js.map +1 -1
- package/dist/runner/claude.d.ts +1 -1
- package/dist/runner/claude.d.ts.map +1 -1
- package/dist/runner/claude.js +85 -15
- package/dist/runner/claude.js.map +1 -1
- package/dist/runner/codex.d.ts +1 -1
- package/dist/runner/codex.d.ts.map +1 -1
- package/dist/runner/codex.js +19 -16
- package/dist/runner/codex.js.map +1 -1
- package/dist/runner/desk.d.ts +43 -2
- package/dist/runner/desk.d.ts.map +1 -1
- package/dist/runner/desk.js +166 -10
- package/dist/runner/desk.js.map +1 -1
- package/dist/runner/process.d.ts.map +1 -1
- package/dist/runner/process.js +11 -4
- package/dist/runner/process.js.map +1 -1
- package/dist/runner/redact.d.ts +39 -4
- package/dist/runner/redact.d.ts.map +1 -1
- package/dist/runner/redact.js +81 -5
- package/dist/runner/redact.js.map +1 -1
- package/dist/runner/runner.d.ts +15 -1
- package/dist/runner/runner.d.ts.map +1 -1
- package/dist/runner/runner.js +231 -33
- package/dist/runner/runner.js.map +1 -1
- package/dist/runner/task-scheduler.d.ts +20 -0
- package/dist/runner/task-scheduler.d.ts.map +1 -1
- package/dist/runner/task-scheduler.js +34 -4
- package/dist/runner/task-scheduler.js.map +1 -1
- package/dist/runner/types.d.ts +36 -1
- package/dist/runner/types.d.ts.map +1 -1
- package/dist/runner/types.js +17 -0
- package/dist/runner/types.js.map +1 -1
- package/dist/runner.d.ts +6 -6
- package/dist/runner.d.ts.map +1 -1
- package/dist/runner.js +5 -5
- package/dist/runner.js.map +1 -1
- package/dist/schemas.d.ts +509 -5
- package/dist/schemas.d.ts.map +1 -1
- package/dist/schemas.js +76 -16
- package/dist/schemas.js.map +1 -1
- package/dist/services.d.ts +22 -5
- package/dist/services.d.ts.map +1 -1
- package/dist/services.js +35 -15
- package/dist/services.js.map +1 -1
- package/dist/setup-guide.d.ts +3 -1
- package/dist/setup-guide.d.ts.map +1 -1
- package/dist/setup-guide.js +7 -4
- package/dist/setup-guide.js.map +1 -1
- package/dist/vocabulary.d.ts +14 -3
- package/dist/vocabulary.d.ts.map +1 -1
- package/dist/vocabulary.js +13 -3
- package/dist/vocabulary.js.map +1 -1
- package/docs/specs/cli.md +64 -38
- package/docs/specs/plugins.md +27 -20
- package/docs/specs/records.md +113 -0
- package/docs/specs/rest.md +20 -13
- package/docs/specs/runner.md +23 -17
- package/package.json +7 -2
- package/skills/building-a-console/SKILL.md +4 -4
- package/skills/building-a-plugin/SKILL.md +6 -6
- package/skills/deploying-a-console/SKILL.md +4 -4
- package/skills/deploying-a-console/references/resources.md +41 -4
- package/skills/deploying-a-console/references/running-it-again.md +3 -2
- package/skills/keeping-a-desk/SKILL.md +133 -0
- package/skills/keeping-a-desk/collections.md +96 -0
- package/skills/planning-the-board/SKILL.md +14 -18
- package/skills/planning-the-board/references/a-task.md +2 -2
- package/skills/planning-the-board/references/project-rules.md +13 -14
- package/skills/planning-the-board/references/setting-up.md +15 -13
- package/skills/running-an-agent/SKILL.md +10 -9
- package/skills/working-the-board/SKILL.md +62 -44
- package/skills/working-the-board/references/terms.md +9 -5
- package/skills/working-the-board/references/the-pack.md +12 -10
- package/skills/working-the-board/references/the-sentence.md +2 -2
- package/src/agent-page.tsx +3 -1
- package/src/api.ts +77 -2
- package/src/charts.ts +250 -0
- package/src/cli/cli.ts +1698 -476
- package/src/cli/command-words.ts +56 -0
- package/src/cli/credentials.ts +181 -20
- package/src/cli/directory.ts +28 -10
- package/src/cli/format.ts +301 -46
- package/src/cli/help.ts +102 -54
- package/src/cli/main.ts +72 -2
- package/src/cli/pack.ts +333 -372
- package/src/cli/plugin-check.ts +275 -34
- package/src/cli/plugin-cli.ts +28 -4
- package/src/cli/plugin-main.ts +1 -0
- package/src/cli/serve.ts +295 -2
- package/src/client.ts +192 -177
- package/src/components/agent-page.tsx +489 -243
- package/src/components/charts.tsx +680 -0
- package/src/components/desk-records.tsx +724 -0
- package/src/components/desk.tsx +471 -0
- package/src/components/event-feed.tsx +5 -1
- package/src/components/home.tsx +12 -0
- package/src/components/plugin-settings.tsx +171 -12
- package/src/components/projects.tsx +29 -12
- package/src/components/rules.tsx +94 -34
- package/src/components/setup.tsx +18 -3
- package/src/console.tsx +17 -9
- package/src/data.ts +37 -34
- package/src/desk-page.tsx +332 -0
- package/src/desk-records-page.tsx +256 -0
- package/src/desk-records.ts +808 -0
- package/src/desk.ts +329 -0
- package/src/feed-stream.ts +144 -0
- package/src/home-tiles.ts +55 -35
- package/src/i18n/en.ts +196 -9
- package/src/i18n/ko.ts +178 -8
- package/src/index.ts +118 -0
- package/src/limits.ts +11 -0
- package/src/onboarding.ts +12 -4
- package/src/plugin/context.ts +55 -12
- package/src/plugin/limits.ts +2 -0
- package/src/plugin/manifest.ts +38 -2
- package/src/plugin/rest-schemas.ts +41 -0
- package/src/plugin/sandbox.ts +4 -1
- package/src/plugin/testing.ts +63 -12
- package/src/plugin.ts +2 -0
- package/src/records.ts +702 -0
- package/src/routes.ts +3 -1
- package/src/rules.ts +108 -47
- package/src/runner/acp.ts +47 -29
- package/src/runner/claude.ts +113 -23
- package/src/runner/codex.ts +35 -25
- package/src/runner/desk.ts +198 -12
- package/src/runner/process.ts +11 -4
- package/src/runner/redact.ts +92 -6
- package/src/runner/runner.ts +275 -34
- package/src/runner/task-scheduler.ts +36 -4
- package/src/runner/types.ts +47 -1
- package/src/runner.ts +27 -2
- package/src/schemas.ts +83 -15
- package/src/services.ts +49 -14
- package/src/setup-guide.ts +6 -2
- package/src/styles/README.md +11 -1
- package/src/styles/console.css +9 -0
- package/src/styles/pages/desk.css +126 -0
- package/src/styles/pages/documents.css +5 -0
- package/src/styles/parts/bars.css +80 -0
- package/src/styles/parts/chart.css +173 -0
- package/src/styles/parts/figures.css +65 -0
- package/src/styles/parts/legend.css +48 -0
- package/src/styles/parts/series.css +32 -0
- package/src/styles/parts/share.css +25 -0
- package/src/styles/parts/spark.css +23 -0
- package/src/styles/parts/stat.css +69 -0
- package/src/styles/tokens.css +13 -7
- package/src/vocabulary.ts +16 -3
- package/template/desk-web/README.md +8 -0
- package/template/desk-web/index.html +13 -0
- package/template/desk-web/package.json +25 -0
- package/template/desk-web/src/main.tsx +24 -0
- package/template/desk-web/src/page.tsx +51 -0
- package/template/desk-web/tsconfig.json +16 -0
- package/template/desk-web/vite.config.ts +15 -0
package/dist/cli/format.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { RestAgent, RestAgentSecret, RestArtifact, RestCategory, RestComment, RestDecision, RestDocument, RestDocumentSummary, RestDocuments, RestGoal, RestListing, RestMember, RestPerson, RestPersonWork, RestPlugin, RestPluginDetail, RestPluginGrant, RestPluginInvocation, RestPluginOperation, RestPluginRecord, RestPluginRecordPage, RestPluginRecordRead, RestPluginRecordVersions, RestPluginSetting, RestPlugins, RestProject, RestProjectRules, RestRules, RestRulesPlugin, RestRun, RestSignal, RestTask, RestTeam, RestVersion, RestVersionSummary, RestWork, RestWorkspace } from "../schemas.js";
|
|
1
|
+
import type { RestAgent, RestAgentSecret, RestArtifact, RestCategory, RestComment, RestDecision, RestDocument, RestDocumentSummary, RestDocuments, RestEvent, RestEvents, RestGoal, RestListing, RestMember, RestPerson, RestPersonWork, RestPlugin, RestPluginDetail, RestPluginGrant, RestPluginInvocation, RestPluginJob, RestPluginOperation, RestPluginRecord, RestPluginRecordPage, RestPluginRecordRead, RestPluginRecordVersions, RestPluginSetting, RestPlugins, RestProject, RestProjectRules, RestRules, RestRulesPlugin, RestRun, RestRunBrief, RestSignal, RestTask, RestTaskBrief, RestTeam, RestVersion, RestVersionSummary, RestWork, RestWorkspace } from "../schemas.js";
|
|
2
2
|
/** Says which time zone the moments printed from now on are in, or none. */
|
|
3
3
|
export declare function setMomentZone(zone: string | undefined): void;
|
|
4
4
|
/**
|
|
@@ -46,28 +46,52 @@ export declare function formatMore(more: boolean, limit: number, offset: number)
|
|
|
46
46
|
* person; a person by their login.
|
|
47
47
|
*/
|
|
48
48
|
export declare const calledOf: (person: Pick<RestPerson, "login" | "handle">) => string;
|
|
49
|
-
export declare function formatTaskLine(task:
|
|
49
|
+
export declare function formatTaskLine(task: RestTaskBrief): string;
|
|
50
50
|
/** One task in full; with the decisions about it and the runs on it, when given. */
|
|
51
|
-
export declare function formatTask(task: RestTask, decisions?: readonly RestDecision[], runs?: readonly
|
|
51
|
+
export declare function formatTask(task: RestTask, decisions?: readonly RestDecision[], runs?: readonly RestRunBrief[], comments?: readonly RestComment[],
|
|
52
|
+
/** The address of the task's page at the console, where the command knows it: what a person is given to open. */
|
|
53
|
+
page?: string): string;
|
|
52
54
|
/**
|
|
53
55
|
* One comment of the discussion, indented under the list: who said it, through which agent,
|
|
54
56
|
* when, the whole word, and each file put in it with the command that reads it.
|
|
55
57
|
*/
|
|
56
58
|
export declare function formatComment(comment: RestComment): string;
|
|
57
|
-
export declare function formatRunLine(run:
|
|
59
|
+
export declare function formatRunLine(run: RestRunBrief): string;
|
|
58
60
|
/** One run in full; with where each file handed in is read, when the caller knows. */
|
|
59
61
|
export declare function formatRun(run: RestRun, fileUrl?: (artifactId: string) => string): string;
|
|
60
62
|
/** What was handed in: the link, or the file with its size and where its bytes are read. */
|
|
61
63
|
export declare function formatArtifact(artifact: RestArtifact, fileUrl?: (artifactId: string) => string): string;
|
|
62
64
|
/**
|
|
63
|
-
* The rules
|
|
64
|
-
*
|
|
65
|
+
* The mark of the rules (ADR-0119): the first eight hex characters of a SHA-256 over what they
|
|
66
|
+
* say to whoever reads them: the workspace's text whole, which is the console's rules with
|
|
67
|
+
* what the organization adds (ADR-0120), what the project adds, and the plugins' lines, in the
|
|
68
|
+
* language they are read in. A session that was shown the rules holds their mark, and a later
|
|
69
|
+
* take of that session leaves out the rules the mark stands for; nothing but having been shown
|
|
70
|
+
* them gives it. When they were written and by whom is no part of it: the same rules have the
|
|
71
|
+
* same mark, and a project that adds nothing has the workspace's.
|
|
72
|
+
*/
|
|
73
|
+
export declare function rulesMark(rules: RestProjectRules | RestRules, language?: string | null | undefined): string;
|
|
74
|
+
/**
|
|
75
|
+
* The rules that hold, under a first line that says what follows (ADR-0119): the mark, which
|
|
76
|
+
* parts there are and how long each is, and how a later take of the session leaves them out.
|
|
77
|
+
* What differs stands first and what always holds last (ADR-0120): what the project adds with
|
|
78
|
+
* the plugins' lines, then what the organization adds, then the console's rules. An agent that
|
|
79
|
+
* had read the long part once cut every later print at its head, and never saw what stood
|
|
80
|
+
* after it; and where they differ it is the earlier part that holds. Who adds nothing is said
|
|
81
|
+
* in a clause of the line, and has no part.
|
|
65
82
|
*/
|
|
66
83
|
export declare function formatRules(rules: RestProjectRules | RestRules, language?: string | null | undefined): string;
|
|
84
|
+
/** What a take says, before the task, where it was told the mark the rules have (ADR-0119): they are left out. */
|
|
85
|
+
export declare const formatRulesLeftOut: (mark: string) => string;
|
|
86
|
+
/**
|
|
87
|
+
* What a take says, before the task, where it was told a mark the rules do not have (ADR-0119):
|
|
88
|
+
* the rules then follow the task whole, as they do without a mark.
|
|
89
|
+
*/
|
|
90
|
+
export declare const formatRulesChanged: (given: string) => string;
|
|
67
91
|
/** One goal: its id, its state, its title, its category, its days, and how far it is. */
|
|
68
92
|
export declare function formatGoalLine(goal: RestGoal): string;
|
|
69
93
|
/** One goal in full; with the tasks that work towards it, when given. */
|
|
70
|
-
export declare function formatGoal(goal: RestGoal, tasks?: readonly
|
|
94
|
+
export declare function formatGoal(goal: RestGoal, tasks?: readonly RestTaskBrief[]): string;
|
|
71
95
|
/** One category: its key, what people call it, and its colour. */
|
|
72
96
|
export declare function formatCategoryLine(category: RestCategory): string;
|
|
73
97
|
/** What is on a person's plate: their open tasks by project, and the decisions waiting. */
|
|
@@ -76,11 +100,21 @@ export declare function formatWork(work: RestWork): string;
|
|
|
76
100
|
export declare function formatPersonWork(person: RestPerson, work: RestPersonWork): string;
|
|
77
101
|
/** The logins of everyone a decision is addressed to, with commas between. */
|
|
78
102
|
export declare const deciderLogins: (decision: RestDecision) => string;
|
|
103
|
+
/**
|
|
104
|
+
* One decision in a line, with when it was asked: a decision that waits holds a run, and whoever
|
|
105
|
+
* is told what is on their plate is told since when each one waits.
|
|
106
|
+
*/
|
|
79
107
|
export declare function formatDecisionLine(decision: RestDecision): string;
|
|
80
108
|
/** The options, one a line; the person's own answer, when they wrote one, is the last and says so. */
|
|
81
109
|
export declare function formatOptions(decision: RestDecision): string;
|
|
82
110
|
/** The answer, with who gave it, and that it is in their own words when it is; or that there is none yet. */
|
|
83
111
|
export declare function formatAnswer(decision: RestDecision): string;
|
|
112
|
+
/**
|
|
113
|
+
* The address of a task's or a decision's page, on a line of its own: what an agent gives a
|
|
114
|
+
* person to open, in place of the console's front page, or of a number a git host would take
|
|
115
|
+
* for an issue of its own.
|
|
116
|
+
*/
|
|
117
|
+
export declare const pageLine: (page: string) => string;
|
|
84
118
|
/**
|
|
85
119
|
* One decision in full. A decision reached at its own address (ADR-0068), outside the project the
|
|
86
120
|
* command works in, names its files with the command that reads them there, by the decision too:
|
|
@@ -88,6 +122,8 @@ export declare function formatAnswer(decision: RestDecision): string;
|
|
|
88
122
|
*/
|
|
89
123
|
export declare function formatDecision(decision: RestDecision, options?: {
|
|
90
124
|
readonly atItsAddress?: boolean;
|
|
125
|
+
/** The address of the decision's page at the console, where the command knows it. */
|
|
126
|
+
readonly page?: string | undefined;
|
|
91
127
|
}): string;
|
|
92
128
|
/** One document in a list: its path, its title, its version, who wrote it last and when. */
|
|
93
129
|
export declare function formatDocumentLine(document: RestDocumentSummary): string;
|
|
@@ -115,12 +151,33 @@ export declare function formatOperationUsage(key: string, operation: RestPluginO
|
|
|
115
151
|
}): string;
|
|
116
152
|
/** One command or query of a plugin in full, as `console help <command>` prints one; or every one in a line. */
|
|
117
153
|
export declare function formatPluginHelp(detail: RestPluginDetail, name: string | undefined): string;
|
|
118
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* A setting in a line: its key and type, what it holds or whether it is set, and its name; for a
|
|
156
|
+
* secret kept per key (ADR-0111), how many keys of how many, and a line under it for each key.
|
|
157
|
+
*/
|
|
119
158
|
export declare function formatPluginSettingLine(setting: RestPluginSetting, language: string | null | undefined): string;
|
|
120
159
|
/** A grant in a line: its id, the role, whom it is to, since when. */
|
|
121
160
|
export declare function formatPluginGrantLine(grant: RestPluginGrant): string;
|
|
122
161
|
/** A team in a line (ADR-0073): its key (ADR-0074), its name, how many are in it, and their logins. */
|
|
123
162
|
export declare function formatTeamLine(team: RestTeam, loginOf: ReadonlyMap<string, string>): string;
|
|
163
|
+
/**
|
|
164
|
+
* A job of a plugin in a line (ADR-0128): its name and how often it runs, how its last run went
|
|
165
|
+
* and since when it has failed where it keeps failing, and when it runs next.
|
|
166
|
+
*/
|
|
167
|
+
export declare function formatPluginJobLine(job: RestPluginJob): string;
|
|
168
|
+
/** One event of a plugin in a line: its number, when, its kind, who did it and through what, and what it says. */
|
|
169
|
+
export declare function formatPluginEventLine(event: RestEvent): string;
|
|
170
|
+
/**
|
|
171
|
+
* A page of a plugin's events, newest first (ADR-0128), of one kind where one was asked for:
|
|
172
|
+
* what `console plugin <key> events` prints, with how to read on. The console answers what the
|
|
173
|
+
* caller may read and says nothing of the rest, so an empty page is said as that, and never as
|
|
174
|
+
* a plugin that has no events.
|
|
175
|
+
*/
|
|
176
|
+
export declare function formatPluginEvents(key: string, page: RestEvents, asked: {
|
|
177
|
+
readonly kind: string | undefined;
|
|
178
|
+
readonly limit: number;
|
|
179
|
+
readonly offset: number;
|
|
180
|
+
}): string;
|
|
124
181
|
/** One plugin in full: what it is, how it stands, what one may run, its skills and its settings. */
|
|
125
182
|
export declare function formatPlugin(detail: RestPluginDetail, language: string | null | undefined): string;
|
|
126
183
|
/**
|
package/dist/cli/format.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/cli/format.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"format.d.ts","sourceRoot":"","sources":["../../src/cli/format.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EACV,SAAS,EACT,eAAe,EACf,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,SAAS,EACT,UAAU,EACV,QAAQ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9B,MAAM,EAAE,gBAAgB,EACxB,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,MAAM,EAAE,CAkBV;AAED,oEAAoE;AACpE,wBAAgB,gBAAgB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAarE;AAQD,uGAAuG;AACvG,wBAAgB,sBAAsB,CAAC,MAAM,EAAE,gBAAgB,GAAG,MAAM,CAEvE;AAED,wDAAwD;AACxD,wBAAgB,mBAAmB,CAAC,IAAI,EAAE,oBAAoB,GAAG,MAAM,CAStE;AAED,0DAA0D;AAC1D,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,oBAAoB,GAAG,MAAM,CAqBvE;AAED,2DAA2D;AAC3D,wBAAgB,0BAA0B,CAAC,QAAQ,EAAE,wBAAwB,GAAG,MAAM,CAUrF;AAED,uGAAuG;AACvG,wBAAgB,kBAAkB,CAChC,OAAO,EAAE,SAAS,eAAe,EAAE,EACnC,QAAQ,EAAE,MAAM,GAAG,IAAI,GAAG,SAAS,GAClC,MAAM,CASR"}
|
package/dist/cli/format.js
CHANGED
|
@@ -1,4 +1,6 @@
|
|
|
1
|
+
import { createHash } from "node:crypto";
|
|
1
2
|
import { argUsage } from "../plugin/args.js";
|
|
3
|
+
import { reportCountOf } from "../schemas.js";
|
|
2
4
|
// What the command prints: one line per thing in a list, a few lines for one thing in full.
|
|
3
5
|
// Plain text, for an agent to read and a person to skim; ids are given, since the commands take
|
|
4
6
|
// them, and the words are the vocabulary's own, since the options take those.
|
|
@@ -101,7 +103,16 @@ export function formatAgentLine(agent) {
|
|
|
101
103
|
const standing = [
|
|
102
104
|
`signs in as ${person.login}`,
|
|
103
105
|
...(manager === null ? [] : [`reports to ${calledOf(manager)}`]),
|
|
104
|
-
...(person.invited === true
|
|
106
|
+
...(person.invited === true
|
|
107
|
+
? [
|
|
108
|
+
// At a git host, whether the host said which account the login is (ADR-0126).
|
|
109
|
+
agent.firstSignIn === undefined
|
|
110
|
+
? "not signed in yet"
|
|
111
|
+
: agent.firstSignIn === "account"
|
|
112
|
+
? "not signed in yet, its account confirmed at the host"
|
|
113
|
+
: "not signed in yet, its account not confirmed",
|
|
114
|
+
]
|
|
115
|
+
: []),
|
|
105
116
|
...(person.status === "active" ? [] : ["deactivated"]),
|
|
106
117
|
].join(", ");
|
|
107
118
|
return `@${person.handle ?? person.login} ${called.join(", ")} (${standing})`;
|
|
@@ -279,11 +290,14 @@ function scheduleLines(task) {
|
|
|
279
290
|
return lines;
|
|
280
291
|
}
|
|
281
292
|
/** One task in full; with the decisions about it and the runs on it, when given. */
|
|
282
|
-
export function formatTask(task, decisions, runs, comments
|
|
293
|
+
export function formatTask(task, decisions, runs, comments,
|
|
294
|
+
/** The address of the task's page at the console, where the command knows it: what a person is given to open. */
|
|
295
|
+
page) {
|
|
283
296
|
const lines = [
|
|
284
297
|
`#${task.number} ${task.title}`,
|
|
285
298
|
`state: ${task.state} priority: ${task.priority} owner: ${calledOf(task.owner)} workers: ${task.workers.length === 0 ? "nobody" : logins(task.workers)}`,
|
|
286
299
|
`id: ${task.id}${task.parentId === null ? "" : ` part of: ${task.parentId}`}`,
|
|
300
|
+
...(page === undefined ? [] : [pageLine(page)]),
|
|
287
301
|
...(task.agent == null ? [] : [`written through: ${task.agent}`]),
|
|
288
302
|
...scheduleLines(task),
|
|
289
303
|
];
|
|
@@ -334,7 +348,9 @@ export function formatComment(comment) {
|
|
|
334
348
|
return lines.join("\n");
|
|
335
349
|
}
|
|
336
350
|
export function formatRunLine(run) {
|
|
337
|
-
|
|
351
|
+
// A run of a listing comes without its reports, counted (`?brief=true`); a run read whole,
|
|
352
|
+
// or from a console from before the brief form, with them.
|
|
353
|
+
const notes = [plural(reportCountOf(run), "report"), plural(run.artifacts.length, "artifact")];
|
|
338
354
|
if (run.waitingFor !== null) {
|
|
339
355
|
notes.push(`waiting for decision ${run.waitingFor}`);
|
|
340
356
|
}
|
|
@@ -373,37 +389,151 @@ export function formatArtifact(artifact, fileUrl) {
|
|
|
373
389
|
: `${artifact.file.name} (${artifact.file.size} bytes, ${artifact.file.contentType}${fileUrl === undefined ? "" : `; read at ${fileUrl(artifact.id)}`}; console file ${artifact.id})`;
|
|
374
390
|
return artifact.label === null ? what : `${artifact.label}: ${what}`;
|
|
375
391
|
}
|
|
376
|
-
/**
|
|
377
|
-
function
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
392
|
+
/** When a part of the rules was written and by whom, where a page says; nothing for the console's own. */
|
|
393
|
+
function rulesFacts(page) {
|
|
394
|
+
return page === null
|
|
395
|
+
? ""
|
|
396
|
+
: ` (v${page.version}, by ${writer(page.updatedBy, page.agent)}; ${moment(page.updatedAt)})`;
|
|
397
|
+
}
|
|
398
|
+
/** A part of the rules that has a text: what it is, who wrote it where someone did, and the text as it stands. */
|
|
399
|
+
const formatRulesPart = (head, page, body) => `${head}${rulesFacts(page)}:\n\n${body.trimEnd()}`;
|
|
400
|
+
/**
|
|
401
|
+
* The workspace's rules as a console of before the parts answers them (ADR-0120): whole, the
|
|
402
|
+
* console's own until an administrator writes the organization's in their place, which is
|
|
403
|
+
* what holds on such a console. No command is named for writing them: this one writes what an
|
|
404
|
+
* organization adds, and refuses to on a console that would keep it as the whole.
|
|
405
|
+
*/
|
|
406
|
+
function formatRulesWhole(rules) {
|
|
385
407
|
const head = rules.source === "reference"
|
|
386
|
-
?
|
|
387
|
-
: `Rules of ${
|
|
388
|
-
return `${head}\n\n${rules.body.trimEnd()}`;
|
|
408
|
+
? "Rules of the workspace: the console's own, until an administrator writes the organization's."
|
|
409
|
+
: `Rules of the workspace${rulesFacts(rules.page) || " (written)"}:`;
|
|
410
|
+
return `${head}\n\n${(rules.body ?? "").trimEnd()}`;
|
|
411
|
+
}
|
|
412
|
+
/**
|
|
413
|
+
* The parts of the rules as they are printed for whoever reads them (ADR-0120): what the
|
|
414
|
+
* project adds where the command works in one and it adds something, the plugins' lines in the
|
|
415
|
+
* language they are read in, what the organization adds where it adds something, and the
|
|
416
|
+
* console's rules, which always hold.
|
|
417
|
+
*/
|
|
418
|
+
function rulesParts(rules, language) {
|
|
419
|
+
const named = "workspace" in rules;
|
|
420
|
+
const workspace = named ? rules.workspace : rules;
|
|
421
|
+
const project = named && rules.project.source !== "none" ? rules.project : undefined;
|
|
422
|
+
const count = rules.plugins?.length ?? 0;
|
|
423
|
+
const added = workspace.added ?? null;
|
|
424
|
+
return {
|
|
425
|
+
/** Whether the command works in a project: its rules were asked for, whether it adds any or not. */
|
|
426
|
+
named,
|
|
427
|
+
workspace,
|
|
428
|
+
/** What the project adds, where it adds something. */
|
|
429
|
+
own: project !== undefined && project.body !== null ? project : undefined,
|
|
430
|
+
plugins: rules.plugins === undefined || count === 0
|
|
431
|
+
? undefined
|
|
432
|
+
: formatRulesPlugins(rules.plugins, language),
|
|
433
|
+
pluginCount: count,
|
|
434
|
+
/** What the organization adds, where it adds something and the console says the parts. */
|
|
435
|
+
added: workspace.own === undefined || added === null ? undefined : added,
|
|
436
|
+
/** The console's rules by themselves; nothing from a console of before, which answers the whole. */
|
|
437
|
+
console: workspace.own,
|
|
438
|
+
};
|
|
439
|
+
}
|
|
440
|
+
/**
|
|
441
|
+
* The mark of the rules (ADR-0119): the first eight hex characters of a SHA-256 over what they
|
|
442
|
+
* say to whoever reads them: the workspace's text whole, which is the console's rules with
|
|
443
|
+
* what the organization adds (ADR-0120), what the project adds, and the plugins' lines, in the
|
|
444
|
+
* language they are read in. A session that was shown the rules holds their mark, and a later
|
|
445
|
+
* take of that session leaves out the rules the mark stands for; nothing but having been shown
|
|
446
|
+
* them gives it. When they were written and by whom is no part of it: the same rules have the
|
|
447
|
+
* same mark, and a project that adds nothing has the workspace's.
|
|
448
|
+
*/
|
|
449
|
+
export function rulesMark(rules, language) {
|
|
450
|
+
const parts = rulesParts(rules, language);
|
|
451
|
+
return createHash("sha256")
|
|
452
|
+
.update(JSON.stringify([
|
|
453
|
+
(parts.workspace.body ?? "").trimEnd(),
|
|
454
|
+
parts.own === undefined ? null : (parts.own.body ?? "").trimEnd(),
|
|
455
|
+
parts.plugins ?? null,
|
|
456
|
+
]))
|
|
457
|
+
.digest("hex")
|
|
458
|
+
.slice(0, 8);
|
|
389
459
|
}
|
|
460
|
+
/** How long a text of the rules is, as its first line says it. */
|
|
461
|
+
const charactersOf = (text) => `${(text ?? "").trimEnd().length} characters`;
|
|
390
462
|
/**
|
|
391
|
-
* The rules that hold
|
|
392
|
-
*
|
|
463
|
+
* The rules that hold, under a first line that says what follows (ADR-0119): the mark, which
|
|
464
|
+
* parts there are and how long each is, and how a later take of the session leaves them out.
|
|
465
|
+
* What differs stands first and what always holds last (ADR-0120): what the project adds with
|
|
466
|
+
* the plugins' lines, then what the organization adds, then the console's rules. An agent that
|
|
467
|
+
* had read the long part once cut every later print at its head, and never saw what stood
|
|
468
|
+
* after it; and where they differ it is the earlier part that holds. Who adds nothing is said
|
|
469
|
+
* in a clause of the line, and has no part.
|
|
393
470
|
*/
|
|
394
471
|
export function formatRules(rules, language) {
|
|
395
|
-
const parts =
|
|
396
|
-
|
|
397
|
-
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
:
|
|
402
|
-
|
|
403
|
-
|
|
472
|
+
const parts = rulesParts(rules, language);
|
|
473
|
+
const mark = rulesMark(rules, language);
|
|
474
|
+
// A console of before answers the workspace's rules whole: they are the last part then.
|
|
475
|
+
const whole = parts.console === undefined;
|
|
476
|
+
const last = whole
|
|
477
|
+
? `the workspace's (${charactersOf(parts.workspace.body)})`
|
|
478
|
+
: `the console's (${charactersOf(parts.console ?? null)})`;
|
|
479
|
+
const lastFollows = whole
|
|
480
|
+
? `the workspace's follow (${charactersOf(parts.workspace.body)})`
|
|
481
|
+
: `the console's follow (${charactersOf(parts.console ?? null)})`;
|
|
482
|
+
const plugins = `${parts.pluginCount} plugin${parts.pluginCount === 1 ? "" : "s"}`;
|
|
483
|
+
const HOLDS = "the earlier holding where they differ";
|
|
484
|
+
/** The organization's part and the last, after whatever stood before them. */
|
|
485
|
+
const rest = (first) => parts.added === undefined
|
|
486
|
+
? last
|
|
487
|
+
: `the organization's${first ? " additions first" : ""} (${charactersOf(parts.added.body)}), then ${last}`;
|
|
488
|
+
let follows;
|
|
489
|
+
if (parts.own !== undefined) {
|
|
490
|
+
follows = `this project's additions first (${charactersOf(parts.own.body)})${parts.plugins === undefined ? "" : ` with its ${plugins}`}, then ${rest(false)}, ${HOLDS}${whole || parts.added !== undefined ? "" : "; the organization adds nothing"}.`;
|
|
404
491
|
}
|
|
405
|
-
|
|
492
|
+
else {
|
|
493
|
+
const nobody = parts.added === undefined && !whole;
|
|
494
|
+
const lead = parts.named
|
|
495
|
+
? nobody
|
|
496
|
+
? "this project and the organization add nothing; "
|
|
497
|
+
: "this project adds nothing; "
|
|
498
|
+
: nobody
|
|
499
|
+
? "the organization adds nothing; "
|
|
500
|
+
: "";
|
|
501
|
+
const theirs = parts.named ? `its ${plugins}` : `the ${plugins} you may use`;
|
|
502
|
+
const body = parts.plugins !== undefined
|
|
503
|
+
? `${theirs} first, then ${parts.added === undefined ? last : `the organization's additions (${charactersOf(parts.added.body)}), then ${last}, ${HOLDS}`}`
|
|
504
|
+
: parts.added === undefined
|
|
505
|
+
? parts.named || nobody
|
|
506
|
+
? lastFollows
|
|
507
|
+
: last
|
|
508
|
+
: `${rest(true)}, ${HOLDS}`;
|
|
509
|
+
follows = `${lead}${body}${parts.named ? "." : "; no project is named here, and a project's additions stand before them where it has some."}`;
|
|
510
|
+
}
|
|
511
|
+
// The mark ends the line bare, so that it is copied as it is.
|
|
512
|
+
const later = parts.named
|
|
513
|
+
? ` A later take in this session leaves them out: console take <number> --rules ${mark}`
|
|
514
|
+
: "";
|
|
515
|
+
return [
|
|
516
|
+
`Rules ${mark}: ${follows}${later}`,
|
|
517
|
+
...(parts.own === undefined
|
|
518
|
+
? []
|
|
519
|
+
: ["", formatRulesPart("What this project adds", parts.own.page, parts.own.body ?? "")]),
|
|
520
|
+
...(parts.plugins === undefined ? [] : ["", parts.plugins]),
|
|
521
|
+
...(parts.added === undefined
|
|
522
|
+
? []
|
|
523
|
+
: ["", formatRulesPart("What this organization adds", parts.added.page, parts.added.body)]),
|
|
524
|
+
"",
|
|
525
|
+
parts.console === undefined
|
|
526
|
+
? formatRulesWhole(parts.workspace)
|
|
527
|
+
: formatRulesPart("The console's rules, which always hold", null, parts.console),
|
|
528
|
+
].join("\n");
|
|
406
529
|
}
|
|
530
|
+
/** What a take says, before the task, where it was told the mark the rules have (ADR-0119): they are left out. */
|
|
531
|
+
export const formatRulesLeftOut = (mark) => `Rules ${mark}: left out, since they stand as this session read them. console rules prints them.`;
|
|
532
|
+
/**
|
|
533
|
+
* What a take says, before the task, where it was told a mark the rules do not have (ADR-0119):
|
|
534
|
+
* the rules then follow the task whole, as they do without a mark.
|
|
535
|
+
*/
|
|
536
|
+
export const formatRulesChanged = (given) => `The rules are not the ones marked ${given}: they changed since, or that mark is of another project's. They follow whole after the task, under the mark they have now.`;
|
|
407
537
|
/** How far a goal is, from its tasks: the done, the at work, and the rest, in one phrase. */
|
|
408
538
|
function progressOf(goal) {
|
|
409
539
|
const counts = goal.taskCounts;
|
|
@@ -483,9 +613,13 @@ export const deciderLogins = (decision) => decidersOf(decision).map(calledOf).jo
|
|
|
483
613
|
const addressed = (decision) => decidersOf(decision).every((person) => person.id === decision.raisedBy.id)
|
|
484
614
|
? ""
|
|
485
615
|
: `, for ${deciderLogins(decision)}`;
|
|
616
|
+
/**
|
|
617
|
+
* One decision in a line, with when it was asked: a decision that waits holds a run, and whoever
|
|
618
|
+
* is told what is on their plate is told since when each one waits.
|
|
619
|
+
*/
|
|
486
620
|
export function formatDecisionLine(decision) {
|
|
487
621
|
const state = decision.answer === null ? "waiting" : `answered ${decision.answer.option}`;
|
|
488
|
-
return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)})`;
|
|
622
|
+
return `${decision.id} ${state} ${decision.question} (asked by ${asker(decision)}${addressed(decision)}, at ${moment(decision.createdAt)})`;
|
|
489
623
|
}
|
|
490
624
|
/** The options, one a line; the person's own answer, when they wrote one, is the last and says so. */
|
|
491
625
|
export function formatOptions(decision) {
|
|
@@ -501,13 +635,19 @@ export function formatAnswer(decision) {
|
|
|
501
635
|
}
|
|
502
636
|
const chosen = decision.options.find((option) => option.id === answer.option);
|
|
503
637
|
const lines = [
|
|
504
|
-
`Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${calledOf(answer.by)}${through(answer.agent)} at ${answer.at}`,
|
|
638
|
+
`Answered: ${answer.option}) ${chosen?.label ?? answer.option}${chosen?.own === true ? ", in their own words" : ""}, by ${calledOf(answer.by)}${through(answer.agent)} at ${moment(answer.at)}`,
|
|
505
639
|
];
|
|
506
640
|
if (answer.note !== null && answer.note.length > 0) {
|
|
507
641
|
lines.push(`Note: ${answer.note}`);
|
|
508
642
|
}
|
|
509
643
|
return lines.join("\n");
|
|
510
644
|
}
|
|
645
|
+
/**
|
|
646
|
+
* The address of a task's or a decision's page, on a line of its own: what an agent gives a
|
|
647
|
+
* person to open, in place of the console's front page, or of a number a git host would take
|
|
648
|
+
* for an issue of its own.
|
|
649
|
+
*/
|
|
650
|
+
export const pageLine = (page) => `page: ${page}`;
|
|
511
651
|
/**
|
|
512
652
|
* One decision in full. A decision reached at its own address (ADR-0068), outside the project the
|
|
513
653
|
* command works in, names its files with the command that reads them there, by the decision too:
|
|
@@ -519,7 +659,8 @@ export function formatDecision(decision, options = {}) {
|
|
|
519
659
|
: `console file ${fileId}`;
|
|
520
660
|
const lines = [
|
|
521
661
|
`decision ${decision.id}: ${decision.question}`,
|
|
522
|
-
`asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}`,
|
|
662
|
+
`asked by ${asker(decision)}${addressed(decision)}${decision.taskNumber === null ? "" : `, about task #${decision.taskNumber}`}, at ${moment(decision.createdAt)}`,
|
|
663
|
+
...(options.page === undefined ? [] : [pageLine(options.page)]),
|
|
523
664
|
];
|
|
524
665
|
if (decision.body.trim().length > 0) {
|
|
525
666
|
lines.push("", decision.body.trimEnd());
|
|
@@ -533,7 +674,7 @@ export function formatDecision(decision, options = {}) {
|
|
|
533
674
|
if (decision.outcome !== null && decision.outcome.trim().length > 0) {
|
|
534
675
|
lines.push("", "what followed:", indent(decision.outcome));
|
|
535
676
|
if (decision.outcomeBy != null && decision.outcomeAt != null) {
|
|
536
|
-
lines.push(indent(`written by ${calledOf(decision.outcomeBy)}${through(decision.outcomeAgent)} at ${decision.outcomeAt}`));
|
|
677
|
+
lines.push(indent(`written by ${calledOf(decision.outcomeBy)}${through(decision.outcomeAgent)} at ${moment(decision.outcomeAt)}`));
|
|
537
678
|
}
|
|
538
679
|
}
|
|
539
680
|
return lines.join("\n");
|
|
@@ -731,15 +872,29 @@ export function formatPluginHelp(detail, name) {
|
|
|
731
872
|
: "Prints what the command says; --json prints its data. A command that raised a decision prints its id and exits with 3: console decision <id> --wait 100 waits for the answer.", "", "Refusals:", ...PLUGIN_COMMAND_REFUSALS.map((refusal) => ` ${refusal}`));
|
|
732
873
|
return parts.join("\n");
|
|
733
874
|
}
|
|
734
|
-
/**
|
|
875
|
+
/** When a secret was set, from where where it was sealed from an answer, and when it expires: never what it holds. */
|
|
876
|
+
function secretStanding(standing) {
|
|
877
|
+
return `set${standing.setAt === null ? "" : ` ${moment(standing.setAt)}`}${standing.source === null || standing.source === undefined || standing.source === "administrator"
|
|
878
|
+
? ""
|
|
879
|
+
: ` from ${standing.source}`}${standing.expiresAt === null || standing.expiresAt === undefined ? "" : `, expires ${moment(standing.expiresAt)}`}`;
|
|
880
|
+
}
|
|
881
|
+
/**
|
|
882
|
+
* A setting in a line: its key and type, what it holds or whether it is set, and its name; for a
|
|
883
|
+
* secret kept per key (ADR-0111), how many keys of how many, and a line under it for each key.
|
|
884
|
+
*/
|
|
735
885
|
export function formatPluginSettingLine(setting, language) {
|
|
886
|
+
const keys = setting.keys ?? null;
|
|
887
|
+
if (setting.type === "secret" && keys !== null) {
|
|
888
|
+
const max = setting.keyed?.max;
|
|
889
|
+
const count = `${keys.length}${max === undefined ? "" : ` of ${max}`} ${keys.length === 1 && max === undefined ? "key" : "keys"}`;
|
|
890
|
+
return [
|
|
891
|
+
` ${setting.key} (secret, per key): ${count} ${localized(setting.name, language)}`,
|
|
892
|
+
...keys.map((kept) => ` ${kept.key}: ${secretStanding(kept)}`),
|
|
893
|
+
].join("\n");
|
|
894
|
+
}
|
|
736
895
|
const holds = setting.type === "secret"
|
|
737
896
|
? setting.set
|
|
738
|
-
?
|
|
739
|
-
setting.source === undefined ||
|
|
740
|
-
setting.source === "administrator"
|
|
741
|
-
? ""
|
|
742
|
-
: ` from ${setting.source}`}${setting.expiresAt === null || setting.expiresAt === undefined ? "" : `, expires ${moment(setting.expiresAt)}`}`
|
|
897
|
+
? secretStanding(setting)
|
|
743
898
|
: "not set"
|
|
744
899
|
: setting.set
|
|
745
900
|
? setting.value === null
|
|
@@ -769,6 +924,52 @@ export function formatTeamLine(team, loginOf) {
|
|
|
769
924
|
const count = team.memberIds.length === 1 ? "1 member" : `${team.memberIds.length} members`;
|
|
770
925
|
return `${team.key} ${team.name} ${count}${logins.length === 0 ? "" : `: ${logins.join(", ")}`}`;
|
|
771
926
|
}
|
|
927
|
+
/**
|
|
928
|
+
* A job of a plugin in a line (ADR-0128): its name and how often it runs, how its last run went
|
|
929
|
+
* and since when it has failed where it keeps failing, and when it runs next.
|
|
930
|
+
*/
|
|
931
|
+
export function formatPluginJobLine(job) {
|
|
932
|
+
const schedule = `every ${job.every}${job.at === null ? "" : ` at ${job.at}`}`;
|
|
933
|
+
const last = job.lastRunAt === null || job.lastOutcome === null
|
|
934
|
+
? "has not run yet"
|
|
935
|
+
: `last run ${moment(job.lastRunAt)}: ${job.lastOutcome}${job.lastOutcome === "failed" && job.failedSince !== null
|
|
936
|
+
? `, failing since ${moment(job.failedSince)}`
|
|
937
|
+
: ""}`;
|
|
938
|
+
return ` ${job.name} ${schedule} ${last} next: ${job.nextAt === null ? "not scheduled" : moment(job.nextAt)}`;
|
|
939
|
+
}
|
|
940
|
+
/** What an event of a plugin says, after its kind: what failed, which command and how it ended, else what it carries. */
|
|
941
|
+
function pluginEventSays(event) {
|
|
942
|
+
const data = event.data;
|
|
943
|
+
if (event.kind === "plugin.failed") {
|
|
944
|
+
return data.problem ?? "";
|
|
945
|
+
}
|
|
946
|
+
if (event.kind === "plugin.command") {
|
|
947
|
+
return `${data.command ?? "?"} ${data.outcome ?? "?"}${data.code === undefined ? "" : ` (${data.code})`}${data.durationMs === undefined ? "" : `, ${data.durationMs} ms`}`;
|
|
948
|
+
}
|
|
949
|
+
const carried = JSON.stringify(data);
|
|
950
|
+
return carried === "{}" ? "" : carried.length > 300 ? `${carried.slice(0, 300)}...` : carried;
|
|
951
|
+
}
|
|
952
|
+
/** One event of a plugin in a line: its number, when, its kind, who did it and through what, and what it says. */
|
|
953
|
+
export function formatPluginEventLine(event) {
|
|
954
|
+
const who = event.actor === null
|
|
955
|
+
? "the console"
|
|
956
|
+
: `${calledOf(event.actor)}${event.agent === null ? "" : ` as ${event.agent}`}`;
|
|
957
|
+
const says = pluginEventSays(event);
|
|
958
|
+
return `#${event.id} ${moment(event.createdAt)} ${event.kind} ${who}${says === "" ? "" : ` ${says}`}`;
|
|
959
|
+
}
|
|
960
|
+
/**
|
|
961
|
+
* A page of a plugin's events, newest first (ADR-0128), of one kind where one was asked for:
|
|
962
|
+
* what `console plugin <key> events` prints, with how to read on. The console answers what the
|
|
963
|
+
* caller may read and says nothing of the rest, so an empty page is said as that, and never as
|
|
964
|
+
* a plugin that has no events.
|
|
965
|
+
*/
|
|
966
|
+
export function formatPluginEvents(key, page, asked) {
|
|
967
|
+
if (page.items.length === 0) {
|
|
968
|
+
const none = `No ${asked.kind === undefined ? "" : `${asked.kind} `}event of ${key} that you may read${asked.offset > 0 ? ", that far back" : ""}.`;
|
|
969
|
+
return `${none}${formatMore(page.more, asked.limit, asked.offset)}`;
|
|
970
|
+
}
|
|
971
|
+
return `${page.items.map(formatPluginEventLine).join("\n")}${formatMore(page.more, asked.limit, asked.offset)}`;
|
|
972
|
+
}
|
|
772
973
|
/** One plugin in full: what it is, how it stands, what one may run, its skills and its settings. */
|
|
773
974
|
export function formatPlugin(detail, language) {
|
|
774
975
|
const name = localized(detail.name, language);
|
|
@@ -810,6 +1011,10 @@ export function formatPlugin(detail, language) {
|
|
|
810
1011
|
if (detail.skills !== null) {
|
|
811
1012
|
lines.push("", `Skills: console plugin ${detail.key} skills lists them; console plugin ${detail.key} skill <path> reads one. Read the one that fits before the first command.`);
|
|
812
1013
|
}
|
|
1014
|
+
// A console before 0.5.1 names no jobs: nothing is printed of them then, not an empty block.
|
|
1015
|
+
if (detail.jobs !== undefined && detail.jobs.length > 0) {
|
|
1016
|
+
lines.push("", `Jobs (what went wrong in one: console plugin ${detail.key} events --kind plugin.failed):`, ...detail.jobs.map(formatPluginJobLine));
|
|
1017
|
+
}
|
|
813
1018
|
if (detail.settings.length > 0) {
|
|
814
1019
|
lines.push("", "Settings:", ...detail.settings.map((setting) => formatPluginSettingLine(setting, language)));
|
|
815
1020
|
}
|