Repository navigation
[pull] main from Tencent:main - #2
Merged
Merged
Conversation
…309) PR #301 introduced getUserHome() (HOME → USERPROFILE → os.homedir) but only wired it into types.ts. The rest of the codebase still read a bare `process.env.HOME`, so on a normal Windows session (where only USERPROFILE is set) `teamai init` printed "Local config saved to undefined/..." and then crashed with ERR_INVALID_ARG_TYPE — the exact failure reported on #301. Route every remaining home lookup through getUserHome(). Because it now always returns a non-empty path, drop the dead `if (!home)` guards it made unreachable (including one in uninstall.ts that used to abort the whole command when HOME was unset — i.e. uninstall was fully broken on Windows). Fix getVotesLocalDir(), the import/recall/search-index paths and the debug-log path to build with path.join instead of a hardcoded "/" separator. Harden getUserHome() with a final os.tmpdir() fallback: os.homedir() is documented to return '' when the home can't be resolved, which would make every derived path cwd-relative; the guarantee of a non-empty absolute path is what lets the callers above drop their guards safely. Add a guard test that fails if any source file outside utils/home.ts reads process.env.HOME directly, plus USERPROFILE- and tmpdir-fallback regression tests. Co-authored-by: Claude Fable 5 <[email protected]>
…ome (#310) Follow-up to #309. That PR ended getUserHome()'s fallback chain with `|| os.tmpdir()` to guarantee a non-empty path. But callers join the result onto `.teamai/...` to write credentials (api-key.ts) and to resolve and execute a node binary (builtin-hooks.ts resolveCodebuddyNode/resolveWorkbuddyNode), so falling back to a world-writable shared directory is a code-execution and credential-exposure vector: an attacker who can write /tmp/.codebuddy-server/.../node would get their binary run. Throw when none of HOME, USERPROFILE, or os.homedir() resolves instead. The empty-string case os.tmpdir() was guarding against (cwd-relative paths) is also covered by throwing. On any real machine at least one of the three is set, so this path is only reached in pathological contexts (passwd-less uid, `env -i`) where refusing to run is the correct, safe behavior. Update the regression test to assert the throw. Co-authored-by: Claude Fable 5 <[email protected]>
`gf auth whoami` / `gf auth login` inspect the current git repository's `origin` remote and scope the authentication check to that remote's host. When `teamai` runs inside a repo whose origin is not git.woa.com (e.g. a GitHub mirror), gf reports "not logged in" even though a valid git.woa.com token exists — so `teamai init` wrongly re-triggers interactive login and fails with "gf auth login failed" in the very repo teamai itself lives in. Run the three auth calls (gfIsAuthenticated / gfAuthWhoami / gfAuthLogin) from os.tmpdir(), which is not a git repo, so the host-scoped credential is found reliably regardless of where teamai was invoked. Verified end-to-end: `teamai init` now authenticates and completes inside a repo whose origin is github.com (previously reproduced the failure). Co-authored-by: Claude Fable 5 <[email protected]>
…(both scopes) (#306) * feat(opencode): sync skills/rules/subagents/MCP into OpenCode config (both scopes) Add OpenCode as a supported AI coding tool. teamai now syncs all four resource types into OpenCode's native config in both user and project scopes: - Skills: copied to .opencode/skills (project) or ~/.config/opencode/skills (user); OpenCode reads these natively. - Subagents: rendered to .opencode/agents/*.md with OpenCode frontmatter (description + mode:subagent + optional model/tool_extras); name comes from the filename, tools are omitted. - Rules: copied to the rules dir and activated via the opencode.json `instructions` glob (reconciled with key-level surgery); the glob is deactivated when the team's last rule is removed upstream. - MCP: written under the `mcp` top-level key (not mcpServers) with OpenCode's local/remote shapes; stdio + http transports, sse skipped. User scope diverges from project scope (~/.config/opencode/... vs <repo>/.opencode/...), handled by a new `userScope` field on ToolPathsSchema and a scopedToolPaths() choke-point. The install-probe now uses path.dirname so a multi-segment path like .config/opencode/skills resolves to the tool root rather than the near-universal .config. Also fixes a pull orchestration bug: pullAllRules is now always called (even with an empty rule set) so the OpenCode instructions glob is deactivated when the team removes its last rule. Personal rule files are still preserved via the existing tombstone mechanism. Docs (README + usage-guide, both languages) updated with OpenCode. * fix(opencode): route all toolPaths iteration through scopedToolPaths for user scope The PR added scopedToolPaths() but only wired it into the resource handlers. Every orchestration/cleanup/deploy site still iterated the raw toolPaths, so OpenCode's user scope (~/.config/opencode/...) was written to but never cleaned up or fully deployed. Route the remaining sites through scopedToolPaths so the correct per-scope path is always used: - pull.ts: tombstone cleanup, excluded-skill cleanup, inactive-namespace cleanup, existing-name detection, culture/claudemd/recall injection - source.ts: source-skill deploy and removal - builtin-{skills,agents,rules}.ts: built-in resource deployment - recall-toggle.ts: recall artifact deploy/removal - uninstall.ts: per-tool resource discovery - pre-push-sync.ts: rules/skills sync-to-local (localConfig was unused) - known-agents.ts: getEffectiveAgents + detectInstalledAgents now scope-aware Also fix a regression and two edge cases: - base.ts isToolInstalled: the path.dirname change reported .openclaw/workspace as the install root for openclaw's 3-segment claudemd path, wrongly treating a .openclaw-without-workspace user as not-installed. Introduce toolInstallRoot() which takes the first path segment (restoring the old openclaw behavior) except for .config/<tool>/... where it takes the first two (the OpenCode fix). Shared with known-agents detection. - opencode-config.ts reconcileOpencodeInstructions: no longer relocates non-string instructions entries to the end of the array on every pull, which could silently change instruction precedence. Operates on the array in place. - mcp-format.ts renderOpencode: guard against a missing stdio command so a malformed def never writes an empty-string executable into opencode.json. Verified end-to-end with a real user-scope pull against a fresh OpenCode-only HOME: skills deploy to ~/.config/opencode/skills, and a tombstoned skill is now cleaned up there (baseline build leaves it behind, fixed build removes it). Co-Authored-By: Claude Fable 5 <[email protected]> --------- Co-authored-by: jeffyxu <[email protected]> Co-authored-by: Claude Fable 5 <[email protected]>
…host, keep clone token out of the URL (#314) Three security issues in the GitLab provider (#307): 1. [HIGH] SSRF / credential exfiltration in mr-fetch.ts — fetchGitLabMR derived the API base (and sent the PAT) from the host in the user-supplied MR URL, with no check against the configured instance. A hand-crafted MR URL on an attacker-controlled host would receive the token. Now the URL host must match GITLAB_HOST (GITLAB_URL / TEAMAI_GITLAB_HOST, default gitlab.com) or the fetch is rejected before any network call. We still derive scheme/port from the URL so self-hosted instances keep working — but only for the trusted host. 2. [MEDIUM] Credential persistence in gitlab-api.ts — gitlabRepoClone embedded the token in the clone URL (oauth2:<token>@...), which git writes into the cloned repo's .git/config for every later fetch/push. Inject it via `-c http.extraHeader=Authorization: Basic <base64(oauth2:token)>` instead, so the token never enters the URL or .git/config. Mirrors clone.ts. 3. [MEDIUM] Inconsistent redaction in gitlab-api.ts — the clone-error path used an inline `oauth2:[^@]+@` regex. Use the shared sanitizeGitUrl from utils/redact.ts so redaction coverage stays consistent with clone.ts. Tests: updated gitlab-provider.test.ts to assert the header-based auth, the clean clone URL, and the SSRF rejection; added gitlab-clone-realspawn.test.ts which runs a REAL git spawn against a fake `git` on PATH and confirms the token never appears in the argv/URL (only base64 in the extraHeader) and that the surfaced error is sanitized. docs/providers.md updated to match. Co-authored-by: Claude Fable 5 <[email protected]>
…ions (#311) Four upgrade-migration defects where a runtime capability depended on a file/field/structure that only a newer version produces, with no backfill or self-heal on upgrade — leaving upgraders silently degraded: - local-agent: when local-agent/config.json is missing (v0.17.x users upgrading from the pre-local-agent era), backfill it from the legacy ~/.teamai/config.yaml (http repo) plus ~/.teamai/apikey and auto-provision it, so the project-binding prompt and resource sync are not lost. The save is wrapped so a write failure degrades to an in-memory config instead of throwing out of the hook path. - local-agent: persist the legacy group-based binding cleanup and warn the user once, instead of re-firing the warning on every hook load. - recall: stop indexing the retired docs/team-codebase in the fallback rebuild (aligning with pull.ts) and warn users to migrate to teamwiki/. - graph-index: guard loadGraphIndex on schemaVersion so a legacy/mismatched index returns null and triggers a rebuild instead of loading silently. Update the issue #84 regression test for the new schemaVersion guard and add a case asserting a mismatched version returns null. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
#316) Bump the two production dependencies flagged by Dependabot as runtime-scope vulnerabilities: - simple-git ^3.27.0 -> ^3.36.0 (installed 3.35.2 -> 3.36.0) fixes RCE advisory GHSA (Dependabot #6, high) - js-yaml -> ^3.15.1 via overrides (pulled transitively by gray-matter, was 3.14.2) fixes quadratic-CPU DoS via merge-key chains (Dependabot #16, high) `npm audit --omit=dev` now reports 0 vulnerabilities. Remaining open alerts are all devDependency-scoped (build/test toolchain) and do not ship in the published package.
Local (--dir) and batch (--from-repo-list) imports populated evidence/code/<repo>/ but never rebuilt the top-level teamwiki/router.md and index.md, leaving global navigation frozen at the first single-repo import. Call rebuildWikiIndex after each so newly imported repos appear. Also fix --from-org rebuild using a hardcoded team-repo path instead of the configured localPath, and guard it behind dryRun. Unify navigation generation on rebuildWikiIndex: drop the single-repo append-only block that only appended a bullet without refreshing stats or reflecting deletions, and produced a format divergent from the batch rebuild. Single-repo --from-repo now runs a full rebuild too; batch paths skip it (skipAutoPush) and rebuild once at the end. Co-authored-by: Claude Opus 4.8 (1M context) <[email protected]>
Both release pipelines (GitHub Actions + Coding CI) hard-coded `npm publish` with no --tag, so npm's default sent every build — prerelease versions included — to the `latest` dist-tag. That is the tag the CLI's auto-update check reads (src/update.ts), so pushing a `vX.Y.Z-beta.N` tag would have force-fed the beta to every user. Derive the dist-tag from the version string instead: a prerelease (e.g. 0.21.0-beta.0 -> beta, 0.22.0-rc.1 -> rc) publishes to its own channel; a plain release still goes to `latest`. GitHub Releases for prereleases are now flagged as pre-release. Document the beta flow in CLAUDE.md.
- Add an Overview table (agents × resources) grouped into Harness, Knowledge Base, and Governance, rendered as an HTML two-level header - List supported Git providers (GitHub / GitLab incl. self-hosted / CNB / TGit / any private/self-hosted) and add GitLab to usage-guide - Trim redundant Quick Start prose: single-repo bullets, --inherit-user-scope example, solo-use note, recall coverage/ranking detail, global-options line - Keep README.md / README.zh-CN.md in sync
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )