@dk/jolly 0.1.9 → 0.1.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. package/bin/jolly +2 -0
  2. package/package.json +3 -2
  3. package/src/index.ts +155 -0
package/bin/jolly ADDED
@@ -0,0 +1,2 @@
1
+ #!/usr/bin/env bun
2
+ import "../src/index.ts";
package/package.json CHANGED
@@ -1,12 +1,13 @@
1
1
  {
2
2
  "name": "@dk/jolly",
3
- "version": "0.1.9",
3
+ "version": "0.1.11",
4
4
  "description": "Ahoy, agent. Go build a Saleor storefront.",
5
5
  "type": "module",
6
6
  "bin": {
7
- "jolly": "./src/index.ts"
7
+ "jolly": "bin/jolly"
8
8
  },
9
9
  "files": [
10
+ "bin/",
10
11
  "src/",
11
12
  "README.md"
12
13
  ],
package/src/index.ts CHANGED
@@ -1665,7 +1665,162 @@ function cmdDoctor(group?: string): void {
1665
1665
 
1666
1666
  // ── Command: start ───────────────────────────────────────────────────────
1667
1667
 
1668
+ /**
1669
+ * Per-stage intended effects for the `jolly start --dry-run` preview plan
1670
+ * (feature 001). All four arrays are always present; empty when the stage
1671
+ * has no such effect.
1672
+ */
1673
+ interface StageEffects {
1674
+ directoriesCreated: string[];
1675
+ filesWritten: string[];
1676
+ networkHostsContacted: string[];
1677
+ repositoriesCloned: string[];
1678
+ }
1679
+
1680
+ interface PlanEntry {
1681
+ stage: string;
1682
+ description: string;
1683
+ effects: StageEffects;
1684
+ riskContext?: RiskContext;
1685
+ }
1686
+
1687
+ /**
1688
+ * `jolly start --dry-run`: a true preview plan, not a status report.
1689
+ * Emits exactly what `start` would do — directories created, files
1690
+ * written, network hosts contacted, repositories cloned — with a feature
1691
+ * 021 riskContext on every side-effecting stage. Touches nothing: no file
1692
+ * reads beyond the .env already loaded, no writes, no network calls.
1693
+ */
1694
+ function cmdStartDryRun(): void {
1695
+ const effects = (partial: Partial<StageEffects>): StageEffects => ({
1696
+ directoriesCreated: [],
1697
+ filesWritten: [],
1698
+ networkHostsContacted: [],
1699
+ repositoriesCloned: [],
1700
+ ...partial,
1701
+ });
1702
+
1703
+ const plan: PlanEntry[] = [
1704
+ {
1705
+ stage: "init",
1706
+ description: "Install Saleor agent skills and Jolly guidance",
1707
+ effects: effects({
1708
+ directoriesCreated: [".jolly", ".jolly/skills"],
1709
+ filesWritten: [".jolly/init.json", ".mcp.json", "AGENTS.md", ".gitignore"],
1710
+ }),
1711
+ riskContext: riskContext(
1712
+ "init",
1713
+ { type: "local project files", path: "." },
1714
+ "low",
1715
+ [],
1716
+ true,
1717
+ [
1718
+ "Installs Saleor agent skills under .jolly/skills",
1719
+ "Merges mcp-graphql config into .mcp.json and a Jolly section into AGENTS.md",
1720
+ "Ensures .env is git-ignored",
1721
+ ],
1722
+ ),
1723
+ },
1724
+ {
1725
+ stage: "store",
1726
+ description: "Connect or create a Saleor Cloud store",
1727
+ effects: effects({
1728
+ networkHostsContacted: ["cloud.saleor.io"],
1729
+ filesWritten: [".env"],
1730
+ }),
1731
+ riskContext: riskContext(
1732
+ "create store",
1733
+ { type: "Saleor Cloud environment", organization: "auto-discovered" },
1734
+ "medium",
1735
+ ["billing", "credential handling"],
1736
+ true,
1737
+ [
1738
+ "Creates a Saleor Cloud environment (consumes a sandbox slot)",
1739
+ "Writes NEXT_PUBLIC_SALEOR_API_URL and JOLLY_SALEOR_APP_TOKEN to .env",
1740
+ ],
1741
+ ),
1742
+ },
1743
+ {
1744
+ stage: "storefront",
1745
+ description: "Clone and configure the Saleor Paper storefront",
1746
+ effects: effects({
1747
+ directoriesCreated: ["storefront"],
1748
+ networkHostsContacted: ["github.com"],
1749
+ repositoriesCloned: ["https://github.com/saleor/storefront"],
1750
+ }),
1751
+ riskContext: riskContext(
1752
+ "create storefront",
1753
+ { type: "Paper storefront clone", path: "storefront" },
1754
+ "low",
1755
+ [],
1756
+ true,
1757
+ ["Clones saleor/storefront Paper template", "Initializes local Git repository"],
1758
+ ),
1759
+ },
1760
+ {
1761
+ stage: "deployment",
1762
+ description: "Deploy the storefront to Vercel",
1763
+ effects: effects({
1764
+ networkHostsContacted: ["api.vercel.com"],
1765
+ }),
1766
+ riskContext: riskContext(
1767
+ "create deployment",
1768
+ { type: "Vercel project", provider: "vercel" },
1769
+ "medium",
1770
+ ["live deployment"],
1771
+ true,
1772
+ ["Creates a Vercel project and triggers a deployment"],
1773
+ ),
1774
+ },
1775
+ {
1776
+ stage: "stripe",
1777
+ description: "Configure Stripe test-mode payments",
1778
+ effects: effects({
1779
+ networkHostsContacted: ["api.stripe.com"],
1780
+ filesWritten: [".env"],
1781
+ }),
1782
+ riskContext: riskContext(
1783
+ "create stripe",
1784
+ { type: "Stripe test-mode configuration" },
1785
+ "medium",
1786
+ ["payment setup", "credential handling"],
1787
+ true,
1788
+ ["Writes JOLLY_STRIPE_PUBLISHABLE_KEY and JOLLY_STRIPE_SECRET_KEY references to .env"],
1789
+ ),
1790
+ },
1791
+ {
1792
+ stage: "doctor",
1793
+ description: "Run final jolly doctor verification",
1794
+ effects: effects({}),
1795
+ },
1796
+ ];
1797
+
1798
+ output(
1799
+ buildEnvelope("start", {
1800
+ status: "success",
1801
+ summary:
1802
+ "Dry-run: previewed the jolly start plan. Nothing was created, written, or contacted.",
1803
+ data: { dryRun: true, plan },
1804
+ checks: [
1805
+ {
1806
+ id: "start-dry-run",
1807
+ status: "pass" as CheckStatus,
1808
+ description: "Preview only — no files created or modified, no network calls",
1809
+ },
1810
+ ],
1811
+ nextSteps: [
1812
+ { description: "Run jolly start to execute this plan" },
1813
+ ],
1814
+ }),
1815
+ );
1816
+ }
1817
+
1668
1818
  function cmdStart(): void {
1819
+ if (FLAG_DRY_RUN) {
1820
+ cmdStartDryRun();
1821
+ return;
1822
+ }
1823
+
1669
1824
  const existing = loadEnvValues(cwd);
1670
1825
 
1671
1826
  // Simulate running stages and detecting progress