@c4a/context-cli 0.5.41-beta.6 → 0.5.41-beta.7
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/cli.js +39735 -39209
- package/package.json +1 -1
- package/plugin/README.md +2 -1
- package/plugin/README_CN.md +2 -1
- package/plugin/commands/compile.md +11 -2
- package/plugin/commands/context.md +5 -4
- package/plugin/commands/ops.md +47 -0
- package/plugin/skills/skill-context-query/SKILL.md +3 -0
- package/scripts/build-plugin.ts +1 -4
package/package.json
CHANGED
package/plugin/README.md
CHANGED
|
@@ -98,8 +98,9 @@ Work includes but is not limited to: workspace init, multi-source capture, align
|
|
|
98
98
|
|
|
99
99
|
The compiled knowledge base can be packaged for distribution:
|
|
100
100
|
|
|
101
|
-
- export as a **Skills** package — `context build --format skills
|
|
101
|
+
- export as a **Skills** package — `context build --format skills`;
|
|
102
102
|
- export as **LLMs.txt** — `context build --format llms`;
|
|
103
|
+
- agent ops build — `/context:ops build` exports Skills by default; use `--format llms` for LLMs.txt;
|
|
103
104
|
- [TODO] publish to the **C4A platform** as an MCP service for other AIs to query live;
|
|
104
105
|
- [TODO] publish as a standalone Plugin knowledge package, with retrieval quality on par with the MCP service and CLI.
|
|
105
106
|
|
package/plugin/README_CN.md
CHANGED
|
@@ -96,8 +96,9 @@ bun add -g @c4a/context-cli
|
|
|
96
96
|
|
|
97
97
|
完整知识库支持对外打包发布:
|
|
98
98
|
|
|
99
|
-
- 导出为 **Skills** 包:`context build --format skills
|
|
99
|
+
- 导出为 **Skills** 包:`context build --format skills`;
|
|
100
100
|
- 导出为 **LLMs.txt**:`context build --format llms`;
|
|
101
|
+
- Agent 运维构建:`/context:ops build` 默认导出 Skills,可用 `--format llms` 导出 LLMs.txt;
|
|
101
102
|
- [TODO] 发布至 **C4A 平台**,作为 MCP 服务供其他 AI 实时查询;
|
|
102
103
|
- [TODO] 发布为独立 Plugin 知识包,具备与 MCP 及 CLI 同等精度的检索能力。
|
|
103
104
|
|
|
@@ -21,7 +21,7 @@ Naming convention:
|
|
|
21
21
|
- **`--aspect code [selector]`** — run `context compile --aspect code [selector]`, report the CLI result, and stop unless the CLI asks for a follow-up close. The selector may be omitted to process all actionable code sources; when present, the CLI resolves source slug, package name, or module path.
|
|
22
22
|
- **`--aspect <name>`** — run deterministic custom aspect projection for one configured aspect. Use `context compile --aspect <name> --allow-large-deprecate` only when the CLI rejected a large deprecate and the user confirms the runner output is intentionally empty or reduced.
|
|
23
23
|
- **`--all`** — run `context compile --all` to materialize code projection first and then custom aspect projections in deterministic order.
|
|
24
|
-
- **Delegated** — add `--delegated` only when the user explicitly authorized delegated mode at the start of this conversation. Delegated mode records scoped authority for low-risk reconcile/review/apply defaults; it does not auto-draft Node content or replace agent evidence reading. Do not infer it from vague "continue" permission.
|
|
24
|
+
- **Delegated** — add `--delegated` only when the user explicitly authorized delegated mode at the start of this conversation. Treat requests such as "全托管执行", "全自动托管", "fully managed", "delegated execution", or "use delegated mode" as explicit delegated authorization. Delegated mode records scoped authority for low-risk reconcile/review/apply defaults; it does not auto-draft Node content or replace agent evidence reading. Do not infer it from vague "continue", "继续", or "后面不用问我" permission.
|
|
25
25
|
|
|
26
26
|
### Core Rules
|
|
27
27
|
|
|
@@ -40,7 +40,7 @@ Protocol discovery:
|
|
|
40
40
|
|
|
41
41
|
## Start
|
|
42
42
|
|
|
43
|
-
1. Run `context compile scan --format json` (or `context compile scan --delegated --format json`
|
|
43
|
+
1. Run `context compile scan --format json` (or `context compile scan --delegated --format json` when the user explicitly authorized delegated mode, including "全托管执行" / "fully managed").
|
|
44
44
|
2. If the scan returns `close_compile`, run the returned close command even when there are no changed Nodes; finalized no-write/container Nodes may still need close materialization.
|
|
45
45
|
3. If the scan returns `stop_noop` or no changed work, report that compile stopped before draft and no files were written.
|
|
46
46
|
4. Run `context status --view summary --format json` or `context mdrive workspace stats --format json` only when needed for the final before/after report or when the CLI asks for diagnostics. Do not run doctor/status/source-list as a required preflight before following a valid compile scan or align-finalize handoff.
|
|
@@ -72,6 +72,8 @@ For `submit_compile_cycle`, load the Node evidence via the returned command/view
|
|
|
72
72
|
|
|
73
73
|
Prefer heredocs for small payloads. If large or parallel draft payloads need staging, use the workspace AGENTS.md scratch path (`.context/.tmp/agent-payloads/<run-id>/...` in embedded workspaces, `.tmp/agent-payloads/<run-id>/...` in root-layout workspaces) and redirect stdin from that file. Never reuse fixed names like `/tmp/c4a-draft-<node>.json`, and never use scratch paths as workflow handoff or CLI-managed storage.
|
|
74
74
|
|
|
75
|
+
Use `op: deprecate` only when an existing active Section is no longer supported by its source, is factually wrong, has been superseded, or the user explicitly asked to retire it. Do not deprecate an existing true Section merely because it is low-relevance to the current narrow task; leave it unchanged and use `op: skip` / omit only for the current proposed evidence.
|
|
76
|
+
|
|
75
77
|
For `continue_compile_cycle`, do not invoke the draft skill and do not attach `--input`; execute the returned `next_action.command` exactly. `--continue` resumes a saved draft session. If it returns `status: "noop"`, follow the returned `close_compile` next action.
|
|
76
78
|
|
|
77
79
|
For `patch_compile_draft`, submit only the patch schema requested by the CLI. Use `actions_meta[].action_id` for `replace_action` / `remove_action`, or `add_action` with `before` / `after`; do not use generic `op/path/value` aliases.
|
|
@@ -100,4 +102,11 @@ Do not recover by replaying an old manual path, editing rendered files, or guess
|
|
|
100
102
|
|
|
101
103
|
When `next_action.kind` is `close_compile`, execute `context compile close` through packaged `context:skill-compile-close` or the returned command. Never claim success unless close exits 0 and verify is green, except the explicit no-work path.
|
|
102
104
|
|
|
105
|
+
Treat close as a terminal gate, not a blind final step:
|
|
106
|
+
|
|
107
|
+
- If close reports `code_projection_followup` / `compile-close-code-projection-followup`, run the returned `context compile --aspect code ...` command, then run `context compile close` again before reporting final success.
|
|
108
|
+
- If close reports `ready_with_debt`, do not enter export/query/report-as-complete unless the user explicitly accepts the remaining debt. Otherwise repair or skip coverage debt through the returned coverage commands, then run close again.
|
|
109
|
+
- Coverage disposition commands mutate workflow state. Run one `context compile coverage ...` command at a time, or use the returned `--skip-unresolved` bulk command for one Node; never submit multiple coverage disposition writes concurrently.
|
|
110
|
+
- Use `context query --intent recall` only as a smoke-test query. Do not use recall as a deterministic full-workspace export path.
|
|
111
|
+
|
|
103
112
|
Report in the user's conversation language. Include semantic apply counts, close/verify status, warning-level `auto_repaired[]`, `ready_with_debt` coverage summaries when present, and before/after workspace totals. Do not surface internal workflow payload digests, source-ref hashes, archive paths, or absolute file paths unless a user-facing report view explicitly returns them.
|
|
@@ -24,10 +24,11 @@ Routing rules (first match wins):
|
|
|
24
24
|
7. **Mentions `aspect` without a concrete supported capture flag** → ask one clarification; code aspect capture is exposed as `/context:capture --code`.
|
|
25
25
|
8. **Matches `align`, `structure`, `plan`, `node tree`** → `/context:align $ARGUMENTS`.
|
|
26
26
|
9. **Matches `compile`, `recompile`, `synthesize`, or `build knowledge`** → `/context:compile $ARGUMENTS`.
|
|
27
|
-
10. **Matches `
|
|
28
|
-
11. **Matches `
|
|
29
|
-
12. **
|
|
30
|
-
13. **
|
|
27
|
+
10. **Matches `build`, `export`, `package`, `publish`, `deploy`, `release`, `ops`, `operations`, or `运维` as an operational/package task** → `/context:ops $ARGUMENTS`.
|
|
28
|
+
11. **Matches `drop`, `retract`, `delete source`, or passes a known source-id pattern (`feishu:*` / `local:*` / `aspect:*` / `oncall:*` / `meeting:*`)** → `/context:drop $ARGUMENTS`.
|
|
29
|
+
12. **Matches `purge`, `clear archive`, `delete archive`, or `清理归档`** → `/context:purge $ARGUMENTS`.
|
|
30
|
+
13. **Equals `status`, `health`, `overview`, `summary`, or asks for workspace/cache/plugin health** → `/context:status`.
|
|
31
|
+
14. **Anything else** (likely a knowledge question) → `/context:query $ARGUMENTS`.
|
|
31
32
|
|
|
32
33
|
If multiple rules apply, pick the most specific (URL beats word match). When in doubt, ask one clarifying question before dispatching.
|
|
33
34
|
Never use Read / Glob / Grep / Write against `WORKSPACE_DIR`; route to packaged `/context:*` commands and skills instead of opening plugin or workspace files manually.
|
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
---
|
|
2
|
+
description: "Run operational package tasks such as local build/export, with future publish commands kept under the same entry."
|
|
3
|
+
argument-hint: "build [--format llms|skills]"
|
|
4
|
+
allowed-tools: Bash(context:*)
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
## Your Task
|
|
8
|
+
|
|
9
|
+
Run operational tasks for the current context workspace. This command owns packaging/export work and is the future home for platform publish. It does not capture, align, compile, query, drop, or purge knowledge.
|
|
10
|
+
|
|
11
|
+
Supported subcommands:
|
|
12
|
+
|
|
13
|
+
- `build`: build a local knowledge package by running `context build`.
|
|
14
|
+
|
|
15
|
+
Unsupported but reserved subcommands:
|
|
16
|
+
|
|
17
|
+
- `publish`: reserved for future platform publish. Do not invent a CLI command for it.
|
|
18
|
+
- `package`: reserved for future offline package-only publish flow. Do not invent a CLI command for it.
|
|
19
|
+
|
|
20
|
+
### Build
|
|
21
|
+
|
|
22
|
+
If `$ARGUMENTS` is empty, treat it as `build --format skills`.
|
|
23
|
+
|
|
24
|
+
If `$ARGUMENTS` starts with `build`, run `context build` with the requested format:
|
|
25
|
+
|
|
26
|
+
- `build --format skills` -> `context build --format skills`
|
|
27
|
+
- `build --format llms` -> `context build --format llms`
|
|
28
|
+
- `build skills` -> `context build --format skills`
|
|
29
|
+
- `build llms` -> `context build --format llms`
|
|
30
|
+
- `build` -> `context build --format skills`
|
|
31
|
+
|
|
32
|
+
If the user asks for both formats, run the two CLI commands separately:
|
|
33
|
+
|
|
34
|
+
1. `context build --format skills`
|
|
35
|
+
2. `context build --format llms`
|
|
36
|
+
|
|
37
|
+
Do not pass unsupported flags to `context build`. If the user supplies an unknown build format, explain that the supported formats are `skills` and `llms`, then stop.
|
|
38
|
+
|
|
39
|
+
Before running build, do not inspect workspace files with generic tools. The CLI performs workspace verification and prints blocking issues if the workspace is not ready.
|
|
40
|
+
|
|
41
|
+
After build succeeds, surface the CLI output verbatim, especially the package path under `output/skills-pkg/` or `output/llms-pkg/`. If build fails because verification failed, relay the error and let the CLI's issue list drive remediation; do not inspect `raw/`, `knowledge/`, or `output/` yourself.
|
|
42
|
+
|
|
43
|
+
### Reserved Publish
|
|
44
|
+
|
|
45
|
+
If `$ARGUMENTS` starts with `publish`, `package`, `deploy`, or `release`, do not run any command. Explain briefly that platform publish/package-only is reserved under `/context:ops` but not implemented yet. For now, the available operational command is `/context:ops build`.
|
|
46
|
+
|
|
47
|
+
Language policy: CLI stdout/stderr stays verbatim. Any explanation you add follows the user's conversation language; command names, flags, paths, package formats, and issue codes stay as printed.
|
|
@@ -50,11 +50,14 @@ Supplemental context can come from:
|
|
|
50
50
|
|
|
51
51
|
```text
|
|
52
52
|
context query --intent node_view --scope <slug>
|
|
53
|
+
context query --intent node_view --scope <slug> --view source-refs
|
|
53
54
|
context query --intent impact_analysis --scope <slug>
|
|
54
55
|
context query --intent node_view --refers-to <slug>
|
|
55
56
|
context query --intent section_search --scope <slug> --query "<keywords>"
|
|
56
57
|
```
|
|
57
58
|
|
|
59
|
+
Use the `--view source-refs` / `--view source-refs-index` node_view forms when a hit's `raw_expand_command` is needed for factual confirmation. These are query-owned read views; do not substitute `context compile context ...` during answer-only query work.
|
|
60
|
+
|
|
58
61
|
## Query Route Decision Table
|
|
59
62
|
|
|
60
63
|
Choose the `context query` command based on problem intent. **Structure queries take priority.**
|
package/scripts/build-plugin.ts
CHANGED
|
@@ -326,10 +326,6 @@ function claudeCommandForSlug(slug: string): string {
|
|
|
326
326
|
return slug === "context" ? "/context:context" : `/context:${slug}`;
|
|
327
327
|
}
|
|
328
328
|
|
|
329
|
-
function cursorCommandForSlug(slug: string): string {
|
|
330
|
-
return slug === "context" ? "/context" : `/context-${slug}`;
|
|
331
|
-
}
|
|
332
|
-
|
|
333
329
|
const CURSOR_COMMAND_SUMMARIES: Record<string, string> = {
|
|
334
330
|
align: "Review raw material and confirm the Node tree before compiling knowledge.",
|
|
335
331
|
capture: "Capture documents, source code, notes, inbox files, or refreshed sources into the workspace.",
|
|
@@ -338,6 +334,7 @@ const CURSOR_COMMAND_SUMMARIES: Record<string, string> = {
|
|
|
338
334
|
drop: "Plan and apply source retraction with semantic decisions and archive safety.",
|
|
339
335
|
extract: "Preview extraction output for a file without writing workspace state.",
|
|
340
336
|
init: "Choose workspace layout, language, and focus, then create the C4A workspace.",
|
|
337
|
+
ops: "Run operational package tasks such as local build/export, with future publish kept under one entry.",
|
|
341
338
|
purge: "Permanently delete archived dropped-source artifacts after explicit confirmation.",
|
|
342
339
|
query: "Answer from the local knowledge workspace with citations and gap handling.",
|
|
343
340
|
status: "Show workspace state, pending work, cache health, and the next useful command.",
|