@skillcdn/console 0.6.3 → 0.6.4

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.
Files changed (191) hide show
  1. package/README.md +6 -6
  2. package/dist/agent-page.d.ts.map +1 -1
  3. package/dist/agent-page.js +7 -3
  4. package/dist/agent-page.js.map +1 -1
  5. package/dist/api.d.ts +5 -4
  6. package/dist/api.d.ts.map +1 -1
  7. package/dist/api.js +5 -4
  8. package/dist/api.js.map +1 -1
  9. package/dist/cli/cli.d.ts.map +1 -1
  10. package/dist/cli/cli.js +660 -138
  11. package/dist/cli/cli.js.map +1 -1
  12. package/dist/cli/format.d.ts +32 -4
  13. package/dist/cli/format.d.ts.map +1 -1
  14. package/dist/cli/format.js +125 -4
  15. package/dist/cli/format.js.map +1 -1
  16. package/dist/cli/help.d.ts.map +1 -1
  17. package/dist/cli/help.js +91 -29
  18. package/dist/cli/help.js.map +1 -1
  19. package/dist/cli/pack.d.ts +11 -10
  20. package/dist/cli/pack.d.ts.map +1 -1
  21. package/dist/cli/pack.js +27 -41
  22. package/dist/cli/pack.js.map +1 -1
  23. package/dist/cli/plugin-cli.d.ts.map +1 -1
  24. package/dist/cli/plugin-cli.js +8 -5
  25. package/dist/cli/plugin-cli.js.map +1 -1
  26. package/dist/cli/runner-files.d.ts.map +1 -1
  27. package/dist/cli/runner-files.js +15 -0
  28. package/dist/cli/runner-files.js.map +1 -1
  29. package/dist/cli/skill-path.d.ts +11 -0
  30. package/dist/cli/skill-path.d.ts.map +1 -0
  31. package/dist/cli/skill-path.js +44 -0
  32. package/dist/cli/skill-path.js.map +1 -0
  33. package/dist/client.d.ts +17 -1
  34. package/dist/client.d.ts.map +1 -1
  35. package/dist/client.js +10 -1
  36. package/dist/client.js.map +1 -1
  37. package/dist/components/agent-page.d.ts +67 -5
  38. package/dist/components/agent-page.d.ts.map +1 -1
  39. package/dist/components/agent-page.js +161 -14
  40. package/dist/components/agent-page.js.map +1 -1
  41. package/dist/components/agents.d.ts +3 -4
  42. package/dist/components/agents.d.ts.map +1 -1
  43. package/dist/components/agents.js +7 -6
  44. package/dist/components/agents.js.map +1 -1
  45. package/dist/components/people.d.ts.map +1 -1
  46. package/dist/components/people.js +7 -2
  47. package/dist/components/people.js.map +1 -1
  48. package/dist/components/picker.d.ts +16 -0
  49. package/dist/components/picker.d.ts.map +1 -1
  50. package/dist/components/picker.js +69 -4
  51. package/dist/components/picker.js.map +1 -1
  52. package/dist/console.css +40 -0
  53. package/dist/console.d.ts.map +1 -1
  54. package/dist/console.js +1 -1
  55. package/dist/console.js.map +1 -1
  56. package/dist/i18n/en.d.ts +19 -5
  57. package/dist/i18n/en.d.ts.map +1 -1
  58. package/dist/i18n/en.js +26 -12
  59. package/dist/i18n/en.js.map +1 -1
  60. package/dist/i18n/ko.d.ts.map +1 -1
  61. package/dist/i18n/ko.js +22 -10
  62. package/dist/i18n/ko.js.map +1 -1
  63. package/dist/limits.d.ts +16 -0
  64. package/dist/limits.d.ts.map +1 -1
  65. package/dist/limits.js +16 -0
  66. package/dist/limits.js.map +1 -1
  67. package/dist/onboarding.d.ts +18 -6
  68. package/dist/onboarding.d.ts.map +1 -1
  69. package/dist/onboarding.js +42 -7
  70. package/dist/onboarding.js.map +1 -1
  71. package/dist/plugin/args.d.ts +24 -2
  72. package/dist/plugin/args.d.ts.map +1 -1
  73. package/dist/plugin/args.js +20 -2
  74. package/dist/plugin/args.js.map +1 -1
  75. package/dist/plugin/define.d.ts.map +1 -1
  76. package/dist/plugin/define.js +12 -3
  77. package/dist/plugin/define.js.map +1 -1
  78. package/dist/plugin/rest-schemas.d.ts +2 -0
  79. package/dist/plugin/rest-schemas.d.ts.map +1 -1
  80. package/dist/plugin/rest-schemas.js +1 -0
  81. package/dist/plugin/rest-schemas.js.map +1 -1
  82. package/dist/routes.d.ts +2 -0
  83. package/dist/routes.d.ts.map +1 -1
  84. package/dist/routes.js +2 -0
  85. package/dist/routes.js.map +1 -1
  86. package/dist/rules.d.ts +4 -1
  87. package/dist/rules.d.ts.map +1 -1
  88. package/dist/rules.js +5 -2
  89. package/dist/rules.js.map +1 -1
  90. package/dist/runner/claude.d.ts.map +1 -1
  91. package/dist/runner/claude.js +48 -0
  92. package/dist/runner/claude.js.map +1 -1
  93. package/dist/runner/codex.d.ts.map +1 -1
  94. package/dist/runner/codex.js +4 -1
  95. package/dist/runner/codex.js.map +1 -1
  96. package/dist/runner/desk.d.ts.map +1 -1
  97. package/dist/runner/desk.js +5 -4
  98. package/dist/runner/desk.js.map +1 -1
  99. package/dist/runner/runner.d.ts +16 -0
  100. package/dist/runner/runner.d.ts.map +1 -1
  101. package/dist/runner/runner.js +157 -8
  102. package/dist/runner/runner.js.map +1 -1
  103. package/dist/runner/slack.d.ts.map +1 -1
  104. package/dist/runner/slack.js +14 -3
  105. package/dist/runner/slack.js.map +1 -1
  106. package/dist/runner/types.d.ts +19 -0
  107. package/dist/runner/types.d.ts.map +1 -1
  108. package/dist/runner/types.js.map +1 -1
  109. package/dist/schemas.d.ts +475 -5
  110. package/dist/schemas.d.ts.map +1 -1
  111. package/dist/schemas.js +117 -12
  112. package/dist/schemas.js.map +1 -1
  113. package/dist/secret-file.d.ts +21 -0
  114. package/dist/secret-file.d.ts.map +1 -0
  115. package/dist/secret-file.js +59 -0
  116. package/dist/secret-file.js.map +1 -0
  117. package/dist/services.d.ts.map +1 -1
  118. package/dist/services.js +3 -2
  119. package/dist/services.js.map +1 -1
  120. package/dist/setup-guide.d.ts +2 -2
  121. package/dist/setup-guide.d.ts.map +1 -1
  122. package/dist/setup-guide.js +6 -5
  123. package/dist/setup-guide.js.map +1 -1
  124. package/dist/vocabulary.d.ts +10 -2
  125. package/dist/vocabulary.d.ts.map +1 -1
  126. package/dist/vocabulary.js +9 -2
  127. package/dist/vocabulary.js.map +1 -1
  128. package/docs/specs/cli.md +22 -16
  129. package/docs/specs/plugins.md +5 -4
  130. package/docs/specs/rest.md +24 -12
  131. package/docs/specs/runner.md +19 -12
  132. package/docs/start.md +4 -3
  133. package/package.json +3 -3
  134. package/skills/building-a-plugin/SKILL.md +2 -2
  135. package/skills/keeping-the-pack/SKILL.md +87 -0
  136. package/skills/planning-the-board/SKILL.md +6 -6
  137. package/skills/planning-the-board/references/a-task.md +1 -1
  138. package/skills/planning-the-board/references/setting-up.md +9 -5
  139. package/skills/running-an-agent/SKILL.md +15 -14
  140. package/skills/running-an-agent/references/preparing-the-machine.md +3 -2
  141. package/skills/running-an-agent/references/several-tasks.md +8 -2
  142. package/skills/running-an-agent/references/slack-app.md +10 -4
  143. package/skills/running-an-agent/references/the-account-and-the-invitation.md +1 -1
  144. package/skills/running-an-agent/references/what-was-not-seen-run-yet.md +3 -1
  145. package/skills/running-an-agent/references/when-the-agent-could-not-go-on.md +3 -3
  146. package/skills/running-an-agent/references/your-first-task.md +4 -3
  147. package/skills/working-the-board/SKILL.md +4 -4
  148. package/skills/working-the-board/references/terms.md +3 -1
  149. package/skills/working-the-board/references/the-pack.md +12 -5
  150. package/src/agent-page.tsx +19 -3
  151. package/src/api.ts +27 -0
  152. package/src/cli/cli.ts +847 -192
  153. package/src/cli/format.ts +158 -4
  154. package/src/cli/help.ts +102 -28
  155. package/src/cli/pack.ts +49 -58
  156. package/src/cli/plugin-cli.ts +8 -5
  157. package/src/cli/runner-files.ts +17 -0
  158. package/src/cli/skill-path.ts +51 -0
  159. package/src/client.ts +50 -0
  160. package/src/components/agent-page.tsx +309 -30
  161. package/src/components/agents.tsx +7 -23
  162. package/src/components/people.tsx +7 -3
  163. package/src/components/picker.tsx +79 -5
  164. package/src/console.tsx +0 -1
  165. package/src/i18n/en.ts +28 -13
  166. package/src/i18n/ko.ts +24 -10
  167. package/src/limits.ts +16 -0
  168. package/src/onboarding.ts +60 -21
  169. package/src/plugin/args.ts +29 -3
  170. package/src/plugin/define.ts +18 -3
  171. package/src/plugin/rest-schemas.ts +3 -0
  172. package/src/routes.ts +2 -0
  173. package/src/rules.ts +5 -2
  174. package/src/runner/claude.ts +53 -0
  175. package/src/runner/codex.ts +4 -1
  176. package/src/runner/desk.ts +5 -4
  177. package/src/runner/runner.ts +199 -9
  178. package/src/runner/slack.ts +18 -7
  179. package/src/runner/types.ts +16 -0
  180. package/src/schemas.ts +148 -10
  181. package/src/secret-file.ts +76 -0
  182. package/src/services.ts +3 -2
  183. package/src/setup-guide.ts +6 -5
  184. package/src/styles/README.md +1 -1
  185. package/src/styles/pages/agents.css +40 -0
  186. package/src/vocabulary.ts +12 -2
  187. package/dist/cli/command-words.d.ts +0 -20
  188. package/dist/cli/command-words.d.ts.map +0 -1
  189. package/dist/cli/command-words.js +0 -51
  190. package/dist/cli/command-words.js.map +0 -1
  191. package/src/cli/command-words.ts +0 -56
package/dist/cli/cli.js CHANGED
@@ -1,15 +1,13 @@
1
1
  import { basename, extname, isAbsolute } from "node:path";
2
2
  import { parseArgs } from "node:util";
3
3
  import { deflateSync } from "node:zlib";
4
- import { PackError, ReadMisuse, readNumber, readPack, wroteLine, } from "@skillcdn/cli";
5
- import { BROWSE_MAX_LIMIT, FIND_MAX_LIMIT, READ_FILE_MAX_LIMIT, utf8Length, } from "@skillcdn/core";
6
4
  import { avatarScanlines, MAX_AVATAR_PIXELS, pngFile } from "../avatar.js";
7
5
  import { ApiError, createClient, } from "../client.js";
8
6
  import { CLIENT_RANGE_HEADER, CONSOLE_AT_LEAST, consoleRange, formatRange, judgeClient, judgeConsole, parseVersion, VERSION_HEADER, formatVersion as versionText, } from "../compat.js";
9
7
  import { normalizeConnectCode } from "../connect.js";
10
8
  import { addDays, dayOf as dayOfDate, firstDayOfWeek, isDay, weekOf } from "../dates.js";
11
9
  import { ICON_NAMES, isIconName } from "../icons/index.js";
12
- import { DEFAULT_PAGE_LIMIT, EVENTS_PAGE_LIMIT, LIST_LIMIT, MAX_DECIDERS, MAX_OPTIONS, MAX_OWN_WAKE_DAYS, MAX_RUNNER_LINE_LENGTH, MAX_SIGNALS_PAGE_LIMIT, MIN_OPTIONS, OWN_WAKE_KEY, } from "../limits.js";
10
+ import { DEFAULT_PAGE_LIMIT, EVENTS_PAGE_LIMIT, LIST_LIMIT, MAX_DECIDERS, MAX_OPTION_LABEL_LENGTH, MAX_OPTIONS, MAX_OWN_WAKE_DAYS, MAX_PACK_NOTE_LENGTH, MAX_PACK_NOTE_OUTCOME_LENGTH, MAX_PACK_NOTES_PAGE_LIMIT, MAX_QUESTION_LENGTH, MAX_RUNNER_LINE_LENGTH, MAX_SIGNALS_PAGE_LIMIT, MIN_OPTIONS, OWN_WAKE_KEY, PACK_NOTES_PAGE_LIMIT, } from "../limits.js";
13
11
  import { MAX_NOTIFICATIONS_PAGE, NOTIFICATION_KINDS, NOTIFICATIONS_PAGE, } from "../notifications.js";
14
12
  import { onboardingTitle } from "../onboarding.js";
15
13
  import { capabilityWords } from "../plugin/capabilities.js";
@@ -23,23 +21,23 @@ import { DESK_FOLDER, deskFiles, deskServicesOf, deskWebTitleOf, personDeskFiles
23
21
  import { quotedLines } from "../runner/message.js";
24
22
  import { ownRunnerModules } from "../runner/modules.js";
25
23
  import { createRunner, GIT_TOKEN_SECRET } from "../runner/runner.js";
26
- import { hostOfLogin, } from "../schemas.js";
24
+ import { hostOfLogin, isPackNotePath, } from "../schemas.js";
25
+ import { secretOfText } from "../secret-file.js";
27
26
  import { agentLoginOf, deskRemoteOf } from "../services.js";
28
27
  import { setupGuideOf, setupGuideText, setupSentenceOf } from "../setup-guide.js";
29
28
  import { COLOR_NAMES, CONSOLE_LANGUAGES, GOAL_STATES, PEOPLE_VISIBILITIES, PERSON_ROLES, PROJECT_ROLES, PROJECT_VISIBILITIES, PROVIDER_KEYS, SERVICE_ROLES, TASK_PRIORITIES, TASK_STATES, WEEK_STARTS, } from "../vocabulary.js";
30
29
  import { loadWebRoot, WebRootError } from "../web.js";
31
- import { commandLine, commandWord, NO_LINE_TO_RUN } from "./command-words.js";
32
30
  import { CredentialsError, EMPTY_CREDENTIALS, fitsFile, keepsNothing, lasts, loginsAt, pendingAt, resolveLogin, withLogin, withoutLogin, withoutPending, withPending, } from "./credentials.js";
33
31
  import { DIRECTORY_FILE, THE_SENTENCE, } from "./directory.js";
34
- import { calledOf, deciderLogins, formatAgent, formatAgentLine, formatAnswer, formatCategoryLine, formatComment, formatDecision, formatDecisionLine, formatDocument, formatDocuments, formatGoal, formatGoalLine, formatInvocation, formatListingLine, formatMemberLine, formatMore, formatNotificationSettings, formatNotifications, formatOptions, formatOwnWakeLine, formatPersonLine, formatPersonWork, formatPlugin, formatPluginAsks, formatPluginEvents, formatPluginGrantLine, formatPluginHelp, formatPluginRecord, formatPluginRecords, formatPluginRecordVersions, formatPluginSettingLine, formatPlugins, formatProject, formatProjectLine, formatRules, formatRulesChanged, formatRulesLeftOut, formatRun, formatRunLine, formatSecretLine, formatSecretOffer, formatSignalLine, formatTask, formatTaskFollow, formatTaskLine, formatTeamLine, formatVersion, formatVersionLine, formatWork, formatWorkspace, localized, moment, pageLine, rulesMark, setMomentZone, } from "./format.js";
32
+ import { calledOf, deciderLogins, formatAgent, formatAgentLine, formatAnswer, formatCategoryLine, formatComment, formatDecision, formatDecisionLine, formatDocument, formatDocuments, formatGoal, formatGoalLine, formatInvocation, formatListingLine, formatMemberLine, formatMore, formatNotificationSettings, formatNotifications, formatOptions, formatOwnWakeLine, formatPackNoteClosed, formatPackNoteLeft, formatPackNotes, formatPersonLine, formatPersonWork, formatPlugin, formatPluginAsks, formatPluginEvents, formatPluginGrantLine, formatPluginHelp, formatPluginRecord, formatPluginRecords, formatPluginRecordVersions, formatPluginSettingLine, formatPlugins, formatProject, formatProjectLine, formatRules, formatRulesChanged, formatRulesLeftOut, formatRun, formatRunLine, formatSecretLine, formatSecretOffer, formatSignalLine, formatTask, formatTaskFollow, formatTaskLine, formatTeamLine, formatVersion, formatVersionLine, formatWork, formatWorkspace, localized, moment, pageLine, rulesMark, setMomentZone, } from "./format.js";
35
33
  import { COMMAND_ALIASES, formTyped, held, helpFor, nearestCommands, ownSkillPath, usage, } from "./help.js";
36
34
  import { describeInstall, updateCommandFor } from "./install.js";
37
35
  import { awakeWords, heldAwake, lookAtMachine, standsInTheWay, } from "./machine-check.js";
38
- import { consolePack, formatSkills, holdsNothing, ORGANIZATION_PACK_LINE, PackRefusal, packWords, refusalWords, skillPathIn, skillsAround, } from "./pack.js";
39
36
  import { keptBySourceOf, keptFileOf, runnerStateOf } from "./runner-files.js";
40
37
  import { workPath } from "./runner-host.js";
41
38
  import { secretNotes } from "./secret-notes.js";
42
39
  import { createServeHandler, DEFAULT_SERVE_PORT, loadRecordsRoot, RecordsRootError, } from "./serve.js";
40
+ import { skillPathIn } from "./skill-path.js";
43
41
  // The `console` command (docs/specs/cli.md): the agent's side of the console. A thin client of
44
42
  // the REST API with no logic of its own: every command is one or two requests and the words to
45
43
  // say what came back. It takes what it needs from `CliIo`, so that tests run it whole, against
@@ -105,12 +103,36 @@ function parse(args, options, allowPositionals = true) {
105
103
  options: { ...GLOBAL_OPTIONS, ...options },
106
104
  allowPositionals,
107
105
  strict: true,
106
+ // The words in the order they were typed, for a search, whose words are every bare word.
107
+ tokens: true,
108
108
  });
109
109
  }
110
110
  catch (error) {
111
111
  throw misuse(refusedByParser(error, options));
112
112
  }
113
113
  }
114
+ /**
115
+ * The words of a search as they were typed (ADR-0179): what `--search` was given and every
116
+ * bare word, in their order, as the skillcdn command takes every word after `find` as the
117
+ * query. So `--search card news` asks for two words, where the second was once read as a
118
+ * folder and the search, of one word in a folder nobody named, found nothing. Nothing where no
119
+ * `--search` was typed: a bare word is then the command's own to read.
120
+ */
121
+ function searchTyped(parsed) {
122
+ if (typeof parsed.values.search !== "string") {
123
+ return undefined;
124
+ }
125
+ const typed = [];
126
+ for (const token of parsed.tokens) {
127
+ if (token.kind === "positional") {
128
+ typed.push(token.value);
129
+ }
130
+ else if (token.kind === "option" && token.name === "search" && token.value !== undefined) {
131
+ typed.push(token.value);
132
+ }
133
+ }
134
+ return typed.join(" ").trim();
135
+ }
114
136
  /**
115
137
  * What the parser refused, in the command's own words (ADR-0167): an option that is none of
116
138
  * the command's is answered with those it takes, so that the next try needs no page of help;
@@ -1113,9 +1135,14 @@ const projects = async (args, io) => {
1113
1135
  const { values } = parse(args, {}, false);
1114
1136
  const session = await open(io, values);
1115
1137
  const found = await session.client.projects();
1116
- answer(io, session, found, () => found.items.length === 0
1117
- ? 'No projects you may work in. Make one: console project new <key> "<name>"'
1118
- : found.items.map(formatProjectLine).join("\n"));
1138
+ // In none: an administrator makes one, and anyone else is listed in one by an administrator.
1139
+ // Asked only then, so that a listing costs no request more.
1140
+ const none = found.items.length === 0
1141
+ ? (await session.client.me()).person?.role === "admin"
1142
+ ? 'No projects you may work in. Make one: console project new <key> "<name>"'
1143
+ : "No projects you may work in. An administrator lists you in one, or opens one to the workspace, which has everyone in it."
1144
+ : undefined;
1145
+ answer(io, session, found, () => none ?? found.items.map(formatProjectLine).join("\n"));
1119
1146
  return EXIT.ok;
1120
1147
  };
1121
1148
  const use = async (args, io) => {
@@ -1162,8 +1189,23 @@ async function endOfWeek(io, session, today) {
1162
1189
  const language = me.language ?? io.locale ?? me.workspace.language ?? "en";
1163
1190
  return weekOf(today, firstDayOfWeek(language, me.workspace.weekStart ?? "auto")).at(-1) ?? today;
1164
1191
  }
1192
+ /**
1193
+ * The words a listing is searched by (ADR-0179): what `--search` was given and every bare word,
1194
+ * in the order typed, for a listing that takes no word of its own. A bare word without
1195
+ * `--search` is not understood, and the answer says where the words of a search go.
1196
+ */
1197
+ function listingSearch(parsed, command) {
1198
+ const search = searchTyped(parsed);
1199
+ if (search === undefined && parsed.positionals.length > 0) {
1200
+ throw misuse(`This command takes no word beside its options: ${parsed.positionals[0]}. The words of a search go after --search: ${command} --search "<words>"`);
1201
+ }
1202
+ if (search === "") {
1203
+ throw misuse(`Say what to search for: ${command} --search "<words>"`);
1204
+ }
1205
+ return search;
1206
+ }
1165
1207
  const tasks = async (args, io) => {
1166
- const { values } = parse(args, {
1208
+ const parsed = parse(args, {
1167
1209
  state: { type: "string" },
1168
1210
  open: { type: "boolean" },
1169
1211
  mine: { type: "boolean" },
@@ -1174,7 +1216,10 @@ const tasks = async (args, io) => {
1174
1216
  search: { type: "string" },
1175
1217
  archived: { type: "boolean" },
1176
1218
  ...PAGE_OPTIONS,
1177
- }, false);
1219
+ });
1220
+ const { values } = parsed;
1221
+ // Every bare word is of the search where --search was typed, and no word goes without it.
1222
+ const search = listingSearch(parsed, "console tasks");
1178
1223
  const state = stateOf(text(values, "state"));
1179
1224
  if (on(values, "mine") && on(values, "unassigned")) {
1180
1225
  throw misuse("Say one: --mine for the tasks you work on, or --unassigned for those nobody works on");
@@ -1193,10 +1238,6 @@ const tasks = async (args, io) => {
1193
1238
  ? await endOfWeek(io, session, today)
1194
1239
  : (dayOf(io, due) ?? undefined);
1195
1240
  const worker = on(values, "mine") ? ((await personIdOf(session, "me")) ?? undefined) : undefined;
1196
- const search = text(values, "search")?.trim();
1197
- if (search === "") {
1198
- throw misuse("Say what to search for: console tasks --search <words>");
1199
- }
1200
1241
  const filter = {
1201
1242
  ...(state === undefined ? {} : { state }),
1202
1243
  ...(on(values, "open") || due === "overdue" ? { open: true } : {}),
@@ -1248,13 +1289,31 @@ const categories = async (args, io) => {
1248
1289
  answer(io, session, found, () => found.items.length === 0 ? "No categories." : found.items.map(formatCategoryLine).join("\n"));
1249
1290
  return EXIT.ok;
1250
1291
  };
1292
+ const packReads = () => import("./pack.js");
1293
+ /**
1294
+ * The reads of a pack where only a word is to be spelled, after an act that is done: nothing
1295
+ * where the library does not load, so that what was done is said all the same and the words
1296
+ * are named in a sentence, never a line, as where a word has no spelling every shell takes.
1297
+ */
1298
+ async function packReadsAfter() {
1299
+ try {
1300
+ return await packReads();
1301
+ }
1302
+ catch {
1303
+ return undefined;
1304
+ }
1305
+ }
1306
+ /** The flags `whereGiven` names, said in words: `--project and --url`. */
1307
+ const flagNamesOf = (given) => given.filter((_, index) => index % 2 === 0).join(" and ");
1251
1308
  const SKILLS_OPTIONS = {
1252
1309
  search: { type: "string" },
1253
1310
  path: { type: "string" },
1311
+ full: { type: "boolean" },
1254
1312
  limit: { type: "string" },
1255
1313
  cursor: { type: "string" },
1256
1314
  rows: { type: "boolean" },
1257
1315
  code: { type: "boolean" },
1316
+ kinds: { type: "boolean" },
1258
1317
  heading: { type: "string" },
1259
1318
  format: { type: "string" },
1260
1319
  grep: { type: "string" },
@@ -1266,11 +1325,11 @@ const SKILLS_OPTIONS = {
1266
1325
  * printed as if it were the read. `--json` still prints what the console answered, which says
1267
1326
  * the status. Thrown by the caller, so that nothing follows it.
1268
1327
  */
1269
- function refusedRead(io, session, owner, answered, words) {
1328
+ function refusedRead(reads, io, session, owner, answered, words) {
1270
1329
  if (session.json) {
1271
1330
  io.stdout(`${JSON.stringify(answered, null, 2)}\n`);
1272
1331
  }
1273
- return failed(owner === "organization" ? `${ORGANIZATION_PACK_LINE}\n${words}` : words);
1332
+ return failed(owner === "organization" ? `${reads.ORGANIZATION_PACK_LINE}\n${words}` : words);
1274
1333
  }
1275
1334
  /** A whole number a flag carries, within its bounds; nothing when it is not given. */
1276
1335
  function countOf(given, name, bounds) {
@@ -1289,12 +1348,12 @@ function countOf(given, name, bounds) {
1289
1348
  * A number a read of a pack takes, checked as the skillcdn command checks it and said in its
1290
1349
  * words, before anything is asked of the console.
1291
1350
  */
1292
- function checkedNumber(given, name, most) {
1351
+ function checkedNumber(reads, given, name, most) {
1293
1352
  try {
1294
- readNumber(given, name, most);
1353
+ reads.readNumber(given, name, most);
1295
1354
  }
1296
1355
  catch (error) {
1297
- throw error instanceof ReadMisuse ? misuse(error.message) : error;
1356
+ throw error instanceof reads.ReadMisuse ? misuse(error.message) : error;
1298
1357
  }
1299
1358
  }
1300
1359
  /**
@@ -1317,23 +1376,25 @@ function whereGiven(values) {
1317
1376
  * lines the command prints of its own around the text, which the read keeps room for, so that
1318
1377
  * the whole output is one a host shows whole.
1319
1378
  */
1320
- async function readThrough(io, session, owner, pack, read, options) {
1379
+ async function readThrough(reads, io, session, owner, pack, read, options) {
1321
1380
  try {
1322
- return await readPack(pack, read, {
1381
+ return await reads.readPack(pack, read, {
1323
1382
  words: options.words,
1324
1383
  json: session.json,
1325
1384
  nextPart: options.nextPart,
1326
1385
  browseFolder: options.browseFolder,
1327
- room: roomFor(owner, options.beside ?? []),
1386
+ readFile: options.readFile,
1387
+ loadFound: options.loadFound,
1388
+ room: roomFor(reads, owner, options.beside ?? []),
1328
1389
  });
1329
1390
  }
1330
1391
  catch (error) {
1331
- if (error instanceof ReadMisuse) {
1392
+ if (error instanceof reads.ReadMisuse) {
1332
1393
  throw misuse(error.message);
1333
1394
  }
1334
- const refusal = error instanceof PackRefusal
1335
- ? { answer: error.answer, words: refusalWords(error.what, error.answer, owner) }
1336
- : error instanceof PackError
1395
+ const refusal = error instanceof reads.PackRefusal
1396
+ ? { answer: error.answer, words: reads.refusalWords(error.what, error.answer, owner) }
1397
+ : error instanceof reads.PackError
1337
1398
  ? { answer: pack.answered(), words: `${error.code}: ${error.message}` }
1338
1399
  : undefined;
1339
1400
  if (refusal === undefined) {
@@ -1341,7 +1402,7 @@ async function readThrough(io, session, owner, pack, read, options) {
1341
1402
  }
1342
1403
  throw options.data === true || refusal.answer === undefined
1343
1404
  ? failed(refusal.words)
1344
- : refusedRead(io, session, owner, refusal.answer, refusal.words);
1405
+ : refusedRead(reads, io, session, owner, refusal.answer, refusal.words);
1345
1406
  }
1346
1407
  }
1347
1408
  /**
@@ -1349,9 +1410,9 @@ async function readThrough(io, session, owner, pack, read, options) {
1349
1410
  * its own with the break that sets it apart, and the line that says the pack is the
1350
1411
  * organization's where it is.
1351
1412
  */
1352
- function roomFor(owner, beside) {
1353
- const lines = [owner === "organization" ? ORGANIZATION_PACK_LINE : undefined, ...beside];
1354
- return lines.reduce((bytes, line) => (line === undefined ? bytes : bytes + utf8Length(line) + 1), 0);
1413
+ function roomFor(reads, owner, beside) {
1414
+ const lines = [owner === "organization" ? reads.ORGANIZATION_PACK_LINE : undefined, ...beside];
1415
+ return lines.reduce((bytes, line) => (line === undefined ? bytes : bytes + reads.utf8Length(line) + 1), 0);
1355
1416
  }
1356
1417
  /**
1357
1418
  * What `--json` prints for a read: the console's answer, with the pack's own in it as the
@@ -1366,14 +1427,14 @@ function jsonOfRead(session, pack, output) {
1366
1427
  * the blocks as written, or written to a file with `--out`. What a program takes is never a
1367
1428
  * refusal: a read the pack refused fails with why.
1368
1429
  */
1369
- async function readData(io, session, pack, asked) {
1430
+ async function readData(reads, io, session, pack, asked) {
1370
1431
  const { read } = asked;
1371
- const output = await readThrough(io, session, asked.owner, pack, read, {
1432
+ const output = await readThrough(reads, io, session, asked.owner, pack, read, {
1372
1433
  words: asked.words,
1373
1434
  data: true,
1374
1435
  });
1375
1436
  // Nothing is printed for nothing, which a program takes as it is; a line beside it says so.
1376
- if (holdsNothing(output.holds) && asked.out === undefined && !session.json) {
1437
+ if (reads.holdsNothing(output.holds) && asked.out === undefined && !session.json) {
1377
1438
  io.stderr(`No ${read.read === "rows" ? "tables" : "code blocks"} in ${read.path ?? "the pack"}${read.heading === undefined ? "" : " under that heading"}.\n`);
1378
1439
  }
1379
1440
  const made = session.json
@@ -1392,7 +1453,7 @@ async function readData(io, session, pack, asked) {
1392
1453
  catch {
1393
1454
  throw failed(`The file could not be written at ${asked.out}.`);
1394
1455
  }
1395
- io.stdout(`${wroteLine(output.holds ?? "", saved)}\n`);
1456
+ io.stdout(`${reads.wroteLine(output.holds ?? "", saved)}\n`);
1396
1457
  return EXIT.ok;
1397
1458
  }
1398
1459
  const SKILL_OPTIONS = {
@@ -1404,36 +1465,68 @@ const SKILL_OPTIONS = {
1404
1465
  /** The line `console skills` ends with: where the plugins' own skills are. */
1405
1466
  const PLUGIN_SKILLS_LINE = "The plugins of this console have skills of their own: console plugins lists the plugins, console plugin <key> skills the skills of one.";
1406
1467
  /**
1407
- * The pack as the words say: whole, a page of a folder or of a file's outline, or what words
1408
- * find; for the project's pack as `console skills`, and for a plugin's as
1409
- * `console plugin <key> skills`. Each as the skillcdn command reads it, through its own reads
1410
- * (ADR-0124).
1468
+ * What stands in place of the line that reads on from a cursor where a word of it has no
1469
+ * spelling every shell takes: the cursor, and what to give it to. Its reader ran the command,
1470
+ * so it has the other words.
1471
+ */
1472
+ const readOnWithoutLine = (reads, cursor) => `the command you ran, with --cursor ${reads.commandLine("", [cursor])?.trim() ?? JSON.stringify(cursor)} in place of any it had, each word quoted for your shell. ${reads.NO_LINE_TO_RUN}`;
1473
+ /** A folder or a file of a pack as it was typed, without the slashes it may end with: `design/` is `design`, and `/` the root. */
1474
+ const folderOf = (typed) => typed?.replace(/\/+$/, "");
1475
+ /**
1476
+ * The pack as the words say: whole, its kinds of work, a page of a folder or of a file's
1477
+ * outline, or what words find; for the project's pack as `console skills`, and for a plugin's
1478
+ * as `console plugin <key> skills`. Each as the skillcdn command reads it, through its own reads
1479
+ * (ADR-0124), and asked for by that command's own arguments after the flag that names the read
1480
+ * (ADR-0179): with `--search`, every bare word is of the query and a folder is `--path`.
1411
1481
  */
1412
- async function readSkills(io, session, reader, values, positionals, extras) {
1482
+ async function readSkills(io, session, reader, parsed, extras) {
1483
+ const { values, positionals } = parsed;
1484
+ const reads = await packReads();
1413
1485
  const owner = extras.owner ?? "project";
1414
- const say = (value, words) => answerPack(io, session, owner, value, words);
1486
+ const again = extras.again ?? [];
1487
+ const say = (value, words) => answerPack(reads, io, session, owner, value, words);
1415
1488
  // The reads by the names of this pack's own commands: a plugin's are not the project's.
1416
1489
  const skillCommand = extras.command.replace(/skills$/, "skill");
1417
- const toolWords = packWords(extras.command, skillCommand);
1418
- // How a skill is loaded, said after a listing and after what a search found: the pack's own
1419
- // words there name how a section is read, and a skill read as a file comes without its rules.
1490
+ const toolWords = reads.packWords(extras.command, skillCommand);
1491
+ // How a skill is loaded, said after a listing: the pack's own words there name how a section
1492
+ // is read, and a skill read as a file comes without its rules. A search says its next step
1493
+ // itself, once (`loadFound`).
1420
1494
  const loading = `A skill is loaded, its rules first, with ${skillCommand} <the path of its SKILL.md>, a long one in parts; --file reads a file of the pack as it is, without the rules.`;
1421
- if (positionals.length > 1) {
1422
- throw misuse(`Say one folder: ${extras.command} [<folder>] [--search <words>]`);
1423
- }
1424
- // The root of the pack is the mounted folder, which the deployment reads as no path at all.
1425
- const given = positionals[0];
1426
- const words = text(values, "search");
1427
- const within = text(values, "path");
1495
+ const words = searchTyped(parsed);
1496
+ // A folder is taken as the pack prints it, `design/`, and as it is named, `design`, as a
1497
+ // folder of the documents is: the deployment refuses a path that ends with a slash.
1498
+ const within = folderOf(text(values, "path"));
1499
+ const full = on(values, "full");
1428
1500
  const limit = text(values, "limit");
1429
1501
  const cursor = text(values, "cursor");
1430
1502
  const rows = on(values, "rows");
1431
1503
  const code = on(values, "code");
1504
+ const kinds = on(values, "kinds");
1432
1505
  const heading = text(values, "heading");
1433
1506
  const out = text(values, "out");
1434
1507
  const format = text(values, "format");
1435
1508
  const grep = text(values, "grep");
1509
+ const searchUsage = `${extras.command} --search "<words>" [--path <folder>] [--full] [--limit <n>]`;
1510
+ // With --search every bare word is of the query; without it, the one bare word is a folder
1511
+ // or a file of the pack.
1512
+ if (words === undefined && positionals.length > 1) {
1513
+ throw misuse(`Say one folder, or the words of a search after --search: ${extras.command} [<folder>], or ${searchUsage}`);
1514
+ }
1515
+ if (words !== undefined && words.length === 0) {
1516
+ throw misuse(`Say what to search for: ${searchUsage}`);
1517
+ }
1518
+ // The root of the pack is the mounted folder, which the deployment reads as no path at all.
1519
+ const given = words === undefined ? folderOf(positionals[0]) : undefined;
1436
1520
  const dataUsage = `${extras.command} --rows|--code [<folder|file>] [--heading <words>] [--out <path>]`;
1521
+ // The kinds of work are of the pack whole, and are said in a few lines: nothing narrows them.
1522
+ if (kinds &&
1523
+ (given !== undefined ||
1524
+ rows ||
1525
+ code ||
1526
+ full ||
1527
+ [words, within, limit, cursor, heading, out, format, grep].some((one) => one !== undefined))) {
1528
+ throw misuse(`--kinds goes alone: ${extras.command} --kinds`);
1529
+ }
1437
1530
  if (rows && code) {
1438
1531
  throw misuse(`Say one: --rows for the tables, or --code for the code blocks: ${dataUsage}`);
1439
1532
  }
@@ -1450,35 +1543,35 @@ async function readSkills(io, session, reader, values, positionals, extras) {
1450
1543
  if (grep !== undefined && !code) {
1451
1544
  throw misuse(`--grep goes with --code: ${extras.command} --code [<folder|file>] [--grep <pattern>]`);
1452
1545
  }
1453
- // The folder a search keeps to is said once: after the words, or with --path as the
1454
- // skillcdn command takes it.
1546
+ // The folder a search keeps to is said with --path, as the skillcdn command takes it, and
1547
+ // everything a search prints of a result with --full.
1455
1548
  if (within !== undefined && words === undefined) {
1456
- throw misuse(`--path goes with --search; a folder is read with ${extras.command} <folder>: ${extras.command} --search <words> [--path <folder>]`);
1549
+ throw misuse(`--path goes with --search; a folder is read with ${extras.command} <folder>: ${searchUsage}`);
1457
1550
  }
1458
- if (within !== undefined && given !== undefined) {
1459
- throw misuse(`Say the folder once: after the words, or with --path: ${extras.command} --search <words> [<folder>]`);
1551
+ if (full && words === undefined) {
1552
+ throw misuse(`--full goes with --search: ${searchUsage}`);
1460
1553
  }
1461
1554
  const named = given ?? within;
1462
- const folder = named === undefined || named === "/" || named === "." ? undefined : named;
1555
+ const folder = named === undefined || named === "" || named === "." ? undefined : named;
1463
1556
  // The listing is as long as one read prints, and goes on from the cursor its page ended with.
1464
1557
  if (words === undefined && given === undefined && limit !== undefined) {
1465
1558
  throw misuse(`--limit goes with a folder or with --search: ${extras.command} <folder> [--limit <n>] [--cursor <cursor>]`);
1466
1559
  }
1467
1560
  // A page of what words find, or of what a folder holds: the bounds of each, as the pack has them.
1468
- checkedNumber(limit, "limit", words === undefined ? BROWSE_MAX_LIMIT : FIND_MAX_LIMIT);
1561
+ checkedNumber(reads, limit, "limit", words === undefined ? reads.BROWSE_MAX_LIMIT : reads.FIND_MAX_LIMIT);
1469
1562
  const listing = await reader.skills();
1470
1563
  // With --json the console's own addresses stay in a document's outline; in words, the
1471
1564
  // commands that read its tables and its code blocks.
1472
- const pack = consolePack(reader, listing, {
1565
+ const pack = reads.consolePack(reader, listing, {
1473
1566
  url: session.url,
1474
1567
  dataCommand: session.json ? undefined : extras.command,
1475
1568
  });
1476
1569
  // As data: a read the pack refused fails with why, and nothing is printed.
1477
1570
  if (rows || code) {
1478
1571
  if (pack === undefined) {
1479
- throw failed(refusalWords(rows ? "tables" : "code blocks", listing, owner));
1572
+ throw failed(reads.refusalWords(rows ? "tables" : "code blocks", listing, owner));
1480
1573
  }
1481
- return readData(io, session, pack, {
1574
+ return readData(reads, io, session, pack, {
1482
1575
  read: rows
1483
1576
  ? { read: "rows", path: folder, heading, format }
1484
1577
  : { read: "code", path: folder, heading, grep },
@@ -1489,10 +1582,34 @@ async function readSkills(io, session, reader, values, positionals, extras) {
1489
1582
  }
1490
1583
  // A pack that does not answer: said as that, which a folder or a search would meet too.
1491
1584
  if (pack === undefined) {
1492
- throw refusedRead(io, session, owner, listing, [formatSkills(listing, undefined, extras.own, owner, toolWords), extras.afterwards]
1585
+ throw refusedRead(reads, io, session, owner, listing, [reads.formatSkills(listing, undefined, extras.own, owner, toolWords), extras.afterwards]
1493
1586
  .filter((part) => part !== undefined)
1494
1587
  .join("\n"));
1495
1588
  }
1589
+ // A file of the pack is named by the line that reads it, whole, asked as this read was
1590
+ // (SkillCDN 0.6.4): the page a pack says to start from, an overview, the manifest.
1591
+ const readFile = (path) => reads.commandLine(skillCommand, ["--file", path, ...again]) ??
1592
+ `${skillCommand} --file with this file's path, quoted for your shell. ${reads.NO_LINE_TO_RUN}`;
1593
+ if (kinds) {
1594
+ // The kinds of work the pack has skills for (ADR-0176), as the skillcdn command reads them
1595
+ // (ADR-0179): its lines, its bound and its closing sentence, in the words of this pack's
1596
+ // commands, made of the one answer the console already has. Read once in a conversation.
1597
+ // --json is the kinds as that command prints them as data. The search and the load it
1598
+ // names are asked where this read was: without --project a desk reads the organization's
1599
+ // pack, which may be another than the one these kinds are of.
1600
+ const where = again.length === 0 ? "" : reads.commandLine("", again);
1601
+ const told = await readThrough(reads, io, session, owner, pack, { read: "kinds" }, {
1602
+ words: where === undefined
1603
+ ? {
1604
+ ...toolWords,
1605
+ search: `${extras.command} --search, asked with ${flagNamesOf(again)} as this read was and quoted for your shell,`,
1606
+ load: `${skillCommand}, asked so too,`,
1607
+ }
1608
+ : reads.packWords(`${extras.command}${where}`, `${skillCommand}${where}`),
1609
+ });
1610
+ say(session.json ? JSON.parse(told.text) : undefined, () => told.text);
1611
+ return EXIT.ok;
1612
+ }
1496
1613
  if (words === undefined && given === undefined) {
1497
1614
  // --json is the console's listing as it answered it, whole; the words are the pack's own,
1498
1615
  // read once more from that answer, a listing longer than one read prints in pages.
@@ -1502,18 +1619,19 @@ async function readSkills(io, session, reader, values, positionals, extras) {
1502
1619
  }
1503
1620
  // The console's own lines stand around the first page, and the read keeps room for them
1504
1621
  // and for the empty lines that set them apart.
1505
- const around = skillsAround(listing, extras.own, toolWords);
1622
+ const around = reads.skillsAround(listing, extras.own, toolWords);
1506
1623
  const own = [
1507
1624
  ...around.host,
1508
1625
  ...around.own,
1509
1626
  loading,
1510
1627
  ...(extras.afterwards === undefined ? [] : [extras.afterwards]),
1511
1628
  ];
1512
- const told = await readThrough(io, session, owner, pack, { read: "skills", cursor }, {
1629
+ const told = await readThrough(reads, io, session, owner, pack, { read: "skills", cursor }, {
1513
1630
  words: toolWords,
1514
1631
  beside: cursor === undefined ? [around.head, ...own, "", "", ""] : [],
1515
- nextPart: (next) => commandLine(extras.command, ["--cursor", next, ...(extras.again ?? [])]) ??
1516
- `${extras.command} with --cursor ${commandWord(next) ?? JSON.stringify(next)}, each word quoted for your shell. ${NO_LINE_TO_RUN}`,
1632
+ readFile,
1633
+ nextPart: (next) => reads.commandLine(extras.command, ["--cursor", next, ...again]) ??
1634
+ `${extras.command} with --cursor ${reads.commandLine("", [next])?.trim() ?? JSON.stringify(next)}, each word quoted for your shell. ${reads.NO_LINE_TO_RUN}`,
1517
1635
  });
1518
1636
  say(listing, () => {
1519
1637
  // A page read from a cursor is the pack's own words alone: what stands around the
@@ -1526,7 +1644,7 @@ async function readSkills(io, session, reader, values, positionals, extras) {
1526
1644
  // lines stand above the listing then, and after it where it is whole.
1527
1645
  return told.next === undefined
1528
1646
  ? [
1529
- formatSkills(listing, told.text, extras.own, owner, toolWords),
1647
+ reads.formatSkills(listing, told.text, extras.own, owner, toolWords),
1530
1648
  loading,
1531
1649
  ...(extras.afterwards === undefined ? [] : [extras.afterwards]),
1532
1650
  ].join("\n")
@@ -1536,34 +1654,44 @@ async function readSkills(io, session, reader, values, positionals, extras) {
1536
1654
  }
1537
1655
  // The command that reads the next page of a folder or of a search (SkillCDN 0.6.3): this
1538
1656
  // one again, asked as it was, with the cursor the page ended on. Where a word of it has no
1539
- // spelling both shells take, the command that was run is run again, and the line says why.
1540
- const nextPage = (asked) => (next) => commandLine(extras.command, [
1657
+ // spelling every shell takes, the command that was run is run again, and the line says why.
1658
+ const nextPage = (asked) => (next) => reads.commandLine(extras.command, [
1541
1659
  ...asked,
1542
1660
  ...(limit === undefined ? [] : ["--limit", limit]),
1661
+ ...(full ? ["--full"] : []),
1543
1662
  "--cursor",
1544
1663
  next,
1545
- ...(extras.again ?? []),
1546
- ]) ??
1547
- `the command you ran, with --cursor ${commandWord(next) ?? JSON.stringify(next)} in place of any it had, each word quoted for your shell. ${NO_LINE_TO_RUN}`;
1664
+ ...again,
1665
+ ]) ?? readOnWithoutLine(reads, next);
1548
1666
  if (words !== undefined) {
1549
- // One page of what the words find, which ends with the command that reads the next where
1550
- // more was found. How a skill is loaded stands above it then, so that the command is last.
1551
- const found = await readThrough(io, session, owner, pack, { read: "find", words, path: folder, cursor, limit }, {
1667
+ // One page of what the words find, as the skillcdn command prints it (ADR-0179): each
1668
+ // result with what choosing needs and how it matches, and, where a skill was found, the
1669
+ // next step once, the command that loads it, asked as this search was. A page that ends
1670
+ // before the results do ends with the command that reads the next: the words as one word
1671
+ // of the line, which every version of the command reads as the query, the folder as --path.
1672
+ const where = reads.commandLine("", again);
1673
+ const found = await readThrough(reads, io, session, owner, pack, { read: "find", words, path: folder, cursor, limit, full }, {
1552
1674
  words: toolWords,
1553
- beside: [loading],
1675
+ readFile,
1676
+ loadFound: where === undefined
1677
+ ? `${skillCommand} with its path and where this pack is read, each quoted for your shell. ${reads.NO_LINE_TO_RUN}`
1678
+ : `${skillCommand} <its path>${where}`,
1554
1679
  nextPart: nextPage([
1555
1680
  "--search",
1556
1681
  words,
1557
- ...(given === undefined ? [] : [given]),
1558
- ...(within === undefined ? [] : ["--path", within]),
1682
+ ...(folder === undefined ? [] : ["--path", folder]),
1559
1683
  ]),
1560
1684
  });
1561
- say(jsonOfRead(session, pack, found), () => found.next === undefined ? `${found.text}\n${loading}` : `${loading}\n${found.text}`);
1685
+ say(jsonOfRead(session, pack, found), () => found.text);
1562
1686
  return EXIT.ok;
1563
1687
  }
1564
1688
  // One page of the folder, or of a file's outline, as the skillcdn command browses: a page
1565
1689
  // that ends before the folder does ends with the command that reads the next.
1566
- const browsed = await readThrough(io, session, owner, pack, { read: "browse", path: folder, cursor, limit }, { words: toolWords, nextPart: nextPage(given === undefined ? [] : [given]) });
1690
+ const browsed = await readThrough(reads, io, session, owner, pack, { read: "browse", path: folder, cursor, limit }, {
1691
+ words: toolWords,
1692
+ readFile,
1693
+ nextPart: nextPage(folder === undefined ? [] : [folder]),
1694
+ });
1567
1695
  say(jsonOfRead(session, pack, browsed), () => browsed.text);
1568
1696
  return EXIT.ok;
1569
1697
  }
@@ -1581,14 +1709,124 @@ async function packNamed(session) {
1581
1709
  * Prints a read of a pack: as `answer` does, and, where the pack is the organization's, under
1582
1710
  * the line that says so. `--json` stays what the console answered.
1583
1711
  */
1584
- function answerPack(io, session, owner, value, words) {
1585
- answer(io, session, value, () => owner === "organization" ? `${ORGANIZATION_PACK_LINE}\n${words()}` : words());
1712
+ function answerPack(reads, io, session, owner, value, words) {
1713
+ answer(io, session, value, () => owner === "organization" ? `${reads.ORGANIZATION_PACK_LINE}\n${words()}` : words());
1714
+ }
1715
+ /**
1716
+ * What the console answers of the notes on the pack (ADR-0178), where it has them: one of
1717
+ * before answers their path as nothing, which is said as what it is, with where the finding
1718
+ * goes meanwhile, since a skill's load named the command whatever the console is.
1719
+ */
1720
+ async function ofPackNotes(io, asked) {
1721
+ try {
1722
+ return await asked;
1723
+ }
1724
+ catch (error) {
1725
+ if (noSuchRoute(error)) {
1726
+ const version = io.consoleVersion?.();
1727
+ throw failed(`This console${version === undefined ? "" : `, ${version},`} takes no notes on the pack yet: it is older than the command. Say what the run showed where the work is reported.`);
1728
+ }
1729
+ throw error;
1730
+ }
1731
+ }
1732
+ /** What `console skills --notes` takes beside what a read of the pack takes. */
1733
+ const SKILLS_NOTES_OPTIONS = {
1734
+ notes: { type: "boolean" },
1735
+ all: { type: "boolean" },
1736
+ mine: { type: "boolean" },
1737
+ offset: { type: "string" },
1738
+ };
1739
+ const SKILLS_NOTES_USAGE = "console skills --notes [<folder|path>] [--all] [--mine] [--limit <n>] [--offset <n>]";
1740
+ /** How a keeper closes a note, and how an author takes one back: said under a list of them. */
1741
+ const NOTE_CLOSING = 'Close one with what became of it: console skill note <id> --done "<what changed, and where>", or --drop "<why nothing was>".';
1742
+ const NOTE_TAKING_BACK = 'These are your own; whoever keeps the skills reads everyone\'s. Take one back: console skill note <id> --drop "<why>".';
1743
+ /**
1744
+ * The notes on the pack (ADR-0178), as the asker reads them: everyone's for whoever keeps the
1745
+ * skills and for an administrator, their own for anyone else. To whoever keeps them, the list
1746
+ * ends with how one is closed and where a keeper's work is written, the skill keeping-the-pack
1747
+ * with its place on this machine: a keeper woken for a round reads it from here, and nobody
1748
+ * else pays for a word of it.
1749
+ */
1750
+ async function listNotes(io, session, values, positionals) {
1751
+ if (positionals.length > 1) {
1752
+ throw misuse(`Say one folder or path: ${SKILLS_NOTES_USAGE}`);
1753
+ }
1754
+ if (["search", "path", "cursor", "heading", "format", "grep", "out"].some((name) => text(values, name) !== undefined) ||
1755
+ ["rows", "code", "kinds", "full"].some((name) => on(values, name))) {
1756
+ throw misuse(`--notes lists the notes on the pack, and reads nothing of it: ${SKILLS_NOTES_USAGE}`);
1757
+ }
1758
+ const limit = numberOf(text(values, "limit"), "limit", 1, MAX_PACK_NOTES_PAGE_LIMIT);
1759
+ const offset = numberOf(text(values, "offset"), "offset", 0, 1_000_000);
1760
+ const all = on(values, "all");
1761
+ const page = { limit: limit ?? PACK_NOTES_PAGE_LIMIT, offset: offset ?? 0, all };
1762
+ const found = await ofPackNotes(io, session.client.packNotes({
1763
+ state: all ? "all" : "open",
1764
+ mine: on(values, "mine"),
1765
+ path: positionals[0] === undefined ? undefined : notePathOf(positionals[0]),
1766
+ limit: page.limit,
1767
+ offset: page.offset,
1768
+ }));
1769
+ const closing = found.everyones
1770
+ ? [
1771
+ NOTE_CLOSING,
1772
+ `What whoever keeps the skills changes alone, what waits for a person and what a round may spend is the skill keeping-the-pack, shipped with this command${io.skillsDir === undefined ? " (in the skills folder of the package @skillcdn/console, which this build has none of beside it)." : `: ${ownSkillPath(io.skillsDir, "keeping-the-pack")}`}`,
1773
+ ]
1774
+ : found.items.length === 0
1775
+ ? []
1776
+ : [NOTE_TAKING_BACK];
1777
+ answer(io, session, found, () => formatPackNotes(found, page, closing));
1778
+ return EXIT.ok;
1779
+ }
1780
+ /** A whole number a flag names, within its bounds; nothing where the flag was not given. */
1781
+ function numberOf(given, name, least, most) {
1782
+ if (given === undefined) {
1783
+ return undefined;
1784
+ }
1785
+ const value = Number(given);
1786
+ if (!/^\d+$/.test(given) || value < least || value > most) {
1787
+ throw misuse(`--${name} is a whole number from ${least} to ${most}: ${given}`);
1788
+ }
1789
+ return value;
1790
+ }
1791
+ /**
1792
+ * A path of the pack as a note names it: from the root, with no slash at either end, and a
1793
+ * skill by its folder, which is what a skill is called, whether its `SKILL.md` or its folder
1794
+ * was said. A URI the pack names a skill by is its path.
1795
+ */
1796
+ function notePathOf(given) {
1797
+ const named = skillPathIn(given, null);
1798
+ if ("error" in named) {
1799
+ throw misuse(named.error);
1800
+ }
1801
+ const from = (given.startsWith("skill://") ? named.path : given)
1802
+ .trim()
1803
+ .replace(/^(?:\.\/)+/, "")
1804
+ .replace(/^\/+|\/+$/g, "");
1805
+ // A pack that is one skill has it at its root, which the load's own line calls `.`.
1806
+ if (from === "." || from === "SKILL.md") {
1807
+ return ".";
1808
+ }
1809
+ const path = from.replace(/\/SKILL\.md$/, "");
1810
+ if (path.length === 0) {
1811
+ throw misuse('Say which skill or page the note is on, by its path in the pack; for a job no skill fit: console skill note --none "<the job, and the words searched>"');
1812
+ }
1813
+ if (!isPackNotePath(path)) {
1814
+ throw misuse(`Not a path of the pack: ${given}. Say the skill's folder or the page's path from the pack's root, as console skills lists it, with no . or .. among its parts.`);
1815
+ }
1816
+ return path;
1586
1817
  }
1587
1818
  const skills = async (args, io) => {
1588
- const { values, positionals } = parse(args, SKILLS_OPTIONS);
1819
+ const parsed = parse(args, { ...SKILLS_OPTIONS, ...SKILLS_NOTES_OPTIONS });
1820
+ const { values, positionals } = parsed;
1821
+ if (on(values, "notes")) {
1822
+ return listNotes(io, await open(io, values), values, positionals);
1823
+ }
1824
+ if (on(values, "all") || on(values, "mine") || text(values, "offset") !== undefined) {
1825
+ throw misuse(`--all, --mine and --offset go with --notes: ${SKILLS_NOTES_USAGE}`);
1826
+ }
1589
1827
  const session = await open(io, values);
1590
1828
  const { reader, owner } = await packNamed(session);
1591
- return readSkills(io, session, reader, values, positionals, {
1829
+ return readSkills(io, session, reader, parsed, {
1592
1830
  command: "console skills",
1593
1831
  own: io.skillsDir,
1594
1832
  afterwards: PLUGIN_SKILLS_LINE,
@@ -1605,8 +1843,9 @@ const skills = async (args, io) => {
1605
1843
  * part.
1606
1844
  */
1607
1845
  async function readSkill(io, session, reader, values, positionals, command, owner = "project", again = []) {
1608
- const say = (value, words) => answerPack(io, session, owner, value, words);
1609
- const toolWords = packWords(`${command}s`, command);
1846
+ const reads = await packReads();
1847
+ const say = (value, words) => answerPack(reads, io, session, owner, value, words);
1848
+ const toolWords = reads.packWords(`${command}s`, command);
1610
1849
  const file = text(values, "file");
1611
1850
  const cursor = text(values, "cursor");
1612
1851
  // A file is read by its own path from the repository's root; a skill's path beside it would be
@@ -1623,17 +1862,21 @@ async function readSkill(io, session, reader, values, positionals, command, owne
1623
1862
  if (file !== undefined && cursor !== undefined) {
1624
1863
  throw misuse(`--cursor reads the next part of a skill; a file reads on from --offset: ${command} --file <path> [--offset <n>] [--limit <n>]`);
1625
1864
  }
1626
- checkedNumber(text(values, "offset"), "offset", Number.MAX_SAFE_INTEGER);
1627
- checkedNumber(text(values, "limit"), "limit", READ_FILE_MAX_LIMIT);
1865
+ checkedNumber(reads, text(values, "offset"), "offset", Number.MAX_SAFE_INTEGER);
1866
+ checkedNumber(reads, text(values, "limit"), "limit", reads.READ_FILE_MAX_LIMIT);
1628
1867
  const listing = await reader.skills();
1629
- const pack = consolePack(reader, listing, { url: session.url });
1868
+ const pack = reads.consolePack(reader, listing, { url: session.url });
1630
1869
  if (pack === undefined) {
1631
- throw refusedRead(io, session, owner, listing, formatSkills(listing, undefined, io.skillsDir, owner, toolWords));
1870
+ throw refusedRead(reads, io, session, owner, listing, reads.formatSkills(listing, undefined, io.skillsDir, owner, toolWords));
1632
1871
  }
1872
+ // A file of the pack is named by the line that reads it, whole, asked as this read was
1873
+ // (SkillCDN 0.6.4): the source a skill names, and what a folder read as a file holds.
1874
+ const readFile = (path) => reads.commandLine(command, ["--file", path, ...again]) ??
1875
+ `${command} --file with this file's path, quoted for your shell. ${reads.NO_LINE_TO_RUN}`;
1633
1876
  if (file !== undefined) {
1634
1877
  // A page of the file, as the skillcdn command reads one: from --offset, as long as a host
1635
1878
  // shows whole where --limit says nothing, and where the next begins when the file goes on.
1636
- const page = await readThrough(io, session, owner, pack, { read: "file", path: file, offset: text(values, "offset"), limit: text(values, "limit") }, { words: toolWords });
1879
+ const page = await readThrough(reads, io, session, owner, pack, { read: "file", path: file, offset: text(values, "offset"), limit: text(values, "limit") }, { words: toolWords, readFile });
1637
1880
  say(jsonOfRead(session, pack, page), () => page.text);
1638
1881
  return EXIT.ok;
1639
1882
  }
@@ -1646,22 +1889,113 @@ async function readSkill(io, session, reader, values, positionals, command, owne
1646
1889
  // the cursor. A part says how many pages of the skill follow it and ends with the command
1647
1890
  // that reads the next, asked as this one was, and the last says that it is the last: the
1648
1891
  // words are the skillcdn command's own (SkillCDN 0.6.2), and only the line is made here.
1649
- const loaded = await readThrough(io, session, owner, pack, { read: "skill", path: wanted.path, cursor }, {
1892
+ // What a load of the project's or the organization's pack ends with (ADR-0178): the command
1893
+ // that leaves a note on this skill, with its folder in it, read by whoever is about to use
1894
+ // the skill and nobody else. A plugin's pack is its package's, and takes no note here.
1895
+ const noting = command === "console skill" && !session.json
1896
+ ? noteLineFor(reads, skillFolderOf(wanted.path), again)
1897
+ : undefined;
1898
+ const loaded = await readThrough(reads, io, session, owner, pack, { read: "skill", path: wanted.path, cursor }, {
1899
+ beside: [noting],
1650
1900
  words: toolWords,
1651
- // Spelled so that bash and PowerShell run it as it is; where a word has no such spelling,
1652
- // the command that was run is run again, with the cursor, and the line says why.
1653
- nextPart: (next) => commandLine(command, [given, "--cursor", next, ...again]) ??
1654
- `the command you ran, with --cursor ${commandWord(next) ?? JSON.stringify(next)} in place of any it had, each word quoted for your shell. ${NO_LINE_TO_RUN}`,
1901
+ readFile,
1902
+ // Spelled so that every shell runs it as it is; where a word has no such spelling, the
1903
+ // command that was run is run again, with the cursor, and the line says why.
1904
+ nextPart: (next) => reads.commandLine(command, [given, "--cursor", next, ...again]) ??
1905
+ readOnWithoutLine(reads, next),
1655
1906
  // The skill's own folder, where it does not list every file of it, as the command that
1656
1907
  // lists a folder of this pack (SkillCDN 0.6.3): the dot for the root, since the command
1657
1908
  // without a folder is the listing.
1658
- browseFolder: (path) => commandLine(`${command}s`, [path.length === 0 ? "." : path, ...again]) ??
1659
- `${command}s with this skill's folder, quoted for your shell. ${NO_LINE_TO_RUN}`,
1909
+ browseFolder: (path) => reads.commandLine(`${command}s`, [path.length === 0 ? "." : path, ...again]) ??
1910
+ `${command}s with this skill's folder, quoted for your shell. ${reads.NO_LINE_TO_RUN}`,
1660
1911
  });
1661
- say(jsonOfRead(session, pack, loaded), () => loaded.text);
1912
+ // After the last part alone: a part that is not the last ends with the command for the next.
1913
+ say(jsonOfRead(session, pack, loaded), () => noting === undefined || loaded.next !== undefined
1914
+ ? loaded.text
1915
+ : `${loaded.text.replace(/\n+$/, "")}\n${noting}`);
1916
+ return EXIT.ok;
1917
+ }
1918
+ /** A skill's folder, which is what a skill is called, from the path of its `SKILL.md`. */
1919
+ const skillFolderOf = (path) => path.replace(/(?:^|\/)SKILL\.md$/, "") || ".";
1920
+ /**
1921
+ * The line a skill's load ends with: where a run shows the skill wrong or lacking, the command
1922
+ * that says so to whoever keeps the pack, asked as this load was. The words are a placeholder,
1923
+ * so the line is printed whole only where the folder has a spelling every shell takes.
1924
+ */
1925
+ function noteLineFor(reads, folder, again) {
1926
+ const line = reads.commandLine("console skill note", [folder]);
1927
+ const where = reads.commandLine("", again)?.trim() ?? "";
1928
+ return `Where a run shows this skill wrong or lacking, say so for whoever keeps the pack, as behavior and without the run's own material: ${line ?? "console skill note <this skill's folder>"} "<what the run showed>"${where.length === 0 ? "" : ` ${where}`}`;
1929
+ }
1930
+ const SKILL_NOTE_USAGE = 'console skill note <path> "<what a run showed>" | console skill note --none "<the job, and the words searched>" | console skill note <id> --done "<what changed>" | console skill note <id> --drop "<why nothing was>"';
1931
+ const NOTE_ID = /^[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12}$/i;
1932
+ /** What a note says, given as a word or, as `-`, on standard input: something, after its edges are trimmed. */
1933
+ async function noteWords(io, given) {
1934
+ const words = (given === "-" ? await io.readStdin() : given).trim();
1935
+ if (words.length === 0) {
1936
+ throw misuse(`A note says something: ${SKILL_NOTE_USAGE}`);
1937
+ }
1938
+ if (words.length > MAX_PACK_NOTE_LENGTH) {
1939
+ throw misuse(`A note is at most ${MAX_PACK_NOTE_LENGTH} characters, and this is ${words.length}: say what the run showed in a few sentences, as behavior, without the run's own material.`);
1940
+ }
1941
+ return words;
1942
+ }
1943
+ /**
1944
+ * A note on the pack (ADR-0178): left on a skill or a page of it, or with `--none` for a job no
1945
+ * skill fit, by anyone who works through the console; and closed, by its id, with what became
1946
+ * of it, by whoever keeps the skills, or taken back by its author. It is left on the pack the
1947
+ * command reads: the project's where one is named, else the organization's.
1948
+ */
1949
+ async function skillNote(args, io) {
1950
+ const { values, positionals } = parse(args, {
1951
+ none: { type: "boolean" },
1952
+ done: { type: "string" },
1953
+ drop: { type: "string" },
1954
+ });
1955
+ const done = text(values, "done");
1956
+ const drop = text(values, "drop");
1957
+ const none = on(values, "none");
1958
+ if (done !== undefined || drop !== undefined) {
1959
+ if ((done !== undefined && drop !== undefined) || none) {
1960
+ throw misuse(`Say one of --done and --drop, with the note's id: ${SKILL_NOTE_USAGE}`);
1961
+ }
1962
+ const id = theOne(positionals, `Say which note, by its id as console skills --notes lists it: ${SKILL_NOTE_USAGE}`);
1963
+ if (!NOTE_ID.test(id)) {
1964
+ throw misuse(`Not a note's id: ${id}. console skills --notes lists the notes with their ids.`);
1965
+ }
1966
+ const outcome = (done ?? drop ?? "").trim();
1967
+ if (outcome.length === 0 || outcome.length > MAX_PACK_NOTE_OUTCOME_LENGTH) {
1968
+ throw misuse(`Say what became of the note, in up to ${MAX_PACK_NOTE_OUTCOME_LENGTH} characters: ${SKILL_NOTE_USAGE}`);
1969
+ }
1970
+ const session = await open(io, values);
1971
+ const closed = await ofPackNotes(io, session.client.closePackNote(id, {
1972
+ state: done === undefined ? "dropped" : "done",
1973
+ outcome,
1974
+ }));
1975
+ answer(io, session, closed, () => formatPackNoteClosed(closed));
1976
+ return EXIT.ok;
1977
+ }
1978
+ // `console skill note` alone read, before this form, as the load of a skill whose folder is
1979
+ // called note: that load is still there, by the path of its file, and the sentence says so.
1980
+ const [path, words] = none
1981
+ ? [undefined, theOne(positionals, `Say the job no skill fit: ${SKILL_NOTE_USAGE}`)]
1982
+ : theTwo(positionals, `Say what the note is on, and what it says: ${SKILL_NOTE_USAGE}${positionals.length === 0 ? " | a skill in a folder called note is loaded by its file: console skill note/SKILL.md" : ""}`);
1983
+ const body = await noteWords(io, words);
1984
+ const on_ = path === undefined ? undefined : notePathOf(path);
1985
+ const session = await open(io, values);
1986
+ const project = await session.projectKey();
1987
+ const left = await ofPackNotes(io, session.client.leavePackNote({
1988
+ ...(on_ === undefined ? {} : { path: on_ }),
1989
+ body,
1990
+ ...(project === undefined ? {} : { project }),
1991
+ }));
1992
+ answer(io, session, left, () => formatPackNoteLeft(left));
1662
1993
  return EXIT.ok;
1663
1994
  }
1664
1995
  const skill = async (args, io) => {
1996
+ if (args[0] === "note") {
1997
+ return skillNote(args.slice(1), io);
1998
+ }
1665
1999
  const { values, positionals } = parse(args, SKILL_OPTIONS);
1666
2000
  const session = await open(io, values);
1667
2001
  const { reader, owner } = await packNamed(session);
@@ -1766,8 +2100,7 @@ const plugin = async (args, io) => {
1766
2100
  case "events":
1767
2101
  return pluginEvents(io, session, client, rest);
1768
2102
  case "skills": {
1769
- const parsed = parse(rest, SKILLS_OPTIONS);
1770
- return readSkills(io, session, client, parsed.values, parsed.positionals, {
2103
+ return readSkills(io, session, client, parse(rest, SKILLS_OPTIONS), {
1771
2104
  command: `console plugin ${key} skills`,
1772
2105
  again: whereGiven(values),
1773
2106
  });
@@ -1944,9 +2277,15 @@ async function pluginRecords(io, session, client, rest, project) {
1944
2277
  });
1945
2278
  const [collection, id, ...more] = positionals;
1946
2279
  if (collection === undefined || more.length > 0) {
1947
- throw misuse(`Say which collection: console plugin ${client.key} records <collection> [<id>] [--where <field>=<value>]... [--search <words>] [--order <field>[:desc]] [--limit <n>] [--after <cursor>] [--archived] [--versions]`);
2280
+ throw misuse(`Say which collection: console plugin ${client.key} records <collection> [<id>] [--where <field>=<value>]... [--search "<words>"] [--order <field>[:desc]] [--limit <n>] [--after <cursor>] [--archived] [--versions]`);
1948
2281
  }
1949
2282
  if (id !== undefined) {
2283
+ // A second word is a record's id, and a record is read alone: a search beside it would be
2284
+ // dropped without a line, and the second word of a search was read so (`--search annual
2285
+ // leave` read the record "leave"). Here the words of a search are one word (ADR-0179).
2286
+ if (text(values, "search") !== undefined) {
2287
+ throw misuse(`A record is read by its id alone, and ${id} was read as one: --search goes with a collection, its words as one word in quotes: console plugin ${client.key} records ${collection} --search "<words>"`);
2288
+ }
1950
2289
  if (on(values, "versions")) {
1951
2290
  const versions = await client.recordVersions(collection, id);
1952
2291
  answer(io, session, versions, () => formatPluginRecordVersions(versions));
@@ -2808,6 +3147,26 @@ const file = async (args, io) => {
2808
3147
  }, () => `Saved ${read.name} (${read.bytes.byteLength} bytes, ${read.contentType}) at ${saved}`);
2809
3148
  return EXIT.ok;
2810
3149
  };
3150
+ /**
3151
+ * What a take says first of what to do next (ADR-0176): the job's skill, before anything is
3152
+ * made. The rules say that a job begins with its skill; a take says the two commands, at the
3153
+ * moment the work begins and at every take, a later one of a session that left the rules out
3154
+ * among them. The one the task names is loaded; where it names none, the search is the
3155
+ * agent's, by words it chooses for the job, and a take runs none itself: a title is not the
3156
+ * words a skill is found by, and every take would pay for the read. The reads are of the
3157
+ * project the take named: where the pack is read is said as it was given, since without it a
3158
+ * desk reads the organization's pack, which may be another. Those words are spelled by the
3159
+ * skillcdn command's own rule, whose library a take loads only where it has a word to spell
3160
+ * (ADR-0179).
3161
+ */
3162
+ async function skillStep(values) {
3163
+ const given = whereGiven(values);
3164
+ const where = given.length === 0 ? "" : (await packReadsAfter())?.commandLine("", given);
3165
+ if (where === undefined) {
3166
+ return `First, the job's skill: console skill <path> for the one the task names; else console skills --kinds says whether the pack has skills for a job of this kind, and how one is found; each asked with ${flagNamesOf(given)} as this take was, quoted for your shell. Of another kind, or where none fits, go on.`;
3167
+ }
3168
+ return `First, the job's skill: console skill <path>${where} for the one the task names; else console skills --kinds${where} says whether the pack has skills for a job of this kind, and how one is found. Of another kind, or where none fits, go on.`;
3169
+ }
2811
3170
  /** Begins a run on a task, as the agent `--agent` names where it is said: the take itself. */
2812
3171
  function runOn(project, found, values) {
2813
3172
  const agent = text(values, "agent");
@@ -2860,6 +3219,7 @@ async function taking(session, project, found, ref, run, values) {
2860
3219
  const answered = held === undefined ? [] : [held === mark ? formatRulesLeftOut(mark) : formatRulesChanged(held)];
2861
3220
  const ruled = held === mark ? [] : [formatRules(rules, language), ""];
2862
3221
  const page = await taskPage(session, taken.number);
3222
+ const first = await skillStep(values);
2863
3223
  return {
2864
3224
  value: { run, task: taken, comments: comments.items, rules: { ...rules, mark } },
2865
3225
  words: () => [
@@ -2872,6 +3232,7 @@ async function taking(session, project, found, ref, run, values) {
2872
3232
  formatTask(taken, undefined, undefined, comments.items, page),
2873
3233
  "",
2874
3234
  ...ruled,
3235
+ first,
2875
3236
  'Say how it goes: console report "<what you found or did>". Hand in what you make: console hand-in <https url | file path>.',
2876
3237
  'Ask when a person must decide: console ask "<question>" --option "..." --option "...". A word for the task\'s people that is not a report: console comment <number> "<markdown>". End with: console finish --summary "<what was done, what is left>".',
2877
3238
  ].join("\n"),
@@ -2990,6 +3351,14 @@ const ask = async (args, io) => {
2990
3351
  if (options.length < MIN_OPTIONS || options.length > MAX_OPTIONS) {
2991
3352
  throw misuse(`Give ${MIN_OPTIONS} to ${MAX_OPTIONS} options, one --option each.`);
2992
3353
  }
3354
+ // Said before the console is asked, with where the rest goes: its refusal names a field.
3355
+ if (question.length > MAX_QUESTION_LENGTH) {
3356
+ throw misuse(`The question is ${question.length} characters, and one is at most ${MAX_QUESTION_LENGTH}: ask it in a line, and put what the person needs to know, the exact values among it, in --body or --file, which take Markdown.`);
3357
+ }
3358
+ const long = options.find((label) => label.length > MAX_OPTION_LABEL_LENGTH);
3359
+ if (long !== undefined) {
3360
+ throw misuse(`An option is ${long.length} characters, and one is at most ${MAX_OPTION_LABEL_LENGTH}: name it in a few words, and say what it means in --body or --file.`);
3361
+ }
2993
3362
  const seconds = secondsOf(text(values, "wait"), DEFAULT_ASK_WAIT_SECONDS);
2994
3363
  const body = await bodyOf(io, values, text(values, "body"));
2995
3364
  // The files put on the decision (ADR-0055): a picture of what is to be chosen between, for one.
@@ -3214,24 +3583,36 @@ const decision = async (args, io) => {
3214
3583
  return settle(io, session, waiter, found, seconds, false, wakes);
3215
3584
  };
3216
3585
  const docs = async (args, io) => {
3217
- const { values, positionals } = parse(args, {
3586
+ const parsed = parse(args, {
3218
3587
  search: { type: "string" },
3219
3588
  archived: { type: "boolean" },
3220
3589
  });
3221
- if (positionals.length > 1) {
3222
- throw misuse("Say one folder: console docs [<folder>] [--search <words>] [--archived]");
3590
+ const { values, positionals } = parsed;
3591
+ // A search is of every page of the project, and every bare word is of it (ADR-0179): a
3592
+ // folder beside the words narrowed nothing, and its word was dropped without a line.
3593
+ const search = searchTyped(parsed);
3594
+ if (search === undefined && positionals.length > 1) {
3595
+ throw misuse('Say one folder, or the words of a search after --search: console docs [<folder>] [--archived], or console docs --search "<words>"');
3596
+ }
3597
+ if (search === "") {
3598
+ throw misuse('Say what to search for: console docs --search "<words>"');
3223
3599
  }
3224
- const search = text(values, "search");
3225
3600
  const session = await open(io, values);
3226
3601
  const project = await session.project();
3227
3602
  // A folder is taken as the listing prints it, `guides/`, and as it is named, `guides`.
3228
- const folder = positionals[0]?.replace(/\/+$/, "");
3603
+ const folder = search === undefined ? positionals[0]?.replace(/\/+$/, "") : undefined;
3229
3604
  const found = await project.documents({
3230
3605
  ...(folder === undefined || folder === "" ? {} : { folder }),
3231
3606
  ...(search === undefined ? {} : { q: search }),
3232
3607
  ...(on(values, "archived") ? { archived: true } : {}),
3233
3608
  });
3234
- answer(io, session, found, () => formatDocuments(found));
3609
+ // A search that finds nothing says what it looked for, as one of the tasks does: a word
3610
+ // typed as a folder is a word of the search, and every word must be on a page.
3611
+ answer(io, session, found, () => search !== undefined && found.folders.length === 0 && found.items.length === 0
3612
+ ? /\s/.test(search.trim())
3613
+ ? `No pages: none holds every word of "${search.trim()}". A search is of every page of the project, whatever its folder, and fewer words find more.`
3614
+ : `No pages: none holds "${search.trim()}".`
3615
+ : formatDocuments(found));
3235
3616
  return EXIT.ok;
3236
3617
  };
3237
3618
  /** What a read of one page takes beside its path. */
@@ -3370,18 +3751,17 @@ const restore = async (args, io) => {
3370
3751
  /** The forms of `console doc` that change a page, by the word that picks each. */
3371
3752
  const DOC_FORMS = { write, attach, archive, restore };
3372
3753
  const goals = async (args, io) => {
3373
- const { values } = parse(args, {
3754
+ const parsed = parse(args, {
3374
3755
  category: { type: "string" },
3375
3756
  state: { type: "string" },
3376
3757
  search: { type: "string" },
3377
3758
  ...PAGE_OPTIONS,
3378
- }, false);
3759
+ });
3760
+ const { values } = parsed;
3379
3761
  const state = goalStateOf(text(values, "state"));
3380
3762
  const category = text(values, "category");
3381
- const search = text(values, "search")?.trim();
3382
- if (search === "") {
3383
- throw misuse("Say what to search for: console goals --search <words>");
3384
- }
3763
+ // Every bare word is of the search where --search was typed, and no word goes without it.
3764
+ const search = listingSearch(parsed, "console goals");
3385
3765
  const page = pageOf(values);
3386
3766
  const session = await open(io, values);
3387
3767
  const project = await session.project();
@@ -3859,6 +4239,10 @@ const runner = async (args, io) => {
3859
4239
  installed: io.version === undefined ? undefined : io.installedVersion,
3860
4240
  // What installs the console's version here, the way this command was installed.
3861
4241
  updateCommand: () => updateWords(io, io.consoleVersion?.()),
4242
+ // What the console said its version is, on the answers the runner gets anyway: where it
4243
+ // is newer than this command, the agent is told once (ADR-0182). A runner whose own
4244
+ // version is not known has nothing to hold it against.
4245
+ consoleVersion: io.version === undefined ? undefined : io.consoleVersion,
3862
4246
  now: io.now,
3863
4247
  random: host.random,
3864
4248
  time: (iso) => clock.format(new Date(iso)),
@@ -3976,7 +4360,7 @@ const manager = async (args, io) => {
3976
4360
  // The administrators stand in where there is no manager, or the manager is out.
3977
4361
  if (found.manager === null || found.manager.status !== "active") {
3978
4362
  lines.push(found.administrators.length === 0
3979
- ? "No administrator is in."
4363
+ ? "No administrator stands in."
3980
4364
  : "The administrators, who stand in:", ...found.administrators.map((person) => ` ${formatPersonLine(person)}`));
3981
4365
  }
3982
4366
  return lines.join("\n");
@@ -3996,10 +4380,24 @@ const agents = async (args, io) => {
3996
4380
  return EXIT.ok;
3997
4381
  };
3998
4382
  const AGENT_USAGE = "Say which agent account, or what to do: console agent <handle>, or console agent new|tell|interrupt|stop|restart|reset|wake|set|signals|messages|secrets|secret|invite|setup ...";
4383
+ /**
4384
+ * Whether a console refused an agent account for the project it was not sent: one before 0.6.4,
4385
+ * which made an account in a project (ADR-0088) where a console now makes it in none
4386
+ * (ADR-0181), and says so as any body it cannot read, by the field's name.
4387
+ */
4388
+ /** The console's version as a sentence names it, `, 0.6.3,`, where it said one. */
4389
+ const consoleNamed = (io) => {
4390
+ const version = io.consoleVersion?.();
4391
+ return version === undefined ? "" : `, ${version},`;
4392
+ };
4393
+ const asksForProject = (error) => error instanceof ApiError &&
4394
+ error.status === 400 &&
4395
+ error.code === "request.invalid" &&
4396
+ error.message.startsWith("project:");
3999
4397
  // An administrator makes an agent account with flags, where the pages make one from a form
4000
4398
  // (ADR-0084): the member's row at once, its login let in. What is left out is proposed: the
4001
4399
  // name is the handle's, capitalized, and the console rolls the avatar from the seed, or from one
4002
- // of its own.
4400
+ // of its own. It is made in no project (ADR-0181), and the console leaves it its first message.
4003
4401
  const agentNew = async (args, io) => {
4004
4402
  const { values, positionals } = parse(args, {
4005
4403
  login: { type: "string" },
@@ -4021,18 +4419,14 @@ const agentNew = async (args, io) => {
4021
4419
  const derived = asked === undefined ? undefined : agentLoginOf(asked.workspace, handle);
4022
4420
  const login = text(values, "login") ?? derived?.login;
4023
4421
  if (login === undefined) {
4024
- throw misuse(`Say the account it will sign in with: console agent new ${handle} --login <login> --project <key>`);
4422
+ throw misuse(`Say the account it will sign in with: console agent new ${handle} --login <login>`);
4025
4423
  }
4026
4424
  const chosen = text(values, "host");
4027
4425
  const host = chosen === undefined ? (derived?.host ?? hostOfLogin(login)) : providerOf(chosen);
4028
- const project = await session.projectKey();
4029
- if (project === undefined) {
4030
- throw misuse(`Say the project it starts in: console agent new ${handle} --login ${login} --project <key>`);
4031
- }
4032
4426
  const manager = text(values, "manager");
4033
4427
  const seed = text(values, "seed");
4034
4428
  const title = text(values, "title");
4035
- const made = await session.client.createAgent({
4429
+ const input = {
4036
4430
  host,
4037
4431
  login,
4038
4432
  handle,
@@ -4042,9 +4436,24 @@ const agentNew = async (args, io) => {
4042
4436
  ...(manager === undefined || manager === "me"
4043
4437
  ? {}
4044
4438
  : { managerId: (await personOf(session, manager)).id }),
4045
- project,
4046
4439
  // A member who carries the login becomes the account only where that is said (ADR-0104).
4047
4440
  ...(on(values, "convert") ? { convert: true } : {}),
4441
+ };
4442
+ /** The project a console of before made the account in, with a task for its setup. */
4443
+ let before;
4444
+ const made = await session.client.createAgent(input).catch(async (error) => {
4445
+ if (!asksForProject(error)) {
4446
+ throw error;
4447
+ }
4448
+ // A console of before, which made nothing of what it refused: it is sent the project this
4449
+ // directory or --project names, and does with it what it did; where none is named, the
4450
+ // answer says what to type.
4451
+ const project = await session.projectKey();
4452
+ before = project;
4453
+ if (project === undefined) {
4454
+ throw failed(`This console${consoleNamed(io)} is older than the command and makes an agent account in a project. Name one: console agent new ${handle} --login ${login} --project <key>`);
4455
+ }
4456
+ return session.client.createAgent({ ...input, project });
4048
4457
  });
4049
4458
  answer(io, session, made, () => [
4050
4459
  formatAgentLine(made),
@@ -4059,11 +4468,24 @@ const agentNew = async (args, io) => {
4059
4468
  : `It is a member now, and work can be assigned to it. It signs in as ${made.person.login}: not confirmed, since this console reads no organization at the git host. That account has to be the organization's own at the git host already, since until its first sign-in binds it here the console lets in whoever holds that login.`
4060
4469
  : `It is a member now, and work can be assigned to it. It signs in as ${made.person.login}: that account is made at the provider before its machine is set up, and its first sign-in with it binds it here.`
4061
4470
  : `${made.person.login} is an agent account from now on, with everything it did.`,
4062
- ...(made.onboarding === null || made.onboarding === undefined
4471
+ // What setting it up takes: a console of now left it as its first message to the
4472
+ // account, made in no project; one of before wrote a task, which it answers where it did.
4473
+ // A console of before lists the account in the project named here, a private one too:
4474
+ // said, since nothing was asked of a project.
4475
+ ...(before === undefined
4063
4476
  ? []
4064
4477
  : [
4065
- `Its first task is #${made.onboarding.number} in ${made.onboarding.project}, with what setting it up takes; its runner is woken with it when it first starts.`,
4478
+ `This console${consoleNamed(io)} is older than the command and makes an agent account in a project: it is in ${before}, ${typeof values.project === "string" ? "which --project names" : "the project named here"}. Where it is not to work there: console member remove ${made.person.login} --project ${before}`,
4066
4479
  ]),
4480
+ ...(made.onboarding !== null && made.onboarding !== undefined
4481
+ ? [
4482
+ `Its first task is #${made.onboarding.number} in ${made.onboarding.project}, with what setting it up takes; its runner is woken with it when it first starts.`,
4483
+ ]
4484
+ : before !== undefined
4485
+ ? []
4486
+ : [
4487
+ `What setting it up takes waits on its record as the console's first message to it, which its runner hands it when it first starts. It is made in no project, and a private one lists it as any member: console member add ${made.person.login} --project <key>`,
4488
+ ]),
4067
4489
  `Next, a machine: console agent invite ${handle} makes the invitation that leads one to it.`,
4068
4490
  ].join("\n"));
4069
4491
  return EXIT.ok;
@@ -4081,7 +4503,8 @@ async function secretValue(io, values, prompt) {
4081
4503
  const file = text(values, "file");
4082
4504
  const value = file === undefined
4083
4505
  ? await secretGiven(io, prompt)
4084
- : (await io.readFile(file)).replace(/\r?\n$/, "");
4506
+ : // What a file comes to as a value is said once, for the command and the pages (ADR-0184).
4507
+ secretOfText(await io.readFile(file));
4085
4508
  if (value.length === 0) {
4086
4509
  throw failed("No value was given.");
4087
4510
  }
@@ -4422,6 +4845,36 @@ const ownReset = async (args, io) => {
4422
4845
  answer(io, session, sent, () => `Asked, as signal #${sent.number} of your record: when this turn is over, your session ends and a new conversation begins with these words. Nothing else of this one goes with it: put what must be kept on the board, in your desk or in your product's memory before the turn ends.`);
4423
4846
  return EXIT.ok;
4424
4847
  };
4848
+ /**
4849
+ * What an account is told that asks of itself what its supervisors do (ADR-0180): a tell, an
4850
+ * interruption, a stop, a start, a setting, an invitation. Said before anything is sent where it
4851
+ * names itself `me`, which no such form takes, and where the console refused it by its handle.
4852
+ */
4853
+ const NOBODY_SUPERVISES_THEMSELVES = 'Nobody supervises themselves (ADR-0180): a tell, an interruption, a stop, a start, a setting and an invitation are an account\'s supervisors\', never its own, whatever its role. What you raise for yourself is a wake, console agent wake me ["<words>"], and a new conversation, console agent reset me "<why>".';
4854
+ /** Whether a word names the account itself where a supervisor's form wants a handle. */
4855
+ const namesItself = (word) => word === "me" || word === "@me";
4856
+ /**
4857
+ * A supervisor's act on an agent account (ADR-0084), refused as what it is. The console's
4858
+ * refusal says that only a supervisor may, and the hint after it would say the step is an
4859
+ * administrator's: of the account's own handle, the account is told that nobody supervises
4860
+ * themselves, which an account that administers is not told otherwise; of another's, whose the
4861
+ * step is. `me` is asked only on a refusal, so that the act costs no request more.
4862
+ */
4863
+ async function supervising(session, handle, act) {
4864
+ try {
4865
+ return await act();
4866
+ }
4867
+ catch (error) {
4868
+ if (!(error instanceof ApiError) || error.code !== "auth.forbidden") {
4869
+ throw error;
4870
+ }
4871
+ const me = await session.client.me().catch(() => undefined);
4872
+ if (me?.person?.handle === handle) {
4873
+ throw failed(`auth.forbidden: ${NOBODY_SUPERVISES_THEMSELVES}`);
4874
+ }
4875
+ throw failed(`auth.forbidden: ${error.message}\nWhat a supervisor does to an agent account is its manager's, whoever is above them in the reporting line and the administrators': hand the step to one of them.`);
4876
+ }
4877
+ }
4425
4878
  /** The kinds of signal a supervisor sends with words: which need them, and which take them. */
4426
4879
  const WORDED_SIGNALS = {
4427
4880
  tell: { needs: true },
@@ -4463,6 +4916,9 @@ const agentSignal = async (kind, args, io) => {
4463
4916
  const [given, words, ...rest] = positionals;
4464
4917
  const needs = WORDED_SIGNALS[kind]?.needs === true;
4465
4918
  const usage = `Say whom${needs ? " and what" : ""}: console agent ${kind} <handle> ${needs ? '"<words>"' : '["<words>"]'} [--file <path>]`;
4919
+ if (namesItself(given)) {
4920
+ throw misuse(NOBODY_SUPERVISES_THEMSELVES);
4921
+ }
4466
4922
  if (given === undefined || rest.length > 0) {
4467
4923
  throw misuse(usage);
4468
4924
  }
@@ -4472,10 +4928,10 @@ const agentSignal = async (kind, args, io) => {
4472
4928
  }
4473
4929
  const handle = handleOf(given);
4474
4930
  const session = await open(io, values);
4475
- const sent = await session.client.sendSignal(handle, {
4931
+ const sent = await supervising(session, handle, () => session.client.sendSignal(handle, {
4476
4932
  kind,
4477
4933
  ...(said.length === 0 ? {} : { text: said }),
4478
- });
4934
+ }));
4479
4935
  answer(io, session, sent, () => `Sent to @${handle}: ${formatSignalLine(sent)}`);
4480
4936
  return EXIT.ok;
4481
4937
  };
@@ -4487,6 +4943,9 @@ const agentSet = async (args, io) => {
4487
4943
  effort: { type: "string" },
4488
4944
  });
4489
4945
  const usage = "Say whom and what: console agent set <handle> [--model <name|none>] [--effort <level|none>]";
4946
+ if (namesItself(positionals[0])) {
4947
+ throw misuse(NOBODY_SUPERVISES_THEMSELVES);
4948
+ }
4490
4949
  const handle = handleOf(theOne(positionals, usage));
4491
4950
  const model = orNone(text(values, "model"));
4492
4951
  const effort = orNone(text(values, "effort"));
@@ -4494,13 +4953,13 @@ const agentSet = async (args, io) => {
4494
4953
  throw misuse(usage);
4495
4954
  }
4496
4955
  const session = await open(io, values);
4497
- const sent = await session.client.sendSignal(handle, {
4956
+ const sent = await supervising(session, handle, () => session.client.sendSignal(handle, {
4498
4957
  kind: "set",
4499
4958
  set: {
4500
4959
  ...(model === undefined ? {} : { model }),
4501
4960
  ...(effort === undefined ? {} : { effort }),
4502
4961
  },
4503
- });
4962
+ }));
4504
4963
  answer(io, session, sent, () => `Sent to @${handle}: ${formatSignalLine(sent)}`);
4505
4964
  return EXIT.ok;
4506
4965
  };
@@ -4622,6 +5081,9 @@ const agentInvite = async (args, io) => {
4622
5081
  revoke: { type: "boolean" },
4623
5082
  out: { type: "string" },
4624
5083
  });
5084
+ if (namesItself(positionals[0])) {
5085
+ throw misuse(NOBODY_SUPERVISES_THEMSELVES);
5086
+ }
4625
5087
  const handle = handleOf(theOne(positionals, "Say whose: console agent invite <handle> [--out <path>] | --revoke"));
4626
5088
  const out = text(values, "out");
4627
5089
  if (on(values, "revoke") && out !== undefined) {
@@ -4629,7 +5091,7 @@ const agentInvite = async (args, io) => {
4629
5091
  }
4630
5092
  const session = await open(io, values);
4631
5093
  if (on(values, "revoke")) {
4632
- await session.client.revokeAgentInvitation(handle);
5094
+ await supervising(session, handle, () => session.client.revokeAgentInvitation(handle));
4633
5095
  answer(io, session, { handle, revoked: true }, () => `The invitation of @${handle} is taken away: its code opens nothing now.`);
4634
5096
  return EXIT.ok;
4635
5097
  }
@@ -4648,7 +5110,7 @@ const agentInvite = async (args, io) => {
4648
5110
  throw failed(`Nothing can be written at ${out}, so no invitation was made and the one before stands. Say a path that can be written.`);
4649
5111
  }
4650
5112
  }
4651
- const made = await session.client.inviteAgent(handle);
5113
+ const made = await supervising(session, handle, () => session.client.inviteAgent(handle));
4652
5114
  const until = `good until ${moment(made.invitation.expiresAt)} or until its command has signed in`;
4653
5115
  const guide = `${session.url}/setup/${made.code}`;
4654
5116
  if (file === undefined) {
@@ -4682,8 +5144,10 @@ const agentInvite = async (args, io) => {
4682
5144
  // The code came this once and went nowhere: the invitation stands and nobody holds its line.
4683
5145
  throw failed(`The invitation of @${handle} is made, and its line could not be written at ${file}, so nobody has it. Make the invitation again with a path that can be written: it takes the place of this one.`);
4684
5146
  }
4685
- // The path as both shells take it whole; where it has no such spelling, it is named in words.
4686
- const path = commandWord(written) ?? "<the file's path, quoted for your shell>";
5147
+ // The path as every shell takes it whole, by the skillcdn command's own rule; where it has
5148
+ // no such spelling, it is named in words.
5149
+ const path = (await packReadsAfter())?.commandLine("", [written])?.trim() ??
5150
+ "<the file's path, quoted for your shell>";
4687
5151
  answer(io, session, { handle, invitation: made.invitation, file: written }, () => [
4688
5152
  `An invitation for @${handle}, ${until}. Its line is written to ${written} and is not shown here: it carries the code, which is shown nowhere else.`,
4689
5153
  `Hand the file on unread to whoever prepares the machine: as the body of a decision for them (console ask "<question>" --option "<one>" --option "<another>" --file ${path} --to <login>), attached to a comment on a task (console comment <number> "<a line for them>" --attach ${path}), or as a file at the messenger. Never as a comment's own words (--file there): the command prints them back. A decision read with the command afterwards shows the line. Remove the file once it is handed on: one left in a desk outside work/ is committed and pushed with it.`,
@@ -5075,6 +5539,8 @@ log) {
5075
5539
  await io.sleep(FIRST_SESSION_PAUSE_MS);
5076
5540
  }
5077
5541
  }
5542
+ // The task for its setup, where its plate holds one: an account a console before 0.6.4 made
5543
+ // has the one that console wrote, and keeps it (ADR-0181).
5078
5544
  const plate = await client.work().catch(() => undefined);
5079
5545
  const first = plate?.tasks.find((one) => one.task.title === onboardingTitle(handle));
5080
5546
  const inTheWay = await standsInTheWay(machine);
@@ -5571,7 +6037,23 @@ function serviceOf(word) {
5571
6037
  }
5572
6038
  return { role: role, service };
5573
6039
  }
5574
- const WORKSPACE_USAGE = `Say what to do: console workspace | console workspace edit [${WORKSPACE_FLAGS.replaceAll(", ", "] [")}] | console workspace pack-token --connect|--stdin|--remove`;
6040
+ const PACK_KEEPER_USAGE = "console workspace pack-keeper <login|none> [--round <HH:MM|none>] | console workspace pack-keeper --round <HH:MM|none>";
6041
+ const WORKSPACE_USAGE = `Say what to do: console workspace | console workspace edit [${WORKSPACE_FLAGS.replaceAll(", ", "] [")}] | console workspace pack-token --connect|--stdin|--remove | ${PACK_KEEPER_USAGE}`;
6042
+ /**
6043
+ * What the member who keeps the organization's skills is called (ADR-0178), and whether they
6044
+ * are out, for the line that says who does: looked up among the people the asker sees, and
6045
+ * nothing where the workspace names nobody, or somebody the asker does not see.
6046
+ */
6047
+ async function keeperOf(session, workspace) {
6048
+ const id = workspace.skills.keeperId;
6049
+ if (typeof id !== "string") {
6050
+ return undefined;
6051
+ }
6052
+ const keeper = (await session.client.people()).items.find((one) => one.id === id);
6053
+ return keeper === undefined
6054
+ ? undefined
6055
+ : { called: calledOf(keeper), away: keeper.status !== "active" };
6056
+ }
5575
6057
  const workspace = async (args, io) => {
5576
6058
  const [verb, ...rest] = args;
5577
6059
  if (verb === undefined || verb.startsWith("--")) {
@@ -5579,7 +6061,47 @@ const workspace = async (args, io) => {
5579
6061
  const session = await open(io, values);
5580
6062
  const me = await session.client.me();
5581
6063
  await rememberZone(io, session, me.workspace.timeZone ?? undefined);
5582
- answer(io, session, me.workspace, () => formatWorkspace(me.workspace));
6064
+ const keeper = session.json ? undefined : await keeperOf(session, me.workspace);
6065
+ answer(io, session, me.workspace, () => formatWorkspace(me.workspace, keeper));
6066
+ return EXIT.ok;
6067
+ }
6068
+ if (verb === "pack-keeper") {
6069
+ // Who keeps the organization's skills, and the hour of their round (ADR-0178): an
6070
+ // administrator's to say, as the workspace's other settings are.
6071
+ const { values, positionals } = parse(rest, { round: { type: "string" } });
6072
+ const round = text(values, "round");
6073
+ if (positionals.length > 1 || (positionals.length === 0 && round === undefined)) {
6074
+ throw misuse(`Say who keeps the organization's skills, or the hour of their round: ${PACK_KEEPER_USAGE}`);
6075
+ }
6076
+ if (round !== undefined &&
6077
+ round !== "none" &&
6078
+ !/^(?:[01][0-9]|2[0-3]):[0-5][0-9]$/.test(round)) {
6079
+ throw misuse(`Not an hour of the day: ${round}. Say --round <HH:MM>, as 03:00, or none.`);
6080
+ }
6081
+ const session = await open(io, values);
6082
+ const [login] = positionals;
6083
+ const keeperId = login === undefined
6084
+ ? undefined
6085
+ : login === "none"
6086
+ ? null
6087
+ : (await personOf(session, login)).id;
6088
+ const changed = await session.client
6089
+ .updateWorkspace({
6090
+ ...(keeperId === undefined ? {} : { packKeeperId: keeperId }),
6091
+ ...(round === undefined ? {} : { packRoundAt: round === "none" ? null : round }),
6092
+ })
6093
+ .catch((error) => {
6094
+ // A console of before reads neither setting, and answers the change as one of nothing.
6095
+ if (error instanceof ApiError &&
6096
+ error.code === "request.invalid" &&
6097
+ error.message.startsWith("The patch names nothing to change")) {
6098
+ const version = io.consoleVersion?.();
6099
+ throw failed(`This console${version === undefined ? "" : `, ${version},`} names nobody who keeps the organization's skills yet: it is older than the command.`);
6100
+ }
6101
+ throw error;
6102
+ });
6103
+ const keeper = session.json ? undefined : await keeperOf(session, changed);
6104
+ answer(io, session, changed, () => formatWorkspace(changed, keeper));
5583
6105
  return EXIT.ok;
5584
6106
  }
5585
6107
  if (verb === "edit") {
@@ -6292,7 +6814,7 @@ function hintFor(error, io, seen) {
6292
6814
  case "category.in_use":
6293
6815
  return "Tasks are sorted into the category. Move them out first: console task edit <number> --category <other|none>\n";
6294
6816
  case "person.last_admin":
6295
- return "The board keeps at least one administrator in. Make another one first.\n";
6817
+ return "The board keeps at least one administrator in who is a person. Make another person one first.\n";
6296
6818
  case "person.of_organization":
6297
6819
  return "The organization says who is in: a person it let in comes and goes with it, and is listed by login to stay.\n";
6298
6820
  case "agent.login_is_member":