mrvn-cli 0.5.13 → 0.5.14
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/index.js +482 -23
- package/dist/index.js.map +1 -1
- package/dist/marvin-serve.js +506 -47
- package/dist/marvin-serve.js.map +1 -1
- package/dist/marvin.js +482 -23
- package/dist/marvin.js.map +1 -1
- package/package.json +1 -1
package/dist/marvin.js
CHANGED
|
@@ -18267,7 +18267,7 @@ import * as readline from "readline";
|
|
|
18267
18267
|
import chalk2 from "chalk";
|
|
18268
18268
|
import ora from "ora";
|
|
18269
18269
|
import {
|
|
18270
|
-
query as
|
|
18270
|
+
query as query5
|
|
18271
18271
|
} from "@anthropic-ai/claude-agent-sdk";
|
|
18272
18272
|
|
|
18273
18273
|
// src/personas/prompt-builder.ts
|
|
@@ -18407,9 +18407,9 @@ var DocumentStore = class {
|
|
|
18407
18407
|
}
|
|
18408
18408
|
}
|
|
18409
18409
|
}
|
|
18410
|
-
list(
|
|
18410
|
+
list(query10) {
|
|
18411
18411
|
const results = [];
|
|
18412
|
-
const types =
|
|
18412
|
+
const types = query10?.type ? [query10.type] : Object.keys(this.typeDirs);
|
|
18413
18413
|
for (const type of types) {
|
|
18414
18414
|
const dirName = this.typeDirs[type];
|
|
18415
18415
|
if (!dirName) continue;
|
|
@@ -18420,9 +18420,9 @@ var DocumentStore = class {
|
|
|
18420
18420
|
const filePath = path6.join(dir, file2);
|
|
18421
18421
|
const raw = fs6.readFileSync(filePath, "utf-8");
|
|
18422
18422
|
const doc = parseDocument(raw, filePath);
|
|
18423
|
-
if (
|
|
18424
|
-
if (
|
|
18425
|
-
if (
|
|
18423
|
+
if (query10?.status && doc.frontmatter.status !== query10.status) continue;
|
|
18424
|
+
if (query10?.owner && doc.frontmatter.owner !== query10.owner) continue;
|
|
18425
|
+
if (query10?.tag && (!doc.frontmatter.tags || !doc.frontmatter.tags.includes(query10.tag)))
|
|
18426
18426
|
continue;
|
|
18427
18427
|
results.push(doc);
|
|
18428
18428
|
}
|
|
@@ -22384,7 +22384,7 @@ function poBacklogPage(ctx) {
|
|
|
22384
22384
|
}
|
|
22385
22385
|
}
|
|
22386
22386
|
}
|
|
22387
|
-
const
|
|
22387
|
+
const DONE_STATUSES17 = /* @__PURE__ */ new Set(["done", "closed", "resolved", "cancelled"]);
|
|
22388
22388
|
function featureTaskStats(featureId) {
|
|
22389
22389
|
const fEpics = featureToEpics.get(featureId) ?? [];
|
|
22390
22390
|
let total = 0;
|
|
@@ -22393,7 +22393,7 @@ function poBacklogPage(ctx) {
|
|
|
22393
22393
|
for (const epic of fEpics) {
|
|
22394
22394
|
for (const t of epicToTasks.get(epic.frontmatter.id) ?? []) {
|
|
22395
22395
|
total++;
|
|
22396
|
-
if (
|
|
22396
|
+
if (DONE_STATUSES17.has(t.frontmatter.status)) done++;
|
|
22397
22397
|
progressSum += getEffectiveProgress(t.frontmatter);
|
|
22398
22398
|
}
|
|
22399
22399
|
}
|
|
@@ -25356,6 +25356,11 @@ function mapJiraStatusForTask(status, configMap) {
|
|
|
25356
25356
|
const lookup = buildStatusLookup(configMap, DEFAULT_TASK_STATUS_MAP);
|
|
25357
25357
|
return lookup.get(status.toLowerCase()) ?? "backlog";
|
|
25358
25358
|
}
|
|
25359
|
+
function extractJiraKeyFromTags(tags) {
|
|
25360
|
+
if (!tags) return void 0;
|
|
25361
|
+
const tag = tags.find((t) => /^jira:[A-Z]+-\d+$/i.test(t));
|
|
25362
|
+
return tag ? tag.slice(5) : void 0;
|
|
25363
|
+
}
|
|
25359
25364
|
function computeSubtaskProgress(subtasks) {
|
|
25360
25365
|
if (subtasks.length === 0) return 0;
|
|
25361
25366
|
const done = subtasks.filter(
|
|
@@ -25738,10 +25743,10 @@ async function fetchJiraDaily(store, client, host, projectKey, dateRange, status
|
|
|
25738
25743
|
jiraKeyToArtifacts.set(jk, list);
|
|
25739
25744
|
}
|
|
25740
25745
|
}
|
|
25741
|
-
const
|
|
25746
|
+
const BATCH_SIZE2 = 5;
|
|
25742
25747
|
const issues = searchResult.issues;
|
|
25743
|
-
for (let i = 0; i < issues.length; i +=
|
|
25744
|
-
const batch = issues.slice(i, i +
|
|
25748
|
+
for (let i = 0; i < issues.length; i += BATCH_SIZE2) {
|
|
25749
|
+
const batch = issues.slice(i, i + BATCH_SIZE2);
|
|
25745
25750
|
const results = await Promise.allSettled(
|
|
25746
25751
|
batch.map(
|
|
25747
25752
|
(issue2) => processIssue(issue2, client, host, dateRange, jiraKeyToArtifacts, allDocs, statusMap)
|
|
@@ -25965,6 +25970,420 @@ function generateProposedActions(issues) {
|
|
|
25965
25970
|
return actions;
|
|
25966
25971
|
}
|
|
25967
25972
|
|
|
25973
|
+
// src/skills/builtin/jira/sprint-progress.ts
|
|
25974
|
+
import { query as query3 } from "@anthropic-ai/claude-agent-sdk";
|
|
25975
|
+
var DONE_STATUSES16 = /* @__PURE__ */ new Set(["done", "closed", "resolved", "obsolete", "wont do", "cancelled"]);
|
|
25976
|
+
var BATCH_SIZE = 5;
|
|
25977
|
+
async function assessSprintProgress(store, client, host, options = {}) {
|
|
25978
|
+
const errors = [];
|
|
25979
|
+
const sprintData = collectSprintSummaryData(store, options.sprintId);
|
|
25980
|
+
if (!sprintData) {
|
|
25981
|
+
return {
|
|
25982
|
+
sprintId: options.sprintId ?? "unknown",
|
|
25983
|
+
sprintTitle: "Sprint not found",
|
|
25984
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
25985
|
+
timeline: { startDate: null, endDate: null, daysRemaining: 0, totalDays: 0, percentComplete: 0 },
|
|
25986
|
+
overallProgress: 0,
|
|
25987
|
+
itemReports: [],
|
|
25988
|
+
focusAreas: [],
|
|
25989
|
+
driftItems: [],
|
|
25990
|
+
blockers: [],
|
|
25991
|
+
proposedUpdates: [],
|
|
25992
|
+
appliedUpdates: [],
|
|
25993
|
+
errors: [`Sprint ${options.sprintId ?? "(active)"} not found. Create a sprint artifact first.`]
|
|
25994
|
+
};
|
|
25995
|
+
}
|
|
25996
|
+
const sprintTag = `sprint:${sprintData.sprint.id}`;
|
|
25997
|
+
const actions = store.list({ type: "action", tag: sprintTag });
|
|
25998
|
+
const tasks = store.list({ type: "task", tag: sprintTag });
|
|
25999
|
+
const sprintItemIds = new Set([...actions, ...tasks].map((d) => d.frontmatter.id));
|
|
26000
|
+
const allTasks = store.list({ type: "task" });
|
|
26001
|
+
const allActions = store.list({ type: "action" });
|
|
26002
|
+
const nestedTasks = allTasks.filter(
|
|
26003
|
+
(d) => !sprintItemIds.has(d.frontmatter.id) && d.frontmatter.aboutArtifact && sprintItemIds.has(d.frontmatter.aboutArtifact)
|
|
26004
|
+
);
|
|
26005
|
+
const nestedActions = allActions.filter(
|
|
26006
|
+
(d) => !sprintItemIds.has(d.frontmatter.id) && d.frontmatter.aboutArtifact && sprintItemIds.has(d.frontmatter.aboutArtifact)
|
|
26007
|
+
);
|
|
26008
|
+
const allItems = [...actions, ...tasks, ...nestedTasks, ...nestedActions];
|
|
26009
|
+
const itemJiraKeys = /* @__PURE__ */ new Map();
|
|
26010
|
+
for (const doc of allItems) {
|
|
26011
|
+
const jiraKey = doc.frontmatter.jiraKey ?? extractJiraKeyFromTags(doc.frontmatter.tags);
|
|
26012
|
+
if (jiraKey) {
|
|
26013
|
+
itemJiraKeys.set(doc.frontmatter.id, jiraKey);
|
|
26014
|
+
}
|
|
26015
|
+
}
|
|
26016
|
+
const jiraKeys = [...new Set(itemJiraKeys.values())];
|
|
26017
|
+
const jiraIssues = /* @__PURE__ */ new Map();
|
|
26018
|
+
for (let i = 0; i < jiraKeys.length; i += BATCH_SIZE) {
|
|
26019
|
+
const batch = jiraKeys.slice(i, i + BATCH_SIZE);
|
|
26020
|
+
const results = await Promise.allSettled(
|
|
26021
|
+
batch.map(async (key) => {
|
|
26022
|
+
const [issue2, comments] = await Promise.all([
|
|
26023
|
+
client.getIssueWithLinks(key),
|
|
26024
|
+
client.getComments(key)
|
|
26025
|
+
]);
|
|
26026
|
+
return { key, issue: issue2, comments };
|
|
26027
|
+
})
|
|
26028
|
+
);
|
|
26029
|
+
for (const result of results) {
|
|
26030
|
+
if (result.status === "fulfilled") {
|
|
26031
|
+
jiraIssues.set(result.value.key, {
|
|
26032
|
+
issue: result.value.issue,
|
|
26033
|
+
comments: result.value.comments
|
|
26034
|
+
});
|
|
26035
|
+
} else {
|
|
26036
|
+
const batchKey = batch[results.indexOf(result)];
|
|
26037
|
+
errors.push(`Failed to fetch ${batchKey}: ${result.reason instanceof Error ? result.reason.message : String(result.reason)}`);
|
|
26038
|
+
}
|
|
26039
|
+
}
|
|
26040
|
+
}
|
|
26041
|
+
const proposedUpdates = [];
|
|
26042
|
+
const itemReports = [];
|
|
26043
|
+
const childReportsByParent = /* @__PURE__ */ new Map();
|
|
26044
|
+
for (const doc of allItems) {
|
|
26045
|
+
const fm = doc.frontmatter;
|
|
26046
|
+
const jiraKey = itemJiraKeys.get(fm.id) ?? null;
|
|
26047
|
+
const jiraData = jiraKey ? jiraIssues.get(jiraKey) : null;
|
|
26048
|
+
let jiraStatus = null;
|
|
26049
|
+
let proposedMarvinStatus = null;
|
|
26050
|
+
let jiraSubtaskProgress = null;
|
|
26051
|
+
const commentSignals = [];
|
|
26052
|
+
if (jiraData) {
|
|
26053
|
+
jiraStatus = jiraData.issue.fields.status.name;
|
|
26054
|
+
proposedMarvinStatus = fm.type === "task" ? mapJiraStatusForTask(jiraStatus, options.statusMap?.task) : mapJiraStatusForAction(jiraStatus, options.statusMap?.action);
|
|
26055
|
+
const subtasks = jiraData.issue.fields.subtasks ?? [];
|
|
26056
|
+
if (subtasks.length > 0) {
|
|
26057
|
+
jiraSubtaskProgress = computeSubtaskProgress(subtasks);
|
|
26058
|
+
}
|
|
26059
|
+
for (const comment of jiraData.comments) {
|
|
26060
|
+
const text = extractCommentText(comment.body);
|
|
26061
|
+
const signals = detectCommentSignals(text);
|
|
26062
|
+
commentSignals.push(...signals);
|
|
26063
|
+
}
|
|
26064
|
+
}
|
|
26065
|
+
const statusDrift = proposedMarvinStatus !== null && proposedMarvinStatus !== fm.status;
|
|
26066
|
+
const currentProgress = getEffectiveProgress(fm);
|
|
26067
|
+
const progressDrift = jiraSubtaskProgress !== null && !fm.progressOverride && jiraSubtaskProgress !== currentProgress;
|
|
26068
|
+
if (statusDrift && proposedMarvinStatus) {
|
|
26069
|
+
proposedUpdates.push({
|
|
26070
|
+
artifactId: fm.id,
|
|
26071
|
+
field: "status",
|
|
26072
|
+
currentValue: fm.status,
|
|
26073
|
+
proposedValue: proposedMarvinStatus,
|
|
26074
|
+
reason: `Jira ${jiraKey} is "${jiraStatus}" \u2192 maps to "${proposedMarvinStatus}"`
|
|
26075
|
+
});
|
|
26076
|
+
}
|
|
26077
|
+
if (progressDrift && jiraSubtaskProgress !== null) {
|
|
26078
|
+
proposedUpdates.push({
|
|
26079
|
+
artifactId: fm.id,
|
|
26080
|
+
field: "progress",
|
|
26081
|
+
currentValue: currentProgress,
|
|
26082
|
+
proposedValue: jiraSubtaskProgress,
|
|
26083
|
+
reason: `Jira ${jiraKey} subtask progress is ${jiraSubtaskProgress}%`
|
|
26084
|
+
});
|
|
26085
|
+
}
|
|
26086
|
+
const tags = fm.tags ?? [];
|
|
26087
|
+
const focusTag = tags.find((t) => t.startsWith("focus:"));
|
|
26088
|
+
const report = {
|
|
26089
|
+
id: fm.id,
|
|
26090
|
+
title: fm.title,
|
|
26091
|
+
type: fm.type,
|
|
26092
|
+
marvinStatus: fm.status,
|
|
26093
|
+
marvinProgress: currentProgress,
|
|
26094
|
+
jiraKey,
|
|
26095
|
+
jiraStatus,
|
|
26096
|
+
jiraSubtaskProgress,
|
|
26097
|
+
proposedMarvinStatus,
|
|
26098
|
+
statusDrift,
|
|
26099
|
+
progressDrift,
|
|
26100
|
+
commentSignals,
|
|
26101
|
+
commentSummary: null,
|
|
26102
|
+
children: [],
|
|
26103
|
+
owner: fm.owner ?? null,
|
|
26104
|
+
focusArea: focusTag ? focusTag.slice(6) : null
|
|
26105
|
+
};
|
|
26106
|
+
const aboutArtifact = fm.aboutArtifact;
|
|
26107
|
+
if (aboutArtifact && sprintItemIds.has(aboutArtifact)) {
|
|
26108
|
+
if (!childReportsByParent.has(aboutArtifact)) {
|
|
26109
|
+
childReportsByParent.set(aboutArtifact, []);
|
|
26110
|
+
}
|
|
26111
|
+
childReportsByParent.get(aboutArtifact).push(report);
|
|
26112
|
+
}
|
|
26113
|
+
itemReports.push(report);
|
|
26114
|
+
}
|
|
26115
|
+
for (const report of itemReports) {
|
|
26116
|
+
const children = childReportsByParent.get(report.id);
|
|
26117
|
+
if (children) {
|
|
26118
|
+
report.children = children;
|
|
26119
|
+
}
|
|
26120
|
+
}
|
|
26121
|
+
const childIds = /* @__PURE__ */ new Set();
|
|
26122
|
+
for (const children of childReportsByParent.values()) {
|
|
26123
|
+
for (const child of children) childIds.add(child.id);
|
|
26124
|
+
}
|
|
26125
|
+
const rootReports = itemReports.filter((r) => !childIds.has(r.id));
|
|
26126
|
+
const focusAreaMap = /* @__PURE__ */ new Map();
|
|
26127
|
+
for (const report of rootReports) {
|
|
26128
|
+
const area = report.focusArea ?? "Uncategorized";
|
|
26129
|
+
if (!focusAreaMap.has(area)) focusAreaMap.set(area, []);
|
|
26130
|
+
focusAreaMap.get(area).push(report);
|
|
26131
|
+
}
|
|
26132
|
+
const focusAreas = [];
|
|
26133
|
+
for (const [name, items] of focusAreaMap) {
|
|
26134
|
+
const allFlatItems = items.flatMap((i) => [i, ...i.children]);
|
|
26135
|
+
const doneCount = allFlatItems.filter((i) => DONE_STATUSES16.has(i.marvinStatus)).length;
|
|
26136
|
+
const blockedCount = allFlatItems.filter((i) => i.marvinStatus === "blocked").length;
|
|
26137
|
+
const avgProgress = allFlatItems.length > 0 ? Math.round(allFlatItems.reduce((s, i) => s + i.marvinProgress, 0) / allFlatItems.length) : 0;
|
|
26138
|
+
focusAreas.push({
|
|
26139
|
+
name,
|
|
26140
|
+
items,
|
|
26141
|
+
totalCount: allFlatItems.length,
|
|
26142
|
+
doneCount,
|
|
26143
|
+
blockedCount,
|
|
26144
|
+
avgProgress
|
|
26145
|
+
});
|
|
26146
|
+
}
|
|
26147
|
+
focusAreas.sort((a, b) => {
|
|
26148
|
+
if (a.name === "Uncategorized") return 1;
|
|
26149
|
+
if (b.name === "Uncategorized") return -1;
|
|
26150
|
+
return a.name.localeCompare(b.name);
|
|
26151
|
+
});
|
|
26152
|
+
const driftItems = itemReports.filter((r) => r.statusDrift || r.progressDrift);
|
|
26153
|
+
const blockers = itemReports.filter(
|
|
26154
|
+
(r) => r.marvinStatus === "blocked" || r.commentSignals.some((s) => s.type === "blocker")
|
|
26155
|
+
);
|
|
26156
|
+
if (options.analyzeComments) {
|
|
26157
|
+
const itemsWithComments = itemReports.filter((r) => r.commentSignals.length > 0 && r.jiraKey);
|
|
26158
|
+
if (itemsWithComments.length > 0) {
|
|
26159
|
+
try {
|
|
26160
|
+
const summaries = await analyzeCommentsForProgress(
|
|
26161
|
+
itemsWithComments,
|
|
26162
|
+
jiraIssues,
|
|
26163
|
+
itemJiraKeys
|
|
26164
|
+
);
|
|
26165
|
+
for (const [artifactId, summary] of summaries) {
|
|
26166
|
+
const report = itemReports.find((r) => r.id === artifactId);
|
|
26167
|
+
if (report) report.commentSummary = summary;
|
|
26168
|
+
}
|
|
26169
|
+
} catch (err) {
|
|
26170
|
+
errors.push(`Comment analysis failed: ${err instanceof Error ? err.message : String(err)}`);
|
|
26171
|
+
}
|
|
26172
|
+
}
|
|
26173
|
+
}
|
|
26174
|
+
const appliedUpdates = [];
|
|
26175
|
+
if (options.applyUpdates && proposedUpdates.length > 0) {
|
|
26176
|
+
for (const update of proposedUpdates) {
|
|
26177
|
+
try {
|
|
26178
|
+
store.update(update.artifactId, {
|
|
26179
|
+
[update.field]: update.proposedValue,
|
|
26180
|
+
lastJiraSyncAt: (/* @__PURE__ */ new Date()).toISOString()
|
|
26181
|
+
});
|
|
26182
|
+
const doc = store.get(update.artifactId);
|
|
26183
|
+
if (doc) {
|
|
26184
|
+
if (doc.frontmatter.type === "task") {
|
|
26185
|
+
propagateProgressFromTask(store, update.artifactId);
|
|
26186
|
+
} else if (doc.frontmatter.type === "action") {
|
|
26187
|
+
propagateProgressToAction(store, update.artifactId);
|
|
26188
|
+
}
|
|
26189
|
+
}
|
|
26190
|
+
appliedUpdates.push(update);
|
|
26191
|
+
} catch (err) {
|
|
26192
|
+
errors.push(
|
|
26193
|
+
`Failed to apply update to ${update.artifactId}: ${err instanceof Error ? err.message : String(err)}`
|
|
26194
|
+
);
|
|
26195
|
+
}
|
|
26196
|
+
}
|
|
26197
|
+
}
|
|
26198
|
+
return {
|
|
26199
|
+
sprintId: sprintData.sprint.id,
|
|
26200
|
+
sprintTitle: sprintData.sprint.title,
|
|
26201
|
+
generatedAt: (/* @__PURE__ */ new Date()).toISOString(),
|
|
26202
|
+
timeline: {
|
|
26203
|
+
startDate: sprintData.sprint.startDate ?? null,
|
|
26204
|
+
endDate: sprintData.sprint.endDate ?? null,
|
|
26205
|
+
daysRemaining: sprintData.timeline.daysRemaining,
|
|
26206
|
+
totalDays: sprintData.timeline.totalDays,
|
|
26207
|
+
percentComplete: sprintData.timeline.percentComplete
|
|
26208
|
+
},
|
|
26209
|
+
overallProgress: sprintData.workItems.completionPct,
|
|
26210
|
+
itemReports: rootReports,
|
|
26211
|
+
focusAreas,
|
|
26212
|
+
driftItems,
|
|
26213
|
+
blockers,
|
|
26214
|
+
proposedUpdates: options.applyUpdates ? [] : proposedUpdates,
|
|
26215
|
+
appliedUpdates,
|
|
26216
|
+
errors
|
|
26217
|
+
};
|
|
26218
|
+
}
|
|
26219
|
+
var COMMENT_ANALYSIS_PROMPT = `You are a delivery management assistant analyzing Jira comments for progress signals.
|
|
26220
|
+
|
|
26221
|
+
For each item below, read the Jira comments and produce a 1-2 sentence progress summary.
|
|
26222
|
+
Focus on: what work was done, what's pending, any blockers or decisions mentioned.
|
|
26223
|
+
|
|
26224
|
+
Return your response as a JSON object mapping artifact IDs to summary strings.
|
|
26225
|
+
Example: {"T-001": "Backend API completed and deployed. Frontend integration pending review.", "A-003": "Blocked on infrastructure team approval."}
|
|
26226
|
+
|
|
26227
|
+
IMPORTANT: Only return the JSON object, no other text.`;
|
|
26228
|
+
async function analyzeCommentsForProgress(items, jiraIssues, itemJiraKeys) {
|
|
26229
|
+
const summaries = /* @__PURE__ */ new Map();
|
|
26230
|
+
const MAX_ITEMS_PER_CALL = 20;
|
|
26231
|
+
const itemsToAnalyze = items.slice(0, MAX_ITEMS_PER_CALL);
|
|
26232
|
+
const promptParts = [];
|
|
26233
|
+
for (const item of itemsToAnalyze) {
|
|
26234
|
+
const jiraKey = itemJiraKeys.get(item.id);
|
|
26235
|
+
if (!jiraKey) continue;
|
|
26236
|
+
const jiraData = jiraIssues.get(jiraKey);
|
|
26237
|
+
if (!jiraData || jiraData.comments.length === 0) continue;
|
|
26238
|
+
const commentTexts = jiraData.comments.map((c) => {
|
|
26239
|
+
const text = extractCommentText(c.body);
|
|
26240
|
+
return ` [${c.author.displayName}, ${c.created.slice(0, 10)}]: ${text.slice(0, 500)}`;
|
|
26241
|
+
}).join("\n");
|
|
26242
|
+
promptParts.push(`## ${item.id} \u2014 ${item.title} (${jiraKey}, Jira status: ${item.jiraStatus})
|
|
26243
|
+
Comments:
|
|
26244
|
+
${commentTexts}`);
|
|
26245
|
+
}
|
|
26246
|
+
if (promptParts.length === 0) return summaries;
|
|
26247
|
+
const prompt = promptParts.join("\n\n");
|
|
26248
|
+
const result = query3({
|
|
26249
|
+
prompt,
|
|
26250
|
+
options: {
|
|
26251
|
+
systemPrompt: COMMENT_ANALYSIS_PROMPT,
|
|
26252
|
+
maxTurns: 1,
|
|
26253
|
+
tools: [],
|
|
26254
|
+
allowedTools: []
|
|
26255
|
+
}
|
|
26256
|
+
});
|
|
26257
|
+
for await (const msg of result) {
|
|
26258
|
+
if (msg.type === "assistant") {
|
|
26259
|
+
const textBlock = msg.message.content.find(
|
|
26260
|
+
(b) => b.type === "text"
|
|
26261
|
+
);
|
|
26262
|
+
if (textBlock) {
|
|
26263
|
+
try {
|
|
26264
|
+
const parsed = JSON.parse(textBlock.text);
|
|
26265
|
+
for (const [id, summary] of Object.entries(parsed)) {
|
|
26266
|
+
if (typeof summary === "string") {
|
|
26267
|
+
summaries.set(id, summary);
|
|
26268
|
+
}
|
|
26269
|
+
}
|
|
26270
|
+
} catch {
|
|
26271
|
+
const match = textBlock.text.match(/```(?:json)?\s*([\s\S]*?)```/);
|
|
26272
|
+
if (match) {
|
|
26273
|
+
try {
|
|
26274
|
+
const parsed = JSON.parse(match[1]);
|
|
26275
|
+
for (const [id, summary] of Object.entries(parsed)) {
|
|
26276
|
+
if (typeof summary === "string") {
|
|
26277
|
+
summaries.set(id, summary);
|
|
26278
|
+
}
|
|
26279
|
+
}
|
|
26280
|
+
} catch {
|
|
26281
|
+
}
|
|
26282
|
+
}
|
|
26283
|
+
}
|
|
26284
|
+
}
|
|
26285
|
+
}
|
|
26286
|
+
}
|
|
26287
|
+
return summaries;
|
|
26288
|
+
}
|
|
26289
|
+
function formatProgressReport(report) {
|
|
26290
|
+
const parts = [];
|
|
26291
|
+
parts.push(`# Sprint Progress Assessment \u2014 ${report.sprintId}`);
|
|
26292
|
+
parts.push(`${report.sprintTitle}`);
|
|
26293
|
+
parts.push(`Generated: ${report.generatedAt.slice(0, 16)}`);
|
|
26294
|
+
parts.push("");
|
|
26295
|
+
if (report.timeline.startDate && report.timeline.endDate) {
|
|
26296
|
+
parts.push(`## Timeline`);
|
|
26297
|
+
parts.push(`${report.timeline.startDate} \u2192 ${report.timeline.endDate}`);
|
|
26298
|
+
parts.push(`Days remaining: ${report.timeline.daysRemaining} / ${report.timeline.totalDays} (${report.timeline.percentComplete}% elapsed)`);
|
|
26299
|
+
parts.push(`Overall progress: ${report.overallProgress}%`);
|
|
26300
|
+
parts.push("");
|
|
26301
|
+
}
|
|
26302
|
+
if (report.focusAreas.length > 0) {
|
|
26303
|
+
parts.push(`## Focus Areas`);
|
|
26304
|
+
parts.push("");
|
|
26305
|
+
for (const area of report.focusAreas) {
|
|
26306
|
+
const bar = progressBar6(area.avgProgress);
|
|
26307
|
+
parts.push(`### ${area.name} ${bar} ${area.avgProgress}%`);
|
|
26308
|
+
parts.push(`${area.doneCount}/${area.totalCount} done${area.blockedCount > 0 ? ` | ${area.blockedCount} blocked` : ""}`);
|
|
26309
|
+
parts.push("");
|
|
26310
|
+
for (const item of area.items) {
|
|
26311
|
+
formatItemLine(parts, item, 0);
|
|
26312
|
+
}
|
|
26313
|
+
parts.push("");
|
|
26314
|
+
}
|
|
26315
|
+
}
|
|
26316
|
+
if (report.driftItems.length > 0) {
|
|
26317
|
+
parts.push(`## Status Drift (${report.driftItems.length} items)`);
|
|
26318
|
+
for (const item of report.driftItems) {
|
|
26319
|
+
const driftParts = [];
|
|
26320
|
+
if (item.statusDrift) {
|
|
26321
|
+
driftParts.push(`status: ${item.marvinStatus} \u2192 ${item.proposedMarvinStatus}`);
|
|
26322
|
+
}
|
|
26323
|
+
if (item.progressDrift && item.jiraSubtaskProgress !== null) {
|
|
26324
|
+
driftParts.push(`progress: ${item.marvinProgress}% \u2192 ${item.jiraSubtaskProgress}%`);
|
|
26325
|
+
}
|
|
26326
|
+
parts.push(` \u26A0 ${item.id} (${item.jiraKey}) \u2014 ${driftParts.join(", ")}`);
|
|
26327
|
+
}
|
|
26328
|
+
parts.push("");
|
|
26329
|
+
}
|
|
26330
|
+
if (report.blockers.length > 0) {
|
|
26331
|
+
parts.push(`## Blockers (${report.blockers.length})`);
|
|
26332
|
+
for (const item of report.blockers) {
|
|
26333
|
+
const blockerSignals = item.commentSignals.filter((s) => s.type === "blocker");
|
|
26334
|
+
parts.push(` \u{1F6AB} ${item.id} \u2014 ${item.title}${item.jiraKey ? ` (${item.jiraKey})` : ""}`);
|
|
26335
|
+
for (const signal of blockerSignals) {
|
|
26336
|
+
parts.push(` "${signal.snippet}"`);
|
|
26337
|
+
}
|
|
26338
|
+
}
|
|
26339
|
+
parts.push("");
|
|
26340
|
+
}
|
|
26341
|
+
if (report.proposedUpdates.length > 0) {
|
|
26342
|
+
parts.push(`## Proposed Updates (${report.proposedUpdates.length})`);
|
|
26343
|
+
for (const update of report.proposedUpdates) {
|
|
26344
|
+
parts.push(` ${update.artifactId}.${update.field}: ${String(update.currentValue)} \u2192 ${String(update.proposedValue)}`);
|
|
26345
|
+
parts.push(` Reason: ${update.reason}`);
|
|
26346
|
+
}
|
|
26347
|
+
parts.push("");
|
|
26348
|
+
parts.push("Run with applyUpdates=true to apply these changes.");
|
|
26349
|
+
parts.push("");
|
|
26350
|
+
}
|
|
26351
|
+
if (report.appliedUpdates.length > 0) {
|
|
26352
|
+
parts.push(`## Applied Updates (${report.appliedUpdates.length})`);
|
|
26353
|
+
for (const update of report.appliedUpdates) {
|
|
26354
|
+
parts.push(` \u2713 ${update.artifactId}.${update.field}: ${String(update.currentValue)} \u2192 ${String(update.proposedValue)}`);
|
|
26355
|
+
}
|
|
26356
|
+
parts.push("");
|
|
26357
|
+
}
|
|
26358
|
+
if (report.errors.length > 0) {
|
|
26359
|
+
parts.push(`## Errors`);
|
|
26360
|
+
for (const err of report.errors) {
|
|
26361
|
+
parts.push(` ${err}`);
|
|
26362
|
+
}
|
|
26363
|
+
parts.push("");
|
|
26364
|
+
}
|
|
26365
|
+
return parts.join("\n");
|
|
26366
|
+
}
|
|
26367
|
+
function formatItemLine(parts, item, depth) {
|
|
26368
|
+
const indent = " ".repeat(depth + 1);
|
|
26369
|
+
const statusIcon = DONE_STATUSES16.has(item.marvinStatus) ? "\u2713" : item.marvinStatus === "blocked" ? "\u{1F6AB}" : item.marvinStatus === "in-progress" ? "\u25B6" : "\u25CB";
|
|
26370
|
+
const jiraLabel = item.jiraKey ? ` [${item.jiraKey}: ${item.jiraStatus}]` : "";
|
|
26371
|
+
const driftFlag = item.statusDrift ? " \u26A0drift" : "";
|
|
26372
|
+
const progressLabel = item.marvinProgress > 0 ? ` ${item.marvinProgress}%` : "";
|
|
26373
|
+
parts.push(`${indent}${statusIcon} ${item.id} \u2014 ${item.title} [${item.marvinStatus}]${progressLabel}${jiraLabel}${driftFlag}`);
|
|
26374
|
+
if (item.commentSummary) {
|
|
26375
|
+
parts.push(`${indent} \u{1F4AC} ${item.commentSummary}`);
|
|
26376
|
+
}
|
|
26377
|
+
for (const child of item.children) {
|
|
26378
|
+
formatItemLine(parts, child, depth + 1);
|
|
26379
|
+
}
|
|
26380
|
+
}
|
|
26381
|
+
function progressBar6(pct) {
|
|
26382
|
+
const filled = Math.round(pct / 10);
|
|
26383
|
+
const empty = 10 - filled;
|
|
26384
|
+
return `[${"\u2588".repeat(filled)}${"\u2591".repeat(empty)}]`;
|
|
26385
|
+
}
|
|
26386
|
+
|
|
25968
26387
|
// src/skills/builtin/jira/tools.ts
|
|
25969
26388
|
var JIRA_TYPE = "jira-issue";
|
|
25970
26389
|
function jiraNotConfiguredError() {
|
|
@@ -26730,6 +27149,36 @@ function createJiraTools(store, projectConfig) {
|
|
|
26730
27149
|
};
|
|
26731
27150
|
},
|
|
26732
27151
|
{ annotations: { readOnlyHint: true } }
|
|
27152
|
+
),
|
|
27153
|
+
// --- Sprint progress assessment ---
|
|
27154
|
+
tool20(
|
|
27155
|
+
"assess_sprint_progress",
|
|
27156
|
+
"Assess sprint progress by fetching live Jira statuses for all sprint-scoped items, detecting drift between Marvin and Jira, grouping by focus area with rollup progress, and extracting comment signals. Optionally applies updates and uses LLM for comment analysis.",
|
|
27157
|
+
{
|
|
27158
|
+
sprintId: external_exports.string().optional().describe("Sprint ID (e.g. 'SP-001'). Defaults to active sprint."),
|
|
27159
|
+
analyzeComments: external_exports.boolean().optional().describe("Use LLM to summarize Jira comments for progress signals (default false)"),
|
|
27160
|
+
applyUpdates: external_exports.boolean().optional().describe("Apply proposed status/progress updates to Marvin artifacts (default false)")
|
|
27161
|
+
},
|
|
27162
|
+
async (args) => {
|
|
27163
|
+
const jira = createJiraClient(jiraUserConfig);
|
|
27164
|
+
if (!jira) return jiraNotConfiguredError();
|
|
27165
|
+
const report = await assessSprintProgress(
|
|
27166
|
+
store,
|
|
27167
|
+
jira.client,
|
|
27168
|
+
jira.host,
|
|
27169
|
+
{
|
|
27170
|
+
sprintId: args.sprintId,
|
|
27171
|
+
analyzeComments: args.analyzeComments ?? false,
|
|
27172
|
+
applyUpdates: args.applyUpdates ?? false,
|
|
27173
|
+
statusMap
|
|
27174
|
+
}
|
|
27175
|
+
);
|
|
27176
|
+
return {
|
|
27177
|
+
content: [{ type: "text", text: formatProgressReport(report) }],
|
|
27178
|
+
isError: report.errors.length > 0 && report.itemReports.length === 0
|
|
27179
|
+
};
|
|
27180
|
+
},
|
|
27181
|
+
{ annotations: { readOnlyHint: false } }
|
|
26733
27182
|
)
|
|
26734
27183
|
];
|
|
26735
27184
|
}
|
|
@@ -26831,6 +27280,7 @@ var COMMON_TOOLS = `**Available tools:**
|
|
|
26831
27280
|
- \`read_confluence_page\` \u2014 **read-only**: fetch and return the content of a Confluence page by URL or page ID. Use this to review Confluence content for updating tasks, generating contributions, or answering questions.
|
|
26832
27281
|
- \`fetch_jira_status\` \u2014 **read-only**: fetch current Jira status, subtask progress, and linked issues for Jira-linked actions/tasks. Returns proposed changes without applying them.
|
|
26833
27282
|
- \`fetch_jira_daily\` \u2014 **read-only**: fetch a daily/range summary of all Jira changes \u2014 status transitions, comments, linked Confluence pages, and cross-references with Marvin artifacts. Returns proposed actions (status updates, unlinked issues, question candidates, Confluence pages to review).
|
|
27283
|
+
- \`assess_sprint_progress\` \u2014 fetch live Jira statuses for all sprint-scoped items, detect drift, group by focus area with rollup progress, and extract comment signals. Use \`analyzeComments=true\` for LLM summaries, \`applyUpdates=true\` to apply changes.
|
|
26834
27284
|
- \`fetch_jira_statuses\` \u2014 **read-only**: discover all Jira statuses in a project and show their Marvin mappings (mapped vs unmapped).
|
|
26835
27285
|
- \`search_jira\` \u2014 **read-only**: search Jira via JQL and return results with Marvin cross-references. No documents created \u2014 use to preview before importing or find issues for linking.
|
|
26836
27286
|
- \`pull_jira_issue\` / \`pull_jira_issues_jql\` \u2014 import Jira issues as local JI-xxx documents (for Jira-originated items with no existing Marvin artifact).
|
|
@@ -26842,6 +27292,11 @@ var COMMON_WORKFLOW = `**Jira sync workflow:**
|
|
|
26842
27292
|
2. Analyze the proposed changes (status transitions, subtask progress, blockers from linked issues)
|
|
26843
27293
|
3. Use \`update_action\` / \`update_task\` to apply the changes you agree with
|
|
26844
27294
|
|
|
27295
|
+
**Sprint progress workflow:**
|
|
27296
|
+
1. Call \`assess_sprint_progress\` to get a comprehensive view of all sprint items with live Jira data
|
|
27297
|
+
2. Review focus area rollups, status drift, and blockers
|
|
27298
|
+
3. Optionally run with \`applyUpdates=true\` to bulk-sync statuses, or \`analyzeComments=true\` for LLM-powered comment summaries
|
|
27299
|
+
|
|
26845
27300
|
**Daily review workflow:**
|
|
26846
27301
|
1. Call \`fetch_jira_daily\` (optionally with \`from\`/\`to\` date range) to get a summary of all Jira activity
|
|
26847
27302
|
2. Review the proposed actions: status updates, unlinked issues to track, questions that may be answered, Confluence pages to review
|
|
@@ -26865,6 +27320,7 @@ ${COMMON_WORKFLOW}
|
|
|
26865
27320
|
|
|
26866
27321
|
**As Product Owner, use Jira integration to:**
|
|
26867
27322
|
- Use \`fetch_jira_daily\` for daily standups \u2014 review what changed, identify status drift, spot untracked work
|
|
27323
|
+
- Use \`assess_sprint_progress\` for sprint reviews \u2014 see overall progress by focus area, detect drift, and identify blockers
|
|
26868
27324
|
- Pull stakeholder-reported issues for triage and prioritization
|
|
26869
27325
|
- Push approved features as Stories for development tracking
|
|
26870
27326
|
- Link decisions to Jira issues for audit trail and traceability
|
|
@@ -26877,6 +27333,7 @@ ${COMMON_WORKFLOW}
|
|
|
26877
27333
|
|
|
26878
27334
|
**As Tech Lead, use Jira integration to:**
|
|
26879
27335
|
- Use \`fetch_jira_daily\` to review technical progress \u2014 status transitions, new comments, Confluence design docs
|
|
27336
|
+
- Use \`assess_sprint_progress\` for sprint health checks \u2014 focus area rollups, Jira drift detection, blocker tracking
|
|
26880
27337
|
- Pull technical issues and bugs for sprint planning and estimation
|
|
26881
27338
|
- Push epics, tasks, and technical decisions to Jira for cross-team visibility
|
|
26882
27339
|
- Use \`link_to_jira\` to connect Marvin tasks to existing Jira tickets
|
|
@@ -26890,6 +27347,8 @@ This is a third path for progress tracking alongside Contributions and Meetings.
|
|
|
26890
27347
|
|
|
26891
27348
|
**As Delivery Manager, use Jira integration to:**
|
|
26892
27349
|
- Use \`fetch_jira_daily\` for daily progress reports \u2014 track what moved, identify blockers, spot untracked work
|
|
27350
|
+
- Use \`assess_sprint_progress\` for sprint reviews and stakeholder updates \u2014 comprehensive progress by focus area with Jira enrichment
|
|
27351
|
+
- Use \`assess_sprint_progress\` with \`applyUpdates=true\` to bulk-sync Marvin statuses from Jira
|
|
26893
27352
|
- Pull sprint issues for tracking progress and blockers
|
|
26894
27353
|
- Push actions and tasks to Jira for stakeholder visibility
|
|
26895
27354
|
- Use \`fetch_jira_daily\` with a date range for sprint retrospectives (e.g. \`from: "2026-03-10", to: "2026-03-21"\`)
|
|
@@ -28388,11 +28847,11 @@ function createMarvinMcpServer(store, options) {
|
|
|
28388
28847
|
}
|
|
28389
28848
|
|
|
28390
28849
|
// src/agent/session-namer.ts
|
|
28391
|
-
import { query as
|
|
28850
|
+
import { query as query4 } from "@anthropic-ai/claude-agent-sdk";
|
|
28392
28851
|
async function generateSessionName(turns) {
|
|
28393
28852
|
try {
|
|
28394
28853
|
const transcript = turns.slice(-20).map((t) => `${t.role}: ${t.content.slice(0, 200)}`).join("\n");
|
|
28395
|
-
const result =
|
|
28854
|
+
const result = query4({
|
|
28396
28855
|
prompt: `Summarize this conversation in 3-5 words as a kebab-case name suitable for a filename. Output ONLY the name, nothing else.
|
|
28397
28856
|
|
|
28398
28857
|
${transcript}`,
|
|
@@ -28670,7 +29129,7 @@ Marvin \u2014 ${persona.name}
|
|
|
28670
29129
|
if (existingSession) {
|
|
28671
29130
|
queryOptions.resume = existingSession.id;
|
|
28672
29131
|
}
|
|
28673
|
-
const conversation =
|
|
29132
|
+
const conversation = query5({
|
|
28674
29133
|
prompt,
|
|
28675
29134
|
options: queryOptions
|
|
28676
29135
|
});
|
|
@@ -29029,7 +29488,7 @@ import * as fs12 from "fs";
|
|
|
29029
29488
|
import * as path12 from "path";
|
|
29030
29489
|
import chalk7 from "chalk";
|
|
29031
29490
|
import ora2 from "ora";
|
|
29032
|
-
import { query as
|
|
29491
|
+
import { query as query6 } from "@anthropic-ai/claude-agent-sdk";
|
|
29033
29492
|
|
|
29034
29493
|
// src/sources/prompts.ts
|
|
29035
29494
|
function buildIngestSystemPrompt(persona, projectConfig, isDraft) {
|
|
@@ -29162,7 +29621,7 @@ async function ingestFile(options) {
|
|
|
29162
29621
|
const spinner = ora2({ text: `Analyzing ${fileName}...`, color: "cyan" });
|
|
29163
29622
|
spinner.start();
|
|
29164
29623
|
try {
|
|
29165
|
-
const conversation =
|
|
29624
|
+
const conversation = query6({
|
|
29166
29625
|
prompt: userPrompt,
|
|
29167
29626
|
options: {
|
|
29168
29627
|
systemPrompt,
|
|
@@ -29692,7 +30151,7 @@ import { StdioServerTransport } from "@modelcontextprotocol/sdk/server/stdio.js"
|
|
|
29692
30151
|
import { tool as tool24 } from "@anthropic-ai/claude-agent-sdk";
|
|
29693
30152
|
|
|
29694
30153
|
// src/skills/action-runner.ts
|
|
29695
|
-
import { query as
|
|
30154
|
+
import { query as query7 } from "@anthropic-ai/claude-agent-sdk";
|
|
29696
30155
|
var GOVERNANCE_TOOL_NAMES2 = [
|
|
29697
30156
|
"mcp__marvin-governance__list_decisions",
|
|
29698
30157
|
"mcp__marvin-governance__get_decision",
|
|
@@ -29714,7 +30173,7 @@ async function runSkillAction(action, userPrompt, context) {
|
|
|
29714
30173
|
try {
|
|
29715
30174
|
const mcpServer = createMarvinMcpServer(context.store);
|
|
29716
30175
|
const allowedTools = action.allowGovernanceTools !== false ? GOVERNANCE_TOOL_NAMES2 : [];
|
|
29717
|
-
const conversation =
|
|
30176
|
+
const conversation = query7({
|
|
29718
30177
|
prompt: userPrompt,
|
|
29719
30178
|
options: {
|
|
29720
30179
|
systemPrompt: action.systemPrompt,
|
|
@@ -30755,7 +31214,7 @@ import chalk13 from "chalk";
|
|
|
30755
31214
|
// src/analysis/analyze.ts
|
|
30756
31215
|
import chalk12 from "chalk";
|
|
30757
31216
|
import ora4 from "ora";
|
|
30758
|
-
import { query as
|
|
31217
|
+
import { query as query8 } from "@anthropic-ai/claude-agent-sdk";
|
|
30759
31218
|
|
|
30760
31219
|
// src/analysis/prompts.ts
|
|
30761
31220
|
function buildAnalyzeSystemPrompt(persona, projectConfig, isDraft) {
|
|
@@ -30885,7 +31344,7 @@ async function analyzeMeeting(options) {
|
|
|
30885
31344
|
const spinner = ora4({ text: `Analyzing meeting ${meetingId}...`, color: "cyan" });
|
|
30886
31345
|
spinner.start();
|
|
30887
31346
|
try {
|
|
30888
|
-
const conversation =
|
|
31347
|
+
const conversation = query8({
|
|
30889
31348
|
prompt: userPrompt,
|
|
30890
31349
|
options: {
|
|
30891
31350
|
systemPrompt,
|
|
@@ -31012,7 +31471,7 @@ import chalk15 from "chalk";
|
|
|
31012
31471
|
// src/contributions/contribute.ts
|
|
31013
31472
|
import chalk14 from "chalk";
|
|
31014
31473
|
import ora5 from "ora";
|
|
31015
|
-
import { query as
|
|
31474
|
+
import { query as query9 } from "@anthropic-ai/claude-agent-sdk";
|
|
31016
31475
|
|
|
31017
31476
|
// src/contributions/prompts.ts
|
|
31018
31477
|
function buildContributeSystemPrompt(persona, contributionType, projectConfig, isDraft) {
|
|
@@ -31266,7 +31725,7 @@ async function contributeFromPersona(options) {
|
|
|
31266
31725
|
"mcp__marvin-governance__get_action",
|
|
31267
31726
|
"mcp__marvin-governance__get_question"
|
|
31268
31727
|
];
|
|
31269
|
-
const conversation =
|
|
31728
|
+
const conversation = query9({
|
|
31270
31729
|
prompt: userPrompt,
|
|
31271
31730
|
options: {
|
|
31272
31731
|
systemPrompt,
|
|
@@ -32105,7 +32564,7 @@ function createProgram() {
|
|
|
32105
32564
|
const program2 = new Command();
|
|
32106
32565
|
program2.name("marvin").description(
|
|
32107
32566
|
"AI-powered product development assistant with Product Owner, Delivery Manager, and Technical Lead personas"
|
|
32108
|
-
).version("0.5.
|
|
32567
|
+
).version("0.5.14");
|
|
32109
32568
|
program2.command("init").description("Initialize a new Marvin project in the current directory").action(async () => {
|
|
32110
32569
|
await initCommand();
|
|
32111
32570
|
});
|