Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
89 changes: 89 additions & 0 deletions src/vault.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
#!/usr/bin/env bash
# Vault Structure & Scaffolding Functions
#
# Implements F01: Vault Structure & Scaffolding
# See requirements/F01-vault-structure.md for specifications.

# Enable strict mode only when executed directly, not when sourced
if [[ "${BASH_SOURCE[0]}" == "${0}" ]]; then
set -euo pipefail
fi

# =============================================================================
# Constants
# =============================================================================

# Expected top-level folders
readonly VAULT_FOLDERS=(
".claude"
"0_Inbox"
"1_Fleeting"
"2_Drafts"
"3_Projects"
"4_Areas"
"5_Resources"
"6_Archive"
"7_Assets"
"8_People"
"9_Meta"
)

# Expected meta files
readonly META_FILES=(
"config.yaml"
"memory.md"
"pending.json"
"state.json"
)

# =============================================================================
# scaffold_vault
# =============================================================================
# Creates the complete vault folder structure at the given path.
# Idempotent: safe to run multiple times without affecting existing files.
#
# Arguments:
# $1 - Path to the vault root directory
#
# Returns:
# 0 on success
# 1 on failure
# =============================================================================
scaffold_vault() {
local vault_path="$1"

# TODO: Implement vault scaffolding
# 1. Create all top-level folders from VAULT_FOLDERS
# 2. Create 6_Archive/Daily-Notes/ subfolder
# 3. Create 9_Meta/prompts/ subfolder
# 4. Create meta files (config.yaml, memory.md, pending.json, state.json)
# 5. Must be idempotent - don't overwrite existing files

echo "scaffold_vault: Not yet implemented" >&2
return 1
}
Comment on lines +52 to +64
Copy link

Copilot AI Feb 1, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scaffold_vault is defined but intentionally returns exit code 1. With the current test suite, this makes all scaffolding tests fail (they only skip when the function is missing). If these functions are meant to be stubs for now, either adjust the tests to skip on the stub state or avoid defining failing stubs until implementation is ready.

Copilot uses AI. Check for mistakes.

# =============================================================================
# validate_vault_structure
# =============================================================================
# Validates that a vault has the correct structure.
#
# Arguments:
# $1 - Path to the vault root directory
#
# Returns:
# 0 if valid, outputs "Vault structure valid"
# 1 if invalid, outputs list of issues
# =============================================================================
validate_vault_structure() {
local vault_path="$1"

# TODO: Implement vault validation
# 1. Check all expected folders exist
# 2. Check folder naming convention (N_Name pattern)
# 3. Check meta files exist
# 4. Report all missing or invalid items

echo "validate_vault_structure: Not yet implemented" >&2
return 1
}
Empty file.
22 changes: 22 additions & 0 deletions tests/fixtures/test-vault-populated/0_Inbox/2025-01-31 Friday.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
---
type: daily
date: 2025-01-31
day_of_week: Friday
status: active
morning_brief_done: false
evening_review_done: false
---

# 2025-01-31 Friday

## Morning Brief


## Captures


## Notes


## Evening Review

10 changes: 10 additions & 0 deletions tests/fixtures/test-vault-populated/1_Fleeting/sample-fleeting.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
type: fleeting
created: 2025-01-31T10:00:00-05:00
source: manual
status: unprocessed
---

# Sample Fleeting Note

This is a sample fleeting note for testing purposes.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
type: project
title: Test Project
status: active
created: 2025-01-15T09:00:00-05:00
area: "[[test-area]]"
---

# Test Project

## Overview

A sample project for testing vault structure.

## Tasks

- [ ] Sample task 1
- [ ] Sample task 2

## Notes

10 changes: 10 additions & 0 deletions tests/fixtures/test-vault-populated/4_Areas/test-area.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
type: area
title: Test Area
status: active
created: 2025-01-01T00:00:00-05:00
---

# Test Area

An area of responsibility for testing purposes.
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
---
type: daily
date: 2025-01-30
day_of_week: Thursday
status: archived
morning_brief_done: true
evening_review_done: true
archived_at: 2025-01-31T06:00:00-05:00
---

# 2025-01-30 Thursday

## Morning Brief

Completed morning brief.

## Captures

- Sample capture from yesterday

## Notes

- Notes from the day

## Evening Review

Day completed and reviewed.
Empty file.
23 changes: 23 additions & 0 deletions tests/fixtures/test-vault-populated/8_People/jane-smith.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
type: person
name: Jane Smith
email: jane.smith@example.com
company: Example Corp
last_contact: 2025-01-28
created: 2025-01-15T00:00:00-05:00
---

# Jane Smith

## Contact Info

- Email: jane.smith@example.com
- Company: Example Corp

## Notes

Met at conference in January 2025.

## Interactions

- 2025-01-28: Email exchange about project collaboration
28 changes: 28 additions & 0 deletions tests/fixtures/test-vault-populated/9_Meta/config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# Digital Cortex Configuration

vault:
name: "Test Vault"
timezone: "America/New_York"
Comment thread
p3ob7o marked this conversation as resolved.

sources:
gmail:
enabled: false
calendar:
enabled: false
slack:
enabled: false
p2:
enabled: false
linear:
enabled: false
reminders:
enabled: false

features:
morning_brief:
enabled: true
auto_run: false
evening_review:
enabled: true
weekly_review:
enabled: true
12 changes: 12 additions & 0 deletions tests/fixtures/test-vault-populated/9_Meta/memory.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Memory

User preferences and learned patterns.

## Preferences

- Preferred working hours: 9am - 5pm
- Focus time preference: mornings

## Patterns

(Learned patterns will be recorded here)
4 changes: 4 additions & 0 deletions tests/fixtures/test-vault-populated/9_Meta/pending.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
{
"version": 1,
"pending_operations": []
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Evening Review Template

Guide the evening review:

1. What was accomplished today?
2. What remains incomplete?
3. Process inbox items
4. Preview tomorrow's calendar
5. Set intentions for tomorrow
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Morning Brief Template

Generate a morning brief with:

1. Today's calendar events
2. Priority tasks
3. Emails needing attention
4. Slack/P2 messages to review
5. Reminders for today
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
# Process Inbox Template

Guide inbox processing:

1. Identify items to process
2. For each item, decide: delete, delegate, defer, do, or file
3. Move processed items to appropriate locations
4. Update any related projects or areas
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# Weekly Review Template

Guide the weekly review:

1. Review the past week
2. Check project statuses
3. Process fleeting notes
4. Review upcoming week
5. Set weekly intentions
14 changes: 14 additions & 0 deletions tests/fixtures/test-vault-populated/9_Meta/state.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
{
"version": 1,
"last_sync": {
"gmail": null,
"calendar": null,
"slack": null,
"p2": null,
"linear": null,
"reminders": null
},
"last_morning_brief": null,
"last_evening_review": null,
"last_weekly_review": null
}
Loading