feishu-doc-cli 0.1.2 → 0.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.
Files changed (2) hide show
  1. package/dist/cli.js +12 -3
  2. package/package.json +1 -1
package/dist/cli.js CHANGED
@@ -56,13 +56,22 @@ async function cmdRead(path, lang) {
56
56
  }
57
57
  async function cmdTree(lang, depth, path) {
58
58
  const tree = await fetchTree(lang);
59
- const nodes = path ? filterSubtree(tree, normalizePath(path)) : tree;
60
- if (!nodes) {
59
+ const match = path ? filterSubtree(tree, normalizePath(path)) : null;
60
+ if (path && !match) {
61
61
  console.error(`Path not found in tree: ${path}`);
62
62
  process.exit(1);
63
63
  return;
64
64
  }
65
- console.log(renderTree(nodes, depth));
65
+ // When filtering by path, render children of the matched node directly
66
+ // so --depth 1 shows its immediate children (not the node itself).
67
+ const nodes = match ? match[0].items : tree;
68
+ if (match && nodes.length === 0) {
69
+ // Leaf node — show the node itself
70
+ console.log(renderTree(match, depth));
71
+ }
72
+ else {
73
+ console.log(renderTree(nodes, depth));
74
+ }
66
75
  }
67
76
  async function cmdSearch(keyword, lang) {
68
77
  const tree = await fetchTree(lang);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "feishu-doc-cli",
3
- "version": "0.1.2",
3
+ "version": "0.1.3",
4
4
  "description": "CLI tool to read Feishu Open Platform documentation as Markdown, designed for AI coding agents",
5
5
  "type": "module",
6
6
  "license": "MIT",