mirror of
https://github.com/paperclipai/companies-tool.git
synced 2026-11-07 06:15:58 -10:00
Remove company-name override flow
Co-Authored-By: Paperclip <[email protected]>
This commit is contained in:
1 parent
45261d945a
commit
b76ff01c33
6 files changed
+9
-48
No files matched your search
+4
-5
@@ -21,16 +21,15 @@ pnpm build
|
||||
node dist/index.js add ./fixtures/minimal-company \
|
||||
--connection custom-url \
|
||||
--api-base http://127.0.0.1:3100 \
|
||||
--target new \
|
||||
--new-company-name "Companies Local Hand Test"
|
||||
--target new
|
||||
```
|
||||
|
||||
Then open `http://127.0.0.1:3100` in the browser and confirm that **Companies Local Hand Test** appears in the company list.
|
||||
Then open `http://127.0.0.1:3100` in the browser and confirm that **Minimal Company** appears in the company list.
|
||||
|
||||
If you want the wrapper to manage local bootstrap for you instead, run:
|
||||
|
||||
```bash
|
||||
node dist/index.js add ./fixtures/minimal-company --target new --new-company-name "Companies Local Hand Test"
|
||||
node dist/index.js add ./fixtures/minimal-company --target new
|
||||
```
|
||||
|
||||
That path uses the bundled `paperclipai` canary, runs `paperclipai onboard --yes` when needed, and starts the local server automatically before importing.
|
||||
@@ -93,7 +92,7 @@ chmod +x /app/companies.sh
|
||||
ln -s /app/companies.sh /app/companies
|
||||
export PATH="/app:$PATH"
|
||||
DATA_DIR=$(mktemp -d "$TMPDIR/companies-docker-handtest.XXXXXX")
|
||||
companies.sh add ./fixtures/minimal-company --yes --data-dir "$DATA_DIR" --target new --new-company-name "Docker Hand Test"
|
||||
companies.sh add ./fixtures/minimal-company --yes --data-dir "$DATA_DIR" --target new
|
||||
companies.sh list --yes --data-dir "$DATA_DIR"
|
||||
node --input-type=module -e 'const response = await fetch("http://127.0.0.1:3210/"); console.log(response.status);'
|
||||
```
|
||||
|
||||
@@ -71,7 +71,6 @@ npx companies.sh add ./my-company
|
||||
| `-p, --provider <provider>` | Destination orchestrator. Default: `paperclip`. |
|
||||
| `--target <mode>` | Import into a `new` or `existing` Paperclip company. |
|
||||
| `-C, --company-id <id>` | Optional target company id for `--target existing`; omit it to choose from the Paperclip company list. |
|
||||
| `--new-company-name <name>` | Override the imported company name when using `--target new`. |
|
||||
| `--include <values>` | Comma-separated subset of `company,agents,projects,tasks,skills`. Default: `company,agents`. |
|
||||
| `--agents <list>` | Comma-separated agent slugs to import, or `all`. Default: `all`. |
|
||||
| `--collision <mode>` | Collision strategy: `rename`, `skip`, or `replace`. Default: `rename`. |
|
||||
|
||||
@@ -91,9 +91,9 @@ if command -v paperclipai >/dev/null 2>&1; then
|
||||
fi
|
||||
|
||||
DATA_DIR="$(mktemp -d "$TMPDIR/companies-docker-npx.XXXXXX")"
|
||||
COMPANY_NAME="Docker NPX Smoke Company"
|
||||
COMPANY_NAME="GStack"
|
||||
|
||||
if ! npx companies.sh add paperclipai/companies/gstack --yes --data-dir "$DATA_DIR" --target new --new-company-name "$COMPANY_NAME"; then
|
||||
if ! npx companies.sh add paperclipai/companies/gstack --yes --data-dir "$DATA_DIR" --target new; then
|
||||
if [[ -f /app/paperclipai-npx.log ]]; then
|
||||
cat /app/paperclipai-npx.log >&2
|
||||
fi
|
||||
|
||||
@@ -94,9 +94,9 @@ ln -s /app/companies.sh /app/companies
|
||||
export PATH="/app:$PATH"
|
||||
|
||||
DATA_DIR="$(mktemp -d "$TMPDIR/companies-docker-smoke.XXXXXX")"
|
||||
COMPANY_NAME="Docker Smoke Company"
|
||||
COMPANY_NAME="Minimal Company"
|
||||
|
||||
if ! companies.sh add ./fixtures/minimal-company --yes --data-dir "$DATA_DIR" --target new --new-company-name "$COMPANY_NAME"; then
|
||||
if ! companies.sh add ./fixtures/minimal-company --yes --data-dir "$DATA_DIR" --target new; then
|
||||
if [[ -f /app/paperclipai.log ]]; then
|
||||
cat /app/paperclipai.log >&2
|
||||
fi
|
||||
|
||||
@@ -10,7 +10,6 @@ import {
|
||||
isDirectCliInvocation,
|
||||
pickProvider,
|
||||
promptPaperclipConnection,
|
||||
promptNewCompanyName,
|
||||
promptSource,
|
||||
promptTargetMode,
|
||||
resolvePaperclipRunApiBase,
|
||||
@@ -84,10 +83,6 @@ test("promptTargetMode defaults to new in non-interactive mode", async () => {
|
||||
assert.equal(await promptTargetMode(undefined, true), "new");
|
||||
});
|
||||
|
||||
test("promptNewCompanyName skips the prompt in non-interactive mode", async () => {
|
||||
assert.equal(await promptNewCompanyName(undefined, true), undefined);
|
||||
});
|
||||
|
||||
test("promptSource fails fast in non-interactive mode when no source is provided", async () => {
|
||||
await assert.rejects(() => promptSource(undefined, true), /A source is required in non-interactive mode/);
|
||||
});
|
||||
|
||||
+1
-33
@@ -1,6 +1,6 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import { intro, outro, select, text, confirm, isCancel, cancel, note } from "@clack/prompts";
|
||||
import { intro, outro, select, text, isCancel, cancel, note } from "@clack/prompts";
|
||||
import { Command } from "commander";
|
||||
import pc from "picocolors";
|
||||
import { readFileSync, realpathSync } from "node:fs";
|
||||
@@ -42,7 +42,6 @@ interface BaseOptions extends CommonPaperclipOptions {
|
||||
interface AddOptions extends BaseOptions {
|
||||
include?: string;
|
||||
target?: TargetMode;
|
||||
newCompanyName?: string;
|
||||
agents?: string;
|
||||
collision?: CollisionMode;
|
||||
dryRun?: boolean;
|
||||
@@ -252,27 +251,6 @@ async function promptExistingCompanyId(options: BaseOptions): Promise<string> {
|
||||
return coerceCancel(picked).trim();
|
||||
}
|
||||
|
||||
export async function promptNewCompanyName(
|
||||
current: string | undefined,
|
||||
skipPrompts: boolean,
|
||||
): Promise<string | undefined> {
|
||||
if (current?.trim()) return current.trim();
|
||||
if (skipPrompts) return undefined;
|
||||
|
||||
const shouldOverride = await confirm({
|
||||
message: "Override the imported company name?",
|
||||
initialValue: false,
|
||||
});
|
||||
|
||||
if (!coerceCancel(shouldOverride)) return undefined;
|
||||
|
||||
const result = await text({
|
||||
message: "New company name",
|
||||
placeholder: "Imported Company",
|
||||
});
|
||||
return coerceCancel(result).trim() || undefined;
|
||||
}
|
||||
|
||||
export function resolvePaperclipRunApiBase(
|
||||
mode: ConnectionMode,
|
||||
apiBase: string,
|
||||
@@ -333,7 +311,6 @@ export function buildAddPaperclipArgs(input: {
|
||||
agents?: string;
|
||||
collision?: CollisionMode;
|
||||
companyId?: string;
|
||||
newCompanyName?: string;
|
||||
dryRun?: boolean;
|
||||
yes?: boolean;
|
||||
}): string[] {
|
||||
@@ -354,9 +331,6 @@ export function buildAddPaperclipArgs(input: {
|
||||
if (input.companyId) {
|
||||
args.push("--company-id", input.companyId);
|
||||
}
|
||||
if (input.newCompanyName) {
|
||||
args.push("--new-company-name", input.newCompanyName);
|
||||
}
|
||||
if (input.dryRun) {
|
||||
args.push("--dry-run");
|
||||
}
|
||||
@@ -386,10 +360,6 @@ export async function handleAdd(source: string | undefined, options: AddOptions)
|
||||
|
||||
const telemetry = await prepareInstallTelemetry(normalizedSource, target);
|
||||
|
||||
const newCompanyName = target === "new"
|
||||
? await promptNewCompanyName(options.newCompanyName, Boolean(options.yes))
|
||||
: undefined;
|
||||
|
||||
const prepared = await preparePaperclipWithConnection(connection, options);
|
||||
const paperclipOptions: AddOptions = {
|
||||
...options,
|
||||
@@ -407,7 +377,6 @@ export async function handleAdd(source: string | undefined, options: AddOptions)
|
||||
agents: options.agents,
|
||||
collision: options.collision,
|
||||
companyId,
|
||||
newCompanyName,
|
||||
dryRun: options.dryRun,
|
||||
yes: options.yes,
|
||||
});
|
||||
@@ -461,7 +430,6 @@ addCommonOptions(
|
||||
.option("--connection <mode>", "Paperclip connection mode: auto | custom-url")
|
||||
.option("--include <values>", INCLUDE_OPTION_DESCRIPTION, "company,agents")
|
||||
.option("--target <mode>", "Import target: new | existing")
|
||||
.option("--new-company-name <name>", "Name override when creating a new company")
|
||||
.option("--agents <list>", "Comma-separated agent slugs to import, or all", "all")
|
||||
.option("--collision <mode>", "Collision strategy: rename | skip | replace", "rename")
|
||||
.option("--dry-run", "Preview the import without applying it", false)
|
||||
|
||||
Reference in new issue
Block a user