Skip to content

Commit d863548

Browse files
authored
Add YAML writes to IAM policy agent (#165)
1 parent c3aac17 commit d863548

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

aws_doc_sdk_examples_tools/agent/bin/main.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@
66

77
from aws_doc_sdk_examples_tools.agent.make_prompts import main as make_prompts
88
from aws_doc_sdk_examples_tools.agent.parse_json_files import main as parse_json_files
9-
from aws_doc_sdk_examples_tools.agent.update_doc_gen import main as update_doc_gen
9+
from aws_doc_sdk_examples_tools.agent.update_doc_gen import update as update_doc_gen
10+
from aws_doc_sdk_examples_tools.yaml_writer import prepare_write, write_many
1011

1112
app = typer.Typer()
1213

@@ -32,7 +33,11 @@ def update(iam_tributary_root: str, system_prompts: List[str] = []) -> None:
3233
run(["npx", "@ailly/cli", "--root", AILLY_DIR])
3334
file_paths = get_ailly_files(AILLY_DIR_PATH)
3435
parse_json_files(file_paths=file_paths, out=IAM_UPDATES_PATH)
35-
update_doc_gen(doc_gen_root=doc_gen_root, iam_updates_path=IAM_UPDATES_PATH)
36+
doc_gen = update_doc_gen(
37+
doc_gen_root=doc_gen_root, iam_updates_path=IAM_UPDATES_PATH
38+
)
39+
writes = prepare_write(doc_gen.examples)
40+
write_many(doc_gen_root, writes)
3641

3742

3843
if __name__ == "__main__":

aws_doc_sdk_examples_tools/agent/update_doc_gen.py

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -36,17 +36,8 @@ def update_examples(doc_gen: DocGen, examples: Iterable[Example]) -> None:
3636
logger.warning(f"Could not find example with id: {example.id}")
3737

3838

39-
def main(doc_gen_root: Path, iam_updates_path: Path) -> None:
39+
def update(doc_gen_root: Path, iam_updates_path: Path) -> DocGen:
4040
doc_gen = DocGen.from_root(doc_gen_root)
4141
examples = examples_from_updates(iam_updates_path)
4242
update_examples(doc_gen, examples)
43-
print(
44-
[
45-
{
46-
"title": ex.title,
47-
"title_abbrev": ex.title_abbrev,
48-
"synopsis": ex.synopsis,
49-
}
50-
for _, ex in doc_gen.examples.items()
51-
]
52-
)
43+
return doc_gen

0 commit comments

Comments
 (0)