Skip to content

Commit 5ef8c95

Browse files
release: v1.3.27 — opportunity crowdfunding CLI + preview mode (#23)
* docs(how-to): add preview_mode + Smart Notebook canonical example (#20) - Documents preview_mode behavior (banner, disabled buttons, "Preview" label) and when to use it - Points the recipe at the Smart Notebook seeder as the canonical reference implementation — every field exercised, real numbers - Bumps scaffold manifest to 2026.05.05 so installer picks up the updated how-to Pairs with fl-api PR #67 + fl-elon-web-ui PR #70. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> * feat(opportunities): wire crowdfunding + preview_mode fields through CLI (1.3.26) (#21) The May 3 push/pull/diff/create commands silently dropped every crowdfunding field — funding_goal_cents, equity_pool_bps, roles[], pitch_sections[], plus the new preview_mode boolean. Round-tripping JSON appeared to work but never persisted any of the new fields. Fixes: - push: forwards funding_goal_cents/equity_pool_bps/roles/pitch_sections/preview_mode/is_public - diff: compares those fields plus correct skills_required key - create: --funding-goal (dollars), --equity-pool-pct, --roles-file, --pitch-file, --preview - new `iris opportunities preview <id>` command — toggles preview_mode with optional --on/--off flags; without flags it auto-detects current state and flips it How-to recipe documents the CLI-only flow + manifest bumped to 2026.05.06 so installer picks up the new docs. Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]> * chore: bump to 1.3.27 (1.3.26 already used by sync-comms release) --------- Co-authored-by: Claude Opus 4.7 (1M context) <[email protected]>
1 parent 787cd6b commit 5ef8c95

4 files changed

Lines changed: 121 additions & 6 deletions

File tree

‎packages/opencode/package.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"$schema": "https://json.schemastore.org/package.json",
3-
"version": "1.3.26",
3+
"version": "1.3.27",
44
"name": "opencode",
55
"displayName": "iris-agent-cli",
66
"type": "module",

‎packages/opencode/src/cli/cmd/platform-opportunities.ts‎

Lines changed: 85 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -149,7 +149,12 @@ const CreateCommand = cmd({
149149
.option("skills", { describe: "required skills (comma-separated)", type: "string" })
150150
.option("min-budget", { describe: "minimum budget", type: "number" })
151151
.option("max-budget", { describe: "maximum budget", type: "number" })
152-
.option("deadline", { describe: "deadline (YYYY-MM-DD)", type: "string" }),
152+
.option("deadline", { describe: "deadline (YYYY-MM-DD)", type: "string" })
153+
.option("funding-goal", { describe: "crowdfunding goal in dollars (e.g. 100000 for $100K)", type: "number" })
154+
.option("equity-pool-pct", { describe: "equity pool percentage (e.g. 5 for 5%)", type: "number" })
155+
.option("roles-file", { describe: "path to roles JSON array (key/title/count/pay_type/pay_amount/equity_bps/description)", type: "string" })
156+
.option("pitch-file", { describe: "path to pitch sections JSON array ({heading, body})", type: "string" })
157+
.option("preview", { describe: "create in preview mode (banner shown, applications/investments disabled)", type: "boolean" }),
153158
async handler(args) {
154159
UI.empty()
155160
prompts.intro("◈ Create Opportunity")
@@ -185,6 +190,19 @@ const CreateCommand = cmd({
185190
if (args["min-budget"]) payload.price_min = args["min-budget"]
186191
if (args["max-budget"]) payload.price_max = args["max-budget"]
187192
if (args.deadline) payload.application_deadline = args.deadline
193+
if (args["funding-goal"] !== undefined) payload.funding_goal_cents = Math.round(Number(args["funding-goal"]) * 100)
194+
if (args["equity-pool-pct"] !== undefined) payload.equity_pool_bps = Math.round(Number(args["equity-pool-pct"]) * 100)
195+
if (args["roles-file"]) {
196+
const rolesPath = String(args["roles-file"])
197+
if (!existsSync(rolesPath)) { spinner.stop("Failed", 1); prompts.log.error(`Roles file not found: ${rolesPath}`); prompts.outro("Done"); return }
198+
payload.roles = JSON.parse(readFileSync(rolesPath, "utf-8"))
199+
}
200+
if (args["pitch-file"]) {
201+
const pitchPath = String(args["pitch-file"])
202+
if (!existsSync(pitchPath)) { spinner.stop("Failed", 1); prompts.log.error(`Pitch file not found: ${pitchPath}`); prompts.outro("Done"); return }
203+
payload.pitch_sections = JSON.parse(readFileSync(pitchPath, "utf-8"))
204+
}
205+
if (args.preview) payload.preview_mode = true
188206

189207
const res = await irisFetch("/api/v1/marketplace/opportunities", { method: "POST", body: JSON.stringify(payload) })
190208
const ok = await handleApiError(res, "Create opportunity")
@@ -292,6 +310,9 @@ const PushCommand = cmd({
292310
const payload: Record<string, unknown> = {
293311
title: entity.title, description: entity.description, skills_required: entity.skills_required ?? entity.skills,
294312
price_min: entity.price_min ?? entity.min_budget, price_max: entity.price_max ?? entity.max_budget, application_deadline: entity.application_deadline ?? entity.deadline,
313+
funding_goal_cents: entity.funding_goal_cents, equity_pool_bps: entity.equity_pool_bps,
314+
roles: entity.roles, pitch_sections: entity.pitch_sections,
315+
preview_mode: entity.preview_mode, is_public: entity.is_public,
295316
}
296317
for (const k of Object.keys(payload)) { if (payload[k] === undefined) delete payload[k] }
297318

@@ -356,16 +377,23 @@ const DiffCommand = cmd({
356377

357378
const local = JSON.parse(readFileSync(filepath, "utf-8"))
358379

359-
const fields = ["title", "description", "status", "min_budget", "max_budget", "deadline"]
380+
const fields = [
381+
"title", "description", "status",
382+
"price_min", "price_max", "application_deadline",
383+
"funding_goal_cents", "equity_pool_bps", "roles", "pitch_sections",
384+
"preview_mode", "is_public",
385+
]
360386
const changes: { field: string; live: unknown; local: unknown }[] = []
361387

362388
for (const f of fields) {
363389
if (JSON.stringify(live[f] ?? null) !== JSON.stringify(local[f] ?? null)) {
364390
changes.push({ field: f, live: live[f], local: local[f] })
365391
}
366392
}
367-
if (JSON.stringify(live.skills ?? null) !== JSON.stringify(local.skills ?? null)) {
368-
changes.push({ field: "skills", live: live.skills, local: local.skills })
393+
const liveSkills = live.skills_required ?? live.skills
394+
const localSkills = local.skills_required ?? local.skills
395+
if (JSON.stringify(liveSkills ?? null) !== JSON.stringify(localSkills ?? null)) {
396+
changes.push({ field: "skills_required", live: liveSkills, local: localSkills })
369397
}
370398

371399
spinner.stop(changes.length === 0 ? success("In sync") : `${changes.length} difference(s)`)
@@ -395,6 +423,58 @@ const DiffCommand = cmd({
395423
},
396424
})
397425

426+
const PreviewCommand = cmd({
427+
command: "preview <id>",
428+
describe: "toggle preview_mode on an opportunity (banner shown, applications/investments disabled)",
429+
builder: (yargs) =>
430+
yargs
431+
.positional("id", { describe: "opportunity ID", type: "number", demandOption: true })
432+
.option("on", { describe: "enable preview mode", type: "boolean" })
433+
.option("off", { describe: "disable preview mode (go live)", type: "boolean" }),
434+
async handler(args) {
435+
UI.empty()
436+
prompts.intro(`◈ Preview Mode #${args.id}`)
437+
438+
const token = await requireAuth()
439+
if (!token) { prompts.outro("Done"); return }
440+
441+
let nextValue: boolean
442+
if (args.on) nextValue = true
443+
else if (args.off) nextValue = false
444+
else {
445+
const spinnerLookup = prompts.spinner()
446+
spinnerLookup.start("Fetching current state…")
447+
const liveRes = await irisFetch(`/api/v1/marketplace/opportunities/${args.id}`)
448+
const liveOk = await handleApiError(liveRes, "Fetch opportunity")
449+
if (!liveOk) { spinnerLookup.stop("Failed", 1); prompts.outro("Done"); return }
450+
const liveData = (await liveRes.json()) as { data?: any }
451+
const liveEntity = liveData?.data ?? liveData
452+
const current = Boolean(liveEntity.preview_mode)
453+
spinnerLookup.stop(`Currently: ${current ? bold("PREVIEW") : bold("LIVE")}`)
454+
nextValue = !current
455+
}
456+
457+
const spinner = prompts.spinner()
458+
spinner.start(`Setting preview_mode=${nextValue}…`)
459+
460+
try {
461+
const res = await irisFetch(`/api/v1/marketplace/opportunities/${args.id}`, {
462+
method: "PUT",
463+
body: JSON.stringify({ preview_mode: nextValue }),
464+
})
465+
const ok = await handleApiError(res, "Update opportunity")
466+
if (!ok) { spinner.stop("Failed", 1); prompts.outro("Done"); return }
467+
468+
spinner.stop(`${success("✓")} ${nextValue ? "Preview mode ON" : "LIVE — applications & investments enabled"}`)
469+
prompts.outro(dim(`iris opportunities get ${args.id}`))
470+
} catch (err) {
471+
spinner.stop("Error", 1)
472+
prompts.log.error(err instanceof Error ? err.message : String(err))
473+
prompts.outro("Done")
474+
}
475+
},
476+
})
477+
398478
const DeleteCommand = cmd({
399479
command: "delete <id>",
400480
describe: "delete an opportunity",
@@ -581,6 +661,7 @@ export const PlatformOpportunitiesCommand = cmd({
581661
.command(PullCommand)
582662
.command(PushCommand)
583663
.command(DiffCommand)
664+
.command(PreviewCommand)
584665
.command(DeleteCommand)
585666
.command(InterestCommand)
586667
.demandCommand(),

‎scaffold/how-to/crowdfunding-opportunities.md‎

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,40 @@ A marketplace opportunity isn't just a job posting — it's a **pitch page**. Ea
66

77
This recipe covers authoring those rich opportunity pages from the CLI.
88

9+
## Canonical example
10+
11+
The reference implementation is the **Smart Notebook — Encrypted Personal Server** opportunity (Andrew Escher / Good Deals Hardware). It exercises every field — funding goal, 4 roles with mixed pay types, 6 pitch sections, board members, 4 milestones, sample backer.
12+
13+
Seed it locally:
14+
15+
```bash
16+
docker compose exec api php artisan atlas:seed-opportunity-schemas
17+
docker compose exec api php artisan db:seed --class=SmartNotebookOpportunitySeeder
18+
```
19+
20+
It seeds with `preview_mode=true` — the page renders fully but Apply/Invest are disabled and a yellow `PREVIEW — NOT LIVE` banner sits at the top. Flip `preview_mode=false` (via `iris opportunities push` or directly in DB) to make it live.
21+
22+
## Preview mode
23+
24+
Set `preview_mode=true` on any opportunity to:
25+
26+
- Render a `PREVIEW — NOT LIVE` banner at the top of the page
27+
- Show a `PREVIEW` pill next to the status badge
28+
- Disable the per-role Apply buttons (label changes to "Preview")
29+
- Replace the bottom Apply/Invest tabs with a "Preview Mode" notice
30+
31+
Use this when you want a shareable URL for founder/investor feedback before opening real applications.
32+
33+
**Toggle preview mode from the CLI:**
34+
35+
```bash
36+
$ iris opportunities preview 494 # toggle (auto-detects current state)
37+
$ iris opportunities preview 494 --on # force preview
38+
$ iris opportunities preview 494 --off # go live
39+
```
40+
41+
Or create directly in preview mode: `iris opportunities create ... --preview`. Or set `preview_mode: true` in the JSON and `iris opportunities push <id>`.
42+
943
## Prerequisites
1044

1145
- Authenticated (`iris-login` complete)

‎scaffold/manifest.json‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"version": "2026.05.04",
2+
"version": "2026.05.06",
33
"description": "IRIS CLI scaffold manifest. The installer fetches this file from GitHub raw (or heyiris.io when configured), then downloads each entry to the user's ~/.iris/ directory. Adding a new how-to is just a PR adding the file + a line here.",
44
"files": [
55
{

0 commit comments

Comments
 (0)