@c4a/context-cli 0.7.106 → 0.7.108
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 +2437 -1408
- package/indexers/contracts/profile-contract.json +245 -245
- package/indexers/release-manifest.json +1 -1
- package/package.json +12 -12
- package/plugins/VERSION +1 -1
- package/plugins/claude/.claude-plugin/plugin.json +1 -1
- package/plugins/claude/commands/context.md +11 -1
- package/plugins/claude/resources/context/routine-update.md +22 -6
- package/plugins/codex/.codex-plugin/plugin.json +2 -2
- package/plugins/codex/skills/context/SKILL.md +11 -1
- package/plugins/codex/skills/context/references/routine-update.md +22 -6
- package/plugins/cursor/.cursor-plugin/plugin.json +1 -1
- package/plugins/cursor/commands/c4a-context.md +11 -1
- package/plugins/cursor/resources/context/routine-update.md +22 -6
- package/plugins/skills/context/SKILL.md +11 -1
- package/plugins/skills/context/references/routine-update.md +22 -6
- package/providers/context/manifest.json +8 -8
- package/providers/context/provider.yaml +1 -1
- package/providers/context/resources/manuals/guides/knowledge-updates.md +89 -0
- package/providers/context/resources/procedures/knowledge-updates.md +89 -0
- package/providers/context/resources/procedures/source-update.md +6 -0
|
@@ -503,6 +503,16 @@ first and update them in batches, so each review covers related pages:
|
|
|
503
503
|
its versioned file sources (see "Versioned external content and archived
|
|
504
504
|
collections"), then start one `context update --input` listing all of the batch's `repo:`, `lark:` and `file:` scopes, each
|
|
505
505
|
with its `requirement_ref`. Do not move later batches' registrations early.
|
|
506
|
+
When another batch follows, add `more_batches: true` to the input: the
|
|
507
|
+
batch is reviewed, closed and built as usual, but the Route does not ask for
|
|
508
|
+
a workspace version, so the next batch can start right after the build.
|
|
509
|
+
Leave it out of the last batch; its Route records the one version (and
|
|
510
|
+
changelog entry) of the whole refresh. When earlier batches were already
|
|
511
|
+
committed and the workspace has no `v<version>` tag (for example a
|
|
512
|
+
workspace inside a larger repository), the default comparison base is
|
|
513
|
+
`HEAD` and would list only the last batch: run `context version inspect
|
|
514
|
+
--base <commit before the first batch> --format json` and record with the
|
|
515
|
+
same `base_ref`, or commit all batches after the version record.
|
|
506
516
|
5. **`--pending` only for one repository-only batch.** `context update
|
|
507
517
|
--pending` covers repositories only and is a write: once it runs, the batch
|
|
508
518
|
cannot be split with `--input` without rolling back. Use it only when the
|
|
@@ -515,6 +525,85 @@ source-update decision, then leave `new_topics` empty, say in `scope_summary`
|
|
|
515
525
|
which uncited additions were left out, and put the rule into each revised
|
|
516
526
|
page's `instruction` so the writing step follows it.
|
|
517
527
|
|
|
528
|
+
## Update without cloning: read repositories through Sourcegraph
|
|
529
|
+
|
|
530
|
+
When a registered repository is also registered on a Sourcegraph site, Context
|
|
531
|
+
can read it over HTTP instead of from a checkout. Updates (`context update
|
|
532
|
+
--input` and `--pending`), revisions, submission checks, `verify` and `status`
|
|
533
|
+
then need no clone. The result is byte for byte the same: Context reads the raw
|
|
534
|
+
blob at the registered commit, checks it against its Git object id, and compares
|
|
535
|
+
commits with a names-only diff, so citations, `changed_references`, evidence
|
|
536
|
+
and `uncited_changes` match a local checkout. Writing new pages and parsing code
|
|
537
|
+
still need a local checkout, and so do `context source restore` and `ensure`.
|
|
538
|
+
|
|
539
|
+
Choose the mode with `CONTEXT_SOURCE_MODE` or `--source-mode` (the option wins):
|
|
540
|
+
|
|
541
|
+
| Mode | Behavior |
|
|
542
|
+
| --- | --- |
|
|
543
|
+
| `local` (default) | Checkouts only, exactly as before; Context sends no Sourcegraph request even when a site or token is configured. |
|
|
544
|
+
| `remote` | Every repository source is read from Sourcegraph. A repository it cannot serve is skipped: the update leaves that scope out (its processed version does not move), lists it in `skipped_sources` with the reason, and continues with the other scopes. |
|
|
545
|
+
| `auto` | Sourcegraph first, per repository; one the site cannot serve uses its local checkout, restored as usual when missing. Without a token, auto mode asks for authorization like remote mode instead of falling back. |
|
|
546
|
+
|
|
547
|
+
Sourcegraph can serve a repository when the site declares the remote-read
|
|
548
|
+
operations, the registered `git.remote` names the same code host and repository
|
|
549
|
+
as the Sourcegraph registration, one registered path group contains the whole
|
|
550
|
+
`subpath`, and the registered commit is readable. Commands that read remotely
|
|
551
|
+
say so: `context update` and `verify --format json` return `source_access`
|
|
552
|
+
(each repository's `access`, site, repository and commit, or the reason it was
|
|
553
|
+
skipped or read locally), and in `status` each such source has `access: remote`
|
|
554
|
+
instead of checkout advice. `ready` keeps describing the local checkout.
|
|
555
|
+
A repository outside the update's scope that remote mode cannot read is listed
|
|
556
|
+
in `skipped_sources` only; it is not offered in `expand_scope`. `context source
|
|
557
|
+
add repo --ref <sha>` checks the commit before registering it: in local mode
|
|
558
|
+
the checkout (or its origin, fetched once) must have it; in a remote mode
|
|
559
|
+
Sourcegraph must be able to read it, or a remote branch or tag must point at it
|
|
560
|
+
(then it is registered with an `info` that `context update --pending` can
|
|
561
|
+
prepare it). Otherwise the registration is refused; for an older commit no
|
|
562
|
+
branch or tag points at, rerun with `--allow-unverified-ref`.
|
|
563
|
+
|
|
564
|
+
**Authorization.** The Sourcegraph MCP server the Agent already uses is the only
|
|
565
|
+
configuration needed. When a command needs a token and has none, it returns a
|
|
566
|
+
`next_action` with `mcp_tool: authorize_cli`, once, at top level
|
|
567
|
+
(`source_authorization`); sources waiting for it are listed with
|
|
568
|
+
`reason_code: sourcegraph-authorization-required` and need no clone. Call that MCP tool once with
|
|
569
|
+
`client: "context"`, then run
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
context source sourcegraph-auth --code <code> --host <host> --format json
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
with the returned one-time `code` and `host` (the site's API root). The CLI
|
|
576
|
+
exchanges the code for a temporary read-only token, keeps it in
|
|
577
|
+
`.tmp/context-runtime/sourcegraph/token.json` (mode 600, never committed) and
|
|
578
|
+
reuses it for later commands in this workspace. Authorize again only when a
|
|
579
|
+
command asks for it again: after the token expired unused, was revoked, or
|
|
580
|
+
reached its maximum lifetime. Never print, copy or log the token. If
|
|
581
|
+
`authorize_cli` answers `TEMPORARY_TOKEN_LIMIT`, do not retry; run `context
|
|
582
|
+
source sourcegraph-auth --refused TEMPORARY_TOKEN_LIMIT --format json`, after
|
|
583
|
+
which remote mode skips repository sources and auto mode reads checkouts until
|
|
584
|
+
earlier temporary tokens expire or are revoked in the Sourcegraph user
|
|
585
|
+
settings. On a development machine or in CI, `SOURCEGRAPH_URL` and
|
|
586
|
+
`SOURCEGRAPH_API_TOKEN` take precedence and need no authorization; Sourcegraph
|
|
587
|
+
CLI login configuration is not read.
|
|
588
|
+
|
|
589
|
+
**Versions.** Only the registered commit decides whether a repository can be
|
|
590
|
+
read. When it is not readable yet, `status`, `verify`, revisions and an explicit
|
|
591
|
+
`update --input` report it and change nothing; `context update --pending` asks
|
|
592
|
+
Sourcegraph to prepare its content (when the site allows), waits a bounded time
|
|
593
|
+
and otherwise reports the job and the next step. Rate limits and full quotas
|
|
594
|
+
are reported, never retried in a loop. When only the processed commit is no
|
|
595
|
+
longer readable, the update still runs: history evidence is `unavailable` and
|
|
596
|
+
`uncited_changes` reports the comparison as unknown, as with a shallow checkout.
|
|
597
|
+
A site that cannot list directories still groups uncited changes but marks no
|
|
598
|
+
`new_directory`, and says so in the entry's `note`.
|
|
599
|
+
|
|
600
|
+
**Reading for writing.** For a source the CLI reads from Sourcegraph, size the
|
|
601
|
+
change with the Sourcegraph diff of the processed and registered commits, and
|
|
602
|
+
read or search code through the Sourcegraph MCP tools pinned to the registered
|
|
603
|
+
full commit; do not clone it for the update. A source read locally, a new page
|
|
604
|
+
and code parsing follow the checkout steps above. A read failure in remote mode
|
|
605
|
+
is never a citation change: `verify` reports those citations as not checked.
|
|
606
|
+
|
|
518
607
|
## Versioned external content and archived collections
|
|
519
608
|
|
|
520
609
|
Published content that another team versions, such as a documentation
|
|
@@ -503,6 +503,16 @@ first and update them in batches, so each review covers related pages:
|
|
|
503
503
|
its versioned file sources (see "Versioned external content and archived
|
|
504
504
|
collections"), then start one `context update --input` listing all of the batch's `repo:`, `lark:` and `file:` scopes, each
|
|
505
505
|
with its `requirement_ref`. Do not move later batches' registrations early.
|
|
506
|
+
When another batch follows, add `more_batches: true` to the input: the
|
|
507
|
+
batch is reviewed, closed and built as usual, but the Route does not ask for
|
|
508
|
+
a workspace version, so the next batch can start right after the build.
|
|
509
|
+
Leave it out of the last batch; its Route records the one version (and
|
|
510
|
+
changelog entry) of the whole refresh. When earlier batches were already
|
|
511
|
+
committed and the workspace has no `v<version>` tag (for example a
|
|
512
|
+
workspace inside a larger repository), the default comparison base is
|
|
513
|
+
`HEAD` and would list only the last batch: run `context version inspect
|
|
514
|
+
--base <commit before the first batch> --format json` and record with the
|
|
515
|
+
same `base_ref`, or commit all batches after the version record.
|
|
506
516
|
5. **`--pending` only for one repository-only batch.** `context update
|
|
507
517
|
--pending` covers repositories only and is a write: once it runs, the batch
|
|
508
518
|
cannot be split with `--input` without rolling back. Use it only when the
|
|
@@ -515,6 +525,85 @@ source-update decision, then leave `new_topics` empty, say in `scope_summary`
|
|
|
515
525
|
which uncited additions were left out, and put the rule into each revised
|
|
516
526
|
page's `instruction` so the writing step follows it.
|
|
517
527
|
|
|
528
|
+
## Update without cloning: read repositories through Sourcegraph
|
|
529
|
+
|
|
530
|
+
When a registered repository is also registered on a Sourcegraph site, Context
|
|
531
|
+
can read it over HTTP instead of from a checkout. Updates (`context update
|
|
532
|
+
--input` and `--pending`), revisions, submission checks, `verify` and `status`
|
|
533
|
+
then need no clone. The result is byte for byte the same: Context reads the raw
|
|
534
|
+
blob at the registered commit, checks it against its Git object id, and compares
|
|
535
|
+
commits with a names-only diff, so citations, `changed_references`, evidence
|
|
536
|
+
and `uncited_changes` match a local checkout. Writing new pages and parsing code
|
|
537
|
+
still need a local checkout, and so do `context source restore` and `ensure`.
|
|
538
|
+
|
|
539
|
+
Choose the mode with `CONTEXT_SOURCE_MODE` or `--source-mode` (the option wins):
|
|
540
|
+
|
|
541
|
+
| Mode | Behavior |
|
|
542
|
+
| --- | --- |
|
|
543
|
+
| `local` (default) | Checkouts only, exactly as before; Context sends no Sourcegraph request even when a site or token is configured. |
|
|
544
|
+
| `remote` | Every repository source is read from Sourcegraph. A repository it cannot serve is skipped: the update leaves that scope out (its processed version does not move), lists it in `skipped_sources` with the reason, and continues with the other scopes. |
|
|
545
|
+
| `auto` | Sourcegraph first, per repository; one the site cannot serve uses its local checkout, restored as usual when missing. Without a token, auto mode asks for authorization like remote mode instead of falling back. |
|
|
546
|
+
|
|
547
|
+
Sourcegraph can serve a repository when the site declares the remote-read
|
|
548
|
+
operations, the registered `git.remote` names the same code host and repository
|
|
549
|
+
as the Sourcegraph registration, one registered path group contains the whole
|
|
550
|
+
`subpath`, and the registered commit is readable. Commands that read remotely
|
|
551
|
+
say so: `context update` and `verify --format json` return `source_access`
|
|
552
|
+
(each repository's `access`, site, repository and commit, or the reason it was
|
|
553
|
+
skipped or read locally), and in `status` each such source has `access: remote`
|
|
554
|
+
instead of checkout advice. `ready` keeps describing the local checkout.
|
|
555
|
+
A repository outside the update's scope that remote mode cannot read is listed
|
|
556
|
+
in `skipped_sources` only; it is not offered in `expand_scope`. `context source
|
|
557
|
+
add repo --ref <sha>` checks the commit before registering it: in local mode
|
|
558
|
+
the checkout (or its origin, fetched once) must have it; in a remote mode
|
|
559
|
+
Sourcegraph must be able to read it, or a remote branch or tag must point at it
|
|
560
|
+
(then it is registered with an `info` that `context update --pending` can
|
|
561
|
+
prepare it). Otherwise the registration is refused; for an older commit no
|
|
562
|
+
branch or tag points at, rerun with `--allow-unverified-ref`.
|
|
563
|
+
|
|
564
|
+
**Authorization.** The Sourcegraph MCP server the Agent already uses is the only
|
|
565
|
+
configuration needed. When a command needs a token and has none, it returns a
|
|
566
|
+
`next_action` with `mcp_tool: authorize_cli`, once, at top level
|
|
567
|
+
(`source_authorization`); sources waiting for it are listed with
|
|
568
|
+
`reason_code: sourcegraph-authorization-required` and need no clone. Call that MCP tool once with
|
|
569
|
+
`client: "context"`, then run
|
|
570
|
+
|
|
571
|
+
```bash
|
|
572
|
+
context source sourcegraph-auth --code <code> --host <host> --format json
|
|
573
|
+
```
|
|
574
|
+
|
|
575
|
+
with the returned one-time `code` and `host` (the site's API root). The CLI
|
|
576
|
+
exchanges the code for a temporary read-only token, keeps it in
|
|
577
|
+
`.tmp/context-runtime/sourcegraph/token.json` (mode 600, never committed) and
|
|
578
|
+
reuses it for later commands in this workspace. Authorize again only when a
|
|
579
|
+
command asks for it again: after the token expired unused, was revoked, or
|
|
580
|
+
reached its maximum lifetime. Never print, copy or log the token. If
|
|
581
|
+
`authorize_cli` answers `TEMPORARY_TOKEN_LIMIT`, do not retry; run `context
|
|
582
|
+
source sourcegraph-auth --refused TEMPORARY_TOKEN_LIMIT --format json`, after
|
|
583
|
+
which remote mode skips repository sources and auto mode reads checkouts until
|
|
584
|
+
earlier temporary tokens expire or are revoked in the Sourcegraph user
|
|
585
|
+
settings. On a development machine or in CI, `SOURCEGRAPH_URL` and
|
|
586
|
+
`SOURCEGRAPH_API_TOKEN` take precedence and need no authorization; Sourcegraph
|
|
587
|
+
CLI login configuration is not read.
|
|
588
|
+
|
|
589
|
+
**Versions.** Only the registered commit decides whether a repository can be
|
|
590
|
+
read. When it is not readable yet, `status`, `verify`, revisions and an explicit
|
|
591
|
+
`update --input` report it and change nothing; `context update --pending` asks
|
|
592
|
+
Sourcegraph to prepare its content (when the site allows), waits a bounded time
|
|
593
|
+
and otherwise reports the job and the next step. Rate limits and full quotas
|
|
594
|
+
are reported, never retried in a loop. When only the processed commit is no
|
|
595
|
+
longer readable, the update still runs: history evidence is `unavailable` and
|
|
596
|
+
`uncited_changes` reports the comparison as unknown, as with a shallow checkout.
|
|
597
|
+
A site that cannot list directories still groups uncited changes but marks no
|
|
598
|
+
`new_directory`, and says so in the entry's `note`.
|
|
599
|
+
|
|
600
|
+
**Reading for writing.** For a source the CLI reads from Sourcegraph, size the
|
|
601
|
+
change with the Sourcegraph diff of the processed and registered commits, and
|
|
602
|
+
read or search code through the Sourcegraph MCP tools pinned to the registered
|
|
603
|
+
full commit; do not clone it for the update. A source read locally, a new page
|
|
604
|
+
and code parsing follow the checkout steps above. A read failure in remote mode
|
|
605
|
+
is never a citation change: `verify` reports those citations as not checked.
|
|
606
|
+
|
|
518
607
|
## Versioned external content and archived collections
|
|
519
608
|
|
|
520
609
|
Published content that another team versions, such as a documentation
|
|
@@ -29,6 +29,12 @@ with an `instruction` when an addition or shared change affects it. When the
|
|
|
29
29
|
pages you revise are written by other Agents, give each writer its page's
|
|
30
30
|
`changed_references` entries and their evidence.
|
|
31
31
|
|
|
32
|
+
When the update's `source_access` marks a repository `remote`, its citations,
|
|
33
|
+
evidence and `uncited_changes` were read from Sourcegraph at the registered
|
|
34
|
+
commit and match a local checkout. Inspect its change with the Sourcegraph diff
|
|
35
|
+
and read its code through the Sourcegraph MCP tools at that commit instead of
|
|
36
|
+
cloning it; a new page from it still needs a local checkout.
|
|
37
|
+
|
|
32
38
|
Follow each changed reference's `evidence_ref` into the JSON array in
|
|
33
39
|
`reference_evidence_file` (`reference_evidence_count` entries) for
|
|
34
40
|
digest-verified historical text and the current excerpt. Read only the entries
|