@event4u/agent-config 14.21.0 → 14.22.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/.augment-plugin/marketplace.json +3 -3
- package/.augment-plugin/plugin.json +1 -1
- package/.claude-plugin/marketplace.json +1 -1
- package/CHANGELOG.md +198 -0
- package/CREDITS.md +37 -0
- package/dist/agent-src/commands/analyze/inbox.md +380 -5
- package/dist/agent-src/commands/analyze/repo.md +4 -2
- package/dist/agent-src/contexts/communication/rules-auto/token-efficiency-mechanics.md +69 -0
- package/dist/agent-src/contexts/execution/auto-dispatch-classification.md +5 -5
- package/dist/agent-src/rules/external-code-graph-interop.md +19 -14
- package/dist/agent-src/rules/token-efficiency.md +26 -3
- package/dist/agent-src/scripts/_cli_entry.ts +51 -0
- package/dist/agent-src/scripts/archive_completed_roadmaps.ts +14 -23
- package/dist/agent-src/scripts/roadmap_gates.ts +4 -20
- package/dist/agent-src/scripts/roadmap_set_step.ts +5 -2
- package/dist/agent-src/scripts/stubs_due.ts +4 -18
- package/dist/agent-src/scripts/update_roadmap_progress.ts +7 -24
- package/dist/agent-src/skills/code-intelligence/SKILL.md +25 -0
- package/dist/agent-src/skills/roadmap-writing/SKILL.md +17 -0
- package/dist/agent-src/templates/agent-settings.md +0 -1
- package/dist/agent-src/templates/agents/agent-project-settings.example.yml +1 -1
- package/dist/cli-delegate/_cli_entry.js +8 -0
- package/dist/cli-delegate/_lib/pin_resolver.js +170 -0
- package/dist/cli-delegate/archival_sweep.js +8 -0
- package/dist/cli-delegate/archive_completed_roadmaps.js +494 -0
- package/dist/cli-delegate/check_update_banner.js +923 -0
- package/dist/cli-delegate/chunk-5EK5WQN6.js +28 -0
- package/dist/cli-delegate/chunk-7XGD2OEU.js +96 -0
- package/dist/cli-delegate/{chunk-643Z7FIC.js → chunk-BIXEDQPZ.js} +6 -0
- package/dist/cli-delegate/chunk-DBH4AHDK.js +155 -0
- package/dist/cli-delegate/chunk-JO25G5H7.js +20 -0
- package/dist/cli-delegate/chunk-LTYVIY76.js +7961 -0
- package/dist/cli-delegate/chunk-QAJS5YWY.js +999 -0
- package/dist/cli-delegate/{chunk-ZVBOHSVF.js → chunk-TGIPZBCW.js} +1 -1
- package/dist/cli-delegate/{chunk-YS6XTLEK.js → chunk-TYSY33MD.js} +56 -6
- package/dist/cli-delegate/chunk-ULET4BYS.js +328 -0
- package/dist/cli-delegate/chunk-YDQSHTD7.js +187 -0
- package/dist/cli-delegate/chunk-YWVXLR44.js +48 -0
- package/dist/cli-delegate/chunk-ZZQBUHFK.js +273 -0
- package/dist/cli-delegate/cmd_conformance.js +2 -2
- package/dist/cli-delegate/cmd_export.js +1 -1
- package/dist/cli-delegate/cmd_handoff.js +26 -2
- package/dist/cli-delegate/cmd_prune.js +1 -1
- package/dist/cli-delegate/cmd_session_recycle.js +2 -2
- package/dist/cli-delegate/cmd_settings_migrate.js +1 -1
- package/dist/cli-delegate/cmd_sync.js +1 -1
- package/dist/cli-delegate/cmd_uninstall.js +1 -1
- package/dist/cli-delegate/cmd_validate.js +1 -1
- package/dist/cli-delegate/dashboard_mode.js +16 -0
- package/dist/cli-delegate/gate_budget.js +24 -0
- package/dist/cli-delegate/gate_execute.js +25 -0
- package/dist/cli-delegate/guarded_baseline.js +18 -0
- package/dist/cli-delegate/resume_probe.js +22 -0
- package/dist/cli-delegate/roadmap_gates.js +638 -0
- package/dist/cli-delegate/roadmap_set_step.js +173 -0
- package/dist/cli-delegate/stub_queue.js +47 -0
- package/dist/cli-delegate/stubs_due.js +38 -0
- package/dist/cli-delegate/ticket_bundles.js +59 -0
- package/dist/cli-delegate/update_roadmap_progress.js +60 -0
- package/dist/discovery/deprecation-report.md +1 -1
- package/dist/discovery/discovery-manifest.json +8 -8
- package/dist/discovery/discovery-manifest.json.sha256 +1 -1
- package/dist/discovery/discovery-manifest.summary.md +1 -1
- package/dist/discovery/dormancy-report.md +1 -1
- package/dist/discovery/orphan-report.md +1 -1
- package/dist/discovery/packs.json +2 -2
- package/dist/discovery/trust-report.md +1 -1
- package/dist/discovery/workspaces.json +2 -2
- package/dist/hooks/dispatch.js +1193 -917
- package/dist/install/claudeLayerCarriage.js +237 -0
- package/dist/install/claudePathsPlan.js +79 -0
- package/dist/install/hostLayerFingerprint.js +1 -1
- package/dist/install/install.mjs +6 -0
- package/dist/install/partitionEligibility.js +231 -117
- package/dist/install/ruleLayerPartition.js +10 -7
- package/dist/mcp/registry-manifest.json +2 -2
- package/dist/mcp/server.json +2 -2
- package/dist/mcp/server.mjs +39219 -38995
- package/dist/scripts/condense.js +32 -25
- package/docs/MIGRATION.md +49 -1
- package/docs/contracts/settings-classes.md +1 -1
- package/docs/guidelines/agent-infra/minimal-safe-diff-mechanics.md +73 -0
- package/package.json +7 -4
- package/src/agent-src/scripts/_cli_entry.ts +51 -0
- package/src/agent-src/scripts/archive_completed_roadmaps.ts +14 -23
- package/src/agent-src/scripts/roadmap_gates.ts +4 -20
- package/src/agent-src/scripts/roadmap_set_step.ts +5 -2
- package/src/agent-src/scripts/stubs_due.ts +4 -18
- package/src/agent-src/scripts/update_roadmap_progress.ts +7 -24
- package/src/config/continuity-surface.json +509 -0
- package/src/config/estate-count-budget.json +1 -1
- package/src/config/gate-coverage.yml +29 -8
- package/src/config/gate-violation-baselines.json +8 -8
- package/src/config/gitignore-block.txt +19 -0
- package/src/config/host-injection-effect.json +73 -0
- package/src/config/packed-binary-manifest.json +33 -0
- package/src/config/preamble-payload-budget.json +112 -105
- package/src/config/publish-surface.json +4 -2
- package/src/install/claudeLayerCarriage.ts +273 -0
- package/src/install/claudePathsPlan.ts +76 -0
- package/src/install/hostLayerFingerprint.ts +1 -1
- package/src/install/partitionEligibility.ts +261 -127
- package/src/install/ruleLayerPartition.ts +19 -23
- package/src/scripts/_dispatch.bash +77 -27
- package/src/scripts/_lib/auto_dispatch.ts +2 -2
- package/src/scripts/_lib/catalogue_layer_parity.ts +146 -0
- package/src/scripts/_lib/continuity_surface.ts +296 -0
- package/src/scripts/_lib/corpus_manifest.ts +26 -9
- package/src/scripts/_lib/hook_settings.ts +1 -1
- package/src/scripts/_lib/injection_effect.ts +151 -0
- package/src/scripts/_lib/layer_overlap_notice.ts +50 -6
- package/src/scripts/_lib/packed_binary_predicate.ts +225 -0
- package/src/scripts/_lib/pin_resolver.ts +13 -0
- package/src/scripts/_lib/regression_neighbourhood.ts +1 -1
- package/src/scripts/_lib/retired_status.ts +74 -0
- package/src/scripts/_lib/skill_catalogue.ts +156 -21
- package/src/scripts/_lib/subagent_capsule.ts +117 -8
- package/src/scripts/ai_council/api_transport.ts +5 -0
- package/src/scripts/ai_council/deliberation_metrics.ts +353 -0
- package/src/scripts/ai_council/prompts.ts +9 -0
- package/src/scripts/ai_council/synthesis_disagreement.ts +206 -0
- package/src/scripts/capture_skill_catalogue.ts +24 -11
- package/src/scripts/check_candidate_lines.ts +499 -0
- package/src/scripts/check_continuity_surface.ts +475 -0
- package/src/scripts/check_dependency_floors.ts +13 -6
- package/src/scripts/check_estate_count.ts +40 -79
- package/src/scripts/check_pack_size.ts +262 -23
- package/src/scripts/check_roadmap_trackable.ts +19 -16
- package/src/scripts/check_rule_layer_partition.ts +54 -34
- package/src/scripts/check_single_delivery.ts +97 -31
- package/src/scripts/check_update_banner.ts +13 -0
- package/src/scripts/code_graph/build.ts +138 -15
- package/src/scripts/code_graph/cli.ts +76 -8
- package/src/scripts/code_graph/extract.ts +11 -0
- package/src/scripts/code_graph/grammar_probe.ts +43 -0
- package/src/scripts/code_graph/loader.ts +88 -14
- package/src/scripts/code_graph/query.ts +121 -11
- package/src/scripts/code_graph/resolution_tiers.ts +238 -0
- package/src/scripts/code_graph/sqlite_store.ts +247 -6
- package/src/scripts/code_graph/types.ts +66 -1
- package/src/scripts/code_graph/validate.ts +23 -0
- package/src/scripts/condense.ts +34 -22
- package/src/scripts/corpus_manifest.ts +5 -5
- package/src/scripts/council_cli.ts +11 -12
- package/src/scripts/count_intent_disagreement.ts +426 -0
- package/src/scripts/handoff_context_hook.ts +79 -0
- package/src/scripts/hook_effect_doctor.ts +82 -1
- package/src/scripts/hook_manifest.json +1 -1
- package/src/scripts/hook_manifest.yaml +64 -12
- package/src/scripts/hooks/chain_nudge_hook.ts +282 -0
- package/src/scripts/hooks/code_graph_context_hook.ts +212 -0
- package/src/scripts/hooks/concern_registry.ts +4 -2
- package/src/scripts/hooks/host_semantics.ts +1 -1
- package/src/scripts/hooks/orchestration_record_hook.ts +2 -2
- package/src/scripts/hooks/rule_inject_hook.ts +1 -1
- package/src/scripts/hooks/skill_route_hook.ts +11 -4
- package/src/scripts/inbox_source_census.ts +322 -0
- package/src/scripts/install-hooks.sh +82 -0
- package/src/scripts/{lint_carrier_integrity.ts → lint_deferral_integrity.ts} +60 -214
- package/src/scripts/lint_plan_risk_register.ts +13 -17
- package/src/scripts/mcp_server/suggest_skill.ts +72 -0
- package/src/scripts/mcp_server/tools.ts +2 -56
- package/src/scripts/media/lib/adapter-contract.md +7 -2
- package/src/scripts/media/lib/fixtures/flux/asset-0001.png +0 -0
- package/src/scripts/media/lib/fixtures/gemini-image/asset-0001.png +0 -0
- package/src/scripts/media/lib/fixtures/ideogram/asset-0001.png +0 -0
- package/src/scripts/rdp_candidates_delta.ts +276 -0
- package/src/scripts/rdp_quality_eval.ts +217 -19
- package/src/scripts/release_mix_taxonomy.json +3 -2
- package/src/scripts/report_host_injection_effect.ts +189 -0
- package/src/scripts/report_layer_overlap.ts +41 -0
- package/src/scripts/report_skill_menu_census.ts +341 -0
- package/src/scripts/skill_tools/score_skill_relevance.ts +70 -6
- package/src/scripts/skill_tools/suggest_skill_for_task.ts +37 -3
- package/src/vendor/grammars/README.md +61 -0
- package/src/vendor/grammars/tree-sitter-javascript.wasm +0 -0
- package/src/vendor/grammars/tree-sitter-php.wasm +0 -0
- package/src/vendor/grammars/tree-sitter-typescript.wasm +0 -0
- package/src/scripts/_lib/carrier_status.ts +0 -118
- package/src/scripts/_lib/estate_carrier_cases.ts +0 -72
- package/src/scripts/hooks/code_graph_nudge_hook.ts +0 -191
|
@@ -8,7 +8,7 @@
|
|
|
8
8
|
* ADR-236 decided that a rule is delivered from exactly one layer: package-only
|
|
9
9
|
* rules stay in the project tree, everything else arrives from the host's global
|
|
10
10
|
* directory and is withheld from the project tree. Measured in a freshly
|
|
11
|
-
* generated worktree with
|
|
11
|
+
* generated worktree with a verified host layer, it holds for one host in five:
|
|
12
12
|
*
|
|
13
13
|
* ```
|
|
14
14
|
* .claude/rules 13 files, 13 package-only, 0 global-only
|
|
@@ -51,7 +51,7 @@ import * as fs from 'node:fs';
|
|
|
51
51
|
import * as os from 'node:os';
|
|
52
52
|
import * as path from 'node:path';
|
|
53
53
|
|
|
54
|
-
import { isExclusivelyPackageOnly
|
|
54
|
+
import { isExclusivelyPackageOnly } from '../install/partitionEligibility.js';
|
|
55
55
|
import { PROJECT_RULE_DIRS, globalRuleLayerNames, globalRuleLayerPath } from '../install/globalRuleLayers.js';
|
|
56
56
|
import { GateLedger, UnaccountedTargetsError } from './_lib/gate_ledger.js';
|
|
57
57
|
import { reportScanned } from './_lib/scan_scope.js';
|
|
@@ -333,7 +333,7 @@ function selfTest(): number {
|
|
|
333
333
|
/**
|
|
334
334
|
* `--prune`: delete exactly the files this gate reports as duplicated.
|
|
335
335
|
*
|
|
336
|
-
*
|
|
336
|
+
* **Why a gate ships a repair at all.**
|
|
337
337
|
*
|
|
338
338
|
* The documented repair is `task generate-tools`, and on this repository's own main
|
|
339
339
|
* checkout that command is **structurally inert**: `agents/.agent-tools.yml` is
|
|
@@ -381,17 +381,39 @@ function prune(audit: PartitionAudit, root: string): number {
|
|
|
381
381
|
}
|
|
382
382
|
|
|
383
383
|
/**
|
|
384
|
-
* Does
|
|
385
|
-
*
|
|
384
|
+
* Does THIS directory's duplication mean an emitter failed, or that the
|
|
385
|
+
* per-directory fail-safe legitimately kept the full projection?
|
|
386
386
|
*
|
|
387
|
-
*
|
|
388
|
-
*
|
|
389
|
-
*
|
|
390
|
-
*
|
|
391
|
-
*
|
|
387
|
+
* **The discriminator, corrected 2026-09-07 after a neutral review.**
|
|
388
|
+
*
|
|
389
|
+
* It used to be the repo-wide host-layer verdict — first a `PartitionMode`
|
|
390
|
+
* string, then the `verified` boolean the 2026-09-07 change reduced it to. Both
|
|
391
|
+
* were wrong in BOTH directions once the withhold stopped reading
|
|
392
|
+
* `installed.lock`:
|
|
393
|
+
*
|
|
394
|
+
* - FALSE NEGATIVE: an install one release behind makes `verified === false`
|
|
395
|
+
* for the whole release window, so a genuine emitter failure — the defect
|
|
396
|
+
* this gate exists to catch — printed and returned 0.
|
|
397
|
+
* - FALSE POSITIVE: a verified layer that legitimately lacks ONE rule makes
|
|
398
|
+
* `partitionRulesForDir` keep all ~104 by design (rules are all-or-nothing,
|
|
399
|
+
* `ruleLayerPartition.ts`), and the gate exited 1 on a correct tree.
|
|
400
|
+
* `rule_partition_per_host.test.ts` pins that state as legal.
|
|
401
|
+
*
|
|
402
|
+
* The right signal was already computed and never asked: `soleCarrier` — the
|
|
403
|
+
* global-scope rules this directory projects that its host layer does NOT hold.
|
|
404
|
+
* Non-empty means the fail-safe fired for a reason a reader can check; empty
|
|
405
|
+
* means the layer carries every withheld name and the emitter simply did not
|
|
406
|
+
* withhold. Per directory, from data on hand, and independent of any lockfile —
|
|
407
|
+
* so the verdict no longer differs between a maintainer machine mid-release and
|
|
408
|
+
* a CI checkout.
|
|
409
|
+
*
|
|
410
|
+
* Also note what a stale layer can NOT do under per-name withholding: if the
|
|
411
|
+
* layer holds the name, the project copy is withheld whatever its CONTENT. So
|
|
412
|
+
* staleness never produces a duplicate, and the old message's second
|
|
413
|
+
* justification was keyed on the wrong fact.
|
|
392
414
|
*/
|
|
393
|
-
export function partitionEnforces(
|
|
394
|
-
return
|
|
415
|
+
export function partitionEnforces(dir: Pick<DirAudit, 'soleCarrier'>): boolean {
|
|
416
|
+
return dir.soleCarrier.length === 0;
|
|
395
417
|
}
|
|
396
418
|
|
|
397
419
|
export function main(argv: readonly string[] = process.argv.slice(2)): number {
|
|
@@ -485,34 +507,32 @@ export function main(argv: readonly string[] = process.argv.slice(2)): number {
|
|
|
485
507
|
// partition gate and `check_bridge_derivation` deadlock, each red in the state
|
|
486
508
|
// the other requires.
|
|
487
509
|
//
|
|
488
|
-
//
|
|
489
|
-
//
|
|
490
|
-
//
|
|
491
|
-
//
|
|
492
|
-
// measuring the release.
|
|
510
|
+
// Split PER DIRECTORY, not on a repo-wide verdict — see `partitionEnforces` for
|
|
511
|
+
// why the verdict was wrong in both directions. A directory that is the sole
|
|
512
|
+
// carrier of at least one global-scope rule kept the full projection by design;
|
|
513
|
+
// one that carries none is an emitter that did not withhold.
|
|
493
514
|
//
|
|
494
|
-
//
|
|
495
|
-
//
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
515
|
+
// In CI both layers are absent, `offenders` is empty, and neither branch is
|
|
516
|
+
// reached — so nothing here changes the CI reading.
|
|
517
|
+
const failing = offenders.filter((d) => partitionEnforces(d));
|
|
518
|
+
for (const d of offenders.filter((d) => !partitionEnforces(d))) {
|
|
519
|
+
process.stdout.write(
|
|
520
|
+
`⚠️ ${d.dir}: ${String(d.duplicated.length)} rule(s) also present in ` +
|
|
521
|
+
`${d.globalLayer ?? '(unknown)'} — kept by design: this directory is the sole ` +
|
|
522
|
+
`carrier of ${String(d.soleCarrier.length)} global-scope rule(s) ` +
|
|
523
|
+
`(e.g. ${d.soleCarrier.slice(0, 3).join(', ')}), and the rule partition is ` +
|
|
524
|
+
`all-or-nothing per directory.\n`,
|
|
525
|
+
);
|
|
526
|
+
}
|
|
527
|
+
if (failing.length === 0) {
|
|
506
528
|
process.stdout.write(
|
|
507
|
-
|
|
508
|
-
`
|
|
509
|
-
`working. Reported, not enforced — run \`agent-config install\` to activate the ` +
|
|
510
|
-
`partition here, then this gate has teeth again.\n`,
|
|
529
|
+
`✅ check_rule_layer_partition: every duplication is the per-directory fail-safe ` +
|
|
530
|
+
`working — no directory duplicates a rule its host layer fully carries.\n`,
|
|
511
531
|
);
|
|
512
532
|
return 0;
|
|
513
533
|
}
|
|
514
534
|
|
|
515
|
-
for (const d of
|
|
535
|
+
for (const d of failing) {
|
|
516
536
|
process.stderr.write(
|
|
517
537
|
`${report ? '⚠️ ' : '❌ '} ${d.dir}: ${String(d.duplicated.length)} rule(s) also present in ` +
|
|
518
538
|
`${d.globalLayer ?? '(unknown)'} — e.g. ${d.duplicated.slice(0, 5).join(', ')}\n`,
|
|
@@ -34,15 +34,31 @@
|
|
|
34
34
|
* fix, which teaches readers to ignore it — the exact failure this estate has
|
|
35
35
|
* recorded twice already.
|
|
36
36
|
*
|
|
37
|
-
* The reason
|
|
38
|
-
*
|
|
39
|
-
*
|
|
40
|
-
* `**Status:** resolved
|
|
41
|
-
*
|
|
42
|
-
*
|
|
43
|
-
*
|
|
44
|
-
*
|
|
45
|
-
* the
|
|
37
|
+
* The reason has been corrected twice rather than left standing. It was first
|
|
38
|
+
* that `road-to-single-delivery` Phase 2 was HALTED on blocker
|
|
39
|
+
* `partition-current-layer-undecidable` — no longer true; that blocker reads
|
|
40
|
+
* `**Status:** resolved` and the partition shipped under ADR-236 Phase 2. It was
|
|
41
|
+
* then a per-machine activation: the partition withheld only where the host layer
|
|
42
|
+
* verified against `installed.lock`, so an install one release behind kept the
|
|
43
|
+
* FULL projection by design and the overlap here was the fail-safe working.
|
|
44
|
+
*
|
|
45
|
+
* That second reason is void as of the ADR-236 amendment of 2026-09-07. The
|
|
46
|
+
* withhold no longer reads `installed.lock` at all — it reads each host
|
|
47
|
+
* directory's own contents, per NAME. An overlap this gate reports is therefore
|
|
48
|
+
* one of exactly two things now, and neither is a repo-wide fail-safe:
|
|
49
|
+
*
|
|
50
|
+
* - an artefact the host layer genuinely does NOT hold, kept on its own merits
|
|
51
|
+
* (the per-name fail-safe, and the right answer);
|
|
52
|
+
* - an emitter that failed to withhold what the evidence said to withhold
|
|
53
|
+
* (a defect).
|
|
54
|
+
*
|
|
55
|
+
* It still reports rather than enforcing, for the unchanged reason above. The
|
|
56
|
+
* second reason an earlier draft of this note gave — that the `commands` row's
|
|
57
|
+
* cluster-DIRECTORY key could read a correct tree as a collision — was true when
|
|
58
|
+
* written and was fixed in the same change: that row keys on the posix subpath
|
|
59
|
+
* now (see TYPES). Left recorded rather than deleted, because the argument is
|
|
60
|
+
* what justified `--enforce` staying opt-in and a reader should see that it no
|
|
61
|
+
* longer applies.
|
|
46
62
|
*
|
|
47
63
|
* WHERE THIS CHECK IS MEANINGFUL — read this before quoting one of its numbers
|
|
48
64
|
* (road-to-session-closeout 3.3). It is a DEVELOPER-MACHINE check. It reads two
|
|
@@ -100,13 +116,23 @@ const REPO_ROOT = path.resolve(path.dirname(_HERE), '..', '..');
|
|
|
100
116
|
* (`commands/<cluster>/<sub>.md`), so this gate's `commands` row compares cluster
|
|
101
117
|
* DIRECTORY names — a coarser key than the thing the host registers.
|
|
102
118
|
*
|
|
103
|
-
* That gap
|
|
104
|
-
*
|
|
105
|
-
* host layer
|
|
106
|
-
*
|
|
107
|
-
*
|
|
108
|
-
*
|
|
109
|
-
*
|
|
119
|
+
* That gap USED to be recorded rather than closed, on a measurement: while the
|
|
120
|
+
* colon-form generator was gated by one repo-wide verdict, a machine with a
|
|
121
|
+
* verified host layer projected ZERO commands and a machine without one had
|
|
122
|
+
* nothing to compare — so the coarse key was imprecise exactly where it had no
|
|
123
|
+
* work to do.
|
|
124
|
+
*
|
|
125
|
+
* **The ADR-236 amendment of 2026-09-07 falsified that, and it was OBSERVED, not
|
|
126
|
+
* predicted.** Withholding per name leaves the project layer holding exactly the
|
|
127
|
+
* commands the host lacks, and those can share a cluster with commands the host
|
|
128
|
+
* has: measured the same day, `.claude/commands/analyze/` held `repo.md` and
|
|
129
|
+
* `roadmap-repos.md` while `~/.claude/commands/analyze/` held `inbox.md` and
|
|
130
|
+
* seven others. Zero duplication, and the directory key reported a collision.
|
|
131
|
+
*
|
|
132
|
+
* So the `commands` row now keys on the POSIX SUBPATH (`<cluster>/<sub>.md`),
|
|
133
|
+
* which is the host's own unit. `readLayer` takes a `recursive` flag for it;
|
|
134
|
+
* `shape` stays a top-level reading so the shape-mismatch line keeps comparing
|
|
135
|
+
* the same thing it always did.
|
|
110
136
|
*
|
|
111
137
|
* `personas` and `user-types` were added 2026-08-21 (closure correction). See
|
|
112
138
|
* `unknownProjectFamilies` for what now prevents the next omission.
|
|
@@ -182,7 +208,7 @@ interface LayerReading {
|
|
|
182
208
|
shape: LayerShape;
|
|
183
209
|
}
|
|
184
210
|
|
|
185
|
-
function readLayer(dir: string): LayerReading | null {
|
|
211
|
+
function readLayer(dir: string, recursive = false): LayerReading | null {
|
|
186
212
|
let entries: fs.Dirent[];
|
|
187
213
|
try {
|
|
188
214
|
if (!fs.statSync(dir).isDirectory()) return null;
|
|
@@ -191,7 +217,11 @@ function readLayer(dir: string): LayerReading | null {
|
|
|
191
217
|
return null;
|
|
192
218
|
}
|
|
193
219
|
const shape: LayerShape = { symlinks: 0, dirs: 0, files: 0 };
|
|
194
|
-
|
|
220
|
+
// README.md is excluded from BOTH the names and the shape. Counting it in the
|
|
221
|
+
// shape while filtering it from the names printed a self-contradicting line
|
|
222
|
+
// (`personas global 31 · shape (l0/d2/f30)` — 32 entries, 31 names), caught by
|
|
223
|
+
// a second neutral review.
|
|
224
|
+
for (const e of entries.filter((x) => x.name !== 'README.md')) {
|
|
195
225
|
// isSymbolicLink() is checked FIRST and deliberately: readdir with
|
|
196
226
|
// withFileTypes does not follow links, but a reader who tested isDirectory
|
|
197
227
|
// first would classify a symlink-to-directory as a directory and lose the
|
|
@@ -200,7 +230,41 @@ function readLayer(dir: string): LayerReading | null {
|
|
|
200
230
|
else if (e.isDirectory()) shape.dirs += 1;
|
|
201
231
|
else shape.files += 1;
|
|
202
232
|
}
|
|
203
|
-
|
|
233
|
+
if (!recursive) {
|
|
234
|
+
// README.md excluded for EVERY family, not only commands. It was excluded
|
|
235
|
+
// on the recursive path from the start and nowhere else, so a README in
|
|
236
|
+
// both layers would have counted as one duplicated artefact for rules,
|
|
237
|
+
// skills, personas, user-types and agents and not for commands — a latent
|
|
238
|
+
// asymmetry a neutral review caught on 2026-09-07. It names no artefact in
|
|
239
|
+
// any family.
|
|
240
|
+
return { names: entries.map((e) => e.name).filter((n) => n !== 'README.md').sort(), shape };
|
|
241
|
+
}
|
|
242
|
+
return { names: _mdSubpaths(dir).sort(), shape };
|
|
243
|
+
}
|
|
244
|
+
|
|
245
|
+
/**
|
|
246
|
+
* Every `*.md` under `dir`, as a posix path relative to it.
|
|
247
|
+
*
|
|
248
|
+
* The identity key for the `commands` row — see the note on TYPES. `README.md` is
|
|
249
|
+
* excluded because both layers carry one and it names no command.
|
|
250
|
+
*/
|
|
251
|
+
function _mdSubpaths(dir: string): string[] {
|
|
252
|
+
const out: string[] = [];
|
|
253
|
+
const walk = (abs: string, rel: string): void => {
|
|
254
|
+
let kids: fs.Dirent[];
|
|
255
|
+
try {
|
|
256
|
+
kids = fs.readdirSync(abs, { withFileTypes: true });
|
|
257
|
+
} catch {
|
|
258
|
+
return;
|
|
259
|
+
}
|
|
260
|
+
for (const k of kids) {
|
|
261
|
+
const childRel = rel === '' ? k.name : `${rel}/${k.name}`;
|
|
262
|
+
if (k.isDirectory()) walk(path.join(abs, k.name), childRel);
|
|
263
|
+
else if (k.name.endsWith('.md') && k.name !== 'README.md') out.push(childRel);
|
|
264
|
+
}
|
|
265
|
+
};
|
|
266
|
+
walk(dir, '');
|
|
267
|
+
return out;
|
|
204
268
|
}
|
|
205
269
|
|
|
206
270
|
/**
|
|
@@ -230,8 +294,9 @@ export function declaresPaths(file: string): 'yes' | 'no' | 'unreadable' {
|
|
|
230
294
|
export function readType(type: ArtefactType, globalRoot: string, projectRoot: string): TypeReading {
|
|
231
295
|
const gDir = path.join(globalRoot, type);
|
|
232
296
|
const pDir = path.join(projectRoot, type);
|
|
233
|
-
const
|
|
234
|
-
const
|
|
297
|
+
const recursive = type === 'commands';
|
|
298
|
+
const gLayer = readLayer(gDir, recursive);
|
|
299
|
+
const pLayer = readLayer(pDir, recursive);
|
|
235
300
|
const globalNames = gLayer?.names ?? null;
|
|
236
301
|
const projectNames = pLayer?.names ?? null;
|
|
237
302
|
const globalShape = gLayer?.shape ?? null;
|
|
@@ -500,11 +565,12 @@ export function main(argv?: readonly string[]): number {
|
|
|
500
565
|
process.stdout.write(
|
|
501
566
|
'usage: check_single_delivery [--global DIR] [--project DIR] [--enforce] [--quiet]\n' +
|
|
502
567
|
'\n' +
|
|
503
|
-
'Reports by default and exits 0: the
|
|
504
|
-
'
|
|
505
|
-
'
|
|
506
|
-
'
|
|
507
|
-
'
|
|
568
|
+
'Reports by default and exits 0: since the ADR-236 amendment of\n' +
|
|
569
|
+
'2026-09-07 the project layer withholds per ARTEFACT NAME on each host\n' +
|
|
570
|
+
"directory's own contents, so an artefact the host layer does not hold is\n" +
|
|
571
|
+
'kept BY DESIGN and reads as overlap here. --enforce exits 1 on any\n' +
|
|
572
|
+
'overlap. It stays opt-in because a machine whose global layer is stale\n' +
|
|
573
|
+
'cannot fix the overlap by regenerating — only by `agent-config install`.\n',
|
|
508
574
|
);
|
|
509
575
|
return 0;
|
|
510
576
|
} else if (a !== undefined) {
|
|
@@ -626,11 +692,11 @@ export function main(argv?: readonly string[]): number {
|
|
|
626
692
|
}
|
|
627
693
|
process.stdout.write(
|
|
628
694
|
`⚠️ check_single_delivery: ${detail}. Reported, not enforced — ` +
|
|
629
|
-
'the
|
|
630
|
-
|
|
631
|
-
'
|
|
632
|
-
'and
|
|
633
|
-
'
|
|
695
|
+
'since the ADR-236 amendment of 2026-09-07 the project layer withholds per ' +
|
|
696
|
+
"ARTEFACT NAME on each host directory's own contents, never on a version in " +
|
|
697
|
+
'`installed.lock`. So an artefact the host layer does not hold is kept BY DESIGN ' +
|
|
698
|
+
'and appears here; a stale global layer is fixed by `agent-config install`. Use ' +
|
|
699
|
+
'--enforce where every layer is known current.\n',
|
|
634
700
|
);
|
|
635
701
|
return 0;
|
|
636
702
|
}
|
|
@@ -157,10 +157,23 @@ async function main(argv: readonly string[] = process.argv.slice(2)): Promise<nu
|
|
|
157
157
|
return 0;
|
|
158
158
|
}
|
|
159
159
|
|
|
160
|
+
// `build:delegate-aux` bundles this file with `--splitting`, which can move the
|
|
161
|
+
// module body into a shared chunk: `import.meta.url` then names the CHUNK, the
|
|
162
|
+
// URL comparison below never matches, and the entry silently no-ops. Inside that
|
|
163
|
+
// bundle the invoked file name is the reliable signal (same pattern as
|
|
164
|
+
// src/scripts/_cli/cmd_migrate.ts). Defined by that build only.
|
|
165
|
+
declare const __AGENT_CONFIG_CLI_DELEGATE__: boolean | undefined;
|
|
160
166
|
function _isCliEntry(): boolean {
|
|
161
167
|
if (process.argv[1] === undefined) {
|
|
162
168
|
return false;
|
|
163
169
|
}
|
|
170
|
+
if (typeof __AGENT_CONFIG_CLI_DELEGATE__ !== 'undefined' && __AGENT_CONFIG_CLI_DELEGATE__) {
|
|
171
|
+
// A miss falls THROUGH to the URL comparison below, which is the
|
|
172
|
+
// symlinked-invocation case that fallback exists for.
|
|
173
|
+
if (path.basename(process.argv[1], '.js') === 'check_update_banner') {
|
|
174
|
+
return true;
|
|
175
|
+
}
|
|
176
|
+
}
|
|
164
177
|
const argvUrl = pathToFileURL(path.resolve(process.argv[1])).href;
|
|
165
178
|
if (import.meta.url === argvUrl) {
|
|
166
179
|
return true;
|
|
@@ -16,6 +16,17 @@ import * as path from 'node:path';
|
|
|
16
16
|
|
|
17
17
|
import { write_atomic } from '../_lib/fs_atomic.js';
|
|
18
18
|
import { extractFile, type FileExtract, type RawEdge } from './extract.js';
|
|
19
|
+
import {
|
|
20
|
+
ALIAS_VIA,
|
|
21
|
+
aliasRulesFrom,
|
|
22
|
+
EMPTY_RESOLUTION_CONFIG,
|
|
23
|
+
parseJsonc,
|
|
24
|
+
PSR4_VIA,
|
|
25
|
+
psr4RulesFrom,
|
|
26
|
+
type ResolutionConfig,
|
|
27
|
+
resolveAlias,
|
|
28
|
+
resolvePsr4,
|
|
29
|
+
} from './resolution_tiers.js';
|
|
19
30
|
import { emitSqliteTwin } from './sqlite_store.js';
|
|
20
31
|
import {
|
|
21
32
|
type CodeEdge,
|
|
@@ -24,6 +35,7 @@ import {
|
|
|
24
35
|
EXPECTED_GRAMMAR_ABI,
|
|
25
36
|
EXT_LANG,
|
|
26
37
|
type Lang,
|
|
38
|
+
type ResolvedVia,
|
|
27
39
|
SCHEMA_VERSION,
|
|
28
40
|
} from './types.js';
|
|
29
41
|
|
|
@@ -145,7 +157,9 @@ function satisfies(kind: string | undefined, want: Capability): boolean {
|
|
|
145
157
|
*/
|
|
146
158
|
interface FileScope {
|
|
147
159
|
locals: Map<string, string[]>;
|
|
148
|
-
|
|
160
|
+
/** `via` records WHICH tier produced the binding, so an edge built from it
|
|
161
|
+
* reports the mechanism instead of assuming `import-specifier`. */
|
|
162
|
+
imports: Map<string, { target: string; exact: boolean; via: ResolvedVia }>;
|
|
149
163
|
}
|
|
150
164
|
|
|
151
165
|
const REL_EXTS = ['.ts', '.tsx', '.mts', '.cts', '.js', '.jsx', '.mjs', '.cjs'];
|
|
@@ -199,11 +213,40 @@ function push(map: Map<string, string[]>, k: string, v: string): void {
|
|
|
199
213
|
} else map.set(k, [v]);
|
|
200
214
|
}
|
|
201
215
|
|
|
216
|
+
/**
|
|
217
|
+
* Read the project's declared resolution tiers from `root` (2.3).
|
|
218
|
+
*
|
|
219
|
+
* IO lives here rather than in `buildGraph`, which stays pure so identical
|
|
220
|
+
* source plus identical config yields identical bytes. A missing or
|
|
221
|
+
* unparseable config is not an error — it degrades to no tiers, which is the
|
|
222
|
+
* behaviour every build had before this existed.
|
|
223
|
+
*
|
|
224
|
+
* `tsconfig.json` is read as JSONC: it is JSONC by convention and this
|
|
225
|
+
* repository's own carries `//` comments, so `JSON.parse` on it throws.
|
|
226
|
+
*/
|
|
227
|
+
export function readResolutionConfig(root: string): ResolutionConfig {
|
|
228
|
+
const read = (name: string): unknown | null => {
|
|
229
|
+
try {
|
|
230
|
+
return parseJsonc(fs.readFileSync(path.join(root, name), 'utf-8'));
|
|
231
|
+
} catch {
|
|
232
|
+
return null;
|
|
233
|
+
}
|
|
234
|
+
};
|
|
235
|
+
return {
|
|
236
|
+
aliases: aliasRulesFrom(read('tsconfig.json')),
|
|
237
|
+
psr4: psr4RulesFrom(read('composer.json')),
|
|
238
|
+
};
|
|
239
|
+
}
|
|
240
|
+
|
|
202
241
|
/**
|
|
203
242
|
* Pure, deterministic graph build over an in-memory file set. Exposed for
|
|
204
243
|
* tests (no IO). `buildFromRepo` is the IO wrapper.
|
|
205
244
|
*/
|
|
206
|
-
export function buildGraph(
|
|
245
|
+
export function buildGraph(
|
|
246
|
+
files: readonly SourceFile[],
|
|
247
|
+
extracts: readonly FileExtract[],
|
|
248
|
+
resolution: ResolutionConfig = EMPTY_RESOLUTION_CONFIG,
|
|
249
|
+
): CodeGraph {
|
|
207
250
|
const nodes = extracts.flatMap((e) => e.nodes);
|
|
208
251
|
const nodeIds = new Set(nodes.map((n) => n.id));
|
|
209
252
|
|
|
@@ -277,7 +320,7 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
277
320
|
for (const ex of extracts) {
|
|
278
321
|
const locals = new Map<string, string[]>();
|
|
279
322
|
for (const n of ex.nodes) if (n.kind !== 'file') push(locals, n.label, n.id);
|
|
280
|
-
const imports = new Map<string, { target: string; exact: boolean }>();
|
|
323
|
+
const imports = new Map<string, { target: string; exact: boolean; via: ResolvedVia }>();
|
|
281
324
|
for (const r of ex.rawEdges) {
|
|
282
325
|
if (r.relation !== 'imports') continue;
|
|
283
326
|
const local = r.localName ?? r.targetName;
|
|
@@ -285,29 +328,58 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
285
328
|
const spec = r.moduleSpecifier;
|
|
286
329
|
if (spec === undefined) {
|
|
287
330
|
// PHP `use A\B\C` — a fully-qualified NAME, not a module path.
|
|
288
|
-
//
|
|
289
|
-
//
|
|
331
|
+
//
|
|
332
|
+
// TIER 1 (2.3): composer PSR-4 maps the NAMESPACE to a
|
|
333
|
+
// directory, so the class file is named outright. That is a
|
|
334
|
+
// declared mapping, hence `exact: true` — and it is the only
|
|
335
|
+
// rung that can tell two same-named classes in different
|
|
336
|
+
// namespaces apart.
|
|
337
|
+
const fq = r.fqName ?? r.targetName;
|
|
338
|
+
const psr4File = resolvePsr4(fq, resolution, fileIds);
|
|
339
|
+
if (psr4File !== null) {
|
|
340
|
+
const member = `${psr4File}#${r.targetName}`;
|
|
341
|
+
imports.set(local, {
|
|
342
|
+
target: nodeKind.has(member) ? member : psr4File,
|
|
343
|
+
exact: true,
|
|
344
|
+
via: PSR4_VIA,
|
|
345
|
+
});
|
|
346
|
+
continue;
|
|
347
|
+
}
|
|
348
|
+
// TIER 2: base name, namespace discarded. A lookup, not a
|
|
349
|
+
// syntactic fact: `exact: false`.
|
|
290
350
|
const hit =
|
|
291
351
|
sym.classByName.get(k(ex.lang, r.targetName)) ??
|
|
292
352
|
(sym.byName.get(k(ex.lang, r.targetName)) ?? []).find((id) => id.includes('#') && !id.includes('::'));
|
|
293
|
-
if (hit) imports.set(local, { target: hit, exact: false });
|
|
353
|
+
if (hit) imports.set(local, { target: hit, exact: false, via: 'name-lookup' });
|
|
294
354
|
continue;
|
|
295
355
|
}
|
|
296
|
-
|
|
356
|
+
// TIER 0: a relative specifier — the file says where it points.
|
|
357
|
+
// TIER 1 (2.3): tsconfig `paths`. `@shared/x` IS `src/shared/x`
|
|
358
|
+
// because the project declares it, so this is a fact and not a
|
|
359
|
+
// guess. Without it the specifier is non-relative, `resolveSpecifier`
|
|
360
|
+
// returns null, and the import binds to `external:@shared/x` — a
|
|
361
|
+
// real module, correctly named, and the wrong one.
|
|
362
|
+
const relFile = resolveSpecifier(ex.file, spec, fileIds);
|
|
363
|
+
const aliasFile = relFile === null ? resolveAlias(spec, resolution, fileIds) : null;
|
|
364
|
+
const file = relFile ?? aliasFile;
|
|
297
365
|
if (file === null) {
|
|
298
366
|
// Bare (`node:path`, `zod`) or relative-but-out-of-root. Either
|
|
299
367
|
// way the module is real and NAMED, and it is not this
|
|
300
368
|
// repository's same-named symbol. `import * as path from
|
|
301
369
|
// 'node:path'` ends here, which is the whole of 1.1.
|
|
302
370
|
const named = r.importKind === 'named';
|
|
303
|
-
imports.set(local, {
|
|
371
|
+
imports.set(local, {
|
|
372
|
+
target: named ? `external:${spec}#${r.targetName}` : `external:${spec}`,
|
|
373
|
+
exact: true,
|
|
374
|
+
via: 'import-specifier',
|
|
375
|
+
});
|
|
304
376
|
continue;
|
|
305
377
|
}
|
|
306
378
|
// A namespace or default import binds the MODULE, never a
|
|
307
379
|
// same-named export inside it.
|
|
308
380
|
const member = `${file}#${r.targetName}`;
|
|
309
381
|
const target = r.importKind === 'named' && nodeKind.has(member) ? member : file;
|
|
310
|
-
imports.set(local, { target, exact: true });
|
|
382
|
+
imports.set(local, { target, exact: true, via: aliasFile === null ? 'import-specifier' : ALIAS_VIA });
|
|
311
383
|
}
|
|
312
384
|
scopes.set(ex.file, { locals, imports });
|
|
313
385
|
}
|
|
@@ -327,13 +399,23 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
327
399
|
want: Capability,
|
|
328
400
|
lang: Lang,
|
|
329
401
|
scopeOnly = false,
|
|
330
|
-
): { target: string; confidence: EdgeConfidence } | null => {
|
|
402
|
+
): { target: string; confidence: EdgeConfidence; via: ResolvedVia } | null => {
|
|
331
403
|
const scope = scopes.get(file) ?? emptyScope;
|
|
404
|
+
// The ladder's rungs ARE the mechanism taxonomy, so `via` is read off
|
|
405
|
+
// the branch that succeeded rather than inferred afterwards.
|
|
332
406
|
for (const id of scope.locals.get(name) ?? [])
|
|
333
|
-
if (satisfies(nodeKind.get(id), want))
|
|
407
|
+
if (satisfies(nodeKind.get(id), want))
|
|
408
|
+
return { target: id, confidence: 'EXTRACTED', via: 'same-file' };
|
|
334
409
|
const bound = scope.imports.get(name);
|
|
335
410
|
if (bound && satisfies(nodeKind.get(bound.target), want))
|
|
336
|
-
return {
|
|
411
|
+
return {
|
|
412
|
+
target: bound.target,
|
|
413
|
+
confidence: bound.exact ? 'EXTRACTED' : 'INFERRED',
|
|
414
|
+
// The binding knows how it was made — a tsconfig alias and a
|
|
415
|
+
// PSR-4 namespace are not import specifiers and must not be
|
|
416
|
+
// reported as ones.
|
|
417
|
+
via: bound.via,
|
|
418
|
+
};
|
|
337
419
|
if (scopeOnly) return null;
|
|
338
420
|
const wide =
|
|
339
421
|
want === 'constructible'
|
|
@@ -344,10 +426,19 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
344
426
|
// Reached only by matching a name across the whole repository, with no
|
|
345
427
|
// binding in this file to justify it. That is not a syntactic fact and
|
|
346
428
|
// no longer claims to be one.
|
|
347
|
-
if (wide) return { target: wide, confidence: 'INFERRED' };
|
|
429
|
+
if (wide) return { target: wide, confidence: 'INFERRED', via: 'name-lookup' };
|
|
348
430
|
return null;
|
|
349
431
|
};
|
|
350
432
|
|
|
433
|
+
/**
|
|
434
|
+
* The mechanism for an edge whose target did not resolve.
|
|
435
|
+
*
|
|
436
|
+
* A `symbol:` pseudo-target is the residue of a name lookup that found
|
|
437
|
+
* nothing, so `name-lookup` is what actually happened. `confidence` already
|
|
438
|
+
* carries whether it resolved; this field carries what was tried.
|
|
439
|
+
*/
|
|
440
|
+
const UNRESOLVED_VIA: ResolvedVia = 'name-lookup';
|
|
441
|
+
|
|
351
442
|
// Deduped the same way emitted edges are, so the count is comparable to
|
|
352
443
|
// `edges.length` rather than being a raw call-site tally that reads as a
|
|
353
444
|
// larger loss than the graph actually took.
|
|
@@ -372,6 +463,8 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
372
463
|
target: hit?.target ?? `symbol:${inh.parentName}`,
|
|
373
464
|
relation: 'inherits',
|
|
374
465
|
confidence: hit?.confidence ?? 'EXTRACTED',
|
|
466
|
+
resolved_via: hit?.via ?? UNRESOLVED_VIA,
|
|
467
|
+
provider: 'native',
|
|
375
468
|
});
|
|
376
469
|
}
|
|
377
470
|
for (const r of ex.rawEdges) resolveRawEdge(r, ex);
|
|
@@ -386,6 +479,11 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
386
479
|
target: nodeIds.has(target) ? target : `symbol:${r.targetName}`,
|
|
387
480
|
relation: 'member',
|
|
388
481
|
confidence: 'EXTRACTED',
|
|
482
|
+
// A member id is DERIVED from its own source node's id, so the
|
|
483
|
+
// declaration is in the same file by construction — no lookup
|
|
484
|
+
// of any kind happens here.
|
|
485
|
+
resolved_via: nodeIds.has(target) ? 'same-file' : UNRESOLVED_VIA,
|
|
486
|
+
provider: 'native',
|
|
389
487
|
});
|
|
390
488
|
return;
|
|
391
489
|
}
|
|
@@ -400,6 +498,8 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
400
498
|
target: bound?.target ?? `symbol:${r.targetName}`,
|
|
401
499
|
relation: 'imports',
|
|
402
500
|
confidence: bound ? (bound.exact ? 'EXTRACTED' : 'INFERRED') : 'EXTRACTED',
|
|
501
|
+
resolved_via: bound ? bound.via : UNRESOLVED_VIA,
|
|
502
|
+
provider: 'native',
|
|
403
503
|
});
|
|
404
504
|
return;
|
|
405
505
|
}
|
|
@@ -416,6 +516,8 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
416
516
|
target: hit?.target ?? `symbol:${r.targetName}`,
|
|
417
517
|
relation: 'uses',
|
|
418
518
|
confidence: hit?.confidence ?? 'EXTRACTED',
|
|
519
|
+
resolved_via: hit?.via ?? UNRESOLVED_VIA,
|
|
520
|
+
provider: 'native',
|
|
419
521
|
});
|
|
420
522
|
return;
|
|
421
523
|
}
|
|
@@ -433,13 +535,25 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
433
535
|
// EXTRACTED is a claim about a SPECIFIC in-repo node reached by
|
|
434
536
|
// name alone.
|
|
435
537
|
confidence: hit?.confidence ?? 'EXTRACTED',
|
|
538
|
+
resolved_via: hit?.via ?? UNRESOLVED_VIA,
|
|
539
|
+
provider: 'native',
|
|
436
540
|
});
|
|
437
541
|
return;
|
|
438
542
|
}
|
|
439
543
|
if (r.callStyle === 'this' || r.callStyle === 'self' || r.callStyle === 'static' || r.callStyle === 'parent') {
|
|
440
544
|
const hit = r.enclosingClassId ? resolveHierMethod(r.enclosingClassId, r.targetName) : null;
|
|
441
545
|
if (hit) {
|
|
442
|
-
emit({
|
|
546
|
+
emit({
|
|
547
|
+
source: r.sourceId,
|
|
548
|
+
target: hit,
|
|
549
|
+
relation: 'calls',
|
|
550
|
+
confidence: 'INFERRED',
|
|
551
|
+
// Walked the class hierarchy, which is same-file only when
|
|
552
|
+
// the declaring class is; the honest mechanism for a
|
|
553
|
+
// hierarchy walk is the repo-wide method table.
|
|
554
|
+
resolved_via: 'name-lookup',
|
|
555
|
+
provider: 'native',
|
|
556
|
+
});
|
|
443
557
|
} else {
|
|
444
558
|
// enclosing class extends an out-of-repo base → honest AMBIGUOUS
|
|
445
559
|
const cands = methodCandidates(r.targetName, ex.lang);
|
|
@@ -448,6 +562,8 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
448
562
|
target: ambiguousTarget(cands, r.targetName),
|
|
449
563
|
relation: 'calls',
|
|
450
564
|
confidence: 'AMBIGUOUS',
|
|
565
|
+
resolved_via: 'dynamic',
|
|
566
|
+
provider: 'native',
|
|
451
567
|
// The enclosing class extends a base outside this
|
|
452
568
|
// repository, so the method is not findable HERE — a
|
|
453
569
|
// different cause from a call whose receiver is unknown,
|
|
@@ -486,6 +602,8 @@ export function buildGraph(files: readonly SourceFile[], extracts: readonly File
|
|
|
486
602
|
target: ambiguousTarget(cands, r.targetName),
|
|
487
603
|
relation: 'calls',
|
|
488
604
|
confidence: 'AMBIGUOUS',
|
|
605
|
+
resolved_via: 'dynamic',
|
|
606
|
+
provider: 'native',
|
|
489
607
|
// Receiver type unknown: `$obj->m()` or an unresolved `C::m()`.
|
|
490
608
|
// Resolving this needs type inference the extractor does not do,
|
|
491
609
|
// which is exactly what 1.2 has to decide about rather than assume.
|
|
@@ -583,6 +701,11 @@ export function serializeGraph(g: CodeGraph): string {
|
|
|
583
701
|
target: e.target,
|
|
584
702
|
relation: e.relation,
|
|
585
703
|
confidence: e.confidence,
|
|
704
|
+
// Unconditional, unlike the two optional fields below: these are
|
|
705
|
+
// required on every edge, so emitting them conditionally would make
|
|
706
|
+
// an absent field mean "not set" instead of being impossible.
|
|
707
|
+
resolved_via: e.resolved_via,
|
|
708
|
+
provider: e.provider,
|
|
586
709
|
};
|
|
587
710
|
// Ordered before `candidates` deliberately: the reason is the coarser
|
|
588
711
|
// axis and a reader scanning the serialized graph sees WHY before HOW
|
|
@@ -684,7 +807,7 @@ export async function buildFromRepo(
|
|
|
684
807
|
nextSidecar.files[f.path] = { hash, extract };
|
|
685
808
|
}
|
|
686
809
|
|
|
687
|
-
const graph = buildGraph(files, extracts);
|
|
810
|
+
const graph = buildGraph(files, extracts, readResolutionConfig(root));
|
|
688
811
|
const json = serializeGraph(graph);
|
|
689
812
|
if (cachePath) {
|
|
690
813
|
write_atomic(cachePath, json);
|