Skip to content

Commit 5dc6c52

Browse files
committed
Add Claude Code SDK 0.1.0
1 parent 1fbf85d commit 5dc6c52

File tree

84 files changed

+9239
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

84 files changed

+9239
-0
lines changed

.editorconfig

Lines changed: 479 additions & 0 deletions
Large diffs are not rendered by default.

.github/workflows/ci.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: CI
2+
3+
on:
4+
pull_request:
5+
branches: [ main ]
6+
push:
7+
branches: [ main ]
8+
9+
env:
10+
DOTNET_VERSION: '10.0.x'
11+
NODE_VERSION: '22'
12+
13+
jobs:
14+
build-test:
15+
name: Build and Claude Code CLI Smoke (${{ matrix.os }})
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
os: [ubuntu-latest, macos-latest, windows-latest]
20+
runs-on: ${{ matrix.os }}
21+
22+
steps:
23+
- name: Checkout
24+
uses: actions/checkout@v5
25+
with:
26+
submodules: recursive
27+
28+
- name: Setup Node.js
29+
uses: actions/setup-node@v4
30+
with:
31+
node-version: ${{ env.NODE_VERSION }}
32+
33+
- name: Setup .NET
34+
uses: actions/setup-dotnet@v4
35+
with:
36+
dotnet-version: ${{ env.DOTNET_VERSION }}
37+
38+
- name: Install Claude Code CLI
39+
run: npm install --global @anthropic-ai/claude-code
40+
41+
- name: Verify Claude Code CLI
42+
run: claude --version
43+
44+
- name: Verify unauthenticated Claude Code behavior
45+
shell: bash
46+
run: |
47+
set -euo pipefail
48+
sandbox="$RUNNER_TEMP/claude-empty-home"
49+
output_file="$RUNNER_TEMP/claude-unauth-output.txt"
50+
51+
rm -rf "$sandbox"
52+
mkdir -p "$sandbox/.config" "$sandbox/AppData/Roaming" "$sandbox/AppData/Local"
53+
54+
set +e
55+
HOME="$sandbox" \
56+
USERPROFILE="$sandbox" \
57+
XDG_CONFIG_HOME="$sandbox/.config" \
58+
APPDATA="$sandbox/AppData/Roaming" \
59+
LOCALAPPDATA="$sandbox/AppData/Local" \
60+
claude -p "health check" >"$output_file" 2>&1
61+
exit_code=$?
62+
set -e
63+
64+
cat "$output_file"
65+
66+
if [ "$exit_code" -eq 0 ]; then
67+
echo "Expected unauthenticated Claude CLI invocation to fail in isolated profile."
68+
exit 1
69+
fi
70+
71+
grep -Eiq "Please run /login|Not logged in|Not authenticated|Invalid API key|claude login" "$output_file"
72+
73+
- name: Restore
74+
run: dotnet restore ManagedCode.ClaudeCodeSharpSDK.slnx
75+
76+
- name: Build
77+
run: dotnet build ManagedCode.ClaudeCodeSharpSDK.slnx -c Release -warnaserror --no-restore
78+
79+
- name: Test (full solution)
80+
run: dotnet test --solution ManagedCode.ClaudeCodeSharpSDK.slnx -c Release --no-build -- --treenode-filter "/*/*/*/*[RequiresClaudeAuth!=true]"
81+
82+
- name: Smoke tests (ClaudeCli_Smoke subset)
83+
run: dotnet test --project ClaudeCodeSharpSDK.Tests/ClaudeCodeSharpSDK.Tests.csproj -c Release --no-build -- --treenode-filter "/*/*/*/ClaudeCli_Smoke_*"
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
name: Claude Code CLI Smoke
2+
3+
on:
4+
schedule:
5+
- cron: '0 2 * * *'
6+
workflow_dispatch:
7+
8+
permissions:
9+
contents: read
10+
11+
env:
12+
DOTNET_VERSION: '10.0.x'
13+
NODE_VERSION: '22'
14+
15+
jobs:
16+
claude-cli-smoke:
17+
name: Claude Code CLI Smoke (${{ matrix.os }})
18+
strategy:
19+
fail-fast: false
20+
matrix:
21+
os: [ubuntu-latest, macos-latest, windows-latest]
22+
runs-on: ${{ matrix.os }}
23+
24+
steps:
25+
- name: Checkout
26+
uses: actions/checkout@v5
27+
with:
28+
submodules: recursive
29+
30+
- name: Setup Node.js
31+
uses: actions/setup-node@v4
32+
with:
33+
node-version: ${{ env.NODE_VERSION }}
34+
35+
- name: Setup .NET
36+
uses: actions/setup-dotnet@v4
37+
with:
38+
dotnet-version: ${{ env.DOTNET_VERSION }}
39+
40+
- name: Install Claude Code CLI
41+
run: npm install --global @anthropic-ai/claude-code
42+
43+
- name: Verify Claude Code CLI
44+
run: claude --version
45+
46+
- name: Verify unauthenticated Claude Code behavior
47+
shell: bash
48+
run: |
49+
set -euo pipefail
50+
sandbox="$RUNNER_TEMP/claude-empty-home"
51+
output_file="$RUNNER_TEMP/claude-unauth-output.txt"
52+
53+
rm -rf "$sandbox"
54+
mkdir -p "$sandbox/.config" "$sandbox/AppData/Roaming" "$sandbox/AppData/Local"
55+
56+
set +e
57+
HOME="$sandbox" \
58+
USERPROFILE="$sandbox" \
59+
XDG_CONFIG_HOME="$sandbox/.config" \
60+
APPDATA="$sandbox/AppData/Roaming" \
61+
LOCALAPPDATA="$sandbox/AppData/Local" \
62+
claude -p "health check" >"$output_file" 2>&1
63+
exit_code=$?
64+
set -e
65+
66+
cat "$output_file"
67+
68+
if [ "$exit_code" -eq 0 ]; then
69+
echo "Expected unauthenticated Claude CLI invocation to fail in isolated profile."
70+
exit 1
71+
fi
72+
73+
grep -Eiq "Please run /login|Not logged in|Not authenticated|Invalid API key|claude login" "$output_file"
74+
75+
- name: Restore
76+
run: dotnet restore ManagedCode.ClaudeCodeSharpSDK.slnx
77+
78+
- name: Build
79+
run: dotnet build ManagedCode.ClaudeCodeSharpSDK.slnx -c Release -warnaserror --no-restore
80+
81+
- name: Test (full solution)
82+
run: dotnet test --solution ManagedCode.ClaudeCodeSharpSDK.slnx -c Release --no-build -- --treenode-filter "/*/*/*/*[RequiresClaudeAuth!=true]"
83+
84+
- name: Smoke tests (ClaudeCli_Smoke subset)
85+
run: dotnet test --project ClaudeCodeSharpSDK.Tests/ClaudeCodeSharpSDK.Tests.csproj -c Release --no-build -- --treenode-filter "/*/*/*/ClaudeCli_Smoke_*"

0 commit comments

Comments
 (0)