ai-project-manage-cli 5.0.6 → 5.0.8

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/dist/index.js CHANGED
@@ -88,6 +88,9 @@ function sessionRulePath(sessionId, apmRoot) {
88
88
  function sessionYamlPath(sessionId, apmRoot) {
89
89
  return join2(sessionDir(sessionId, apmRoot), "session.yaml");
90
90
  }
91
+ function sessionMessagesXmlPath(sessionId, apmRoot) {
92
+ return join2(sessionDir(sessionId, apmRoot), "messages.xml");
93
+ }
91
94
  function documentLocalFileName(platformName) {
92
95
  const trimmed = platformName.trim();
93
96
  if (!trimmed) return "document.md";
@@ -191,6 +194,10 @@ var requestConfig = {
191
194
  method: "GET",
192
195
  path: "/cli/sessions/members"
193
196
  }),
197
+ listSessionMessages: defineEndpoint({
198
+ method: "GET",
199
+ path: "/cli/messages"
200
+ }),
194
201
  listDocuments: defineEndpoint({
195
202
  method: "GET",
196
203
  path: "/cli/documents"
@@ -442,6 +449,32 @@ import { writeFileSync as writeFileSync4 } from "fs";
442
449
  import { join as join5 } from "path";
443
450
  import { stringify as yamlStringify } from "yaml";
444
451
 
452
+ // src/session-messages-xml.ts
453
+ function escapeXmlAttr(value) {
454
+ return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
455
+ }
456
+ function wrapCdata(value) {
457
+ return `<![CDATA[${value.replace(/]]>/g, "]]]]><![CDATA[>")}]]>`;
458
+ }
459
+ function formatSessionMessagesXml(sessionId, messages) {
460
+ const lines = [
461
+ '<?xml version="1.0" encoding="UTF-8"?>',
462
+ `<messages sessionId="${escapeXmlAttr(sessionId)}">`
463
+ ];
464
+ for (const message of messages) {
465
+ const roundAttr = message.round != null && message.round > 0 ? ` round="${message.round}"` : "";
466
+ lines.push(
467
+ ` <message id="${escapeXmlAttr(message.id)}" name="${escapeXmlAttr(
468
+ message.name
469
+ )}" position="${escapeXmlAttr(message.position)}"${roundAttr}>`,
470
+ ` <content>${wrapCdata(message.content)}</content>`,
471
+ " </message>"
472
+ );
473
+ }
474
+ lines.push("</messages>", "");
475
+ return lines.join("\n");
476
+ }
477
+
445
478
  // src/commands/sync-session-attachments.ts
446
479
  import { writeFileSync as writeFileSync3 } from "fs";
447
480
  import { join as join4 } from "path";
@@ -482,12 +515,15 @@ async function runPull(sessionId, apmRoot) {
482
515
  }
483
516
  const cfg = await ensureLoggedConfig();
484
517
  const api = createApmApiClient(cfg);
485
- const [detail, members, documents, attachments] = await Promise.all([
486
- api.cli.sessionDetail({ sessionId: trimmedId }),
487
- api.cli.sessionMembers({ sessionId: trimmedId }),
488
- api.cli.listDocuments({ sessionId: trimmedId }),
489
- api.cli.listAttachments({ sessionId: trimmedId })
490
- ]);
518
+ const [detail, members, documents, attachments, messages] = await Promise.all(
519
+ [
520
+ api.cli.sessionDetail({ sessionId: trimmedId }),
521
+ api.cli.sessionMembers({ sessionId: trimmedId }),
522
+ api.cli.listDocuments({ sessionId: trimmedId }),
523
+ api.cli.listAttachments({ sessionId: trimmedId }),
524
+ api.cli.listSessionMessages({ sessionId: trimmedId })
525
+ ]
526
+ );
491
527
  const dir = sessionDir(trimmedId, apmRoot);
492
528
  const docsDir = sessionDocsDir(trimmedId, apmRoot);
493
529
  await ensureDirExists(docsDir);
@@ -521,6 +557,11 @@ async function runPull(sessionId, apmRoot) {
521
557
  `,
522
558
  "utf8"
523
559
  );
560
+ writeFileSync4(
561
+ sessionMessagesXmlPath(trimmedId, apmRoot),
562
+ formatSessionMessagesXml(trimmedId, messages),
563
+ "utf8"
564
+ );
524
565
  await syncSessionAttachments(cfg, trimmedId, attachments, apmRoot);
525
566
  console.log(`[apm] \u5DF2\u540C\u6B65\u4F1A\u8BDD\u5DE5\u4F5C\u533A: ${dir}`);
526
567
  return dir;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "ai-project-manage-cli",
3
- "version": "5.0.6",
3
+ "version": "5.0.8",
4
4
  "description": "命令行工具:后续用于调用平台后端 API 完成运维与自动化操作",
5
5
  "type": "module",
6
6
  "private": false,
@@ -0,0 +1,22 @@
1
+ ## APM 指南
2
+
3
+ ### 回复消息命令
4
+
5
+ - 命令: `apm append-message --id=<消息ID> --content=<消息内容>`
6
+ - 注意事项:如果消息内容中包含文档地址,不要把前缀也写出来,直接用文档名称即可,并且文档名称要用倒引号包裹
7
+
8
+ ### 创建/更新群文档命令
9
+
10
+ - 命令: `apm sync-document <会话ID> --file <文档名称>`
11
+ - 注意事项:文档名称是指`.apm/sessions/<会话ID>/` 这个目录下的某个文档,参数直接文档名称,比如 PRD.md。
12
+
13
+ ## 工作流程
14
+
15
+ - 读取 `.apm/sessions/<会话ID>/session.yaml`,必要时读取`messages.xml` 了解当前会话状态与历史消息
16
+ - 根据用户提示找到你对应的人设(system_persona)
17
+ - 根据人设完成用户指定的任务
18
+
19
+ ## 目录声明
20
+
21
+ - 技能目录: ./skills
22
+ - 群文档目录: ./sessions/<会话 ID>/docs