@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
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
import { spawn } from 'node:child_process';
|
|
2
|
+
import { createServer } from 'node:http';
|
|
3
|
+
import { createConnection, createServer as tcpServer } from 'node:net';
|
|
4
|
+
import { readFileSync, realpathSync, statSync } from 'node:fs';
|
|
5
|
+
import { setTimeout as delay } from 'node:timers/promises';
|
|
6
|
+
import { join, resolve } from 'node:path';
|
|
7
|
+
import { pathToFileURL } from 'node:url';
|
|
8
|
+
import { sha256 } from './prepare-session.mjs';
|
|
9
|
+
|
|
10
|
+
const fingerprint = path => sha256(readFileSync(path));
|
|
11
|
+
|
|
12
|
+
function listen(server, port) {
|
|
13
|
+
return new Promise((ok, fail) => {
|
|
14
|
+
server.once('error', fail);
|
|
15
|
+
server.listen(port, '127.0.0.1', () => { server.removeListener('error', fail); ok(); });
|
|
16
|
+
});
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
async function waitForMixedPort(port, signal) {
|
|
20
|
+
const deadline = Date.now() + 30000;
|
|
21
|
+
while (!signal.aborted && Date.now() < deadline) {
|
|
22
|
+
const ready = await new Promise(resolve => {
|
|
23
|
+
const socket = createConnection({ host: '127.0.0.1', port });
|
|
24
|
+
let reply = Buffer.alloc(0);
|
|
25
|
+
socket.setTimeout(400);
|
|
26
|
+
socket.once('connect', () => socket.write(Buffer.from([5, 1, 0])));
|
|
27
|
+
socket.on('data', chunk => {
|
|
28
|
+
reply = Buffer.concat([reply, chunk]);
|
|
29
|
+
if (reply.length >= 2) socket.destroy();
|
|
30
|
+
});
|
|
31
|
+
socket.on('error', () => socket.destroy());
|
|
32
|
+
socket.once('timeout', () => socket.destroy());
|
|
33
|
+
socket.once('close', () => resolve(reply[0] === 5 && reply[1] === 0));
|
|
34
|
+
});
|
|
35
|
+
if (ready) return;
|
|
36
|
+
await delay(100, undefined, { signal });
|
|
37
|
+
}
|
|
38
|
+
throw new Error('助手的回环 SOCKS 监听未就绪');
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
export async function runSession(core, bundle, port) {
|
|
42
|
+
if (!Number.isInteger(port) || port < 1 || port > 65535) throw new Error('需要有效的 PAC 端口');
|
|
43
|
+
const binary = realpathSync(core);
|
|
44
|
+
const directory = realpathSync(bundle);
|
|
45
|
+
const configPath = join(directory, 'config.yaml');
|
|
46
|
+
const manifest = JSON.parse(readFileSync(join(directory, 'session.json'), 'utf8'));
|
|
47
|
+
const configBytes = readFileSync(configPath);
|
|
48
|
+
const pac = readFileSync(join(directory, 'whitelist.pac'));
|
|
49
|
+
if (sha256(configBytes) !== manifest.config || sha256(pac) !== manifest.pac || !manifest.sources?.length) {
|
|
50
|
+
throw new Error('会话产物与准备时的摘要不符,请重新生成');
|
|
51
|
+
}
|
|
52
|
+
const config = JSON.parse(configBytes.toString('utf8'));
|
|
53
|
+
if (config.tun?.enable !== false || config['allow-lan'] !== false || config.rules?.at(-1) !== 'MATCH,REJECT') {
|
|
54
|
+
throw new Error('需要本技能生成的回环白名单配置');
|
|
55
|
+
}
|
|
56
|
+
const sources = manifest.sources.map(source => {
|
|
57
|
+
const last = statSync(source.file);
|
|
58
|
+
if (realpathSync(source.file) !== source.target || fingerprint(source.file) !== source.digest) throw new Error('订阅已变化,请重新准备');
|
|
59
|
+
return { ...source, last };
|
|
60
|
+
});
|
|
61
|
+
if (port === config['mixed-port']) throw new Error('PAC 与代理监听端口冲突');
|
|
62
|
+
const checkPort = tcpServer();
|
|
63
|
+
await listen(checkPort, config['mixed-port']);
|
|
64
|
+
await new Promise(resolve => checkPort.close(resolve));
|
|
65
|
+
let ready = false;
|
|
66
|
+
const server = createServer((req, res) => {
|
|
67
|
+
if (req.headers.host !== '127.0.0.1:' + port || req.url !== '/whitelist.pac' || !['GET', 'HEAD'].includes(req.method)) {
|
|
68
|
+
res.writeHead(404).end(); return;
|
|
69
|
+
}
|
|
70
|
+
if (!ready) { res.writeHead(503).end(); return; }
|
|
71
|
+
res.writeHead(200, { 'Content-Type': 'application/x-ns-proxy-autoconfig', 'Cache-Control': 'no-store' });
|
|
72
|
+
res.end(req.method === 'HEAD' ? undefined : pac);
|
|
73
|
+
});
|
|
74
|
+
// 先占用 PAC 端口。失败时不启动另一个核心。
|
|
75
|
+
await listen(server, port);
|
|
76
|
+
const child = spawn(binary, ['-d', directory, '-f', configPath], {
|
|
77
|
+
cwd: directory, windowsHide: true, stdio: 'ignore'
|
|
78
|
+
});
|
|
79
|
+
let stopping = false;
|
|
80
|
+
let changed = false;
|
|
81
|
+
const controller = new AbortController();
|
|
82
|
+
const stop = () => {
|
|
83
|
+
if (stopping) return;
|
|
84
|
+
stopping = true;
|
|
85
|
+
ready = false;
|
|
86
|
+
server.close();
|
|
87
|
+
child.kill();
|
|
88
|
+
};
|
|
89
|
+
function checkSource() {
|
|
90
|
+
try {
|
|
91
|
+
if (sources.every(source => {
|
|
92
|
+
if (realpathSync(source.file) !== source.target) return false;
|
|
93
|
+
const current = statSync(source.file);
|
|
94
|
+
const { last } = source;
|
|
95
|
+
if (current.ino === last.ino && current.ctimeMs === last.ctimeMs && current.mtimeMs === last.mtimeMs && current.size === last.size) return true;
|
|
96
|
+
source.last = current;
|
|
97
|
+
return fingerprint(source.file) === source.digest;
|
|
98
|
+
})) return;
|
|
99
|
+
} catch { /* 文件缺失同样撤销会话。 */ }
|
|
100
|
+
changed = true;
|
|
101
|
+
stop();
|
|
102
|
+
}
|
|
103
|
+
const monitor = setInterval(checkSource, 1000);
|
|
104
|
+
process.once('SIGINT', stop);
|
|
105
|
+
process.once('SIGTERM', stop);
|
|
106
|
+
try {
|
|
107
|
+
const ended = new Promise((ok, fail) => {
|
|
108
|
+
child.once('error', fail);
|
|
109
|
+
child.once('exit', (code, signal) => ok({ code, signal }));
|
|
110
|
+
});
|
|
111
|
+
checkSource();
|
|
112
|
+
const running = waitForMixedPort(config['mixed-port'], controller.signal).then(() => {
|
|
113
|
+
if (!stopping) {
|
|
114
|
+
ready = true;
|
|
115
|
+
console.log('会话 PAC http://127.0.0.1:' + port + '/whitelist.pac');
|
|
116
|
+
}
|
|
117
|
+
return ended;
|
|
118
|
+
});
|
|
119
|
+
const { code } = await Promise.race([ended, running]);
|
|
120
|
+
if (changed) throw new Error('有效配置已变化,会话已撤下;核对新版本并重新生成。');
|
|
121
|
+
if (!stopping && code !== 0) throw new Error('会话核心未正常运行,请检查本机端口、权限和内核配置。');
|
|
122
|
+
} finally {
|
|
123
|
+
controller.abort();
|
|
124
|
+
if (child.exitCode === null && child.signalCode === null) child.kill();
|
|
125
|
+
clearInterval(monitor);
|
|
126
|
+
process.removeListener('SIGINT', stop);
|
|
127
|
+
process.removeListener('SIGTERM', stop);
|
|
128
|
+
server.close();
|
|
129
|
+
}
|
|
130
|
+
}
|
|
131
|
+
|
|
132
|
+
if (process.argv[1] && import.meta.url === pathToFileURL(resolve(process.argv[1])).href) {
|
|
133
|
+
try {
|
|
134
|
+
const [core, bundle, port, ...extra] = process.argv.slice(2);
|
|
135
|
+
if (!port || extra.length) throw new Error('用法:node run-session.mjs <mihomo> <会话目录> <PAC端口>');
|
|
136
|
+
await runSession(core, bundle, Number(port));
|
|
137
|
+
} catch (error) { console.error(error.message); process.exitCode = 1; }
|
|
138
|
+
}
|
|
@@ -34,7 +34,7 @@ node "$SKILL_DIR/scripts/inspect.mjs" --path "/path/on/target/volume"
|
|
|
34
34
|
|
|
35
35
|
报告不带密钥、完整环境变量、进程参数或私有日志。不要把单次快照、空闲磁盘或脚本成功退出说成“系统已优化”。
|
|
36
36
|
|
|
37
|
-
空间问题可继续交给 `system-cleanup
|
|
37
|
+
空间问题可继续交给 `system-cleanup`,代理、TUN 与地区配置可交给 `system-clash-proxy-config`;这些是可选协作技能,未安装时直接交付同等明确的计划。
|
|
38
38
|
|
|
39
39
|
## 完整本地材料
|
|
40
40
|
|
|
@@ -25,7 +25,7 @@ PowerShell 使用 `node "$SKILL_DIR\scripts\inspect.mjs" --path 'C:\'`,先确
|
|
|
25
25
|
|
|
26
26
|
先给基线与瓶颈假设,再给具名动作、预期收益、影响、授权、回滚和验证命令。区分缓存/用户数据/活动运行时,不能凭目录名删除。系统更新、驱动、固件、内核参数、杀毒、swap/pagefile、索引、Docker/WSL 虚拟盘与服务开关都不在一般审计授权内。
|
|
27
27
|
|
|
28
|
-
|
|
28
|
+
后续空间清理可交给 `system-cleanup`,代理网络与区域设置可交给 `system-clash-proxy-config`。编辑器配置按实际授权单独处理;没有安装时直接交付清楚的具名计划,不依赖兄弟目录。
|
|
29
29
|
|
|
30
30
|
## 完成标准
|
|
31
31
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: zh-archify
|
|
3
|
-
description: "创建经过校验、可探索的独立 HTML 架构图、工作流图、时序图、数据流图、生命周期/状态图、ERD
|
|
3
|
+
description: "创建经过校验、可探索的独立 HTML 架构图、工作流图、时序图、数据流图、生命周期/状态图、ERD、类图、树图、时间线和瀑布图,支持深浅主题、动态效果与图片/SVG/WebM 导出。接受需求或 Mermaid;为基于代码的图追踪仓库证据。适用于可视化系统、API 调用、流水线、schema、历史、时序,以及日常步骤和关系。使用 Code Analysis 调查仓库架构、耦合与重构范围。为原生图添加引导演示和视频。用户要求页面或讲解页(做成一页、用页面讲)时,将答案做成结论在先、包含结构化面板、原生图和图表的一页讲解页。复杂流程、诊断、比较、测试或评审报告默认只简短提议,收到请求后才生成。用 [zh-archify explainer: on-demand] 关闭提议,或用 [zh-archify explainer: proactive] 对符合条件的答案自动生成。不适用于仪表板。"
|
|
4
4
|
license: Apache-2.0
|
|
5
5
|
metadata:
|
|
6
6
|
version: "3.3"
|
|
@@ -11,8 +11,6 @@ metadata:
|
|
|
11
11
|
|
|
12
12
|
# Archify
|
|
13
13
|
|
|
14
|
-
创建经过检查的 HTML,形式可以是原生图、讲解页、故事或独立的 Code Analysis 工作台。
|
|
15
|
-
|
|
16
14
|
从工作目录运行命令。除非用户指定其他位置,否则为每次新的产物请求,在工作目录中建立独立的 `.archify/<type>-<slug>-<YYYYMMDD-HHMMSS>/` 文件夹(使用当地时间,只选择一次):将候选文件和 `<slug>.html` 保存在其中,修复时复用该目录。原生图表使用 `candidate.json`,其中 `meta.output` 相对于工作目录;解释页可以使用 `candidate.archify.md` 和可移植的输出文件名。之后的新请求使用新文件夹。把所有命令中的 `bin/archify.mjs` 替换为已安装包的绝对路径,或相对于工作目录的路径;CLI 的输入和输出路径都从该工作目录解析。
|
|
17
15
|
|
|
18
16
|
为真实代码库创作原生图表时,在追踪请求涉及的行为时阅读[仓库创作](references/repository-authoring.md)。系统描述使用下方原生创作步骤;冻结的候选文件使用交接路径。
|
|
@@ -25,14 +23,14 @@ metadata:
|
|
|
25
23
|
- 需要调查本地仓库架构健康度、模块耦合、循环、分层违规、大文件、复杂度热点或重构方向时,使用下方 Code Analysis;由 agent 处理命令,不需要架构 JSON。
|
|
26
24
|
- 要在一个或多个原生图上制作引导演示、动画/静态双主题 SVG、交互舞台播放器或 1080p MP4/WebM 视频,阅读[故事编写](references/story-authoring.md)。用 `story draft`/`attach` 为原生 Viewer 添加播放;用 `story validate`/`svg`/`stage`/`video` 进行声明式组件编排。
|
|
27
25
|
- 仅当用户明确要求解释或可视化拉取请求、分支变更或 `git diff`,要求将变更图附到 PR,或点名已安装的配套技能 `archify-pr` 时,先阅读 [PR 审查编写](references/pr-review.md):它涵盖三点差异、带变更标记的合并超集视图,以及 `pr validate` / `pr build` / `pr attach` 循环。
|
|
28
|
-
-
|
|
29
|
-
-
|
|
30
|
-
- `
|
|
31
|
-
- `on-demand
|
|
32
|
-
- `
|
|
33
|
-
-
|
|
34
|
-
-
|
|
35
|
-
-
|
|
26
|
+
- 用户要求页面或讲解页(“做成一页”“用页面讲”“answer with a page”)时,直接使用 `explainer`,跳过提议。制作任何讲解页时,阅读[讲解页编写](references/explainer-authoring.md),写完完整草稿,再运行 `finalize explainer` 校验、原子交付并检查产物。局部修改使用 panel patch。
|
|
27
|
+
- 讲解页默认为 `offer` 模式。上下文中的 `[zh-archify explainer: <mode>]` 规则行可选择其他模式,对话中的指令在当前对话内覆盖该规则。
|
|
28
|
+
- `offer`(默认,无需规则行)。用户未请求时不生成页面。如果复杂流程、诊断或排障结果、选项比较、取舍或决策、测试或评审报告、结构化计划需要表格、步骤或多个章节才能读清,先用文字回答。在回复末尾简短提议提供可离线分享的一页讲解,结论在先,配交互图和结构化面板,每次对话最多提议一次。说明提出讲解页请求即可直接生成,并给出自动生成或关闭提议的规则行。此后同一对话不再提议。
|
|
29
|
+
- `on-demand`。只在用户要求时制作页面,始终不作提议。
|
|
30
|
+
- `proactive`(须主动启用)。符合 `offer` 条件的复杂结构化答案,即使用户未请求也制作页面。
|
|
31
|
+
- `always-on`(须主动启用)。每个符合条件且有结论的回复都附一个最多四个面板的紧凑页面。
|
|
32
|
+
- 所有模式均不为闲聊、简短或单行回答、普通代码改动或修复、例行状态更新(“完成,测试通过”)、原始命令输出、用户请求的原生图或只要文字或不要页面的请求(“只要文字”“不用做页面”)生成或提议页面。用户点名其他页面工具或其他技能已为该回复制作页面时,也适用这些排除条件。每次回复最多制作一页。
|
|
33
|
+
- 只有用户要求切换模式时,才在当前 agent 的全局规则文件(如 `~/.codex/AGENTS.md`、`~/.claude/CLAUDE.md` 或 `~/.config/devin/AGENTS.md`)写入或替换一行 `[zh-archify explainer: <mode>]`,并说明文件名。“关闭 explainer 提示”或“only make pages when I ask”使用 `[zh-archify explainer: on-demand]`,“以后复杂问答默认自动生成”或“auto-make explainer pages for complex answers”使用 `[zh-archify explainer: proactive]`,“always make a page”使用 `[zh-archify explainer: always-on]`。删除规则行恢复 `offer`。用户未要求时,绝不切换到 `proactive` 或 `always-on`。
|
|
36
34
|
|
|
37
35
|
<a id="existing-candidate-handoff"></a>
|
|
38
36
|
|
|
@@ -184,3 +182,5 @@ node bin/archify.mjs demo <output-directory>
|
|
|
184
182
|
示例:`Created [Checkout request timing](/abs/path/checkout-timing.html). Durations are illustrative, not measured.`
|
|
185
183
|
|
|
186
184
|
对于讲解页,即使不打开页面,回复也必须清楚:先用一至三行说明结论,包括关键原因、数值或建议,然后把使用用户语言的描述性 Markdown 链接放在最后一行,例如 `[查看测试报告](/abs/path/test-report.html)` 或 `[Open the test report](...)`。使用绝对路径,含空格时以 `<...>` 包裹,不使用 `file://`;任何更新通知都放在链接之前。绝不以目录、终端日志或自动打开(`--open`)代替链接。`finalize explainer` 失败或渲染器不可用时,用文字回答,以一行说明页面未生成,不提供页面链接。仅在有门禁失败或仍有写入警告时提及门禁;不要粘贴草稿。
|
|
185
|
+
|
|
186
|
+
在 `offer` 模式下,用用户的语言在回复末尾加一句提议。例如,“如需结论在先、带交互图与面板、可离线分享的一页讲解,请直接提出。设为 `[zh-archify explainer: proactive]` 可为复杂答案自动生成,设为 `[zh-archify explainer: on-demand]` 可关闭提议。”
|
|
@@ -4,7 +4,7 @@
|
|
|
4
4
|
<meta charset="UTF-8">
|
|
5
5
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
6
6
|
<meta name="color-scheme" content="dark light">
|
|
7
|
-
<meta name="generator" content="archify 3.3.
|
|
7
|
+
<meta name="generator" content="archify 3.3.4">
|
|
8
8
|
<meta name="archify-reader-contract" content="declared-wide-v1">
|
|
9
9
|
<title>[PROJECT NAME] Architecture Diagram</title>
|
|
10
10
|
<script>
|
|
@@ -8187,12 +8187,15 @@ OTHER DEALINGS IN THE FONT SOFTWARE.
|
|
|
8187
8187
|
};
|
|
8188
8188
|
}).filter(function (edge) { return edge && edge.points.length > 1; });
|
|
8189
8189
|
|
|
8190
|
-
var
|
|
8190
|
+
var nodeSelector = sequence ? '[data-animate="node"]' : '[data-node-id][data-animate="node"]';
|
|
8191
|
+
var nodes = Array.prototype.slice.call(root.querySelectorAll(nodeSelector)).map(function (element, index) {
|
|
8192
|
+
var wrapper = sequence ? element.closest('[data-node-id]') : element;
|
|
8193
|
+
if (!wrapper) return null;
|
|
8191
8194
|
var box;
|
|
8192
8195
|
try { box = element.getBBox(); } catch (_) { return null; }
|
|
8193
8196
|
var painted = element.querySelector('[class*="c-"]') || element;
|
|
8194
8197
|
var computed = getComputedStyle(painted);
|
|
8195
|
-
var windows = sequence && sequence.nodes[
|
|
8198
|
+
var windows = sequence && sequence.nodes[wrapper.getAttribute('data-node-id')];
|
|
8196
8199
|
return {
|
|
8197
8200
|
x: box.x,
|
|
8198
8201
|
y: box.y,
|
|
@@ -2218,7 +2218,7 @@ const COMMAND_USAGE = {
|
|
|
2218
2218
|
patch: 'explainer <artifact.html> <panel-id> <replacement-file> <output.html> [--json] [--quality standard|showcase] [--repo-root path]',
|
|
2219
2219
|
finalize: '<type> <input.json> <output.html> [--json] [--browser-check] [--no-update-notice] [--receipt path] [--out-dir <dir>] [--quality standard|showcase] [--repo-root path] [--candidate-sha256 hex]',
|
|
2220
2220
|
preview: '<type> <input.json> [output.html] [--no-open] [--quality standard|showcase] [--repo-root path]',
|
|
2221
|
-
validate: '<type> <input.json> [--json] [--layout-json] [--quality standard|showcase] [--repo-root path]',
|
|
2221
|
+
validate: '<type> <input.json> [--json [--with-layout]] [--layout-json] [--quality standard|showcase] [--repo-root path]',
|
|
2222
2222
|
'export-svg': '<type> <input.json> <output.svg|stem> [--theme both|light|dark] [--preset name] [--animate-flow] [--json] [--quality standard|showcase] [--repo-root path]',
|
|
2223
2223
|
pr: ['preflight [--repo-root path] [--base ref] [--head ref] [--init dir] [--mode ask|on-demand|proactive] [--target body|comment] [--global-rules path] [--json]', 'validate <manifest.json> [--repo-root path] [--json]', 'build <manifest.json> --out-dir <dir> [--repo-root path] [--platform github|gitlab|generic] [--no-html] [--animate-flow] [--quality standard|showcase] [--json]', 'attach <pr-number-or-url|gitlab-mr-url> --manifest <build-receipt.json> [--target body|comment] [--repo owner/name] [--allow-stale] [--dry-run] [--json]'],
|
|
2224
2224
|
migrate: 'workflow <old.json> <new.json> --to-schema 2 [--output portable.html] [--json] [--repo-root path]',
|
|
@@ -7138,6 +7138,7 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7138
7138
|
const quality = qualityArgs.quality;
|
|
7139
7139
|
const repoRoot = repoArgs.repoRoot;
|
|
7140
7140
|
const knownOptions = new Set(['--json', '--layout-json']);
|
|
7141
|
+
if (invokingCommand === 'validate') knownOptions.add('--with-layout');
|
|
7141
7142
|
const unknown = args.filter((arg) => arg.startsWith('--') && !knownOptions.has(arg));
|
|
7142
7143
|
if (unknown.length) rejectCliArgument(`Unknown ${invokingCommand} option "${unknown[0]}".`, {
|
|
7143
7144
|
code: 'cli/unknown-option',
|
|
@@ -7146,6 +7147,7 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7146
7147
|
});
|
|
7147
7148
|
const json = args.includes('--json');
|
|
7148
7149
|
const layoutJson = args.includes('--layout-json');
|
|
7150
|
+
const withLayout = args.includes('--with-layout');
|
|
7149
7151
|
const rest = args.filter((arg) => !knownOptions.has(arg));
|
|
7150
7152
|
const [type, input] = rest;
|
|
7151
7153
|
if (!type || !input || rest.length !== 2) rejectCliArgument(usage(), {
|
|
@@ -7153,6 +7155,25 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7153
7155
|
supportedFixes: [`use: archify ${invokingCommand} <type> <input.json> [options]`],
|
|
7154
7156
|
});
|
|
7155
7157
|
const renderer = rendererPath(type);
|
|
7158
|
+
// --with-layout adds the --layout-json report to a passing --json verdict,
|
|
7159
|
+
// so a caller that needs both pays for one render (#1420).
|
|
7160
|
+
if (withLayout && (layoutJson || !json)) rejectCliArgument(
|
|
7161
|
+
layoutJson
|
|
7162
|
+
? `--with-layout adds the layout to the --json verdict; it cannot be combined with --layout-json.`
|
|
7163
|
+
: `--with-layout requires --json.`,
|
|
7164
|
+
{
|
|
7165
|
+
code: 'cli/unsupported-option',
|
|
7166
|
+
subject: { command: invokingCommand, option: '--with-layout' },
|
|
7167
|
+
supportedFixes: layoutJson
|
|
7168
|
+
? ['use --json --with-layout for the verdict and layout together', 'use --layout-json alone for the layout only']
|
|
7169
|
+
: ['add --json'],
|
|
7170
|
+
},
|
|
7171
|
+
);
|
|
7172
|
+
if (withLayout && type === 'explainer') rejectCliArgument('--with-layout is supported for native diagram types; explainer has no layout report.', {
|
|
7173
|
+
code: 'cli/unsupported-option',
|
|
7174
|
+
subject: { command: invokingCommand, option: '--with-layout', type },
|
|
7175
|
+
supportedFixes: ['remove --with-layout for explainer documents'],
|
|
7176
|
+
});
|
|
7156
7177
|
|
|
7157
7178
|
const inputPath = path.resolve(input);
|
|
7158
7179
|
let specification;
|
|
@@ -7222,6 +7243,7 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7222
7243
|
const temporary = createOwnedTempDirectory('archify-validate-');
|
|
7223
7244
|
const tmp = temporary.path;
|
|
7224
7245
|
const out = path.join(tmp, `${type}.html`);
|
|
7246
|
+
const layoutReportPath = withLayout ? path.join(tmp, 'layout.json') : null;
|
|
7225
7247
|
let exitCode = 0;
|
|
7226
7248
|
let report = () => {};
|
|
7227
7249
|
|
|
@@ -7235,7 +7257,11 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7235
7257
|
}
|
|
7236
7258
|
const render = runNode([renderer, snapshot, out], {
|
|
7237
7259
|
stdio: 'pipe',
|
|
7238
|
-
env: {
|
|
7260
|
+
env: {
|
|
7261
|
+
...rendererEnv(quality, repoRoot, true),
|
|
7262
|
+
...(preparedBundlePath ? { ARCHIFY_EXPLAINER_PREPARED: preparedBundlePath, ARCHIFY_EXPLAINER_SNAPSHOT_INPUT: inputPath } : {}),
|
|
7263
|
+
...(layoutReportPath ? { ARCHIFY_LAYOUT_REPORT_PATH: layoutReportPath } : {}),
|
|
7264
|
+
},
|
|
7239
7265
|
});
|
|
7240
7266
|
if (render.status !== 0) {
|
|
7241
7267
|
const failure = rendererFailure(render);
|
|
@@ -7293,7 +7319,37 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7293
7319
|
} else {
|
|
7294
7320
|
const result = JSON.parse(check.stdout);
|
|
7295
7321
|
const engineeringProfile = engineeringProfileFromArtifact(fs.readFileSync(out));
|
|
7296
|
-
|
|
7322
|
+
let layout;
|
|
7323
|
+
if (layoutReportPath) {
|
|
7324
|
+
try {
|
|
7325
|
+
const recorded = JSON.parse(fs.readFileSync(layoutReportPath, 'utf8'));
|
|
7326
|
+
if (recorded?.ok !== true || recorded.diagram_type !== type
|
|
7327
|
+
|| !Array.isArray(recorded.viewBox) || recorded.viewBox.length !== 2) {
|
|
7328
|
+
throw new Error(`Expected a successful ${type} layout report with a viewBox.`);
|
|
7329
|
+
}
|
|
7330
|
+
layout = recorded;
|
|
7331
|
+
} catch (error) {
|
|
7332
|
+
exitCode = 1;
|
|
7333
|
+
const message = `The renderer did not record a readable layout report: ${error.message}`;
|
|
7334
|
+
report = () => reportFailure({
|
|
7335
|
+
json,
|
|
7336
|
+
stage: 'render',
|
|
7337
|
+
type,
|
|
7338
|
+
input: path.resolve(input),
|
|
7339
|
+
error: message,
|
|
7340
|
+
diagnostics: [{
|
|
7341
|
+
code: 'validate/layout-report-unavailable',
|
|
7342
|
+
severity: 'error',
|
|
7343
|
+
message,
|
|
7344
|
+
subject: { type },
|
|
7345
|
+
evidence: { reason: error.code || error.name },
|
|
7346
|
+
supportedFixes: ['run validate <type> <input.json> --layout-json for the layout alone', 'report the renderer failure'],
|
|
7347
|
+
}],
|
|
7348
|
+
status: 1,
|
|
7349
|
+
});
|
|
7350
|
+
}
|
|
7351
|
+
}
|
|
7352
|
+
if (exitCode === 0 && json) {
|
|
7297
7353
|
const candidate = {
|
|
7298
7354
|
path: path.resolve(input),
|
|
7299
7355
|
...artifactIdentity(specification),
|
|
@@ -7325,9 +7381,10 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7325
7381
|
composition: result.composition,
|
|
7326
7382
|
...(engineeringProfile ? { engineeringProfile } : {}),
|
|
7327
7383
|
...(localeWarnings.length ? { diagnostics: localeWarnings } : {}),
|
|
7384
|
+
...(withLayout ? { layout } : {}),
|
|
7328
7385
|
};
|
|
7329
7386
|
report = () => console.log(JSON.stringify(receipt, null, 2));
|
|
7330
|
-
} else {
|
|
7387
|
+
} else if (exitCode === 0) {
|
|
7331
7388
|
const engineering = engineeringProfile
|
|
7332
7389
|
? `; engineering ${engineeringProfile}: pass`
|
|
7333
7390
|
: '';
|
|
@@ -7363,6 +7420,12 @@ async function commandValidate(args, invocation = {}) {
|
|
|
7363
7420
|
if (exitCode !== 0) process.exitCode = exitCode;
|
|
7364
7421
|
}
|
|
7365
7422
|
|
|
7423
|
+
// Only validate --with-layout may supply this internal path to a renderer.
|
|
7424
|
+
// Strip inherited spellings before dispatch, including Windows case aliases.
|
|
7425
|
+
for (const name of Object.keys(process.env)) {
|
|
7426
|
+
if (name.toUpperCase() === 'ARCHIFY_LAYOUT_REPORT_PATH') delete process.env[name];
|
|
7427
|
+
}
|
|
7428
|
+
|
|
7366
7429
|
const [command, ...args] = process.argv.slice(2);
|
|
7367
7430
|
// Reuse the canonical help metadata rather than a separate help registry.
|
|
7368
7431
|
// Only the sole --help form bypasses command argument parsing and operations.
|
|
@@ -124,7 +124,13 @@ AI 任务预览使用共用任务生成器的 Markdown。在线页面从经过
|
|
|
124
124
|
- `overview.json`
|
|
125
125
|
- `repo.analysis.html`
|
|
126
126
|
|
|
127
|
-
|
|
127
|
+
每次运行都先在输出锁保护下写入一个新的暂存目录。返回数据可读后,当前结果移到 `<out>/analysis.previous/`,候选结果移入 `<out>/analysis/`。如果发布失败且回滚成功,两份已完成的报告都会恢复。
|
|
128
|
+
|
|
129
|
+
`check` 也会在发布前将完整输出写入暂存目录。报告发布与工作台的审阅保存共用同一个输出目录锁,锁覆盖从选择自动比较对象到发布的全过程。工作进程写入由锁持有者准备的目录。重试只有在确认写入进程已退出时,才会清除尚未发布的暂存目录。
|
|
130
|
+
|
|
131
|
+
在 Linux 上,锁的标记将写入进程绑定到本次系统启动和 PID 命名空间。若仍能看到该 PID,比较启动时间要求时间命名空间一致,且 procfs 视图属于同一 PID 命名空间。身份不同或无法核实(包括旧格式锁标记)时,保留锁。在其他平台上,仅在同一机器和进程视图内共享可写输出目录。
|
|
132
|
+
|
|
133
|
+
发布中断或回滚失败时,会保留移动计划和备份供恢复。回滚失败会记录终止状态,即使工作台进程仍在运行,重试也能报告需恢复。
|
|
128
134
|
|
|
129
135
|
分析 HTML 嵌入已映射文件及证据文件的源码上下文,可以离线显示已有结果。没有本地服务器就不能重新扫描项目。
|
|
130
136
|
|
|
@@ -11,7 +11,8 @@ process.stdin.setEncoding('utf8');
|
|
|
11
11
|
process.stdin.on('data', (chunk) => { input += chunk; });
|
|
12
12
|
process.stdin.on('end', () => {
|
|
13
13
|
try {
|
|
14
|
-
|
|
14
|
+
// The lock owner creates the stage, so a late worker cannot recreate it.
|
|
15
|
+
const result = analyzeRepository(JSON.parse(input), { createOutput: false });
|
|
15
16
|
process.stdout.write(`${JSON.stringify(result)}\n`);
|
|
16
17
|
} catch (error) {
|
|
17
18
|
const diagnostics = error instanceof DiagnosticError ? error.diagnostics
|
|
@@ -6,6 +6,7 @@ import fs from 'node:fs';
|
|
|
6
6
|
import path from 'node:path';
|
|
7
7
|
import { fileURLToPath } from 'node:url';
|
|
8
8
|
import { DiagnosticError, fail, receipt } from '../core/index.mjs';
|
|
9
|
+
import { outputEntry, withAnalysisOutput, writeCheckOutputs } from '../lib/output.mjs';
|
|
9
10
|
import { baselineCommand, taskCommand } from '../lib/task-command.mjs';
|
|
10
11
|
|
|
11
12
|
export const USAGE = `Usage:
|
|
@@ -59,10 +60,9 @@ export function parseCheckArgs(argv) {
|
|
|
59
60
|
|
|
60
61
|
export async function runCheck(argv) {
|
|
61
62
|
const { repo, options } = parseCheckArgs(argv);
|
|
62
|
-
const
|
|
63
|
-
const {
|
|
64
|
-
const {
|
|
65
|
-
const { alignDiagram, findingModules } = await import('../overlay/inject.mjs');
|
|
63
|
+
const out = options['--out'] ? path.resolve(options['--out']) : null;
|
|
64
|
+
const { extractFacts, buildGraph, evaluateGraph, loadBaseline, saveBaseline, loadPrevious, readJsonInput } = await import('../lib/analysis.mjs');
|
|
65
|
+
const { baselineFrom, acceptFinding, revokeFinding } = await import('../lib/review.mjs');
|
|
66
66
|
|
|
67
67
|
const root = path.resolve(repo);
|
|
68
68
|
const baselineFile = options['--baseline'] ? path.resolve(options['--baseline']) : null;
|
|
@@ -96,11 +96,9 @@ export async function runCheck(argv) {
|
|
|
96
96
|
}
|
|
97
97
|
}
|
|
98
98
|
}
|
|
99
|
-
const
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
// An explicit --compare must be readable; the automatic one in --out is optional.
|
|
103
|
-
const previous = loadPrevious(previousFile, { strict: Boolean(options['--compare']) });
|
|
99
|
+
const compare = options['--compare'] ? path.resolve(options['--compare']) : null;
|
|
100
|
+
if (compare && !fs.existsSync(compare)) fail('cli/input-invalid', `Not a file: ${options['--compare']}`, { subject: { option: '--compare' }, supportedFixes: ['pass the findings.json of an earlier run'] });
|
|
101
|
+
const explicitPrevious = compare ? loadPrevious(compare, { strict: true }) : null;
|
|
104
102
|
|
|
105
103
|
const { facts, config, otherLanguages } = extractFacts(root, { language: options['--language'] || null, config: options['--config'] || null });
|
|
106
104
|
const graph = buildGraph(facts, config);
|
|
@@ -121,6 +119,20 @@ export async function runCheck(argv) {
|
|
|
121
119
|
return { exitCode: 0, receipt: receipt('ok', { command: 'check', action: 'update-baseline', baseline: baselineFile, entries: doc.accepted.length, kept, added: doc.accepted.length - kept, dropped: existing ? existing.accepted.length - kept : 0 }) };
|
|
122
120
|
}
|
|
123
121
|
|
|
122
|
+
const finish = lock => finishCheck({ root, out, options, irDoc, mapDoc, baselineFile, explicitPrevious, facts, config, otherLanguages, graph, findings, lock });
|
|
123
|
+
return out ? withAnalysisOutput(out, finish) : finish(null);
|
|
124
|
+
}
|
|
125
|
+
|
|
126
|
+
async function finishCheck({ root, out, options, irDoc, mapDoc, baselineFile, explicitPrevious, facts, config, otherLanguages, graph, findings, lock }) {
|
|
127
|
+
const { loadBaseline, loadPrevious, stableJson, reviewSummary } = await import('../lib/analysis.mjs');
|
|
128
|
+
const { reviewFindings, isOpen } = await import('../lib/review.mjs');
|
|
129
|
+
const { buildOverview, findingWhere } = await import('../overlay/overview.mjs');
|
|
130
|
+
const { alignDiagram, findingModules } = await import('../overlay/inject.mjs');
|
|
131
|
+
let previous = explicitPrevious;
|
|
132
|
+
if (!previous && out) {
|
|
133
|
+
const file = path.join(out, 'findings.json');
|
|
134
|
+
if (outputEntry(file)) previous = loadPrevious(file);
|
|
135
|
+
}
|
|
124
136
|
const review = reviewFindings(findings.diagnostics, { baseline: loadBaseline(baselineFile), previous, analysis: findings.analysis, files: [...facts.files, ...(findings.externalEvidence || [])].map((f) => f.path) });
|
|
125
137
|
if (options['--new-only'] && review.comparison && (findings.analysis.external?.length || previous?.analysis?.external?.length) && review.comparison.comparable !== true) {
|
|
126
138
|
fail('external/comparison-unverified', 'New-only gating requires comparable external reports.', { evidence: { reasons: review.comparison.reasons }, supportedFixes: ['provide matching tool versions, rule configuration, complete scan scope and source-bound reports', 'run a full check without --new-only to inspect the available diagnostics'] });
|
|
@@ -133,11 +145,6 @@ export async function runCheck(argv) {
|
|
|
133
145
|
: findings.diagnostics.map((d) => ({ ...d, ...(review.findings[d.id] ? { review: review.findings[d.id] } : {}), moduleIds: findingModules(d, fileModule), componentIds: [] }));
|
|
134
146
|
const overview = buildOverview({ findings: listed, graph, facts, unmapped: alignment ? alignment.unmapped : [], ambiguousModules: alignment ? alignment.ambiguousModules : [], run, diagram: Boolean(alignment) });
|
|
135
147
|
|
|
136
|
-
if (out) {
|
|
137
|
-
fs.mkdirSync(out, { recursive: true });
|
|
138
|
-
for (const [name, doc] of [['raw-facts', facts], ['module-graph', graph], ['findings', findings], ['review', review], ['overview', overview]]) fs.writeFileSync(path.join(out, `${name}.json`), stableJson(doc));
|
|
139
|
-
}
|
|
140
|
-
|
|
141
148
|
const failOn = options['--fail-on'];
|
|
142
149
|
const newOnly = Boolean(options['--new-only']);
|
|
143
150
|
const failing = failOn === 'never' ? [] : findings.diagnostics.filter((d) => SEVERITY[d.severity] <= SEVERITY[failOn]
|
|
@@ -146,7 +153,7 @@ export async function runCheck(argv) {
|
|
|
146
153
|
// finding counts as new: a missing artifact must not pass the gate.
|
|
147
154
|
&& (!newOnly || !review.comparison || review.findings[d.id]?.since === 'new'));
|
|
148
155
|
const status = failing.length ? 'failed' : 'ok';
|
|
149
|
-
|
|
156
|
+
const result = {
|
|
150
157
|
exitCode: failing.length ? 1 : 0,
|
|
151
158
|
receipt: receipt(status, {
|
|
152
159
|
command: 'check', root, out,
|
|
@@ -211,6 +218,13 @@ export async function runCheck(argv) {
|
|
|
211
218
|
},
|
|
212
219
|
}),
|
|
213
220
|
};
|
|
221
|
+
if (lock) {
|
|
222
|
+
// The implicit comparison reads findings.json. Publish it last, after
|
|
223
|
+
// every other artifact and the CLI receipt are ready.
|
|
224
|
+
const documents = [['raw-facts', facts], ['module-graph', graph], ['review', review], ['overview', overview], ['findings', findings]];
|
|
225
|
+
writeCheckOutputs(out, lock, documents.map(([name, doc]) => [`${name}.json`, stableJson(doc)]));
|
|
226
|
+
}
|
|
227
|
+
return result;
|
|
214
228
|
}
|
|
215
229
|
|
|
216
230
|
export { findingWhere as where } from '../overlay/overview.mjs';
|
|
@@ -5,7 +5,7 @@ import path from 'node:path';
|
|
|
5
5
|
import { spawnSync } from 'node:child_process';
|
|
6
6
|
import { fileURLToPath } from 'node:url';
|
|
7
7
|
import { DiagnosticError, fail, receipt } from '../core/index.mjs';
|
|
8
|
-
import { assertDriftPin, captureDriftTree, driftRepository } from '../lib/drift-capture.mjs';
|
|
8
|
+
import { assertDriftPin, captureDriftTree, driftRepository, skippedDriftDirectory } from '../lib/drift-capture.mjs';
|
|
9
9
|
import { driftReportMaxBytes, readDriftInput } from '../lib/drift-input.mjs';
|
|
10
10
|
import { validateDriftFollowup } from '../lib/drift-verification.mjs';
|
|
11
11
|
import { driftDigest } from '../lib/architecture-drift.mjs';
|
|
@@ -117,10 +117,10 @@ async function run([repoArg, ...args]) {
|
|
|
117
117
|
const resolutionInputs = new Map();
|
|
118
118
|
const { facts } = extractFacts(root, { language: 'ts', config, capturedOnly: true, onCapture({ reads }) {
|
|
119
119
|
for (const [file, content] of reads) {
|
|
120
|
-
if (content === undefined) continue;
|
|
121
120
|
const relative = path.relative(root, file).split(path.sep).join('/');
|
|
122
121
|
if (relative !== '..' && !relative.startsWith('../') && !path.isAbsolute(relative)) {
|
|
123
|
-
resolutionInputs.set(relative, driftDigest(content));
|
|
122
|
+
if (content !== undefined) resolutionInputs.set(relative, driftDigest(content));
|
|
123
|
+
else if (skippedDriftDirectory(relative.split('/'))) resolutionInputs.set(relative, null);
|
|
124
124
|
}
|
|
125
125
|
}
|
|
126
126
|
} });
|
|
@@ -1,17 +1,16 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
2
|
// One-shot companion to serve: a portable analysis view with captured AI tasks.
|
|
3
3
|
import path from 'node:path';
|
|
4
|
-
import fs from 'node:fs';
|
|
5
4
|
import { fileURLToPath } from 'node:url';
|
|
6
5
|
import { DiagnosticError, receipt } from '../core/index.mjs';
|
|
7
6
|
import { prepareAnalysisSession, runSessionAnalysis } from './serve.mjs';
|
|
8
7
|
|
|
9
8
|
export async function prepareAnalysisView(argv, dependencies = {}) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
9
|
+
return prepareAnalysisSession(argv, async (session, lock) => {
|
|
10
|
+
const { summary } = await runSessionAnalysis({ ...session, openAnalysis: true }, lock, dependencies);
|
|
11
|
+
return receipt('ok', { command: 'prepare', summary, diagram: session.delivered,
|
|
12
|
+
html: path.join(session.out, 'analysis', 'repo.analysis.html'), resume: session.resume });
|
|
13
|
+
});
|
|
15
14
|
}
|
|
16
15
|
|
|
17
16
|
if (process.argv[1] && path.resolve(process.argv[1]) === fileURLToPath(import.meta.url)) {
|