prosicht 1.0.0 → 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/index.js +50 -15
- package/package.json +1 -1
- package/tasks/todo.md +7 -14
package/index.js
CHANGED
|
@@ -5,7 +5,6 @@ const path = require('path');
|
|
|
5
5
|
const { program } = require('commander');
|
|
6
6
|
const prompts = require('prompts');
|
|
7
7
|
|
|
8
|
-
// GitHub Repository Raw URL (Kendi reponuzun URL'si ile eşleştiğinden emin olun)
|
|
9
8
|
const BASE_URL = 'https://raw.githubusercontent.com/ProSicht/ai-standards/main/templates';
|
|
10
9
|
|
|
11
10
|
const TEMPLATES = {
|
|
@@ -15,6 +14,16 @@ const TEMPLATES = {
|
|
|
15
14
|
backend: { name: 'Backend API Service', file: 'backend.md' }
|
|
16
15
|
};
|
|
17
16
|
|
|
17
|
+
// Projedeki mevcut AGENTS.md dosyasından şablon türünü okur
|
|
18
|
+
function detectExistingTemplate() {
|
|
19
|
+
const targetPath = path.join(process.cwd(), 'AGENTS.md');
|
|
20
|
+
if (!fs.existsSync(targetPath)) return null;
|
|
21
|
+
|
|
22
|
+
const content = fs.readFileSync(targetPath, 'utf8');
|
|
23
|
+
const match = content.match(/<!--\s*template:\s*(\w+)\s*-->/);
|
|
24
|
+
return match ? match[1] : null;
|
|
25
|
+
}
|
|
26
|
+
|
|
18
27
|
async function fetchAndSaveTemplate(templateKey) {
|
|
19
28
|
const selected = TEMPLATES[templateKey];
|
|
20
29
|
if (!selected) {
|
|
@@ -31,11 +40,19 @@ async function fetchAndSaveTemplate(templateKey) {
|
|
|
31
40
|
throw new Error(`HTTP ${response.status}: Dosya bulunamadi (${fileUrl})`);
|
|
32
41
|
}
|
|
33
42
|
|
|
34
|
-
|
|
35
|
-
|
|
43
|
+
let content = await response.text();
|
|
44
|
+
|
|
45
|
+
// En üste gizli metadata etiketini ekle
|
|
46
|
+
const metadataHeader = `<!-- template: ${templateKey} -->\n`;
|
|
47
|
+
|
|
48
|
+
// Eğer dosya önceden indirildiyse eski etiketi temizle, yenisini bas
|
|
49
|
+
content = content.replace(/<!--\s*template:\s*\w+\s*-->\n?/, '');
|
|
50
|
+
const finalContent = metadataHeader + content;
|
|
36
51
|
|
|
37
|
-
|
|
38
|
-
|
|
52
|
+
const targetPath = path.join(process.cwd(), 'AGENTS.md');
|
|
53
|
+
fs.writeFileSync(targetPath, finalContent, 'utf8');
|
|
54
|
+
|
|
55
|
+
console.log(`Basarili: AGENTS.md kaydedildi! (Sablon: ${templateKey})`);
|
|
39
56
|
console.log(`Konum: ${targetPath}\n`);
|
|
40
57
|
|
|
41
58
|
} catch (error) {
|
|
@@ -46,7 +63,7 @@ async function fetchAndSaveTemplate(templateKey) {
|
|
|
46
63
|
program
|
|
47
64
|
.name('prosicht')
|
|
48
65
|
.description('Pro Sicht AI Standards CLI')
|
|
49
|
-
.version('1.
|
|
66
|
+
.version('1.1.0');
|
|
50
67
|
|
|
51
68
|
program
|
|
52
69
|
.command('init')
|
|
@@ -67,12 +84,7 @@ program
|
|
|
67
84
|
});
|
|
68
85
|
|
|
69
86
|
templateKey = response.template;
|
|
70
|
-
|
|
71
|
-
// Kullanıcı menüden çıkış yaparsa (Ctrl+C)
|
|
72
|
-
if (!templateKey) {
|
|
73
|
-
console.log('Islem iptal edildi.');
|
|
74
|
-
process.exit(0);
|
|
75
|
-
}
|
|
87
|
+
if (!templateKey) process.exit(0);
|
|
76
88
|
}
|
|
77
89
|
|
|
78
90
|
await fetchAndSaveTemplate(templateKey);
|
|
@@ -80,10 +92,33 @@ program
|
|
|
80
92
|
|
|
81
93
|
program
|
|
82
94
|
.command('update')
|
|
83
|
-
.description('
|
|
84
|
-
.option('-t, --template <type>', 'Sablon
|
|
95
|
+
.description('Projedeki AGENTS.md dosyasini tespit edip otomatik gunceller')
|
|
96
|
+
.option('-t, --template <type>', 'Sablon turunu zorla belirle')
|
|
85
97
|
.action(async (options) => {
|
|
86
|
-
|
|
98
|
+
let templateKey = options.template;
|
|
99
|
+
|
|
100
|
+
// -t verilmediyse mevcut dosyadan otomatik tespit et
|
|
101
|
+
if (!templateKey) {
|
|
102
|
+
templateKey = detectExistingTemplate();
|
|
103
|
+
if (templateKey) {
|
|
104
|
+
console.log(`🔍 Tespit edilen mevcut sablon: "${templateKey}"`);
|
|
105
|
+
} else {
|
|
106
|
+
console.log('⚠️ Projede mevcut bir AGENTS.md veya sablon etiketi bulunamadi.');
|
|
107
|
+
const response = await prompts({
|
|
108
|
+
type: 'select',
|
|
109
|
+
name: 'template',
|
|
110
|
+
message: 'Guncellemek istediginiz sablonu secin:',
|
|
111
|
+
choices: Object.entries(TEMPLATES).map(([key, value]) => ({
|
|
112
|
+
title: value.name,
|
|
113
|
+
value: key
|
|
114
|
+
}))
|
|
115
|
+
});
|
|
116
|
+
templateKey = response.template;
|
|
117
|
+
if (!templateKey) process.exit(0);
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
|
|
121
|
+
await fetchAndSaveTemplate(templateKey);
|
|
87
122
|
});
|
|
88
123
|
|
|
89
124
|
program.parse(process.argv);
|
package/package.json
CHANGED
package/tasks/todo.md
CHANGED
|
@@ -1,21 +1,14 @@
|
|
|
1
|
-
#
|
|
1
|
+
# Şablon etiketi ve otomatik update
|
|
2
2
|
|
|
3
3
|
## Plan
|
|
4
4
|
|
|
5
|
-
- [x]
|
|
6
|
-
- [x]
|
|
7
|
-
- [x]
|
|
8
|
-
- [x]
|
|
9
|
-
- [x] Adım 5: `npm link` ile lokal test
|
|
10
|
-
- [ ] Adım 6: NPM yayınlama (login + publish) — bu oturumda atlandı
|
|
5
|
+
- [x] `index.js`: init sırasında `<!-- template: xxx -->` yaz
|
|
6
|
+
- [x] `index.js`: update mevcut etiketi okuyup doğru şablonu çeksin
|
|
7
|
+
- [x] `package.json` sürümünü `1.1.0` yap (CLI `--version` ile eşleşsin)
|
|
8
|
+
- [x] Lokal test: init `-t web` + etiket; update `-t` olmadan tespit
|
|
11
9
|
|
|
12
10
|
## Review
|
|
13
11
|
|
|
14
|
-
|
|
12
|
+
Init, `AGENTS.md` başına `<!-- template: web -->` yazıyor. `prosicht update` (`-t` yok) etiketi okuyup web şablonunu tekrar indirdi; dosyada tek etiket kaldı.
|
|
15
13
|
|
|
16
|
-
|
|
17
|
-
- `prosicht init -t web` GitHub'dan şablonu çekip geçici dizine `AGENTS.md` yazdı (4446 byte, başlık: Pro Sicht Web Application AI Instructions)
|
|
18
|
-
|
|
19
|
-
Paket adı `prosicht`; `bin.prosicht` `./index.js`. npm yayını yapılmadı.
|
|
20
|
-
|
|
21
|
-
Not: GitHub `templates/` altında şu an yalnızca `web.md` var. `landing.md`, `mobile.md`, `backend.md` 404 dönüyor; CLI bunu hata mesajıyla bildiriyor. Diğer şablonlar repo'ya eklenince komutlar ek değişiklik olmadan çalışır.
|
|
14
|
+
Sürüm lokal `1.1.0`. npm'deki yayın hâlâ `1.0.0` — yeni davranış için `npm publish` gerekir.
|