mirror-mind 0.36.1 → 0.36.3
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/.pi/extensions/mirror-logger.ts +128 -26
- package/.pi/skills/mm-help/SKILL.md +4 -1
- package/README.md +1 -1
- package/docs/releases/index.md +2 -0
- package/docs/releases/v0.36.2.md +130 -0
- package/docs/releases/v0.36.3.md +142 -0
- package/package.json +1 -1
- package/plugins/mirror-mind/.claude-plugin/plugin.json +1 -1
- package/plugins/mirror-mind/plugin.json +1 -1
- package/ts/src/conversation/commandTurn.ts +3 -2
- package/ts/src/conversation/conversationDeletion.ts +45 -0
- package/ts/src/conversation/importedConversations.ts +288 -0
- package/ts/src/conversation/logger.ts +4 -18
- package/ts/src/conversation/piSkillTurns.ts +267 -0
- package/ts/src/frontDoor/cli.ts +38 -0
- package/ts/src/frontDoor/conversationLoggerRoute.ts +20 -2
- package/ts/src/frontDoor/dbSafetyToolsRoute.ts +1 -35
- package/ts/src/frontDoor/importedConversationsRoute.ts +337 -0
- package/ts/src/frontDoor/routing.ts +22 -0
- package/ts/src/frontDoor/skillTurnsRoute.ts +213 -0
- package/ts/src/frontDoor/stdinSource.ts +5 -0
- package/ts/src/mirror/mirrorForm.ts +4 -1
- package/ts/src/util/strictArgs.ts +59 -0
|
@@ -13,11 +13,14 @@
|
|
|
13
13
|
// $mirror-mind:mm:mirror … the Codex plugin (TS2 L10)
|
|
14
14
|
// /mm-mirror … Grok (TS4 L5)
|
|
15
15
|
// $mm-mirror … Codex's own skill form
|
|
16
|
+
// /skill:mm-mirror … Pi's command, which its menu sends (CR160)
|
|
16
17
|
//
|
|
17
18
|
// Three choices, each made by the runtime, not the person: the sigil (`/` or
|
|
18
19
|
// `$`), whether the plugin's name prefixes the skill, and whether the skill's
|
|
19
20
|
// `name: "mm:mirror"` or its directory `mm-mirror` is used. The grammar is
|
|
20
21
|
// their product, so a runtime that combines them differently is covered too.
|
|
22
|
+
// Pi is the exception: it registers every skill as the command `skill:<name>`
|
|
23
|
+
// (CR159 measured it on Pi 1.4.0), so its one form is spelled out whole.
|
|
21
24
|
//
|
|
22
25
|
// The form must open the prompt and end at whitespace or the end of it: a
|
|
23
26
|
// longer skill name (`/mm-mirrors`) is another skill, and a form quoted in the
|
|
@@ -32,7 +35,7 @@ export interface MirrorForm {
|
|
|
32
35
|
readonly query: string;
|
|
33
36
|
}
|
|
34
37
|
|
|
35
|
-
const FORM = /^([/$]
|
|
38
|
+
const FORM = /^(?:\/skill:mm-mirror|[/$](?:mirror-mind:)?mm[:-]mirror)(?=\s|$)/;
|
|
36
39
|
|
|
37
40
|
/** The explicit Mirror Mode form at the start of a prompt, or null. */
|
|
38
41
|
export function mirrorForm(prompt: string): MirrorForm | null {
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
// argparse-shaped strict parsing: every option declared, anything else refused.
|
|
2
|
+
//
|
|
3
|
+
// Moved from `dbSafetyToolsRoute.ts`, where `backup` and `repair-encoding` use
|
|
4
|
+
// it, when CR154 needed the same strictness for `conversations imported`. The
|
|
5
|
+
// reason is the same in all three: these commands write, and a lenient parser
|
|
6
|
+
// turns a typo into a different command. Under the `conversations` listing's
|
|
7
|
+
// parser, which ignores what it does not know, `remove --all --projet <folder>
|
|
8
|
+
// --apply` would drop the misspelled filter and remove every import in the
|
|
9
|
+
// home. Here the typo is refused, and nothing runs.
|
|
10
|
+
//
|
|
11
|
+
// Positionals are opt-in, for a grammar that takes them (CR154's ids). A token
|
|
12
|
+
// that starts with `-` is never a positional: an option nobody declared is a
|
|
13
|
+
// typo, not a value.
|
|
14
|
+
|
|
15
|
+
export interface StrictArgsSpec {
|
|
16
|
+
/** Options that stand alone. */
|
|
17
|
+
readonly flags: readonly string[];
|
|
18
|
+
/** Options that take the next token as their value, whatever it looks like. */
|
|
19
|
+
readonly valued: readonly string[];
|
|
20
|
+
/** Whether bare tokens are accepted, in order; otherwise they are unrecognized. */
|
|
21
|
+
readonly positionals?: boolean;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
export interface ParsedArgs {
|
|
25
|
+
flags: Set<string>;
|
|
26
|
+
values: Map<string, string>;
|
|
27
|
+
positionals: string[];
|
|
28
|
+
/** argparse's message for the first problem, or null. */
|
|
29
|
+
error: string | null;
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
export function parseArgs(args: readonly string[], spec: StrictArgsSpec): ParsedArgs {
|
|
33
|
+
const flags = new Set<string>();
|
|
34
|
+
const values = new Map<string, string>();
|
|
35
|
+
const positionals: string[] = [];
|
|
36
|
+
const unrecognized: string[] = [];
|
|
37
|
+
for (let index = 0; index < args.length; index += 1) {
|
|
38
|
+
const arg = args[index] as string;
|
|
39
|
+
if (spec.flags.includes(arg)) {
|
|
40
|
+
flags.add(arg);
|
|
41
|
+
} else if (spec.valued.includes(arg)) {
|
|
42
|
+
const value = args[index + 1];
|
|
43
|
+
if (value === undefined)
|
|
44
|
+
return { flags, values, positionals, error: `argument ${arg}: expected one argument` };
|
|
45
|
+
values.set(arg, value);
|
|
46
|
+
index += 1;
|
|
47
|
+
} else if (spec.positionals === true && !arg.startsWith("-")) {
|
|
48
|
+
positionals.push(arg);
|
|
49
|
+
} else {
|
|
50
|
+
unrecognized.push(arg);
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return {
|
|
54
|
+
flags,
|
|
55
|
+
values,
|
|
56
|
+
positionals,
|
|
57
|
+
error: unrecognized.length > 0 ? `unrecognized arguments: ${unrecognized.join(" ")}` : null,
|
|
58
|
+
};
|
|
59
|
+
}
|