Greg647465374's picture
shorten the files
41c095f
{
"ast": {
"items": [
{
"use": {
"tree": {
"path": {
"ident": "core",
"tree": {
"ident": "io"
}
}
}
}
},
{
"use": {
"tree": {
"path": {
"ident": "std",
"tree": {
"path": {
"ident": "path",
"tree": {
"ident": "Path"
}
}
}
}
}
}
},
{
"fn": {
"attrs": [
{
"meta": {
"name_value": {
"path": {
"segments": [
{
"ident": "doc"
}
]
},
"value": {
"lit": {
"str": "\" Saves the processed document summary to a JSON file.\""
}
}
}
},
"style": "outer"
}
],
"ident": "save_summary",
"inputs": [
{
"typed": {
"pat": {
"ident": {
"ident": "summary"
}
},
"ty": {
"reference": {
"elem": {
"path": {
"segments": [
{
"ident": "DocumentSummary"
}
]
}
}
}
}
}
},
{
"typed": {
"pat": {
"ident": {
"ident": "output_path"
}
},
"ty": {
"reference": {
"elem": {
"path": {
"segments": [
{
"ident": "Path"
}
]
}
}
}
}
}
}
],
"output": {
"path": {
"segments": [
{
"ident": "io"
},
{
"arguments": {
"angle_bracketed": {
"args": [
{
"type": {
"tuple": {
"elems": []
}
}
}
]
}
},
"ident": "Result"
}
]
}
},
"stmts": [
{
"let": {
"init": {
"expr": {
"try": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "summary"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "serde_json"
},
{
"ident": "to_string_pretty"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "json"
}
}
}
},
{
"expr": [
{
"try": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "output_path"
}
]
}
},
{
"path": {
"segments": [
{
"ident": "json"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "fs"
},
{
"ident": "write"
}
]
}
}
}
}
}
},
true
]
},
{
"expr": [
{
"call": {
"args": [
{
"tuple": {
"elems": []
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Ok"
}
]
}
}
}
},
false
]
}
],
"vis": "pub"
}
},
{
"fn": {
"attrs": [
{
"meta": {
"name_value": {
"path": {
"segments": [
{
"ident": "doc"
}
]
},
"value": {
"lit": {
"str": "\" Main function to process documents from command line\""
}
}
}
},
"style": "outer"
}
],
"ident": "savemain",
"inputs": [],
"output": {
"path": {
"segments": [
{
"ident": "io"
},
{
"arguments": {
"angle_bracketed": {
"args": [
{
"type": {
"tuple": {
"elems": []
}
}
}
]
}
},
"ident": "Result"
}
]
}
},
"stmts": [
{
"let": {
"init": {
"expr": {
"method_call": {
"args": [],
"method": "collect",
"receiver": {
"call": {
"args": [],
"func": {
"path": {
"segments": [
{
"ident": "std"
},
{
"ident": "env"
},
{
"ident": "args"
}
]
}
}
}
}
}
}
},
"pat": {
"type": {
"pat": {
"ident": {
"ident": "args"
}
},
"ty": {
"path": {
"segments": [
{
"arguments": {
"angle_bracketed": {
"args": [
{
"type": {
"path": {
"segments": [
{
"ident": "String"
}
]
}
}
}
]
}
},
"ident": "Vec"
}
]
}
}
}
}
}
},
{
"expr": [
{
"if": {
"cond": {
"binary": {
"left": {
"method_call": {
"args": [],
"method": "len",
"receiver": {
"path": {
"segments": [
{
"ident": "args"
}
]
}
}
}
},
"op": "!=",
"right": {
"lit": {
"int": "3"
}
}
}
},
"then_branch": [
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "eprintln"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\"Usage: {} <input_file> <output_file>\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "args"
},
{
"group": {
"delimiter": "bracket",
"stream": [
{
"lit": "0"
}
]
}
}
]
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "eprintln"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\"Example: {} founding_documents/prelude1-aaa.md output/summary.json\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "args"
},
{
"group": {
"delimiter": "bracket",
"stream": [
{
"lit": "0"
}
]
}
}
]
}
},
{
"expr": [
{
"call": {
"args": [
{
"lit": {
"int": "1"
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "std"
},
{
"ident": "process"
},
{
"ident": "exit"
}
]
}
}
}
},
true
]
}
]
}
},
false
]
},
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"reference": {
"expr": {
"index": {
"expr": {
"path": {
"segments": [
{
"ident": "args"
}
]
}
},
"index": {
"lit": {
"int": "1"
}
}
}
}
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Path"
},
{
"ident": "new"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "input_path"
}
}
}
},
{
"let": {
"init": {
"expr": {
"call": {
"args": [
{
"reference": {
"expr": {
"index": {
"expr": {
"path": {
"segments": [
{
"ident": "args"
}
]
}
},
"index": {
"lit": {
"int": "2"
}
}
}
}
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Path"
},
{
"ident": "new"
}
]
}
}
}
}
},
"pat": {
"ident": {
"ident": "output_path"
}
}
}
},
{
"expr": [
{
"if": {
"cond": {
"unary": {
"expr": {
"method_call": {
"args": [],
"method": "exists",
"receiver": {
"path": {
"segments": [
{
"ident": "input_path"
}
]
}
}
}
},
"op": "!"
}
},
"then_branch": [
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "eprintln"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\"Error: Input file '{}' does not exist\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "args"
},
{
"group": {
"delimiter": "bracket",
"stream": [
{
"lit": "1"
}
]
}
}
]
}
},
{
"expr": [
{
"call": {
"args": [
{
"lit": {
"int": "1"
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "std"
},
{
"ident": "process"
},
{
"ident": "exit"
}
]
}
}
}
},
true
]
}
]
}
},
false
]
},
{
"expr": [
{
"if": {
"cond": {
"let": {
"expr": {
"method_call": {
"args": [],
"method": "parent",
"receiver": {
"path": {
"segments": [
{
"ident": "output_path"
}
]
}
}
}
},
"pat": {
"tuple_struct": {
"elems": [
{
"ident": {
"ident": "parent"
}
}
],
"path": {
"segments": [
{
"ident": "Some"
}
]
}
}
}
}
},
"then_branch": [
{
"expr": [
{
"try": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "parent"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "fs"
},
{
"ident": "create_dir_all"
}
]
}
}
}
}
}
},
true
]
}
]
}
},
false
]
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\"Processing document: {}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "input_path"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "display"
},
{
"group": {
"delimiter": "parenthesis",
"stream": []
}
}
]
}
},
{
"let": {
"init": {
"expr": {
"try": {
"expr": {
"call": {
"args": [
{
"path": {
"segments": [
{
"ident": "input_path"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "process_file"
}
]
}
}
}
}
}
}
},
"pat": {
"ident": {
"ident": "summary"
}
}
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\"Saving summary to: {}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "output_path"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "display"
},
{
"group": {
"delimiter": "parenthesis",
"stream": []
}
}
]
}
},
{
"expr": [
{
"try": {
"expr": {
"call": {
"args": [
{
"reference": {
"expr": {
"path": {
"segments": [
{
"ident": "summary"
}
]
}
}
}
},
{
"path": {
"segments": [
{
"ident": "output_path"
}
]
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "save_summary"
}
]
}
}
}
}
}
},
true
]
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\"Document Summary:\""
}
]
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\" Total turns: {}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "summary"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "total_turns"
}
]
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\" Total code snippets: {}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "summary"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "total_code_snippets"
}
]
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\" Total tokens: {}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "summary"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "total_tokens"
}
]
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\" Languages found: {:?}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "summary"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "languages_found"
}
]
}
},
{
"macro": {
"delimiter": "paren",
"path": {
"segments": [
{
"ident": "println"
}
]
},
"semi_token": true,
"tokens": [
{
"lit": "\" Content hashes: {}\""
},
{
"punct": {
"op": ",",
"spacing": "alone"
}
},
{
"ident": "summary"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "content_hashes"
},
{
"punct": {
"op": ".",
"spacing": "alone"
}
},
{
"ident": "len"
},
{
"group": {
"delimiter": "parenthesis",
"stream": []
}
}
]
}
},
{
"expr": [
{
"call": {
"args": [
{
"tuple": {
"elems": []
}
}
],
"func": {
"path": {
"segments": [
{
"ident": "Ok"
}
]
}
}
}
},
false
]
}
],
"vis": "pub"
}
}
]
},
"file_path": "src\\extractor\\system\\save_summary.rs",
"summary": {
"emoji_counts_in_strings": {},
"string_literals": [
"\" Saves the processed document summary to a JSON file.\"",
"\" Main function to process documents from command line\"",
"\"Usage: {} <input_file> <output_file>\"",
"0",
"\"Example: {} founding_documents/prelude1-aaa.md output/summary.json\"",
"0",
"\"Error: Input file '{}' does not exist\"",
"1",
"\"Processing document: {}\"",
"\"Saving summary to: {}\"",
"\"Document Summary:\"",
"\" Total turns: {}\"",
"\" Total code snippets: {}\"",
"\" Total tokens: {}\"",
"\" Languages found: {:?}\"",
"\" Content hashes: {}\""
],
"top_level_nodes": 1,
"total_nodes": 404,
"type_counts": {
"angle_bracketed": 3,
"args": 19,
"arguments": 3,
"attrs": 2,
"binary": 1,
"call": 12,
"cond": 3,
"delimiter": 17,
"elem": 2,
"elems": 5,
"expr": 27,
"fn": 2,
"func": 12,
"group": 6,
"ident": 98,
"if": 3,
"index": 4,
"init": 5,
"inputs": 2,
"int": 5,
"items": 1,
"left": 1,
"let": 6,
"lit": 21,
"macro": 11,
"meta": 2,
"method": 4,
"method_call": 4,
"name_value": 2,
"op": 20,
"output": 2,
"pat": 9,
"path": 47,
"punct": 18,
"receiver": 4,
"reference": 5,
"right": 1,
"segments": 44,
"semi_token": 11,
"spacing": 18,
"stmts": 2,
"str": 2,
"stream": 6,
"style": 2,
"then_branch": 3,
"tokens": 11,
"tree": 5,
"try": 5,
"tuple": 4,
"tuple_struct": 1,
"ty": 3,
"type": 4,
"typed": 2,
"unary": 1,
"use": 2,
"value": 2,
"vis": 2
},
"word_counts": {
"0": 2,
"1": 1,
"a": 1,
"aaa": 1,
"code": 1,
"command": 1,
"content": 1,
"document": 3,
"documents": 1,
"does": 1,
"error": 1,
"example": 1,
"exist": 1,
"file": 2,
"found": 1,
"founding_documents": 1,
"from": 1,
"function": 1,
"hashes": 1,
"input": 1,
"input_file": 1,
"json": 2,
"languages": 1,
"line": 1,
"main": 1,
"md": 1,
"not": 1,
"output": 1,
"output_file": 1,
"prelude1": 1,
"process": 1,
"processed": 1,
"processing": 1,
"saves": 1,
"saving": 1,
"snippets": 1,
"summary": 4,
"the": 1,
"to": 3,
"tokens": 1,
"total": 3,
"turns": 1,
"usage": 1
},
"word_emoji_counts": {
"0️⃣": 2,
"1️⃣": 1,
"⬅️": 1,
"🎟️": 1,
"📦": 1
}
},
"timestamp": 1751588204
}