Skip to content

Commit f761570

Browse files
committed
Wire Office Plane commands into sourceosctl CLI
1 parent 7da1be5 commit f761570

1 file changed

Lines changed: 84 additions & 0 deletions

File tree

sourceosctl/cli.py

Lines changed: 84 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
ai,
1414
agents,
1515
agent_machine,
16+
office,
1617
)
1718

1819

@@ -194,6 +195,89 @@ def add_mount_common(p):
194195
mounts_evidence_inspect_p.add_argument("path", help="Path to mount evidence JSON file")
195196
mounts_evidence_inspect_p.set_defaults(func=agent_machine.mounts_evidence_inspect)
196197

198+
# --- office ---
199+
office_p = sub.add_parser("office", help="Office Plane helpers")
200+
office_sub = office_p.add_subparsers(dest="office_command", metavar="<subcommand>")
201+
office_sub.required = True
202+
203+
def add_office_common(p):
204+
p.add_argument("--workroom-id", default="workroom-local-default", help="Professional Workroom id")
205+
p.add_argument("--title", default="Untitled Office Artifact", help="Office artifact title")
206+
p.add_argument(
207+
"--artifact-type",
208+
default="document",
209+
choices=office.SUPPORTED_ARTIFACT_TYPES,
210+
help="Office artifact type",
211+
)
212+
p.add_argument(
213+
"--format",
214+
default="docx",
215+
choices=office.SUPPORTED_FORMATS,
216+
help="Office artifact output format",
217+
)
218+
p.add_argument("--backend", default="libreoffice", help="Office backend engine")
219+
p.add_argument("--mode", default="local-headless", help="Office backend mode")
220+
p.add_argument(
221+
"--output-root",
222+
default="~/Documents/SourceOS/agent-output",
223+
help="Host Office output root",
224+
)
225+
p.add_argument(
226+
"--downloads-root",
227+
default="~/Downloads/SourceOS/agent-downloads",
228+
help="Host scoped browser downloads root",
229+
)
230+
p.add_argument("--template-root", default="~/dev", help="Host template/code root")
231+
232+
office_doctor_p = office_sub.add_parser("doctor", help="Inspect local Office backend availability")
233+
office_doctor_p.set_defaults(func=office.doctor)
234+
235+
office_plan_p = office_sub.add_parser("plan", help="Render OfficeArtifact-compatible plan")
236+
add_office_common(office_plan_p)
237+
office_plan_p.set_defaults(func=office.plan)
238+
239+
office_generate_p = office_sub.add_parser("generate", help="Render Office generation plan (dry-run only)")
240+
add_office_common(office_generate_p)
241+
office_generate_p.add_argument("--template", default=None, help="Optional template reference")
242+
office_generate_p.add_argument("--prompt-ref", default=None, help="Optional prompt/context reference")
243+
office_generate_p.add_argument("--data-ref", default=None, help="Optional structured data reference")
244+
office_generate_p.add_argument(
245+
"--dry-run",
246+
action="store_true",
247+
default=True,
248+
dest="dry_run",
249+
help="Print generation plan without writing files (default: True)",
250+
)
251+
office_generate_p.set_defaults(func=office.generate)
252+
253+
office_convert_p = office_sub.add_parser("convert", help="Render Office conversion plan (dry-run only)")
254+
office_convert_p.add_argument("input", help="Input Office artifact path")
255+
office_convert_p.add_argument("--to", required=True, help="Target format, e.g. pdf, docx, pptx")
256+
add_office_common(office_convert_p)
257+
office_convert_p.add_argument(
258+
"--dry-run",
259+
action="store_true",
260+
default=True,
261+
dest="dry_run",
262+
help="Print conversion plan without writing files (default: True)",
263+
)
264+
office_convert_p.set_defaults(func=office.convert)
265+
266+
office_inspect_p = office_sub.add_parser("inspect", help="Inspect an Office artifact file")
267+
office_inspect_p.add_argument("path", help="Path to Office artifact file")
268+
office_inspect_p.set_defaults(func=office.inspect)
269+
270+
office_evidence_p = office_sub.add_parser("evidence", help="Office evidence helpers")
271+
office_evidence_sub = office_evidence_p.add_subparsers(
272+
dest="office_evidence_command", metavar="<subcommand>"
273+
)
274+
office_evidence_sub.required = True
275+
office_evidence_inspect_p = office_evidence_sub.add_parser(
276+
"inspect", help="Inspect an Office Plane evidence JSON file"
277+
)
278+
office_evidence_inspect_p.add_argument("path", help="Path to Office evidence JSON file")
279+
office_evidence_inspect_p.set_defaults(func=office.evidence_inspect)
280+
197281
return parser
198282

199283

0 commit comments

Comments
 (0)