Skip to content

Commit b08d1a2

Browse files
committed
chore: Remove unused files and update X icon
This commit removes the following unused files: - assets/scss/components/_session-card.scss - layouts/partials/override-social-share.html - assets/scss/social-share.scss - layouts/partials/components/upcoming-wide.html - generate_context.py It also updates the Twitter icon to X icon in data/social.json.
1 parent 71131a7 commit b08d1a2

File tree

8 files changed

+70
-414
lines changed

8 files changed

+70
-414
lines changed

assets/scss/components/_session-card.scss

Lines changed: 0 additions & 45 deletions
This file was deleted.

assets/scss/main.scss

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,6 @@
2020
@import "utilities";
2121
}
2222

23-
@import "social-share";
2423
@import "images";
2524

2625

assets/scss/social-share.scss

Lines changed: 0 additions & 111 deletions
This file was deleted.

data/social.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@
1111
"link": "https://github.com/open-neuromorphic"
1212
},
1313
{
14-
"name": "twitter",
15-
"icon": "fab fa-twitter",
16-
"link": "https://twitter.com/OpenNeuroMorph"
14+
"name": "x-twitter",
15+
"icon": "fab fa-x-twitter",
16+
"link": "https://x.com/OpenNeuroMorph"
1717
},
1818
{
1919
"name": "linkedin",

generate_context.py

Lines changed: 18 additions & 75 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@
1414
# Output files (relative to PROJECT_ROOT, placed in tmp/)
1515
TMP_DIR = PROJECT_ROOT / "tmp"
1616
FULL_OUTPUT_FILE = TMP_DIR / "output_full.txt"
17-
DIFF_OUTPUT_FILE = TMP_DIR / "output_diff.txt"
1817
LAYOUTS_OUTPUT_FILE = TMP_DIR / "output_layouts.txt"
1918

2019
# Files/Directories to EXCLUDE (relative to PROJECT_ROOT)
@@ -42,7 +41,6 @@
4241
"hugo_stats.json",
4342
".hugo_build.lock",
4443
str(FULL_OUTPUT_FILE.name),
45-
str(DIFF_OUTPUT_FILE.name),
4644
str(LAYOUTS_OUTPUT_FILE.name),
4745
"*.pyc",
4846
"*~", # Backup files
@@ -110,18 +108,15 @@ def should_include(filename: str) -> bool:
110108
return True
111109
return False
112110

113-
def find_relevant_files(root: Path, checkpoint_mtime: float | None = None, mode: str = "full", with_public_html: bool = False) -> list[Path]:
111+
def find_relevant_files(root: Path, mode: str = "full", with_public_html: bool = False) -> list[Path]:
114112
"""
115113
Walks the directory tree, applying include/exclude rules.
116-
If checkpoint_mtime is provided, only includes files newer than it.
117114
If mode is "layouts", filters for files within "layouts" directories.
118115
If with_public_html is True and mode is "full", also includes HTML files from ./public.
119116
"""
120117
initial_candidates = set() # Use a set to handle potential overlaps gracefully
121118

122119
log(f"Scanning directory: {root} for mode '{mode}' (main scan)")
123-
if checkpoint_mtime:
124-
log(f"Filtering for files newer than: {datetime.fromtimestamp(checkpoint_mtime)}")
125120

126121
for current_dir_str, dir_names, file_names in os.walk(root, topdown=True):
127122
current_path = Path(current_dir_str)
@@ -138,13 +133,6 @@ def find_relevant_files(root: Path, checkpoint_mtime: float | None = None, mode:
138133
if not should_include(filename):
139134
continue
140135

141-
if checkpoint_mtime:
142-
try:
143-
if file_path.stat().st_mtime <= checkpoint_mtime:
144-
continue
145-
except OSError as e:
146-
log(f"Warning: Could not stat file {file_path}: {e}. Skipping.")
147-
continue
148136
initial_candidates.add(file_path.resolve()) # Store absolute paths
149137

150138
log(f"Found {len(initial_candidates)} candidate files from main scan.")
@@ -158,15 +146,6 @@ def find_relevant_files(root: Path, checkpoint_mtime: float | None = None, mode:
158146
for item in public_dir.rglob('*.html'): # rglob for recursive search
159147
if item.is_file():
160148
public_file_path = item.resolve() # Ensure absolute path
161-
# Apply mtime filter for public HTML files too, if diff mode were to use this
162-
if checkpoint_mtime:
163-
try:
164-
if public_file_path.stat().st_mtime <= checkpoint_mtime:
165-
continue
166-
except OSError as e:
167-
log(f"Warning: Could not stat file {public_file_path}: {e}. Skipping.")
168-
continue
169-
170149
if public_file_path not in initial_candidates: # Add if not already picked up
171150
initial_candidates.add(public_file_path)
172151
public_html_added_count +=1
@@ -194,7 +173,7 @@ def find_relevant_files(root: Path, checkpoint_mtime: float | None = None, mode:
194173
return final_relevant_files_list
195174

196175

197-
def generate_header(mode: str, checkpoint_file: Path | None = None, with_public_html: bool = False) -> str:
176+
def generate_header(mode: str, with_public_html: bool = False) -> str:
198177
"""Generates the header content for the output file."""
199178
common_instructions = """
200179
**Instructions for AI:**
@@ -209,23 +188,7 @@ def generate_header(mode: str, checkpoint_file: Path | None = None, with_public_
209188
9. Format code changes in a way that is most simple for an LLM (gemini, copilot) to integrate - this could be one single code block. It is not necessary to provide human instructions that highlight the specific lines being updated.
210189
10. indicate which file it is to be updated, outside of the file codeblock
211190
"""
212-
if mode == "diff":
213-
checkpoint_ts_str = "ERROR: Checkpoint file missing!"
214-
if checkpoint_file and checkpoint_file.exists():
215-
checkpoint_mtime = checkpoint_file.stat().st_mtime
216-
checkpoint_ts = datetime.fromtimestamp(checkpoint_mtime)
217-
checkpoint_ts_str = checkpoint_ts.strftime('%Y-%m-%d %H:%M:%S %Z')
218-
219-
return f"""--- START OF PROJECT CONTEXT UPDATE ---
220-
221-
This file contains ONLY the content of key files that have been MODIFIED since the last full context checkpoint was generated. Image files are listed by path only.
222-
223-
**Checkpoint File:** {checkpoint_file.relative_to(PROJECT_ROOT) if checkpoint_file else 'N/A'}
224-
**Checkpoint Timestamp:** {checkpoint_ts_str}
225-
{common_instructions.replace("1. Analyze Structure...", "1. **Apply Updates:** Use the content below to update your understanding of the project based on the changes since the checkpoint timestamp. Prioritize this information when it conflicts with previous context from the full checkpoint. Remember this is NOT the full project, only the changed files. Refer back to the full checkpoint if needed for unchanged files or broader structure.")}
226-
--- MODIFIED FILE CONTENTS START ---
227-
"""
228-
elif mode == "layouts":
191+
if mode == "layouts":
229192
return f"""--- START OF PROJECT CONTEXT (Layouts Only) ---
230193
231194
This file contains the content of files found within all 'layouts' directories in the project. Image files are listed by path only.
@@ -252,37 +215,21 @@ def generate_header(mode: str, checkpoint_file: Path | None = None, with_public_
252215

253216
def generate_footer(mode: str) -> str:
254217
"""Generates the footer content."""
255-
if mode == "diff":
256-
return "\n--- END OF PROJECT CONTEXT UPDATE ---"
257-
elif mode == "layouts":
218+
if mode == "layouts":
258219
return "\n--- END OF PROJECT LAYOUTS CONTEXT ---"
259220
else: # mode == "full"
260221
return "\n--- END OF PROJECT CONTEXT ---"
261222

262-
def create_context_file(mode: str, with_public_html: bool):
223+
def generate_context(mode: str, with_public_html: bool):
263224
"""Main function to generate the context file based on the mode."""
264225
log(f"Project Root: {PROJECT_ROOT}")
265-
checkpoint_mtime = None
266226
target_output_file = None
267227

268228
if mode == "full":
269229
target_output_file = FULL_OUTPUT_FILE
270230
log(f"Mode: Generating FULL context checkpoint -> {target_output_file.relative_to(PROJECT_ROOT)}")
271231
if with_public_html:
272232
log("Including HTML files from 'public' directory.")
273-
elif mode == "diff":
274-
target_output_file = DIFF_OUTPUT_FILE
275-
log(f"Mode: Generating DIFF context based on {FULL_OUTPUT_FILE.relative_to(PROJECT_ROOT)} -> {target_output_file.relative_to(PROJECT_ROOT)}")
276-
if not FULL_OUTPUT_FILE.exists():
277-
log(f"Error: Checkpoint file '{FULL_OUTPUT_FILE}' not found. Please run with --full first.")
278-
sys.exit(1)
279-
try:
280-
checkpoint_mtime = FULL_OUTPUT_FILE.stat().st_mtime
281-
except OSError as e:
282-
log(f"Error: Could not read checkpoint file timestamp {FULL_OUTPUT_FILE}: {e}")
283-
sys.exit(1)
284-
if with_public_html:
285-
log("Note: --with-public-html is typically used with --full. For --diff, it will include public HTML files modified since the checkpoint if any.")
286233
elif mode == "layouts":
287234
target_output_file = LAYOUTS_OUTPUT_FILE
288235
log(f"Mode: Generating LAYOUTS context -> {target_output_file.relative_to(PROJECT_ROOT)}")
@@ -298,10 +245,10 @@ def create_context_file(mode: str, with_public_html: bool):
298245
log(f"Error: Could not create output directory {TMP_DIR}: {e}")
299246
sys.exit(1)
300247

301-
files_to_process = find_relevant_files(PROJECT_ROOT, checkpoint_mtime, mode=mode, with_public_html=with_public_html)
248+
files_to_process = find_relevant_files(PROJECT_ROOT, mode=mode, with_public_html=with_public_html)
302249

303250
log(f"Generating context file: {target_output_file.relative_to(PROJECT_ROOT)}")
304-
header = generate_header(mode, FULL_OUTPUT_FILE if mode == "diff" else None, with_public_html if mode == "full" else False)
251+
header = generate_header(mode, with_public_html if mode == "full" else False)
305252
footer = generate_footer(mode)
306253

307254
try:
@@ -344,38 +291,30 @@ def create_context_file(mode: str, with_public_html: bool):
344291
def main():
345292
"""Parses command line arguments and runs the script."""
346293
parser = argparse.ArgumentParser(
347-
description="Generate a context file with project source code for AI analysis.",
294+
description="Generate a context file with project source code for AI analysis. Defaults to '--full' if no mode is specified.",
348295
formatter_class=argparse.RawDescriptionHelpFormatter,
349296
epilog=f"""
350297
Examples:
351-
Generate a full context checkpoint:
298+
Generate a full context checkpoint (default action):
299+
{sys.argv[0]}
352300
{sys.argv[0]} --full
353301
354-
Generate a full context checkpoint and include HTML files from the 'public' directory:
302+
Generate a full context and include HTML files from the 'public' directory:
355303
{sys.argv[0]} --full --with-public-html
356304
357-
Generate a context file with changes since the last full checkpoint:
358-
{sys.argv[0]} --diff
359-
360305
Generate a context file with only content from 'layouts' directories:
361306
{sys.argv[0]} --layouts
362307
"""
363308
)
364-
group = parser.add_mutually_exclusive_group(required=True)
309+
# If no mode flag is given, args.mode will be None, and we'll default to 'full'.
310+
group = parser.add_mutually_exclusive_group(required=False)
365311
group.add_argument(
366312
"-f", "--full",
367313
action="store_const",
368314
const="full",
369315
dest="mode",
370316
help=f"Generate the full project context checkpoint ({FULL_OUTPUT_FILE.relative_to(PROJECT_ROOT)})."
371317
)
372-
group.add_argument(
373-
"-d", "--diff",
374-
action="store_const",
375-
const="diff",
376-
dest="mode",
377-
help=f"Generate context with files modified since the last full checkpoint ({DIFF_OUTPUT_FILE.relative_to(PROJECT_ROOT)})."
378-
)
379318
group.add_argument(
380319
"-l", "--layouts",
381320
action="store_const",
@@ -390,7 +329,11 @@ def main():
390329
)
391330

392331
args = parser.parse_args()
393-
create_context_file(args.mode, args.with_public_html)
332+
333+
# Default to 'full' mode if no other mode is selected
334+
mode = args.mode or "full"
335+
336+
generate_context(mode, args.with_public_html)
394337

395338
if __name__ == "__main__":
396339
main()

0 commit comments

Comments
 (0)