refactor(lint): Improve link parsing and date command compatibility
This commit is contained in:
parent
3a2d69619c
commit
b55084acc4
1 changed files with 5 additions and 2 deletions
|
|
@ -6,6 +6,9 @@
|
||||||
|
|
||||||
# Valid values for the 'type' frontmatter field.
|
# Valid values for the 'type' frontmatter field.
|
||||||
# Must stay in sync with the type list in templates/agents-genome.md.
|
# Must stay in sync with the type list in templates/agents-genome.md.
|
||||||
|
# Note: 'index' and 'log' are wiki-level singleton files (wiki/index.md, wiki/log.md).
|
||||||
|
# 'conflict' has no dedicated scaffold directory — it is a cross-cutting type
|
||||||
|
# that can live under any wiki/ subdirectory.
|
||||||
VALID_TYPES=("source" "entity" "concept" "query" "conflict" "private" "index" "log")
|
VALID_TYPES=("source" "entity" "concept" "query" "conflict" "private" "index" "log")
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
# ---------------------------------------------------------------------------
|
||||||
|
|
@ -121,7 +124,7 @@ check_knowledge_decay() {
|
||||||
|
|
||||||
# Parse date — handle both GNU date (Linux) and BSD date (macOS)
|
# Parse date — handle both GNU date (Linux) and BSD date (macOS)
|
||||||
local updated_ts
|
local updated_ts
|
||||||
if date --version &>/dev/null 2>&1; then
|
if date --version >/dev/null 2>&1; then
|
||||||
# GNU date
|
# GNU date
|
||||||
updated_ts=$(date -d "$last_updated" +%s 2>/dev/null)
|
updated_ts=$(date -d "$last_updated" +%s 2>/dev/null)
|
||||||
else
|
else
|
||||||
|
|
@ -161,7 +164,7 @@ check_broken_links() {
|
||||||
|
|
||||||
# Extract link targets, stripping aliases: [[Link|Alias]] -> Link
|
# Extract link targets, stripping aliases: [[Link|Alias]] -> Link
|
||||||
local links
|
local links
|
||||||
links=$(grep -oP '\[\[\K[^\]]+' "$file" 2>/dev/null | cut -d'|' -f1)
|
links=$(grep -oE '\[\[[^\]]+' "$file" 2>/dev/null | sed 's/^\[\[//' | cut -d'|' -f1)
|
||||||
|
|
||||||
for link in $links; do
|
for link in $links; do
|
||||||
local target="$link"
|
local target="$link"
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue