Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Automation #49

Closed
silvester-pari opened this issue Nov 25, 2024 · 0 comments · Fixed by #50
Closed

Automation #49

silvester-pari opened this issue Nov 25, 2024 · 0 comments · Fixed by #50
Assignees
Labels

Comments

@silvester-pari
Copy link
Collaborator

silvester-pari commented Nov 25, 2024

Initial concept:

automations: [
  {
    title: "Bootstrap Product",
    description: "Bootstrap a new file with the correct folder structure and ID.",
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        title: {
          type: "string"
        }
      }
    },
    steps: [
      {
        type: "add",
        path: (input) => `/products/${input.id}/collection.json`,
        content: (input) => ({ id: input.id }) // because of format "json", stringify this (via formatIsNeeded function)
      },
      {
        type: "edit",
        path: "/products/catalog.json",
        transform: (content, input) => { // because of format "json", parse content before passing (via formatIsNeeded function)
          content.links = [
            ...content.links,
            {
              rel: "child",
              href: `./${input.id}/collection.json`,
              type: "application/json",
              title: input.title
            },
          ]
          return content
        }
      }
    ]
  },
  {
    title: "Create Narrative",
    inputSchema: {
      type: "object",
      properties: {
        id: {
          type: "string"
        },
        title: {
          type: "string"
        }
      }
    },
    steps: [
      {
        type: "add",
        path: (input) => `/narratives/${input.id}.md`,
        content: (input) => `# ${input.title}` // no "format" defined, so just as text
      }
    ]
  }
]

What would be really neat is also some feedback to the user while loading (similar to when the fork is created), like: "Creating file... Editing file..." etc.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants