archscribe 0.0.0-stage → 0.2.1
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/LICENSE +33 -0
- package/README.md +266 -2
- package/dashboard-server/client-dist/assets/index-CswIFyKN.js +9 -0
- package/dashboard-server/client-dist/assets/index-DWB_-3yk.css +1 -0
- package/dashboard-server/client-dist/brand/favicon.png +0 -0
- package/dashboard-server/client-dist/brand/logo-full.png +0 -0
- package/dashboard-server/client-dist/icons.svg +24 -0
- package/dashboard-server/client-dist/index.html +14 -0
- package/dashboard-server/dist/core-bridge.js +19 -0
- package/dashboard-server/dist/files-route.js +28 -0
- package/dashboard-server/dist/index.js +294 -0
- package/dashboard-server/dist/license-routes.js +39 -0
- package/dashboard-server/dist/review-route.js +150 -0
- package/dashboard-server/dist/run-route.js +74 -0
- package/dashboard-server/dist/security.js +115 -0
- package/dist/cli/archscribe.d.ts +11 -0
- package/dist/cli/archscribe.js +340 -0
- package/dist/cli/archscribe.js.map +1 -0
- package/dist/cli/check.d.ts +17 -0
- package/dist/cli/check.js +67 -0
- package/dist/cli/check.js.map +1 -0
- package/dist/cli/clean.d.ts +2 -0
- package/dist/cli/clean.js +46 -0
- package/dist/cli/clean.js.map +1 -0
- package/dist/cli/commands.d.ts +4 -0
- package/dist/cli/commands.js +21 -0
- package/dist/cli/commands.js.map +1 -0
- package/dist/cli/compare.d.ts +2 -0
- package/dist/cli/compare.js +125 -0
- package/dist/cli/compare.js.map +1 -0
- package/dist/cli/config.d.ts +2 -0
- package/dist/cli/config.js +40 -0
- package/dist/cli/config.js.map +1 -0
- package/dist/cli/dashboard.d.ts +1 -0
- package/dist/cli/dashboard.js +16 -0
- package/dist/cli/dashboard.js.map +1 -0
- package/dist/cli/doctor.d.ts +20 -0
- package/dist/cli/doctor.js +169 -0
- package/dist/cli/doctor.js.map +1 -0
- package/dist/cli/evaluate.d.ts +9 -0
- package/dist/cli/evaluate.js +78 -0
- package/dist/cli/evaluate.js.map +1 -0
- package/dist/cli/history.d.ts +31 -0
- package/dist/cli/history.js +167 -0
- package/dist/cli/history.js.map +1 -0
- package/dist/cli/login.d.ts +5 -0
- package/dist/cli/login.js +49 -0
- package/dist/cli/login.js.map +1 -0
- package/dist/cli/logout.d.ts +5 -0
- package/dist/cli/logout.js +36 -0
- package/dist/cli/logout.js.map +1 -0
- package/dist/cli/menu/screens.d.ts +31 -0
- package/dist/cli/menu/screens.js +230 -0
- package/dist/cli/menu/screens.js.map +1 -0
- package/dist/cli/open.d.ts +2 -0
- package/dist/cli/open.js +28 -0
- package/dist/cli/open.js.map +1 -0
- package/dist/cli/rag.d.ts +4 -0
- package/dist/cli/rag.js +20 -0
- package/dist/cli/rag.js.map +1 -0
- package/dist/cli/run.d.ts +21 -0
- package/dist/cli/run.js +163 -0
- package/dist/cli/run.js.map +1 -0
- package/dist/cli/run_pipeline.d.ts +2 -0
- package/dist/cli/run_pipeline.js +103 -0
- package/dist/cli/run_pipeline.js.map +1 -0
- package/dist/cli/shell.d.ts +8 -0
- package/dist/cli/shell.js +38 -0
- package/dist/cli/shell.js.map +1 -0
- package/dist/cli/state.d.ts +42 -0
- package/dist/cli/state.js +99 -0
- package/dist/cli/state.js.map +1 -0
- package/dist/cli/status.d.ts +2 -0
- package/dist/cli/status.js +59 -0
- package/dist/cli/status.js.map +1 -0
- package/dist/cli/ui/animations.d.ts +19 -0
- package/dist/cli/ui/animations.js +161 -0
- package/dist/cli/ui/animations.js.map +1 -0
- package/dist/cli/ui/index.d.ts +4 -0
- package/dist/cli/ui/index.js +5 -0
- package/dist/cli/ui/index.js.map +1 -0
- package/dist/cli/ui/keys.d.ts +25 -0
- package/dist/cli/ui/keys.js +47 -0
- package/dist/cli/ui/keys.js.map +1 -0
- package/dist/cli/ui/mascot.d.ts +4 -0
- package/dist/cli/ui/mascot.js +53 -0
- package/dist/cli/ui/mascot.js.map +1 -0
- package/dist/cli/ui/menu.d.ts +86 -0
- package/dist/cli/ui/menu.js +268 -0
- package/dist/cli/ui/menu.js.map +1 -0
- package/dist/cli/ui/motions.d.ts +22 -0
- package/dist/cli/ui/motions.js +112 -0
- package/dist/cli/ui/motions.js.map +1 -0
- package/dist/cli/ui/stage.d.ts +25 -0
- package/dist/cli/ui/stage.js +296 -0
- package/dist/cli/ui/stage.js.map +1 -0
- package/dist/cli/ui/term.d.ts +98 -0
- package/dist/cli/ui/term.js +275 -0
- package/dist/cli/ui/term.js.map +1 -0
- package/dist/core/actor-inference.d.ts +25 -0
- package/dist/core/actor-inference.js +89 -0
- package/dist/core/actor-inference.js.map +1 -0
- package/dist/core/component-groups.d.ts +35 -0
- package/dist/core/component-groups.js +93 -0
- package/dist/core/component-groups.js.map +1 -0
- package/dist/core/docx-styles.d.ts +44 -0
- package/dist/core/docx-styles.js +45 -0
- package/dist/core/docx-styles.js.map +1 -0
- package/dist/core/docx.d.ts +11 -0
- package/dist/core/docx.js +310 -0
- package/dist/core/docx.js.map +1 -0
- package/dist/core/flow-steps-uc.d.ts +10 -0
- package/dist/core/flow-steps-uc.js +109 -0
- package/dist/core/flow-steps-uc.js.map +1 -0
- package/dist/core/flow-steps.d.ts +66 -0
- package/dist/core/flow-steps.js +814 -0
- package/dist/core/flow-steps.js.map +1 -0
- package/dist/core/flow-trace.d.ts +45 -0
- package/dist/core/flow-trace.js +131 -0
- package/dist/core/flow-trace.js.map +1 -0
- package/dist/core/flow.d.ts +13 -0
- package/dist/core/flow.js +379 -0
- package/dist/core/flow.js.map +1 -0
- package/dist/core/freshness.d.ts +22 -0
- package/dist/core/freshness.js +66 -0
- package/dist/core/freshness.js.map +1 -0
- package/dist/core/manifest.d.ts +35 -0
- package/dist/core/manifest.js +99 -0
- package/dist/core/manifest.js.map +1 -0
- package/dist/core/markdown.d.ts +21 -0
- package/dist/core/markdown.js +233 -0
- package/dist/core/markdown.js.map +1 -0
- package/dist/core/parser.d.ts +22 -0
- package/dist/core/parser.js +86 -0
- package/dist/core/parser.js.map +1 -0
- package/dist/core/project-config.d.ts +18 -0
- package/dist/core/project-config.js +30 -0
- package/dist/core/project-config.js.map +1 -0
- package/dist/core/review-ledger.d.ts +36 -0
- package/dist/core/review-ledger.js +104 -0
- package/dist/core/review-ledger.js.map +1 -0
- package/dist/core/review-rerun.d.ts +16 -0
- package/dist/core/review-rerun.js +31 -0
- package/dist/core/review-rerun.js.map +1 -0
- package/dist/core/role-permissions.d.ts +21 -0
- package/dist/core/role-permissions.js +60 -0
- package/dist/core/role-permissions.js.map +1 -0
- package/dist/core/run-result.d.ts +24 -0
- package/dist/core/run-result.js +21 -0
- package/dist/core/run-result.js.map +1 -0
- package/dist/core/run-summary.d.ts +47 -0
- package/dist/core/run-summary.js +22 -0
- package/dist/core/run-summary.js.map +1 -0
- package/dist/core/uc-context-builder.d.ts +7 -0
- package/dist/core/uc-context-builder.js +30 -0
- package/dist/core/uc-context-builder.js.map +1 -0
- package/dist/core/uc-proposal.d.ts +11 -0
- package/dist/core/uc-proposal.js +49 -0
- package/dist/core/uc-proposal.js.map +1 -0
- package/dist/diagrams/activity.d.ts +21 -0
- package/dist/diagrams/activity.js +362 -0
- package/dist/diagrams/activity.js.map +1 -0
- package/dist/diagrams/architecture.d.ts +42 -0
- package/dist/diagrams/architecture.js +165 -0
- package/dist/diagrams/architecture.js.map +1 -0
- package/dist/diagrams/class.d.ts +9 -0
- package/dist/diagrams/class.js +222 -0
- package/dist/diagrams/class.js.map +1 -0
- package/dist/diagrams/class_relations.d.ts +19 -0
- package/dist/diagrams/class_relations.js +165 -0
- package/dist/diagrams/class_relations.js.map +1 -0
- package/dist/diagrams/layout/elk.d.ts +9 -0
- package/dist/diagrams/layout/elk.js +57 -0
- package/dist/diagrams/layout/elk.js.map +1 -0
- package/dist/diagrams/layout/postprocess.d.ts +17 -0
- package/dist/diagrams/layout/postprocess.js +81 -0
- package/dist/diagrams/layout/postprocess.js.map +1 -0
- package/dist/diagrams/layout/radial.d.ts +65 -0
- package/dist/diagrams/layout/radial.js +275 -0
- package/dist/diagrams/layout/radial.js.map +1 -0
- package/dist/diagrams/layout/types.d.ts +37 -0
- package/dist/diagrams/layout/types.js +2 -0
- package/dist/diagrams/layout/types.js.map +1 -0
- package/dist/diagrams/sequence-header.d.ts +58 -0
- package/dist/diagrams/sequence-header.js +102 -0
- package/dist/diagrams/sequence-header.js.map +1 -0
- package/dist/diagrams/sequence-model.d.ts +21 -0
- package/dist/diagrams/sequence-model.js +298 -0
- package/dist/diagrams/sequence-model.js.map +1 -0
- package/dist/diagrams/sequence-parts.d.ts +83 -0
- package/dist/diagrams/sequence-parts.js +239 -0
- package/dist/diagrams/sequence-parts.js.map +1 -0
- package/dist/diagrams/sequence-take.d.ts +22 -0
- package/dist/diagrams/sequence-take.js +221 -0
- package/dist/diagrams/sequence-take.js.map +1 -0
- package/dist/diagrams/sequence.d.ts +27 -0
- package/dist/diagrams/sequence.js +339 -0
- package/dist/diagrams/sequence.js.map +1 -0
- package/dist/diagrams/usecase.d.ts +9 -0
- package/dist/diagrams/usecase.js +160 -0
- package/dist/diagrams/usecase.js.map +1 -0
- package/dist/diagrams/usecase_layout.d.ts +54 -0
- package/dist/diagrams/usecase_layout.js +160 -0
- package/dist/diagrams/usecase_layout.js.map +1 -0
- package/dist/evaluation/accuracy.d.ts +23 -0
- package/dist/evaluation/accuracy.js +140 -0
- package/dist/evaluation/accuracy.js.map +1 -0
- package/dist/evaluation/collector.d.ts +32 -0
- package/dist/evaluation/collector.js +40 -0
- package/dist/evaluation/collector.js.map +1 -0
- package/dist/evaluation/completeness.d.ts +3 -0
- package/dist/evaluation/completeness.js +51 -0
- package/dist/evaluation/completeness.js.map +1 -0
- package/dist/evaluation/consistency.d.ts +12 -0
- package/dist/evaluation/consistency.js +26 -0
- package/dist/evaluation/consistency.js.map +1 -0
- package/dist/evaluation/dashboard-compare.d.ts +4 -0
- package/dist/evaluation/dashboard-compare.js +108 -0
- package/dist/evaluation/dashboard-compare.js.map +1 -0
- package/dist/evaluation/dashboard-review.d.ts +4 -0
- package/dist/evaluation/dashboard-review.js +189 -0
- package/dist/evaluation/dashboard-review.js.map +1 -0
- package/dist/evaluation/dashboard.d.ts +3 -0
- package/dist/evaluation/dashboard.js +334 -0
- package/dist/evaluation/dashboard.js.map +1 -0
- package/dist/evaluation/human-eval.d.ts +7 -0
- package/dist/evaluation/human-eval.js +34 -0
- package/dist/evaluation/human-eval.js.map +1 -0
- package/dist/evaluation/timing.d.ts +14 -0
- package/dist/evaluation/timing.js +35 -0
- package/dist/evaluation/timing.js.map +1 -0
- package/dist/evaluation/token-cost.d.ts +16 -0
- package/dist/evaluation/token-cost.js +44 -0
- package/dist/evaluation/token-cost.js.map +1 -0
- package/dist/evaluation/token-savings.d.ts +12 -0
- package/dist/evaluation/token-savings.js +60 -0
- package/dist/evaluation/token-savings.js.map +1 -0
- package/dist/knowledge/hub-grouping.d.ts +8 -0
- package/dist/knowledge/hub-grouping.js +66 -0
- package/dist/knowledge/hub-grouping.js.map +1 -0
- package/dist/knowledge/local-kb.d.ts +4 -0
- package/dist/knowledge/local-kb.js +82 -0
- package/dist/knowledge/local-kb.js.map +1 -0
- package/dist/knowledge/rag-augment.d.ts +9 -0
- package/dist/knowledge/rag-augment.js +45 -0
- package/dist/knowledge/rag-augment.js.map +1 -0
- package/dist/knowledge/rag-client.d.ts +11 -0
- package/dist/knowledge/rag-client.js +60 -0
- package/dist/knowledge/rag-client.js.map +1 -0
- package/dist/knowledge/retriever.d.ts +15 -0
- package/dist/knowledge/retriever.js +43 -0
- package/dist/knowledge/retriever.js.map +1 -0
- package/dist/knowledge/rules.d.ts +2 -0
- package/dist/knowledge/rules.js +10 -0
- package/dist/knowledge/rules.js.map +1 -0
- package/dist/knowledge/types.d.ts +28 -0
- package/dist/knowledge/types.js +2 -0
- package/dist/knowledge/types.js.map +1 -0
- package/dist/license/banner.d.ts +5 -0
- package/dist/license/banner.js +7 -0
- package/dist/license/banner.js.map +1 -0
- package/dist/license/client.d.ts +116 -0
- package/dist/license/client.js +195 -0
- package/dist/license/client.js.map +1 -0
- package/dist/license/gate.d.ts +22 -0
- package/dist/license/gate.js +50 -0
- package/dist/license/gate.js.map +1 -0
- package/dist/license/keys.d.ts +6 -0
- package/dist/license/keys.js +7 -0
- package/dist/license/keys.js.map +1 -0
- package/dist/license/login-flow.d.ts +39 -0
- package/dist/license/login-flow.js +61 -0
- package/dist/license/login-flow.js.map +1 -0
- package/dist/license/logout-flow.d.ts +18 -0
- package/dist/license/logout-flow.js +55 -0
- package/dist/license/logout-flow.js.map +1 -0
- package/dist/license/rollback.d.ts +9 -0
- package/dist/license/rollback.js +57 -0
- package/dist/license/rollback.js.map +1 -0
- package/dist/license/run-license.d.ts +24 -0
- package/dist/license/run-license.js +28 -0
- package/dist/license/run-license.js.map +1 -0
- package/dist/license/session.d.ts +62 -0
- package/dist/license/session.js +101 -0
- package/dist/license/session.js.map +1 -0
- package/dist/license/status-line.d.ts +8 -0
- package/dist/license/status-line.js +42 -0
- package/dist/license/status-line.js.map +1 -0
- package/dist/license/telemetry.d.ts +15 -0
- package/dist/license/telemetry.js +53 -0
- package/dist/license/telemetry.js.map +1 -0
- package/dist/license/verify.d.ts +11 -0
- package/dist/license/verify.js +214 -0
- package/dist/license/verify.js.map +1 -0
- package/dist/parser.jar +0 -0
- package/dist/server.d.ts +2 -0
- package/dist/server.js +443 -0
- package/dist/server.js.map +1 -0
- package/dist/theory/domains.d.ts +10 -0
- package/dist/theory/domains.js +53 -0
- package/dist/theory/domains.js.map +1 -0
- package/dist/theory/facts.d.ts +8 -0
- package/dist/theory/facts.js +98 -0
- package/dist/theory/facts.js.map +1 -0
- package/dist/theory/fill.d.ts +18 -0
- package/dist/theory/fill.js +157 -0
- package/dist/theory/fill.js.map +1 -0
- package/dist/theory/references.d.ts +33 -0
- package/dist/theory/references.js +227 -0
- package/dist/theory/references.js.map +1 -0
- package/dist/theory/requirements.d.ts +21 -0
- package/dist/theory/requirements.js +100 -0
- package/dist/theory/requirements.js.map +1 -0
- package/dist/theory/scaffold.d.ts +13 -0
- package/dist/theory/scaffold.js +261 -0
- package/dist/theory/scaffold.js.map +1 -0
- package/dist/tools/analyze_project.d.ts +28 -0
- package/dist/tools/analyze_project.js +50 -0
- package/dist/tools/analyze_project.js.map +1 -0
- package/dist/tools/environment.d.ts +29 -0
- package/dist/tools/environment.js +101 -0
- package/dist/tools/environment.js.map +1 -0
- package/dist/tools/generate_report.d.ts +40 -0
- package/dist/tools/generate_report.js +490 -0
- package/dist/tools/generate_report.js.map +1 -0
- package/dist/tools/learn_usecase.d.ts +11 -0
- package/dist/tools/learn_usecase.js +58 -0
- package/dist/tools/learn_usecase.js.map +1 -0
- package/dist/tools/propose_uc_groupings.d.ts +16 -0
- package/dist/tools/propose_uc_groupings.js +94 -0
- package/dist/tools/propose_uc_groupings.js.map +1 -0
- package/dist/tools/review-tasks.d.ts +28 -0
- package/dist/tools/review-tasks.js +168 -0
- package/dist/tools/review-tasks.js.map +1 -0
- package/dist/tools/review.d.ts +28 -0
- package/dist/tools/review.js +160 -0
- package/dist/tools/review.js.map +1 -0
- package/dist/tools/scaffold.d.ts +21 -0
- package/dist/tools/scaffold.js +149 -0
- package/dist/tools/scaffold.js.map +1 -0
- package/dist/tools/scan_repo.d.ts +33 -0
- package/dist/tools/scan_repo.js +140 -0
- package/dist/tools/scan_repo.js.map +1 -0
- package/dist/types/diagram.d.ts +98 -0
- package/dist/types/diagram.js +2 -0
- package/dist/types/diagram.js.map +1 -0
- package/dist/types/evaluation.d.ts +114 -0
- package/dist/types/evaluation.js +2 -0
- package/dist/types/evaluation.js.map +1 -0
- package/dist/types/ir.d.ts +112 -0
- package/dist/types/ir.js +2 -0
- package/dist/types/ir.js.map +1 -0
- package/dist/types/license.d.ts +66 -0
- package/dist/types/license.js +3 -0
- package/dist/types/license.js.map +1 -0
- package/dist/types/report.d.ts +176 -0
- package/dist/types/report.js +2 -0
- package/dist/types/report.js.map +1 -0
- package/dist/types/theory.d.ts +110 -0
- package/dist/types/theory.js +3 -0
- package/dist/types/theory.js.map +1 -0
- package/dist/types/uc-grouping.d.ts +49 -0
- package/dist/types/uc-grouping.js +2 -0
- package/dist/types/uc-grouping.js.map +1 -0
- package/dist/utils/approval.d.ts +37 -0
- package/dist/utils/approval.js +173 -0
- package/dist/utils/approval.js.map +1 -0
- package/dist/utils/dashboard-launcher.d.ts +28 -0
- package/dist/utils/dashboard-launcher.js +215 -0
- package/dist/utils/dashboard-launcher.js.map +1 -0
- package/dist/utils/diagram-dir.d.ts +5 -0
- package/dist/utils/diagram-dir.js +33 -0
- package/dist/utils/diagram-dir.js.map +1 -0
- package/dist/utils/file.d.ts +35 -0
- package/dist/utils/file.js +76 -0
- package/dist/utils/file.js.map +1 -0
- package/dist/utils/ir-minify.d.ts +15 -0
- package/dist/utils/ir-minify.js +114 -0
- package/dist/utils/ir-minify.js.map +1 -0
- package/dist/utils/mcp-launch.d.ts +24 -0
- package/dist/utils/mcp-launch.js +37 -0
- package/dist/utils/mcp-launch.js.map +1 -0
- package/dist/utils/open.d.ts +10 -0
- package/dist/utils/open.js +24 -0
- package/dist/utils/open.js.map +1 -0
- package/dist/utils/run-history.d.ts +29 -0
- package/dist/utils/run-history.js +62 -0
- package/dist/utils/run-history.js.map +1 -0
- package/dist/utils/version.d.ts +6 -0
- package/dist/utils/version.js +25 -0
- package/dist/utils/version.js.map +1 -0
- package/dist/utils/xml.d.ts +17 -0
- package/dist/utils/xml.js +30 -0
- package/dist/utils/xml.js.map +1 -0
- package/package.json +67 -6
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import fs from "node:fs";
|
|
2
|
+
import { scanRepo, extractClasses, extractDependencies, generateReport, buildRunSummary, readConfig, resolveOutputDir, } from "./core-bridge.js";
|
|
3
|
+
export async function handleRunRequest(req, res, broadcast) {
|
|
4
|
+
const body = req.body;
|
|
5
|
+
const projectPath = body.projectPath;
|
|
6
|
+
if (!projectPath || typeof projectPath !== "string") {
|
|
7
|
+
res.status(400).json({ error: "projectPath is required" });
|
|
8
|
+
return;
|
|
9
|
+
}
|
|
10
|
+
let stat;
|
|
11
|
+
try {
|
|
12
|
+
stat = fs.statSync(projectPath);
|
|
13
|
+
}
|
|
14
|
+
catch {
|
|
15
|
+
res.status(400).json({ error: `Path does not exist: ${projectPath}` });
|
|
16
|
+
return;
|
|
17
|
+
}
|
|
18
|
+
if (!stat.isDirectory()) {
|
|
19
|
+
res.status(400).json({ error: `Not a directory: ${projectPath}` });
|
|
20
|
+
return;
|
|
21
|
+
}
|
|
22
|
+
const cfg = readConfig(projectPath);
|
|
23
|
+
const resolvedOutput = resolveOutputDir(projectPath, cfg, body.outputDir);
|
|
24
|
+
const selectN = body.select ?? (typeof cfg.maxUseCases === "number" ? cfg.maxUseCases : undefined);
|
|
25
|
+
const selectedIds = cfg.selectedUseCases?.length ? cfg.selectedUseCases : undefined;
|
|
26
|
+
try {
|
|
27
|
+
broadcast("run-progress", { step: "scan", status: "start" });
|
|
28
|
+
const scanT0 = performance.now();
|
|
29
|
+
const ir = await scanRepo({ project_path: projectPath });
|
|
30
|
+
const parseTimeMs = Math.round(performance.now() - scanT0);
|
|
31
|
+
const classes = extractClasses(ir);
|
|
32
|
+
const { dependencies } = extractDependencies(ir);
|
|
33
|
+
const classCount = ir.classes?.length ?? 0;
|
|
34
|
+
const byType = classes.summary?.by_type ?? {};
|
|
35
|
+
const projectName = cfg.projectName || ir.project.name;
|
|
36
|
+
broadcast("run-progress", { step: "scan", status: "done", detail: `${classCount} classes` });
|
|
37
|
+
broadcast("run-progress", { step: "diagram", status: "start" });
|
|
38
|
+
// Component grouping is derived straight from the scan — no extra work,
|
|
39
|
+
// but still its own step for parity with the CLI's 3-step display.
|
|
40
|
+
broadcast("run-progress", { step: "diagram", status: "done" });
|
|
41
|
+
broadcast("run-progress", { step: "report", status: "start" });
|
|
42
|
+
const report = await generateReport({
|
|
43
|
+
ir,
|
|
44
|
+
classes,
|
|
45
|
+
dependencies,
|
|
46
|
+
output_dir: resolvedOutput,
|
|
47
|
+
parse_time_ms: parseTimeMs,
|
|
48
|
+
usecase_selection: (selectN != null || selectedIds) ? { limit: selectN, selected_ids: selectedIds } : undefined,
|
|
49
|
+
project_info: {
|
|
50
|
+
title: `${projectName} — Báo cáo phân tích và thiết kế`,
|
|
51
|
+
subject: "Công nghệ mới trong phát triển ứng dụng CNTT",
|
|
52
|
+
group: "Nhóm XX",
|
|
53
|
+
},
|
|
54
|
+
actor_overrides: cfg.actorOverrides,
|
|
55
|
+
});
|
|
56
|
+
broadcast("run-progress", { step: "report", status: "done" });
|
|
57
|
+
const summary = buildRunSummary({
|
|
58
|
+
projectName,
|
|
59
|
+
outputDir: resolvedOutput,
|
|
60
|
+
classCount,
|
|
61
|
+
byType,
|
|
62
|
+
parseTimeMs,
|
|
63
|
+
classes,
|
|
64
|
+
report,
|
|
65
|
+
});
|
|
66
|
+
broadcast("run-complete", { projectName, outputDir: resolvedOutput });
|
|
67
|
+
res.json(summary);
|
|
68
|
+
}
|
|
69
|
+
catch (e) {
|
|
70
|
+
const message = e instanceof Error ? e.message : String(e);
|
|
71
|
+
broadcast("run-error", { message });
|
|
72
|
+
res.status(500).json({ error: message });
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,115 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Local-server hardening for the dashboard: this process runs real core
|
|
3
|
+
* functions (scanRepo/generateReport/activateOnline) with filesystem and
|
|
4
|
+
* network access on whatever the browser tells it to, so every request must
|
|
5
|
+
* be provably from the person who started this process, not from any page
|
|
6
|
+
* a browser tab happens to have open.
|
|
7
|
+
*/
|
|
8
|
+
import crypto from "node:crypto";
|
|
9
|
+
import fs from "node:fs";
|
|
10
|
+
import path from "node:path";
|
|
11
|
+
import os from "node:os";
|
|
12
|
+
export const TOKEN_FILE = path.join(os.homedir(), ".archscribe", "dashboard-token");
|
|
13
|
+
/**
|
|
14
|
+
* Persist this server instance's token to TOKEN_FILE (mode 0600 where the
|
|
15
|
+
* platform supports it) so other local processes with filesystem access to
|
|
16
|
+
* ~/.archscribe — the CLI pipeline's notifyNewReport(), or a second
|
|
17
|
+
* `archscribe run` checking whether a dashboard is already up — can
|
|
18
|
+
* discover the CURRENT token the same way they already trust that
|
|
19
|
+
* directory for the license key. Never logged, never put in a response body.
|
|
20
|
+
* Called both when this process generates its own token and when it was
|
|
21
|
+
* handed one via DASHBOARD_TOKEN, so the file always reflects whichever
|
|
22
|
+
* token the currently-running server actually checks.
|
|
23
|
+
*/
|
|
24
|
+
export function persistToken(token) {
|
|
25
|
+
fs.mkdirSync(path.dirname(TOKEN_FILE), { recursive: true });
|
|
26
|
+
fs.writeFileSync(TOKEN_FILE, token, { encoding: "utf8", mode: 0o600 });
|
|
27
|
+
try {
|
|
28
|
+
fs.chmodSync(TOKEN_FILE, 0o600);
|
|
29
|
+
}
|
|
30
|
+
catch { /* best-effort on platforms without POSIX modes */ }
|
|
31
|
+
}
|
|
32
|
+
/** Generate a fresh random token - does NOT persist it, call persistToken() too. */
|
|
33
|
+
export function generateToken() {
|
|
34
|
+
return crypto.randomBytes(24).toString("hex");
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The token a previous run persisted, so the next start reuses it instead of
|
|
38
|
+
* minting a new one.
|
|
39
|
+
*
|
|
40
|
+
* Regenerating on every start silently broke any dashboard tab already open:
|
|
41
|
+
* its sessionStorage still holds the old token, so every /api/* call becomes a
|
|
42
|
+
* 401 the tab has no way to recover from. Reusing the persisted token keeps
|
|
43
|
+
* open tabs working across a restart. Returns null for a missing, empty, or
|
|
44
|
+
* implausibly short file (never a usable token), so a corrupt file just falls
|
|
45
|
+
* back to a fresh token.
|
|
46
|
+
*/
|
|
47
|
+
export function readPersistedToken() {
|
|
48
|
+
try {
|
|
49
|
+
const t = fs.readFileSync(TOKEN_FILE, "utf8").trim();
|
|
50
|
+
return t.length >= 32 ? t : null;
|
|
51
|
+
}
|
|
52
|
+
catch {
|
|
53
|
+
return null;
|
|
54
|
+
}
|
|
55
|
+
}
|
|
56
|
+
/**
|
|
57
|
+
* Rejects any request whose Host header isn't localhost/127.0.0.1/::1 —
|
|
58
|
+
* binding to 127.0.0.1 alone does not stop DNS rebinding: an attacker-owned
|
|
59
|
+
* hostname can resolve to 127.0.0.1, and the browser then considers a
|
|
60
|
+
* fetch() from a page on that hostname same-origin-with-itself, landing a
|
|
61
|
+
* real TCP connection on this server whose Host header names the attacker's
|
|
62
|
+
* domain, not localhost. The attacker controls DNS, never the Host header
|
|
63
|
+
* a legitimate localhost tab sends, so checking it here is what actually
|
|
64
|
+
* stops the attack that IP-binding alone does not.
|
|
65
|
+
*/
|
|
66
|
+
export const hostGuard = (req, res, next) => {
|
|
67
|
+
const host = req.headers.host ?? "";
|
|
68
|
+
const hostname = host.split(":")[0]?.toLowerCase();
|
|
69
|
+
if (hostname === "localhost" || hostname === "127.0.0.1" || hostname === "::1") {
|
|
70
|
+
next();
|
|
71
|
+
return;
|
|
72
|
+
}
|
|
73
|
+
res.status(403).json({ error: "forbidden_host" });
|
|
74
|
+
};
|
|
75
|
+
/** Constant-time compare so a wrong-length guess can't be distinguished by timing from a wrong-value one of the right length. */
|
|
76
|
+
function timingSafeEqualStrings(a, b) {
|
|
77
|
+
const bufA = Buffer.from(a);
|
|
78
|
+
const bufB = Buffer.from(b);
|
|
79
|
+
if (bufA.length !== bufB.length)
|
|
80
|
+
return false;
|
|
81
|
+
return crypto.timingSafeEqual(bufA, bufB);
|
|
82
|
+
}
|
|
83
|
+
/**
|
|
84
|
+
* Requires the startup token, via `Authorization: Bearer <token>` (every
|
|
85
|
+
* fetch() call) or a `?token=` query param (the one exception: browser
|
|
86
|
+
* EventSource cannot set custom headers, so the SSE connection has no other
|
|
87
|
+
* way to authenticate). Accepting the query-param form everywhere is a
|
|
88
|
+
* deliberate, narrow trade-off for a local single-user tool, not a general
|
|
89
|
+
* API — the token is still never accepted from anywhere but these two.
|
|
90
|
+
*/
|
|
91
|
+
export function authGuard(getCurrentToken) {
|
|
92
|
+
return (req, res, next) => {
|
|
93
|
+
const header = req.headers.authorization ?? "";
|
|
94
|
+
const fromHeader = header.startsWith("Bearer ") ? header.slice(7) : "";
|
|
95
|
+
const fromQuery = typeof req.query["token"] === "string" ? req.query["token"] : "";
|
|
96
|
+
const provided = fromHeader || fromQuery;
|
|
97
|
+
if (provided && timingSafeEqualStrings(provided, getCurrentToken())) {
|
|
98
|
+
next();
|
|
99
|
+
return;
|
|
100
|
+
}
|
|
101
|
+
res.status(401).json({ error: "unauthorized" });
|
|
102
|
+
};
|
|
103
|
+
}
|
|
104
|
+
/**
|
|
105
|
+
* Resolves `relPath` against `baseDir` and refuses anything that escapes it
|
|
106
|
+
* (via `..`, an absolute path, a symlink-free lexical check) — returns null
|
|
107
|
+
* rather than throwing, so every caller is forced to handle the rejection.
|
|
108
|
+
*/
|
|
109
|
+
export function resolveWithinDir(baseDir, relPath) {
|
|
110
|
+
const base = path.resolve(baseDir);
|
|
111
|
+
const resolved = path.resolve(base, relPath);
|
|
112
|
+
if (resolved !== base && !resolved.startsWith(base + path.sep))
|
|
113
|
+
return null;
|
|
114
|
+
return resolved;
|
|
115
|
+
}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* archscribe CLI — general-purpose entry for Spring Boot project analysis.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* archscribe doctor [projectPath] — verify environment
|
|
7
|
+
* archscribe run <projectPath> [--output <dir>] [--select <n>]
|
|
8
|
+
* archscribe init <projectPath> — scaffold .archscribe.json
|
|
9
|
+
* archscribe status <projectPath> [--check] [--json] — are the generated docs stale?
|
|
10
|
+
*/
|
|
11
|
+
export {};
|
|
@@ -0,0 +1,340 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
/**
|
|
3
|
+
* archscribe CLI — general-purpose entry for Spring Boot project analysis.
|
|
4
|
+
*
|
|
5
|
+
* Usage:
|
|
6
|
+
* archscribe doctor [projectPath] — verify environment
|
|
7
|
+
* archscribe run <projectPath> [--output <dir>] [--select <n>]
|
|
8
|
+
* archscribe init <projectPath> — scaffold .archscribe.json
|
|
9
|
+
* archscribe status <projectPath> [--check] [--json] — are the generated docs stale?
|
|
10
|
+
*/
|
|
11
|
+
// Suppress the spurious Node.js 22+ localStorage warning emitted by the docx library.
|
|
12
|
+
// docx touches window.localStorage at module load; Node.js 22+ warns unless
|
|
13
|
+
// --localstorage-file is set, which we never pass. Override process.emit so
|
|
14
|
+
// the warning event never reaches the default stderr handler.
|
|
15
|
+
{
|
|
16
|
+
const _origEmit = process.emit.bind(process);
|
|
17
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
18
|
+
process.emit = function (name, ...args) {
|
|
19
|
+
if (name === "warning") {
|
|
20
|
+
const w = args[0];
|
|
21
|
+
if (w && String(w.message).includes("localstorage-file"))
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
25
|
+
return _origEmit(name, ...args);
|
|
26
|
+
};
|
|
27
|
+
}
|
|
28
|
+
import fs from "node:fs";
|
|
29
|
+
import path from "node:path";
|
|
30
|
+
import os from "node:os";
|
|
31
|
+
import { spawnSync } from "node:child_process";
|
|
32
|
+
import { fileURLToPath } from "node:url";
|
|
33
|
+
import { parseArgs } from "node:util";
|
|
34
|
+
import * as p from "@clack/prompts";
|
|
35
|
+
import { scaffoldIntegration } from "../tools/scaffold.js";
|
|
36
|
+
import { mcpLaunch, clientRegistrations, mergeMcpServersJson } from "../utils/mcp-launch.js";
|
|
37
|
+
import { cmdLogin } from "./login.js";
|
|
38
|
+
import { cmdLogout } from "./logout.js";
|
|
39
|
+
import { runPipeline, CONFIG_FILE } from "./run.js";
|
|
40
|
+
import { runCommand } from "./commands.js";
|
|
41
|
+
import { runShell } from "./shell.js";
|
|
42
|
+
import { cmdDashboard } from "./dashboard.js";
|
|
43
|
+
// ── run ───────────────────────────────────────────────────────────────────────
|
|
44
|
+
/**
|
|
45
|
+
* Parse `archscribe run` flags and hand off to runPipeline.
|
|
46
|
+
*
|
|
47
|
+
* This function does argv work only — it must not import anything from ui/,
|
|
48
|
+
* so `runPipeline` stays the single owner of the stage.
|
|
49
|
+
*
|
|
50
|
+
* Flags:
|
|
51
|
+
* --no-anim Disable all animation (ARCHSCRIBE_ANIM=0 also works)
|
|
52
|
+
* --quiet Keep spinner but skip intro/scan/uml animations
|
|
53
|
+
*/
|
|
54
|
+
async function cmdRun(argv) {
|
|
55
|
+
const { positionals, values } = parseArgs({
|
|
56
|
+
args: argv,
|
|
57
|
+
options: {
|
|
58
|
+
output: { type: "string", short: "o" },
|
|
59
|
+
select: { type: "string", short: "s" },
|
|
60
|
+
"no-anim": { type: "boolean" },
|
|
61
|
+
quiet: { type: "boolean" },
|
|
62
|
+
},
|
|
63
|
+
allowPositionals: true,
|
|
64
|
+
strict: false,
|
|
65
|
+
});
|
|
66
|
+
if (values["no-anim"])
|
|
67
|
+
process.env.ARCHSCRIBE_ANIM = "0";
|
|
68
|
+
if (values.quiet)
|
|
69
|
+
process.env.ARCHSCRIBE_QUIET = "1";
|
|
70
|
+
const projectPath = positionals[0];
|
|
71
|
+
if (!projectPath) {
|
|
72
|
+
console.error("Usage: archscribe run <projectPath> [--output <dir>] [--select <n>] [--no-anim] [--quiet]");
|
|
73
|
+
process.exit(1);
|
|
74
|
+
}
|
|
75
|
+
await runPipeline({
|
|
76
|
+
projectPath,
|
|
77
|
+
output: values.output,
|
|
78
|
+
select: values.select ? Number(values.select) : undefined,
|
|
79
|
+
quiet: Boolean(values.quiet),
|
|
80
|
+
});
|
|
81
|
+
}
|
|
82
|
+
// ── init ──────────────────────────────────────────────────────────────────────
|
|
83
|
+
const CONFIG_TEMPLATE = {
|
|
84
|
+
projectName: "",
|
|
85
|
+
outputDir: "archscribe-output",
|
|
86
|
+
selectedUseCases: [],
|
|
87
|
+
maxUseCases: null,
|
|
88
|
+
actorOverrides: {},
|
|
89
|
+
};
|
|
90
|
+
/** Scaffold a .archscribe.json template in the target project. */
|
|
91
|
+
async function cmdInit(argv) {
|
|
92
|
+
const projectPath = argv[0];
|
|
93
|
+
if (!projectPath) {
|
|
94
|
+
console.error("Usage: archscribe init <projectPath>");
|
|
95
|
+
process.exit(1);
|
|
96
|
+
}
|
|
97
|
+
const dest = path.join(projectPath, CONFIG_FILE);
|
|
98
|
+
if (fs.existsSync(dest)) {
|
|
99
|
+
console.error(`[archscribe] ${CONFIG_FILE} already exists at ${dest}`);
|
|
100
|
+
console.error(" Edit it manually, or delete it first and re-run init.");
|
|
101
|
+
process.exit(1);
|
|
102
|
+
}
|
|
103
|
+
fs.mkdirSync(projectPath, { recursive: true });
|
|
104
|
+
fs.writeFileSync(dest, JSON.stringify(CONFIG_TEMPLATE, null, 2) + "\n", "utf8");
|
|
105
|
+
console.log(`✓ Created ${dest}`);
|
|
106
|
+
console.log(` Set projectName, then run: archscribe run ${projectPath}`);
|
|
107
|
+
}
|
|
108
|
+
// ── setup ─────────────────────────────────────────────────────────────────────
|
|
109
|
+
/** Resolve the absolute path to dist/server.js from this compiled file. */
|
|
110
|
+
function resolveServerPath() {
|
|
111
|
+
const thisFile = fileURLToPath(import.meta.url);
|
|
112
|
+
// dist/cli/archscribe.js → dist/server.js
|
|
113
|
+
return path.resolve(path.dirname(thisFile), "../server.js");
|
|
114
|
+
}
|
|
115
|
+
const onPath = (bin) => spawnSync(process.platform === "win32" ? "where" : "which", [bin], { stdio: "ignore" }).status === 0;
|
|
116
|
+
/** Windows needs a shell for .cmd/.ps1 shims, so quote args that contain spaces. */
|
|
117
|
+
const shellArg = (a) => (process.platform === "win32" && /\s/.test(a) ? `"${a}"` : a);
|
|
118
|
+
/**
|
|
119
|
+
* Register the archscribe MCP server at user scope with every AI client found on this machine:
|
|
120
|
+
* Claude Code, Codex, Gemini CLI, OpenCode (via their own `mcp add`) and Antigravity (config file).
|
|
121
|
+
* archscribe setup [--only claude,codex,...]
|
|
122
|
+
*/
|
|
123
|
+
async function cmdSetup(argv) {
|
|
124
|
+
p.intro("archscribe setup");
|
|
125
|
+
const serverPath = resolveServerPath();
|
|
126
|
+
if (!fs.existsSync(serverPath)) {
|
|
127
|
+
p.log.error(`dist/server.js not found at ${serverPath}`);
|
|
128
|
+
p.log.info("Run 'npm run build' first.");
|
|
129
|
+
process.exit(1);
|
|
130
|
+
}
|
|
131
|
+
const java = spawnSync("java", ["-version"], { encoding: "utf8" });
|
|
132
|
+
if (java.status !== 0)
|
|
133
|
+
p.log.warn("Java not found. archscribe needs JDK 17+ to analyze projects: https://adoptium.net");
|
|
134
|
+
const launch = mcpLaunch(serverPath);
|
|
135
|
+
const agDir = path.join(os.homedir(), ".gemini", "config");
|
|
136
|
+
const agFile = path.join(agDir, "mcp_config.json");
|
|
137
|
+
const agInstalled = fs.existsSync(agFile) || ["antigravity", "antigravity-cli", "antigravity-ide"]
|
|
138
|
+
.some((d) => fs.existsSync(path.join(os.homedir(), ".gemini", d)));
|
|
139
|
+
const onlyIdx = argv.indexOf("--only");
|
|
140
|
+
const only = onlyIdx >= 0 ? (argv[onlyIdx + 1] ?? "").split(",").map((s) => s.trim()) : null;
|
|
141
|
+
// --only forces the config-file client even before Antigravity has created ~/.gemini.
|
|
142
|
+
let clients = clientRegistrations(launch)
|
|
143
|
+
.filter((c) => !only || only.includes(c.id))
|
|
144
|
+
.filter((c) => (c.bin ? onPath(c.bin) : only !== null || agInstalled));
|
|
145
|
+
if (!clients.length) {
|
|
146
|
+
p.log.warn("No supported AI client found (claude, codex, gemini, opencode, Antigravity).");
|
|
147
|
+
p.log.info(`Add this MCP server to your client manually:\n ${[launch.command, ...launch.args].join(" ")}`);
|
|
148
|
+
p.outro("Then run: archscribe scaffold <your-spring-boot-project>");
|
|
149
|
+
return;
|
|
150
|
+
}
|
|
151
|
+
if (!only && process.stdin.isTTY) {
|
|
152
|
+
const picked = await p.multiselect({
|
|
153
|
+
message: "Register archscribe with:",
|
|
154
|
+
options: clients.map((c) => ({ value: c.id, label: c.label })),
|
|
155
|
+
initialValues: clients.map((c) => c.id),
|
|
156
|
+
});
|
|
157
|
+
if (p.isCancel(picked)) {
|
|
158
|
+
p.cancel("Cancelled");
|
|
159
|
+
return;
|
|
160
|
+
}
|
|
161
|
+
clients = clients.filter((c) => picked.includes(c.id));
|
|
162
|
+
}
|
|
163
|
+
let failed = 0;
|
|
164
|
+
for (const c of clients) {
|
|
165
|
+
if (!c.bin) {
|
|
166
|
+
try {
|
|
167
|
+
const existing = fs.existsSync(agFile) ? fs.readFileSync(agFile, "utf8") : null;
|
|
168
|
+
const next = mergeMcpServersJson(existing, launch);
|
|
169
|
+
fs.mkdirSync(agDir, { recursive: true });
|
|
170
|
+
fs.writeFileSync(agFile, next, "utf8");
|
|
171
|
+
p.log.success(`${c.label}: registered`);
|
|
172
|
+
}
|
|
173
|
+
catch (err) {
|
|
174
|
+
failed++;
|
|
175
|
+
p.log.error(`${c.label}: left unchanged (${err.message})`);
|
|
176
|
+
}
|
|
177
|
+
continue;
|
|
178
|
+
}
|
|
179
|
+
const r = spawnSync([c.bin, ...c.argv].map(shellArg).join(" "), {
|
|
180
|
+
shell: true, encoding: "utf8", timeout: 60_000, stdio: ["ignore", "pipe", "pipe"],
|
|
181
|
+
});
|
|
182
|
+
const out = `${r.stdout ?? ""}${r.stderr ?? ""}`;
|
|
183
|
+
if (r.status === 0)
|
|
184
|
+
p.log.success(`${c.label}: registered`);
|
|
185
|
+
else if (/already exists/i.test(out))
|
|
186
|
+
p.log.info(`${c.label}: already registered`);
|
|
187
|
+
else {
|
|
188
|
+
failed++;
|
|
189
|
+
p.log.error(`${c.label}: failed\n${out.trim() || r.error?.message || ""}`);
|
|
190
|
+
}
|
|
191
|
+
}
|
|
192
|
+
p.outro(failed
|
|
193
|
+
? `${failed} client(s) failed, see above. Then run: archscribe scaffold <your-spring-boot-project>`
|
|
194
|
+
: "Done. Restart your AI client, then run: archscribe scaffold <your-spring-boot-project>");
|
|
195
|
+
if (failed)
|
|
196
|
+
process.exitCode = 1;
|
|
197
|
+
}
|
|
198
|
+
// ── scaffold ──────────────────────────────────────────────────────────────────
|
|
199
|
+
/**
|
|
200
|
+
* Create .mcp.json + SKILL.md inside a Spring Boot project.
|
|
201
|
+
* Equivalent to the MCP tool scaffold_integration — no Claude needed.
|
|
202
|
+
*/
|
|
203
|
+
async function cmdScaffold(argv) {
|
|
204
|
+
const projectPath = argv[0];
|
|
205
|
+
if (!projectPath) {
|
|
206
|
+
console.error("Usage: archscribe scaffold <projectPath> [--overwrite]");
|
|
207
|
+
process.exit(1);
|
|
208
|
+
}
|
|
209
|
+
const overwrite = argv.includes("--overwrite");
|
|
210
|
+
const abs = path.resolve(projectPath);
|
|
211
|
+
if (!fs.existsSync(abs)) {
|
|
212
|
+
console.error(`[archscribe] Directory not found: ${abs}`);
|
|
213
|
+
process.exit(1);
|
|
214
|
+
}
|
|
215
|
+
const result = await scaffoldIntegration({ projectPath: abs, overwrite });
|
|
216
|
+
if (result.created.length) {
|
|
217
|
+
result.created.forEach((f) => console.log(` ✓ created ${f}`));
|
|
218
|
+
}
|
|
219
|
+
if (result.skipped.length) {
|
|
220
|
+
result.skipped.forEach((f) => console.log(` – skipped ${f} (already exists; use --overwrite)`));
|
|
221
|
+
}
|
|
222
|
+
if (!result.created.length && !result.skipped.length) {
|
|
223
|
+
console.log(" Nothing to do.");
|
|
224
|
+
}
|
|
225
|
+
}
|
|
226
|
+
// ── dispatch ──────────────────────────────────────────────────────────────────
|
|
227
|
+
const HELP = `archscribe — Spring Boot documentation generator
|
|
228
|
+
|
|
229
|
+
Commands:
|
|
230
|
+
archscribe setup [--only claude,codex,...] Register the MCP server with your AI clients (run once per machine)
|
|
231
|
+
Supported: claude, codex, gemini, opencode, antigravity
|
|
232
|
+
archscribe login [--switch] Activate your license key (--switch: replace another key)
|
|
233
|
+
archscribe logout [--force] Give this machine's seat back and forget the key
|
|
234
|
+
archscribe scaffold <projectPath> Create .mcp.json + skill in your Spring Boot project
|
|
235
|
+
archscribe doctor [projectPath] Check environment requirements
|
|
236
|
+
archscribe run <projectPath> [options] Analyze project and generate docs
|
|
237
|
+
archscribe init <projectPath> Create .archscribe.json config template
|
|
238
|
+
archscribe status <projectPath> [options] Check whether the generated docs are stale
|
|
239
|
+
archscribe history <projectPath> [options] Show past runs and what changed between them
|
|
240
|
+
archscribe mascot [--moods] Show Archie mascot animation
|
|
241
|
+
archscribe open <projectPath> Open generated dashboard.html
|
|
242
|
+
archscribe dashboard Open the local dashboard server (with its token)
|
|
243
|
+
archscribe check [projectPath|--all] Check recent projects for source changes
|
|
244
|
+
archscribe config <projectPath> View or edit project settings
|
|
245
|
+
archscribe clean <projectPath> [--yes] Remove generated output (requires confirmation)
|
|
246
|
+
archscribe rag status Count local learned use cases
|
|
247
|
+
archscribe version Show installed version
|
|
248
|
+
|
|
249
|
+
Options for 'run':
|
|
250
|
+
-o, --output <dir> Output directory (default: <projectPath>/archscribe-output)
|
|
251
|
+
-s, --select <n> Max use cases to generate
|
|
252
|
+
--no-anim Disable animations (static log output)
|
|
253
|
+
--quiet Keep spinner but skip intro/scan/uml animations
|
|
254
|
+
|
|
255
|
+
Options for 'status':
|
|
256
|
+
-o, --output <dir> Output directory holding manifest.json (same default as 'run')
|
|
257
|
+
--check Exit 1 when stale, 2 when never generated (for CI)
|
|
258
|
+
--json Print the machine-readable report
|
|
259
|
+
|
|
260
|
+
Options for 'history':
|
|
261
|
+
-o, --output <dir> Output directory holding runs/ (same default as 'run')
|
|
262
|
+
--diff <n> Compare run #n (1 = newest) with the run before it
|
|
263
|
+
--last Shortcut for --diff 1
|
|
264
|
+
--json Print runs (and the diff, if requested) as JSON
|
|
265
|
+
|
|
266
|
+
Examples:
|
|
267
|
+
archscribe setup
|
|
268
|
+
archscribe login
|
|
269
|
+
archscribe scaffold D:/path/to/MiniZalo_Backend
|
|
270
|
+
archscribe doctor ./my-spring-app
|
|
271
|
+
archscribe run ./my-spring-app
|
|
272
|
+
archscribe mascot --moods`;
|
|
273
|
+
const [, , sub, ...rest] = process.argv;
|
|
274
|
+
switch (sub) {
|
|
275
|
+
case "setup":
|
|
276
|
+
await cmdSetup(rest);
|
|
277
|
+
break;
|
|
278
|
+
case "login":
|
|
279
|
+
await cmdLogin(rest);
|
|
280
|
+
break;
|
|
281
|
+
case "logout":
|
|
282
|
+
await cmdLogout(rest);
|
|
283
|
+
break;
|
|
284
|
+
case "scaffold":
|
|
285
|
+
await cmdScaffold(rest);
|
|
286
|
+
break;
|
|
287
|
+
case "run":
|
|
288
|
+
await cmdRun(rest);
|
|
289
|
+
break;
|
|
290
|
+
case "doctor":
|
|
291
|
+
await runCommand("doctor", rest);
|
|
292
|
+
break;
|
|
293
|
+
case "init":
|
|
294
|
+
await cmdInit(rest);
|
|
295
|
+
break;
|
|
296
|
+
case "status":
|
|
297
|
+
await runCommand("status", rest);
|
|
298
|
+
break;
|
|
299
|
+
case "history":
|
|
300
|
+
await runCommand("history", rest);
|
|
301
|
+
break;
|
|
302
|
+
case "mascot":
|
|
303
|
+
await runCommand("mascot", rest);
|
|
304
|
+
break;
|
|
305
|
+
case "open":
|
|
306
|
+
await runCommand("open", rest);
|
|
307
|
+
break;
|
|
308
|
+
case "dashboard":
|
|
309
|
+
await cmdDashboard(rest);
|
|
310
|
+
break;
|
|
311
|
+
case "check":
|
|
312
|
+
await runCommand("check", rest);
|
|
313
|
+
break;
|
|
314
|
+
case "config":
|
|
315
|
+
await runCommand("config", rest);
|
|
316
|
+
break;
|
|
317
|
+
case "clean":
|
|
318
|
+
await runCommand("clean", rest);
|
|
319
|
+
break;
|
|
320
|
+
case "rag":
|
|
321
|
+
await runCommand("rag", rest);
|
|
322
|
+
break;
|
|
323
|
+
case "version":
|
|
324
|
+
await runCommand("version", rest);
|
|
325
|
+
break;
|
|
326
|
+
default: {
|
|
327
|
+
// Bare `archscribe` on a real terminal opens the interactive menu.
|
|
328
|
+
// Anything else — an unknown subcommand, a pipe, CI, --quiet/--no-anim —
|
|
329
|
+
// prints help and exits. Never block on input we can't get.
|
|
330
|
+
const interactive = Boolean(process.stdin.isTTY) && Boolean(process.stderr.isTTY)
|
|
331
|
+
&& !rest.includes("--no-anim") && !rest.includes("--quiet") && !process.env.CI;
|
|
332
|
+
if (sub || !interactive) {
|
|
333
|
+
console.error(HELP);
|
|
334
|
+
process.exit(sub ? 1 : 0);
|
|
335
|
+
}
|
|
336
|
+
await runShell();
|
|
337
|
+
break;
|
|
338
|
+
}
|
|
339
|
+
}
|
|
340
|
+
//# sourceMappingURL=archscribe.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"archscribe.js","sourceRoot":"","sources":["../../src/cli/archscribe.ts"],"names":[],"mappings":";AACA;;;;;;;;GAQG;AAEH,sFAAsF;AACtF,4EAA4E;AAC5E,4EAA4E;AAC5E,8DAA8D;AAC9D,CAAC;IACC,MAAM,SAAS,GAAG,OAAO,CAAC,IAAI,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IAC7C,8DAA8D;IAC7D,OAAe,CAAC,IAAI,GAAG,UAAU,IAAY,EAAE,GAAG,IAAe;QAChE,IAAI,IAAI,KAAK,SAAS,EAAE,CAAC;YACvB,MAAM,CAAC,GAAG,IAAI,CAAC,CAAC,CAAsB,CAAC;YACvC,IAAI,CAAC,IAAI,MAAM,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,QAAQ,CAAC,mBAAmB,CAAC;gBAAE,OAAO,KAAK,CAAC;QACzE,CAAC;QACD,8DAA8D;QAC9D,OAAQ,SAAiB,CAAC,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC;IAC3C,CAAC,CAAC;AACJ,CAAC;AAED,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,MAAM,SAAS,CAAC;AACzB,OAAO,EAAE,SAAS,EAAE,MAAM,oBAAoB,CAAC;AAC/C,OAAO,EAAE,aAAa,EAAE,MAAM,UAAU,CAAC;AACzC,OAAO,EAAE,SAAS,E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,KAAK,EAAE,IAAI,CAAC,CAAC;QAAC,MAAM;IACtD,KAAK,SAAS;QAAG,MAAM,UAAU,CAAC,SAAS,EAAE,IAAI,CAAC,CAAC;QAAC,MAAM;IAC1D,OAAO,CAAC,CAAC,CAAC;QACR,mEAAmE;QACnE,yEAAyE;QACzE,4DAA4D;QAC5D,MAAM,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,IAAI,OAAO,CAAC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC;eAC5E,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,IAAI,CAAC,QAAQ,CAAC,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,EAAE,CAAC;QACjF,IAAI,GAAG,IAAI,CAAC,WAAW,EAAE,CAAC;YACxB,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;YACpB,OAAO,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC;QAC5B,CAAC;QAED,MAAM,QAAQ,EAAE,CAAC;QACjB,MAAM;IACR,CAAC;AACH,CAAC"}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { type FreshnessReport } from "../core/freshness.js";
|
|
2
|
+
/** One project's freshness, flattened for display. */
|
|
3
|
+
export interface CheckRow {
|
|
4
|
+
project: string;
|
|
5
|
+
state: FreshnessReport["state"];
|
|
6
|
+
changed: number;
|
|
7
|
+
newControllers: number;
|
|
8
|
+
}
|
|
9
|
+
/** Flatten a freshness report into the two numbers a row shows. */
|
|
10
|
+
export declare function summarizeFreshness(report: FreshnessReport): {
|
|
11
|
+
changed: number;
|
|
12
|
+
newControllers: number;
|
|
13
|
+
};
|
|
14
|
+
/** Render the check lines; empty list points at the command that fills it. */
|
|
15
|
+
export declare function renderCheck(rows: CheckRow[]): string;
|
|
16
|
+
/** Parse `archscribe check` flags and print the freshness table. */
|
|
17
|
+
export declare function cmdCheck(argv: string[]): Promise<void>;
|
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* `archscribe check [<project>|--all] [-o <dir>]` — is each recent project's
|
|
3
|
+
* documentation still current? One compact "có cập nhật mới" line per project,
|
|
4
|
+
* reusing the freshness scan behind `archscribe status`.
|
|
5
|
+
*/
|
|
6
|
+
import path from "node:path";
|
|
7
|
+
import { parseArgs } from "node:util";
|
|
8
|
+
import { checkFreshness } from "../core/freshness.js";
|
|
9
|
+
import { readConfig, resolveOutputDir } from "../core/project-config.js";
|
|
10
|
+
import { listRecent } from "./state.js";
|
|
11
|
+
import { caps, SYM } from "./ui/term.js";
|
|
12
|
+
import { runMotion } from "./ui/motions.js";
|
|
13
|
+
/** Flatten a freshness report into the two numbers a row shows. */
|
|
14
|
+
export function summarizeFreshness(report) {
|
|
15
|
+
return {
|
|
16
|
+
changed: report.changed.length + report.added.length + report.removed.length,
|
|
17
|
+
newControllers: report.newControllerFiles.length,
|
|
18
|
+
};
|
|
19
|
+
}
|
|
20
|
+
/** Render the check lines; empty list points at the command that fills it. */
|
|
21
|
+
export function renderCheck(rows) {
|
|
22
|
+
if (!rows.length) {
|
|
23
|
+
return "Chưa có project nào trong lịch sử — chạy: archscribe run <project>";
|
|
24
|
+
}
|
|
25
|
+
const warn = caps.unicode ? "⚠" : "!";
|
|
26
|
+
return rows
|
|
27
|
+
.map((r) => {
|
|
28
|
+
if (r.state === "fresh")
|
|
29
|
+
return `${SYM.ok} ${r.project} — docs up to date`;
|
|
30
|
+
if (r.state === "missing")
|
|
31
|
+
return `· ${r.project} — chưa tạo docs`;
|
|
32
|
+
const extra = r.newControllers ? ` · ${r.newControllers} controller mới` : "";
|
|
33
|
+
return `${warn} ${r.project} — ${r.changed} file đổi${extra}`;
|
|
34
|
+
})
|
|
35
|
+
.join("\n");
|
|
36
|
+
}
|
|
37
|
+
/** Build one row for a project, degrading to "missing" on any read error. */
|
|
38
|
+
function rowFor(projectPath, outputOverride) {
|
|
39
|
+
const project = path.basename(path.resolve(projectPath));
|
|
40
|
+
try {
|
|
41
|
+
const outputDir = resolveOutputDir(projectPath, readConfig(projectPath), outputOverride);
|
|
42
|
+
const report = checkFreshness(projectPath, outputDir);
|
|
43
|
+
const { changed, newControllers } = summarizeFreshness(report);
|
|
44
|
+
return { project, state: report.state, changed, newControllers };
|
|
45
|
+
}
|
|
46
|
+
catch {
|
|
47
|
+
return { project, state: "missing", changed: 0, newControllers: 0 };
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
/** Parse `archscribe check` flags and print the freshness table. */
|
|
51
|
+
export async function cmdCheck(argv) {
|
|
52
|
+
const { positionals, values } = parseArgs({
|
|
53
|
+
args: argv,
|
|
54
|
+
options: { output: { type: "string", short: "o" }, all: { type: "boolean" } },
|
|
55
|
+
allowPositionals: true,
|
|
56
|
+
strict: false,
|
|
57
|
+
});
|
|
58
|
+
const explicit = positionals[0];
|
|
59
|
+
const projects = explicit ? [explicit] : listRecent().map((r) => r.path);
|
|
60
|
+
const rows = await runMotion("Kiểm tra cập nhật", async (task) => projects.map((project, i) => {
|
|
61
|
+
const row = rowFor(project, explicit ? values.output : undefined);
|
|
62
|
+
task.update(`${i + 1}/${projects.length} ${row.project}`, (i + 1) / projects.length);
|
|
63
|
+
return row;
|
|
64
|
+
}), { done: (results) => `Đã kiểm tra ${results.length} project` });
|
|
65
|
+
console.log(renderCheck(rows));
|
|
66
|
+
}
|
|
67
|
+
//# sourceMappingURL=check.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"check.js","sourceRoot":"","sources":["../../src/cli/check.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AACH,OAAO,IAAI,MAAM,WAAW,CAAC;AAC7B,OAAO,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AACtC,OAAO,EAAE,cAAc,EAAwB,MAAM,sBAAsB,CAAC;AAC5E,OAAO,EAAE,UAAU,EAAE,gBAAg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