@autonav/core 1.4.0 → 1.6.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/autonav.d.ts +1 -0
- package/dist/cli/autonav.d.ts.map +1 -1
- package/dist/cli/autonav.js +7 -0
- package/dist/cli/autonav.js.map +1 -1
- package/dist/cli/nav-init.js +17 -3
- package/dist/cli/nav-init.js.map +1 -1
- package/dist/cli/nav-memento.d.ts +20 -0
- package/dist/cli/nav-memento.d.ts.map +1 -0
- package/dist/cli/nav-memento.js +179 -0
- package/dist/cli/nav-memento.js.map +1 -0
- package/dist/cli/nav-mend.js +7 -0
- package/dist/cli/nav-mend.js.map +1 -1
- package/dist/memento/git-operations.d.ts +95 -0
- package/dist/memento/git-operations.d.ts.map +1 -0
- package/dist/memento/git-operations.js +256 -0
- package/dist/memento/git-operations.js.map +1 -0
- package/dist/memento/index.d.ts +31 -0
- package/dist/memento/index.d.ts.map +1 -0
- package/dist/memento/index.js +38 -0
- package/dist/memento/index.js.map +1 -0
- package/dist/memento/loop.d.ts +33 -0
- package/dist/memento/loop.d.ts.map +1 -0
- package/dist/memento/loop.js +535 -0
- package/dist/memento/loop.js.map +1 -0
- package/dist/memento/matrix-animation.d.ts +77 -0
- package/dist/memento/matrix-animation.d.ts.map +1 -0
- package/dist/memento/matrix-animation.js +228 -0
- package/dist/memento/matrix-animation.js.map +1 -0
- package/dist/memento/nav-protocol.d.ts +30 -0
- package/dist/memento/nav-protocol.d.ts.map +1 -0
- package/dist/memento/nav-protocol.js +79 -0
- package/dist/memento/nav-protocol.js.map +1 -0
- package/dist/memento/prompts.d.ts +44 -0
- package/dist/memento/prompts.d.ts.map +1 -0
- package/dist/memento/prompts.js +168 -0
- package/dist/memento/prompts.js.map +1 -0
- package/dist/memento/state.d.ts +56 -0
- package/dist/memento/state.d.ts.map +1 -0
- package/dist/memento/state.js +156 -0
- package/dist/memento/state.js.map +1 -0
- package/dist/memento/types.d.ts +123 -0
- package/dist/memento/types.d.ts.map +1 -0
- package/dist/memento/types.js +30 -0
- package/dist/memento/types.js.map +1 -0
- package/dist/memento/worker-agent.d.ts +30 -0
- package/dist/memento/worker-agent.d.ts.map +1 -0
- package/dist/memento/worker-agent.js +109 -0
- package/dist/memento/worker-agent.js.map +1 -0
- package/dist/mend/index.d.ts +6 -0
- package/dist/mend/index.d.ts.map +1 -1
- package/dist/mend/index.js +92 -1
- package/dist/mend/index.js.map +1 -1
- package/dist/mend/llm-review.d.ts +18 -0
- package/dist/mend/llm-review.d.ts.map +1 -0
- package/dist/mend/llm-review.js +81 -0
- package/dist/mend/llm-review.js.map +1 -0
- package/dist/migrations/index.d.ts.map +1 -1
- package/dist/migrations/index.js +4 -0
- package/dist/migrations/index.js.map +1 -1
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.d.ts +18 -0
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.d.ts.map +1 -0
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.js +207 -0
- package/dist/migrations/versions/v1.4.0-rfc2119-skills.js.map +1 -0
- package/dist/migrations/versions/v1.5.1-mend-instruction.d.ts +13 -0
- package/dist/migrations/versions/v1.5.1-mend-instruction.d.ts.map +1 -0
- package/dist/migrations/versions/v1.5.1-mend-instruction.js +156 -0
- package/dist/migrations/versions/v1.5.1-mend-instruction.js.map +1 -0
- package/package.json +1 -1
- package/dist/skill-generator/index.d.ts +0 -142
- package/dist/skill-generator/index.d.ts.map +0 -1
- package/dist/skill-generator/index.js +0 -510
- package/dist/skill-generator/index.js.map +0 -1
- package/dist/templates/.gitignore.template +0 -26
- package/dist/templates/CLAUDE-pack.md.template +0 -114
- package/dist/templates/CLAUDE.md.template +0 -153
- package/dist/templates/README.md.template +0 -174
- package/dist/templates/config-pack.json.template +0 -16
- package/dist/templates/config.json.template +0 -11
- package/dist/templates/index.d.ts +0 -22
- package/dist/templates/index.d.ts.map +0 -1
- package/dist/templates/index.js +0 -32
- package/dist/templates/index.js.map +0 -1
- package/dist/templates/plugins.json.template +0 -33
- package/dist/templates/system-configuration.md.template +0 -70
|
@@ -0,0 +1,256 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Git Operations for Memento Loop
|
|
3
|
+
*
|
|
4
|
+
* Helper functions for git operations: branches, commits, logs, PRs.
|
|
5
|
+
*/
|
|
6
|
+
import { execSync } from "node:child_process";
|
|
7
|
+
/**
|
|
8
|
+
* Execute a git command and return output
|
|
9
|
+
*/
|
|
10
|
+
function execGit(command, options) {
|
|
11
|
+
const execOptions = {
|
|
12
|
+
cwd: options.cwd,
|
|
13
|
+
encoding: "utf-8",
|
|
14
|
+
stdio: options.verbose ? "inherit" : "pipe",
|
|
15
|
+
};
|
|
16
|
+
try {
|
|
17
|
+
const result = execSync(command, execOptions);
|
|
18
|
+
return typeof result === "string" ? result.trim() : "";
|
|
19
|
+
}
|
|
20
|
+
catch (error) {
|
|
21
|
+
if (error instanceof Error && "stderr" in error) {
|
|
22
|
+
throw new Error(`Git command failed: ${command}\n${error.stderr}`);
|
|
23
|
+
}
|
|
24
|
+
throw error;
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Check if directory is a git repository
|
|
29
|
+
*/
|
|
30
|
+
export function isGitRepo(cwd) {
|
|
31
|
+
try {
|
|
32
|
+
execSync("git rev-parse --is-inside-work-tree", {
|
|
33
|
+
cwd,
|
|
34
|
+
encoding: "utf-8",
|
|
35
|
+
stdio: "pipe",
|
|
36
|
+
});
|
|
37
|
+
return true;
|
|
38
|
+
}
|
|
39
|
+
catch {
|
|
40
|
+
return false;
|
|
41
|
+
}
|
|
42
|
+
}
|
|
43
|
+
/**
|
|
44
|
+
* Initialize a git repository if not already initialized
|
|
45
|
+
*/
|
|
46
|
+
export function ensureGitRepo(options) {
|
|
47
|
+
if (!isGitRepo(options.cwd)) {
|
|
48
|
+
execGit("git init", options);
|
|
49
|
+
if (options.verbose) {
|
|
50
|
+
console.log(`Initialized git repository in ${options.cwd}`);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
/**
|
|
55
|
+
* Get current branch name
|
|
56
|
+
*/
|
|
57
|
+
export function getCurrentBranch(options) {
|
|
58
|
+
try {
|
|
59
|
+
return execGit("git branch --show-current", { ...options, verbose: false });
|
|
60
|
+
}
|
|
61
|
+
catch {
|
|
62
|
+
return "HEAD"; // Detached HEAD state
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
/**
|
|
66
|
+
* Create and checkout a new branch
|
|
67
|
+
*/
|
|
68
|
+
export function createBranch(name, options) {
|
|
69
|
+
// Check if branch already exists
|
|
70
|
+
try {
|
|
71
|
+
execGit(`git rev-parse --verify ${name}`, { ...options, verbose: false });
|
|
72
|
+
// Branch exists, just checkout
|
|
73
|
+
execGit(`git checkout ${name}`, options);
|
|
74
|
+
if (options.verbose) {
|
|
75
|
+
console.log(`Switched to existing branch: ${name}`);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
catch {
|
|
79
|
+
// Branch doesn't exist, create it
|
|
80
|
+
execGit(`git checkout -b ${name}`, options);
|
|
81
|
+
if (options.verbose) {
|
|
82
|
+
console.log(`Created and switched to branch: ${name}`);
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
/**
|
|
87
|
+
* Get recent git log entries
|
|
88
|
+
*/
|
|
89
|
+
export function getRecentGitLog(options) {
|
|
90
|
+
const count = options.count ?? 10;
|
|
91
|
+
try {
|
|
92
|
+
// Check if there are any commits
|
|
93
|
+
execGit("git rev-parse HEAD", { ...options, verbose: false });
|
|
94
|
+
return execGit(`git log --oneline --no-decorate -n ${count}`, { ...options, verbose: false });
|
|
95
|
+
}
|
|
96
|
+
catch {
|
|
97
|
+
// No commits yet
|
|
98
|
+
return "";
|
|
99
|
+
}
|
|
100
|
+
}
|
|
101
|
+
/**
|
|
102
|
+
* Get diff of recent changes (staged + unstaged)
|
|
103
|
+
*/
|
|
104
|
+
export function getRecentDiff(options) {
|
|
105
|
+
try {
|
|
106
|
+
const staged = execGit("git diff --cached", { ...options, verbose: false });
|
|
107
|
+
const unstaged = execGit("git diff", { ...options, verbose: false });
|
|
108
|
+
return `${staged}\n${unstaged}`.trim();
|
|
109
|
+
}
|
|
110
|
+
catch {
|
|
111
|
+
return "";
|
|
112
|
+
}
|
|
113
|
+
}
|
|
114
|
+
/**
|
|
115
|
+
* Get diff stats (lines added/removed) for uncommitted changes
|
|
116
|
+
*/
|
|
117
|
+
export function getDiffStats(options) {
|
|
118
|
+
try {
|
|
119
|
+
// git diff --shortstat outputs: " 3 files changed, 10 insertions(+), 5 deletions(-)"
|
|
120
|
+
const output = execGit("git diff --shortstat", { ...options, verbose: false });
|
|
121
|
+
if (!output) {
|
|
122
|
+
return { filesChanged: 0, linesAdded: 0, linesRemoved: 0 };
|
|
123
|
+
}
|
|
124
|
+
const filesMatch = output.match(/(\d+) files? changed/);
|
|
125
|
+
const insertionsMatch = output.match(/(\d+) insertions?\(\+\)/);
|
|
126
|
+
const deletionsMatch = output.match(/(\d+) deletions?\(-\)/);
|
|
127
|
+
return {
|
|
128
|
+
filesChanged: filesMatch ? parseInt(filesMatch[1], 10) : 0,
|
|
129
|
+
linesAdded: insertionsMatch ? parseInt(insertionsMatch[1], 10) : 0,
|
|
130
|
+
linesRemoved: deletionsMatch ? parseInt(deletionsMatch[1], 10) : 0,
|
|
131
|
+
};
|
|
132
|
+
}
|
|
133
|
+
catch {
|
|
134
|
+
return { filesChanged: 0, linesAdded: 0, linesRemoved: 0 };
|
|
135
|
+
}
|
|
136
|
+
}
|
|
137
|
+
/**
|
|
138
|
+
* Get diff stats between HEAD and HEAD~1 (last commit)
|
|
139
|
+
*/
|
|
140
|
+
export function getLastCommitDiffStats(options) {
|
|
141
|
+
try {
|
|
142
|
+
const output = execGit("git diff --shortstat HEAD~1 HEAD", { ...options, verbose: false });
|
|
143
|
+
if (!output) {
|
|
144
|
+
return { filesChanged: 0, linesAdded: 0, linesRemoved: 0 };
|
|
145
|
+
}
|
|
146
|
+
const filesMatch = output.match(/(\d+) files? changed/);
|
|
147
|
+
const insertionsMatch = output.match(/(\d+) insertions?\(\+\)/);
|
|
148
|
+
const deletionsMatch = output.match(/(\d+) deletions?\(-\)/);
|
|
149
|
+
return {
|
|
150
|
+
filesChanged: filesMatch ? parseInt(filesMatch[1], 10) : 0,
|
|
151
|
+
linesAdded: insertionsMatch ? parseInt(insertionsMatch[1], 10) : 0,
|
|
152
|
+
linesRemoved: deletionsMatch ? parseInt(deletionsMatch[1], 10) : 0,
|
|
153
|
+
};
|
|
154
|
+
}
|
|
155
|
+
catch {
|
|
156
|
+
return { filesChanged: 0, linesAdded: 0, linesRemoved: 0 };
|
|
157
|
+
}
|
|
158
|
+
}
|
|
159
|
+
/**
|
|
160
|
+
* Check if there are uncommitted changes
|
|
161
|
+
*/
|
|
162
|
+
export function hasUncommittedChanges(options) {
|
|
163
|
+
try {
|
|
164
|
+
const status = execGit("git status --porcelain", { ...options, verbose: false });
|
|
165
|
+
return status.length > 0;
|
|
166
|
+
}
|
|
167
|
+
catch {
|
|
168
|
+
return false;
|
|
169
|
+
}
|
|
170
|
+
}
|
|
171
|
+
/**
|
|
172
|
+
* Stage all changes
|
|
173
|
+
*/
|
|
174
|
+
export function stageAllChanges(options) {
|
|
175
|
+
execGit("git add -A", options);
|
|
176
|
+
}
|
|
177
|
+
/**
|
|
178
|
+
* Commit staged changes
|
|
179
|
+
*
|
|
180
|
+
* Returns the commit hash, or null if nothing to commit
|
|
181
|
+
*/
|
|
182
|
+
export function commitChanges(message, options) {
|
|
183
|
+
// Check if there's anything to commit
|
|
184
|
+
if (!hasUncommittedChanges(options)) {
|
|
185
|
+
if (options.verbose) {
|
|
186
|
+
console.log("No changes to commit");
|
|
187
|
+
}
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
// Stage all changes
|
|
191
|
+
stageAllChanges(options);
|
|
192
|
+
// Commit
|
|
193
|
+
execGit(`git commit -m "${message.replace(/"/g, '\\"')}"`, options);
|
|
194
|
+
// Get the commit hash
|
|
195
|
+
const hash = execGit("git rev-parse --short HEAD", { ...options, verbose: false });
|
|
196
|
+
if (options.verbose) {
|
|
197
|
+
console.log(`Committed: ${hash} - ${message}`);
|
|
198
|
+
}
|
|
199
|
+
return hash;
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Push branch to remote
|
|
203
|
+
*/
|
|
204
|
+
export function pushBranch(branch, options) {
|
|
205
|
+
const upstream = options.setUpstream ? "-u origin" : "";
|
|
206
|
+
execGit(`git push ${upstream} ${branch}`.trim(), options);
|
|
207
|
+
if (options.verbose) {
|
|
208
|
+
console.log(`Pushed branch: ${branch}`);
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
/**
|
|
212
|
+
* Create a pull request using GitHub CLI
|
|
213
|
+
*
|
|
214
|
+
* Requires `gh` CLI to be installed and authenticated
|
|
215
|
+
*/
|
|
216
|
+
export function createPullRequest(options) {
|
|
217
|
+
const { title, body, base = "main", draft = false } = options;
|
|
218
|
+
// Escape for shell
|
|
219
|
+
const escapedTitle = title.replace(/"/g, '\\"');
|
|
220
|
+
const escapedBody = body.replace(/"/g, '\\"');
|
|
221
|
+
const draftFlag = draft ? "--draft" : "";
|
|
222
|
+
const output = execGit(`gh pr create --title "${escapedTitle}" --body "${escapedBody}" --base ${base} ${draftFlag}`.trim(), options);
|
|
223
|
+
// gh pr create outputs the PR URL
|
|
224
|
+
const prUrl = output.split("\n").pop() || output;
|
|
225
|
+
if (options.verbose) {
|
|
226
|
+
console.log(`Created PR: ${prUrl}`);
|
|
227
|
+
}
|
|
228
|
+
return prUrl;
|
|
229
|
+
}
|
|
230
|
+
/**
|
|
231
|
+
* Check if gh CLI is available and authenticated
|
|
232
|
+
*/
|
|
233
|
+
export function isGhAvailable() {
|
|
234
|
+
try {
|
|
235
|
+
execSync("gh auth status", {
|
|
236
|
+
encoding: "utf-8",
|
|
237
|
+
stdio: "pipe",
|
|
238
|
+
});
|
|
239
|
+
return true;
|
|
240
|
+
}
|
|
241
|
+
catch {
|
|
242
|
+
return false;
|
|
243
|
+
}
|
|
244
|
+
}
|
|
245
|
+
/**
|
|
246
|
+
* Get the remote origin URL
|
|
247
|
+
*/
|
|
248
|
+
export function getRemoteUrl(options) {
|
|
249
|
+
try {
|
|
250
|
+
return execGit("git remote get-url origin", { ...options, verbose: false });
|
|
251
|
+
}
|
|
252
|
+
catch {
|
|
253
|
+
return null;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
//# sourceMappingURL=git-operations.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"git-operations.js","sourceRoot":"","sources":["../../src/memento/git-operations.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,QAAQ,EAAwB,MAAM,oBAAoB,CAAC;AAUpE;;GAEG;AACH,SAAS,OAAO,CAAC,OAAe,EAAE,OAAmB;IACnD,MAAM,WAAW,GAAoB;QACnC,GAAG,EAAE,OAAO,CAAC,GAAG;QAChB,QAAQ,EAAE,OAAO;QACjB,KAAK,EAAE,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,MAAM;KAC5C,CAAC;IAEF,IAAI,CAAC;QACH,MAAM,MAAM,GAAG,QAAQ,CAAC,OAAO,EAAE,WAAW,CAAC,CAAC;QAC9C,OAAO,OAAO,MAAM,KAAK,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;IACzD,CAAC;IAAC,OAAO,KAAK,EAAE,CAAC;QACf,IAAI,KAAK,YAAY,KAAK,IAAI,QAAQ,IAAI,KAAK,EAAE,CAAC;YAChD,MAAM,IAAI,KAAK,CAAC,uBAAuB,OAAO,KAAM,KAAoC,CAAC,MAAM,EAAE,CAAC,CAAC;QACrG,CAAC;QACD,MAAM,KAAK,CAAC;IACd,CAAC;AACH,CAAC;AAED;;GAE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
*
|
|
4
|
+
* Context-clearing iterative development loop that coordinates
|
|
5
|
+
* navigator (planning) and worker (implementation) agents.
|
|
6
|
+
*
|
|
7
|
+
* Design principle: Git is the only persistent memory. All other
|
|
8
|
+
* state lives in-memory during loop execution.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { runMementoLoop } from './memento';
|
|
13
|
+
*
|
|
14
|
+
* const result = await runMementoLoop(
|
|
15
|
+
* './my-code',
|
|
16
|
+
* './my-navigator',
|
|
17
|
+
* 'Add user authentication',
|
|
18
|
+
* { maxIterations: 10, branch: 'feature/auth', verbose: true }
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* console.log(`Completed in ${result.iterations} iterations`);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
export { type ImplementationStep, type ImplementationPlan, type WorkerResult, type MementoOptions, type MementoResult, ImplementationStepSchema, ImplementationPlanSchema, } from "./types.js";
|
|
25
|
+
export { isGitRepo, ensureGitRepo, getCurrentBranch, createBranch, getRecentGitLog, getRecentDiff, getDiffStats, getLastCommitDiffStats, hasUncommittedChanges, stageAllChanges, commitChanges, pushBranch, createPullRequest, isGhAvailable, getRemoteUrl, type DiffStats, } from "./git-operations.js";
|
|
26
|
+
export { createNavProtocolMcpServer, SUBMIT_PLAN_TOOL, type PlanSubmissionResult, } from "./nav-protocol.js";
|
|
27
|
+
export { buildNavPlanPrompt, buildNavSystemPrompt, buildWorkerPrompt, buildWorkerSystemPrompt, type NavigatorIdentity, } from "./prompts.js";
|
|
28
|
+
export { runWorkerAgent, type WorkerAgentOptions, } from "./worker-agent.js";
|
|
29
|
+
export { runMementoLoop, type MementoLoopOptions, } from "./loop.js";
|
|
30
|
+
export { MatrixAnimation, withMatrixAnimation, type AnimationStats, } from "./matrix-animation.js";
|
|
31
|
+
//# sourceMappingURL=index.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/memento/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAGH,OAAO,EACL,KAAK,kBAAkB,EACvB,KAAK,kBAAkB,EACvB,KAAK,YAAY,EACjB,KAAK,cAAc,EACnB,KAAK,aAAa,EAClB,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAGpB,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,EACZ,KAAK,SAAS,GACf,MAAM,qBAAqB,CAAC;AAG7B,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,EAChB,KAAK,oBAAoB,GAC1B,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,EACvB,KAAK,iBAAiB,GACvB,MAAM,cAAc,CAAC;AAGtB,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,GACxB,MAAM,mBAAmB,CAAC;AAG3B,OAAO,EACL,cAAc,EACd,KAAK,kBAAkB,GACxB,MAAM,WAAW,CAAC;AAGnB,OAAO,EACL,eAAe,EACf,mBAAmB,EACnB,KAAK,cAAc,GACpB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memento Loop Module
|
|
3
|
+
*
|
|
4
|
+
* Context-clearing iterative development loop that coordinates
|
|
5
|
+
* navigator (planning) and worker (implementation) agents.
|
|
6
|
+
*
|
|
7
|
+
* Design principle: Git is the only persistent memory. All other
|
|
8
|
+
* state lives in-memory during loop execution.
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```typescript
|
|
12
|
+
* import { runMementoLoop } from './memento';
|
|
13
|
+
*
|
|
14
|
+
* const result = await runMementoLoop(
|
|
15
|
+
* './my-code',
|
|
16
|
+
* './my-navigator',
|
|
17
|
+
* 'Add user authentication',
|
|
18
|
+
* { maxIterations: 10, branch: 'feature/auth', verbose: true }
|
|
19
|
+
* );
|
|
20
|
+
*
|
|
21
|
+
* console.log(`Completed in ${result.iterations} iterations`);
|
|
22
|
+
* ```
|
|
23
|
+
*/
|
|
24
|
+
// Types
|
|
25
|
+
export { ImplementationStepSchema, ImplementationPlanSchema, } from "./types.js";
|
|
26
|
+
// Git operations
|
|
27
|
+
export { isGitRepo, ensureGitRepo, getCurrentBranch, createBranch, getRecentGitLog, getRecentDiff, getDiffStats, getLastCommitDiffStats, hasUncommittedChanges, stageAllChanges, commitChanges, pushBranch, createPullRequest, isGhAvailable, getRemoteUrl, } from "./git-operations.js";
|
|
28
|
+
// Nav protocol
|
|
29
|
+
export { createNavProtocolMcpServer, SUBMIT_PLAN_TOOL, } from "./nav-protocol.js";
|
|
30
|
+
// Prompts
|
|
31
|
+
export { buildNavPlanPrompt, buildNavSystemPrompt, buildWorkerPrompt, buildWorkerSystemPrompt, } from "./prompts.js";
|
|
32
|
+
// Worker agent
|
|
33
|
+
export { runWorkerAgent, } from "./worker-agent.js";
|
|
34
|
+
// Main loop
|
|
35
|
+
export { runMementoLoop, } from "./loop.js";
|
|
36
|
+
// Animation
|
|
37
|
+
export { MatrixAnimation, withMatrixAnimation, } from "./matrix-animation.js";
|
|
38
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/memento/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;GAsBG;AAEH,QAAQ;AACR,OAAO,EAML,wBAAwB,EACxB,wBAAwB,GACzB,MAAM,YAAY,CAAC;AAEpB,iBAAiB;AACjB,OAAO,EACL,SAAS,EACT,aAAa,EACb,gBAAgB,EAChB,YAAY,EACZ,eAAe,EACf,aAAa,EACb,YAAY,EACZ,sBAAsB,EACtB,qBAAqB,EACrB,eAAe,EACf,aAAa,EACb,UAAU,EACV,iBAAiB,EACjB,aAAa,EACb,YAAY,GAEb,MAAM,qBAAqB,CAAC;AAE7B,eAAe;AACf,OAAO,EACL,0BAA0B,EAC1B,gBAAgB,GAEjB,MAAM,mBAAmB,CAAC;AAE3B,UAAU;AACV,OAAO,EACL,kBAAkB,EAClB,oBAAoB,EACpB,iBAAiB,EACjB,uBAAuB,GAExB,MAAM,cAAc,CAAC;AAEtB,eAAe;AACf,OAAO,EACL,cAAc,GAEf,MAAM,mBAAmB,CAAC;AAE3B,YAAY;AACZ,OAAO,EACL,cAAc,GAEf,MAAM,WAAW,CAAC;AAEnB,YAAY;AACZ,OAAO,EACL,eAAe,EACf,mBAAmB,GAEpB,MAAM,uBAAuB,CAAC"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Memento Loop Core Logic
|
|
3
|
+
*
|
|
4
|
+
* The main loop that coordinates navigator planning and worker implementation
|
|
5
|
+
* in a context-clearing iterative development pattern.
|
|
6
|
+
*
|
|
7
|
+
* Design principle: The WORKER forgets between iterations (memento pattern).
|
|
8
|
+
* The NAVIGATOR maintains its own memory and knowledge base. We provide git
|
|
9
|
+
* history as context about what the worker has accomplished so far.
|
|
10
|
+
*/
|
|
11
|
+
import type { MementoOptions, MementoResult } from "./types.js";
|
|
12
|
+
/**
|
|
13
|
+
* Options for the memento loop
|
|
14
|
+
*/
|
|
15
|
+
export interface MementoLoopOptions extends MementoOptions {
|
|
16
|
+
/** Model to use for worker agent (default: claude-haiku-4-5) */
|
|
17
|
+
model?: string;
|
|
18
|
+
/** Model to use for navigator agent (default: claude-opus-4-5) */
|
|
19
|
+
navModel?: string;
|
|
20
|
+
/** Maximum turns per agent call */
|
|
21
|
+
maxTurns?: number;
|
|
22
|
+
}
|
|
23
|
+
/**
|
|
24
|
+
* Run the memento loop
|
|
25
|
+
*
|
|
26
|
+
* Coordinates navigator planning and worker implementation in iterations
|
|
27
|
+
* until the task is complete or max iterations reached.
|
|
28
|
+
*
|
|
29
|
+
* All state is in-memory. Git history is the only persistent context
|
|
30
|
+
* visible to the agents.
|
|
31
|
+
*/
|
|
32
|
+
export declare function runMementoLoop(codeDirectory: string, navDirectory: string, task: string, options: MementoLoopOptions): Promise<MementoResult>;
|
|
33
|
+
//# sourceMappingURL=loop.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loop.d.ts","sourceRoot":"","sources":["../../src/memento/loop.ts"],"names":[],"mappings":"AAAA;;;;;;;;;GASG;AAMH,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAsB,MAAM,YAAY,CAAC;AAoBpF;;GAEG;AACH,MAAM,WAAW,kBAAmB,SAAQ,cAAc;IACxD,gEAAgE;IAChE,KAAK,CAAC,EAAE,MAAM,CAAC;IAEf,kEAAkE;IAClE,QAAQ,CAAC,EAAE,MAAM,CAAC;IAElB,mCAAmC;IACnC,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AA0bD;;;;;;;;GAQG;AACH,wBAAsB,cAAc,CAClC,aAAa,EAAE,MAAM,EACrB,YAAY,EAAE,MAAM,EACpB,IAAI,EAAE,MAAM,EACZ,OAAO,EAAE,kBAAkB,GAC1B,OAAO,CAAC,aAAa,CAAC,CA4PxB"}
|