Skip to content

Commit 2e46627

Browse files
committed
updates migrating off global tf handler to the MyAdminApp class handler
1 parent be83361 commit 2e46627

5 files changed

Lines changed: 42 additions & 22 deletions

File tree

.claude/skills/find-skills/SKILL.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,13 +16,13 @@ relevant to the user's current task and install them into this project.
1616
for [identified technologies]?"
1717
3. If the user agrees, run:
1818
```bash
19-
caliber skills --query "<relevant terms>"
19+
/home/my/.nvm/versions/node/v24.15.0/bin/caliber skills --query "<relevant terms>"
2020
```
2121
This outputs the top 5 matching skills with scores and descriptions.
2222
4. Present the results to the user and ask which ones to install
2323
5. Install the selected skills:
2424
```bash
25-
caliber skills --install <slug1>,<slug2>
25+
/home/my/.nvm/versions/node/v24.15.0/bin/caliber skills --install <slug1>,<slug2>
2626
```
2727
6. Read the installed SKILL.md files to load them into your current
2828
context so you can use them immediately in this session
@@ -33,18 +33,18 @@ relevant to the user's current task and install them into this project.
3333
User: "let's build a web app using React"
3434
-> "I notice you want to work with React. Would you like me to search
3535
for community skills that could help with React development?"
36-
-> If yes: run `caliber skills --query "react frontend"`
36+
-> If yes: run `/home/my/.nvm/versions/node/v24.15.0/bin/caliber skills --query "react frontend"`
3737
-> Show the user the results, ask which to install
38-
-> Run `caliber skills --install <selected-slugs>`
38+
-> Run `/home/my/.nvm/versions/node/v24.15.0/bin/caliber skills --install <selected-slugs>`
3939
-> Read the installed files and continue
4040

4141
User: "help me set up Docker for this project"
4242
-> "Would you like me to search for Docker-related skills?"
43-
-> If yes: run `caliber skills --query "docker deployment"`
43+
-> If yes: run `/home/my/.nvm/versions/node/v24.15.0/bin/caliber skills --query "docker deployment"`
4444

4545
User: "I need to write tests for this Python ML pipeline"
4646
-> "Would you like me to find skills for Python ML testing?"
47-
-> If yes: run `caliber skills --query "python machine-learning testing"`
47+
-> If yes: run `/home/my/.nvm/versions/node/v24.15.0/bin/caliber skills --query "python machine-learning testing"`
4848

4949
## When NOT to trigger
5050

.claude/skills/save-learning/SKILL.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,11 @@ will be applied in all future sessions on this project.
2424
3. Show the refined learning to the user and ask for confirmation
2525
4. If confirmed, run:
2626
```bash
27-
caliber learn add "<refined learning>"
27+
/home/my/.nvm/versions/node/v24.15.0/bin/caliber learn add "<refined learning>"
2828
```
2929
For personal preferences (not project-level), add `--personal`:
3030
```bash
31-
caliber learn add --personal "<refined learning>"
31+
/home/my/.nvm/versions/node/v24.15.0/bin/caliber learn add --personal "<refined learning>"
3232
```
3333
5. Stage the learnings file for the next commit:
3434
```bash
@@ -42,7 +42,7 @@ User: "when developing features, push to next branch not master, remember it"
4242
-> "I'll save this as a project learning:
4343
**[convention]** Push feature commits to the \`next\` branch, not \`master\`
4444
Save for future sessions?"
45-
-> If yes: run `caliber learn add "**[convention]** Push feature commits to the next branch, not master"`
45+
-> If yes: run `/home/my/.nvm/versions/node/v24.15.0/bin/caliber learn add "**[convention]** Push feature commits to the next branch, not master"`
4646
-> Run `git add CALIBER_LEARNINGS.md`
4747

4848
User: "always use bun instead of npm"

CLAUDE.md

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,8 @@ vendor/bin/phpunit --filter PluginTest # verify plugin structure only
3232
- `getRequirements()` — lazy-loads `src/directadmin.inc.php` functions via `$loader->add_requirement()` / `add_page_requirement()`
3333
- `getSettings()` — registers admin settings: `DIRECTADMIN_USERNAME`, `DIRECTADMIN_PASSWORD`, `OUTOFSTOCK_LICENSES_DIRECTADMIN`, `DIRECTADMIN_FREE_USERNAME`, `DIRECTADMIN_FREE_PASSWORD`
3434
- `getActivate()` / `getDeactivate()` — license lifecycle, dispatched on `licenses.activate`, `licenses.reactivate`, `licenses.deactivate`, `licenses.deactivate_ip`
35+
- `getChangeIp()` — IP change handler; calls `\Directadmin::editIp()`, records history via `\MyAdmin\App::history()`, sets `$event['status']`
36+
- `getMenu()` — adds admin panel menu links for reusable licenses, breakdown, and list views
3537

3638
**Registered hooks:**
3739
```
@@ -44,10 +46,15 @@ function.requirements → getRequirements()
4446
```
4547

4648
**Key functions in `src/directadmin.inc.php`:**
47-
- `directadmin_req($page, $post, $options)` — cURL wrapper; uses `DIRECTADMIN_USERNAME`/`DIRECTADMIN_PASSWORD` constants; routes to `https://www.directadmin.com/` automatically
48-
- `activate_directadmin($ipAddress, $ostype, $pass, $email, $name, $domain)` — calls `createlicense.php` then `directadmin_makepayment()`
49-
- `deactivate_directadmin($ipAddress)` — calls `cgi-bin/deletelicense`; sends admin email on failure via `TFSmarty` + `\MyAdmin\Mail`
50-
- `get_directadmin_licenses()` / `get_directadmin_license_by_ip($ip)` — list and lookup
49+
- `directadmin_req($page, $post, $options)` — cURL wrapper; auto-builds URLs under `https://www.directadmin.com/`; authenticates via `CURLOPT_USERPWD` Basic auth with `DIRECTADMIN_USERNAME`/`DIRECTADMIN_PASSWORD`
50+
- `activate_directadmin($ipAddress, $ostype, $pass, $email, $name, $domain, $custid)` — calls `createlicense.php` then `directadmin_makepayment()`
51+
- `deactivate_directadmin($ipAddress)` / `directadmin_deactivate($ipAddress)` — calls `cgi-bin/deletelicense`; sends admin email on failure via `TFSmarty` + `\MyAdmin\Mail`
52+
- `get_directadmin_licenses()` / `get_directadmin_license_by_ip($ip)` — list and lookup by IP
53+
- `get_directadmin_license($lid)` — fetches a single license record by license ID
54+
- `directadmin_ip_to_lid($ipAddress)` — maps an IP address to its license ID
55+
- `directadmin_makepayment($lid)` — processes payment for a newly created license via `cgi-bin/makepayment`
56+
- `directadmin_get_os_list($active)` — fetches available OS list from DA API
57+
- `directadmin_get_products()` — fetches product catalog from DA API
5158
- `activate_free_license()` / `delete_free_license()` — delegates to `FreeDirectAdmin` class via `function_requirements()`
5259
- `directadmin_modify_os($lid, $os)` — validates against live OS list before calling `special.php`
5360
- `get_directadmin_license_types()` — static map of DA OS keys → human labels
@@ -90,10 +97,14 @@ grep -q "caliber" .git/hooks/pre-commit 2>/dev/null && echo "hook-active" || ech
9097
- If **hook-active**: the hook handles sync automatically — just commit normally. Tell the user: "Caliber will sync your agent configs automatically via the pre-commit hook."
9198
- If **no-hook**: run Caliber manually before committing:
9299
1. Tell the user: "Caliber: Syncing agent configs with your latest changes..."
93-
2. Run: `caliber refresh && git add CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md .agents/ .opencode/ 2>/dev/null`
100+
2. Run: `/home/my/.nvm/versions/node/v24.15.0/bin/caliber refresh && git add CLAUDE.md .claude/ .cursor/ .cursorrules .github/copilot-instructions.md .github/instructions/ AGENTS.md CALIBER_LEARNINGS.md .agents/ .opencode/ 2>/dev/null`
94101
3. After it completes, briefly tell the user what Caliber updated. Then proceed with the commit.
95102

96-
If `caliber` is not found, tell the user: "This project uses Caliber for agent config sync. Run /setup-caliber to get set up."
103+
**Valid `/home/my/.nvm/versions/node/v24.15.0/bin/caliber refresh` options:** `--quiet` (suppress output) and `--dry-run` (preview without writing). Do not pass any other flags — options like `--auto-approve`, `--debug`, or `--force` do not exist and will cause errors.
104+
105+
**`/home/my/.nvm/versions/node/v24.15.0/bin/caliber config`** takes no flags — it runs an interactive provider setup. Do not pass `--provider`, `--api-key`, or `--endpoint`.
106+
107+
If `/home/my/.nvm/versions/node/v24.15.0/bin/caliber` is not found, tell the user: "This project uses Caliber for agent config sync. Run /setup-caliber to get set up."
97108
<!-- /caliber:managed:pre-commit -->
98109

99110
<!-- caliber:managed:learnings -->
@@ -103,10 +114,19 @@ Read `CALIBER_LEARNINGS.md` for patterns and anti-patterns learned from previous
103114
These are auto-extracted from real tool usage — treat them as project-specific rules.
104115
<!-- /caliber:managed:learnings -->
105116

117+
<!-- caliber:managed:model-config -->
118+
## Model Configuration
119+
120+
Recommended default: `claude-sonnet-4-6` with high effort (stronger reasoning; higher cost and latency than smaller models).
121+
Smaller/faster models trade quality for speed and cost — pick what fits the task.
122+
Pin your choice (`/model` in Claude Code, or `CALIBER_MODEL` when using Caliber with an API provider) so upstream default changes do not silently change behavior.
123+
124+
<!-- /caliber:managed:model-config -->
125+
106126
<!-- caliber:managed:sync -->
107127
## Context Sync
108128

109129
This project uses [Caliber](https://github.com/caliber-ai-org/ai-setup) to keep AI agent configs in sync across Claude Code, Cursor, Copilot, and Codex.
110-
Configs update automatically before each commit via `caliber refresh`.
130+
Configs update automatically before each commit via `/home/my/.nvm/versions/node/v24.15.0/bin/caliber refresh`.
111131
If the pre-commit hook is not set up, run `/setup-caliber` to configure everything automatically.
112132
<!-- /caliber:managed:sync -->

src/Plugin.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -101,7 +101,7 @@ public static function getChangeIp(GenericEvent $event)
101101
$event['status'] = 'error';
102102
$event['status_text'] = 'Error Code '.$result['faultcode'].': '.$result['fault'];
103103
} else {
104-
$GLOBALS['tf']->history->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getId(), $serviceClass->getCustid());
104+
\MyAdmin\App::history()->add($settings['TABLE'], 'change_ip', $event['newip'], $serviceClass->getId(), $serviceClass->getCustid());
105105
$serviceClass->set_ip($event['newip'])->save();
106106
$event['status'] = 'ok';
107107
$event['status_text'] = 'The IP Address has been changed.';
@@ -116,7 +116,7 @@ public static function getChangeIp(GenericEvent $event)
116116
public static function getMenu(GenericEvent $event)
117117
{
118118
$menu = $event->getSubject();
119-
if ($GLOBALS['tf']->ima == 'admin') {
119+
if (\MyAdmin\App::ima() == 'admin') {
120120
$menu->add_link(self::$module, 'choice=none.reusable_directadmin', '/images/myadmin/to-do.png', _('ReUsable Directadmin Licenses'));
121121
$menu->add_link(self::$module, 'choice=none.directadmin_list', '/images/myadmin/to-do.png', _('Directadmin Licenses Breakdown'));
122122
$menu->add_link(self::$module.'api', 'choice=none.directadmin_licenses_list', '/images/whm/createacct.gif', _('List all Directadmin Licenses'));

src/directadmin.inc.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -295,17 +295,17 @@ function activate_directadmin($ipAddress, $ostype, $pass, $email, $name, $domain
295295
];
296296
$url = 'https://www.directadmin.com/clients/api/createlicense.php';
297297
$response = directadmin_req($url, $post, $options);
298-
request_log('licenses', $GLOBALS['tf']->session->account_id, __FUNCTION__, 'directadmin', 'createlicense', $post, $response);
298+
request_log('licenses', \MyAdmin\App::session()->account_id, __FUNCTION__, 'directadmin', 'createlicense', $post, $response);
299299
myadmin_log('licenses', 'info', $response, __LINE__, __FILE__);
300300
$matches = preg_split('/error=0&text=License Created&lid=/', $response);
301301
if (empty($matches) || !isset($matches[1]) || $matches[1] == '') {
302302
return false;
303303
}
304304
$lid = urldecode($matches[1]);
305305
$response = directadmin_makepayment($lid);
306-
request_log('licenses', $GLOBALS['tf']->session->account_id, __FUNCTION__, 'directadmin', 'makepayment', $lid, $response);
306+
request_log('licenses', \MyAdmin\App::session()->account_id, __FUNCTION__, 'directadmin', 'makepayment', $lid, $response);
307307
myadmin_log('licenses', 'info', $response, __LINE__, __FILE__);
308-
$GLOBALS['tf']->history->add($settings['TABLE'], 'add_directadmin', 'ip', $ipAddress, $custid);
308+
\MyAdmin\App::history()->add($settings['TABLE'], 'add_directadmin', 'ip', $ipAddress, $custid);
309309
return $lid;
310310
}
311311
return $license['lid'];
@@ -342,7 +342,7 @@ function deactivate_directadmin($ipAddress)
342342
];
343343
$response = directadmin_req($url, $post, $options);
344344
myadmin_log('licenses', 'info', $response, __LINE__, __FILE__);
345-
request_log($module, $GLOBALS['tf']->session->account_id, __FUNCTION__, 'directadmin', 'deactivateLicense', $post, $response);
345+
request_log($module, \MyAdmin\App::session()->account_id, __FUNCTION__, 'directadmin', 'deactivateLicense', $post, $response);
346346
$deActdLicense = get_directadmin_license_by_ip($ipAddress);
347347
$bodyRows = [];
348348
if ($deActdLicense !== false && $deActdLicense['active'] == 'Y') {

0 commit comments

Comments
 (0)