Skip to content
Open
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
41 changes: 4 additions & 37 deletions .agents/skills/openshc-find-function-implementation/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,49 +8,17 @@ Accepted formats:

- Function: `wipeAICMemory`
- Class/function: `AICState::wipeAICMemory`
- Path: `src/OpenSHC/AI/AICState/wipeAICMemory.cpp`
- Address: `0x004C6D30`

---

## Resolution

### Function
Powershell script call: `tools/reimplementation-helper/Get-Function-Data.ps1 -Partial -Query <input>`

Search `src/**/*.cpp` for implementation filenames matching the function name.

### Class/function

Restrict the search to the class folder.

Example:

`AICState::wipeAICMemory` → `src/**/AICState/wipeAICMemory.cpp`

### Path

Verify that the `.cpp` file exists.

### Address

Requires an available CLI or optimized text-search tool.

Search all `.cpp` files under `src/` for:

`FUNCTION: STRONGHOLDCRUSADER <hex-address>`

Requirements:

- Use the search tool only.
- Do not inspect files individually.

### Match Rules

For function, class/function, and address resolution:

- One match → return path.
- Zero matches → fail.
- Multiple matches → fail and report matches.
- If a function name was requested and the resulting name is different, mention the partial match.
- Use the implementation file and the exists parameter.
- Report failure if implementation file does not exist.

---

Expand All @@ -63,7 +31,6 @@ On failure:
- Report:
- Input.
- Reason.
- Matches (if applicable).

---

Expand Down
103 changes: 8 additions & 95 deletions .agents/skills/openshc-setup-function/SKILL.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,109 +4,22 @@ Creates a new C++ implementation file for an existing Stronghold Crusader functi

## Input

Ask for:
Accepted formats:

```text
File: <path relative to src/>
Function: <function name>
```
- Function: `wipeAICMemory`
- Class/function: `AICState::wipeAICMemory`
- Address: `0x004C6D30`

If validation fails, abort without creating or modifying files. Report source `.func.hpp` path, function name, and failure reason.
If validation fails, abort without creating or modifying files and report the failure reason.

---

## Workflow

### 1. Validate `.func.hpp`

Locate `src/<File>`.

Find `MACRO_FUNCTION_RESOLVER(..., &Class::Function) Function;`.

The function identifier after the macro must match the requested function.

---

### 2. Extract Address

Extract only the hexadecimal value from `Address::SHC_xxxxxxxx_0xXXXXXXXX`.

Example:

`Address::SHC_3BB0A8C1_0x004C6D30` → `0x004C6D30`

Never use the symbolic identifier.

---

### 3. Resolve Paths

From `src/<path>/<Class>.func.hpp`, derive:

- Implementation folder: `src/<path>/<Class>/`
- Declaration file: `src/<path>/<Class>.hpp`

Create the implementation folder if missing. Abort if creation fails.

---

### 4. Check Implementation

Target: `src/<path>/<Class>/<Function>.cpp`.
Powershell script call: `tools/reimplementation-helper/Setup-Function-Implementation.ps1 -Partial -Query <input>`

If it exists, abort. Never overwrite.

---

### 5. Validate Declaration

Search `<Class>.hpp` for the class-qualified function declaration.

Use the exact header declaration as the implementation signature.

Abort if:
- Header is missing
- Declaration is missing
- Namespace extraction fails

---

### 6. Generate File

Create `src/<path>/<Class>/<Function>.cpp`.

Content:

```cpp
#include "../<Class>.func.hpp"

<namespace blocks>

// FUNCTION: STRONGHOLDCRUSADER <address>
<function signature> {
}
```

Rules:
- Preserve namespace order and nesting
- Copy only normal `namespace` declarations
- Ignore `using` declarations and namespace aliases
- Do not modify existing files

Example:
```
#include "../AICState.func.hpp"

namespace OpenSHC {
namespace AI {

// FUNCTION: STRONGHOLDCRUSADER 0x004C6D30
void AICState::wipeAICMemory() {
}

}
}
```
- If a function name was requested and the resulting name is different, mention the partial match.
- Use the returned path to the implementation file for the completion report.

---

Expand Down
Loading