mod8-cli 0.2.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/CHANGELOG.md +87 -0
- package/LICENSE +21 -0
- package/README.md +239 -0
- package/bin/mod8.js +2 -0
- package/dist/cli.js +302 -0
- package/dist/commands/addProvider.js +105 -0
- package/dist/commands/all.js +158 -0
- package/dist/commands/chat.js +855 -0
- package/dist/commands/config.js +29 -0
- package/dist/commands/devAuthStatus.js +34 -0
- package/dist/commands/devHostAsk.js +51 -0
- package/dist/commands/devHostSystem.js +15 -0
- package/dist/commands/devResolve.js +54 -0
- package/dist/commands/devSimulate.js +235 -0
- package/dist/commands/devWorkAsk.js +55 -0
- package/dist/commands/intentRouting.js +280 -0
- package/dist/commands/keys.js +55 -0
- package/dist/commands/list.js +27 -0
- package/dist/commands/login.js +147 -0
- package/dist/commands/logout.js +17 -0
- package/dist/commands/prompt.js +63 -0
- package/dist/commands/providers.js +30 -0
- package/dist/commands/verify.js +5 -0
- package/dist/input/compose.js +37 -0
- package/dist/input/files.js +49 -0
- package/dist/input/stdin.js +14 -0
- package/dist/providers/anthropic.js +115 -0
- package/dist/providers/displayName.js +25 -0
- package/dist/providers/errorHints.js +175 -0
- package/dist/providers/generic.js +331 -0
- package/dist/providers/genericChat.js +265 -0
- package/dist/providers/google.js +63 -0
- package/dist/providers/hostSystem.js +173 -0
- package/dist/providers/index.js +38 -0
- package/dist/providers/mock.js +87 -0
- package/dist/providers/modelResolution.js +42 -0
- package/dist/providers/openai.js +75 -0
- package/dist/providers/pricing.js +47 -0
- package/dist/providers/proxy.js +148 -0
- package/dist/providers/registry.js +196 -0
- package/dist/providers/types.js +1 -0
- package/dist/providers/workSystem.js +33 -0
- package/dist/storage/auth.js +65 -0
- package/dist/storage/config.js +35 -0
- package/dist/storage/keys.js +59 -0
- package/dist/storage/providers.js +337 -0
- package/dist/storage/sessions.js +150 -0
- package/dist/types.js +9 -0
- package/dist/util/debug.js +79 -0
- package/dist/util/errors.js +157 -0
- package/dist/util/prompt.js +111 -0
- package/dist/util/secrets.js +110 -0
- package/dist/util/text.js +53 -0
- package/dist/util/time.js +25 -0
- package/dist/verify/runner.js +437 -0
- package/package.json +69 -0
- package/specs/all-mode.yaml +44 -0
- package/specs/behavior/auto-fallback.yaml +49 -0
- package/specs/behavior/bare-name-routing.yaml +223 -0
- package/specs/behavior/bare-paste-confirm.yaml +125 -0
- package/specs/behavior/env-var-respected.yaml +108 -0
- package/specs/behavior/error-fidelity.yaml +92 -0
- package/specs/behavior/error-hints.yaml +160 -0
- package/specs/behavior/fresh-vs-resume.yaml +94 -0
- package/specs/behavior/fuzzy-match.yaml +208 -0
- package/specs/behavior/host-self-knowledge-fresh.yaml +66 -0
- package/specs/behavior/intent-no-mismatch.yaml +115 -0
- package/specs/behavior/login-logout.yaml +97 -0
- package/specs/behavior/no-model-allowlist.yaml +80 -0
- package/specs/behavior/paste-key.yaml +342 -0
- package/specs/behavior/provider-switching.yaml +186 -0
- package/specs/behavior/providers-json-respected.yaml +106 -0
- package/specs/behavior/self-knowledge.yaml +119 -0
- package/specs/behavior/stress-session.yaml +226 -0
- package/specs/behavior/switch-back-when-failing.yaml +90 -0
- package/specs/behavior/work-character.yaml +109 -0
- package/specs/chat-meta.yaml +349 -0
- package/specs/chat-startup.yaml +148 -0
- package/specs/chat.yaml +91 -0
- package/specs/config.yaml +42 -0
- package/specs/install.yaml +112 -0
- package/specs/keys.yaml +81 -0
- package/specs/one-shot.yaml +65 -0
- package/specs/pipe-and-files.yaml +40 -0
- package/specs/providers.yaml +172 -0
- package/specs/sessions.yaml +115 -0
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
name: sessions (persistence)
|
|
2
|
+
description: new / list / resume / clear / save behavior — uses storage layer directly when chat invocation would require API
|
|
3
|
+
|
|
4
|
+
tests:
|
|
5
|
+
- name: list shows empty state when no sessions exist
|
|
6
|
+
run: mod8 list
|
|
7
|
+
expect:
|
|
8
|
+
stdout_contains: "no sessions yet"
|
|
9
|
+
|
|
10
|
+
- name: list shows seeded session with id, fallback title, turn count
|
|
11
|
+
steps:
|
|
12
|
+
- shell: |
|
|
13
|
+
mkdir -p $MOD8_CONFIG_DIR/sessions
|
|
14
|
+
cat > $MOD8_CONFIG_DIR/sessions/2026-05-07-aaaa.json <<'JSON'
|
|
15
|
+
{
|
|
16
|
+
"version": 1,
|
|
17
|
+
"id": "2026-05-07-aaaa",
|
|
18
|
+
"title": null,
|
|
19
|
+
"createdAt": 1715000000000,
|
|
20
|
+
"lastActivity": 1715000000000,
|
|
21
|
+
"messages": [
|
|
22
|
+
{"role": "user", "content": "how do I refactor my auth middleware", "mode": "host"},
|
|
23
|
+
{"role": "assistant", "content": "what stack are you using?", "mode": "host"}
|
|
24
|
+
]
|
|
25
|
+
}
|
|
26
|
+
JSON
|
|
27
|
+
chmod 600 $MOD8_CONFIG_DIR/sessions/2026-05-07-aaaa.json
|
|
28
|
+
- run: mod8 list
|
|
29
|
+
expect:
|
|
30
|
+
stdout_contains:
|
|
31
|
+
- "2026-05-07-aaaa"
|
|
32
|
+
- "how do I refactor my"
|
|
33
|
+
- "1 turn"
|
|
34
|
+
|
|
35
|
+
- name: list shows real title when present
|
|
36
|
+
steps:
|
|
37
|
+
- shell: |
|
|
38
|
+
mkdir -p $MOD8_CONFIG_DIR/sessions
|
|
39
|
+
cat > $MOD8_CONFIG_DIR/sessions/2026-05-07-bbbb.json <<'JSON'
|
|
40
|
+
{
|
|
41
|
+
"version": 1,
|
|
42
|
+
"id": "2026-05-07-bbbb",
|
|
43
|
+
"title": "Refactoring auth middleware",
|
|
44
|
+
"createdAt": 1715000000000,
|
|
45
|
+
"lastActivity": 1715000000000,
|
|
46
|
+
"messages": [
|
|
47
|
+
{"role": "user", "content": "x", "mode": "host"},
|
|
48
|
+
{"role": "assistant", "content": "y", "mode": "host"}
|
|
49
|
+
]
|
|
50
|
+
}
|
|
51
|
+
JSON
|
|
52
|
+
chmod 600 $MOD8_CONFIG_DIR/sessions/2026-05-07-bbbb.json
|
|
53
|
+
- run: mod8 list
|
|
54
|
+
expect:
|
|
55
|
+
stdout_contains: "Refactoring auth middleware"
|
|
56
|
+
|
|
57
|
+
- name: list sorts by most recent activity first
|
|
58
|
+
steps:
|
|
59
|
+
- shell: |
|
|
60
|
+
mkdir -p $MOD8_CONFIG_DIR/sessions
|
|
61
|
+
cat > $MOD8_CONFIG_DIR/sessions/2026-05-07-cccc.json <<'JSON'
|
|
62
|
+
{"version":1,"id":"2026-05-07-cccc","title":"Older","createdAt":1700000000000,"lastActivity":1700000000000,"messages":[{"role":"user","content":"x","mode":"host"},{"role":"assistant","content":"y","mode":"host"}]}
|
|
63
|
+
JSON
|
|
64
|
+
cat > $MOD8_CONFIG_DIR/sessions/2026-05-07-dddd.json <<'JSON'
|
|
65
|
+
{"version":1,"id":"2026-05-07-dddd","title":"Newer","createdAt":1715000000000,"lastActivity":1715000000000,"messages":[{"role":"user","content":"x","mode":"host"},{"role":"assistant","content":"y","mode":"host"}]}
|
|
66
|
+
JSON
|
|
67
|
+
chmod 600 $MOD8_CONFIG_DIR/sessions/*.json
|
|
68
|
+
- run: mod8 list
|
|
69
|
+
expect:
|
|
70
|
+
stdout_matches: "Newer[\\s\\S]*Older"
|
|
71
|
+
|
|
72
|
+
- name: list shows hint to resume by id
|
|
73
|
+
steps:
|
|
74
|
+
- shell: |
|
|
75
|
+
mkdir -p $MOD8_CONFIG_DIR/sessions
|
|
76
|
+
cat > $MOD8_CONFIG_DIR/sessions/2026-05-07-eeee.json <<'JSON'
|
|
77
|
+
{"version":1,"id":"2026-05-07-eeee","title":"x","createdAt":0,"lastActivity":0,"messages":[]}
|
|
78
|
+
JSON
|
|
79
|
+
chmod 600 $MOD8_CONFIG_DIR/sessions/2026-05-07-eeee.json
|
|
80
|
+
- run: mod8 list
|
|
81
|
+
expect:
|
|
82
|
+
stdout_contains: "mod8 resume <id>"
|
|
83
|
+
|
|
84
|
+
- name: resume on bogus id is rejected with friendly error
|
|
85
|
+
steps:
|
|
86
|
+
- run: mod8 keys set anthropic
|
|
87
|
+
stdin: "fake-key"
|
|
88
|
+
- run: mod8 resume 2099-12-31-zzzz
|
|
89
|
+
expect:
|
|
90
|
+
stderr_contains:
|
|
91
|
+
- "no session with id"
|
|
92
|
+
- "mod8 list"
|
|
93
|
+
exit_code: 1
|
|
94
|
+
|
|
95
|
+
- name: resume on malformed id is rejected
|
|
96
|
+
steps:
|
|
97
|
+
- run: mod8 keys set anthropic
|
|
98
|
+
stdin: "fake-key"
|
|
99
|
+
- run: mod8 resume not-a-real-id
|
|
100
|
+
expect:
|
|
101
|
+
stderr_contains: "no session with id"
|
|
102
|
+
exit_code: 1
|
|
103
|
+
|
|
104
|
+
- name: a seeded session file is honored at 0600
|
|
105
|
+
steps:
|
|
106
|
+
- shell: |
|
|
107
|
+
mkdir -p $MOD8_CONFIG_DIR/sessions
|
|
108
|
+
cat > $MOD8_CONFIG_DIR/sessions/2026-05-07-perm.json <<'JSON'
|
|
109
|
+
{"version":1,"id":"2026-05-07-perm","title":"perm test","createdAt":0,"lastActivity":0,"messages":[]}
|
|
110
|
+
JSON
|
|
111
|
+
chmod 600 $MOD8_CONFIG_DIR/sessions/2026-05-07-perm.json
|
|
112
|
+
- run: mod8 list
|
|
113
|
+
expect:
|
|
114
|
+
stdout_contains: "2026-05-07-perm"
|
|
115
|
+
file_mode: "$MOD8_CONFIG_DIR/sessions/2026-05-07-perm.json:600"
|