@venizia/vulcan 0.4.9-0 → 0.4.9-2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/base/extensions/vulcan-guards.ts +48 -41
- package/base/hooks/antigravity-guards.ts +2 -2
- package/base/hooks/codex-guards.ts +15 -5
- package/base/hooks/guard-git.ts +8 -8
- package/base/hooks/guard-manifest.ts +4 -5
- package/base/hooks/guard-outside.ts +8 -8
- package/base/hooks/guard-package.ts +5 -6
- package/base/hooks/guard-remote-hosts.ts +6 -7
- package/base/hooks/guard-scripting.ts +5 -6
- package/base/hooks/guard-writes.ts +8 -9
- package/base/hooks/post-tool.ts +2 -2
- package/base/hooks/prompt-submit.ts +2 -2
- package/base/hooks/session-start.ts +3 -3
- package/base/hooks/stop.ts +2 -2
- package/base/hooks/subagent-start.ts +2 -2
- package/base/skills/docs-update/SKILL.md +4 -2
- package/base/skills/visualize-work/SKILL.md +9 -0
- package/package.json +3 -3
- package/src/agents/atlas-block.ts +43 -43
- package/src/agents/codex-hooks.ts +45 -43
- package/src/agents/detect.ts +19 -16
- package/src/agents/exclude.ts +96 -97
- package/src/agents/hooks-json.ts +38 -36
- package/src/agents/local.ts +46 -43
- package/src/agents/prompt.ts +45 -42
- package/src/agents/render.ts +201 -195
- package/src/agents/resolve.ts +133 -134
- package/src/agents/table.ts +12 -8
- package/src/commands/add.command.ts +2 -2
- package/src/commands/agents.command.ts +11 -17
- package/src/commands/clean.command.ts +6 -6
- package/src/commands/doctor.command.ts +4 -4
- package/src/commands/init.command.ts +12 -8
- package/src/commands/preset.command.ts +2 -2
- package/src/commands/profile.command.ts +42 -49
- package/src/commands/sync.command.ts +109 -111
- package/src/commands/upgrade.command.ts +80 -75
- package/src/commands/visualize.command.ts +7 -13
- package/src/commands/x.command.ts +55 -50
- package/src/common/format.ts +23 -21
- package/src/common/json.ts +8 -5
- package/src/common/layout-folder.ts +94 -91
- package/src/common/paths.ts +14 -12
- package/src/config/loader.ts +52 -49
- package/src/config/packages.ts +14 -11
- package/src/config/schema.ts +3 -3
- package/src/create/add-app.ts +519 -509
- package/src/create/add-lib.ts +237 -240
- package/src/create/bunfig.ts +26 -23
- package/src/create/checks.ts +36 -34
- package/src/create/diff.ts +21 -23
- package/src/create/dockerignore.ts +26 -24
- package/src/create/files.ts +7 -5
- package/src/create/init-monorepo.ts +75 -80
- package/src/create/lib-preset.ts +59 -63
- package/src/create/manifest-json.ts +10 -4
- package/src/create/names.ts +217 -210
- package/src/create/next.ts +26 -23
- package/src/create/plan.ts +15 -12
- package/src/create/preset-diff.ts +301 -303
- package/src/create/preset-menu.ts +38 -32
- package/src/create/preset.ts +202 -197
- package/src/create/process.ts +79 -72
- package/src/create/scratch.ts +48 -49
- package/src/create/workspace.ts +404 -396
- package/src/doctor/checks.ts +1027 -1014
- package/src/doctor/makefile.ts +17 -13
- package/src/doctor/runner.ts +88 -118
- package/src/doctor/skills.ts +97 -95
- package/src/doctor/tags.ts +42 -37
- package/src/hooks/codex-patch.ts +25 -22
- package/src/hooks/command-view.ts +44 -39
- package/src/hooks/decision.ts +37 -37
- package/src/hooks/guard-git.ts +51 -49
- package/src/hooks/guard-manifest.ts +58 -55
- package/src/hooks/guard-outside.ts +93 -91
- package/src/hooks/guard-package.ts +82 -79
- package/src/hooks/guard-scripting.ts +19 -14
- package/src/hooks/guard-writes.ts +154 -149
- package/src/hooks/owner-reply.ts +127 -127
- package/src/hooks/post-tool.ts +94 -93
- package/src/hooks/project-guards.ts +65 -62
- package/src/hooks/project-tmp.ts +27 -24
- package/src/hooks/remote-hosts.ts +153 -130
- package/src/hooks/session-digest.ts +98 -101
- package/src/hooks/shell.ts +509 -499
- package/src/hooks/subagent-card.ts +11 -7
- package/src/hooks/trusted-scripts.ts +106 -104
- package/src/init/scaffold.ts +135 -132
- package/src/local/clean.ts +38 -36
- package/src/local/format.ts +21 -17
- package/src/local/scan.ts +144 -138
- package/src/manifest/render.ts +110 -104
- package/src/owner/card.ts +51 -46
- package/src/owner/profile.ts +99 -93
- package/src/owner/reply-switch.ts +9 -6
- package/src/owner/shape.ts +71 -69
- package/src/owner/survey.ts +173 -171
- package/src/owner/view.ts +62 -59
- package/src/owner/violations.ts +119 -123
- package/src/rules/base.ts +15 -11
- package/src/rules/parser.ts +39 -32
- package/src/rules/slots.ts +8 -6
- package/src/signals/claims.ts +30 -28
- package/src/signals/classify.ts +38 -33
- package/src/signals/loop.ts +39 -37
- package/src/signals/state.ts +79 -81
- package/src/skills/frontmatter.ts +28 -28
- package/src/sync/agent-files.ts +217 -199
- package/src/sync/agent-removal.ts +56 -59
- package/src/sync/atlas-block.ts +45 -43
- package/src/sync/base-rules.ts +32 -30
- package/src/sync/claude-launch.ts +36 -34
- package/src/sync/exclude.ts +77 -69
- package/src/sync/local-choice.ts +50 -47
- package/src/sync/planner.ts +59 -61
- package/src/sync/prune.ts +52 -48
- package/src/sync/settings.ts +166 -167
- package/src/ui/capability.ts +12 -7
- package/src/ui/keyboard.ts +38 -38
- package/src/ui/prompt.ts +79 -77
- package/src/visualize/assets.ts +33 -24
- package/src/visualize/charts.ts +179 -176
- package/src/visualize/compare-css.ts +3 -2
- package/src/visualize/compare-render.ts +9 -7
- package/src/visualize/diagrams.ts +189 -174
- package/src/visualize/grid-span.ts +34 -0
- package/src/visualize/icons.ts +7 -5
- package/src/visualize/kinds-render.ts +50 -45
- package/src/visualize/kinds-validate.ts +12 -10
- package/src/visualize/labels.ts +21 -17
- package/src/visualize/layout.ts +112 -97
- package/src/visualize/page.ts +92 -104
- package/src/visualize/render.ts +143 -140
- package/src/visualize/sections.ts +395 -384
- package/src/visualize/sources.ts +2 -2
- package/src/visualize/theme.ts +12 -10
- package/src/visualize/validate.ts +13 -9
- package/src/wiki/anchors.ts +38 -36
- package/src/wiki/command.ts +4 -4
- package/src/wiki/source-links.ts +46 -44
package/src/owner/shape.ts
CHANGED
|
@@ -403,92 +403,94 @@ const styleProblems = (opts: { lines: string[]; view: IOwnerView }): string[] =>
|
|
|
403
403
|
return classes;
|
|
404
404
|
};
|
|
405
405
|
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
419
|
-
|
|
420
|
-
|
|
421
|
-
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
const lines = proseLinesOf({ text });
|
|
426
|
-
const classes: string[] = [];
|
|
427
|
-
const isHeadlineOnly = view.reportDetail === OwnerDetails.HEADLINE;
|
|
428
|
-
let cursor = 0;
|
|
429
|
-
let isOutOfOrder = false;
|
|
406
|
+
export class OwnerShape {
|
|
407
|
+
/**
|
|
408
|
+
* Checks one reply to the owner against the resolved shape: a headline that is a sentence within the
|
|
409
|
+
* cap, the minimap table with the configured header and only the configured statuses, the Blocked line,
|
|
410
|
+
* the decisions list with the recommendation in each item or exactly the none string, and the order. Each
|
|
411
|
+
* section is looked for after the one before it, so a headline that begins with a label is still a
|
|
412
|
+
* headline. Pure and deterministic; what it cannot see (whether a point has a plain meaning, whether the
|
|
413
|
+
* answer is right) is for an eval or the owner. A reply under `shortReplyWords` is exempt, and a person
|
|
414
|
+
* who asked for headline-only reports is held to the headline and the style only. In the `free` label mode
|
|
415
|
+
* (a language that is not English with no label set) no word is expected: the table, a labelled blocker
|
|
416
|
+
* line and a decisions heading with a numbered list or one line are looked for, and the status words and
|
|
417
|
+
* the recommendation are not checked.
|
|
418
|
+
*/
|
|
419
|
+
static check(opts: { text: string; view: IOwnerView }): IShapeResult {
|
|
420
|
+
const { text, view } = opts;
|
|
421
|
+
|
|
422
|
+
if (text.trim() === '' || text.trim().split(/\s+/).length < view.shortReplyWords) {
|
|
423
|
+
return { isChecked: false, classes: [] };
|
|
424
|
+
}
|
|
430
425
|
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
426
|
+
const lines = proseLinesOf({ text });
|
|
427
|
+
const classes: string[] = [];
|
|
428
|
+
const isHeadlineOnly = view.reportDetail === OwnerDetails.HEADLINE;
|
|
429
|
+
let cursor = 0;
|
|
430
|
+
let isOutOfOrder = false;
|
|
434
431
|
|
|
435
|
-
|
|
436
|
-
|
|
432
|
+
for (const section of view.shape) {
|
|
433
|
+
if (section === OwnerSections.HEADLINE) {
|
|
434
|
+
const found = headlineOf({ lines, view });
|
|
437
435
|
|
|
438
|
-
|
|
439
|
-
|
|
436
|
+
classes.push(...found.problems);
|
|
437
|
+
cursor = found.end;
|
|
440
438
|
|
|
441
|
-
|
|
442
|
-
|
|
443
|
-
}
|
|
439
|
+
continue;
|
|
440
|
+
}
|
|
444
441
|
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
if (section === OwnerSections.MINIMAP) {
|
|
448
|
-
return isFree ? freeMinimapFrom({ lines, from }) : minimapFrom({ lines, view, from });
|
|
442
|
+
if (isHeadlineOnly) {
|
|
443
|
+
continue;
|
|
449
444
|
}
|
|
450
445
|
|
|
451
|
-
|
|
452
|
-
|
|
453
|
-
|
|
446
|
+
const isFree = view.labelMode === OwnerLabelModes.FREE;
|
|
447
|
+
const run = (from: number): IFound => {
|
|
448
|
+
if (section === OwnerSections.MINIMAP) {
|
|
449
|
+
return isFree ? freeMinimapFrom({ lines, from }) : minimapFrom({ lines, view, from });
|
|
454
450
|
}
|
|
455
451
|
|
|
456
|
-
|
|
452
|
+
if (section === OwnerSections.BLOCKED) {
|
|
453
|
+
if (isFree) {
|
|
454
|
+
return freeBlockedFrom({ lines, from });
|
|
455
|
+
}
|
|
457
456
|
|
|
458
|
-
|
|
459
|
-
}
|
|
457
|
+
const at = findLabelFrom({ lines, label: view.labels.labels.blocked, from });
|
|
460
458
|
|
|
461
|
-
|
|
462
|
-
|
|
463
|
-
}
|
|
459
|
+
return { at, problems: at === -1 ? [ShapeClasses.BLOCKED_MISSING] : [] };
|
|
460
|
+
}
|
|
464
461
|
|
|
465
|
-
|
|
466
|
-
|
|
467
|
-
|
|
462
|
+
if (section === OwnerSections.DECISIONS) {
|
|
463
|
+
return isFree ? freeDecisionsFrom({ lines, from }) : decisionsFrom({ lines, view, from });
|
|
464
|
+
}
|
|
468
465
|
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
466
|
+
return { at: -1, problems: [] };
|
|
467
|
+
};
|
|
468
|
+
const after = run(cursor);
|
|
472
469
|
|
|
473
|
-
|
|
474
|
-
|
|
470
|
+
if (after.at !== -1 || section === OwnerSections.DETAIL) {
|
|
471
|
+
classes.push(...after.problems);
|
|
472
|
+
cursor = after.at === -1 ? cursor : after.at + 1;
|
|
475
473
|
|
|
476
|
-
|
|
477
|
-
|
|
474
|
+
continue;
|
|
475
|
+
}
|
|
476
|
+
|
|
477
|
+
// Not after the section before it: present earlier means out of order, nowhere means missing.
|
|
478
|
+
const anywhere = run(0);
|
|
478
479
|
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
480
|
+
if (anywhere.at === -1) {
|
|
481
|
+
classes.push(...anywhere.problems);
|
|
482
|
+
} else {
|
|
483
|
+
isOutOfOrder = true;
|
|
484
|
+
classes.push(...anywhere.problems);
|
|
485
|
+
}
|
|
484
486
|
}
|
|
485
|
-
}
|
|
486
487
|
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
488
|
+
if (isOutOfOrder) {
|
|
489
|
+
classes.push(ShapeClasses.SECTION_ORDER);
|
|
490
|
+
}
|
|
490
491
|
|
|
491
|
-
|
|
492
|
+
classes.push(...styleProblems({ lines, view }));
|
|
492
493
|
|
|
493
|
-
|
|
494
|
-
}
|
|
494
|
+
return { isChecked: true, classes: [...new Set(classes)] };
|
|
495
|
+
}
|
|
496
|
+
}
|
package/src/owner/survey.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { OwnerConstants, OwnerDetails, OwnerFormalities, OwnerTones } from './constants.ts';
|
|
2
2
|
import { OWNER_LABEL_SET, PROFILE_SCHEMA } from './schema.ts';
|
|
3
|
-
import {
|
|
3
|
+
import { OwnerView } from './view.ts';
|
|
4
4
|
import type { TOwnerLabelSet, TProfile } from './schema.ts';
|
|
5
5
|
|
|
6
6
|
interface ISurveyChoice {
|
|
@@ -26,14 +26,6 @@ export interface ISurveyIo {
|
|
|
26
26
|
confirm: (opts: { message: string; initial: boolean }) => Promise<boolean | null>;
|
|
27
27
|
}
|
|
28
28
|
|
|
29
|
-
/** The language of the machine as a code (`vi` from `vi_VN.UTF-8`), or English. */
|
|
30
|
-
export const systemLanguageOf = (opts: { env: Record<string, string | undefined> }): string => {
|
|
31
|
-
const raw = opts.env.LC_ALL ?? opts.env.LC_MESSAGES ?? opts.env.LANG ?? '';
|
|
32
|
-
const code = /^([a-z]{2,3})(?:[_.@-]|$)/.exec(raw)?.[1];
|
|
33
|
-
|
|
34
|
-
return code ?? OwnerConstants.DEFAULT_LANGUAGE;
|
|
35
|
-
};
|
|
36
|
-
|
|
37
29
|
const labelProblem = (value: string): string | undefined =>
|
|
38
30
|
OwnerConstants.LABEL_PATTERN.test(value)
|
|
39
31
|
? undefined
|
|
@@ -122,178 +114,188 @@ const askLabels = async (opts: { io: ISurveyIo }): Promise<TOwnerLabelSet | null
|
|
|
122
114
|
});
|
|
123
115
|
};
|
|
124
116
|
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
* profile, or `null` when the user cancelled.
|
|
131
|
-
*/
|
|
132
|
-
export const runSurvey = async (opts: {
|
|
133
|
-
io: ISurveyIo;
|
|
134
|
-
existing?: TProfile;
|
|
135
|
-
systemLanguage: string;
|
|
136
|
-
}): Promise<TProfile | null> => {
|
|
137
|
-
const { io, existing } = opts;
|
|
138
|
-
const text = async (
|
|
139
|
-
message: string,
|
|
140
|
-
defaultValue: string,
|
|
141
|
-
validate?: (value: string) => string | undefined,
|
|
142
|
-
) => io.text({ message, defaultValue, validate });
|
|
143
|
-
/** An optional free value: a single dash clears what an earlier run set. */
|
|
144
|
-
const optional = async (
|
|
145
|
-
message: string,
|
|
146
|
-
defaultValue: string,
|
|
147
|
-
validate?: (value: string) => string | undefined,
|
|
148
|
-
) => {
|
|
149
|
-
const answer = await io.text({
|
|
150
|
-
message: defaultValue === '' ? message : `${message} (${CLEAR_ANSWER} clears it)`,
|
|
151
|
-
defaultValue,
|
|
152
|
-
validate: (value) => (value === CLEAR_ANSWER ? undefined : validate?.(value)),
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
return answer === CLEAR_ANSWER ? '' : answer;
|
|
156
|
-
};
|
|
157
|
-
const language = await text(
|
|
158
|
-
'Reply language (a code such as en, fr, pt-BR)',
|
|
159
|
-
existing?.language ?? opts.systemLanguage,
|
|
160
|
-
languageProblem,
|
|
161
|
-
);
|
|
117
|
+
export class OwnerSurvey {
|
|
118
|
+
/** The language of the machine as a code (`vi` from `vi_VN.UTF-8`), or English. */
|
|
119
|
+
static systemLanguageOf(opts: { env: Record<string, string | undefined> }): string {
|
|
120
|
+
const raw = opts.env.LC_ALL ?? opts.env.LC_MESSAGES ?? opts.env.LANG ?? '';
|
|
121
|
+
const code = /^([a-z]{2,3})(?:[_.@-]|$)/.exec(raw)?.[1];
|
|
162
122
|
|
|
163
|
-
|
|
164
|
-
return null;
|
|
123
|
+
return code ?? OwnerConstants.DEFAULT_LANGUAGE;
|
|
165
124
|
}
|
|
166
125
|
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
const reportDetail = await askingReportDetail;
|
|
209
|
-
const askingAsk =
|
|
210
|
-
reportDetail === null
|
|
211
|
-
? null
|
|
212
|
-
: io.confirm({
|
|
213
|
-
message:
|
|
214
|
-
'For a choice that can be undone, ask you first? (no: state a default and continue)',
|
|
215
|
-
initial: existing?.habits.askBeforeReversible ?? false,
|
|
216
|
-
});
|
|
217
|
-
const ask = await askingAsk;
|
|
218
|
-
const askingCommits =
|
|
219
|
-
ask === null
|
|
220
|
-
? null
|
|
221
|
-
: io.confirm({
|
|
222
|
-
message: 'Propose commits when a piece of work is done?',
|
|
223
|
-
initial: existing?.habits.proposeCommits ?? false,
|
|
224
|
-
});
|
|
225
|
-
const commits = await askingCommits;
|
|
226
|
-
const askingAbout =
|
|
227
|
-
commits === null
|
|
228
|
-
? null
|
|
229
|
-
: optional(
|
|
230
|
-
'Anything about how you like to work, or to be worked with? (your own words, optional)',
|
|
231
|
-
existing?.about ?? '',
|
|
232
|
-
aboutProblem,
|
|
233
|
-
);
|
|
234
|
-
const about = await askingAbout;
|
|
235
|
-
const askingCodeTaste =
|
|
236
|
-
about === null
|
|
237
|
-
? null
|
|
238
|
-
: optional(
|
|
239
|
-
'Taste in code that no formatter or lint rule already enforces? (optional)',
|
|
240
|
-
existing?.codeTaste ?? '',
|
|
241
|
-
codeTasteProblem,
|
|
242
|
-
);
|
|
243
|
-
const codeTaste = await askingCodeTaste;
|
|
244
|
-
|
|
245
|
-
if (
|
|
246
|
-
[you, self, formality, tone, reportDetail, ask, commits, about, codeTaste].some(
|
|
247
|
-
(answer) => answer === null,
|
|
248
|
-
)
|
|
249
|
-
) {
|
|
250
|
-
return null;
|
|
251
|
-
}
|
|
252
|
-
|
|
253
|
-
const labels: Record<string, TOwnerLabelSet> = { ...existing?.labels };
|
|
254
|
-
|
|
255
|
-
if (!isEnglishLanguage({ language }) && !(language in labels)) {
|
|
256
|
-
const typed = await io.select({
|
|
257
|
-
message: `Words for reports in ${language}: no set ships. Let the agent write them in ${language} (only the structure is checked), or type them now?`,
|
|
258
|
-
choices: [
|
|
259
|
-
{ value: 'keep', label: `let the agent write them in ${language}` },
|
|
260
|
-
{ value: 'type', label: 'type them now' },
|
|
261
|
-
],
|
|
262
|
-
initial: 'keep',
|
|
263
|
-
});
|
|
126
|
+
/**
|
|
127
|
+
* The questions, in order, each with a default taken on an empty answer and each skippable: the
|
|
128
|
+
* reply language, how to address the person, tone, report detail, working habits, a free line in their
|
|
129
|
+
* words and code taste, and - for a language that is not English - whether to type the words for the report or let the agent write them. Nothing is
|
|
130
|
+
* inferred from the answers. `existing` supplies the defaults when the form is run again. Returns the
|
|
131
|
+
* profile, or `null` when the user cancelled.
|
|
132
|
+
*/
|
|
133
|
+
static async run(opts: {
|
|
134
|
+
io: ISurveyIo;
|
|
135
|
+
existing?: TProfile;
|
|
136
|
+
systemLanguage: string;
|
|
137
|
+
}): Promise<TProfile | null> {
|
|
138
|
+
const { io, existing } = opts;
|
|
139
|
+
const text = async (
|
|
140
|
+
message: string,
|
|
141
|
+
defaultValue: string,
|
|
142
|
+
validate?: (value: string) => string | undefined,
|
|
143
|
+
) => io.text({ message, defaultValue, validate });
|
|
144
|
+
/** An optional free value: a single dash clears what an earlier run set. */
|
|
145
|
+
const optional = async (
|
|
146
|
+
message: string,
|
|
147
|
+
defaultValue: string,
|
|
148
|
+
validate?: (value: string) => string | undefined,
|
|
149
|
+
) => {
|
|
150
|
+
const answer = await io.text({
|
|
151
|
+
message: defaultValue === '' ? message : `${message} (${CLEAR_ANSWER} clears it)`,
|
|
152
|
+
defaultValue,
|
|
153
|
+
validate: (value) => (value === CLEAR_ANSWER ? undefined : validate?.(value)),
|
|
154
|
+
});
|
|
155
|
+
|
|
156
|
+
return answer === CLEAR_ANSWER ? '' : answer;
|
|
157
|
+
};
|
|
158
|
+
const language = await text(
|
|
159
|
+
'Reply language (a code such as en, fr, pt-BR)',
|
|
160
|
+
existing?.language ?? opts.systemLanguage,
|
|
161
|
+
languageProblem,
|
|
162
|
+
);
|
|
163
|
+
|
|
164
|
+
if (language === null) {
|
|
165
|
+
return null;
|
|
166
|
+
}
|
|
264
167
|
|
|
265
|
-
|
|
168
|
+
const you = await optional(
|
|
169
|
+
'How should I address you? (a name, a pronoun, an honorific, or leave empty for none)',
|
|
170
|
+
existing?.address.you ?? '',
|
|
171
|
+
optionalLabelProblem,
|
|
172
|
+
);
|
|
173
|
+
// Each question is asked only when the one before it was answered.
|
|
174
|
+
const askingSelf =
|
|
175
|
+
you === null
|
|
176
|
+
? null
|
|
177
|
+
: optional(
|
|
178
|
+
'How should I refer to myself? (leave empty for neutral)',
|
|
179
|
+
existing?.address.self ?? '',
|
|
180
|
+
optionalLabelProblem,
|
|
181
|
+
);
|
|
182
|
+
const self = await askingSelf;
|
|
183
|
+
const askingFormality =
|
|
184
|
+
self === null
|
|
185
|
+
? null
|
|
186
|
+
: io.select({
|
|
187
|
+
message: 'How formal should I be?',
|
|
188
|
+
choices: choicesOf({ set: OwnerFormalities.SCHEME_SET }),
|
|
189
|
+
initial: existing?.address.formality ?? OwnerFormalities.NEUTRAL,
|
|
190
|
+
});
|
|
191
|
+
const formality = await askingFormality;
|
|
192
|
+
const askingTone =
|
|
193
|
+
formality === null
|
|
194
|
+
? null
|
|
195
|
+
: io.select({
|
|
196
|
+
message: 'Tone',
|
|
197
|
+
choices: choicesOf({ set: OwnerTones.SCHEME_SET }),
|
|
198
|
+
initial: existing?.tone ?? OwnerTones.NEUTRAL,
|
|
199
|
+
});
|
|
200
|
+
const tone = await askingTone;
|
|
201
|
+
const askingReportDetail =
|
|
202
|
+
tone === null
|
|
203
|
+
? null
|
|
204
|
+
: io.select({
|
|
205
|
+
message: 'Reports: headline only, or headline plus tables?',
|
|
206
|
+
choices: choicesOf({ set: OwnerDetails.SCHEME_SET }),
|
|
207
|
+
initial: existing?.reportDetail ?? OwnerDetails.TABLES,
|
|
208
|
+
});
|
|
209
|
+
const reportDetail = await askingReportDetail;
|
|
210
|
+
const askingAsk =
|
|
211
|
+
reportDetail === null
|
|
212
|
+
? null
|
|
213
|
+
: io.confirm({
|
|
214
|
+
message:
|
|
215
|
+
'For a choice that can be undone, ask you first? (no: state a default and continue)',
|
|
216
|
+
initial: existing?.habits.askBeforeReversible ?? false,
|
|
217
|
+
});
|
|
218
|
+
const ask = await askingAsk;
|
|
219
|
+
const askingCommits =
|
|
220
|
+
ask === null
|
|
221
|
+
? null
|
|
222
|
+
: io.confirm({
|
|
223
|
+
message: 'Propose commits when a piece of work is done?',
|
|
224
|
+
initial: existing?.habits.proposeCommits ?? false,
|
|
225
|
+
});
|
|
226
|
+
const commits = await askingCommits;
|
|
227
|
+
const askingAbout =
|
|
228
|
+
commits === null
|
|
229
|
+
? null
|
|
230
|
+
: optional(
|
|
231
|
+
'Anything about how you like to work, or to be worked with? (your own words, optional)',
|
|
232
|
+
existing?.about ?? '',
|
|
233
|
+
aboutProblem,
|
|
234
|
+
);
|
|
235
|
+
const about = await askingAbout;
|
|
236
|
+
const askingCodeTaste =
|
|
237
|
+
about === null
|
|
238
|
+
? null
|
|
239
|
+
: optional(
|
|
240
|
+
'Taste in code that no formatter or lint rule already enforces? (optional)',
|
|
241
|
+
existing?.codeTaste ?? '',
|
|
242
|
+
codeTasteProblem,
|
|
243
|
+
);
|
|
244
|
+
const codeTaste = await askingCodeTaste;
|
|
245
|
+
|
|
246
|
+
if (
|
|
247
|
+
[you, self, formality, tone, reportDetail, ask, commits, about, codeTaste].some(
|
|
248
|
+
(answer) => answer === null,
|
|
249
|
+
)
|
|
250
|
+
) {
|
|
266
251
|
return null;
|
|
267
252
|
}
|
|
268
253
|
|
|
269
|
-
|
|
270
|
-
|
|
254
|
+
const labels: Record<string, TOwnerLabelSet> = { ...existing?.labels };
|
|
255
|
+
|
|
256
|
+
if (!OwnerView.isEnglishLanguage({ language }) && !(language in labels)) {
|
|
257
|
+
const typed = await io.select({
|
|
258
|
+
message: `Words for reports in ${language}: no set ships. Let the agent write them in ${language} (only the structure is checked), or type them now?`,
|
|
259
|
+
choices: [
|
|
260
|
+
{ value: 'keep', label: `let the agent write them in ${language}` },
|
|
261
|
+
{ value: 'type', label: 'type them now' },
|
|
262
|
+
],
|
|
263
|
+
initial: 'keep',
|
|
264
|
+
});
|
|
271
265
|
|
|
272
|
-
if (
|
|
266
|
+
if (typed === null) {
|
|
273
267
|
return null;
|
|
274
268
|
}
|
|
275
269
|
|
|
276
|
-
|
|
270
|
+
if (typed === 'type') {
|
|
271
|
+
const set = await askLabels({ io });
|
|
272
|
+
|
|
273
|
+
if (set === null) {
|
|
274
|
+
return null;
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
labels[language] = set;
|
|
278
|
+
}
|
|
277
279
|
}
|
|
278
|
-
}
|
|
279
280
|
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
}
|
|
281
|
+
return PROFILE_SCHEMA.parse({
|
|
282
|
+
schemaVersion: OwnerConstants.PROFILE_SCHEMA_VERSION,
|
|
283
|
+
language,
|
|
284
|
+
address: {
|
|
285
|
+
...(you === '' || you === null ? {} : { you }),
|
|
286
|
+
...(self === '' || self === null ? {} : { self }),
|
|
287
|
+
formality,
|
|
288
|
+
},
|
|
289
|
+
tone,
|
|
290
|
+
reportDetail,
|
|
291
|
+
habits: { askBeforeReversible: ask, proposeCommits: commits },
|
|
292
|
+
...(about === '' || about === null ? {} : { about }),
|
|
293
|
+
...(codeTaste === '' || codeTaste === null ? {} : { codeTaste }),
|
|
294
|
+
...(existing?.enforce === undefined ? {} : { enforce: existing.enforce }),
|
|
295
|
+
...(existing?.shortReplyWords === undefined
|
|
296
|
+
? {}
|
|
297
|
+
: { shortReplyWords: existing.shortReplyWords }),
|
|
298
|
+
labels,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
}
|