@oss-autopilot/core 3.42.5 → 3.44.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-pre-action.js +8 -3
- package/dist/cli-registry.js +428 -27
- package/dist/cli.bundle.cjs +212 -156
- package/dist/commands/check-integration.js +5 -1
- package/dist/commands/cleanup.d.ts +80 -0
- package/dist/commands/cleanup.js +334 -0
- package/dist/commands/comments.d.ts +14 -1
- package/dist/commands/comments.js +17 -5
- package/dist/commands/config.d.ts +2 -0
- package/dist/commands/config.js +63 -6
- package/dist/commands/daily-dismiss-filter.d.ts +7 -0
- package/dist/commands/daily-dismiss-filter.js +17 -1
- package/dist/commands/daily-ledger.d.ts +150 -0
- package/dist/commands/daily-ledger.js +248 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily-render.d.ts +2 -1
- package/dist/commands/daily-render.js +4 -1
- package/dist/commands/daily.d.ts +5 -1
- package/dist/commands/daily.js +83 -93
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +113 -69
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.d.ts +36 -8
- package/dist/commands/dashboard-lifecycle.js +132 -39
- package/dist/commands/dashboard-process.d.ts +49 -1
- package/dist/commands/dashboard-process.js +111 -12
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +11 -7
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +66 -5
- package/dist/commands/draft.d.ts +77 -0
- package/dist/commands/draft.js +218 -0
- package/dist/commands/eval.js +1 -0
- package/dist/commands/fork-prune.d.ts +58 -0
- package/dist/commands/fork-prune.js +247 -0
- package/dist/commands/guidelines.d.ts +69 -2
- package/dist/commands/guidelines.js +158 -14
- package/dist/commands/index.d.ts +29 -4
- package/dist/commands/index.js +20 -3
- package/dist/commands/issue-thread.d.ts +46 -0
- package/dist/commands/issue-thread.js +123 -0
- package/dist/commands/ledger-backfill.d.ts +9 -0
- package/dist/commands/ledger-backfill.js +44 -1
- package/dist/commands/list-mark-done.d.ts +2 -1
- package/dist/commands/list-mark-done.js +3 -1
- package/dist/commands/list-move-tier.d.ts +2 -1
- package/dist/commands/list-move-tier.js +3 -1
- package/dist/commands/local-repos.js +10 -5
- package/dist/commands/locate-issue-list.d.ts +40 -17
- package/dist/commands/locate-issue-list.js +148 -88
- package/dist/commands/move.js +7 -1
- package/dist/commands/overnight-handoff.d.ts +17 -7
- package/dist/commands/overnight-handoff.js +36 -14
- package/dist/commands/overnight-push-prep.d.ts +14 -8
- package/dist/commands/overnight-push-prep.js +107 -35
- package/dist/commands/overnight-tool-rules.d.ts +54 -0
- package/dist/commands/overnight-tool-rules.js +217 -0
- package/dist/commands/overnight.d.ts +5 -6
- package/dist/commands/overnight.js +61 -140
- package/dist/commands/parse-list.js +7 -1
- package/dist/commands/policy.d.ts +90 -0
- package/dist/commands/policy.js +276 -0
- package/dist/commands/pr-create.d.ts +48 -0
- package/dist/commands/pr-create.js +200 -0
- package/dist/commands/pr-preflight.d.ts +69 -0
- package/dist/commands/pr-preflight.js +348 -0
- package/dist/commands/repo-vet.d.ts +9 -0
- package/dist/commands/repo-vet.js +36 -11
- package/dist/commands/scout-bridge.js +18 -8
- package/dist/commands/search.js +7 -0
- package/dist/commands/setup.d.ts +3 -3
- package/dist/commands/setup.js +160 -48
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +12 -3
- package/dist/commands/startup.js +82 -49
- package/dist/commands/state-cmd.d.ts +2 -0
- package/dist/commands/state-cmd.js +5 -1
- package/dist/commands/stats.js +1 -0
- package/dist/commands/status.js +6 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/validation.d.ts +5 -0
- package/dist/commands/validation.js +5 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +26 -1
- package/dist/commands/vet.d.ts +20 -0
- package/dist/commands/vet.js +133 -2
- package/dist/commands/work.d.ts +4 -0
- package/dist/commands/work.js +34 -11
- package/dist/core/__fixtures__/prompt-injection-payloads.js +31 -0
- package/dist/core/anti-llm-policy.d.ts +3 -0
- package/dist/core/anti-llm-policy.js +3 -0
- package/dist/core/auth.js +2 -0
- package/dist/core/ci-analysis.d.ts +7 -2
- package/dist/core/ci-analysis.js +76 -21
- package/dist/core/commit-date.d.ts +45 -0
- package/dist/core/commit-date.js +45 -0
- package/dist/core/compliance-score.d.ts +3 -0
- package/dist/core/compliance-score.js +13 -9
- package/dist/core/config-registry.d.ts +27 -2
- package/dist/core/config-registry.js +94 -7
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +30 -5
- package/dist/core/daily-logic.js +68 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- package/dist/core/fork-prune.d.ts +149 -0
- package/dist/core/fork-prune.js +333 -0
- package/dist/core/gist-health.d.ts +15 -3
- package/dist/core/gist-health.js +8 -0
- package/dist/core/gist-state-store.d.ts +24 -4
- package/dist/core/gist-state-store.js +98 -51
- package/dist/core/github-stats.d.ts +110 -16
- package/dist/core/github-stats.js +295 -110
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +13 -6
- package/dist/core/index.js +16 -6
- package/dist/core/issue-conversation.d.ts +8 -2
- package/dist/core/issue-conversation.js +31 -12
- package/dist/core/local-config.d.ts +95 -0
- package/dist/core/local-config.js +270 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- package/dist/core/pacing.d.ts +41 -0
- package/dist/core/pacing.js +115 -0
- package/dist/core/pagination.d.ts +55 -0
- package/dist/core/pagination.js +59 -0
- package/dist/core/paths.d.ts +7 -0
- package/dist/core/paths.js +9 -0
- package/dist/core/pr-assembly.d.ts +2 -0
- package/dist/core/pr-assembly.js +6 -2
- package/dist/core/pr-graphql.d.ts +53 -4
- package/dist/core/pr-graphql.js +87 -14
- package/dist/core/pr-monitor.d.ts +35 -12
- package/dist/core/pr-monitor.js +110 -26
- package/dist/core/pr-preflight.d.ts +154 -0
- package/dist/core/pr-preflight.js +753 -0
- package/dist/core/pr-quality-rubric.d.ts +0 -6
- package/dist/core/pr-quality-rubric.js +0 -8
- package/dist/core/pr-template.d.ts +2 -0
- package/dist/core/pr-template.js +5 -1
- package/dist/core/prose-script.d.ts +72 -0
- package/dist/core/prose-script.js +223 -0
- package/dist/core/repo-policy.d.ts +111 -0
- package/dist/core/repo-policy.js +428 -0
- package/dist/core/repo-score-manager.d.ts +66 -0
- package/dist/core/repo-score-manager.js +140 -1
- package/dist/core/review-analysis.d.ts +49 -21
- package/dist/core/review-analysis.js +89 -15
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +78 -0
- package/dist/core/stale-data.js +153 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -119
- package/dist/core/state-schema.d.ts +152 -210
- package/dist/core/state-schema.js +232 -80
- package/dist/core/state.d.ts +81 -8
- package/dist/core/state.js +239 -46
- package/dist/core/status-determination.js +32 -12
- package/dist/core/strategy.js +3 -1
- package/dist/core/types.d.ts +22 -1
- package/dist/core/types.js +1 -0
- package/dist/core/untrusted-content.d.ts +30 -11
- package/dist/core/untrusted-content.js +95 -42
- package/dist/core/urls.d.ts +33 -0
- package/dist/core/urls.js +94 -0
- package/dist/dashboard/assets/chart-panel-B-nLVgzQ.js +3 -0
- package/dist/dashboard/assets/index-5IvMGokL.js +55 -0
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +432 -10
- package/dist/formatters/json.js +156 -1
- package/package.json +6 -6
- package/dist/core/ci-enforced-tools.d.ts +0 -35
- package/dist/core/ci-enforced-tools.js +0 -109
- package/dist/core/comment-decision.d.ts +0 -79
- package/dist/core/comment-decision.js +0 -82
- package/dist/core/extraction-categories.d.ts +0 -55
- package/dist/core/extraction-categories.js +0 -108
- package/dist/core/follow-up-history.d.ts +0 -40
- package/dist/core/follow-up-history.js +0 -71
- package/dist/core/issue-effort.d.ts +0 -29
- package/dist/core/issue-effort.js +0 -47
- package/dist/core/maintainer-hints.d.ts +0 -23
- package/dist/core/maintainer-hints.js +0 -36
- package/dist/core/workflow-state.d.ts +0 -56
- package/dist/core/workflow-state.js +0 -101
- package/dist/dashboard/assets/chart-panel-DPKNBUts.js +0 -3
- package/dist/dashboard/assets/index-B25bZOYX.js +0 -55
|
@@ -1,108 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Per-repo extraction category configuration (#1284).
|
|
3
|
-
*
|
|
4
|
-
* The `extract-learnings` MCP prompt produces a structured markdown
|
|
5
|
-
* document organized into category sections. The default category
|
|
6
|
-
* set is sensible for typical web/library OSS work; specialized
|
|
7
|
-
* repos (security-focused, performance-critical, accessibility-
|
|
8
|
-
* forward) benefit from a tailored taxonomy.
|
|
9
|
-
*
|
|
10
|
-
* This module is the single source of truth for:
|
|
11
|
-
* - The default category list.
|
|
12
|
-
* - Validation of custom category lists (non-empty, no duplicates,
|
|
13
|
-
* reasonable string lengths).
|
|
14
|
-
* - Resolution: given a repo's optional override, produce the list
|
|
15
|
-
* of categories the prompt and the storage layer should use.
|
|
16
|
-
*
|
|
17
|
-
* Pure typed helper — no I/O. Same architectural shape as the recent
|
|
18
|
-
* #1252 / #1264 / #1286 / #1279 / #1277 extractions.
|
|
19
|
-
*
|
|
20
|
-
* Out of scope (deferred per #1284):
|
|
21
|
-
* - Wiring `categories` into the `guidelines store` / `guidelines view`
|
|
22
|
-
* shape so the override persists alongside the markdown.
|
|
23
|
-
* - Updating the `extract-learnings` MCP prompt to consume the
|
|
24
|
-
* resolved category list at run time.
|
|
25
|
-
* - Detecting repo type from signals (SECURITY.md presence, repo
|
|
26
|
-
* topics, etc.) to suggest categories.
|
|
27
|
-
*/
|
|
28
|
-
/**
|
|
29
|
-
* The default category list used by `extract-learnings` when no
|
|
30
|
-
* per-repo override is configured. Order matters: the prompt
|
|
31
|
-
* renders sections in this order, so `Code Style` first /
|
|
32
|
-
* `Other` last is the established convention.
|
|
33
|
-
*/
|
|
34
|
-
export const DEFAULT_EXTRACTION_CATEGORIES = [
|
|
35
|
-
'Code Style',
|
|
36
|
-
'Process',
|
|
37
|
-
'Architecture',
|
|
38
|
-
'Testing',
|
|
39
|
-
'Other',
|
|
40
|
-
];
|
|
41
|
-
/**
|
|
42
|
-
* Reasonable bounds on an override list. The prompt produces output
|
|
43
|
-
* organized into one heading per category; very long lists become
|
|
44
|
-
* unreadable, very long category names blow out heading width.
|
|
45
|
-
*/
|
|
46
|
-
const CATEGORY_NAME_MAX_LENGTH = 40;
|
|
47
|
-
const MAX_CATEGORIES = 12;
|
|
48
|
-
/**
|
|
49
|
-
* Validate a user-supplied category list. Returns a structured
|
|
50
|
-
* result rather than throwing — the CLI / slash-command callers
|
|
51
|
-
* surface error strings inline.
|
|
52
|
-
*/
|
|
53
|
-
export function validateCategories(input) {
|
|
54
|
-
const errors = [];
|
|
55
|
-
if (input.length === 0) {
|
|
56
|
-
errors.push('At least one category is required.');
|
|
57
|
-
return { ok: false, errors };
|
|
58
|
-
}
|
|
59
|
-
if (input.length > MAX_CATEGORIES) {
|
|
60
|
-
errors.push(`At most ${MAX_CATEGORIES} categories are supported (received ${input.length}).`);
|
|
61
|
-
}
|
|
62
|
-
const seen = new Set();
|
|
63
|
-
const cleaned = [];
|
|
64
|
-
for (const raw of input) {
|
|
65
|
-
const trimmed = raw.trim();
|
|
66
|
-
if (trimmed.length === 0) {
|
|
67
|
-
errors.push('Category names cannot be empty or whitespace-only.');
|
|
68
|
-
continue;
|
|
69
|
-
}
|
|
70
|
-
if (trimmed.length > CATEGORY_NAME_MAX_LENGTH) {
|
|
71
|
-
errors.push(`Category "${trimmed.slice(0, 30)}…" is longer than ${CATEGORY_NAME_MAX_LENGTH} characters.`);
|
|
72
|
-
continue;
|
|
73
|
-
}
|
|
74
|
-
const lowerKey = trimmed.toLowerCase();
|
|
75
|
-
if (seen.has(lowerKey)) {
|
|
76
|
-
errors.push(`Duplicate category "${trimmed}" (case-insensitive).`);
|
|
77
|
-
continue;
|
|
78
|
-
}
|
|
79
|
-
seen.add(lowerKey);
|
|
80
|
-
cleaned.push(trimmed);
|
|
81
|
-
}
|
|
82
|
-
if (errors.length > 0) {
|
|
83
|
-
return { ok: false, errors };
|
|
84
|
-
}
|
|
85
|
-
// Always ensure an "Other" bucket exists at the end so the prompt
|
|
86
|
-
// has a place to put feedback that doesn't fit the user's chosen
|
|
87
|
-
// categories. Append silently if missing rather than treating the
|
|
88
|
-
// omission as an error — most users won't think to add it.
|
|
89
|
-
if (!seen.has('other')) {
|
|
90
|
-
cleaned.push('Other');
|
|
91
|
-
}
|
|
92
|
-
return { ok: true, errors: [], normalized: cleaned };
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Resolve the categories the prompt + storage layer should use for a
|
|
96
|
-
* specific extraction. Falls back to the default list when no
|
|
97
|
-
* override is supplied or when the override fails validation.
|
|
98
|
-
*/
|
|
99
|
-
export function resolveCategories(override) {
|
|
100
|
-
if (!override || override.length === 0) {
|
|
101
|
-
return DEFAULT_EXTRACTION_CATEGORIES;
|
|
102
|
-
}
|
|
103
|
-
const result = validateCategories(override);
|
|
104
|
-
if (!result.ok || !result.normalized) {
|
|
105
|
-
return DEFAULT_EXTRACTION_CATEGORIES;
|
|
106
|
-
}
|
|
107
|
-
return result.normalized;
|
|
108
|
-
}
|
|
@@ -1,40 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PR follow-up history helpers (#1277).
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the read/write logic for `state.prFollowUpHistory`.
|
|
5
|
-
* Used by `workflows/dormant-pr-follow-up.md` to enforce the
|
|
6
|
-
* one-follow-up-per-timeframe rule documented in
|
|
7
|
-
* `skills/pr-etiquette/SKILL.md`.
|
|
8
|
-
*
|
|
9
|
-
* Pure functions — callers manage state I/O.
|
|
10
|
-
*/
|
|
11
|
-
import type { AgentState, FollowUpEntry } from './state-schema.js';
|
|
12
|
-
export type FollowUpTier = 'light_check_in' | 'direct_check_in' | 'final_check_in';
|
|
13
|
-
/**
|
|
14
|
-
* Tier window in days. The "no second ping in the same window" rule
|
|
15
|
-
* uses this to decide whether a recent follow-up still locks out the
|
|
16
|
-
* next draft. Sourced from `skills/pr-etiquette/SKILL.md`.
|
|
17
|
-
*/
|
|
18
|
-
export declare const TIER_WINDOW_DAYS: Record<FollowUpTier, number>;
|
|
19
|
-
/**
|
|
20
|
-
* Read the existing follow-up entries for a PR. Returns an empty
|
|
21
|
-
* array when no entries exist or when the state field is unset.
|
|
22
|
-
*/
|
|
23
|
-
export declare function getFollowUpHistory(state: AgentState, prUrl: string): FollowUpEntry[];
|
|
24
|
-
/**
|
|
25
|
-
* Find the most recent entry, or null when there are none. Used by
|
|
26
|
-
* the workflow's pre-draft gate.
|
|
27
|
-
*/
|
|
28
|
-
export declare function lastFollowUp(state: AgentState, prUrl: string): FollowUpEntry | null;
|
|
29
|
-
/**
|
|
30
|
-
* Whether a follow-up of the given tier was drafted within the
|
|
31
|
-
* tier's own window. The workflow uses this to surface a warning
|
|
32
|
-
* before the user drafts a second ping in the same window. Different
|
|
33
|
-
* tiers are always allowed (escalating light → direct → final).
|
|
34
|
-
*/
|
|
35
|
-
export declare function isWithinTierWindow(state: AgentState, prUrl: string, tier: FollowUpTier, now?: Date): boolean;
|
|
36
|
-
/**
|
|
37
|
-
* Record a new follow-up entry. Returns the next state; callers
|
|
38
|
-
* decide when to persist.
|
|
39
|
-
*/
|
|
40
|
-
export declare function recordFollowUp(state: AgentState, prUrl: string, entry: FollowUpEntry): AgentState;
|
|
@@ -1,71 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* PR follow-up history helpers (#1277).
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the read/write logic for `state.prFollowUpHistory`.
|
|
5
|
-
* Used by `workflows/dormant-pr-follow-up.md` to enforce the
|
|
6
|
-
* one-follow-up-per-timeframe rule documented in
|
|
7
|
-
* `skills/pr-etiquette/SKILL.md`.
|
|
8
|
-
*
|
|
9
|
-
* Pure functions — callers manage state I/O.
|
|
10
|
-
*/
|
|
11
|
-
/**
|
|
12
|
-
* Tier window in days. The "no second ping in the same window" rule
|
|
13
|
-
* uses this to decide whether a recent follow-up still locks out the
|
|
14
|
-
* next draft. Sourced from `skills/pr-etiquette/SKILL.md`.
|
|
15
|
-
*/
|
|
16
|
-
export const TIER_WINDOW_DAYS = {
|
|
17
|
-
light_check_in: 7,
|
|
18
|
-
direct_check_in: 14,
|
|
19
|
-
final_check_in: 30,
|
|
20
|
-
};
|
|
21
|
-
/**
|
|
22
|
-
* Read the existing follow-up entries for a PR. Returns an empty
|
|
23
|
-
* array when no entries exist or when the state field is unset.
|
|
24
|
-
*/
|
|
25
|
-
export function getFollowUpHistory(state, prUrl) {
|
|
26
|
-
return state.prFollowUpHistory?.[prUrl] ?? [];
|
|
27
|
-
}
|
|
28
|
-
/**
|
|
29
|
-
* Find the most recent entry, or null when there are none. Used by
|
|
30
|
-
* the workflow's pre-draft gate.
|
|
31
|
-
*/
|
|
32
|
-
export function lastFollowUp(state, prUrl) {
|
|
33
|
-
const entries = getFollowUpHistory(state, prUrl);
|
|
34
|
-
if (entries.length === 0)
|
|
35
|
-
return null;
|
|
36
|
-
// Newest by timestamp wins. Defensive sort because the persistence
|
|
37
|
-
// path doesn't guarantee insertion order across machines.
|
|
38
|
-
return [...entries].sort((a, b) => Date.parse(b.timestamp) - Date.parse(a.timestamp))[0];
|
|
39
|
-
}
|
|
40
|
-
/**
|
|
41
|
-
* Whether a follow-up of the given tier was drafted within the
|
|
42
|
-
* tier's own window. The workflow uses this to surface a warning
|
|
43
|
-
* before the user drafts a second ping in the same window. Different
|
|
44
|
-
* tiers are always allowed (escalating light → direct → final).
|
|
45
|
-
*/
|
|
46
|
-
export function isWithinTierWindow(state, prUrl, tier, now = new Date()) {
|
|
47
|
-
const last = lastFollowUp(state, prUrl);
|
|
48
|
-
if (!last)
|
|
49
|
-
return false;
|
|
50
|
-
if (last.tier !== tier)
|
|
51
|
-
return false;
|
|
52
|
-
const ageMs = now.getTime() - Date.parse(last.timestamp);
|
|
53
|
-
if (Number.isNaN(ageMs))
|
|
54
|
-
return false;
|
|
55
|
-
const windowMs = TIER_WINDOW_DAYS[tier] * 86_400_000;
|
|
56
|
-
return ageMs < windowMs;
|
|
57
|
-
}
|
|
58
|
-
/**
|
|
59
|
-
* Record a new follow-up entry. Returns the next state; callers
|
|
60
|
-
* decide when to persist.
|
|
61
|
-
*/
|
|
62
|
-
export function recordFollowUp(state, prUrl, entry) {
|
|
63
|
-
const next = {
|
|
64
|
-
...state,
|
|
65
|
-
prFollowUpHistory: { ...(state.prFollowUpHistory ?? {}) },
|
|
66
|
-
};
|
|
67
|
-
const list = next.prFollowUpHistory[prUrl] ? [...next.prFollowUpHistory[prUrl]] : [];
|
|
68
|
-
list.push(entry);
|
|
69
|
-
next.prFollowUpHistory[prUrl] = list;
|
|
70
|
-
return next;
|
|
71
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action-menu issue effort classification (#1264).
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `workflows/action-menu.md`'s in-prompt truth table so
|
|
5
|
-
* the rules are typed, unit-testable, and tunable without editing
|
|
6
|
-
* markdown. Same architectural shape as the typed-core extractions in
|
|
7
|
-
* #1245 (compliance-score), #1242 (repo-vet), #1243 (strategy), and
|
|
8
|
-
* #1252 (pr-quality-rubric).
|
|
9
|
-
*/
|
|
10
|
-
/** Issue types the action menu surfaces. Match the strings the CLI emits in
|
|
11
|
-
* `data.daily.actionableIssues[*].type`. */
|
|
12
|
-
export type ActionableIssueType = 'needs_response' | 'needs_changes' | 'incomplete_checklist' | 'ci_failing' | 'merge_conflict';
|
|
13
|
-
export type IssueEffort = 'small' | 'medium' | 'large';
|
|
14
|
-
/**
|
|
15
|
-
* Decide the effort label for an actionable issue based on its type and
|
|
16
|
-
* how many maintainer hints accompany it. Default falls through to
|
|
17
|
-
* `medium` for any unrecognized combination — the action-menu workflow
|
|
18
|
-
* still renders something useful when the CLI surfaces a new issue
|
|
19
|
-
* type before this function is updated.
|
|
20
|
-
*
|
|
21
|
-
* Truth table sourced verbatim from `workflows/action-menu.md`:
|
|
22
|
-
*
|
|
23
|
-
* | Effort | Condition |
|
|
24
|
-
* |--------|-----------|
|
|
25
|
-
* | small | needs_response with 0-1 hints, incomplete_checklist |
|
|
26
|
-
* | medium | needs_response with 2+ hints, needs_changes with 0-2 hints, ci_failing |
|
|
27
|
-
* | large | merge_conflict, needs_changes with 3+ hints |
|
|
28
|
-
*/
|
|
29
|
-
export declare function computeIssueEffort(type: ActionableIssueType, hintCount: number): IssueEffort;
|
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Action-menu issue effort classification (#1264).
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `workflows/action-menu.md`'s in-prompt truth table so
|
|
5
|
-
* the rules are typed, unit-testable, and tunable without editing
|
|
6
|
-
* markdown. Same architectural shape as the typed-core extractions in
|
|
7
|
-
* #1245 (compliance-score), #1242 (repo-vet), #1243 (strategy), and
|
|
8
|
-
* #1252 (pr-quality-rubric).
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Decide the effort label for an actionable issue based on its type and
|
|
12
|
-
* how many maintainer hints accompany it. Default falls through to
|
|
13
|
-
* `medium` for any unrecognized combination — the action-menu workflow
|
|
14
|
-
* still renders something useful when the CLI surfaces a new issue
|
|
15
|
-
* type before this function is updated.
|
|
16
|
-
*
|
|
17
|
-
* Truth table sourced verbatim from `workflows/action-menu.md`:
|
|
18
|
-
*
|
|
19
|
-
* | Effort | Condition |
|
|
20
|
-
* |--------|-----------|
|
|
21
|
-
* | small | needs_response with 0-1 hints, incomplete_checklist |
|
|
22
|
-
* | medium | needs_response with 2+ hints, needs_changes with 0-2 hints, ci_failing |
|
|
23
|
-
* | large | merge_conflict, needs_changes with 3+ hints |
|
|
24
|
-
*/
|
|
25
|
-
export function computeIssueEffort(type, hintCount) {
|
|
26
|
-
const hints = Math.max(0, hintCount);
|
|
27
|
-
switch (type) {
|
|
28
|
-
case 'needs_response': {
|
|
29
|
-
return hints <= 1 ? 'small' : 'medium';
|
|
30
|
-
}
|
|
31
|
-
case 'incomplete_checklist': {
|
|
32
|
-
return 'small';
|
|
33
|
-
}
|
|
34
|
-
case 'needs_changes': {
|
|
35
|
-
return hints >= 3 ? 'large' : 'medium';
|
|
36
|
-
}
|
|
37
|
-
case 'ci_failing': {
|
|
38
|
-
return 'medium';
|
|
39
|
-
}
|
|
40
|
-
case 'merge_conflict': {
|
|
41
|
-
return 'large';
|
|
42
|
-
}
|
|
43
|
-
default: {
|
|
44
|
-
return 'medium';
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maintainer-hint label constants (#1264).
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `workflows/action-menu.md`'s in-prompt mapping so the
|
|
5
|
-
* label strings live in typed code instead of markdown. Adding a new
|
|
6
|
-
* hint type becomes a single-file change in core; the workflow gets
|
|
7
|
-
* the new label for free instead of requiring a parallel markdown
|
|
8
|
-
* edit. Same pattern as #1252.
|
|
9
|
-
*/
|
|
10
|
-
export type MaintainerHint = 'demo_requested' | 'tests_requested' | 'changes_requested' | 'docs_requested' | 'rebase_requested';
|
|
11
|
-
/**
|
|
12
|
-
* Display labels the action-menu workflow renders for each hint type.
|
|
13
|
-
* Source of truth — both `data.daily.actionableIssues[*].maintainerHintsLabel`
|
|
14
|
-
* (computed by the CLI) and the workflow's prose docs reference this map.
|
|
15
|
-
*/
|
|
16
|
-
export declare const MAINTAINER_HINT_LABELS: Record<MaintainerHint, string>;
|
|
17
|
-
/**
|
|
18
|
-
* Format an array of hints as a comma-joined human label, in the same
|
|
19
|
-
* order the caller passed them. Unknown hint values are dropped silently —
|
|
20
|
-
* a future CLI version might emit a hint type the workflow doesn't yet
|
|
21
|
-
* know about; rendering "undefined" would be worse than omitting it.
|
|
22
|
-
*/
|
|
23
|
-
export declare function formatMaintainerHints(hints: readonly MaintainerHint[] | readonly string[]): string;
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Maintainer-hint label constants (#1264).
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `workflows/action-menu.md`'s in-prompt mapping so the
|
|
5
|
-
* label strings live in typed code instead of markdown. Adding a new
|
|
6
|
-
* hint type becomes a single-file change in core; the workflow gets
|
|
7
|
-
* the new label for free instead of requiring a parallel markdown
|
|
8
|
-
* edit. Same pattern as #1252.
|
|
9
|
-
*/
|
|
10
|
-
/**
|
|
11
|
-
* Display labels the action-menu workflow renders for each hint type.
|
|
12
|
-
* Source of truth — both `data.daily.actionableIssues[*].maintainerHintsLabel`
|
|
13
|
-
* (computed by the CLI) and the workflow's prose docs reference this map.
|
|
14
|
-
*/
|
|
15
|
-
export const MAINTAINER_HINT_LABELS = {
|
|
16
|
-
demo_requested: 'demo/screenshot requested',
|
|
17
|
-
tests_requested: 'tests requested',
|
|
18
|
-
changes_requested: 'code changes requested',
|
|
19
|
-
docs_requested: 'documentation requested',
|
|
20
|
-
rebase_requested: 'rebase requested',
|
|
21
|
-
};
|
|
22
|
-
/**
|
|
23
|
-
* Format an array of hints as a comma-joined human label, in the same
|
|
24
|
-
* order the caller passed them. Unknown hint values are dropped silently —
|
|
25
|
-
* a future CLI version might emit a hint type the workflow doesn't yet
|
|
26
|
-
* know about; rendering "undefined" would be worse than omitting it.
|
|
27
|
-
*/
|
|
28
|
-
export function formatMaintainerHints(hints) {
|
|
29
|
-
const labels = [];
|
|
30
|
-
for (const h of hints) {
|
|
31
|
-
const label = MAINTAINER_HINT_LABELS[h];
|
|
32
|
-
if (label)
|
|
33
|
-
labels.push(label);
|
|
34
|
-
}
|
|
35
|
-
return labels.join(', ');
|
|
36
|
-
}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflow-state helpers (#1280).
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the read/write logic for `state.workflowState`. Used
|
|
5
|
-
* by `draft-first-workflow.md`, `work-through-issues.md`, and
|
|
6
|
-
* `pre-commit-review.md` to record pause points and offer
|
|
7
|
-
* Resume / Restart / Discard at the next `/oss` invocation.
|
|
8
|
-
*
|
|
9
|
-
* Pure functions — callers manage state I/O. Same architectural
|
|
10
|
-
* shape as the recent #1277 (follow-up-history) helpers.
|
|
11
|
-
*/
|
|
12
|
-
import type { AgentState, WorkflowState } from './state-schema.js';
|
|
13
|
-
export type WorkflowName = WorkflowState['workflowName'];
|
|
14
|
-
/**
|
|
15
|
-
* Snapshot the user's current workflow position. Returns the
|
|
16
|
-
* patched state; callers persist via `StateManager.save()` (or the
|
|
17
|
-
* gist `checkpoint()` path).
|
|
18
|
-
*/
|
|
19
|
-
export declare function recordWorkflowPause(state: AgentState, next: Omit<WorkflowState, 'lastUpdatedAt'>, now?: Date): AgentState;
|
|
20
|
-
/**
|
|
21
|
-
* Read the current workflow snapshot, or null when no pause is
|
|
22
|
-
* recorded.
|
|
23
|
-
*/
|
|
24
|
-
export declare function getWorkflowState(state: AgentState): WorkflowState | null;
|
|
25
|
-
/**
|
|
26
|
-
* Discard the current pause snapshot. Used by:
|
|
27
|
-
* - the workflow completing normally,
|
|
28
|
-
* - the user picking "Discard and start fresh" at the resume
|
|
29
|
-
* prompt,
|
|
30
|
-
* - any consumer that detects the snapshot has gone stale (branch
|
|
31
|
-
* deleted, repo no longer reachable).
|
|
32
|
-
*/
|
|
33
|
-
export declare function clearWorkflowState(state: AgentState): AgentState;
|
|
34
|
-
/**
|
|
35
|
-
* Append a step name to `completedSteps` and update `currentStep`
|
|
36
|
-
* to the supplied next step. Convenience wrapper around the immer-
|
|
37
|
-
* style read/replace pattern. Returns the patched state.
|
|
38
|
-
*/
|
|
39
|
-
export declare function advanceWorkflowStep(state: AgentState, nextStep: string, now?: Date): AgentState;
|
|
40
|
-
/**
|
|
41
|
-
* Merge per-step data into `stepData` without overwriting other
|
|
42
|
-
* keys. Useful when a workflow's resume needs to restore non-trivial
|
|
43
|
-
* context (skipped compliance items, last review pass count, etc.).
|
|
44
|
-
*/
|
|
45
|
-
export declare function setStepData(state: AgentState, step: string, data: unknown, now?: Date): AgentState;
|
|
46
|
-
/**
|
|
47
|
-
* Read step data for a specific step, or undefined when none was
|
|
48
|
-
* stored. Callers typically narrow the unknown via a type guard.
|
|
49
|
-
*/
|
|
50
|
-
export declare function getStepData(state: AgentState, step: string): unknown;
|
|
51
|
-
/**
|
|
52
|
-
* Whether the recorded pause is on the supplied workflow. Useful
|
|
53
|
-
* for the router to decide whether to offer Resume vs ignore the
|
|
54
|
-
* snapshot when the current `/oss` invocation is unrelated.
|
|
55
|
-
*/
|
|
56
|
-
export declare function isPausedIn(state: AgentState, workflowName: WorkflowName): boolean;
|
|
@@ -1,101 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Workflow-state helpers (#1280).
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the read/write logic for `state.workflowState`. Used
|
|
5
|
-
* by `draft-first-workflow.md`, `work-through-issues.md`, and
|
|
6
|
-
* `pre-commit-review.md` to record pause points and offer
|
|
7
|
-
* Resume / Restart / Discard at the next `/oss` invocation.
|
|
8
|
-
*
|
|
9
|
-
* Pure functions — callers manage state I/O. Same architectural
|
|
10
|
-
* shape as the recent #1277 (follow-up-history) helpers.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Snapshot the user's current workflow position. Returns the
|
|
14
|
-
* patched state; callers persist via `StateManager.save()` (or the
|
|
15
|
-
* gist `checkpoint()` path).
|
|
16
|
-
*/
|
|
17
|
-
export function recordWorkflowPause(state, next, now = new Date()) {
|
|
18
|
-
const incoming = {
|
|
19
|
-
...next,
|
|
20
|
-
lastUpdatedAt: now.toISOString(),
|
|
21
|
-
};
|
|
22
|
-
return { ...state, workflowState: incoming };
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Read the current workflow snapshot, or null when no pause is
|
|
26
|
-
* recorded.
|
|
27
|
-
*/
|
|
28
|
-
export function getWorkflowState(state) {
|
|
29
|
-
return state.workflowState ?? null;
|
|
30
|
-
}
|
|
31
|
-
/**
|
|
32
|
-
* Discard the current pause snapshot. Used by:
|
|
33
|
-
* - the workflow completing normally,
|
|
34
|
-
* - the user picking "Discard and start fresh" at the resume
|
|
35
|
-
* prompt,
|
|
36
|
-
* - any consumer that detects the snapshot has gone stale (branch
|
|
37
|
-
* deleted, repo no longer reachable).
|
|
38
|
-
*/
|
|
39
|
-
export function clearWorkflowState(state) {
|
|
40
|
-
if (!state.workflowState)
|
|
41
|
-
return state;
|
|
42
|
-
const { workflowState: _drop, ...rest } = state;
|
|
43
|
-
return rest;
|
|
44
|
-
}
|
|
45
|
-
/**
|
|
46
|
-
* Append a step name to `completedSteps` and update `currentStep`
|
|
47
|
-
* to the supplied next step. Convenience wrapper around the immer-
|
|
48
|
-
* style read/replace pattern. Returns the patched state.
|
|
49
|
-
*/
|
|
50
|
-
export function advanceWorkflowStep(state, nextStep, now = new Date()) {
|
|
51
|
-
const ws = state.workflowState;
|
|
52
|
-
if (!ws)
|
|
53
|
-
return state;
|
|
54
|
-
if (ws.currentStep === nextStep)
|
|
55
|
-
return state;
|
|
56
|
-
const completed = [...ws.completedSteps];
|
|
57
|
-
if (!completed.includes(ws.currentStep))
|
|
58
|
-
completed.push(ws.currentStep);
|
|
59
|
-
return {
|
|
60
|
-
...state,
|
|
61
|
-
workflowState: {
|
|
62
|
-
...ws,
|
|
63
|
-
currentStep: nextStep,
|
|
64
|
-
completedSteps: completed,
|
|
65
|
-
lastUpdatedAt: now.toISOString(),
|
|
66
|
-
},
|
|
67
|
-
};
|
|
68
|
-
}
|
|
69
|
-
/**
|
|
70
|
-
* Merge per-step data into `stepData` without overwriting other
|
|
71
|
-
* keys. Useful when a workflow's resume needs to restore non-trivial
|
|
72
|
-
* context (skipped compliance items, last review pass count, etc.).
|
|
73
|
-
*/
|
|
74
|
-
export function setStepData(state, step, data, now = new Date()) {
|
|
75
|
-
const ws = state.workflowState;
|
|
76
|
-
if (!ws)
|
|
77
|
-
return state;
|
|
78
|
-
return {
|
|
79
|
-
...state,
|
|
80
|
-
workflowState: {
|
|
81
|
-
...ws,
|
|
82
|
-
stepData: { ...ws.stepData, [step]: data },
|
|
83
|
-
lastUpdatedAt: now.toISOString(),
|
|
84
|
-
},
|
|
85
|
-
};
|
|
86
|
-
}
|
|
87
|
-
/**
|
|
88
|
-
* Read step data for a specific step, or undefined when none was
|
|
89
|
-
* stored. Callers typically narrow the unknown via a type guard.
|
|
90
|
-
*/
|
|
91
|
-
export function getStepData(state, step) {
|
|
92
|
-
return state.workflowState?.stepData[step];
|
|
93
|
-
}
|
|
94
|
-
/**
|
|
95
|
-
* Whether the recorded pause is on the supplied workflow. Useful
|
|
96
|
-
* for the router to decide whether to offer Resume vs ignore the
|
|
97
|
-
* snapshot when the current `/oss` invocation is unrelated.
|
|
98
|
-
*/
|
|
99
|
-
export function isPausedIn(state, workflowName) {
|
|
100
|
-
return state.workflowState?.workflowName === workflowName;
|
|
101
|
-
}
|