@contextium/cli 1.0.1 → 1.0.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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contextium/cli",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
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",
@@ -1,26 +1,204 @@
1
1
  ---
2
2
  name: ium:new-project
3
- description: Set up a new Contextium project — authenticate, pick a workspace, create libraries, agents, skills, and a workflow
3
+ description: Set up a new Contextium project — authenticate, pick a workspace, describe project, intelligently suggest and create libraries, agents, skills, tags, and a workflow
4
4
  allowed-tools:
5
5
  - Bash
6
+ - mcp__contextium__list_workspaces
7
+ - mcp__contextium__create_context_library
8
+ - mcp__contextium__list_context_libraries
9
+ - mcp__contextium__create_agent
10
+ - mcp__contextium__list_agents
11
+ - mcp__contextium__create_skill
12
+ - mcp__contextium__list_skills
13
+ - mcp__contextium__create_workflow
14
+ - mcp__contextium__list_workflows
15
+ - mcp__contextium__list_tags
16
+ - mcp__contextium__list_tag_types
17
+ - mcp__contextium__create_tag
18
+ - mcp__contextium__create_tag_type
19
+ - AskUserQuestion
6
20
  ---
7
21
 
8
22
  <objective>
9
- Guide the user through setting up a brand new Contextium project from scratch. This is the first-time onboarding flow authentication, workspace selection, project structure, and workflow creation.
23
+ Set up a new Contextium project intelligently understand what the user is trying to do, quietly analyse the workspace for existing resources, then recommend exactly what to create (libraries, agents, skills, tags, workflow) with clear reasoning. Get confirmation before creating anything.
10
24
  </objective>
11
25
 
26
+ <mode-detection>
27
+ Run this once at the start, silently, to determine which mode to use for the entire session:
28
+
29
+ ```bash
30
+ command -v contextium &>/dev/null && echo "cli" || echo "no-cli"
31
+ ```
32
+
33
+ - If `cli`: use CLI commands throughout. Do not attempt MCP tools.
34
+ - If `no-cli`: check if mcp__contextium__list_workspaces is available. If yes, use MCP tools throughout.
35
+ - If neither: tell the user "Contextium doesn't appear to be installed. Install the CLI with `npm install -g @contextium/cli` or connect the MCP server, then re-run this." Stop here.
36
+
37
+ Do not mention the mode to the user. Pick one path and stick with it.
38
+ </mode-detection>
39
+
12
40
  <process>
13
- Run the following command and let the wizard guide the user interactively:
14
41
 
42
+ <step name="check_auth">
43
+ **CLI only.** Run silently:
15
44
  ```bash
16
- contextium setup
45
+ contextium whoami 2>/dev/null | grep -E "Token:|Name:" || echo "unauthenticated"
17
46
  ```
47
+ If token is expired or unauthenticated, tell the user: "Your Contextium session has expired — run `contextium login` in your terminal, then come back and re-run this." Stop here.
48
+
49
+ MCP users are already authenticated via the server connection — skip this step.
50
+ </step>
51
+
52
+ <step name="select_workspace">
53
+ **CLI:** run `contextium workspace list 2>/dev/null` silently, parse workspace names.
54
+ **MCP:** call mcp__contextium__list_workspaces silently.
18
55
 
19
- If the user wants to reconfigure from scratch, run:
56
+ Ask: "Which workspace is this project for?"
57
+
58
+ Present names only — no IDs, no raw output.
59
+ </step>
60
+
61
+ <step name="project_description">
62
+ Ask the user this question exactly:
63
+
64
+ "Tell me about your project — what are you trying to do, what topics are involved, and what kind of work will you be doing with this? The more detail you give me, the better I can set things up for you."
65
+
66
+ Wait for their response. Store it as the project description. Do not proceed until you have a meaningful answer.
67
+ </step>
68
+
69
+ <step name="quiet_analysis">
70
+ Silently fetch all existing workspace resources. Do not show raw output or errors. Show only these progress lines as you go:
71
+
72
+ ```
73
+ Searching libraries...
74
+ Searching agents...
75
+ Searching skills...
76
+ Searching tags...
77
+ ```
20
78
 
79
+ **CLI:**
21
80
  ```bash
22
- contextium setup --force
81
+ contextium library list --workspace <slug> 2>/dev/null
82
+ contextium agent list --workspace <slug> 2>/dev/null
83
+ contextium skill list --workspace <slug> 2>/dev/null
84
+ contextium tag list --workspace <slug> 2>/dev/null
85
+ ```
86
+
87
+ **MCP:** call list_context_libraries, list_agents, list_skills, list_tags — all for the selected workspace. Suppress any errors silently.
88
+
89
+ After all four searches complete, output this line:
23
90
  ```
91
+ Creating Contextium setup plan...
92
+ ```
93
+
94
+ Then analyse the results against the project description:
95
+ - Which existing libraries (if any) are relevant to what the user described?
96
+ - Which existing agents (if any) could serve this project?
97
+ - Which existing skills (if any) are applicable?
98
+ - Which existing tags/tag types (if any) relate to the topics mentioned?
99
+
100
+ Internally categorise everything as: **reuse** (relevant, already exists) or **create** (needed, does not exist).
101
+ </step>
102
+
103
+ <step name="intelligent_plan">
104
+ Based on the project description and the analysis, build a setup plan. Think through:
105
+
106
+ **Libraries:** What distinct knowledge areas did the user mention? Each major topic or type of content that needs to be stored separately should be its own library. If an existing library already covers one of these, mark it for reuse.
107
+
108
+ **Agents:** What kind of AI assistant roles would serve this project? Think about what tasks the user will perform — research, writing, analysis, Q&A, etc. If an existing agent fits, mark it for reuse.
109
+
110
+ **Skills:** What reusable knowledge blocks would help agents working on this project? Think about domain-specific guidelines, reference material, or persistent context the agent needs. If an existing skill fits, mark it for reuse.
111
+
112
+ **Tags:** What topic or category labels would make sense for organising content in this project? Look for existing tag types that match. If none exist, suggest new ones. Think in terms of tag categories (e.g. `topic`, `source`, `status`) and the specific tag values within them (e.g. `topic:space-travel`, `topic:rocket-engineering`).
113
+
114
+ **Workflow:** Propose one workflow name that bundles everything together for quick loading.
115
+
116
+ Present the plan in this format (omit any section that has nothing in it):
117
+
118
+ ---
119
+
120
+ Here's what I'll set up for you:
121
+
122
+ **New libraries to create**
123
+ - "Library Name" — reason why this is needed
124
+
125
+ **Existing libraries to reuse**
126
+ - "Library Name" — why it's relevant
127
+
128
+ **New agents to create**
129
+ - "Agent Name" — what it will do for this project
130
+
131
+ **Existing agents to reuse**
132
+ - "Agent Name" — why it fits
133
+
134
+ **New skills to create**
135
+ - "Skill Name" — what knowledge it will hold
136
+
137
+ **Existing skills to reuse**
138
+ - "Skill Name" — why it fits
139
+
140
+ **Tags to create**
141
+ - `category:value` — why this label is useful
142
+
143
+ **Workflow**
144
+ - "Workflow Name" — bundles everything above for quick loading
145
+
146
+ Shall I go ahead and create all of this?
147
+
148
+ ---
149
+
150
+ Wait for the user to confirm, adjust, or say skip on any item before proceeding.
151
+ </step>
152
+
153
+ <step name="create_resources">
154
+ Only create what the user confirmed. Create in this order: tag types → tags → libraries → skills → agents → workflow.
155
+
156
+ Show `✓ Created "Name"` for each item as it is created. Show `↗ Reusing "Name"` for each existing resource being included.
157
+
158
+ Suppress all errors silently — if something fails, skip it quietly and note it in the summary.
159
+
160
+ **CLI commands:**
161
+ ```bash
162
+ contextium library create "<name>" --workspace <slug>
163
+ contextium agent create "<name>" --workspace <slug>
164
+ contextium skill create "<name>" --workspace <slug>
165
+ contextium workflow create "<name>" --workspace <slug>
166
+ contextium tag create "<value>" --type <type-slug> --workspace <slug>
167
+ contextium tag-type create "<name>" --workspace <slug>
168
+ ```
169
+
170
+ **MCP:** use the corresponding create_* tools for each resource type.
171
+ </step>
172
+
173
+ <step name="summary">
174
+ Show a clean final summary:
175
+
176
+ ```
177
+ ✓ Project ready
178
+
179
+ Workspace: <name>
180
+ Libraries: <list — new + reused>
181
+ Agents: <list — new + reused, or none>
182
+ Skills: <list — new + reused, or none>
183
+ Tags: <list, or none>
184
+ Workflow: <name>
185
+
186
+ Load it anytime with /ium:workflow.
187
+ ```
188
+
189
+ If anything failed to create, add a single line at the end:
190
+ `⚠ Could not create: <list of names> — you can add these manually.`
191
+ </step>
24
192
 
25
- Do not interrupt or wrap the wizard output — let it run fully interactively.
26
193
  </process>
194
+
195
+ <rules>
196
+ - Never say "the wizard", "Contextium would like to know", or "the next step is"
197
+ - Never show raw bash output, API responses, or IDs to the user
198
+ - Run all checks and fetches silently — only surface progress labels and the final plan
199
+ - Only ask questions when genuinely needed — the description step and the confirmation step
200
+ - Do not ask the user what to create — figure it out from the description, then ask them to confirm
201
+ - If a resource already exists and is relevant, always prefer reuse over creating a duplicate
202
+ - The plan report must explain the reasoning for each item — not just list names
203
+ - Never create anything before the user confirms the plan
204
+ </rules>