MCPcopy Create free account
hub / github.com/OpenRaiser/PaperFlow / build_parser

Function build_parser

agents/wiki-agent/main.py:134–198  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

132
133
134def build_parser() -> argparse.ArgumentParser:
135 parser = argparse.ArgumentParser(description="PaperFlow Wiki")
136 subparsers = parser.add_subparsers(dest="command", required=True)
137
138 init_parser = subparsers.add_parser("init", help="Initialize wiki tables and folders.")
139 init_parser.set_defaults(func=_cmd_init)
140
141 list_parser = subparsers.add_parser("list", help="List wiki nodes.")
142 list_parser.add_argument("--user-id", required=True)
143 list_parser.add_argument("--type", choices=["paper", "section", "trajectory", "topic"])
144 list_parser.add_argument("--limit", type=int, default=20)
145 list_parser.add_argument("--json", action="store_true")
146 list_parser.set_defaults(func=_cmd_list)
147
148 search_parser = subparsers.add_parser("search", help="Search wiki nodes.")
149 search_parser.add_argument("query")
150 search_parser.add_argument("--user-id", required=True)
151 search_parser.add_argument("--type", choices=["paper", "section", "trajectory", "topic"])
152 search_parser.add_argument("--limit", type=int, default=20)
153 search_parser.add_argument("--json", action="store_true")
154 search_parser.set_defaults(func=_cmd_search)
155
156 stats_parser = subparsers.add_parser("stats", help="Show wiki storage stats.")
157 stats_parser.add_argument("--user-id", required=True)
158 stats_parser.add_argument("--json", action="store_true")
159 stats_parser.set_defaults(func=_cmd_stats)
160
161 embed_parser = subparsers.add_parser("embed", help="Embed wiki nodes for vector search.")
162 embed_parser.add_argument("--user-id", required=True)
163 embed_parser.add_argument("--force", action="store_true")
164 embed_parser.add_argument("--limit", type=int, default=500)
165 embed_parser.add_argument("--json", action="store_true")
166 embed_parser.set_defaults(func=_cmd_embed)
167
168 topics_parser = subparsers.add_parser("topics", help="Flush keyword topic nodes.")
169 topics_parser.add_argument("--user-id", required=True)
170 topics_parser.add_argument("--min-count", type=int, default=2)
171 topics_parser.add_argument("--limit", type=int, default=50)
172 topics_parser.add_argument("--json", action="store_true")
173 topics_parser.set_defaults(func=_cmd_topics)
174
175 ask_parser = subparsers.add_parser("ask", help="Ask a question over the local wiki.")
176 ask_parser.add_argument("question")
177 ask_parser.add_argument("--user-id", required=True)
178 ask_parser.add_argument("--limit", type=int, default=8)
179 ask_parser.add_argument("--json", action="store_true")
180 ask_parser.set_defaults(func=_cmd_ask)
181
182 backfill_parser = subparsers.add_parser("backfill", help="Backfill existing runtime data into wiki.")
183 backfill_parser.add_argument("--user-id")
184 backfill_parser.add_argument("--all", action="store_true")
185 backfill_parser.add_argument("--dry-run", action="store_true")
186 backfill_parser.add_argument("--json", action="store_true")
187 backfill_parser.set_defaults(func=_cmd_backfill)
188
189 monthly_parser = subparsers.add_parser("monthly", help="Export an Obsidian-friendly monthly report.")
190 monthly_parser.add_argument("--user-id", required=True)
191 monthly_parser.add_argument("--month", help="Month to export in YYYY-MM format. Defaults to current month.")

Callers 1

mainFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected