pgserve 2.1.3 → 2.2.1
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/CHANGELOG.md +96 -0
- package/README.md +105 -1
- package/bin/autopg-wrapper.cjs +16 -0
- package/bin/pgserve-wrapper.cjs +32 -6
- package/bin/postgres-server.js +56 -0
- package/console/README.md +131 -0
- package/console/api.js +173 -0
- package/console/app.jsx +483 -0
- package/console/colors_and_type.css +227 -0
- package/console/components.jsx +167 -0
- package/console/console.css +1666 -0
- package/console/data.jsx +350 -0
- package/console/index.html +31 -0
- package/console/screens/databases.jsx +5 -0
- package/console/screens/health.jsx +5 -0
- package/console/screens/ingress.jsx +5 -0
- package/console/screens/optimizer.jsx +5 -0
- package/console/screens/rlm-sim.jsx +5 -0
- package/console/screens/rlm-trace.jsx +5 -0
- package/console/screens/security.jsx +5 -0
- package/console/screens/settings.jsx +611 -0
- package/console/screens/sql.jsx +5 -0
- package/console/screens/sync.jsx +5 -0
- package/console/screens/tables.jsx +5 -0
- package/console/tweaks-panel.jsx +425 -0
- package/package.json +14 -2
- package/scripts/postinstall.cjs +60 -0
- package/src/cli-config.cjs +310 -0
- package/src/cli-install.cjs +112 -11
- package/src/cli-restart.cjs +228 -0
- package/src/cli-ui.cjs +580 -0
- package/src/cluster.js +43 -38
- package/src/postgres.js +141 -19
- package/src/settings-loader.cjs +235 -0
- package/src/settings-migrate.cjs +212 -0
- package/src/settings-pg-args.cjs +146 -0
- package/src/settings-schema.cjs +422 -0
- package/src/settings-validator.cjs +416 -0
- package/src/settings-writer.cjs +288 -0
- package/src/upgrade/index.js +65 -0
- package/src/upgrade/runner.js +23 -0
- package/src/upgrade/steps/binary-cache-flush.js +67 -0
- package/src/upgrade/steps/consumer-signal.js +40 -0
- package/src/upgrade/steps/env-refresh.js +89 -0
- package/src/upgrade/steps/health-validate.js +53 -0
- package/src/upgrade/steps/plpgsql-resolve.js +66 -0
- package/src/upgrade/steps/port-reconcile.js +52 -0
- package/.claude/context/windows-debug.md +0 -119
- package/.genie/AGENTS.md +0 -15
- package/.genie/agents/README.md +0 -110
- package/.genie/agents/analyze.md +0 -176
- package/.genie/agents/forge.md +0 -290
- package/.genie/agents/garbage-cleaner.md +0 -324
- package/.genie/agents/garbage-collector.md +0 -596
- package/.genie/agents/github-issue-gc.md +0 -618
- package/.genie/agents/review.md +0 -380
- package/.genie/agents/semantic-analyzer/find-duplicates.md +0 -90
- package/.genie/agents/semantic-analyzer/find-orphans.md +0 -99
- package/.genie/agents/semantic-analyzer.md +0 -101
- package/.genie/agents/update.md +0 -182
- package/.genie/agents/wish.md +0 -357
- package/.genie/brainstorms/pgserve-v2/DESIGN.md +0 -174
- package/.genie/code/AGENTS.md +0 -694
- package/.genie/code/agents/audit/risk.md +0 -173
- package/.genie/code/agents/audit/security.md +0 -189
- package/.genie/code/agents/audit.md +0 -145
- package/.genie/code/agents/challenge.md +0 -230
- package/.genie/code/agents/change-reviewer.md +0 -295
- package/.genie/code/agents/code-garbage-collector.md +0 -425
- package/.genie/code/agents/code-quality.md +0 -410
- package/.genie/code/agents/commit-suggester.md +0 -255
- package/.genie/code/agents/commit.md +0 -124
- package/.genie/code/agents/consensus.md +0 -204
- package/.genie/code/agents/daily-standup.md +0 -722
- package/.genie/code/agents/docgen.md +0 -48
- package/.genie/code/agents/explore.md +0 -79
- package/.genie/code/agents/fix.md +0 -100
- package/.genie/code/agents/git/commit-advisory.md +0 -219
- package/.genie/code/agents/git/workflows/issue.md +0 -244
- package/.genie/code/agents/git/workflows/pr.md +0 -179
- package/.genie/code/agents/git/workflows/release.md +0 -460
- package/.genie/code/agents/git/workflows/report.md +0 -342
- package/.genie/code/agents/git.md +0 -432
- package/.genie/code/agents/implementor.md +0 -161
- package/.genie/code/agents/install.md +0 -515
- package/.genie/code/agents/issue-creator.md +0 -344
- package/.genie/code/agents/polish.md +0 -116
- package/.genie/code/agents/qa.md +0 -653
- package/.genie/code/agents/refactor.md +0 -294
- package/.genie/code/agents/release.md +0 -1129
- package/.genie/code/agents/roadmap.md +0 -885
- package/.genie/code/agents/tests.md +0 -557
- package/.genie/code/agents/tracer.md +0 -50
- package/.genie/code/agents/update/upstream-update.md +0 -85
- package/.genie/code/agents/update/versions/generic-update.md +0 -305
- package/.genie/code/agents/vibe.md +0 -1317
- package/.genie/code/spells/agent-configuration.md +0 -58
- package/.genie/code/spells/automated-rc-publishing.md +0 -106
- package/.genie/code/spells/branch-tracker-guidance.md +0 -28
- package/.genie/code/spells/debug.md +0 -320
- package/.genie/code/spells/emoji-naming-convention.md +0 -303
- package/.genie/code/spells/evidence-storage.md +0 -26
- package/.genie/code/spells/file-naming-rules.md +0 -35
- package/.genie/code/spells/forge-code-blueprints.md +0 -195
- package/.genie/code/spells/genie-integration.md +0 -153
- package/.genie/code/spells/publishing-protocol.md +0 -61
- package/.genie/code/spells/team-consultation-protocol.md +0 -284
- package/.genie/code/spells/tool-requirements.md +0 -20
- package/.genie/code/spells/triad-maintenance-protocol.md +0 -154
- package/.genie/code/teams/tech-council/council.md +0 -328
- package/.genie/code/teams/tech-council/jt.md +0 -352
- package/.genie/code/teams/tech-council/nayr.md +0 -305
- package/.genie/code/teams/tech-council/oettam.md +0 -375
- package/.genie/neurons/README.md +0 -193
- package/.genie/neurons/forge.md +0 -106
- package/.genie/neurons/genie.md +0 -63
- package/.genie/neurons/review.md +0 -106
- package/.genie/neurons/wish.md +0 -104
- package/.genie/product/README.md +0 -20
- package/.genie/product/cli-automation.md +0 -359
- package/.genie/product/environment.md +0 -60
- package/.genie/product/mission.md +0 -60
- package/.genie/product/roadmap.md +0 -44
- package/.genie/product/tech-stack.md +0 -34
- package/.genie/product/templates/context-template.md +0 -218
- package/.genie/product/templates/qa-done-report-template.md +0 -68
- package/.genie/product/templates/review-report-template.md +0 -89
- package/.genie/product/templates/wish-template.md +0 -120
- package/.genie/scripts/helpers/analyze-commit.js +0 -195
- package/.genie/scripts/helpers/bullet-counter.js +0 -194
- package/.genie/scripts/helpers/bullet-find.js +0 -289
- package/.genie/scripts/helpers/bullet-id.js +0 -244
- package/.genie/scripts/helpers/check-secrets.js +0 -237
- package/.genie/scripts/helpers/count-tokens.js +0 -200
- package/.genie/scripts/helpers/create-frontmatter.js +0 -456
- package/.genie/scripts/helpers/detect-markers.js +0 -293
- package/.genie/scripts/helpers/detect-todos.js +0 -267
- package/.genie/scripts/helpers/detect-unlabeled-blocks.js +0 -135
- package/.genie/scripts/helpers/embeddings.js +0 -344
- package/.genie/scripts/helpers/find-empty-sections.js +0 -158
- package/.genie/scripts/helpers/index.js +0 -319
- package/.genie/scripts/helpers/validate-frontmatter.js +0 -578
- package/.genie/scripts/helpers/validate-links.js +0 -207
- package/.genie/scripts/helpers/validate-paths.js +0 -373
- package/.genie/spells/README.md +0 -9
- package/.genie/spells/ace-protocol.md +0 -118
- package/.genie/spells/ask-one-at-a-time.md +0 -175
- package/.genie/spells/backup-analyzer.md +0 -542
- package/.genie/spells/blocker.md +0 -12
- package/.genie/spells/break-things-move-fast.md +0 -56
- package/.genie/spells/context-candidates.md +0 -72
- package/.genie/spells/context-critic.md +0 -51
- package/.genie/spells/defer-to-expertise.md +0 -278
- package/.genie/spells/delegate-dont-do.md +0 -292
- package/.genie/spells/error-investigation-protocol.md +0 -328
- package/.genie/spells/evidence-based-completion.md +0 -273
- package/.genie/spells/experiment.md +0 -65
- package/.genie/spells/file-creation-protocol.md +0 -229
- package/.genie/spells/forge-integration.md +0 -281
- package/.genie/spells/forge-orchestration.md +0 -514
- package/.genie/spells/gather-context.md +0 -18
- package/.genie/spells/global-health-check.md +0 -34
- package/.genie/spells/global-noop-roundtrip.md +0 -25
- package/.genie/spells/install-genie.md +0 -1232
- package/.genie/spells/install.md +0 -82
- package/.genie/spells/investigate-before-commit.md +0 -112
- package/.genie/spells/know-yourself.md +0 -288
- package/.genie/spells/learn.md +0 -828
- package/.genie/spells/mcp-diagnostic-protocol.md +0 -246
- package/.genie/spells/mcp-first.md +0 -124
- package/.genie/spells/multi-step-execution.md +0 -67
- package/.genie/spells/orchestration-boundary-protocol.md +0 -256
- package/.genie/spells/orchestrator-not-implementor.md +0 -189
- package/.genie/spells/prompt.md +0 -746
- package/.genie/spells/reflect.md +0 -404
- package/.genie/spells/routing-decision-matrix.md +0 -368
- package/.genie/spells/run-in-parallel.md +0 -12
- package/.genie/spells/session-state-updater-example.md +0 -196
- package/.genie/spells/session-state-updater.md +0 -220
- package/.genie/spells/track-long-running-tasks.md +0 -133
- package/.genie/spells/troubleshoot-infrastructure.md +0 -176
- package/.genie/spells/upgrade-genie.md +0 -415
- package/.genie/spells/url-presentation-protocol.md +0 -301
- package/.genie/spells/wish-initiation.md +0 -158
- package/.genie/spells/wish-issue-linkage.md +0 -410
- package/.genie/spells/wish-lifecycle.md +0 -100
- package/.genie/state/provider-status.json +0 -3
- package/.genie/state/version.json +0 -16
- package/.genie/wishes/canonical-pgserve-pm2-supervision/WISH.md +0 -290
- package/.genie/wishes/pgserve-v2/BRIEF-from-genie-pgserve.md +0 -99
- package/.genie/wishes/pgserve-v2/WISH.md +0 -442
- package/.genie/wishes/release-system-genie-pattern/WISH.md +0 -268
- package/.genie/wishes/release-system-genie-pattern/validation.md +0 -205
- package/.gitguardian.yaml +0 -29
- package/.gitguardianignore +0 -16
- package/.github/workflows/ci.yml +0 -122
- package/.github/workflows/release.yml +0 -289
- package/.github/workflows/version.yml +0 -228
- package/.husky/pre-commit +0 -2
- package/AGENTS.md +0 -433
- package/CLAUDE.md +0 -1
- package/Makefile +0 -285
- package/assets/icon.ico +0 -0
- package/bun.lock +0 -435
- package/bunfig.toml +0 -28
- package/ecosystem.config.cjs +0 -23
- package/eslint.config.js +0 -63
- package/examples/multi-tenant-demo.js +0 -104
- package/install.sh +0 -123
- package/knip.json +0 -9
- package/tests/audit.test.js +0 -189
- package/tests/backpressure.test.js +0 -167
- package/tests/benchmarks/runner.js +0 -1197
- package/tests/benchmarks/vector-generator.js +0 -368
- package/tests/cli-install.test.js +0 -322
- package/tests/control-db.test.js +0 -285
- package/tests/daemon-args.test.js +0 -86
- package/tests/daemon-control.test.js +0 -171
- package/tests/daemon-fingerprint-integration.test.js +0 -111
- package/tests/daemon-pr24-regression.test.js +0 -198
- package/tests/fingerprint.test.js +0 -263
- package/tests/fixtures/240-orphan-seed.sql +0 -30
- package/tests/multi-tenant.test.js +0 -374
- package/tests/orphan-cleanup.test.js +0 -390
- package/tests/pg-version-regex.test.js +0 -129
- package/tests/quick-bench.js +0 -135
- package/tests/router-handshake-retry.test.js +0 -119
- package/tests/router-handshake-watchdog.test.js +0 -110
- package/tests/sdk.test.js +0 -71
- package/tests/stale-postmaster-pid.test.js +0 -85
- package/tests/stress-test.js +0 -439
- package/tests/sync-perf-test.js +0 -150
- package/tests/tcp-listen.test.js +0 -368
- package/tests/tenancy.test.js +0 -403
- package/tests/wrapper-supervision.test.js +0 -107
|
@@ -1,293 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* TODO/FIXME/WIP Marker Detector
|
|
5
|
-
*
|
|
6
|
-
* Scans files for incomplete work markers:
|
|
7
|
-
* - TODO, FIXME, XXX, HACK, WIP, TBD
|
|
8
|
-
* - Placeholder text patterns
|
|
9
|
-
*
|
|
10
|
-
* Usage:
|
|
11
|
-
* node detect-markers.js [path]
|
|
12
|
-
* (defaults to current directory if no path provided)
|
|
13
|
-
*/
|
|
14
|
-
|
|
15
|
-
const fs = require('fs');
|
|
16
|
-
const path = require('path');
|
|
17
|
-
|
|
18
|
-
// Marker patterns
|
|
19
|
-
const MARKERS = {
|
|
20
|
-
todo: /\bTODO\b:?/gi,
|
|
21
|
-
fixme: /\bFIXME\b:?/gi,
|
|
22
|
-
xxx: /\bXXX\b:?/gi,
|
|
23
|
-
hack: /\bHACK\b:?/gi,
|
|
24
|
-
wip: /\bWIP\b:?/gi,
|
|
25
|
-
tbd: /\bTBD\b:?/gi,
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
const PLACEHOLDER_PATTERNS = [
|
|
29
|
-
/coming soon/gi,
|
|
30
|
-
/to be documented/gi,
|
|
31
|
-
/fill this in later/gi,
|
|
32
|
-
/\[placeholder\]/gi,
|
|
33
|
-
/lorem ipsum/gi,
|
|
34
|
-
/TODO: write this section/gi,
|
|
35
|
-
];
|
|
36
|
-
|
|
37
|
-
// Git conflict markers (CRITICAL)
|
|
38
|
-
const CONFLICT_MARKERS = [
|
|
39
|
-
/^<<<<<<< /m,
|
|
40
|
-
/^=======/m,
|
|
41
|
-
/^>>>>>>> /m,
|
|
42
|
-
/^\|\|\|\|\|\|\| merged common ancestors/m,
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
// Configuration
|
|
46
|
-
const EXCLUDE_PATTERNS = [
|
|
47
|
-
'node_modules',
|
|
48
|
-
'.git',
|
|
49
|
-
'dist',
|
|
50
|
-
'build',
|
|
51
|
-
'coverage',
|
|
52
|
-
'/backups/',
|
|
53
|
-
'.min.js',
|
|
54
|
-
'.bundle.js',
|
|
55
|
-
];
|
|
56
|
-
|
|
57
|
-
// File extensions to scan
|
|
58
|
-
const SCAN_EXTENSIONS = ['.md', '.js', '.ts', '.jsx', '.tsx', '.json', '.yaml', '.yml'];
|
|
59
|
-
|
|
60
|
-
// Results
|
|
61
|
-
const results = {
|
|
62
|
-
totalFiles: 0,
|
|
63
|
-
scannedFiles: 0,
|
|
64
|
-
issues: [],
|
|
65
|
-
summary: {
|
|
66
|
-
markers: {},
|
|
67
|
-
placeholders: 0,
|
|
68
|
-
conflicts: 0,
|
|
69
|
-
},
|
|
70
|
-
};
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
* Should scan this file?
|
|
74
|
-
*/
|
|
75
|
-
function shouldScan(filePath) {
|
|
76
|
-
// Check exclusions
|
|
77
|
-
if (EXCLUDE_PATTERNS.some(pattern => filePath.includes(pattern))) {
|
|
78
|
-
return false;
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
// Check extension
|
|
82
|
-
const ext = path.extname(filePath);
|
|
83
|
-
return SCAN_EXTENSIONS.includes(ext);
|
|
84
|
-
}
|
|
85
|
-
|
|
86
|
-
/**
|
|
87
|
-
* Check if line is inside code block (markdown)
|
|
88
|
-
*/
|
|
89
|
-
function isInCodeBlock(lines, lineIndex) {
|
|
90
|
-
let inCodeBlock = false;
|
|
91
|
-
for (let i = 0; i < lineIndex; i++) {
|
|
92
|
-
if (lines[i].trim().startsWith('```')) {
|
|
93
|
-
inCodeBlock = !inCodeBlock;
|
|
94
|
-
}
|
|
95
|
-
}
|
|
96
|
-
return inCodeBlock;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* Scan single file
|
|
101
|
-
*/
|
|
102
|
-
function scanFile(filePath) {
|
|
103
|
-
results.totalFiles++;
|
|
104
|
-
|
|
105
|
-
if (!shouldScan(filePath)) {
|
|
106
|
-
return;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
111
|
-
const lines = content.split('\n');
|
|
112
|
-
const isMarkdown = filePath.endsWith('.md');
|
|
113
|
-
|
|
114
|
-
results.scannedFiles++;
|
|
115
|
-
|
|
116
|
-
lines.forEach((line, index) => {
|
|
117
|
-
const lineNum = index + 1;
|
|
118
|
-
|
|
119
|
-
// Skip code blocks in markdown (intentional examples)
|
|
120
|
-
if (isMarkdown && isInCodeBlock(lines, index)) {
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
// Check for git conflict markers (CRITICAL)
|
|
125
|
-
CONFLICT_MARKERS.forEach(pattern => {
|
|
126
|
-
if (pattern.test(line)) {
|
|
127
|
-
results.issues.push({
|
|
128
|
-
file: filePath,
|
|
129
|
-
line: lineNum,
|
|
130
|
-
type: 'conflict_marker',
|
|
131
|
-
severity: 'critical',
|
|
132
|
-
content: line.trim(),
|
|
133
|
-
message: 'Unresolved git merge conflict marker',
|
|
134
|
-
});
|
|
135
|
-
results.summary.conflicts++;
|
|
136
|
-
}
|
|
137
|
-
});
|
|
138
|
-
|
|
139
|
-
// Check for TODO/FIXME markers
|
|
140
|
-
Object.entries(MARKERS).forEach(([type, pattern]) => {
|
|
141
|
-
const match = line.match(pattern);
|
|
142
|
-
if (match) {
|
|
143
|
-
results.issues.push({
|
|
144
|
-
file: filePath,
|
|
145
|
-
line: lineNum,
|
|
146
|
-
type: `marker_${type}`,
|
|
147
|
-
severity: 'warning',
|
|
148
|
-
content: line.trim(),
|
|
149
|
-
message: `${type.toUpperCase()} marker found`,
|
|
150
|
-
});
|
|
151
|
-
results.summary.markers[type] = (results.summary.markers[type] || 0) + 1;
|
|
152
|
-
}
|
|
153
|
-
});
|
|
154
|
-
|
|
155
|
-
// Check for placeholder text
|
|
156
|
-
PLACEHOLDER_PATTERNS.forEach(pattern => {
|
|
157
|
-
const match = line.match(pattern);
|
|
158
|
-
if (match) {
|
|
159
|
-
results.issues.push({
|
|
160
|
-
file: filePath,
|
|
161
|
-
line: lineNum,
|
|
162
|
-
type: 'placeholder',
|
|
163
|
-
severity: 'warning',
|
|
164
|
-
content: line.trim(),
|
|
165
|
-
message: `Placeholder text: "${match[0]}"`,
|
|
166
|
-
});
|
|
167
|
-
results.summary.placeholders++;
|
|
168
|
-
}
|
|
169
|
-
});
|
|
170
|
-
});
|
|
171
|
-
|
|
172
|
-
} catch (err) {
|
|
173
|
-
console.error(`Error scanning ${filePath}: ${err.message}`);
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
* Recursively scan directory
|
|
179
|
-
*/
|
|
180
|
-
function scanDirectory(dir) {
|
|
181
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
182
|
-
|
|
183
|
-
for (const entry of entries) {
|
|
184
|
-
const fullPath = path.join(dir, entry.name);
|
|
185
|
-
|
|
186
|
-
if (entry.isDirectory()) {
|
|
187
|
-
scanDirectory(fullPath);
|
|
188
|
-
} else if (entry.isFile()) {
|
|
189
|
-
scanFile(fullPath);
|
|
190
|
-
}
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
|
-
/**
|
|
195
|
-
* Generate report
|
|
196
|
-
*/
|
|
197
|
-
function generateReport() {
|
|
198
|
-
console.log('\n=== TODO/FIXME/Placeholder Detection Report ===\n');
|
|
199
|
-
|
|
200
|
-
console.log(`Total files: ${results.totalFiles}`);
|
|
201
|
-
console.log(`Scanned: ${results.scannedFiles}`);
|
|
202
|
-
console.log(`Issues found: ${results.issues.length}\n`);
|
|
203
|
-
|
|
204
|
-
if (results.issues.length === 0) {
|
|
205
|
-
console.log('✅ No markers or placeholders found!\n');
|
|
206
|
-
return 0;
|
|
207
|
-
}
|
|
208
|
-
|
|
209
|
-
// Group by severity
|
|
210
|
-
const critical = results.issues.filter(i => i.severity === 'critical');
|
|
211
|
-
const warnings = results.issues.filter(i => i.severity === 'warning');
|
|
212
|
-
|
|
213
|
-
// Show critical first
|
|
214
|
-
if (critical.length > 0) {
|
|
215
|
-
console.log(`🔴 CRITICAL (${critical.length}):\n`);
|
|
216
|
-
critical.forEach(issue => {
|
|
217
|
-
console.log(` ${issue.file}:${issue.line}`);
|
|
218
|
-
console.log(` ${issue.message}`);
|
|
219
|
-
console.log(` Content: ${issue.content}`);
|
|
220
|
-
console.log('');
|
|
221
|
-
});
|
|
222
|
-
}
|
|
223
|
-
|
|
224
|
-
// Show warnings
|
|
225
|
-
if (warnings.length > 0) {
|
|
226
|
-
console.log(`⚠️ WARNINGS (${warnings.length}):\n`);
|
|
227
|
-
|
|
228
|
-
// Group by type for cleaner output
|
|
229
|
-
const byType = {};
|
|
230
|
-
warnings.forEach(issue => {
|
|
231
|
-
if (!byType[issue.type]) byType[issue.type] = [];
|
|
232
|
-
byType[issue.type].push(issue);
|
|
233
|
-
});
|
|
234
|
-
|
|
235
|
-
Object.entries(byType).forEach(([type, issues]) => {
|
|
236
|
-
console.log(` ${type.toUpperCase()} (${issues.length}):`);
|
|
237
|
-
issues.forEach(issue => {
|
|
238
|
-
console.log(` ${issue.file}:${issue.line} - ${issue.content.substring(0, 80)}`);
|
|
239
|
-
});
|
|
240
|
-
console.log('');
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
|
-
// Summary
|
|
245
|
-
console.log('\n=== Summary ===\n');
|
|
246
|
-
|
|
247
|
-
if (results.summary.conflicts > 0) {
|
|
248
|
-
console.log(` 🔴 Conflict markers: ${results.summary.conflicts} (CRITICAL - FIX IMMEDIATELY)`);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
const totalMarkers = Object.values(results.summary.markers).reduce((a, b) => a + b, 0);
|
|
252
|
-
if (totalMarkers > 0) {
|
|
253
|
-
console.log(` ⚠️ TODO/FIXME markers: ${totalMarkers}`);
|
|
254
|
-
Object.entries(results.summary.markers).forEach(([type, count]) => {
|
|
255
|
-
console.log(` ${type.toUpperCase()}: ${count}`);
|
|
256
|
-
});
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
if (results.summary.placeholders > 0) {
|
|
260
|
-
console.log(` ⚠️ Placeholder text: ${results.summary.placeholders}`);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
console.log('');
|
|
264
|
-
|
|
265
|
-
// Exit code: 1 if critical issues found, 0 otherwise
|
|
266
|
-
return critical.length > 0 ? 1 : 0;
|
|
267
|
-
}
|
|
268
|
-
|
|
269
|
-
/**
|
|
270
|
-
* Main
|
|
271
|
-
*/
|
|
272
|
-
function main() {
|
|
273
|
-
const targetPath = process.argv[2] || '.';
|
|
274
|
-
|
|
275
|
-
if (!fs.existsSync(targetPath)) {
|
|
276
|
-
console.error(`Error: Path not found: ${targetPath}`);
|
|
277
|
-
process.exit(1);
|
|
278
|
-
}
|
|
279
|
-
|
|
280
|
-
console.log(`Scanning: ${targetPath}\n`);
|
|
281
|
-
|
|
282
|
-
const stat = fs.statSync(targetPath);
|
|
283
|
-
if (stat.isDirectory()) {
|
|
284
|
-
scanDirectory(targetPath);
|
|
285
|
-
} else {
|
|
286
|
-
scanFile(targetPath);
|
|
287
|
-
}
|
|
288
|
-
|
|
289
|
-
const exitCode = generateReport();
|
|
290
|
-
process.exit(exitCode);
|
|
291
|
-
}
|
|
292
|
-
|
|
293
|
-
main();
|
|
@@ -1,267 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* TODO/FIXME Marker Detection
|
|
5
|
-
*
|
|
6
|
-
* Scans markdown files for incomplete work markers:
|
|
7
|
-
* - TODO, FIXME, XXX, HACK, TBD, WIP
|
|
8
|
-
* - "Coming soon", placeholder text
|
|
9
|
-
* - Git merge conflict markers
|
|
10
|
-
*
|
|
11
|
-
* Usage:
|
|
12
|
-
* node detect-todos.js [path]
|
|
13
|
-
* (defaults to .genie/ if no path provided)
|
|
14
|
-
*/
|
|
15
|
-
|
|
16
|
-
const fs = require('fs');
|
|
17
|
-
const path = require('path');
|
|
18
|
-
|
|
19
|
-
// Marker patterns (case-insensitive)
|
|
20
|
-
const MARKERS = {
|
|
21
|
-
todo: /\bTODO:?/i,
|
|
22
|
-
fixme: /\bFIXME:?/i,
|
|
23
|
-
xxx: /\bXXX:?/i,
|
|
24
|
-
hack: /\bHACK:?/i,
|
|
25
|
-
tbd: /\bTBD:?/i,
|
|
26
|
-
wip: /\bWIP:?/i,
|
|
27
|
-
};
|
|
28
|
-
|
|
29
|
-
const PLACEHOLDER_PATTERNS = [
|
|
30
|
-
/\bcoming soon\b/i,
|
|
31
|
-
/\bto be documented\b/i,
|
|
32
|
-
/\bfill this in later\b/i,
|
|
33
|
-
/\[placeholder\]/i,
|
|
34
|
-
/\blorem ipsum\b/i,
|
|
35
|
-
/\bTODO:\s*write this section\b/i,
|
|
36
|
-
];
|
|
37
|
-
|
|
38
|
-
const CONFLICT_MARKERS = [
|
|
39
|
-
/^<<<<<<< /m,
|
|
40
|
-
/^=======$/m,
|
|
41
|
-
/^>>>>>>> /m,
|
|
42
|
-
/^\|\|\|\|\|\|\| /m,
|
|
43
|
-
];
|
|
44
|
-
|
|
45
|
-
// Results tracking
|
|
46
|
-
const results = {
|
|
47
|
-
totalFiles: 0,
|
|
48
|
-
scannedFiles: 0,
|
|
49
|
-
issues: [],
|
|
50
|
-
skipped: [],
|
|
51
|
-
};
|
|
52
|
-
|
|
53
|
-
/**
|
|
54
|
-
* Check if file should be scanned
|
|
55
|
-
*/
|
|
56
|
-
function shouldScan(filePath) {
|
|
57
|
-
const excludePatterns = [
|
|
58
|
-
'node_modules',
|
|
59
|
-
'.git',
|
|
60
|
-
'dist',
|
|
61
|
-
'build',
|
|
62
|
-
'coverage',
|
|
63
|
-
'/backups/',
|
|
64
|
-
'detect-todos.js', // Don't scan self
|
|
65
|
-
'GARBAGE-DETECTION-IDEAS.md', // Ideas doc has intentional TODOs
|
|
66
|
-
];
|
|
67
|
-
|
|
68
|
-
return !excludePatterns.some(pattern => filePath.includes(pattern));
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
/**
|
|
72
|
-
* Check if line is inside code block
|
|
73
|
-
*/
|
|
74
|
-
function isInCodeBlock(lines, lineIndex) {
|
|
75
|
-
let inCodeBlock = false;
|
|
76
|
-
for (let i = 0; i < lineIndex; i++) {
|
|
77
|
-
if (lines[i].trim().startsWith('```')) {
|
|
78
|
-
inCodeBlock = !inCodeBlock;
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
return inCodeBlock;
|
|
82
|
-
}
|
|
83
|
-
|
|
84
|
-
/**
|
|
85
|
-
* Scan file for markers
|
|
86
|
-
*/
|
|
87
|
-
function scanFile(filePath) {
|
|
88
|
-
results.totalFiles++;
|
|
89
|
-
|
|
90
|
-
if (!shouldScan(filePath)) {
|
|
91
|
-
results.skipped.push({ file: filePath, reason: 'Excluded path' });
|
|
92
|
-
return;
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
try {
|
|
96
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
97
|
-
const lines = content.split('\n');
|
|
98
|
-
|
|
99
|
-
results.scannedFiles++;
|
|
100
|
-
|
|
101
|
-
lines.forEach((line, index) => {
|
|
102
|
-
const lineNum = index + 1;
|
|
103
|
-
const inCodeBlock = isInCodeBlock(lines, index);
|
|
104
|
-
|
|
105
|
-
// Skip code blocks for markers (but not conflict markers)
|
|
106
|
-
if (!inCodeBlock) {
|
|
107
|
-
// Check TODO/FIXME/etc markers
|
|
108
|
-
for (const [type, pattern] of Object.entries(MARKERS)) {
|
|
109
|
-
if (pattern.test(line)) {
|
|
110
|
-
results.issues.push({
|
|
111
|
-
file: filePath,
|
|
112
|
-
line: lineNum,
|
|
113
|
-
type: `marker_${type}`,
|
|
114
|
-
severity: 'warning',
|
|
115
|
-
content: line.trim(),
|
|
116
|
-
message: `${type.toUpperCase()} marker found`,
|
|
117
|
-
suggestion: 'Complete the work or remove the marker',
|
|
118
|
-
});
|
|
119
|
-
}
|
|
120
|
-
}
|
|
121
|
-
|
|
122
|
-
// Check placeholder patterns
|
|
123
|
-
for (const pattern of PLACEHOLDER_PATTERNS) {
|
|
124
|
-
if (pattern.test(line)) {
|
|
125
|
-
results.issues.push({
|
|
126
|
-
file: filePath,
|
|
127
|
-
line: lineNum,
|
|
128
|
-
type: 'placeholder_text',
|
|
129
|
-
severity: 'warning',
|
|
130
|
-
content: line.trim(),
|
|
131
|
-
message: 'Placeholder text found',
|
|
132
|
-
suggestion: 'Complete the content or remove the placeholder',
|
|
133
|
-
});
|
|
134
|
-
break; // Only report first match per line
|
|
135
|
-
}
|
|
136
|
-
}
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
// Check conflict markers (even in code blocks)
|
|
140
|
-
for (const pattern of CONFLICT_MARKERS) {
|
|
141
|
-
if (pattern.test(line)) {
|
|
142
|
-
results.issues.push({
|
|
143
|
-
file: filePath,
|
|
144
|
-
line: lineNum,
|
|
145
|
-
type: 'merge_conflict',
|
|
146
|
-
severity: 'error',
|
|
147
|
-
content: line.trim(),
|
|
148
|
-
message: 'Git merge conflict marker found',
|
|
149
|
-
suggestion: 'Resolve the conflict immediately',
|
|
150
|
-
});
|
|
151
|
-
break;
|
|
152
|
-
}
|
|
153
|
-
}
|
|
154
|
-
});
|
|
155
|
-
|
|
156
|
-
} catch (err) {
|
|
157
|
-
results.issues.push({
|
|
158
|
-
file: filePath,
|
|
159
|
-
type: 'read_error',
|
|
160
|
-
message: `Failed to read file: ${err.message}`,
|
|
161
|
-
severity: 'error',
|
|
162
|
-
});
|
|
163
|
-
}
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
/**
|
|
167
|
-
* Recursively scan directory
|
|
168
|
-
*/
|
|
169
|
-
function scanDirectory(dir) {
|
|
170
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
171
|
-
|
|
172
|
-
for (const entry of entries) {
|
|
173
|
-
const fullPath = path.join(dir, entry.name);
|
|
174
|
-
|
|
175
|
-
if (entry.isDirectory()) {
|
|
176
|
-
scanDirectory(fullPath);
|
|
177
|
-
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
178
|
-
scanFile(fullPath);
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* Generate report
|
|
185
|
-
*/
|
|
186
|
-
function generateReport() {
|
|
187
|
-
console.log('\n=== TODO/FIXME Detection Report ===\n');
|
|
188
|
-
|
|
189
|
-
console.log(`Total files: ${results.totalFiles}`);
|
|
190
|
-
console.log(`Scanned: ${results.scannedFiles}`);
|
|
191
|
-
console.log(`Issues found: ${results.issues.length}`);
|
|
192
|
-
console.log(`Skipped: ${results.skipped.length}\n`);
|
|
193
|
-
|
|
194
|
-
if (results.issues.length === 0) {
|
|
195
|
-
console.log('✅ No TODO/FIXME markers found!\n');
|
|
196
|
-
return 0;
|
|
197
|
-
}
|
|
198
|
-
|
|
199
|
-
// Group by severity
|
|
200
|
-
const errors = results.issues.filter(i => i.severity === 'error');
|
|
201
|
-
const warnings = results.issues.filter(i => i.severity === 'warning');
|
|
202
|
-
|
|
203
|
-
if (errors.length > 0) {
|
|
204
|
-
console.log(`🔴 ERRORS (${errors.length}):\n`);
|
|
205
|
-
errors.forEach(issue => {
|
|
206
|
-
console.log(` ${issue.file}:${issue.line || '?'}`);
|
|
207
|
-
console.log(` Type: ${issue.type}`);
|
|
208
|
-
console.log(` Message: ${issue.message}`);
|
|
209
|
-
console.log(` Content: ${issue.content}`);
|
|
210
|
-
console.log(` Suggestion: ${issue.suggestion}`);
|
|
211
|
-
console.log('');
|
|
212
|
-
});
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
if (warnings.length > 0) {
|
|
216
|
-
console.log(`⚠️ WARNINGS (${warnings.length}):\n`);
|
|
217
|
-
warnings.forEach(issue => {
|
|
218
|
-
console.log(` ${issue.file}:${issue.line || '?'}`);
|
|
219
|
-
console.log(` Type: ${issue.type}`);
|
|
220
|
-
console.log(` Content: ${issue.content}`);
|
|
221
|
-
console.log('');
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
// Summary by type
|
|
226
|
-
console.log('\n=== Summary by Type ===\n');
|
|
227
|
-
const byType = {};
|
|
228
|
-
results.issues.forEach(issue => {
|
|
229
|
-
byType[issue.type] = (byType[issue.type] || 0) + 1;
|
|
230
|
-
});
|
|
231
|
-
|
|
232
|
-
Object.entries(byType).forEach(([type, count]) => {
|
|
233
|
-
console.log(` ${type}: ${count}`);
|
|
234
|
-
});
|
|
235
|
-
|
|
236
|
-
console.log('');
|
|
237
|
-
return errors.length > 0 ? 1 : 0;
|
|
238
|
-
}
|
|
239
|
-
|
|
240
|
-
/**
|
|
241
|
-
* Main
|
|
242
|
-
*/
|
|
243
|
-
function main() {
|
|
244
|
-
const targetPath = process.argv[2] || '.genie';
|
|
245
|
-
|
|
246
|
-
if (!fs.existsSync(targetPath)) {
|
|
247
|
-
console.error(`Error: Path not found: ${targetPath}`);
|
|
248
|
-
process.exit(1);
|
|
249
|
-
}
|
|
250
|
-
|
|
251
|
-
console.log(`Scanning: ${targetPath}\n`);
|
|
252
|
-
|
|
253
|
-
const stat = fs.statSync(targetPath);
|
|
254
|
-
if (stat.isDirectory()) {
|
|
255
|
-
scanDirectory(targetPath);
|
|
256
|
-
} else if (targetPath.endsWith('.md')) {
|
|
257
|
-
scanFile(targetPath);
|
|
258
|
-
} else {
|
|
259
|
-
console.error('Error: Target must be a directory or .md file');
|
|
260
|
-
process.exit(1);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
const exitCode = generateReport();
|
|
264
|
-
process.exit(exitCode);
|
|
265
|
-
}
|
|
266
|
-
|
|
267
|
-
main();
|
|
@@ -1,135 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env node
|
|
2
|
-
|
|
3
|
-
/**
|
|
4
|
-
* Detect Unlabeled Code Blocks Helper
|
|
5
|
-
*
|
|
6
|
-
* Find fenced code blocks without language identifiers.
|
|
7
|
-
* Detects ``` without language specification (should be ```bash, ```typescript, etc.)
|
|
8
|
-
*
|
|
9
|
-
* Usage:
|
|
10
|
-
* node detect-unlabeled-blocks.js <file-path> # Check single file
|
|
11
|
-
* node detect-unlabeled-blocks.js <directory> # Check all .md files recursively
|
|
12
|
-
*
|
|
13
|
-
* Output:
|
|
14
|
-
* <file>:<line>: Unlabeled code block (missing language identifier)
|
|
15
|
-
*/
|
|
16
|
-
|
|
17
|
-
const fs = require('fs');
|
|
18
|
-
const path = require('path');
|
|
19
|
-
|
|
20
|
-
/**
|
|
21
|
-
* Detect unlabeled code blocks in file content
|
|
22
|
-
* Returns: [{ line, content }]
|
|
23
|
-
*/
|
|
24
|
-
function detectUnlabeledBlocks(content) {
|
|
25
|
-
const lines = content.split('\n');
|
|
26
|
-
const issues = [];
|
|
27
|
-
|
|
28
|
-
lines.forEach((line, idx) => {
|
|
29
|
-
// Match ``` at start of line with optional whitespace
|
|
30
|
-
// But NOT ```language or ``` followed by text on same line
|
|
31
|
-
if (/^```\s*$/.test(line.trim())) {
|
|
32
|
-
issues.push({
|
|
33
|
-
line: idx + 1,
|
|
34
|
-
content: line.trim(),
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
});
|
|
38
|
-
|
|
39
|
-
return issues;
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
/**
|
|
43
|
-
* Check single file
|
|
44
|
-
*/
|
|
45
|
-
function checkFile(filePath) {
|
|
46
|
-
try {
|
|
47
|
-
const content = fs.readFileSync(filePath, 'utf-8');
|
|
48
|
-
const issues = detectUnlabeledBlocks(content);
|
|
49
|
-
|
|
50
|
-
return issues.map(issue => ({
|
|
51
|
-
file: filePath,
|
|
52
|
-
line: issue.line,
|
|
53
|
-
content: issue.content,
|
|
54
|
-
}));
|
|
55
|
-
} catch (err) {
|
|
56
|
-
return [{ file: filePath, error: `Failed to read file: ${err.message}` }];
|
|
57
|
-
}
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
/**
|
|
61
|
-
* Check all .md files in directory
|
|
62
|
-
*/
|
|
63
|
-
function checkDirectory(dirPath) {
|
|
64
|
-
const allIssues = [];
|
|
65
|
-
|
|
66
|
-
function scanDir(dir) {
|
|
67
|
-
const entries = fs.readdirSync(dir, { withFileTypes: true });
|
|
68
|
-
|
|
69
|
-
entries.forEach(entry => {
|
|
70
|
-
const fullPath = path.join(dir, entry.name);
|
|
71
|
-
|
|
72
|
-
if (entry.isDirectory() && !entry.name.startsWith('.')) {
|
|
73
|
-
scanDir(fullPath);
|
|
74
|
-
} else if (entry.isFile() && entry.name.endsWith('.md')) {
|
|
75
|
-
const issues = checkFile(fullPath);
|
|
76
|
-
allIssues.push(...issues);
|
|
77
|
-
}
|
|
78
|
-
});
|
|
79
|
-
}
|
|
80
|
-
|
|
81
|
-
scanDir(dirPath);
|
|
82
|
-
return allIssues;
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
/**
|
|
86
|
-
* Main
|
|
87
|
-
*/
|
|
88
|
-
function main() {
|
|
89
|
-
const args = process.argv.slice(2);
|
|
90
|
-
|
|
91
|
-
if (args.length === 0) {
|
|
92
|
-
console.error(`
|
|
93
|
-
Usage:
|
|
94
|
-
node detect-unlabeled-blocks.js <file-path> # Check single file
|
|
95
|
-
node detect-unlabeled-blocks.js <directory> # Check all .md files recursively
|
|
96
|
-
|
|
97
|
-
Output:
|
|
98
|
-
<file>:<line>: Unlabeled code block (missing language identifier)
|
|
99
|
-
|
|
100
|
-
Exit code:
|
|
101
|
-
0 = All code blocks labeled
|
|
102
|
-
1 = Unlabeled blocks found
|
|
103
|
-
`);
|
|
104
|
-
process.exit(1);
|
|
105
|
-
}
|
|
106
|
-
|
|
107
|
-
const target = args[0];
|
|
108
|
-
|
|
109
|
-
if (!fs.existsSync(target)) {
|
|
110
|
-
console.error(`Error: Path not found: ${target}`);
|
|
111
|
-
process.exit(1);
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
const stat = fs.statSync(target);
|
|
115
|
-
const issues = stat.isDirectory()
|
|
116
|
-
? checkDirectory(target)
|
|
117
|
-
: checkFile(target);
|
|
118
|
-
|
|
119
|
-
if (issues.length === 0) {
|
|
120
|
-
console.log('All code blocks properly labeled');
|
|
121
|
-
process.exit(0);
|
|
122
|
-
}
|
|
123
|
-
|
|
124
|
-
issues.forEach(issue => {
|
|
125
|
-
if (issue.line) {
|
|
126
|
-
console.log(`${issue.file}:${issue.line}: Unlabeled code block (missing language identifier)`);
|
|
127
|
-
} else {
|
|
128
|
-
console.log(`${issue.file}: ${issue.error}`);
|
|
129
|
-
}
|
|
130
|
-
});
|
|
131
|
-
|
|
132
|
-
process.exit(1);
|
|
133
|
-
}
|
|
134
|
-
|
|
135
|
-
main();
|