oneie 3.6.17 โ 3.6.20
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/.claude/agents/agent-ops.md +63 -2
- package/.claude/commands/commit.md +95 -0
- package/.claude/commands/npx.md +2 -2
- package/.claude/commands/one.md +7 -1
- package/.claude/commands/push.md +113 -21
- package/.claude/commands/release.md +2 -2
- package/.claude/hooks/release-cli.sh +195 -0
- package/CLAUDE.md +119 -0
- package/README.md +778 -497
- package/package.json +1 -1
- package/.claude/agents/NEWS-QUICKSTART.md +0 -321
- package/.claude/agents/NEWS-README.md +0 -353
- package/.claude/hooks/README-knowledge-hooks.md +0 -451
- package/.claude/hooks/README-root-cleanup.md +0 -200
- package/.claude/hooks/README.md +0 -284
- package/.claude/hooks/__pycache__/done.cpython-313.pyc +0 -0
- package/.claude/hooks/__pycache__/todo.cpython-313.pyc +0 -0
- package/.claude/hooks/check-filenames.py +0 -177
- package/.claude/hooks/clean-post.py +0 -468
- package/.claude/hooks/clean-pre.py +0 -393
- package/.claude/hooks/clean-root-markdown.sh +0 -73
- package/.claude/hooks/done.py +0 -236
- package/.claude/hooks/format-hook.sh +0 -163
- package/.claude/hooks/hook-logger.sh +0 -173
- package/.claude/hooks/knowledge-post.py +0 -355
- package/.claude/hooks/knowledge-pre.py +0 -245
- package/.claude/hooks/notification-hook.sh +0 -279
- package/.claude/hooks/root-cleanup.py +0 -217
- package/.claude/hooks/security-hook.sh +0 -397
- package/.claude/hooks/tag-all-docs.py +0 -464
- package/.claude/hooks/test-validate-ontology.sh +0 -170
- package/.claude/hooks/todo.py +0 -368
- package/.claude/hooks/track-changes.sh +0 -101
- package/.claude/hooks/validate-ontology-structure-summary.md +0 -243
- package/.claude/hooks/validate-ontology-structure.py +0 -518
- package/TESTING-ONBOARDING.md +0 -185
|
@@ -1,279 +0,0 @@
|
|
|
1
|
-
#!/bin/bash
|
|
2
|
-
|
|
3
|
-
# Notification Hook - ONE Platform
|
|
4
|
-
# Sends development notifications via console, system, or file
|
|
5
|
-
# Aligned with 6-dimension ontology
|
|
6
|
-
#
|
|
7
|
-
# DIMENSION MAPPING (by inference range):
|
|
8
|
-
# Infer 1-10: ๐๏ธ Foundation & Setup
|
|
9
|
-
# Infer 11-20: ๐ฆ Backend Schema (things)
|
|
10
|
-
# Infer 21-30: ๐จ Frontend UI (things)
|
|
11
|
-
# Infer 31-40: ๐ Integration (connections)
|
|
12
|
-
# Infer 41-50: ๐ค Auth & Authorization (people)
|
|
13
|
-
# Infer 51-60: ๐ง Knowledge & RAG (knowledge)
|
|
14
|
-
# Infer 61-70: โ
Quality & Testing (events)
|
|
15
|
-
# Infer 71-80: ๐ญ Design & Wireframes (things)
|
|
16
|
-
# Infer 81-90: โก Performance (events)
|
|
17
|
-
# Infer 91-100: ๐ Deployment (groups)
|
|
18
|
-
#
|
|
19
|
-
# ONTOLOGY DIMENSIONS:
|
|
20
|
-
# - groups: Multi-tenant containers (friend circles โ governments)
|
|
21
|
-
# - people: Authorization & governance (4 roles)
|
|
22
|
-
# - things: All entities (66+ types)
|
|
23
|
-
# - connections: All relationships (25+ types)
|
|
24
|
-
# - events: All actions & state changes (67+ types)
|
|
25
|
-
# - knowledge: Labels, embeddings, RAG
|
|
26
|
-
|
|
27
|
-
set -e
|
|
28
|
-
|
|
29
|
-
# Source the logger
|
|
30
|
-
source "$CLAUDE_PROJECT_DIR/.claude/hooks/hook-logger.sh"
|
|
31
|
-
|
|
32
|
-
# Configuration
|
|
33
|
-
EVENT="${1:-}"
|
|
34
|
-
MESSAGE="${2:-}"
|
|
35
|
-
TYPE="${3:-info}" # info, success, warning, error
|
|
36
|
-
CHANNEL="${4:-console}" # console, system, file, all
|
|
37
|
-
|
|
38
|
-
# Log start
|
|
39
|
-
log_message "INFO" "notification-hook: $EVENT ($TYPE) via $CHANNEL"
|
|
40
|
-
START_TIME=$(get_time_ms)
|
|
41
|
-
|
|
42
|
-
# Load inference context if available
|
|
43
|
-
INFERENCE_STATE="$CLAUDE_PROJECT_DIR/.claude/state/inference.json"
|
|
44
|
-
CURRENT_INFERENCE="Unknown"
|
|
45
|
-
FEATURE_NAME="Unknown Feature"
|
|
46
|
-
ORGANIZATION="Unknown Org"
|
|
47
|
-
|
|
48
|
-
if [ -f "$INFERENCE_STATE" ]; then
|
|
49
|
-
if command -v jq &> /dev/null; then
|
|
50
|
-
CURRENT_INFERENCE=$(jq -r '.current_inference // "Unknown"' "$INFERENCE_STATE" 2>/dev/null || echo "Unknown")
|
|
51
|
-
FEATURE_NAME=$(jq -r '.feature_name // "Unknown Feature"' "$INFERENCE_STATE" 2>/dev/null || echo "Unknown Feature")
|
|
52
|
-
ORGANIZATION=$(jq -r '.organization // "Unknown Org"' "$INFERENCE_STATE" 2>/dev/null || echo "Unknown Org")
|
|
53
|
-
fi
|
|
54
|
-
fi
|
|
55
|
-
|
|
56
|
-
# Map inference to dimension and emoji
|
|
57
|
-
get_dimension_info() {
|
|
58
|
-
local inference=$1
|
|
59
|
-
local dimension=""
|
|
60
|
-
local emoji=""
|
|
61
|
-
local phase=""
|
|
62
|
-
|
|
63
|
-
if [ "$inference" = "Unknown" ]; then
|
|
64
|
-
echo "โ|unknown|General"
|
|
65
|
-
return
|
|
66
|
-
fi
|
|
67
|
-
|
|
68
|
-
# Map inference ranges to 6-dimension ontology
|
|
69
|
-
if [ "$inference" -ge 1 ] && [ "$inference" -le 10 ]; then
|
|
70
|
-
dimension="foundation"
|
|
71
|
-
emoji="๐๏ธ"
|
|
72
|
-
phase="Foundation & Setup"
|
|
73
|
-
elif [ "$inference" -ge 11 ] && [ "$inference" -le 20 ]; then
|
|
74
|
-
dimension="things"
|
|
75
|
-
emoji="๐ฆ"
|
|
76
|
-
phase="Backend Schema (things)"
|
|
77
|
-
elif [ "$inference" -ge 21 ] && [ "$inference" -le 30 ]; then
|
|
78
|
-
dimension="things"
|
|
79
|
-
emoji="๐จ"
|
|
80
|
-
phase="Frontend UI (things)"
|
|
81
|
-
elif [ "$inference" -ge 31 ] && [ "$inference" -le 40 ]; then
|
|
82
|
-
dimension="connections"
|
|
83
|
-
emoji="๐"
|
|
84
|
-
phase="Integration (connections)"
|
|
85
|
-
elif [ "$inference" -ge 41 ] && [ "$inference" -le 50 ]; then
|
|
86
|
-
dimension="people"
|
|
87
|
-
emoji="๐ค"
|
|
88
|
-
phase="Auth & Authorization (people)"
|
|
89
|
-
elif [ "$inference" -ge 51 ] && [ "$inference" -le 60 ]; then
|
|
90
|
-
dimension="knowledge"
|
|
91
|
-
emoji="๐ง "
|
|
92
|
-
phase="Knowledge & RAG"
|
|
93
|
-
elif [ "$inference" -ge 61 ] && [ "$inference" -le 70 ]; then
|
|
94
|
-
dimension="events"
|
|
95
|
-
emoji="โ
"
|
|
96
|
-
phase="Quality & Testing (events)"
|
|
97
|
-
elif [ "$inference" -ge 71 ] && [ "$inference" -le 80 ]; then
|
|
98
|
-
dimension="things"
|
|
99
|
-
emoji="๐ญ"
|
|
100
|
-
phase="Design & Wireframes (things)"
|
|
101
|
-
elif [ "$inference" -ge 81 ] && [ "$inference" -le 90 ]; then
|
|
102
|
-
dimension="events"
|
|
103
|
-
emoji="โก"
|
|
104
|
-
phase="Performance (events)"
|
|
105
|
-
elif [ "$inference" -ge 91 ] && [ "$inference" -le 100 ]; then
|
|
106
|
-
dimension="groups"
|
|
107
|
-
emoji="๐"
|
|
108
|
-
phase="Deployment (groups)"
|
|
109
|
-
else
|
|
110
|
-
dimension="unknown"
|
|
111
|
-
emoji="โ"
|
|
112
|
-
phase="Unknown Phase"
|
|
113
|
-
fi
|
|
114
|
-
|
|
115
|
-
echo "$emoji|$dimension|$phase"
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
# Console notification with ontology context
|
|
119
|
-
send_console() {
|
|
120
|
-
local msg="$1"
|
|
121
|
-
local type="$2"
|
|
122
|
-
|
|
123
|
-
# Get dimension info
|
|
124
|
-
local dim_info=$(get_dimension_info "$CURRENT_INFERENCE")
|
|
125
|
-
local dim_emoji=$(echo "$dim_info" | cut -d'|' -f1)
|
|
126
|
-
local dimension=$(echo "$dim_info" | cut -d'|' -f2)
|
|
127
|
-
local phase=$(echo "$dim_info" | cut -d'|' -f3)
|
|
128
|
-
|
|
129
|
-
# Build context line
|
|
130
|
-
local context="[Infer $CURRENT_INFERENCE] $dim_emoji $phase"
|
|
131
|
-
|
|
132
|
-
case "$type" in
|
|
133
|
-
"success") echo "โ
$msg" ;;
|
|
134
|
-
"warning") echo "โ ๏ธ $msg" ;;
|
|
135
|
-
"error") echo "โ $msg" ;;
|
|
136
|
-
*) echo "โน๏ธ $msg" ;;
|
|
137
|
-
esac
|
|
138
|
-
|
|
139
|
-
# Show ontology context
|
|
140
|
-
echo " $context | ๐ข $ORGANIZATION | ๐ฏ $FEATURE_NAME"
|
|
141
|
-
}
|
|
142
|
-
|
|
143
|
-
# System notification (macOS/Linux) with ontology context
|
|
144
|
-
send_system() {
|
|
145
|
-
local title="$1"
|
|
146
|
-
local msg="$2"
|
|
147
|
-
|
|
148
|
-
# Get dimension info
|
|
149
|
-
local dim_info=$(get_dimension_info "$CURRENT_INFERENCE")
|
|
150
|
-
local dim_emoji=$(echo "$dim_info" | cut -d'|' -f1)
|
|
151
|
-
local dimension=$(echo "$dim_info" | cut -d'|' -f2)
|
|
152
|
-
local phase=$(echo "$dim_info" | cut -d'|' -f3)
|
|
153
|
-
|
|
154
|
-
# Build rich notification with context
|
|
155
|
-
local full_title="$dim_emoji ONE: $title"
|
|
156
|
-
local full_msg="$msg
|
|
157
|
-
|
|
158
|
-
Infer $CURRENT_INFERENCE: $phase
|
|
159
|
-
Feature: $FEATURE_NAME
|
|
160
|
-
Org: $ORGANIZATION"
|
|
161
|
-
|
|
162
|
-
if command -v osascript &> /dev/null; then
|
|
163
|
-
# macOS - escape quotes in message
|
|
164
|
-
local escaped_msg=$(echo "$full_msg" | sed 's/"/\\"/g')
|
|
165
|
-
osascript -e "display notification \"$escaped_msg\" with title \"$full_title\"" 2>/dev/null || true
|
|
166
|
-
elif command -v notify-send &> /dev/null; then
|
|
167
|
-
# Linux
|
|
168
|
-
notify-send "$full_title" "$full_msg" 2>/dev/null || true
|
|
169
|
-
else
|
|
170
|
-
# Fallback to console
|
|
171
|
-
send_console "$title: $msg" "info"
|
|
172
|
-
fi
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
# File notification with ontology context
|
|
176
|
-
send_file() {
|
|
177
|
-
local msg="$1"
|
|
178
|
-
local type="$2"
|
|
179
|
-
|
|
180
|
-
# Get dimension info
|
|
181
|
-
local dim_info=$(get_dimension_info "$CURRENT_INFERENCE")
|
|
182
|
-
local dim_emoji=$(echo "$dim_info" | cut -d'|' -f1)
|
|
183
|
-
local dimension=$(echo "$dim_info" | cut -d'|' -f2)
|
|
184
|
-
local phase=$(echo "$dim_info" | cut -d'|' -f3)
|
|
185
|
-
|
|
186
|
-
local notif_file="$CLAUDE_PROJECT_DIR/.claude/notifications.log"
|
|
187
|
-
local timestamp=$(date '+%Y-%m-%d %H:%M:%S')
|
|
188
|
-
|
|
189
|
-
# Log with full ontology context
|
|
190
|
-
echo "[$timestamp] [$type] $msg" >> "$notif_file"
|
|
191
|
-
echo " โ Inference: $CURRENT_INFERENCE | Dimension: $dimension | Phase: $phase" >> "$notif_file"
|
|
192
|
-
echo " โ Feature: $FEATURE_NAME | Organization: $ORGANIZATION" >> "$notif_file"
|
|
193
|
-
}
|
|
194
|
-
|
|
195
|
-
# Notification templates with ontology awareness
|
|
196
|
-
get_template() {
|
|
197
|
-
# Get dimension info for context
|
|
198
|
-
local dim_info=$(get_dimension_info "$CURRENT_INFERENCE")
|
|
199
|
-
local dimension=$(echo "$dim_info" | cut -d'|' -f2)
|
|
200
|
-
|
|
201
|
-
case "$1" in
|
|
202
|
-
# Ontology-specific events
|
|
203
|
-
"thing-created") echo "Created new thing entity in $dimension dimension" ;;
|
|
204
|
-
"connection-added") echo "Added connection relationship" ;;
|
|
205
|
-
"event-logged") echo "Logged event in audit trail" ;;
|
|
206
|
-
"knowledge-indexed") echo "Indexed knowledge for RAG" ;;
|
|
207
|
-
"group-updated") echo "Updated group configuration" ;;
|
|
208
|
-
"person-authorized") echo "Authorized person with role" ;;
|
|
209
|
-
|
|
210
|
-
# Build events
|
|
211
|
-
"build-start") echo "Build process started for $dimension" ;;
|
|
212
|
-
"build-success") echo "Build completed successfully in $dimension" ;;
|
|
213
|
-
"build-failure") echo "Build failed in $dimension phase" ;;
|
|
214
|
-
|
|
215
|
-
# Test events
|
|
216
|
-
"test-success") echo "All tests passed for $dimension" ;;
|
|
217
|
-
"test-failure") echo "Some tests failed in $dimension" ;;
|
|
218
|
-
|
|
219
|
-
# Security events
|
|
220
|
-
"security-warning") echo "Security warning detected in $dimension" ;;
|
|
221
|
-
"security-block") echo "Security block - operation prevented" ;;
|
|
222
|
-
|
|
223
|
-
# Session events
|
|
224
|
-
"session-start") echo "Claude Code session started" ;;
|
|
225
|
-
"session-end") echo "Claude Code session ended" ;;
|
|
226
|
-
|
|
227
|
-
# Inference progress
|
|
228
|
-
"inference-complete") echo "Completed Infer $CURRENT_INFERENCE ($dimension)" ;;
|
|
229
|
-
"inference-start") echo "Starting Infer $CURRENT_INFERENCE ($dimension)" ;;
|
|
230
|
-
|
|
231
|
-
# Agent events
|
|
232
|
-
"agent-invoked") echo "AI agent invoked for $dimension work" ;;
|
|
233
|
-
"agent-completed") echo "AI agent completed $dimension task" ;;
|
|
234
|
-
|
|
235
|
-
# Deployment events
|
|
236
|
-
"deploy-start") echo "Deployment started" ;;
|
|
237
|
-
"deploy-success") echo "Deployment successful" ;;
|
|
238
|
-
"deploy-failure") echo "Deployment failed" ;;
|
|
239
|
-
|
|
240
|
-
# Default
|
|
241
|
-
*) echo "${MESSAGE:-$1}" ;;
|
|
242
|
-
esac
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
EXIT_CODE=0
|
|
246
|
-
NOTIFICATION_MESSAGE=$(get_template "$EVENT")
|
|
247
|
-
|
|
248
|
-
# Send notification
|
|
249
|
-
case "$CHANNEL" in
|
|
250
|
-
"console")
|
|
251
|
-
send_console "$NOTIFICATION_MESSAGE" "$TYPE"
|
|
252
|
-
;;
|
|
253
|
-
"system")
|
|
254
|
-
send_system "$EVENT" "$NOTIFICATION_MESSAGE"
|
|
255
|
-
;;
|
|
256
|
-
"file")
|
|
257
|
-
send_file "$NOTIFICATION_MESSAGE" "$TYPE"
|
|
258
|
-
;;
|
|
259
|
-
"all")
|
|
260
|
-
send_console "$NOTIFICATION_MESSAGE" "$TYPE"
|
|
261
|
-
send_system "$EVENT" "$NOTIFICATION_MESSAGE"
|
|
262
|
-
send_file "$NOTIFICATION_MESSAGE" "$TYPE"
|
|
263
|
-
;;
|
|
264
|
-
*)
|
|
265
|
-
echo "โ Unknown channel: $CHANNEL"
|
|
266
|
-
EXIT_CODE=1
|
|
267
|
-
;;
|
|
268
|
-
esac
|
|
269
|
-
|
|
270
|
-
# Log notification
|
|
271
|
-
if [ $EXIT_CODE -eq 0 ]; then
|
|
272
|
-
log_message "INFO" "Notification sent: $EVENT"
|
|
273
|
-
fi
|
|
274
|
-
|
|
275
|
-
# Log completion
|
|
276
|
-
END_TIME=$(get_time_ms)
|
|
277
|
-
log_hook_execution "notification-hook" "$EVENT $CHANNEL" "$START_TIME" "$END_TIME" "$EXIT_CODE"
|
|
278
|
-
|
|
279
|
-
exit $EXIT_CODE
|
|
@@ -1,217 +0,0 @@
|
|
|
1
|
-
#!/usr/bin/env python3
|
|
2
|
-
"""
|
|
3
|
-
Root Cleanup Hook - 6-Dimension Ontology Aligned
|
|
4
|
-
|
|
5
|
-
Automatically moves misplaced files from root to appropriate /one/<dimension>/ directories.
|
|
6
|
-
Keeps root clean with only essential documentation files.
|
|
7
|
-
|
|
8
|
-
6-Dimension Ontology:
|
|
9
|
-
- groups: Hierarchical containers (organizations, teams, communities)
|
|
10
|
-
- people: Authorization & governance (roles, users, governance)
|
|
11
|
-
- things: Entities (specs, plans, components, agents)
|
|
12
|
-
- connections: Relationships (protocols, workflows, integrations)
|
|
13
|
-
- events: Actions & state changes (deployments, releases, reports)
|
|
14
|
-
- knowledge: Labels & learning (architecture, patterns, rules, guides)
|
|
15
|
-
"""
|
|
16
|
-
import os
|
|
17
|
-
import re
|
|
18
|
-
import shutil
|
|
19
|
-
from pathlib import Path
|
|
20
|
-
from typing import Optional, Tuple
|
|
21
|
-
|
|
22
|
-
# Root directory
|
|
23
|
-
root_dir = Path("/Users/toc/Server/ONE")
|
|
24
|
-
|
|
25
|
-
# Files allowed to stay in root (per CLAUDE.md)
|
|
26
|
-
ALLOWED_ROOT_FILES = {
|
|
27
|
-
"README.md",
|
|
28
|
-
"LICENSE.md",
|
|
29
|
-
"SECURITY.md",
|
|
30
|
-
"CLAUDE.md",
|
|
31
|
-
"AGENTS.md",
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
# Installation/project folders to ignore (not part of ONE platform docs)
|
|
35
|
-
INSTALLATION_FOLDERS = {
|
|
36
|
-
"web", "backend", "apps", "cli", "scripts", "node_modules",
|
|
37
|
-
"docs", "media", "import", ".git", ".claude", ".vscode",
|
|
38
|
-
# Installation-specific folders (examples from codebase)
|
|
39
|
-
"one-inc", "nine-padel", "onei-ie", "one.ie",
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
def classify_file(filename: str, content_preview: str = "") -> Tuple[str, str]:
|
|
44
|
-
"""
|
|
45
|
-
Classify a file to determine which dimension directory it belongs to.
|
|
46
|
-
Returns (dimension, reason).
|
|
47
|
-
"""
|
|
48
|
-
lower = filename.lower()
|
|
49
|
-
|
|
50
|
-
# Groups: Group-specific docs, organization structures
|
|
51
|
-
if any(word in lower for word in ["group", "organization", "org-", "team", "community", "hierarchy"]):
|
|
52
|
-
return ("groups", "Group-related content")
|
|
53
|
-
|
|
54
|
-
# People: Roles, governance, authorization
|
|
55
|
-
if any(word in lower for word in ["role", "user", "people", "governance", "authorization", "auth", "permission"]):
|
|
56
|
-
return ("people", "People/authorization content")
|
|
57
|
-
|
|
58
|
-
# Things: Specifications, plans, components, agents, features
|
|
59
|
-
if any(word in lower for word in [
|
|
60
|
-
"spec", "plan", "component", "agent", "feature",
|
|
61
|
-
"implementation", "design", "blueprint", "architecture-diagram"
|
|
62
|
-
]):
|
|
63
|
-
return ("things", "Thing/entity specification")
|
|
64
|
-
|
|
65
|
-
# Connections: Protocols, workflows, integrations, relationships
|
|
66
|
-
if any(word in lower for word in [
|
|
67
|
-
"protocol", "workflow", "integration", "connection",
|
|
68
|
-
"api", "sync", "communication", "relationship"
|
|
69
|
-
]):
|
|
70
|
-
return ("connections", "Connection/protocol content")
|
|
71
|
-
|
|
72
|
-
# Events: Deployments, releases, reports, audits, summaries
|
|
73
|
-
if any(word in lower for word in [
|
|
74
|
-
"deploy", "release", "report", "audit", "summary",
|
|
75
|
-
"event", "log", "history", "status", "result", "demo", "deliverable"
|
|
76
|
-
]):
|
|
77
|
-
return ("events", "Event/report content")
|
|
78
|
-
|
|
79
|
-
# Knowledge: Architecture, patterns, rules, guides, documentation
|
|
80
|
-
if any(word in lower for word in [
|
|
81
|
-
"guide", "pattern", "rule", "architecture", "knowledge",
|
|
82
|
-
"best-practice", "convention", "standard", "ontology",
|
|
83
|
-
"documentation", "tutorial", "learning"
|
|
84
|
-
]):
|
|
85
|
-
return ("knowledge", "Knowledge/learning content")
|
|
86
|
-
|
|
87
|
-
# Default to events for unclassified files (reports, misc docs)
|
|
88
|
-
return ("events", "General documentation/report")
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
def is_installation_folder(path: Path) -> bool:
|
|
92
|
-
"""Check if a path is within an installation folder."""
|
|
93
|
-
parts = path.parts
|
|
94
|
-
root_parts = root_dir.parts
|
|
95
|
-
|
|
96
|
-
if len(parts) <= len(root_parts):
|
|
97
|
-
return False
|
|
98
|
-
|
|
99
|
-
# Get the immediate subdirectory of root
|
|
100
|
-
subdir = parts[len(root_parts)]
|
|
101
|
-
return subdir in INSTALLATION_FOLDERS
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
def move_file(file_path: Path) -> Optional[Tuple[str, str, str]]:
|
|
105
|
-
"""
|
|
106
|
-
Move a file to the appropriate dimension directory.
|
|
107
|
-
Returns (filename, dimension, reason) if moved, None if skipped.
|
|
108
|
-
"""
|
|
109
|
-
filename = file_path.name
|
|
110
|
-
|
|
111
|
-
# Skip allowed files
|
|
112
|
-
if filename in ALLOWED_ROOT_FILES:
|
|
113
|
-
return None
|
|
114
|
-
|
|
115
|
-
# Read first 500 chars for classification hints
|
|
116
|
-
content_preview = ""
|
|
117
|
-
try:
|
|
118
|
-
if file_path.suffix in [".md", ".txt"]:
|
|
119
|
-
content_preview = file_path.read_text(encoding="utf-8", errors="ignore")[:500]
|
|
120
|
-
except:
|
|
121
|
-
pass
|
|
122
|
-
|
|
123
|
-
# Classify the file
|
|
124
|
-
dimension, reason = classify_file(filename, content_preview)
|
|
125
|
-
|
|
126
|
-
# Create destination directory
|
|
127
|
-
dest_dir = root_dir / "one" / dimension
|
|
128
|
-
dest_dir.mkdir(parents=True, exist_ok=True)
|
|
129
|
-
|
|
130
|
-
# Move file
|
|
131
|
-
try:
|
|
132
|
-
dest = dest_dir / filename
|
|
133
|
-
|
|
134
|
-
# Handle duplicates by appending number
|
|
135
|
-
counter = 1
|
|
136
|
-
while dest.exists():
|
|
137
|
-
stem = file_path.stem
|
|
138
|
-
suffix = file_path.suffix
|
|
139
|
-
dest = dest_dir / f"{stem}_{counter}{suffix}"
|
|
140
|
-
counter += 1
|
|
141
|
-
|
|
142
|
-
shutil.move(str(file_path), str(dest))
|
|
143
|
-
return (filename, dimension, reason)
|
|
144
|
-
except Exception as e:
|
|
145
|
-
print(f"โ Failed to move {filename}: {e}")
|
|
146
|
-
return None
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
def main():
|
|
150
|
-
"""Main cleanup routine."""
|
|
151
|
-
files_moved = []
|
|
152
|
-
files_skipped = []
|
|
153
|
-
|
|
154
|
-
# Process markdown files
|
|
155
|
-
for file_path in root_dir.glob("*.md"):
|
|
156
|
-
result = move_file(file_path)
|
|
157
|
-
if result:
|
|
158
|
-
files_moved.append(result)
|
|
159
|
-
else:
|
|
160
|
-
files_skipped.append(file_path.name)
|
|
161
|
-
|
|
162
|
-
# Process text files (deliverables, notes)
|
|
163
|
-
for file_path in root_dir.glob("*.txt"):
|
|
164
|
-
# Skip git-related files
|
|
165
|
-
if file_path.name in {"package-lock.txt", ".gitignore"}:
|
|
166
|
-
continue
|
|
167
|
-
|
|
168
|
-
result = move_file(file_path)
|
|
169
|
-
if result:
|
|
170
|
-
files_moved.append(result)
|
|
171
|
-
|
|
172
|
-
# Report results
|
|
173
|
-
print("=" * 70)
|
|
174
|
-
print("๐งน ROOT CLEANUP - 6-Dimension Ontology Alignment")
|
|
175
|
-
print("=" * 70)
|
|
176
|
-
print()
|
|
177
|
-
|
|
178
|
-
if files_moved:
|
|
179
|
-
print(f"โ
Moved {len(files_moved)} files to dimension directories:")
|
|
180
|
-
print()
|
|
181
|
-
|
|
182
|
-
# Group by dimension
|
|
183
|
-
by_dimension = {}
|
|
184
|
-
for filename, dimension, reason in files_moved:
|
|
185
|
-
if dimension not in by_dimension:
|
|
186
|
-
by_dimension[dimension] = []
|
|
187
|
-
by_dimension[dimension].append((filename, reason))
|
|
188
|
-
|
|
189
|
-
for dimension in ["groups", "people", "things", "connections", "events", "knowledge"]:
|
|
190
|
-
if dimension in by_dimension:
|
|
191
|
-
files = by_dimension[dimension]
|
|
192
|
-
print(f" ๐ /one/{dimension}/ ({len(files)} files)")
|
|
193
|
-
for filename, reason in files:
|
|
194
|
-
print(f" โข {filename}")
|
|
195
|
-
print(f" โโ {reason}")
|
|
196
|
-
print()
|
|
197
|
-
|
|
198
|
-
if files_skipped:
|
|
199
|
-
print(f"โ
Kept {len(files_skipped)} essential files in root:")
|
|
200
|
-
for f in sorted(files_skipped):
|
|
201
|
-
print(f" โข {f}")
|
|
202
|
-
print()
|
|
203
|
-
|
|
204
|
-
if not files_moved and not files_skipped:
|
|
205
|
-
print("โ
Root is clean - no files to move!")
|
|
206
|
-
print()
|
|
207
|
-
|
|
208
|
-
print("=" * 70)
|
|
209
|
-
print("๐ Approved root files: README.md, LICENSE.md, SECURITY.md,")
|
|
210
|
-
print(" CLAUDE.md, AGENTS.md")
|
|
211
|
-
print()
|
|
212
|
-
print("๐ 6 Dimensions: groups, people, things, connections, events, knowledge")
|
|
213
|
-
print("=" * 70)
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
if __name__ == "__main__":
|
|
217
|
-
main()
|