shortcuts-playground 1.2.2 → 1.2.3
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/README.md +16 -8
- package/bin/install.js +84 -0
- package/package.json +8 -1
package/README.md
CHANGED
|
@@ -14,18 +14,29 @@ OpenCode now supports plugin-bundled hooks via `tool.execute.after`. This packag
|
|
|
14
14
|
|
|
15
15
|
## Installation
|
|
16
16
|
|
|
17
|
-
For published npm distribution:
|
|
17
|
+
For published npm distribution (native for generic `tool` plugins — `opencode plugin` is `tui`/`server` only):
|
|
18
|
+
|
|
19
|
+
```json
|
|
20
|
+
// opencode.json (project or ~/.config/opencode/opencode.jsonc)
|
|
21
|
+
{
|
|
22
|
+
"$schema": "https://opencode.ai/config.json",
|
|
23
|
+
"plugin": ["shortcuts-playground"]
|
|
24
|
+
}
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
Bun installs the validator on next startup to `~/.cache/opencode`. Skills/commands/agents are installed automatically on `npm i` via `postinstall`, or manually:
|
|
18
28
|
|
|
19
29
|
```bash
|
|
20
|
-
|
|
21
|
-
#
|
|
22
|
-
opencode plugin shortcuts-playground --global
|
|
30
|
+
npx shortcuts-playground # project .opencode/
|
|
31
|
+
npx shortcuts-playground --global # ~/.config/opencode/
|
|
23
32
|
```
|
|
24
33
|
|
|
34
|
+
Pin with `shortcuts-playground@1.2.3`.
|
|
35
|
+
|
|
25
36
|
For local development from a checkout:
|
|
26
37
|
|
|
27
38
|
```bash
|
|
28
|
-
#
|
|
39
|
+
# via opencode.json (recommended)
|
|
29
40
|
# add to opencode.json: { "plugin": ["./opencode/plugin/validator.ts"] }
|
|
30
41
|
# then copy skills/commands/agents:
|
|
31
42
|
mkdir -p .opencode/plugins .opencode/skills .opencode/commands .opencode/agents
|
|
@@ -33,9 +44,6 @@ cp opencode/plugin/validator.ts .opencode/plugins/shortcuts-playground.ts
|
|
|
33
44
|
cp -R opencode/skills/shortcuts-playground .opencode/skills/
|
|
34
45
|
cp opencode/commands/*.md .opencode/commands/
|
|
35
46
|
cp opencode/agents/*.md .opencode/agents/
|
|
36
|
-
|
|
37
|
-
# option B: npm link / file path (no clone needed after publish)
|
|
38
|
-
opencode plugin ./opencode
|
|
39
47
|
```
|
|
40
48
|
|
|
41
49
|
The bundled skill uses direct script paths:
|
package/bin/install.js
ADDED
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// shortcuts-playground installer for OpenCode
|
|
3
|
+
// Copies skills/commands/agents from the npm package into .opencode/
|
|
4
|
+
// Usage: npx shortcuts-playground or npx shortcuts-playground --global
|
|
5
|
+
|
|
6
|
+
import { cpSync, existsSync, mkdirSync, readdirSync } from "node:fs";
|
|
7
|
+
import { join, dirname } from "node:path";
|
|
8
|
+
import { fileURLToPath } from "node:url";
|
|
9
|
+
|
|
10
|
+
const pkgRoot = join(dirname(fileURLToPath(import.meta.url)), "..");
|
|
11
|
+
const isGlobal = process.argv.includes("--global") || process.argv.includes("-g");
|
|
12
|
+
|
|
13
|
+
function findProjectRoot(start) {
|
|
14
|
+
let dir = start;
|
|
15
|
+
for (let i = 0; i < 10; i++) {
|
|
16
|
+
if (existsSync(join(dir, ".git"))) return dir;
|
|
17
|
+
if (existsSync(join(dir, "opencode.json")) || existsSync(join(dir, ".opencode"))) return dir;
|
|
18
|
+
const parent = dirname(dir);
|
|
19
|
+
if (parent === dir) break;
|
|
20
|
+
dir = parent;
|
|
21
|
+
}
|
|
22
|
+
return start;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
const destRoot = isGlobal
|
|
26
|
+
? join(process.env.HOME || "~", ".config", "opencode")
|
|
27
|
+
: findProjectRoot(process.cwd());
|
|
28
|
+
|
|
29
|
+
const destBase = join(destRoot, ".opencode");
|
|
30
|
+
if (isGlobal) {
|
|
31
|
+
// global directly uses ~/.config/opencode
|
|
32
|
+
// destRoot already is that
|
|
33
|
+
}
|
|
34
|
+
|
|
35
|
+
function copyDir(src, dest) {
|
|
36
|
+
if (!existsSync(src)) return 0;
|
|
37
|
+
mkdirSync(dest, { recursive: true });
|
|
38
|
+
let count = 0;
|
|
39
|
+
for (const entry of readdirSync(src, { withFileTypes: true })) {
|
|
40
|
+
const s = join(src, entry.name);
|
|
41
|
+
const d = join(dest, entry.name);
|
|
42
|
+
if (entry.isDirectory()) {
|
|
43
|
+
cpSync(s, d, { recursive: true, force: true });
|
|
44
|
+
count++;
|
|
45
|
+
} else {
|
|
46
|
+
cpSync(s, d, { force: true });
|
|
47
|
+
count++;
|
|
48
|
+
}
|
|
49
|
+
}
|
|
50
|
+
return count;
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
const skillsSrc = join(pkgRoot, "skills", "shortcuts-playground");
|
|
54
|
+
const skillsDest = isGlobal
|
|
55
|
+
? join(destRoot, "skills", "shortcuts-playground")
|
|
56
|
+
: join(destBase, "skills", "shortcuts-playground");
|
|
57
|
+
|
|
58
|
+
const commandsSrc = join(pkgRoot, "commands");
|
|
59
|
+
const commandsDest = isGlobal
|
|
60
|
+
? join(destRoot, "commands")
|
|
61
|
+
: join(destBase, "commands");
|
|
62
|
+
|
|
63
|
+
const agentsSrc = join(pkgRoot, "agents");
|
|
64
|
+
const agentsDest = isGlobal
|
|
65
|
+
? join(destRoot, "agents")
|
|
66
|
+
: join(destBase, "agents");
|
|
67
|
+
|
|
68
|
+
mkdirSync(skillsDest, { recursive: true });
|
|
69
|
+
mkdirSync(commandsDest, { recursive: true });
|
|
70
|
+
mkdirSync(agentsDest, { recursive: true });
|
|
71
|
+
|
|
72
|
+
cpSync(skillsSrc, skillsDest, { recursive: true, force: true });
|
|
73
|
+
for (const f of readdirSync(commandsSrc)) {
|
|
74
|
+
if (f.endsWith(".md")) cpSync(join(commandsSrc, f), join(commandsDest, f), { force: true });
|
|
75
|
+
}
|
|
76
|
+
for (const f of readdirSync(agentsSrc)) {
|
|
77
|
+
if (f.endsWith(".md")) cpSync(join(agentsSrc, f), join(agentsDest, f), { force: true });
|
|
78
|
+
}
|
|
79
|
+
|
|
80
|
+
console.log(`✓ Installed skills → ${skillsDest}`);
|
|
81
|
+
console.log(`✓ Installed commands → ${commandsDest} (/build-shortcut, /remix-shortcut)`);
|
|
82
|
+
console.log(`✓ Installed agents → ${agentsDest} (shortcut-builder, shortcut-remixer)`);
|
|
83
|
+
console.log(`\nPlugin already registered via opencode.json "plugin": ["shortcuts-playground"] — restart OpenCode TUI and run /build-shortcut`);
|
|
84
|
+
if (!isGlobal) console.log(`(global: npx shortcuts-playground --global)`);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "shortcuts-playground",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.3",
|
|
4
4
|
"description": "Build, validate, sign, and archive macOS/iOS Shortcuts from OpenCode — thin skill wrapper over ToolKit v78 catalog, /build-shortcut and /remix-shortcut commands, and tool.execute.after validator",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"license": "MIT",
|
|
@@ -24,7 +24,11 @@
|
|
|
24
24
|
"plugin"
|
|
25
25
|
],
|
|
26
26
|
"main": "plugin/validator.ts",
|
|
27
|
+
"bin": {
|
|
28
|
+
"shortcuts-playground": "./bin/install.js"
|
|
29
|
+
},
|
|
27
30
|
"files": [
|
|
31
|
+
"bin/",
|
|
28
32
|
"plugin/",
|
|
29
33
|
"skills/",
|
|
30
34
|
"commands/",
|
|
@@ -40,6 +44,9 @@
|
|
|
40
44
|
"peerDependencies": {
|
|
41
45
|
"@opencode-ai/plugin": "^1.17.0"
|
|
42
46
|
},
|
|
47
|
+
"scripts": {
|
|
48
|
+
"postinstall": "node ./bin/install.js || true"
|
|
49
|
+
},
|
|
43
50
|
"engines": {
|
|
44
51
|
"node": ">=18"
|
|
45
52
|
},
|