@namewta/skills-hub 0.1.49 → 0.1.52
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 +7 -7
- 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 +61 -0
- package/skills/home/home-project-changelog/references/tools.md +28 -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 +42 -38
- package/skills/home/home-project-changelog/scripts/contract.mjs +40 -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 +143 -128
- package/skills/home/home-website/assets/website/scripts/render.mjs +8 -6
- 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 +81 -34
- package/skills/home/home-website/assets/website/site/public/home-assets/site.css +92 -70
- package/skills/home/home-website/assets/website/site/templates/favicon.png +0 -0
- package/skills/home/home-website/assets/website/site/templates/layout.mjs +13 -10
- package/skills/home/home-website/assets/website/site/templates/ledger.mjs +51 -46
- package/skills/home/home-website/assets/website/site/templates/model.mjs +58 -14
- package/skills/home/home-website/assets/website/site/templates/pages.mjs +28 -30
- package/skills/home/home-website/assets/website/site/templates/project-logs.mjs +3 -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 +106 -0
- package/skills/home/home-website/scripts/init.mjs +98 -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
|
@@ -5,10 +5,11 @@ import path from 'node:path';
|
|
|
5
5
|
import { execFileSync, spawnSync } from 'node:child_process';
|
|
6
6
|
import { fileURLToPath, pathToFileURL } from 'node:url';
|
|
7
7
|
import { test } from 'node:test';
|
|
8
|
-
import { parsePullRequest, preparePullRequest, normalizeScope } from '../lib/pull-request.mjs';
|
|
8
|
+
import { parsePullRequest, preparePullRequest, normalizeScope, resolveLocalPullRequest } from '../lib/pull-request.mjs';
|
|
9
9
|
import { materializeTree } from '../lib/git-sources.mjs';
|
|
10
10
|
import { startAnalysisView, parseArgs } from '../bin/serve.mjs';
|
|
11
11
|
import { prepareAnalysisView } from '../bin/prepare.mjs';
|
|
12
|
+
import { evaluateVerification } from '../lib/verification.mjs';
|
|
12
13
|
|
|
13
14
|
const payload = html => JSON.parse(html.match(/id="bauify-analysis">([\s\S]*?)<\/script>/)[1]);
|
|
14
15
|
const git = (root,args) => execFileSync('git',['-C',root,...args],{encoding:'utf8',windowsHide:true,env:{...process.env,GIT_NO_LAZY_FETCH:'1'},stdio:['ignore','pipe','pipe']}).trim();
|
|
@@ -37,7 +38,7 @@ function fixture(t) {
|
|
|
37
38
|
const fetchJSON=async route=>{if(fail)throw Error('simulated capture failure');return route.includes('/files?')?files:route.includes('/compare/')?{merge_base_commit:{sha:base}}:meta;};
|
|
38
39
|
const dependencies={preparePRSources:options=>preparePullRequest(options,{fetchJSON})};
|
|
39
40
|
const args=['--pr','https://github.com/example/project/pull/42','--locale','zh-CN'];
|
|
40
|
-
return {dir,root,base,head,args,dependencies,fail:()=>{fail=true;}};
|
|
41
|
+
return {dir,root,base,head,args,dependencies,meta,fail:()=>{fail=true;}};
|
|
41
42
|
}
|
|
42
43
|
|
|
43
44
|
test('PR options reuse native grammar and reject ambiguous sources',()=>{
|
|
@@ -101,6 +102,48 @@ test('live PR analysis verifies tasks against captured head, retains merge-base
|
|
|
101
102
|
assert.equal(fs.readFileSync(path.join(view.out,'analysis/repo.analysis.html'),'utf8'),last);
|
|
102
103
|
});
|
|
103
104
|
|
|
105
|
+
test('a refreshed PR verifies its prior head task while retaining the merge-base comparison', async t => {
|
|
106
|
+
const f = fixture(t), view = await startAnalysisView([f.root, '--out', path.join(f.dir, 'out'), ...f.args], f.dependencies);
|
|
107
|
+
t.after(() => { view.server.closeAllConnections(); view.server.close(); });
|
|
108
|
+
const post = (route, input, refresh = false) => fetch(view.url + route, { method: 'POST', headers: { Origin: view.url, 'X-Analysis-Token': view.token, 'Content-Type': 'application/json', ...(refresh ? { 'X-Analysis-Refresh': '1' } : {}) }, ...(input ? { body: JSON.stringify(input) } : {}) });
|
|
109
|
+
const first = await post('/analyze');
|
|
110
|
+
assert.equal(first.status, 200, await first.clone().text());
|
|
111
|
+
const initial = payload(await first.text()), finding = initial.findings[0];
|
|
112
|
+
const taskResponse = await post('/task', { ids: [finding.id], expected: { [finding.id]: finding.reviewTarget } });
|
|
113
|
+
assert.equal(taskResponse.status, 200, await taskResponse.clone().text());
|
|
114
|
+
const task = (await taskResponse.json()).task;
|
|
115
|
+
fs.writeFileSync(path.join(f.root, 'a.ts'), 'export function a() { return 2; }\n');
|
|
116
|
+
git(f.root, ['add', 'a.ts']);
|
|
117
|
+
git(f.root, ['-c', 'user.name=Fixture', '-c', 'user.email=fixture@example.invalid', 'commit', '-m', 'next head']);
|
|
118
|
+
f.meta.head.sha = git(f.root, ['rev-parse', 'HEAD']);
|
|
119
|
+
const refreshed = await post('/analyze', null, true);
|
|
120
|
+
assert.equal(refreshed.status, 200, await refreshed.clone().text());
|
|
121
|
+
const result = payload(await refreshed.text());
|
|
122
|
+
assert.equal(result.pullRequest.baseSHA, f.base);
|
|
123
|
+
assert.equal(result.pullRequest.headSHA, f.meta.head.sha);
|
|
124
|
+
const { receipt } = await evaluateVerification(result.verification, task);
|
|
125
|
+
assert.ok(receipt, 'the task uses its original PR head as verification baseline');
|
|
126
|
+
|
|
127
|
+
const cli = fileURLToPath(new URL('../../../bin/archify.mjs', import.meta.url));
|
|
128
|
+
const taskFile = path.join(f.dir, 'first-head.task.json');
|
|
129
|
+
fs.writeFileSync(taskFile, JSON.stringify(task));
|
|
130
|
+
const verifySaved = () => spawnSync(process.execPath, [cli, 'code-analysis', 'verify-change',
|
|
131
|
+
path.join(view.out, 'analysis'), '--task', taskFile], {
|
|
132
|
+
encoding: 'utf8', windowsHide: true, timeout: 30000,
|
|
133
|
+
});
|
|
134
|
+
const accepted = verifySaved();
|
|
135
|
+
assert.equal(accepted.status, 0, accepted.stdout + accepted.stderr);
|
|
136
|
+
assert.deepEqual(JSON.parse(accepted.stdout).analysis, receipt.analysis);
|
|
137
|
+
|
|
138
|
+
const adjacent = path.join(view.out, 'analysis.previous', 'view-context.json');
|
|
139
|
+
const unrelated = JSON.parse(fs.readFileSync(adjacent, 'utf8'));
|
|
140
|
+
unrelated.run.pullRequest.number++;
|
|
141
|
+
fs.writeFileSync(adjacent, JSON.stringify(unrelated));
|
|
142
|
+
const rejected = verifySaved();
|
|
143
|
+
assert.equal(rejected.status, 2, rejected.stdout + rejected.stderr);
|
|
144
|
+
assert.equal(JSON.parse(rejected.stdout).diagnostics[0].code, 'verification/wrong-task-snapshot');
|
|
145
|
+
});
|
|
146
|
+
|
|
104
147
|
test('pinned CLI reviews an exact base and head with renamed source and preserves the last complete report', t => {
|
|
105
148
|
const f = fixture(t);
|
|
106
149
|
const source = fs.readFileSync(path.join(f.root, 'b.ts'), 'utf8');
|
|
@@ -160,3 +203,56 @@ test('pinned CLI reviews an exact base and head with renamed source and preserve
|
|
|
160
203
|
assert.equal(fs.readFileSync(result.receipt.html, 'utf8'), original);
|
|
161
204
|
assert.equal(fs.readdirSync(out).some(name => name.startsWith('analysis.next-')), false);
|
|
162
205
|
});
|
|
206
|
+
|
|
207
|
+
|
|
208
|
+
test('pinned reviews reject a scope absent from both trees', async t => {
|
|
209
|
+
const f = fixture(t);
|
|
210
|
+
await assert.rejects(preparePullRequest({ root: f.root, out: path.join(f.dir, 'bad-scope'), scope: 'not-a-directory', local: { base: f.base, head: f.head } }),
|
|
211
|
+
error => error.diagnostics?.some(diagnostic => diagnostic.code === 'pr/scope-invalid' && diagnostic.subject.scope === 'not-a-directory' && diagnostic.supportedFixes.length > 0));
|
|
212
|
+
});
|
|
213
|
+
|
|
214
|
+
test('scoped pinned preflight identifies a missing tree and gives root recovery guidance', async t => {
|
|
215
|
+
const f = fixture(t);
|
|
216
|
+
fs.mkdirSync(path.join(f.root, 'subdir'));
|
|
217
|
+
await assert.rejects(resolveLocalPullRequest(path.join(f.root, 'subdir'), f.base, f.head, 'missing'),
|
|
218
|
+
error => error.diagnostics?.some(d => d.code === 'pr/scope-invalid' && d.supportedFixes.some(fix => fix.includes('--scope .'))));
|
|
219
|
+
const root = await resolveLocalPullRequest(path.join(f.root, 'subdir'), f.base, f.head, '.');
|
|
220
|
+
assert.equal(root.scope, '.');
|
|
221
|
+
|
|
222
|
+
git(f.root, ['config', 'uploadpack.allowFilter', 'true']);
|
|
223
|
+
const partial = path.join(f.dir, 'treeless');
|
|
224
|
+
git(f.dir, ['clone', '--no-checkout', '--no-local', '--filter=tree:0', pathToFileURL(f.root).href, partial]);
|
|
225
|
+
const baseTree = git(f.root, ['rev-parse', f.base + '^{tree}']);
|
|
226
|
+
const headTree = git(f.root, ['rev-parse', f.head + '^{tree}']);
|
|
227
|
+
assert.throws(() => git(partial, ['cat-file', '-e', baseTree]), 'precondition: base tree is missing');
|
|
228
|
+
assert.throws(() => git(partial, ['cat-file', '-e', headTree]), 'precondition: head tree is missing');
|
|
229
|
+
const identifiesBase = error => error.diagnostics?.some(d =>
|
|
230
|
+
d.code === 'pr/local-object-missing' && d.subject.side === 'base' && d.evidence.commit === f.base && d.supportedFixes.length);
|
|
231
|
+
await assert.rejects(resolveLocalPullRequest(partial, f.base, f.head, 'src'), identifiesBase);
|
|
232
|
+
await assert.rejects(preparePullRequest({
|
|
233
|
+
root: partial, out: path.join(f.dir, 'treeless-out'), local: { head: f.head, base: f.base }, scope: 'src',
|
|
234
|
+
}), identifiesBase);
|
|
235
|
+
assert.throws(() => git(partial, ['cat-file', '-e', baseTree]), 'preflight must not fetch the base tree');
|
|
236
|
+
assert.throws(() => git(partial, ['cat-file', '-e', headTree]), 'preflight must not fetch the head tree');
|
|
237
|
+
});
|
|
238
|
+
|
|
239
|
+
test('scoped local preparation reuses each preflight tree listing', async t => {
|
|
240
|
+
const f = fixture(t);
|
|
241
|
+
fs.mkdirSync(path.join(f.root, 'src'));
|
|
242
|
+
fs.writeFileSync(path.join(f.root, 'src', 'sample.ts'), 'export const sample = 1;\n');
|
|
243
|
+
git(f.root, ['add', 'src']);
|
|
244
|
+
git(f.root, ['-c', 'user.name=Fixture', '-c', 'user.email=fixture@example.invalid', 'commit', '-m', 'scoped']);
|
|
245
|
+
const head = git(f.root, ['rev-parse', 'HEAD']);
|
|
246
|
+
const trace = path.join(f.dir, 'git-trace.log');
|
|
247
|
+
const previous = process.env.GIT_TRACE;
|
|
248
|
+
process.env.GIT_TRACE = trace;
|
|
249
|
+
try {
|
|
250
|
+
const result = await preparePullRequest({ root: f.root, out: path.join(f.dir, 'scoped-out'), scope: 'src', local: { base: head, head } });
|
|
251
|
+
assert.deepEqual(result.manifests.base.files.map(item => item.path), ['sample.ts']);
|
|
252
|
+
assert.equal(fs.readFileSync(path.join(result.roots.head, 'sample.ts'), 'utf8'), 'export const sample = 1;\n');
|
|
253
|
+
} finally {
|
|
254
|
+
if (previous === undefined) delete process.env.GIT_TRACE; else process.env.GIT_TRACE = previous;
|
|
255
|
+
}
|
|
256
|
+
const invocations = fs.readFileSync(trace, 'utf8').split('\n').filter(line => /built-in: git ls-tree\b/.test(line));
|
|
257
|
+
assert.equal(invocations.length, 2, 'one preflight listing per pinned side; materialization does not re-scan');
|
|
258
|
+
});
|
|
@@ -176,6 +176,43 @@ test('check: --new-only without a previous run treats every open finding as new'
|
|
|
176
176
|
}
|
|
177
177
|
});
|
|
178
178
|
|
|
179
|
+
test('check: each PR attempt gates against the same explicit comparison', t => {
|
|
180
|
+
const dir = pyTree();
|
|
181
|
+
t.after(() => fs.rmSync(dir, { recursive: true, force: true }));
|
|
182
|
+
const args = ['.', '--language', 'py', '--json'];
|
|
183
|
+
const comparison = path.join(dir, 'base/findings.json');
|
|
184
|
+
assert.equal(check([...args, '--out', 'base', '--fail-on', 'never'], dir).code, 0);
|
|
185
|
+
const originalBase = fs.readFileSync(comparison);
|
|
186
|
+
|
|
187
|
+
fs.writeFileSync(path.join(dir, 'app/c.py'), 'from app import d\n');
|
|
188
|
+
fs.writeFileSync(path.join(dir, 'app/d.py'), 'from app import c\n');
|
|
189
|
+
const gate = [...args, '--new-only', '--fail-on', 'warning'];
|
|
190
|
+
const first = check([...gate, '--compare', comparison, '--out', 'first'], dir);
|
|
191
|
+
assert.equal(first.code, 1);
|
|
192
|
+
assert.equal(first.json.gate.failing.length, 1);
|
|
193
|
+
assert.equal(first.json.gate.failing[0].code, 'coupling/import-cycle');
|
|
194
|
+
assert.match(first.json.gate.failing[0].where, /^app\/(c|d)\.py:1$/);
|
|
195
|
+
const firstReport = path.join(dir, 'first/findings.json');
|
|
196
|
+
const originalReport = fs.readFileSync(firstReport);
|
|
197
|
+
|
|
198
|
+
const retry = check([...gate, '--compare', comparison, '--out', 'retry'], dir);
|
|
199
|
+
assert.equal(retry.code, 1);
|
|
200
|
+
const [newCycle] = first.json.gate.failing;
|
|
201
|
+
assert.deepEqual(retry.json.gate.failing.map(finding => finding.id), [newCycle.id]);
|
|
202
|
+
assert.deepEqual(fs.readFileSync(firstReport), originalReport);
|
|
203
|
+
assert.deepEqual(fs.readFileSync(comparison), originalBase);
|
|
204
|
+
const retryReport = JSON.parse(fs.readFileSync(path.join(dir, 'retry/findings.json'), 'utf8'));
|
|
205
|
+
assert.ok(retryReport.diagnostics.some(finding => finding.id === newCycle.id));
|
|
206
|
+
|
|
207
|
+
fs.writeFileSync(path.join(dir, 'invalid.json'), '{}');
|
|
208
|
+
for (const file of ['missing.json', 'invalid.json']) {
|
|
209
|
+
const failed = check([...gate, '--compare', file, '--out', 'unwritten'], dir);
|
|
210
|
+
assert.equal(failed.code, 2);
|
|
211
|
+
assert.equal(failed.json.diagnostics[0].code, 'cli/input-invalid');
|
|
212
|
+
}
|
|
213
|
+
assert.equal(fs.existsSync(path.join(dir, 'unwritten')), false);
|
|
214
|
+
});
|
|
215
|
+
|
|
179
216
|
test('check: usage and analysis errors exit 2 with a diagnostic, never a stack', () => {
|
|
180
217
|
const dir = pyTree();
|
|
181
218
|
try {
|
|
@@ -60,8 +60,9 @@ test('source links preserve distinct finding lines and never invent line one', (
|
|
|
60
60
|
assert.match(render({incoming:[],outgoing:[{evidence:[{file:'hub.py',line:28}]}]},'hub.py'),/data-line="28"/);
|
|
61
61
|
const start=script.indexOf(' function showCode('),end=script.indexOf(' function showDetail(',start);
|
|
62
62
|
let pane={hidden:true,innerHTML:'',querySelector:()=>({addEventListener(){},scrollIntoView(){}})};
|
|
63
|
-
const show=new Function('tr','codePane','data','detail','function readerPage(){} const document={documentElement:{setAttribute(){},removeAttribute(){}}}; function esc(x){return x} '+script.slice(start,end)+';return showCode;')(createTranslator(),pane,{snippets:{'worker.py':{lines:Array.from({length:100},(_,i)=>'code '+(i+1))}}},{});
|
|
63
|
+
const show=new Function('tr','codePane','data','detail','const readerView="Dependency"; function readerPage(){} const document={documentElement:{setAttribute(){},removeAttribute(){}}}; function esc(x){return x} '+script.slice(start,end)+';return showCode;')(createTranslator(),pane,{snippets:{'worker.py':{lines:Array.from({length:100},(_,i)=>'code '+(i+1))}}},{});
|
|
64
64
|
show('worker.py',47,'','amber');
|
|
65
|
+
assert.match(pane.innerHTML,/← Dependency/);
|
|
65
66
|
assert.match(pane.innerHTML,/Source · line 47/);
|
|
66
67
|
assert.match(pane.innerHTML,/<span class="ln hit amber"><i>47<\/i>code 47/);
|
|
67
68
|
assert.equal((pane.innerHTML.match(/class="ln/g)||[]).length,9);
|
|
@@ -28,10 +28,11 @@ function fixtureRun(t) {
|
|
|
28
28
|
const byCode = (findings, code) => findings.diagnostics.find((d) => d.code === code);
|
|
29
29
|
const edit = (dir, rel, fn) => { const f = path.join(dir, rel); fs.writeFileSync(f, fn(fs.readFileSync(f, 'utf8'))); };
|
|
30
30
|
|
|
31
|
-
// Python version and
|
|
31
|
+
// Python version and capture identity differ by machine; everything else must match.
|
|
32
32
|
function normalize(name, text) {
|
|
33
33
|
if (name.endsWith('.md')) return text.replace(/\(python@[^)]*\)/g, '(python@X)').replace(/Snapshot: `[0-9a-f]{64}`/g, 'Snapshot: `X`');
|
|
34
|
-
return text.replace(/"python@[^"]*"/g, '"python@X"').replace(/"snapshotId": "[0-9a-f]{64}"/g, '"snapshotId": "X"')
|
|
34
|
+
return text.replace(/"python@[^"]*"/g, '"python@X"').replace(/"snapshotId": "[0-9a-f]{64}"/g, '"snapshotId": "X"')
|
|
35
|
+
.replace(/"analysisSha256": "[0-9a-f]{64}"/g, '"analysisSha256": "X"');
|
|
35
36
|
}
|
|
36
37
|
|
|
37
38
|
test('task fixtures: checked-in contract examples match a fresh generation', () => {
|
|
@@ -0,0 +1,216 @@
|
|
|
1
|
+
import assert from 'node:assert/strict';
|
|
2
|
+
import { createHash } from 'node:crypto';
|
|
3
|
+
import fs from 'node:fs';
|
|
4
|
+
import os from 'node:os';
|
|
5
|
+
import path from 'node:path';
|
|
6
|
+
import { test } from 'node:test';
|
|
7
|
+
import { matchingPreviousPullRequest, retainVerificationBaselines, sameVerificationRepository, verificationContexts } from '../lib/verification-history.mjs';
|
|
8
|
+
import { analysisDigest, taskAnalysisDigest } from '../lib/verification-context.mjs';
|
|
9
|
+
import { evaluateVerification } from '../lib/verification.mjs';
|
|
10
|
+
|
|
11
|
+
const fixture = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/findings.json', import.meta.url), 'utf8'));
|
|
12
|
+
const snapshotId = (number) => number.toString(16).padStart(64, '0');
|
|
13
|
+
const capture = (number, repository = {}) => ({
|
|
14
|
+
...fixture,
|
|
15
|
+
repository: { ...fixture.repository, root: '.', sourceKind: 'working-tree', snapshotId: snapshotId(number), ...repository },
|
|
16
|
+
});
|
|
17
|
+
|
|
18
|
+
let testRoot;
|
|
19
|
+
function workspace(t) {
|
|
20
|
+
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-verification-history-'));
|
|
21
|
+
t.after(() => fs.rmSync(scratch, { recursive: true, force: true }));
|
|
22
|
+
testRoot = scratch;
|
|
23
|
+
const now = Date.now;
|
|
24
|
+
t.mock.method(Date, 'now', () => now() + 2000);
|
|
25
|
+
return (name) => { const dir = path.join(scratch, String(name)); fs.mkdirSync(dir, { recursive: true }); return dir; };
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
const historyFile = (dir) => path.join(dir, 'verification-history.json');
|
|
29
|
+
const savedIds = (dir) => JSON.parse(fs.readFileSync(historyFile(dir), 'utf8')).map(({ repository }) => repository.snapshotId);
|
|
30
|
+
const beforeIds = (contexts) => contexts.map(({ before }) => before.snapshotId);
|
|
31
|
+
|
|
32
|
+
test('verification history keeps the six newest distinct captures across staged runs', t => {
|
|
33
|
+
const directory = workspace(t);
|
|
34
|
+
let published = directory('first');
|
|
35
|
+
retainVerificationBaselines(published, published, null, capture(1), testRoot);
|
|
36
|
+
const scans = [1, 2, 3, 4, 5, 6, 7, 8, 8, 8];
|
|
37
|
+
for (const [index, number] of scans.entries()) {
|
|
38
|
+
const next = directory(index);
|
|
39
|
+
retainVerificationBaselines(next, published, capture(number), capture(scans[index + 1] ?? number), testRoot);
|
|
40
|
+
published = next;
|
|
41
|
+
}
|
|
42
|
+
|
|
43
|
+
const expected = [8, 7, 6, 5, 4, 3].map(snapshotId);
|
|
44
|
+
assert.deepEqual(savedIds(published), expected);
|
|
45
|
+
assert.deepEqual(beforeIds(verificationContexts(published, capture(8), capture(9), { files: [] })), expected);
|
|
46
|
+
});
|
|
47
|
+
|
|
48
|
+
test('verification history fits a byte budget and keeps smaller eligible captures', t => {
|
|
49
|
+
const directory = workspace(t);
|
|
50
|
+
const initial = directory('initial');
|
|
51
|
+
const published = directory('published');
|
|
52
|
+
const next = directory('next');
|
|
53
|
+
const current = capture(4);
|
|
54
|
+
retainVerificationBaselines(initial, initial, null, current, testRoot);
|
|
55
|
+
const evidence = (number, length) => {
|
|
56
|
+
const sourceText = '界'.repeat(length);
|
|
57
|
+
return {
|
|
58
|
+
...capture(number),
|
|
59
|
+
externalEvidence: [{ path: 'supplemental.py', sourceText, sha256: createHash('sha256').update(sourceText).digest('hex') }],
|
|
60
|
+
};
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
retainVerificationBaselines(initial, initial, capture(1), current, testRoot);
|
|
64
|
+
retainVerificationBaselines(published, initial, evidence(2, 800_000), current, testRoot);
|
|
65
|
+
retainVerificationBaselines(next, published, evidence(3, 800_000), current, testRoot);
|
|
66
|
+
|
|
67
|
+
assert.ok(fs.statSync(historyFile(next)).size <= 4 * 1024 * 1024);
|
|
68
|
+
assert.deepEqual(savedIds(next), [3, 1].map(snapshotId));
|
|
69
|
+
|
|
70
|
+
const oversized = directory('oversized');
|
|
71
|
+
retainVerificationBaselines(oversized, next, evidence(5, 1_400_000), current, testRoot);
|
|
72
|
+
assert.deepEqual(savedIds(oversized), [3, 1].map(snapshotId));
|
|
73
|
+
});
|
|
74
|
+
|
|
75
|
+
test('verification history excludes other roots and source kinds and falls back to the prior capture', t => {
|
|
76
|
+
const directory = workspace(t);
|
|
77
|
+
const previous = directory('previous');
|
|
78
|
+
const next = directory('next');
|
|
79
|
+
const adjacent = capture(1);
|
|
80
|
+
const wrongRoot = capture(2, { root: 'another-project' });
|
|
81
|
+
const wrongKind = capture(3, { sourceKind: 'git-tree' });
|
|
82
|
+
const current = capture(4);
|
|
83
|
+
retainVerificationBaselines(previous, previous, null, current, testRoot);
|
|
84
|
+
|
|
85
|
+
assert.deepEqual(beforeIds(verificationContexts(previous, adjacent, current, { files: [] })), [snapshotId(1)]);
|
|
86
|
+
fs.writeFileSync(historyFile(previous), JSON.stringify([wrongRoot, wrongKind, adjacent]));
|
|
87
|
+
|
|
88
|
+
retainVerificationBaselines(next, previous, wrongRoot, current, testRoot);
|
|
89
|
+
assert.deepEqual(savedIds(next), [snapshotId(1)]);
|
|
90
|
+
assert.deepEqual(beforeIds(verificationContexts(previous, wrongKind, current, { files: [] })), [snapshotId(1)]);
|
|
91
|
+
});
|
|
92
|
+
|
|
93
|
+
|
|
94
|
+
test('history does not cross repositories sharing one output directory', t => {
|
|
95
|
+
const directory = workspace(t);
|
|
96
|
+
const repoA = directory('repo-a'), repoB = directory('repo-b');
|
|
97
|
+
const a = directory('a'), b = directory('b'), first = directory('first');
|
|
98
|
+
retainVerificationBaselines(first, first, null, capture(1), repoA);
|
|
99
|
+
retainVerificationBaselines(a, first, capture(1), capture(2), repoA);
|
|
100
|
+
assert.deepEqual(savedIds(a), [snapshotId(1)]);
|
|
101
|
+
assert.deepEqual(retainVerificationBaselines(b, a, capture(2), capture(3), repoB), []);
|
|
102
|
+
assert.equal(fs.existsSync(historyFile(b)), false);
|
|
103
|
+
fs.rmdirSync(repoA); fs.mkdirSync(repoA);
|
|
104
|
+
Date.now.mock.restore();
|
|
105
|
+
const replaced = directory('replaced');
|
|
106
|
+
assert.deepEqual(retainVerificationBaselines(replaced, a, capture(2), capture(3), repoA), [], 'a fresh replacement at the same path cannot inherit history');
|
|
107
|
+
assert.equal(sameVerificationRepository(replaced, a), false);
|
|
108
|
+
});
|
|
109
|
+
|
|
110
|
+
test('a capture made within the directory creation window cannot later establish ownership', t => {
|
|
111
|
+
const directory = workspace(t);
|
|
112
|
+
const repo = directory('repo'), first = directory('first'), later = directory('later');
|
|
113
|
+
const created = Math.ceil(fs.statSync(repo).birthtimeMs);
|
|
114
|
+
Date.now.mock.mockImplementation(() => created);
|
|
115
|
+
assert.deepEqual(retainVerificationBaselines(first, first, null, capture(1), repo), []);
|
|
116
|
+
assert.equal(sameVerificationRepository(first, first), false);
|
|
117
|
+
Date.now.mock.mockImplementation(() => created + 2000);
|
|
118
|
+
assert.deepEqual(retainVerificationBaselines(later, first, capture(1), capture(2), repo), []);
|
|
119
|
+
assert.equal(sameVerificationRepository(later, later), true);
|
|
120
|
+
});
|
|
121
|
+
|
|
122
|
+
test('captures differing only in supplemental evidence use one task identity', t => {
|
|
123
|
+
const directory = workspace(t), first = directory('first'), next = directory('next'), last = directory('last');
|
|
124
|
+
const baseline = capture(1), current = capture(2);
|
|
125
|
+
retainVerificationBaselines(first, first, null, baseline, testRoot);
|
|
126
|
+
retainVerificationBaselines(next, first, baseline, current, testRoot);
|
|
127
|
+
const bytes = 'additional source';
|
|
128
|
+
const supplemented = { ...baseline, externalEvidence: [{ path: 'source.py', sourceText: bytes, sha256: createHash('sha256').update(bytes).digest('hex') }] };
|
|
129
|
+
retainVerificationBaselines(last, next, supplemented, current, testRoot);
|
|
130
|
+
assert.equal(savedIds(last).length, 1);
|
|
131
|
+
const contexts = verificationContexts(last, supplemented, current, { files: [] });
|
|
132
|
+
assert.equal(beforeIds(contexts).length, 1);
|
|
133
|
+
assert.equal(contexts[0].before.analysisSha256, analysisDigest(baseline), 'checks stay bound to the original retained capture');
|
|
134
|
+
});
|
|
135
|
+
|
|
136
|
+
test('an oversized duplicate does not evict its smaller retained baseline', t => {
|
|
137
|
+
const directory = workspace(t), first = directory('first'), next = directory('next'), last = directory('last');
|
|
138
|
+
const baseline = capture(1), current = capture(2);
|
|
139
|
+
retainVerificationBaselines(first, first, null, baseline, testRoot);
|
|
140
|
+
retainVerificationBaselines(next, first, baseline, current, testRoot);
|
|
141
|
+
const sourceText = 'x'.repeat(4 * 1024 * 1024);
|
|
142
|
+
const oversized = { ...baseline, externalEvidence: [{ path: 'source.py', sourceText, sha256: createHash('sha256').update(sourceText).digest('hex') }] };
|
|
143
|
+
retainVerificationBaselines(last, next, oversized, current, testRoot);
|
|
144
|
+
assert.deepEqual(savedIds(last), [snapshotId(1)]);
|
|
145
|
+
});
|
|
146
|
+
|
|
147
|
+
test('an oversized owned adjacent capture remains usable outside retained history', t => {
|
|
148
|
+
const directory = workspace(t), previous = directory('previous'), currentDir = directory('current');
|
|
149
|
+
const current = capture(2), sourceText = 'x'.repeat(5 * 1024 * 1024);
|
|
150
|
+
const oversized = { ...capture(1), externalEvidence: [{ path: 'source.py', sourceText, sha256: createHash('sha256').update(sourceText).digest('hex') }] };
|
|
151
|
+
retainVerificationBaselines(previous, previous, null, current, testRoot);
|
|
152
|
+
assert.deepEqual(retainVerificationBaselines(currentDir, previous, oversized, current, testRoot), [], 'the 4 MiB history cap still applies');
|
|
153
|
+
assert.equal(sameVerificationRepository(currentDir, previous), true);
|
|
154
|
+
assert.deepEqual(beforeIds(verificationContexts(currentDir, oversized, current, { files: [] })), [snapshotId(1)], 'the independently owned adjacent capture can still be compared');
|
|
155
|
+
});
|
|
156
|
+
|
|
157
|
+
test('checks from a supplemental-only change remain usable after an unchanged rerun', async t => {
|
|
158
|
+
const directory = workspace(t), first = directory('first'), next = directory('next'), last = directory('last');
|
|
159
|
+
const baseline = capture(1), current = capture(2);
|
|
160
|
+
const task = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/complexity.task.json', import.meta.url), 'utf8'));
|
|
161
|
+
task.source.snapshotId = baseline.repository.snapshotId;
|
|
162
|
+
task.source.analysisSha256 = taskAnalysisDigest(baseline);
|
|
163
|
+
retainVerificationBaselines(first, first, null, baseline, testRoot);
|
|
164
|
+
retainVerificationBaselines(next, first, baseline, current, testRoot);
|
|
165
|
+
const contexts = verificationContexts(next, baseline, current, { files: [] });
|
|
166
|
+
const initial = await evaluateVerification(contexts, task);
|
|
167
|
+
assert.ok(initial.checksTemplate, initial.error);
|
|
168
|
+
const sourceText = 'additional source';
|
|
169
|
+
const supplemental = { ...baseline, externalEvidence: [{ path: 'source.py', sourceText, sha256: createHash('sha256').update(sourceText).digest('hex') }] };
|
|
170
|
+
retainVerificationBaselines(last, next, supplemental, current, testRoot);
|
|
171
|
+
const rerun = await evaluateVerification(verificationContexts(last, supplemental, current, { files: [] }), task, initial.checksTemplate);
|
|
172
|
+
assert.ok(rerun.receipt, rerun.error);
|
|
173
|
+
assert.equal(rerun.receipt.projectChecks.status, 'reported-not-independently-verified');
|
|
174
|
+
});
|
|
175
|
+
|
|
176
|
+
test('a prior PR head is accepted only for the same verified PR and pins', t => {
|
|
177
|
+
const directory = workspace(t), previousDir = directory('pr-previous');
|
|
178
|
+
const oldHead = '1'.repeat(40), newHead = '2'.repeat(40), base = '3'.repeat(40);
|
|
179
|
+
const oldPR = { repository: 'owner/repo', number: 42, scope: '.', baseSHA: base, headSHA: oldHead };
|
|
180
|
+
const currentPR = { ...oldPR, headSHA: newHead };
|
|
181
|
+
const previous = capture(1, { sourceKind: 'git-tree', revision: oldHead });
|
|
182
|
+
const current = capture(2, { sourceKind: 'git-tree', revision: newHead });
|
|
183
|
+
fs.writeFileSync(path.join(previousDir, 'findings.json'), JSON.stringify(previous));
|
|
184
|
+
fs.writeFileSync(path.join(previousDir, 'view-context.json'), JSON.stringify({ run: { pullRequest: oldPR } }));
|
|
185
|
+
assert.deepEqual(matchingPreviousPullRequest(previousDir, current, currentPR), previous);
|
|
186
|
+
assert.deepEqual(matchingPreviousPullRequest(previousDir, current, { ...currentPR, repository: 'Owner/Repo' }), previous, 'GitHub repository identity is case-insensitive');
|
|
187
|
+
for (const change of [{ number: 43 }, { repository: 'other/repo' }, { scope: 'src' }, { baseSHA: '4'.repeat(40) }, { headSHA: '5'.repeat(40) }, { local: true }]) {
|
|
188
|
+
assert.equal(matchingPreviousPullRequest(previousDir, current, { ...currentPR, ...change }), null);
|
|
189
|
+
}
|
|
190
|
+
});
|
|
191
|
+
|
|
192
|
+
test('legacy captures without ownership cannot be migrated by command alone', t => {
|
|
193
|
+
const directory = workspace(t), old = directory('old'), adjacent = directory('adjacent'), migrated = directory('migrated'), rejected = directory('rejected');
|
|
194
|
+
const resume = { command: 'archify serve /example/repo --out /example/out', shell: 'POSIX sh' };
|
|
195
|
+
const context = { run: { resume } };
|
|
196
|
+
fs.writeFileSync(path.join(old, 'view-context.json'), JSON.stringify(context));
|
|
197
|
+
fs.writeFileSync(path.join(adjacent, 'view-context.json'), JSON.stringify(context));
|
|
198
|
+
assert.equal(sameVerificationRepository(old, adjacent), false);
|
|
199
|
+
assert.deepEqual(retainVerificationBaselines(migrated, old, capture(1), capture(2), testRoot, resume), []);
|
|
200
|
+
assert.deepEqual(retainVerificationBaselines(rejected, old, capture(1), capture(2), testRoot, { ...resume, command: 'other repo' }), []);
|
|
201
|
+
fs.writeFileSync(path.join(old, 'verification-owner.json'), '{"identity":"invalid"}');
|
|
202
|
+
assert.equal(sameVerificationRepository(old, adjacent), false, 'invalid explicit ownership cannot fall back to legacy metadata');
|
|
203
|
+
const invalid = directory('invalid');
|
|
204
|
+
assert.deepEqual(retainVerificationBaselines(invalid, old, capture(1), capture(2), testRoot, resume), []);
|
|
205
|
+
});
|
|
206
|
+
|
|
207
|
+
test('a legacy resume command cannot establish repository continuity after replacement', t => {
|
|
208
|
+
const directory = workspace(t), repo = directory('repo'), old = directory('legacy'), next = directory('next');
|
|
209
|
+
const resume = { command: `archify serve ${repo} --out ${old}`, shell: 'POSIX sh' };
|
|
210
|
+
fs.writeFileSync(path.join(old, 'view-context.json'), JSON.stringify({ run: { resume } }));
|
|
211
|
+
fs.rmdirSync(repo); fs.mkdirSync(repo);
|
|
212
|
+
assert.deepEqual(retainVerificationBaselines(next, old, capture(1), capture(2), repo, resume), [], 'an unchanged command cannot prove a legacy capture belongs to the replacement checkout');
|
|
213
|
+
const oversized = { ...capture(1), externalEvidence: [{ path: 'large.py', sourceText: 'x'.repeat(5 * 1024 * 1024) }] };
|
|
214
|
+
const large = directory('large');
|
|
215
|
+
assert.deepEqual(retainVerificationBaselines(large, old, oversized, capture(2), repo, resume), [], 'oversized legacy findings cannot bypass the same ownership rule');
|
|
216
|
+
});
|
|
@@ -7,6 +7,8 @@ import { test } from 'node:test';
|
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { evaluateVerification } from '../lib/verification.mjs';
|
|
9
9
|
import { verificationContext } from '../lib/verification-context.mjs';
|
|
10
|
+
import { schemaErrors } from '../schemas/index.mjs';
|
|
11
|
+
import { Ajv2020 } from '../vendor/deps.cjs';
|
|
10
12
|
|
|
11
13
|
test('receipt distinguishes an unchanged external report from a detected source fix and cannot transfer check results to a different analysis', async () => {
|
|
12
14
|
const sha = (char) => char.repeat(64);
|
|
@@ -42,6 +44,12 @@ test('receipt distinguishes an unchanged external report from a detected source
|
|
|
42
44
|
assert.equal((await evaluateVerification(refreshed, task, checks)).error, 'wrong-checks-snapshot', 'report bytes can change even when source snapshot does not');
|
|
43
45
|
assert.equal((await evaluateVerification(ctx, { ...task, source: { ...task.source, snapshotId: sha('0') } }, checks)).error, 'wrong-task-snapshot');
|
|
44
46
|
assert.equal((await evaluateVerification(ctx, { ...task, findings: [{ ...diagnostics[1], external: { ...external, reviewDigest: sha('0') } }] })).error, 'wrong-task-findings');
|
|
47
|
+
assert.equal((await evaluateVerification([ctx, refreshed], task)).error, 'wrong-task-snapshot',
|
|
48
|
+
'legacy task JSON cannot silently choose between different reports for the same code snapshot');
|
|
49
|
+
const pinned = { ...task, source: { ...task.source, analysisSha256: ctx.before.analysisSha256 } };
|
|
50
|
+
const otherBefore = { ...refreshed, taskAnalysisSha256: sha('0'), before: { ...refreshed.before, analysisSha256: sha('0') } };
|
|
51
|
+
assert.deepEqual((await evaluateVerification([otherBefore, ctx], pinned)).receipt, result.receipt);
|
|
52
|
+
assert.equal((await evaluateVerification([otherBefore], pinned)).error, 'wrong-task-snapshot');
|
|
45
53
|
const limited = verificationContext(previous, current, { comparison: { ...review.comparison,
|
|
46
54
|
comparable: false, reasons: [{ code: 'config-changed' }], new: ['unaudited-addition'] } });
|
|
47
55
|
const limitedResult = await evaluateVerification(limited, task);
|
|
@@ -82,3 +90,117 @@ test('verify-change returns exit 2 and separates missing comparisons from malfor
|
|
|
82
90
|
assert.equal(diagnostic.code, 'cli/input-not-json');
|
|
83
91
|
assert.equal(diagnostic.subject.input, 'task');
|
|
84
92
|
});
|
|
93
|
+
|
|
94
|
+
|
|
95
|
+
test('a pinned review with a missing base never falls back to an adjacent working-tree capture', t => {
|
|
96
|
+
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-pinned-verify-'));
|
|
97
|
+
t.after(() => fs.rmSync(scratch, { recursive: true, force: true }));
|
|
98
|
+
const dir = path.join(scratch, 'analysis'), previousDir = path.join(scratch, 'analysis.previous');
|
|
99
|
+
fs.mkdirSync(dir); fs.mkdirSync(previousDir);
|
|
100
|
+
const findings = fs.readFileSync(new URL('./fixtures/tasks/findings.json', import.meta.url));
|
|
101
|
+
fs.writeFileSync(path.join(dir, 'findings.json'), findings);
|
|
102
|
+
fs.writeFileSync(path.join(previousDir, 'findings.json'), findings);
|
|
103
|
+
fs.writeFileSync(path.join(dir, 'raw-facts.json'), JSON.stringify({ files: [] }));
|
|
104
|
+
fs.writeFileSync(path.join(dir, 'view-context.json'), JSON.stringify({ run: { pullRequest: { local: true } } }));
|
|
105
|
+
const identity = JSON.stringify({ identity: 'a'.repeat(64) });
|
|
106
|
+
fs.writeFileSync(path.join(dir, 'verification-owner.json'), identity);
|
|
107
|
+
fs.writeFileSync(path.join(previousDir, 'verification-owner.json'), identity);
|
|
108
|
+
const task = path.join(scratch, 'task.json'); fs.writeFileSync(task, '{}');
|
|
109
|
+
const cli = fileURLToPath(new URL('../../../bin/archify.mjs', import.meta.url));
|
|
110
|
+
const result = spawnSync(process.execPath, [cli, 'code-analysis', 'verify-change', dir, '--task', task], { encoding: 'utf8' });
|
|
111
|
+
assert.equal(result.status, 2, result.stdout + result.stderr);
|
|
112
|
+
assert.equal(JSON.parse(result.stdout).diagnostics[0].code, 'verification/no-comparison');
|
|
113
|
+
});
|
|
114
|
+
|
|
115
|
+
test('verify-change rejects an unowned legacy adjacent pair even if its command matches', t => {
|
|
116
|
+
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-legacy-verify-'));
|
|
117
|
+
t.after(() => fs.rmSync(scratch, { recursive: true, force: true }));
|
|
118
|
+
const dir = path.join(scratch, 'analysis'), previousDir = path.join(scratch, 'analysis.previous');
|
|
119
|
+
fs.mkdirSync(dir); fs.mkdirSync(previousDir);
|
|
120
|
+
const previous = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/findings.json', import.meta.url), 'utf8'));
|
|
121
|
+
const current = structuredClone(previous);
|
|
122
|
+
current.repository.snapshotId = '2'.repeat(64);
|
|
123
|
+
const task = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/complexity.task.json', import.meta.url), 'utf8'));
|
|
124
|
+
const context = { run: { resume: { command: 'archify serve /example/repo --out /example/out', shell: 'POSIX sh' } } };
|
|
125
|
+
fs.writeFileSync(path.join(previousDir, 'findings.json'), JSON.stringify(previous));
|
|
126
|
+
fs.writeFileSync(path.join(dir, 'findings.json'), JSON.stringify(current));
|
|
127
|
+
fs.writeFileSync(path.join(dir, 'raw-facts.json'), JSON.stringify({ files: [] }));
|
|
128
|
+
for (const folder of [dir, previousDir]) fs.writeFileSync(path.join(folder, 'view-context.json'), JSON.stringify(context));
|
|
129
|
+
const taskPath = path.join(scratch, 'task.json'); fs.writeFileSync(taskPath, JSON.stringify(task));
|
|
130
|
+
const cli = fileURLToPath(new URL('../../../bin/archify.mjs', import.meta.url));
|
|
131
|
+
const result = spawnSync(process.execPath, [cli, 'code-analysis', 'verify-change', dir, '--task', taskPath], { encoding: 'utf8' });
|
|
132
|
+
assert.equal(result.status, 2, result.stdout + result.stderr);
|
|
133
|
+
assert.equal(JSON.parse(result.stdout).diagnostics[0].code, 'verification/no-comparison');
|
|
134
|
+
previous.externalEvidence = [{ path: 'large.py', sourceText: 'x'.repeat(5 * 1024 * 1024) }];
|
|
135
|
+
fs.writeFileSync(path.join(previousDir, 'findings.json'), JSON.stringify(previous));
|
|
136
|
+
fs.writeFileSync(path.join(dir, 'verification-owner.json'), JSON.stringify({ identity: 'a'.repeat(64) }));
|
|
137
|
+
const oversized = spawnSync(process.execPath, [cli, 'code-analysis', 'verify-change', dir, '--task', taskPath], { encoding: 'utf8' });
|
|
138
|
+
assert.equal(oversized.status, 2, oversized.stdout + oversized.stderr);
|
|
139
|
+
assert.equal(JSON.parse(oversized.stdout).diagnostics[0].code, 'verification/no-comparison', 'an unowned oversized legacy capture cannot be trusted as adjacent evidence');
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
test('explicit legacy baseline comparison stays inconclusive and does not adopt the report', t => {
|
|
143
|
+
const scratch = fs.mkdtempSync(path.join(os.tmpdir(), 'archify-legacy-explicit-'));
|
|
144
|
+
t.after(() => fs.rmSync(scratch, { recursive: true, force: true }));
|
|
145
|
+
const dir = path.join(scratch, 'analysis'), baseline = path.join(scratch, 'legacy.json');
|
|
146
|
+
fs.mkdirSync(dir);
|
|
147
|
+
const previous = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/findings.json', import.meta.url), 'utf8'));
|
|
148
|
+
const current = structuredClone(previous);
|
|
149
|
+
current.repository.snapshotId = '2'.repeat(64);
|
|
150
|
+
const task = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/complexity.task.json', import.meta.url), 'utf8'));
|
|
151
|
+
delete task.source.analysisSha256;
|
|
152
|
+
previous.externalEvidence = [{ path: 'large.py', sourceText: 'x'.repeat(5 * 1024 * 1024), sha256: 'a'.repeat(64) }];
|
|
153
|
+
fs.writeFileSync(baseline, JSON.stringify(previous));
|
|
154
|
+
fs.writeFileSync(path.join(dir, 'findings.json'), JSON.stringify(current));
|
|
155
|
+
fs.writeFileSync(path.join(dir, 'raw-facts.json'), JSON.stringify({ files: [] }));
|
|
156
|
+
const taskPath = path.join(scratch, 'task.json'); fs.writeFileSync(taskPath, JSON.stringify(task));
|
|
157
|
+
const cli = fileURLToPath(new URL('../../../bin/archify.mjs', import.meta.url));
|
|
158
|
+
const args = [cli, 'code-analysis', 'verify-change', dir, '--task', taskPath, '--unverified-baseline', baseline];
|
|
159
|
+
const result = spawnSync(process.execPath, args, { encoding: 'utf8' });
|
|
160
|
+
assert.equal(result.status, 0, result.stdout + result.stderr);
|
|
161
|
+
const receipt = JSON.parse(result.stdout);
|
|
162
|
+
assert.equal(receipt.analysis.comparable, false);
|
|
163
|
+
assert.ok(receipt.analysis.reasons.includes('legacy-owner-unverified'));
|
|
164
|
+
assert.ok(receipt.analysis.selected.every(row => row.outcome === 'inconclusive'));
|
|
165
|
+
assert.equal(receipt.analysis.newCount, null);
|
|
166
|
+
assert.equal(fs.existsSync(path.join(dir, 'verification-owner.json')), false);
|
|
167
|
+
assert.equal(fs.existsSync(path.join(dir, 'verification-history.json')), false);
|
|
168
|
+
const template = spawnSync(process.execPath, [...args, '--checks-template'], { encoding: 'utf8' });
|
|
169
|
+
assert.equal(template.status, 0, template.stdout + template.stderr);
|
|
170
|
+
const checks = path.join(scratch, 'checks.json'); fs.writeFileSync(checks, template.stdout);
|
|
171
|
+
const withChecks = spawnSync(process.execPath, [...args, '--checks', checks], { encoding: 'utf8' });
|
|
172
|
+
assert.equal(withChecks.status, 0, withChecks.stdout + withChecks.stderr);
|
|
173
|
+
assert.equal(JSON.parse(withChecks.stdout).analysis.comparable, false);
|
|
174
|
+
task.source.snapshotId = '3'.repeat(64); fs.writeFileSync(taskPath, JSON.stringify(task));
|
|
175
|
+
const mismatch = spawnSync(process.execPath, args, { encoding: 'utf8' });
|
|
176
|
+
assert.equal(mismatch.status, 2);
|
|
177
|
+
assert.equal(JSON.parse(mismatch.stdout).diagnostics[0].code, 'verification/wrong-task-snapshot');
|
|
178
|
+
fs.writeFileSync(path.join(dir, 'view-context.json'), JSON.stringify({ run: { pullRequest: { local: true } } }));
|
|
179
|
+
const pinned = spawnSync(process.execPath, args, { encoding: 'utf8' });
|
|
180
|
+
assert.equal(pinned.status, 2);
|
|
181
|
+
assert.equal(JSON.parse(pinned.stdout).diagnostics[0].code, 'cli/usage');
|
|
182
|
+
fs.unlinkSync(path.join(dir, 'view-context.json'));
|
|
183
|
+
fs.writeFileSync(baseline, '{broken');
|
|
184
|
+
const invalid = spawnSync(process.execPath, args, { encoding: 'utf8' });
|
|
185
|
+
assert.equal(invalid.status, 2);
|
|
186
|
+
assert.equal(JSON.parse(invalid.stdout).diagnostics[0].code, 'cli/input-invalid');
|
|
187
|
+
fs.truncateSync(baseline, 64 * 1024 * 1024 + 1);
|
|
188
|
+
const tooLarge = spawnSync(process.execPath, args, { encoding: 'utf8' });
|
|
189
|
+
assert.equal(tooLarge.status, 2);
|
|
190
|
+
assert.equal(JSON.parse(tooLarge.stdout).diagnostics[0].code, 'cli/input-invalid');
|
|
191
|
+
});
|
|
192
|
+
|
|
193
|
+
|
|
194
|
+
test('task fingerprint is optional for current readers but rejected by an older strict schema', () => {
|
|
195
|
+
const schema = JSON.parse(fs.readFileSync(new URL('../schemas/ai-task.schema.json', import.meta.url), 'utf8'));
|
|
196
|
+
const task = JSON.parse(fs.readFileSync(new URL('./fixtures/tasks/complexity.task.json', import.meta.url), 'utf8'));
|
|
197
|
+
assert.deepEqual(schemaErrors('ai-task', task), []);
|
|
198
|
+
const legacyTask = structuredClone(task);
|
|
199
|
+
delete legacyTask.source.analysisSha256;
|
|
200
|
+
assert.deepEqual(schemaErrors('ai-task', legacyTask), []);
|
|
201
|
+
delete schema.properties.source.properties.analysisSha256;
|
|
202
|
+
const oldValidate = new Ajv2020({ allErrors: true, strict: true, strictRequired: false }).compile(schema);
|
|
203
|
+
assert.equal(oldValidate(legacyTask), true);
|
|
204
|
+
assert.equal(oldValidate(task), false);
|
|
205
|
+
assert.ok(oldValidate.errors.some(error => error.instancePath === '/source' && error.params.additionalProperty === 'analysisSha256'));
|
|
206
|
+
});
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "archify",
|
|
3
|
-
"version": "3.3.
|
|
3
|
+
"version": "3.3.4",
|
|
4
4
|
"lockfileVersion": 3,
|
|
5
5
|
"requires": true,
|
|
6
6
|
"packages": {
|
|
7
7
|
"": {
|
|
8
8
|
"name": "archify",
|
|
9
|
-
"version": "3.3.
|
|
9
|
+
"version": "3.3.4",
|
|
10
10
|
"license": "Apache-2.0",
|
|
11
11
|
"bin": {
|
|
12
12
|
"archify": "bin/archify.mjs"
|
|
@@ -151,6 +151,8 @@ CJK characters count as two units
|
|
|
151
151
|
|
|
152
152
|
对于 architecture,`validate architecture <input.json> --layout-json` 会暴露解析后的组件框、边界框、连接点和标签位置。可测量但被拒绝的布局也会返回这些字段,以及 `ok: false`、`contract: "archify-architecture-layout-v1"`、诊断,并以状态 1 退出。这是修复证据,不是制品验收;它不写 HTML。输入格式错误或实现失败时,保留普通失败回执,不含布局。每种原生图类型都接受 `validate <type> <input.json> --layout-json`;各报告包含 `ok`、`diagram_type`、`viewBox` 及该类型测量后的元素几何(workflow、sequence、dataflow、lifecycle 为节点和边路由;其余类型为实体、类型、片段或条形)。
|
|
153
153
|
|
|
154
|
+
工具如果需要同时获取候选稿的两个结果,可以运行 `validate <type> <input.json> --json --with-layout`。通过时,回执包含 `--json` 的判定和 `layout` 下的同一布局报告,只渲染一次。候选稿失败时,返回普通失败回执,不带 `layout`。要取得被拒布局的证据,单独使用 `--layout-json`。讲解页文档没有布局报告,也不接受这个选项。
|
|
155
|
+
|
|
154
156
|
对 `layout/boundary-out-of-bounds`,使用实测失败侧。左/上负坐标需要向内移动;增加 viewBox 宽/高只能解决右/下溢出。边界可以跨行包围成员。移动成员时保留真实成员关系,并复查相连路由。
|
|
155
157
|
|
|
156
158
|
自动 Architecture 画布包括路由点,以及节点、框和标签。作者指定 viewBox 保持权威。Showcase 中,`layout/route-out-of-bounds` 指出被裁切的路由点;负坐标需要向内路由,右/下溢出也可通过更大作者指定画布解决。扩大画布后重新检查桌面可读性。
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
# 解释页创作
|
|
4
4
|
|
|
5
|
-
|
|
5
|
+
讲解页把有结论和一定结构的答案(解释、比较、决策、诊断、评审或计划)转成一页内容。页面以结论开头,用面板中的图、表格、步骤和短文呈现推理。适用条件和模式规则见[选择产物](../SKILL.md#choose-the-artifact)。用户请求讲解页时直接生成。默认 `offer` 模式对符合条件的答案每次对话最多提议一次,等待用户提出请求。`on-demand` 关闭提议,`proactive` 和 `always-on` 须主动启用才自动生成。用户要求绘制系统时,用原生图类型。
|
|
6
6
|
|
|
7
7
|
本指南定义完整草稿语言,直接据此编写草稿。
|
|
8
8
|
|
|
@@ -24,5 +24,6 @@ if (process.argv.includes('--layout-json')) {
|
|
|
24
24
|
console.log(JSON.stringify(layoutReportFromSvg(svg, 'dataflow'), null, 2));
|
|
25
25
|
} else {
|
|
26
26
|
writeDiagram({ outPath, template, diagramType: 'dataflow', meta: dataflow.meta,
|
|
27
|
-
svg, cards: dataflow.cards, sourceEvidence, diagram: dataflow
|
|
27
|
+
svg, cards: dataflow.cards, sourceEvidence, diagram: dataflow,
|
|
28
|
+
layoutReport: () => layoutReportFromSvg(svg, 'dataflow') });
|
|
28
29
|
}
|