friday-protocol 1.0.1 → 1.1.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/bin/cli.js +64 -2
- package/install.ps1 +31 -1
- package/install.sh +24 -0
- package/package.json +1 -1
package/bin/cli.js
CHANGED
|
@@ -3,9 +3,23 @@
|
|
|
3
3
|
import fs from 'node:fs';
|
|
4
4
|
import path from 'node:path';
|
|
5
5
|
import os from 'node:os';
|
|
6
|
+
import { fileURLToPath } from 'node:url';
|
|
6
7
|
import * as p from '@clack/prompts';
|
|
7
8
|
import pc from 'picocolors';
|
|
8
9
|
|
|
10
|
+
const __filename = fileURLToPath(import.meta.url);
|
|
11
|
+
const __dirname = path.dirname(__filename);
|
|
12
|
+
const packageRoot = path.resolve(__dirname, '..');
|
|
13
|
+
|
|
14
|
+
function copyDirectory(src, dest) {
|
|
15
|
+
if (!fs.existsSync(src)) return false;
|
|
16
|
+
if (!fs.existsSync(dest)) {
|
|
17
|
+
fs.mkdirSync(dest, { recursive: true });
|
|
18
|
+
}
|
|
19
|
+
fs.cpSync(src, dest, { recursive: true, force: true });
|
|
20
|
+
return true;
|
|
21
|
+
}
|
|
22
|
+
|
|
9
23
|
function getRuleContent(isCognitive) {
|
|
10
24
|
const cognitiveModeTitle = isCognitive ? 'COGNITIVE MODE' : 'STANDALONE MODE';
|
|
11
25
|
const law5Text = isCognitive
|
|
@@ -186,15 +200,63 @@ ${pc.bold('OPTIONS:')}
|
|
|
186
200
|
);
|
|
187
201
|
}
|
|
188
202
|
|
|
203
|
+
// 1. Inject Governance Rules
|
|
189
204
|
for (const targetPath of targets) {
|
|
190
205
|
const res = injectRuleFile(targetPath, ruleSnippet);
|
|
191
206
|
results.push(res);
|
|
192
207
|
}
|
|
193
208
|
|
|
194
|
-
|
|
209
|
+
// 2. Install Skills & Templates
|
|
210
|
+
const srcSkillsDir = path.join(packageRoot, 'skills', 'friday-protocol');
|
|
211
|
+
const srcTemplatesDir = path.join(packageRoot, 'templates');
|
|
212
|
+
const skillDestinations = [];
|
|
213
|
+
|
|
214
|
+
if (targetEnv === 'all' || targetEnv === 'antigravity') {
|
|
215
|
+
const dest = scope === 'global'
|
|
216
|
+
? path.join(userHome, '.gemini', 'config', 'skills', 'friday-protocol')
|
|
217
|
+
: path.join(process.cwd(), '.agents', 'skills', 'friday-protocol');
|
|
218
|
+
skillDestinations.push({ platform: 'Antigravity Skill', path: dest });
|
|
219
|
+
}
|
|
220
|
+
|
|
221
|
+
if (targetEnv === 'all' || targetEnv === 'claude') {
|
|
222
|
+
const dest = scope === 'global'
|
|
223
|
+
? path.join(userHome, '.claude', 'skills', 'friday-protocol')
|
|
224
|
+
: path.join(process.cwd(), '.claude', 'skills', 'friday-protocol');
|
|
225
|
+
skillDestinations.push({ platform: 'Claude Skill', path: dest });
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
if (targetEnv === 'all' || targetEnv === 'cursor') {
|
|
229
|
+
const dest = scope === 'global'
|
|
230
|
+
? path.join(userHome, '.cursor', 'skills', 'friday-protocol')
|
|
231
|
+
: path.join(process.cwd(), '.cursor', 'skills', 'friday-protocol');
|
|
232
|
+
skillDestinations.push({ platform: 'Cursor Skill', path: dest });
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
for (const item of skillDestinations) {
|
|
236
|
+
const copied = copyDirectory(srcSkillsDir, item.path);
|
|
237
|
+
if (copied) {
|
|
238
|
+
results.push({ status: 'skill', path: item.path, desc: item.platform });
|
|
239
|
+
}
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
// Optional: Copy templates to workspace if in workspace mode
|
|
243
|
+
if (scope === 'workspace') {
|
|
244
|
+
const destTemplates = path.join(process.cwd(), '.friday', 'templates');
|
|
245
|
+
const copiedTpl = copyDirectory(srcTemplatesDir, destTemplates);
|
|
246
|
+
if (copiedTpl) {
|
|
247
|
+
results.push({ status: 'skill', path: destTemplates, desc: 'Friday Templates' });
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
|
|
251
|
+
s.stop('Governance rules & skills successfully applied!');
|
|
195
252
|
|
|
196
253
|
for (const r of results) {
|
|
197
|
-
|
|
254
|
+
let icon = pc.green('[INJECTED]');
|
|
255
|
+
if (r.status === 'updated') {
|
|
256
|
+
icon = pc.yellow('[UPDATED]');
|
|
257
|
+
} else if (r.status === 'skill') {
|
|
258
|
+
icon = pc.cyan('[SKILL INSTALLED]');
|
|
259
|
+
}
|
|
198
260
|
p.log.success(`${icon} ${pc.dim(r.path)}`);
|
|
199
261
|
}
|
|
200
262
|
|
package/install.ps1
CHANGED
|
@@ -105,22 +105,52 @@ function Inject-RuleFile {
|
|
|
105
105
|
}
|
|
106
106
|
}
|
|
107
107
|
|
|
108
|
-
|
|
108
|
+
function Install-SkillFiles {
|
|
109
|
+
param([string]$DestDir)
|
|
110
|
+
if (!(Test-Path $DestDir)) { New-Item -ItemType Directory -Path $DestDir -Force | Out-Null }
|
|
111
|
+
|
|
112
|
+
$localSkill = Join-Path $PSScriptRoot "skills\friday-protocol"
|
|
113
|
+
if (Test-Path $localSkill) {
|
|
114
|
+
Copy-Item -Path "$localSkill\*" -Destination $DestDir -Recurse -Force
|
|
115
|
+
Write-Host " [SKILL INSTALLED] $DestDir" -ForegroundColor Cyan
|
|
116
|
+
} else {
|
|
117
|
+
# Remote fallback via GitHub raw
|
|
118
|
+
$baseUri = "https://raw.githubusercontent.com/lhermawan/friday-protocol/main/skills/friday-protocol"
|
|
119
|
+
$refDir = Join-Path $DestDir "references"
|
|
120
|
+
if (!(Test-Path $refDir)) { New-Item -ItemType Directory -Path $refDir -Force | Out-Null }
|
|
121
|
+
|
|
122
|
+
try {
|
|
123
|
+
Invoke-WebRequest -Uri "$baseUri/SKILL.md" -OutFile (Join-Path $DestDir "SKILL.md") -UseBasicParsing | Out-Null
|
|
124
|
+
Invoke-WebRequest -Uri "$baseUri/references/6d-matrix.md" -OutFile (Join-Path $refDir "6d-matrix.md") -UseBasicParsing | Out-Null
|
|
125
|
+
Invoke-WebRequest -Uri "$baseUri/references/sast-checklist.md" -OutFile (Join-Path $refDir "sast-checklist.md") -UseBasicParsing | Out-Null
|
|
126
|
+
Invoke-WebRequest -Uri "$baseUri/references/dss-integration.md" -OutFile (Join-Path $refDir "dss-integration.md") -UseBasicParsing | Out-Null
|
|
127
|
+
Write-Host " [SKILL DOWNLOADED & INSTALLED] $DestDir" -ForegroundColor Cyan
|
|
128
|
+
} catch {
|
|
129
|
+
Write-Host " [WARN] Failed to download skill files: $_" -ForegroundColor Yellow
|
|
130
|
+
}
|
|
131
|
+
}
|
|
132
|
+
}
|
|
109
133
|
|
|
110
134
|
# Targets Mapping
|
|
111
135
|
if ($envChoice -in @("1", "4")) {
|
|
112
136
|
$target = if ($scopeChoice -eq "1") { "$userHome\.gemini\config\rules\GEMINI.md" } else { ".\.agents\rules\GEMINI.md" }
|
|
113
137
|
Inject-RuleFile -FilePath $target
|
|
138
|
+
$skillDest = if ($scopeChoice -eq "1") { "$userHome\.gemini\config\skills\friday-protocol" } else { ".\.agents\skills\friday-protocol" }
|
|
139
|
+
Install-SkillFiles -DestDir $skillDest
|
|
114
140
|
}
|
|
115
141
|
|
|
116
142
|
if ($envChoice -in @("2", "4")) {
|
|
117
143
|
$target = if ($scopeChoice -eq "1") { "$userHome\.claude\CLAUDE.md" } else { ".\CLAUDE.md" }
|
|
118
144
|
Inject-RuleFile -FilePath $target
|
|
145
|
+
$skillDest = if ($scopeChoice -eq "1") { "$userHome\.claude\skills\friday-protocol" } else { ".\.claude\skills\friday-protocol" }
|
|
146
|
+
Install-SkillFiles -DestDir $skillDest
|
|
119
147
|
}
|
|
120
148
|
|
|
121
149
|
if ($envChoice -in @("3", "4")) {
|
|
122
150
|
$target = if ($scopeChoice -eq "1") { "$userHome\.cursorrules" } else { ".\.cursorrules" }
|
|
123
151
|
Inject-RuleFile -FilePath $target
|
|
152
|
+
$skillDest = if ($scopeChoice -eq "1") { "$userHome\.cursor\skills\friday-protocol" } else { ".\.cursor\skills\friday-protocol" }
|
|
153
|
+
Install-SkillFiles -DestDir $skillDest
|
|
124
154
|
}
|
|
125
155
|
|
|
126
156
|
Write-Host ""
|
package/install.sh
CHANGED
|
@@ -101,20 +101,44 @@ inject_rule() {
|
|
|
101
101
|
fi
|
|
102
102
|
}
|
|
103
103
|
|
|
104
|
+
install_skills() {
|
|
105
|
+
local dest="$1"
|
|
106
|
+
mkdir -p "$dest/references"
|
|
107
|
+
local script_dir
|
|
108
|
+
script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
109
|
+
if [ -d "$script_dir/skills/friday-protocol" ]; then
|
|
110
|
+
cp -r "$script_dir/skills/friday-protocol/"* "$dest/"
|
|
111
|
+
echo -e " \033[0;36m[SKILL INSTALLED]\033[0m $dest"
|
|
112
|
+
else
|
|
113
|
+
local base_uri="https://raw.githubusercontent.com/lhermawan/friday-protocol/main/skills/friday-protocol"
|
|
114
|
+
curl -fsSL "$base_uri/SKILL.md" -o "$dest/SKILL.md" 2>/dev/null || true
|
|
115
|
+
curl -fsSL "$base_uri/references/6d-matrix.md" -o "$dest/references/6d-matrix.md" 2>/dev/null || true
|
|
116
|
+
curl -fsSL "$base_uri/references/sast-checklist.md" -o "$dest/references/sast-checklist.md" 2>/dev/null || true
|
|
117
|
+
curl -fsSL "$base_uri/references/dss-integration.md" -o "$dest/references/dss-integration.md" 2>/dev/null || true
|
|
118
|
+
echo -e " \033[0;36m[SKILL DOWNLOADED & INSTALLED]\033[0m $dest"
|
|
119
|
+
fi
|
|
120
|
+
}
|
|
121
|
+
|
|
104
122
|
# Apply targets
|
|
105
123
|
if [ "$envChoice" -eq 1 ] || [ "$envChoice" -eq 4 ]; then
|
|
106
124
|
[ "$scopeChoice" -eq 1 ] && target="$HOME/.gemini/config/rules/GEMINI.md" || target="./.agents/rules/GEMINI.md"
|
|
107
125
|
inject_rule "$target"
|
|
126
|
+
[ "$scopeChoice" -eq 1 ] && skill_dest="$HOME/.gemini/config/skills/friday-protocol" || skill_dest="./.agents/skills/friday-protocol"
|
|
127
|
+
install_skills "$skill_dest"
|
|
108
128
|
fi
|
|
109
129
|
|
|
110
130
|
if [ "$envChoice" -eq 2 ] || [ "$envChoice" -eq 4 ]; then
|
|
111
131
|
[ "$scopeChoice" -eq 1 ] && target="$HOME/.claude/CLAUDE.md" || target="./CLAUDE.md"
|
|
112
132
|
inject_rule "$target"
|
|
133
|
+
[ "$scopeChoice" -eq 1 ] && skill_dest="$HOME/.claude/skills/friday-protocol" || skill_dest="./.claude/skills/friday-protocol"
|
|
134
|
+
install_skills "$skill_dest"
|
|
113
135
|
fi
|
|
114
136
|
|
|
115
137
|
if [ "$envChoice" -eq 3 ] || [ "$envChoice" -eq 4 ]; then
|
|
116
138
|
[ "$scopeChoice" -eq 1 ] && target="$HOME/.cursorrules" || target="./.cursorrules"
|
|
117
139
|
inject_rule "$target"
|
|
140
|
+
[ "$scopeChoice" -eq 1 ] && skill_dest="$HOME/.cursor/skills/friday-protocol" || skill_dest="./.cursor/skills/friday-protocol"
|
|
141
|
+
install_skills "$skill_dest"
|
|
118
142
|
fi
|
|
119
143
|
|
|
120
144
|
echo ""
|