Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .agents
Submodule .agents added at 60986e
5 changes: 5 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,11 @@ jobs:
steps:
- checkout:
path: ~/$CIRCLE_PROJECT_REPONAME
- run:
name: Initialize shared build tools
command: |
cd ~/$CIRCLE_PROJECT_REPONAME
bash .circleci/init-agent-skills.sh
- run:
name: Build and Upload
context: bintray-creds
Expand Down
28 changes: 28 additions & 0 deletions .circleci/init-agent-skills.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/usr/bin/env bash
# Check out the pinned private build tools with the existing checkout identity
# or an optional read-only identity. Remove temporary key material on every exit.
set +x
set -euo pipefail
cd "$(dirname "$0")/.."

if [ -n "${CINCHAPI_AGENT_SKILLS_READ_KEY:-}" ]; then
umask 077
key_file=$(mktemp)
trap 'rm -f "$key_file"' EXIT
printf '%s\n' "$CINCHAPI_AGENT_SKILLS_READ_KEY" > "$key_file"
if GIT_SSH_COMMAND="ssh -i '$key_file' -o IdentitiesOnly=yes -o StrictHostKeyChecking=yes" \
git submodule update --init .agents; then
:
else
printf '%s\n' 'The configured read key cannot fetch the pinned agent tools.' >&2
exit 1
fi
else
if git submodule update --init .agents; then
:
else
printf '%s\n' 'The checkout identity needs read access to cinchapi-agent-skills.' \
'Set CINCHAPI_AGENT_SKILLS_READ_KEY to a dedicated read-only key if needed.' >&2
exit 1
fi
fi
14 changes: 14 additions & 0 deletions .claude/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"hooks" : {
"SessionStart" : [
{
"hooks" : [
{
"command" : "[ -e .agents/.git ] || { git submodule update --init .agents >&2 && cat .agents/instructions/AGENTS.md; }",
"type" : "command"
}
]
}
]
}
}
1 change: 1 addition & 0 deletions .claude/skills
74 changes: 74 additions & 0 deletions .github/workflows/agents.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# Written by .agents/setup.sh, which rewrites it on every skills pull.
# Change the shared workflows in cinchapi/cinchapi-agent-skills instead. Keep
# the name, because the CodeBuild runners start only for a workflow whose name
# begins with "Agent ".
name: Agent skills

on:
pull_request:
types: [opened, reopened, ready_for_review, labeled, synchronize]
pull_request_review:
types: [submitted]
issues:
types: [labeled]
issue_comment:
types: [created]
workflow_dispatch:
inputs:
skill:
description: Skill to run
type: choice
options:
- review-pipeline
- code-review
- code-comment-cleanup
- test-cleanup
- fix
- fix-conflicts
- work-on
- implement
number:
description: Pull request or issue number
type: number
required: true
args:
description: Extra instructions for the skill
type: string
required: false

permissions: {}

jobs:
agents:
# New commits on a pull request marked pipeline:done reach the router whoever
# pushed them, so it takes the label off. Dependabot's do not, because GitHub
# gives Dependabot's runs no Actions secrets, so the router could not act.
if: >-
(github.event_name == 'pull_request' && github.event.action == 'synchronize' &&
github.actor != 'dependabot[bot]' &&
github.event.pull_request.head.repo.full_name == github.repository &&
contains(github.event.pull_request.labels.*.name, 'pipeline:done')) ||
(github.event.sender.type != 'Bot' &&
(github.event_name == 'workflow_dispatch' ||
(github.event_name == 'pull_request' &&
github.event.pull_request.head.repo.full_name == github.repository &&
((github.event.action == 'labeled' &&
startsWith(github.event.label.name, 'agent:')) ||
(github.event.action != 'labeled' && !github.event.pull_request.draft))) ||
(github.event_name == 'pull_request_review' &&
github.event.pull_request.head.repo.full_name == github.repository &&
(github.event.review.state == 'changes_requested' ||
github.event.review.user.login == github.event.pull_request.user.login)) ||
(github.event_name == 'issues' &&
startsWith(github.event.label.name, 'agent:')) ||
(github.event_name == 'issue_comment' &&
(startsWith(github.event.comment.body, '/agent') ||
startsWith(github.event.comment.body, '/approve')))))
concurrency:
group: agents-${{ github.event.pull_request.number || github.event.issue.number || github.event.inputs.number }}
queue: max
uses: cinchapi/cinchapi-agent-skills/.github/workflows/router.yml@60986ed0018283a8978f2567e4babad1036fb0c7
permissions:
contents: read
id-token: write
secrets: inherit
3 changes: 3 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
[submodule ".agents"]
path = .agents
url = git@github.com:cinchapi/cinchapi-agent-skills.git
1 change: 1 addition & 0 deletions AGENTS.md
34 changes: 34 additions & 0 deletions AGENTS.project.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
# Project instructions

Instructions specific to this repo. The shared instructions in `AGENTS.md` apply
first. Rules here add to them and win on conflict.

Keep this file to what an agent cannot learn from the shared guides or from the
code: how to build and test here, facts that differ by repo, where the project's
own docs live, and any shared rule this repo overrides.

## Build and quality gates

The commands to build, compile, format, lint, and type check, how to run one
test class or file, and which of them must pass before delivery. The full test
suite runs in CI, not on a developer's machine; name a fast test tier here only
when it is a delivery gate.

## Repo layout

The modules or packages and what each one holds.

## Facts that differ by repo

The language and runtime version, the package manager, the framework and the
test runner, the formatter's width, the integration branch, the test base class,
the label set, and anything else the shared guides say to resolve per repo.

## Where to look

The project docs to read before working in a subsystem, and when to read each
one.

## Overrides

Shared rules this repo relaxes or tightens, and why.
1 change: 1 addition & 0 deletions CLAUDE.md
21 changes: 12 additions & 9 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -39,24 +39,27 @@ publishing {
}
}

// The project version is controlled externally by the "version.sh" script.
def getVersion = { ->
/**
* Create one semantic build version, or convert a supplied build version for
* publication without changing its counter. Fail when the shared tool fails.
*/
def getVersion = { String buildVersion = null ->
def stdout = new ByteArrayOutputStream()
def arguments = ['bash', rootProject.file('.agents/tools/version').path,
'--root', rootProject.projectDir.path]
if (buildVersion != null) {
arguments += ['--published', buildVersion]
}
exec {
commandLine 'bash', 'version.sh'
commandLine arguments
standardOutput = stdout
}
return stdout.toString().trim()
}

group = 'com.cinchapi'
version = getVersion()
// Drop the build component from version number and use that for
// publishing
ext.mavenVersion = version.split('\\.')
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+-", "-")
ext.mavenVersion[3] = ext.mavenVersion[3].replaceAll("[0-9]+", "").trim()
ext.mavenVersion = ext.mavenVersion.join(".").replace(".-", "-").replaceAll('\\.$', "")
ext.mavenVersion = getVersion(version.toString())

repositories {
mavenCentral()
Expand Down
101 changes: 0 additions & 101 deletions version.sh

This file was deleted.