@oss-autopilot/core 3.42.4 → 3.43.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 +272 -25
- package/dist/cli.bundle.cjs +183 -154
- package/dist/commands/check-integration.js +1 -0
- package/dist/commands/cleanup.d.ts +76 -0
- package/dist/commands/cleanup.js +269 -0
- package/dist/commands/comments.d.ts +6 -0
- package/dist/commands/comments.js +6 -2
- package/dist/commands/config.js +37 -5
- 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 +122 -0
- package/dist/commands/daily-ledger.js +225 -0
- package/dist/commands/daily-recent-prs.d.ts +26 -0
- package/dist/commands/daily-recent-prs.js +55 -0
- package/dist/commands/daily.d.ts +2 -1
- package/dist/commands/daily.js +59 -89
- package/dist/commands/dashboard-cache.d.ts +2 -0
- package/dist/commands/dashboard-cache.js +33 -8
- package/dist/commands/dashboard-data.js +71 -36
- package/dist/commands/dashboard-gist-sync.js +3 -1
- package/dist/commands/dashboard-lifecycle.js +1 -1
- package/dist/commands/dashboard-process.d.ts +14 -1
- package/dist/commands/dashboard-process.js +46 -7
- package/dist/commands/dashboard-server.js +89 -23
- package/dist/commands/detect-formatters.js +1 -0
- package/dist/commands/dismiss.js +5 -2
- package/dist/commands/doctor.d.ts +15 -1
- package/dist/commands/doctor.js +73 -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/guidelines.d.ts +23 -1
- package/dist/commands/guidelines.js +49 -4
- package/dist/commands/index.d.ts +24 -4
- package/dist/commands/index.js +15 -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 +13 -8
- package/dist/commands/overnight-push-prep.js +106 -34
- 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 +86 -0
- package/dist/commands/policy.js +263 -0
- package/dist/commands/pr-preflight.d.ts +43 -0
- package/dist/commands/pr-preflight.js +294 -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 +46 -18
- package/dist/commands/skip-add.js +10 -1
- package/dist/commands/startup.d.ts +5 -3
- package/dist/commands/startup.js +65 -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 +1 -0
- package/dist/commands/strategy.js +1 -0
- package/dist/commands/vet-list.d.ts +6 -0
- package/dist/commands/vet-list.js +25 -0
- package/dist/commands/vet.d.ts +12 -0
- package/dist/commands/vet.js +118 -1
- 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/checklist-analysis.js +50 -12
- package/dist/core/ci-analysis.d.ts +7 -2
- package/dist/core/ci-analysis.js +76 -21
- package/dist/core/comment-utils.d.ts +1 -1
- package/dist/core/comment-utils.js +7 -1
- package/dist/core/commit-date.d.ts +19 -0
- package/dist/core/commit-date.js +17 -0
- package/dist/core/compliance-score.js +11 -7
- package/dist/core/config-registry.js +11 -5
- package/dist/core/contributing.d.ts +2 -3
- package/dist/core/contributing.js +2 -3
- package/dist/core/daily-logic.d.ts +27 -5
- package/dist/core/daily-logic.js +57 -19
- package/dist/core/errors.d.ts +37 -3
- package/dist/core/errors.js +54 -5
- 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 +97 -46
- package/dist/core/github-stats.d.ts +104 -16
- package/dist/core/github-stats.js +282 -97
- package/dist/core/http-cache.d.ts +0 -10
- package/dist/core/http-cache.js +0 -19
- package/dist/core/index.d.ts +12 -5
- package/dist/core/index.js +15 -5
- 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 +271 -0
- package/dist/core/merged-pr-notes.d.ts +2 -2
- 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.js +6 -2
- package/dist/core/pr-graphql.d.ts +37 -3
- package/dist/core/pr-graphql.js +73 -12
- package/dist/core/pr-monitor.d.ts +29 -12
- package/dist/core/pr-monitor.js +71 -23
- package/dist/core/pr-preflight.d.ts +113 -0
- package/dist/core/pr-preflight.js +364 -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/repo-policy.d.ts +105 -0
- package/dist/core/repo-policy.js +400 -0
- package/dist/core/repo-score-manager.d.ts +48 -0
- package/dist/core/repo-score-manager.js +111 -1
- package/dist/core/review-analysis.d.ts +34 -19
- package/dist/core/review-analysis.js +74 -19
- package/dist/core/reviewed-prs-fetch.js +11 -29
- package/dist/core/reviewed-prs.js +8 -15
- package/dist/core/stale-data.d.ts +41 -0
- package/dist/core/stale-data.js +115 -0
- package/dist/core/state-persistence.d.ts +62 -27
- package/dist/core/state-persistence.js +338 -117
- package/dist/core/state-schema.d.ts +113 -210
- package/dist/core/state-schema.js +165 -80
- package/dist/core/state.d.ts +60 -8
- package/dist/core/state.js +192 -46
- package/dist/core/status-determination.js +26 -8
- 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 +77 -42
- package/dist/core/urls.d.ts +9 -0
- package/dist/core/urls.js +18 -0
- package/dist/dashboard/assets/{chart-panel-DPKNBUts.js → chart-panel-C_C1lFTI.js} +1 -1
- package/dist/dashboard/assets/{index-B25bZOYX.js → index-B--H66Jk.js} +1 -1
- package/dist/dashboard/index.html +1 -1
- package/dist/formatters/json.d.ts +262 -6
- package/dist/formatters/json.js +77 -1
- package/package.json +1 -1
- 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
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* CI-enforced tool detection (#1286).
|
|
3
|
-
*
|
|
4
|
-
* Extracted from `workflows/pre-commit-review.md` Steps 2b and 6a so
|
|
5
|
-
* the same logic isn't reimplemented twice in markdown. Callers
|
|
6
|
-
* supply pre-fetched config snippets (the workflow runs `cat` /
|
|
7
|
-
* `head` against the well-known files); this function does the
|
|
8
|
-
* structured parse.
|
|
9
|
-
*
|
|
10
|
-
* Pure typed helper — no I/O.
|
|
11
|
-
*/
|
|
12
|
-
/**
|
|
13
|
-
* Detect which class of tool each input source enforces. The output
|
|
14
|
-
* may contain duplicates (e.g., `test` enforced by both pre-commit
|
|
15
|
-
* and a GitHub workflow); callers can dedupe on `tool` or display
|
|
16
|
-
* each evidence pair separately.
|
|
17
|
-
*/
|
|
18
|
-
export function getCIEnforcedTools(input) {
|
|
19
|
-
const out = [];
|
|
20
|
-
if (input.preCommitConfigYaml) {
|
|
21
|
-
detectFromHaystack(input.preCommitConfigYaml, 'pre-commit', out);
|
|
22
|
-
}
|
|
23
|
-
if (input.workflowYamls) {
|
|
24
|
-
detectFromHaystack(input.workflowYamls, 'github-workflow', out);
|
|
25
|
-
}
|
|
26
|
-
if (input.makefile) {
|
|
27
|
-
detectFromHaystack(input.makefile, 'makefile', out);
|
|
28
|
-
}
|
|
29
|
-
if (input.packageJson) {
|
|
30
|
-
detectScriptsFromPackageJson(input.packageJson, out);
|
|
31
|
-
}
|
|
32
|
-
return out;
|
|
33
|
-
}
|
|
34
|
-
function detectFromHaystack(haystack, source, out) {
|
|
35
|
-
const lower = haystack.toLowerCase();
|
|
36
|
-
const checks = [
|
|
37
|
-
{
|
|
38
|
-
tool: 'lint',
|
|
39
|
-
pattern: /\b(?:eslint|biome|ruff|flake8|rubocop|golangci-lint|clippy|pylint)\b/i,
|
|
40
|
-
evidenceFor: ['eslint', 'biome', 'ruff', 'flake8', 'rubocop', 'golangci-lint', 'clippy', 'pylint'],
|
|
41
|
-
},
|
|
42
|
-
{
|
|
43
|
-
tool: 'format',
|
|
44
|
-
pattern: /\b(?:prettier|biome[\s-]+format|black|gofmt|rustfmt|clang-format)\b/i,
|
|
45
|
-
evidenceFor: ['prettier', 'biome', 'black', 'gofmt', 'rustfmt', 'clang-format'],
|
|
46
|
-
},
|
|
47
|
-
{
|
|
48
|
-
tool: 'typecheck',
|
|
49
|
-
pattern: /\b(?:tsc|mypy|sorbet|pyright|flow)\b/i,
|
|
50
|
-
evidenceFor: ['tsc', 'mypy', 'sorbet', 'pyright', 'flow'],
|
|
51
|
-
},
|
|
52
|
-
{
|
|
53
|
-
tool: 'test',
|
|
54
|
-
pattern: /\b(?:vitest|jest|pytest|rspec|go test|cargo test|mocha)\b/i,
|
|
55
|
-
evidenceFor: ['vitest', 'jest', 'pytest', 'rspec', 'go test', 'cargo test', 'mocha'],
|
|
56
|
-
},
|
|
57
|
-
{
|
|
58
|
-
// `tsc` alone (or `tsc --noEmit`) is a typecheck, not a build artifact
|
|
59
|
-
// step — keep it out of this pattern so a workflow with only
|
|
60
|
-
// `tsc --noEmit` doesn't fire BOTH `typecheck` and `build`. Real
|
|
61
|
-
// build steps that do produce artifacts (tsup, esbuild, webpack,
|
|
62
|
-
// cargo build, go build) stay here.
|
|
63
|
-
tool: 'build',
|
|
64
|
-
pattern: /\b(?:tsup|esbuild|webpack|cargo build|go build)\b/i,
|
|
65
|
-
evidenceFor: ['tsup', 'esbuild', 'webpack', 'cargo build', 'go build'],
|
|
66
|
-
},
|
|
67
|
-
{
|
|
68
|
-
tool: 'commit-format',
|
|
69
|
-
pattern: /\b(?:commitlint|conventional-commits)\b/i,
|
|
70
|
-
evidenceFor: ['commitlint', 'conventional-commits'],
|
|
71
|
-
},
|
|
72
|
-
{
|
|
73
|
-
tool: 'security-scan',
|
|
74
|
-
pattern: /\b(?:codeql|semgrep|trivy|gitleaks|snyk)\b/i,
|
|
75
|
-
evidenceFor: ['codeql', 'semgrep', 'trivy', 'gitleaks', 'snyk'],
|
|
76
|
-
},
|
|
77
|
-
];
|
|
78
|
-
for (const c of checks) {
|
|
79
|
-
if (c.pattern.test(lower)) {
|
|
80
|
-
const evidence = c.evidenceFor.find((e) => lower.includes(e)) ?? c.tool;
|
|
81
|
-
out.push({ tool: c.tool, source, evidence });
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
}
|
|
85
|
-
function detectScriptsFromPackageJson(packageJson, out) {
|
|
86
|
-
let parsed;
|
|
87
|
-
try {
|
|
88
|
-
parsed = JSON.parse(packageJson);
|
|
89
|
-
}
|
|
90
|
-
catch {
|
|
91
|
-
return;
|
|
92
|
-
}
|
|
93
|
-
const scripts = parsed.scripts ?? {};
|
|
94
|
-
const scriptToTool = [
|
|
95
|
-
{ key: /^lint(:|$)/, tool: 'lint' },
|
|
96
|
-
{ key: /^format(:|$)/, tool: 'format' },
|
|
97
|
-
{ key: /^typecheck(:|$)|^tsc(:|$)/, tool: 'typecheck' },
|
|
98
|
-
{ key: /^test(:|$)/, tool: 'test' },
|
|
99
|
-
{ key: /^build(:|$)/, tool: 'build' },
|
|
100
|
-
];
|
|
101
|
-
for (const [name] of Object.entries(scripts)) {
|
|
102
|
-
for (const m of scriptToTool) {
|
|
103
|
-
if (m.key.test(name)) {
|
|
104
|
-
out.push({ tool: m.tool, source: 'package-json', evidence: `scripts.${name}` });
|
|
105
|
-
break;
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
}
|
|
109
|
-
}
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-push comment decision (#1286).
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the "should I draft a comment, or does the diff speak
|
|
5
|
-
* for itself?" rule that was duplicated between
|
|
6
|
-
* `workflows/pre-commit-review.md` Step 7a and `agents/pr-responder.md`
|
|
7
|
-
* Step 3.
|
|
8
|
-
*
|
|
9
|
-
* Pure typed helper — no LLM, no I/O. Callers do the upstream natural-
|
|
10
|
-
* language classification (mapping a maintainer comment to a structured
|
|
11
|
-
* `FeedbackCategory` + flags) and pass in the result. This module owns
|
|
12
|
-
* the rule that decides skip vs. draft from the structured input.
|
|
13
|
-
*
|
|
14
|
-
* Same architectural shape as #1245 (compliance-score), #1242 (repo-vet),
|
|
15
|
-
* #1243 (strategy), #1252 (pr-quality-rubric), and #1264 (issue-effort /
|
|
16
|
-
* maintainer-hints).
|
|
17
|
-
*/
|
|
18
|
-
export type FeedbackCategory = 'code_request' | 'question' | 'explanation_request' | 'style_request' | 'design_discussion' | 'approval_with_nit' | 'formatting_complaint'
|
|
19
|
-
/**
|
|
20
|
-
* A maintainer comment whose main content is thanks or praise (not a polite
|
|
21
|
-
* opener on a request); always gets a short acknowledgment (#1852).
|
|
22
|
-
*/
|
|
23
|
-
| 'appreciation';
|
|
24
|
-
export interface FeedbackClassification {
|
|
25
|
-
category: FeedbackCategory;
|
|
26
|
-
/**
|
|
27
|
-
* Whether this individual feedback item, considered in isolation,
|
|
28
|
-
* requires a drafted comment. Aggregated by `shouldDraftResponse`
|
|
29
|
-
* across the full feedback list.
|
|
30
|
-
*/
|
|
31
|
-
needsComment: boolean;
|
|
32
|
-
/** Short rationale rendered alongside the decision. */
|
|
33
|
-
reason: string;
|
|
34
|
-
}
|
|
35
|
-
export interface CommentDecisionInput {
|
|
36
|
-
/**
|
|
37
|
-
* Pre-classified feedback items in chronological order. The caller
|
|
38
|
-
* (agent or workflow) is responsible for the natural-language
|
|
39
|
-
* categorization step; this function only consumes structured input.
|
|
40
|
-
*/
|
|
41
|
-
feedback: readonly FeedbackClassification[];
|
|
42
|
-
/**
|
|
43
|
-
* True when the contributor pushed code that addresses every
|
|
44
|
-
* feedback item that requested a code change. The agent's diff
|
|
45
|
-
* inspection determines this; the function trusts the boolean.
|
|
46
|
-
*/
|
|
47
|
-
allRequestedChangesAddressed: boolean;
|
|
48
|
-
}
|
|
49
|
-
export interface CommentDecisionResult {
|
|
50
|
-
shouldDraft: boolean;
|
|
51
|
-
reason: string;
|
|
52
|
-
}
|
|
53
|
-
/**
|
|
54
|
-
* Decide whether the contributor should draft a comment after a push.
|
|
55
|
-
*
|
|
56
|
-
* Rule (sourced verbatim from `workflows/pre-commit-review.md` Step 7a
|
|
57
|
-
* and `agents/pr-responder.md` "Comment Decision Logic"):
|
|
58
|
-
*
|
|
59
|
-
* - Skip the comment entirely when ALL of these are true:
|
|
60
|
-
* 1. Every piece of maintainer feedback that requested code changes
|
|
61
|
-
* has a corresponding code change.
|
|
62
|
-
* 2. No question was asked and no maintainer thanks or praise is
|
|
63
|
-
* waiting for an acknowledgment.
|
|
64
|
-
* 3. Nothing was intentionally left unchanged (a "yes the maintainer
|
|
65
|
-
* asked but I did not change it" item always needs explanation).
|
|
66
|
-
* 4. The diff makes the fix self-evident — modeled here as the
|
|
67
|
-
* `allRequestedChangesAddressed` flag the caller passes in.
|
|
68
|
-
*
|
|
69
|
-
* - Draft a comment if ANY of these are true:
|
|
70
|
-
* 1. The maintainer asked a question, or thanked or praised the
|
|
71
|
-
* contributor (#1852).
|
|
72
|
-
* 2. The feedback is conceptual or design-level (the diff alone
|
|
73
|
-
* cannot answer "why").
|
|
74
|
-
* 3. Something was intentionally left unchanged (`needsComment: true`
|
|
75
|
-
* on a code-request item where the contributor disagrees).
|
|
76
|
-
* 4. Only some of multiple requested changes were addressed.
|
|
77
|
-
* 5. The contributor deviated from exactly what was asked.
|
|
78
|
-
*/
|
|
79
|
-
export declare function shouldDraftResponse(input: CommentDecisionInput): CommentDecisionResult;
|
|
@@ -1,82 +0,0 @@
|
|
|
1
|
-
/**
|
|
2
|
-
* Post-push comment decision (#1286).
|
|
3
|
-
*
|
|
4
|
-
* Centralizes the "should I draft a comment, or does the diff speak
|
|
5
|
-
* for itself?" rule that was duplicated between
|
|
6
|
-
* `workflows/pre-commit-review.md` Step 7a and `agents/pr-responder.md`
|
|
7
|
-
* Step 3.
|
|
8
|
-
*
|
|
9
|
-
* Pure typed helper — no LLM, no I/O. Callers do the upstream natural-
|
|
10
|
-
* language classification (mapping a maintainer comment to a structured
|
|
11
|
-
* `FeedbackCategory` + flags) and pass in the result. This module owns
|
|
12
|
-
* the rule that decides skip vs. draft from the structured input.
|
|
13
|
-
*
|
|
14
|
-
* Same architectural shape as #1245 (compliance-score), #1242 (repo-vet),
|
|
15
|
-
* #1243 (strategy), #1252 (pr-quality-rubric), and #1264 (issue-effort /
|
|
16
|
-
* maintainer-hints).
|
|
17
|
-
*/
|
|
18
|
-
/**
|
|
19
|
-
* Decide whether the contributor should draft a comment after a push.
|
|
20
|
-
*
|
|
21
|
-
* Rule (sourced verbatim from `workflows/pre-commit-review.md` Step 7a
|
|
22
|
-
* and `agents/pr-responder.md` "Comment Decision Logic"):
|
|
23
|
-
*
|
|
24
|
-
* - Skip the comment entirely when ALL of these are true:
|
|
25
|
-
* 1. Every piece of maintainer feedback that requested code changes
|
|
26
|
-
* has a corresponding code change.
|
|
27
|
-
* 2. No question was asked and no maintainer thanks or praise is
|
|
28
|
-
* waiting for an acknowledgment.
|
|
29
|
-
* 3. Nothing was intentionally left unchanged (a "yes the maintainer
|
|
30
|
-
* asked but I did not change it" item always needs explanation).
|
|
31
|
-
* 4. The diff makes the fix self-evident — modeled here as the
|
|
32
|
-
* `allRequestedChangesAddressed` flag the caller passes in.
|
|
33
|
-
*
|
|
34
|
-
* - Draft a comment if ANY of these are true:
|
|
35
|
-
* 1. The maintainer asked a question, or thanked or praised the
|
|
36
|
-
* contributor (#1852).
|
|
37
|
-
* 2. The feedback is conceptual or design-level (the diff alone
|
|
38
|
-
* cannot answer "why").
|
|
39
|
-
* 3. Something was intentionally left unchanged (`needsComment: true`
|
|
40
|
-
* on a code-request item where the contributor disagrees).
|
|
41
|
-
* 4. Only some of multiple requested changes were addressed.
|
|
42
|
-
* 5. The contributor deviated from exactly what was asked.
|
|
43
|
-
*/
|
|
44
|
-
export function shouldDraftResponse(input) {
|
|
45
|
-
if (input.feedback.length === 0) {
|
|
46
|
-
return { shouldDraft: false, reason: 'no maintainer feedback to address' };
|
|
47
|
-
}
|
|
48
|
-
// Categories that always demand a written reply, regardless of the
|
|
49
|
-
// diff. The diff cannot answer a question, carry a design decision, or
|
|
50
|
-
// acknowledge a maintainer's thanks.
|
|
51
|
-
const alwaysDraftCategories = new Set([
|
|
52
|
-
'question',
|
|
53
|
-
'explanation_request',
|
|
54
|
-
'design_discussion',
|
|
55
|
-
'appreciation',
|
|
56
|
-
]);
|
|
57
|
-
for (const item of input.feedback) {
|
|
58
|
-
if (alwaysDraftCategories.has(item.category)) {
|
|
59
|
-
return {
|
|
60
|
-
shouldDraft: true,
|
|
61
|
-
reason: `${item.category.replaceAll('_', ' ')} needs a written reply the diff cannot give`,
|
|
62
|
-
};
|
|
63
|
-
}
|
|
64
|
-
}
|
|
65
|
-
// Caller flagged at least one item as "I'm intentionally not making
|
|
66
|
-
// this change" or "I deviated" — needs an explanation either way.
|
|
67
|
-
const intentionalGap = input.feedback.find((item) => item.needsComment);
|
|
68
|
-
if (intentionalGap) {
|
|
69
|
-
return {
|
|
70
|
-
shouldDraft: true,
|
|
71
|
-
reason: `requires written explanation: ${intentionalGap.reason}`,
|
|
72
|
-
};
|
|
73
|
-
}
|
|
74
|
-
// Caller signaled the diff covers everything that was requested.
|
|
75
|
-
if (input.allRequestedChangesAddressed) {
|
|
76
|
-
return { shouldDraft: false, reason: 'all requested changes are visible in the diff' };
|
|
77
|
-
}
|
|
78
|
-
return {
|
|
79
|
-
shouldDraft: true,
|
|
80
|
-
reason: 'not all requested changes are visible in the diff yet',
|
|
81
|
-
};
|
|
82
|
-
}
|
|
@@ -1,55 +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 declare const DEFAULT_EXTRACTION_CATEGORIES: readonly string[];
|
|
35
|
-
export interface CategoryValidationResult {
|
|
36
|
-
ok: boolean;
|
|
37
|
-
/** Non-empty when ok === false. One issue per detected problem. */
|
|
38
|
-
errors: string[];
|
|
39
|
-
/** The list as a caller should persist it, with `Other` appended
|
|
40
|
-
* if the user forgot it (the prompt always needs an "everything
|
|
41
|
-
* else" bucket). Only populated when ok === true. */
|
|
42
|
-
normalized?: readonly string[];
|
|
43
|
-
}
|
|
44
|
-
/**
|
|
45
|
-
* Validate a user-supplied category list. Returns a structured
|
|
46
|
-
* result rather than throwing — the CLI / slash-command callers
|
|
47
|
-
* surface error strings inline.
|
|
48
|
-
*/
|
|
49
|
-
export declare function validateCategories(input: readonly string[]): CategoryValidationResult;
|
|
50
|
-
/**
|
|
51
|
-
* Resolve the categories the prompt + storage layer should use for a
|
|
52
|
-
* specific extraction. Falls back to the default list when no
|
|
53
|
-
* override is supplied or when the override fails validation.
|
|
54
|
-
*/
|
|
55
|
-
export declare function resolveCategories(override: readonly string[] | undefined | null): readonly string[];
|
|
@@ -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;
|