@mmnto/cli 0.2.2 → 0.4.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/LICENSE +21 -21
- package/dist/commands/anchor.d.ts +2 -0
- package/dist/commands/anchor.d.ts.map +1 -0
- package/dist/commands/anchor.js +82 -0
- package/dist/commands/anchor.js.map +1 -0
- package/dist/commands/briefing.d.ts +1 -0
- package/dist/commands/briefing.d.ts.map +1 -1
- package/dist/commands/briefing.js +30 -30
- package/dist/commands/briefing.js.map +1 -1
- package/dist/commands/handoff.d.ts +1 -0
- package/dist/commands/handoff.d.ts.map +1 -1
- package/dist/commands/handoff.js +33 -33
- package/dist/commands/handoff.js.map +1 -1
- package/dist/commands/init.js +44 -44
- package/dist/commands/install-hooks.js +9 -9
- package/dist/commands/learn.d.ts +1 -0
- package/dist/commands/learn.d.ts.map +1 -1
- package/dist/commands/learn.js +26 -26
- package/dist/commands/learn.js.map +1 -1
- package/dist/commands/shield.d.ts +5 -0
- package/dist/commands/shield.d.ts.map +1 -1
- package/dist/commands/shield.js +60 -31
- package/dist/commands/shield.js.map +1 -1
- package/dist/commands/shield.test.d.ts +2 -0
- package/dist/commands/shield.test.d.ts.map +1 -0
- package/dist/commands/shield.test.js +92 -0
- package/dist/commands/shield.test.js.map +1 -0
- package/dist/commands/spec.d.ts +1 -0
- package/dist/commands/spec.d.ts.map +1 -1
- package/dist/commands/spec.js +34 -34
- package/dist/commands/spec.js.map +1 -1
- package/dist/commands/triage.d.ts +1 -0
- package/dist/commands/triage.d.ts.map +1 -1
- package/dist/commands/triage.js +28 -28
- package/dist/commands/triage.js.map +1 -1
- package/dist/index.js +18 -0
- package/dist/index.js.map +1 -1
- package/dist/utils.d.ts +1 -0
- package/dist/utils.d.ts.map +1 -1
- package/dist/utils.js +116 -13
- package/dist/utils.js.map +1 -1
- package/package.json +5 -4
package/LICENSE
CHANGED
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
MIT License
|
|
2
|
-
|
|
3
|
-
Copyright (c) 2026 Matt Sutton
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
-
in the Software without restriction, including without limitation the rights
|
|
8
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
-
furnished to do so, subject to the following conditions:
|
|
11
|
-
|
|
12
|
-
The above copyright notice and this permission notice shall be included in all
|
|
13
|
-
copies or substantial portions of the Software.
|
|
14
|
-
|
|
15
|
-
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
-
SOFTWARE.
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2026 Matt Sutton
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.d.ts","sourceRoot":"","sources":["../../src/commands/anchor.ts"],"names":[],"mappings":"AAkBA,wBAAsB,aAAa,CAAC,SAAS,CAAC,EAAE,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CA0ErE"}
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import * as fs from 'node:fs';
|
|
3
|
+
import * as path from 'node:path';
|
|
4
|
+
import { stdin as input, stdout as output } from 'node:process';
|
|
5
|
+
import * as readline from 'node:readline/promises';
|
|
6
|
+
import { IS_WIN, loadConfig, loadEnv, resolveConfigPath } from '../utils.js';
|
|
7
|
+
function detectSyncCommand(cwd) {
|
|
8
|
+
if (fs.existsSync(path.join(cwd, 'pnpm-lock.yaml'))) {
|
|
9
|
+
return { cmd: IS_WIN ? 'pnpm.cmd' : 'pnpm', args: ['exec', 'totem', 'sync', '--incremental'] };
|
|
10
|
+
}
|
|
11
|
+
if (fs.existsSync(path.join(cwd, 'yarn.lock'))) {
|
|
12
|
+
return { cmd: IS_WIN ? 'yarn.cmd' : 'yarn', args: ['totem', 'sync', '--incremental'] };
|
|
13
|
+
}
|
|
14
|
+
return { cmd: IS_WIN ? 'npx.cmd' : 'npx', args: ['totem', 'sync', '--incremental'] };
|
|
15
|
+
}
|
|
16
|
+
export async function anchorCommand(lessonArg) {
|
|
17
|
+
const cwd = process.cwd();
|
|
18
|
+
const configPath = resolveConfigPath(cwd);
|
|
19
|
+
loadEnv(cwd);
|
|
20
|
+
const config = await loadConfig(configPath);
|
|
21
|
+
const totemDir = path.join(cwd, config.totemDir);
|
|
22
|
+
if (!fs.existsSync(totemDir)) {
|
|
23
|
+
fs.mkdirSync(totemDir, { recursive: true });
|
|
24
|
+
}
|
|
25
|
+
const lessonsPath = path.join(totemDir, 'lessons.md');
|
|
26
|
+
let lessonText = lessonArg;
|
|
27
|
+
const tags = [];
|
|
28
|
+
if (!lessonText) {
|
|
29
|
+
const rl = readline.createInterface({ input, output });
|
|
30
|
+
try {
|
|
31
|
+
console.log('--- Proactive Anchoring ---');
|
|
32
|
+
const context = await rl.question('> Context (e.g., Attempting to persist state...): ');
|
|
33
|
+
const symptom = await rl.question('> Symptom (e.g., App crashes on reload...): ');
|
|
34
|
+
const fix = await rl.question('> Fix/Rule (e.g., Use custom localStorage wrappers...): ');
|
|
35
|
+
const tagStr = await rl.question('> Tags (comma separated): ');
|
|
36
|
+
if (tagStr.trim()) {
|
|
37
|
+
tags.push(...tagStr
|
|
38
|
+
.split(',')
|
|
39
|
+
.map((t) => t.trim())
|
|
40
|
+
.filter(Boolean));
|
|
41
|
+
}
|
|
42
|
+
const parts = [];
|
|
43
|
+
if (context.trim())
|
|
44
|
+
parts.push(`**Context:** ${context.trim()}`);
|
|
45
|
+
if (symptom.trim())
|
|
46
|
+
parts.push(`**Symptom:** ${symptom.trim()}`);
|
|
47
|
+
if (fix.trim())
|
|
48
|
+
parts.push(`**Fix/Rule:** ${fix.trim()}`);
|
|
49
|
+
lessonText = parts.join('\n');
|
|
50
|
+
}
|
|
51
|
+
finally {
|
|
52
|
+
rl.close();
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
if (!lessonText || !lessonText.trim()) {
|
|
56
|
+
console.error('[Totem Error] Lesson text cannot be empty.');
|
|
57
|
+
return;
|
|
58
|
+
}
|
|
59
|
+
const timestamp = new Date().toISOString();
|
|
60
|
+
const tagString = tags.length > 0 ? tags.join(', ') : 'manual';
|
|
61
|
+
const entry = `\n## Lesson — ${timestamp}\n\n**Tags:** ${tagString}\n\n${lessonText.trim()}\n`;
|
|
62
|
+
fs.appendFileSync(lessonsPath, entry, 'utf-8');
|
|
63
|
+
console.log(`\n[Totem] Lesson saved to ${config.totemDir}/lessons.md`);
|
|
64
|
+
const logPath = path.join(totemDir, 'mcp-sync.log');
|
|
65
|
+
console.log('[Totem] Triggering background re-index...');
|
|
66
|
+
try {
|
|
67
|
+
const { cmd, args } = detectSyncCommand(cwd);
|
|
68
|
+
const logFd = fs.openSync(logPath, 'a');
|
|
69
|
+
const child = spawn(cmd, args, {
|
|
70
|
+
cwd,
|
|
71
|
+
detached: true,
|
|
72
|
+
stdio: ['ignore', logFd, logFd],
|
|
73
|
+
shell: IS_WIN,
|
|
74
|
+
windowsHide: true,
|
|
75
|
+
});
|
|
76
|
+
child.unref();
|
|
77
|
+
}
|
|
78
|
+
catch (err) {
|
|
79
|
+
console.error('[Totem Warning] Failed to trigger background sync:', err);
|
|
80
|
+
}
|
|
81
|
+
}
|
|
82
|
+
//# sourceMappingURL=anchor.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"anchor.js","sourceRoot":"","sources":["../../src/commands/anchor.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,EAAE,MAAM,oBAAoB,CAAC;AAC3C,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAClC,OAAO,EAAE,KAAK,IAAI,KAAK,EAAE,MAAM,IAAI,MAAM,EAAE,MAAM,cAAc,CAAC;AAChE,OAAO,KAAK,QAAQ,MAAM,wBAAwB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AAE,GAAG,CAAC,CAAC;QACxC,MAAM,KAAK,GAAG,KAAK,CAAC,GAAG,EAAE,IAAI,EAAE;YAC7B,GAAG;YACH,QAAQ,EAAE,IAAI;YACd,KAAK,EAAE,CAAC,QAAQ,EAAE,KAAK,EAAE,KAAK,CAAC;YAC/B,KAAK,EAAE,MAAM;YACb,WAAW,EAAE,IAAI;SAClB,CAAC,CAAC;QACH,KAAK,CAAC,KAAK,EAAE,CAAC;IAChB,CAAC;IAAC,OAAO,GAAG,EAAE,CAAC;QACb,OAAO,CAAC,KAAK,CAAC,oDAAoD,EAAE,GAAG,CAAC,CAAC;IAC3E,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"briefing.d.ts","sourceRoot":"","sources":["../../src/commands/briefing.ts"],"names":[],"mappings":"AAqJA,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"briefing.d.ts","sourceRoot":"","sources":["../../src/commands/briefing.ts"],"names":[],"mappings":"AAqJA,MAAM,WAAW,eAAe;IAC9B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,eAAe,CAAC,OAAO,EAAE,eAAe,GAAG,OAAO,CAAC,IAAI,CAAC,CAwC7E"}
|
|
@@ -9,36 +9,36 @@ const TAG = 'Briefing';
|
|
|
9
9
|
const MAX_SPEC_RESULTS = 5;
|
|
10
10
|
const MAX_SESSION_RESULTS = 5;
|
|
11
11
|
// ─── System prompt ──────────────────────────────────────
|
|
12
|
-
const SYSTEM_PROMPT = `# Briefing System Prompt — Session Startup Briefing
|
|
13
|
-
|
|
14
|
-
## Purpose
|
|
15
|
-
Produce a session startup briefing that orients the developer at the start of an AI-assisted work session.
|
|
16
|
-
|
|
17
|
-
## Role
|
|
18
|
-
You are a technical project assistant producing a quick-start briefing. You have access to the current git state, open pull requests, and project knowledge from Totem. Your job is to synthesize this into an actionable summary so the developer knows exactly where they left off and what to do next.
|
|
19
|
-
|
|
20
|
-
## Rules
|
|
21
|
-
- Reference PRs by number (#NNN) and branch name
|
|
22
|
-
- Reference issues by number (#NNN) when they appear in Totem knowledge
|
|
23
|
-
- Be opinionated about what the recommended first action should be
|
|
24
|
-
- Be concise — this is a startup briefing, not a project plan
|
|
25
|
-
- If there are uncommitted changes, flag them prominently
|
|
26
|
-
- If there are no open PRs, say so
|
|
27
|
-
|
|
28
|
-
## Output Format
|
|
29
|
-
Respond with ONLY the sections below. No preamble, no closing remarks.
|
|
30
|
-
|
|
31
|
-
### Session Context
|
|
32
|
-
[Current branch, uncommitted changes summary. If working tree is clean, say so. If on a feature branch, note what it likely relates to.]
|
|
33
|
-
|
|
34
|
-
### Open PRs
|
|
35
|
-
[List of open PRs with number, title, and branch. If none, say "No open PRs." Highlight any that are the developer's current branch.]
|
|
36
|
-
|
|
37
|
-
### Active Priorities
|
|
38
|
-
[Key priorities and recent work context from Totem knowledge — what was recently worked on, what specs are active, what sessions covered. If no relevant knowledge, say "No recent context found in Totem index."]
|
|
39
|
-
|
|
40
|
-
### Recommended First Action
|
|
41
|
-
[Single clear recommendation for what the developer should do first in this session. Consider: uncommitted work to commit/continue, PRs to review/merge, next issue to pick up.]
|
|
12
|
+
const SYSTEM_PROMPT = `# Briefing System Prompt — Session Startup Briefing
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
Produce a session startup briefing that orients the developer at the start of an AI-assisted work session.
|
|
16
|
+
|
|
17
|
+
## Role
|
|
18
|
+
You are a technical project assistant producing a quick-start briefing. You have access to the current git state, open pull requests, and project knowledge from Totem. Your job is to synthesize this into an actionable summary so the developer knows exactly where they left off and what to do next.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
- Reference PRs by number (#NNN) and branch name
|
|
22
|
+
- Reference issues by number (#NNN) when they appear in Totem knowledge
|
|
23
|
+
- Be opinionated about what the recommended first action should be
|
|
24
|
+
- Be concise — this is a startup briefing, not a project plan
|
|
25
|
+
- If there are uncommitted changes, flag them prominently
|
|
26
|
+
- If there are no open PRs, say so
|
|
27
|
+
|
|
28
|
+
## Output Format
|
|
29
|
+
Respond with ONLY the sections below. No preamble, no closing remarks.
|
|
30
|
+
|
|
31
|
+
### Session Context
|
|
32
|
+
[Current branch, uncommitted changes summary. If working tree is clean, say so. If on a feature branch, note what it likely relates to.]
|
|
33
|
+
|
|
34
|
+
### Open PRs
|
|
35
|
+
[List of open PRs with number, title, and branch. If none, say "No open PRs." Highlight any that are the developer's current branch.]
|
|
36
|
+
|
|
37
|
+
### Active Priorities
|
|
38
|
+
[Key priorities and recent work context from Totem knowledge — what was recently worked on, what specs are active, what sessions covered. If no relevant knowledge, say "No recent context found in Totem index."]
|
|
39
|
+
|
|
40
|
+
### Recommended First Action
|
|
41
|
+
[Single clear recommendation for what the developer should do first in this session. Consider: uncommitted work to commit/continue, PRs to review/merge, next issue to pick up.]
|
|
42
42
|
`;
|
|
43
43
|
// ─── GitHub helpers ─────────────────────────────────────
|
|
44
44
|
const GhPrListItemSchema = z.object({
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"briefing.js","sourceRoot":"","sources":["../../src/commands/briefing.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,oBAAoB,CAAC;AAClD,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,CAAC,EAAE,MAAM,KAAK,CAAC;AAGxB,OAAO,EAAE,cAAc,EAAE,UAAU,EAAE,MAAM,cAAc,CAAC;AAE1D,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACvD,OAAO,EACL,aAAa,EACb,aAAa,EACb,MAA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AO,EAAE,OAAO,CAAC,GAAG,CAAC,CAAC;QAClC,IAAI,OAAO,CAAC,GAAG;YAAE,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,gBAAgB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../src/commands/handoff.ts"],"names":[],"mappings":"AAyGA,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;
|
|
1
|
+
{"version":3,"file":"handoff.d.ts","sourceRoot":"","sources":["../../src/commands/handoff.ts"],"names":[],"mappings":"AAyGA,MAAM,WAAW,cAAc;IAC7B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;CACnB;AAED,wBAAsB,cAAc,CAAC,OAAO,EAAE,cAAc,GAAG,OAAO,CAAC,IAAI,CAAC,CAuC3E"}
|
package/dist/commands/handoff.js
CHANGED
|
@@ -7,39 +7,39 @@ const TAG = 'Handoff';
|
|
|
7
7
|
const MAX_DIFF_CHARS = 50_000;
|
|
8
8
|
const LESSONS_TAIL_LINES = 100;
|
|
9
9
|
// ─── System prompt ──────────────────────────────────────
|
|
10
|
-
const SYSTEM_PROMPT = `# Handoff System Prompt — End-of-Session State Transfer
|
|
11
|
-
|
|
12
|
-
## Purpose
|
|
13
|
-
Produce an end-of-session handoff snapshot that captures everything the next session (or the next developer) needs to resume work immediately.
|
|
14
|
-
|
|
15
|
-
## Role
|
|
16
|
-
You are writing a concise, tactical "End of Shift" handoff. You have access to the current git state, uncommitted changes, and lessons learned during this session. Your job is to synthesize this into a snapshot that lets the next session bootstrap instantly — no detective work required.
|
|
17
|
-
|
|
18
|
-
## Rules
|
|
19
|
-
- Be concrete and specific — file paths, branch names, issue numbers
|
|
20
|
-
- Distinguish between what IS done vs what NEEDS to be done next
|
|
21
|
-
- If there are uncommitted changes, describe what they represent and whether they look ready to commit
|
|
22
|
-
- If the working tree is clean, say so and focus on what was accomplished and what's next
|
|
23
|
-
- Capture any lessons or traps discovered during this session
|
|
24
|
-
- Be concise — this is a tactical handoff, not a retrospective
|
|
25
|
-
|
|
26
|
-
## Output Format
|
|
27
|
-
Respond with ONLY the sections below. No preamble, no closing remarks.
|
|
28
|
-
|
|
29
|
-
### Branch & State
|
|
30
|
-
[Current branch, clean/dirty status, what the branch represents]
|
|
31
|
-
|
|
32
|
-
### What Was Done
|
|
33
|
-
[Summary of work completed this session based on the diff and git state. If no changes, say "No uncommitted changes — session may have been exploratory or changes were already committed."]
|
|
34
|
-
|
|
35
|
-
### Uncommitted Changes
|
|
36
|
-
[Description of what the uncommitted changes contain and their state (staged vs unstaged). If clean, say "Working tree is clean."]
|
|
37
|
-
|
|
38
|
-
### Lessons & Traps
|
|
39
|
-
[Lessons learned during this session from the memory file. If none, say "No new lessons recorded this session."]
|
|
40
|
-
|
|
41
|
-
### Next Steps
|
|
42
|
-
[Clear, ordered list of what the next session should do first. Be specific — not "continue working" but "finish implementing X in file Y, then run tests."]
|
|
10
|
+
const SYSTEM_PROMPT = `# Handoff System Prompt — End-of-Session State Transfer
|
|
11
|
+
|
|
12
|
+
## Purpose
|
|
13
|
+
Produce an end-of-session handoff snapshot that captures everything the next session (or the next developer) needs to resume work immediately.
|
|
14
|
+
|
|
15
|
+
## Role
|
|
16
|
+
You are writing a concise, tactical "End of Shift" handoff. You have access to the current git state, uncommitted changes, and lessons learned during this session. Your job is to synthesize this into a snapshot that lets the next session bootstrap instantly — no detective work required.
|
|
17
|
+
|
|
18
|
+
## Rules
|
|
19
|
+
- Be concrete and specific — file paths, branch names, issue numbers
|
|
20
|
+
- Distinguish between what IS done vs what NEEDS to be done next
|
|
21
|
+
- If there are uncommitted changes, describe what they represent and whether they look ready to commit
|
|
22
|
+
- If the working tree is clean, say so and focus on what was accomplished and what's next
|
|
23
|
+
- Capture any lessons or traps discovered during this session
|
|
24
|
+
- Be concise — this is a tactical handoff, not a retrospective
|
|
25
|
+
|
|
26
|
+
## Output Format
|
|
27
|
+
Respond with ONLY the sections below. No preamble, no closing remarks.
|
|
28
|
+
|
|
29
|
+
### Branch & State
|
|
30
|
+
[Current branch, clean/dirty status, what the branch represents]
|
|
31
|
+
|
|
32
|
+
### What Was Done
|
|
33
|
+
[Summary of work completed this session based on the diff and git state. If no changes, say "No uncommitted changes — session may have been exploratory or changes were already committed."]
|
|
34
|
+
|
|
35
|
+
### Uncommitted Changes
|
|
36
|
+
[Description of what the uncommitted changes contain and their state (staged vs unstaged). If clean, say "Working tree is clean."]
|
|
37
|
+
|
|
38
|
+
### Lessons & Traps
|
|
39
|
+
[Lessons learned during this session from the memory file. If none, say "No new lessons recorded this session."]
|
|
40
|
+
|
|
41
|
+
### Next Steps
|
|
42
|
+
[Clear, ordered list of what the next session should do first. Be specific — not "continue working" but "finish implementing X in file Y, then run tests."]
|
|
43
43
|
`;
|
|
44
44
|
// ─── Lessons file reader ────────────────────────────────
|
|
45
45
|
function readRecentLessons(cwd, totemDir) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"handoff.js","sourceRoot":"","sources":["../../src/commands/handoff.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,SAAS,CAAC;AAC9B,OAAO,KAAK,IAAI,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,YAAY,EAAE,UAAU,EAAE,cAAc,EAAE,YAAY,EAAE,MAAM,WAAW,CAAC;AACnF,OAAO,EAAE,UAAU,EAAE,OAAO,EAAE,iBAAiB,EAAE,eAAe,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAEnG,2DAA2D;AAE3D,MAAM,GAAG,GAAG,SAAS,CAAC;AACtB,M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G,CAAC,CAAC;QAClC,IAAI,OAAO,CAAC,GAAG;YAAE,OAAO,CAAC,KAAK,CAAC,IAAI,GAAG,gBAAgB,OAAO,CAAC,GAAG,EAAE,CAAC,CAAC;IACvE,CAAC;AACH,CAAC"}
|
package/dist/commands/init.js
CHANGED
|
@@ -3,28 +3,28 @@ import * as path from 'node:path';
|
|
|
3
3
|
import { stdin as input, stdout as output } from 'node:process';
|
|
4
4
|
import * as readline from 'node:readline/promises';
|
|
5
5
|
import { installPostMergeHook } from './install-hooks.js';
|
|
6
|
-
const AI_PROMPT_BLOCK = `
|
|
7
|
-
|
|
8
|
-
## Totem AI Integration (Auto-Generated)
|
|
9
|
-
You have access to the Totem MCP for long-term project memory. You MUST operate with the following reflexes:
|
|
10
|
-
|
|
11
|
-
### Memory Reflexes
|
|
12
|
-
1. **Pull Before Planning:** Before writing specs, architecture, or fixing complex bugs, use \`search_knowledge\` to retrieve domain constraints and past traps.
|
|
13
|
-
2. **Proactive Anchoring (The 3 Triggers):** You must autonomously call \`add_lesson\` when any of the following occur — do NOT wait for the user to ask:
|
|
14
|
-
- **The Trap Trigger:** If you spend >2 turns fixing a bug caused by a framework quirk, unexpected API response, or edge case. (Anchor the symptom + fix).
|
|
15
|
-
- **The Pivot Trigger:** If the user introduces a new architectural pattern or deprecates an old one. (Anchor the rule).
|
|
16
|
-
- **The Handoff Trigger:** At the end of a session or when wrapping up a complex feature, extract the non-obvious lessons learned and anchor them.
|
|
17
|
-
3. **Tool Preference (MCP over CLI):** Always prioritize using dedicated MCP tools (e.g., GitHub, Supabase, Vercel) over executing generic shell commands (like \`gh issue view\` or \`curl\`). MCP tools provide structured, un-truncated data optimized for your context window. Only fall back to bash execution if an MCP tool is unavailable or fails.
|
|
18
|
-
|
|
19
|
-
Lessons are automatically re-indexed in the background after each \`add_lesson\` call — no manual sync needed.
|
|
20
|
-
|
|
21
|
-
### Workflow Orchestrator Rituals
|
|
22
|
-
[FOR LOCAL CLI/TERMINAL AGENTS ONLY] Do not attempt to run these commands if you are a headless bot or operating in a cloud PR environment (e.g., Gemini Code Assist on GitHub).
|
|
23
|
-
Totem provides CLI commands that map to your development lifecycle. Use them at these moments:
|
|
24
|
-
1. **Start of Session:** Run \`totem briefing\` to get oriented with current branch state, open PRs, and recent context. Run \`totem triage\` if you need to pick a new task.
|
|
25
|
-
2. **Before Implementation:** Run \`totem spec <issue-url-or-topic>\` to generate an architectural plan and review related context before writing code.
|
|
26
|
-
3. **Before PR/Push:** Run \`totem shield\` to analyze uncommitted changes against project knowledge — catches architectural drift and pattern violations.
|
|
27
|
-
4. **End of Session:** Run \`totem handoff\` to generate a snapshot for the next agent session with current progress and open threads.
|
|
6
|
+
const AI_PROMPT_BLOCK = `
|
|
7
|
+
|
|
8
|
+
## Totem AI Integration (Auto-Generated)
|
|
9
|
+
You have access to the Totem MCP for long-term project memory. You MUST operate with the following reflexes:
|
|
10
|
+
|
|
11
|
+
### Memory Reflexes
|
|
12
|
+
1. **Pull Before Planning:** Before writing specs, architecture, or fixing complex bugs, use \`search_knowledge\` to retrieve domain constraints and past traps.
|
|
13
|
+
2. **Proactive Anchoring (The 3 Triggers):** You must autonomously call \`add_lesson\` when any of the following occur — do NOT wait for the user to ask:
|
|
14
|
+
- **The Trap Trigger:** If you spend >2 turns fixing a bug caused by a framework quirk, unexpected API response, or edge case. (Anchor the symptom + fix).
|
|
15
|
+
- **The Pivot Trigger:** If the user introduces a new architectural pattern or deprecates an old one. (Anchor the rule).
|
|
16
|
+
- **The Handoff Trigger:** At the end of a session or when wrapping up a complex feature, extract the non-obvious lessons learned and anchor them.
|
|
17
|
+
3. **Tool Preference (MCP over CLI):** Always prioritize using dedicated MCP tools (e.g., GitHub, Supabase, Vercel) over executing generic shell commands (like \`gh issue view\` or \`curl\`). MCP tools provide structured, un-truncated data optimized for your context window. Only fall back to bash execution if an MCP tool is unavailable or fails.
|
|
18
|
+
|
|
19
|
+
Lessons are automatically re-indexed in the background after each \`add_lesson\` call — no manual sync needed.
|
|
20
|
+
|
|
21
|
+
### Workflow Orchestrator Rituals
|
|
22
|
+
[FOR LOCAL CLI/TERMINAL AGENTS ONLY] Do not attempt to run these commands if you are a headless bot or operating in a cloud PR environment (e.g., Gemini Code Assist on GitHub).
|
|
23
|
+
Totem provides CLI commands that map to your development lifecycle. Use them at these moments:
|
|
24
|
+
1. **Start of Session:** Run \`totem briefing\` to get oriented with current branch state, open PRs, and recent context. Run \`totem triage\` if you need to pick a new task.
|
|
25
|
+
2. **Before Implementation:** Run \`totem spec <issue-url-or-topic>\` to generate an architectural plan and review related context before writing code.
|
|
26
|
+
3. **Before PR/Push:** Run \`totem shield\` to analyze uncommitted changes against project knowledge — catches architectural drift and pattern violations.
|
|
27
|
+
4. **End of Session:** Run \`totem handoff\` to generate a snapshot for the next agent session with current progress and open threads.
|
|
28
28
|
`;
|
|
29
29
|
function detectProject(cwd) {
|
|
30
30
|
const exists = (p) => fs.existsSync(path.join(cwd, p));
|
|
@@ -94,28 +94,28 @@ function generateConfig(targets, provider) {
|
|
|
94
94
|
const embeddingBlock = provider === 'openai'
|
|
95
95
|
? ` embedding: { provider: 'openai', model: 'text-embedding-3-small' },`
|
|
96
96
|
: ` embedding: { provider: 'ollama', model: 'nomic-embed-text', baseUrl: 'http://localhost:11434' },`;
|
|
97
|
-
return `import type { TotemConfig } from '@mmnto/totem';
|
|
98
|
-
|
|
99
|
-
const config: TotemConfig = {
|
|
100
|
-
targets: [
|
|
101
|
-
${formatTargets(targets)}
|
|
102
|
-
],
|
|
103
|
-
|
|
104
|
-
${embeddingBlock}
|
|
105
|
-
|
|
106
|
-
orchestrator: {
|
|
107
|
-
provider: 'shell',
|
|
108
|
-
command: 'gemini --model {model} -o json -e none < {file}',
|
|
109
|
-
defaultModel: 'gemini-3-flash-preview',
|
|
110
|
-
overrides: {
|
|
111
|
-
'spec': 'gemini-3.1-pro-preview',
|
|
112
|
-
'shield': 'gemini-3.1-pro-preview',
|
|
113
|
-
'triage': 'gemini-3.1-pro-preview',
|
|
114
|
-
},
|
|
115
|
-
},
|
|
116
|
-
};
|
|
117
|
-
|
|
118
|
-
export default config;
|
|
97
|
+
return `import type { TotemConfig } from '@mmnto/totem';
|
|
98
|
+
|
|
99
|
+
const config: TotemConfig = {
|
|
100
|
+
targets: [
|
|
101
|
+
${formatTargets(targets)}
|
|
102
|
+
],
|
|
103
|
+
|
|
104
|
+
${embeddingBlock}
|
|
105
|
+
|
|
106
|
+
orchestrator: {
|
|
107
|
+
provider: 'shell',
|
|
108
|
+
command: 'gemini --model {model} -o json -e none < {file}',
|
|
109
|
+
defaultModel: 'gemini-3-flash-preview',
|
|
110
|
+
overrides: {
|
|
111
|
+
'spec': 'gemini-3.1-pro-preview',
|
|
112
|
+
'shield': 'gemini-3.1-pro-preview',
|
|
113
|
+
'triage': 'gemini-3.1-pro-preview',
|
|
114
|
+
},
|
|
115
|
+
},
|
|
116
|
+
};
|
|
117
|
+
|
|
118
|
+
export default config;
|
|
119
119
|
`;
|
|
120
120
|
}
|
|
121
121
|
export async function initCommand() {
|
|
@@ -13,11 +13,11 @@ function detectSyncCommand(cwd) {
|
|
|
13
13
|
return 'npx totem sync --incremental';
|
|
14
14
|
}
|
|
15
15
|
function buildHookContent(syncCmd) {
|
|
16
|
-
return `#!/bin/sh
|
|
17
|
-
# ${TOTEM_HOOK_MARKER} — background re-index after pull/merge.
|
|
18
|
-
|
|
19
|
-
echo "[totem] Triggering background re-index..."
|
|
20
|
-
(${syncCmd} > .git/totem-sync.log 2>&1) &
|
|
16
|
+
return `#!/bin/sh
|
|
17
|
+
# ${TOTEM_HOOK_MARKER} — background re-index after pull/merge.
|
|
18
|
+
|
|
19
|
+
echo "[totem] Triggering background re-index..."
|
|
20
|
+
(${syncCmd} > .git/totem-sync.log 2>&1) &
|
|
21
21
|
`;
|
|
22
22
|
}
|
|
23
23
|
function detectHookManager(cwd) {
|
|
@@ -91,10 +91,10 @@ export async function installPostMergeHook(cwd, rl) {
|
|
|
91
91
|
}
|
|
92
92
|
// Append to existing hook
|
|
93
93
|
const separator = existing.endsWith('\n') ? '' : '\n';
|
|
94
|
-
const appendBlock = `${separator}
|
|
95
|
-
# ${TOTEM_HOOK_MARKER} — background re-index after pull/merge.
|
|
96
|
-
echo "[totem] Triggering background re-index..."
|
|
97
|
-
(${syncCmd} > .git/totem-sync.log 2>&1) &
|
|
94
|
+
const appendBlock = `${separator}
|
|
95
|
+
# ${TOTEM_HOOK_MARKER} — background re-index after pull/merge.
|
|
96
|
+
echo "[totem] Triggering background re-index..."
|
|
97
|
+
(${syncCmd} > .git/totem-sync.log 2>&1) &
|
|
98
98
|
`;
|
|
99
99
|
fs.appendFileSync(hookPath, appendBlock);
|
|
100
100
|
console.log('[Totem] Appended post-merge hook to existing hook file.');
|
package/dist/commands/learn.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"learn.d.ts","sourceRoot":"","sources":["../../src/commands/learn.ts"],"names":[],"mappings":"AAuRA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAID,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE,CAkBjE;AAID,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAenF;AAID,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmGzF"}
|
|
1
|
+
{"version":3,"file":"learn.d.ts","sourceRoot":"","sources":["../../src/commands/learn.ts"],"names":[],"mappings":"AAuRA,MAAM,WAAW,eAAe;IAC9B,IAAI,EAAE,MAAM,EAAE,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd;AAID,wBAAgB,YAAY,CAAC,SAAS,EAAE,MAAM,GAAG,eAAe,EAAE,CAkBjE;AAID,wBAAgB,aAAa,CAAC,OAAO,EAAE,eAAe,EAAE,EAAE,WAAW,EAAE,MAAM,GAAG,IAAI,CAenF;AAID,MAAM,WAAW,YAAY;IAC3B,GAAG,CAAC,EAAE,OAAO,CAAC;IACd,GAAG,CAAC,EAAE,MAAM,CAAC;IACb,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,MAAM,CAAC,EAAE,OAAO,CAAC;CAClB;AAED,wBAAsB,YAAY,CAAC,QAAQ,EAAE,MAAM,EAAE,OAAO,EAAE,YAAY,GAAG,OAAO,CAAC,IAAI,CAAC,CAmGzF"}
|
package/dist/commands/learn.js
CHANGED
|
@@ -9,32 +9,32 @@ const TAG = 'Learn';
|
|
|
9
9
|
const MAX_EXISTING_LESSONS = 10;
|
|
10
10
|
const MAX_REVIEW_BODY_CHARS = 50_000;
|
|
11
11
|
// ─── System prompt ──────────────────────────────────────
|
|
12
|
-
const SYSTEM_PROMPT = `# Learn System Prompt — PR Lesson Extraction
|
|
13
|
-
|
|
14
|
-
## Purpose
|
|
15
|
-
Extract tactical lessons from a pull request's review comments and discussion.
|
|
16
|
-
|
|
17
|
-
## Role
|
|
18
|
-
You are a knowledge curator analyzing a PR's review threads. Your job is to distill non-obvious lessons — traps, patterns, decisions with rationale — that will prevent future mistakes.
|
|
19
|
-
|
|
20
|
-
## Rules
|
|
21
|
-
- Extract ONLY non-obvious lessons (traps, surprising behaviors, pattern decisions with rationale)
|
|
22
|
-
- Ignore GCA boilerplate, simple acknowledgments, nits, and formatting suggestions
|
|
23
|
-
- When a suggestion was DECLINED, the author's rationale is often the most valuable lesson
|
|
24
|
-
- Each lesson should be 1-2 sentences capturing WHAT happened and WHY it matters
|
|
25
|
-
- Tags should be lowercase, comma-separated, reflecting the technical domain
|
|
26
|
-
- If existing lessons are provided, do NOT extract duplicates or near-duplicates
|
|
27
|
-
- If no lessons are worth extracting, output exactly: NONE
|
|
28
|
-
|
|
29
|
-
## Output Format
|
|
30
|
-
For each lesson, use this exact delimiter format:
|
|
31
|
-
|
|
32
|
-
---LESSON---
|
|
33
|
-
Tags: tag1, tag2, tag3
|
|
34
|
-
The lesson text. One or two sentences capturing the trap/pattern and WHY it matters.
|
|
35
|
-
---END---
|
|
36
|
-
|
|
37
|
-
If no lessons found, output exactly: NONE
|
|
12
|
+
const SYSTEM_PROMPT = `# Learn System Prompt — PR Lesson Extraction
|
|
13
|
+
|
|
14
|
+
## Purpose
|
|
15
|
+
Extract tactical lessons from a pull request's review comments and discussion.
|
|
16
|
+
|
|
17
|
+
## Role
|
|
18
|
+
You are a knowledge curator analyzing a PR's review threads. Your job is to distill non-obvious lessons — traps, patterns, decisions with rationale — that will prevent future mistakes.
|
|
19
|
+
|
|
20
|
+
## Rules
|
|
21
|
+
- Extract ONLY non-obvious lessons (traps, surprising behaviors, pattern decisions with rationale)
|
|
22
|
+
- Ignore GCA boilerplate, simple acknowledgments, nits, and formatting suggestions
|
|
23
|
+
- When a suggestion was DECLINED, the author's rationale is often the most valuable lesson
|
|
24
|
+
- Each lesson should be 1-2 sentences capturing WHAT happened and WHY it matters
|
|
25
|
+
- Tags should be lowercase, comma-separated, reflecting the technical domain
|
|
26
|
+
- If existing lessons are provided, do NOT extract duplicates or near-duplicates
|
|
27
|
+
- If no lessons are worth extracting, output exactly: NONE
|
|
28
|
+
|
|
29
|
+
## Output Format
|
|
30
|
+
For each lesson, use this exact delimiter format:
|
|
31
|
+
|
|
32
|
+
---LESSON---
|
|
33
|
+
Tags: tag1, tag2, tag3
|
|
34
|
+
The lesson text. One or two sentences capturing the trap/pattern and WHY it matters.
|
|
35
|
+
---END---
|
|
36
|
+
|
|
37
|
+
If no lessons found, output exactly: NONE
|
|
38
38
|
`;
|
|
39
39
|
// ─── GitHub helpers ─────────────────────────────────────
|
|
40
40
|
const GhPrSchema = z.object({
|