@lebtiga/sonic-agent 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +223 -0
- package/README.md +61 -0
- package/bin/sonic.js +304 -0
- package/lib/index.js +20 -0
- package/lib/installer.js +156 -0
- package/lib/license.js +48 -0
- package/package.json +46 -0
- package/plugin/.claude-plugin/plugin.json +13 -0
- package/plugin/README.md +100 -0
- package/plugin/agents/sonic.md +80 -0
- package/plugin/commands/sonic-build.md +145 -0
- package/plugin/commands/sonic-help.md +71 -0
- package/plugin/skills/accessibility-qa/SKILL.md +160 -0
- package/plugin/skills/accessibility-qa/templates/accessibility-qa-report-template.md +123 -0
- package/plugin/skills/accessibility-qa/templates/wcag-compliance-statement.md +70 -0
- package/plugin/skills/aka-wireframe-wp/SKILL.md +149 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/README.md +190 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/footer.php +49 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/functions.php +395 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/header.php +58 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/index.php +39 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/page-answer.php +62 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/page-authority-hub.php +122 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/page-knowledge.php +58 -0
- package/plugin/skills/aka-wireframe-wp/assets/aka-framework-theme/style.css +633 -0
- package/plugin/skills/aka-wireframe-wp/references/content-generator.md +371 -0
- package/plugin/skills/aka-wireframe-wp/references/internal-linker.md +430 -0
- package/plugin/skills/aka-wireframe-wp/references/orchestrator.md +269 -0
- package/plugin/skills/aka-wireframe-wp/references/prompts-library.md +880 -0
- package/plugin/skills/aka-wireframe-wp/references/seo-optimizer.md +433 -0
- package/plugin/skills/aka-wireframe-wp/references/strategy-planner.md +317 -0
- package/plugin/skills/aka-wireframe-wp/references/wordpress-deployer.md +545 -0
- package/plugin/skills/authority-site-builder/SKILL.md +138 -0
- package/plugin/skills/brand-philosophy/SKILL.md +77 -0
- package/plugin/skills/freepik-spaces/SKILL.md +122 -0
- package/plugin/skills/freepik-spaces/docs/automation-guide.md +233 -0
- package/plugin/skills/freepik-spaces/docs/research-notes.md +264 -0
- package/plugin/skills/freepik-spaces/plans/naseberry-demo-plan.md +320 -0
- package/plugin/skills/freepik-spaces/templates/naseberry-demo.json +302 -0
- package/plugin/skills/freepik-spaces/templates/saas-demo.json +212 -0
- package/plugin/skills/frontend-design/LICENSE.txt +177 -0
- package/plugin/skills/frontend-design/SKILL.md +77 -0
- package/plugin/skills/programmatic-seo/SKILL.md +236 -0
- package/plugin/skills/programmatic-seo/references/playbooks.md +293 -0
- package/plugin/skills/seo-qa/SKILL.md +132 -0
- package/plugin/skills/seo-qa/templates/schema-localbusiness.json +49 -0
- package/plugin/skills/seo-qa/templates/schema-service.json +36 -0
- package/plugin/skills/seo-qa/templates/seo-qa-report-template.md +90 -0
- package/plugin/skills/visual-identity/SKILL.md +109 -0
- package/plugin/skills/visual-identity/templates/style-guide-template.md +108 -0
- package/plugin/skills/website-image-gen/SKILL.md +82 -0
- package/plugin/skills/website-image-gen/templates/blog-featured.md +56 -0
- package/plugin/skills/website-image-gen/templates/hero-service-photo.md +56 -0
- package/plugin/skills/wordpress-pro/SKILL.md +105 -0
- package/plugin/skills/wordpress-pro/references/gutenberg-blocks.md +870 -0
- package/plugin/skills/wordpress-pro/references/hooks-filters.md +845 -0
- package/plugin/skills/wordpress-pro/references/performance-security.md +1012 -0
- package/plugin/skills/wordpress-pro/references/plugin-architecture.md +1041 -0
- package/plugin/skills/wordpress-pro/references/theme-development.md +858 -0
- package/plugin/sops/SOP-Sonic 777/authority-site-sop.html +1100 -0
- package/plugin/sops/SOP-WORDPRESS-330-PAGE-SITES.md +926 -0
- package/scripts/postinstall.js +109 -0
package/LICENSE.txt
ADDED
|
@@ -0,0 +1,223 @@
|
|
|
1
|
+
SONIC AGENT — COMMERCIAL LICENSE & USE AGREEMENT
|
|
2
|
+
Copyright (c) 2026 Rob Rizk / Rizk Advertising
|
|
3
|
+
All rights reserved.
|
|
4
|
+
|
|
5
|
+
This is a binding agreement between you ("Licensee") and Rizk Advertising
|
|
6
|
+
("Licensor"). By installing or using the Sonic Agent software, materials,
|
|
7
|
+
or related content (collectively, the "Software"), you agree to all terms
|
|
8
|
+
below. If you do not agree, do not install or use the Software.
|
|
9
|
+
|
|
10
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
11
|
+
1. DEFINITIONS
|
|
12
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
13
|
+
|
|
14
|
+
"Software" means the Sonic Agent CLI, the Claude Code plugin, all
|
|
15
|
+
bundled agent definitions, skills, commands, prompts, scripts, and
|
|
16
|
+
source code distributed in this package.
|
|
17
|
+
|
|
18
|
+
"Confidential Materials" means the Standard Operating Procedures (SOPs),
|
|
19
|
+
the 6-stage build methodology, the skill prompts, the workshop curriculum,
|
|
20
|
+
the cohort training materials, and any non-public technical or strategic
|
|
21
|
+
information disclosed to Licensee through the Software, the workshop,
|
|
22
|
+
the Discord community, or any direct communication from Licensor.
|
|
23
|
+
|
|
24
|
+
"Methodology" means the systematic approach, processes, prompts, prompt
|
|
25
|
+
chains, decision trees, quality gates, and operational patterns embodied
|
|
26
|
+
in the Software and Confidential Materials, regardless of the specific
|
|
27
|
+
form in which they are expressed.
|
|
28
|
+
|
|
29
|
+
"Output" means websites, content, graphics, code, configurations, and
|
|
30
|
+
other deliverables that Licensee produces for Licensee's own clients
|
|
31
|
+
using the Software.
|
|
32
|
+
|
|
33
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
34
|
+
2. GRANT OF LICENSE
|
|
35
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
36
|
+
|
|
37
|
+
Subject to payment in full and ongoing compliance with these terms,
|
|
38
|
+
Licensor grants Licensee a non-exclusive, non-transferable, revocable,
|
|
39
|
+
single-seat license to install and operate the Software on machines
|
|
40
|
+
personally operated by Licensee, solely for the internal benefit of
|
|
41
|
+
Licensee's own agency, business, or client engagements.
|
|
42
|
+
|
|
43
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
44
|
+
3. SINGLE SEAT
|
|
45
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
46
|
+
|
|
47
|
+
One license key authorizes one (1) individual user. Sharing the license
|
|
48
|
+
key, account, installation, or installed files with any other person —
|
|
49
|
+
inside or outside Licensee's organization — is strictly prohibited.
|
|
50
|
+
Agencies requiring multiple users must purchase additional licenses.
|
|
51
|
+
|
|
52
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
53
|
+
4. INTELLECTUAL PROPERTY OWNERSHIP
|
|
54
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
55
|
+
|
|
56
|
+
The Software, the Confidential Materials, and the Methodology are the
|
|
57
|
+
exclusive intellectual property of Licensor. Nothing in this agreement
|
|
58
|
+
transfers ownership of any portion thereof to Licensee.
|
|
59
|
+
|
|
60
|
+
Licensee acknowledges that:
|
|
61
|
+
|
|
62
|
+
(a) The Methodology was developed by Licensor at significant expense
|
|
63
|
+
and constitutes valuable trade secrets and proprietary know-how;
|
|
64
|
+
|
|
65
|
+
(b) Licensee's exposure to the Software, the Methodology, and the
|
|
66
|
+
Confidential Materials is granted only as a use-license and creates
|
|
67
|
+
no ownership, residual rights, or implied rights of any kind;
|
|
68
|
+
|
|
69
|
+
(c) Output produced by Licensee for Licensee's own clients belongs to
|
|
70
|
+
Licensee and Licensee's clients; the underlying Methodology, prompts,
|
|
71
|
+
skills, and SOPs that produced that Output remain the exclusive
|
|
72
|
+
property of Licensor.
|
|
73
|
+
|
|
74
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
75
|
+
5. PROHIBITED USES
|
|
76
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
77
|
+
|
|
78
|
+
Licensee shall NOT, directly or indirectly, do any of the following,
|
|
79
|
+
whether for compensation or not:
|
|
80
|
+
|
|
81
|
+
(a) Republish, resell, sublicense, mirror, distribute, fork publicly,
|
|
82
|
+
or otherwise redistribute the Software, the SOPs, the skills, the
|
|
83
|
+
prompts, or any substantial portion of the Confidential Materials;
|
|
84
|
+
|
|
85
|
+
(b) Repackage the Software (in whole or in modified form) for sale,
|
|
86
|
+
trade, or distribution as a product, agent, plugin, template,
|
|
87
|
+
course, or service;
|
|
88
|
+
|
|
89
|
+
(c) Build, develop, market, or operate any competing product, AI
|
|
90
|
+
agent, SaaS, automated tool, plugin, or course that incorporates
|
|
91
|
+
the Methodology, the prompts, the skills, the SOPs, or any
|
|
92
|
+
substantial derivative thereof;
|
|
93
|
+
|
|
94
|
+
(d) Use the Software, the Methodology, or the Confidential Materials
|
|
95
|
+
to train, fine-tune, prompt, or otherwise develop any artificial
|
|
96
|
+
intelligence model, agent, or system;
|
|
97
|
+
|
|
98
|
+
(e) Reverse engineer, decompile, disassemble, or attempt to extract
|
|
99
|
+
the Methodology from the Software for the purpose of recreating it
|
|
100
|
+
outside the licensed context;
|
|
101
|
+
|
|
102
|
+
(f) Bypass, disable, or circumvent the license validation, machine
|
|
103
|
+
fingerprinting, or watermarking systems;
|
|
104
|
+
|
|
105
|
+
(g) Disclose the Confidential Materials to any third party not
|
|
106
|
+
independently licensed by Licensor.
|
|
107
|
+
|
|
108
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
109
|
+
6. CONFIDENTIALITY
|
|
110
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
111
|
+
|
|
112
|
+
Licensee shall treat all Confidential Materials with the same degree
|
|
113
|
+
of care used to protect Licensee's own trade secrets, and in no case
|
|
114
|
+
less than reasonable care. The confidentiality obligation survives
|
|
115
|
+
termination of this agreement and continues indefinitely with respect
|
|
116
|
+
to information that retains commercial value as a trade secret.
|
|
117
|
+
|
|
118
|
+
Licensee may not screenshot, transcribe, paraphrase, or summarize
|
|
119
|
+
substantial portions of the Confidential Materials for public
|
|
120
|
+
distribution, social media content, blog posts, conference talks, or
|
|
121
|
+
competing training programs without prior written permission from
|
|
122
|
+
Licensor.
|
|
123
|
+
|
|
124
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
125
|
+
7. WATERMARKING & LEAK DETECTION
|
|
126
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
127
|
+
|
|
128
|
+
Licensee acknowledges that the SOPs and certain other Confidential
|
|
129
|
+
Materials are watermarked with Licensee's identifying information.
|
|
130
|
+
Licensee agrees that any unauthorized distribution traceable to
|
|
131
|
+
Licensee's watermark constitutes prima facie evidence of breach.
|
|
132
|
+
|
|
133
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
134
|
+
8. FOUNDERS COHORT TERMS
|
|
135
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
136
|
+
|
|
137
|
+
If Licensee purchased a Founders Cohort seat, Licensee's seat is
|
|
138
|
+
grandfathered at the founders price for all future versions of the
|
|
139
|
+
Software, conditional on continuous compliance with this agreement.
|
|
140
|
+
Founders status is non-transferable and is forfeited upon any material
|
|
141
|
+
breach.
|
|
142
|
+
|
|
143
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
144
|
+
9. TERMINATION
|
|
145
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
146
|
+
|
|
147
|
+
Licensor may revoke this license, with or without notice, upon any
|
|
148
|
+
material breach by Licensee — including but not limited to
|
|
149
|
+
redistribution, license sharing, derivative product development,
|
|
150
|
+
chargebacks, or breach of confidentiality. Upon termination, Licensee
|
|
151
|
+
must immediately cease all use of the Software, uninstall all copies,
|
|
152
|
+
and destroy any retained Confidential Materials.
|
|
153
|
+
|
|
154
|
+
Sections 4 (IP), 5 (Prohibited Uses), 6 (Confidentiality), 7
|
|
155
|
+
(Watermarking), 10 (Remedies), 11 (Liability), and 12 (Governing Law)
|
|
156
|
+
survive termination indefinitely.
|
|
157
|
+
|
|
158
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
159
|
+
10. REMEDIES
|
|
160
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
161
|
+
|
|
162
|
+
Licensee acknowledges that breach of Sections 4, 5, or 6 would cause
|
|
163
|
+
irreparable harm to Licensor that cannot be adequately compensated by
|
|
164
|
+
monetary damages alone. In the event of such breach, Licensor is
|
|
165
|
+
entitled to seek immediate injunctive relief, in addition to monetary
|
|
166
|
+
damages, attorneys' fees, and any other remedies available at law or
|
|
167
|
+
in equity.
|
|
168
|
+
|
|
169
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
170
|
+
11. NO WARRANTY / LIMITATION OF LIABILITY
|
|
171
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
172
|
+
|
|
173
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
|
|
174
|
+
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO IMPLIED WARRANTIES
|
|
175
|
+
OF MERCHANTABILITY OR FITNESS FOR A PARTICULAR PURPOSE. IN NO EVENT
|
|
176
|
+
SHALL LICENSOR BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY
|
|
177
|
+
ARISING FROM USE OF THE SOFTWARE, EXCEEDING THE FEES PAID BY LICENSEE
|
|
178
|
+
IN THE PRECEDING TWELVE (12) MONTHS.
|
|
179
|
+
|
|
180
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
181
|
+
12. GOVERNING LAW & VENUE
|
|
182
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
183
|
+
|
|
184
|
+
This agreement is governed by the laws of the jurisdiction where
|
|
185
|
+
Licensor is principally located, without regard to conflict-of-law
|
|
186
|
+
provisions. Any dispute arising from this agreement shall be resolved
|
|
187
|
+
exclusively in the courts of that jurisdiction.
|
|
188
|
+
|
|
189
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
190
|
+
13. SEVERABILITY
|
|
191
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
192
|
+
|
|
193
|
+
If any provision of this agreement is held to be unenforceable, the
|
|
194
|
+
remaining provisions remain in full force and effect, and the
|
|
195
|
+
unenforceable provision shall be reformed to the minimum extent
|
|
196
|
+
necessary to make it enforceable while preserving its intent.
|
|
197
|
+
|
|
198
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
199
|
+
14. ENTIRE AGREEMENT
|
|
200
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
201
|
+
|
|
202
|
+
This agreement, together with any signed Founders Agreement or
|
|
203
|
+
companion NDA executed between the parties, constitutes the entire
|
|
204
|
+
agreement regarding the Software and supersedes all prior
|
|
205
|
+
communications, representations, or understandings.
|
|
206
|
+
|
|
207
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
208
|
+
15. CONTACT
|
|
209
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
210
|
+
|
|
211
|
+
Questions, license transfers, alleged violations, or inquiries:
|
|
212
|
+
|
|
213
|
+
Rob Rizk
|
|
214
|
+
Rizk Advertising
|
|
215
|
+
rob@rizkadvertising.com
|
|
216
|
+
|
|
217
|
+
═══════════════════════════════════════════════════════════════════════════
|
|
218
|
+
|
|
219
|
+
NOTICE: By installing the Software, Licensee accepts this agreement in
|
|
220
|
+
full. The Software watermarks identifying information into Confidential
|
|
221
|
+
Materials at install time. This is not negotiable on a per-installation
|
|
222
|
+
basis. Volume licensing, agency tier, and special arrangements available
|
|
223
|
+
on request.
|
package/README.md
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
# ⚡ Sonic Agent
|
|
2
|
+
|
|
3
|
+
A specialized AI agent for building WordPress authority websites at scale.
|
|
4
|
+
|
|
5
|
+
> **Founders cohort license required.** This is a private package — install only works with a valid license key.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Install
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install -g @lebtiga/sonic-agent
|
|
13
|
+
```
|
|
14
|
+
|
|
15
|
+
You'll be prompted for your license key during install. Format: `SONIC-XXXX-XXXX-XXXX-XXXX`.
|
|
16
|
+
|
|
17
|
+
If the prompt is skipped (CI, non-interactive shell), run:
|
|
18
|
+
|
|
19
|
+
```bash
|
|
20
|
+
sonic activate
|
|
21
|
+
```
|
|
22
|
+
|
|
23
|
+
## Quick start
|
|
24
|
+
|
|
25
|
+
```bash
|
|
26
|
+
sonic # start the agent in your project directory
|
|
27
|
+
sonic init # scaffold a new project workspace
|
|
28
|
+
sonic status # check install state + license
|
|
29
|
+
sonic update # pull latest core (your skills + user data are preserved)
|
|
30
|
+
sonic --help # all commands
|
|
31
|
+
```
|
|
32
|
+
|
|
33
|
+
## What you get
|
|
34
|
+
|
|
35
|
+
Sonic installs to `~/.sonic/` with a 3-layer structure:
|
|
36
|
+
|
|
37
|
+
```
|
|
38
|
+
~/.sonic/
|
|
39
|
+
├── sonic-agent/ ← Core agent (refreshed on `sonic update`)
|
|
40
|
+
├── sonic-skills/ ← Your installed skills (never touched on update)
|
|
41
|
+
└── sonic-user/ ← Your custom skills, client configs, workspace
|
|
42
|
+
├── custom-skills/
|
|
43
|
+
├── client-configs/
|
|
44
|
+
└── workspace/
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
Anything you put in `sonic-skills/` or `sonic-user/` is **yours forever** — `sonic update` will never overwrite it.
|
|
48
|
+
|
|
49
|
+
## Requires
|
|
50
|
+
|
|
51
|
+
- Node.js >= 18
|
|
52
|
+
- [Claude Code](https://claude.com/claude-code) installed (the CLI Sonic plugs into)
|
|
53
|
+
|
|
54
|
+
## Support
|
|
55
|
+
|
|
56
|
+
- Email: rob@rizkadvertising.com
|
|
57
|
+
- Docs: https://sonic.saasperity.com
|
|
58
|
+
|
|
59
|
+
## License
|
|
60
|
+
|
|
61
|
+
Commercial — single seat per license key. Do not redistribute. SOPs and skills are watermarked with the buyer's email for leak detection.
|
package/bin/sonic.js
ADDED
|
@@ -0,0 +1,304 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Sonic CLI — main entry point
|
|
3
|
+
// Usage:
|
|
4
|
+
// sonic start the Sonic agent (launches Claude Code with the plugin)
|
|
5
|
+
// sonic init scaffold a new project workspace in the current directory
|
|
6
|
+
// sonic activate enter/re-enter your license key (if postinstall was skipped)
|
|
7
|
+
// sonic update pull the latest sonic-agent core (preserves user/skills folders)
|
|
8
|
+
// sonic status show install state, license info, version
|
|
9
|
+
// sonic --version print version
|
|
10
|
+
// sonic --help show this help
|
|
11
|
+
|
|
12
|
+
const fs = require('fs');
|
|
13
|
+
const path = require('path');
|
|
14
|
+
const { spawn } = require('child_process');
|
|
15
|
+
const os = require('os');
|
|
16
|
+
|
|
17
|
+
const { isValidFormat } = require('../lib/license');
|
|
18
|
+
const {
|
|
19
|
+
installPlugin,
|
|
20
|
+
isInstalled,
|
|
21
|
+
getLicenseInfo,
|
|
22
|
+
getSonicHome,
|
|
23
|
+
} = require('../lib/installer');
|
|
24
|
+
|
|
25
|
+
let c;
|
|
26
|
+
try {
|
|
27
|
+
c = require('kleur');
|
|
28
|
+
} catch (e) {
|
|
29
|
+
c = { yellow: (s) => s, red: (s) => s, green: (s) => s, bold: (s) => s, dim: (s) => s, cyan: (s) => s };
|
|
30
|
+
}
|
|
31
|
+
|
|
32
|
+
let prompts;
|
|
33
|
+
try {
|
|
34
|
+
prompts = require('prompts');
|
|
35
|
+
} catch (e) {
|
|
36
|
+
prompts = null;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
const pkg = require('../package.json');
|
|
40
|
+
|
|
41
|
+
const args = process.argv.slice(2);
|
|
42
|
+
const command = args[0];
|
|
43
|
+
|
|
44
|
+
async function main() {
|
|
45
|
+
if (!command || command === 'start') {
|
|
46
|
+
return cmdStart();
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
switch (command) {
|
|
50
|
+
case 'init':
|
|
51
|
+
return cmdInit();
|
|
52
|
+
case 'activate':
|
|
53
|
+
return cmdActivate();
|
|
54
|
+
case 'update':
|
|
55
|
+
return cmdUpdate();
|
|
56
|
+
case 'status':
|
|
57
|
+
return cmdStatus();
|
|
58
|
+
case '-v':
|
|
59
|
+
case '--version':
|
|
60
|
+
case 'version':
|
|
61
|
+
console.log(`sonic v${pkg.version}`);
|
|
62
|
+
return;
|
|
63
|
+
case '-h':
|
|
64
|
+
case '--help':
|
|
65
|
+
case 'help':
|
|
66
|
+
return printHelp();
|
|
67
|
+
default:
|
|
68
|
+
// Unrecognized — assume the user is passing claude flags or a prompt.
|
|
69
|
+
// Launch sonic with all args forwarded to claude.
|
|
70
|
+
return cmdStart();
|
|
71
|
+
}
|
|
72
|
+
}
|
|
73
|
+
|
|
74
|
+
function printHelp() {
|
|
75
|
+
console.log('');
|
|
76
|
+
console.log(c.cyan('⚡ Sonic Agent') + c.dim(` v${pkg.version}`));
|
|
77
|
+
console.log(c.dim('────────────────────────────────────────'));
|
|
78
|
+
console.log('');
|
|
79
|
+
console.log(c.bold('Commands'));
|
|
80
|
+
console.log(' ' + c.cyan('sonic') + c.dim(' start the Sonic agent in this directory'));
|
|
81
|
+
console.log(' ' + c.cyan('sonic init') + c.dim(' scaffold a new project workspace here'));
|
|
82
|
+
console.log(' ' + c.cyan('sonic activate') + c.dim(' enter your license key'));
|
|
83
|
+
console.log(' ' + c.cyan('sonic update') + c.dim(' pull the latest core (preserves your skills + user data)'));
|
|
84
|
+
console.log(' ' + c.cyan('sonic status') + c.dim(' show install state, license, version'));
|
|
85
|
+
console.log(' ' + c.cyan('sonic --version') + c.dim(' print version'));
|
|
86
|
+
console.log(' ' + c.cyan('sonic --help') + c.dim(' show this help'));
|
|
87
|
+
console.log('');
|
|
88
|
+
console.log(c.dim('Docs: https://sonic.saasperity.com'));
|
|
89
|
+
console.log(c.dim('Support: rob@rizkadvertising.com'));
|
|
90
|
+
console.log('');
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
async function cmdStart() {
|
|
94
|
+
if (!isInstalled()) {
|
|
95
|
+
console.log(c.yellow('⚠️ Sonic is not installed yet.'));
|
|
96
|
+
console.log(c.dim(' Run: ') + c.cyan('sonic activate'));
|
|
97
|
+
process.exit(1);
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
const sonicAgent = path.join(getSonicHome(), 'sonic-agent');
|
|
101
|
+
|
|
102
|
+
// Try to launch Claude Code with the plugin path.
|
|
103
|
+
// We use `claude` CLI if available, otherwise print instructions.
|
|
104
|
+
const claudeBin = findClaudeBin();
|
|
105
|
+
if (!claudeBin) {
|
|
106
|
+
console.log('');
|
|
107
|
+
console.log(c.yellow('Claude Code CLI not found on your PATH.'));
|
|
108
|
+
console.log('');
|
|
109
|
+
console.log(c.dim('Install it from: https://claude.com/claude-code'));
|
|
110
|
+
console.log('');
|
|
111
|
+
console.log(c.dim('Once installed, Sonic lives at:'));
|
|
112
|
+
console.log(' ' + c.cyan(sonicAgent));
|
|
113
|
+
console.log('');
|
|
114
|
+
console.log(c.dim('Add it as a Claude Code plugin and you are ready to go.'));
|
|
115
|
+
process.exit(1);
|
|
116
|
+
}
|
|
117
|
+
|
|
118
|
+
console.log(c.cyan('⚡ Launching Sonic...'));
|
|
119
|
+
console.log(c.dim(` Plugin: ${sonicAgent}`));
|
|
120
|
+
console.log('');
|
|
121
|
+
|
|
122
|
+
// Pass any extra args after `sonic` straight through to claude.
|
|
123
|
+
const passthrough = process.argv.slice(2).filter((a) => a !== 'start');
|
|
124
|
+
|
|
125
|
+
const child = spawn(
|
|
126
|
+
claudeBin,
|
|
127
|
+
['--plugin-dir', sonicAgent, ...passthrough],
|
|
128
|
+
{
|
|
129
|
+
stdio: 'inherit',
|
|
130
|
+
env: {
|
|
131
|
+
...process.env,
|
|
132
|
+
SONIC_HOME: getSonicHome(),
|
|
133
|
+
},
|
|
134
|
+
}
|
|
135
|
+
);
|
|
136
|
+
|
|
137
|
+
child.on('exit', (code) => process.exit(code || 0));
|
|
138
|
+
}
|
|
139
|
+
|
|
140
|
+
async function cmdInit() {
|
|
141
|
+
const cwd = process.cwd();
|
|
142
|
+
console.log('');
|
|
143
|
+
console.log(c.cyan('⚡ Sonic — init project workspace'));
|
|
144
|
+
console.log(c.dim(` ${cwd}`));
|
|
145
|
+
console.log('');
|
|
146
|
+
|
|
147
|
+
const dirs = ['.sonic', '.sonic/state', '.sonic/output', 'content', 'images'];
|
|
148
|
+
for (const d of dirs) {
|
|
149
|
+
const full = path.join(cwd, d);
|
|
150
|
+
if (!fs.existsSync(full)) {
|
|
151
|
+
fs.mkdirSync(full, { recursive: true });
|
|
152
|
+
console.log(c.green(' + ') + c.dim(d + '/'));
|
|
153
|
+
} else {
|
|
154
|
+
console.log(c.dim(' · ' + d + '/ (exists)'));
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
const configFile = path.join(cwd, '.sonic', 'project.json');
|
|
159
|
+
if (!fs.existsSync(configFile)) {
|
|
160
|
+
fs.writeFileSync(
|
|
161
|
+
configFile,
|
|
162
|
+
JSON.stringify(
|
|
163
|
+
{
|
|
164
|
+
createdAt: new Date().toISOString(),
|
|
165
|
+
sonicVersion: pkg.version,
|
|
166
|
+
stage: 'brand',
|
|
167
|
+
},
|
|
168
|
+
null,
|
|
169
|
+
2
|
|
170
|
+
)
|
|
171
|
+
);
|
|
172
|
+
console.log(c.green(' + ') + c.dim('.sonic/project.json'));
|
|
173
|
+
}
|
|
174
|
+
|
|
175
|
+
console.log('');
|
|
176
|
+
console.log(c.green('✓ Workspace ready.'));
|
|
177
|
+
console.log(c.dim(' Run ') + c.cyan('sonic') + c.dim(' to start.'));
|
|
178
|
+
console.log('');
|
|
179
|
+
}
|
|
180
|
+
|
|
181
|
+
async function cmdActivate() {
|
|
182
|
+
console.log('');
|
|
183
|
+
console.log(c.cyan('⚡ Sonic — activate license'));
|
|
184
|
+
console.log(c.dim('────────────────────────────────────────'));
|
|
185
|
+
console.log('');
|
|
186
|
+
|
|
187
|
+
if (!prompts) {
|
|
188
|
+
console.log(c.red('Interactive prompts unavailable.'));
|
|
189
|
+
process.exit(1);
|
|
190
|
+
}
|
|
191
|
+
|
|
192
|
+
const response = await prompts([
|
|
193
|
+
{
|
|
194
|
+
type: 'text',
|
|
195
|
+
name: 'licenseKey',
|
|
196
|
+
message: 'Enter your Sonic license key:',
|
|
197
|
+
validate: (value) =>
|
|
198
|
+
isValidFormat(value) ? true : 'Invalid format. Expected: SONIC-XXXX-XXXX-XXXX-XXXX',
|
|
199
|
+
},
|
|
200
|
+
{
|
|
201
|
+
type: (prev) => (prev ? 'text' : null),
|
|
202
|
+
name: 'email',
|
|
203
|
+
message: 'Email address on your Sonic license:',
|
|
204
|
+
validate: (value) =>
|
|
205
|
+
value && value.includes('@') && value.includes('.')
|
|
206
|
+
? true
|
|
207
|
+
: 'Please enter a valid email address.',
|
|
208
|
+
},
|
|
209
|
+
]);
|
|
210
|
+
|
|
211
|
+
if (!response.licenseKey || !response.email) {
|
|
212
|
+
console.log(c.yellow('Cancelled.'));
|
|
213
|
+
process.exit(0);
|
|
214
|
+
}
|
|
215
|
+
|
|
216
|
+
const licenseKey = response.licenseKey.trim().toUpperCase();
|
|
217
|
+
const email = response.email.trim().toLowerCase();
|
|
218
|
+
|
|
219
|
+
console.log('');
|
|
220
|
+
console.log(c.dim(' Installing Sonic to ~/.sonic ...'));
|
|
221
|
+
try {
|
|
222
|
+
const result = installPlugin(licenseKey, email);
|
|
223
|
+
console.log(c.green(' ✓ Installed'));
|
|
224
|
+
console.log(c.dim(` Licensed to: ${email}`));
|
|
225
|
+
console.log(c.dim(` ${result.sonicAgent}`));
|
|
226
|
+
} catch (err) {
|
|
227
|
+
console.log(c.red(` ✗ Install failed: ${err.message}`));
|
|
228
|
+
process.exit(1);
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
console.log('');
|
|
232
|
+
console.log(c.bold(c.green('⚡ Sonic is ready. Run "sonic" to start.')));
|
|
233
|
+
console.log('');
|
|
234
|
+
}
|
|
235
|
+
|
|
236
|
+
async function cmdUpdate() {
|
|
237
|
+
console.log('');
|
|
238
|
+
console.log(c.cyan('⚡ Sonic — update'));
|
|
239
|
+
console.log('');
|
|
240
|
+
|
|
241
|
+
const license = getLicenseInfo();
|
|
242
|
+
if (!license || !license.licenseKey) {
|
|
243
|
+
console.log(c.yellow('No license on file. Run ') + c.cyan('sonic activate') + c.yellow(' first.'));
|
|
244
|
+
process.exit(1);
|
|
245
|
+
}
|
|
246
|
+
|
|
247
|
+
console.log(c.dim(' To get the latest version, run:'));
|
|
248
|
+
console.log('');
|
|
249
|
+
console.log(' ' + c.cyan('npm install -g @lebtiga/sonic-agent@latest'));
|
|
250
|
+
console.log('');
|
|
251
|
+
console.log(c.dim(' This will refresh ~/.sonic/sonic-agent. Your custom skills'));
|
|
252
|
+
console.log(c.dim(' and user data in ~/.sonic/sonic-skills and ~/.sonic/sonic-user'));
|
|
253
|
+
console.log(c.dim(' are never touched.'));
|
|
254
|
+
console.log('');
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
function cmdStatus() {
|
|
258
|
+
console.log('');
|
|
259
|
+
console.log(c.cyan('⚡ Sonic — status'));
|
|
260
|
+
console.log(c.dim('────────────────────────────────────────'));
|
|
261
|
+
console.log('');
|
|
262
|
+
console.log(c.dim(' Version: ') + pkg.version);
|
|
263
|
+
console.log(c.dim(' Sonic home: ') + getSonicHome());
|
|
264
|
+
console.log(c.dim(' Installed: ') + (isInstalled() ? c.green('yes') : c.red('no')));
|
|
265
|
+
|
|
266
|
+
const license = getLicenseInfo();
|
|
267
|
+
if (license) {
|
|
268
|
+
console.log(c.dim(' License key: ') + maskLicense(license.licenseKey));
|
|
269
|
+
console.log(c.dim(' Licensed to: ') + (license.buyerEmail || 'unknown'));
|
|
270
|
+
console.log(c.dim(' Installed at: ') + (license.installedAt || 'unknown'));
|
|
271
|
+
} else {
|
|
272
|
+
console.log(c.dim(' License: ') + c.yellow('not activated'));
|
|
273
|
+
}
|
|
274
|
+
console.log('');
|
|
275
|
+
}
|
|
276
|
+
|
|
277
|
+
function maskLicense(key) {
|
|
278
|
+
if (!key) return '';
|
|
279
|
+
// SONIC-ABCD-EFGH-IJKL-MNOP -> SONIC-ABCD-****-****-MNOP
|
|
280
|
+
return key.replace(/^(SONIC-[A-Z0-9]{4})-[A-Z0-9]{4}-[A-Z0-9]{4}-([A-Z0-9]{4})$/i, '$1-****-****-$2');
|
|
281
|
+
}
|
|
282
|
+
|
|
283
|
+
function findClaudeBin() {
|
|
284
|
+
const candidates = ['claude', 'claude-code'];
|
|
285
|
+
const PATH = process.env.PATH || '';
|
|
286
|
+
const sep = process.platform === 'win32' ? ';' : ':';
|
|
287
|
+
const ext = process.platform === 'win32' ? ['.exe', '.cmd', ''] : [''];
|
|
288
|
+
for (const dir of PATH.split(sep)) {
|
|
289
|
+
for (const name of candidates) {
|
|
290
|
+
for (const e of ext) {
|
|
291
|
+
const full = path.join(dir, name + e);
|
|
292
|
+
try {
|
|
293
|
+
if (fs.existsSync(full) && fs.statSync(full).isFile()) return full;
|
|
294
|
+
} catch (e) { /* skip */ }
|
|
295
|
+
}
|
|
296
|
+
}
|
|
297
|
+
}
|
|
298
|
+
return null;
|
|
299
|
+
}
|
|
300
|
+
|
|
301
|
+
main().catch((err) => {
|
|
302
|
+
console.error(c.red('Error: ') + err.message);
|
|
303
|
+
process.exit(1);
|
|
304
|
+
});
|
package/lib/index.js
ADDED
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
// @lebtiga/sonic-agent — main module exports.
|
|
2
|
+
// Most users will use the `sonic` CLI; this is for programmatic access.
|
|
3
|
+
|
|
4
|
+
const license = require('./license');
|
|
5
|
+
const installer = require('./installer');
|
|
6
|
+
|
|
7
|
+
module.exports = {
|
|
8
|
+
// license validation
|
|
9
|
+
validateLicense: license.validateLicense,
|
|
10
|
+
isValidFormat: license.isValidFormat,
|
|
11
|
+
getMachineFingerprint: license.getMachineFingerprint,
|
|
12
|
+
|
|
13
|
+
// installer
|
|
14
|
+
installPlugin: installer.installPlugin,
|
|
15
|
+
isInstalled: installer.isInstalled,
|
|
16
|
+
getSonicHome: installer.getSonicHome,
|
|
17
|
+
getLicenseInfo: installer.getLicenseInfo,
|
|
18
|
+
|
|
19
|
+
version: require('../package.json').version,
|
|
20
|
+
};
|