feat(contribute): target a learnings namespace with --namespace - #980
Open
yudongyouqing wants to merge 1 commit into
Open
yudongyouqing wants to merge 1 commit into
yudongyouqing wants to merge 1 commit into
Conversation
…ent#916) A directory reading several learnings namespaces always files into the shared root, so a team sharing a group namespace (e.g. payments) across projects loses each project's own namespace as a write target. contribute --namespace <ns> picks one, restricted to the namespaces this directory reads so a learning never lands where its author's recall would not find it; unknown values are refused with the valid list. Without the flag the routing is unchanged, and the ambiguous case now hints at the namespaces. projects list names the default destination and the accepted namespaces. Co-Authored-By: Claude Code <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds
teamai contribute --namespace <ns>so a member whose directory reads several learnings namespaces can file a learning under one of them, instead of always landing in the shared root (#916). The flag accepts only namespaces this directory already reads — a learning never lands where its author'srecallwould not find it — and refuses unknown values with the valid list. Without the flag, routing is unchanged; the ambiguous multi-namespace case now prints a one-line hint.teamai projects listnames the default destination and the accepted namespaces.Type of Change
Test Plan
npx tsc --noEmitpassesnpm run lintpassesnpx vitest run— every suite whose code path this change touches passes locally (contribute*incl. the new file,projects*,learnings*,import,commands-reference,skill-content,recall,search-index); the 13 failures in the wider learnings subset reproduce identically onorigin/mainon this Windows machine (git-kind-learnings,learnings-import-remnantsreal-git staging cases,pending-learningspath-separator assertions,skill-content'snpm pack --dry-runshell-out) — i.e. pre-existing and environment-specific, left to CIsrc/__tests__/contribute-namespace.test.ts(10 cases: routing with/without flag, namespace ≠ project id, refusal with valid list, refusal when no namespace is active, queue lands underpending-learnings/<ns>/, hint on ambiguity, dry-run path) andprojectsListdestination output cases insrc/__tests__/projects-cmd.test.tsnpm run build+ builtdist/index.js, single-repo mode, two projects with learnings namespacessvc-a+payments):teamai projects list→Contribute destination for this directory: learnings/ (shared root)+Namespaces read here: svc-a, payments — pass \teamai contribute --namespace ` to file under one.`teamai contribute --file note.md --namespace payments --dry-run→[dry-run] Would push: learnings/payments/payments-routing-2026-10-04-6eme8b.mdteamai contribute --file note.md --namespace nope --dry-run→Unknown learnings namespace "nope". Valid namespaces: svc-a, payments+ pointer toprojects listteamai contribute --file note.md --dry-run→ hint naming both namespaces, then the shared-root pathcontribute --namespace payments(offline) → learning queued at…/pending-learnings/payments/payments-routing-2026-10-04-i6q1k6.md, reported as saved locally and recallableskill-data/core/references/commands.mdregenerated (npx vitest run commands-reference -u)Related Issues
Closes #916
Notes for Reviewers
--namespacevs something else). I went with--namespaceas proposed — happy to rename if reviewers prefer another name.resolveLearningsSubdiris now a thin wrapper over the newresolveLearningsDestination(which also returns the namespace list the hint and error messages need); the two other callers (import --from-mrremnants,learnings-publish) keep the old signature and unchanged behavior.alphawithlearnings: [alpha-notes]accepts--namespace alpha-notes, per the issue.docs/usage-guide.md+docs/usage-guide.zh-CN.md;skill-data/share/SKILL.mdgot a one-line pointer (kept minimal —teamai contribute --helpand the generatedcommands.mdremain the source of truth).🤖 Generated with Claude Code