@namewta/skills-hub 0.1.49 → 0.1.51
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/README.md +4 -1
- package/THIRD_PARTY_NOTICES.md +19 -7
- package/cli.mjs +2 -2
- package/install.mjs +11 -4
- package/package.json +1 -1
- package/scripts/persistence/home.md +1 -1
- package/skills/dev/dev-build/SKILL.md +2 -0
- package/skills/dev/dev-build/references/implement-request.md +7 -2
- package/skills/dev/dev-formal-verify/SKILL.md +2 -1
- package/skills/dev/dev-formal-verify/references/create-check.md +3 -1
- package/skills/dev/dev-formal-verify/references/example.md +1 -1
- package/skills/dev/dev-formal-verify/references/tool-choice.md +1 -1
- package/skills/dev/dev-help/references/capabilities.md +6 -6
- package/skills/dev/dev-help/references/guide-verification.md +7 -1
- package/skills/dev/dev-help/references/help-method.md +7 -1
- package/skills/dev/dev-issue/SKILL.md +1 -0
- package/skills/dev/dev-issue/references/github-operations.md +8 -0
- package/skills/dev/dev-plan/references/plan-template.md +1 -0
- package/skills/dev/dev-plan/references/vertical-slicing.md +2 -0
- package/skills/dev/dev-pr/references/pull-request-evidence.md +2 -0
- package/skills/dev/dev-review/references/host-parity.md +12 -0
- package/skills/dev/dev-review/references/review-baseline.md +2 -0
- package/skills/dev/dev-setup/references/formal-options.md +1 -1
- package/skills/dev/dev-statechart/SKILL.md +17 -19
- package/skills/dev/dev-statechart/agents/openai.yaml +3 -3
- package/skills/dev/dev-statechart/assets/theme.css +135 -0
- package/skills/dev/dev-statechart/references/lean-proof.md +47 -0
- package/skills/dev/dev-statechart/references/render.md +15 -83
- package/skills/dev/dev-statechart/references/runtime.md +21 -1
- package/skills/dev/dev-statechart/scripts/lean/backends/lemma-chart.mjs +285 -0
- package/skills/dev/dev-statechart/scripts/lean/backends/mermaid.mjs +174 -0
- package/skills/dev/dev-statechart/scripts/lean/backends/proof-chart.mjs +540 -0
- package/skills/dev/dev-statechart/scripts/lean/backends/report.mjs +242 -0
- package/skills/dev/dev-statechart/scripts/lean/frontends/facts.mjs +234 -0
- package/skills/dev/dev-statechart/scripts/lean/frontends/view.mjs +217 -0
- package/skills/dev/dev-statechart/scripts/lean/ir.mjs +226 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/attribute.mjs +148 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/blocks.mjs +32 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/budget.mjs +167 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/check.mjs +70 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/contract.mjs +160 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/fold.mjs +206 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/inline.mjs +84 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/mark.mjs +432 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/reduce.mjs +73 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/trust.mjs +111 -0
- package/skills/dev/dev-statechart/scripts/lean/passes/view-lemmas.mjs +155 -0
- package/skills/dev/dev-statechart/scripts/lean/pipeline.mjs +164 -0
- package/skills/dev/dev-statechart/scripts/lean/run.mjs +168 -0
- package/skills/dev/dev-statechart/scripts/statechart.mjs +42 -23
- package/skills/dev/dev-statechart/scripts/worker.mjs +33 -7
- package/skills/dev/dev-ui-design/SKILL.md +2 -2
- package/skills/dev/dev-ui-design/references/interaction-review.md +9 -0
- package/skills/dev/dev-verify/SKILL.md +1 -1
- package/skills/dev/dev-verify/references/evidence-storage.md +12 -0
- package/skills/dev/dev-workflow/SKILL.md +6 -6
- package/skills/dev/dev-workflow/references/method-handoffs.md +7 -1
- package/skills/dev/dev-writing/SKILL.md +2 -0
- package/skills/dev/dev-writing/references/library-docs.md +37 -0
- package/skills/home/home-doctor/references/diagnosis.md +2 -2
- package/skills/home/home-doctor/scripts/doctor.mjs +68 -38
- package/skills/home/home-project-changelog/SKILL.md +6 -6
- package/skills/home/home-project-changelog/assets/project-changelog.example.json +188 -0
- package/skills/home/home-project-changelog/assets/project-changelog.schema.json +156 -0
- package/skills/home/home-project-changelog/assets/worker-brief.md +1 -1
- package/skills/home/home-project-changelog/references/git-ranges.md +2 -2
- package/skills/home/home-project-changelog/references/schema.md +60 -0
- package/skills/home/home-project-changelog/references/tools.md +27 -22
- package/skills/home/home-project-changelog/references/workflow.md +12 -9
- package/skills/home/home-project-changelog/references/writing.md +5 -3
- package/skills/home/home-project-changelog/scripts/changelog.mjs +34 -37
- package/skills/home/home-project-changelog/scripts/contract.mjs +39 -3
- package/skills/home/home-project-changelog/scripts/legacy-markdown.mjs +116 -0
- package/skills/home/home-project-changelog/scripts/migrate.mjs +122 -0
- package/skills/home/home-project-changelog/scripts/revision.mjs +2 -196
- package/skills/home/home-project-changelog/scripts/storage.mjs +120 -125
- package/skills/home/home-project-changelog/scripts/summary.mjs +0 -60
- package/skills/home/home-route/SKILL.md +2 -2
- package/skills/home/home-route/references/routing.md +3 -1
- package/skills/home/home-route/scripts/route.mjs +79 -11
- package/skills/home/home-setup/SKILL.md +2 -1
- package/skills/home/home-setup/assets/repos.schema.json +10 -0
- package/skills/home/home-setup/references/registry.md +18 -1
- package/skills/home/home-setup/scripts/registry.mjs +67 -7
- package/skills/home/home-website/SKILL.md +13 -9
- package/skills/home/home-website/assets/website/scripts/inputs.mjs +136 -128
- package/skills/home/home-website/assets/website/scripts/render.mjs +3 -3
- package/skills/home/home-website/assets/website/scripts/site.mjs +21 -10
- package/skills/home/home-website/assets/website/site/public/home-assets/app.js +69 -23
- package/skills/home/home-website/assets/website/site/public/home-assets/site.css +74 -42
- package/skills/home/home-website/assets/website/site/templates/layout.mjs +2 -6
- package/skills/home/home-website/assets/website/site/templates/ledger.mjs +33 -24
- package/skills/home/home-website/assets/website/site/templates/model.mjs +28 -5
- package/skills/home/home-website/assets/website/site/templates/pages.mjs +48 -19
- package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +2 -107
- package/skills/home/home-website/assets/website/site.config.json +1 -1
- package/skills/home/home-website/references/website.md +64 -46
- package/skills/home/home-website/scripts/activate.mjs +105 -0
- package/skills/home/home-website/scripts/init.mjs +79 -11
- package/skills/home/home-workflow/SKILL.md +6 -4
- package/skills/system/system-clash-proxy-config/SKILL.md +21 -0
- package/skills/system/system-clash-proxy-config/agents/openai.yaml +4 -0
- package/skills/system/system-clash-proxy-config/assets/clash-override.js +328 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/browser-privacy.md +2 -2
- package/skills/system/{system-config → system-clash-proxy-config}/references/changes.md +2 -2
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/clash-verge.md +1 -1
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/diagnosis.md +1 -1
- package/skills/system/system-clash-proxy-config/references/dns-workflow.md +42 -0
- package/skills/system/system-clash-proxy-config/references/egress-macos.md +31 -0
- package/skills/system/system-clash-proxy-config/references/egress-windows.md +37 -0
- package/skills/system/system-clash-proxy-config/references/egress.md +12 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/flclash.md +1 -1
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/index.md +1 -1
- package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/linux-cutover.md +29 -0
- package/skills/system/system-clash-proxy-config/references/locale-workflow.md +9 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/mihomo.md +1 -25
- package/skills/system/system-clash-proxy-config/references/session.md +34 -0
- package/skills/system/system-clash-proxy-config/references/subscription.md +29 -0
- package/skills/system/{system-proxy → system-clash-proxy-config}/references/troubleshooting.md +7 -7
- package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/verification.md +2 -0
- package/skills/system/system-clash-proxy-config/scripts/prepare-session.mjs +155 -0
- package/skills/system/system-clash-proxy-config/scripts/run-session.mjs +138 -0
- package/skills/system/system-inspect/SKILL.md +1 -1
- package/skills/system/system-inspect/references/health-audit.md +1 -1
- package/upstream-skills/zh-archify/SKILL.md +11 -11
- package/upstream-skills/zh-archify/assets/template.html +6 -3
- package/upstream-skills/zh-archify/bin/archify.mjs +67 -4
- package/upstream-skills/zh-archify/modules/code-analysis/ARCHITECTURE.md +7 -1
- package/upstream-skills/zh-archify/modules/code-analysis/bin/analyze-run.mjs +2 -1
- package/upstream-skills/zh-archify/modules/code-analysis/bin/check.mjs +29 -15
- package/upstream-skills/zh-archify/modules/code-analysis/bin/drift.mjs +3 -3
- package/upstream-skills/zh-archify/modules/code-analysis/bin/prepare.mjs +5 -6
- package/upstream-skills/zh-archify/modules/code-analysis/bin/serve.mjs +66 -36
- package/upstream-skills/zh-archify/modules/code-analysis/bin/verify-change.mjs +43 -13
- package/upstream-skills/zh-archify/modules/code-analysis/docs/TECH-GUIDE.md +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/docs/USAGE.md +37 -4
- package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/functions.mjs +7 -5
- package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/index.mjs +4 -1
- package/upstream-skills/zh-archify/modules/code-analysis/extract/ts/snapshot-host.mjs +9 -0
- package/upstream-skills/zh-archify/modules/code-analysis/lib/architecture-drift.mjs +28 -7
- package/upstream-skills/zh-archify/modules/code-analysis/lib/drift-capture.mjs +4 -3
- package/upstream-skills/zh-archify/modules/code-analysis/lib/git-sources.mjs +5 -3
- package/upstream-skills/zh-archify/modules/code-analysis/lib/output.mjs +272 -0
- package/upstream-skills/zh-archify/modules/code-analysis/lib/pull-request.mjs +34 -4
- package/upstream-skills/zh-archify/modules/code-analysis/lib/task.mjs +4 -2
- package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-context.mjs +13 -1
- package/upstream-skills/zh-archify/modules/code-analysis/lib/verification-history.mjs +112 -0
- package/upstream-skills/zh-archify/modules/code-analysis/lib/verification.mjs +6 -2
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/atlas.mjs +71 -5
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.css +16 -2
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas.js +121 -5
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/atlas3d.js +38 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.css +14 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/overlay.js +187 -27
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/client/verification.js +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/i18n.mjs +9 -0
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/inject.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/page.mjs +11 -6
- package/upstream-skills/zh-archify/modules/code-analysis/overlay/pull-request.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/schemas/ai-task.schema.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/atlas.test.mjs +88 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/duplicates.test.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/test/external-workflow.test.mjs +1 -1
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/boundary.task.missing.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/complexity.task.valid.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.changed.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/import-cycle.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/fixtures/tasks/module-cycle.task.json +1 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/function-source-range.test.mjs +10 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/output-recovery.test.mjs +626 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/pull-request.test.mjs +98 -2
- package/upstream-skills/zh-archify/modules/code-analysis/test/review.test.mjs +37 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/source-panel.test.mjs +2 -1
- package/upstream-skills/zh-archify/modules/code-analysis/test/task.test.mjs +3 -2
- package/upstream-skills/zh-archify/modules/code-analysis/test/verification-history.test.mjs +216 -0
- package/upstream-skills/zh-archify/modules/code-analysis/test/verification.test.mjs +122 -0
- package/upstream-skills/zh-archify/package-lock.json +2 -2
- package/upstream-skills/zh-archify/package.json +1 -1
- package/upstream-skills/zh-archify/references/authoring-contract.md +2 -0
- package/upstream-skills/zh-archify/references/explainer-authoring.md +1 -1
- package/upstream-skills/zh-archify/renderers/architecture/render-architecture.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/class/render-class.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/dataflow/render-dataflow.mjs +2 -1
- package/upstream-skills/zh-archify/renderers/erd/render-erd.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/lifecycle/render-lifecycle.mjs +4 -2
- package/upstream-skills/zh-archify/renderers/sequence/render-sequence.mjs +4 -2
- package/upstream-skills/zh-archify/renderers/shared/cli.mjs +7 -1
- package/upstream-skills/zh-archify/renderers/timeline/render-timeline.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/tree/render-tree.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/waterfall/render-waterfall.mjs +1 -0
- package/upstream-skills/zh-archify/renderers/workflow/render-workflow.mjs +3 -2
- package/upstream-skills/zh-archify/renderers/workflow/workflow-compiler.mjs +68 -7
- package/upstream-skills/zh-archify/skill-release.json +1 -1
- package/upstream-skills/zh-modern-web-guidance/SKILL.md +4 -11
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-detection.md +20 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/language-model.md +22 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/prompt-api.md +22 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/summarizer.md +20 -0
- package/upstream-skills/zh-modern-web-guidance/guides/built-in-ai/translator.md +22 -0
- package/upstream-skills/zh-modern-web-guidance/guides/performance/custom-ml-model-inference.md +342 -0
- package/upstream-skills/zh-modern-web-guidance/guides/performance/data-parallel-computation.md +337 -0
- package/upstream-skills/zh-modern-web-guidance/guides/performance/improve-next-page-load-performance.md +4 -1
- package/upstream-skills/zh-modern-web-guidance/guides/performance/large-scene-rendering.md +350 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/position-aware-tooltips.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-atoms/viewport-aware-dropdowns.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/animate-to-from-top-layer.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/declarative-dialog-popover-control.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/interest-triggered-tooltips.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/scroll-target-on-load.md +29 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-behaviors/sortable-table.md +1 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/app-menus.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/context-menu.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/copy-button.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/dialog.md +10 -1
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/hovercard.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/menu.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/navbar.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-app-tours.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/persistent-toast-notifications.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/ui-components/toolbar.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/user-experience/content-first-noise-reduction.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/user-experience/natural-interactions.md +9 -0
- package/upstream-skills/zh-modern-web-guidance/guides/webmcp/agentic-javascript-tools.md +27 -0
- package/skills/home/home-project-changelog/assets/project-changelog.md +0 -35
- package/skills/system/system-clash-tun-egress/SKILL.md +0 -22
- package/skills/system/system-clash-tun-egress/agents/openai.yaml +0 -4
- package/skills/system/system-config/SKILL.md +0 -37
- package/skills/system/system-config/agents/openai.yaml +0 -4
- package/skills/system/system-config/references/ai-cli-config.md +0 -75
- package/skills/system/system-config/references/ai-cli-optimization.md +0 -37
- package/skills/system/system-config/references/index.md +0 -12
- package/skills/system/system-config/references/locale-workflow.md +0 -33
- package/skills/system/system-config/references/locale.md +0 -50
- package/skills/system/system-proxy/SKILL.md +0 -40
- package/skills/system/system-proxy/agents/openai.yaml +0 -4
- package/skills/system/system-proxy/assets/protected-rules.yaml +0 -7
- package/skills/system/system-proxy/references/dns-workflow.md +0 -152
- /package/skills/system/{system-config → system-clash-proxy-config}/assets/configuration.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/assets/network.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/acceptance.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-fields.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/dns-misconceptions.md +0 -0
- /package/skills/system/{system-clash-tun-egress/references/troubleshooting.md → system-clash-proxy-config/references/egress-troubleshooting.md} +0 -0
- /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-linux.md +0 -0
- /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-macos.md +0 -0
- /package/skills/system/{system-config → system-clash-proxy-config}/references/locale-windows.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/network-performance.md +0 -0
- /package/skills/system/{system-clash-tun-egress → system-clash-proxy-config}/references/nodes-and-dns.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platform-dns.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/platforms.md +0 -0
- /package/skills/system/{system-proxy → system-clash-proxy-config}/references/tun-dns.md +0 -0
|
@@ -20,9 +20,58 @@
|
|
|
20
20
|
// coupling; the side panel states the unresolved counts. Source text stays in
|
|
21
21
|
// the Classic view, which the Atlas links to for any finding's evidence.
|
|
22
22
|
import fs from 'node:fs';
|
|
23
|
+
import { createHash } from 'node:crypto';
|
|
24
|
+
import { createRequire } from 'node:module';
|
|
23
25
|
import { clientAsset } from './client-assets.mjs';
|
|
24
26
|
|
|
25
27
|
const compareText = (a, b) => (a < b ? -1 : a > b ? 1 : 0);
|
|
28
|
+
const require = createRequire(import.meta.url);
|
|
29
|
+
|
|
30
|
+
// A function expression's measured range does not include its binding. Only
|
|
31
|
+
// accept a uniquely bound top-level anonymous expression whose captured range
|
|
32
|
+
// still matches the parsed source; otherwise its apparent name may be local
|
|
33
|
+
// to the expression or ambiguous across scopes.
|
|
34
|
+
function boundExpressions(facts) {
|
|
35
|
+
const wanted = new Set((facts.functions || []).filter(fn => fn.syntaxKind === 'FunctionExpression').map(fn => fn.file));
|
|
36
|
+
const result = new Map();
|
|
37
|
+
if (!wanted.size) return result;
|
|
38
|
+
const ts = require('../vendor/typescript.cjs');
|
|
39
|
+
for (const file of facts.files || []) {
|
|
40
|
+
if (!wanted.has(file.path) || typeof file.sourceText !== 'string') continue;
|
|
41
|
+
const source = ts.createSourceFile(file.path, file.sourceText, ts.ScriptTarget.Latest, true);
|
|
42
|
+
if (source.parseDiagnostics.length) continue;
|
|
43
|
+
const declarations = new Map(), expressions = [], pending = [source];
|
|
44
|
+
while (pending.length) {
|
|
45
|
+
const node = pending.pop();
|
|
46
|
+
if (ts.isVariableDeclaration(node) && ts.isIdentifier(node.name)) {
|
|
47
|
+
const name = node.name.text;
|
|
48
|
+
declarations.set(name, (declarations.get(name) || 0) + 1);
|
|
49
|
+
let init = node.initializer;
|
|
50
|
+
while (init && (ts.isParenthesizedExpression(init) || ts.isAsExpression(init) || ts.isSatisfiesExpression?.(init) || ts.isTypeAssertionExpression(init))) init = init.expression;
|
|
51
|
+
if (init && ts.isFunctionExpression(init) && !init.name && node.parent?.parent?.parent === source) expressions.push({ name, init });
|
|
52
|
+
}
|
|
53
|
+
ts.forEachChild(node, child => { pending.push(child); });
|
|
54
|
+
}
|
|
55
|
+
for (const { name, init } of expressions) {
|
|
56
|
+
if (declarations.get(name) !== 1) continue;
|
|
57
|
+
const start = init.getStart(source), end = init.getEnd(), pos = source.getLineAndCharacterOfPosition(start);
|
|
58
|
+
const digest = createHash('sha256').update(file.sourceText.slice(start, end)).digest('hex');
|
|
59
|
+
result.set(`${file.path}\0${pos.line + 1}\0${pos.character + 1}`, { name, digest });
|
|
60
|
+
}
|
|
61
|
+
}
|
|
62
|
+
return result;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
function stableFunctionName(fn, expressions) {
|
|
66
|
+
if (fn.syntaxKind === 'FunctionExpression') {
|
|
67
|
+
const binding = expressions.get(`${fn.file}\0${fn.line}\0${fn.sourceRange?.column}`);
|
|
68
|
+
if (!binding || binding.name !== fn.name || binding.digest !== fn.sourceRange?.sha256) return false;
|
|
69
|
+
}
|
|
70
|
+
const name = fn.qualname || fn.name;
|
|
71
|
+
const owner = /^(?:MethodDeclaration|GetAccessor|SetAccessor)$/.test(fn.syntaxKind || '') && fn.name && name.endsWith(fn.name)
|
|
72
|
+
? name.slice(0, -fn.name.length) : name;
|
|
73
|
+
return !/<(?:callback of |anonymous(?:#\d+)?>|(?:static|instance) initializer>)/.test(owner);
|
|
74
|
+
}
|
|
26
75
|
|
|
27
76
|
// Shortest unambiguous label for each module: the fewest trailing path
|
|
28
77
|
// segments that no other module shares (`executor`, `cache/decorators`).
|
|
@@ -75,7 +124,8 @@ export function buildAtlas({ graph, facts, findings = [], review = null }) {
|
|
|
75
124
|
(byModule.get(id) || byModule.set(id, []).get(id)).push(f);
|
|
76
125
|
}
|
|
77
126
|
const modules = graphModules.filter((m) => byModule.has(m.id));
|
|
78
|
-
|
|
127
|
+
// A file at the selected scope root can form its own module with an empty directory path.
|
|
128
|
+
const labels = moduleLabels(modules.map((m) => m.path || (m.label === '(root)' ? '' : m.label)));
|
|
79
129
|
const moduleIndex = new Map(modules.map((m, i) => [m.id, i]));
|
|
80
130
|
const labelOf = (id) => (moduleIndex.has(id) ? labels[moduleIndex.get(id)] : id);
|
|
81
131
|
|
|
@@ -100,6 +150,10 @@ export function buildAtlas({ graph, facts, findings = [], review = null }) {
|
|
|
100
150
|
|
|
101
151
|
const accepted = new Set(Object.entries(review?.findings || {}).filter(([, r]) => r.status === 'accepted').map(([id]) => id));
|
|
102
152
|
const listed = [];
|
|
153
|
+
// A qualified name can identify multiple declarations in the same file.
|
|
154
|
+
// Link only a unique finding and function with the same declaration range.
|
|
155
|
+
const functionKey = (file, name, line, endLine) => file && name && Number.isInteger(line) && Number.isInteger(endLine) && endLine >= line
|
|
156
|
+
? JSON.stringify([file, name, line, endLine]) : null;
|
|
103
157
|
const functionFinding = new Map();
|
|
104
158
|
for (const f of findings) {
|
|
105
159
|
const s = f.subject || {};
|
|
@@ -113,7 +167,8 @@ export function buildAtlas({ graph, facts, findings = [], review = null }) {
|
|
|
113
167
|
}
|
|
114
168
|
} else if (f.code === 'complexity/function' && fileIndex.has(s.file)) {
|
|
115
169
|
entry.kind = 'function';
|
|
116
|
-
|
|
170
|
+
const key = functionKey(s.file, s.function, s.line, s.endLine);
|
|
171
|
+
if (key) functionFinding.set(key, functionFinding.has(key) ? -1 : listed.length);
|
|
117
172
|
} else if (f.code === 'coupling/import-cycle' && Array.isArray(s.files)) {
|
|
118
173
|
entry.kind = 'cycle';
|
|
119
174
|
entry.files = s.files.filter((p) => fileIndex.has(p)).map((p) => fileIndex.get(p));
|
|
@@ -147,11 +202,22 @@ export function buildAtlas({ graph, facts, findings = [], review = null }) {
|
|
|
147
202
|
}
|
|
148
203
|
|
|
149
204
|
// [file, name, line, complexity, nesting, length, finding index or -1]
|
|
205
|
+
const expressions = boundExpressions(facts);
|
|
206
|
+
const functionCounts = new Map();
|
|
207
|
+
for (const fn of facts.functions || []) {
|
|
208
|
+
const key = functionKey(fn.file, fn.qualname || fn.name, fn.line, fn.endLine);
|
|
209
|
+
if (key) functionCounts.set(key, (functionCounts.get(key) || 0) + 1);
|
|
210
|
+
}
|
|
150
211
|
const functions = (facts.functions || [])
|
|
151
212
|
.filter((fn) => fileIndex.has(fn.file))
|
|
152
213
|
.map((fn) => [fileIndex.get(fn.file), fn.qualname || fn.name, fn.line, fn.complexity, fn.nesting ?? 0, (fn.endLine ?? fn.line) - fn.line + 1,
|
|
153
|
-
|
|
154
|
-
|
|
214
|
+
functionCounts.get(functionKey(fn.file, fn.qualname || fn.name, fn.line, fn.endLine)) === 1
|
|
215
|
+
? functionFinding.get(functionKey(fn.file, fn.qualname || fn.name, fn.line, fn.endLine)) ?? -1 : -1,
|
|
216
|
+
fn.sourceRange ? { column: fn.sourceRange.column, endLine: fn.sourceRange.endLine, endColumn: fn.sourceRange.endColumn } : null,
|
|
217
|
+
fn.definition ? fn.definition.sourceRange?.sha256 || null : fn.sourceRange?.sha256 || null,
|
|
218
|
+
// Display names of callbacks and Java anonymous owners are numbered by
|
|
219
|
+
// source order. A quoted JS method named <anonymous> is a real name.
|
|
220
|
+
stableFunctionName(fn, expressions)])
|
|
155
221
|
.sort((a, b) => a[0] - b[0] || a[2] - b[2] || compareText(a[1], b[1]));
|
|
156
222
|
for (const [i, fn] of functions.entries()) if (fn[6] !== -1) listed[fn[6]].fn = i;
|
|
157
223
|
|
|
@@ -159,7 +225,7 @@ export function buildAtlas({ graph, facts, findings = [], review = null }) {
|
|
|
159
225
|
return {
|
|
160
226
|
language: facts.repository?.language ?? null,
|
|
161
227
|
measured: Array.isArray(facts.functions),
|
|
162
|
-
modules: modules.map((m, i) => ({ id: m.id, label: labels[i], path: m.path, fanIn: m.fanIn, fanOut: m.fanOut })),
|
|
228
|
+
modules: modules.map((m, i) => ({ id: m.id, label: labels[i], path: m.path, rootGroup: m.path === '' && m.label === '(root)', fanIn: m.fanIn, fanOut: m.fanOut })),
|
|
163
229
|
files: files.map((f) => [f.path, f.module, f.loc]),
|
|
164
230
|
edges,
|
|
165
231
|
functions,
|
|
@@ -58,6 +58,12 @@ html:not([data-analysis-mode="standalone"]) #bauify-atlas { position: relative;
|
|
|
58
58
|
#bauify-atlas .hist div { flex: 1 1 0; min-height: 1px; border-radius: 2px 2px 0 0; background: var(--text-muted, #94a3b8); opacity: .75; }
|
|
59
59
|
#bauify-atlas .hist div.hot { background: #FBBF24; opacity: 1; }
|
|
60
60
|
#bauify-atlas .axis { display: flex; justify-content: space-between; color: var(--text-muted, #94a3b8); font: 10px ui-monospace, Menlo, Consolas, monospace; margin-top: 3px; }
|
|
61
|
+
#bauify-atlas .atlas-imports { margin-block: 12px; font-size: 12px; }
|
|
62
|
+
#bauify-atlas .atlas-imports label { display: grid; gap: 4px; color: var(--atlas-muted, var(--text-muted)); }
|
|
63
|
+
#bauify-atlas .atlas-imports select { box-sizing: border-box; min-width: 0; width: 100%; padding: 6px; border: 1px solid var(--atlas-line, var(--panel-border)); border-radius: 6px; background: var(--atlas-solid, var(--panel)); color: var(--atlas-ink, var(--text)); }
|
|
64
|
+
#bauify-atlas .atlas-import-paths { margin: 8px 0 0; }
|
|
65
|
+
#bauify-atlas .atlas-import-paths dt { color: var(--atlas-muted, var(--text-muted)); }
|
|
66
|
+
#bauify-atlas .atlas-import-paths dd { margin: 2px 0 8px; overflow-wrap: anywhere; font-family: var(--atlas-mono, monospace); }
|
|
61
67
|
#bauify-atlas .note { color: var(--text-muted, #94a3b8); font-size: 11px; margin-top: 6px; }
|
|
62
68
|
#bauify-atlas .legend { display: grid; gap: 4px; font-size: 11px; color: var(--text-muted, #94a3b8); }
|
|
63
69
|
#bauify-atlas .legend i { display: inline-block; width: 14px; height: 3px; vertical-align: middle; margin-right: 6px; border-radius: 2px; }
|
|
@@ -242,7 +248,11 @@ html[data-theme="dark"] #bauify-atlas.atlas-page { --atlas-amber: #fbbf24; }
|
|
|
242
248
|
@media (max-width: 1100px) {
|
|
243
249
|
#bauify-atlas.atlas-page .atlas-help, #bauify-atlas.atlas-page .atlas-legend span:nth-child(n+4) { display: none; }
|
|
244
250
|
#bauify-atlas.atlas-page .atlas-focus, #bauify-atlas.atlas-page:not([data-fly="closed"]) .atlas-focus { max-width: calc(100% - 40px); top: 60px; left: 50%; }
|
|
245
|
-
#bauify-atlas.atlas-page { --atlas-shift: 0px
|
|
251
|
+
#bauify-atlas.atlas-page:not([data-fly="closed"]) { --atlas-shift: 0px; }
|
|
252
|
+
}
|
|
253
|
+
@media (760px < width <= 1100px) {
|
|
254
|
+
#bauify-atlas.atlas-page:not([data-fly="closed"]) .atlas-stage { right: calc(var(--atlas-fly) + 24px); }
|
|
255
|
+
#bauify-atlas.atlas-page:not([data-fly="closed"]) .atlas-focus { left: calc((100% - var(--atlas-fly) - 24px) / 2); max-width: calc(100% - var(--atlas-fly) - 64px); }
|
|
246
256
|
}
|
|
247
257
|
@media (max-width: 760px) {
|
|
248
258
|
html:not([data-analysis-mode="standalone"]) #bauify-atlas.atlas-page { height: clamp(560px, calc(100vh - 120px), 820px); }
|
|
@@ -252,7 +262,11 @@ html[data-theme="dark"] #bauify-atlas.atlas-page { --atlas-amber: #fbbf24; }
|
|
|
252
262
|
#bauify-atlas.atlas-page .atlas-first { bottom: 58px; width: calc(100% - 28px); padding-bottom: 4px; }
|
|
253
263
|
#bauify-atlas.atlas-page .atlas-first > p, #bauify-atlas.atlas-page .atlas-lead small { display: none; }
|
|
254
264
|
#bauify-atlas.atlas-page .atlas-lead { padding: 6px 10px 6px 0; }
|
|
255
|
-
#bauify-atlas.atlas-page .atlas-
|
|
265
|
+
#bauify-atlas.atlas-page:not([data-fly="closed"]) .atlas-stage { bottom: 50%; }
|
|
266
|
+
/* The finding sheet already names the selection and has a clear button.
|
|
267
|
+
Avoid covering numbered map endpoints with a redundant floating pill. */
|
|
268
|
+
#bauify-atlas.atlas-page[data-fly="finding"] .atlas-focus { display: none; }
|
|
269
|
+
#bauify-atlas.atlas-page .atlas-side { top: auto; left: 8px; right: 8px; bottom: 8px; width: auto; height: calc(50% - 8px); }
|
|
256
270
|
}
|
|
257
271
|
@media (prefers-reduced-motion: reduce) { #bauify-atlas.atlas-page canvas, #bauify-atlas.atlas-page .atlas-side, #bauify-atlas.atlas-page .atlas-focus, #bauify-atlas.atlas-page .atlas-first { transition: none; } #bauify-atlas.atlas-page .atlas-selection > * { animation: none; } }
|
|
258
272
|
@media print { #bauify-atlas, #bauify-views { display: none; } }
|
|
@@ -13,6 +13,7 @@
|
|
|
13
13
|
var prMarkerHits = [], prModuleChanges = pr ? new Map((pr.moduleChanges || []).map(function(m){return[m.id,m];})) : null;
|
|
14
14
|
var changedFiles = pr ? (pr.changedFiles || []) : [];
|
|
15
15
|
var changedSelection = null;
|
|
16
|
+
var findingImports = [], activeImport = 0;
|
|
16
17
|
if (pr) FN.forEach(function(fn,i){prFunctions.set(JSON.stringify([F[fn[0]][0],fn[1]]),i);});
|
|
17
18
|
function esc(s) { return String(s).replace(/[&<>"']/g, function (ch) { return { '&': '&', '<': '<', '>': '>', '"': '"', "'": ''' }[ch]; }); }
|
|
18
19
|
function fmt(n) { return Number(n).toLocaleString('en-US'); }
|
|
@@ -337,6 +338,29 @@
|
|
|
337
338
|
}
|
|
338
339
|
return sel;
|
|
339
340
|
}
|
|
341
|
+
function drawImportEndpoints(ctx, t, edge) {
|
|
342
|
+
var ends = edge.map(function (file) { return pt(geo.ang[file], geo.R * 0.985, F[file][1]); });
|
|
343
|
+
var labels = edge.map(function (file) { return pt(geo.ang[file], Math.max(0, geo.R * 0.985 - 17), F[file][1]); });
|
|
344
|
+
if (Math.hypot(labels[0][0] - labels[1][0], labels[0][1] - labels[1][1]) < 22) {
|
|
345
|
+
var step = labels[0][1] <= labels[1][1] ? 11 : -11;
|
|
346
|
+
labels[0][1] -= step;
|
|
347
|
+
labels[1][1] += step;
|
|
348
|
+
}
|
|
349
|
+
ctx.save();
|
|
350
|
+
ctx.lineWidth = 1;
|
|
351
|
+
ctx.strokeStyle = t.text;
|
|
352
|
+
ctx.font = '600 13px system-ui, sans-serif';
|
|
353
|
+
ctx.textAlign = 'center';
|
|
354
|
+
ctx.textBaseline = 'middle';
|
|
355
|
+
labels.forEach(function (point, index) {
|
|
356
|
+
ctx.beginPath(); ctx.moveTo(ends[index][0], ends[index][1]); ctx.lineTo(point[0], point[1]); ctx.stroke();
|
|
357
|
+
ctx.fillStyle = t.bg;
|
|
358
|
+
ctx.beginPath(); ctx.arc(point[0], point[1], 9, 0, 2 * Math.PI); ctx.fill(); ctx.stroke();
|
|
359
|
+
ctx.fillStyle = t.text;
|
|
360
|
+
ctx.fillText(index === 0 ? '①' : '②', point[0], point[1]);
|
|
361
|
+
});
|
|
362
|
+
ctx.restore();
|
|
363
|
+
}
|
|
340
364
|
function inSel(sel, file) { return sel.files[file] || sel.modules[F[file][1]]; }
|
|
341
365
|
|
|
342
366
|
// ---- drawing ----
|
|
@@ -443,6 +467,13 @@
|
|
|
443
467
|
ctx.setTransform(dpr, 0, 0, dpr, 0, 0);
|
|
444
468
|
ctx.clearRect(0, 0, geo.w, geo.h);
|
|
445
469
|
var sel = selection(), dimmed = sel.any;
|
|
470
|
+
var selectedImport = findingImports[activeImport];
|
|
471
|
+
if (selectedImport) {
|
|
472
|
+
sel.anchor = null;
|
|
473
|
+
sel.files[selectedImport[0]] = true;
|
|
474
|
+
sel.files[selectedImport[1]] = true;
|
|
475
|
+
sel.edges = [selectedImport];
|
|
476
|
+
}
|
|
446
477
|
// guide rings
|
|
447
478
|
ctx.lineWidth = 1; ctx.strokeStyle = t.grid;
|
|
448
479
|
[0.42, 0.8, 1.0, 1.42].forEach(function (f) { ctx.beginPath(); ctx.arc(geo.cx, geo.cy, geo.R * f, 0, 2 * Math.PI); ctx.stroke(); });
|
|
@@ -537,6 +568,7 @@
|
|
|
537
568
|
}
|
|
538
569
|
ctx.restore();
|
|
539
570
|
});
|
|
571
|
+
if (selectedImport) drawImportEndpoints(ctx, t, selectedImport);
|
|
540
572
|
if (pr) drawPRMarks(ctx,sel);
|
|
541
573
|
ctx.lineCap = 'round';
|
|
542
574
|
}
|
|
@@ -647,6 +679,13 @@
|
|
|
647
679
|
changedSelection = Number.isInteger(changeIndex) && changedFiles[changeIndex] ? changeIndex : null;
|
|
648
680
|
if (state.file !== -1) { module = F[state.file][1]; finding = -1; }
|
|
649
681
|
state.focusModule = module; state.finding = finding;
|
|
682
|
+
var selected = FD[finding];
|
|
683
|
+
var fn = selected?.kind === 'function' && FN[selected.fn];
|
|
684
|
+
findingImports = fn ? E.filter(function (edge) { return edge[0] === fn[0] || edge[1] === fn[0]; }) : [];
|
|
685
|
+
var importIndex = saved?.portable && saved.importPaths
|
|
686
|
+
? findingImports.findIndex(function (edge) { return edge.every(function (index, i) { return F[index][0] === saved.importPaths[i]; }); })
|
|
687
|
+
: saved?.importIndex;
|
|
688
|
+
activeImport = findingImports[importIndex] ? importIndex : 0;
|
|
650
689
|
state.hover = null; tip.hidden = true;
|
|
651
690
|
// The page's panel shows "all findings" only when asked; clearing closes it.
|
|
652
691
|
homeOpen = wantHome && module === -1 && finding === -1 && state.file === -1; wantHome = false;
|
|
@@ -698,7 +737,7 @@
|
|
|
698
737
|
if (f) {
|
|
699
738
|
var what = findingWhat(f);
|
|
700
739
|
return '<div class="selected"><h4>' + esc(findingTitle(f)) + '</h4><p><span style="color:' + (TONE[f.severity] || TONE.info) + '">' + esc(tr(f.severity)) + '</span>' + (f.accepted ? tr(" · accepted in baseline") : '') + ' · ' + esc(what) + '</p>' +
|
|
701
|
-
'<button type="button" class="atlas-evidence" data-id="' + esc(f.id) + '">' + esc(tr(standalone ? 'Open
|
|
740
|
+
'<button type="button" class="atlas-evidence" data-id="' + esc(f.id) + '">' + esc(tr(standalone ? 'Open finding details' : 'Open finding details in Classic view')) + '</button></div>';
|
|
702
741
|
}
|
|
703
742
|
if (state.file !== -1) {
|
|
704
743
|
var picked = F[state.file];
|
|
@@ -878,6 +917,8 @@
|
|
|
878
917
|
side.querySelector('.atlas-selection').innerHTML = '<div class="k">' + esc(tr('Selection')) + '</div>' + selectedCard();
|
|
879
918
|
side.querySelector('.atlas-stats').hidden = Boolean(pr);
|
|
880
919
|
}
|
|
920
|
+
var finding = FD[state.finding];
|
|
921
|
+
if (finding?.kind === 'function' && finding.fn != null) renderFindingImports(FN[finding.fn][0]);
|
|
881
922
|
side.querySelector('.atlas-side-content').innerHTML = listsHtml(view, openSelected);
|
|
882
923
|
side.querySelector('.module-list').scrollTop = view.modules;
|
|
883
924
|
scroller.scrollTop = PAGE && !openSelected ? view.scroll : PAGE ? 0 : view.scroll;
|
|
@@ -890,7 +931,45 @@
|
|
|
890
931
|
side.querySelectorAll('[data-module]').forEach(function (el) { el.addEventListener('click', function () { var i = Number(el.getAttribute('data-module')); select(state.focusModule === i ? -1 : i, -1); }); });
|
|
891
932
|
}
|
|
892
933
|
var ev = side.querySelector('.atlas-evidence');
|
|
893
|
-
if (ev) ev.addEventListener('click', function () {
|
|
934
|
+
if (ev) ev.addEventListener('click', function () {
|
|
935
|
+
if (!window.__archifyShowFinding) return;
|
|
936
|
+
window.__archifyShowFinding(ev.dataset.id, 'atlas', window.__archifyAtlas.saveSelection(true));
|
|
937
|
+
});
|
|
938
|
+
}
|
|
939
|
+
|
|
940
|
+
function renderFindingImports(file) {
|
|
941
|
+
var section = document.createElement('div');
|
|
942
|
+
section.className = 'atlas-imports';
|
|
943
|
+
side.querySelector('.atlas-selection').appendChild(section);
|
|
944
|
+
if (!findingImports.length) {
|
|
945
|
+
section.classList.add('note');
|
|
946
|
+
section.textContent = tr('No captured dependencies for the selected file');
|
|
947
|
+
return;
|
|
948
|
+
}
|
|
949
|
+
var label = document.createElement('label'), picker = document.createElement('select');
|
|
950
|
+
label.append(tr('File dependencies') + ' · ' + fmt(findingImports.length), picker);
|
|
951
|
+
findingImports.forEach(function (edge, index) {
|
|
952
|
+
var outgoing = edge[0] === file;
|
|
953
|
+
var other = outgoing ? edge[1] : edge[0];
|
|
954
|
+
picker.add(new Option((outgoing ? '→ ' : '← ') + F[other][0], String(index), false, index === activeImport));
|
|
955
|
+
});
|
|
956
|
+
var paths = document.createElement('dl');
|
|
957
|
+
paths.className = 'atlas-import-paths';
|
|
958
|
+
paths.setAttribute('aria-live', 'polite');
|
|
959
|
+
var values = ['① Importing file', '② Imported file'].map(function (role) {
|
|
960
|
+
var term = document.createElement('dt'), value = document.createElement('dd');
|
|
961
|
+
term.textContent = tr(role); paths.append(term, value);
|
|
962
|
+
return value;
|
|
963
|
+
});
|
|
964
|
+
function updatePaths() {
|
|
965
|
+
findingImports[activeImport].forEach(function (file, index) { values[index].textContent = F[file][0]; });
|
|
966
|
+
}
|
|
967
|
+
picker.addEventListener('change', function () {
|
|
968
|
+
activeImport = picker.selectedIndex;
|
|
969
|
+
updatePaths(); draw();
|
|
970
|
+
});
|
|
971
|
+
section.append(label, paths);
|
|
972
|
+
updatePaths();
|
|
894
973
|
}
|
|
895
974
|
|
|
896
975
|
// ---- the page: panel content, start card, focus pill, search ----
|
|
@@ -963,7 +1042,7 @@
|
|
|
963
1042
|
var fix = (info.supportedFixes || [])[0];
|
|
964
1043
|
if (fix) h += head(tr('First step')) + '<p class="atlas-fix">' + esc(fix) + '</p>';
|
|
965
1044
|
if (owner !== -1) h += head(tr('Module')) + '<button type="button" class="atlas-rel" data-module="' + owner + '" data-keep="1"><i style="background:' + hue(owner, theme()) + '"></i><span>' + esc(M[owner].label) + '</span><em>' + esc(tr('{n} open', { n: modOpen[owner] })) + ' ›</em></button>';
|
|
966
|
-
h += '<div class="atlas-acts"><button type="button" class="primary atlas-evidence" data-id="' + esc(f.id) + '">' + esc(tr(standalone ? 'Open
|
|
1045
|
+
h += '<div class="atlas-acts"><button type="button" class="primary atlas-evidence" data-id="' + esc(f.id) + '">' + esc(tr(standalone ? 'Open finding details' : 'Open finding details in Classic view')) + '</button></div>';
|
|
967
1046
|
return h;
|
|
968
1047
|
}
|
|
969
1048
|
function filePanel(fi) {
|
|
@@ -1108,6 +1187,7 @@
|
|
|
1108
1187
|
// One view at a time; the diagram is the default page ('' or 'diagram').
|
|
1109
1188
|
function showView(kind) {
|
|
1110
1189
|
if (!views) return;
|
|
1190
|
+
views.hidden = root.getAttribute('data-bauify') !== 'on';
|
|
1111
1191
|
var next = kind === 'diagram' ? '' : kind || '';
|
|
1112
1192
|
// Set first: the layout (summary column hidden, full width) must settle before a view draws.
|
|
1113
1193
|
if (next) root.setAttribute('data-bauify-views', next); else root.removeAttribute('data-bauify-views');
|
|
@@ -1166,12 +1246,48 @@
|
|
|
1166
1246
|
var index = M.findIndex(function (m) { return m.id === id; });
|
|
1167
1247
|
select(index, -1);
|
|
1168
1248
|
},
|
|
1169
|
-
|
|
1249
|
+
returnFromEvidence: function (saved) {
|
|
1250
|
+
if (!standalone) showView('atlas');
|
|
1251
|
+
window.__archifyAtlas.restoreSelection(saved);
|
|
1252
|
+
requestAnimationFrame(function () { side.querySelector('.atlas-evidence')?.focus({ preventScroll: true }); });
|
|
1253
|
+
},
|
|
1254
|
+
saveSelection: function (portable, active) {
|
|
1255
|
+
var saved = { module: state.focusModule, finding: state.finding, file: state.file, importIndex: activeImport, changedFile: changedSelection, scope: fileScope?.value, tab: filePane.hidden ? 'map' : 'files', query: fileQuery.value, zoom: focusZoom, view: sideView() };
|
|
1256
|
+
if (!portable) return saved;
|
|
1257
|
+
return {
|
|
1258
|
+
...saved, portable: true, module: M[saved.module] ? { path: M[saved.module].path, rootFile: M[saved.module].path || M[saved.module].rootGroup ? null : F.find(function (entry) { return entry[1] === saved.module; })?.[0] } : null, finding: FD[saved.finding]?.id, file: F[saved.file]?.[0],
|
|
1259
|
+
importIndex: undefined,
|
|
1260
|
+
importPaths: findingImports[activeImport]?.map(function (index) { return F[index][0]; }),
|
|
1261
|
+
changedFile: changedFiles[saved.changedFile]?.path,
|
|
1262
|
+
view: { ...saved.view, groups: [...saved.view.groups] }, fileScroll: filePane.scrollTop,
|
|
1263
|
+
focus: active === fileQuery ? 'search' : active === fileScope ? 'scope'
|
|
1264
|
+
: active && fileList.contains(active) ? 'file' : active?.classList.contains('atlas-tab') ? 'tab' : null
|
|
1265
|
+
};
|
|
1266
|
+
},
|
|
1170
1267
|
restoreSelection: function (saved) {
|
|
1171
1268
|
fileQuery.value = saved.query || '';
|
|
1172
1269
|
if (fileScope && saved.scope) fileScope.value = saved.scope;
|
|
1173
|
-
|
|
1270
|
+
var module = saved.module, finding = saved.finding, file = saved.file, changed = saved.changedFile;
|
|
1271
|
+
if (saved.portable) {
|
|
1272
|
+
var matchingModules = saved.module ? M.map(function (entry, index) {
|
|
1273
|
+
var rootFile = entry.path || entry.rootGroup ? null : F.find(function (file) { return file[1] === index; })?.[0];
|
|
1274
|
+
return entry.path === saved.module.path && rootFile === saved.module.rootFile ? index : -1;
|
|
1275
|
+
}).filter(function (index) { return index >= 0; }) : [];
|
|
1276
|
+
module = matchingModules.length === 1 ? matchingModules[0] : -1;
|
|
1277
|
+
finding = FD.findIndex(function (entry) { return entry.id === saved.finding; });
|
|
1278
|
+
file = F.findIndex(function (entry) { return entry[0] === saved.file; });
|
|
1279
|
+
changed = changedFiles.findIndex(function (entry) { return entry.path === saved.changedFile; });
|
|
1280
|
+
saved = { ...saved, view: { ...saved.view, groups: new Set(saved.view.groups) } };
|
|
1281
|
+
}
|
|
1282
|
+
select(module, finding, saved, file, changed);
|
|
1174
1283
|
showTab(saved.tab === 'files');
|
|
1284
|
+
if (saved.portable && saved.tab === 'files') filePane.scrollTop = saved.fileScroll;
|
|
1285
|
+
if (saved.portable && !panel.hidden && saved.focus) {
|
|
1286
|
+
var target = saved.focus === 'search' ? fileQuery : saved.focus === 'scope' ? fileScope
|
|
1287
|
+
: saved.focus === 'file' ? fileList.querySelector('[aria-current="true"]') || fileQuery : panel.querySelector('.atlas-tab[aria-selected="true"]');
|
|
1288
|
+
if (target?.getClientRects().length) target.focus({ preventScroll: true });
|
|
1289
|
+
}
|
|
1290
|
+
return saved.portable && ((saved.module && module < 0) || (saved.finding && finding < 0) || (saved.file && file < 0) || (saved.changedFile && changed < 0));
|
|
1175
1291
|
}
|
|
1176
1292
|
};
|
|
1177
1293
|
if (standalone) open();
|
|
@@ -684,7 +684,44 @@
|
|
|
684
684
|
}
|
|
685
685
|
resize(); updateCamera(); renderSide(); applyMarks();
|
|
686
686
|
requestAnimationFrame(frame);
|
|
687
|
-
|
|
687
|
+
function functionIdentity(index) {
|
|
688
|
+
const fn = FN[index];
|
|
689
|
+
if (!fn) return null;
|
|
690
|
+
return { file: F[fn[0]][0], name: fn[1], line: fn[2], digest: fn[8], stableName: fn[9] === true, unique: !!fn[8] && FN.filter(candidate => candidate[0] === fn[0] && candidate[1] === fn[1] && candidate[8] === fn[8]).length === 1 };
|
|
691
|
+
}
|
|
692
|
+
function matchingFunction(saved) {
|
|
693
|
+
if (!saved || !saved.stableName || !saved.unique || !saved.digest) return [];
|
|
694
|
+
return FN.map((fn, i) => F[fn[0]][0] === saved.file && fn[9] === true && fn[1] === saved.name && fn[8] === saved.digest ? i : -1).filter(i => i !== -1);
|
|
695
|
+
}
|
|
696
|
+
function saveSelection() {
|
|
697
|
+
if (state.fn !== -1) return { type: 'function', ...functionIdentity(state.fn) };
|
|
698
|
+
if (state.finding !== -1) { const finding = FD[state.finding]; return { type: 'finding', id: finding.id, ...(finding.kind === 'function' ? { function: functionIdentity(finding.fn) } : {}) }; }
|
|
699
|
+
if (state.file !== -1) return { type: 'file', path: F[state.file][0] };
|
|
700
|
+
if (state.module !== -1) { const m = M[state.module]; return { type: 'module', path: m.path, rootFile: m.path || m.rootGroup ? null : F.find(f => f[1] === state.module)?.[0] }; }
|
|
701
|
+
return null;
|
|
702
|
+
}
|
|
703
|
+
function restoreSelection(saved) {
|
|
704
|
+
if (!saved) return false;
|
|
705
|
+
let indexes = [];
|
|
706
|
+
if (saved.type === 'function') {
|
|
707
|
+
// A generated name can be reassigned to a new function. Without
|
|
708
|
+
// independent owner provenance it is safer to report it unavailable.
|
|
709
|
+
indexes = matchingFunction(saved);
|
|
710
|
+
}
|
|
711
|
+
if (saved.type === 'finding') {
|
|
712
|
+
indexes = FD.map((f, i) => f.id === saved.id ? i : -1).filter(i => i !== -1);
|
|
713
|
+
if (indexes.length === 1 && FD[indexes[0]].kind === 'function') {
|
|
714
|
+
const matches = matchingFunction(saved.function);
|
|
715
|
+
if (matches.length !== 1 || matches[0] !== FD[indexes[0]].fn) return true;
|
|
716
|
+
}
|
|
717
|
+
}
|
|
718
|
+
if (saved.type === 'file') indexes = F.map((f, i) => f[0] === saved.path ? i : -1).filter(i => i !== -1);
|
|
719
|
+
if (saved.type === 'module') indexes = M.map((m, i) => m.path === saved.path && (m.path || (m.rootGroup ? null : F.find(f => f[1] === i)?.[0]) === saved.rootFile) ? i : -1).filter(i => i !== -1);
|
|
720
|
+
if (indexes.length !== 1) return true;
|
|
721
|
+
select({ type: saved.type, index: indexes[0] });
|
|
722
|
+
return false;
|
|
723
|
+
}
|
|
724
|
+
return { host, select, state, saveSelection, restoreSelection, consistent, counts: { files: drawnFiles, functions: drawnFns, branchDeps, threadDeps, insideDeps }, trunk: M[trunk].label, refresh: () => { resize(); dirty = true; } };
|
|
688
725
|
}
|
|
689
726
|
|
|
690
727
|
window.__archifyAtlas3d = { mount, get view() { return mounted; } };
|
|
@@ -610,7 +610,8 @@ html[data-bauify-flymode] #bauify-panel h3 { margin: 4px 0 2px; font-size: 21px;
|
|
|
610
610
|
#bauify-reader .fly-ev em { font-style: normal; color: var(--fly-muted); }
|
|
611
611
|
#bauify-reader .fly-ev small { grid-column: 1 / -1; color: var(--fly-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
|
|
612
612
|
#bauify-reader .fly-rel:hover, #bauify-reader .fly-find:hover { background: var(--fly-hover); }
|
|
613
|
-
#bauify-reader .fly-ev
|
|
613
|
+
#bauify-reader .fly-ev-unavailable { cursor: default; }
|
|
614
|
+
#bauify-reader button.fly-ev:hover { border-color: color-mix(in srgb, var(--fly-text) 22%, var(--fly-line)); }
|
|
614
615
|
#bauify-reader .fly-note { margin: 12px 0 0; padding: 10px 12px; border-radius: 11px; border: 1px solid var(--fly-line); background: var(--fly-soft); font-size: 12.5px; line-height: 1.6; }
|
|
615
616
|
#bauify-reader .fly-note.attention { border-color: color-mix(in srgb, var(--fly-red) 35%, var(--fly-line)); background: color-mix(in srgb, var(--fly-red) 7%, var(--fly-surface)); }
|
|
616
617
|
#bauify-reader .fly-pill { padding: 1px 8px; border-radius: 99px; font-size: 11px; font-weight: 600; background: color-mix(in srgb, var(--fly-grey) 16%, transparent); }
|
|
@@ -693,3 +694,15 @@ html[data-bauify="on"][data-bauify-code="on"][data-bauify-pick] #bauify-edges .b
|
|
|
693
694
|
html[data-bauify="on"][data-bauify-pick] path.bauify-coded.bauify-lit { opacity: 1; }
|
|
694
695
|
html[data-bauify="on"] g[data-node-id] { transition: opacity .3s; }
|
|
695
696
|
.pr-source-pin { display: block; overflow-wrap: anywhere; }
|
|
697
|
+
|
|
698
|
+
.toolbar .analysis-refresh { position: relative; display: none; }
|
|
699
|
+
html[data-bauify="on"] .toolbar .analysis-refresh { display: inline-flex; }
|
|
700
|
+
.toolbar .analysis-refresh-button[aria-busy="true"] { cursor: progress; }
|
|
701
|
+
.analysis-refresh-status:not(:empty) {
|
|
702
|
+
position: absolute; z-index: 12; inset: calc(100% + 8px) 0 auto auto;
|
|
703
|
+
width: max-content; max-width: min(340px, 70vw); padding: 8px 12px;
|
|
704
|
+
background: var(--panel, #fff); color: var(--text, #0f172a);
|
|
705
|
+
border: 1px solid var(--panel-border, #cbd5e1); border-radius: 8px;
|
|
706
|
+
font-size: 12px; line-height: 1.35;
|
|
707
|
+
}
|
|
708
|
+
.analysis-refresh-status:empty { position: absolute; }
|