@tablation/crew 0.160.0 → 0.162.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.js +248 -21
- package/package.json +1 -1
- package/prompts/default/skills/crew-lane-agent.md +23 -0
- package/prompts/default/skills/question-and-investigation.md +4 -0
- package/prompts/dev-qa/skills/crew-lane-agent.md +23 -0
- package/prompts/dev-qa/skills/question-and-investigation.md +4 -0
package/dist/cli.js
CHANGED
|
@@ -4589,6 +4589,8 @@ function parseResolved(raw, m, where) {
|
|
|
4589
4589
|
epicsModelId: raw.epicsModelId,
|
|
4590
4590
|
mapsModelId: raw.mapsModelId,
|
|
4591
4591
|
periscopesModelId: raw.periscopesModelId,
|
|
4592
|
+
questionsModelId: raw.questionsModelId,
|
|
4593
|
+
answersModelId: raw.answersModelId,
|
|
4592
4594
|
locksModelId: raw.locksModelId,
|
|
4593
4595
|
recordLinkViewId: raw.recordLinkViewId,
|
|
4594
4596
|
reposModelId: raw.reposModelId,
|
|
@@ -8406,10 +8408,10 @@ var SEAT_WRITE_ISSUE_FIELDS = [
|
|
|
8406
8408
|
"cost_usd"
|
|
8407
8409
|
];
|
|
8408
8410
|
var canWrite = (level) => level === "WRITE" || level === "DELETE";
|
|
8409
|
-
function refusedIssueFields(body,
|
|
8411
|
+
function refusedIssueFields(body, columns2 = SEAT_WRITE_ISSUE_FIELDS) {
|
|
8410
8412
|
const fields = body?.fields;
|
|
8411
8413
|
if (!fields || typeof fields !== "object") return [];
|
|
8412
|
-
return
|
|
8414
|
+
return columns2.filter((c) => c in fields && !canWrite(fields[c]));
|
|
8413
8415
|
}
|
|
8414
8416
|
async function getJson(url, apiKey, o) {
|
|
8415
8417
|
const res = await (o.fetchImpl ?? fetch)(url, {
|
|
@@ -9084,7 +9086,9 @@ var TABLE_ENTRIES = [
|
|
|
9084
9086
|
{ role: "epics", defaultName: "Epics", label: "Epics table", optional: true, whatBreaks: "Without it tickets cannot belong to an epic." },
|
|
9085
9087
|
{ role: "maps", defaultName: "Maps", label: "Maps table", optional: true, whatBreaks: "Without it a ticket cannot cite its epic\u2019s planning document." },
|
|
9086
9088
|
{ role: "periscopes", defaultName: "Periscopes", label: "Periscopes table", optional: true, whatBreaks: "Without it crew cannot host live previews." },
|
|
9087
|
-
{ role: "locks", defaultName: "Locks", label: "Locks table", optional: true, whatBreaks: "Without it ships cannot take the release lock through the board." }
|
|
9089
|
+
{ role: "locks", defaultName: "Locks", label: "Locks table", optional: true, whatBreaks: "Without it ships cannot take the release lock through the board." },
|
|
9090
|
+
{ role: "questions", defaultName: "Questions", label: "Questions table", optional: true, whatBreaks: "Without it a seat that parks a ticket for an answer cannot also ask the question as a record with proposed answers; the comment still carries it." },
|
|
9091
|
+
{ role: "answers", defaultName: "Answers", label: "Answers table", optional: true, whatBreaks: "Without it a question cannot offer proposed answers." }
|
|
9088
9092
|
];
|
|
9089
9093
|
function f(table2, name, contractPath, defaultColumn, kind, label, whatBreaks, extra = {}) {
|
|
9090
9094
|
return { role: `${table2}.${name}`, table: table2, contractPath, defaultColumn, kind, label, whatBreaks, ...extra };
|
|
@@ -9124,6 +9128,8 @@ var FIELD_ENTRIES = [
|
|
|
9124
9128
|
f("issues", "cacheWriteTokens", "columns.cacheWriteTokens", "cache_write_tokens", "number", "Cache write tokens", "Without it per-ticket token spend is not kept.", opt),
|
|
9125
9129
|
f("issues", "costUsd", "columns.costUsd", "cost_usd", "number", "Cost (USD)", "Without it per-ticket spend is not kept.", opt),
|
|
9126
9130
|
f("issues", "crewAssisted", "columns.crewAssisted", "crew_assisted", "boolean", "Crew assisted", "Without it tickets the crew worked are not marked.", opt),
|
|
9131
|
+
f("issues", "description", "columns.description", "description", "text", "Description", "Without it the platform cannot tell its own setup tickets from a first ticket, and cannot write one.", opt),
|
|
9132
|
+
f("issues", "needsPlanning", "columns.needsPlanning", "needs_planning", "boolean", "Needs planning", "Without it the platform counts every ticket in a demand status as plannable, including ones a person still owes scoping.", opt),
|
|
9127
9133
|
f("projects", "workMode", "columns.workMode", "work_mode", "choice", "Work mode", "Without it every project is worked automatically.", opt),
|
|
9128
9134
|
f("comments", "parent", "comments.parent", "ticket_id", "link", "Comment ticket", "Without it a comment cannot be tied to its ticket."),
|
|
9129
9135
|
f("comments", "body", "comments.body", "body", "text", "Comment body", "Without it a comment has no text."),
|
|
@@ -9132,6 +9138,32 @@ var FIELD_ENTRIES = [
|
|
|
9132
9138
|
f("comments", "ship", "comments.ship", "ship_id", "link", "Posted from ship", "Without it a comment does not name the machine that posted it.", opt),
|
|
9133
9139
|
f("comments", "publicReply", "comments.publicReply", "is_public_reply", "boolean", "Public reply", "Without it replies from a public form are read as the team\u2019s.", opt),
|
|
9134
9140
|
f("comments", "authorName", "comments.authorName", "author_name", "text", "Public author name", "Without it a public reporter\u2019s name is lost.", opt),
|
|
9141
|
+
// Read by the platform's scheduler, project setup checklist and repository
|
|
9142
|
+
// pages (interface 1.2, CREW-3633). All optional: the platform reports a role
|
|
9143
|
+
// it needs but the app did not map as 'not ready' with that reason.
|
|
9144
|
+
f("repos", "name", "repos.name", "name", "text", "Repository name", "Without it a repository has no short name to show or route by.", opt),
|
|
9145
|
+
f("repos", "remote", "repos.remote", "remote", "text", "Repository remote", "Without it the platform cannot tell which `owner/name` a repository is.", opt),
|
|
9146
|
+
f("repos", "enabled", "repos.enabled", "enabled", "boolean", "Repository enabled", "Without it the platform cannot tell a repository crew works from one it has switched off.", opt),
|
|
9147
|
+
f("repos", "ciProvider", "repos.ciProvider", "ci_provider", "any", "CI provider", "Without it the platform cannot tell which CI system a repository uses (a text or choice field).", opt),
|
|
9148
|
+
f("repos", "appUrl", "repos.appUrl", "app_url", "text", "App URL", "Without it the setup checklist has no link to where the app is served.", opt),
|
|
9149
|
+
f("repos", "project", "repos.project", "project_id", "link", "Repository project", "Without it setup tickets cannot tell which project a repository belongs to.", { ...opt, linkTo: "projects" }),
|
|
9150
|
+
f("crew", "userId", "crew.userId", "user_id", "any", "Workspace membership", "Without it the platform cannot find the adding member\u2019s seat (the field holds the workspace membership id of the person the seat is).", opt),
|
|
9151
|
+
// The optional questions part (interface 1.1, CREW-3588). The shapes are the
|
|
9152
|
+
// ones the platform's Record choices requirement asks of its questions and
|
|
9153
|
+
// answers tables; `questionsPartMapped` says when a mapping carries enough of
|
|
9154
|
+
// them for crew to write a question. Each role is optional here because the
|
|
9155
|
+
// whole part is: an app that maps none of it still conforms.
|
|
9156
|
+
f("questions", "parent", "questions.parent", "ticket_id", "link", "Question ticket", "Without it a question cannot be tied to the ticket it is about, so crew writes none.", { ...opt, linkTo: "issues" }),
|
|
9157
|
+
f("questions", "text", "questions.text", "question", "text", "Question text", "Without it a question has no words.", opt),
|
|
9158
|
+
f("questions", "status", "questions.status", "status", "choice", "Question status", "Without it crew cannot tell an open question from an answered or withdrawn one.", opt),
|
|
9159
|
+
f("questions", "askedBy", "questions.askedBy", "asked_by_id", "link", "Asked by", "Without it a question does not say which seat asked it, so crew cannot withdraw its own earlier question.", opt),
|
|
9160
|
+
f("questions", "addressedTo", "questions.addressedTo", "addressed_to_id", "link", "Addressed to", "Without it a question does not say who it is waiting on.", opt),
|
|
9161
|
+
f("questions", "answeredBy", "questions.answeredBy", "answered_by_id", "link", "Answered by", "Without it an answered question does not say who answered.", opt),
|
|
9162
|
+
f("questions", "chosenAnswer", "questions.chosenAnswer", "chosen_answer_id", "link", "Chosen answer", "Without it an answered question does not say which answer was chosen.", { ...opt, linkTo: "answers" }),
|
|
9163
|
+
f("answers", "question", "answers.question", "question_id", "link", "Answer question", "Without it an answer cannot be tied to its question, so crew offers none.", { ...opt, linkTo: "questions" }),
|
|
9164
|
+
f("answers", "label", "answers.label", "label", "text", "Answer label", "Without it an answer has no short label to show on a button.", opt),
|
|
9165
|
+
f("answers", "detail", "answers.detail", "detail", "text", "Answer detail", "Without it an answer has no full instruction to act on when chosen.", opt),
|
|
9166
|
+
f("answers", "order", "answers.order", "position", "number", "Answer order", "Without it the answers show in the order they were created, not the order the seat intended.", opt),
|
|
9135
9167
|
f("epics", "status", "epics.statusColumn", "status", "choice", "Epic status", "Without it crew cannot keep an epic\u2019s status from its tickets.", opt),
|
|
9136
9168
|
f("epics", "key", "epics.keyColumn", "epic_id", "any", "Epic key", "Without it an epic has no name in the log.", opt),
|
|
9137
9169
|
f("maps", "epic", "maps.epicColumn", "epic_id", "link", "Map epic", "Without it a Map cannot be matched to its epic.", opt),
|
|
@@ -9158,6 +9190,11 @@ var STATUS_MEANINGS = [
|
|
|
9158
9190
|
{ id: "cantReproduce", label: "Can\u2019t reproduce", defaultValue: "closed_cant_reproduce", open: false, resolved: true, meaning: "Closed as written, unreproducible." },
|
|
9159
9191
|
{ id: "draft", label: "Draft", defaultValue: "draft", contractKey: "draft", open: false, resolved: false, optional: true, meaning: "Held back; never polled." }
|
|
9160
9192
|
];
|
|
9193
|
+
var QUESTION_STATUS_MEANINGS = [
|
|
9194
|
+
{ id: "open", label: "Open", defaultValue: "open", meaning: "Waiting for a person to answer." },
|
|
9195
|
+
{ id: "answered", label: "Answered", defaultValue: "answered", meaning: "A person chose an answer or replied in writing." },
|
|
9196
|
+
{ id: "withdrawn", label: "Withdrawn", defaultValue: "withdrawn", meaning: "The asker took it back, usually because it asked again on the same ticket." }
|
|
9197
|
+
];
|
|
9161
9198
|
function defaultGroup(group) {
|
|
9162
9199
|
const out = {};
|
|
9163
9200
|
for (const e of FIELD_ENTRIES) {
|
|
@@ -9166,6 +9203,10 @@ function defaultGroup(group) {
|
|
|
9166
9203
|
}
|
|
9167
9204
|
return out;
|
|
9168
9205
|
}
|
|
9206
|
+
function defaultQuestionStatuses() {
|
|
9207
|
+
const v = (id) => QUESTION_STATUS_MEANINGS.find((q2) => q2.id === id).defaultValue;
|
|
9208
|
+
return { open: v("open"), answered: v("answered"), withdrawn: v("withdrawn") };
|
|
9209
|
+
}
|
|
9169
9210
|
function defaultStatusValues() {
|
|
9170
9211
|
const open2 = STATUS_MEANINGS.filter((s) => s.open && s.defaultValue).map((s) => s.defaultValue);
|
|
9171
9212
|
const resolved = STATUS_MEANINGS.filter((s) => s.resolved && s.defaultValue).map((s) => s.defaultValue);
|
|
@@ -9187,11 +9228,23 @@ function sideToUpdate(v) {
|
|
|
9187
9228
|
}
|
|
9188
9229
|
function contractFromMapping(base, mapping) {
|
|
9189
9230
|
const next = structuredClone(base);
|
|
9190
|
-
const groups = {
|
|
9231
|
+
const groups = {
|
|
9232
|
+
columns: next.columns,
|
|
9233
|
+
comments: next.comments,
|
|
9234
|
+
epics: next.epics,
|
|
9235
|
+
maps: next.maps,
|
|
9236
|
+
questions: next.questions,
|
|
9237
|
+
answers: next.answers,
|
|
9238
|
+
repos: next.repos,
|
|
9239
|
+
crew: next.crew
|
|
9240
|
+
};
|
|
9191
9241
|
for (const e of FIELD_ENTRIES) {
|
|
9192
9242
|
const col = mapping.fields[e.role];
|
|
9193
|
-
if (!col) continue;
|
|
9194
9243
|
const [group, key] = e.contractPath.split(".");
|
|
9244
|
+
if (!col) {
|
|
9245
|
+
if (group === "questions" || group === "answers") Object.assign(groups[group], { [key]: "" });
|
|
9246
|
+
continue;
|
|
9247
|
+
}
|
|
9195
9248
|
Object.assign(groups[group], { [key]: col });
|
|
9196
9249
|
}
|
|
9197
9250
|
const mapped = mapping.values?.["status"] ?? {};
|
|
@@ -9206,11 +9259,27 @@ function contractFromMapping(base, mapping) {
|
|
|
9206
9259
|
}
|
|
9207
9260
|
next.statuses.open = open2;
|
|
9208
9261
|
next.statuses.resolved = resolved;
|
|
9262
|
+
const questionValues = mapping.values?.["questionStatus"] ?? {};
|
|
9263
|
+
for (const q2 of QUESTION_STATUS_MEANINGS) {
|
|
9264
|
+
Object.assign(next.questionStatuses, { [q2.id]: questionValues[q2.id] ?? q2.defaultValue });
|
|
9265
|
+
}
|
|
9209
9266
|
return next;
|
|
9210
9267
|
}
|
|
9211
9268
|
function mappedTableName(mapping, role) {
|
|
9212
9269
|
return mapping.tables?.[role];
|
|
9213
9270
|
}
|
|
9271
|
+
var QUESTIONS_PART_ROLES = [
|
|
9272
|
+
"questions.parent",
|
|
9273
|
+
"questions.text",
|
|
9274
|
+
"questions.status",
|
|
9275
|
+
"questions.askedBy",
|
|
9276
|
+
"answers.question",
|
|
9277
|
+
"answers.label",
|
|
9278
|
+
"answers.detail"
|
|
9279
|
+
];
|
|
9280
|
+
function questionsPartMapped(mapping) {
|
|
9281
|
+
return !!mapping.tables?.["questions"] && !!mapping.tables?.["answers"] && QUESTIONS_PART_ROLES.every((r) => !!mapping.fields?.[r]);
|
|
9282
|
+
}
|
|
9214
9283
|
function describeShape(roleId) {
|
|
9215
9284
|
const t = TABLE_ENTRIES.find((x) => x.role === roleId);
|
|
9216
9285
|
if (t) return "a table";
|
|
@@ -9252,6 +9321,11 @@ var DEFAULT_CONTRACT = {
|
|
|
9252
9321
|
statuses: { planned: "planned", building: "in_progress", done: "done", cancelled: "cancelled" }
|
|
9253
9322
|
},
|
|
9254
9323
|
maps: { ...MAP_DEFAULTS, activeStatus: "active" },
|
|
9324
|
+
questions: defaultGroup("questions"),
|
|
9325
|
+
answers: defaultGroup("answers"),
|
|
9326
|
+
repos: defaultGroup("repos"),
|
|
9327
|
+
crew: defaultGroup("crew"),
|
|
9328
|
+
questionStatuses: defaultQuestionStatuses(),
|
|
9255
9329
|
priorityOrder: ["p0", "p1", "p2", "p3"],
|
|
9256
9330
|
severityOrder: ["s1", "s2", "s3", "s4"],
|
|
9257
9331
|
unknownPriorityRank: 2,
|
|
@@ -9275,6 +9349,11 @@ function resolveContract(override) {
|
|
|
9275
9349
|
statuses: { ...DEFAULT_CONTRACT.epics.statuses, ...override.epics?.statuses }
|
|
9276
9350
|
},
|
|
9277
9351
|
maps: { ...DEFAULT_CONTRACT.maps, ...override.maps },
|
|
9352
|
+
questions: { ...DEFAULT_CONTRACT.questions, ...override.questions },
|
|
9353
|
+
answers: { ...DEFAULT_CONTRACT.answers, ...override.answers },
|
|
9354
|
+
repos: { ...DEFAULT_CONTRACT.repos, ...override.repos },
|
|
9355
|
+
crew: { ...DEFAULT_CONTRACT.crew, ...override.crew },
|
|
9356
|
+
questionStatuses: { ...DEFAULT_CONTRACT.questionStatuses, ...override.questionStatuses },
|
|
9278
9357
|
priorityOrder: override.priorityOrder ?? DEFAULT_CONTRACT.priorityOrder,
|
|
9279
9358
|
severityOrder: override.severityOrder ?? DEFAULT_CONTRACT.severityOrder,
|
|
9280
9359
|
unknownPriorityRank: override.unknownPriorityRank ?? DEFAULT_CONTRACT.unknownPriorityRank,
|
|
@@ -10289,6 +10368,33 @@ var Tracker = class _Tracker {
|
|
|
10289
10368
|
if (res.status === 404) throw new ConfigError(EVENT_LOG_MISSING);
|
|
10290
10369
|
if (!res.ok) throw new Error(`posting a ${type} event failed: HTTP ${res.status}${await refusalReason(res)}`);
|
|
10291
10370
|
}
|
|
10371
|
+
/**
|
|
10372
|
+
* The questions part's tables when this route's app maps it (interface 1.1,
|
|
10373
|
+
* CREW-3588), else null: an app at 1.0, an undeclared app, or a mapping that
|
|
10374
|
+
* leaves a table out. Nothing is written for a null.
|
|
10375
|
+
*/
|
|
10376
|
+
questionsPart() {
|
|
10377
|
+
const r = this.route.resolved;
|
|
10378
|
+
return r?.questionsModelId && r.answersModelId ? { questionsModelId: r.questionsModelId, answersModelId: r.answersModelId } : null;
|
|
10379
|
+
}
|
|
10380
|
+
/** The seat's own open questions on a ticket (its askedBy, never a person's). */
|
|
10381
|
+
async listOpenQuestions(part, ticketId, askedBy) {
|
|
10382
|
+
const q2 = this.contract.questions;
|
|
10383
|
+
return this.client.records.list(part.questionsModelId, {
|
|
10384
|
+
filters: encodeFilters([
|
|
10385
|
+
{ columnName: q2.parent, operator: "EQ", value: ticketId },
|
|
10386
|
+
{ columnName: q2.status, operator: "EQ", value: this.contract.questionStatuses.open },
|
|
10387
|
+
{ columnName: q2.askedBy, operator: "EQ", value: askedBy }
|
|
10388
|
+
]),
|
|
10389
|
+
limit: 100
|
|
10390
|
+
});
|
|
10391
|
+
}
|
|
10392
|
+
async updateRecord(modelId, id, fields) {
|
|
10393
|
+
await this.client.records.update(modelId, id, fields);
|
|
10394
|
+
}
|
|
10395
|
+
async createRecord(modelId, fields) {
|
|
10396
|
+
return this.client.records.create(modelId, fields);
|
|
10397
|
+
}
|
|
10292
10398
|
/** A ticket comment under a seat's identity (CREW-2363: the replayed hand-off comment). */
|
|
10293
10399
|
async postComment(ticketId, body, memberId) {
|
|
10294
10400
|
const auth = await this.authorshipProbe();
|
|
@@ -10649,11 +10755,11 @@ var Tracker = class _Tracker {
|
|
|
10649
10755
|
[this.route.resolved?.shipsModelId, "Ships", ["kind", "instance_class", "relay_url"]]
|
|
10650
10756
|
];
|
|
10651
10757
|
const missing = [];
|
|
10652
|
-
for (const [modelId, label,
|
|
10758
|
+
for (const [modelId, label, columns2] of wanted) {
|
|
10653
10759
|
if (!modelId) continue;
|
|
10654
10760
|
const have = await this.columnNames(modelId);
|
|
10655
10761
|
if (have.size === 0) continue;
|
|
10656
|
-
for (const c of
|
|
10762
|
+
for (const c of columns2) if (!have.has(c)) missing.push(`${label}.${c}`);
|
|
10657
10763
|
}
|
|
10658
10764
|
return missing;
|
|
10659
10765
|
}
|
|
@@ -14546,7 +14652,7 @@ function planAgentRun(o) {
|
|
|
14546
14652
|
// resolved yet has nothing to authenticate the MCP connection with either.
|
|
14547
14653
|
mcp: o.apiKey ? { url: `${o.route.baseUrl}/api/mcp`, keyVar: API_KEY_VAR } : void 0
|
|
14548
14654
|
});
|
|
14549
|
-
const
|
|
14655
|
+
const columns2 = resolveContract(o.route.contract).columns;
|
|
14550
14656
|
const agentLog = o.route.resolved && o.apiKey ? {
|
|
14551
14657
|
baseUrl: o.route.baseUrl,
|
|
14552
14658
|
workspaceId: o.route.resolved.workspaceId,
|
|
@@ -14556,15 +14662,15 @@ function planAgentRun(o) {
|
|
|
14556
14662
|
...o.route.resolved.models?.crew && o.route.resolved.seats?.[o.role] ? { actor: { table: o.route.resolved.models.crew, recordId: o.route.resolved.seats[o.role] } } : {},
|
|
14557
14663
|
...o.route.resolved.models?.issues ? { tickets: {
|
|
14558
14664
|
issuesModelId: o.route.resolved.models.issues,
|
|
14559
|
-
keyColumn:
|
|
14560
|
-
tagColumn:
|
|
14665
|
+
keyColumn: columns2.key,
|
|
14666
|
+
tagColumn: columns2.tag,
|
|
14561
14667
|
counters: {
|
|
14562
|
-
agentRuns:
|
|
14563
|
-
tokensIn:
|
|
14564
|
-
tokensOut:
|
|
14565
|
-
cacheReadTokens:
|
|
14566
|
-
cacheWriteTokens:
|
|
14567
|
-
costUsd:
|
|
14668
|
+
agentRuns: columns2.agentRuns,
|
|
14669
|
+
tokensIn: columns2.tokensIn,
|
|
14670
|
+
tokensOut: columns2.tokensOut,
|
|
14671
|
+
cacheReadTokens: columns2.cacheReadTokens,
|
|
14672
|
+
cacheWriteTokens: columns2.cacheWriteTokens,
|
|
14673
|
+
costUsd: columns2.costUsd
|
|
14568
14674
|
}
|
|
14569
14675
|
} } : {}
|
|
14570
14676
|
} : void 0;
|
|
@@ -16952,7 +17058,10 @@ var VALUE_FLAGS = /* @__PURE__ */ new Set([
|
|
|
16952
17058
|
"requested-by",
|
|
16953
17059
|
"issue",
|
|
16954
17060
|
"shell",
|
|
16955
|
-
"resume"
|
|
17061
|
+
"resume",
|
|
17062
|
+
"question",
|
|
17063
|
+
"answer",
|
|
17064
|
+
"to"
|
|
16956
17065
|
]);
|
|
16957
17066
|
function positionalArgs(argv2) {
|
|
16958
17067
|
const out = [];
|
|
@@ -21901,7 +22010,7 @@ async function runReview(r, verified, reviewing) {
|
|
|
21901
22010
|
}
|
|
21902
22011
|
return out;
|
|
21903
22012
|
}
|
|
21904
|
-
async function applyReview(tracker, contract, outcome, remote, emit, seat,
|
|
22013
|
+
async function applyReview(tracker, contract, outcome, remote, emit, seat, columns2, dryRun) {
|
|
21905
22014
|
const reviewing = contract.statuses.reviewing;
|
|
21906
22015
|
for (const h of outcome.handoffs) {
|
|
21907
22016
|
if (!reviewing) break;
|
|
@@ -21920,8 +22029,8 @@ ${h.prFailure.tail}
|
|
|
21920
22029
|
try {
|
|
21921
22030
|
await tracker.updateTicket(t.id, {
|
|
21922
22031
|
[contract.columns.status]: reviewing,
|
|
21923
|
-
...h.prRef &&
|
|
21924
|
-
...h.prUrl &&
|
|
22032
|
+
...h.prRef && columns2.prRef ? { [contract.columns.prRef]: h.prRef } : {},
|
|
22033
|
+
...h.prUrl && columns2.prUrl ? { [contract.columns.prUrl]: h.prUrl } : {}
|
|
21925
22034
|
}, t.updated_at);
|
|
21926
22035
|
await tracker.postEvent(t.id, lines2.join("\n\n"), seat, "review");
|
|
21927
22036
|
emit.emit(`moved to ${reviewing}`, { ticket: t.issue_id });
|
|
@@ -26707,6 +26816,58 @@ function renderStatus(v, opts) {
|
|
|
26707
26816
|
return out;
|
|
26708
26817
|
}
|
|
26709
26818
|
|
|
26819
|
+
// src/questions.ts
|
|
26820
|
+
var MIN_ANSWERS = 2;
|
|
26821
|
+
var MAX_ANSWERS = 4;
|
|
26822
|
+
function validateAsk(req) {
|
|
26823
|
+
const problems = [];
|
|
26824
|
+
if (!req.question.trim()) problems.push("the question is empty");
|
|
26825
|
+
const n = req.answers.length;
|
|
26826
|
+
if (n === 1) problems.push(`one proposed answer is not a choice \u2014 give ${MIN_ANSWERS} to ${MAX_ANSWERS}, or none for a question that needs a free-form answer`);
|
|
26827
|
+
if (n > MAX_ANSWERS) problems.push(`${n} proposed answers is too many \u2014 give ${MIN_ANSWERS} to ${MAX_ANSWERS}`);
|
|
26828
|
+
req.answers.forEach((a, i) => {
|
|
26829
|
+
if (!a.label.trim()) problems.push(`answer ${i + 1} has no label`);
|
|
26830
|
+
if (!a.detail.trim()) problems.push(`answer ${i + 1} has no detail`);
|
|
26831
|
+
});
|
|
26832
|
+
return problems;
|
|
26833
|
+
}
|
|
26834
|
+
function columns(pairs) {
|
|
26835
|
+
return Object.fromEntries(pairs.filter(([name, value2]) => name && value2 !== void 0));
|
|
26836
|
+
}
|
|
26837
|
+
async function askQuestion(store, part, contract, req) {
|
|
26838
|
+
const q2 = contract.questions;
|
|
26839
|
+
const a = contract.answers;
|
|
26840
|
+
const st = contract.questionStatuses;
|
|
26841
|
+
const earlier = await store.listOpenQuestions(part, req.ticketId, req.askedBy);
|
|
26842
|
+
for (const old of earlier) await store.updateRecord(part.questionsModelId, old.id, { [q2.status]: st.withdrawn });
|
|
26843
|
+
const made = await store.createRecord(part.questionsModelId, columns([
|
|
26844
|
+
[q2.parent, req.ticketId],
|
|
26845
|
+
[q2.text, req.question.trim()],
|
|
26846
|
+
[q2.status, st.open],
|
|
26847
|
+
[q2.askedBy, req.askedBy],
|
|
26848
|
+
[q2.addressedTo, req.addressedTo]
|
|
26849
|
+
]));
|
|
26850
|
+
const answerIds = [];
|
|
26851
|
+
try {
|
|
26852
|
+
for (const [i, ans] of req.answers.entries()) {
|
|
26853
|
+
const row = await store.createRecord(part.answersModelId, columns([
|
|
26854
|
+
[a.question, made.id],
|
|
26855
|
+
[a.label, ans.label.trim()],
|
|
26856
|
+
[a.detail, ans.detail.trim()],
|
|
26857
|
+
[a.order, i + 1]
|
|
26858
|
+
]));
|
|
26859
|
+
answerIds.push(row.id);
|
|
26860
|
+
}
|
|
26861
|
+
} catch (e) {
|
|
26862
|
+
try {
|
|
26863
|
+
await store.updateRecord(part.questionsModelId, made.id, { [q2.status]: st.withdrawn });
|
|
26864
|
+
} catch {
|
|
26865
|
+
}
|
|
26866
|
+
throw e;
|
|
26867
|
+
}
|
|
26868
|
+
return { withdrawn: earlier.map((e) => e.id), questionId: made.id, answerIds };
|
|
26869
|
+
}
|
|
26870
|
+
|
|
26710
26871
|
// src/connect.ts
|
|
26711
26872
|
var ConnectHttpError = class extends Error {
|
|
26712
26873
|
status;
|
|
@@ -27002,6 +27163,14 @@ async function discover(o) {
|
|
|
27002
27163
|
out.epicsModelId = find("epics");
|
|
27003
27164
|
out.mapsModelId = find("maps");
|
|
27004
27165
|
out.periscopesModelId = find("periscopes");
|
|
27166
|
+
if (usesMapping && mapping && questionsPartMapped(mapping)) {
|
|
27167
|
+
out.questionsModelId = find("questions");
|
|
27168
|
+
out.answersModelId = find("answers");
|
|
27169
|
+
if (!out.questionsModelId || !out.answersModelId) {
|
|
27170
|
+
out.questionsModelId = void 0;
|
|
27171
|
+
out.answersModelId = void 0;
|
|
27172
|
+
}
|
|
27173
|
+
}
|
|
27005
27174
|
out.locksModelId = find("locks");
|
|
27006
27175
|
try {
|
|
27007
27176
|
const views = await get(o, `/views?workspaceId=${ws.id}`);
|
|
@@ -28997,7 +29166,7 @@ import { dirname as dirOf2, resolve as resolvePath } from "path";
|
|
|
28997
29166
|
import { existsSync as existsSync56, readdirSync as readdirSync18, statSync as statSync17 } from "fs";
|
|
28998
29167
|
import { join as join60 } from "path";
|
|
28999
29168
|
function builtVersion() {
|
|
29000
|
-
return true ? "0.
|
|
29169
|
+
return true ? "0.162.0" : null;
|
|
29001
29170
|
}
|
|
29002
29171
|
var REBUILD_HINT = "rebuild with npm run build";
|
|
29003
29172
|
function newestMtime(path) {
|
|
@@ -31227,6 +31396,8 @@ function usage(problem, requested = false) {
|
|
|
31227
31396
|
crew shell-init [--shell zsh|bash|fish] print the periscope shell function (install: eval "$(crew shell-init)")
|
|
31228
31397
|
crew worktree [route] NNN cut (or refresh) this run's worktree for a ticket from the remote; prints its path
|
|
31229
31398
|
crew unassign [route] NNN hand back a session's ticket \u2014 clears assignee, next cycle picks it up
|
|
31399
|
+
crew ask [route] NNN --question TEXT [--answer "LABEL :: DETAIL"]... [--to CREW_ROW_ID] [--role dev|design|qa]
|
|
31400
|
+
write a parked ticket's question as a record with 2-4 proposed answers (none for a free-form question); a no-op when the app maps no questions part
|
|
31230
31401
|
crew footprint [route] NNN [path...] record the files a ticket will change (once), then print PROCEED or YIELD against active work
|
|
31231
31402
|
crew sandbox cache [--refresh|--prune|--reset] [--json] list the sandbox cache volume's mirrors; --refresh runs the daemon's cache pass once (creates missing mirrors), --prune drops unserved repositories, --reset recreates the volume
|
|
31232
31403
|
crew sync [route] fast-forward the checkout and its worktrees from the remote
|
|
@@ -31358,6 +31529,7 @@ var KNOWN_COMMANDS = /* @__PURE__ */ new Set([
|
|
|
31358
31529
|
"sync",
|
|
31359
31530
|
"unassign",
|
|
31360
31531
|
"footprint",
|
|
31532
|
+
"ask",
|
|
31361
31533
|
"uninstall",
|
|
31362
31534
|
"watch",
|
|
31363
31535
|
"whoami",
|
|
@@ -35109,6 +35281,8 @@ ${found.problems.map((p) => ` - ${p}`).join("\n")}`, "fix the problems above, t
|
|
|
35109
35281
|
epicsModelId: found.epicsModelId,
|
|
35110
35282
|
mapsModelId: found.mapsModelId,
|
|
35111
35283
|
periscopesModelId: found.periscopesModelId,
|
|
35284
|
+
questionsModelId: found.questionsModelId,
|
|
35285
|
+
answersModelId: found.answersModelId,
|
|
35112
35286
|
locksModelId: found.locksModelId,
|
|
35113
35287
|
recordLinkViewId: found.recordLinkViewId,
|
|
35114
35288
|
reposModelId: found.reposModelId,
|
|
@@ -36359,6 +36533,59 @@ ${where.join("\n")}`);
|
|
|
36359
36533
|
}
|
|
36360
36534
|
break;
|
|
36361
36535
|
}
|
|
36536
|
+
case "ask": {
|
|
36537
|
+
const argsA = positional.slice(1);
|
|
36538
|
+
const nA = argsA.map(parseTicketNumber).find((x) => x !== null);
|
|
36539
|
+
const usageA = '`crew ask 326 --question "Which way?" --answer "Option A :: Do A" --answer "Option B :: Do B" --to <crew row id>`';
|
|
36540
|
+
if (!nA) {
|
|
36541
|
+
die("crew ask", "need a ticket number (326, ISSUE-326, or TABL-326)", usageA);
|
|
36542
|
+
}
|
|
36543
|
+
const questionA = value("question");
|
|
36544
|
+
if (!questionA) {
|
|
36545
|
+
die("crew ask", "need --question TEXT", usageA);
|
|
36546
|
+
}
|
|
36547
|
+
const answersA = [];
|
|
36548
|
+
argv.forEach((a, i) => {
|
|
36549
|
+
if (a !== "--answer") return;
|
|
36550
|
+
const raw = argv[i + 1] ?? "";
|
|
36551
|
+
const at = raw.indexOf("::");
|
|
36552
|
+
if (at < 0) {
|
|
36553
|
+
die("crew ask", `--answer "${raw}" needs a label and a detail separated by "::"`, usageA);
|
|
36554
|
+
}
|
|
36555
|
+
answersA.push({ label: raw.slice(0, at).trim(), detail: raw.slice(at + 2).trim() });
|
|
36556
|
+
});
|
|
36557
|
+
const trA = new Tracker(route2, cfg.ship);
|
|
36558
|
+
const partA = trA.questionsPart();
|
|
36559
|
+
if (!partA) {
|
|
36560
|
+
process.stdout.write("no questions part: this app does not map one, so nothing was written \u2014 post the comment as usual\n");
|
|
36561
|
+
break;
|
|
36562
|
+
}
|
|
36563
|
+
const openA = await trA.openTickets();
|
|
36564
|
+
const ticketA = openA.find((t) => t[trA.contract.columns.key] === `ISSUE-${nA}`);
|
|
36565
|
+
if (!ticketA) {
|
|
36566
|
+
die("crew ask", `no open ticket ISSUE-${nA} on ${route2.route}`, "`crew inbox` to list open tickets");
|
|
36567
|
+
}
|
|
36568
|
+
const seatsA = route2.resolved?.seats ?? {};
|
|
36569
|
+
const roleA = value("role") ?? "dev";
|
|
36570
|
+
const holderA = ticketA[trA.contract.columns.assignee];
|
|
36571
|
+
const askedByA = holderA && Object.values(seatsA).includes(holderA) ? holderA : seatsA[roleA];
|
|
36572
|
+
if (!askedByA) {
|
|
36573
|
+
die("crew ask", `no seat for role "${roleA}" on ${route2.route}`, "pass --role dev|design|qa");
|
|
36574
|
+
}
|
|
36575
|
+
const reqA = { ticketId: ticketA.id, question: questionA, answers: answersA, askedBy: askedByA, addressedTo: value("to") };
|
|
36576
|
+
const problemsA = validateAsk(reqA);
|
|
36577
|
+
if (problemsA.length) {
|
|
36578
|
+
die("crew ask", problemsA.join("; "), `${MIN_ANSWERS} to ${MAX_ANSWERS} --answer flags, or none for a free-form question`);
|
|
36579
|
+
}
|
|
36580
|
+
if (dryRun) {
|
|
36581
|
+
emit.emit(`would withdraw this seat's open questions on ${displayKey(ticketA)}, then ask one with ${answersA.length} proposed answer(s)`);
|
|
36582
|
+
break;
|
|
36583
|
+
}
|
|
36584
|
+
const doneA = await askQuestion(trA, partA, trA.contract, reqA);
|
|
36585
|
+
process.stdout.write(`asked on ${displayKey(ticketA)}: question ${doneA.questionId} with ${doneA.answerIds.length} answer(s)${doneA.withdrawn.length ? `, withdrew ${doneA.withdrawn.length} earlier` : ""}
|
|
36586
|
+
`);
|
|
36587
|
+
break;
|
|
36588
|
+
}
|
|
36362
36589
|
case "footprint": {
|
|
36363
36590
|
const args = positional.slice(1);
|
|
36364
36591
|
const at = args.findIndex((a) => parseTicketNumber(a) !== null);
|
package/package.json
CHANGED
|
@@ -635,6 +635,29 @@ ticket looks:
|
|
|
635
635
|
sensible default, state it ("If you just approve this without replying, I
|
|
636
636
|
will <default>."). Approving with no reply then means that default.
|
|
637
637
|
|
|
638
|
+
**Also ask it as a record, when the app takes questions.** Before you post a
|
|
639
|
+
stop comment that asks a person to decide or answer something, run
|
|
640
|
+
`crew ask <ticket number> --question "<the question>" --role <your lane>`, with
|
|
641
|
+
`--to <the park-to Crew row id>` when the park names a person, and one
|
|
642
|
+
`--answer "<label> :: <detail>"` per proposed answer. It writes the question as
|
|
643
|
+
a record the person can answer with one click. It is a no-op that says so when
|
|
644
|
+
the app has no questions part, so run it every time and then post the comment as
|
|
645
|
+
usual; the comment is never skipped, and it still opens with the question. A
|
|
646
|
+
failure of the command is never a reason to hold the park back.
|
|
647
|
+
|
|
648
|
+
- Offer answers only when the choices are genuinely discrete: two to four
|
|
649
|
+
options you could each act on at once. Give the recommended one first, and the
|
|
650
|
+
default you would take on a bare approval is that first one. Each label is a
|
|
651
|
+
few words for a button; each detail is the full instruction you will act on if
|
|
652
|
+
it is chosen.
|
|
653
|
+
- A question that needs a free-form answer (a name, a description, an opinion,
|
|
654
|
+
"what should this say?") is asked with no `--answer` at all. Do not invent
|
|
655
|
+
options to fill the space.
|
|
656
|
+
- Asking again on the same ticket withdraws your earlier open question, so the
|
|
657
|
+
person never sees two. Do not read the question record to learn the answer:
|
|
658
|
+
a chosen answer arrives as a comment from the person, which you already treat
|
|
659
|
+
as direction.
|
|
660
|
+
|
|
638
661
|
**A parked ticket that comes back unanswered is not an answer.** When a ticket
|
|
639
662
|
you parked with a question returns to `accepted` (or has `needs_planning`
|
|
640
663
|
cleared) and no person has commented since your question — a comment from your
|
|
@@ -26,6 +26,10 @@ No worktree and no code changes; only an answer.
|
|
|
26
26
|
4. Set `status` to `needs_info`, `needs_planning` to true, and `assignee_id`
|
|
27
27
|
to the Crew row in the ticket's `park to` cell (none: leave it unassigned,
|
|
28
28
|
no personal address).
|
|
29
|
+
When the closing question is a decision between discrete choices, ask it as
|
|
30
|
+
a record too (`crew ask`, see "Stopping" in the shared policy) with the
|
|
31
|
+
recommended choice first; a question that needs a free-form answer is asked
|
|
32
|
+
with no answers.
|
|
29
33
|
Close the answer by saying what you need from the person in one plain
|
|
30
34
|
sentence and asking them to reply in a comment — never to change the
|
|
31
35
|
status (see "Stopping" in the shared policy). This is the designed ending
|
|
@@ -612,6 +612,29 @@ on data. There are two kinds, each written where the operator looks:
|
|
|
612
612
|
sensible default, state it ("If you just approve this without replying, I
|
|
613
613
|
will <default>."). Approving with no reply then means that default.
|
|
614
614
|
|
|
615
|
+
**Also ask it as a record, when the app takes questions.** Before you post a
|
|
616
|
+
stop comment that asks a person to decide or answer something, run
|
|
617
|
+
`crew ask <ticket number> --question "<the question>" --role <your lane>`, with
|
|
618
|
+
`--to <the park-to Crew row id>` when the park names a person, and one
|
|
619
|
+
`--answer "<label> :: <detail>"` per proposed answer. It writes the question as
|
|
620
|
+
a record the person can answer with one click. It is a no-op that says so when
|
|
621
|
+
the app has no questions part, so run it every time and then post the comment as
|
|
622
|
+
usual; the comment is never skipped, and it still opens with the question. A
|
|
623
|
+
failure of the command is never a reason to hold the park back.
|
|
624
|
+
|
|
625
|
+
- Offer answers only when the choices are genuinely discrete: two to four
|
|
626
|
+
options you could each act on at once. Give the recommended one first, and the
|
|
627
|
+
default you would take on a bare approval is that first one. Each label is a
|
|
628
|
+
few words for a button; each detail is the full instruction you will act on if
|
|
629
|
+
it is chosen.
|
|
630
|
+
- A question that needs a free-form answer (a name, a description, an opinion,
|
|
631
|
+
"what should this say?") is asked with no `--answer` at all. Do not invent
|
|
632
|
+
options to fill the space.
|
|
633
|
+
- Asking again on the same ticket withdraws your earlier open question, so the
|
|
634
|
+
person never sees two. Do not read the question record to learn the answer:
|
|
635
|
+
a chosen answer arrives as a comment from the person, which you already treat
|
|
636
|
+
as direction.
|
|
637
|
+
|
|
615
638
|
**A parked ticket that comes back unanswered is not an answer.** When a ticket
|
|
616
639
|
you parked with a question returns to `accepted` (or has `needs_planning`
|
|
617
640
|
cleared) and no person has commented since your question — a comment from your
|
|
@@ -24,6 +24,10 @@ No worktree and no code changes; only an answer.
|
|
|
24
24
|
rests on, the way a closing comment cites what changed.
|
|
25
25
|
4. Set `status` to `needs_info`, `needs_planning` to true, and `assignee_id`
|
|
26
26
|
to the operator's Crew row (see the roster).
|
|
27
|
+
When the closing question is a decision between discrete choices, ask it as
|
|
28
|
+
a record too (`crew ask`, see "Stopping" in the shared policy) with the
|
|
29
|
+
recommended choice first; a question that needs a free-form answer is asked
|
|
30
|
+
with no answers.
|
|
27
31
|
Close the answer by saying what you need from the person in one plain
|
|
28
32
|
sentence and asking them to reply in a comment — never to change the
|
|
29
33
|
status (see "Stopping" in the shared policy). This is the designed ending
|