@contextium/cli 1.0.4 → 1.0.6
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.
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-file.d.ts","sourceRoot":"","sources":["../../src/commands/new-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,cAAc,
|
|
1
|
+
{"version":3,"file":"new-file.d.ts","sourceRoot":"","sources":["../../src/commands/new-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAMnC,eAAO,MAAM,cAAc,SA+FvB,CAAA"}
|
|
@@ -8,8 +8,9 @@ export const newFileCommand = new Command('new')
|
|
|
8
8
|
.argument('<library>', 'Context library/project name or slug')
|
|
9
9
|
.requiredOption('-t, --title <title>', 'File title')
|
|
10
10
|
.requiredOption('-p, --path <path>', 'File path (e.g. "guide.md")')
|
|
11
|
-
.option('-c, --content <text>', 'File content')
|
|
11
|
+
.option('-c, --content <text>', 'File content (avoid for long or multi-line content — use --stdin or -f instead)')
|
|
12
12
|
.option('-f, --from-file <filepath>', 'Read content from a local file')
|
|
13
|
+
.option('--stdin', 'Read content from stdin (pipe content in)')
|
|
13
14
|
.option('-w, --workspace <slug>', 'Workspace name or slug')
|
|
14
15
|
.option('--folder <id>', 'Folder ID to place file in')
|
|
15
16
|
.action(async (libraryName, options) => {
|
|
@@ -43,13 +44,23 @@ export const newFileCommand = new Command('new')
|
|
|
43
44
|
spinner.fail(`Context library '${libraryName}' not found`);
|
|
44
45
|
process.exit(1);
|
|
45
46
|
}
|
|
46
|
-
// Read content
|
|
47
|
+
// Read content — stdin takes priority, then -f, then -c
|
|
47
48
|
let content = options.content || '';
|
|
48
49
|
if (options.fromFile) {
|
|
49
50
|
content = await fs.readFile(options.fromFile, 'utf-8');
|
|
50
51
|
}
|
|
51
|
-
if (
|
|
52
|
-
spinner.
|
|
52
|
+
if (options.stdin) {
|
|
53
|
+
spinner.stop();
|
|
54
|
+
content = await new Promise((resolve, reject) => {
|
|
55
|
+
const chunks = [];
|
|
56
|
+
process.stdin.on('data', (chunk) => chunks.push(chunk));
|
|
57
|
+
process.stdin.on('end', () => resolve(Buffer.concat(chunks).toString('utf-8')));
|
|
58
|
+
process.stdin.on('error', reject);
|
|
59
|
+
});
|
|
60
|
+
spinner.start();
|
|
61
|
+
}
|
|
62
|
+
if (!content || content.trim() === '') {
|
|
63
|
+
spinner.fail('File content is required. Use --stdin (pipe content in), -f <filepath>, or -c <text>.');
|
|
53
64
|
process.exit(1);
|
|
54
65
|
}
|
|
55
66
|
const data = {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"new-file.js","sourceRoot":"","sources":["../../src/commands/new-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,sBAAsB,CAAA;AAChD,OAAO,EAAE,UAAU,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,KAAK,EAAE,GAAG,EAAE,MAAM,kBAAkB,CAAA;AAC7C,OAAO,EAAE,MAAM,aAAa,CAAA;AAE5B,MAAM,CAAC,MAAM,cAAc,GAAG,IAAI,OAAO,CAAC,KAAK,CAAC;KAC7C,WAAW,CAAC,kDAAkD,CAAC;KAC/D,QAAQ,CAAC,WAAW,EAAE,sCAAsC,CAAC;KAC7D,cAAc,CAAC,qBAAqB,EAAE,YAAY,CAAC;KACnD,cAAc,CAAC,mBAAmB,EAAE,6BAA6B,CAAC;KAClE,MAAM,CAAC,sBAAsB,EAAE,
|
|
1
|
+
{"version":3,"file":"new-file.js","sourceRoot":"","sources":["../../src/commands/new-file.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AACnC,OAAO,EAAE,SAAS,EAAE,MAAM,sB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AAE,QAAQ,EAAE,GAAG,MAAM,MAAM,CAAC,IAAI,CAAC,aAAa,YAAY,CAAC,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAA;QACxF,MAAM,IAAI,GAAG,QAAQ,CAAC,IAAI,IAAI,QAAQ,CAAA;QAEtC,OAAO,CAAC,IAAI,EAAE,CAAA;QAEd,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC,CAAA;QAC1D,OAAO,CAAC,GAAG,CAAC,YAAY,IAAI,CAAC,KAAK,EAAE,CAAC,CAAA;QACrC,OAAO,CAAC,GAAG,CAAC,WAAW,IAAI,CAAC,IAAI,EAAE,CAAC,CAAA;QACnC,OAAO,CAAC,GAAG,CAAC,SAAS,IAAI,CAAC,EAAE,EAAE,CAAC,CAAA;QAC/B,OAAO,CAAC,GAAG,CAAC,cAAc,YAAY,CAAC,IAAI,EAAE,CAAC,CAAA;QAC9C,OAAO,CAAC,GAAG,EAAE,CAAA;IACf,CAAC;IAAC,OAAO,KAAU,EAAE,CAAC;QACpB,OAAO,CAAC,IAAI,CAAC,0BAA0B,KAAK,CAAC,OAAO,EAAE,CAAC,CAAA;QACvD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAA;IACjB,CAAC;AACH,CAAC,CAAC,CAAA"}
|
package/package.json
CHANGED
package/skills/ium/new.md
CHANGED
|
@@ -6,24 +6,26 @@ allowed-tools:
|
|
|
6
6
|
---
|
|
7
7
|
|
|
8
8
|
<objective>
|
|
9
|
-
Create a new file in a Contextium context library. Always
|
|
9
|
+
Create a new file in a Contextium context library. Always pipe content via stdin using a single-quoted heredoc — never use -c to inline content as special characters will be mangled by the shell.
|
|
10
10
|
</objective>
|
|
11
11
|
|
|
12
12
|
<process>
|
|
13
|
-
|
|
14
|
-
|
|
13
|
+
If the user has not specified a library, list available libraries first:
|
|
15
14
|
```bash
|
|
16
|
-
contextium
|
|
15
|
+
contextium libraries -w <workspace>
|
|
17
16
|
```
|
|
18
17
|
|
|
19
|
-
|
|
18
|
+
Then create the file by piping content through stdin using a single-quoted heredoc (the `'EOF'` quotes prevent all shell interpolation):
|
|
19
|
+
|
|
20
20
|
```bash
|
|
21
|
-
contextium
|
|
21
|
+
cat << 'EOF' | contextium new <library-name> -t "<title>" -p "<path.md>" --stdin -w <workspace>
|
|
22
|
+
<full file content here>
|
|
23
|
+
EOF
|
|
22
24
|
```
|
|
23
25
|
|
|
24
26
|
Rules:
|
|
25
|
-
- ALWAYS
|
|
26
|
-
- The
|
|
27
|
-
-
|
|
27
|
+
- ALWAYS use the heredoc+stdin pattern — never use -c to pass content inline
|
|
28
|
+
- The single quotes around EOF (`<< 'EOF'`) are mandatory — they prevent shell interpolation of $variables, backticks, and special characters
|
|
29
|
+
- Write the complete, fully-formed content inside the heredoc — not a placeholder
|
|
28
30
|
- If no workspace is set in .contextiumrc, ask the user which workspace to use
|
|
29
31
|
</process>
|
package/skills/ium/workflow.md
CHANGED
|
@@ -3,28 +3,63 @@ name: ium:workflow
|
|
|
3
3
|
description: Load a Contextium workflow and sync its resources into context — bundles agents, skills, and libraries for a project
|
|
4
4
|
allowed-tools:
|
|
5
5
|
- Bash
|
|
6
|
+
- mcp__contextium__load_workflow
|
|
7
|
+
- mcp__contextium__list_workflows
|
|
6
8
|
---
|
|
7
9
|
|
|
8
10
|
<objective>
|
|
9
|
-
Load a Contextium workflow and bring its resources into the current context.
|
|
11
|
+
Load a Contextium workflow and bring its resources into the current context. Once loaded, output a structured session context block so Claude never needs to re-list or re-check workspace resources during this session.
|
|
10
12
|
</objective>
|
|
11
13
|
|
|
12
14
|
<process>
|
|
13
|
-
1.
|
|
15
|
+
1. If no workflow name was specified, list available workflows so the user can pick one. Do this silently — do not show raw output:
|
|
16
|
+
|
|
17
|
+
**CLI:** `contextium workflows list -w <workspace> 2>/dev/null`
|
|
18
|
+
**MCP:** call mcp__contextium__list_workflows
|
|
19
|
+
|
|
20
|
+
Present workflow names only. Ask the user which one to load.
|
|
21
|
+
|
|
22
|
+
2. Load the chosen workflow:
|
|
23
|
+
|
|
24
|
+
**CLI:** `contextium workflow "<workflow-name>" -w <workspace> --sync 2>/dev/null`
|
|
25
|
+
**MCP:** call mcp__contextium__load_workflow
|
|
26
|
+
|
|
27
|
+
3. Output synced file content to context (CLI only):
|
|
14
28
|
```bash
|
|
15
|
-
contextium
|
|
29
|
+
contextium cat --all -w <workspace> 2>/dev/null
|
|
16
30
|
```
|
|
17
31
|
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
contextium workflow "<workflow-name>" -w <workspace> --sync
|
|
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:
|
|
33
|
+
|
|
21
34
|
```
|
|
35
|
+
--- WORKFLOW SESSION CONTEXT ---
|
|
36
|
+
Workflow: <name>
|
|
37
|
+
Workspace: <name> (id: <id>)
|
|
22
38
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
39
|
+
Libraries:
|
|
40
|
+
- "<name>" (id: <id>)
|
|
41
|
+
- "<name>" (id: <id>)
|
|
42
|
+
|
|
43
|
+
Agents:
|
|
44
|
+
- "<name>" (id: <id>)
|
|
45
|
+
|
|
46
|
+
Skills:
|
|
47
|
+
- "<name>" (id: <id>)
|
|
48
|
+
--- END SESSION CONTEXT ---
|
|
49
|
+
|
|
50
|
+
Workflow loaded. What would you like to do?
|
|
26
51
|
```
|
|
27
52
|
|
|
28
|
-
If
|
|
53
|
+
If a workflow name was specified directly in the user's message, skip step 1 and load immediately.
|
|
29
54
|
If no workspace is specified, use the default from .contextiumrc or ask the user.
|
|
30
55
|
</process>
|
|
56
|
+
|
|
57
|
+
<session-rules>
|
|
58
|
+
Once the session context block has been output, these rules apply for the rest of the conversation:
|
|
59
|
+
|
|
60
|
+
- Do NOT call list_workflows, list_context_libraries, list_agents, list_skills, list_files, or any other listing tool again unless the user explicitly asks to see a list
|
|
61
|
+
- Use the IDs from the session context block directly when creating files, searching, or referencing resources
|
|
62
|
+
- Do NOT re-verify or re-check which libraries, agents, or skills exist — they are already known
|
|
63
|
+
- All tool calls and checks must be silent — never show the user raw API responses, tool call names, or intermediate results
|
|
64
|
+
- Only surface the final answer or the created/updated content to the user
|
|
65
|
+
</session-rules>
|