cyrus-edge-worker 0.2.39 → 0.2.41
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/cyrus-skills-plugin/.claude-plugin/plugin.json +4 -0
- package/dist/AgentSessionManager.d.ts +4 -58
- package/dist/AgentSessionManager.d.ts.map +1 -1
- package/dist/AgentSessionManager.js +11 -304
- package/dist/AgentSessionManager.js.map +1 -1
- package/dist/ChatSessionHandler.d.ts +2 -2
- package/dist/ChatSessionHandler.d.ts.map +1 -1
- package/dist/ChatSessionHandler.js +2 -4
- package/dist/ChatSessionHandler.js.map +1 -1
- package/dist/DefaultSkillsDeployer.d.ts +32 -0
- package/dist/DefaultSkillsDeployer.d.ts.map +1 -0
- package/dist/DefaultSkillsDeployer.js +82 -0
- package/dist/DefaultSkillsDeployer.js.map +1 -0
- package/dist/EdgeWorker.d.ts +20 -46
- package/dist/EdgeWorker.d.ts.map +1 -1
- package/dist/EdgeWorker.js +98 -450
- package/dist/EdgeWorker.js.map +1 -1
- package/dist/PromptBuilder.d.ts +1 -7
- package/dist/PromptBuilder.d.ts.map +1 -1
- package/dist/PromptBuilder.js +2 -33
- package/dist/PromptBuilder.js.map +1 -1
- package/dist/RunnerConfigBuilder.d.ts +13 -6
- package/dist/RunnerConfigBuilder.d.ts.map +1 -1
- package/dist/RunnerConfigBuilder.js +50 -27
- package/dist/RunnerConfigBuilder.js.map +1 -1
- package/dist/SkillsPluginResolver.d.ts +66 -0
- package/dist/SkillsPluginResolver.d.ts.map +1 -0
- package/dist/SkillsPluginResolver.js +180 -0
- package/dist/SkillsPluginResolver.js.map +1 -0
- package/dist/ToolPermissionResolver.d.ts +1 -12
- package/dist/ToolPermissionResolver.d.ts.map +1 -1
- package/dist/ToolPermissionResolver.js +0 -23
- package/dist/ToolPermissionResolver.js.map +1 -1
- package/dist/cyrus-skills-plugin/.claude-plugin/plugin.json +4 -0
- package/dist/cyrus-skills-plugin/cyrus-skills-plugin/.claude-plugin/plugin.json +4 -0
- package/dist/cyrus-skills-plugin/cyrus-skills-plugin/skills/debug/SKILL.md +29 -0
- package/dist/cyrus-skills-plugin/cyrus-skills-plugin/skills/implementation/SKILL.md +17 -0
- package/dist/cyrus-skills-plugin/cyrus-skills-plugin/skills/investigate/SKILL.md +23 -0
- package/dist/cyrus-skills-plugin/cyrus-skills-plugin/skills/summarize/SKILL.md +47 -0
- package/dist/cyrus-skills-plugin/cyrus-skills-plugin/skills/verify-and-ship/SKILL.md +74 -0
- package/dist/cyrus-skills-plugin/skills/debug/SKILL.md +29 -0
- package/dist/cyrus-skills-plugin/skills/implementation/SKILL.md +17 -0
- package/dist/cyrus-skills-plugin/skills/investigate/SKILL.md +23 -0
- package/dist/cyrus-skills-plugin/skills/summarize/SKILL.md +47 -0
- package/dist/cyrus-skills-plugin/skills/verify-and-ship/SKILL.md +74 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/prompt-assembly/types.d.ts +1 -3
- package/dist/prompt-assembly/types.d.ts.map +1 -1
- package/package.json +17 -16
- package/dist/procedures/ProcedureAnalyzer.d.ts +0 -69
- package/dist/procedures/ProcedureAnalyzer.d.ts.map +0 -1
- package/dist/procedures/ProcedureAnalyzer.js +0 -274
- package/dist/procedures/ProcedureAnalyzer.js.map +0 -1
- package/dist/procedures/index.d.ts +0 -7
- package/dist/procedures/index.d.ts.map +0 -1
- package/dist/procedures/index.js +0 -7
- package/dist/procedures/index.js.map +0 -1
- package/dist/procedures/registry.d.ts +0 -173
- package/dist/procedures/registry.d.ts.map +0 -1
- package/dist/procedures/registry.js +0 -264
- package/dist/procedures/registry.js.map +0 -1
- package/dist/procedures/types.d.ts +0 -101
- package/dist/procedures/types.d.ts.map +0 -1
- package/dist/procedures/types.js +0 -5
- package/dist/procedures/types.js.map +0 -1
- package/dist/prompts/subroutines/changelog-update-gitlab.md +0 -79
- package/dist/prompts/subroutines/changelog-update.md +0 -79
- package/dist/prompts/subroutines/coding-activity.md +0 -12
- package/dist/prompts/subroutines/concise-summary.md +0 -67
- package/dist/prompts/subroutines/debugger-fix.md +0 -92
- package/dist/prompts/subroutines/debugger-reproduction.md +0 -74
- package/dist/prompts/subroutines/get-approval.md +0 -175
- package/dist/prompts/subroutines/gh-pr.md +0 -110
- package/dist/prompts/subroutines/git-commit.md +0 -37
- package/dist/prompts/subroutines/glab-mr.md +0 -106
- package/dist/prompts/subroutines/plan-summary.md +0 -21
- package/dist/prompts/subroutines/preparation.md +0 -16
- package/dist/prompts/subroutines/question-answer.md +0 -8
- package/dist/prompts/subroutines/question-investigation.md +0 -8
- package/dist/prompts/subroutines/release-execution.md +0 -81
- package/dist/prompts/subroutines/release-summary.md +0 -60
- package/dist/prompts/subroutines/user-testing-summary.md +0 -87
- package/dist/prompts/subroutines/user-testing.md +0 -48
- package/dist/prompts/subroutines/validation-fixer.md +0 -56
- package/dist/prompts/subroutines/verbose-summary.md +0 -46
- package/dist/prompts/subroutines/verifications.md +0 -77
- package/dist/validation/ValidationLoopController.d.ts +0 -54
- package/dist/validation/ValidationLoopController.d.ts.map +0 -1
- package/dist/validation/ValidationLoopController.js +0 -242
- package/dist/validation/ValidationLoopController.js.map +0 -1
- package/dist/validation/index.d.ts +0 -7
- package/dist/validation/index.d.ts.map +0 -1
- package/dist/validation/index.js +0 -7
- package/dist/validation/index.js.map +0 -1
- package/dist/validation/types.d.ts +0 -82
- package/dist/validation/types.d.ts.map +0 -1
- package/dist/validation/types.js +0 -29
- package/dist/validation/types.js.map +0 -1
|
@@ -0,0 +1,180 @@
|
|
|
1
|
+
import { access, mkdir, readdir, writeFile } from "node:fs/promises";
|
|
2
|
+
import { join } from "node:path";
|
|
3
|
+
/**
|
|
4
|
+
* Resolves skills plugins for agent sessions.
|
|
5
|
+
*
|
|
6
|
+
* Two plugin sources are supported:
|
|
7
|
+
* 1. Internal plugin — default Cyrus workflow skills deployed to ~/.cyrus/cyrus-skills-plugin/
|
|
8
|
+
* (editable by the user)
|
|
9
|
+
* 2. User skills plugin — custom skills managed by the CYHOST UI at ~/.cyrus/user-skills-plugin/
|
|
10
|
+
*
|
|
11
|
+
* Both live outside the repository so they are never committed to the user's repo.
|
|
12
|
+
*
|
|
13
|
+
* Plugin ordering: user plugin is loaded before internal plugin so that
|
|
14
|
+
* user-defined skills take precedence over internal skills with the same name.
|
|
15
|
+
*/
|
|
16
|
+
export class SkillsPluginResolver {
|
|
17
|
+
cyrusHome;
|
|
18
|
+
logger;
|
|
19
|
+
internalPluginPath;
|
|
20
|
+
userPluginPath;
|
|
21
|
+
userSkillsDir;
|
|
22
|
+
constructor(cyrusHome, logger) {
|
|
23
|
+
this.cyrusHome = cyrusHome;
|
|
24
|
+
this.logger = logger;
|
|
25
|
+
this.internalPluginPath = join(this.cyrusHome, "cyrus-skills-plugin");
|
|
26
|
+
this.userPluginPath = join(this.cyrusHome, "user-skills-plugin");
|
|
27
|
+
this.userSkillsDir = join(this.userPluginPath, "skills");
|
|
28
|
+
}
|
|
29
|
+
/**
|
|
30
|
+
* Ensure the user skills plugin directory is properly initialized.
|
|
31
|
+
* Call once during EdgeWorker startup — NOT on every session.
|
|
32
|
+
*
|
|
33
|
+
* Separated from resolve() to maintain Command-Query Separation:
|
|
34
|
+
* this method writes to the filesystem, resolve() only reads.
|
|
35
|
+
*/
|
|
36
|
+
async ensureUserPluginScaffolded() {
|
|
37
|
+
if (!(await this.exists(this.userSkillsDir))) {
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const manifestDir = join(this.userPluginPath, ".claude-plugin");
|
|
41
|
+
const manifestPath = join(manifestDir, "plugin.json");
|
|
42
|
+
if (await this.exists(manifestPath)) {
|
|
43
|
+
return;
|
|
44
|
+
}
|
|
45
|
+
await mkdir(manifestDir, { recursive: true });
|
|
46
|
+
await writeFile(manifestPath, JSON.stringify({
|
|
47
|
+
name: "user-skills",
|
|
48
|
+
description: "User-created skills managed by Cyrus",
|
|
49
|
+
}, null, "\t"));
|
|
50
|
+
this.logger.info(`Auto-scaffolded user skills plugin manifest at ${manifestPath}`);
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Resolve all available skills plugins (user + internal).
|
|
54
|
+
*
|
|
55
|
+
* User plugin is listed first so user-defined skills take precedence
|
|
56
|
+
* over internal skills with the same name.
|
|
57
|
+
*
|
|
58
|
+
* Pure query — no filesystem side effects.
|
|
59
|
+
*/
|
|
60
|
+
async resolve() {
|
|
61
|
+
const plugins = [];
|
|
62
|
+
// User plugin first — user skills override internal skills
|
|
63
|
+
const user = await this.resolveUserPlugin();
|
|
64
|
+
if (user) {
|
|
65
|
+
plugins.push(user);
|
|
66
|
+
}
|
|
67
|
+
const internal = await this.resolveInternalPlugin();
|
|
68
|
+
if (internal) {
|
|
69
|
+
plugins.push(internal);
|
|
70
|
+
}
|
|
71
|
+
await this.logConflicts(plugins);
|
|
72
|
+
return plugins;
|
|
73
|
+
}
|
|
74
|
+
/**
|
|
75
|
+
* Discover all available skill names from the given plugin configs.
|
|
76
|
+
*
|
|
77
|
+
* Reads the `skills/` subdirectory of each plugin path and returns
|
|
78
|
+
* deduplicated skill names (user skills shadow internal ones due to
|
|
79
|
+
* insertion order of the Set).
|
|
80
|
+
*/
|
|
81
|
+
async discoverSkillNames(plugins) {
|
|
82
|
+
const skillNames = [];
|
|
83
|
+
for (const plugin of plugins) {
|
|
84
|
+
const skillsDir = join(plugin.path, "skills");
|
|
85
|
+
try {
|
|
86
|
+
const entries = await readdir(skillsDir, { withFileTypes: true });
|
|
87
|
+
for (const entry of entries) {
|
|
88
|
+
if (entry.isDirectory() || entry.isSymbolicLink()) {
|
|
89
|
+
skillNames.push(entry.name);
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
}
|
|
93
|
+
catch {
|
|
94
|
+
// Plugin directory doesn't exist or isn't readable — skip
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
return [...new Set(skillNames)];
|
|
98
|
+
}
|
|
99
|
+
/**
|
|
100
|
+
* Build the skills guidance block appended to system prompts.
|
|
101
|
+
*
|
|
102
|
+
* Dynamically lists all available skills so that user-added custom
|
|
103
|
+
* skills appear in the guidance without code changes (OCP).
|
|
104
|
+
*
|
|
105
|
+
* Accepts pre-resolved plugins to avoid redundant filesystem access
|
|
106
|
+
* when resolve() is also called separately for the runner config.
|
|
107
|
+
*/
|
|
108
|
+
async buildSkillsGuidance(plugins) {
|
|
109
|
+
const resolvedPlugins = plugins ?? (await this.resolve());
|
|
110
|
+
const availableSkills = await this.discoverSkillNames(resolvedPlugins);
|
|
111
|
+
if (availableSkills.length === 0) {
|
|
112
|
+
return "";
|
|
113
|
+
}
|
|
114
|
+
const skillsList = availableSkills.map((s) => `\`${s}\``).join(", ");
|
|
115
|
+
return ("\n\n## Skills\n\n" +
|
|
116
|
+
`You have skills available via the Skill tool: ${skillsList}\n\n` +
|
|
117
|
+
"Choose the appropriate skill based on the context:\n\n" +
|
|
118
|
+
"- **Code changes requested** (feature, bug fix, refactor): Use `implementation` to write code, then `verify-and-ship` to run checks and create a PR, then `summarize` to narrate results.\n" +
|
|
119
|
+
"- **Bug report or error**: Use `debug` to reproduce, root-cause, and fix, then `verify-and-ship`, then `summarize`.\n" +
|
|
120
|
+
"- **Question or research request**: Use `investigate` to search the codebase and provide an answer, then `summarize`.\n" +
|
|
121
|
+
"- **PR review feedback** (changes requested): Use `implementation` to address review comments, then `verify-and-ship`.\n\n" +
|
|
122
|
+
"Analyze the issue description, labels, and any user comments to determine which workflow fits. " +
|
|
123
|
+
"Do NOT skip the verify-and-ship step if you made code changes — it ensures quality checks pass and a PR is created.");
|
|
124
|
+
}
|
|
125
|
+
async resolveInternalPlugin() {
|
|
126
|
+
if (await this.exists(this.internalPluginPath)) {
|
|
127
|
+
this.logger.debug(`Using internal skills plugin at ${this.internalPluginPath}`);
|
|
128
|
+
return { type: "local", path: this.internalPluginPath };
|
|
129
|
+
}
|
|
130
|
+
this.logger.warn(`No internal skills plugin found at ${this.internalPluginPath}`);
|
|
131
|
+
return null;
|
|
132
|
+
}
|
|
133
|
+
async resolveUserPlugin() {
|
|
134
|
+
const manifestPath = join(this.userPluginPath, ".claude-plugin", "plugin.json");
|
|
135
|
+
if (!(await this.exists(manifestPath))) {
|
|
136
|
+
return null;
|
|
137
|
+
}
|
|
138
|
+
this.logger.debug(`Using user skills plugin at ${this.userPluginPath}`);
|
|
139
|
+
return { type: "local", path: this.userPluginPath };
|
|
140
|
+
}
|
|
141
|
+
/**
|
|
142
|
+
* Detect and log skill name conflicts between user and internal plugins.
|
|
143
|
+
*/
|
|
144
|
+
async logConflicts(plugins) {
|
|
145
|
+
if (plugins.length < 2) {
|
|
146
|
+
return;
|
|
147
|
+
}
|
|
148
|
+
const skillSets = [];
|
|
149
|
+
for (const plugin of plugins) {
|
|
150
|
+
const skillsDir = join(plugin.path, "skills");
|
|
151
|
+
try {
|
|
152
|
+
const entries = await readdir(skillsDir, { withFileTypes: true });
|
|
153
|
+
skillSets.push(entries
|
|
154
|
+
.filter((e) => e.isDirectory() || e.isSymbolicLink())
|
|
155
|
+
.map((e) => e.name));
|
|
156
|
+
}
|
|
157
|
+
catch {
|
|
158
|
+
skillSets.push([]);
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
// First set is user, second is internal — find overlap
|
|
162
|
+
if (skillSets.length >= 2 && skillSets[0] && skillSets[1]) {
|
|
163
|
+
const userSkills = new Set(skillSets[0]);
|
|
164
|
+
const conflicts = skillSets[1].filter((s) => userSkills.has(s));
|
|
165
|
+
if (conflicts.length > 0) {
|
|
166
|
+
this.logger.info(`User skills override internal skills: ${conflicts.join(", ")}`);
|
|
167
|
+
}
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
async exists(path) {
|
|
171
|
+
try {
|
|
172
|
+
await access(path);
|
|
173
|
+
return true;
|
|
174
|
+
}
|
|
175
|
+
catch {
|
|
176
|
+
return false;
|
|
177
|
+
}
|
|
178
|
+
}
|
|
179
|
+
}
|
|
180
|
+
//# sourceMappingURL=SkillsPluginResolver.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SkillsPluginResolver.js","sourceRoot":"","sources":["../src/SkillsPluginResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AACrE,OAAO,EAAE,IAAI,EAAE,MAAM,WAAW,CAAC;AAIjC;;;;;;;;;;;;GAYG;AACH,MAAM,OAAO,oBAAoB;IAMd;IACA;IAND,kBAAkB,CAAS;IAC3B,cAAc,CAAS;IACvB,aAAa,CAAS;IAEvC,YACkB,SAAiB,EACjB,MAAe;QADf,cAAS,GAAT,SAAS,CAAQ;QACjB,WAAM,GAAN,MAAM,CAAS;QAEhC,IAAI,CAAC,kBAAkB,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,qBAAqB,CAAC,CAAC;QACtE,IAAI,CAAC,cAAc,GAAG,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,oBAAoB,CAAC,CAAC;QACjE,IAAI,CAAC,aAAa,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,QAAQ,CAAC,CAAC;IAC1D,CAAC;IAED;;;;;;OAMG;IACH,KAAK,CAAC,0BAA0B;QAC/B,IAAI,CAAC,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,CAAC,aAAa,CAAC,CAAC,EAAE,CAAC;YAC9C,OAAO;QACR,CAAC;QAED,MAAM,WAAW,GAAG,IAAI,CAAC,IAAI,CAAC,cAAc,EAAE,gBAAgB,CAAC,CAAC;QAChE,MAAM,YAAY,GAAG,IAAI,CAAC,WAAW,EAAE,aAAa,CAAC,CAAC;QACtD,IAAI,MAAM,IAAI,CAAC,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC;YACrC,OAAO;QACR,CAAC;QAED,MAAM,KAAK,CAAC,WAAW,EAAE,EAAE,SAAS,E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AAI,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,IAAI,SAAS,CAAC,CAAC,CAAC,EAAE,CAAC;YAC3D,MAAM,UAAU,GAAG,IAAI,GAAG,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC,CAAC;YACzC,MAAM,SAAS,GAAG,SAAS,CAAC,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAAE,EAAE,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC;YAChE,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;gBAC1B,IAAI,CAAC,MAAM,CAAC,IAAI,CACf,yCAAyC,SAAS,CAAC,IAAI,CAAC,IAAI,CAAC,EAAE,CAC/D,CAAC;YACH,CAAC;QACF,CAAC;IACF,CAAC;IAEO,KAAK,CAAC,MAAM,CAAC,IAAY;QAChC,IAAI,CAAC;YACJ,MAAM,MAAM,CAAC,IAAI,CAAC,CAAC;YACnB,OAAO,IAAI,CAAC;QACb,CAAC;QAAC,MAAM,CAAC;YACR,OAAO,KAAK,CAAC;QACd,CAAC;IACF,CAAC;CACD"}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
import type {
|
|
2
|
-
import type { ProcedureAnalyzer } from "./procedures/index.js";
|
|
1
|
+
import type { EdgeWorkerConfig, ILogger, RepositoryConfig } from "cyrus-core";
|
|
3
2
|
/** Prompt type used for label-based tool/prompt selection */
|
|
4
3
|
export type PromptType = "debugger" | "builder" | "scoper" | "orchestrator" | "graphite-orchestrator";
|
|
5
4
|
/**
|
|
@@ -9,7 +8,6 @@ export type PromptType = "debugger" | "builder" | "scoper" | "orchestrator" | "g
|
|
|
9
8
|
* - Repository-based tool resolution (allowed/disallowed)
|
|
10
9
|
* - Chat-mode read-only tool sets with MCP prefixes
|
|
11
10
|
* - Workspace-level MCP tool prefixes
|
|
12
|
-
* - Subroutine-level tool merging
|
|
13
11
|
*/
|
|
14
12
|
export declare class ToolPermissionResolver {
|
|
15
13
|
private config;
|
|
@@ -60,14 +58,5 @@ export declare class ToolPermissionResolver {
|
|
|
60
58
|
* Resolve disallowed tools for a single repository.
|
|
61
59
|
*/
|
|
62
60
|
private buildDisallowedToolsForRepo;
|
|
63
|
-
/**
|
|
64
|
-
* Merge subroutine-level disallowedTools with base disallowedTools
|
|
65
|
-
* @param session Current agent session
|
|
66
|
-
* @param baseDisallowedTools Base disallowed tools from repository/global config
|
|
67
|
-
* @param logContext Context string for logging (e.g., "EdgeWorker", "resumeClaudeSession")
|
|
68
|
-
* @param procedureAnalyzer ProcedureAnalyzer instance to resolve current subroutine
|
|
69
|
-
* @returns Merged disallowed tools list
|
|
70
|
-
*/
|
|
71
|
-
mergeSubroutineDisallowedTools(session: CyrusAgentSession, baseDisallowedTools: string[], logContext: string, procedureAnalyzer: ProcedureAnalyzer): string[];
|
|
72
61
|
}
|
|
73
62
|
//# sourceMappingURL=ToolPermissionResolver.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolPermissionResolver.d.ts","sourceRoot":"","sources":["../src/ToolPermissionResolver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"ToolPermissionResolver.d.ts","sourceRoot":"","sources":["../src/ToolPermissionResolver.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,gBAAgB,EAAE,OAAO,EAAE,gBAAgB,EAAE,MAAM,YAAY,CAAC;AAE9E,6DAA6D;AAC7D,MAAM,MAAM,UAAU,GACnB,UAAU,GACV,SAAS,GACT,QAAQ,GACR,cAAc,GACd,uBAAuB,CAAC;AAE3B;;;;;;;GAOG;AACH,qBAAa,sBAAsB;IAClC,OAAO,CAAC,MAAM,CAAmB;IACjC,OAAO,CAAC,MAAM,CAAU;gBAEZ,MAAM,EAAE,gBAAgB,EAAE,MAAM,EAAE,OAAO;IAKrD;;OAEG;IACH,SAAS,CAAC,MAAM,EAAE,gBAAgB,GAAG,IAAI;IAIzC;;OAEG;IACI,iBAAiB,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,EAAE,GAAG,MAAM,EAAE;IAoB7D;;;;;;;;OAQG;IACI,qBAAqB,CAC3B,aAAa,CAAC,EAAE,MAAM,EAAE,EACxB,YAAY,CAAC,EAAE,MAAM,EAAE,GACrB,MAAM,EAAE;IAeX;;;;;;OAMG;IACI,iBAAiB,CACvB,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,EACnD,UAAU,CAAC,EAAE,UAAU,GACrB,MAAM,EAAE;IAgCX;;OAEG;IACI,oBAAoB,IAAI,MAAM,EAAE;IASvC;;OAEG;IACH,OAAO,CAAC,wBAAwB;IAwChC;;;;;OAKG;IACI,oBAAoB,CAC1B,YAAY,EAAE,gBAAgB,GAAG,gBAAgB,EAAE,EACnD,UAAU,CAAC,EAAE,UAAU,GACrB,MAAM,EAAE;IAoCX;;OAEG;IACH,OAAO,CAAC,2BAA2B;CAqCnC"}
|
|
@@ -6,7 +6,6 @@ import { getAllTools, getCoordinatorTools, getReadOnlyTools, getSafeTools, } fro
|
|
|
6
6
|
* - Repository-based tool resolution (allowed/disallowed)
|
|
7
7
|
* - Chat-mode read-only tool sets with MCP prefixes
|
|
8
8
|
* - Workspace-level MCP tool prefixes
|
|
9
|
-
* - Subroutine-level tool merging
|
|
10
9
|
*/
|
|
11
10
|
export class ToolPermissionResolver {
|
|
12
11
|
config;
|
|
@@ -194,27 +193,5 @@ export class ToolPermissionResolver {
|
|
|
194
193
|
// 5. No defaults for disallowedTools
|
|
195
194
|
return [];
|
|
196
195
|
}
|
|
197
|
-
/**
|
|
198
|
-
* Merge subroutine-level disallowedTools with base disallowedTools
|
|
199
|
-
* @param session Current agent session
|
|
200
|
-
* @param baseDisallowedTools Base disallowed tools from repository/global config
|
|
201
|
-
* @param logContext Context string for logging (e.g., "EdgeWorker", "resumeClaudeSession")
|
|
202
|
-
* @param procedureAnalyzer ProcedureAnalyzer instance to resolve current subroutine
|
|
203
|
-
* @returns Merged disallowed tools list
|
|
204
|
-
*/
|
|
205
|
-
mergeSubroutineDisallowedTools(session, baseDisallowedTools, logContext, procedureAnalyzer) {
|
|
206
|
-
const currentSubroutine = procedureAnalyzer.getCurrentSubroutine(session);
|
|
207
|
-
if (currentSubroutine?.disallowedTools) {
|
|
208
|
-
const mergedTools = [
|
|
209
|
-
...new Set([
|
|
210
|
-
...baseDisallowedTools,
|
|
211
|
-
...currentSubroutine.disallowedTools,
|
|
212
|
-
]),
|
|
213
|
-
];
|
|
214
|
-
this.logger.debug(`[${logContext}] Merged subroutine-level disallowedTools for ${currentSubroutine.name}:`, currentSubroutine.disallowedTools);
|
|
215
|
-
return mergedTools;
|
|
216
|
-
}
|
|
217
|
-
return baseDisallowedTools;
|
|
218
|
-
}
|
|
219
196
|
}
|
|
220
197
|
//# sourceMappingURL=ToolPermissionResolver.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ToolPermissionResolver.js","sourceRoot":"","sources":["../src/ToolPermissionResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,GACZ,MAAM,qBAAqB,CAAC;
|
|
1
|
+
{"version":3,"file":"ToolPermissionResolver.js","sourceRoot":"","sources":["../src/ToolPermissionResolver.ts"],"names":[],"mappings":"AAAA,OAAO,EACN,WAAW,EACX,mBAAmB,EACnB,gBAAgB,EAChB,YAAY,GACZ,MAAM,qBAAqB,CAAC;AAW7B;;;;;;;GAOG;AACH,MAAM,OAAO,sBAAsB;IAC1B,MAAM,CAAmB;IACzB,MAAM,CAAU;IAExB,YAAY,MAAwB,EAAE,MAAe;QACpD,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;QACrB,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;OAEG;IACH,SAAS,CAAC,MAAwB;QACjC,IAAI,CAAC,MAAM,GAAG,MAAM,CAAC;IACtB,CAAC;IAED;;OAEG;IACI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;YACvC,CAAC,CAAC,UAAU,CAAC,YAAY,EAAE,CAAC,mBAAmB,CAAC;YAChD,CAAC,CAAC,SAAS,CAAC;QACb,MAAM,qBAAqB,GAC1B,YAAY,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,YAAY,CAAC;YAC3C,CAAC,CAAC,YAAY,CAAC,eAAe;YAC9B,CAAC,CAAC,SAAS,CAAC;QACd,IAAI,qBAAqB,EAAE,CAAC;YAC3B,OAAO,qBAAqB,CAAC;QAC9B,CAAC;QACD,iCAAiC;QACjC,IACC,mBAAmB;YACnB,IAAI,CAAC,MAAM,CAAC,cAAc,EAAE,CAAC,mBAAmB,CAAC,EAAE,eAAe,EACjE,CAAC;YACF,OAAO,IAAI,CAAC,MAAM,CAAC,cAAc,CAAC,mBAAmB,CAAC,CAAC,eAAe,CAAC;QACxE,CAAC;QACD,uCAAuC;QACvC,IAAI,UAAU,CAAC,eAAe,EAAE,CAAC;YAChC,OAAO,UAAU,CAAC,eAAe,CAAC;QACnC,CAAC;QACD,qCAAqC;QACrC,IAAI,IAAI,CAAC,MAAM,CAAC,sBAAsB,EAAE,CAAC;YACxC,OAAO,IAAI,CAAC,MAAM,CAAC,sBAAsB,CAAC;QAC3C,CAAC;QACD,qCAAqC;QACrC,OAAO,EAAE,CAAC;IACX,CAAC;CACD"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug
|
|
3
|
+
description: Full debugging workflow — reproduce the bug with a failing test, perform root cause analysis, then implement a minimal fix.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debug
|
|
7
|
+
|
|
8
|
+
Debug a reported issue using a structured reproduction-then-fix approach.
|
|
9
|
+
|
|
10
|
+
## Phase 1: Reproduction & Root Cause Analysis
|
|
11
|
+
|
|
12
|
+
1. **Investigate** — Analyze the bug report for key symptoms and error messages
|
|
13
|
+
2. **Trace** — Search the codebase for error occurrence patterns, trace from symptom to source
|
|
14
|
+
3. **Root cause** — Identify the root cause through data flow analysis and edge case checking
|
|
15
|
+
4. **Reproduce** — Create a minimal failing test case that reproduces the exact error
|
|
16
|
+
5. **Document** — Clearly document the root cause and reproduction steps
|
|
17
|
+
|
|
18
|
+
## Phase 2: Fix Implementation
|
|
19
|
+
|
|
20
|
+
1. **Plan** — Analyze the optimal fix approach based on root cause, check for similar fixes in the codebase
|
|
21
|
+
2. **Implement** — Make the minimal, targeted fix that addresses the root cause
|
|
22
|
+
3. **Verify** — Run the failing test to confirm it passes, then run the full test suite to check for regressions
|
|
23
|
+
|
|
24
|
+
## Principles
|
|
25
|
+
|
|
26
|
+
- **Minimal changes** — Fix the bug, nothing more
|
|
27
|
+
- **Targeted** — Only touch affected code paths
|
|
28
|
+
- **Tested** — The fix must make the failing test pass and not break existing tests
|
|
29
|
+
- **No unrelated improvements** — Stay focused on the specific bug
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: implementation
|
|
3
|
+
description: Implement the requested changes. Write production-ready code, follow existing patterns, and run tests to verify your work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Implementation
|
|
7
|
+
|
|
8
|
+
Implement the requested changes:
|
|
9
|
+
|
|
10
|
+
- Write production-ready code that follows existing patterns and conventions
|
|
11
|
+
- Run tests to verify your implementation works correctly
|
|
12
|
+
- Handle edge cases and error scenarios appropriately
|
|
13
|
+
- Keep changes focused on what was requested — avoid unrelated improvements
|
|
14
|
+
|
|
15
|
+
If tests fail, fix them before moving on to the next phase of the workflow.
|
|
16
|
+
|
|
17
|
+
When implementation is complete, proceed to the verification and shipping phase.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: investigate
|
|
3
|
+
description: Research the codebase to answer questions. Search for relevant files, gather context, and provide clear answers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Investigate
|
|
7
|
+
|
|
8
|
+
Research the codebase and provide a clear, direct answer to the question.
|
|
9
|
+
|
|
10
|
+
## Approach
|
|
11
|
+
|
|
12
|
+
1. **Search** — Search the codebase for relevant files, functions, and patterns
|
|
13
|
+
2. **Read** — Read necessary files to understand the implementation
|
|
14
|
+
3. **Gather context** — Use tools as needed to collect comprehensive information
|
|
15
|
+
4. **Answer** — Provide a clear, direct answer using your findings
|
|
16
|
+
|
|
17
|
+
## Answer Format
|
|
18
|
+
|
|
19
|
+
- Present in Linear-compatible markdown
|
|
20
|
+
- Use `+++Section Name\n...\n+++` for collapsible sections with detailed information
|
|
21
|
+
- Include code references with file paths and line numbers
|
|
22
|
+
- For @mentions, use the Linear profile URL format from `<assignee>` context (e.g. `https://linear.app/<workspace>/profiles/<username>`)
|
|
23
|
+
- Be complete but concise — answer the question directly without unnecessary preamble
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: summarize
|
|
3
|
+
description: Format a final summary message for Linear. Your output is automatically streamed to the Linear agent session — just format it well, do not post it yourself.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Summarize
|
|
7
|
+
|
|
8
|
+
Format a final summary of the work completed. Your output will be automatically rendered inside Linear — just write it as your response. Do **not** use any tool to post or save it.
|
|
9
|
+
|
|
10
|
+
## Content
|
|
11
|
+
|
|
12
|
+
Cover the following:
|
|
13
|
+
1. **Work Completed** — What was accomplished (1-2 sentences) and key outcome
|
|
14
|
+
2. **Key Details** — Files modified, important changes, PR link if created
|
|
15
|
+
3. **Status** — Completion status and any follow-up needed
|
|
16
|
+
|
|
17
|
+
## Format
|
|
18
|
+
|
|
19
|
+
- Aim for 3-5 paragraphs maximum
|
|
20
|
+
- Use clear, professional language suitable for Linear
|
|
21
|
+
- Use markdown formatting for readability
|
|
22
|
+
- **Collapsible sections**: Wrap "Changes Made" and "Files Modified" in `+++Section Name\n...\n+++`
|
|
23
|
+
- **@mentions**: Use the Linear profile URL format from `<assignee>` context (e.g. `https://linear.app/<workspace>/profiles/<username>`)
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
## Summary
|
|
29
|
+
|
|
30
|
+
[Brief description of what was done]
|
|
31
|
+
|
|
32
|
+
+++Changes Made
|
|
33
|
+
- [Key change 1]
|
|
34
|
+
- [Key change 2]
|
|
35
|
+
+++
|
|
36
|
+
|
|
37
|
+
+++Files Modified
|
|
38
|
+
- [File 1]
|
|
39
|
+
- [File 2]
|
|
40
|
+
+++
|
|
41
|
+
|
|
42
|
+
## Status
|
|
43
|
+
|
|
44
|
+
[Current status and any next steps]
|
|
45
|
+
|
|
46
|
+
[PR link if applicable]
|
|
47
|
+
```
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: verify-and-ship
|
|
3
|
+
description: Run all quality checks (tests, lint, typecheck), fix failures, update the changelog, commit, push, and create/update the pull request or merge request.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Verify and Ship
|
|
7
|
+
|
|
8
|
+
After implementing your changes, follow these steps to verify quality and ship the work.
|
|
9
|
+
|
|
10
|
+
## 1. Acceptance Criteria Validation (CRITICAL)
|
|
11
|
+
|
|
12
|
+
Use the issue tracker `get_issue` tool to fetch the current issue details. Extract ALL acceptance criteria from the issue description and verify each one is satisfied by the implementation. If no explicit criteria exist, validate against the implied requirements from the issue title and description.
|
|
13
|
+
|
|
14
|
+
## 2. Quality Checks
|
|
15
|
+
|
|
16
|
+
Run all applicable quality checks:
|
|
17
|
+
- **Tests** — Run the full test suite. If tests fail, fix the issues and re-run. Retry up to 3 times. If you cannot resolve failures after 3 attempts, proceed and note the failures in your summary.
|
|
18
|
+
- **Linting** — Run linting tools and fix any issues found.
|
|
19
|
+
- **Type checking** — Run TypeScript type checking (if applicable) and fix any errors.
|
|
20
|
+
- **Code review** — Review your changes for quality, consistency, and best practices. Remove any debug code, console.logs, or commented-out sections.
|
|
21
|
+
|
|
22
|
+
## 3. Changelog Update
|
|
23
|
+
|
|
24
|
+
Check if the project has changelog files:
|
|
25
|
+
```bash
|
|
26
|
+
ls -la CHANGELOG.md CHANGELOG.internal.md 2>/dev/null || echo "NO_CHANGELOG"
|
|
27
|
+
```
|
|
28
|
+
|
|
29
|
+
If changelog files exist:
|
|
30
|
+
- Add an entry under `## [Unreleased]` in the appropriate subsection (`### Added`, `### Changed`, `### Fixed`, `### Removed`)
|
|
31
|
+
- Focus on end-user impact — be concise but descriptive
|
|
32
|
+
- Include the Linear issue identifier and PR/MR link (format: `([ISSUE-ID](linear_url), [#NUMBER](PR_OR_MR_URL))`)
|
|
33
|
+
- Follow [Keep a Changelog](https://keepachangelog.com/) format
|
|
34
|
+
|
|
35
|
+
## 4. Commit and Push
|
|
36
|
+
|
|
37
|
+
- Stage all relevant changes (including changelog updates)
|
|
38
|
+
- Commit with clear, descriptive messages following the project's commit conventions
|
|
39
|
+
- Push to the remote repository
|
|
40
|
+
|
|
41
|
+
## 5. Create or Update PR/MR
|
|
42
|
+
|
|
43
|
+
Determine the platform from the repository context (`<github_url>` or `<gitlab_url>` in the issue context). Use the appropriate tool for the platform.
|
|
44
|
+
|
|
45
|
+
### GitHub (when `<github_url>` is present)
|
|
46
|
+
|
|
47
|
+
```bash
|
|
48
|
+
git push -u origin HEAD
|
|
49
|
+
gh pr view --json url,number 2>/dev/null || gh pr create --draft --base [base_branch from context] --title "[descriptive title]" --body "Work in progress"
|
|
50
|
+
```
|
|
51
|
+
|
|
52
|
+
### GitLab (when `<gitlab_url>` is present)
|
|
53
|
+
|
|
54
|
+
```bash
|
|
55
|
+
git push -u origin HEAD
|
|
56
|
+
glab mr view 2>/dev/null || glab mr create --draft --target-branch [base_branch from context] --title "[descriptive title]" --description "Work in progress"
|
|
57
|
+
```
|
|
58
|
+
|
|
59
|
+
### PR/MR Description
|
|
60
|
+
|
|
61
|
+
Update the PR/MR with a comprehensive description:
|
|
62
|
+
- **Assignee attribution**: If `<github_username>` is available in the assignee context, add `Assignee: @username ([Display Name](linear_profile_url))` at the top of the body. If only a linear profile URL is available, use `Assignee: [Display Name](linear_profile_url)`.
|
|
63
|
+
- **Summary** of changes, implementation approach, and testing performed
|
|
64
|
+
- **Link** to the Linear issue
|
|
65
|
+
- **Cyrus marker**: Include `<!-- generated-by-cyrus -->` as a hidden HTML comment at the end of the body
|
|
66
|
+
- **Interaction tip**: Add this at the end (before the marker), using the bot username from `<github_bot_username>` or `<gitlab_bot_username>` in the `<agent_context>` block of the system prompt:
|
|
67
|
+
```
|
|
68
|
+
---
|
|
69
|
+
> **Tip:** I will respond to comments that @ mention @<bot_username> on this PR/MR. You can also submit a review with all your feedback at once, and I will automatically wake up to address each comment.
|
|
70
|
+
```
|
|
71
|
+
|
|
72
|
+
Remove any "WIP:" or "Draft:" prefix from the title. Check `<agent_guidance>` — only mark the PR/MR as ready if guidance does NOT specify keeping them as drafts.
|
|
73
|
+
|
|
74
|
+
Verify the PR/MR targets the correct base branch from `<base_branch>` in the issue context.
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: debug
|
|
3
|
+
description: Full debugging workflow — reproduce the bug with a failing test, perform root cause analysis, then implement a minimal fix.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Debug
|
|
7
|
+
|
|
8
|
+
Debug a reported issue using a structured reproduction-then-fix approach.
|
|
9
|
+
|
|
10
|
+
## Phase 1: Reproduction & Root Cause Analysis
|
|
11
|
+
|
|
12
|
+
1. **Investigate** — Analyze the bug report for key symptoms and error messages
|
|
13
|
+
2. **Trace** — Search the codebase for error occurrence patterns, trace from symptom to source
|
|
14
|
+
3. **Root cause** — Identify the root cause through data flow analysis and edge case checking
|
|
15
|
+
4. **Reproduce** — Create a minimal failing test case that reproduces the exact error
|
|
16
|
+
5. **Document** — Clearly document the root cause and reproduction steps
|
|
17
|
+
|
|
18
|
+
## Phase 2: Fix Implementation
|
|
19
|
+
|
|
20
|
+
1. **Plan** — Analyze the optimal fix approach based on root cause, check for similar fixes in the codebase
|
|
21
|
+
2. **Implement** — Make the minimal, targeted fix that addresses the root cause
|
|
22
|
+
3. **Verify** — Run the failing test to confirm it passes, then run the full test suite to check for regressions
|
|
23
|
+
|
|
24
|
+
## Principles
|
|
25
|
+
|
|
26
|
+
- **Minimal changes** — Fix the bug, nothing more
|
|
27
|
+
- **Targeted** — Only touch affected code paths
|
|
28
|
+
- **Tested** — The fix must make the failing test pass and not break existing tests
|
|
29
|
+
- **No unrelated improvements** — Stay focused on the specific bug
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: implementation
|
|
3
|
+
description: Implement the requested changes. Write production-ready code, follow existing patterns, and run tests to verify your work.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Implementation
|
|
7
|
+
|
|
8
|
+
Implement the requested changes:
|
|
9
|
+
|
|
10
|
+
- Write production-ready code that follows existing patterns and conventions
|
|
11
|
+
- Run tests to verify your implementation works correctly
|
|
12
|
+
- Handle edge cases and error scenarios appropriately
|
|
13
|
+
- Keep changes focused on what was requested — avoid unrelated improvements
|
|
14
|
+
|
|
15
|
+
If tests fail, fix them before moving on to the next phase of the workflow.
|
|
16
|
+
|
|
17
|
+
When implementation is complete, proceed to the verification and shipping phase.
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: investigate
|
|
3
|
+
description: Research the codebase to answer questions. Search for relevant files, gather context, and provide clear answers.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Investigate
|
|
7
|
+
|
|
8
|
+
Research the codebase and provide a clear, direct answer to the question.
|
|
9
|
+
|
|
10
|
+
## Approach
|
|
11
|
+
|
|
12
|
+
1. **Search** — Search the codebase for relevant files, functions, and patterns
|
|
13
|
+
2. **Read** — Read necessary files to understand the implementation
|
|
14
|
+
3. **Gather context** — Use tools as needed to collect comprehensive information
|
|
15
|
+
4. **Answer** — Provide a clear, direct answer using your findings
|
|
16
|
+
|
|
17
|
+
## Answer Format
|
|
18
|
+
|
|
19
|
+
- Present in Linear-compatible markdown
|
|
20
|
+
- Use `+++Section Name\n...\n+++` for collapsible sections with detailed information
|
|
21
|
+
- Include code references with file paths and line numbers
|
|
22
|
+
- For @mentions, use the Linear profile URL format from `<assignee>` context (e.g. `https://linear.app/<workspace>/profiles/<username>`)
|
|
23
|
+
- Be complete but concise — answer the question directly without unnecessary preamble
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
name: summarize
|
|
3
|
+
description: Format a final summary message for Linear. Your output is automatically streamed to the Linear agent session — just format it well, do not post it yourself.
|
|
4
|
+
---
|
|
5
|
+
|
|
6
|
+
# Summarize
|
|
7
|
+
|
|
8
|
+
Format a final summary of the work completed. Your output will be automatically rendered inside Linear — just write it as your response. Do **not** use any tool to post or save it.
|
|
9
|
+
|
|
10
|
+
## Content
|
|
11
|
+
|
|
12
|
+
Cover the following:
|
|
13
|
+
1. **Work Completed** — What was accomplished (1-2 sentences) and key outcome
|
|
14
|
+
2. **Key Details** — Files modified, important changes, PR link if created
|
|
15
|
+
3. **Status** — Completion status and any follow-up needed
|
|
16
|
+
|
|
17
|
+
## Format
|
|
18
|
+
|
|
19
|
+
- Aim for 3-5 paragraphs maximum
|
|
20
|
+
- Use clear, professional language suitable for Linear
|
|
21
|
+
- Use markdown formatting for readability
|
|
22
|
+
- **Collapsible sections**: Wrap "Changes Made" and "Files Modified" in `+++Section Name\n...\n+++`
|
|
23
|
+
- **@mentions**: Use the Linear profile URL format from `<assignee>` context (e.g. `https://linear.app/<workspace>/profiles/<username>`)
|
|
24
|
+
|
|
25
|
+
## Example
|
|
26
|
+
|
|
27
|
+
```
|
|
28
|
+
## Summary
|
|
29
|
+
|
|
30
|
+
[Brief description of what was done]
|
|
31
|
+
|
|
32
|
+
+++Changes Made
|
|
33
|
+
- [Key change 1]
|
|
34
|
+
- [Key change 2]
|
|
35
|
+
+++
|
|
36
|
+
|
|
37
|
+
+++Files Modified
|
|
38
|
+
- [File 1]
|
|
39
|
+
- [File 2]
|
|
40
|
+
+++
|
|
41
|
+
|
|
42
|
+
## Status
|
|
43
|
+
|
|
44
|
+
[Current status and any next steps]
|
|
45
|
+
|
|
46
|
+
[PR link if applicable]
|
|
47
|
+
```
|