task icon Task

Edit Published Letter

Requirements
Which letter to edit (by title, URL, or from the index). What changes to make (content, style, image, or title).
2

Help the user identify which letter to edit:

  1. If they specified a title or URL, find it in the index
  2. If not, show them their published letters and ask which one

Once identified, confirm the letter details:

  • Title: [title]
  • URL: [url]
  • Style: [style]
  • Published: [date]
4

Show the user their current published content (from the fetch result).

Ask what changes they want:

  • Content changes: edits to the text itself
  • Style change: switch to a different typography style (modern, classic, serif)
  • Image change: add, remove, or replace header image
  • Title change: update the title (note: this changes the URL)

If they want content changes, they can describe edits to apply
or provide entirely new content.

5

If they're changing the title, warn that this creates a new URL:
"Changing the title will publish to a new URL. The old URL will
remain live until you delete the old repository. Continue?"

6

Prepare the updated content:

  • If editing content, apply their changes
  • If changing style, note the new style
  • If adding/changing image, handle via taskHost Image or taskGenerate Image

Save the updated content to uiLetter Draft if it was modified.

8

Save the updated content to uiLetter Draft as a markdown file.
If the user provided new content, use that.
If they described edits, apply them to the fetched content and save.

11

Write a preview of the changes with _action frontmatter:


_action:
label: "Update letter"
prompt: "Re-publish this letter to GitHub Pages using codePublish to GitHub Pages"
isComplete: false

Updating: [original title]
Changes: [summary of what changed]
Style: [style]


[First ~500 characters of updated content...]


Will be published at: [url]

13

Confirm the update:

  1. Show the live URL
  2. Note GitHub Pages may take 1-2 minutes to reflect changes
  3. If title changed, mention the old URL still exists

Update the entry in uiPublished Letters Index with:

  • Updated title, style, or image as applicable
  • Add or update "lastUpdated" field with current date
                    To run this task you must have the following required information:

> Which letter to edit (by title, URL, or from the index).
What changes to make (content, style, image, or title).

If you don't have all of this information, exit here and respond asking for any extra information you require, and instructions to run this task again with ALL required information.

---

You MUST use a todo list to complete these steps in order. Never move on to one step if you haven't completed the previous step. If you have multiple read steps in a row, read them all at once (in parallel).

Add all steps to your todo list now and begin executing.

## Steps

1. [Read Published Letters Index]: Read the file at `documents/published-letters.json` and analyze its contents (Load list of previously published letters)

2. Help the user identify which letter to edit:
1. If they specified a title or URL, find it in the index
2. If not, show them their published letters and ask which one

Once identified, confirm the letter details:
- Title: [title]
- URL: [url]
- Style: [style]
- Published: [date]


3. [Gather Arguments: Fetch Published Letter] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `url`: URL of the letter to edit

4. [Run Code: Fetch Published Letter]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/publish.letter.fetch/preview,
    "args": [
      "url"
    ]
  },
  "packages": null
}
```

5. Show the user their current published content (from the fetch result).

Ask what changes they want:
- Content changes: edits to the text itself
- Style change: switch to a different typography style (modern, classic, serif)
- Image change: add, remove, or replace header image
- Title change: update the title (note: this changes the URL)

If they want content changes, they can describe edits to apply
or provide entirely new content.


6. If they're changing the title, warn that this creates a new URL:
"Changing the title will publish to a new URL. The old URL will
remain live until you delete the old repository. Continue?"


7. Prepare the updated content:
- If editing content, apply their changes
- If changing style, note the new style
- If adding/changing image, handle via `skills/sauna/[skill_id]/references/recipes/media.image.host.md` or `skills/sauna/[skill_id]/references/recipes/media.image.generate.md`

Save the updated content to `session/draft.md` if it was modified.


8. [Read Letter Typography System]: Read the documentation in: `skills/sauna/[skill_id]/references/publish.letter.typography.md` (Style reference for any style changes)

9. Save the updated content to `session/draft.md` as a markdown file.
If the user provided new content, use that.
If they described edits, apply them to the fetched content and save.


10. [Gather Arguments: Render Letter HTML] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `title`: title (updated if changed)
- `contentPath`: session/draft.md
- `style` (default: "modern"): style (modern, classic, or serif)
- `author`: author (from original or updated)
- `date`: date (keep original date, or add 'Updated: [today]')
- `imageUrl`: imageUrl (updated if changed)
- `outputPath`: session/letter.html
- Packages: marked

11. [Run Code: Render Letter HTML]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/publish.letter.render/preview,
    "args": [
      "title",
      "contentPath",
      "style",
      "author",
      "date",
      "imageUrl",
      "outputPath"
    ]
  },
  "packages": ["marked"]
}
```

12. [Read External Actions Guide]: Read the documentation in: `skills/sauna/[skill_id]/references/sauna.actions.external.md` (Preview pattern for re-publish action)

13. Write a preview of the changes with _action frontmatter:

---
_action:
  label: "Update letter"
  prompt: "Re-publish this letter to GitHub Pages using `skills/sauna/[skill_id]/scripts/web.github.publish.js`"
  isComplete: false
---

**Updating:** [original title]
**Changes:** [summary of what changed]
**Style:** [style]

---

[First ~500 characters of updated content...]

---

*Will be published at: [url]*


14. [Gather Arguments: Publish to GitHub Pages] The next step has the following requirements for arguments, do not proceed until you have all the required information:
- `projectName`: slug (same as original unless title changed)
- `htmlPath`: session/letter.html
- `commitMessage` (default: "Deploy web app"): Update: [title]
- `trackingPath`: documents/published-letters.json

15. [Run Code: Publish to GitHub Pages]: Call `run_script` with:

```json
{
  "file": {
    "path": https://sk.ills.app/code/web.github.publish/preview,
    "args": [
      "projectName",
      "htmlPath",
      "commitMessage",
      "trackingPath"
    ]
  },
  "packages": null
}
```

16. Confirm the update:
1. Show the live URL
2. Note GitHub Pages may take 1-2 minutes to reflect changes
3. If title changed, mention the old URL still exists

Update the entry in `documents/published-letters.json` with:
- Updated title, style, or image as applicable
- Add or update "lastUpdated" field with current date