ai-project-manage-cli 1.0.0

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.
Files changed (74) hide show
  1. package/README.md +29 -0
  2. package/dist/api/client.d.ts +14 -0
  3. package/dist/api/client.d.ts.map +1 -0
  4. package/dist/api/client.js +32 -0
  5. package/dist/api/client.js.map +1 -0
  6. package/dist/api/http.d.ts +21 -0
  7. package/dist/api/http.d.ts.map +1 -0
  8. package/dist/api/http.js +108 -0
  9. package/dist/api/http.js.map +1 -0
  10. package/dist/api/index.d.ts +6 -0
  11. package/dist/api/index.d.ts.map +1 -0
  12. package/dist/api/index.js +13 -0
  13. package/dist/api/index.js.map +1 -0
  14. package/dist/api/request-config.d.ts +16 -0
  15. package/dist/api/request-config.d.ts.map +1 -0
  16. package/dist/api/request-config.js +40 -0
  17. package/dist/api/request-config.js.map +1 -0
  18. package/dist/api/requirement.d.ts +112 -0
  19. package/dist/api/requirement.d.ts.map +1 -0
  20. package/dist/api/requirement.js +6 -0
  21. package/dist/api/requirement.js.map +1 -0
  22. package/dist/cli/commands/auth.d.ts +3 -0
  23. package/dist/cli/commands/auth.d.ts.map +1 -0
  24. package/dist/cli/commands/auth.js +72 -0
  25. package/dist/cli/commands/auth.js.map +1 -0
  26. package/dist/cli/commands/comment.d.ts +3 -0
  27. package/dist/cli/commands/comment.d.ts.map +1 -0
  28. package/dist/cli/commands/comment.js +57 -0
  29. package/dist/cli/commands/comment.js.map +1 -0
  30. package/dist/cli/commands/config.d.ts +3 -0
  31. package/dist/cli/commands/config.d.ts.map +1 -0
  32. package/dist/cli/commands/config.js +59 -0
  33. package/dist/cli/commands/config.js.map +1 -0
  34. package/dist/cli/commands/requirement.d.ts +3 -0
  35. package/dist/cli/commands/requirement.d.ts.map +1 -0
  36. package/dist/cli/commands/requirement.js +118 -0
  37. package/dist/cli/commands/requirement.js.map +1 -0
  38. package/dist/cli/commands/ws.d.ts +3 -0
  39. package/dist/cli/commands/ws.d.ts.map +1 -0
  40. package/dist/cli/commands/ws.js +67 -0
  41. package/dist/cli/commands/ws.js.map +1 -0
  42. package/dist/cli/credentials.d.ts +25 -0
  43. package/dist/cli/credentials.d.ts.map +1 -0
  44. package/dist/cli/credentials.js +52 -0
  45. package/dist/cli/credentials.js.map +1 -0
  46. package/dist/cli/exit-api-error.d.ts +2 -0
  47. package/dist/cli/exit-api-error.d.ts.map +1 -0
  48. package/dist/cli/exit-api-error.js +12 -0
  49. package/dist/cli/exit-api-error.js.map +1 -0
  50. package/dist/cli/session.d.ts +26 -0
  51. package/dist/cli/session.d.ts.map +1 -0
  52. package/dist/cli/session.js +41 -0
  53. package/dist/cli/session.js.map +1 -0
  54. package/dist/cli/ws-run-command.d.ts +10 -0
  55. package/dist/cli/ws-run-command.d.ts.map +1 -0
  56. package/dist/cli/ws-run-command.js +118 -0
  57. package/dist/cli/ws-run-command.js.map +1 -0
  58. package/dist/cli.d.ts +3 -0
  59. package/dist/cli.d.ts.map +1 -0
  60. package/dist/cli.js +38 -0
  61. package/dist/cli.js.map +1 -0
  62. package/dist/config-store.d.ts +19 -0
  63. package/dist/config-store.d.ts.map +1 -0
  64. package/dist/config-store.js +82 -0
  65. package/dist/config-store.js.map +1 -0
  66. package/dist/employee-ws-client.d.ts +42 -0
  67. package/dist/employee-ws-client.d.ts.map +1 -0
  68. package/dist/employee-ws-client.js +99 -0
  69. package/dist/employee-ws-client.js.map +1 -0
  70. package/dist/index.d.ts +6 -0
  71. package/dist/index.d.ts.map +1 -0
  72. package/dist/index.js +22 -0
  73. package/dist/index.js.map +1 -0
  74. package/package.json +46 -0
package/README.md ADDED
@@ -0,0 +1,29 @@
1
+ # ai-project-manage-cli (`apm`)
2
+
3
+ ## 配置与登录
4
+
5
+ ```bash
6
+ apm config set base-url http://localhost:3000
7
+ apm login -u <员工ID> # 按提示输入 CLI 口令;或 --password(勿写入 shell 历史)
8
+ apm config get base-url
9
+ apm logout # 清除 token / employeeId,保留 base-url
10
+ ```
11
+
12
+ 优先级(业务命令):`--base-url` / `--token` / `--employee-id` → 配置文件 `~/.config/apm/config.json`(或 `$XDG_CONFIG_HOME/apm/config.json`)→ `APM_BASE_URL` / `APM_TOKEN` / `APM_EMPLOYEE_ID`。
13
+
14
+ ## 业务子命令(示例)
15
+
16
+ ```bash
17
+ apm comment update --id 1 --content "新正文"
18
+
19
+ apm requirement version create --requirement-id 1 --content "版本说明"
20
+ apm requirement version create --requirement-id 1 --content "说明" --no-sync-requirement-content
21
+
22
+ apm requirement test-case import --requirement-id 1 --file ./cases.json
23
+
24
+ apm requirement branch set-status --requirement-id 1 --branch-name feat/x --status IN_DEVELOPMENT
25
+
26
+ apm requirement defect set-status --defect-id 1 --status RESOLVED
27
+ ```
28
+
29
+ 员工 CLI 口令为明文落库,在 Web 端编辑员工节点时填写,或通过 `POST /api/v1/employees/update` 传入 `cliPassword` 后再 `apm login`。
@@ -0,0 +1,14 @@
1
+ import { type ApiClient } from "listpage-http";
2
+ import { requestConfig } from "./request-config";
3
+ export type CreateApmClientOptions = {
4
+ /** 服务根地址,不含尾斜杠 */
5
+ baseUrl: string;
6
+ /** 员工 CLI token(与库表 `Employee.cliToken` 全等);登录调用可传空串 */
7
+ token: string;
8
+ /** 与 Bearer 一并发送;服务端要求与 token 对应行的 `Employee.id` 一致 */
9
+ employeeId?: number;
10
+ defaultTimeoutMs?: number;
11
+ };
12
+ export type ApmClient = ApiClient<typeof requestConfig>;
13
+ export declare function createApmClient(options: CreateApmClientOptions): ApmClient;
14
+ //# sourceMappingURL=client.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":"AAAA,OAAO,EAAmB,KAAK,SAAS,EAAE,MAAM,eAAe,CAAC;AAChE,OAAO,EAAE,aAAa,EAAE,MAAM,kBAAkB,CAAC;AAEjD,MAAM,MAAM,sBAAsB,GAAG;IACnC,kBAAkB;IAClB,OAAO,EAAE,MAAM,CAAC;IAChB,wDAAwD;IACxD,KAAK,EAAE,MAAM,CAAC;IACd,uDAAuD;IACvD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,gBAAgB,CAAC,EAAE,MAAM,CAAC;CAC3B,CAAC;AAMF,MAAM,MAAM,SAAS,GAAG,SAAS,CAAC,OAAO,aAAa,CAAC,CAAC;AAExD,wBAAgB,eAAe,CAAC,OAAO,EAAE,sBAAsB,GAAG,SAAS,CAqB1E"}
@@ -0,0 +1,32 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.createApmClient = createApmClient;
4
+ const listpage_http_1 = require("listpage-http");
5
+ const request_config_1 = require("./request-config");
6
+ function normalizeBaseUrl(url) {
7
+ return url.trim().replace(/\/+$/, "");
8
+ }
9
+ function createApmClient(options) {
10
+ const baseURL = `${normalizeBaseUrl(options.baseUrl)}/api/v1`;
11
+ const defaultHeaders = {};
12
+ if (options.employeeId != null && Number.isFinite(options.employeeId)) {
13
+ defaultHeaders["X-Apm-Employee-Id"] = String(options.employeeId);
14
+ }
15
+ return (0, listpage_http_1.createApiClient)(request_config_1.requestConfig, {
16
+ baseURL,
17
+ getToken: () => {
18
+ const t = options.token.trim();
19
+ return t.length > 0 ? t : undefined;
20
+ },
21
+ defaultHeaders,
22
+ defaultTimeout: options.defaultTimeoutMs ?? 30_000,
23
+ successCodes: [20000, 200, 201],
24
+ unauthorizedCodes: [],
25
+ onError(code, message, opts) {
26
+ if (opts?.quiet)
27
+ return;
28
+ console.error(`[APM API] ${String(code)}: ${message ?? "请求失败"}`);
29
+ },
30
+ });
31
+ }
32
+ //# sourceMappingURL=client.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"client.js","sourceRoot":"","sources":["../../src/api/client.ts"],"names":[],"mappings":";;AAmBA,0CAqBC;AAxCD,iDAAgE;AAChE,qDAAiD;AAYjD,SAAS,gBAAgB,CAAC,GAAW;IACnC,OAAO,GAAG,CAAC,IAAI,EAAE,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC;AACxC,CAAC;AAID,SAAgB,eAAe,CAAC,OAA+B;IAC7D,MAAM,OAAO,GAAG,GAAG,gBAAgB,CAAC,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC;IAC9D,MAAM,cAAc,GAA2B,EAAE,CAAC;IAClD,IAAI,OAAO,CAAC,UAAU,IAAI,IAAI,IAAI,MAAM,CAAC,QAAQ,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QACtE,cAAc,CAAC,mBAAmB,CAAC,GAAG,MAAM,CAAC,OAAO,CAAC,UAAU,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,IAAA,+BAAe,EAAC,8BAAa,EAAE;QACpC,OAAO;QACP,QAAQ,EAAE,GAAG,EAAE;YACb,MAAM,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,EAAE,CAAC;YAC/B,OAAO,CAAC,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,SAAS,CAAC;QACtC,CAAC;QACD,cAAc;QACd,cAAc,EAAE,OAAO,CAAC,gBAAgB,IAAI,MAAM;QAClD,YAAY,EAAE,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAC;QAC/B,iBAAiB,EAAE,EAAE;QACrB,OAAO,CAAC,IAAI,EAAE,OAAO,EAAE,IAA0B;YAC/C,IAAI,IAAI,EAAE,KAAK;gBAAE,OAAO;YACxB,OAAO,CAAC,KAAK,CAAC,aAAa,MAAM,CAAC,IAAI,CAAC,KAAK,OAAO,IAAI,MAAM,EAAE,CAAC,CAAC;QACnE,CAAC;KACF,CAAC,CAAC;AACL,CAAC"}
@@ -0,0 +1,21 @@
1
+ /**
2
+ * 与前端 listpage-http 约定一致:成功码与 { code, message, data } 包体。
3
+ */
4
+ export declare const APM_SUCCESS_CODES: readonly [20000, 200, 201];
5
+ export declare class ApmSdkError extends Error {
6
+ readonly httpStatus?: number | undefined;
7
+ readonly businessCode?: number | undefined;
8
+ readonly name = "ApmSdkError";
9
+ constructor(message: string, httpStatus?: number | undefined, businessCode?: number | undefined, options?: {
10
+ cause?: unknown;
11
+ });
12
+ }
13
+ export type CreateJsonTransportOptions = {
14
+ baseUrl: string;
15
+ token: string;
16
+ timeoutMs?: number;
17
+ fetch?: typeof fetch;
18
+ };
19
+ export type JsonPostFn = <Req, Res>(path: string, body: Req) => Promise<Res>;
20
+ export declare function createJsonPostTransport(options: CreateJsonTransportOptions): JsonPostFn;
21
+ //# sourceMappingURL=http.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.d.ts","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,eAAO,MAAM,iBAAiB,4BAA6B,CAAC;AAI5D,qBAAa,WAAY,SAAQ,KAAK;IAKlC,QAAQ,CAAC,UAAU,CAAC,EAAE,MAAM;IAC5B,QAAQ,CAAC,YAAY,CAAC,EAAE,MAAM;IALhC,SAAkB,IAAI,iBAAiB;gBAGrC,OAAO,EAAE,MAAM,EACN,UAAU,CAAC,EAAE,MAAM,YAAA,EACnB,YAAY,CAAC,EAAE,MAAM,YAAA,EAC9B,OAAO,CAAC,EAAE;QAAE,KAAK,CAAC,EAAE,OAAO,CAAA;KAAE;CAIhC;AAED,MAAM,MAAM,0BAA0B,GAAG;IACvC,OAAO,EAAE,MAAM,CAAC;IAChB,KAAK,EAAE,MAAM,CAAC;IACd,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,KAAK,CAAC,EAAE,OAAO,KAAK,CAAC;CACtB,CAAC;AAwCF,MAAM,MAAM,UAAU,GAAG,CAAC,GAAG,EAAE,GAAG,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,GAAG,KAAK,OAAO,CAAC,GAAG,CAAC,CAAC;AAE7E,wBAAgB,uBAAuB,CACrC,OAAO,EAAE,0BAA0B,GAClC,UAAU,CA0EZ"}
@@ -0,0 +1,108 @@
1
+ /**
2
+ * 与前端 listpage-http 约定一致:成功码与 { code, message, data } 包体。
3
+ */
4
+ export const APM_SUCCESS_CODES = [20000, 200, 201];
5
+ const SUCCESS_SET = new Set(APM_SUCCESS_CODES);
6
+ export class ApmSdkError extends Error {
7
+ httpStatus;
8
+ businessCode;
9
+ name = 'ApmSdkError';
10
+ constructor(message, httpStatus, businessCode, options) {
11
+ super(message, options);
12
+ this.httpStatus = httpStatus;
13
+ this.businessCode = businessCode;
14
+ }
15
+ }
16
+ function normalizeBaseUrl(url) {
17
+ return url.trim().replace(/\/+$/, '');
18
+ }
19
+ function isRecord(v) {
20
+ return typeof v === 'object' && v !== null && !Array.isArray(v);
21
+ }
22
+ function readMessage(body) {
23
+ if (!isRecord(body))
24
+ return undefined;
25
+ const m = body.message ?? body.msg ?? body.error;
26
+ return typeof m === 'string' ? m : undefined;
27
+ }
28
+ function readBusinessCode(body) {
29
+ if (!isRecord(body))
30
+ return undefined;
31
+ const c = body.code;
32
+ return typeof c === 'number' ? c : undefined;
33
+ }
34
+ function unwrapEnvelope(body, httpStatus) {
35
+ if (!isRecord(body) || typeof body.code !== 'number') {
36
+ return body;
37
+ }
38
+ const env = body;
39
+ if (!SUCCESS_SET.has(env.code)) {
40
+ throw new ApmSdkError(readMessage(body) ?? `业务错误 code=${env.code}`, httpStatus, env.code);
41
+ }
42
+ if (env.data === undefined) {
43
+ throw new ApmSdkError('成功响应缺少 data 字段', httpStatus, env.code);
44
+ }
45
+ return env.data;
46
+ }
47
+ export function createJsonPostTransport(options) {
48
+ const base = normalizeBaseUrl(options.baseUrl);
49
+ const token = options.token;
50
+ const timeoutMs = options.timeoutMs ?? 30_000;
51
+ const fetchFn = options.fetch ?? globalThis.fetch;
52
+ if (typeof fetchFn !== 'function') {
53
+ throw new ApmSdkError('当前环境没有 fetch,请在 options 中传入 fetch 实现');
54
+ }
55
+ return async function postJson(path, body) {
56
+ const url = `${base}/api/v1${path.startsWith('/') ? path : `/${path}`}`;
57
+ const controller = new AbortController();
58
+ const timer = setTimeout(() => controller.abort(), timeoutMs);
59
+ try {
60
+ const res = await fetchFn(url, {
61
+ method: 'POST',
62
+ headers: {
63
+ 'Content-Type': 'application/json',
64
+ Authorization: `Bearer ${token}`,
65
+ },
66
+ body: JSON.stringify(body),
67
+ signal: controller.signal,
68
+ });
69
+ const text = await res.text();
70
+ let parsed;
71
+ try {
72
+ parsed = text ? JSON.parse(text) : null;
73
+ }
74
+ catch {
75
+ throw new ApmSdkError(`响应不是合法 JSON(HTTP ${res.status})`, res.status);
76
+ }
77
+ if (!res.ok) {
78
+ const msg = readMessage(parsed) ??
79
+ (typeof parsed === 'string' ? parsed : `HTTP ${res.status}`);
80
+ throw new ApmSdkError(msg, res.status, readBusinessCode(parsed), {
81
+ cause: parsed,
82
+ });
83
+ }
84
+ try {
85
+ return unwrapEnvelope(parsed, res.status);
86
+ }
87
+ catch (e) {
88
+ if (e instanceof ApmSdkError)
89
+ throw e;
90
+ throw new ApmSdkError(e instanceof Error ? e.message : String(e), res.status);
91
+ }
92
+ }
93
+ catch (e) {
94
+ if (e instanceof ApmSdkError)
95
+ throw e;
96
+ if (e instanceof Error && e.name === 'AbortError') {
97
+ throw new ApmSdkError(`请求超时(${timeoutMs}ms)`, undefined, undefined, {
98
+ cause: e,
99
+ });
100
+ }
101
+ throw new ApmSdkError(e instanceof Error ? e.message : String(e), undefined, undefined, { cause: e });
102
+ }
103
+ finally {
104
+ clearTimeout(timer);
105
+ }
106
+ };
107
+ }
108
+ //# sourceMappingURL=http.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"http.js","sourceRoot":"","sources":["../../src/api/http.ts"],"names":[],"mappings":"AAAA;;GAEG;AAQH,MAAM,CAAC,MAAM,iBAAiB,GAAG,CAAC,KAAK,EAAE,GAAG,EAAE,GAAG,CAAU,CAAC;AAE5D,MAAM,WAAW,GAAG,IAAI,GAAG,CAAS,iBAAiB,CAAC,CAAC;AAEvD,MAAM,OAAO,WAAY,SAAQ,KAAK;IAKzB;IACA;IAL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AAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAC1C,GAAG,CAAC,MAAM,CACX,CAAC;YACJ,CAAC;QACH,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC,YAAY,WAAW;gBAAE,MAAM,CAAC,CAAC;YACtC,IAAI,CAAC,YAAY,KAAK,IAAI,CAAC,CAAC,IAAI,KAAK,YAAY,EAAE,CAAC;gBAClD,MAAM,IAAI,WAAW,CAAC,QAAQ,SAAS,KAAK,EAAE,SAAS,EAAE,SAAS,EAAE;oBAClE,KAAK,EAAE,CAAC;iBACT,CAAC,CAAC;YACL,CAAC;YACD,MAAM,IAAI,WAAW,CACnB,CAAC,YAAY,KAAK,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,EAC1C,SAAS,EACT,SAAS,EACT,EAAE,KAAK,EAAE,CAAC,EAAE,CACb,CAAC;QACJ,CAAC;gBAAS,CAAC;YACT,YAAY,CAAC,KAAK,CAAC,CAAC;QACtB,CAAC;IACH,CAAC,CAAC;AACJ,CAAC"}
@@ -0,0 +1,6 @@
1
+ export type { ApiClient } from "listpage-http";
2
+ export { ApiError, ERROR_CODE_NETWORK, RequestTimeoutException, defineEndpoint, } from "listpage-http";
3
+ export { createApmClient, type ApmClient, type CreateApmClientOptions, } from "./client.js";
4
+ export { requestConfig, type RequestConfig } from "./request-config.js";
5
+ export type { EmployeeSummary, ReqBranchList, ReqBranchUpdate, ReqCommentProcessPendingAndVersion, ReqCommentSubmitPending, ResCommentProcessPendingAndVersion, ReqDefectUpdate, ReqLoginByEmployee, ReqTestCaseCreate, RequirementBranchRow, RequirementBranchStatus, RequirementCommentRow, RequirementCommentStatus, RequirementDefectRow, RequirementDefectStatus, RequirementTestCaseRow, RequirementVersionRow, ResLoginByEmployee, } from "./requirement";
6
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":"AAAA,YAAY,EAAE,SAAS,EAAE,MAAM,eAAe,CAAC;AAC/C,OAAO,EACL,QAAQ,EACR,kBAAkB,EAClB,uBAAuB,EACvB,cAAc,GACf,MAAM,eAAe,CAAC;AACvB,OAAO,EACL,eAAe,EACf,KAAK,SAAS,EACd,KAAK,sBAAsB,GAC5B,MAAM,aAAa,CAAC;AACrB,OAAO,EAAE,aAAa,EAAE,KAAK,aAAa,EAAE,MAAM,qBAAqB,CAAC;AACxE,YAAY,EACV,eAAe,EACf,aAAa,EACb,eAAe,EACf,kCAAkC,EAClC,uBAAuB,EACvB,kCAAkC,EAClC,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,uBAAuB,EACvB,qBAAqB,EACrB,wBAAwB,EACxB,oBAAoB,EACpB,uBAAuB,EACvB,sBAAsB,EACtB,qBAAqB,EACrB,kBAAkB,GACnB,MAAM,eAAe,CAAC"}
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestConfig = exports.createApmClient = exports.defineEndpoint = exports.RequestTimeoutException = exports.ERROR_CODE_NETWORK = exports.ApiError = void 0;
4
+ var listpage_http_1 = require("listpage-http");
5
+ Object.defineProperty(exports, "ApiError", { enumerable: true, get: function () { return listpage_http_1.ApiError; } });
6
+ Object.defineProperty(exports, "ERROR_CODE_NETWORK", { enumerable: true, get: function () { return listpage_http_1.ERROR_CODE_NETWORK; } });
7
+ Object.defineProperty(exports, "RequestTimeoutException", { enumerable: true, get: function () { return listpage_http_1.RequestTimeoutException; } });
8
+ Object.defineProperty(exports, "defineEndpoint", { enumerable: true, get: function () { return listpage_http_1.defineEndpoint; } });
9
+ var client_js_1 = require("./client.js");
10
+ Object.defineProperty(exports, "createApmClient", { enumerable: true, get: function () { return client_js_1.createApmClient; } });
11
+ var request_config_js_1 = require("./request-config.js");
12
+ Object.defineProperty(exports, "requestConfig", { enumerable: true, get: function () { return request_config_js_1.requestConfig; } });
13
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/api/index.ts"],"names":[],"mappings":";;;AACA,+CAKuB;AAJrB,yGAAA,QAAQ,OAAA;AACR,mHAAA,kBAAkB,OAAA;AAClB,wHAAA,uBAAuB,OAAA;AACvB,+GAAA,cAAc,OAAA;AAEhB,yCAIqB;AAHnB,4GAAA,eAAe,OAAA;AAIjB,yDAAwE;AAA/D,kHAAA,aAAa,OAAA"}
@@ -0,0 +1,16 @@
1
+ import type { ReqBranchList, ReqBranchUpdate, ReqCommentProcessPendingAndVersion, ReqCommentSubmitPending, ResCommentProcessPendingAndVersion, ReqDefectUpdate, ReqLoginByEmployee, ReqTestCaseCreate, RequirementBranchRow, RequirementCommentRow, RequirementDefectRow, RequirementTestCaseRow, ResLoginByEmployee } from "./requirement";
2
+ export declare const requestConfig: {
3
+ readonly auth: {
4
+ readonly loginByEmployee: import("listpage-http").EndpointConfig<ReqLoginByEmployee, ResLoginByEmployee>;
5
+ };
6
+ readonly requirement: {
7
+ readonly commentsSubmitPending: import("listpage-http").EndpointConfig<ReqCommentSubmitPending, RequirementCommentRow>;
8
+ readonly commentsProcessPendingAndVersion: import("listpage-http").EndpointConfig<ReqCommentProcessPendingAndVersion, ResCommentProcessPendingAndVersion>;
9
+ readonly testCasesCreateBatch: import("listpage-http").EndpointConfig<ReqTestCaseCreate[], RequirementTestCaseRow[]>;
10
+ readonly branchesList: import("listpage-http").EndpointConfig<ReqBranchList, RequirementBranchRow[]>;
11
+ readonly branchesUpdate: import("listpage-http").EndpointConfig<ReqBranchUpdate, RequirementBranchRow>;
12
+ readonly defectsUpdate: import("listpage-http").EndpointConfig<ReqDefectUpdate, RequirementDefectRow>;
13
+ };
14
+ };
15
+ export type RequestConfig = typeof requestConfig;
16
+ //# sourceMappingURL=request-config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-config.d.ts","sourceRoot":"","sources":["../../src/api/request-config.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,kCAAkC,EAClC,uBAAuB,EACvB,kCAAkC,EAClC,eAAe,EACf,kBAAkB,EAClB,iBAAiB,EACjB,oBAAoB,EACpB,qBAAqB,EACrB,oBAAoB,EACpB,sBAAsB,EACtB,kBAAkB,EACnB,MAAM,eAAe,CAAC;AAEvB,eAAO,MAAM,aAAa;;;;;;;;;;;;CA2ChB,CAAC;AAEX,MAAM,MAAM,aAAa,GAAG,OAAO,aAAa,CAAC"}
@@ -0,0 +1,40 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.requestConfig = void 0;
4
+ const listpage_http_1 = require("listpage-http");
5
+ exports.requestConfig = {
6
+ auth: {
7
+ loginByEmployee: (0, listpage_http_1.defineEndpoint)({
8
+ method: "POST",
9
+ path: "/auth/login-by-employee",
10
+ authRequired: false,
11
+ }),
12
+ },
13
+ requirement: {
14
+ commentsSubmitPending: (0, listpage_http_1.defineEndpoint)({
15
+ method: "POST",
16
+ path: "/requirements/comments/submit-pending",
17
+ }),
18
+ commentsProcessPendingAndVersion: (0, listpage_http_1.defineEndpoint)({
19
+ method: "POST",
20
+ path: "/requirements/comments/process-pending-and-version",
21
+ }),
22
+ testCasesCreateBatch: (0, listpage_http_1.defineEndpoint)({
23
+ method: "POST",
24
+ path: "/requirements/test-cases/create-batch",
25
+ }),
26
+ branchesList: (0, listpage_http_1.defineEndpoint)({
27
+ method: "POST",
28
+ path: "/requirements/branches/list",
29
+ }),
30
+ branchesUpdate: (0, listpage_http_1.defineEndpoint)({
31
+ method: "POST",
32
+ path: "/requirements/branches/update",
33
+ }),
34
+ defectsUpdate: (0, listpage_http_1.defineEndpoint)({
35
+ method: "POST",
36
+ path: "/requirements/defects/update",
37
+ }),
38
+ },
39
+ };
40
+ //# sourceMappingURL=request-config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"request-config.js","sourceRoot":"","sources":["../../src/api/request-config.ts"],"names":[],"mappings":";;;AAAA,iDAA+C;AAiBlC,QAAA,aAAa,GAAG;IAC3B,IAAI,EAAE;QACJ,eAAe,EAAE,IAAA,8BAAc,EAAyC;YACtE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,yBAAyB;YAC/B,YAAY,EAAE,KAAK;SACpB,CAAC;KACH;IACD,WAAW,EAAE;QACX,qBAAqB,EAAE,IAAA,8BAAc,EAGnC;YACA,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,uCAAuC;SAC9C,CAAC;QACF,gCAAgC,EAAE,IAAA,8BAAc,EAG9C;YACA,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,oDAAoD;SAC3D,CAAC;QACF,oBAAoB,EAAE,IAAA,8BAAc,EAGlC;YACA,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,uCAAuC;SAC9C,CAAC;QACF,YAAY,EAAE,IAAA,8BAAc,EAAwC;YAClE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,6BAA6B;SACpC,CAAC;QACF,cAAc,EAAE,IAAA,8BAAc,EAAwC;YACpE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,+BAA+B;SACtC,CAAC;QACF,aAAa,EAAE,IAAA,8BAAc,EAAwC;YACnE,MAAM,EAAE,MAAM;YACd,IAAI,EAAE,8BAA8B;SACrC,CAAC;KACH;CACO,CAAC"}
@@ -0,0 +1,112 @@
1
+ /**
2
+ * 与 apps/fe/src/api/requirement.ts 对齐的请求/响应类型(本包仅含 SDK 已用子集)。
3
+ */
4
+ export type RequirementCommentStatus = "CREATED" | "RESOLVED" | "PENDING" | "IN_PROGRESS" | "IGNORED";
5
+ export type EmployeeSummary = {
6
+ id: number;
7
+ name: string;
8
+ };
9
+ export type RequirementCommentRow = {
10
+ id: number;
11
+ content: string;
12
+ status: RequirementCommentStatus;
13
+ reply: string | null;
14
+ employee: EmployeeSummary;
15
+ workDirPath: string;
16
+ createdAt: string;
17
+ updatedAt: string;
18
+ };
19
+ export type RequirementVersionRow = {
20
+ id: number;
21
+ versionSeq: number;
22
+ content: string;
23
+ createdAt: string;
24
+ comments: RequirementCommentRow[];
25
+ };
26
+ /** 仅 CREATED → 写正文并置 PENDING */
27
+ export type ReqCommentSubmitPending = {
28
+ id: number;
29
+ content: string;
30
+ };
31
+ /** 批量 PENDING→RESOLVED 并创建新版本(仅员工 CLI;versionSeq 为需求内 v1、v2 序号) */
32
+ export type ReqCommentProcessPendingAndVersion = {
33
+ requirementId: number;
34
+ versionSeq: number;
35
+ content: string;
36
+ };
37
+ export type ResCommentProcessPendingAndVersion = {
38
+ resolvedCommentCount: number;
39
+ newVersion: RequirementVersionRow;
40
+ };
41
+ export type RequirementDefectStatus = "CREATED" | "PENDING" | "IN_PROGRESS" | "RESOLVED" | "CLOSED";
42
+ export type DefectAssigneePair = {
43
+ employeeId: number;
44
+ workDirPath: string;
45
+ };
46
+ export type RequirementDefectRow = {
47
+ id: number;
48
+ title: string;
49
+ description: string | null;
50
+ status: RequirementDefectStatus;
51
+ assignees: (EmployeeSummary & {
52
+ workDirPath: string;
53
+ })[];
54
+ createdAt: string;
55
+ updatedAt: string;
56
+ };
57
+ export type ReqDefectUpdate = {
58
+ id: number;
59
+ title?: string;
60
+ description?: string;
61
+ assignees?: DefectAssigneePair[];
62
+ status?: RequirementDefectStatus;
63
+ };
64
+ export type RequirementBranchStatus = "CREATED" | "IN_DEVELOPMENT" | "PENDING_TEST" | "MERGED";
65
+ export type RequirementBranchRow = {
66
+ id: number;
67
+ repository: {
68
+ id: number;
69
+ name: string;
70
+ };
71
+ branchName: string;
72
+ employee: EmployeeSummary;
73
+ workDirPath: string;
74
+ status: RequirementBranchStatus;
75
+ createdAt: string;
76
+ updatedAt: string;
77
+ };
78
+ export type ReqBranchList = {
79
+ requirementId: number;
80
+ };
81
+ export type ReqBranchUpdate = {
82
+ id: number;
83
+ repositoryId?: number;
84
+ employeeId?: number;
85
+ workDirPath?: string;
86
+ status?: RequirementBranchStatus;
87
+ };
88
+ export type RequirementTestCaseStatus = "DRAFT" | "READY" | "PASSED" | "FAILED" | "BLOCKED";
89
+ export type RequirementTestCaseRow = {
90
+ id: number;
91
+ title: string;
92
+ steps: string;
93
+ expectedResult: string | null;
94
+ status: RequirementTestCaseStatus;
95
+ createdAt: string;
96
+ updatedAt: string;
97
+ };
98
+ export type ReqTestCaseCreate = {
99
+ requirementId: number;
100
+ title: string;
101
+ steps: string;
102
+ expectedResult?: string;
103
+ status?: RequirementTestCaseStatus;
104
+ };
105
+ export type ReqLoginByEmployee = {
106
+ employeeId: number;
107
+ password: string;
108
+ };
109
+ export type ResLoginByEmployee = {
110
+ token: string;
111
+ };
112
+ //# sourceMappingURL=requirement.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirement.d.ts","sourceRoot":"","sources":["../../src/api/requirement.ts"],"names":[],"mappings":"AAAA;;GAEG;AAEH,MAAM,MAAM,wBAAwB,GAChC,SAAS,GACT,UAAU,GACV,SAAS,GACT,aAAa,GACb,SAAS,CAAC;AAEd,MAAM,MAAM,eAAe,GAAG;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,OAAO,EAAE,MAAM,CAAC;IAChB,MAAM,EAAE,wBAAwB,CAAC;IACjC,KAAK,EAAE,MAAM,GAAG,IAAI,CAAC;IACrB,QAAQ,EAAE,eAAe,CAAC;IAC1B,WAAW,EAAE,MAAM,CAAC;IACpB,SAAS,EAAE,MAAM,CAAC;IAClB,SAAS,EAAE,MAAM,CAAC;CACnB,CAAC;AAEF,MAAM,MAAM,qBAAqB,GAAG;IAClC,EAAE,EAAE,MAAM,CAAC;IACX,UAAU,EAAE,MAAM,CAAC;IACnB,OAAO,EAA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C;IACxB,MAAM,CAAC,EAAE,yBAAyB,CAAC;CACpC,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAC/B,UAAU,EAAE,MAAM,CAAC;IACnB,QAAQ,EAAE,MAAM,CAAC;CAClB,CAAC;AAEF,MAAM,MAAM,kBAAkB,GAAG;IAAE,KAAK,EAAE,MAAM,CAAA;CAAE,CAAC"}
@@ -0,0 +1,6 @@
1
+ "use strict";
2
+ /**
3
+ * 与 apps/fe/src/api/requirement.ts 对齐的请求/响应类型(本包仅含 SDK 已用子集)。
4
+ */
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ //# sourceMappingURL=requirement.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"requirement.js","sourceRoot":"","sources":["../../src/api/requirement.ts"],"names":[],"mappings":";AAAA;;GAEG"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerAuthCommands(program: Command): void;
3
+ //# sourceMappingURL=auth.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"auth.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/auth.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AASzC,wBAAgB,oBAAoB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAoF3D"}
@@ -0,0 +1,72 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerAuthCommands = registerAuthCommands;
4
+ const node_process_1 = require("node:process");
5
+ const promises_1 = require("node:readline/promises");
6
+ const client_1 = require("../../api/client");
7
+ const config_store_1 = require("../../config-store");
8
+ const exit_api_error_1 = require("../exit-api-error");
9
+ function registerAuthCommands(program) {
10
+ program
11
+ .command("login")
12
+ .description("员工 CLI 登录(写入配置文件 baseUrl、token 与 employeeId;可用 --url 指定或覆盖服务地址)")
13
+ .requiredOption("-u, --employee-id <id>", "员工 ID", (v) => Number.parseInt(v, 10))
14
+ .option("--url <url>", "服务根地址(优于配置;登录成功会写入配置)")
15
+ .option("--password <text>", "口令(不推荐在 shell 历史中留明文)")
16
+ .action(async (opts) => {
17
+ const cfg = await (0, config_store_1.readApmConfig)();
18
+ const fromArg = opts.url?.trim() || "";
19
+ const baseUrl = (0, config_store_1.normalizeBaseUrl)(fromArg || cfg.baseUrl?.trim() || "");
20
+ if (!baseUrl) {
21
+ console.error("缺少服务根地址:请传入 --url <url>,或先执行 apm config set base-url <url>");
22
+ process.exit(1);
23
+ }
24
+ let password = opts.password?.trim();
25
+ if (!password) {
26
+ const rl = (0, promises_1.createInterface)({ input: node_process_1.stdin, output: node_process_1.stdout });
27
+ try {
28
+ password = (await rl.question("口令: ")).trim();
29
+ }
30
+ finally {
31
+ await rl.close();
32
+ }
33
+ }
34
+ if (!password) {
35
+ console.error("口令不能为空");
36
+ process.exit(1);
37
+ }
38
+ const api = (0, client_1.createApmClient)({
39
+ baseUrl,
40
+ token: "",
41
+ });
42
+ try {
43
+ const res = await api.auth.loginByEmployee({
44
+ employeeId: opts.employeeId,
45
+ password,
46
+ });
47
+ const next = {
48
+ ...cfg,
49
+ baseUrl,
50
+ token: res.token,
51
+ employeeId: opts.employeeId,
52
+ };
53
+ await (0, config_store_1.writeApmConfig)(next);
54
+ console.log(JSON.stringify({ ok: true, baseUrl, employeeId: opts.employeeId }, null, 2));
55
+ }
56
+ catch (e) {
57
+ (0, exit_api_error_1.exitApiError)(e);
58
+ }
59
+ });
60
+ program
61
+ .command("logout")
62
+ .description("清除配置文件中的 token 与 employeeId(保留 base-url)")
63
+ .action(async () => {
64
+ const cfg = await (0, config_store_1.readApmConfig)();
65
+ await (0, config_store_1.writeApmConfig)({
66
+ baseUrl: cfg.baseUrl,
67
+ ...(cfg.wsPort != null ? { wsPort: cfg.wsPort } : {}),
68
+ });
69
+ console.log(JSON.stringify({ ok: true }, null, 2));
70
+ });
71
+ }
72
+ //# sourceMappingURL=auth.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file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AG,CAAC,MAAM,IAAI,IAAI,CAAC,CAAC,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,EAAE,CAAC;SACtD,CAAC,CAAC;QACH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,EAAE,EAAE,EAAE,IAAI,EAAE,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;IACrD,CAAC,CAAC,CAAC;AACP,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerCommentCommands(program: Command): void;
3
+ //# sourceMappingURL=comment.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/comment.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAIzC,wBAAgB,uBAAuB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAmE9D"}
@@ -0,0 +1,57 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.registerCommentCommands = registerCommentCommands;
4
+ const promises_1 = require("node:fs/promises");
5
+ const credentials_1 = require("../credentials");
6
+ const exit_api_error_1 = require("../exit-api-error");
7
+ function registerCommentCommands(program) {
8
+ const comment = program.command("comment").description("需求内容版本评论");
9
+ comment
10
+ .command("update")
11
+ .description("提交评论正文:仅允许「已创建」状态,成功后变为「待处理」")
12
+ .requiredOption("--id <id>", "评论 id", (v) => Number.parseInt(v, 10))
13
+ .requiredOption("--content <text>", "评论正文")
14
+ .action(async (opts) => {
15
+ const api = (0, credentials_1.apiClient)();
16
+ try {
17
+ const row = await api.requirement.commentsSubmitPending({
18
+ id: opts.id,
19
+ content: opts.content,
20
+ });
21
+ console.log(JSON.stringify(row, null, 2));
22
+ }
23
+ catch (e) {
24
+ (0, exit_api_error_1.exitApiError)(e);
25
+ }
26
+ });
27
+ comment
28
+ .command("process")
29
+ .description("一键处理:由服务端将指定内容版本下你名下「待处理」评论标为已处理并创建新版本(同步需求正文)")
30
+ .requiredOption("--requirement-id <id>", "需求 id", (v) => Number.parseInt(v, 10))
31
+ .requiredOption("--version-seq <n>", "该需求下的版本序号(与界面 v1、v2 一致,非数据库 id)", (v) => Number.parseInt(v, 10))
32
+ .option("--content <text>", "新版本正文(与 --content-file 二选一)")
33
+ .option("--content-file <path>", "从文件读取新版本正文(UTF-8)")
34
+ .action(async (opts) => {
35
+ let content = opts.content?.trim();
36
+ if (opts.contentFile) {
37
+ content = (await (0, promises_1.readFile)(opts.contentFile, "utf8")).trimEnd();
38
+ }
39
+ if (!content) {
40
+ console.error("请提供 --content 或 --content-file");
41
+ process.exit(1);
42
+ }
43
+ const api = (0, credentials_1.apiClient)();
44
+ try {
45
+ const result = await api.requirement.commentsProcessPendingAndVersion({
46
+ requirementId: opts.requirementId,
47
+ versionSeq: opts.versionSeq,
48
+ content,
49
+ });
50
+ console.log(JSON.stringify(result, null, 2));
51
+ }
52
+ catch (e) {
53
+ (0, exit_api_error_1.exitApiError)(e);
54
+ }
55
+ });
56
+ }
57
+ //# sourceMappingURL=comment.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"comment.js","sourceRoot":"","sources":["../../../src/cli/commands/comment.ts"],"names":[],"mappings":";;AAKA,0DAmEC;AAxED,+CAA4C;AAE5C,gDAA2C;AAC3C,sDAAiD;AAEjD,SAAgB,uBAAuB,CAAC,OAAgB;IACtD,MAAM,OAAO,GAAG,OAAO,CAAC,OAAO,CAAC,SAAS,CAAC,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;IAEnE,OAAO;SACJ,OAAO,CAAC,QAAQ,CAAC;SACjB,WAAW,CACV,8BAA8B,CAC/B;SACA,cAAc,CAAC,WAAW,EAAE,OAAO,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC,EAAE,EAAE,CAAC,CAAC;SACnE,cAAc,CAAC,kBAA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,IAAI,CAAC,OAAO,EAAE,CAAC;YACb,OAAO,CAAC,KAAK,CAAC,gCAAgC,CAAC,CAAC;YAChD,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;QAClB,CAAC;QAED,MAAM,GAAG,GAAG,IAAA,uBAAS,GAAE,CAAC;QACxB,IAAI,CAAC;YACH,MAAM,MAAM,GAAG,MAAM,GAAG,CAAC,WAAW,CAAC,gCAAgC,CAAC;gBACpE,aAAa,EAAE,IAAI,CAAC,aAAa;gBACjC,UAAU,EAAE,IAAI,CAAC,UAAU;gBAC3B,OAAO;aACR,CAAC,CAAC;YACH,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,SAAS,CAAC,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC,CAAC,CAAC;QAC/C,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAA,6BAAY,EAAC,CAAC,CAAC,CAAC;QAClB,CAAC;IACH,CAAC,CACF,CAAC;AACN,CAAC"}
@@ -0,0 +1,3 @@
1
+ import type { Command } from "commander";
2
+ export declare function registerConfigCommands(program: Command): void;
3
+ //# sourceMappingURL=config.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"config.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AAQzC,wBAAgB,sBAAsB,CAAC,OAAO,EAAE,OAAO,GAAG,IAAI,CAqD7D"}