Use positional source arg for company import

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
dotta 2026-03-23 06:34:24 -05:00
parent e204e03fa6
commit 5a73556871
5 changed files with 9 additions and 12 deletions

View file

@ -390,7 +390,6 @@ describe("paperclipai company import/export e2e", () => {
[
"company",
"import",
"--from",
exportDir,
"--target",
"new",
@ -435,7 +434,6 @@ describe("paperclipai company import/export e2e", () => {
[
"company",
"import",
"--from",
exportDir,
"--target",
"existing",
@ -463,7 +461,6 @@ describe("paperclipai company import/export e2e", () => {
[
"company",
"import",
"--from",
exportDir,
"--target",
"existing",

View file

@ -390,7 +390,7 @@ export function registerCompanyCommands(program: Command): void {
company
.command("import")
.description("Import a portable markdown company package from local path, URL, or GitHub")
.requiredOption("--from <pathOrUrl>", "Source path or URL")
.argument("<fromPathOrUrl>", "Source path or URL")
.option("--include <values>", "Comma-separated include set: company,agents,projects,issues,tasks,skills", "company,agents")
.option("--target <mode>", "Target mode: new | existing")
.option("-C, --company-id <id>", "Existing target company ID")
@ -398,12 +398,12 @@ export function registerCompanyCommands(program: Command): void {
.option("--agents <list>", "Comma-separated agent slugs to import, or all", "all")
.option("--collision <mode>", "Collision strategy: rename | skip | replace", "rename")
.option("--dry-run", "Run preview only without applying", false)
.action(async (opts: CompanyImportOptions) => {
.action(async (fromPathOrUrl: string, opts: CompanyImportOptions) => {
try {
const ctx = resolveCommandContext(opts);
const from = (opts.from ?? "").trim();
const from = fromPathOrUrl.trim();
if (!from) {
throw new Error("--from is required");
throw new Error("Source path or URL is required.");
}
const include = parseInclude(opts.include);

View file

@ -60,7 +60,7 @@ Route registration lives in `server/src/app.ts` via `companyRoutes(db, storage)`
| File | Commands |
|---|---|
| `cli/src/commands/client/company.ts` | `company export` — exports a company package to disk (flags: `--out`, `--include`, `--projects`, `--issues`, `--projectIssues`).<br>`company import` — imports a company package from a file or folder (flags: `--from`, `--include`, `--target`, `--companyId`, `--newCompanyName`, `--agents`, `--collision`, `--dryRun`).<br>Reads/writes portable file entries and handles `.paperclip.yaml` filtering. |
| `cli/src/commands/client/company.ts` | `company export` — exports a company package to disk (flags: `--out`, `--include`, `--projects`, `--issues`, `--projectIssues`).<br>`company import <fromPathOrUrl>` — imports a company package from a file or folder (flags: positional source path/URL, `--include`, `--target`, `--companyId`, `--newCompanyName`, `--agents`, `--collision`, `--dryRun`).<br>Reads/writes portable file entries and handles `.paperclip.yaml` filtering. |
## 7. UI — Pages

View file

@ -484,8 +484,8 @@ The CLI should continue to support direct import/export without a registry.
Target commands:
- `paperclipai company export <company-id> --out <path>`
- `paperclipai company import --from <path-or-url> --dry-run`
- `paperclipai company import --from <path-or-url> --target existing -C <company-id>`
- `paperclipai company import <path-or-url> --dry-run`
- `paperclipai company import <path-or-url> --target existing -C <company-id>`
Planned additions:

View file

@ -41,7 +41,7 @@ pnpm paperclipai company export <company-id> --out ./exports/acme --include comp
# Preview import (no writes)
pnpm paperclipai company import \
--from https://github.com/<owner>/<repo>/tree/main/<path> \
https://github.com/<owner>/<repo>/tree/main/<path> \
--target existing \
--company-id <company-id> \
--collision rename \
@ -49,7 +49,7 @@ pnpm paperclipai company import \
# Apply import
pnpm paperclipai company import \
--from ./exports/acme \
./exports/acme \
--target new \
--new-company-name "Acme Imported" \
--include company,agents