siluzan-cso-cli 1.1.29-beta.9 → 1.1.29
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 +1 -2
- package/dist/index.js +719 -447
- package/dist/skill/SKILL.md +7 -6
- package/dist/skill/_meta.json +2 -2
- package/dist/skill/assets/three-lib-content-workflow.example.md +7 -5
- package/dist/skill/references/account-group.md +9 -9
- package/dist/skill/references/authorize.md +1 -1
- package/dist/skill/references/core/agent-conventions.md +61 -0
- package/dist/skill/references/core/tips.md +130 -0
- package/dist/skill/references/list-accounts.md +13 -13
- package/dist/skill/references/persona.md +20 -19
- package/dist/skill/references/planning.md +52 -52
- package/dist/skill/references/publish.md +7 -7
- package/dist/skill/references/rag.md +16 -16
- package/dist/skill/references/report.md +2 -2
- package/dist/skill/references/setup.md +4 -4
- package/dist/skill/references/task.md +2 -2
- package/dist/skill/references/upload.md +2 -3
- package/dist/skill/references/validate-content.md +15 -15
- package/dist/skill/references/web-pages.md +21 -21
- package/dist/skill/scripts/install.ps1 +3 -3
- package/dist/skill/scripts/install.sh +3 -3
- package/dist/skill/three-lib-content-workflow/collaboration.md +11 -6
- package/dist/skill/three-lib-content-workflow/content-writer.workflow.md +23 -24
- package/dist/skill/three-lib-content-workflow/persona-onboarding.md +8 -0
- package/dist/skill/three-lib-content-workflow/persona-schema.md +41 -34
- package/dist/skill/three-lib-content-workflow/sop.md +18 -17
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1951,6 +1951,10 @@ import * as path2 from "path";
|
|
|
1951
1951
|
import { fileURLToPath } from "url";
|
|
1952
1952
|
import { spawn } from "child_process";
|
|
1953
1953
|
import Table from "cli-table3";
|
|
1954
|
+
import * as fs3 from "fs/promises";
|
|
1955
|
+
import * as path3 from "path";
|
|
1956
|
+
import * as fs4 from "fs/promises";
|
|
1957
|
+
import * as path4 from "path";
|
|
1954
1958
|
var SILUZAN_DIR = path.join(os.homedir(), ".siluzan");
|
|
1955
1959
|
var CONFIG_FILE = path.join(SILUZAN_DIR, "config.json");
|
|
1956
1960
|
function atomicWriteFileSync(targetPath, content, encoding = "utf8") {
|
|
@@ -2127,7 +2131,7 @@ function rawRequest(url, options) {
|
|
|
2127
2131
|
const perfOn = isPerfEnabled();
|
|
2128
2132
|
const t0 = perfOn ? performance.now() : 0;
|
|
2129
2133
|
const method = options.method ?? "GET";
|
|
2130
|
-
return new Promise((
|
|
2134
|
+
return new Promise((resolve52, reject) => {
|
|
2131
2135
|
const parsed = new URL(url);
|
|
2132
2136
|
const transport = parsed.protocol === "https:" ? https : http;
|
|
2133
2137
|
const timeoutMs = options.timeoutMs ?? DEFAULT_TIMEOUT_MS;
|
|
@@ -2212,7 +2216,7 @@ function rawRequest(url, options) {
|
|
|
2212
2216
|
ok: status >= 200 && status < 300
|
|
2213
2217
|
});
|
|
2214
2218
|
}
|
|
2215
|
-
|
|
2219
|
+
resolve52({ status, text: data, headers });
|
|
2216
2220
|
});
|
|
2217
2221
|
});
|
|
2218
2222
|
req.on("timeout", () => {
|
|
@@ -2345,20 +2349,20 @@ async function defaultRunMinRequiredGlobalInstall(ctx) {
|
|
|
2345
2349
|
return { ok: false, stderr: "SILUZAN_SKIP_AUTO_GLOBAL_INSTALL=1" };
|
|
2346
2350
|
}
|
|
2347
2351
|
const spec = `${ctx.pkgName}@${ctx.tag}`;
|
|
2348
|
-
return await new Promise((
|
|
2352
|
+
return await new Promise((resolve52) => {
|
|
2349
2353
|
const child = spawn("npm", ["install", "-g", spec, "--no-fund", "--no-audit"], {
|
|
2350
2354
|
stdio: "inherit",
|
|
2351
2355
|
shell: true
|
|
2352
2356
|
});
|
|
2353
2357
|
child.on("error", (err) => {
|
|
2354
|
-
|
|
2358
|
+
resolve52({ ok: false, stderr: err instanceof Error ? err.message : String(err) });
|
|
2355
2359
|
});
|
|
2356
2360
|
child.on("close", (code, signal) => {
|
|
2357
2361
|
if (code === 0) {
|
|
2358
|
-
|
|
2362
|
+
resolve52({ ok: true });
|
|
2359
2363
|
} else {
|
|
2360
2364
|
const sig = signal ? ` signal=${signal}` : "";
|
|
2361
|
-
|
|
2365
|
+
resolve52({ ok: false, stderr: `exit code ${code}${sig}` });
|
|
2362
2366
|
}
|
|
2363
2367
|
});
|
|
2364
2368
|
});
|
|
@@ -2515,6 +2519,268 @@ function formatPaginationSummary(params) {
|
|
|
2515
2519
|
const totalPages = params.totalPagesOverride !== void 0 ? params.totalPagesOverride : computeTotalPages(params.total, params.pageSize);
|
|
2516
2520
|
return `\u9875\u7801/\u5F53\u524D\u9875\uFF1A${params.page}\uFF0C\u603B\u6761\u6570\uFF1A${params.total}\uFF0C\u603B\u9875\u6570\uFF1A${totalPages}\uFF0C\u6BCF\u9875\uFF1A${params.pageSize} \u6761`;
|
|
2517
2521
|
}
|
|
2522
|
+
function resolveSnapshotDir(snapshotDir) {
|
|
2523
|
+
const trimmed = snapshotDir.trim();
|
|
2524
|
+
if (!trimmed) {
|
|
2525
|
+
throw new Error("\u5FEB\u7167\u76EE\u5F55\u4E0D\u80FD\u4E3A\u7A7A");
|
|
2526
|
+
}
|
|
2527
|
+
if (trimmed.includes("\0")) {
|
|
2528
|
+
throw new Error("\u5FEB\u7167\u76EE\u5F55\u8DEF\u5F84\u975E\u6CD5");
|
|
2529
|
+
}
|
|
2530
|
+
return path3.resolve(trimmed);
|
|
2531
|
+
}
|
|
2532
|
+
async function ensureSnapshotDir(snapshotDir) {
|
|
2533
|
+
const abs = resolveSnapshotDir(snapshotDir);
|
|
2534
|
+
await fs3.mkdir(abs, { recursive: true });
|
|
2535
|
+
return abs;
|
|
2536
|
+
}
|
|
2537
|
+
var CLI_SNAPSHOT_MANIFEST_FILE = "cli-manifest.json";
|
|
2538
|
+
var SCHEMA_VERSION = 1;
|
|
2539
|
+
var FALLBACK_FIELD_GUIDE_REFS = ["references/core/tips.md"];
|
|
2540
|
+
var _cliPackage = "siluzan-cli";
|
|
2541
|
+
var _resolveCliVersion = () => "0.0.0";
|
|
2542
|
+
var _fieldGuideRefs = FALLBACK_FIELD_GUIDE_REFS;
|
|
2543
|
+
function configureCliJsonSnapshot(opts) {
|
|
2544
|
+
if (opts.cliPackage) _cliPackage = opts.cliPackage;
|
|
2545
|
+
if (opts.resolveVersion) _resolveCliVersion = opts.resolveVersion;
|
|
2546
|
+
if (opts.fieldGuideRefs && opts.fieldGuideRefs.length) _fieldGuideRefs = opts.fieldGuideRefs;
|
|
2547
|
+
}
|
|
2548
|
+
function configuredCliPackage() {
|
|
2549
|
+
return _cliPackage;
|
|
2550
|
+
}
|
|
2551
|
+
function configuredCliVersion() {
|
|
2552
|
+
try {
|
|
2553
|
+
return _resolveCliVersion();
|
|
2554
|
+
} catch {
|
|
2555
|
+
return "0.0.0";
|
|
2556
|
+
}
|
|
2557
|
+
}
|
|
2558
|
+
var OUTLINE_AGENT_HINT = "\u7981\u6B62\u7528 Read/cat \u6253\u5F00 writtenFiles \u4E2D\u7684\u5B8C\u6574\u4E1A\u52A1 *.json\u3002\u987A\u5E8F\uFF1A1) \u89E3\u6790\u672C\u884C stdout \u6458\u8981\uFF1B2) \u4EC5\u53EF\u8BFB outlineFile\uFF08*.outline.txt\uFF0Cschema\uFF09\uFF1B3) \u5FC5\u987B\u7528 node/python \u811A\u672C require/readFileSync \u8BFB JSON \u5E76\u6253\u5370\u6240\u9700\u5B57\u6BB5\u3002\u52FF\u628A JSON \u8D34\u8FDB\u5BF9\u8BDD\u3002";
|
|
2559
|
+
function slugifyCliSnapshotSectionKey(section) {
|
|
2560
|
+
return section.trim().toLowerCase().replace(/[^a-z0-9_-]+/g, "-").replace(/-+/g, "-").replace(/^-|-$/g, "");
|
|
2561
|
+
}
|
|
2562
|
+
function slugifyIdSuffix(id) {
|
|
2563
|
+
if (id === void 0 || id === null) return "";
|
|
2564
|
+
return slugifyCliSnapshotSectionKey(String(id));
|
|
2565
|
+
}
|
|
2566
|
+
function applyIdSuffix(stem, idSuffix) {
|
|
2567
|
+
const slug = slugifyIdSuffix(idSuffix);
|
|
2568
|
+
if (!slug) return stem;
|
|
2569
|
+
if (stem === slug || stem.endsWith(`-${slug}`)) return stem;
|
|
2570
|
+
return `${stem}-${slug}`;
|
|
2571
|
+
}
|
|
2572
|
+
function normalizeCliSnapshotSection(section) {
|
|
2573
|
+
const slug = slugifyCliSnapshotSectionKey(section);
|
|
2574
|
+
if (!slug || !/^[a-z0-9_-]+$/.test(slug)) {
|
|
2575
|
+
throw new Error(`\u975E\u6CD5 section\uFF0C\u65E0\u6CD5\u751F\u6210\u6587\u4EF6\u540D\uFF1A${section}`);
|
|
2576
|
+
}
|
|
2577
|
+
return slug;
|
|
2578
|
+
}
|
|
2579
|
+
function cliManifestFileName(idSuffix) {
|
|
2580
|
+
return `${applyIdSuffix("cli-manifest", idSuffix)}.json`;
|
|
2581
|
+
}
|
|
2582
|
+
async function readCliManifestIfExists(absDir, idSuffix) {
|
|
2583
|
+
const candidates = [cliManifestFileName(idSuffix)];
|
|
2584
|
+
if (idSuffix && candidates[0] !== CLI_SNAPSHOT_MANIFEST_FILE) {
|
|
2585
|
+
candidates.push(CLI_SNAPSHOT_MANIFEST_FILE);
|
|
2586
|
+
}
|
|
2587
|
+
for (const name of candidates) {
|
|
2588
|
+
const manifestPath = path4.join(absDir, name);
|
|
2589
|
+
try {
|
|
2590
|
+
const raw = await fs4.readFile(manifestPath, "utf8");
|
|
2591
|
+
const parsed = JSON.parse(raw);
|
|
2592
|
+
if (parsed?.schemaVersion !== SCHEMA_VERSION || parsed.kind !== "siluzan-cli-json-snapshot" || !Array.isArray(parsed.artifacts)) {
|
|
2593
|
+
continue;
|
|
2594
|
+
}
|
|
2595
|
+
return parsed;
|
|
2596
|
+
} catch {
|
|
2597
|
+
continue;
|
|
2598
|
+
}
|
|
2599
|
+
}
|
|
2600
|
+
return null;
|
|
2601
|
+
}
|
|
2602
|
+
function mergeCliSnapshotManifest(existing, params) {
|
|
2603
|
+
const prevArts = existing?.artifacts ?? [];
|
|
2604
|
+
const key = slugifyCliSnapshotSectionKey(params.newArtifact.section);
|
|
2605
|
+
const without = prevArts.filter((a) => slugifyCliSnapshotSectionKey(a.section) !== key);
|
|
2606
|
+
const artifacts = [...without, params.newArtifact];
|
|
2607
|
+
const fieldGuide = existing?.fieldGuide ?? { markdownRefs: [..._fieldGuideRefs] };
|
|
2608
|
+
return {
|
|
2609
|
+
schemaVersion: SCHEMA_VERSION,
|
|
2610
|
+
kind: "siluzan-cli-json-snapshot",
|
|
2611
|
+
cliPackage: params.cliPackage ?? existing?.cliPackage ?? configuredCliPackage(),
|
|
2612
|
+
cliVersion: params.cliVersion,
|
|
2613
|
+
fieldGuide: { markdownRefs: [...fieldGuide.markdownRefs] },
|
|
2614
|
+
artifacts
|
|
2615
|
+
};
|
|
2616
|
+
}
|
|
2617
|
+
function rejectDeprecatedJsonFlag(json, commandLabel) {
|
|
2618
|
+
if (json) {
|
|
2619
|
+
console.error(
|
|
2620
|
+
`
|
|
2621
|
+
\u274C ${commandLabel}\uFF1A--json \u5DF2\u79FB\u9664\u3002\u8BF7\u4F7F\u7528 --json-out <\u76EE\u5F55\u6216 *.json \u6587\u4EF6> \u843D\u76D8\u7ED3\u6784\u5316\u6570\u636E\uFF08stdout \u4EC5\u4E00\u884C\u6458\u8981\uFF09\u3002
|
|
2622
|
+
`
|
|
2623
|
+
);
|
|
2624
|
+
process.exit(1);
|
|
2625
|
+
}
|
|
2626
|
+
}
|
|
2627
|
+
var TS_LIKE_ARRAY_SAMPLE_MAX = 8;
|
|
2628
|
+
function tsLikeQuoteKey(key) {
|
|
2629
|
+
if (/^[A-Za-z_$][\w$]*$/.test(key)) return key;
|
|
2630
|
+
return JSON.stringify(key);
|
|
2631
|
+
}
|
|
2632
|
+
function describePayloadTsLike(value) {
|
|
2633
|
+
const visiting = /* @__PURE__ */ new WeakSet();
|
|
2634
|
+
const memoDone = /* @__PURE__ */ new WeakSet();
|
|
2635
|
+
function tsScalar(v) {
|
|
2636
|
+
if (v === null) return "null";
|
|
2637
|
+
if (v === void 0) return "undefined";
|
|
2638
|
+
if (typeof v === "boolean") return "boolean";
|
|
2639
|
+
if (typeof v === "number") return "number";
|
|
2640
|
+
if (typeof v === "string") return "string";
|
|
2641
|
+
if (typeof v === "bigint") return "bigint";
|
|
2642
|
+
if (typeof v !== "object") return "unknown";
|
|
2643
|
+
return "";
|
|
2644
|
+
}
|
|
2645
|
+
function ts(v) {
|
|
2646
|
+
const prim = tsScalar(v);
|
|
2647
|
+
if (prim) return prim;
|
|
2648
|
+
if (Array.isArray(v)) {
|
|
2649
|
+
if (v.length === 0) return "unknown[]";
|
|
2650
|
+
const parts = [];
|
|
2651
|
+
const seen = /* @__PURE__ */ new Set();
|
|
2652
|
+
const n = Math.min(v.length, TS_LIKE_ARRAY_SAMPLE_MAX);
|
|
2653
|
+
for (let i = 0; i < n; i++) {
|
|
2654
|
+
const t = ts(v[i]);
|
|
2655
|
+
if (seen.has(t)) continue;
|
|
2656
|
+
seen.add(t);
|
|
2657
|
+
parts.push(t);
|
|
2658
|
+
}
|
|
2659
|
+
const inner = parts.length === 1 ? parts[0] : `(${parts.join(" | ")})`;
|
|
2660
|
+
return `${inner}[]`;
|
|
2661
|
+
}
|
|
2662
|
+
const o = v;
|
|
2663
|
+
if (visiting.has(o)) return "any";
|
|
2664
|
+
if (memoDone.has(o)) return "any";
|
|
2665
|
+
visiting.add(o);
|
|
2666
|
+
const props = [];
|
|
2667
|
+
for (const k of Object.keys(o)) {
|
|
2668
|
+
const child = o[k];
|
|
2669
|
+
if (child === void 0) {
|
|
2670
|
+
props.push(`${tsLikeQuoteKey(k)}: undefined`);
|
|
2671
|
+
continue;
|
|
2672
|
+
}
|
|
2673
|
+
props.push(`${tsLikeQuoteKey(k)}: ${ts(child)}`);
|
|
2674
|
+
}
|
|
2675
|
+
visiting.delete(o);
|
|
2676
|
+
memoDone.add(o);
|
|
2677
|
+
return `{ ${props.join("; ")} }`;
|
|
2678
|
+
}
|
|
2679
|
+
return ts(value);
|
|
2680
|
+
}
|
|
2681
|
+
function isJsonFilePath(p) {
|
|
2682
|
+
return p.trim().toLowerCase().endsWith(".json");
|
|
2683
|
+
}
|
|
2684
|
+
function snapshotOutlineFileName(jsonBasename) {
|
|
2685
|
+
const lower = jsonBasename.trim().toLowerCase();
|
|
2686
|
+
if (!lower.endsWith(".json")) {
|
|
2687
|
+
throw new Error(`\u5FEB\u7167 JSON \u6587\u4EF6\u540D\u987B\u4EE5 .json \u7ED3\u5C3E\uFF1A${jsonBasename}`);
|
|
2688
|
+
}
|
|
2689
|
+
return `${jsonBasename.slice(0, -".json".length)}.outline.txt`;
|
|
2690
|
+
}
|
|
2691
|
+
function formatOutlineFileBody(jsonBasename, payload, extraHeaderCommentLines) {
|
|
2692
|
+
const typeText = describePayloadTsLike(payload);
|
|
2693
|
+
const lines = [
|
|
2694
|
+
`// outline of \`${jsonBasename}\` \u2014 schema-only, NOT the data.`,
|
|
2695
|
+
`// \u7528\u6CD5\uFF1A\u5904\u7406\u540C\u76EE\u5F55 \`${jsonBasename}\` \u7684\u6570\u636E\u524D\uFF0C\u5148\u8BFB\u672C\u6587\u4EF6\u4E86\u89E3\u5B57\u6BB5\u7C7B\u578B\uFF0C\u518D\u7528\u811A\u672C\uFF08fs.readFileSync / require\uFF09\u8BFB\u53D6\u8BE5 JSON \u505A\u7B5B\u9009\u4E0E\u805A\u5408\u3002`,
|
|
2696
|
+
`// \u7C7B\u578B\u7531 JSON \u63A8\u65AD\uFF1A\u6570\u7EC4\u53D6\u524D 8 \u9879\u53BB\u91CD\u5E76\u96C6\uFF1B\u73AF\u6216\u91CD\u590D\u5BF9\u8C61\u5F15\u7528\u8BB0\u4E3A any\u3002`,
|
|
2697
|
+
...extraHeaderCommentLines ?? [],
|
|
2698
|
+
typeText
|
|
2699
|
+
];
|
|
2700
|
+
return lines.join("\n");
|
|
2701
|
+
}
|
|
2702
|
+
async function writeCliJsonSnapshot(params) {
|
|
2703
|
+
const trimmed = params.snapshotDir.trim();
|
|
2704
|
+
const idSlug = slugifyIdSuffix(params.idSuffix);
|
|
2705
|
+
const manifestFile = cliManifestFileName(idSlug || void 0);
|
|
2706
|
+
let absDir;
|
|
2707
|
+
let fileName;
|
|
2708
|
+
let section;
|
|
2709
|
+
if (isJsonFilePath(trimmed)) {
|
|
2710
|
+
const absFile = path4.resolve(trimmed);
|
|
2711
|
+
absDir = path4.dirname(absFile);
|
|
2712
|
+
if (absDir.includes("\0") || absFile.includes("\0")) {
|
|
2713
|
+
throw new Error("\u5FEB\u7167\u8DEF\u5F84\u975E\u6CD5");
|
|
2714
|
+
}
|
|
2715
|
+
await fs4.mkdir(absDir, { recursive: true });
|
|
2716
|
+
fileName = path4.basename(absFile);
|
|
2717
|
+
if (!fileName.toLowerCase().endsWith(".json")) {
|
|
2718
|
+
throw new Error(`--json-out \u6587\u4EF6\u8DEF\u5F84\u987B\u4EE5 .json \u7ED3\u5C3E\uFF1A${trimmed}`);
|
|
2719
|
+
}
|
|
2720
|
+
if (fileName.toLowerCase() === manifestFile.toLowerCase()) {
|
|
2721
|
+
throw new Error(`\u8F93\u51FA\u6587\u4EF6\u4E0D\u80FD\u547D\u540D\u4E3A ${manifestFile}\uFF0C\u4E0E\u6E05\u5355\u6587\u4EF6\u51B2\u7A81`);
|
|
2722
|
+
}
|
|
2723
|
+
const base = fileName.slice(0, -".json".length);
|
|
2724
|
+
section = normalizeCliSnapshotSection(base || params.section);
|
|
2725
|
+
} else {
|
|
2726
|
+
absDir = await ensureSnapshotDir(trimmed);
|
|
2727
|
+
section = normalizeCliSnapshotSection(params.section);
|
|
2728
|
+
const stem = applyIdSuffix(section, idSlug || void 0);
|
|
2729
|
+
fileName = `${stem}.json`;
|
|
2730
|
+
}
|
|
2731
|
+
const writtenAt = (/* @__PURE__ */ new Date()).toISOString();
|
|
2732
|
+
const absFilePath = path4.join(absDir, fileName);
|
|
2733
|
+
await fs4.writeFile(absFilePath, `${JSON.stringify(params.payload, null, 2)}
|
|
2734
|
+
`, "utf8");
|
|
2735
|
+
const outlineFileName = snapshotOutlineFileName(fileName);
|
|
2736
|
+
if (outlineFileName.toLowerCase() === manifestFile.toLowerCase()) {
|
|
2737
|
+
throw new Error(`\u975E\u6CD5\u8F93\u51FA\uFF1A${outlineFileName} \u4E0E\u6E05\u5355\u6587\u4EF6\u540D\u51B2\u7A81`);
|
|
2738
|
+
}
|
|
2739
|
+
const outlineBody = formatOutlineFileBody(fileName, params.payload);
|
|
2740
|
+
await fs4.writeFile(path4.join(absDir, outlineFileName), `${outlineBody}
|
|
2741
|
+
`, "utf8");
|
|
2742
|
+
const existing = await readCliManifestIfExists(absDir, idSlug || void 0);
|
|
2743
|
+
const newArtifact = {
|
|
2744
|
+
section,
|
|
2745
|
+
file: fileName,
|
|
2746
|
+
writtenAt,
|
|
2747
|
+
...params.commandHint ? { commandHint: params.commandHint } : {}
|
|
2748
|
+
};
|
|
2749
|
+
const merged = mergeCliSnapshotManifest(existing, {
|
|
2750
|
+
cliVersion: params.cliVersion ?? configuredCliVersion(),
|
|
2751
|
+
newArtifact
|
|
2752
|
+
});
|
|
2753
|
+
await fs4.writeFile(
|
|
2754
|
+
path4.join(absDir, manifestFile),
|
|
2755
|
+
`${JSON.stringify(merged, null, 2)}
|
|
2756
|
+
`,
|
|
2757
|
+
"utf8"
|
|
2758
|
+
);
|
|
2759
|
+
return {
|
|
2760
|
+
kind: "siluzan-tso-cli-json-snapshot",
|
|
2761
|
+
schemaVersion: SCHEMA_VERSION,
|
|
2762
|
+
absoluteSnapshotDir: absDir,
|
|
2763
|
+
manifestFile,
|
|
2764
|
+
writtenFiles: [fileName, outlineFileName],
|
|
2765
|
+
section,
|
|
2766
|
+
outlineFile: outlineFileName,
|
|
2767
|
+
agentHint: OUTLINE_AGENT_HINT
|
|
2768
|
+
};
|
|
2769
|
+
}
|
|
2770
|
+
async function emitCliJsonOrSnapshot(opts, params) {
|
|
2771
|
+
if (opts.jsonOut) {
|
|
2772
|
+
const summary = await writeCliJsonSnapshot({
|
|
2773
|
+
snapshotDir: opts.jsonOut,
|
|
2774
|
+
section: params.section,
|
|
2775
|
+
payload: params.payload,
|
|
2776
|
+
commandHint: params.commandHint,
|
|
2777
|
+
idSuffix: params.idSuffix
|
|
2778
|
+
});
|
|
2779
|
+
console.log(JSON.stringify(summary));
|
|
2780
|
+
return true;
|
|
2781
|
+
}
|
|
2782
|
+
return false;
|
|
2783
|
+
}
|
|
2518
2784
|
function installProcessHandlers() {
|
|
2519
2785
|
process.on("uncaughtException", (err) => {
|
|
2520
2786
|
console.error(`
|
|
@@ -2883,33 +3149,33 @@ import { Command } from "commander";
|
|
|
2883
3149
|
import { Option } from "commander";
|
|
2884
3150
|
|
|
2885
3151
|
// src/config/defaults.ts
|
|
2886
|
-
var BUILD_ENV = "
|
|
2887
|
-
var DEFAULT_API_BASE = "https://api
|
|
2888
|
-
var DEFAULT_CSO_BASE = "https://cso
|
|
2889
|
-
var DEFAULT_WEB_BASE = "https://www
|
|
2890
|
-
var DEFAULT_AGENT_BASE = "https://agent
|
|
3152
|
+
var BUILD_ENV = "production";
|
|
3153
|
+
var DEFAULT_API_BASE = "https://api.siluzan.com";
|
|
3154
|
+
var DEFAULT_CSO_BASE = "https://cso.siluzan.com";
|
|
3155
|
+
var DEFAULT_WEB_BASE = "https://www.siluzan.com";
|
|
3156
|
+
var DEFAULT_AGENT_BASE = "https://agent.mysiluzan.com";
|
|
2891
3157
|
|
|
2892
3158
|
// src/commands/init.ts
|
|
2893
|
-
import * as
|
|
3159
|
+
import * as fs6 from "fs/promises";
|
|
2894
3160
|
import * as fsSync from "fs";
|
|
2895
3161
|
import * as os2 from "os";
|
|
2896
|
-
import * as
|
|
3162
|
+
import * as path6 from "path";
|
|
2897
3163
|
import { fileURLToPath as fileURLToPath2 } from "url";
|
|
2898
3164
|
|
|
2899
3165
|
// src/templates/load-templates.ts
|
|
2900
|
-
import * as
|
|
2901
|
-
import * as
|
|
3166
|
+
import * as fs5 from "fs/promises";
|
|
3167
|
+
import * as path5 from "path";
|
|
2902
3168
|
async function getSkillFiles(skillDir, apiBaseUrl) {
|
|
2903
3169
|
const out = {};
|
|
2904
3170
|
async function walk(dir, prefix) {
|
|
2905
|
-
const entries = await
|
|
3171
|
+
const entries = await fs5.readdir(dir, { withFileTypes: true });
|
|
2906
3172
|
for (const ent of entries) {
|
|
2907
3173
|
const rel = prefix ? `${prefix}/${ent.name}` : ent.name;
|
|
2908
|
-
const full =
|
|
3174
|
+
const full = path5.join(dir, ent.name);
|
|
2909
3175
|
if (ent.isDirectory()) {
|
|
2910
3176
|
await walk(full, rel);
|
|
2911
3177
|
} else {
|
|
2912
|
-
let text = await
|
|
3178
|
+
let text = await fs5.readFile(full, "utf8");
|
|
2913
3179
|
text = text.replace(/\{\{SILUZAN_API_BASE_URL\}\}/g, apiBaseUrl);
|
|
2914
3180
|
out[rel] = text;
|
|
2915
3181
|
}
|
|
@@ -2920,31 +3186,31 @@ async function getSkillFiles(skillDir, apiBaseUrl) {
|
|
|
2920
3186
|
}
|
|
2921
3187
|
|
|
2922
3188
|
// src/commands/init.ts
|
|
2923
|
-
var __dirname =
|
|
3189
|
+
var __dirname = path6.dirname(fileURLToPath2(import.meta.url));
|
|
2924
3190
|
var SKILL_DIR_NAME = "siluzan-platform";
|
|
2925
3191
|
var PROJECT_DIRS = {
|
|
2926
|
-
agents: (cwd) =>
|
|
2927
|
-
cursor: (cwd) =>
|
|
2928
|
-
claude: (cwd) =>
|
|
2929
|
-
windsurf: (cwd) =>
|
|
2930
|
-
gemini: (cwd) =>
|
|
2931
|
-
codex: (cwd) =>
|
|
2932
|
-
opencode: (cwd) =>
|
|
2933
|
-
kilo: (cwd) =>
|
|
2934
|
-
openclaw: (cwd) =>
|
|
2935
|
-
workbuddy: (cwd) =>
|
|
3192
|
+
agents: (cwd) => path6.join(cwd, ".agents", "skills", SKILL_DIR_NAME),
|
|
3193
|
+
cursor: (cwd) => path6.join(cwd, ".cursor", "skills", SKILL_DIR_NAME),
|
|
3194
|
+
claude: (cwd) => path6.join(cwd, ".claude", "skills", SKILL_DIR_NAME),
|
|
3195
|
+
windsurf: (cwd) => path6.join(cwd, ".windsurf", "skills", SKILL_DIR_NAME),
|
|
3196
|
+
gemini: (cwd) => path6.join(cwd, ".gemini", "skills", SKILL_DIR_NAME),
|
|
3197
|
+
codex: (cwd) => path6.join(cwd, ".codex", "skills", SKILL_DIR_NAME),
|
|
3198
|
+
opencode: (cwd) => path6.join(cwd, ".opencode", "skills", SKILL_DIR_NAME),
|
|
3199
|
+
kilo: (cwd) => path6.join(cwd, ".kilo", "skills", SKILL_DIR_NAME),
|
|
3200
|
+
openclaw: (cwd) => path6.join(cwd, "skills", SKILL_DIR_NAME),
|
|
3201
|
+
workbuddy: (cwd) => path6.join(cwd, ".workbuddy", "skills", SKILL_DIR_NAME)
|
|
2936
3202
|
};
|
|
2937
3203
|
var GLOBAL_DIRS = {
|
|
2938
|
-
agents: (home) =>
|
|
2939
|
-
cursor: (home) =>
|
|
2940
|
-
claude: (home) =>
|
|
2941
|
-
windsurf: (home) =>
|
|
2942
|
-
gemini: (home) =>
|
|
2943
|
-
codex: (home) =>
|
|
2944
|
-
opencode: (home) =>
|
|
2945
|
-
kilo: (home) =>
|
|
2946
|
-
openclaw: (home) =>
|
|
2947
|
-
workbuddy: (home) =>
|
|
3204
|
+
agents: (home) => path6.join(home, ".agents", "skills", SKILL_DIR_NAME),
|
|
3205
|
+
cursor: (home) => path6.join(home, ".cursor", "skills", SKILL_DIR_NAME),
|
|
3206
|
+
claude: (home) => path6.join(home, ".claude", "skills", SKILL_DIR_NAME),
|
|
3207
|
+
windsurf: (home) => path6.join(home, ".codeium", "windsurf", "skills", SKILL_DIR_NAME),
|
|
3208
|
+
gemini: (home) => path6.join(home, ".gemini", "skills", SKILL_DIR_NAME),
|
|
3209
|
+
codex: (home) => path6.join(home, ".codex", "skills", SKILL_DIR_NAME),
|
|
3210
|
+
opencode: (home) => path6.join(home, ".config", "opencode", "skills", SKILL_DIR_NAME),
|
|
3211
|
+
kilo: (home) => path6.join(home, ".kilo", "skills", SKILL_DIR_NAME),
|
|
3212
|
+
openclaw: (home) => path6.join(home, ".openclaw", "skills", SKILL_DIR_NAME),
|
|
3213
|
+
workbuddy: (home) => path6.join(home, ".workbuddy", "skills", SKILL_DIR_NAME)
|
|
2948
3214
|
};
|
|
2949
3215
|
var ALL_PLATFORM_KEYS = Object.keys(PROJECT_DIRS);
|
|
2950
3216
|
function parseTargets(raw) {
|
|
@@ -2993,12 +3259,12 @@ function parseTargets(raw) {
|
|
|
2993
3259
|
return results;
|
|
2994
3260
|
}
|
|
2995
3261
|
function skillRoot() {
|
|
2996
|
-
return
|
|
3262
|
+
return path6.join(__dirname, "skill");
|
|
2997
3263
|
}
|
|
2998
3264
|
function saveInstalledTargets(newEntries) {
|
|
2999
|
-
const CONFIG_FILE3 =
|
|
3265
|
+
const CONFIG_FILE3 = path6.join(os2.homedir(), ".siluzan", "config.json");
|
|
3000
3266
|
try {
|
|
3001
|
-
fsSync.mkdirSync(
|
|
3267
|
+
fsSync.mkdirSync(path6.dirname(CONFIG_FILE3), { recursive: true });
|
|
3002
3268
|
let existing = {};
|
|
3003
3269
|
if (fsSync.existsSync(CONFIG_FILE3)) {
|
|
3004
3270
|
existing = JSON.parse(fsSync.readFileSync(CONFIG_FILE3, "utf8"));
|
|
@@ -3020,20 +3286,20 @@ function saveInstalledTargets(newEntries) {
|
|
|
3020
3286
|
}
|
|
3021
3287
|
}
|
|
3022
3288
|
async function writeSkillFilesToDir(destDir, skillFiles, force) {
|
|
3023
|
-
await
|
|
3289
|
+
await fs6.mkdir(destDir, { recursive: true });
|
|
3024
3290
|
let anyWritten = false;
|
|
3025
3291
|
for (const [relativePath, content] of Object.entries(skillFiles)) {
|
|
3026
|
-
const fullPath =
|
|
3027
|
-
await
|
|
3292
|
+
const fullPath = path6.join(destDir, relativePath);
|
|
3293
|
+
await fs6.mkdir(path6.dirname(fullPath), { recursive: true });
|
|
3028
3294
|
try {
|
|
3029
|
-
await
|
|
3295
|
+
await fs6.access(fullPath);
|
|
3030
3296
|
if (!force) {
|
|
3031
3297
|
console.warn(`\u8DF3\u8FC7\uFF08\u5DF2\u5B58\u5728\uFF0C\u4F7F\u7528 --force \u8986\u76D6\uFF09: ${fullPath}`);
|
|
3032
3298
|
continue;
|
|
3033
3299
|
}
|
|
3034
3300
|
} catch {
|
|
3035
3301
|
}
|
|
3036
|
-
await
|
|
3302
|
+
await fs6.writeFile(fullPath, content, "utf8");
|
|
3037
3303
|
console.log(`\u5DF2\u5199\u5165: ${fullPath}`);
|
|
3038
3304
|
anyWritten = true;
|
|
3039
3305
|
}
|
|
@@ -3044,7 +3310,7 @@ async function runInit(options) {
|
|
|
3044
3310
|
const skillFiles = await getSkillFiles(skillRoot(), options.apiBaseUrl);
|
|
3045
3311
|
const installedEntries = [];
|
|
3046
3312
|
if (options.dir) {
|
|
3047
|
-
const destDir =
|
|
3313
|
+
const destDir = path6.resolve(options.cwd, options.dir);
|
|
3048
3314
|
console.log(`\u5B89\u88C5\u76EE\u6807\u76EE\u5F55\uFF1A${destDir}`);
|
|
3049
3315
|
const anyWritten = await writeSkillFilesToDir(destDir, skillFiles, options.force);
|
|
3050
3316
|
if (anyWritten) {
|
|
@@ -3319,8 +3585,8 @@ async function runLogin(opts = {}) {
|
|
|
3319
3585
|
}
|
|
3320
3586
|
|
|
3321
3587
|
// src/commands/update.ts
|
|
3322
|
-
import * as
|
|
3323
|
-
import * as
|
|
3588
|
+
import * as fs7 from "fs";
|
|
3589
|
+
import * as path7 from "path";
|
|
3324
3590
|
import * as os4 from "os";
|
|
3325
3591
|
import { spawnSync } from "child_process";
|
|
3326
3592
|
|
|
@@ -3346,10 +3612,10 @@ var notifyIfOutdated = notifier.notifyIfOutdated;
|
|
|
3346
3612
|
var fetchLatestVersion = notifier.fetchLatestVersion;
|
|
3347
3613
|
|
|
3348
3614
|
// src/commands/update.ts
|
|
3349
|
-
var CONFIG_FILE2 =
|
|
3615
|
+
var CONFIG_FILE2 = path7.join(os4.homedir(), ".siluzan", "config.json");
|
|
3350
3616
|
function readInstalledTargets() {
|
|
3351
3617
|
try {
|
|
3352
|
-
const cfg = JSON.parse(
|
|
3618
|
+
const cfg = JSON.parse(fs7.readFileSync(CONFIG_FILE2, "utf8"));
|
|
3353
3619
|
return Array.isArray(cfg.installedTargets) ? cfg.installedTargets : [];
|
|
3354
3620
|
} catch {
|
|
3355
3621
|
return [];
|
|
@@ -3605,7 +3871,7 @@ async function runListAccounts(options) {
|
|
|
3605
3871
|
const list = res.data.list ?? [];
|
|
3606
3872
|
const total = res.data.total ?? 0;
|
|
3607
3873
|
const totalPages = computeTotalPages(total, pageSize);
|
|
3608
|
-
if (options.
|
|
3874
|
+
if (options.jsonOut) {
|
|
3609
3875
|
const outputAccounts = list.map((a) => ({
|
|
3610
3876
|
entityId: a.entityId,
|
|
3611
3877
|
mediaAccountType: a.mediaAccountType,
|
|
@@ -3622,18 +3888,15 @@ async function runListAccounts(options) {
|
|
|
3622
3888
|
overview: a.mediaAccountOverviewDataDto ?? null,
|
|
3623
3889
|
externalMediaAccountTokenId: a.externalMediaAccountTokenId
|
|
3624
3890
|
}));
|
|
3625
|
-
|
|
3626
|
-
|
|
3627
|
-
|
|
3628
|
-
|
|
3629
|
-
|
|
3630
|
-
|
|
3631
|
-
|
|
3632
|
-
|
|
3633
|
-
|
|
3634
|
-
null,
|
|
3635
|
-
2
|
|
3636
|
-
)
|
|
3891
|
+
await emitCliJsonOrSnapshot(
|
|
3892
|
+
{ jsonOut: options.jsonOut },
|
|
3893
|
+
{
|
|
3894
|
+
section: "list-accounts",
|
|
3895
|
+
commandLabel: "list-accounts",
|
|
3896
|
+
payload: { page: pageNo, pageSize, total, totalPages, accounts: outputAccounts },
|
|
3897
|
+
commandHint: options.mediaType ? normalizeMediaType(options.mediaType) : void 0,
|
|
3898
|
+
idSuffix: options.mediaType ? normalizeMediaType(options.mediaType) : void 0
|
|
3899
|
+
}
|
|
3637
3900
|
);
|
|
3638
3901
|
return;
|
|
3639
3902
|
}
|
|
@@ -3687,7 +3950,9 @@ async function runListAccounts(options) {
|
|
|
3687
3950
|
console.log(`
|
|
3688
3951
|
\u63D0\u793A\uFF1A\u8FD8\u6709\u66F4\u591A\u8D26\u53F7\uFF0C\u4F7F\u7528 --page ${pageNo + 1} \u53EF\u67E5\u770B\u4E0B\u4E00\u9875\u3002`);
|
|
3689
3952
|
}
|
|
3690
|
-
console.log(
|
|
3953
|
+
console.log(
|
|
3954
|
+
"\u63D0\u793A\uFF1A\u4F7F\u7528 --json-out <\u76EE\u5F55\u6216 *.json> \u53EF\u5C06\u5B8C\u6574 JSON \u6570\u636E\u843D\u76D8\uFF08\u542B mediaCustomerId \u7B49\u5B57\u6BB5\uFF09\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\u3002"
|
|
3955
|
+
);
|
|
3691
3956
|
console.log(
|
|
3692
3957
|
`\u63D0\u793A\uFF1A\u8D26\u53F7\u8BE6\u7EC6\u6570\u636E\u8BF7\u767B\u5F55\u540E\u53F0\u67E5\u770B \u{1F449} ${DEFAULT_WEB_BASE}/v3/foreign_trade/cso/ManageAccounts`
|
|
3693
3958
|
);
|
|
@@ -3722,25 +3987,20 @@ async function runListMembers(options) {
|
|
|
3722
3987
|
})() : allMembers;
|
|
3723
3988
|
const total = res.data.totalResultCount ?? allMembers.length;
|
|
3724
3989
|
const pageSizeForSummary = members.length > 0 ? members.length : 1;
|
|
3725
|
-
if (options.
|
|
3990
|
+
if (options.jsonOut) {
|
|
3726
3991
|
const output = members.map((m) => ({
|
|
3727
3992
|
entityId: m.entityId,
|
|
3728
3993
|
realName: m.realName || m.fullname,
|
|
3729
3994
|
phone: m.phone,
|
|
3730
3995
|
status: m.status
|
|
3731
3996
|
}));
|
|
3732
|
-
|
|
3733
|
-
|
|
3734
|
-
|
|
3735
|
-
|
|
3736
|
-
|
|
3737
|
-
|
|
3738
|
-
|
|
3739
|
-
members: output
|
|
3740
|
-
},
|
|
3741
|
-
null,
|
|
3742
|
-
2
|
|
3743
|
-
)
|
|
3997
|
+
await emitCliJsonOrSnapshot(
|
|
3998
|
+
{ jsonOut: options.jsonOut },
|
|
3999
|
+
{
|
|
4000
|
+
section: "list-members",
|
|
4001
|
+
commandLabel: "list-members",
|
|
4002
|
+
payload: { page: 1, pageSize: pageSizeForSummary, total, totalPages: 1, members: output }
|
|
4003
|
+
}
|
|
3744
4004
|
);
|
|
3745
4005
|
return;
|
|
3746
4006
|
}
|
|
@@ -3793,7 +4053,7 @@ var register = defineCommand({
|
|
|
3793
4053
|
await runListMembers({
|
|
3794
4054
|
token: opts.token,
|
|
3795
4055
|
query: opts.query,
|
|
3796
|
-
|
|
4056
|
+
jsonOut: opts.jsonOut,
|
|
3797
4057
|
unicode: opts.unicode,
|
|
3798
4058
|
verbose: opts.verbose
|
|
3799
4059
|
});
|
|
@@ -3831,19 +4091,14 @@ async function runAccountGroupList(options) {
|
|
|
3831
4091
|
total,
|
|
3832
4092
|
totalPagesOverride: 1
|
|
3833
4093
|
});
|
|
3834
|
-
if (options.
|
|
3835
|
-
|
|
3836
|
-
|
|
3837
|
-
|
|
3838
|
-
|
|
3839
|
-
|
|
3840
|
-
|
|
3841
|
-
|
|
3842
|
-
groups
|
|
3843
|
-
},
|
|
3844
|
-
null,
|
|
3845
|
-
2
|
|
3846
|
-
)
|
|
4094
|
+
if (options.jsonOut) {
|
|
4095
|
+
await emitCliJsonOrSnapshot(
|
|
4096
|
+
{ jsonOut: options.jsonOut },
|
|
4097
|
+
{
|
|
4098
|
+
section: "account-group-list",
|
|
4099
|
+
commandLabel: "account-group list",
|
|
4100
|
+
payload: { page: 1, pageSize: pageSizeForSummary, total, totalPages: 1, groups }
|
|
4101
|
+
}
|
|
3847
4102
|
);
|
|
3848
4103
|
return;
|
|
3849
4104
|
}
|
|
@@ -3872,7 +4127,9 @@ async function runAccountGroupList(options) {
|
|
|
3872
4127
|
const tableOpts2 = options.unicode ? { plain: false } : void 0;
|
|
3873
4128
|
printCliTable(rows, columns, tableOpts2);
|
|
3874
4129
|
console.log('\n\u63D0\u793A\uFF1Aid === "\u672A\u5206\u7EC4" \u7684\u4E3A\u7CFB\u7EDF\u865A\u62DF\u5206\u7EC4\uFF0C\u4E0D\u53EF\u7F16\u8F91/\u5220\u9664\u3002');
|
|
3875
|
-
console.log(
|
|
4130
|
+
console.log(
|
|
4131
|
+
"\u63D0\u793A\uFF1A\u4F7F\u7528 --json-out <\u76EE\u5F55\u6216 *.json> \u53EF\u5C06\u542B mediaAccountInfos \u7684\u5B8C\u6574\u6570\u636E\u843D\u76D8\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\u3002"
|
|
4132
|
+
);
|
|
3876
4133
|
}
|
|
3877
4134
|
async function runAccountGroupCreate(options) {
|
|
3878
4135
|
const config = loadConfig(options.token);
|
|
@@ -3910,10 +4167,6 @@ async function runAccountGroupCreate(options) {
|
|
|
3910
4167
|
process.exit(1);
|
|
3911
4168
|
}
|
|
3912
4169
|
const newGroupId = res;
|
|
3913
|
-
if (options.json) {
|
|
3914
|
-
console.log(JSON.stringify({ success: true, id: newGroupId, name: options.name, accountIds }));
|
|
3915
|
-
return;
|
|
3916
|
-
}
|
|
3917
4170
|
console.log(`
|
|
3918
4171
|
\u2705 \u5206\u7EC4\u300C${options.name}\u300D\u521B\u5EFA\u6210\u529F`);
|
|
3919
4172
|
console.log(` \u5206\u7EC4 ID\uFF1A${newGroupId}`);
|
|
@@ -3961,10 +4214,6 @@ async function runAccountGroupUpdate(options) {
|
|
|
3961
4214
|
\u274C \u66F4\u65B0\u5206\u7EC4\u5931\u8D25\uFF1A${errMsg}`);
|
|
3962
4215
|
process.exit(1);
|
|
3963
4216
|
}
|
|
3964
|
-
if (options.json) {
|
|
3965
|
-
console.log(JSON.stringify({ success: true, id: options.id, name: options.name, accountIds }));
|
|
3966
|
-
return;
|
|
3967
|
-
}
|
|
3968
4217
|
console.log(`
|
|
3969
4218
|
\u2705 \u5206\u7EC4\u300C${options.name}\u300D\uFF08ID: ${options.id}\uFF09\u66F4\u65B0\u6210\u529F`);
|
|
3970
4219
|
console.log(` \u8D26\u53F7\u6570\u91CF\uFF1A${accountIds.length} \u4E2A`);
|
|
@@ -3988,10 +4237,6 @@ async function runAccountGroupDelete(options) {
|
|
|
3988
4237
|
\u274C \u5220\u9664\u5206\u7EC4\u5931\u8D25\uFF1A${res.message ?? "\u670D\u52A1\u7AEF\u8FD4\u56DE\u5F02\u5E38"}`);
|
|
3989
4238
|
process.exit(1);
|
|
3990
4239
|
}
|
|
3991
|
-
if (options.json) {
|
|
3992
|
-
console.log(JSON.stringify({ success: true, id: options.id }));
|
|
3993
|
-
return;
|
|
3994
|
-
}
|
|
3995
4240
|
console.log(`
|
|
3996
4241
|
\u2705 \u5206\u7EC4\uFF08ID: ${options.id}\uFF09\u5DF2\u5220\u9664\u3002`);
|
|
3997
4242
|
console.log("\n\u4F7F\u7528 siluzan-cso account-group list \u67E5\u770B\u6240\u6709\u5206\u7EC4\u3002");
|
|
@@ -4055,19 +4300,6 @@ async function runAccountGroupAddAccounts(options) {
|
|
|
4055
4300
|
);
|
|
4056
4301
|
process.exit(1);
|
|
4057
4302
|
}
|
|
4058
|
-
if (options.json) {
|
|
4059
|
-
console.log(
|
|
4060
|
-
JSON.stringify({
|
|
4061
|
-
success: true,
|
|
4062
|
-
id: options.id,
|
|
4063
|
-
name,
|
|
4064
|
-
added: addedCount,
|
|
4065
|
-
total: merged.length,
|
|
4066
|
-
accountIds: merged
|
|
4067
|
-
})
|
|
4068
|
-
);
|
|
4069
|
-
return;
|
|
4070
|
-
}
|
|
4071
4303
|
if (addedCount === 0) {
|
|
4072
4304
|
console.log(`
|
|
4073
4305
|
\u2139\uFE0F \u6240\u6709\u8D26\u53F7\u5DF2\u5728\u5206\u7EC4\u300C${name}\u300D\u4E2D\uFF0C\u65E0\u9700\u6DFB\u52A0\uFF08\u5171 ${merged.length} \u4E2A\uFF09\u3002`);
|
|
@@ -4121,19 +4353,6 @@ async function runAccountGroupRemoveAccounts(options) {
|
|
|
4121
4353
|
);
|
|
4122
4354
|
process.exit(1);
|
|
4123
4355
|
}
|
|
4124
|
-
if (options.json) {
|
|
4125
|
-
console.log(
|
|
4126
|
-
JSON.stringify({
|
|
4127
|
-
success: true,
|
|
4128
|
-
id: options.id,
|
|
4129
|
-
name,
|
|
4130
|
-
removed: removedCount,
|
|
4131
|
-
total: remaining.length,
|
|
4132
|
-
accountIds: remaining
|
|
4133
|
-
})
|
|
4134
|
-
);
|
|
4135
|
-
return;
|
|
4136
|
-
}
|
|
4137
4356
|
if (removedCount === 0) {
|
|
4138
4357
|
console.log(
|
|
4139
4358
|
`
|
|
@@ -4576,18 +4795,18 @@ ${SEP}`);
|
|
|
4576
4795
|
}
|
|
4577
4796
|
|
|
4578
4797
|
// src/commands/publish/commands.ts
|
|
4579
|
-
import * as
|
|
4580
|
-
import * as
|
|
4798
|
+
import * as fs8 from "fs";
|
|
4799
|
+
import * as path8 from "path";
|
|
4581
4800
|
async function runPublish(options) {
|
|
4582
|
-
const configPath =
|
|
4583
|
-
if (!
|
|
4801
|
+
const configPath = path8.resolve(options.config);
|
|
4802
|
+
if (!fs8.existsSync(configPath)) {
|
|
4584
4803
|
console.error(`
|
|
4585
4804
|
\u274C \u914D\u7F6E\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${configPath}`);
|
|
4586
4805
|
process.exit(1);
|
|
4587
4806
|
}
|
|
4588
4807
|
let input;
|
|
4589
4808
|
try {
|
|
4590
|
-
input = JSON.parse(
|
|
4809
|
+
input = JSON.parse(fs8.readFileSync(configPath, "utf8"));
|
|
4591
4810
|
} catch (e) {
|
|
4592
4811
|
console.error(`
|
|
4593
4812
|
\u274C \u914D\u7F6E\u6587\u4EF6\u89E3\u6790\u5931\u8D25\uFF1A${e.message}`);
|
|
@@ -4687,39 +4906,39 @@ async function runPublish(options) {
|
|
|
4687
4906
|
}
|
|
4688
4907
|
|
|
4689
4908
|
// src/commands/upload/_shared.ts
|
|
4690
|
-
import * as
|
|
4909
|
+
import * as fs9 from "fs";
|
|
4691
4910
|
import * as os5 from "os";
|
|
4692
|
-
import * as
|
|
4911
|
+
import * as path9 from "path";
|
|
4693
4912
|
import { imageSize } from "image-size";
|
|
4694
4913
|
import { ContainerClient } from "@azure/storage-blob";
|
|
4695
4914
|
var SENSITIVE_PATH_PREFIXES = [
|
|
4696
|
-
|
|
4915
|
+
path9.join(os5.homedir(), ".siluzan"),
|
|
4697
4916
|
// 本工具配置(含 authToken)
|
|
4698
|
-
|
|
4917
|
+
path9.join(os5.homedir(), ".ssh"),
|
|
4699
4918
|
// SSH 私钥
|
|
4700
|
-
|
|
4919
|
+
path9.join(os5.homedir(), ".aws"),
|
|
4701
4920
|
// AWS 凭证
|
|
4702
|
-
|
|
4921
|
+
path9.join(os5.homedir(), ".config"),
|
|
4703
4922
|
// 各类应用配置
|
|
4704
|
-
|
|
4923
|
+
path9.join(os5.homedir(), ".gnupg"),
|
|
4705
4924
|
// GPG 私钥
|
|
4706
|
-
|
|
4925
|
+
path9.join(os5.homedir(), ".npmrc"),
|
|
4707
4926
|
// npm Token
|
|
4708
|
-
|
|
4927
|
+
path9.join(os5.homedir(), ".docker"),
|
|
4709
4928
|
// Docker 凭证
|
|
4710
|
-
|
|
4929
|
+
path9.join(os5.homedir(), ".kube"),
|
|
4711
4930
|
// Kubernetes 配置
|
|
4712
|
-
|
|
4931
|
+
path9.join(os5.homedir(), ".pypirc"),
|
|
4713
4932
|
// PyPI Token
|
|
4714
|
-
|
|
4715
|
-
|
|
4933
|
+
path9.join(os5.homedir(), ".gitconfig"),
|
|
4934
|
+
path9.join(os5.homedir(), ".env")
|
|
4716
4935
|
// 常用本地环境变量文件
|
|
4717
4936
|
];
|
|
4718
4937
|
var SENSITIVE_ABSOLUTE_PATHS = ["/etc/passwd", "/etc/shadow", "/etc/hosts"];
|
|
4719
4938
|
function validateUploadPath(resolved) {
|
|
4720
4939
|
const normalized = resolved.toLowerCase();
|
|
4721
4940
|
for (const prefix of SENSITIVE_PATH_PREFIXES) {
|
|
4722
|
-
if (normalized === prefix.toLowerCase() || normalized.startsWith(prefix.toLowerCase() +
|
|
4941
|
+
if (normalized === prefix.toLowerCase() || normalized.startsWith(prefix.toLowerCase() + path9.sep)) {
|
|
4723
4942
|
return `\u7981\u6B62\u4E0A\u4F20\u654F\u611F\u76EE\u5F55\u4E0B\u7684\u6587\u4EF6\uFF1A${prefix}`;
|
|
4724
4943
|
}
|
|
4725
4944
|
}
|
|
@@ -4728,9 +4947,9 @@ function validateUploadPath(resolved) {
|
|
|
4728
4947
|
return `\u7981\u6B62\u4E0A\u4F20\u7CFB\u7EDF\u654F\u611F\u6587\u4EF6\uFF1A${abs}`;
|
|
4729
4948
|
}
|
|
4730
4949
|
}
|
|
4731
|
-
const base =
|
|
4950
|
+
const base = path9.basename(resolved).toLowerCase();
|
|
4732
4951
|
if (base === ".env" || base.startsWith(".env.")) {
|
|
4733
|
-
return `\u7981\u6B62\u4E0A\u4F20\u73AF\u5883\u53D8\u91CF\u6587\u4EF6\uFF08${
|
|
4952
|
+
return `\u7981\u6B62\u4E0A\u4F20\u73AF\u5883\u53D8\u91CF\u6587\u4EF6\uFF08${path9.basename(resolved)}\uFF09\uFF0C\u53EF\u80FD\u5305\u542B\u5BC6\u94A5`;
|
|
4734
4953
|
}
|
|
4735
4954
|
return null;
|
|
4736
4955
|
}
|
|
@@ -4755,7 +4974,7 @@ var VIDEO_EXTS = [
|
|
|
4755
4974
|
];
|
|
4756
4975
|
var IMAGE_EXTS = [".jpg", ".jpeg", ".png", ".gif", ".arw"];
|
|
4757
4976
|
function detectKind(filePath) {
|
|
4758
|
-
const ext =
|
|
4977
|
+
const ext = path9.extname(filePath).toLowerCase();
|
|
4759
4978
|
if (VIDEO_EXTS.includes(ext)) return "video";
|
|
4760
4979
|
if (IMAGE_EXTS.includes(ext)) return "image";
|
|
4761
4980
|
throw new Error(
|
|
@@ -4778,7 +4997,7 @@ function getMimeType(filePath) {
|
|
|
4778
4997
|
".png": "image/png",
|
|
4779
4998
|
".gif": "image/gif"
|
|
4780
4999
|
};
|
|
4781
|
-
return map[
|
|
5000
|
+
return map[path9.extname(filePath).toLowerCase()] ?? "application/octet-stream";
|
|
4782
5001
|
}
|
|
4783
5002
|
var guid2 = randomUUID;
|
|
4784
5003
|
async function generateSas(config, verbose = false) {
|
|
@@ -4790,11 +5009,11 @@ async function generateSas(config, verbose = false) {
|
|
|
4790
5009
|
return res.data;
|
|
4791
5010
|
}
|
|
4792
5011
|
async function uploadToAzure(filePath, sas, onProgress) {
|
|
4793
|
-
const ext =
|
|
5012
|
+
const ext = path9.extname(filePath);
|
|
4794
5013
|
const blobName = `${guid2()}${ext}`;
|
|
4795
5014
|
const containerClient = new ContainerClient(sas.sasUri);
|
|
4796
5015
|
const blockBlobClient = containerClient.getBlockBlobClient(blobName);
|
|
4797
|
-
const fileSize =
|
|
5016
|
+
const fileSize = fs9.statSync(filePath).size;
|
|
4798
5017
|
await blockBlobClient.uploadFile(filePath, {
|
|
4799
5018
|
blockSize: BLOCK_SIZE,
|
|
4800
5019
|
blobHTTPHeaders: { blobContentType: getMimeType(filePath) },
|
|
@@ -4835,16 +5054,16 @@ async function fetchMaterialInfo(config, id, verbose = false) {
|
|
|
4835
5054
|
}
|
|
4836
5055
|
function readMp4Duration(filePath) {
|
|
4837
5056
|
try {
|
|
4838
|
-
const fileSize =
|
|
5057
|
+
const fileSize = fs9.statSync(filePath).size;
|
|
4839
5058
|
const chunkSize = Math.min(fileSize, 256 * 1024);
|
|
4840
5059
|
const bufEnd = Buffer.alloc(chunkSize);
|
|
4841
|
-
const fdEnd =
|
|
4842
|
-
|
|
4843
|
-
|
|
5060
|
+
const fdEnd = fs9.openSync(filePath, "r");
|
|
5061
|
+
fs9.readSync(fdEnd, bufEnd, 0, chunkSize, fileSize - chunkSize);
|
|
5062
|
+
fs9.closeSync(fdEnd);
|
|
4844
5063
|
const bufStart = Buffer.alloc(chunkSize);
|
|
4845
|
-
const fdStart =
|
|
4846
|
-
|
|
4847
|
-
|
|
5064
|
+
const fdStart = fs9.openSync(filePath, "r");
|
|
5065
|
+
fs9.readSync(fdStart, bufStart, 0, chunkSize, 0);
|
|
5066
|
+
fs9.closeSync(fdStart);
|
|
4848
5067
|
const durationSec = parseMvhdFromBuffer(bufEnd) ?? parseMvhdFromBuffer(bufStart);
|
|
4849
5068
|
if (durationSec === null || durationSec <= 0) return null;
|
|
4850
5069
|
const h = Math.floor(durationSec / 3600);
|
|
@@ -4878,7 +5097,7 @@ function parseMvhdFromBuffer(buf) {
|
|
|
4878
5097
|
}
|
|
4879
5098
|
function readImageDimensions(filePath) {
|
|
4880
5099
|
try {
|
|
4881
|
-
const buf =
|
|
5100
|
+
const buf = fs9.readFileSync(filePath);
|
|
4882
5101
|
const dim = imageSize(buf);
|
|
4883
5102
|
return { width: dim.width, height: dim.height, format: (dim.type ?? "").toUpperCase() };
|
|
4884
5103
|
} catch {
|
|
@@ -4886,9 +5105,9 @@ function readImageDimensions(filePath) {
|
|
|
4886
5105
|
}
|
|
4887
5106
|
}
|
|
4888
5107
|
async function uploadImageFile(filePath, config, verbose = false) {
|
|
4889
|
-
const fileName =
|
|
4890
|
-
const fileSize =
|
|
4891
|
-
const format =
|
|
5108
|
+
const fileName = path9.basename(filePath);
|
|
5109
|
+
const fileSize = fs9.statSync(filePath).size;
|
|
5110
|
+
const format = path9.extname(filePath).replace(".", "").toUpperCase();
|
|
4892
5111
|
const sas = await generateSas(config, verbose);
|
|
4893
5112
|
const { resourceUrl } = await uploadToAzure(filePath, sas, void 0);
|
|
4894
5113
|
const dim = readImageDimensions(filePath);
|
|
@@ -4919,11 +5138,11 @@ async function uploadImageFile(filePath, config, verbose = false) {
|
|
|
4919
5138
|
}
|
|
4920
5139
|
|
|
4921
5140
|
// src/commands/upload/commands.ts
|
|
4922
|
-
import * as
|
|
4923
|
-
import * as
|
|
5141
|
+
import * as fs10 from "fs";
|
|
5142
|
+
import * as path10 from "path";
|
|
4924
5143
|
async function runUpload(options) {
|
|
4925
|
-
const filePath =
|
|
4926
|
-
if (!
|
|
5144
|
+
const filePath = path10.resolve(options.file);
|
|
5145
|
+
if (!fs10.existsSync(filePath)) {
|
|
4927
5146
|
console.error(`
|
|
4928
5147
|
\u274C \u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${filePath}`);
|
|
4929
5148
|
process.exit(1);
|
|
@@ -4936,9 +5155,9 @@ async function runUpload(options) {
|
|
|
4936
5155
|
}
|
|
4937
5156
|
const kind = options.kind ?? detectKind(filePath);
|
|
4938
5157
|
const config = loadConfig(options.token);
|
|
4939
|
-
const fileName =
|
|
4940
|
-
const fileSize =
|
|
4941
|
-
const format =
|
|
5158
|
+
const fileName = path10.basename(filePath);
|
|
5159
|
+
const fileSize = fs10.statSync(filePath).size;
|
|
5160
|
+
const format = path10.extname(filePath).replace(".", "").toUpperCase();
|
|
4942
5161
|
if (kind === "video" && !options.cover) {
|
|
4943
5162
|
console.error("\n\u274C \u4E0A\u4F20\u89C6\u9891\u65F6\u5FC5\u987B\u901A\u8FC7 --cover <\u56FE\u7247\u8DEF\u5F84> \u6307\u5B9A\u5C01\u9762\u56FE\u7247");
|
|
4944
5163
|
process.exit(1);
|
|
@@ -4953,8 +5172,8 @@ async function runUpload(options) {
|
|
|
4953
5172
|
let coverUserId;
|
|
4954
5173
|
const { verbose = false } = options;
|
|
4955
5174
|
if (kind === "video" && options.cover) {
|
|
4956
|
-
const coverPath =
|
|
4957
|
-
if (!
|
|
5175
|
+
const coverPath = path10.resolve(options.cover);
|
|
5176
|
+
if (!fs10.existsSync(coverPath)) {
|
|
4958
5177
|
console.error(`
|
|
4959
5178
|
\u274C \u5C01\u9762\u56FE\u7247\u4E0D\u5B58\u5728\uFF1A${coverPath}`);
|
|
4960
5179
|
process.exit(1);
|
|
@@ -4966,7 +5185,7 @@ async function runUpload(options) {
|
|
|
4966
5185
|
process.exit(1);
|
|
4967
5186
|
}
|
|
4968
5187
|
console.log(`
|
|
4969
|
-
0\uFE0F\u20E3 \u4E0A\u4F20\u5C01\u9762\u56FE\u7247\uFF1A${
|
|
5188
|
+
0\uFE0F\u20E3 \u4E0A\u4F20\u5C01\u9762\u56FE\u7247\uFF1A${path10.basename(coverPath)} \u2026`);
|
|
4970
5189
|
try {
|
|
4971
5190
|
const coverResult = await uploadImageFile(coverPath, config, verbose);
|
|
4972
5191
|
thumbUrl = coverResult.resourceUrl;
|
|
@@ -5070,7 +5289,7 @@ async function runUpload(options) {
|
|
|
5070
5289
|
...matInfo?.duration ? { duration: matInfo.duration } : {},
|
|
5071
5290
|
cover: {
|
|
5072
5291
|
imageUrl: verbose ? coverUrl || "\uFF08\u8BF7\u624B\u52A8\u586B\u5199\u5C01\u9762\u56FE\u7247 URL\uFF09" : thumbUrl,
|
|
5073
|
-
imageName: options.cover ?
|
|
5292
|
+
imageName: options.cover ? path10.basename(options.cover) : "cover.jpg",
|
|
5074
5293
|
imageSourceType: 1,
|
|
5075
5294
|
sourceImageId: coverMaterialId || void 0,
|
|
5076
5295
|
imageCreateUserId: coverUserId || void 0,
|
|
@@ -5097,8 +5316,8 @@ async function runUpload(options) {
|
|
|
5097
5316
|
}
|
|
5098
5317
|
|
|
5099
5318
|
// src/commands/workflow/validate.ts
|
|
5100
|
-
import * as
|
|
5101
|
-
import * as
|
|
5319
|
+
import * as fs11 from "fs";
|
|
5320
|
+
import * as path11 from "path";
|
|
5102
5321
|
var CJK_REGEX = /[\u3400-\u4dbf\u4e00-\u9fff\uf900-\ufaff]/g;
|
|
5103
5322
|
var WORD_REGEX = /[A-Za-z0-9]+(?:['’\-][A-Za-z0-9]+)*/g;
|
|
5104
5323
|
function countMetrics(text) {
|
|
@@ -5182,7 +5401,7 @@ var COUNT_BY_LABEL = {
|
|
|
5182
5401
|
};
|
|
5183
5402
|
function readStdin() {
|
|
5184
5403
|
try {
|
|
5185
|
-
return
|
|
5404
|
+
return fs11.readFileSync(0, "utf8");
|
|
5186
5405
|
} catch {
|
|
5187
5406
|
return "";
|
|
5188
5407
|
}
|
|
@@ -5192,14 +5411,14 @@ function resolveContent(options) {
|
|
|
5192
5411
|
return { raw: options.text, sourceLabel: "--text \u6587\u672C" };
|
|
5193
5412
|
}
|
|
5194
5413
|
if (options.file) {
|
|
5195
|
-
const filePath =
|
|
5196
|
-
if (!
|
|
5414
|
+
const filePath = path11.resolve(options.file);
|
|
5415
|
+
if (!fs11.existsSync(filePath) || !fs11.statSync(filePath).isFile()) {
|
|
5197
5416
|
console.error(`
|
|
5198
5417
|
\u274C \u6587\u6848\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${filePath}`);
|
|
5199
5418
|
process.exit(1);
|
|
5200
5419
|
}
|
|
5201
5420
|
try {
|
|
5202
|
-
return { raw:
|
|
5421
|
+
return { raw: fs11.readFileSync(filePath, "utf8"), sourceLabel: path11.basename(filePath) };
|
|
5203
5422
|
} catch (e) {
|
|
5204
5423
|
console.error(`
|
|
5205
5424
|
\u274C \u8BFB\u53D6\u6587\u4EF6\u5931\u8D25\uFF1A${e.message}`);
|
|
@@ -5293,8 +5512,8 @@ async function runValidateContent(options) {
|
|
|
5293
5512
|
}
|
|
5294
5513
|
|
|
5295
5514
|
// src/commands/workflow/load-libraries.ts
|
|
5296
|
-
import * as
|
|
5297
|
-
import * as
|
|
5515
|
+
import * as fs12 from "fs";
|
|
5516
|
+
import * as path12 from "path";
|
|
5298
5517
|
var REMOTE_BASE = "https://staticpn.siluzan.com/assets/chat/thrju_sofn";
|
|
5299
5518
|
var WECHAT_PACK_PATH = "packs/wechat";
|
|
5300
5519
|
var LIB_FILES = [
|
|
@@ -5360,35 +5579,19 @@ async function runLoadLibraries(options) {
|
|
|
5360
5579
|
let outPath;
|
|
5361
5580
|
try {
|
|
5362
5581
|
if (options.out) {
|
|
5363
|
-
outPath =
|
|
5364
|
-
|
|
5582
|
+
outPath = path12.resolve(options.out);
|
|
5583
|
+
fs12.mkdirSync(path12.dirname(outPath), { recursive: true });
|
|
5365
5584
|
} else {
|
|
5366
|
-
const cacheDir =
|
|
5367
|
-
|
|
5368
|
-
outPath =
|
|
5585
|
+
const cacheDir = path12.join(SILUZAN_DIR, "content-library", ".cache");
|
|
5586
|
+
fs12.mkdirSync(cacheDir, { recursive: true });
|
|
5587
|
+
outPath = path12.join(cacheDir, `three-lib-${sourceUsed}-${Date.now()}.md`);
|
|
5369
5588
|
}
|
|
5370
|
-
|
|
5589
|
+
fs12.writeFileSync(outPath, combined, "utf8");
|
|
5371
5590
|
} catch (e) {
|
|
5372
5591
|
console.error(`
|
|
5373
5592
|
\u274C \u5199\u5165\u5408\u5E76\u6587\u4EF6\u5931\u8D25\uFF1A${e.message}`);
|
|
5374
5593
|
process.exit(1);
|
|
5375
5594
|
}
|
|
5376
|
-
if (options.json) {
|
|
5377
|
-
console.log(
|
|
5378
|
-
JSON.stringify(
|
|
5379
|
-
{
|
|
5380
|
-
platform,
|
|
5381
|
-
source: sourceUsed,
|
|
5382
|
-
libraries: LIB_FILES.map((l) => l.label),
|
|
5383
|
-
file: outPath,
|
|
5384
|
-
bytes: Buffer.byteLength(combined, "utf8")
|
|
5385
|
-
},
|
|
5386
|
-
null,
|
|
5387
|
-
2
|
|
5388
|
-
)
|
|
5389
|
-
);
|
|
5390
|
-
return;
|
|
5391
|
-
}
|
|
5392
5595
|
console.log(`
|
|
5393
5596
|
\u2705 \u4E09\u5E93\u5DF2\u5408\u5E76\u5199\u5165\u5355\u4E2A\u4E34\u65F6\u6587\u4EF6`);
|
|
5394
5597
|
console.log(` \u5E73\u53F0\uFF1A${platform}`);
|
|
@@ -5714,8 +5917,8 @@ function printMarkdownFetch(runtime, includeModules, sections) {
|
|
|
5714
5917
|
}
|
|
5715
5918
|
|
|
5716
5919
|
// src/commands/report/commands.ts
|
|
5717
|
-
import * as
|
|
5718
|
-
import * as
|
|
5920
|
+
import * as fs13 from "fs";
|
|
5921
|
+
import * as path13 from "path";
|
|
5719
5922
|
async function runReportFetch(options) {
|
|
5720
5923
|
const runtime = buildRuntime(options);
|
|
5721
5924
|
const includeModules = parseModules(options.include);
|
|
@@ -5831,8 +6034,17 @@ async function runReportFetch(options) {
|
|
|
5831
6034
|
const msg = error.message;
|
|
5832
6035
|
exitWithError(`\u67E5\u8BE2\u8FD0\u8425\u62A5\u8868\u5931\u8D25\uFF1A${msg}`);
|
|
5833
6036
|
}
|
|
5834
|
-
if (options.
|
|
5835
|
-
|
|
6037
|
+
if (options.jsonOut) {
|
|
6038
|
+
await emitCliJsonOrSnapshot(
|
|
6039
|
+
{ jsonOut: options.jsonOut },
|
|
6040
|
+
{
|
|
6041
|
+
section: "report-fetch",
|
|
6042
|
+
commandLabel: "report fetch",
|
|
6043
|
+
payload,
|
|
6044
|
+
commandHint: options.media,
|
|
6045
|
+
idSuffix: options.media
|
|
6046
|
+
}
|
|
6047
|
+
);
|
|
5836
6048
|
return;
|
|
5837
6049
|
}
|
|
5838
6050
|
printMarkdownFetch(runtime, includeModules, sections);
|
|
@@ -5885,8 +6097,15 @@ async function runReportRecords(options) {
|
|
|
5885
6097
|
const list = Array.isArray(data?.list) ? data.list : [];
|
|
5886
6098
|
const total = data?.total ?? 0;
|
|
5887
6099
|
const totalPages = computeTotalPages(total, size);
|
|
5888
|
-
if (options.
|
|
5889
|
-
|
|
6100
|
+
if (options.jsonOut) {
|
|
6101
|
+
await emitCliJsonOrSnapshot(
|
|
6102
|
+
{ jsonOut: options.jsonOut },
|
|
6103
|
+
{
|
|
6104
|
+
section: "report-records",
|
|
6105
|
+
commandLabel: "report records",
|
|
6106
|
+
payload: { page, size, total, totalPages, list }
|
|
6107
|
+
}
|
|
6108
|
+
);
|
|
5890
6109
|
return;
|
|
5891
6110
|
}
|
|
5892
6111
|
const pageInfo = formatPaginationSummary({ page, pageSize: size, total });
|
|
@@ -5899,7 +6118,7 @@ function defaultDownloadPath(recordId) {
|
|
|
5899
6118
|
const now = /* @__PURE__ */ new Date();
|
|
5900
6119
|
const pad = (n) => String(n).padStart(2, "0");
|
|
5901
6120
|
const name = `operations-report-${recordId}-${now.getFullYear()}${pad(now.getMonth() + 1)}${pad(now.getDate())}-${pad(now.getHours())}${pad(now.getMinutes())}${pad(now.getSeconds())}.pdf`;
|
|
5902
|
-
return
|
|
6121
|
+
return path13.resolve(process.cwd(), name);
|
|
5903
6122
|
}
|
|
5904
6123
|
async function downloadFile(url, output) {
|
|
5905
6124
|
const res = await fetch(url);
|
|
@@ -5907,7 +6126,7 @@ async function downloadFile(url, output) {
|
|
|
5907
6126
|
throw new Error(`\u4E0B\u8F7D\u5931\u8D25\uFF0CHTTP ${res.status}`);
|
|
5908
6127
|
}
|
|
5909
6128
|
const buffer = Buffer.from(await res.arrayBuffer());
|
|
5910
|
-
|
|
6129
|
+
fs13.writeFileSync(output, buffer);
|
|
5911
6130
|
}
|
|
5912
6131
|
async function runReportDownload(options) {
|
|
5913
6132
|
if (!options.id) {
|
|
@@ -5927,7 +6146,7 @@ async function runReportDownload(options) {
|
|
|
5927
6146
|
const msg = error.message;
|
|
5928
6147
|
exitWithError(`\u83B7\u53D6\u4E0B\u8F7D\u5730\u5740\u5931\u8D25\uFF1A${msg}`);
|
|
5929
6148
|
}
|
|
5930
|
-
const output =
|
|
6149
|
+
const output = path13.resolve(options.output ? options.output : defaultDownloadPath(options.id));
|
|
5931
6150
|
try {
|
|
5932
6151
|
await downloadFile(pdfUrl, output);
|
|
5933
6152
|
} catch (error) {
|
|
@@ -6158,8 +6377,8 @@ async function requestPlanning(config, endpoint, init = {}, verbose = false) {
|
|
|
6158
6377
|
}
|
|
6159
6378
|
|
|
6160
6379
|
// src/commands/planning/commands.ts
|
|
6161
|
-
import * as
|
|
6162
|
-
import * as
|
|
6380
|
+
import * as fs14 from "fs";
|
|
6381
|
+
import * as path14 from "path";
|
|
6163
6382
|
async function runPlanningEnterprises(options) {
|
|
6164
6383
|
const config = loadConfig(options.token);
|
|
6165
6384
|
const verbose = Boolean(options.verbose);
|
|
@@ -6192,19 +6411,20 @@ async function runPlanningEnterprises(options) {
|
|
|
6192
6411
|
total: entTotal,
|
|
6193
6412
|
totalPagesOverride: 1
|
|
6194
6413
|
});
|
|
6195
|
-
if (options.
|
|
6196
|
-
|
|
6197
|
-
|
|
6198
|
-
|
|
6414
|
+
if (options.jsonOut) {
|
|
6415
|
+
await emitCliJsonOrSnapshot(
|
|
6416
|
+
{ jsonOut: options.jsonOut },
|
|
6417
|
+
{
|
|
6418
|
+
section: "planning-enterprises",
|
|
6419
|
+
commandLabel: "planning enterprises",
|
|
6420
|
+
payload: {
|
|
6199
6421
|
page: 1,
|
|
6200
6422
|
pageSize: entPageSize,
|
|
6201
6423
|
total: entTotal,
|
|
6202
6424
|
totalPages: 1,
|
|
6203
6425
|
folders: enterprises
|
|
6204
|
-
}
|
|
6205
|
-
|
|
6206
|
-
2
|
|
6207
|
-
)
|
|
6426
|
+
}
|
|
6427
|
+
}
|
|
6208
6428
|
);
|
|
6209
6429
|
return;
|
|
6210
6430
|
}
|
|
@@ -6239,8 +6459,15 @@ async function runPlanningContentTypes(options) {
|
|
|
6239
6459
|
}
|
|
6240
6460
|
list = [...DEFAULT_CONTENT_TYPES];
|
|
6241
6461
|
}
|
|
6242
|
-
if (options.
|
|
6243
|
-
|
|
6462
|
+
if (options.jsonOut) {
|
|
6463
|
+
await emitCliJsonOrSnapshot(
|
|
6464
|
+
{ jsonOut: options.jsonOut },
|
|
6465
|
+
{
|
|
6466
|
+
section: "planning-content-types",
|
|
6467
|
+
commandLabel: "planning content-types",
|
|
6468
|
+
payload: { list }
|
|
6469
|
+
}
|
|
6470
|
+
);
|
|
6244
6471
|
return;
|
|
6245
6472
|
}
|
|
6246
6473
|
console.log("\n\u53EF\u7528\u5185\u5BB9\u7C7B\u578B\uFF1A");
|
|
@@ -6287,7 +6514,7 @@ async function watchPlanTask(config, taskId, maxWaitMs, onProgress) {
|
|
|
6287
6514
|
const url = `${baseUrl}/api/plans/tasks/${encodeURIComponent(taskId)}/progress`;
|
|
6288
6515
|
const controller = new AbortController();
|
|
6289
6516
|
let finished = false;
|
|
6290
|
-
return new Promise((
|
|
6517
|
+
return new Promise((resolve10, reject) => {
|
|
6291
6518
|
const settle = (fn) => {
|
|
6292
6519
|
if (finished) return;
|
|
6293
6520
|
finished = true;
|
|
@@ -6334,7 +6561,7 @@ async function watchPlanTask(config, taskId, maxWaitMs, onProgress) {
|
|
|
6334
6561
|
}
|
|
6335
6562
|
onProgress?.(event);
|
|
6336
6563
|
if (event.status === "completed") {
|
|
6337
|
-
settle(() =>
|
|
6564
|
+
settle(() => resolve10(event.plan ?? null));
|
|
6338
6565
|
return;
|
|
6339
6566
|
}
|
|
6340
6567
|
if (event.status === "failed" || event.status === "cancelled") {
|
|
@@ -6362,22 +6589,17 @@ async function runPlanningWatchTask(taskId, options) {
|
|
|
6362
6589
|
try {
|
|
6363
6590
|
finalPlan = await watchPlanTask(config, id, timeoutMs, (event) => {
|
|
6364
6591
|
progress.push(event);
|
|
6365
|
-
|
|
6366
|
-
|
|
6367
|
-
console.log(` - \u72B6\u6001\u66F4\u65B0\uFF1A${statusText}`);
|
|
6368
|
-
}
|
|
6592
|
+
const statusText = getTaskStatusText(String(event.status ?? ""));
|
|
6593
|
+
console.log(` - \u72B6\u6001\u66F4\u65B0\uFF1A${statusText}`);
|
|
6369
6594
|
});
|
|
6370
6595
|
} catch (error) {
|
|
6371
6596
|
exitWithError2(`\u76D1\u542C\u4EFB\u52A1\u5931\u8D25\uFF1A${error.message}`);
|
|
6372
6597
|
}
|
|
6373
|
-
if (options.json) {
|
|
6374
|
-
console.log(JSON.stringify({ taskId: id, progress, plan: finalPlan }, null, 2));
|
|
6375
|
-
return;
|
|
6376
|
-
}
|
|
6377
6598
|
console.log(`
|
|
6378
6599
|
\u2705 \u4EFB\u52A1\u76D1\u542C\u7ED3\u675F\uFF1A${id}`);
|
|
6379
6600
|
if (finalPlan?.id) {
|
|
6380
6601
|
console.log(` \u89C4\u5212ID: ${finalPlan.id}`);
|
|
6602
|
+
console.log(" \u63D0\u793A : \u7528 `siluzan-cso planning get <planId> --json-out <\u76EE\u5F55>` \u843D\u76D8\u5B8C\u6574\u89C4\u5212");
|
|
6381
6603
|
}
|
|
6382
6604
|
console.log();
|
|
6383
6605
|
}
|
|
@@ -6407,42 +6629,33 @@ async function runPlanningGenerate(options) {
|
|
|
6407
6629
|
if (!taskId || response.status === "failed") {
|
|
6408
6630
|
exitWithError2("\u521B\u5EFA\u89C4\u5212\u4EFB\u52A1\u5931\u8D25\uFF1A\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u53EF\u7528 taskId");
|
|
6409
6631
|
}
|
|
6410
|
-
|
|
6411
|
-
|
|
6412
|
-
|
|
6413
|
-
|
|
6414
|
-
|
|
6415
|
-
|
|
6416
|
-
` \u72B6\u6001 : ${getTaskStatusText(String(response.status ?? "pending"))}`
|
|
6417
|
-
);
|
|
6418
|
-
console.log(" \u63D0\u793A : \u53EF\u7528 `siluzan-cso planning watch <taskId>` \u76D1\u542C\u8FDB\u5EA6");
|
|
6419
|
-
}
|
|
6632
|
+
console.log("\n\u2705 \u5DF2\u63D0\u4EA4\u89C4\u5212\u751F\u6210\u4EFB\u52A1");
|
|
6633
|
+
console.log(` Task ID : ${taskId}`);
|
|
6634
|
+
console.log(
|
|
6635
|
+
` \u72B6\u6001 : ${getTaskStatusText(String(response.status ?? "pending"))}`
|
|
6636
|
+
);
|
|
6637
|
+
console.log(" \u63D0\u793A : \u53EF\u7528 `siluzan-cso planning watch <taskId>` \u76D1\u542C\u8FDB\u5EA6");
|
|
6420
6638
|
if (options.watch) {
|
|
6421
6639
|
const timeoutMs = parseTimeoutMs(options.watchTimeout, 3e5);
|
|
6422
|
-
|
|
6423
|
-
console.log("\n\u5F00\u59CB\u76D1\u542C\u4EFB\u52A1\u8FDB\u5EA6...");
|
|
6424
|
-
}
|
|
6640
|
+
console.log("\n\u5F00\u59CB\u76D1\u542C\u4EFB\u52A1\u8FDB\u5EA6...");
|
|
6425
6641
|
let plan = null;
|
|
6426
6642
|
try {
|
|
6427
6643
|
plan = await watchPlanTask(config, taskId, timeoutMs, (event) => {
|
|
6428
|
-
|
|
6429
|
-
|
|
6430
|
-
console.log(` - \u72B6\u6001\u66F4\u65B0\uFF1A${statusText}`);
|
|
6431
|
-
}
|
|
6644
|
+
const statusText = getTaskStatusText(String(event.status ?? ""));
|
|
6645
|
+
console.log(` - \u72B6\u6001\u66F4\u65B0\uFF1A${statusText}`);
|
|
6432
6646
|
});
|
|
6433
6647
|
} catch (error) {
|
|
6434
6648
|
exitWithError2(`\u4EFB\u52A1\u76D1\u542C\u5931\u8D25\uFF1A${error.message}`);
|
|
6435
6649
|
}
|
|
6436
|
-
|
|
6437
|
-
|
|
6438
|
-
|
|
6439
|
-
console.log(
|
|
6440
|
-
|
|
6441
|
-
|
|
6442
|
-
}
|
|
6443
|
-
console.log();
|
|
6650
|
+
console.log("\u2705 \u4EFB\u52A1\u5DF2\u5B8C\u6210");
|
|
6651
|
+
if (plan?.id) {
|
|
6652
|
+
console.log(` \u89C4\u5212ID : ${plan.id}`);
|
|
6653
|
+
console.log(
|
|
6654
|
+
" \u63D0\u793A : \u7528 `siluzan-cso planning get <planId> --json-out <\u76EE\u5F55>` \u843D\u76D8\u5B8C\u6574\u89C4\u5212"
|
|
6655
|
+
);
|
|
6444
6656
|
}
|
|
6445
|
-
|
|
6657
|
+
console.log();
|
|
6658
|
+
} else {
|
|
6446
6659
|
console.log();
|
|
6447
6660
|
}
|
|
6448
6661
|
}
|
|
@@ -6467,9 +6680,14 @@ async function runPlanningList(options) {
|
|
|
6467
6680
|
}
|
|
6468
6681
|
const total = data.total;
|
|
6469
6682
|
const totalPages = computeTotalPages(total, pageSize);
|
|
6470
|
-
if (options.
|
|
6471
|
-
|
|
6472
|
-
|
|
6683
|
+
if (options.jsonOut) {
|
|
6684
|
+
await emitCliJsonOrSnapshot(
|
|
6685
|
+
{ jsonOut: options.jsonOut },
|
|
6686
|
+
{
|
|
6687
|
+
section: "planning-list",
|
|
6688
|
+
commandLabel: "planning list",
|
|
6689
|
+
payload: { pageIndex, pageSize, total, totalPages, list: data.list }
|
|
6690
|
+
}
|
|
6473
6691
|
);
|
|
6474
6692
|
return;
|
|
6475
6693
|
}
|
|
@@ -6514,20 +6732,14 @@ async function runTaskAction(actionName, taskId, options) {
|
|
|
6514
6732
|
const init = actionName === "delete" ? { method: "DELETE" } : { method: "POST", headers: { "Content-Type": "application/json" } };
|
|
6515
6733
|
try {
|
|
6516
6734
|
const raw = await requestPlanning(config, endpoint, init, verbose);
|
|
6517
|
-
|
|
6518
|
-
if (options.json) {
|
|
6519
|
-
console.log(JSON.stringify({ taskId: id, action: actionName, data: payload }, null, 2));
|
|
6520
|
-
return;
|
|
6521
|
-
}
|
|
6735
|
+
normalizeApiPayload(raw);
|
|
6522
6736
|
} catch (error) {
|
|
6523
6737
|
exitWithError2(`${actionName} \u4EFB\u52A1\u5931\u8D25\uFF1A${error.message}`);
|
|
6524
6738
|
}
|
|
6525
|
-
|
|
6526
|
-
|
|
6527
|
-
console.log(`
|
|
6739
|
+
const actionText = actionName === "cancel" ? "\u53D6\u6D88" : actionName === "retry" ? "\u91CD\u8BD5" : "\u5220\u9664";
|
|
6740
|
+
console.log(`
|
|
6528
6741
|
\u2705 \u4EFB\u52A1${actionText}\u6210\u529F\uFF1A${id}
|
|
6529
6742
|
`);
|
|
6530
|
-
}
|
|
6531
6743
|
}
|
|
6532
6744
|
async function runPlanningTaskCancel(taskId, options) {
|
|
6533
6745
|
await runTaskAction("cancel", taskId, options);
|
|
@@ -6557,8 +6769,16 @@ async function runPlanningGet(planId, options) {
|
|
|
6557
6769
|
} catch (error) {
|
|
6558
6770
|
exitWithError2(`\u83B7\u53D6\u89C4\u5212\u8BE6\u60C5\u5931\u8D25\uFF1A${error.message}`);
|
|
6559
6771
|
}
|
|
6560
|
-
if (options.
|
|
6561
|
-
|
|
6772
|
+
if (options.jsonOut) {
|
|
6773
|
+
await emitCliJsonOrSnapshot(
|
|
6774
|
+
{ jsonOut: options.jsonOut },
|
|
6775
|
+
{
|
|
6776
|
+
section: "planning-get",
|
|
6777
|
+
commandLabel: "planning get",
|
|
6778
|
+
payload: plan,
|
|
6779
|
+
idSuffix: plan.id ?? id
|
|
6780
|
+
}
|
|
6781
|
+
);
|
|
6562
6782
|
return;
|
|
6563
6783
|
}
|
|
6564
6784
|
const enterpriseIds = Array.isArray(plan.enterpriseIds) ? plan.enterpriseIds.join(",") : plan.enterpriseId ?? "-";
|
|
@@ -6570,7 +6790,7 @@ async function runPlanningGet(planId, options) {
|
|
|
6570
6790
|
console.log(` \u89C4\u5212\u6708\u4EFD : ${plan.yearMonth ?? "-"}`);
|
|
6571
6791
|
console.log(` \u56FE\u6587\u65B9\u5411\u6570 : ${postCount}`);
|
|
6572
6792
|
console.log(` \u89C6\u9891\u65B9\u5411\u6570 : ${videoCount}`);
|
|
6573
|
-
console.log(" \u63D0\u793A : \u4F7F\u7528 --json \
|
|
6793
|
+
console.log(" \u63D0\u793A : \u4F7F\u7528 --json-out <\u76EE\u5F55\u6216 *.json> \u843D\u76D8\u5B8C\u6574\u8BE6\u60C5\n");
|
|
6574
6794
|
}
|
|
6575
6795
|
async function runPlanningRegenerate(planId, options) {
|
|
6576
6796
|
const id = String(planId ?? "").trim();
|
|
@@ -6601,40 +6821,31 @@ async function runPlanningRegenerate(planId, options) {
|
|
|
6601
6821
|
if (!taskId || response.status === "failed") {
|
|
6602
6822
|
exitWithError2("\u518D\u751F\u6210\u5931\u8D25\uFF1A\u670D\u52A1\u7AEF\u672A\u8FD4\u56DE\u53EF\u7528 taskId");
|
|
6603
6823
|
}
|
|
6604
|
-
|
|
6605
|
-
|
|
6606
|
-
|
|
6607
|
-
|
|
6608
|
-
console.log(` \u89C4\u5212ID : ${id}`);
|
|
6609
|
-
console.log(` TaskID : ${taskId}`);
|
|
6610
|
-
console.log(" \u63D0\u793A : \u53EF\u7528 `siluzan-cso planning watch <taskId>` \u76D1\u542C\u8FDB\u5EA6");
|
|
6611
|
-
}
|
|
6824
|
+
console.log("\n\u2705 \u5DF2\u63D0\u4EA4\u518D\u751F\u6210\u4EFB\u52A1");
|
|
6825
|
+
console.log(` \u89C4\u5212ID : ${id}`);
|
|
6826
|
+
console.log(` TaskID : ${taskId}`);
|
|
6827
|
+
console.log(" \u63D0\u793A : \u53EF\u7528 `siluzan-cso planning watch <taskId>` \u76D1\u542C\u8FDB\u5EA6");
|
|
6612
6828
|
if (!options.watch) {
|
|
6613
|
-
|
|
6829
|
+
console.log();
|
|
6614
6830
|
return;
|
|
6615
6831
|
}
|
|
6616
6832
|
const timeoutMs = parseTimeoutMs(options.watchTimeout, 3e5);
|
|
6617
|
-
|
|
6618
|
-
console.log("\n\u5F00\u59CB\u76D1\u542C\u4EFB\u52A1\u8FDB\u5EA6...");
|
|
6619
|
-
}
|
|
6833
|
+
console.log("\n\u5F00\u59CB\u76D1\u542C\u4EFB\u52A1\u8FDB\u5EA6...");
|
|
6620
6834
|
let plan = null;
|
|
6621
6835
|
try {
|
|
6622
6836
|
plan = await watchPlanTask(config, taskId, timeoutMs, (event) => {
|
|
6623
|
-
|
|
6624
|
-
|
|
6625
|
-
console.log(` - \u72B6\u6001\u66F4\u65B0\uFF1A${statusText}`);
|
|
6626
|
-
}
|
|
6837
|
+
const statusText = getTaskStatusText(String(event.status ?? ""));
|
|
6838
|
+
console.log(` - \u72B6\u6001\u66F4\u65B0\uFF1A${statusText}`);
|
|
6627
6839
|
});
|
|
6628
6840
|
} catch (error) {
|
|
6629
6841
|
exitWithError2(`\u4EFB\u52A1\u76D1\u542C\u5931\u8D25\uFF1A${error.message}`);
|
|
6630
6842
|
}
|
|
6631
|
-
if (options.json) {
|
|
6632
|
-
console.log(JSON.stringify({ planId: id, taskId, plan }, null, 2));
|
|
6633
|
-
return;
|
|
6634
|
-
}
|
|
6635
6843
|
console.log("\u2705 \u518D\u751F\u6210\u5DF2\u5B8C\u6210");
|
|
6636
6844
|
if (plan?.id) {
|
|
6637
6845
|
console.log(` \u65B0\u89C4\u5212ID : ${plan.id}`);
|
|
6846
|
+
console.log(
|
|
6847
|
+
" \u63D0\u793A : \u7528 `siluzan-cso planning get <planId> --json-out <\u76EE\u5F55>` \u843D\u76D8\u5B8C\u6574\u89C4\u5212"
|
|
6848
|
+
);
|
|
6638
6849
|
}
|
|
6639
6850
|
console.log();
|
|
6640
6851
|
}
|
|
@@ -6665,13 +6876,13 @@ function inferEnterpriseNameFromPlan(plan) {
|
|
|
6665
6876
|
}
|
|
6666
6877
|
async function loadPlanFromSource(options, config) {
|
|
6667
6878
|
if (options.input) {
|
|
6668
|
-
const inputPath =
|
|
6669
|
-
if (!
|
|
6879
|
+
const inputPath = path14.resolve(options.input);
|
|
6880
|
+
if (!fs14.existsSync(inputPath)) {
|
|
6670
6881
|
exitWithError2(`\u8F93\u5165\u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${inputPath}`);
|
|
6671
6882
|
}
|
|
6672
6883
|
let raw = "";
|
|
6673
6884
|
try {
|
|
6674
|
-
raw =
|
|
6885
|
+
raw = fs14.readFileSync(inputPath, "utf-8");
|
|
6675
6886
|
} catch (error) {
|
|
6676
6887
|
exitWithError2(`\u8BFB\u53D6\u8F93\u5165\u6587\u4EF6\u5931\u8D25\uFF1A${error.message}`);
|
|
6677
6888
|
}
|
|
@@ -6705,18 +6916,12 @@ async function runPlanningExportTxt(options) {
|
|
|
6705
6916
|
const defaultName = sanitizeFilename(
|
|
6706
6917
|
`\u5185\u5BB9\u9009\u9898\u65B9\u5411\u89C4\u5212_${enterpriseName}_${plan.yearMonth ?? "unknown"}.txt`
|
|
6707
6918
|
);
|
|
6708
|
-
const outputPath =
|
|
6919
|
+
const outputPath = path14.resolve(options.output ? options.output : defaultName);
|
|
6709
6920
|
try {
|
|
6710
|
-
|
|
6921
|
+
fs14.writeFileSync(outputPath, text, "utf-8");
|
|
6711
6922
|
} catch (error) {
|
|
6712
6923
|
exitWithError2(`\u5199\u5165\u5BFC\u51FA\u6587\u4EF6\u5931\u8D25\uFF1A${error.message}`);
|
|
6713
6924
|
}
|
|
6714
|
-
if (options.json) {
|
|
6715
|
-
console.log(
|
|
6716
|
-
JSON.stringify({ output: outputPath, planId: plan.id ?? options.planId ?? null }, null, 2)
|
|
6717
|
-
);
|
|
6718
|
-
return;
|
|
6719
|
-
}
|
|
6720
6925
|
console.log("\n\u2705 \u89C4\u5212 TXT \u5BFC\u51FA\u5B8C\u6210");
|
|
6721
6926
|
console.log(` \u8F93\u51FA\u8DEF\u5F84: ${outputPath}
|
|
6722
6927
|
`);
|
|
@@ -6899,8 +7104,15 @@ async function runTaskList(options) {
|
|
|
6899
7104
|
const list = Array.isArray(data.list) ? data.list : [];
|
|
6900
7105
|
const total = data.total ?? 0;
|
|
6901
7106
|
const totalPages = computeTotalPages(total, size);
|
|
6902
|
-
if (options.
|
|
6903
|
-
|
|
7107
|
+
if (options.jsonOut) {
|
|
7108
|
+
await emitCliJsonOrSnapshot(
|
|
7109
|
+
{ jsonOut: options.jsonOut },
|
|
7110
|
+
{
|
|
7111
|
+
section: "task-list",
|
|
7112
|
+
commandLabel: "task list",
|
|
7113
|
+
payload: { page, size, total, totalPages, list }
|
|
7114
|
+
}
|
|
7115
|
+
);
|
|
6904
7116
|
return;
|
|
6905
7117
|
}
|
|
6906
7118
|
const pageInfo = formatPaginationSummary({ page, pageSize: size, total });
|
|
@@ -6958,13 +7170,22 @@ async function runTaskDetail(options) {
|
|
|
6958
7170
|
const raw = data;
|
|
6959
7171
|
const itemTotal = typeof raw.total === "number" ? raw.total : data.totalPublishCount ?? 0;
|
|
6960
7172
|
const totalPages = computeTotalPages(itemTotal, size);
|
|
6961
|
-
if (options.
|
|
6962
|
-
|
|
6963
|
-
|
|
6964
|
-
|
|
6965
|
-
|
|
6966
|
-
|
|
6967
|
-
|
|
7173
|
+
if (options.jsonOut) {
|
|
7174
|
+
await emitCliJsonOrSnapshot(
|
|
7175
|
+
{ jsonOut: options.jsonOut },
|
|
7176
|
+
{
|
|
7177
|
+
section: "task-detail",
|
|
7178
|
+
commandLabel: "task detail",
|
|
7179
|
+
payload: {
|
|
7180
|
+
...data,
|
|
7181
|
+
publishId: options.publishId,
|
|
7182
|
+
page,
|
|
7183
|
+
size,
|
|
7184
|
+
total: itemTotal,
|
|
7185
|
+
totalPages
|
|
7186
|
+
},
|
|
7187
|
+
idSuffix: options.publishId
|
|
7188
|
+
}
|
|
6968
7189
|
);
|
|
6969
7190
|
return;
|
|
6970
7191
|
}
|
|
@@ -7076,10 +7297,6 @@ async function runTaskCheckEdit(options) {
|
|
|
7076
7297
|
exitWithError3(res.message || `\u68C0\u67E5\u53EF\u7F16\u8F91\u72B6\u6001\u5931\u8D25\uFF08code=${res.code}\uFF09`);
|
|
7077
7298
|
}
|
|
7078
7299
|
const allowChange = Boolean(res.data.allowChange);
|
|
7079
|
-
if (options.json) {
|
|
7080
|
-
console.log(JSON.stringify(res.data, null, 2));
|
|
7081
|
-
return;
|
|
7082
|
-
}
|
|
7083
7300
|
console.log(`
|
|
7084
7301
|
allowChange: ${allowChange ? "true" : "false"}`);
|
|
7085
7302
|
if (!allowChange) {
|
|
@@ -7137,19 +7354,14 @@ async function runTaskCommentList(options) {
|
|
|
7137
7354
|
total,
|
|
7138
7355
|
totalPagesOverride: 1
|
|
7139
7356
|
});
|
|
7140
|
-
if (options.
|
|
7141
|
-
|
|
7142
|
-
|
|
7143
|
-
|
|
7144
|
-
|
|
7145
|
-
|
|
7146
|
-
|
|
7147
|
-
|
|
7148
|
-
list
|
|
7149
|
-
},
|
|
7150
|
-
null,
|
|
7151
|
-
2
|
|
7152
|
-
)
|
|
7357
|
+
if (options.jsonOut) {
|
|
7358
|
+
await emitCliJsonOrSnapshot(
|
|
7359
|
+
{ jsonOut: options.jsonOut },
|
|
7360
|
+
{
|
|
7361
|
+
section: "task-comment-list",
|
|
7362
|
+
commandLabel: "task comment list",
|
|
7363
|
+
payload: { page: 1, pageSize: pageSizeForSummary, total, totalPages: 1, list }
|
|
7364
|
+
}
|
|
7153
7365
|
);
|
|
7154
7366
|
return;
|
|
7155
7367
|
}
|
|
@@ -7204,8 +7416,8 @@ async function runAuthorize(opts) {
|
|
|
7204
7416
|
}
|
|
7205
7417
|
|
|
7206
7418
|
// src/commands/persona.ts
|
|
7207
|
-
import
|
|
7208
|
-
import
|
|
7419
|
+
import fs15 from "fs";
|
|
7420
|
+
import path15 from "path";
|
|
7209
7421
|
var MAX_PERSONA_NAME = 60;
|
|
7210
7422
|
function unwrapGetPersonas(raw) {
|
|
7211
7423
|
if (!raw || typeof raw !== "object") return null;
|
|
@@ -7273,12 +7485,22 @@ async function runPersonaList(options) {
|
|
|
7273
7485
|
list = list.filter((p) => (p.personaName || "").toLowerCase().includes(q));
|
|
7274
7486
|
}
|
|
7275
7487
|
const total = payload.totalResultCount ?? payload.results.length;
|
|
7276
|
-
if (options.
|
|
7488
|
+
if (options.jsonOut) {
|
|
7277
7489
|
const includeStyleGuide = options.includeStyleGuide !== false;
|
|
7278
7490
|
const results = list.map((p) => projectPersonaForJson(p, includeStyleGuide));
|
|
7279
|
-
|
|
7491
|
+
await emitCliJsonOrSnapshot(
|
|
7492
|
+
{ jsonOut: options.jsonOut },
|
|
7493
|
+
{
|
|
7494
|
+
section: "persona-list",
|
|
7495
|
+
commandLabel: "persona list",
|
|
7496
|
+
payload: { results, totalResultCount: total },
|
|
7497
|
+
idSuffix: options.id
|
|
7498
|
+
}
|
|
7499
|
+
);
|
|
7280
7500
|
if (!options.name && !options.id) {
|
|
7281
|
-
console.log(
|
|
7501
|
+
console.log(
|
|
7502
|
+
"\n\u4EBA\u8BBE\u6570\u636E\u5DF2\u843D\u76D8\u3002\u8BF7\u6CE8\u610F\uFF1A\u5982\u9700\u4E3A\u7528\u6237\u5199\u6587\u6848\uFF0C\u8BF7\u52A1\u5FC5\u8BE2\u95EE\u7528\u6237\u9009\u62E9\u5177\u4F53\u7684\u4EBA\u8BBE\uFF0C\u5207\u52FF\u9ED8\u8BA4\u6216\u64C5\u81EA\u66FF\u7528\u6237\u51B3\u5B9A\u3002"
|
|
7503
|
+
);
|
|
7282
7504
|
}
|
|
7283
7505
|
return;
|
|
7284
7506
|
}
|
|
@@ -7309,20 +7531,24 @@ ${hint}`);
|
|
|
7309
7531
|
const tableOpts2 = options.unicode ? { plain: false } : void 0;
|
|
7310
7532
|
printCliTable(rows, columns, tableOpts2);
|
|
7311
7533
|
if (!options.name && !options.id) {
|
|
7312
|
-
console.log(
|
|
7534
|
+
console.log(
|
|
7535
|
+
"\n\u63D0\u793A\uFF1A\u4EBA\u8BBE\u5217\u8868\u5DF2\u8F93\u51FA\u3002\u8BF7\u6CE8\u610F\uFF1A\u5982\u9700\u4E3A\u7528\u6237\u5199\u6587\u6848\uFF0C\u8BF7\u52A1\u5FC5\u8BE2\u95EE\u7528\u6237\u9009\u62E9\u5177\u4F53\u7684\u4EBA\u8BBE\uFF0C\u5207\u52FF\u9ED8\u8BA4\u6216\u64C5\u81EA\u66FF\u7528\u6237\u51B3\u5B9A\u3002"
|
|
7536
|
+
);
|
|
7313
7537
|
}
|
|
7314
|
-
console.log(
|
|
7538
|
+
console.log(
|
|
7539
|
+
"\n\u63D0\u793A\uFF1A\u5B8C\u6574 styleGuide\uFF08Markdown\uFF09\u8BF7\u4F7F\u7528 --json-out <\u76EE\u5F55\u6216 *.json> \u843D\u76D8\u540E\uFF0C\u7528\u811A\u672C\u8BFB\u53D6\u6BCF\u6761\u8BB0\u5F55\u7684 styleGuide \u5B57\u6BB5\u3002"
|
|
7540
|
+
);
|
|
7315
7541
|
}
|
|
7316
7542
|
function readStyleGuideFromFile(filePath) {
|
|
7317
|
-
const resolved =
|
|
7318
|
-
if (!
|
|
7543
|
+
const resolved = path15.resolve(process.cwd(), filePath);
|
|
7544
|
+
if (!fs15.existsSync(resolved)) {
|
|
7319
7545
|
throw new Error(`styleGuide \u6587\u4EF6\u4E0D\u5B58\u5728\uFF1A${resolved}`);
|
|
7320
7546
|
}
|
|
7321
|
-
const stat =
|
|
7547
|
+
const stat = fs15.statSync(resolved);
|
|
7322
7548
|
if (!stat.isFile()) {
|
|
7323
7549
|
throw new Error(`styleGuide \u6587\u4EF6\u8DEF\u5F84\u4E0D\u662F\u666E\u901A\u6587\u4EF6\uFF1A${resolved}`);
|
|
7324
7550
|
}
|
|
7325
|
-
return
|
|
7551
|
+
return fs15.readFileSync(resolved, "utf-8");
|
|
7326
7552
|
}
|
|
7327
7553
|
function unwrapAddPersona(raw) {
|
|
7328
7554
|
if (!raw || typeof raw !== "object") return null;
|
|
@@ -7408,10 +7634,6 @@ async function runPersonaCreate(options) {
|
|
|
7408
7634
|
process.exit(1);
|
|
7409
7635
|
}
|
|
7410
7636
|
const displayName = persona.personaName && persona.personaName.trim() ? persona.personaName.trim() : name;
|
|
7411
|
-
if (options.json) {
|
|
7412
|
-
console.log(JSON.stringify(persona, null, 2));
|
|
7413
|
-
return;
|
|
7414
|
-
}
|
|
7415
7637
|
console.log(`
|
|
7416
7638
|
\u2705 \u4EBA\u8BBE\u300C${displayName}\u300D\u5DF2\u4FDD\u5B58`);
|
|
7417
7639
|
console.log(` \u4EBA\u8BBE ID\uFF1A${persona.id}`);
|
|
@@ -7689,10 +7911,13 @@ async function runRagQuery(options) {
|
|
|
7689
7911
|
} else {
|
|
7690
7912
|
output = await fetchKnowledgesOne(subQueries[0]);
|
|
7691
7913
|
}
|
|
7692
|
-
if (options.
|
|
7693
|
-
|
|
7694
|
-
|
|
7695
|
-
|
|
7914
|
+
if (options.jsonOut) {
|
|
7915
|
+
await emitCliJsonOrSnapshot(
|
|
7916
|
+
{ jsonOut: options.jsonOut },
|
|
7917
|
+
{
|
|
7918
|
+
section: "rag-query",
|
|
7919
|
+
commandLabel: "rag query",
|
|
7920
|
+
payload: {
|
|
7696
7921
|
query: queryTxt,
|
|
7697
7922
|
...multiKeyword ? { subQueries, mergedCap } : {},
|
|
7698
7923
|
belongToId,
|
|
@@ -7700,10 +7925,8 @@ async function runRagQuery(options) {
|
|
|
7700
7925
|
topK: clamped,
|
|
7701
7926
|
output,
|
|
7702
7927
|
partition
|
|
7703
|
-
}
|
|
7704
|
-
|
|
7705
|
-
2
|
|
7706
|
-
)
|
|
7928
|
+
}
|
|
7929
|
+
}
|
|
7707
7930
|
);
|
|
7708
7931
|
return;
|
|
7709
7932
|
}
|
|
@@ -7800,10 +8023,13 @@ async function runRagList(options) {
|
|
|
7800
8023
|
if (options.ragOnly) {
|
|
7801
8024
|
folders = folders.filter((f) => f.ragStatus === true);
|
|
7802
8025
|
}
|
|
7803
|
-
if (options.
|
|
7804
|
-
|
|
7805
|
-
|
|
7806
|
-
|
|
8026
|
+
if (options.jsonOut) {
|
|
8027
|
+
await emitCliJsonOrSnapshot(
|
|
8028
|
+
{ jsonOut: options.jsonOut },
|
|
8029
|
+
{
|
|
8030
|
+
section: "rag-list",
|
|
8031
|
+
commandLabel: "rag list",
|
|
8032
|
+
payload: {
|
|
7807
8033
|
belongToId,
|
|
7808
8034
|
total: folders.length,
|
|
7809
8035
|
folders: folders.map((f) => ({
|
|
@@ -7812,10 +8038,8 @@ async function runRagList(options) {
|
|
|
7812
8038
|
ragStatus: f.ragStatus,
|
|
7813
8039
|
createTime: f.createTime
|
|
7814
8040
|
}))
|
|
7815
|
-
}
|
|
7816
|
-
|
|
7817
|
-
2
|
|
7818
|
-
)
|
|
8041
|
+
}
|
|
8042
|
+
}
|
|
7819
8043
|
);
|
|
7820
8044
|
return;
|
|
7821
8045
|
}
|
|
@@ -7857,7 +8081,7 @@ async function runRagList(options) {
|
|
|
7857
8081
|
}
|
|
7858
8082
|
|
|
7859
8083
|
// src/commands/config.ts
|
|
7860
|
-
import * as
|
|
8084
|
+
import * as fs16 from "fs";
|
|
7861
8085
|
function cmdConfigShow() {
|
|
7862
8086
|
const shared = readSharedConfig();
|
|
7863
8087
|
const envApiKey = process.env.SILUZAN_API_KEY;
|
|
@@ -7991,8 +8215,11 @@ function registerCsoCommands(program2) {
|
|
|
7991
8215
|
"all"
|
|
7992
8216
|
).option(
|
|
7993
8217
|
"--owner <owner>",
|
|
7994
|
-
"\u6309\u8D1F\u8D23\u4EBA\u8FC7\u6EE4\uFF08\u4F20\u5165\u7528\u6237 ID\uFF0C\u53EF\u4ECE --json \
|
|
7995
|
-
).option("--page <n>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09", "1").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 20\uFF09", "20").option(
|
|
8218
|
+
"\u6309\u8D1F\u8D23\u4EBA\u8FC7\u6EE4\uFF08\u4F20\u5165\u7528\u6237 ID\uFF0C\u53EF\u4ECE --json-out \u843D\u76D8\u6570\u636E\u7684 ownerInfo[].id \u5B57\u6BB5\u83B7\u53D6\uFF09"
|
|
8219
|
+
).option("--page <n>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09", "1").option("--page-size <n>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 20\uFF09", "20").option(
|
|
8220
|
+
"--json-out <path>",
|
|
8221
|
+
"\u5C06\u8D26\u53F7\u5217\u8868\uFF08\u542B\u603B\u89C8\u6570\u636E\uFF09\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8222
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII +-|\uFF09", false).option("--verbose", "\u663E\u793A\u5B8C\u6574\u4EE4\u724C\u6807\u8BC6\uFF08\u9ED8\u8BA4\u8131\u654F\uFF09", false).action(
|
|
7996
8223
|
async (opts) => {
|
|
7997
8224
|
const state = opts.state;
|
|
7998
8225
|
await runListAccounts({
|
|
@@ -8003,18 +8230,21 @@ function registerCsoCommands(program2) {
|
|
|
8003
8230
|
owner: opts.owner,
|
|
8004
8231
|
page: opts.page ? parseInt(opts.page, 10) : void 0,
|
|
8005
8232
|
pageSize: opts.pageSize ? parseInt(opts.pageSize, 10) : void 0,
|
|
8006
|
-
|
|
8233
|
+
jsonOut: opts.jsonOut,
|
|
8007
8234
|
unicode: opts.unicode,
|
|
8008
8235
|
verbose: opts.verbose
|
|
8009
8236
|
});
|
|
8010
8237
|
}
|
|
8011
8238
|
);
|
|
8012
8239
|
const accountGroupCmd = program2.command("account-group").description("\u8D26\u53F7\u5206\u7EC4\u7BA1\u7406\uFF1A\u67E5\u8BE2\u3001\u65B0\u5EFA\u3001\u7F16\u8F91\u3001\u5220\u9664\u5206\u7EC4");
|
|
8013
|
-
accountGroupCmd.command("list").description("\u67E5\u8BE2\u8D26\u53F7\u5206\u7EC4\u5217\u8868").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8240
|
+
accountGroupCmd.command("list").description("\u67E5\u8BE2\u8D26\u53F7\u5206\u7EC4\u5217\u8868").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8241
|
+
"--json-out <path>",
|
|
8242
|
+
"\u5C06\u5B8C\u6574\u5206\u7EC4\u6570\u636E\uFF08\u542B mediaAccountInfos\uFF09\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8243
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII +-|\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8014
8244
|
async (opts) => {
|
|
8015
8245
|
await runAccountGroupList({
|
|
8016
8246
|
token: opts.token,
|
|
8017
|
-
|
|
8247
|
+
jsonOut: opts.jsonOut,
|
|
8018
8248
|
unicode: opts.unicode,
|
|
8019
8249
|
verbose: opts.verbose
|
|
8020
8250
|
});
|
|
@@ -8022,71 +8252,65 @@ function registerCsoCommands(program2) {
|
|
|
8022
8252
|
);
|
|
8023
8253
|
accountGroupCmd.command("create").description("\u65B0\u5EFA\u8D26\u53F7\u5206\u7EC4").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--name <name>", "\u5206\u7EC4\u540D\u79F0").option(
|
|
8024
8254
|
"--accounts <ids>",
|
|
8025
|
-
"\u7EC4\u5185\u8D26\u53F7\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694\uFF08\u53EF\u4ECE list-accounts --json \u83B7\u53D6\uFF09"
|
|
8026
|
-
).option("--
|
|
8255
|
+
"\u7EC4\u5185\u8D26\u53F7\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694\uFF08\u53EF\u4ECE list-accounts --json-out \u843D\u76D8\u6570\u636E\u83B7\u53D6\uFF09"
|
|
8256
|
+
).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8027
8257
|
async (opts) => {
|
|
8028
8258
|
await runAccountGroupCreate({
|
|
8029
8259
|
token: opts.token,
|
|
8030
8260
|
name: opts.name,
|
|
8031
8261
|
accounts: opts.accounts,
|
|
8032
|
-
json: opts.json,
|
|
8033
8262
|
verbose: opts.verbose
|
|
8034
8263
|
});
|
|
8035
8264
|
}
|
|
8036
8265
|
);
|
|
8037
|
-
accountGroupCmd.command("update").description("\u7F16\u8F91\u5DF2\u6709\u8D26\u53F7\u5206\u7EC4\uFF08\u66F4\u65B0\u540D\u79F0\u6216\u8D26\u53F7\u5217\u8868\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").requiredOption("--name <name>", "\u65B0\u5206\u7EC4\u540D\u79F0").option("--accounts <ids>", "\u7EC4\u5185\u8D26\u53F7\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694\uFF1B\u4E0D\u4F20\u5219\u6E05\u7A7A\u5206\u7EC4\u5185\u8D26\u53F7").option("--
|
|
8266
|
+
accountGroupCmd.command("update").description("\u7F16\u8F91\u5DF2\u6709\u8D26\u53F7\u5206\u7EC4\uFF08\u66F4\u65B0\u540D\u79F0\u6216\u8D26\u53F7\u5217\u8868\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").requiredOption("--name <name>", "\u65B0\u5206\u7EC4\u540D\u79F0").option("--accounts <ids>", "\u7EC4\u5185\u8D26\u53F7\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694\uFF1B\u4E0D\u4F20\u5219\u6E05\u7A7A\u5206\u7EC4\u5185\u8D26\u53F7").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8038
8267
|
async (opts) => {
|
|
8039
8268
|
await runAccountGroupUpdate({
|
|
8040
8269
|
token: opts.token,
|
|
8041
8270
|
id: opts.id,
|
|
8042
8271
|
name: opts.name,
|
|
8043
8272
|
accounts: opts.accounts,
|
|
8044
|
-
json: opts.json,
|
|
8045
8273
|
verbose: opts.verbose
|
|
8046
8274
|
});
|
|
8047
8275
|
}
|
|
8048
8276
|
);
|
|
8049
|
-
accountGroupCmd.command("delete").description("\u5220\u9664\u8D26\u53F7\u5206\u7EC4\uFF08\u4E0D\u53EF\u5220\u9664\u300C\u672A\u5206\u7EC4\u300D\u865A\u62DF\u5206\u7EC4\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").option("--
|
|
8277
|
+
accountGroupCmd.command("delete").description("\u5220\u9664\u8D26\u53F7\u5206\u7EC4\uFF08\u4E0D\u53EF\u5220\u9664\u300C\u672A\u5206\u7EC4\u300D\u865A\u62DF\u5206\u7EC4\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
8050
8278
|
await runAccountGroupDelete({
|
|
8051
8279
|
token: opts.token,
|
|
8052
8280
|
id: opts.id,
|
|
8053
|
-
json: opts.json,
|
|
8054
8281
|
verbose: opts.verbose
|
|
8055
8282
|
});
|
|
8056
8283
|
});
|
|
8057
|
-
accountGroupCmd.command("add-accounts").description("\u5411\u5206\u7EC4\u8FFD\u52A0\u8D26\u53F7\uFF08\u81EA\u52A8\u5408\u5E76\uFF0C\u4E0D\u5F71\u54CD\u5DF2\u6709\u8D26\u53F7\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").requiredOption("--accounts <ids>", "\u8981\u6DFB\u52A0\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694").option("--
|
|
8058
|
-
|
|
8059
|
-
|
|
8060
|
-
|
|
8061
|
-
|
|
8062
|
-
|
|
8063
|
-
|
|
8064
|
-
|
|
8065
|
-
|
|
8066
|
-
|
|
8067
|
-
|
|
8068
|
-
|
|
8069
|
-
|
|
8070
|
-
|
|
8071
|
-
|
|
8072
|
-
|
|
8073
|
-
accounts: opts.accounts,
|
|
8074
|
-
json: opts.json,
|
|
8075
|
-
verbose: opts.verbose
|
|
8076
|
-
});
|
|
8077
|
-
}
|
|
8078
|
-
);
|
|
8284
|
+
accountGroupCmd.command("add-accounts").description("\u5411\u5206\u7EC4\u8FFD\u52A0\u8D26\u53F7\uFF08\u81EA\u52A8\u5408\u5E76\uFF0C\u4E0D\u5F71\u54CD\u5DF2\u6709\u8D26\u53F7\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").requiredOption("--accounts <ids>", "\u8981\u6DFB\u52A0\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
8285
|
+
await runAccountGroupAddAccounts({
|
|
8286
|
+
token: opts.token,
|
|
8287
|
+
id: opts.id,
|
|
8288
|
+
accounts: opts.accounts,
|
|
8289
|
+
verbose: opts.verbose
|
|
8290
|
+
});
|
|
8291
|
+
});
|
|
8292
|
+
accountGroupCmd.command("remove-accounts").description("\u4ECE\u5206\u7EC4\u79FB\u9664\u6307\u5B9A\u8D26\u53F7\uFF08\u4E0D\u5F71\u54CD\u5176\u4ED6\u5DF2\u6709\u8D26\u53F7\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").requiredOption("--id <groupId>", "\u5206\u7EC4 ID\uFF08\u6765\u81EA account-group list \u7684 id \u5B57\u6BB5\uFF09").requiredOption("--accounts <ids>", "\u8981\u79FB\u9664\u7684 mediaCustomerId\uFF0C\u9017\u53F7\u5206\u9694").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
8293
|
+
await runAccountGroupRemoveAccounts({
|
|
8294
|
+
token: opts.token,
|
|
8295
|
+
id: opts.id,
|
|
8296
|
+
accounts: opts.accounts,
|
|
8297
|
+
verbose: opts.verbose
|
|
8298
|
+
});
|
|
8299
|
+
});
|
|
8079
8300
|
const personaCmd = program2.command("persona").description("CSO \u4EBA\u8BBE\uFF1A\u67E5\u8BE2\u5E73\u53F0\u4EBA\u8BBE\u4E0E styleGuide\uFF08Markdown\uFF09");
|
|
8080
|
-
personaCmd.command("list").description("\u62C9\u53D6\u4EBA\u8BBE\u5217\u8868\uFF08POST /cso/v1/platformdata/GetPersonas\uFF0C\u4E0E Web \u7AEF\u4E00\u81F4\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--id <id>", "\u53EA\u663E\u793A\u6307\u5B9A\u4EBA\u8BBE id").option("--name <text>", "\u6309\u4EBA\u8BBE\u540D\u79F0\u5B50\u4E32\u8FC7\u6EE4").option(
|
|
8301
|
+
personaCmd.command("list").description("\u62C9\u53D6\u4EBA\u8BBE\u5217\u8868\uFF08POST /cso/v1/platformdata/GetPersonas\uFF0C\u4E0E Web \u7AEF\u4E00\u81F4\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--id <id>", "\u53EA\u663E\u793A\u6307\u5B9A\u4EBA\u8BBE id").option("--name <text>", "\u6309\u4EBA\u8BBE\u540D\u79F0\u5B50\u4E32\u8FC7\u6EE4").option(
|
|
8302
|
+
"--json-out <path>",
|
|
8303
|
+
"\u5C06\u5B8C\u6574\u4EBA\u8BBE\u6570\u636E\uFF08\u542B styleGuide\uFF09\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8304
|
+
).option(
|
|
8081
8305
|
"--no-style-guide",
|
|
8082
|
-
"\u642D\u914D --json\uFF1A\u7701\u7565 styleGuide\uFF0C\u4EC5\u8F93\u51FA styleGuideChars\uFF08\u5B57\u7B26\u6570\uFF09\u3002styleGuide \u901A\u5E38\u5F88\u957F\uFF0C\
|
|
8306
|
+
"\u642D\u914D --json-out\uFF1A\u7701\u7565 styleGuide\uFF0C\u4EC5\u8F93\u51FA styleGuideChars\uFF08\u5B57\u7B26\u6570\uFF09\u3002styleGuide \u901A\u5E38\u5F88\u957F\uFF0C\u9700\u8981\u5B8C\u6574\u5185\u5BB9\u65F6\u518D\u7528 --id \u5355\u72EC\u62C9\u53D6"
|
|
8083
8307
|
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII +-|\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8084
8308
|
async (opts) => {
|
|
8085
8309
|
await runPersonaList({
|
|
8086
8310
|
token: opts.token,
|
|
8087
8311
|
id: opts.id,
|
|
8088
8312
|
name: opts.name,
|
|
8089
|
-
|
|
8313
|
+
jsonOut: opts.jsonOut,
|
|
8090
8314
|
includeStyleGuide: opts.styleGuide,
|
|
8091
8315
|
unicode: opts.unicode,
|
|
8092
8316
|
verbose: opts.verbose
|
|
@@ -8095,17 +8319,19 @@ function registerCsoCommands(program2) {
|
|
|
8095
8319
|
);
|
|
8096
8320
|
personaCmd.command("create").description(
|
|
8097
8321
|
"\u4FDD\u5B58\u4EBA\u8BBE\u5230 CSO \u5E73\u53F0\uFF08POST /cso/v1/platformdata/AddPersona\uFF09\u3002styleGuide \u7531\u8C03\u7528\u65B9\u81EA\u884C\u751F\u6210\uFF0CCLI \u53EA\u8D1F\u8D23\u6301\u4E45\u5316"
|
|
8098
|
-
).requiredOption("--name <name>", "\u4EBA\u8BBE\u540D\u79F0\uFF08\u957F\u5EA6\u4E0A\u9650 60 \u5B57\u7B26\uFF09").option(
|
|
8322
|
+
).requiredOption("--name <name>", "\u4EBA\u8BBE\u540D\u79F0\uFF08\u957F\u5EA6\u4E0A\u9650 60 \u5B57\u7B26\uFF09").option(
|
|
8323
|
+
"--style-guide <markdown>",
|
|
8324
|
+
"\u76F4\u63A5\u4F20\u5165 styleGuide markdown \u5185\u5BB9\uFF08\u4E0E --style-guide-file \u4E8C\u9009\u4E00\uFF09"
|
|
8325
|
+
).option(
|
|
8099
8326
|
"--style-guide-file <path>",
|
|
8100
8327
|
"\u4ECE\u672C\u5730 markdown \u6587\u4EF6\u8BFB\u53D6 styleGuide\uFF08\u4E0E --style-guide \u4E8C\u9009\u4E00\uFF0C\u957F\u6587\u63A8\u8350\u7528\u6587\u4EF6\uFF09"
|
|
8101
|
-
).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8328
|
+
).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8102
8329
|
async (opts) => {
|
|
8103
8330
|
await runPersonaCreate({
|
|
8104
8331
|
name: opts.name,
|
|
8105
8332
|
styleGuide: opts.styleGuide,
|
|
8106
8333
|
styleGuideFile: opts.styleGuideFile,
|
|
8107
8334
|
token: opts.token,
|
|
8108
|
-
json: opts.json,
|
|
8109
8335
|
verbose: opts.verbose
|
|
8110
8336
|
});
|
|
8111
8337
|
}
|
|
@@ -8115,13 +8341,16 @@ function registerCsoCommands(program2) {
|
|
|
8115
8341
|
);
|
|
8116
8342
|
ragCmd.command("list").description(
|
|
8117
8343
|
"\u5217\u51FA\u5F53\u524D\u4F01\u4E1A\u4E0B\u6240\u6709\u77E5\u8BC6\u5E93\u6587\u4EF6\u5939\uFF08GET cutapi/v1/material/querylist\uFF09\uFF0C\u4F9B AI \u9009\u62E9\u68C0\u7D22\u8303\u56F4"
|
|
8118
|
-
).option("--belong-to-id <id>", "\u4F01\u4E1A ID\uFF1B\u4E0D\u4F20\u5219\u4ECE GET /query/account/me \u53D6 companyId").option("--rag-only", "\u4EC5\u663E\u793A\u5DF2\u5EFA RAG \u5411\u91CF\u7D22\u5F15\uFF08ragStatus=true\uFF09\u7684\u77E5\u8BC6\u5E93", false).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8344
|
+
).option("--belong-to-id <id>", "\u4F01\u4E1A ID\uFF1B\u4E0D\u4F20\u5219\u4ECE GET /query/account/me \u53D6 companyId").option("--rag-only", "\u4EC5\u663E\u793A\u5DF2\u5EFA RAG \u5411\u91CF\u7D22\u5F15\uFF08ragStatus=true\uFF09\u7684\u77E5\u8BC6\u5E93", false).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8345
|
+
"--json-out <path>",
|
|
8346
|
+
"\u5C06\u5B8C\u6574\u77E5\u8BC6\u5E93\u5217\u8868\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8347
|
+
).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8119
8348
|
async (opts) => {
|
|
8120
8349
|
await runRagList({
|
|
8121
8350
|
belongToId: opts.belongToId,
|
|
8122
8351
|
ragOnly: opts.ragOnly,
|
|
8123
8352
|
token: opts.token,
|
|
8124
|
-
|
|
8353
|
+
jsonOut: opts.jsonOut,
|
|
8125
8354
|
verbose: opts.verbose
|
|
8126
8355
|
});
|
|
8127
8356
|
}
|
|
@@ -8130,7 +8359,10 @@ function registerCsoCommands(program2) {
|
|
|
8130
8359
|
"--partition <wiki|default>",
|
|
8131
8360
|
"\u68C0\u7D22\u5206\u533A\uFF08queryknowledges \u7684 partition\uFF0C\u9ED8\u8BA4 default\uFF09",
|
|
8132
8361
|
"default"
|
|
8133
|
-
).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8362
|
+
).option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8363
|
+
"--json-out <path>",
|
|
8364
|
+
"\u5C06\u5B8C\u6574\u68C0\u7D22\u7ED3\u679C\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8365
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII +-|\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8134
8366
|
async (opts) => {
|
|
8135
8367
|
await runRagQuery({
|
|
8136
8368
|
query: opts.query,
|
|
@@ -8143,7 +8375,7 @@ function registerCsoCommands(program2) {
|
|
|
8143
8375
|
category: opts.category,
|
|
8144
8376
|
partition: opts.partition,
|
|
8145
8377
|
token: opts.token,
|
|
8146
|
-
|
|
8378
|
+
jsonOut: opts.jsonOut,
|
|
8147
8379
|
unicode: opts.unicode,
|
|
8148
8380
|
verbose: opts.verbose
|
|
8149
8381
|
});
|
|
@@ -8208,10 +8440,7 @@ function registerCsoCommands(program2) {
|
|
|
8208
8440
|
const workflowCmd = program2.command("workflow").description("\u5185\u5BB9\u521B\u4F5C\u5DE5\u4F5C\u6D41\u76F8\u5173\u547D\u4EE4\uFF1A\u6587\u6848\u6821\u9A8C\u7B49");
|
|
8209
8441
|
workflowCmd.command("validate").description(
|
|
8210
8442
|
"\u6821\u9A8C\u6587\u6848\uFF1A\u7EDF\u8BA1\u5B57\u6570\uFF08\u6C49\u5B57/\u5B57\u7B26/\u5355\u8BCD\uFF09\uFF0C\u6309 --min/--max \u68C0\u67E5\u5B57\u6570\u9650\u5236\uFF0C\u5E76\u68C0\u67E5\u4E09\u5E93\u7F16\u7801/\u6EAF\u6E90\u7B49\u5185\u90E8\u5185\u5BB9\u662F\u5426\u6CC4\u6F0F\u5230\u6210\u7A3F\u3002\u6587\u6848\u6765\u6E90\u652F\u6301 -f \u6587\u4EF6\u3001--text \u884C\u5185\u6587\u672C\u3001\u6216 stdin \u7BA1\u9053\uFF08\u5BBF\u4E3B\u65E0\u6587\u4EF6\u5DE5\u5177\u65F6\u7528\u540E\u4E24\u79CD\uFF09"
|
|
8211
|
-
).option("-f, --file <path>", "\u5F85\u6821\u9A8C\u7684\u6587\u6848\u6587\u4EF6\u8DEF\u5F84\uFF08.md / .txt\uFF09\uFF1B\u4E0E --text / stdin \u4E09\u9009\u4E00").option(
|
|
8212
|
-
"--text <content>",
|
|
8213
|
-
"\u76F4\u63A5\u4F20\u5165\u6587\u6848\u6B63\u6587\uFF08\u5BBF\u4E3B\u65E0\u6587\u4EF6\u5DE5\u5177\u65F6\u7528\uFF09\uFF1B\u4F18\u5148\u7EA7\u9AD8\u4E8E -f \u4E0E stdin"
|
|
8214
|
-
).option("--min <n>", "\u5B57\u6570\u4E0B\u9650\uFF08\u6309 --count-by \u53E3\u5F84\uFF09", parseInt).option("--max <n>", "\u5B57\u6570\u4E0A\u9650\uFF08\u6309 --count-by \u53E3\u5F84\uFF09", parseInt).option(
|
|
8443
|
+
).option("-f, --file <path>", "\u5F85\u6821\u9A8C\u7684\u6587\u6848\u6587\u4EF6\u8DEF\u5F84\uFF08.md / .txt\uFF09\uFF1B\u4E0E --text / stdin \u4E09\u9009\u4E00").option("--text <content>", "\u76F4\u63A5\u4F20\u5165\u6587\u6848\u6B63\u6587\uFF08\u5BBF\u4E3B\u65E0\u6587\u4EF6\u5DE5\u5177\u65F6\u7528\uFF09\uFF1B\u4F18\u5148\u7EA7\u9AD8\u4E8E -f \u4E0E stdin").option("--min <n>", "\u5B57\u6570\u4E0B\u9650\uFF08\u6309 --count-by \u53E3\u5F84\uFF09", parseInt).option("--max <n>", "\u5B57\u6570\u4E0A\u9650\uFF08\u6309 --count-by \u53E3\u5F84\uFF09", parseInt).option(
|
|
8215
8444
|
"--count-by <mode>",
|
|
8216
8445
|
"\u9650\u5236\u53E3\u5F84\uFF1Achars-no-space\uFF08\u4E0D\u542B\u7A7A\u767D\uFF0C\u9ED8\u8BA4\uFF09| chars\uFF08\u542B\u7A7A\u767D\uFF09| cjk\uFF08\u6C49\u5B57\uFF09| words\uFF08\u82F1\u6587\u5355\u8BCD\uFF09",
|
|
8217
8446
|
"chars-no-space"
|
|
@@ -8233,11 +8462,10 @@ function registerCsoCommands(program2) {
|
|
|
8233
8462
|
);
|
|
8234
8463
|
workflowCmd.command("load-libraries").description(
|
|
8235
8464
|
"\u6309\u5E73\u53F0\u52A0\u8F7D\u5185\u7F6E\u9ED8\u8BA4\u4E09\u5E93\uFF08\u6D41\u91CF\u56E0\u5B50/\u4EA7\u54C1\u8D44\u4EA7/\u70F9\u8C03\u65B9\u6CD5\uFF09\uFF0C\u5C06\u4E09\u4E2A\u6587\u4EF6\u5185\u5BB9\u5408\u5E76\u5199\u5165\u5355\u4E2A\u4E34\u65F6\u6587\u4EF6\u3002\u5E73\u53F0\u542B\u300C\u516C\u4F17\u53F7\u300D\u65F6\u4F18\u5148\u53D6\u4E13\u5C5E\u8D5B\u9053\u5305\uFF0C\u53D6\u4E0D\u5230\u56DE\u9000\u5168\u5C40\u9ED8\u8BA4\u3002"
|
|
8236
|
-
).requiredOption("--platform <platform>", "\u5E73\u53F0 / \u6E20\u9053\uFF08\u5982\u300C\u516C\u4F17\u53F7\u300D\u300C\u6296\u97F3\u300D\u300CYouTube\u300D\uFF09").option("-o, --out <path>", "\u5408\u5E76\u8F93\u51FA\u6587\u4EF6\u8DEF\u5F84\uFF1B\u7F3A\u7701\u5199\u5165 ~/.siluzan/content-library/.cache/").option("--
|
|
8465
|
+
).requiredOption("--platform <platform>", "\u5E73\u53F0 / \u6E20\u9053\uFF08\u5982\u300C\u516C\u4F17\u53F7\u300D\u300C\u6296\u97F3\u300D\u300CYouTube\u300D\uFF09").option("-o, --out <path>", "\u5408\u5E76\u8F93\u51FA\u6587\u4EF6\u8DEF\u5F84\uFF1B\u7F3A\u7701\u5199\u5165 ~/.siluzan/content-library/.cache/").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
8237
8466
|
await runLoadLibraries({
|
|
8238
8467
|
platform: opts.platform,
|
|
8239
8468
|
out: opts.out,
|
|
8240
|
-
json: opts.json,
|
|
8241
8469
|
verbose: opts.verbose
|
|
8242
8470
|
});
|
|
8243
8471
|
});
|
|
@@ -8264,7 +8492,10 @@ function registerCsoCommands(program2) {
|
|
|
8264
8492
|
).option("--start <date>", "\u5F00\u59CB\u65F6\u95F4\uFF08\u672C\u5730\u65F6\u533A\uFF0CYYYY-MM-DD \u6216 ISO \u65E5\u671F\u65F6\u95F4\uFF09").option("--end <date>", "\u7ED3\u675F\u65F6\u95F4\uFF08\u672C\u5730\u65F6\u533A\uFF0CYYYY-MM-DD \u6216 ISO \u65E5\u671F\u65F6\u95F4\uFF09").option("--method <Day|Week|Moth>", "\u805A\u5408\u7EF4\u5EA6\uFF08\u4E0E Web table \u4FDD\u6301\u4E00\u81F4\uFF09", "Day").option(
|
|
8265
8493
|
"--include <modules...>",
|
|
8266
8494
|
"\u9700\u8981\u62C9\u53D6\u7684\u6A21\u5757\uFF0C\u652F\u6301\u9017\u53F7\u5206\u9694\uFF1Aoperation,total-fans,fans-analysis,hot-topic,works,hot-comment-word,comment-top10,video-duration,video-distribution,comment-trend,fans-trend,new-fans-trend,homepage-visit"
|
|
8267
|
-
).option("--order <play|digg|fullplay>", "works \u6A21\u5757\u6392\u5E8F\u5B57\u6BB5", "play").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8495
|
+
).option("--order <play|digg|fullplay>", "works \u6A21\u5757\u6392\u5E8F\u5B57\u6BB5", "play").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8496
|
+
"--json-out <path>",
|
|
8497
|
+
"\u5C06\u5B8C\u6574\u62A5\u8868\u6570\u636E\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8498
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8268
8499
|
async (opts) => {
|
|
8269
8500
|
await runReportFetch({
|
|
8270
8501
|
...opts,
|
|
@@ -8272,7 +8503,10 @@ function registerCsoCommands(program2) {
|
|
|
8272
8503
|
});
|
|
8273
8504
|
}
|
|
8274
8505
|
);
|
|
8275
|
-
reportCmd.command("records").description("\u67E5\u8BE2\u8FD0\u8425\u62A5\u8868\u5BFC\u51FA\u8BB0\u5F55\uFF08\u5BF9\u5E94 table \u5BFC\u51FA\u8BB0\u5F55\u5F39\u7A97\uFF09").option("--page <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--page-size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 20\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8506
|
+
reportCmd.command("records").description("\u67E5\u8BE2\u8FD0\u8425\u62A5\u8868\u5BFC\u51FA\u8BB0\u5F55\uFF08\u5BF9\u5E94 table \u5BFC\u51FA\u8BB0\u5F55\u5F39\u7A97\uFF09").option("--page <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--page-size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 20\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8507
|
+
"--json-out <path>",
|
|
8508
|
+
"\u5C06\u5B8C\u6574\u5BFC\u51FA\u8BB0\u5F55\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8509
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8276
8510
|
async (opts) => {
|
|
8277
8511
|
await runReportRecords(opts);
|
|
8278
8512
|
}
|
|
@@ -8284,12 +8518,18 @@ function registerCsoCommands(program2) {
|
|
|
8284
8518
|
planningCmd.command("enterprises").description("\u67E5\u8BE2\u4F01\u4E1A\u76EE\u5F55\uFF08cutapi querylist\uFF0C\u4F9B\u89C4\u5212\u751F\u6210\u65F6\u9009\u62E9\u4F01\u4E1A\uFF09").option(
|
|
8285
8519
|
"--belong-to-id <id>",
|
|
8286
8520
|
"\u7EC4\u7EC7\u5F52\u5C5E ID\uFF08companyId\uFF0C\u4EC5\u7528\u4E8E\u7B5B\u9009\u4F01\u4E1A\u76EE\u5F55\uFF1B\u4E0D\u53EF\u4F5C\u4E3A generate \u7684 --enterprise-id\uFF09"
|
|
8287
|
-
).option("--page-size <number>", "\u76EE\u5F55\u67E5\u8BE2\u6761\u6570\uFF08\u9ED8\u8BA4 100\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8521
|
+
).option("--page-size <number>", "\u76EE\u5F55\u67E5\u8BE2\u6761\u6570\uFF08\u9ED8\u8BA4 100\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8522
|
+
"--json-out <path>",
|
|
8523
|
+
"\u5C06\u5B8C\u6574\u4F01\u4E1A\u76EE\u5F55\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8524
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8288
8525
|
async (opts) => {
|
|
8289
8526
|
await runPlanningEnterprises(opts);
|
|
8290
8527
|
}
|
|
8291
8528
|
);
|
|
8292
|
-
planningCmd.command("content-types").description("\u67E5\u8BE2\u53EF\u7528\u5185\u5BB9\u7C7B\u578B\uFF08\u5931\u8D25\u65F6\u56DE\u9000\u9ED8\u8BA4 post/video\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8529
|
+
planningCmd.command("content-types").description("\u67E5\u8BE2\u53EF\u7528\u5185\u5BB9\u7C7B\u578B\uFF08\u5931\u8D25\u65F6\u56DE\u9000\u9ED8\u8BA4 post/video\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8530
|
+
"--json-out <path>",
|
|
8531
|
+
"\u5C06\u5B8C\u6574\u5185\u5BB9\u7C7B\u578B\u5217\u8868\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8532
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8293
8533
|
async (opts) => {
|
|
8294
8534
|
await runPlanningContentTypes(opts);
|
|
8295
8535
|
}
|
|
@@ -8297,13 +8537,10 @@ function registerCsoCommands(program2) {
|
|
|
8297
8537
|
planningCmd.command("generate").description("\u521B\u5EFA\u89C4\u5212\u751F\u6210\u4EFB\u52A1\uFF08\u5BF9\u5E94 planning \u751F\u6210\u5F39\u7A97\uFF09").requiredOption(
|
|
8298
8538
|
"--enterprise-id <id>",
|
|
8299
8539
|
"\u77E5\u8BC6\u5E93\u4F01\u4E1A ID\uFF08\u987B\u4E3A planning enterprises \u8FD4\u56DE\u7684 id\uFF0C\u4E0D\u662F --belong-to-id\uFF09"
|
|
8300
|
-
).requiredOption(
|
|
8301
|
-
"--enterprise-name <name>",
|
|
8302
|
-
"\u4F01\u4E1A\u540D\u79F0\uFF08\u987B\u4E3A planning enterprises \u8FD4\u56DE\u7684 name\uFF09"
|
|
8303
|
-
).requiredOption("--year-month <YYYY-MM>", "\u89C4\u5212\u6708\u4EFD").requiredOption("--content-types <types...>", "\u5185\u5BB9\u7C7B\u578B\uFF0C\u652F\u6301\u9017\u53F7\u6216\u7A7A\u683C\uFF1Apost,video").option("--partnership-total-months <6|12|24>", "\u5408\u4F5C\u603B\u6708\u6570\uFF08\u9ED8\u8BA4 12\uFF09", "12").option("--partnership-start-year-month <YYYY-MM>", "\u5408\u4F5C\u5F00\u59CB\u6708\u4EFD\uFF08\u4E0E\u89C4\u5212\u6708\u4E0D\u540C\u624D\u4F1A\u4F20\u7ED9\u63A5\u53E3\uFF09").option("--freq-unit <week|month>", "\u9891\u6B21\u5355\u4F4D").option("--freq-count <number>", "\u9891\u6B21\u6570\u91CF\uFF08\u4E0E --freq-unit \u540C\u65F6\u63D0\u4F9B\uFF09").option("--marketing-goal <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u8425\u9500\u76EE\u6807").option("--key-products <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u6838\u5FC3\u4EA7\u54C1").option(
|
|
8540
|
+
).requiredOption("--enterprise-name <name>", "\u4F01\u4E1A\u540D\u79F0\uFF08\u987B\u4E3A planning enterprises \u8FD4\u56DE\u7684 name\uFF09").requiredOption("--year-month <YYYY-MM>", "\u89C4\u5212\u6708\u4EFD").requiredOption("--content-types <types...>", "\u5185\u5BB9\u7C7B\u578B\uFF0C\u652F\u6301\u9017\u53F7\u6216\u7A7A\u683C\uFF1Apost,video").option("--partnership-total-months <6|12|24>", "\u5408\u4F5C\u603B\u6708\u6570\uFF08\u9ED8\u8BA4 12\uFF09", "12").option("--partnership-start-year-month <YYYY-MM>", "\u5408\u4F5C\u5F00\u59CB\u6708\u4EFD\uFF08\u4E0E\u89C4\u5212\u6708\u4E0D\u540C\u624D\u4F1A\u4F20\u7ED9\u63A5\u53E3\uFF09").option("--freq-unit <week|month>", "\u9891\u6B21\u5355\u4F4D").option("--freq-count <number>", "\u9891\u6B21\u6570\u91CF\uFF08\u4E0E --freq-unit \u540C\u65F6\u63D0\u4F9B\uFF09").option("--marketing-goal <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u8425\u9500\u76EE\u6807").option("--key-products <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u6838\u5FC3\u4EA7\u54C1").option(
|
|
8304
8541
|
"--target-markets <markets...>",
|
|
8305
8542
|
"\u76EE\u6807\u5E02\u573A\uFF1A\u5168\u7403\uFF08\u5355\u72EC\uFF09\u6216 \u4E2D\u4E9A/\u975E\u6D32/\u62C9\u7F8E/\u4E2D\u4E1C/\u72EC\u8054\u4F53/\u4E1C\u5357\u4E9A\uFF08\u53EF\u591A\u9009\uFF0C\u4E0D\u53EF\u4E0E\u5168\u7403\u540C\u9009\uFF09"
|
|
8306
|
-
).option("--key-events <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u5173\u952E\u8282\u70B9").option("--content-tone <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u5185\u5BB9\u8BED\u8C03").option("--watch", "\u63D0\u4EA4\u540E\u76D1\u542C\u4EFB\u52A1\u76F4\u5230\u5B8C\u6210/\u5931\u8D25", false).option("--watch-timeout <seconds>", "\u76D1\u542C\u8D85\u65F6\u79D2\u6570\uFF08\u9ED8\u8BA4 300 \u79D2\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8543
|
+
).option("--key-events <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u5173\u952E\u8282\u70B9").option("--content-tone <text>", "\u672C\u6708\u89C4\u5212\u91CD\u70B9\uFF1A\u5185\u5BB9\u8BED\u8C03").option("--watch", "\u63D0\u4EA4\u540E\u76D1\u542C\u4EFB\u52A1\u76F4\u5230\u5B8C\u6210/\u5931\u8D25", false).option("--watch-timeout <seconds>", "\u76D1\u542C\u8D85\u65F6\u79D2\u6570\uFF08\u9ED8\u8BA4 300 \u79D2\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8307
8544
|
async (opts) => {
|
|
8308
8545
|
await runPlanningGenerate(opts);
|
|
8309
8546
|
}
|
|
@@ -8311,47 +8548,61 @@ function registerCsoCommands(program2) {
|
|
|
8311
8548
|
planningCmd.command("list").description("\u67E5\u8BE2\u89C4\u5212\u4EFB\u52A1\u5217\u8868\uFF08\u652F\u6301\u4F01\u4E1A/\u6708\u5EA6\u7B5B\u9009\u4E0E\u5206\u9875\uFF09").option(
|
|
8312
8549
|
"--enterprise-id <id>",
|
|
8313
8550
|
"\u77E5\u8BC6\u5E93\u4F01\u4E1A ID\uFF08\u987B\u4E3A planning enterprises \u8FD4\u56DE\u7684 id\uFF0C\u4E0D\u662F --belong-to-id\uFF09"
|
|
8314
|
-
).option("--year-month <YYYY-MM>", "\u89C4\u5212\u6708\u4EFD").option("--page-index <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--page-size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 10\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8551
|
+
).option("--year-month <YYYY-MM>", "\u89C4\u5212\u6708\u4EFD").option("--page-index <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--page-size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 10\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8552
|
+
"--json-out <path>",
|
|
8553
|
+
"\u5C06\u5B8C\u6574\u89C4\u5212\u4EFB\u52A1\u5217\u8868\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8554
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8315
8555
|
async (opts) => {
|
|
8316
8556
|
await runPlanningList(opts);
|
|
8317
8557
|
}
|
|
8318
8558
|
);
|
|
8319
|
-
planningCmd.command("watch").description("\u76D1\u542C\u89C4\u5212\u4EFB\u52A1\u8FDB\u5EA6\uFF08SSE\uFF09").argument("<taskId>", "\u4EFB\u52A1 ID").option("--timeout <seconds>", "\u76D1\u542C\u8D85\u65F6\u79D2\u6570\uFF08\u9ED8\u8BA4 300 \u79D2\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8559
|
+
planningCmd.command("watch").description("\u76D1\u542C\u89C4\u5212\u4EFB\u52A1\u8FDB\u5EA6\uFF08SSE\uFF09").argument("<taskId>", "\u4EFB\u52A1 ID").option("--timeout <seconds>", "\u76D1\u542C\u8D85\u65F6\u79D2\u6570\uFF08\u9ED8\u8BA4 300 \u79D2\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8320
8560
|
async (taskId, opts) => {
|
|
8321
8561
|
await runPlanningWatchTask(taskId, opts);
|
|
8322
8562
|
}
|
|
8323
8563
|
);
|
|
8324
8564
|
const planningTaskCmd = planningCmd.command("task").description("\u89C4\u5212\u4EFB\u52A1\u64CD\u4F5C\uFF1A\u53D6\u6D88\u3001\u91CD\u8BD5\u3001\u5220\u9664");
|
|
8325
|
-
planningTaskCmd.command("cancel").description("\u53D6\u6D88\u4EFB\u52A1").argument("<taskId>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8565
|
+
planningTaskCmd.command("cancel").description("\u53D6\u6D88\u4EFB\u52A1").argument("<taskId>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (taskId, opts) => {
|
|
8326
8566
|
await runPlanningTaskCancel(taskId, opts);
|
|
8327
8567
|
});
|
|
8328
|
-
planningTaskCmd.command("retry").description("\u91CD\u8BD5\u5931\u8D25/\u53D6\u6D88\u4EFB\u52A1").argument("<taskId>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8568
|
+
planningTaskCmd.command("retry").description("\u91CD\u8BD5\u5931\u8D25/\u53D6\u6D88\u4EFB\u52A1").argument("<taskId>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (taskId, opts) => {
|
|
8329
8569
|
await runPlanningTaskRetry(taskId, opts);
|
|
8330
8570
|
});
|
|
8331
|
-
planningTaskCmd.command("delete").description("\u5220\u9664\u4EFB\u52A1").argument("<taskId>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8571
|
+
planningTaskCmd.command("delete").description("\u5220\u9664\u4EFB\u52A1").argument("<taskId>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (taskId, opts) => {
|
|
8332
8572
|
await runPlanningTaskDelete(taskId, opts);
|
|
8333
8573
|
});
|
|
8334
|
-
planningCmd.command("get").description("\u83B7\u53D6\u89C4\u5212\u8BE6\u60C5").argument("<planId>", "\u89C4\u5212 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8335
|
-
|
|
8336
|
-
|
|
8337
|
-
|
|
8574
|
+
planningCmd.command("get").description("\u83B7\u53D6\u89C4\u5212\u8BE6\u60C5").argument("<planId>", "\u89C4\u5212 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8575
|
+
"--json-out <path>",
|
|
8576
|
+
"\u5C06\u5B8C\u6574\u89C4\u5212\u8BE6\u60C5\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8577
|
+
).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8578
|
+
async (planId, opts) => {
|
|
8579
|
+
await runPlanningGet(planId, opts);
|
|
8580
|
+
}
|
|
8581
|
+
);
|
|
8582
|
+
planningCmd.command("regenerate").description("\u5BF9\u5DF2\u6709\u89C4\u5212\u53D1\u8D77\u518D\u751F\u6210").argument("<planId>", "\u89C4\u5212 ID").option("--watch", "\u63D0\u4EA4\u540E\u76D1\u542C\u4EFB\u52A1\u76F4\u5230\u5B8C\u6210/\u5931\u8D25", false).option("--watch-timeout <seconds>", "\u76D1\u542C\u8D85\u65F6\u79D2\u6570\uFF08\u9ED8\u8BA4 300 \u79D2\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8338
8583
|
async (planId, opts) => {
|
|
8339
8584
|
await runPlanningRegenerate(planId, opts);
|
|
8340
8585
|
}
|
|
8341
8586
|
);
|
|
8342
8587
|
const planningExportCmd = planningCmd.command("export").description("\u89C4\u5212\u5BFC\u51FA");
|
|
8343
|
-
planningExportCmd.command("txt").description("\u5BFC\u51FA\u89C4\u5212\u4E3A TXT\uFF08Markdown \u8868\u683C\u683C\u5F0F\uFF09").option("--plan-id <id>", "\u89C4\u5212 ID\uFF08\u4E0E --input \u4E8C\u9009\u4E00\uFF09").option("--input <file>", "\u672C\u5730\u89C4\u5212 JSON \u6587\u4EF6\u8DEF\u5F84\uFF08\u4E0E --plan-id \u4E8C\u9009\u4E00\uFF09").option("-o, --output <file>", "\u5BFC\u51FA\u6587\u4EF6\u8DEF\u5F84\uFF08\u9ED8\u8BA4\u81EA\u52A8\u547D\u540D\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--
|
|
8588
|
+
planningExportCmd.command("txt").description("\u5BFC\u51FA\u89C4\u5212\u4E3A TXT\uFF08Markdown \u8868\u683C\u683C\u5F0F\uFF09").option("--plan-id <id>", "\u89C4\u5212 ID\uFF08\u4E0E --input \u4E8C\u9009\u4E00\uFF09").option("--input <file>", "\u672C\u5730\u89C4\u5212 JSON \u6587\u4EF6\u8DEF\u5F84\uFF08\u4E0E --plan-id \u4E8C\u9009\u4E00\uFF09").option("-o, --output <file>", "\u5BFC\u51FA\u6587\u4EF6\u8DEF\u5F84\uFF08\u9ED8\u8BA4\u81EA\u52A8\u547D\u540D\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8344
8589
|
async (opts) => {
|
|
8345
8590
|
await runPlanningExportTxt(opts);
|
|
8346
8591
|
}
|
|
8347
8592
|
);
|
|
8348
8593
|
const taskCmd = program2.command("task").description("\u4EFB\u52A1\u7BA1\u7406\uFF08taskManage\uFF09\uFF1A\u5217\u8868\u7B5B\u9009\u3001\u8BE6\u60C5\u3001\u4EFB\u52A1\u64CD\u4F5C\u3001\u53D1\u5E03\u9879\u64CD\u4F5C\u3001\u8BC4\u8BBA\u64CD\u4F5C");
|
|
8349
|
-
taskCmd.command("list").description("\u67E5\u8BE2\u4EFB\u52A1\u5217\u8868\uFF08\u652F\u6301\u72B6\u6001/\u65F6\u95F4/\u7C7B\u578B/\u5173\u952E\u8BCD/\u5F02\u5E38\u4EFB\u52A1\u7B5B\u9009\uFF09").option("--page <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 10\uFF09").option("--status <-1|0|1|2>", "\u72B6\u6001\uFF1A-1 \u5168\u90E8\uFF0C0 \u6267\u884C\u4E2D\uFF0C1 \u5DF2\u5B8C\u6210\uFF0C2 \u5DF2\u4E2D\u6B62").option("--asc", "\u6309\u521B\u5EFA\u65F6\u95F4\u5347\u5E8F\uFF08\u9ED8\u8BA4\u964D\u5E8F\uFF09", false).option("--search-type <task-name|creator>", "\u5173\u952E\u8BCD\u5B57\u6BB5\uFF08\u9ED8\u8BA4 task-name\uFF09", "task-name").option("--keyword <text>", "\u5173\u952E\u8BCD\uFF08\u914D\u5408 --search-type \u4F7F\u7528\uFF09").option("--creator <name>", "\u6309\u521B\u5EFA\u4EBA\u7B5B\u9009\uFF08\u4F18\u5148\u7EA7\u9AD8\u4E8E --keyword + --search-type creator\uFF09").option("--mine", "\u4EC5\u770B\u6211\u521B\u5EFA\u7684\uFF08\u9700\u540C\u65F6\u63D0\u4F9B --mine-name\uFF09", false).option("--mine-name <name>", "\u6211\u7684\u7528\u6237\u540D\uFF08\u7528\u4E8E --mine\uFF09").option("--failed-only", "\u4EC5\u67E5\u770B\u5F02\u5E38\u4EFB\u52A1\uFF08nolyFailed=true\uFF09", false).option("--content-type <all|video|image-text>", "\u5185\u5BB9\u7C7B\u578B\u7B5B\u9009", "all").option("--date-preset <all|week|month|year>", "\u5FEB\u6377\u65F6\u95F4\u8303\u56F4", "all").option("--start-date <YYYY-MM-DD>", "\u81EA\u5B9A\u4E49\u5F00\u59CB\u65E5\u671F\uFF08\u4E0E --end-date \u540C\u65F6\u4F7F\u7528\uFF09").option("--end-date <YYYY-MM-DD>", "\u81EA\u5B9A\u4E49\u7ED3\u675F\u65E5\u671F\uFF08\u4E0E --start-date \u540C\u65F6\u4F7F\u7528\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8594
|
+
taskCmd.command("list").description("\u67E5\u8BE2\u4EFB\u52A1\u5217\u8868\uFF08\u652F\u6301\u72B6\u6001/\u65F6\u95F4/\u7C7B\u578B/\u5173\u952E\u8BCD/\u5F02\u5E38\u4EFB\u52A1\u7B5B\u9009\uFF09").option("--page <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 10\uFF09").option("--status <-1|0|1|2>", "\u72B6\u6001\uFF1A-1 \u5168\u90E8\uFF0C0 \u6267\u884C\u4E2D\uFF0C1 \u5DF2\u5B8C\u6210\uFF0C2 \u5DF2\u4E2D\u6B62").option("--asc", "\u6309\u521B\u5EFA\u65F6\u95F4\u5347\u5E8F\uFF08\u9ED8\u8BA4\u964D\u5E8F\uFF09", false).option("--search-type <task-name|creator>", "\u5173\u952E\u8BCD\u5B57\u6BB5\uFF08\u9ED8\u8BA4 task-name\uFF09", "task-name").option("--keyword <text>", "\u5173\u952E\u8BCD\uFF08\u914D\u5408 --search-type \u4F7F\u7528\uFF09").option("--creator <name>", "\u6309\u521B\u5EFA\u4EBA\u7B5B\u9009\uFF08\u4F18\u5148\u7EA7\u9AD8\u4E8E --keyword + --search-type creator\uFF09").option("--mine", "\u4EC5\u770B\u6211\u521B\u5EFA\u7684\uFF08\u9700\u540C\u65F6\u63D0\u4F9B --mine-name\uFF09", false).option("--mine-name <name>", "\u6211\u7684\u7528\u6237\u540D\uFF08\u7528\u4E8E --mine\uFF09").option("--failed-only", "\u4EC5\u67E5\u770B\u5F02\u5E38\u4EFB\u52A1\uFF08nolyFailed=true\uFF09", false).option("--content-type <all|video|image-text>", "\u5185\u5BB9\u7C7B\u578B\u7B5B\u9009", "all").option("--date-preset <all|week|month|year>", "\u5FEB\u6377\u65F6\u95F4\u8303\u56F4", "all").option("--start-date <YYYY-MM-DD>", "\u81EA\u5B9A\u4E49\u5F00\u59CB\u65E5\u671F\uFF08\u4E0E --end-date \u540C\u65F6\u4F7F\u7528\uFF09").option("--end-date <YYYY-MM-DD>", "\u81EA\u5B9A\u4E49\u7ED3\u675F\u65E5\u671F\uFF08\u4E0E --start-date \u540C\u65F6\u4F7F\u7528\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8595
|
+
"--json-out <path>",
|
|
8596
|
+
"\u5C06\u5B8C\u6574\u4EFB\u52A1\u5217\u8868\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8597
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8350
8598
|
async (opts) => {
|
|
8351
8599
|
await runTaskList(opts);
|
|
8352
8600
|
}
|
|
8353
8601
|
);
|
|
8354
|
-
taskCmd.command("detail").description("\u67E5\u770B\u4EFB\u52A1\u8BE6\u60C5\u53D1\u5E03\u9879\u5217\u8868\uFF08\u5BF9\u5E94\u8BE6\u60C5\u62BD\u5C49\uFF09").requiredOption("--publish-id <id>", "\u4EFB\u52A1 ID").option("--media <nameOrId>", "\u5A92\u4F53\u7C7B\u578B\uFF08\u5982 Douyin / YouTube\uFF0C\u6216\u6570\u5B57 ID\uFF09").option("--page <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 10\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8602
|
+
taskCmd.command("detail").description("\u67E5\u770B\u4EFB\u52A1\u8BE6\u60C5\u53D1\u5E03\u9879\u5217\u8868\uFF08\u5BF9\u5E94\u8BE6\u60C5\u62BD\u5C49\uFF09").requiredOption("--publish-id <id>", "\u4EFB\u52A1 ID").option("--media <nameOrId>", "\u5A92\u4F53\u7C7B\u578B\uFF08\u5982 Douyin / YouTube\uFF0C\u6216\u6570\u5B57 ID\uFF09").option("--page <number>", "\u9875\u7801\uFF08\u9ED8\u8BA4 1\uFF09").option("--size <number>", "\u6BCF\u9875\u6761\u6570\uFF08\u9ED8\u8BA4 10\uFF09").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF1B\u4F18\u5148\u4E8E ~/.siluzan/config.json\uFF09").option(
|
|
8603
|
+
"--json-out <path>",
|
|
8604
|
+
"\u5C06\u5B8C\u6574\u4EFB\u52A1\u8BE6\u60C5\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8605
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8355
8606
|
async (opts) => {
|
|
8356
8607
|
await runTaskDetail(opts);
|
|
8357
8608
|
}
|
|
@@ -8370,11 +8621,9 @@ function registerCsoCommands(program2) {
|
|
|
8370
8621
|
await runTaskRename(opts);
|
|
8371
8622
|
}
|
|
8372
8623
|
);
|
|
8373
|
-
taskCmd.command("check-edit").description("\u68C0\u67E5\u4EFB\u52A1\u662F\u5426\u5141\u8BB8\u4FEE\u6539\uFF08\u5BF9\u5E94 checkAllowChange\uFF09").requiredOption("--publish-id <id>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF09").option("--
|
|
8374
|
-
|
|
8375
|
-
|
|
8376
|
-
}
|
|
8377
|
-
);
|
|
8624
|
+
taskCmd.command("check-edit").description("\u68C0\u67E5\u4EFB\u52A1\u662F\u5426\u5141\u8BB8\u4FEE\u6539\uFF08\u5BF9\u5E94 checkAllowChange\uFF09").requiredOption("--publish-id <id>", "\u4EFB\u52A1 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
8625
|
+
await runTaskCheckEdit(opts);
|
|
8626
|
+
});
|
|
8378
8627
|
const taskItemCmd = taskCmd.command("item").description("\u4EFB\u52A1\u53D1\u5E03\u9879\u64CD\u4F5C\uFF1A\u5220\u9664\u3001\u91CD\u65B0\u53D1\u5E03\u3001\u7ACB\u5373\u53D1\u5E03");
|
|
8379
8628
|
taskItemCmd.command("delete").description("\u5220\u9664\u5355\u4E2A\u53D1\u5E03\u9879\uFF08deletePublishItem\uFF09").requiredOption("--item-id <id>", "\u53D1\u5E03\u9879 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF09").option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(async (opts) => {
|
|
8380
8629
|
await runTaskItemDelete(opts);
|
|
@@ -8386,18 +8635,41 @@ function registerCsoCommands(program2) {
|
|
|
8386
8635
|
await runTaskItemRunNow(opts);
|
|
8387
8636
|
});
|
|
8388
8637
|
const taskCommentCmd = taskCmd.command("comment").description("\u4EFB\u52A1\u8BE6\u60C5\u4E2D\u7684\u8BC4\u8BBA\u67E5\u8BE2\u4E0E\u56DE\u590D");
|
|
8389
|
-
taskCommentCmd.command("list").description("\u6309\u89C6\u9891\u67E5\u8BE2\u8BC4\u8BBA\u5217\u8868").requiredOption("--media-type <nameOrId>", "\u5A92\u4F53\u7C7B\u578B\uFF08\u5982 Douyin / YouTube \u6216\u6570\u5B57 ID\uFF09").requiredOption("--video-id <id>", "\u89C6\u9891 ID").requiredOption("--media-customer-id <id>", "\u5A92\u4F53\u8D26\u53F7 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF09").option(
|
|
8638
|
+
taskCommentCmd.command("list").description("\u6309\u89C6\u9891\u67E5\u8BE2\u8BC4\u8BBA\u5217\u8868").requiredOption("--media-type <nameOrId>", "\u5A92\u4F53\u7C7B\u578B\uFF08\u5982 Douyin / YouTube \u6216\u6570\u5B57 ID\uFF09").requiredOption("--video-id <id>", "\u89C6\u9891 ID").requiredOption("--media-customer-id <id>", "\u5A92\u4F53\u8D26\u53F7 ID").option("-t, --token <token>", "Token\uFF08\u53EF\u9009\uFF09").option(
|
|
8639
|
+
"--json-out <path>",
|
|
8640
|
+
"\u5C06\u5B8C\u6574\u8BC4\u8BBA\u5217\u8868\u843D\u76D8\u5230\u76EE\u5F55\u6216 *.json \u6587\u4EF6\uFF0Cstdout \u4EC5\u4E00\u884C\u6458\u8981\uFF08\u9632\u5DE5\u5177\u6B7B\u5FAA\u73AF\uFF09"
|
|
8641
|
+
).option("--unicode", "\u4F7F\u7528 Unicode \u7EBF\u6846\u8868\u683C\uFF08\u9ED8\u8BA4 ASCII\uFF09", false).option("--verbose", "\u663E\u793A\u8BE6\u7EC6\u9519\u8BEF\u4FE1\u606F", false).action(
|
|
8390
8642
|
async (opts) => {
|
|
8391
8643
|
await runTaskCommentList(opts);
|
|
8392
8644
|
}
|
|
8393
8645
|
);
|
|
8394
8646
|
}
|
|
8395
8647
|
|
|
8648
|
+
// src/utils/deprecated-json-flag.ts
|
|
8649
|
+
function argvHasDeprecatedJsonFlag(argv) {
|
|
8650
|
+
const isWorkflowValidate = argv[2] === "workflow" && argv[3] === "validate";
|
|
8651
|
+
if (isWorkflowValidate) return false;
|
|
8652
|
+
return argv.some((a) => a === "--json" || a.startsWith("--json="));
|
|
8653
|
+
}
|
|
8654
|
+
|
|
8396
8655
|
// src/index.ts
|
|
8397
8656
|
installProcessHandlers();
|
|
8657
|
+
configureCliJsonSnapshot({
|
|
8658
|
+
cliPackage: "siluzan-cso-cli",
|
|
8659
|
+
resolveVersion: getCurrentVersion2,
|
|
8660
|
+
fieldGuideRefs: ["references/core/tips.md", "references/list-accounts.md", "references/rag.md"]
|
|
8661
|
+
});
|
|
8398
8662
|
var program = new Command();
|
|
8399
8663
|
program.name("siluzan-cso").description("Siluzan \u5E73\u53F0 Skill \u5DE5\u5177\uFF1A\u521D\u59CB\u5316\u3001\u8D26\u53F7\u67E5\u8BE2\u3001\u4E0A\u4F20\u3001\u56FE\u6587/\u89C6\u9891\u53D1\u5E03").version(getCurrentVersion2());
|
|
8664
|
+
program.hook("preAction", async () => {
|
|
8665
|
+
if (argvHasDeprecatedJsonFlag(process.argv)) {
|
|
8666
|
+
rejectDeprecatedJsonFlag(true, process.argv[2] ?? "siluzan-cso");
|
|
8667
|
+
}
|
|
8668
|
+
});
|
|
8400
8669
|
registerCsoCommands(program);
|
|
8670
|
+
if (argvHasDeprecatedJsonFlag(process.argv)) {
|
|
8671
|
+
rejectDeprecatedJsonFlag(true, process.argv[2] ?? "siluzan-cso");
|
|
8672
|
+
}
|
|
8401
8673
|
program.parse();
|
|
8402
8674
|
var activeCmd = process.argv[2];
|
|
8403
8675
|
if (activeCmd !== "update" && activeCmd !== "login" && activeCmd !== "send-login-code") {
|