Add safe knowledge document file editing
This commit is contained in:
1 parent
cbef6d0ef6
commit
b017e1fc48
16 files changed
+918
-138
No files matched your search
@@ -0,0 +1,165 @@
|
||||
import { afterEach, beforeEach, describe, expect, test } from "bun:test"
|
||||
import { existsSync, mkdirSync, mkdtempSync, readFileSync, rmSync, writeFileSync } from "node:fs"
|
||||
import { tmpdir } from "node:os"
|
||||
import { join } from "node:path"
|
||||
import { runCli } from "../runner.js"
|
||||
|
||||
const envKeys = ["SEAL_USE_ENTERPRISES_DIR", "SEAL_USE_CONFIG_FILE", "SEAL_USE_TOKEN_STORE", "SEAL_USE_USAGE_FILE"] as const
|
||||
const oldEnv = Object.fromEntries(envKeys.map(key => [key, process.env[key]]))
|
||||
const oldFetch = globalThis.fetch
|
||||
let dir: string
|
||||
let document = { id: "doc-1", title: "Fixture policy", purpose: "Testing", content: "Line one\\\r\n| a \\| b |", status: "published", enabled: true, scenarios: ["audit"], tags: ["test"] }
|
||||
let requests: Array<{ method: string; path: string; query: string; body?: Record<string, unknown> }>
|
||||
let failReadback: boolean
|
||||
const original = structuredClone(document)
|
||||
|
||||
beforeEach(() => {
|
||||
dir = mkdtempSync(join(tmpdir(), "seal-documents-cli-"))
|
||||
const enterprises = join(dir, "enterprises")
|
||||
mkdirSync(enterprises)
|
||||
process.env.SEAL_USE_ENTERPRISES_DIR = enterprises
|
||||
process.env.SEAL_USE_CONFIG_FILE = join(dir, "config.json")
|
||||
process.env.SEAL_USE_TOKEN_STORE = join(dir, "tokens.json")
|
||||
process.env.SEAL_USE_USAGE_FILE = join(dir, "usage.json")
|
||||
writeFileSync(join(enterprises, "document-cli-test.json"), JSON.stringify({
|
||||
id: "document-cli-test", name: "Document Test", environment: "test",
|
||||
seal: { url: "https://documents.example.test" },
|
||||
source: { type: "seal", token: "test-token", sealUrl: "https://documents.example.test", staffId: "fixture" }
|
||||
}))
|
||||
document = structuredClone(original)
|
||||
requests = []
|
||||
failReadback = false
|
||||
globalThis.fetch = (async (input: RequestInfo | URL, init?: RequestInit) => {
|
||||
const request = new Request(input, init)
|
||||
const url = new URL(request.url)
|
||||
const method = request.method
|
||||
const body = ["PATCH", "POST"].includes(method) ? JSON.parse(await request.text()) as Record<string, unknown> : undefined
|
||||
requests.push({ method, path: url.pathname, query: url.searchParams.toString(), body })
|
||||
if (failReadback && method === "GET" && requests.some(item => item.method === "PATCH")) return Response.json({ error: "offline" }, { status: 400 })
|
||||
if (method === "PATCH") document = { ...document, ...(body?.attributes as object) }
|
||||
if (method === "POST") document = { ...document, ...body }
|
||||
return Response.json({ data: url.pathname.endsWith("/articles") && method === "GET" ? { articles: [document], total: 115 } : document })
|
||||
}) as typeof fetch
|
||||
})
|
||||
|
||||
afterEach(() => {
|
||||
for (const key of envKeys) {
|
||||
if (oldEnv[key] === undefined) delete process.env[key]
|
||||
else process.env[key] = oldEnv[key]
|
||||
}
|
||||
globalThis.fetch = oldFetch
|
||||
rmSync(dir, { recursive: true, force: true })
|
||||
})
|
||||
|
||||
function cli(...argv: string[]) { return runCli(["documents", ...argv, "--corp", "document-cli-test"]) }
|
||||
const writes = () => requests.filter(request => request.method !== "GET")
|
||||
|
||||
describe("documents CLI", () => {
|
||||
test("exports body plus baseline, previews edits, and updates only body with JSON receipts", async () => {
|
||||
const out = join(dir, "body.txt")
|
||||
const exported = await cli("get", "doc-1", "--out", out)
|
||||
expect(exported.exitCode).toBe(0)
|
||||
expect(JSON.parse(exported.stdout)).toMatchObject({ contentFile: out, contentFormat: "raw" })
|
||||
expect(readFileSync(out, "utf8")).toBe(original.content)
|
||||
writeFileSync(out, "edited content")
|
||||
const preview = await cli("update", "doc-1", "--content-file", out, "--dry-run", "--yes")
|
||||
expect(preview.exitCode).toBe(0)
|
||||
expect(JSON.parse(preview.stdout)).toMatchObject({ preview: true, executed: false, baselineAvailable: true, changedFields: ["content"] })
|
||||
expect(writes()).toHaveLength(0)
|
||||
const result = await cli("update", "doc-1", "--content-file", out, "--yes")
|
||||
expect(result.exitCode).toBe(0)
|
||||
const payload = JSON.parse(result.stdout)
|
||||
expect(payload).toMatchObject({ verified: true, executed: true, baselineAvailable: true })
|
||||
expect(JSON.parse(readFileSync(payload.snapshotFile, "utf8")).document.content).toBe(original.content)
|
||||
expect(writes()).toHaveLength(1)
|
||||
expect(writes()[0]?.body).toEqual({ attributes: { content: "edited content" } })
|
||||
expect(document.title).toBe(original.title)
|
||||
expect(document.status).toBe("published")
|
||||
})
|
||||
|
||||
test("plain get and output-file still produce whole document JSON", async () => {
|
||||
expect(JSON.parse((await cli("get", "doc-1")).stdout)).toMatchObject(original)
|
||||
const path = join(dir, "document.json")
|
||||
const result = await cli("get", "doc-1", "--output-file", path)
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({ outputFile: path })
|
||||
expect(JSON.parse(readFileSync(path, "utf8"))).toMatchObject(original)
|
||||
})
|
||||
|
||||
test("lightweight list and explicit fields do not request per-document details", async () => {
|
||||
const summary = await cli("list", "--summary", "--limit", "2", "--offset", "1")
|
||||
expect(summary.exitCode).toBe(0)
|
||||
expect(JSON.parse(summary.stdout).articles[0]).not.toHaveProperty("content")
|
||||
expect(new URLSearchParams(requests[0]?.query).get("limit")).toBe("2")
|
||||
expect(new URLSearchParams(requests[0]?.query).get("offset")).toBe("1")
|
||||
const fields = await cli("list", "--summary", "--fields", "id,title")
|
||||
expect(JSON.parse(fields.stdout)).toEqual({ total: 115, articles: [{ id: "doc-1", title: original.title }] })
|
||||
expect(requests.every(request => request.path === "/api/v1/knowledge/articles")).toBe(true)
|
||||
expect((await cli("list", "--fields", "typo")).exitCode).toBe(2)
|
||||
})
|
||||
|
||||
test("all write commands require confirmation and all previews remain read-only", async () => {
|
||||
const variants = [
|
||||
["create", "--title", "new", "--purpose", "test", "--content", "new"],
|
||||
["update", "doc-1", "--content", "new"],
|
||||
["delete", "doc-1"]
|
||||
]
|
||||
for (const argv of variants) {
|
||||
expect((await cli(...argv)).exitCode).toBe(10)
|
||||
for (const flag of ["--dry-run", "--dryRun"]) {
|
||||
const result = await cli(...argv, flag, "--confirm")
|
||||
expect(result.exitCode).toBe(0)
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({ preview: true, executed: false })
|
||||
}
|
||||
}
|
||||
expect(writes()).toHaveLength(0)
|
||||
expect(existsSync(join(dir, "document-history"))).toBe(false)
|
||||
})
|
||||
|
||||
test("conflicts and failed readback return JSON state with nonzero exit codes", async () => {
|
||||
const path = join(dir, "body")
|
||||
await cli("get", "doc-1", "--out", path)
|
||||
writeFileSync(path, "my edit")
|
||||
document.content = "remote edit"
|
||||
const conflict = await cli("update", "doc-1", "--content-file", path, "--yes")
|
||||
expect(conflict.exitCode).toBe(1)
|
||||
expect(JSON.parse(conflict.stdout)).toMatchObject({ code: "DOCUMENT_CONFLICT", executed: false })
|
||||
expect(writes()).toHaveLength(0)
|
||||
failReadback = true
|
||||
const uncertain = await cli("update", "doc-1", "--content", "new", "--yes")
|
||||
expect(uncertain.exitCode).toBe(1)
|
||||
expect(JSON.parse(uncertain.stdout)).toMatchObject({ code: "DOCUMENT_READBACK_FAILED", executed: true, verified: false })
|
||||
expect(uncertain.stderr).toContain("Next action:")
|
||||
})
|
||||
|
||||
test("unsupported format and path/input conflicts fail before requests or file changes", async () => {
|
||||
const path = join(dir, "body")
|
||||
writeFileSync(path, "keep")
|
||||
for (const argv of [
|
||||
["get", "doc-1", "--out", path, "--content-format", "markdown"],
|
||||
["get", "doc-1", "--out", path, "--output-file", path],
|
||||
["update", "doc-1", "--content-file", path, "--content", "other", "--yes"],
|
||||
["update", "doc-1", "--content-file", path, "--output-file", path, "--yes"],
|
||||
["update", "doc-1", "--content-file", path, "--output-file", `${path}.seal-use.json`, "--yes"]
|
||||
]) expect((await cli(...argv)).exitCode).toBe(2)
|
||||
expect(readFileSync(path, "utf8")).toBe("keep")
|
||||
expect(requests).toHaveLength(0)
|
||||
})
|
||||
|
||||
test("invalid UTF-8, missing file and damaged baseline fail with exit 13 and zero writes", async () => {
|
||||
const path = join(dir, "body")
|
||||
expect((await cli("update", "doc-1", "--content-file", path, "--yes")).exitCode).toBe(13)
|
||||
writeFileSync(path, Buffer.from([0xff]))
|
||||
expect((await cli("update", "doc-1", "--content-file", path, "--yes")).exitCode).toBe(13)
|
||||
writeFileSync(path, "new")
|
||||
writeFileSync(`${path}.seal-use.json`, "{}")
|
||||
expect((await cli("update", "doc-1", "--content-file", path, "--yes")).exitCode).toBe(13)
|
||||
expect(writes()).toHaveLength(0)
|
||||
})
|
||||
|
||||
test("legacy raw input is supported and discloses absence of an editing baseline", async () => {
|
||||
const result = await cli("update", "doc-1", "--content", "new", "--confirm")
|
||||
expect(result.exitCode).toBe(0)
|
||||
expect(JSON.parse(result.stdout)).toMatchObject({ verified: true, baselineAvailable: false })
|
||||
expect(result.stderr).toContain("baselineAvailable:false")
|
||||
})
|
||||
})
|
||||
@@ -1,8 +1,11 @@
|
||||
import { readFileSync } from "node:fs";
|
||||
import { resolve } from "node:path";
|
||||
import type { CorpConfig } from "../../core/config/types.js";
|
||||
import type { createSealClient } from "../../core/http/factory.js";
|
||||
import { confirmationRequired, usageError } from "../../core/errors.js";
|
||||
import { runCapability } from "../helpers.js";
|
||||
import { usageError } from "../../core/errors.js";
|
||||
import { runCapability, runCapabilityResult } from "../helpers.js";
|
||||
import { exportDocument, readDocumentBaseline, readDocumentText } from "../../domains/seal/documents/files.js";
|
||||
import { DocumentMutationError } from "../../domains/seal/documents/service.js";
|
||||
import { ApprovalDocumentSchema } from "../../domains/seal/types.js";
|
||||
import {
|
||||
booleanOption,
|
||||
jsonObject,
|
||||
@@ -10,17 +13,25 @@ import {
|
||||
splitOption,
|
||||
stringOption
|
||||
} from "../parser.js";
|
||||
import { outputOptions } from "../printer.js";
|
||||
import { outputOptions, printJson } from "../printer.js";
|
||||
import type { ParsedArgs } from "../types.js";
|
||||
|
||||
function readContentInput(args: ParsedArgs, payload: Record<string, unknown>): string | undefined {
|
||||
const filePath =
|
||||
function contentFilePath(args: ParsedArgs): string | undefined {
|
||||
return (
|
||||
stringOption(args.options.contentFile) ??
|
||||
stringOption(args.options["content-file"]) ??
|
||||
stringOption(args.options.file) ??
|
||||
stringOption(args.options.f);
|
||||
stringOption(args.options.f)
|
||||
);
|
||||
}
|
||||
|
||||
function readContentInput(args: ParsedArgs, payload: Record<string, unknown>): string | undefined {
|
||||
const filePath = contentFilePath(args);
|
||||
const fileInputs = ["contentFile", "content-file", "file", "f"].filter(key => args.options[key] !== undefined).length;
|
||||
const sources = fileInputs + Number(args.options.content !== undefined) + Number(payload.content !== undefined);
|
||||
if (sources > 1) throw usageError("Specify exactly one document content source: --content-file, --content, or JSON content");
|
||||
if (filePath) {
|
||||
return readFileSync(filePath, "utf8");
|
||||
return readDocumentText(filePath);
|
||||
}
|
||||
const direct = stringOption(args.options.content);
|
||||
if (direct !== undefined) return direct;
|
||||
@@ -34,6 +45,33 @@ export async function handleDocumentsCommand(
|
||||
corp: CorpConfig,
|
||||
args: ParsedArgs
|
||||
) {
|
||||
const out = stringOption(args.options.out);
|
||||
const format = stringOption(args.options["content-format"]) ?? stringOption(args.options.contentFormat);
|
||||
if (format !== undefined && format !== "raw") throw usageError("--content-format supports raw only; Markdown conversion requires a verified platform codec");
|
||||
if (out && action !== "get") throw usageError("--out is supported only by documents get");
|
||||
if (format !== undefined && !["get", "create", "update"].includes(action ?? "")) throw usageError("--content-format is supported only by documents get/create/update");
|
||||
if (out && outputOptions(args.options).outputFile) throw usageError("--out (body) and --output-file (JSON) are mutually exclusive");
|
||||
if (booleanOption(args.options.overwrite) && !out) throw usageError("--overwrite requires documents get --out");
|
||||
const contentPath = contentFilePath(args);
|
||||
const jsonOutput = outputOptions(args.options).outputFile;
|
||||
if (contentPath && jsonOutput && [resolve(contentPath), `${resolve(contentPath)}.seal-use.json`].includes(resolve(jsonOutput))) {
|
||||
throw usageError("--output-file must not overwrite the input body or its export baseline");
|
||||
}
|
||||
|
||||
const safety = {
|
||||
dryRun: booleanOption(args.options["dry-run"]) ?? booleanOption(args.options.dryRun),
|
||||
confirm: booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true,
|
||||
allowEmpty: booleanOption(args.options["allow-empty"]) ?? booleanOption(args.options.allowEmpty)
|
||||
};
|
||||
const mutate = async (name: string, params: Record<string, unknown>) => {
|
||||
try {
|
||||
printJson(await runCapabilityResult(name, client, corp, params), outputOptions(args.options));
|
||||
} catch (error) {
|
||||
if (error instanceof DocumentMutationError) printJson(error.payload, outputOptions(args.options));
|
||||
throw error;
|
||||
}
|
||||
};
|
||||
|
||||
if (!action || action === "list") {
|
||||
const scenarios = splitOption(args.options.scenarios);
|
||||
const limit = numberOption(args.options.limit);
|
||||
@@ -42,7 +80,7 @@ export async function handleDocumentsCommand(
|
||||
"sealApprovalDocumentsList",
|
||||
client,
|
||||
corp,
|
||||
{ scenarios, limit, offset },
|
||||
{ scenarios, limit, offset, summary: booleanOption(args.options.summary), fields: splitOption(args.options.fields) },
|
||||
outputOptions(args.options)
|
||||
);
|
||||
return;
|
||||
@@ -57,6 +95,11 @@ export async function handleDocumentsCommand(
|
||||
if (!documentId) {
|
||||
throw usageError("Usage: seal-use documents get <documentId> [--corp <corpId>]");
|
||||
}
|
||||
if (out) {
|
||||
const document = ApprovalDocumentSchema.parse(await runCapabilityResult("sealApprovalDocumentGet", client, corp, { documentId }));
|
||||
printJson(exportDocument(corp, document, out, booleanOption(args.options.overwrite)));
|
||||
return;
|
||||
}
|
||||
await runCapability(
|
||||
"sealApprovalDocumentGet",
|
||||
client,
|
||||
@@ -118,10 +161,8 @@ export async function handleDocumentsCommand(
|
||||
throw usageError("Usage: seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]");
|
||||
}
|
||||
|
||||
await runCapability(
|
||||
await mutate(
|
||||
"sealApprovalDocumentCreate",
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
title,
|
||||
purpose,
|
||||
@@ -130,9 +171,9 @@ export async function handleDocumentsCommand(
|
||||
status,
|
||||
enabled,
|
||||
scenarios,
|
||||
tags
|
||||
},
|
||||
outputOptions(args.options)
|
||||
tags,
|
||||
...safety
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -180,10 +221,11 @@ export async function handleDocumentsCommand(
|
||||
throw usageError("Usage: seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]");
|
||||
}
|
||||
|
||||
await runCapability(
|
||||
const filePath = contentFilePath(args);
|
||||
const baseline = filePath ? readDocumentBaseline(filePath) : undefined;
|
||||
if (content !== undefined && !baseline) console.error("Document input has no export baseline; changes made by others during editing cannot be detected (baselineAvailable:false).");
|
||||
await mutate(
|
||||
"sealApprovalDocumentUpdate",
|
||||
client,
|
||||
corp,
|
||||
{
|
||||
documentId,
|
||||
title,
|
||||
@@ -193,9 +235,10 @@ export async function handleDocumentsCommand(
|
||||
status,
|
||||
enabled,
|
||||
scenarios,
|
||||
tags
|
||||
},
|
||||
outputOptions(args.options)
|
||||
tags,
|
||||
baseline,
|
||||
...safety
|
||||
}
|
||||
);
|
||||
return;
|
||||
}
|
||||
@@ -209,19 +252,9 @@ export async function handleDocumentsCommand(
|
||||
if (!documentId) {
|
||||
throw usageError("Usage: seal-use documents delete <documentId> --yes [--corp <corpId>]");
|
||||
}
|
||||
const confirmed = booleanOption(args.options.yes) === true || booleanOption(args.options.confirm) === true;
|
||||
if (!confirmed) {
|
||||
throw confirmationRequired(
|
||||
`Refusing to delete document '${documentId}' without --yes.`,
|
||||
`seal-use documents delete ${documentId} --corp ${corp.id} --yes`
|
||||
);
|
||||
}
|
||||
await runCapability(
|
||||
await mutate(
|
||||
"sealApprovalDeleteDocument",
|
||||
client,
|
||||
corp,
|
||||
{ documentId },
|
||||
outputOptions(args.options)
|
||||
{ documentId, dryRun: safety.dryRun, confirm: safety.confirm }
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
+10
-10
@@ -1347,13 +1347,13 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
commands: [
|
||||
{
|
||||
name: "list",
|
||||
summary: "List approval knowledge documents",
|
||||
usage: ["seal-use documents list [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]"]
|
||||
summary: "List knowledge documents; --summary omits body, --fields selects explicit fields",
|
||||
usage: ["seal-use documents list [--summary] [--fields <id,title,purpose,updatedAt>] [--scenarios <audit,fill>] [--limit 50] [--offset 0] [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
name: "get",
|
||||
summary: "Get approval knowledge document details by ID",
|
||||
usage: ["seal-use documents get <documentId> [--corp <corpId>]"]
|
||||
summary: "Get document JSON, or export exact UTF-8 body plus baseline with --out; --output-file saves JSON",
|
||||
usage: ["seal-use documents get <documentId> [--out <path>] [--content-format raw] [--overwrite] [--corp <corpId>]"]
|
||||
},
|
||||
{
|
||||
name: "search",
|
||||
@@ -1362,22 +1362,22 @@ export const HELP_REGISTRY: AreaHelp[] = [
|
||||
},
|
||||
{
|
||||
name: "create",
|
||||
summary: "Create a new approval knowledge document",
|
||||
summary: "Preview with --dry-run; --yes/--confirm creates and verifies a knowledge document",
|
||||
usage: [
|
||||
"seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]"
|
||||
"seal-use documents create --title <title> --purpose <purpose> [--content <text>|--content-file <path>] [--content-format raw] [--allow-empty] [--type <policy|document|video|pdf|feishu_doc>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--dry-run|--yes|--confirm] [--corp <corpId>]"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "update",
|
||||
summary: "Update an approval knowledge document by ID",
|
||||
summary: "Preview changes; confirmed updates check export baseline, snapshot and verify readback",
|
||||
usage: [
|
||||
"seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--corp <corpId>]"
|
||||
"seal-use documents update <documentId> [--title <title>] [--purpose <purpose>] [--content <text>|--content-file <path>] [--content-format raw] [--allow-empty] [--type <policy|document|video|pdf|feishu_doc>] [--enabled <true|false>] [--scenarios <audit,fill>] [--tags <tag1,tag2>] [--status <published|draft>] [--dry-run|--yes|--confirm] [--corp <corpId>]"
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "delete",
|
||||
summary: "Delete an approval knowledge document by ID",
|
||||
usage: ["seal-use documents delete <documentId> --yes [--corp <corpId>]"]
|
||||
summary: "Preview deletion; --yes/--confirm snapshots the document before deleting it",
|
||||
usage: ["seal-use documents delete <documentId> [--dry-run|--yes|--confirm] [--corp <corpId>]"]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
+2
-2
@@ -23,7 +23,7 @@ import { usageError, validationError } from "../core/errors.js";
|
||||
|
||||
// Read with booleanOption(...) / Boolean(...) / presence check.
|
||||
export const BOOLEAN_FLAGS = new Set([
|
||||
"clear", "clear-max-file-size", "clearMaxFileSize", "latest", "show-secret", "showSecret",
|
||||
"allow-empty", "allowEmpty", "clear", "clear-max-file-size", "clearMaxFileSize", "latest", "show-secret", "showSecret",
|
||||
"V", "add", "all", "allow-unreviewed", "allowUnreviewed", "as-hose", "attachments", "auto",
|
||||
"auto-login", "autoLogin", "bg-save", "changelog", "check", "check-only",
|
||||
"completed-only", "completedOnly", "confirm", "count", "disable-attachment-cache", "disableAttachmentCache",
|
||||
@@ -47,7 +47,7 @@ export const VALUE_FLAGS = new Set([
|
||||
"access-token", "accessToken", "action", "add-approver-ids", "addApproverIds", "ai", "ai-accuracy", "aiAccuracy", "app-key", "app-security", "appKey", "appSecurity",
|
||||
"base-url", "batch", "batch-id", "batchId", "both", "both-accurate", "bothAccurate", "business-codes", "businessCodes",
|
||||
"channel", "chrome", "code", "comment", "concurrency", "confirm-code", "confirmCode", "content", "content-file", "content-hints", "content-type", "contentFile",
|
||||
"contentType", "context-chars", "contextLines", "corp", "corp-id", "corpId", "corporation-id", "corporationId", "date",
|
||||
"content-format", "contentFormat", "contentType", "context-chars", "contextLines", "corp", "corp-id", "corpId", "corporation-id", "corporationId", "date",
|
||||
"dedupe-by", "dedupeBy", "default", "departmentId", "dept", "desc",
|
||||
"description", "description-file", "descriptionFile", "dir", "doc-id-prefix", "doc-id-suffix",
|
||||
"docIdPrefix", "docIdSuffix", "document-id", "document-sn", "document-sns", "document-type",
|
||||
|
||||
@@ -61,6 +61,8 @@ describe("CLI read-only classification", () => {
|
||||
["expense", "--sn", "SN-FIXTURE", "--corp", "corp-a"],
|
||||
["data", "expenses", "--sn", "SN-FIXTURE", "--corp", "corp-a"],
|
||||
["documents", "get", "doc-1", "--corp", "corp-a"],
|
||||
["documents", "get", "doc-1", "--out", "./body.txt", "--corp", "corp-a"],
|
||||
["documents", "list", "--summary", "--fields", "id,title", "--corp", "corp-a"],
|
||||
["documents", "search", "差旅", "--corp", "corp-a"],
|
||||
["approval-runs", "get", "01a09dac-c688-767b-8eb4-37b945095585"],
|
||||
["approval-runs", "list", "--corp", "corp-a"],
|
||||
@@ -94,6 +96,7 @@ describe("CLI read-only classification", () => {
|
||||
["rules", "clear"],
|
||||
["documents", "create"],
|
||||
["documents", "update", "doc-1"],
|
||||
["documents", "update", "doc-1", "--content-file", "body.txt", "--dry-run", "--yes"],
|
||||
["documents", "delete", "doc-1"],
|
||||
["simulation", "create", "--mode", "hosecloud"],
|
||||
["deploy", "hosecloud", "sync", "sign-key"],
|
||||
|
||||
Reference in new issue
Block a user