Default agentworkforce create to the cwd persona dir#50
Conversation
`agentworkforce create` now writes to `<cwd>/.agentworkforce/workforce/personas` unconditionally, creating the directory if it does not already exist. The previous behavior fell back to the user persona dir when no cwd-local workforce was present, which made the project-local layout opt-in. Override with `--to <target>` (or persist a non-cwd default via `--save-default` / `defaultCreateTarget`). Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
📝 WalkthroughWalkthroughThe PR renames the create flag to --save-in-directory, makes the default persona save location the cwd-local .agentworkforce/workforce/personas (created if missing), and updates CLI parsing, help, README/CHANGELOG docs, persona-maker inputs, and tests to match. ChangesDefault Persona Creation Target & CLI Flag Rename
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~20 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 13ac187fd9
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "default": ".agentworkforce/workforce/personas" | ||
| }, | ||
| "CREATE_MODE": { | ||
| "description": "local|built-in: local writes JSON only; built-in also updates repo catalog/routing/test/docs.", |
There was a problem hiding this comment.
Keep built-in persona-maker default output in
personas/
When persona-maker is invoked directly (for example via agentworkforce agent persona-maker), runtime input defaults come from this generated spec, not from create's injected values. Setting TARGET_DIR to .agentworkforce/workforce/personas while leaving CREATE_MODE defaulted to built-in makes built-in authoring write the new JSON outside the repo personas/ tree, so the generator/checklist flow can miss the new file and fail integration. This regression only appears outside agentworkforce create, where no explicit TARGET_DIR is passed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@personas/persona-maker.json`:
- Line 17: Update the TARGET_DIR description string in persona-maker.json to
reflect actual precedence: note that the CLI default
`<cwd>/.agentworkforce/workforce/personas` is used unless `--to` is provided,
but when `--to` is absent a persisted config value `defaultCreateTarget` will
override the CLI default; edit the description text to mention
`defaultCreateTarget` alongside `--to` and the CLI default so the behavior
described matches the implementation.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: b151cada-1afb-455d-96db-8817407cd5ad
⛔ Files ignored due to path filters (1)
packages/workload-router/src/generated/personas.tsis excluded by!**/generated/**
📒 Files selected for processing (8)
README.mdpackages/cli/CHANGELOG.mdpackages/cli/README.mdpackages/cli/src/cli.test.tspackages/cli/src/cli.tspackages/cli/src/local-personas.tspackages/workload-router/src/index.test.tspersonas/persona-maker.json
Replaces the somewhat opaque `--to <target>` flag with the more descriptive `--save-in-directory=<target>` (also accepted as `--save-in-directory <target>`). The previous name is removed without a back-compat alias — `--to` now triggers the standard "unexpected argument" guard, so the rename surfaces in stderr instead of silently continuing. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
|
@copilot resolve the merge conflicts in this pull request |
…r-default-dir # Conflicts: # packages/cli/CHANGELOG.md Co-authored-by: willwashburn <957608+willwashburn@users.noreply.github.com>
Resolved and pushed: I merged |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/cli.ts`:
- Around line 2345-2354: The parsing currently accepts empty or whitespace-only
values for the --save-in-directory flag; update both branches that set
flags.saveInDirectory (the valueOf(i, arg) branch and the inline
--save-in-directory=... branch) to trim the obtained value and reject it if it
is an empty/whitespace-only string by calling die(`create: --save-in-directory
requires a value.`). Also add the same trim+non-empty validation where the code
later resolves defaults (the block that inspects flags.saveInDirectory around
the later defaulting logic) so whitespace-only values cannot be treated as a
valid target.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: f0684bc1-ebc7-452c-be02-338f7d95017b
⛔ Files ignored due to path filters (1)
packages/workload-router/src/generated/personas.tsis excluded by!**/generated/**
📒 Files selected for processing (7)
README.mdpackages/agentworkforce/README.mdpackages/cli/CHANGELOG.mdpackages/cli/README.mdpackages/cli/src/cli.test.tspackages/cli/src/cli.tspersonas/persona-maker.json
✅ Files skipped from review due to trivial changes (3)
- packages/agentworkforce/README.md
- packages/cli/CHANGELOG.md
- README.md
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/cli/src/cli.test.ts
- personas/persona-maker.json
- persona-maker's `CREATE_MODE` defaulted to `built-in` while `TARGET_DIR` defaulted to the cwd-local persona dir. Direct `agentworkforce agent persona-maker` runs (i.e. no `create`-injected inputs) would then ask the agent to write a built-in persona — which expects writes into the repo's `personas/` library plus catalog edits — into a cwd-local path. Default `CREATE_MODE` to `local` so the two inputs agree out of the box; the CLI still upgrades to `built-in` when `--save-in-directory=library` is selected. - TARGET_DIR description now mentions `defaultCreateTarget` alongside the CLI flag so persona-maker's own docs match the actual override precedence. - `parseCreateArgs` now trims `--save-in-directory` values and rejects empty/whitespace-only inputs in both the `=` and space-separated forms, so a wrapper passing an unset variable fails fast instead of silently saving to the cwd default. Addresses review feedback on PR #50. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
There was a problem hiding this comment.
Actionable comments posted: 2
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/cli/src/cli.ts`:
- Around line 2364-2384: The CLI parsing removed support for the existing --to
flag; restore --to as an alias for --save-in-directory by updating the argument
checks around the create command where flags.saveInDirectory is set (the blocks
handling '--save-in-directory' and '--save-in-directory='). Specifically, accept
'--to' and '--to=' variants the same way (call valueOf(i, arg) for '--to' and
slice for '--to='), validate non-empty values the same way, and set
flags.saveInDirectory when either flag is used so existing scripts continue to
work unless you intend a breaking rename.
- Around line 1970-1971: The UI text for "Default create target" is inconsistent
with the runtime fallback in defaultCreateTargetSelector(); update the display
logic used by the "sources list" output to show "cwd" (or "cwd (implicit)") when
loadPersonaSourceConfig().defaultCreateTarget is undefined rather than printing
"(auto)". Locate where the sources list message is composed and replace the
conditional that prints "(auto)" with one that prints the actual fallback value
from defaultCreateTargetSelector() or explicitly "cwd (implicit)" when no saved
override exists.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 27e33f9b-f338-4bc5-b386-766c21eeb902
⛔ Files ignored due to path filters (1)
packages/workload-router/src/generated/personas.tsis excluded by!**/generated/**
📒 Files selected for processing (4)
packages/cli/src/cli.test.tspackages/cli/src/cli.tspackages/workload-router/src/index.test.tspersonas/persona-maker.json
🚧 Files skipped from review as they are similar to previous changes (2)
- packages/workload-router/src/index.test.ts
- packages/cli/src/cli.test.ts
| function defaultCreateTargetSelector(): string { | ||
| if (existsSync(join(process.cwd(), '.agentworkforce', 'workforce'))) { | ||
| return 'cwd'; | ||
| } | ||
| return loadPersonaSourceConfig().defaultCreateTarget ?? 'user'; | ||
| return loadPersonaSourceConfig().defaultCreateTarget ?? 'cwd'; |
There was a problem hiding this comment.
Show cwd instead of (auto) in the sources output.
With Line 1971 making the implicit fallback always cwd, sources list will still print Default create target: (auto) for users without a saved override. That UI now describes behavior that no longer exists, so it should be updated to show cwd (or cwd (implicit)) to match runtime behavior.
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/src/cli.ts` around lines 1970 - 1971, The UI text for "Default
create target" is inconsistent with the runtime fallback in
defaultCreateTargetSelector(); update the display logic used by the "sources
list" output to show "cwd" (or "cwd (implicit)") when
loadPersonaSourceConfig().defaultCreateTarget is undefined rather than printing
"(auto)". Locate where the sources list message is composed and replace the
conditional that prints "(auto)" with one that prints the actual fallback value
from defaultCreateTargetSelector() or explicitly "cwd (implicit)" when no saved
override exists.
| if (arg === '--save-in-directory') { | ||
| const value = valueOf(i, arg).trim(); | ||
| if (!value) die('create: --save-in-directory requires a non-empty value.'); | ||
| flags.saveInDirectory = value; | ||
| i += 1; | ||
| continue; | ||
| } | ||
| if (arg.startsWith('--save-in-directory=')) { | ||
| const value = arg.slice('--save-in-directory='.length).trim(); | ||
| if (!value) die('create: --save-in-directory requires a non-empty value.'); | ||
| flags.saveInDirectory = value; | ||
| continue; | ||
| } | ||
| if (arg === '--save-default') { | ||
| flags.saveDefault = true; | ||
| continue; | ||
| } | ||
| if (arg === '-h' || arg === '--help') { | ||
| process.stdout.write( | ||
| 'Usage: agentworkforce create [--to <cwd|user|dir:n|library|path>] [--save-default] [--install-in-repo] [--no-launch-metadata]\n' | ||
| 'Usage: agentworkforce create [--save-in-directory=<cwd|user|dir:n|library|path>] [--save-default] [--install-in-repo] [--no-launch-metadata]\n' | ||
| ); |
There was a problem hiding this comment.
Keep --to working unless this PR is intentionally renaming the public flag.
Lines 2364-2397 stop accepting agentworkforce create --to ... and only recognize --save-in-directory. Given the stated goal here is changing default target resolution, this turns the PR into a breaking CLI flag rename for existing scripts and wrappers. Please keep --to as an alias here, or explicitly treat this as a breaking change and update the public contract everywhere in the same PR.
Minimal compatibility patch
- if (arg === '--save-in-directory') {
+ if (arg === '--save-in-directory' || arg === '--to') {
const value = valueOf(i, arg).trim();
- if (!value) die('create: --save-in-directory requires a non-empty value.');
+ if (!value) die(`create: ${arg} requires a non-empty value.`);
flags.saveInDirectory = value;
i += 1;
continue;
}
- if (arg.startsWith('--save-in-directory=')) {
- const value = arg.slice('--save-in-directory='.length).trim();
- if (!value) die('create: --save-in-directory requires a non-empty value.');
+ if (arg.startsWith('--save-in-directory=') || arg.startsWith('--to=')) {
+ const prefix = arg.startsWith('--to=') ? '--to=' : '--save-in-directory=';
+ const value = arg.slice(prefix.length).trim();
+ if (!value) die(`create: ${prefix.slice(0, -1)} requires a non-empty value.`);
flags.saveInDirectory = value;
continue;
}Also applies to: 2397-2397
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@packages/cli/src/cli.ts` around lines 2364 - 2384, The CLI parsing removed
support for the existing --to flag; restore --to as an alias for
--save-in-directory by updating the argument checks around the create command
where flags.saveInDirectory is set (the blocks handling '--save-in-directory'
and '--save-in-directory='). Specifically, accept '--to' and '--to=' variants
the same way (call valueOf(i, arg) for '--to' and slice for '--to='), validate
non-empty values the same way, and set flags.saveInDirectory when either flag is
used so existing scripts continue to work unless you intend a breaking rename.
Summary
agentworkforce createnow writes to<cwd>/.agentworkforce/workforce/personasby default, creating the directory if it does not already exist. Previously, the cwd-local target only won when.agentworkforce/workforce/already existed; otherwise we fell back to the user persona dir or a configureddefaultCreateTarget.--to <target>flag is now the only thing that changes the default.defaultCreateTargetin~/.agentworkforce/workforce/config.json(and--save-default) still pin a persistent override for users who want one.personas/persona-maker.jsonadvertises the newTARGET_DIRdefault (.agentworkforce/workforce/personas) and the systemPrompt explains that the CLI sets it to a cwd-local absolute path.packages/cli) and the CLI CHANGELOG describe the new resolution order.Test plan
corepack pnpm run check(lint + typecheck + tests across all workspace packages)parseCreateArgstest that the cwd target wins with no override AND the persona directory is created when missingparseCreateArgstest that a saveddefaultCreateTargetstill overrides the cwd default🤖 Generated with Claude Code