@c4a/context-cli 0.5.41-beta.5 → 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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c4a/context-cli",
3
- "version": "0.5.41-beta.5",
3
+ "version": "0.5.41-beta.7",
4
4
  "type": "module",
5
5
  "bin": {
6
6
  "context": "./cli.js"
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-pack`;
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
 
@@ -96,8 +96,9 @@ bun add -g @c4a/context-cli
96
96
 
97
97
  完整知识库支持对外打包发布:
98
98
 
99
- - 导出为 **Skills** 包:`context build --format skills-pack`;
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
 
@@ -27,7 +27,7 @@ For protocol discovery, prefer narrow commands:
27
27
 
28
28
  - `context schema workflow.next-action-envelope.v2 --view minimal --format json`
29
29
  - `context protocol show align-compile --format json`
30
- - `context schema align-structure-intent --view minimal --format json` — includes required fields, enums, mount matrix, and a minimal authoring example; use full schema only for extended notes.
30
+ - `context schema align-structure-intent --view minimal --format json` — includes required fields, enums, section kind priority/triggers, mount matrix, and a minimal authoring example; use full schema only for extended notes.
31
31
 
32
32
  ### Step 2 — Read Evidence Through The Single Evidence Path
33
33
 
@@ -32,7 +32,7 @@ Before choosing a local Markdown capture route, honor the surrounding task conte
32
32
  - `$ARGUMENTS` contains `--refresh` → `context capture --refresh`. This refreshes active Feishu URL sources and local Markdown sources whose stored origin file still exists; code sources use `context capture --code`.
33
33
  - User asks for code capture with explicit `--module` flags → run `context capture --code $ARGUMENTS`, preserving code flags such as `--module`, `--version`, `--version-from`, and `--no-runner-cache`.
34
34
  - User asks to refresh/re-capture an already configured code source → run `context capture --code` unless the user explicitly wants to change package selection or version flags. The CLI reuses stored `capture_config`, appends a new snapshot only when code/version content changes, and never overwrites prior snapshots.
35
- - User asks to run a configured custom aspect capture → run `context capture --aspect <name...> --format json`. Do not use `context capture --aspect code`; code capture remains `context capture --code` because it owns target path, `--module`, version, and runner-cache flags.
35
+ - User asks to run a configured custom aspect capture → run `context capture --aspect <name...> --format json`. Prefer configured aspect names. If an automation script already supplies a path, it must point to an installed aspect directory in the current workspace and the CLI will treat it as that aspect name. Do not use `context capture --aspect code`; code capture remains `context capture --code` because it owns target path, `--module`, version, and runner-cache flags.
36
36
  - User provides one or more code target paths, or asks for code capture without explicit `--module` flags → run `context capture --code $ARGUMENTS --format json` directly. The CLI preflights every target first; if any target is ambiguous it returns candidates without writing, otherwise it captures all selected code targets serially.
37
37
  - If the CLI returns candidate packages, ask the user which package paths to capture.
38
38
  - Then run `context capture --code <original-target-if-present>` with one repeated `--module <path>` for every selected package. The CLI derives and stores path filtering silently from that selection.
@@ -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` only for explicit delegated mode).
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 `drop`, `retract`, `delete source`, or passes a known source-id pattern (`feishu:*` / `local:*` / `aspect:*` / `oncall:*` / `meeting:*`)** → `/context:drop $ARGUMENTS`.
28
- 11. **Matches `purge`, `clear archive`, `delete archive`, or `清理归档`** → `/context:purge $ARGUMENTS`.
29
- 12. **Equals `status`, `health`, `overview`, `summary`, or asks for workspace/cache/plugin health** → `/context:status`.
30
- 13. **Anything else** (likely a knowledge question) → `/context:query $ARGUMENTS`.
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.
@@ -82,7 +82,7 @@ Use only `block_ids[]` in `section_groups[]`. Do not invent heading/range/window
82
82
 
83
83
  Emit `depends_on` edges only when cited source blocks explicitly say one Node consumes, requires, calls, is configured by, or is downstream of another Node as a prerequisite, capability provider, upstream input, runtime dependency, or data-flow source. Direction is consumer/downstream -> provider/upstream. Do not create `depends_on` for parent/child containment, `Related`/`See also` lists, sibling co-occurrence, shared table membership, name similarity, or a plain mention without a dependency predicate. `edges[].evidence_blocks[]` must include the block that states the dependency; if the relationship matters but evidence is missing, leave the edge out or add an unresolved question instead of guessing.
84
84
 
85
- Prefer the strongest source-backed `section_kind` that fits the current schema priority chain; avoid planning an entire dense source as `description` when the evidence clearly contains examples, comparison tables, Q&A, decisions, specs, warnings, or principles. Treat kind precision as a drafting quality preference, not a reason to block an otherwise source-backed write. Keep only raw-backed semantic decisions in the payload; leave mechanical repair and patch routing to CLI diagnostics.
85
+ Prefer the strongest source-backed `section_kind` using the current schema's `section_kind_priority` and `section_kind_triggers`; avoid planning an entire dense source as `description` when the evidence clearly contains examples, comparison tables, Q&A, decisions, specs, warnings, or principles. Ordinary typical scenarios, case studies, and impact/result examples are `example`, not `incident`, unless the source is explicitly an outage, incident review, postmortem, or dated fault-handling timeline. Treat kind precision as a drafting quality preference, not a reason to block an otherwise source-backed write. Keep only raw-backed semantic decisions in the payload; leave mechanical repair and patch routing to CLI diagnostics.
86
86
 
87
87
  Canonical `align-structure-decision` is not a parallel authoring path. Use it only when `next_action.input_schema` explicitly asks for it or when auditing/repairing canonical output returned by the CLI.
88
88
 
@@ -48,6 +48,8 @@ Relation-only sources should not force title copying or dangling graph edges. De
48
48
 
49
49
  Do not put `planned_sections` inside `domain_gate`. A kept placeholder needs support: `context_only` block(s) with `visible_to`, owned/shared evidence, or finalized graph support. `ignored` blocks only dispose unused material and do not support close materialization by themselves. For Domain placeholders, write only resolved current/existing children in `domain_gate.child_refs`; if all children are unresolved/deferred relation clues, use `child_refs: []` and keep those target hints in pending relation refs. If the source names only an atomic concept and that term is useful on its own, prefer a concise term Entity title without scope/process suffixes.
50
50
 
51
+ For no-write placeholder summaries, describe only the preserved page identity and unresolved navigation clues. Do not say the Node "provides navigation/links/relations to X" unless those targets are resolved graph children or rendered links; say the source contains deferred navigation clues instead.
52
+
51
53
  ## Entity Tag Rules
52
54
 
53
55
  Use `tags` to state what the Entity is. Legal combinations:
@@ -98,7 +98,7 @@ Confidence is optional. Omit it for ordinary confirmed claims; set it only when
98
98
  `description` is the kind for narrative claims that do not match any other form. Before locking in `kind: description` for a snippet, run three classification checks against the cited block:
99
99
 
100
100
  1. **Atomicity**: single narrative, or multi-step / multi-row / multi-config? Multi → split into the right kinds — each step into its own `spec` / `warning`, each row into a `comparison` Section, each config block into `example` (sample) or `spec` (constraint with a check method).
101
- 2. **Kind-precision**: does a higher-priority kind fit better? A code / config / command block belongs in `example`; a comparison table belongs in `comparison`; a Q+A pair belongs in `faq`; a real incident with timeline belongs in `incident`; a versioned change record belongs in `changelog`; an explicit source-backed choice / tradeoff / adopted path with rationale belongs in `decision` even when only one chosen option is surfaced; a verifiable rule with a check method belongs in `spec`; explicit risks belong in `warning`; a stable design rule or core mechanism without a recorded choice or check method belongs in `principle`.
101
+ 2. **Kind-precision**: does a higher-priority kind fit better? A code / config / command block belongs in `example`; a comparison table belongs in `comparison`; a Q+A pair belongs in `faq`; a real incident with timeline belongs in `incident`; ordinary "typical scenario" / case-study / impact-result examples are `example`, not `incident`, unless the source is explicitly an outage, incident review, postmortem, or dated fault-handling timeline; a versioned change record belongs in `changelog`; an explicit source-backed choice / tradeoff / adopted path with rationale belongs in `decision` even when only one chosen option is surfaced; a verifiable rule with a check method belongs in `spec`; explicit risks belong in `warning`; a stable design rule or core mechanism without a recorded choice or check method belongs in `principle`.
102
102
  3. **Action threshold**: multi-step fragments that clear the Action bar → emit `op: skip` with a note "evidence warrants sub-Action; re-align needed"; do not create Nodes from this skill.
103
103
 
104
104
  A Node whose raw is genuinely narrative — definitions, summaries, plain prose without enumerations or normative wording — legitimately ends with description-dominant output. The smell fires the other way: when raw contained enumerations, normative rules, or code blocks, and the draft collapsed them to `description`. Redraft from Step 2 in that case, not from a percentage threshold. Navigation-only evidence is handled separately by the TL;DR navigation rule and Step 2 — the gates above are not the right place to second-guess that path.
@@ -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.**
@@ -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.",