feat(daily): add daily note creation workflow and documentation
Add comprehensive daily note system with multiple creation methods: - Add daily-note.js script for CLI-based daily note creation - Add daily-note npm command to package.json - Create DAILY_NOTE_GUIDE.md with complete workflow documentation - Three creation methods: CLI, Templater, QuickAdd - Step-by-step usage instructions - Recommended daily workflows - Troubleshooting guide Add new reference documentation: - GIT_WORKFLOW.md: Git workflow best practices - PARA_METHOD.md: PARA method explanation - TROUBLESHOOTING.md: Extended troubleshooting guide - AGENTS.md: Agent coding guidelines and commands - QUICK_REFERENCE.md: 1-page quick reference card - REFACTOR_SUMMARY.md: Refactoring summary Organize reference docs: - Move Templater guides to 06_Metadata/Reference/ - Move Obsidian plugins manual to 06_Metadata/Reference/
This commit is contained in:
@@ -0,0 +1,47 @@
|
||||
#!/usr/bin/env node
|
||||
|
||||
import fs from 'node:fs'
|
||||
import path from 'node:path'
|
||||
|
||||
const args = process.argv.slice(2)
|
||||
const topic = args[0] || ''
|
||||
|
||||
// Get current date
|
||||
const date = new Date()
|
||||
const dateStr = date.toISOString().split('T')[0] // YYYY-MM-DD
|
||||
const dayName = date.toLocaleDateString('zh-CN', { weekday: 'long' })
|
||||
|
||||
// File name
|
||||
const filename = topic ? `${dateStr} - ${topic}.md` : `${dateStr}.md`
|
||||
|
||||
// Check if file exists
|
||||
if (fs.existsSync(filename)) {
|
||||
console.log(`❌ File already exists: ${filename}`)
|
||||
console.log('Opening existing file...')
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Template path
|
||||
const templatePath = path.join(
|
||||
'06_Metadata',
|
||||
'Templates',
|
||||
'Daily Note Template.md',
|
||||
)
|
||||
if (!fs.existsSync(templatePath)) {
|
||||
console.log(`❌ Template not found: ${templatePath}`)
|
||||
process.exit(1)
|
||||
}
|
||||
|
||||
// Read template
|
||||
const template = fs.readFileSync(templatePath, 'utf-8')
|
||||
|
||||
// Replace template variables
|
||||
let content = template
|
||||
.replace(/\{\{date:YYYY-MM-DD\}\}/g, dateStr)
|
||||
.replace(/<!-- .*? -->/g, '')
|
||||
|
||||
// Write to file
|
||||
fs.writeFileSync(filename, content, 'utf-8')
|
||||
|
||||
console.log(`✅ Created daily note: ${filename}`)
|
||||
console.log(`📝 Location: ${path.join(process.cwd(), filename)}`)
|
||||
Reference in New Issue
Block a user