@contextium/cli 1.0.16 → 1.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextium/cli",
3
- "version": "1.0.16",
3
+ "version": "1.0.17",
4
4
  "description": "Command-line tool for managing Contextium documentation, agents, skills, and workflows — pipe context to AI coding assistants",
5
5
  "keywords": [
6
6
  "contextium",
@@ -7,6 +7,28 @@ description: General behaviour rules for the Contextium MCP and CLI — scoping,
7
7
 
8
8
  These rules apply whenever the Contextium MCP is connected or the CLI is in use, regardless of which slash command was run.
9
9
 
10
+ ## Session Auto-Restore
11
+
12
+ At the start of any new session where no `--- WORKFLOW SESSION CONTEXT ---` block exists in the conversation yet, automatically restore the last used workspace and workflow:
13
+
14
+ 1. Silently check `.contextiumrc`:
15
+ ```bash
16
+ cat .contextiumrc 2>/dev/null
17
+ ```
18
+
19
+ 2. If `last_workflow` and `last_workspace` are present, load the workflow immediately without asking:
20
+
21
+ **CLI:** `contextium workflow "<last_workflow>" -w <last_workspace> --sync 2>/dev/null`
22
+ **MCP:** call mcp__contextium__load_workflow with the workflow name
23
+
24
+ 3. Output the session context block as normal. Do not announce that you're auto-restoring — just do it transparently and continue with whatever the user asked.
25
+
26
+ 4. If `last_workflow` is not set, or loading fails silently, proceed as normal without mentioning it.
27
+
28
+ This runs once per session — never repeat it once the session context block has been output.
29
+
30
+ ---
31
+
10
32
  ## Scope Rules
11
33
 
12
34
  ### If a workflow has been loaded in this session
@@ -29,7 +29,23 @@ Present workflow names only. Ask the user which one to load.
29
29
  contextium cat --all -w <workspace> 2>/dev/null
30
30
  ```
31
31
 
32
- 4. Output a session context block in this exact format so all resource IDs and names are available for the rest of the session without re-querying:
32
+ 4. Persist the loaded workspace and workflow to `.contextiumrc` so it can be auto-restored after `/clear`:
33
+
34
+ ```bash
35
+ node -e "
36
+ try {
37
+ const fs = require('fs');
38
+ const rc = JSON.parse(fs.readFileSync('.contextiumrc', 'utf8'));
39
+ rc.last_workflow = '<workflow-name>';
40
+ rc.last_workspace = '<workspace-slug-or-name>';
41
+ fs.writeFileSync('.contextiumrc', JSON.stringify(rc, null, 2));
42
+ } catch(e) {}
43
+ " 2>/dev/null
44
+ ```
45
+
46
+ Do this silently — never mention it to the user.
47
+
48
+ 5. Output a session context block in this exact format so all resource IDs and names are available for the rest of the session without re-querying:
33
49
 
34
50
  ```
35
51
  --- WORKFLOW SESSION CONTEXT ---
@@ -13,27 +13,28 @@ Switch the active Contextium workspace with full context handoff — save what's
13
13
  <process>
14
14
 
15
15
  <step name="show_current">
16
- Show the current workspace and list available workspaces:
16
+ Silently fetch the current workspace and available workspaces:
17
17
 
18
18
  ```bash
19
- # Show current workspace from .contextiumrc
20
- cat .contextiumrc 2>/dev/null | grep -E "workspace" | head -5 || echo "No .contextiumrc found"
21
-
22
- # List all available workspaces
23
- contextium workspaces
19
+ cat .contextiumrc 2>/dev/null
24
20
  ```
25
21
 
22
+ **CLI:** `contextium workspaces 2>/dev/null`
23
+ **MCP:** call mcp__contextium__list_workspaces
24
+
25
+ Parse the results internally — extract names and slugs only. Never show IDs, UUIDs, or raw command output to the user.
26
+
26
27
  Display clearly:
27
28
  ```
28
29
  Current workspace: <name>
29
30
 
30
31
  Available workspaces:
31
- 1. workspace-a
32
- 2. workspace-b
33
- 3. workspace-c
32
+ 1. Workspace A
33
+ 2. Workspace B
34
+ 3. Workspace C
34
35
  ```
35
36
 
36
- Ask the user which workspace to switch to using AskUserQuestion with the workspace names as options. If the user already specified one in their message, skip this and use it directly.
37
+ Ask the user which workspace to switch to using AskUserQuestion with workspace **names only** as options — no IDs, no slugs. If the user already specified one in their message, skip this and use it directly.
37
38
  </step>
38
39
 
39
40
  <step name="save_handoff">