Skip to content

Commit c9c569e

Browse files
feat: ship sandcode cli (#28)
* feat: ship sandcode cli * chore: align local opencode config with sandcode defaults
1 parent 52797ca commit c9c569e

36 files changed

+2231
-1224
lines changed

.github/workflows/check.yml

Lines changed: 32 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ permissions:
1212
env:
1313
DAYTONA_API_KEY: ${{ secrets.DAYTONA_API_KEY }}
1414
DAYTONA_API_URL: ${{ vars.DAYTONA_API_URL }}
15-
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
15+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
1616

1717
jobs:
1818
Check:
@@ -25,7 +25,7 @@ jobs:
2525
- name: Setup Bun
2626
uses: oven-sh/setup-bun@v2
2727
with:
28-
bun-version: 1.3.8
28+
bun-version: 1.3.10
2929

3030
- name: Install dependencies
3131
run: bun install --frozen-lockfile
@@ -41,9 +41,10 @@ jobs:
4141

4242
- name: CLI smoke checks
4343
run: |
44-
bun run analyze -- --help
45-
bun run start -- --help
46-
bun run setup -- --help
44+
bun src/sandcode.ts --help
45+
bun src/sandcode.ts analyze --help
46+
bun src/sandcode.ts start --help
47+
bun src/sandcode.ts setup --help
4748
4849
BuildPackage:
4950
name: Build Package Artifact
@@ -61,7 +62,7 @@ jobs:
6162
- name: Setup Bun
6263
uses: oven-sh/setup-bun@v2
6364
with:
64-
bun-version: 1.3.8
65+
bun-version: 1.3.10
6566

6667
- name: Install dependencies
6768
run: bun install --frozen-lockfile
@@ -87,6 +88,11 @@ jobs:
8788
runs-on: blacksmith-2vcpu-ubuntu-2404
8889
needs: BuildPackage
8990
steps:
91+
- name: Setup Bun
92+
uses: oven-sh/setup-bun@v2
93+
with:
94+
bun-version: 1.3.10
95+
9096
- name: Setup Node
9197
uses: actions/setup-node@v4
9298
with:
@@ -105,9 +111,25 @@ jobs:
105111
npm init -y
106112
npm install ../artifacts/*.tgz
107113
108-
- name: Run installed CLI binaries
114+
- name: Run installed CLI binary
115+
run: |
116+
cd e2e-install
117+
./node_modules/.bin/sandcode --help
118+
./node_modules/.bin/sandcode analyze --help
119+
./node_modules/.bin/sandcode start --help
120+
./node_modules/.bin/sandcode setup --help
121+
122+
- name: Run installed setup smoke
109123
run: |
110124
cd e2e-install
111-
./node_modules/.bin/opencode-sandboxed-research-analyze --help
112-
./node_modules/.bin/opencode-sandboxed-research-start --help
113-
./node_modules/.bin/opencode-sandboxed-research-setup --help
125+
mkdir -p home-smoke/vaults/test
126+
HOME="$PWD/home-smoke" ./node_modules/.bin/sandcode setup --yes \
127+
--vault-path ~/vaults/test \
128+
--obsidian-integration desktop \
129+
--notes-root Research/Sandcode \
130+
--catalog-mode repo \
131+
--daytona-api-key daytona-test \
132+
--opencode-api-key opencode-test
133+
134+
test -f home-smoke/.config/sandcode/sandcode.toml
135+
test -f home-smoke/.config/sandcode/.env

.github/workflows/daytona-e2e.yml

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,11 @@ on:
1010
model:
1111
description: "Model to use"
1212
required: false
13-
default: "openai/gpt-5.3-codex"
13+
default: "opencode-go/glm-5"
1414
variant:
1515
description: "Model variant"
1616
required: false
17-
default: "high"
17+
default: ""
1818
analyze_timeout_sec:
1919
description: "Analyze timeout seconds"
2020
required: false
@@ -30,8 +30,7 @@ permissions:
3030
env:
3131
DAYTONA_API_KEY: ${{ secrets.DAYTONA_API_KEY }}
3232
DAYTONA_API_URL: ${{ vars.DAYTONA_API_URL }}
33-
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
34-
ZHIPU_API_KEY: ${{ secrets.ZHIPU_API_KEY }}
33+
OPENCODE_API_KEY: ${{ secrets.OPENCODE_API_KEY }}
3534

3635
jobs:
3736
E2E:
@@ -45,7 +44,7 @@ jobs:
4544
- name: Setup Bun
4645
uses: oven-sh/setup-bun@v2
4746
with:
48-
bun-version: 1.3.8
47+
bun-version: 1.3.10
4948

5049
- name: Install dependencies
5150
run: bun install --frozen-lockfile
@@ -56,17 +55,26 @@ jobs:
5655
echo "DAYTONA_API_KEY is required" >&2
5756
exit 1
5857
fi
58+
if [ -z "${OPENCODE_API_KEY:-}" ]; then
59+
echo "OPENCODE_API_KEY is required for the default opencode-go model flow" >&2
60+
exit 1
61+
fi
5962
6063
- name: Run analyze e2e
6164
run: |
6265
mkdir -p .memory/daytona-e2e
63-
bun run analyze -- \
64-
--out-dir .memory/daytona-e2e/findings \
65-
--model "${{ inputs.model }}" \
66-
--variant "${{ inputs.variant }}" \
67-
--install-timeout-sec "${{ inputs.install_timeout_sec }}" \
68-
--analyze-timeout-sec "${{ inputs.analyze_timeout_sec }}" \
66+
args=(
67+
analyze
68+
--out-dir .memory/daytona-e2e/findings
69+
--model "${{ inputs.model }}"
70+
--install-timeout-sec "${{ inputs.install_timeout_sec }}"
71+
--analyze-timeout-sec "${{ inputs.analyze_timeout_sec }}"
6972
"${{ inputs.repo_url }}"
73+
)
74+
if [ -n "${{ inputs.variant }}" ]; then
75+
args+=(--variant "${{ inputs.variant }}")
76+
fi
77+
bun src/sandcode.ts "${args[@]}"
7078
7179
- name: Upload findings artifact
7280
uses: actions/upload-artifact@v4
Lines changed: 18 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ concurrency:
1111
permissions:
1212
contents: write
1313
pull-requests: write
14-
packages: write
14+
id-token: write
1515

1616
jobs:
1717
resolve-merge-context:
@@ -106,7 +106,7 @@ jobs:
106106
107107
const isBumpPr =
108108
(mergedPr.headRefName ?? "").startsWith("ci/version-bump-") ||
109-
/^chore:\s*bump package version to 0\\.0\\.\\d+$/i.test(
109+
/^chore:\s*bump package version to 0\.0\.\d+$/i.test(
110110
mergedPr.title ?? "",
111111
);
112112
@@ -122,25 +122,29 @@ jobs:
122122
123123
publish-and-manage-bump:
124124
name: Publish Package + Manage Bump PR
125-
runs-on: blacksmith-2vcpu-ubuntu-2404
125+
runs-on: ubuntu-latest
126126
needs: resolve-merge-context
127127
permissions:
128128
contents: write
129129
pull-requests: write
130-
packages: write
130+
id-token: write
131131
steps:
132132
- name: Checkout
133133
uses: actions/checkout@v4
134134

135135
- name: Setup Node
136136
uses: actions/setup-node@v4
137137
with:
138-
node-version: "20"
138+
node-version: "22.14.0"
139+
registry-url: "https://registry.npmjs.org"
140+
141+
- name: Upgrade npm for trusted publishing support
142+
run: npm install -g npm@latest
139143

140144
- name: Setup Bun
141145
uses: oven-sh/setup-bun@v2
142146
with:
143-
bun-version: 1.3.8
147+
bun-version: 1.3.10
144148

145149
- name: Install dependencies
146150
run: bun install --frozen-lockfile
@@ -211,40 +215,29 @@ jobs:
211215
fs.writeFileSync("package.json", `${JSON.stringify(pkg, null, 2)}\n`);
212216
NODE
213217
214-
- name: Configure npm for GitHub Packages
215-
env:
216-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
217-
run: |
218-
npm config set @shpitdev:registry https://npm.pkg.github.com
219-
npm config set //npm.pkg.github.com/:_authToken "$NODE_AUTH_TOKEN"
220-
221218
- name: Publish package
222219
id: publish
223-
env:
224-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
225220
run: |
226221
PACKAGE_REF="${{ steps.meta.outputs.name }}@${{ steps.meta.outputs.publish_version }}"
227222
228-
if npm view "$PACKAGE_REF" version --registry https://npm.pkg.github.com >/dev/null 2>&1; then
229-
echo "Version $PACKAGE_REF already exists in GitHub Packages; skipping publish."
223+
if npm view "$PACKAGE_REF" version >/dev/null 2>&1; then
224+
echo "Version $PACKAGE_REF already exists on npm; skipping publish."
230225
echo "published=false" >> "$GITHUB_OUTPUT"
231226
exit 0
232227
fi
233228
234-
npm publish --registry https://npm.pkg.github.com --tag "${{ steps.meta.outputs.publish_tag }}"
229+
npm publish --tag "${{ steps.meta.outputs.publish_tag }}"
235230
echo "published=true" >> "$GITHUB_OUTPUT"
236231
237232
- name: Verify published dist-tag
238233
if: steps.publish.outputs.published == 'true'
239-
env:
240-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
241234
run: |
242235
PACKAGE_NAME="${{ steps.meta.outputs.name }}"
243236
PUBLISH_TAG="${{ steps.meta.outputs.publish_tag }}"
244237
EXPECTED_VERSION="${{ steps.meta.outputs.publish_version }}"
245238
246239
for attempt in 1 2 3 4 5 6; do
247-
ACTUAL_VERSION="$(npm view "${PACKAGE_NAME}@${PUBLISH_TAG}" version --registry https://npm.pkg.github.com 2>/dev/null || true)"
240+
ACTUAL_VERSION="$(npm view "${PACKAGE_NAME}@${PUBLISH_TAG}" version 2>/dev/null || true)"
248241
249242
if [ "$ACTUAL_VERSION" = "$EXPECTED_VERSION" ]; then
250243
echo "Verified dist-tag ${PUBLISH_TAG}: ${PACKAGE_NAME}@${ACTUAL_VERSION}"
@@ -262,8 +255,6 @@ jobs:
262255
263256
- name: Verify registry install
264257
if: steps.publish.outputs.published == 'true'
265-
env:
266-
NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
267258
run: |
268259
PACKAGE_REF="${{ steps.meta.outputs.name }}@${{ steps.meta.outputs.publish_version }}"
269260
@@ -284,9 +275,10 @@ jobs:
284275
sleep 10
285276
done
286277
287-
./node_modules/.bin/opencode-sandboxed-research-analyze --help
288-
./node_modules/.bin/opencode-sandboxed-research-start --help
289-
./node_modules/.bin/opencode-sandboxed-research-setup --help
278+
./node_modules/.bin/sandcode --help
279+
./node_modules/.bin/sandcode analyze --help
280+
./node_modules/.bin/sandcode start --help
281+
./node_modules/.bin/sandcode setup --help
290282
291283
- name: Prepare next patch bump
292284
if: steps.meta.outputs.create_bump_pr == 'true'

.ignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
!.memory
2+
!.memory/**

AGENTS.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AGENTS
2+
3+
- Interim work should be done in the `.memory/` folder.

0 commit comments

Comments
 (0)