sdg-agents 1.0.9 → 1.0.11
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/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sdg-agents",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.11",
|
|
4
4
|
"description": "Structured working protocol and engineering rules for AI agents. Works with Claude Code, Antigravity, Codex, and others.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./src/engine/bin/index.mjs",
|
|
@@ -74,7 +74,9 @@ function getDirname(importMetaUrl) {
|
|
|
74
74
|
}
|
|
75
75
|
|
|
76
76
|
function runIfDirect(importMetaUrl, fn) {
|
|
77
|
-
|
|
77
|
+
const currentFile = fileURLToPath(importMetaUrl);
|
|
78
|
+
const entryFile = fs.realpathSync(path.resolve(process.argv[1]));
|
|
79
|
+
if (currentFile === entryFile) {
|
|
78
80
|
fn().catch((error) => {
|
|
79
81
|
if (error.name === 'ExitPromptError') {
|
|
80
82
|
console.log('\n\n Aborted.\n');
|
|
@@ -431,31 +431,41 @@ function writeAgentConfig(targetDir, content, requestedAgents = []) {
|
|
|
431
431
|
}
|
|
432
432
|
|
|
433
433
|
/**
|
|
434
|
-
* Writes or updates .gitignore
|
|
435
|
-
* Idempotent — only appends entries
|
|
434
|
+
* Writes or updates .gitignore with SDG-managed entries.
|
|
435
|
+
* Idempotent — each block only appends entries not already present.
|
|
436
436
|
*/
|
|
437
437
|
function writeGitignore(targetDir) {
|
|
438
438
|
const gitignorePath = path.join(targetDir, '.gitignore');
|
|
439
439
|
|
|
440
|
-
const
|
|
441
|
-
|
|
440
|
+
const BLOCKS = [
|
|
441
|
+
{
|
|
442
|
+
header: '# Environment — never commit secrets',
|
|
443
|
+
entries: ['.env', '.env.*'],
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
header: '# AI artifacts — session state, not project logic',
|
|
447
|
+
entries: ['.ai-backlog/', 'tmp/', 'temp/'],
|
|
448
|
+
},
|
|
449
|
+
];
|
|
442
450
|
|
|
443
451
|
const existingContent = fs.existsSync(gitignorePath)
|
|
444
452
|
? fs.readFileSync(gitignorePath, 'utf8')
|
|
445
453
|
: '';
|
|
446
454
|
|
|
447
455
|
const existingLines = existingContent.split('\n').map((line) => line.trim());
|
|
448
|
-
const missingEntries = REQUIRED_ENTRIES.filter((entry) => !existingLines.includes(entry));
|
|
449
456
|
|
|
450
|
-
|
|
457
|
+
const blocksToAppend = BLOCKS.map((block) => {
|
|
458
|
+
const missingEntries = block.entries.filter((entry) => !existingLines.includes(entry));
|
|
459
|
+
if (missingEntries.length === 0) return null;
|
|
460
|
+
const alreadyHasHeader = existingContent.includes(block.header);
|
|
461
|
+
const lines = alreadyHasHeader ? missingEntries : [block.header, ...missingEntries];
|
|
462
|
+
return lines.join('\n');
|
|
463
|
+
}).filter(Boolean);
|
|
451
464
|
|
|
452
|
-
|
|
453
|
-
const entriesToAppend = alreadyHasHeader ? missingEntries : [SDG_BLOCK_HEADER, ...missingEntries];
|
|
465
|
+
if (blocksToAppend.length === 0) return;
|
|
454
466
|
|
|
455
467
|
const separator = existingContent.length > 0 && !existingContent.endsWith('\n') ? '\n' : '';
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
fs.appendFileSync(gitignorePath, appendBlock);
|
|
468
|
+
fs.appendFileSync(gitignorePath, `${separator}\n${blocksToAppend.join('\n\n')}\n`);
|
|
459
469
|
}
|
|
460
470
|
|
|
461
471
|
/**
|