@curdx/flow 7.1.2 → 7.1.3

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.mjs CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  // src/index.ts
4
4
  import * as p10 from "@clack/prompts";
5
- import { defineCommand, runMain } from "citty";
5
+ import { defineCommand as defineCommand2, runMain } from "citty";
6
6
 
7
7
  // src/ui/language.ts
8
8
  import * as p from "@clack/prompts";
@@ -84,7 +84,17 @@ var messages = {
84
84
  "claudeMd.unchanged": "CLAUDE.md \u5DF2\u662F\u6700\u65B0",
85
85
  "claudeMd.removed": "\u5DF2\u4ECE CLAUDE.md \u79FB\u9664 @curdx/flow \u533A\u5757",
86
86
  "claudeMd.skipped": "\u5DF2\u8DF3\u8FC7 CLAUDE.md \u540C\u6B65\uFF08--no-claude-md\uFF09",
87
- "claudeMd.failed": "CLAUDE.md \u540C\u6B65\u5931\u8D25\uFF1A{error}"
87
+ "claudeMd.failed": "CLAUDE.md \u540C\u6B65\u5931\u8D25\uFF1A{error}",
88
+ "analyze.description": "\u89E3\u6790 Claude Code session jsonl + curdx-flow errors.jsonl\uFF0C\u8F93\u51FA markdown \u62A5\u544A",
89
+ "analyze.helpSummary": "analyze \u2014 \u672C\u5730\u89C2\u6D4B\uFF1A\u5408\u5E76 ~/.claude/projects/<cwd-encoded>/<sessionId>.jsonl \u4E0E ~/.claude/curdx-flow/errors.jsonl\uFF0C\u6E32\u67D3 7 \u6BB5 markdown\uFF08hook \u5931\u8D25 / slash command \u9891\u6B21 / subagent \u8C03\u5EA6 / spec \u6F0F\u6597 / hook \u65F6\u5EF6 P50/P95/P99 / schema \u6F02\u79FB / parentUuid \u94FE\u5B8C\u6574\u6027\uFF09",
90
+ "analyze.flags.json": "\u8F93\u51FA JSON \u800C\u975E markdown\uFF08CI \u53CB\u597D\uFF1B\u4E0E --out \u4E92\u65A5\u8BED\u4E49\uFF1AJSON \u4E0D\u5199\u6587\u4EF6\uFF09",
91
+ "analyze.flags.out": "\u628A markdown \u62A5\u544A\u5199\u5165\u6307\u5B9A\u6587\u4EF6\uFF08\u7F3A\u7701\u5199\u5230 stdout\uFF09",
92
+ "analyze.flags.limit": "\u8868\u683C\u6BB5 Top-N \u622A\u65AD\uFF08\u9ED8\u8BA4 10\uFF1B\u4F20 0 \u89C6\u4E3A\u65E0\u610F\u4E49\u56DE\u843D 10\uFF09",
93
+ "analyze.flags.since": "\u53EA\u7EDF\u8BA1\u76F8\u5BF9\u7A97\u53E3\u5185\u7684\u4E8B\u4EF6\uFF0C\u4F8B\u5982 `7d` / `24h` / `30m`\uFF08\u9ED8\u8BA4\u5168\u91CF\uFF1B--since \u4E0E\u589E\u91CF offset \u7F13\u5B58\u5171\u5B58\uFF0C\u7F13\u5B58\u547D\u4E2D\u65F6\u76F4\u63A5 replay \u4E0A\u6B21\u62A5\u544A\uFF09",
94
+ "analyze.flags.project": "\u6307\u5B9A ~/.claude/projects/ \u4E0B\u7684 encoded-cwd \u5B50\u76EE\u5F55\uFF1B\u7F3A\u7701\u6309\u5F53\u524D git \u4ED3\u5E93\u6839\u76EE\u5F55\u63A8\u65AD\uFF08\u975E git \u76EE\u5F55\u9000\u5316\u4E3A\u7A7A\u62A5\u544A + warning\uFF09",
95
+ "analyze.flags.includePrompts": "\u5173\u95ED\u9ED8\u8BA4 redact\uFF0C\u628A\u539F\u59CB prompt \u6587\u672C\u900F\u51FA\uFF08\u4EC5\u672C\u5730\u8C03\u8BD5\uFF0C\u8C28\u614E\u4F7F\u7528\uFF1BD-9 \u767D\u540D\u5355\u9ED8\u8BA4\u88C1\u526A\u6240\u6709\u672A\u5728\u767D\u540D\u5355\u5B57\u6BB5\uFF09",
96
+ "analyze.warning.noProject": "\u672A\u80FD\u4ECE cwd \u63A8\u65AD\u5230 ~/.claude/projects/ \u5B50\u76EE\u5F55\uFF08\u975E git \u4ED3\u5E93\u6216\u65E0\u5BF9\u5E94 session\uFF09\uFF1B\u8F93\u51FA\u7A7A\u62A5\u544A\uFF0C\u8BF7\u7528 --project \u663E\u5F0F\u6307\u5B9A",
97
+ "analyze.warning.schemaFallback": "plugins/curdx-flow/schemas/transcript-events.json \u672A\u627E\u5230\uFF0C\u56DE\u843D\u5230\u5185\u7F6E\u6700\u5C0F\u767D\u540D\u5355\u2014\u2014schema \u6F02\u79FB\u8BCA\u65AD\u53EF\u80FD\u6F0F\u62A5"
88
98
  };
89
99
  var zh_default = messages;
90
100
 
@@ -165,7 +175,17 @@ var messages2 = {
165
175
  "claudeMd.unchanged": "CLAUDE.md already up to date",
166
176
  "claudeMd.removed": "Removed @curdx/flow block from CLAUDE.md",
167
177
  "claudeMd.skipped": "Skipped CLAUDE.md sync (--no-claude-md)",
168
- "claudeMd.failed": "CLAUDE.md sync failed: {error}"
178
+ "claudeMd.failed": "CLAUDE.md sync failed: {error}",
179
+ "analyze.description": "Analyze Claude Code session jsonl + curdx-flow errors.jsonl, output markdown report",
180
+ "analyze.helpSummary": "analyze \u2014 local observability: merge ~/.claude/projects/<cwd-encoded>/<sessionId>.jsonl with ~/.claude/curdx-flow/errors.jsonl into 7 markdown sections (hook failures / slash command frequency / subagent dispatch / spec funnel / hook duration P50/P95/P99 / schema drift / parentUuid chain integrity)",
181
+ "analyze.flags.json": "Emit JSON instead of markdown (CI-friendly; --out is ignored when --json is set)",
182
+ "analyze.flags.out": "Write the markdown report to the given file path (defaults to stdout)",
183
+ "analyze.flags.limit": "Top-N truncation for tabular sections (default 10; 0 falls back to 10)",
184
+ "analyze.flags.since": "Only count events within a relative window such as `7d` / `24h` / `30m` (default: full history; --since coexists with the incremental offset cache, replays the last report when cache hits)",
185
+ "analyze.flags.project": "Pin to a specific encoded-cwd directory under ~/.claude/projects/; defaults to inferring from the current git repository root (non-git directories degrade to an empty report with a warning)",
186
+ "analyze.flags.includePrompts": "Skip default redaction and pass raw prompt text through (local debugging only; D-9 white-list redacts every non-whitelisted field by default)",
187
+ "analyze.warning.noProject": "Could not infer a ~/.claude/projects/ subdirectory from cwd (not a git repo or no matching session); emitting an empty report \u2014 pass --project to override",
188
+ "analyze.warning.schemaFallback": "plugins/curdx-flow/schemas/transcript-events.json not found, falling back to the builtin minimal whitelist \u2014 schema drift diagnostics may underreport"
169
189
  };
170
190
  var en_default = messages2;
171
191
 
@@ -1554,6 +1574,45 @@ async function mainMenu() {
1554
1574
  }
1555
1575
  }
1556
1576
 
1577
+ // src/flows/analyze.ts
1578
+ import { defineCommand } from "citty";
1579
+ var analyzeCmd = defineCommand({
1580
+ meta: {
1581
+ name: "analyze",
1582
+ description: "Analyze Claude Code session jsonl + curdx-flow errors.jsonl into a markdown report"
1583
+ },
1584
+ args: {
1585
+ out: {
1586
+ type: "string",
1587
+ description: "Output file path (default: stdout)"
1588
+ },
1589
+ json: {
1590
+ type: "boolean",
1591
+ description: "Emit JSON instead of markdown"
1592
+ },
1593
+ limit: {
1594
+ type: "string",
1595
+ description: "Top-N truncation for tabular sections (default: 10)"
1596
+ },
1597
+ "include-prompts": {
1598
+ type: "boolean",
1599
+ description: "Skip prompt redaction (D-9 white-list passthrough disabled \u2014 local debugging only)"
1600
+ }
1601
+ },
1602
+ async run({ args }) {
1603
+ const limitRaw = args.limit;
1604
+ const limit = typeof limitRaw === "string" && limitRaw.length > 0 ? Number(limitRaw) : void 0;
1605
+ const { runAnalyze } = await import("./analyze-4DE3HVCA.mjs");
1606
+ await runAnalyze({
1607
+ out: typeof args.out === "string" ? args.out : void 0,
1608
+ json: Boolean(args.json),
1609
+ limit: Number.isFinite(limit) ? limit : void 0,
1610
+ includePrompts: Boolean(args["include-prompts"])
1611
+ });
1612
+ }
1613
+ });
1614
+ var analyze_default = analyzeCmd;
1615
+
1557
1616
  // src/index.ts
1558
1617
  function parseLang(v) {
1559
1618
  return v === "zh" || v === "en" ? v : void 0;
@@ -1569,7 +1628,7 @@ var sharedArgs = {
1569
1628
  description: "Skip syncing the @curdx/flow block in ~/.claude/CLAUDE.md"
1570
1629
  }
1571
1630
  };
1572
- var installCmd = defineCommand({
1631
+ var installCmd = defineCommand2({
1573
1632
  meta: { name: "install", description: "Install, reinstall, or update plugins / MCP servers" },
1574
1633
  args: {
1575
1634
  ...sharedArgs,
@@ -1592,7 +1651,7 @@ var installCmd = defineCommand({
1592
1651
  p10.outro(t("app.outro"));
1593
1652
  }
1594
1653
  });
1595
- var uninstallCmd = defineCommand({
1654
+ var uninstallCmd = defineCommand2({
1596
1655
  meta: { name: "uninstall", description: "Uninstall installed plugins / MCP servers" },
1597
1656
  args: {
1598
1657
  ...sharedArgs,
@@ -1611,7 +1670,7 @@ var uninstallCmd = defineCommand({
1611
1670
  p10.outro(t("app.outro"));
1612
1671
  }
1613
1672
  });
1614
- var updateCmd = defineCommand({
1673
+ var updateCmd = defineCommand2({
1615
1674
  meta: { name: "update", description: "Update installed plugins" },
1616
1675
  args: {
1617
1676
  ...sharedArgs,
@@ -1630,7 +1689,7 @@ var updateCmd = defineCommand({
1630
1689
  p10.outro(t("app.outro"));
1631
1690
  }
1632
1691
  });
1633
- var statusCmd = defineCommand({
1692
+ var statusCmd = defineCommand2({
1634
1693
  meta: { name: "status", description: "Show install status" },
1635
1694
  args: {
1636
1695
  ...sharedArgs,
@@ -1643,8 +1702,8 @@ var statusCmd = defineCommand({
1643
1702
  if (!args.json) p10.outro(t("app.outro"));
1644
1703
  }
1645
1704
  });
1646
- var SUBCOMMANDS = /* @__PURE__ */ new Set(["install", "uninstall", "update", "status"]);
1647
- var root = defineCommand({
1705
+ var SUBCOMMANDS = /* @__PURE__ */ new Set(["install", "uninstall", "update", "status", "analyze"]);
1706
+ var root = defineCommand2({
1648
1707
  meta: {
1649
1708
  name: "@curdx/flow",
1650
1709
  version: "3.3.2",
@@ -1655,7 +1714,8 @@ var root = defineCommand({
1655
1714
  install: installCmd,
1656
1715
  uninstall: uninstallCmd,
1657
1716
  update: updateCmd,
1658
- status: statusCmd
1717
+ status: statusCmd,
1718
+ analyze: analyze_default
1659
1719
  }
1660
1720
  // No root run() — citty 0.1.6 calls parent.run AFTER a matching subcommand,
1661
1721
  // which would render the menu after a subcommand finishes. We dispatch the
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@curdx/flow",
3
- "version": "7.1.2",
3
+ "version": "7.1.3",
4
4
  "description": "Interactive installer for Claude Code plugins and MCP servers",
5
5
  "type": "module",
6
6
  "bin": "./dist/index.mjs",
@@ -15,11 +15,13 @@
15
15
  "build": "tsup",
16
16
  "build:hooks": "node scripts/build-hooks.mjs",
17
17
  "check:hooks-fresh": "node scripts/check-hooks-fresh.mjs",
18
+ "check:bundle": "node scripts/check-bundle-size.mjs",
18
19
  "dev": "tsup --watch",
19
20
  "test:hooks": "npm run build:hooks && vitest run tests/hooks --passWithNoTests",
21
+ "test:analyze": "vitest run tests/analyze",
20
22
  "start": "node ./dist/index.mjs",
21
23
  "typecheck": "tsc --noEmit",
22
- "verify": "npm run typecheck && npm run check-versions && npm run check:hooks-fresh && npm run test:hooks",
24
+ "verify": "npm run typecheck && npm run check-versions && npm run check:hooks-fresh && npm run build && npm run check:bundle && npm run test:hooks && npm run test:analyze",
23
25
  "check-versions": "node scripts/check-versions.mjs",
24
26
  "bump-version": "node scripts/bump-version.mjs",
25
27
  "prepublishOnly": "node scripts/check-versions.mjs && npm run typecheck && npm run check:hooks-fresh && npm run build"