@fro.bot/systematic 3.30.0 → 3.31.0
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/HARNESSES.md +4 -4
- package/dist/cli.d.ts +13 -9
- package/dist/cli.js +140 -31
- package/dist/{index-jvpbpj9z.js → index-a5jd8n2y.js} +2432 -1698
- package/dist/index.js +1 -1
- package/dist/lib/config-schema.d.ts +2 -0
- package/dist/lib/config.d.ts +29 -9
- package/dist/lib/search-corpus.d.ts +40 -0
- package/dist/lib/search-exclude.d.ts +84 -0
- package/dist/lib/search-external-deciduous.d.ts +9 -2
- package/dist/lib/search-external-sources.d.ts +102 -3
- package/dist/lib/search-external.d.ts +2 -1
- package/dist/lib/search-user-config.d.ts +186 -13
- package/dist/pi.js +869 -248
- package/package.json +3 -2
package/HARNESSES.md
CHANGED
|
@@ -14,7 +14,7 @@ The five capability rows use the vocabulary in the [OpenCode profile](skills/usi
|
|
|
14
14
|
| Blocking user interaction | `question` on v1 [OC-2] and v2 [OC2-PROFILE] | No native blocking tool; numbered-chat fallback [PI-2] | `AskUserQuestion` [CC-2] | `request_user_input`; blocking and root-thread-only [CX-1][CX-2] | `ask_user`; pauses until answers [GE-1][GE-2] | No dedicated tool name verified; plan-mode clarification and `--no-ask-user` are documented [GH-3][GH-4] |
|
|
15
15
|
| Task tracking | `todowrite` on v1 [OC-3]; on v2 only when the experimental `todo` option is on [OC2-TODO] | No native mechanism; visible list fallback [PI-2] | `TodoWrite` is deprecated/disabled by default; `TaskCreate`/`TaskGet`/`TaskList`/`TaskUpdate` replace it [CC-3][CC-4] | **UNVERIFIED** [U] | **UNVERIFIED** [U] | No `TodoWrite` equivalent verified; cloud-agent tasks/sessions API is documented [GH-5] |
|
|
16
16
|
| Skill loading | Skills become commands and `systematic_skill` is registered [OC-4][OC-5]; v2 also registers each skill with the host's own `skill` tool [OC2-SKILL] | `systematic_skill` adapter and Pi-native activation [PI-3][PI-4] | Native Skill tool with `SKILL.md` discovery (`~/.claude/skills/`, `.claude/skills/`, plugin `skills/`); Systematic ships no `systematic_skill` tool on Claude Code [CC-5][CC-6][CC-9] | **UNVERIFIED** [U] | **UNVERIFIED** [U] | `SKILL.md` skills [GH-6] |
|
|
17
|
-
| Durable-output search | v1 and v2: `systematic_search` over solutions, plans, brainstorms and ideation docs (`kind`: `solution`, `plan`, `brainstorm`, `ideation`, `all` or `external`) [SR-1][SR-2][SR-5] [SR-6] | `systematic_search` with the same kinds, also handed to the built-in read-only delegates [SR-1][SR-5] [SR-6] | `systematic-search` bin in the plugin's `bin/`; user-level config, plus the
|
|
17
|
+
| Durable-output search | v1 and v2: `systematic_search` over solutions, plans, brainstorms and ideation docs (`kind`: `solution`, `plan`, `brainstorm`, `ideation`, `all` or `external`) [SR-1][SR-2][SR-5] [SR-6] | `systematic_search` with the same kinds, also handed to the built-in read-only delegates [SR-1][SR-5] [SR-6] | `systematic-search` bin in the plugin's `bin/`; user-level config (user, user.local, custom, custom.local), plus the `sources` the repository-root project file proposes for `--kind external` only [SR-3] [SR-6] | None (no Systematic adapter) | None (no Systematic adapter) | None (no Systematic adapter) |
|
|
18
18
|
| Skills-file support | `SKILL.md` is loaded by the Systematic skill path [OC-4] | `pi.skills` ships `./skills`, including `SKILL.md` discovery [PI-4][PI-5] | `SKILL.md` and `.claude/skills/`; the plugin bundle is built and identifier-translated in CI from `skills/`, never committed [CC-5][CC-6][CC-9] | **UNVERIFIED** [U] | **UNVERIFIED** [U] | `SKILL.md` [GH-6] |
|
|
19
19
|
|
|
20
20
|
`[U]` means the capability was not checked in the supplied research pack. It is not a claim that the capability does not exist.
|
|
@@ -92,7 +92,7 @@ Honest capability boundary: output-style enforcement is real and applies automat
|
|
|
92
92
|
|
|
93
93
|
Systematic ships its own search over four kinds of durable output: `docs/solutions/`, `docs/plans/`, `docs/brainstorms/` and `docs/ideation/`. `kind` takes each of them, or `all` for one ranking across the four, or `external` for the opt-in external sources described below; leaving it out means `solution`. It is not a host primitive, so every claim below rests on Systematic's own code and tests. One host-neutral composition, `runSearch` in `src/lib/search-core.ts`, validates, loads each requested kind, ranks lexically, resolves the lifecycle per kind and renders; every surface only maps host I/O to it [SR-1]. The surfaces are `systematic_search` on OpenCode v1, OpenCode v2 and Pi, `systematic search` on the CLI, and the `systematic-search` bin in the Claude Code bundle [SR-1][SR-3]. The learnings-researcher calls it first and keeps its grep steps as the fallback; its `scope: past-work` makes one search per kind across all four, and ce:plan, ce:ideate, ce:brainstorm and deepen-plan dispatch it that way, followed by one `external` call.
|
|
94
94
|
|
|
95
|
-
**External search reach.** `kind: "external"` is a selector beside `all`, not a fifth kind. It searches folders of Markdown and Deciduous sync JSON that the user opted in to. A project proposes sources in its own `.opencode/systematic.jsonc` and none is read until the user lists the project's main repository root in `search.allow_project_sources`; a user config may map folders anywhere to projects with `projects[]`. Every surface reaches one per-call reader (`resolveExternalSources` in `src/lib/search-external-sources.ts`) that re-reads
|
|
95
|
+
**External search reach.** `kind: "external"` is a selector beside `all`, not a fifth kind. It searches folders of Markdown and Deciduous sync JSON that the user opted in to. A project proposes sources in its own `.systematic.jsonc` at the repository root, or in `.opencode/systematic.jsonc` when no root file exists, and none is read until the user lists the project's main repository root in `search.allow_project_sources`; a user config may map folders anywhere to projects with `projects[]`. Every surface reaches one per-call reader (`resolveExternalSources` in `src/lib/search-external-sources.ts`) that re-reads the user-level files (user, user.local, custom and custom.local), the project file from the repository root of the call's start directory and the project identity on each call; only `search.enabled`, tool registration and the registration-time `config unreadable` note are fixed at init [SR-6]. The OpenCode v2 plugin passes no config-directory override to that reader: on the plugin hosts it reads `~/.config/opencode` and `OPENCODE_CONFIG_DIR`. The bin reads user-level config, and from project config only the proposed `sources` and only for `--kind external` [SR-3] [SR-6]. A source may carry `exclude` patterns, tested against root-relative paths by one dependency-free matcher that the plugin and the bin share [SR-6]. Pi loads config once at init from `process.cwd()`, while each search call starts from the call's `ctx.cwd`; the parity test starts both in one directory, and no test starts them apart [SR-6]. Two accepted limits: every worktree of an allowed project, including a pull-request worktree under review, contributes its own proposals and Markdown, and a stale allow entry trusts whatever repository is later cloned to that path. Sources read local files only; nothing is redacted from a hit that reaches the model provider.
|
|
96
96
|
|
|
97
97
|
Evidence tiers differ by host, and this file does not claim more than the tests do:
|
|
98
98
|
- **Host-free contract evidence:** one parity test drives each adapter's real entry over one fixture corpus and compares the rendered text; a second runs the built bin under real Node from a directory with no `node_modules` [SR-1].
|
|
@@ -277,7 +277,7 @@ Migrated-skill discipline is enforced by the [content-integrity gate](scripts/co
|
|
|
277
277
|
- **WT-2** — `skills/git-worktree/scripts/worktree-manager.sh` (the script); `tests/unit/git-worktree-manager.test.ts` and `tests/unit/git-worktree-cleanup.test.ts` (placement from the root, a subdirectory and a linked worktree, refused layouts, ignore policy, base resolution, `--no-track`, `list`, `switch`, `copy-env`, `cleanup`; real git in throwaway repositories with a bare `origin`, `TEST_BASH=/bin/bash` runs them under bash 3.2); `tests/unit/git-worktree-skills-contract.test.ts` (the safety and routing terms in `skills/git-worktree/SKILL.md` and the pointers in `ce-review`, `orchestrating-subagents` and `git-clean-gone-branches`). Package probe: the plugin-init, Pi-init and built-output-style tests cited by WT-1, OC-8, PI-8 and CC-13. No live session has run.
|
|
278
278
|
- **SR-1** — `src/lib/search-core.ts` (`runSearch`, the tool name and argument constants, the lifecycle constants and resolver); `src/lib/search-tool.ts` (the v1, v2 and Pi adapters); `tests/unit/search-adapters-parity.test.ts` (every adapter's real entry over one corpus: byte-identical text, fixed validation errors, no permission request, registration shapes); `tests/unit/search-lifecycle.test.ts` (the resolver over a lifecycle fixture corpus); `tests/unit/search-determinism.test.ts` (Bun and Node produce the same bits).
|
|
279
279
|
- **SR-2** — `tests/integration/opencode-v1.test.ts` › "systematic_search finds a document under the host project, and limit 0 and 21 reach the core" (CI jobs `Host Contract v1 floor` and `Host Contract v1 current`); `tests/integration/opencode-v2.test.ts` › "systematic_search is offered to the model, finds a document under the project, and limit 0 and 21 reach the core" (CI job `Host Contract v2 shard N/4`, OpenCode 2.2.0, run only when `SYSTEMATIC_OPENCODE_V2_BIN` is set).
|
|
280
|
-
- **SR-3** — `src/claude-code-search.ts` (the bin entry); `tests/unit/claude-code-search.test.ts` (the bundle run from a foreign directory); `tests/unit/harness-profiles-search.test.ts` and `tests/integration/claude-code.test.ts` (the output style names `systematic-search` and `command -v systematic-search`, and still ships no `systematic_skill` tool). From project config the bin reads only the `sources` a project proposes, and only for `--kind external` (SR-6). No CI job runs the bin inside a live Claude Code session; see SR-4.
|
|
280
|
+
- **SR-3** — `src/claude-code-search.ts` (the bin entry); `tests/unit/claude-code-search.test.ts` (the bundle run from a foreign directory); `tests/unit/harness-profiles-search.test.ts` and `tests/integration/claude-code.test.ts` (the output style names `systematic-search` and `command -v systematic-search`, and still ships no `systematic_skill` tool). From project config the bin reads only the `sources` a project proposes, from the repository-root file, and only for `--kind external` (SR-6). `tests/unit/claude-code-search.test.ts` has 26 tests, one of which starts in a subfolder of a repository and reads the repo-root project file, its excludes and a user.local allow entry. No CI job runs the bin inside a live Claude Code session; see SR-4.
|
|
281
281
|
- **SR-4** — Manual evidence, not a CI check. Recorded 2026-10-31 with Claude Code 2.1.312 and model claude-sonnet-5-5. The plugin bundle was built from 9ed5a336 with `bun run claude-code:build` and loaded with `--plugin-dir`. The fixture project held one solution and one `status: abandoned` brainstorm. `claude -p --output-format stream-json --verbose --forward-subagent-text` was given a prompt to dispatch `systematic:learnings-researcher` with `scope: past-work`. Outcome: the subagent ran `systematic-search --kind all --limit 12 -- '<query>'` through Bash. The Bash `tool_use` carried `parent_tool_use_id` set to the `Agent` dispatch's id. The `tool_result` began `Search "` and named both the solution and the brainstorm. In that bundle the researcher still used the `all` call. The per-kind calls that replaced it run through the same bin. Scope limit: this run predates `kind: external`, and no live Claude Code session has run `--kind external`.
|
|
282
282
|
- **SR-5** — `tests/helpers/delegated-search-proof.ts` (the planted fixture, the scripted four-turn model and the proof assertion with its failure diagnostics); `tests/unit/delegated-search-proof.test.ts` (the assertion over recorded request lists, including each failure code); `tests/integration/opencode-v1.test.ts` › "a dispatched learnings-researcher child calls systematic_search and its result reaches the parent" (CI jobs `Host Contract v1 floor` and `Host Contract v1 current`, OpenCode 1.18.29 and the current v1 pin); `tests/integration/opencode-v2.test.ts` › the same test name (CI job `Host Contract v2 shard N/4`, OpenCode 2.2.0, run only when `SYSTEMATIC_OPENCODE_V2_BIN` is set); `tests/integration/pi.test.ts` › "a delegated learnings-researcher child calls systematic_search and its result reaches the parent" (the real Pi runtime, run in the v2 host-contract profile). Each file also has a negative control: with `search.enabled` false the child is not offered the tool and the proof fails saying so. Scope limit: a scripted model makes the call, so these show reach and plumbing only.
|
|
283
|
-
- **SR-6** — External search reach (`kind: "external"`). Code: `src/lib/search-external-sources.ts` (the per-call reader every surface shares), `src/lib/search-project-identity.ts` (main-root identity from filesystem reads), `src/lib/search-external.ts` and `src/lib/search-external-deciduous.ts` (the Markdown and Deciduous loaders), `src/lib/search-user-config.ts` (the field and entry validators and the 1 MB bin-safe project reader), `src/lib/search-render.ts` (the external renderer). Host-free tests: `tests/unit/search-project-identity.test.ts` (real git repositories and `git worktree add`: a worktree maps to its main root, forged and inconsistent `.git` files, a bare repository, `core.worktree` and a symlinked `.git` never resolve); `tests/unit/search-external-sources.test.ts` (resolution order, worktrees, shadowing, the 8-source cap, user and custom config directories, nothing cached between calls, the module graph); `tests/unit/search-external.test.ts` and `tests/unit/search-external-deciduous.test.ts` (records, caps, the shared read budget, states, symlinks and read-only behavior); `tests/unit/search-adapters-parity.test.ts` › \"search adapters parity: kind external\" (v1, v2, Pi, CLI, the bin in process and the built bin under Node give byte-identical text; not-allowed replies; an allow-list edit between calls; `search.enabled` false); `tests/unit/claude-code-search.test.ts` (`--kind external` in process and from a foreign directory under Node, the stderr warning for a broken project file, and a bundle that contains neither `config.ts` nor `config-schema.ts`); `tests/unit/opencode-v2-search.test.ts` › \"setupOpenCodeV2 with a project search.sources problem\" (a project file that parses never fails v2 setup, and one that cannot be parsed still does); `tests/unit/past-work-wiring-contract.test.ts` › \"the external call in past-work scope\" and the External records group (the researcher prompt side); `tests/unit/delegated-search-proof.test.ts` › \"external mode\" and `tests/helpers/delegated-search-proof.ts` (the external fixture, script and assertion). Real host: `tests/integration/opencode-v2.test.ts` › \"a dispatched learnings-researcher child searches kind external and the planted external record reaches the parent\" and its negative control \"with the allow entry absent the child receives the not-allowed reply, the parent never sees the external path and the proof names the failure\" (CI job `Host Contract v2 shard N/4`, OpenCode 2.2.0, run only when `SYSTEMATIC_OPENCODE_V2_BIN` is set). Scope limits: a scripted model makes the call, so the real-host proof shows reach and plumbing only; it covers OpenCode v2 alone. No real-host external proof exists for OpenCode v1, Pi or Claude Code.
|
|
283
|
+
- **SR-6** — External search reach (`kind: "external"`). Code: `src/lib/search-external-sources.ts` (the per-call reader every surface shares), `src/lib/search-project-identity.ts` (main-root identity from filesystem reads), `src/lib/search-external.ts` and `src/lib/search-external-deciduous.ts` (the Markdown and Deciduous loaders), `src/lib/search-user-config.ts` (the field and entry validators, the user-level and project file selection, and the 1 MB bin-safe project reader), `src/lib/search-exclude.ts` (the `exclude` pattern validators and matcher), `src/lib/search-render.ts` (the external renderer). Host-free tests: `tests/unit/search-project-identity.test.ts` (real git repositories and `git worktree add`: a worktree maps to its main root, forged and inconsistent `.git` files, a bare repository, `core.worktree` and a symlinked `.git` never resolve); `tests/unit/search-external-sources.test.ts` (resolution order, worktrees, shadowing, the 8-source cap, user and custom config directories, nothing cached between calls, the module graph); `tests/unit/search-external.test.ts` and `tests/unit/search-external-deciduous.test.ts` (records, caps, the shared read budget, states, symlinks and read-only behavior); `tests/unit/search-adapters-parity.test.ts` › \"search adapters parity: kind external\" (v1, v2, Pi, CLI, the bin in process and the built bin under Node give byte-identical text; not-allowed replies; an allow-list edit between calls; `search.enabled` false); `tests/unit/claude-code-search.test.ts` (`--kind external` in process and from a foreign directory under Node, the stderr warning for a broken project file, and a bundle that contains neither `config.ts` nor `config-schema.ts`); `tests/unit/opencode-v2-search.test.ts` › \"setupOpenCodeV2 with a project search.sources problem\" (a project file that parses never fails v2 setup, and one that cannot be parsed still does); `tests/unit/past-work-wiring-contract.test.ts` › \"the external call in past-work scope\" and the External records group (the researcher prompt side); `tests/unit/delegated-search-proof.test.ts` › \"external mode\" and `tests/helpers/delegated-search-proof.ts` (the external fixture, script and assertion). Real host: `tests/integration/opencode-v2.test.ts` › \"a dispatched learnings-researcher child searches kind external and the planted external record reaches the parent\" and its negative control \"with the allow entry absent the child receives the not-allowed reply, the parent never sees the external path and the proof names the failure\" (CI job `Host Contract v2 shard N/4`, OpenCode 2.2.0, run only when `SYSTEMATIC_OPENCODE_V2_BIN` is set). Config locations, local overlays and excludes (host-free; the per-file counts are the tests in each file today, not only the ones added): `tests/unit/search-exclude.test.ts` (77 tests: pattern validation, the matcher on slash, `**` and `?` patterns, adversarial inputs, and a module that imports nothing); `tests/unit/search-user-config.test.ts` (192 tests: file selection by existence, the four user-level layers, an aliased custom directory read once, project file selection, `exclude` validation); `tests/unit/search-corpus.test.ts` › "lookupSearchRoot" and "discoverSourceFiles: excludes" (109 tests); `tests/unit/search-external.test.ts` › "loadExternalSources: excludes" (58 tests) and `tests/unit/search-external-deciduous.test.ts` › "Deciduous loader: excludes" (54 tests); `tests/unit/search-external-sources.test.ts` › "resolveExternalSources: locations, local overlays and diagnostics" and "inspectSearch" (66 tests); `tests/unit/search-adapters-parity.test.ts` › "search adapters parity: repo-root project file, local overlays and excludes" and "search adapters parity: an invalid local file" (43 tests: one fixture started in a subfolder gives byte-identical external text on v1, v2, Pi, the CLI, the bin in process and the built bin, with every layer and the excludes applied; v1 and Pi throw at init and v2 setup rejects naming an invalid local file; a project file over 1 MB fails v1, v2 and Pi while the CLI and the bin carry on); `tests/unit/config.test.ts` › "layered config files" (374 tests); `tests/unit/pi.test.ts` › "src/pi.ts config resolved from the repository root" (72 tests); `tests/unit/opencode-v2.test.ts` (44 tests: a project directory below the repository root applies the root file, the home fallback applies no project file, an invalid user.local rejects setup naming it); `tests/unit/cli.test.ts` › "cli config show: locations and search" and the `loadSearchSettingsForCli` cases (132 tests). Scope limits: a scripted model makes the call, so the real-host proof shows reach and plumbing only; it covers OpenCode v2 alone. No real-host external proof exists for OpenCode v1, Pi or Claude Code.
|
package/dist/cli.d.ts
CHANGED
|
@@ -39,20 +39,24 @@ export declare function runValidateReviewReturnCli(options: ValidateReviewReturn
|
|
|
39
39
|
/**
|
|
40
40
|
* The settings loader `systematic search` injects into `runSearchCli`: the
|
|
41
41
|
* full config loader, so the project-config strip warning for `search.enabled`
|
|
42
|
-
* or `search.allow_project_sources` reaches stderr.
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
*
|
|
46
|
-
*
|
|
47
|
-
* project config cannot change `enabled` or the allow
|
|
48
|
-
* `search.sources`, but the loader validates and
|
|
49
|
-
* external reader is their only consumer, and
|
|
42
|
+
* or `search.allow_project_sources` reaches stderr. The loader gets the start
|
|
43
|
+
* directory as given and finds the repository root itself, so a directory with
|
|
44
|
+
* no repository keeps its unresolved path. A thrown load, an invalid file of
|
|
45
|
+
* any kind (user, local, custom or project), or an invalid `search` block all
|
|
46
|
+
* give `unreadable: true`, which makes the core add the `config unreadable`
|
|
47
|
+
* note to the results. A project config cannot change `enabled` or the allow
|
|
48
|
+
* list. It may propose `search.sources`, but the loader validates and
|
|
49
|
+
* discards them: the per-call external reader is their only consumer, and
|
|
50
|
+
* reads the project file's `search` block on its own.
|
|
50
51
|
*
|
|
51
52
|
* The full loader drops a whole file that fails validation, so a valid
|
|
52
53
|
* `search.enabled: false` next to a bad sibling key would be lost. When a
|
|
53
54
|
* source is invalid, or the load throws, the settings come from the user-level
|
|
54
55
|
* reader instead, which validates the `search` block on its own (the same
|
|
55
|
-
* reader the `systematic-search` bin uses), so the opt-out still holds.
|
|
56
|
+
* reader the `systematic-search` bin uses), so the opt-out still holds. Its
|
|
57
|
+
* warnings join the loader's, and a thrown load adds the exception message.
|
|
58
|
+
* Each message appears once, and a file the loader already named as
|
|
59
|
+
* unreadable is not named a second time by the fallback. Never throws.
|
|
56
60
|
*/
|
|
57
61
|
export declare function loadSearchSettingsForCli(startDir: string, configOptions?: LoadConfigOptions): SearchCliSettingsLoad;
|
|
58
62
|
/**
|
package/dist/cli.js
CHANGED
|
@@ -24,6 +24,9 @@ import {
|
|
|
24
24
|
discriminatedUnion,
|
|
25
25
|
_enum,
|
|
26
26
|
literal,
|
|
27
|
+
displaySafe,
|
|
28
|
+
MAX_PROJECT_CONFIG_BYTES,
|
|
29
|
+
readTextBounded,
|
|
27
30
|
loadUserLevelSearchSettings,
|
|
28
31
|
extractString,
|
|
29
32
|
toSourcedPiSubagentsOverlays,
|
|
@@ -36,7 +39,7 @@ import {
|
|
|
36
39
|
findCommandsInDir,
|
|
37
40
|
findSkillsInDir,
|
|
38
41
|
discoverSkills,
|
|
39
|
-
|
|
42
|
+
inspectSearch,
|
|
40
43
|
SEARCH_TOOL_NAME,
|
|
41
44
|
SEARCH_ARGS,
|
|
42
45
|
MIN_LIMIT,
|
|
@@ -44,7 +47,7 @@ import {
|
|
|
44
47
|
SEARCH_NOTICES,
|
|
45
48
|
SEARCH_CONFIG_UNREADABLE_NOTE,
|
|
46
49
|
runSearch
|
|
47
|
-
} from "./index-
|
|
50
|
+
} from "./index-a5jd8n2y.js";
|
|
48
51
|
var __defProp = Object.defineProperty;
|
|
49
52
|
var __returnValue = (v) => v;
|
|
50
53
|
function __exportSetter(name, newValue) {
|
|
@@ -3698,29 +3701,50 @@ function userLevelDirOptions(options) {
|
|
|
3698
3701
|
}
|
|
3699
3702
|
function loadSearchSettingsForCli(startDir, configOptions) {
|
|
3700
3703
|
const warnings = [];
|
|
3704
|
+
const fallback = () => {
|
|
3705
|
+
const user = loadUserLevelSearchSettings(userLevelDirOptions(configOptions));
|
|
3706
|
+
const failed = new Set(user.readFailures);
|
|
3707
|
+
return {
|
|
3708
|
+
settings: user.settings,
|
|
3709
|
+
warnings: user.warnings.filter((message) => !failed.has(message))
|
|
3710
|
+
};
|
|
3711
|
+
};
|
|
3701
3712
|
try {
|
|
3702
|
-
const loaded = loadConfigWithSources(
|
|
3713
|
+
const loaded = loadConfigWithSources(startDir, {
|
|
3703
3714
|
...configOptions,
|
|
3704
3715
|
invalidSource: "report",
|
|
3705
3716
|
warningSink: (message) => warnings.push(message)
|
|
3706
3717
|
});
|
|
3707
|
-
const invalidSource = loaded.metadata.sources.some((source) => source.presence === "invalid"
|
|
3708
|
-
if (invalidSource) {
|
|
3709
|
-
|
|
3718
|
+
const invalidSource = loaded.metadata.sources.some((source) => source.presence === "invalid");
|
|
3719
|
+
if (!invalidSource) {
|
|
3720
|
+
return {
|
|
3721
|
+
settings: loaded.config.search,
|
|
3722
|
+
warnings: uniqueMessages(warnings),
|
|
3723
|
+
unreadable: loaded.config.searchUnreadable === true
|
|
3724
|
+
};
|
|
3710
3725
|
}
|
|
3726
|
+
warnings.push("[systematic] A Systematic config file could not be read, so search results carry a `config unreadable` note. Run `systematic config show` for details.");
|
|
3727
|
+
const user = fallback();
|
|
3728
|
+
warnings.push(...user.warnings);
|
|
3711
3729
|
return {
|
|
3712
|
-
settings:
|
|
3713
|
-
warnings,
|
|
3714
|
-
unreadable:
|
|
3730
|
+
settings: user.settings,
|
|
3731
|
+
warnings: uniqueMessages(warnings),
|
|
3732
|
+
unreadable: true
|
|
3715
3733
|
};
|
|
3716
|
-
} catch {
|
|
3734
|
+
} catch (error) {
|
|
3735
|
+
const detail = error instanceof Error ? error.message : String(error);
|
|
3736
|
+
const user = fallback();
|
|
3737
|
+
warnings.push(`[systematic] The Systematic config could not be loaded (${displaySafe(detail)}), so search results carry a \`config unreadable\` note. Search settings come from the user-level files alone.`, ...user.warnings);
|
|
3717
3738
|
return {
|
|
3718
|
-
settings:
|
|
3719
|
-
warnings,
|
|
3739
|
+
settings: user.settings,
|
|
3740
|
+
warnings: uniqueMessages(warnings),
|
|
3720
3741
|
unreadable: true
|
|
3721
3742
|
};
|
|
3722
3743
|
}
|
|
3723
3744
|
}
|
|
3745
|
+
function uniqueMessages(messages) {
|
|
3746
|
+
return [...new Set(messages)];
|
|
3747
|
+
}
|
|
3724
3748
|
function searchCliInputs(configOptions) {
|
|
3725
3749
|
return {
|
|
3726
3750
|
loadSettings: (startDir) => loadSearchSettingsForCli(startDir, configOptions),
|
|
@@ -3869,20 +3893,31 @@ function toJsonRoutingResolution(resolution) {
|
|
|
3869
3893
|
source: resolution.source
|
|
3870
3894
|
};
|
|
3871
3895
|
}
|
|
3872
|
-
function
|
|
3873
|
-
|
|
3874
|
-
const locations = {
|
|
3896
|
+
function toJsonLocations(paths) {
|
|
3897
|
+
return {
|
|
3875
3898
|
user: paths.userConfig,
|
|
3899
|
+
userLocal: paths.userLocalConfig,
|
|
3876
3900
|
project: paths.projectConfig,
|
|
3877
|
-
custom: paths.customConfig ?? null
|
|
3901
|
+
custom: paths.customConfig ?? null,
|
|
3902
|
+
customLocal: paths.customLocalConfig ?? null,
|
|
3903
|
+
ignoredProject: paths.ignoredProjectConfig ?? null
|
|
3878
3904
|
};
|
|
3905
|
+
}
|
|
3906
|
+
function inspectSearchForConfigShow(paths) {
|
|
3907
|
+
return inspectSearch({ checkoutRoot: paths.projectRoot });
|
|
3908
|
+
}
|
|
3909
|
+
function buildConfigShowJson() {
|
|
3910
|
+
const paths = getConfigPaths(process.cwd());
|
|
3911
|
+
const locations = toJsonLocations(paths);
|
|
3912
|
+
const search = inspectSearchForConfigShow(paths);
|
|
3879
3913
|
let loaded;
|
|
3880
3914
|
try {
|
|
3881
3915
|
loaded = loadConfigWithSources(process.cwd());
|
|
3882
3916
|
} catch (error) {
|
|
3883
3917
|
return {
|
|
3884
3918
|
locations,
|
|
3885
|
-
error: error instanceof Error ? error.message : String(error)
|
|
3919
|
+
error: error instanceof Error ? error.message : String(error),
|
|
3920
|
+
search
|
|
3886
3921
|
};
|
|
3887
3922
|
}
|
|
3888
3923
|
const targets = collectRoutingTargets(loaded.overlays, disabledAgentsSet(loaded)).sort((left, right) => `${left.category}/${left.agentKey}`.localeCompare(`${right.category}/${right.agentKey}`));
|
|
@@ -3907,9 +3942,78 @@ function buildConfigShowJson() {
|
|
|
3907
3942
|
profileSelectorSource: loaded.metadata.profileSelectorSource,
|
|
3908
3943
|
activeProfileSourcePath: loaded.activeProfileSourcePath,
|
|
3909
3944
|
profileFallback: loaded.metadata.profileFallback,
|
|
3910
|
-
routing
|
|
3945
|
+
routing,
|
|
3946
|
+
search
|
|
3911
3947
|
};
|
|
3912
3948
|
}
|
|
3949
|
+
function yesNo(value) {
|
|
3950
|
+
return value ? "yes" : "no";
|
|
3951
|
+
}
|
|
3952
|
+
function formatSourceRoot(root) {
|
|
3953
|
+
const state = root.present === null ? "" : root.present ? " (present)" : " (missing)";
|
|
3954
|
+
return `${displaySafe(root.path)}${state}`;
|
|
3955
|
+
}
|
|
3956
|
+
function printSearchSource(source) {
|
|
3957
|
+
console.log(` ${displaySafe(source.name)} [${source.status}]`);
|
|
3958
|
+
console.log(` origin: ${source.origin}`);
|
|
3959
|
+
if (source.status === "dropped invalid") {
|
|
3960
|
+
console.log(` reason: ${displaySafe(source.reason)}`);
|
|
3961
|
+
} else {
|
|
3962
|
+
if (source.status === "root rejected") {
|
|
3963
|
+
console.log(` reason: ${displaySafe(source.reason)}`);
|
|
3964
|
+
}
|
|
3965
|
+
console.log(` format: ${source.format}`);
|
|
3966
|
+
for (const root of source.roots) {
|
|
3967
|
+
console.log(` root: ${formatSourceRoot(root)}`);
|
|
3968
|
+
}
|
|
3969
|
+
if (source.exclude.length > 0) {
|
|
3970
|
+
console.log(` exclude: ${source.exclude.map((pattern) => displaySafe(pattern)).join(", ")}`);
|
|
3971
|
+
}
|
|
3972
|
+
}
|
|
3973
|
+
for (const warning of source.warnings) {
|
|
3974
|
+
console.log(` warning: ${warning}`);
|
|
3975
|
+
}
|
|
3976
|
+
}
|
|
3977
|
+
function printSearchSection(search) {
|
|
3978
|
+
console.log(`
|
|
3979
|
+
Search:`);
|
|
3980
|
+
console.log(` Enabled: ${yesNo(search.enabled)}`);
|
|
3981
|
+
console.log(` Project root: ${displaySafe(search.projectRoot)}`);
|
|
3982
|
+
console.log(` Allow list: ${search.allowProjectSources.length === 0 ? "(empty)" : search.allowProjectSources.map((entry) => displaySafe(entry)).join(", ")}`);
|
|
3983
|
+
console.log(` Project allowed: ${yesNo(search.projectAllowed)}`);
|
|
3984
|
+
if (search.userConfigUnreadable) {
|
|
3985
|
+
console.log(" A user-level config file could not be fully read.");
|
|
3986
|
+
}
|
|
3987
|
+
if (search.projectConfigUnreadable) {
|
|
3988
|
+
console.log(" The project config file could not be read.");
|
|
3989
|
+
}
|
|
3990
|
+
console.log(`
|
|
3991
|
+
External sources:`);
|
|
3992
|
+
if (search.sources.length === 0)
|
|
3993
|
+
console.log(" (none)");
|
|
3994
|
+
for (const source of search.sources)
|
|
3995
|
+
printSearchSource(source);
|
|
3996
|
+
for (const warning of search.warnings) {
|
|
3997
|
+
console.log(` warning: ${warning}`);
|
|
3998
|
+
}
|
|
3999
|
+
console.log(`
|
|
4000
|
+
Built-in kinds:`);
|
|
4001
|
+
for (const kind of search.builtIn) {
|
|
4002
|
+
console.log(` ${kind.kind.padEnd(10)} ${kind.state.padEnd(10)} ${displaySafe(kind.directory)}`);
|
|
4003
|
+
}
|
|
4004
|
+
}
|
|
4005
|
+
function printConfigFile(heading, filePath) {
|
|
4006
|
+
const read = readTextBounded(filePath, MAX_PROJECT_CONFIG_BYTES);
|
|
4007
|
+
if (read.kind === "absent")
|
|
4008
|
+
return;
|
|
4009
|
+
console.log(`
|
|
4010
|
+
${heading}:`);
|
|
4011
|
+
if (read.kind === "text") {
|
|
4012
|
+
console.log(read.content);
|
|
4013
|
+
return;
|
|
4014
|
+
}
|
|
4015
|
+
console.log(` ${displaySafe(filePath)} could not be shown: ${read.reason}`);
|
|
4016
|
+
}
|
|
3913
4017
|
function configShow(options) {
|
|
3914
4018
|
if (options.json) {
|
|
3915
4019
|
const output = buildConfigShowJson();
|
|
@@ -3919,21 +4023,26 @@ function configShow(options) {
|
|
|
3919
4023
|
return;
|
|
3920
4024
|
}
|
|
3921
4025
|
const paths = getConfigPaths(process.cwd());
|
|
4026
|
+
const locations = toJsonLocations(paths);
|
|
3922
4027
|
console.log(`Configuration locations:
|
|
3923
4028
|
`);
|
|
3924
|
-
console.log(` User config:
|
|
3925
|
-
console.log(`
|
|
3926
|
-
|
|
3927
|
-
|
|
3928
|
-
|
|
3929
|
-
|
|
3930
|
-
|
|
3931
|
-
|
|
3932
|
-
|
|
3933
|
-
|
|
3934
|
-
console.log(
|
|
3935
|
-
}
|
|
3936
|
-
|
|
4029
|
+
console.log(` User config: ${locations.user}`);
|
|
4030
|
+
console.log(` User local config: ${locations.userLocal}`);
|
|
4031
|
+
console.log(` Project config: ${locations.project}`);
|
|
4032
|
+
if (locations.ignoredProject !== null) {
|
|
4033
|
+
console.log(` Ignored project config: ${locations.ignoredProject}`);
|
|
4034
|
+
}
|
|
4035
|
+
if (locations.custom !== null) {
|
|
4036
|
+
console.log(` Custom config: ${locations.custom}`);
|
|
4037
|
+
}
|
|
4038
|
+
if (locations.customLocal !== null) {
|
|
4039
|
+
console.log(` Custom local config: ${locations.customLocal}`);
|
|
4040
|
+
}
|
|
4041
|
+
printConfigFile("Project configuration", paths.projectConfig);
|
|
4042
|
+
printConfigFile("User configuration", paths.userConfig);
|
|
4043
|
+
const resolved = printResolvedSection();
|
|
4044
|
+
printSearchSection(inspectSearchForConfigShow(paths));
|
|
4045
|
+
if (!resolved)
|
|
3937
4046
|
process.exit(1);
|
|
3938
4047
|
}
|
|
3939
4048
|
function parseConfigShowArgs(rest) {
|