Repository navigation
Expand file tree
/
Copy pathsetup
More file actions
executable file
·551 lines (490 loc) · 23.6 KB
/
Copy pathsetup
File metadata and controls
executable file
·551 lines (490 loc) · 23.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
#!/usr/bin/env python3
"""Install Retriever Claude Code commands globally under ~/.claude/commands/retriever.
This is the Claude-first installer. It keeps Retriever's current backend in this
checkout, but installs personal namespaced commands so Claude Code can use
Retriever in any workspace opened at the desired workspace root.
"""
from __future__ import annotations
import argparse
import json
import shlex
import site
import sys
from dataclasses import dataclass
from pathlib import Path
REPO_ROOT = Path(__file__).resolve().parent
TOOL_PATH = REPO_ROOT / "skills" / "tool-template" / "tools.py"
PACKAGE_MAIN_PATH = REPO_ROOT / "retriever" / "__main__.py"
COMMAND_NAMESPACE = "retriever"
COMMANDS_SUBDIR = Path("commands") / COMMAND_NAMESPACE
MANIFEST_PATH = Path("retriever-manifest.json")
MANAGED_MARKER = "<!-- Managed by Retriever setup. Re-run the installer to update. -->"
CLAUDE_MD_PATH = Path("CLAUDE.md")
CLAUDE_SECTION_START = "<!-- BEGIN RETRIEVER CLAUDE SECTION -->"
CLAUDE_SECTION_END = "<!-- END RETRIEVER CLAUDE SECTION -->"
PTH_FILENAME = "retriever.pth"
@dataclass(frozen=True)
class SlashCommandSpec:
name: str
description: str
@dataclass(frozen=True)
class FixedCommandSpec:
name: str
description: str
argv_after_tool: tuple[str, ...]
@dataclass(frozen=True)
class WorkspaceArgsCommandSpec:
name: str
description: str
subcommand: str
workspace_position: str
arguments_hint: str
always_args: tuple[str, ...] = ()
default_args_if_empty: tuple[str, ...] = ()
extra_guidance: tuple[str, ...] = ()
SLASH_COMMANDS: tuple[SlashCommandSpec, ...] = (
SlashCommandSpec("search", "Search the active Retriever workspace using the persistent browse session"),
SlashCommandSpec("filter", "Add or clear SQL-like filters on the active Retriever browse session"),
SlashCommandSpec("dataset", "Inspect, set, rename, or clear the active dataset scope"),
SlashCommandSpec("sort", "Inspect or change the sort order for the active Retriever results"),
SlashCommandSpec("columns", "Inspect or change the visible columns for Retriever result tables"),
SlashCommandSpec("page", "Jump to a specific results page in the active Retriever browse session"),
SlashCommandSpec("page-size", "Inspect or change the Retriever results page size"),
SlashCommandSpec("next", "Advance to the next page of Retriever results"),
SlashCommandSpec("previous", "Go back to the previous page of Retriever results"),
SlashCommandSpec("scope", "Inspect, save, load, list, or clear the current Retriever browse scope"),
SlashCommandSpec("bates", "Scope Retriever browsing to a Bates or production-number range"),
SlashCommandSpec("from-run", "Scope Retriever browsing to documents from a processing run"),
SlashCommandSpec("documents", "Switch Retriever browsing back to document mode"),
SlashCommandSpec("conversations", "Switch Retriever browsing to conversation mode"),
SlashCommandSpec("entities", "Switch Retriever browsing to entity mode"),
SlashCommandSpec("export", "Start, inspect, or resume Retriever table and archive exports"),
)
FIXED_COMMANDS: tuple[FixedCommandSpec, ...] = (
FixedCommandSpec(
"status",
"Check Retriever workspace readiness and runtime state",
("workspace", "status"),
),
FixedCommandSpec(
"init",
"Initialize or repair Retriever workspace state",
("workspace", "init"),
),
)
WORKSPACE_ARGS_COMMANDS: tuple[WorkspaceArgsCommandSpec, ...] = (
WorkspaceArgsCommandSpec(
"open",
"Open one Retriever document preview and include a short extracted-text summary",
"get-doc",
"first",
"Pass at least `--doc-id <id>`. Use `/retriever:search` first if you need to discover the document id.",
always_args=("--include-text", "summary"),
),
WorkspaceArgsCommandSpec(
"ingest",
"Start or resume Retriever ingest for the current workspace",
"ingest",
"last",
"Examples: `--recursive`, `--path raw`, `--file-types pdf,docx`.",
always_args=("--run-to-completion",),
default_args_if_empty=("--recursive",),
extra_guidance=(
"This command already includes `--run-to-completion`, so let it keep stepping until Retriever reaches a terminal ingest state.",
"Do not stop early or ask the user to continue manually unless the Bash command was interrupted or Claude explicitly backgrounded it.",
),
),
WorkspaceArgsCommandSpec(
"run",
"Resume or finish an existing Retriever processing run to a terminal state",
"run",
"first",
"Pass `--run-id <id>`. Use this when a translation, extraction, OCR, or image-description run was interrupted and needs to be resumed.",
extra_guidance=(
"This is the native one-shot processing runner. Let it continue until the run reaches a terminal state.",
),
),
WorkspaceArgsCommandSpec(
"translate",
"Create a translation run for the current scope or explicit selectors and execute it to completion",
"translate",
"first",
"Pass `--target-language <language>` and optional selectors like `--doc-id`, `--control-number`, `--filter`, `--dataset`, or `--keyword`.",
extra_guidance=(
"If you do not pass any selectors, Retriever automatically uses the current persisted browse scope.",
"Use `--provider` and `--model` when you want to override the default processing provider configuration.",
),
),
WorkspaceArgsCommandSpec(
"extract",
"Create a structured extraction run for one field and execute it to completion",
"extract",
"first",
"Pass `<field_name> --instruction \"...\"` and optional selectors like `--doc-id`, `--control-number`, `--filter`, `--dataset`, or `--keyword`.",
extra_guidance=(
"If you do not pass any selectors, Retriever automatically uses the current persisted browse scope.",
"Completed extraction runs auto-publish bound outputs into the target custom field.",
),
),
WorkspaceArgsCommandSpec(
"ocr",
"Create an OCR run and execute it to completion",
"ocr",
"first",
"Optional selectors: `--doc-id`, `--control-number`, `--filter`, `--dataset`, or `--keyword`. Use `--control-number` for visible `SR...` / production labels instead of `--doc-id`. Optional provider overrides: `--provider`, `--model`, `--parameters-json`.",
extra_guidance=(
"If you do not pass any selectors, Retriever automatically uses the current persisted browse scope.",
),
),
WorkspaceArgsCommandSpec(
"describe-images",
"Create an image-description run and execute it to completion",
"describe-images",
"first",
"Optional selectors: `--doc-id`, `--control-number`, `--filter`, `--dataset`, or `--keyword`. Optional provider overrides: `--provider`, `--model`, `--parameters-json`.",
extra_guidance=(
"If you do not pass any selectors, Retriever automatically uses the current persisted browse scope.",
),
),
)
def yaml_quote(value: str) -> str:
return json.dumps(value)
def shell_quote(path: Path | str) -> str:
return shlex.quote(str(path))
def retriever_command_prefix() -> str:
return "python3 -m retriever"
def render_frontmatter(description: str) -> str:
allowed_tools = "Bash(python3 -m retriever:*)"
return "\n".join(
(
"---",
f"description: {yaml_quote(description)}",
f"allowed-tools: {yaml_quote(allowed_tools)}",
"---",
"",
)
)
def render_slash_command(spec: SlashCommandSpec, *, tool_path: Path, repo_root: Path) -> str:
base_command = f"/{COMMAND_NAMESPACE}:{spec.name}"
del tool_path
example = f"{retriever_command_prefix()} slash \"$PWD\" '<slash command text>'"
if spec.name == "export":
execution_block = (
"```bash\n"
+ "slash_args=\"$ARGUMENTS\"\n"
+ "if [ -z \"$slash_args\" ]; then\n"
+ " slash_command=\"/export\"\n"
+ "else\n"
+ " slash_command=\"/export $slash_args\"\n"
+ "fi\n"
+ "case \"$slash_args\" in\n"
+ " table*|csv*|archive*)\n"
+ " case \" $slash_command \" in\n"
+ " *\" --run-to-completion \"*) ;;\n"
+ " *) slash_command=\"$slash_command --run-to-completion\" ;;\n"
+ " esac\n"
+ " ;;\n"
+ "esac\n"
+ f"{retriever_command_prefix()} slash \"$PWD\" \"$slash_command\"\n"
+ "```\n\n"
)
slash_guidance = (
"Build the slash command from the user arguments, then run the shell script above exactly once.\n"
"- `/export table ...` and `/export archive ...` should always keep the hidden `--run-to-completion` suffix.\n"
"- `/export status ...` should pass through unchanged.\n\n"
)
else:
execution_block = "```bash\n" + example + "\n```\n\n"
slash_guidance = (
"Build `<slash command text>` as:\n"
+ f"- `/{spec.name}` if no user arguments were provided\n"
+ f"- otherwise `/{spec.name} ` followed by the exact user arguments\n\n"
+ "Quote the full slash command as one shell argument safely.\n\n"
)
return (
render_frontmatter(spec.description)
+ MANAGED_MARKER
+ "\n\n"
+ f"# Retriever {base_command}\n\n"
+ "Use Retriever's existing persistent browse/session surface for the current workspace.\n\n"
+ "- Workspace root: current Claude working directory (`$PWD`)\n"
+ f"- Retriever repo: `{repo_root}`\n"
+ "- User arguments: `$ARGUMENTS`\n\n"
+ "Use the Bash tool to run exactly one Retriever command:\n\n"
+ execution_block
+ slash_guidance
+ "Return stdout exactly as the entire response. No preamble. No commentary. No reformatting.\n"
)
def render_fixed_command(spec: FixedCommandSpec, *, tool_path: Path, repo_root: Path) -> str:
del tool_path
argv = [*retriever_command_prefix().split(), *spec.argv_after_tool, "$PWD"]
display_command = " ".join(shell_quote(part) if part != "$PWD" else '"$PWD"' for part in argv)
return (
render_frontmatter(spec.description)
+ MANAGED_MARKER
+ "\n\n"
+ f"# Retriever /{COMMAND_NAMESPACE}:{spec.name}\n\n"
+ "- Workspace root: current Claude working directory (`$PWD`)\n"
+ f"- Retriever repo: `{repo_root}`\n\n"
+ "Use the Bash tool to run exactly one Retriever command:\n\n"
+ "```bash\n"
+ display_command
+ "\n```\n\n"
+ "Return stdout exactly as the entire response. No preamble. No commentary. No reformatting.\n"
)
def render_workspace_args_command(spec: WorkspaceArgsCommandSpec, *, tool_path: Path, repo_root: Path) -> str:
always_args_display = " ".join(shell_quote(arg) for arg in spec.always_args)
default_args_display = " ".join(shell_quote(arg) for arg in spec.default_args_if_empty)
if spec.workspace_position == "first":
if default_args_display:
display_command = (
f"{retriever_command_prefix()} {spec.subcommand} "
+ (f"{always_args_display} " if always_args_display else "")
+ "\"$PWD\" [user arguments or default arguments]"
)
else:
display_command = (
f"{retriever_command_prefix()} {spec.subcommand} "
+ (f"{always_args_display} " if always_args_display else "")
+ "\"$PWD\" [user arguments]"
)
placement_rule = "Place the workspace path before the user arguments."
elif spec.workspace_position == "last":
if default_args_display:
display_command = (
f"{retriever_command_prefix()} {spec.subcommand} "
+ (f"{always_args_display} " if always_args_display else "")
+ "[user arguments or default arguments] \"$PWD\""
)
else:
display_command = (
f"{retriever_command_prefix()} {spec.subcommand} "
+ (f"{always_args_display} " if always_args_display else "")
+ "[user arguments] \"$PWD\""
)
placement_rule = "Place all user arguments before the workspace path."
else:
raise ValueError(f"Unknown workspace_position: {spec.workspace_position}")
if spec.default_args_if_empty:
empty_args_rule = (
"If the user did not provide any arguments, use these default arguments instead: "
f"`{default_args_display}`."
)
else:
empty_args_rule = "If no arguments are needed, omit `[user arguments]` entirely."
if spec.always_args:
always_args_rule = f"Always include these arguments: `{always_args_display}`."
else:
always_args_rule = None
return (
render_frontmatter(spec.description)
+ MANAGED_MARKER
+ "\n\n"
+ f"# Retriever /{COMMAND_NAMESPACE}:{spec.name}\n\n"
+ "- Workspace root: current Claude working directory (`$PWD`)\n"
+ f"- Retriever repo: `{repo_root}`\n"
+ "- User arguments: `$ARGUMENTS`\n\n"
+ "Use the Bash tool to run exactly one Retriever command:\n\n"
+ "```bash\n"
+ display_command
+ "\n```\n\n"
+ placement_rule
+ "\n"
+ spec.arguments_hint
+ "\n\n"
+ (always_args_rule + "\n\n" if always_args_rule else "")
+ empty_args_rule
+ "\n\n"
+ ("\n".join(spec.extra_guidance) + "\n\n" if spec.extra_guidance else "")
+ "Return stdout exactly as the entire response. No preamble. No commentary. No reformatting.\n"
)
def load_manifest(path: Path) -> dict[str, object] | None:
if not path.exists():
return None
return json.loads(path.read_text(encoding="utf-8"))
def managed_paths_from_manifest(manifest: dict[str, object] | None, claude_home: Path) -> set[Path]:
if not manifest:
return set()
files = manifest.get("files")
if not isinstance(files, list):
return set()
return {claude_home / relpath for relpath in files if isinstance(relpath, str)}
def remove_previous_managed_files(paths: set[Path], commands_dir: Path) -> None:
for path in sorted(paths, reverse=True):
if not path.exists():
continue
if commands_dir not in path.parents:
continue
path.unlink()
def render_claude_md_section() -> str:
commands = [
"/retriever:init",
"/retriever:status",
"/retriever:ingest",
"/retriever:run",
"/retriever:translate",
"/retriever:extract",
"/retriever:ocr",
"/retriever:describe-images",
"/retriever:search",
"/retriever:filter",
"/retriever:dataset",
"/retriever:sort",
"/retriever:columns",
"/retriever:page",
"/retriever:page-size",
"/retriever:next",
"/retriever:previous",
"/retriever:documents",
"/retriever:conversations",
"/retriever:entities",
"/retriever:open",
"/retriever:export",
]
command_lines = "\n".join(f"- `{command}`" for command in commands)
return (
f"{CLAUDE_SECTION_START}\n"
+ "## Retriever\n\n"
+ "When a workspace contains a Retriever state directory at `./.retriever/`, prefer Retriever's installed slash commands over ad hoc Bash, Python, or SQL.\n\n"
+ "Selection order:\n"
+ "1. Use a `/retriever:*` slash command when it can satisfy the user's request.\n"
+ "2. If no slash command fits, call the Retriever CLI directly with `python3 -m retriever ...`.\n"
+ "3. Query `./.retriever/retriever.db` directly only for debugging or verification that Retriever cannot already answer.\n\n"
+ "Behavior rules:\n"
+ "- Preserve Retriever's stateful browse model. Prefer `/retriever:search`, `/retriever:documents`, `/retriever:conversations`, `/retriever:entities`, `/retriever:filter`, `/retriever:dataset`, `/retriever:sort`, `/retriever:columns`, `/retriever:page`, `/retriever:page-size`, `/retriever:next`, `/retriever:previous`, `/retriever:scope`, `/retriever:bates`, and `/retriever:from-run` over stateless one-off queries when the user is browsing.\n"
+ "- Default processing commands to the Claude Code provider when the `claude` CLI is installed. Treat `claude_code` and legacy `cowork_agent` as the same Claude-backed execution path.\n"
+ "- For long-running ingest, export, and processing work, prefer the one-shot commands that already run to completion: `/retriever:ingest`, `/retriever:run`, `/retriever:translate`, `/retriever:extract`, `/retriever:ocr`, `/retriever:describe-images`, and `/retriever:export`. Only fall back to direct backend recovery commands like `python3 -m retriever ingest-status ...` or `python3 -m retriever run-status ...` if the original command was interrupted.\n"
+ "- Prefer `/retriever:open` for document previews. Do not rely on HTML anchors in preview URLs unless Claude Code preview handling is known to respect them.\n"
+ "- Return Retriever's human summaries directly when they are sufficient. Avoid reprinting raw JSON unless the user asks for it.\n\n"
+ "- After a successful Retriever command, suggest the single most reasonable next Retriever command when there is an obvious next step. Prefer a concrete `/retriever:*` command with arguments. Do not force a next command when the task is already complete or the user explicitly wants to stop.\n\n"
+ "Available Retriever commands:\n"
+ f"{command_lines}\n"
+ f"{CLAUDE_SECTION_END}\n"
)
def update_claude_md(claude_md_path: Path) -> None:
rendered_section = render_claude_md_section().rstrip() + "\n"
if claude_md_path.exists():
current = claude_md_path.read_text(encoding="utf-8")
else:
current = ""
start = current.find(CLAUDE_SECTION_START)
end = current.find(CLAUDE_SECTION_END)
if start != -1 and end != -1 and end > start:
end += len(CLAUDE_SECTION_END)
updated = current[:start].rstrip()
if updated:
updated += "\n\n"
updated += rendered_section
tail = current[end:].lstrip("\n")
if tail:
updated += "\n" + tail
else:
updated = current.rstrip()
if updated:
updated += "\n\n"
updated += rendered_section
claude_md_path.parent.mkdir(parents=True, exist_ok=True)
claude_md_path.write_text(updated, encoding="utf-8")
def install_python_package_entrypoint(repo_root: Path, python_site_packages: Path) -> Path:
python_site_packages.mkdir(parents=True, exist_ok=True)
pth_path = python_site_packages / PTH_FILENAME
pth_path.write_text(str(repo_root) + "\n", encoding="utf-8")
return pth_path
def parse_args(argv: list[str]) -> argparse.Namespace:
parser = argparse.ArgumentParser(
description="Install Retriever Claude Code commands globally under ~/.claude/commands/retriever."
)
parser.add_argument(
"--claude-home",
default=str(Path.home() / ".claude"),
help="Claude home directory. Defaults to ~/.claude.",
)
parser.add_argument(
"--repo-root",
default=str(REPO_ROOT),
help="Retriever checkout to call from installed commands. Defaults to this repository.",
)
parser.add_argument(
"--python-site-packages",
default=str(Path(site.getusersitepackages()).expanduser()),
help="User site-packages directory that should receive the Retriever .pth registration.",
)
parser.add_argument(
"--force",
action="store_true",
help="Overwrite existing Retriever-managed files inside the retriever command namespace.",
)
return parser.parse_args(argv)
def main(argv: list[str] | None = None) -> int:
args = parse_args(sys.argv[1:] if argv is None else argv)
claude_home = Path(args.claude_home).expanduser().resolve()
repo_root = Path(args.repo_root).expanduser().resolve()
python_site_packages = Path(args.python_site_packages).expanduser().resolve()
tool_path = repo_root / "skills" / "tool-template" / "tools.py"
package_main_path = repo_root / "retriever" / "__main__.py"
commands_dir = claude_home / COMMANDS_SUBDIR
manifest_path = claude_home / MANIFEST_PATH
claude_md_path = claude_home / CLAUDE_MD_PATH
if not tool_path.exists():
raise SystemExit(f"Could not find Retriever tools.py at: {tool_path}")
if not package_main_path.exists():
raise SystemExit(f"Could not find Retriever package entrypoint at: {package_main_path}")
previous_manifest = load_manifest(manifest_path)
previous_managed_files = managed_paths_from_manifest(previous_manifest, claude_home)
rendered_files = {
**{
f"{spec.name}.md": render_slash_command(spec, tool_path=tool_path, repo_root=repo_root)
for spec in SLASH_COMMANDS
},
**{
f"{spec.name}.md": render_fixed_command(spec, tool_path=tool_path, repo_root=repo_root)
for spec in FIXED_COMMANDS
},
**{
f"{spec.name}.md": render_workspace_args_command(spec, tool_path=tool_path, repo_root=repo_root)
for spec in WORKSPACE_ARGS_COMMANDS
},
}
target_paths = {commands_dir / filename for filename in rendered_files}
if commands_dir.exists():
unmanaged_paths = sorted(
path
for path in commands_dir.glob("*.md")
if path not in previous_managed_files and path not in target_paths
)
if unmanaged_paths and not args.force:
collision_list = "\n".join(f"- {path}" for path in unmanaged_paths)
raise SystemExit(
"Refusing to install because the Retriever namespace already contains unmanaged command files:\n"
+ collision_list
+ "\nRe-run with --force if you want to overwrite the namespace."
)
commands_dir.mkdir(parents=True, exist_ok=True)
remove_previous_managed_files(previous_managed_files - target_paths, commands_dir)
for filename, content in sorted(rendered_files.items()):
(commands_dir / filename).write_text(content, encoding="utf-8")
pth_path = install_python_package_entrypoint(repo_root, python_site_packages)
manifest = {
"schema_version": 1,
"repo_root": str(repo_root),
"command_namespace": COMMAND_NAMESPACE,
"command_subdir": str(COMMANDS_SUBDIR),
"python_site_packages": str(python_site_packages),
"python_path_file": str(pth_path),
"files": [str(path.relative_to(claude_home)) for path in sorted(target_paths)],
}
manifest_path.parent.mkdir(parents=True, exist_ok=True)
manifest_path.write_text(json.dumps(manifest, indent=2, sort_keys=True) + "\n", encoding="utf-8")
update_claude_md(claude_md_path)
print(f"Installed {len(rendered_files)} Retriever Claude commands into {commands_dir}")
print(f"Registered `python3 -m retriever` via {pth_path}")
print(f"Updated Retriever guidance in {claude_md_path}")
print("Open Claude Code in a Retriever workspace root and run `/help` to see the new namespaced commands.")
print(
"Primary commands: /retriever:init, /retriever:status, /retriever:ingest, /retriever:run, "
"/retriever:translate, /retriever:extract, /retriever:ocr, /retriever:describe-images, "
"/retriever:search, /retriever:open, /retriever:export"
)
return 0
if __name__ == "__main__":
raise SystemExit(main())