Commit Graph

34 Commits

Author SHA1 Message Date
wbtiger d0dc20866f feat: support GITLINK_TOKEN env var for non-interactive auth
Enables authentication in non-interactive environments (CI/CD, Trae
sandbox, MCP) by reading token from GITLINK_TOKEN environment variable.
Falls back to existing interactive login flow when env var is not set.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-15 17:45:30 +08:00
wbtiger a20b4f81af docs: add fork PR creation example 2026-04-09 18:42:30 +08:00
wbtiger 9112f3382c fix: release create default target_commitish to master
GitLink default branch is master, not main. Some repos don't have main.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 17:33:15 +08:00
wbtiger f8ed262b26 fix: default priority_id=2 when creating issues
GitLink API requires priority_id field, otherwise the issue shows
without a priority badge.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 16:50:52 +08:00
wbtiger adc9213254 docs: add --owner/--repo to all README examples
Commands like issue +create, pr +view, release +create were missing
--owner/--repo flags in examples, causing errors when run outside a
git repository directory.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-09 14:23:19 +08:00
wbtiger 8442ed6d8e docs: document both login methods (password & token)
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:16:24 +08:00
wbtiger 95fdee5cd8 fix: use cookie-based auth for login — resolves Windows 401
Root cause: GitLink login API returns session cookies (autologin_trustie),
not API access_tokens. The old code tried to use the cookie value as an
access_token query parameter, which GitLink rejects.

Fix: store auth cookies with "cookie:" prefix. Transport detects the
prefix and sends credentials as Cookie header instead of access_token
param. Private tokens (from --token mode) continue to use access_token
param — fully backward compatible.

Verified: login → store cookie → GetCurrentUser → repo list all pass.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 13:01:55 +08:00
wbtiger a27122ab76 fix: GetCurrentUser must check HTTP status and JSON status for token verification
GetCurrentUser() was not checking the HTTP status code or the JSON
"status" field. GitLink returns {"status":401,"message":"无效token"}
as valid JSON, so json.Unmarshal succeeds and the function returns nil
error — making any token appear valid.

Now properly checks HTTP status code, JSON status field, and requires
"login" field in response. If login API tokens fail verification,
shows clear guidance to use private token (--token mode).

Root cause of Windows 401: login API returns session/CSRF token, not
a valid API access_token. The broken verification masked this entirely.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 12:38:25 +08:00
wbtiger 78f435a57c fix: force binary re-download on version mismatch in postinstall
The postinstall script was only checking if the existing binary could
run (--help), not whether its version matched the npm package version.
This caused npm upgrades to skip downloading the new binary, leaving
users on stale versions without fixes.

Now checks `gitlink-cli version` output against package.json version.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-08 09:56:55 +08:00
wbtiger 993896ad6f fix: robust login token handling — verify token before storing
- Prefer autologin cookie over response body token (body token may be CSRF/session token)
- Use cookiejar to capture cookies across redirects
- Try all candidate tokens and verify each with /users/me API call
- Detect keyring store/load mismatch and auto-fallback to file storage
- Login now fails fast if no candidate token works, instead of silently storing a bad token

Fixes Windows 401 "无效token" after successful login. Also improves
reliability on headless Linux (no Secret Service) and edge cases on macOS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 17:19:06 +08:00
wbtiger 5975c0759c feat: add gitlink-cli-install-skills command for cross-platform skills installation
- New bin/install-skills.js: resolves local skills path automatically
- Users just run `gitlink-cli-install-skills` on any platform
- No more bash-specific $(npm root -g) syntax that breaks on Windows
- Update README installation docs

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 16:27:22 +08:00
wbtiger df8937316a fix: improve release asset matching with version fallback
- When exact version release not found, fallback to latest release
- Match assets by platform/arch pattern when version in filename differs
- Ensures npm install works even when release version != npm version

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 15:39:45 +08:00
wbtiger c3744936d9 fix: prepend domain to relative download URL in install.js
GitLink release API returns relative URLs for attachments (e.g.
/Gitlink/gitlink-cli/releases/download/...). Prepend RELEASE_BASE
to make them absolute, fixing "Invalid URL" error on Windows/Linux.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 15:08:01 +08:00
wbtiger d32f3b53c9 fix: npm package should not embed platform-specific binary
- Remove bin/ directory from npm files, only include bin/cli.js wrapper
- postinstall now always downloads the correct platform binary from release
- Add platform compatibility check: if pre-existing binary doesn't match
  current platform, re-download instead of silently failing

Fixes "cannot execute binary file" on Linux/Windows when npm package was
built on macOS.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 15:04:11 +08:00
wbtiger a6b9797869 chore: bump npm package to v0.1.3
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 13:35:13 +08:00
wbtiger 9e29de94ea fix: branch delete and release delete API issues
- branch +delete: change from DELETE to POST /branches/delete with
  branch_name in body (matches actual GitLink API)
- release +delete: add post-delete verification to handle API bug where
  delete succeeds but returns error status
- Update branch delete skill docs: remove "known issue" notice

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 11:50:33 +08:00
wbtiger e92caeacda Merge pull request 'Test PR for full testing' (#1) from pr-test-0407 into master 2026-04-07 11:48:01 +08:00
wbtiger 405f6e0a9c test: add pr test file 2026-04-07 11:45:56 +08:00
wbtiger 342badbdd2 feat: add Windows (x64/arm64) support
- Add windows/amd64 and windows/arm64 to build targets with .zip packaging
- Update npm install.js: win32 platform detection, .exe binary, PowerShell zip extraction
- Update npm cli.js wrapper to append .exe on Windows
- Fix credential path to use filepath.Join for cross-platform compatibility
- Update README with Windows support docs and FAQ

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-07 10:52:56 +08:00
wbtiger 0aed7ad2d7 refactor: upgrade skills to Anthropic agent skills standard
Structure changes:
- Add metadata (requires.bins, cliHelp) to all SKILL.md frontmatter
- Add CRITICAL prerequisite notices for authentication/authorization
- Create references/ directory with per-shortcut reference files
  (34 new reference files across 8 skills)
- Migrate examples/ to references/ (standard structure)
- Move REFERENCE.md and TROUBLESHOOTING.md into references/

New reference files:
- gitlink-issue: 6 refs (list, create, view, update, close, comment)
- gitlink-pr: 6 refs (list, create, view, merge, close, files)
- gitlink-repo: 9 refs (5 repo + 4 branch shortcuts)
- gitlink-release: 4 refs (list, create, view, delete)
- gitlink-org: 3 refs (list, info, members)
- gitlink-search: 2 refs (repos, users)
- gitlink-user: 2 refs (me, info)
- gitlink-shared: 2 refs (api-reference, troubleshooting)

Each reference follows lark-cli standard: prerequisites, commands,
parameters table, workflow steps, caution notices, cross-references.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 18:22:38 +08:00
wbtiger 66beb075da fix: pr merge requires 'do' param, update skills docs with test findings
Code fixes:
- pr +merge: add 'do' parameter (merge/rebase/squash) and --method flag
  to fix "请选择合并方式" error

Skills documentation updates:
- gitlink-pr: add complete PR workflow with create_file/update_file,
  document merge methods, PR status values, state filter behavior
- gitlink-shared: update API notes table (release delete now works,
  create_file needs base64, update_file needs SHA), add file operations
  API section with create/update/delete examples
- gitlink-release: update delete docs (now works with version_id)

All 8 scenarios tested and passing (2026-04-04):
  auth/user , repo , branch (delete=API bug),
  issue , PR , release , search/org , CI (no config)

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-04 18:10:48 +08:00
wbtiger 798bc7d18f cleanup: remove test file pr-test-file.md 2026-04-04 18:09:47 +08:00
wbtiger 25e158ceea cleanup: remove test file skill-pr-test.md 2026-04-04 18:09:45 +08:00
wbtiger 1d685f72ca Merge pull request 'test: Skill PR 全流程测试' (#3) from skill-pr-test-0404 into master 2026-04-04 17:43:00 +08:00
wbtiger 8eab488eb1 test: skill PR test file 2026-04-04 17:26:21 +08:00
wbtiger 83c3cfb68b cleanup: remove test file 2026-04-04 16:48:38 +08:00
wbtiger 78a1de8c99 Merge pull request 'test: PR workflow test (0404)' (#1) from pr-test-0404 into master 2026-04-04 16:47:15 +08:00
wbtiger 483f7495ae feat: add pr test file 2026-04-04 16:26:03 +08:00
wbtiger 32bc53c2bf test: update file via API 2026-04-04 16:25:33 +08:00
wbtiger 0c9fab21cb test: create file via API 2026-04-04 16:24:52 +08:00
wbtiger 0d0f79f3e7 Update README.md 2026-04-03 11:03:39 +08:00
Your GitHub Username 3c2e8f0580 feat: include skills in npm package, update README with AI Agent quick start
- Bundle skills/ directory into npm package for local installation
- Add npx skills add instructions for both human users and AI agents
- Update README installation section to match larksuite/cli style
- Bump npm version to 0.1.1

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 23:06:06 +08:00
Your GitHub Username 381a32a49f feat: add npm distribution support (@gitlink-ai/cli)
- Add npm package structure (package.json, install script, bin wrapper)
- Add cross-platform build script (darwin/linux × amd64/arm64)
- Add local pack script for embedding binary in npm package
- Update README with larksuite/cli-style installation docs
- Published as @gitlink-ai/cli@0.1.0 on npmjs.com

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-04-02 22:57:37 +08:00
Your GitHub Username bd2d8b52d6 initial commit: gitlink-cli project 2026-04-02 16:50:00 +08:00