Skip to content
Merged
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 .github/skills/cli-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,4 @@ This is an adapter entrypoint. The canonical implementation lives in `cli-skill/
- `/cli-semantic-analysis`
- `/cli-heuristic-analysis`
- `/cli-check-help`
- `/cli-behavioral-analysis`
72 changes: 22 additions & 50 deletions .github/workflows/cli-skill-review-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,12 +66,23 @@ jobs:
with:
fetch-depth: 0

- name: Check CLI metadata and changed paths
id: cli_scope
env:
BASE_SHA: ${{ github.event.pull_request.base.sha }}
HEAD_SHA: ${{ github.event.pull_request.head.sha }}
run: |
set -euo pipefail
python3 scripts/check-cli-scope.py

- name: Setup Node
if: ${{ steps.cli_scope.outputs.proceed == 'true' }}
uses: actions/setup-node@v6
with:
node-version: 24

- name: Configure custom LLM provider
if: ${{ steps.cli_scope.outputs.proceed == 'true' }}
env:
LLM_API_KEY: ${{ secrets.llm_token }}
MODEL_ID: ${{ inputs.model }}
Expand All @@ -97,9 +108,17 @@ jobs:
EOF

- name: Sync cli-skill adapters
if: ${{ steps.cli_scope.outputs.proceed == 'true' }}
run: node scripts/sync-cli-skill-adapters.js

- name: Install cli-skill for Pi discovery
if: ${{ steps.cli_scope.outputs.proceed == 'true' }}
run: |
mkdir -p ~/.pi/skills
cp -R cli-skill ~/.pi/skills/

- name: Run Pi agent
if: ${{ steps.cli_scope.outputs.proceed == 'true' }}
id: pi
uses: shaftoe/pi-coding-agent-action@v2
with:
Expand All @@ -125,7 +144,7 @@ jobs:
- Include a short summary table with severity counts and overall score.

- name: Upload Pi session artifacts
if: ${{ steps.pi.outputs.session_html_path || steps.pi.outputs.session_jsonl_path }}
if: ${{ steps.cli_scope.outputs.proceed == 'true' && (steps.pi.outputs.session_html_path || steps.pi.outputs.session_jsonl_path) }}
uses: actions/upload-artifact@v4
with:
name: pi-session-${{ github.run_id }}-${{ github.run_attempt }}
Expand All @@ -134,7 +153,7 @@ jobs:
${{ steps.pi.outputs.session_jsonl_path }}

- name: Build PR report body
if: ${{ inputs.post_pr_comment && inputs.pr_number > 0 }}
if: ${{ steps.cli_scope.outputs.proceed == 'true' && inputs.post_pr_comment && inputs.pr_number > 0 }}
id: report
env:
PI_RESPONSE: ${{ steps.pi.outputs.response }}
Expand Down Expand Up @@ -190,55 +209,8 @@ jobs:
print(f"Wrote {p}")
PY

- name: Upsert PR comment
if: ${{ inputs.post_pr_comment && inputs.pr_number > 0 }}
uses: actions/github-script@v7
env:
PR_NUMBER: ${{ inputs.pr_number }}
REPORT_PATH: pi-report-comment.md
MARKER: "<!-- cli-skill-report:${{ inputs.command }} -->"
with:
github-token: ${{ secrets.gh_token }}
script: |
const fs = require('node:fs');

const owner = context.repo.owner;
const repo = context.repo.repo;
const issue_number = Number(process.env.PR_NUMBER);
const marker = process.env.MARKER;
const body = fs.readFileSync(process.env.REPORT_PATH, 'utf8');

const comments = await github.paginate(github.rest.issues.listComments, {
owner,
repo,
issue_number,
per_page: 100,
});

const existing = comments.find((c) =>
c.user?.type === 'Bot' && typeof c.body === 'string' && c.body.includes(marker)
);

if (existing) {
await github.rest.issues.updateComment({
owner,
repo,
comment_id: existing.id,
body,
});
core.info(`Updated existing report comment: ${existing.id}`);
} else {
const created = await github.rest.issues.createComment({
owner,
repo,
issue_number,
body,
});
core.info(`Created report comment: ${created.data.id}`);
}

- name: Fail when agent run is unsuccessful
if: ${{ inputs.fail_on_agent_error && steps.pi.outputs.success != 'true' }}
if: ${{ steps.cli_scope.outputs.proceed == 'true' && inputs.fail_on_agent_error && steps.pi.outputs.success != 'true' }}
run: |
echo "Pi agent reported success=${{ steps.pi.outputs.success }}"
exit 1
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ qwen36-snap
**/*session.jsonl
**/session.jsonl
session.jsonl
**/__pycache__
1 change: 1 addition & 0 deletions .pi/skills/cli-skill/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ Canonical files are in `cli-skill/`.
- `/cli-semantic-analysis`
- `/cli-heuristic-analysis`
- `/cli-check-help`
- `/cli-behavioral-analysis`
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ Future scaffolds:

## Use with Different Agents

1. Sync adapters from the manifest:
1. Sync adapters from the manifest (single maintained helper script):

node scripts/sync-cli-skill-adapters.js

Expand Down Expand Up @@ -68,7 +68,7 @@ On pull requests (opened, synchronize, reopened, ready_for_review), the workflow

- command: /cli-review
- provider: openrouter
- model: gpt-5.4
- model: moonshotai/kimi-k2.6

It publishes a markdown report in PR comments and updates the same report on subsequent PR updates.

Expand Down
6 changes: 3 additions & 3 deletions cli-skill/adapters/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,10 @@ These are scaffolds for portability. If a specific runtime needs strict schema f

## Regeneration

When command mappings change, regenerate all adapter files from the canonical manifest:
When command mappings change, regenerate all adapter files from the canonical manifest using the single maintained helper script:

```bash
node /project/scripts/sync-cli-skill-adapters.js
node scripts/sync-cli-skill-adapters.js
```

Source of truth:
Expand All @@ -46,7 +46,7 @@ A pre-commit hook is available at:

The hook:

1. Runs `node /project/scripts/sync-cli-skill-adapters.js`
1. Runs `node scripts/sync-cli-skill-adapters.js`
2. Fails the commit if adapter files changed during sync
3. Prompts you to stage regenerated adapter files before retrying commit

Expand Down
1 change: 1 addition & 0 deletions cli-skill/adapters/claude-code/commands.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ routes:
/cli-semantic-analysis: cli-skill/commands/cli-semantic-analysis.md
/cli-heuristic-analysis: cli-skill/commands/cli-heuristic-analysis.md
/cli-check-help: cli-skill/commands/cli-check-help.md
/cli-behavioral-analysis: cli-skill/commands/cli-behavioral-analysis.md

future:
/cli-propose-command: cli-skill/future-commands/cli-propose-command.md
Expand Down
1 change: 1 addition & 0 deletions cli-skill/adapters/copilot/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ This adapter maps slash-style command intents to command files in `cli-skill/`.
- `/cli-semantic-analysis` -> `cli-skill/commands/cli-semantic-analysis.md`
- `/cli-heuristic-analysis` -> `cli-skill/commands/cli-heuristic-analysis.md`
- `/cli-check-help` -> `cli-skill/commands/cli-check-help.md`
- `/cli-behavioral-analysis` -> `cli-skill/commands/cli-behavioral-analysis.md`

## Future Command Stubs

Expand Down
3 changes: 2 additions & 1 deletion cli-skill/adapters/opencode/commands.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,8 @@
"/cli-review": "cli-skill/commands/cli-review.md",
"/cli-semantic-analysis": "cli-skill/commands/cli-semantic-analysis.md",
"/cli-heuristic-analysis": "cli-skill/commands/cli-heuristic-analysis.md",
"/cli-check-help": "cli-skill/commands/cli-check-help.md"
"/cli-check-help": "cli-skill/commands/cli-check-help.md",
"/cli-behavioral-analysis": "cli-skill/commands/cli-behavioral-analysis.md"
},
"future": {
"/cli-propose-command": "cli-skill/future-commands/cli-propose-command.md",
Expand Down
1 change: 1 addition & 0 deletions cli-skill/adapters/pi-coding-agent/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,3 +19,4 @@ This adapter is intentionally thin and delegates all behavior to files under `cl
- `/cli-semantic-analysis` -> `cli-skill/commands/cli-semantic-analysis.md`
- `/cli-heuristic-analysis` -> `cli-skill/commands/cli-heuristic-analysis.md`
- `/cli-check-help` -> `cli-skill/commands/cli-check-help.md`
- `/cli-behavioral-analysis` -> `cli-skill/commands/cli-behavioral-analysis.md`
4 changes: 4 additions & 0 deletions cli-skill/schemas/commands.manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,10 @@ commands:
file: cli-skill/commands/cli-check-help.md
stage: active
description: Help-system focused CLI audit.
- name: /cli-behavioral-analysis
file: cli-skill/commands/cli-behavioral-analysis.md
stage: active
description: Analyze runtime behavior, output contracts, errors, and safety properties.

futureCommands:
- name: /cli-propose-command
Expand Down
7 changes: 2 additions & 5 deletions cli-skill/shared/cli-discovery-preflight.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,8 @@ Run this module before any analysis command.

## Purpose

- Identify whether the current repository contains a CLI
- Identify whether the current repository contains a CLI - the skill and simple scripts are NOT considered CLIs.
- If there is no CLI present, stop and return "No CLI found." This is an expected, valid, useful output for the user triggering this skill.
- Determine which files should be parsed for command discovery and behavior analysis
- Produce interim discovery artifacts for downstream commands

Expand All @@ -28,10 +29,6 @@ Use multiple signals. Positive matches increase confidence:
- README usage blocks and examples
- Packaging metadata referencing command binaries

### Failure Policy

- If no CLI is found, stop the analysis here. Do not write any files, and return the result "No CLI present. No CLI review necessary".

## Phase 0: Structure Discovery
**Goal: Map the CLI surface area — architecture, commands, and arguments.**

Expand Down
2 changes: 1 addition & 1 deletion knowledge_base/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,5 +40,5 @@
- Reusable workflow uses `gh_token` (not `github_token`) for `workflow_call` secret interface to avoid reserved-name collision.

11. Repository-root path policy for scripts
- Operational scripts resolve repository root at runtime via git (`rev-parse --show-toplevel`) with fallback to script-relative root.
- The maintained helper script resolves repository root at runtime via git (`rev-parse --show-toplevel`) with fallback to script-relative root.
- Hard-coded absolute workspace paths are intentionally avoided.
1 change: 1 addition & 0 deletions knowledge_base/CLI.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This project has no CLI.
80 changes: 0 additions & 80 deletions scripts/check-agents.js

This file was deleted.

Loading
Loading