naive-framework 0.0.0-stage → 0.2.0
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.
- package/AGENTS.md +62 -0
- package/LICENSE +21 -0
- package/README.md +37 -2
- package/docs/decisions/decisions.json +888 -0
- package/docs/ontology.json +796 -0
- package/docs/ontology.md +163 -0
- package/docs/reference/ROUTES.md +124 -0
- package/evidence/benchmarks/2026-10-27-golden.jev.after-catalog-fix.json +558 -0
- package/evidence/benchmarks/2026-10-27-golden.jev.json +501 -0
- package/evidence/benchmarks/2026-10-27-golden.reasoning-answers.json +177 -0
- package/evidence/benchmarks/JEV_VS_REASONING_MODEL_2026-10-27.md +68 -0
- package/evidence/capabilities/agent-capabilities.json +86 -0
- package/evidence/design-documents.registry.json +2896 -0
- package/evidence/evals/evals.json +25 -0
- package/evidence/evals/harness-evals.json +140 -0
- package/evidence/layer.json +51 -0
- package/evidence/skills/agent-capabilities/SKILL.md +35 -0
- package/evidence/skills/design-coverage/SKILL.md +57 -0
- package/evidence/skills/design-coverage/check.mjs +192 -0
- package/evidence/skills/design-coverage/scan.mjs +45 -0
- package/evidence/skills/fidelity-ladder-audit/SKILL.md +121 -0
- package/evidence/skills/fidelity-ladder-audit/ladder-census.mjs +180 -0
- package/evidence/skills/findability/SKILL.md +32 -0
- package/evidence/skills/findability/inventory.rb +41 -0
- package/evidence/skills/foreshadowing-audit/SKILL.md +183 -0
- package/evidence/skills/metrics-review/SKILL.md +177 -0
- package/evidence/tooling/integrations.json +153 -0
- package/governance/layer.json +102 -0
- package/governance/references/references.json +26 -0
- package/governance/skills/board-design/SKILL.md +68 -0
- package/governance/skills/brand-pillar/SKILL.md +90 -0
- package/governance/skills/business-pillar/SKILL.md +96 -0
- package/governance/skills/chief-of-staff/SKILL.md +45 -0
- package/governance/skills/cofounder-structure/SKILL.md +64 -0
- package/governance/skills/cross-pillar-tradeoff/SKILL.md +168 -0
- package/governance/skills/equity-and-share-classes/SKILL.md +68 -0
- package/governance/skills/executive-roles/SKILL.md +95 -0
- package/governance/skills/exit-planning/SKILL.md +66 -0
- package/governance/skills/financing-and-investor-rights/SKILL.md +73 -0
- package/governance/skills/office-hours-mode/SKILL.md +113 -0
- package/governance/skills/product-pillar/SKILL.md +81 -0
- package/governance/skills/publication-policy/SKILL.md +63 -0
- package/governance/skills/role-and-candidate-authoring/SKILL.md +198 -0
- package/governance/skills/stakeholder-update/SKILL.md +177 -0
- package/governance/tooling/integrations.json +37 -0
- package/governance/venture-template/AGENT_ROLES_AND_DECISION_RIGHTS.md +58 -0
- package/governance/venture-template/COMPANY_VAULT_DEFINITION_2026-10-25.md +204 -0
- package/governance/venture-template/README.md +74 -0
- package/governance/venture-template/decision-rights.json +186 -0
- package/governance/venture-template/index.md +151 -0
- package/governance/venture-template/pillars/brand.md +209 -0
- package/governance/venture-template/pillars/business.md +255 -0
- package/governance/venture-template/pillars/product.md +254 -0
- package/governance/venture-template/render-roles.py +11 -0
- package/governance/venture-template/roles/README.md +85 -0
- package/governance/venture-template/roles/agent-roles.json +202 -0
- package/governance/venture-template/roles/ceo.md +163 -0
- package/governance/venture-template/roles/chief-of-staff.md +153 -0
- package/governance/venture-template/roles/cmo.md +165 -0
- package/governance/venture-template/roles/coo.md +189 -0
- package/governance/venture-template/roles/cto.md +158 -0
- package/governance/venture-template/roles/department-head.md +47 -0
- package/governance/venture-template/roles/forward-deployed-engineer.md +51 -0
- package/governance/venture-template/roles/founder.md +173 -0
- package/governance/venture-template/roles/hr-manager.md +49 -0
- package/governance/venture-template/roles/talent-acquisition-manager.md +50 -0
- package/governance/venture-template/roles/venture-roles.json +62 -0
- package/interface/acting.mjs +83 -0
- package/interface/adapters/claude-code.json +16 -0
- package/interface/adapters/codex.json +14 -0
- package/interface/adapters/cursor.json +16 -0
- package/interface/adapters.mjs +182 -0
- package/interface/api/server.mjs +71 -0
- package/interface/boundaries.mjs +218 -0
- package/interface/brand.mjs +214 -0
- package/interface/cli/find-venture.mjs +15 -0
- package/interface/cli/freshness.mjs +59 -0
- package/interface/cli/guard.mjs +6 -0
- package/interface/cli/mentura.mjs +341 -0
- package/interface/cli/naive.mjs +194 -0
- package/interface/context.mjs +524 -0
- package/interface/demo/board.mjs +581 -0
- package/interface/demo/decision-harness.mjs +91 -0
- package/interface/demo/live-agent.mjs +47 -0
- package/interface/dev/setup.mjs +84 -0
- package/interface/gate-hooks.mjs +36 -0
- package/interface/harness/evals.mjs +90 -0
- package/interface/harness/examples/pt-no-shows.dump.md +19 -0
- package/interface/harness/run.mjs +313 -0
- package/interface/harness/site.mjs +59 -0
- package/interface/instrumentation.mjs +86 -0
- package/interface/kit-boundary.mjs +73 -0
- package/interface/layer.json +37 -0
- package/interface/mcp/server.mjs +162 -0
- package/interface/operator-console/README.md +58 -0
- package/interface/package-routes.mjs +196 -0
- package/interface/provenance.mjs +65 -0
- package/interface/reads.mjs +173 -0
- package/interface/references/references.json +28 -0
- package/interface/release-card.mjs +42 -0
- package/interface/route-aliases.json +32 -0
- package/interface/router.mjs +653 -0
- package/interface/skills/install-mentura/SKILL.md +88 -0
- package/interface/skills/naive-setup/SKILL.md +71 -0
- package/interface/skills/naive-setup/artifact.html +83 -0
- package/interface/tooling/integrations.json +112 -0
- package/interface/vitals.mjs +115 -0
- package/interface/writes.mjs +190 -0
- package/knowledge/connectors/README.md +54 -0
- package/knowledge/connectors/catalog.mjs +118 -0
- package/knowledge/connectors/contract.mjs +56 -0
- package/knowledge/connectors/eval.mjs +176 -0
- package/knowledge/connectors/filesystem.mjs +79 -0
- package/knowledge/connectors/index.mjs +102 -0
- package/knowledge/connectors/resolve.mjs +44 -0
- package/knowledge/connectors/suite.mjs +80 -0
- package/knowledge/freshness.json +85 -0
- package/knowledge/layer.json +50 -0
- package/knowledge/skills/find-reference/SKILL.md +38 -0
- package/knowledge/skills/industry-awareness/SKILL.md +277 -0
- package/knowledge/templates/glossary.md +23 -0
- package/knowledge/tooling/integrations.json +127 -0
- package/knowledge/tooling/questions.md +46 -0
- package/operations/FOUNDER_OPERATING_MODEL_CAMPAIGN_2026-10-14.md +16 -0
- package/operations/departments.json +162 -0
- package/operations/handoff-v2.md +93 -0
- package/operations/layer.json +67 -0
- package/operations/marketing/check-public.mjs +68 -0
- package/operations/marketing/site/README.md +86 -0
- package/operations/marketing/site/matrix.json +731 -0
- package/operations/marketing/site/plan.mjs +117 -0
- package/operations/marketing/site/presence.mjs +252 -0
- package/operations/references/references.json +45 -0
- package/operations/skills/recruiting/SKILL.md +32 -0
- package/operations/skills/team-design/SKILL.md +36 -0
- package/operations/skills/tool-selection/SKILL.md +46 -0
- package/operations/templates/marketing-brand.md +46 -0
- package/operations/templates/public-assets.md +39 -0
- package/operations/templates/recruiting-brief.md +35 -0
- package/operations/tooling/integrations.json +158 -0
- package/package.json +59 -4
- package/packages/catalog.json +280 -0
- package/packages/cofounder/package.json +42 -0
- package/packages/counsel/package.json +47 -0
- package/packages/customers/package.json +41 -0
- package/packages/deals/package.json +27 -0
- package/packages/decisions/package.json +28 -0
- package/packages/engineering/package.json +41 -0
- package/packages/evidence/package.json +17 -0
- package/packages/finance/frames/fund-without-ceding-control.frame.json +177 -0
- package/packages/finance/package.json +48 -0
- package/packages/foundation/package.json +59 -0
- package/packages/fund/package.json +48 -0
- package/packages/investor/package.json +57 -0
- package/packages/investors/package.json +21 -0
- package/packages/legal/package.json +73 -0
- package/packages/marketing/package.json +63 -0
- package/packages/money/package.json +42 -0
- package/packages/operations/package.json +74 -0
- package/packages/partner/package.json +38 -0
- package/packages/people/package.json +64 -0
- package/packages/product/package.json +49 -0
- package/packages/raw/package.json +19 -0
- package/packages/relationships/package.json +52 -0
- package/packages/validation/package.json +112 -0
- package/platform/README.md +51 -0
- package/platform/adapter.json +15 -0
- package/platform/connectors/eval.mjs +154 -0
- package/platform/connectors/fake-github.mjs +91 -0
- package/platform/connectors/github.mjs +105 -0
- package/platform/integrations/jev.mjs +30 -0
- package/platform/integrations/langsmith-docket.mjs +53 -0
- package/platform/integrations/langsmith-setup.mjs +115 -0
- package/platform/integrations/langsmith.mjs +47 -0
- package/platform/integrations/remote-image.mjs +79 -0
- package/platform/integrations/rho.mjs +146 -0
- package/platform/integrations/site.mjs +75 -0
- package/platform/kits/README.md +14 -0
- package/platform/kits/agent-upgrade/kit.json +15 -0
- package/platform/kits/agent-upgrade/run.mjs +82 -0
- package/platform/kits/agent-upgrade/stand-in-agent.mjs +32 -0
- package/platform/kits/validation-kickoff/kit.json +29 -0
- package/platform/mcp/research.mjs +64 -0
- package/platform/webhooks/server.mjs +70 -0
- package/purpose/checklists/vault-and-tooling-consultancy-setup.md +216 -0
- package/purpose/frameworks/business-discovery-framework-amendments-2026-05-20.md +181 -0
- package/purpose/frameworks/business-discovery-framework.html +938 -0
- package/purpose/frameworks/business-discovery-framework.md +326 -0
- package/purpose/frameworks/idea-map/README.md +74 -0
- package/purpose/frameworks/idea-map/conventions.json +146 -0
- package/purpose/frameworks/idea-map/graph.mjs +182 -0
- package/purpose/frameworks/idea-map/ideamap.mjs +181 -0
- package/purpose/frameworks/idea-map/route.mjs +140 -0
- package/purpose/frameworks/onboarding-handoff-framework.md +269 -0
- package/purpose/frameworks/post-discovery-deliverable-playbook.md +274 -0
- package/purpose/frameworks/product-anatomy/README.md +63 -0
- package/purpose/frameworks/product-anatomy/anatomy.mjs +195 -0
- package/purpose/frameworks/product-anatomy/examples/polity.answers.reasoned.json +11 -0
- package/purpose/frameworks/product-anatomy/examples/polity.json +89 -0
- package/purpose/frameworks/product-anatomy/phases.json +107 -0
- package/purpose/frameworks/product-anatomy/questions.json +74 -0
- package/purpose/kits/validation/README.md +14 -0
- package/purpose/kits/validation/references/references.json +122 -0
- package/purpose/kits/validation/skills/problem-validation/SKILL.md +43 -0
- package/purpose/kits/validation/skills/validation-score/SKILL.md +35 -0
- package/purpose/kits/validation/templates/go-to-market.md +19 -0
- package/purpose/kits/validation/templates/operations-readiness.md +20 -0
- package/purpose/kits/validation/templates/pricing.md +22 -0
- package/purpose/kits/validation/templates/problem-interview.md +36 -0
- package/purpose/kits/validation/templates/problem.md +45 -0
- package/purpose/kits/validation/templates/product-market-fit.md +23 -0
- package/purpose/kits/validation/templates/solution.md +18 -0
- package/purpose/kits/validation/templates/team.md +19 -0
- package/purpose/kits/validation/weights.json +22 -0
- package/purpose/layer.json +53 -0
- package/purpose/references/references.json +324 -0
- package/purpose/skills/ambition-tier/SKILL.md +205 -0
- package/purpose/skills/telos/SKILL.md +52 -0
- package/purpose/strategic-foundation.json +133 -0
- package/purpose/templates/telos-based-smart.md +39 -0
- package/purpose/tooling/integrations.json +48 -0
- package/schema/README.md +62 -0
- package/schema/VERSION +1 -0
- package/schema/access.mjs +57 -0
- package/schema/account.schema.json +79 -0
- package/schema/adapter.schema.json +33 -0
- package/schema/add-department.mjs +41 -0
- package/schema/agent-capability.schema.json +94 -0
- package/schema/alignment.schema.json +61 -0
- package/schema/assess-problem.mjs +131 -0
- package/schema/assets.mjs +212 -0
- package/schema/bdd.mjs +56 -0
- package/schema/board.schema.json +101 -0
- package/schema/brand.mjs +373 -0
- package/schema/build-release.mjs +61 -0
- package/schema/caching.mjs +505 -0
- package/schema/check-assets.mjs +24 -0
- package/schema/check-boundary.mjs +54 -0
- package/schema/check-brand.mjs +24 -0
- package/schema/check-config.mjs +110 -0
- package/schema/check-data-model.mjs +170 -0
- package/schema/check-data-packages.mjs +83 -0
- package/schema/check-departments.mjs +45 -0
- package/schema/check-execution.mjs +85 -0
- package/schema/check-governance.mjs +98 -0
- package/schema/check-integrations.mjs +33 -0
- package/schema/check-nextjs-status.mjs +79 -0
- package/schema/check-nouns.mjs +49 -0
- package/schema/check-people.mjs +70 -0
- package/schema/check-private.mjs +61 -0
- package/schema/check-provenance.mjs +55 -0
- package/schema/check-publication.mjs +96 -0
- package/schema/check-ready.mjs +89 -0
- package/schema/check-sources.mjs +74 -0
- package/schema/check-team.mjs +94 -0
- package/schema/check-telos.mjs +59 -0
- package/schema/check-validation.mjs +165 -0
- package/schema/check-ventures.mjs +81 -0
- package/schema/check-where-used.mjs +58 -0
- package/schema/data-master.schema.json +14 -0
- package/schema/data-model.json +1584 -0
- package/schema/data-model.schema.json +152 -0
- package/schema/deal.schema.json +80 -0
- package/schema/decision-analytics.mjs +77 -0
- package/schema/decision-record.schema.json +290 -0
- package/schema/decision-rights.schema.json +34 -0
- package/schema/decision.schema.json +30 -0
- package/schema/decisions.mjs +327 -0
- package/schema/department-catalog.schema.json +55 -0
- package/schema/department.schema.json +15 -0
- package/schema/departments.mjs +32 -0
- package/schema/docket-eval.mjs +89 -0
- package/schema/docket.mjs +135 -0
- package/schema/eval-suite.schema.json +45 -0
- package/schema/evidence.schema.json +110 -0
- package/schema/examples/frames/judge.mjs +10 -0
- package/schema/examples/migrate/agent.mjs +12 -0
- package/schema/examples/venture-type/jev.mjs +12 -0
- package/schema/examples/workspace/ventures/acme-labs/AGENTS.md +17 -0
- package/schema/examples/workspace/ventures/acme-labs/accounts/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/acme-labs/decisions/discovery-goal.decision.json +23 -0
- package/schema/examples/workspace/ventures/acme-labs/decisions/statement-icp.decision.json +22 -0
- package/schema/examples/workspace/ventures/acme-labs/decisions/statement-problem.decision.json +22 -0
- package/schema/examples/workspace/ventures/acme-labs/decisions/venture.team.decision.json +37 -0
- package/schema/examples/workspace/ventures/acme-labs/knowledge/README.md +3 -0
- package/schema/examples/workspace/ventures/acme-labs/knowledge/sources.json +46 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000001.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000002.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000003.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000004.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000005.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000006.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000007.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000008.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000009.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000010.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000011.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000012.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000013.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/30000000-0000-4000-8000-000000000014.json +12 -0
- package/schema/examples/workspace/ventures/acme-labs/money/_streams/transactions/stream.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/money/_summary.json +30 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/customer-service/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/customer-service/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/finance/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/finance/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/human-capital/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/human-capital/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/it/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/it/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/marketing-and-sales/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/marketing-and-sales/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/products/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/products/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/strategy/README.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/operations/departments/strategy/department.json +5 -0
- package/schema/examples/workspace/ventures/acme-labs/people/founders/maya-chen.json +15 -0
- package/schema/examples/workspace/ventures/acme-labs/people/people.json +22 -0
- package/schema/examples/workspace/ventures/acme-labs/pillars/brand.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/pillars/business.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/pillars/product.md +5 -0
- package/schema/examples/workspace/ventures/acme-labs/products/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/acme-labs/products/decisions/product.core-product.decision.json +28 -0
- package/schema/examples/workspace/ventures/acme-labs/products/decisions/product.exists.decision.json +38 -0
- package/schema/examples/workspace/ventures/acme-labs/products/decisions/product.flagship.decision.json +27 -0
- package/schema/examples/workspace/ventures/acme-labs/profile.md +12 -0
- package/schema/examples/workspace/ventures/acme-labs/provenance.jsonl +12 -0
- package/schema/examples/workspace/ventures/acme-labs/raw/dump.md +6 -0
- package/schema/examples/workspace/ventures/acme-labs/venture.json +27 -0
- package/schema/examples/workspace/ventures/northstar/AGENTS.md +17 -0
- package/schema/examples/workspace/ventures/northstar/accounts/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/northstar/deals/ductline.json +8 -0
- package/schema/examples/workspace/ventures/northstar/deals/kilnworks.json +14 -0
- package/schema/examples/workspace/ventures/northstar/decisions/venture.team.decision.json +31 -0
- package/schema/examples/workspace/ventures/northstar/evidence/README.md +3 -0
- package/schema/examples/workspace/ventures/northstar/fund/decisions/terms.decision.json +27 -0
- package/schema/examples/workspace/ventures/northstar/fund/decisions/terms.first-close.decision.json +27 -0
- package/schema/examples/workspace/ventures/northstar/fund/decisions/thesis.decision.json +26 -0
- package/schema/examples/workspace/ventures/northstar/fund/terms.json +22 -0
- package/schema/examples/workspace/ventures/northstar/fund/thesis.json +22 -0
- package/schema/examples/workspace/ventures/northstar/governance/README.md +3 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/external-relationships/charter.md +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/external-relationships/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/finance/charter.md +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/finance/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/human-capital/charter.md +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/human-capital/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/risk-and-compliance/charter.md +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/risk-and-compliance/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/strategy/charter.md +5 -0
- package/schema/examples/workspace/ventures/northstar/governance/departments/strategy/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/knowledge/README.md +3 -0
- package/schema/examples/workspace/ventures/northstar/operations/README.md +3 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/external-relationships/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/external-relationships/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/finance/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/finance/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/human-capital/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/human-capital/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/risk-and-compliance/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/risk-and-compliance/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/strategy/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/operations/departments/strategy/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/people/founders/ana-ruiz.json +13 -0
- package/schema/examples/workspace/ventures/northstar/people/founders/ben-okafor.json +7 -0
- package/schema/examples/workspace/ventures/northstar/people/people.json +27 -0
- package/schema/examples/workspace/ventures/northstar/pillars/brand.md +5 -0
- package/schema/examples/workspace/ventures/northstar/pillars/business.md +5 -0
- package/schema/examples/workspace/ventures/northstar/pillars/product.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/AGENTS.md +17 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/accounts/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/decisions/venture.team.decision.json +31 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/knowledge/README.md +3 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/customer-service/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/customer-service/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/finance/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/finance/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/human-capital/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/human-capital/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/it/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/it/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/marketing-and-sales/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/marketing-and-sales/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/products/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/products/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/strategy/README.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/operations/departments/strategy/department.json +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/pillars/brand.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/pillars/business.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/pillars/product.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/decisions/product.core-product.decision.json +28 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/decisions/product.exists.decision.json +32 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/products/decisions/product.flagship.decision.json +27 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/profile.md +5 -0
- package/schema/examples/workspace/ventures/northstar/portfolio/kilnworks/venture.json +27 -0
- package/schema/examples/workspace/ventures/northstar/products/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/northstar/profile.md +5 -0
- package/schema/examples/workspace/ventures/northstar/provenance.jsonl +3 -0
- package/schema/examples/workspace/ventures/northstar/purpose/README.md +3 -0
- package/schema/examples/workspace/ventures/northstar/venture.json +49 -0
- package/schema/examples/workspace/ventures/studio/accounts/bakery/account.json +18 -0
- package/schema/examples/workspace/ventures/studio/evidence/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/governance/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/knowledge/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/operations/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/print/knowledge/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/print/purpose/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/print/venture.json +37 -0
- package/schema/examples/workspace/ventures/studio/products/brand-care.json +19 -0
- package/schema/examples/workspace/ventures/studio/products/brand-kit.json +23 -0
- package/schema/examples/workspace/ventures/studio/provenance.jsonl +3 -0
- package/schema/examples/workspace/ventures/studio/purpose/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/studio/venture.json +43 -0
- package/schema/examples/workspace/ventures/tandem/accounts/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/tandem/evidence/README.md +3 -0
- package/schema/examples/workspace/ventures/tandem/governance/README.md +3 -0
- package/schema/examples/workspace/ventures/tandem/governance/agreements/dee-fast.md +3 -0
- package/schema/examples/workspace/ventures/tandem/governance/board.json +51 -0
- package/schema/examples/workspace/ventures/tandem/governance/departments/finance/charter.md +5 -0
- package/schema/examples/workspace/ventures/tandem/governance/departments/finance/department.json +5 -0
- package/schema/examples/workspace/ventures/tandem/governance/departments/primary/marketing-and-sales/charter.md +5 -0
- package/schema/examples/workspace/ventures/tandem/governance/departments/primary/marketing-and-sales/department.json +5 -0
- package/schema/examples/workspace/ventures/tandem/governance/exit.json +33 -0
- package/schema/examples/workspace/ventures/tandem/governance/founder-agreement.json +24 -0
- package/schema/examples/workspace/ventures/tandem/governance/founder-agreement.md +3 -0
- package/schema/examples/workspace/ventures/tandem/governance/ownership.json +131 -0
- package/schema/examples/workspace/ventures/tandem/governance/publication-policy.json +171 -0
- package/schema/examples/workspace/ventures/tandem/knowledge/README.md +3 -0
- package/schema/examples/workspace/ventures/tandem/knowledge/research/friends-feedback-2026-08.md +3 -0
- package/schema/examples/workspace/ventures/tandem/knowledge/research/pilot-2026-10.md +3 -0
- package/schema/examples/workspace/ventures/tandem/knowledge/research/problem-interviews-2026-09.md +20 -0
- package/schema/examples/workspace/ventures/tandem/knowledge/sources.json +8 -0
- package/schema/examples/workspace/ventures/tandem/knowledge/where-used.json +13 -0
- package/schema/examples/workspace/ventures/tandem/operations/README.md +3 -0
- package/schema/examples/workspace/ventures/tandem/operations/departments/finance/README.md +5 -0
- package/schema/examples/workspace/ventures/tandem/operations/departments/finance/department.json +5 -0
- package/schema/examples/workspace/ventures/tandem/operations/departments/primary/marketing-and-sales/README.md +5 -0
- package/schema/examples/workspace/ventures/tandem/operations/departments/primary/marketing-and-sales/department.json +5 -0
- package/schema/examples/workspace/ventures/tandem/pillars/brand.md +5 -0
- package/schema/examples/workspace/ventures/tandem/pillars/business.md +5 -0
- package/schema/examples/workspace/ventures/tandem/pillars/product.md +5 -0
- package/schema/examples/workspace/ventures/tandem/products/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/tandem/products/shop-app.json +22 -0
- package/schema/examples/workspace/ventures/tandem/profile.md +5 -0
- package/schema/examples/workspace/ventures/tandem/provenance.jsonl +13 -0
- package/schema/examples/workspace/ventures/tandem/purpose/README.md +3 -0
- package/schema/examples/workspace/ventures/tandem/purpose/telos.json +78 -0
- package/schema/examples/workspace/ventures/tandem/purpose/validation/go-to-market.json +35 -0
- package/schema/examples/workspace/ventures/tandem/purpose/validation/pricing.json +37 -0
- package/schema/examples/workspace/ventures/tandem/purpose/validation/problem.json +74 -0
- package/schema/examples/workspace/ventures/tandem/purpose/validation/product-market-fit.json +66 -0
- package/schema/examples/workspace/ventures/tandem/purpose/validation/solution.json +33 -0
- package/schema/examples/workspace/ventures/tandem/purpose/validation/team.json +52 -0
- package/schema/examples/workspace/ventures/tandem/venture.json +79 -0
- package/schema/examples/workspace/ventures/woodworking/knowledge/.gitkeep +0 -0
- package/schema/examples/workspace/ventures/woodworking/venture.json +21 -0
- package/schema/examples/workspace/workspace.json +8 -0
- package/schema/exit.schema.json +74 -0
- package/schema/foundation.mjs +118 -0
- package/schema/founder-agreement.schema.json +83 -0
- package/schema/founder.schema.json +72 -0
- package/schema/frame.schema.json +240 -0
- package/schema/frames.mjs +228 -0
- package/schema/freshness-log.schema.json +40 -0
- package/schema/freshness-profiles.schema.json +44 -0
- package/schema/freshness.mjs +473 -0
- package/schema/fund-terms.schema.json +107 -0
- package/schema/fund-thesis.schema.json +87 -0
- package/schema/gate-drafts.mjs +130 -0
- package/schema/gate.mjs +133 -0
- package/schema/glossary.schema.json +25 -0
- package/schema/handoff.schema.json +239 -0
- package/schema/icp.schema.json +136 -0
- package/schema/idea-graph.schema.json +61 -0
- package/schema/init-venture.mjs +128 -0
- package/schema/integration.schema.json +143 -0
- package/schema/judgment.schema.json +38 -0
- package/schema/kit.schema.json +47 -0
- package/schema/kits.mjs +24 -0
- package/schema/knowledge-sources.schema.json +260 -0
- package/schema/layer.json +59 -0
- package/schema/layer.schema.json +119 -0
- package/schema/load-packages.mjs +26 -0
- package/schema/marketing-brand.schema.json +116 -0
- package/schema/marketing-sitemap.schema.json +232 -0
- package/schema/migrate-venture.mjs +192 -0
- package/schema/migrations/kit-to-package.mjs +94 -0
- package/schema/migrations/package-layout.mjs +86 -0
- package/schema/model-steps.mjs +717 -0
- package/schema/money-summary.schema.json +138 -0
- package/schema/naive-config.mjs +165 -0
- package/schema/naive-config.schema.json +268 -0
- package/schema/need-now.json +772 -0
- package/schema/need-now.mjs +108 -0
- package/schema/nextjs-status.schema.json +29 -0
- package/schema/ownership.schema.json +282 -0
- package/schema/packages.json +4 -0
- package/schema/packages.mjs +252 -0
- package/schema/payouts.mjs +91 -0
- package/schema/people.schema.json +86 -0
- package/schema/port-venture.mjs +161 -0
- package/schema/product.schema.json +223 -0
- package/schema/provenance-entry.schema.json +154 -0
- package/schema/public-assets.schema.json +76 -0
- package/schema/publication-policy.schema.json +293 -0
- package/schema/raw-source.schema.json +15 -0
- package/schema/reference.schema.json +115 -0
- package/schema/release-read.mjs +111 -0
- package/schema/releases.mjs +497 -0
- package/schema/route-aliases.schema.json +25 -0
- package/schema/run-handoff.mjs +51 -0
- package/schema/scaffold/defaults.json +54 -0
- package/schema/setup.mjs +164 -0
- package/schema/site-presence.schema.json +337 -0
- package/schema/stale.mjs +111 -0
- package/schema/start-release.mjs +41 -0
- package/schema/strategic-foundation.schema.json +74 -0
- package/schema/stream.schema.json +14 -0
- package/schema/structure.mjs +186 -0
- package/schema/systems-catalog.json +126 -0
- package/schema/systems-catalog.schema.json +78 -0
- package/schema/team-plan.schema.json +157 -0
- package/schema/telos.schema.json +197 -0
- package/schema/time-to-ready.mjs +93 -0
- package/schema/trigger.schema.json +44 -0
- package/schema/triggers.mjs +237 -0
- package/schema/upgrade-registry.schema.json +60 -0
- package/schema/upgrade-venture.mjs +107 -0
- package/schema/upgrades.json +69 -0
- package/schema/upgrades.mjs +385 -0
- package/schema/use-model.mjs +10 -0
- package/schema/validate.py +58 -0
- package/schema/validation-evidence.schema.json +123 -0
- package/schema/validation-go-to-market.schema.json +110 -0
- package/schema/validation-operations-readiness.schema.json +91 -0
- package/schema/validation-pricing.schema.json +114 -0
- package/schema/validation-problem.schema.json +118 -0
- package/schema/validation-product-market-fit.schema.json +135 -0
- package/schema/validation-solution.schema.json +79 -0
- package/schema/validation-team.schema.json +116 -0
- package/schema/venture-role.schema.json +64 -0
- package/schema/venture-type.mjs +62 -0
- package/schema/venture-types.json +346 -0
- package/schema/venture-types.schema.json +129 -0
- package/schema/venture.schema.json +460 -0
- package/schema/vocab/business-models.json +298 -0
- package/schema/where-used.schema.json +56 -0
- package/schema/workspace.schema.json +38 -0
package/schema/setup.mjs
ADDED
|
@@ -0,0 +1,164 @@
|
|
|
1
|
+
// Setup (EE-083): the questions that establish a venture's structure, in order: its people and their
|
|
2
|
+
// hats, where each function keeps its truth, the strategic foundation and the first decisions (the decision
|
|
3
|
+
// docket), and a goal for the discovery phase. It holds no view. The naive-setup skill
|
|
4
|
+
// (interface/skills/naive-setup) renders it in the model's harness, as a Claude artifact where there is one;
|
|
5
|
+
// interface/dev/setup.mjs serves the same state to a browser.
|
|
6
|
+
//
|
|
7
|
+
// node schema/setup.mjs <venture dir> state the state, as JSON
|
|
8
|
+
// node schema/setup.mjs <venture dir> artifact the state rendered into the skill's artifact template
|
|
9
|
+
// node schema/setup.mjs <venture dir> answer <decision id> <the founder's words> [--via mcp]
|
|
10
|
+
// node schema/setup.mjs <venture dir> point <function> <system> [address] [--via mcp]
|
|
11
|
+
// node schema/setup.mjs <venture dir> confirm [--yes] confirm the answers the model relayed, as the founder
|
|
12
|
+
|
|
13
|
+
import { spawnSync } from "node:child_process";
|
|
14
|
+
import { existsSync, readFileSync } from "node:fs";
|
|
15
|
+
import { basename, dirname, join, resolve } from "node:path";
|
|
16
|
+
|
|
17
|
+
const repo = new URL("..", import.meta.url).pathname;
|
|
18
|
+
const load = (p) => JSON.parse(readFileSync(p, "utf8"));
|
|
19
|
+
export const TEMPLATE = "interface/skills/naive-setup/artifact.html";
|
|
20
|
+
|
|
21
|
+
const GOAL = "discovery-goal";
|
|
22
|
+
|
|
23
|
+
export async function state(dir) {
|
|
24
|
+
const { decisions } = await import("./decisions.mjs");
|
|
25
|
+
const v = load(join(dir, "venture.json"));
|
|
26
|
+
const people = existsSync(join(dir, "people/people.json")) ? load(join(dir, "people/people.json")) : null;
|
|
27
|
+
const sources = existsSync(join(dir, "knowledge/sources.json")) ? load(join(dir, "knowledge/sources.json")) : { sources: [], records: {} };
|
|
28
|
+
const catalog = load(join(repo, "schema/systems-catalog.json"));
|
|
29
|
+
const types = load(join(repo, "schema/venture-types.json")).types;
|
|
30
|
+
const all = decisions(dir).decisions;
|
|
31
|
+
// The roots (venture, foundation) structure the docket; they are not questions to answer here.
|
|
32
|
+
const docket = all.filter((d) => d.id !== GOAL && d.status !== "deferred" && !["venture", "foundation"].includes(d.id));
|
|
33
|
+
const now = docket.filter((d) => d.render === "now" || d.status === "decided");
|
|
34
|
+
const goal = all.find((d) => d.id === GOAL) ?? null;
|
|
35
|
+
const settled = now.filter((d) => d.status === "decided").length;
|
|
36
|
+
const pointed = Object.values(sources.functions ?? {}).filter((f) => f.systems.length).length;
|
|
37
|
+
const steps = { venture: true, people: !!people, truth: pointed > 0, docket: now.length > 0 && settled === now.length, goal: goal?.status === "decided" };
|
|
38
|
+
return {
|
|
39
|
+
venture: { id: v.id, name: v.name, phase: v.phase, type: types.find((t) => t.id === v.type) ?? null },
|
|
40
|
+
people, functions: sources.functions ?? {}, truth: sources.truth ?? "local",
|
|
41
|
+
catalog, docket: now.map((d) => ({ id: d.id, question: d.question, source: d.source, status: d.status, options: d.options ?? [], answer: d.answer ?? null, why: d.why ?? [], statement: d.statement ?? null, relayed: relayed(d) })),
|
|
42
|
+
// Answers the model wrote down from the founder's words; they wait for the founder to confirm them.
|
|
43
|
+
waiting: [...now, ...(goal ? [goal] : [])].filter(relayed).map((d) => ({ id: d.id, question: d.question, answer: d.answer })),
|
|
44
|
+
later: docket.filter((d) => d.render !== "now" && d.status !== "decided").length,
|
|
45
|
+
goal: goal ? { status: goal.status, answer: goal.answer ?? null, relayed: relayed(goal) } : null,
|
|
46
|
+
steps, done: Object.values(steps).every(Boolean), counts: { settled, of: now.length },
|
|
47
|
+
rho: existsSync(join(repo, "platform/integrations/rho.mjs")),
|
|
48
|
+
};
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
// An open decision whose wording an agent wrote: in setup, the founder's words the model relayed.
|
|
52
|
+
const relayed = (d) => d.status !== "decided" && !!d.answer && d.provenance?.drafted_by?.kind === "agent";
|
|
53
|
+
|
|
54
|
+
const founderName = (dir) => existsSync(join(dir, "people/people.json")) ? load(join(dir, "people/people.json")).people[0]?.name ?? "Founder" : "Founder";
|
|
55
|
+
|
|
56
|
+
// One answer: a decision on file is approved; a foundation statement (or the goal) becomes a decision a person approves.
|
|
57
|
+
export async function decide(dir, { id, answer, via = "api", where = "/setup" }) {
|
|
58
|
+
const { approve, decisions, propose } = await import("./decisions.mjs");
|
|
59
|
+
if (!answer || !String(answer).trim()) return { ok: false, error: "write an answer first" };
|
|
60
|
+
const by = founderName(dir);
|
|
61
|
+
const d = decisions(dir).decisions.find((x) => x.id === id);
|
|
62
|
+
if (id === GOAL && !d) {
|
|
63
|
+
const p = propose(dir, { id: GOAL, question: "What must be true for the venture to leave discovery? Name the goal this phase works toward.", decides: { record: "telos", path: "foundation/telos.json" }, layer: "purpose", needed_in: "discovery", boundary: "fail-open" }, { via });
|
|
64
|
+
if (!p.ok) return p;
|
|
65
|
+
return approve(dir, GOAL, { by, answer: String(answer).trim(), via, note: `set at ${where}` });
|
|
66
|
+
}
|
|
67
|
+
if (!d) return { ok: false, error: `no decision ${id}` };
|
|
68
|
+
if (d.source === "foundation") {
|
|
69
|
+
const sid = id.replace(/^foundation-/, "");
|
|
70
|
+
const did = `statement-${sid}`;
|
|
71
|
+
const p = propose(dir, { id: did, question: d.question, statement: sid, decides: d.decides, layer: d.layer === "system" ? "purpose" : d.layer, needed_in: d.needed_in }, { via });
|
|
72
|
+
if (!p.ok) return p;
|
|
73
|
+
return approve(dir, did, { by, answer: String(answer).trim(), via, note: `the founder's words at ${where}` });
|
|
74
|
+
}
|
|
75
|
+
return approve(dir, id, { by, answer: String(answer).trim(), via, note: `decided at ${where}` });
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
// One pointer: where a function keeps its truth, merged into knowledge/sources.json through the router.
|
|
79
|
+
export async function point(dir, { fn, system, address, via = "api", actor = "person", agentId }) {
|
|
80
|
+
const catalog = load(join(repo, "schema/systems-catalog.json"));
|
|
81
|
+
if (!catalog.functions[fn]?.includes(system)) return { ok: false, error: `${system} is not offered for ${fn}` };
|
|
82
|
+
const file = join(dir, "knowledge/sources.json");
|
|
83
|
+
const map = existsSync(file) ? load(file) : { sources: [], records: {}, truth: "local" };
|
|
84
|
+
const f = (map.functions ??= {})[fn] ??= { systems: [] };
|
|
85
|
+
const entry = { system, ...(address ? { address } : {}), status: "pointed" };
|
|
86
|
+
if (system === "rho" && existsSync(join(repo, "platform/integrations/rho.mjs"))) {
|
|
87
|
+
const live = Boolean(process.env.RHO_API_TOKEN);
|
|
88
|
+
const r = spawnSync("node", [join(repo, "platform/integrations/rho.mjs"), "sync", "--venture", dir, ...(live ? ["--live"] : [])], { encoding: "utf8", env: process.env });
|
|
89
|
+
if (r.status === 0) Object.assign(entry, { status: "connected", synced: new Date().toISOString().replace(/\.\d+Z$/, "Z"), address: address || (live ? "live" : "sandbox") });
|
|
90
|
+
}
|
|
91
|
+
f.systems = [...f.systems.filter((s) => s.system !== system), entry];
|
|
92
|
+
const { call } = await import("../interface/router.mjs");
|
|
93
|
+
const r = await call({ workspace: dirname(dir), venture: basename(dir), route: "knowledge/knowledge-sources", action: "write", input: map, actor, ...(agentId ? { actor_id: agentId } : {}), via, provenance: { note: `${fn}: ${system}${address ? ` at ${address}` : ""} (${entry.status})` } });
|
|
94
|
+
return r.ok ? { ok: true, result: entry } : r;
|
|
95
|
+
}
|
|
96
|
+
|
|
97
|
+
/** The model relays the founder's answer: proposed with the founder's words as its wording, by an agent,
|
|
98
|
+
* so it stays open until the founder confirms it (an agent never decides, EE-058). */
|
|
99
|
+
export async function relay(dir, { id, answer, agentId, harness, model }) {
|
|
100
|
+
const { decisions, propose } = await import("./decisions.mjs");
|
|
101
|
+
if (!answer || !String(answer).trim()) return { ok: false, error: "pass the founder's answer, in their words" };
|
|
102
|
+
const words = String(answer).trim();
|
|
103
|
+
const note = `the founder's words, relayed from ${harness ?? "the model's harness"} during setup`;
|
|
104
|
+
const opts = { agentId, via: "mcp", harness, model };
|
|
105
|
+
const d = decisions(dir).decisions.find((x) => x.id === id);
|
|
106
|
+
if (id === GOAL) return propose(dir, { ...(d ? {} : { decides: { record: "telos", path: "foundation/telos.json" }, layer: "purpose", needed_in: "discovery", boundary: "fail-open" }), id: GOAL, question: d?.question ?? "What must be true for the venture to leave discovery? Name the goal this phase works toward.", answer: words, note }, opts);
|
|
107
|
+
if (!d) return { ok: false, error: `no decision ${id}` };
|
|
108
|
+
if (d.status === "decided") return { ok: false, error: `${id} is decided; only the founder can change it` };
|
|
109
|
+
if (d.source === "foundation") {
|
|
110
|
+
const sid = id.replace(/^foundation-/, "");
|
|
111
|
+
return propose(dir, { id: `statement-${sid}`, question: d.question, statement: sid, decides: d.decides, layer: d.layer === "system" ? "purpose" : d.layer, needed_in: d.needed_in, answer: words, note }, opts);
|
|
112
|
+
}
|
|
113
|
+
return propose(dir, { id, question: d.question, answer: words, note }, opts);
|
|
114
|
+
}
|
|
115
|
+
|
|
116
|
+
/** The founder confirms the answers the model relayed, at the keyboard: each becomes a decision they made. */
|
|
117
|
+
export async function confirm(dir, { by = founderName(dir) } = {}) {
|
|
118
|
+
const { approve } = await import("./decisions.mjs");
|
|
119
|
+
const out = [];
|
|
120
|
+
for (const w of (await state(dir)).waiting) {
|
|
121
|
+
const r = approve(dir, w.id, { by, via: "cli", note: `confirmed at setup: ${by}'s words, relayed by the model` });
|
|
122
|
+
if (!r.ok) return { ...r, confirmed: out };
|
|
123
|
+
out.push(w.id);
|
|
124
|
+
}
|
|
125
|
+
return { ok: true, result: { confirmed: out, by } };
|
|
126
|
+
}
|
|
127
|
+
|
|
128
|
+
/** The state rendered into the skill's artifact template: one self-contained page, no network. */
|
|
129
|
+
export async function artifact(dir) {
|
|
130
|
+
const s = await state(dir);
|
|
131
|
+
const data = JSON.stringify(s).replace(/</g, "\\u003c");
|
|
132
|
+
return readFileSync(join(repo, TEMPLATE), "utf8").replace("__NAIVE_SETUP_STATE__", () => data);
|
|
133
|
+
}
|
|
134
|
+
|
|
135
|
+
if (process.argv[1] && resolve(process.argv[1]) === new URL(import.meta.url).pathname) {
|
|
136
|
+
const [dirArg, cmd, ...rest] = process.argv.slice(2);
|
|
137
|
+
const flag = (n) => { const i = rest.indexOf(`--${n}`); if (i < 0) return undefined; const v = rest[i + 1]; rest.splice(i, 2); return v; };
|
|
138
|
+
const via = flag("via") ?? "cli";
|
|
139
|
+
if (!["cli", "mcp", "api"].includes(via)) { console.error(`--via is cli, mcp or api, not ${via}`); process.exit(2); }
|
|
140
|
+
if (!dirArg || !existsSync(join(dirArg, "venture.json"))) { console.error("usage: node schema/setup.mjs <venture dir> state|artifact|answer|point|confirm ..."); process.exit(2); }
|
|
141
|
+
const dir = resolve(dirArg);
|
|
142
|
+
let r;
|
|
143
|
+
if (cmd === "state") r = { ok: true, result: await state(dir) };
|
|
144
|
+
else if (cmd === "artifact") { process.stdout.write(await artifact(dir)); process.exit(0); }
|
|
145
|
+
else if (cmd === "answer") r = await decide(dir, { id: rest[0], answer: rest.slice(1).join(" "), via, where: via === "mcp" ? "setup in the model's harness" : "setup" });
|
|
146
|
+
else if (cmd === "confirm") {
|
|
147
|
+
const waiting = (await state(dir)).waiting;
|
|
148
|
+
if (!waiting.length) { console.log("Nothing waits for you to confirm."); process.exit(0); }
|
|
149
|
+
for (const w of waiting) console.log(`\n ${w.question}\n > ${w.answer}`);
|
|
150
|
+
let yes = rest.includes("--yes");
|
|
151
|
+
if (!yes) {
|
|
152
|
+
const { createInterface } = await import("node:readline/promises");
|
|
153
|
+
const rl = createInterface({ input: process.stdin, output: process.stdout });
|
|
154
|
+
yes = (await rl.question(`\nAre these ${waiting.length} answers yours, as written? Type yes to confirm them: `)).trim().toLowerCase() === "yes";
|
|
155
|
+
rl.close();
|
|
156
|
+
}
|
|
157
|
+
if (!yes) { console.log("Nothing confirmed. Change an answer in the chat, or run this again."); process.exit(1); }
|
|
158
|
+
r = await confirm(dir);
|
|
159
|
+
}
|
|
160
|
+
else if (cmd === "point") r = await point(dir, { fn: rest[0], system: rest[1], address: rest[2], via });
|
|
161
|
+
else { console.error(`unknown command ${cmd}: state, artifact, answer, point or confirm`); process.exit(2); }
|
|
162
|
+
console.log(JSON.stringify(r.ok && cmd === "state" ? r.result : r, null, 2));
|
|
163
|
+
process.exit(r.ok ? 0 : 1);
|
|
164
|
+
}
|
|
@@ -0,0 +1,337 @@
|
|
|
1
|
+
{
|
|
2
|
+
"$schema": "https://json-schema.org/draft/2020-12/schema",
|
|
3
|
+
"$id": "site-presence.schema.json",
|
|
4
|
+
"title": "Site presence",
|
|
5
|
+
"description": "How present a venture's public records are on its marketing site, weighed by who the site must speak to now (EE-062, EE-063). Written by operations/marketing/site/presence.mjs from a read of the site; version 0.x, ours and unevaluated.",
|
|
6
|
+
"type": "object",
|
|
7
|
+
"required": [
|
|
8
|
+
"version",
|
|
9
|
+
"site",
|
|
10
|
+
"judged_by",
|
|
11
|
+
"facts",
|
|
12
|
+
"score",
|
|
13
|
+
"audiences",
|
|
14
|
+
"pages",
|
|
15
|
+
"items",
|
|
16
|
+
"fix_first",
|
|
17
|
+
"icp",
|
|
18
|
+
"sitemap"
|
|
19
|
+
],
|
|
20
|
+
"properties": {
|
|
21
|
+
"version": {
|
|
22
|
+
"type": "string"
|
|
23
|
+
},
|
|
24
|
+
"site": {
|
|
25
|
+
"type": "string"
|
|
26
|
+
},
|
|
27
|
+
"venture": {
|
|
28
|
+
"type": [
|
|
29
|
+
"string",
|
|
30
|
+
"null"
|
|
31
|
+
]
|
|
32
|
+
},
|
|
33
|
+
"read_via": {
|
|
34
|
+
"enum": [
|
|
35
|
+
"firecrawl",
|
|
36
|
+
"fetch"
|
|
37
|
+
]
|
|
38
|
+
},
|
|
39
|
+
"read_at": {
|
|
40
|
+
"type": "string"
|
|
41
|
+
},
|
|
42
|
+
"judged_by": {
|
|
43
|
+
"enum": [
|
|
44
|
+
"jev",
|
|
45
|
+
"keywords"
|
|
46
|
+
]
|
|
47
|
+
},
|
|
48
|
+
"facts": {
|
|
49
|
+
"type": "object"
|
|
50
|
+
},
|
|
51
|
+
"score": {
|
|
52
|
+
"type": "integer",
|
|
53
|
+
"minimum": 0,
|
|
54
|
+
"maximum": 100
|
|
55
|
+
},
|
|
56
|
+
"audiences": {
|
|
57
|
+
"type": "object",
|
|
58
|
+
"additionalProperties": {
|
|
59
|
+
"type": "object",
|
|
60
|
+
"required": [
|
|
61
|
+
"weight"
|
|
62
|
+
],
|
|
63
|
+
"properties": {
|
|
64
|
+
"weight": {
|
|
65
|
+
"type": "number"
|
|
66
|
+
},
|
|
67
|
+
"score": {
|
|
68
|
+
"type": [
|
|
69
|
+
"integer",
|
|
70
|
+
"null"
|
|
71
|
+
]
|
|
72
|
+
}
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
},
|
|
76
|
+
"pages": {
|
|
77
|
+
"type": "array",
|
|
78
|
+
"items": {
|
|
79
|
+
"type": "object",
|
|
80
|
+
"required": [
|
|
81
|
+
"path",
|
|
82
|
+
"type",
|
|
83
|
+
"level"
|
|
84
|
+
],
|
|
85
|
+
"properties": {
|
|
86
|
+
"path": {
|
|
87
|
+
"type": "string"
|
|
88
|
+
},
|
|
89
|
+
"title": {
|
|
90
|
+
"type": "string"
|
|
91
|
+
},
|
|
92
|
+
"type": {
|
|
93
|
+
"type": "string"
|
|
94
|
+
},
|
|
95
|
+
"level": {
|
|
96
|
+
"enum": [
|
|
97
|
+
"home",
|
|
98
|
+
"nav",
|
|
99
|
+
"linked",
|
|
100
|
+
"anywhere"
|
|
101
|
+
]
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
"items": {
|
|
107
|
+
"type": "array",
|
|
108
|
+
"items": {
|
|
109
|
+
"type": "object",
|
|
110
|
+
"required": [
|
|
111
|
+
"id",
|
|
112
|
+
"label",
|
|
113
|
+
"record",
|
|
114
|
+
"need",
|
|
115
|
+
"required",
|
|
116
|
+
"score",
|
|
117
|
+
"note"
|
|
118
|
+
],
|
|
119
|
+
"properties": {
|
|
120
|
+
"id": {
|
|
121
|
+
"type": "string"
|
|
122
|
+
},
|
|
123
|
+
"label": {
|
|
124
|
+
"type": "string"
|
|
125
|
+
},
|
|
126
|
+
"record": {
|
|
127
|
+
"type": "string"
|
|
128
|
+
},
|
|
129
|
+
"need": {
|
|
130
|
+
"type": "number"
|
|
131
|
+
},
|
|
132
|
+
"required": {
|
|
133
|
+
"enum": [
|
|
134
|
+
"home",
|
|
135
|
+
"nav",
|
|
136
|
+
"linked",
|
|
137
|
+
"anywhere"
|
|
138
|
+
]
|
|
139
|
+
},
|
|
140
|
+
"for": {
|
|
141
|
+
"type": "array",
|
|
142
|
+
"items": {
|
|
143
|
+
"type": "string"
|
|
144
|
+
}
|
|
145
|
+
},
|
|
146
|
+
"at": {
|
|
147
|
+
"enum": [
|
|
148
|
+
"home",
|
|
149
|
+
"nav",
|
|
150
|
+
"linked",
|
|
151
|
+
"anywhere",
|
|
152
|
+
null
|
|
153
|
+
]
|
|
154
|
+
},
|
|
155
|
+
"score": {
|
|
156
|
+
"enum": [
|
|
157
|
+
0,
|
|
158
|
+
0.5,
|
|
159
|
+
1
|
|
160
|
+
]
|
|
161
|
+
},
|
|
162
|
+
"found": {
|
|
163
|
+
"type": "array"
|
|
164
|
+
},
|
|
165
|
+
"note": {
|
|
166
|
+
"type": "string"
|
|
167
|
+
},
|
|
168
|
+
"evidence": {
|
|
169
|
+
"type": "array",
|
|
170
|
+
"description": "Who needs the item and why: each audience's weight, the item's importance to it, and the reason (for customers, from the customer types)",
|
|
171
|
+
"items": {
|
|
172
|
+
"type": "object",
|
|
173
|
+
"required": [
|
|
174
|
+
"audience",
|
|
175
|
+
"need",
|
|
176
|
+
"why",
|
|
177
|
+
"source"
|
|
178
|
+
],
|
|
179
|
+
"properties": {
|
|
180
|
+
"audience": {
|
|
181
|
+
"type": "string"
|
|
182
|
+
},
|
|
183
|
+
"weight": {
|
|
184
|
+
"type": "number"
|
|
185
|
+
},
|
|
186
|
+
"importance": {
|
|
187
|
+
"type": "number"
|
|
188
|
+
},
|
|
189
|
+
"need": {
|
|
190
|
+
"type": "number"
|
|
191
|
+
},
|
|
192
|
+
"why": {
|
|
193
|
+
"type": "string"
|
|
194
|
+
},
|
|
195
|
+
"source": {
|
|
196
|
+
"enum": [
|
|
197
|
+
"customer types",
|
|
198
|
+
"matrix"
|
|
199
|
+
]
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
}
|
|
203
|
+
}
|
|
204
|
+
}
|
|
205
|
+
}
|
|
206
|
+
},
|
|
207
|
+
"fix_first": {
|
|
208
|
+
"type": "array",
|
|
209
|
+
"items": {
|
|
210
|
+
"type": "string"
|
|
211
|
+
}
|
|
212
|
+
},
|
|
213
|
+
"icp": {
|
|
214
|
+
"type": "object",
|
|
215
|
+
"required": [
|
|
216
|
+
"text",
|
|
217
|
+
"source",
|
|
218
|
+
"cite",
|
|
219
|
+
"types"
|
|
220
|
+
],
|
|
221
|
+
"description": "Who the site is for and where that comes from: the founder's words, the venture's ICP record, or inferred from the home page; and the customer types Jev placed it in",
|
|
222
|
+
"properties": {
|
|
223
|
+
"text": {
|
|
224
|
+
"type": "string"
|
|
225
|
+
},
|
|
226
|
+
"source": {
|
|
227
|
+
"enum": [
|
|
228
|
+
"founder",
|
|
229
|
+
"record",
|
|
230
|
+
"inferred"
|
|
231
|
+
]
|
|
232
|
+
},
|
|
233
|
+
"cite": {
|
|
234
|
+
"type": "string"
|
|
235
|
+
},
|
|
236
|
+
"types": {
|
|
237
|
+
"type": "array",
|
|
238
|
+
"items": {
|
|
239
|
+
"type": "object",
|
|
240
|
+
"required": [
|
|
241
|
+
"id",
|
|
242
|
+
"label"
|
|
243
|
+
],
|
|
244
|
+
"properties": {
|
|
245
|
+
"id": {
|
|
246
|
+
"type": "string"
|
|
247
|
+
},
|
|
248
|
+
"label": {
|
|
249
|
+
"type": "string"
|
|
250
|
+
},
|
|
251
|
+
"p": {
|
|
252
|
+
"type": [
|
|
253
|
+
"number",
|
|
254
|
+
"null"
|
|
255
|
+
]
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
}
|
|
259
|
+
}
|
|
260
|
+
}
|
|
261
|
+
},
|
|
262
|
+
"sitemap": {
|
|
263
|
+
"type": "array",
|
|
264
|
+
"description": "The site's routes as a tree from the home page, each rated on the items that belong there; ghost routes are pages the venture's priorities call for that the site lacks",
|
|
265
|
+
"items": {
|
|
266
|
+
"type": "object",
|
|
267
|
+
"required": [
|
|
268
|
+
"path",
|
|
269
|
+
"parent",
|
|
270
|
+
"label",
|
|
271
|
+
"type",
|
|
272
|
+
"level",
|
|
273
|
+
"read",
|
|
274
|
+
"rating",
|
|
275
|
+
"expected",
|
|
276
|
+
"found",
|
|
277
|
+
"missing"
|
|
278
|
+
],
|
|
279
|
+
"properties": {
|
|
280
|
+
"path": {
|
|
281
|
+
"type": "string"
|
|
282
|
+
},
|
|
283
|
+
"parent": {
|
|
284
|
+
"type": [
|
|
285
|
+
"string",
|
|
286
|
+
"null"
|
|
287
|
+
]
|
|
288
|
+
},
|
|
289
|
+
"label": {
|
|
290
|
+
"type": "string"
|
|
291
|
+
},
|
|
292
|
+
"type": {
|
|
293
|
+
"type": "string"
|
|
294
|
+
},
|
|
295
|
+
"level": {
|
|
296
|
+
"enum": [
|
|
297
|
+
"home",
|
|
298
|
+
"nav",
|
|
299
|
+
"linked",
|
|
300
|
+
"anywhere"
|
|
301
|
+
]
|
|
302
|
+
},
|
|
303
|
+
"read": {
|
|
304
|
+
"type": "boolean"
|
|
305
|
+
},
|
|
306
|
+
"rating": {
|
|
307
|
+
"type": [
|
|
308
|
+
"integer",
|
|
309
|
+
"null"
|
|
310
|
+
]
|
|
311
|
+
},
|
|
312
|
+
"expected": {
|
|
313
|
+
"type": "array",
|
|
314
|
+
"items": {
|
|
315
|
+
"type": "string"
|
|
316
|
+
}
|
|
317
|
+
},
|
|
318
|
+
"found": {
|
|
319
|
+
"type": "array",
|
|
320
|
+
"items": {
|
|
321
|
+
"type": "string"
|
|
322
|
+
}
|
|
323
|
+
},
|
|
324
|
+
"missing": {
|
|
325
|
+
"type": "array",
|
|
326
|
+
"items": {
|
|
327
|
+
"type": "string"
|
|
328
|
+
}
|
|
329
|
+
},
|
|
330
|
+
"ghost": {
|
|
331
|
+
"type": "boolean"
|
|
332
|
+
}
|
|
333
|
+
}
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
}
|
package/schema/stale.mjs
ADDED
|
@@ -0,0 +1,111 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// Stale summaries (V-9). In Next.js, content from a CMS is cached for a long time, and the CMS calls a
|
|
3
|
+
// webhook that revalidates its tag when the content changes. In Naive a system of record (a CRM, a bank
|
|
4
|
+
// such as Rho) notifies the venture that something it holds changed, and every summary that reads it is
|
|
5
|
+
// marked stale until it is written again. What reads what is already recorded:
|
|
6
|
+
//
|
|
7
|
+
// - provenance: a record whose latest write was derived from the changed item (derived_from names its
|
|
8
|
+
// path or its <source>://<path> address, or a folder that holds it) reads it;
|
|
9
|
+
// - the where-used list (knowledge/where-used.json, V-4): every child of a fact whose parent route is
|
|
10
|
+
// the changed record repeats it.
|
|
11
|
+
//
|
|
12
|
+
// Receiving the notification over the network is the platform's (platform/webhooks/server.mjs); this is
|
|
13
|
+
// the framework part, offline: notify() marks, staleOf() answers for one file (the router adds it to a
|
|
14
|
+
// read), and a summary is fresh again once it is written after the mark. Marks live in
|
|
15
|
+
// <venture>/.naive/stale.json, never in the records.
|
|
16
|
+
//
|
|
17
|
+
// node schema/stale.mjs <venture dir> [--json] what is stale now
|
|
18
|
+
// node schema/stale.mjs <venture dir> --notify --source <id> --path <p> [--path <q>] [--version <v>]
|
|
19
|
+
|
|
20
|
+
import { existsSync, mkdirSync, readFileSync, writeFileSync } from "node:fs";
|
|
21
|
+
import { join } from "node:path";
|
|
22
|
+
import { entries } from "../interface/provenance.mjs";
|
|
23
|
+
import { resolve as resolveRoute } from "../interface/router.mjs";
|
|
24
|
+
import { address } from "../knowledge/connectors/contract.mjs";
|
|
25
|
+
import { LOCAL, sourcesOf } from "../knowledge/connectors/index.mjs";
|
|
26
|
+
|
|
27
|
+
export const MARKS = ".naive/stale.json";
|
|
28
|
+
const load = (p) => JSON.parse(readFileSync(p, "utf8"));
|
|
29
|
+
const now = () => new Date().toISOString();
|
|
30
|
+
const WRITES = new Set(["write", "accept", "baseline"]);
|
|
31
|
+
|
|
32
|
+
const readMarks = (dir) => (existsSync(join(dir, MARKS)) ? load(join(dir, MARKS)) : { marks: [] });
|
|
33
|
+
|
|
34
|
+
// The latest write of each file in the log.
|
|
35
|
+
function lastWrites(dir) {
|
|
36
|
+
const last = new Map();
|
|
37
|
+
for (const e of entries(dir)) if (WRITES.has(e.activity) && !e.source) last.set(e.entity, e);
|
|
38
|
+
return last;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const covers = (d, item) => d === item || (d.endsWith("/") ? item.startsWith(d) : item.startsWith(`${d}/`));
|
|
42
|
+
|
|
43
|
+
/**
|
|
44
|
+
* A system of record says items changed. Marks every summary that reads them stale and returns what it
|
|
45
|
+
* marked. source: a source id from knowledge/sources.json (venture for the venture's own folder);
|
|
46
|
+
* paths: the changed items, as paths inside that source.
|
|
47
|
+
*/
|
|
48
|
+
export function notify(dir, { source, paths, version, at = now(), via = "framework" }) {
|
|
49
|
+
const map = sourcesOf(dir);
|
|
50
|
+
if (!source || !map.sources.some((s) => s.id === source)) throw new Error(`no source ${source} in ${dir}'s knowledge/sources.json: one of ${map.sources.map((s) => s.id).join(", ")}`);
|
|
51
|
+
paths = [paths].flat().filter(Boolean);
|
|
52
|
+
if (!paths.length) throw new Error("a notification names at least one changed path");
|
|
53
|
+
// The changed items as the venture refers to them: the address always, and the bare path for its own folder
|
|
54
|
+
// or for a source whose records the venture keeps a local copy of at the same path.
|
|
55
|
+
const items = paths.flatMap((p) => [address(source, p), ...(source === LOCAL || existsSync(join(dir, p)) ? [p] : [])]);
|
|
56
|
+
const readers = new Map();
|
|
57
|
+
for (const [file, e] of lastWrites(dir)) {
|
|
58
|
+
if (items.includes(file)) continue;
|
|
59
|
+
const hit = (e.derived_from ?? []).find((d) => items.some((i) => covers(d, i)));
|
|
60
|
+
if (hit) readers.set(file, { via: "provenance", reads: hit });
|
|
61
|
+
}
|
|
62
|
+
const wu = join(dir, "knowledge/where-used.json");
|
|
63
|
+
if (existsSync(wu)) {
|
|
64
|
+
for (const fact of load(wu).facts ?? []) {
|
|
65
|
+
const { r, params } = resolveRoute(fact.parent.route);
|
|
66
|
+
if (!r || r.kind !== "record") continue;
|
|
67
|
+
const files = (r.collection === "item" ? r.files.map((f) => f.replace("*", params.id)) : r.files).filter((f) => !f.includes("*"));
|
|
68
|
+
if (!files.some((f) => items.includes(f) || items.includes(address(source, f)))) continue;
|
|
69
|
+
for (const c of fact.children) readers.set(c.source === LOCAL ? c.path : address(c.source, c.path), { via: "where-used", reads: fact.parent.route, fact: fact.id });
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
const state = readMarks(dir);
|
|
73
|
+
const because = { source, paths, ...(version ? { version } : {}), at, via };
|
|
74
|
+
for (const [file, how] of readers) state.marks.push({ file, ...how, because, marked_at: now() });
|
|
75
|
+
state.notifications = [...(state.notifications ?? []), { ...because, marked: readers.size, received_at: now() }].slice(-100);
|
|
76
|
+
mkdirSync(join(dir, ".naive"), { recursive: true });
|
|
77
|
+
writeFileSync(join(dir, MARKS), JSON.stringify(state, null, 2) + "\n");
|
|
78
|
+
return { source, paths, stale: [...readers.keys()].sort() };
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
/** Whether one file is stale: the marks made after its latest write, or null when it is fresh. */
|
|
82
|
+
export function staleOf(dir, file) {
|
|
83
|
+
if (!existsSync(join(dir, MARKS))) return null;
|
|
84
|
+
const written = lastWrites(dir).get(file)?.at ?? "";
|
|
85
|
+
const live = readMarks(dir).marks.filter((m) => m.file === file && m.marked_at > written);
|
|
86
|
+
return live.length ? { since: live[0].marked_at, because: live.map((m) => ({ ...m.because, reads: m.reads, via: m.via })), fix: `write ${file} again from the changed source; it is fresh once written` } : null;
|
|
87
|
+
}
|
|
88
|
+
|
|
89
|
+
/** Every stale file in the venture now. */
|
|
90
|
+
export function stale(dir) {
|
|
91
|
+
const files = [...new Set(readMarks(dir).marks.map((m) => m.file))];
|
|
92
|
+
return files.map((f) => ({ file: f, ...staleOf(dir, f) })).filter((x) => x.since).sort((a, b) => a.file.localeCompare(b.file));
|
|
93
|
+
}
|
|
94
|
+
|
|
95
|
+
if (import.meta.url === `file://${process.argv[1]}`) {
|
|
96
|
+
const a = process.argv.slice(2);
|
|
97
|
+
const dir = a[0];
|
|
98
|
+
const all = (n) => a.flatMap((x, i) => (x === `--${n}` ? [a[i + 1]] : []));
|
|
99
|
+
if (!dir || !existsSync(join(dir, "venture.json"))) { console.error("usage: node schema/stale.mjs <venture dir> [--json] | --notify --source <id> --path <p> [--version <v>]"); process.exit(2); }
|
|
100
|
+
try {
|
|
101
|
+
if (a.includes("--notify")) {
|
|
102
|
+
const r = notify(dir, { source: all("source")[0], paths: all("path"), version: all("version")[0], via: "cli" });
|
|
103
|
+
if (a.includes("--json")) console.log(JSON.stringify(r, null, 2));
|
|
104
|
+
else console.log(r.stale.length ? `${r.stale.length} stale: ${r.stale.join(", ")}` : "nothing reads what changed, so nothing is stale");
|
|
105
|
+
} else {
|
|
106
|
+
const s = stale(dir);
|
|
107
|
+
if (a.includes("--json")) console.log(JSON.stringify(s, null, 2));
|
|
108
|
+
else console.log(s.length ? s.map((x) => `stale ${x.file} since ${x.since}: ${x.because.map((b) => `${b.source} changed ${b.paths.join(", ")}`).join("; ")}`).join("\n") : "nothing is stale");
|
|
109
|
+
}
|
|
110
|
+
} catch (e) { console.error(e.message); process.exit(1); }
|
|
111
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
#!/usr/bin/env node
|
|
2
|
+
// naive start (I-17, C-12): serves a venture's release read-only over local HTTP. No router: it reads
|
|
3
|
+
// <venture>/.release/ and nothing else (schema/release-read.mjs), as a CDN serves a static shell. It
|
|
4
|
+
// reads the manifest on each request, so an item added with build-release --add shows at once (C-18).
|
|
5
|
+
// It listens on 127.0.0.1 only. The paths are listed in schema/release-read.mjs; /card.svg is the
|
|
6
|
+
// release card drawn by the interface (interface/release-card.mjs).
|
|
7
|
+
//
|
|
8
|
+
// node schema/start-release.mjs <venture dir> [--port n] serve; --port 0 picks a free port (default 4330)
|
|
9
|
+
// node schema/start-release.mjs <venture dir> --get <path> answer one path and exit, without a server
|
|
10
|
+
|
|
11
|
+
import { existsSync } from "node:fs";
|
|
12
|
+
import { createServer } from "node:http";
|
|
13
|
+
import { join } from "node:path";
|
|
14
|
+
import { svg } from "../interface/release-card.mjs";
|
|
15
|
+
import { answer, readRelease } from "./release-read.mjs";
|
|
16
|
+
|
|
17
|
+
const args = process.argv.slice(2);
|
|
18
|
+
const opt = (n) => { const i = args.indexOf(`--${n}`); return i >= 0 ? args[i + 1] : undefined; };
|
|
19
|
+
const values = new Set(["port", "get", "now"].flatMap((n) => (opt(n) !== undefined ? [opt(n)] : [])));
|
|
20
|
+
const dir = args.find((a) => !a.startsWith("--") && !values.has(a));
|
|
21
|
+
if (!dir || !existsSync(join(dir, "venture.json"))) { console.error("usage: node schema/start-release.mjs <venture dir> [--port n] | --get <path>"); process.exit(2); }
|
|
22
|
+
if (!readRelease(dir)) { console.error(`no release in ${dir}: run node schema/build-release.mjs ${dir} first`); process.exit(1); }
|
|
23
|
+
|
|
24
|
+
if (opt("get") !== undefined) {
|
|
25
|
+
const a = answer(dir, "GET", opt("get"), { draw: svg });
|
|
26
|
+
process.stdout.write(a.body);
|
|
27
|
+
process.exit(a.status < 400 ? 0 : 1);
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
const port = opt("port") === undefined ? 4330 : Number(opt("port"));
|
|
31
|
+
if (!Number.isInteger(port) || port < 0 || port > 65535) { console.error(`--port ${opt("port")} is not a port`); process.exit(2); }
|
|
32
|
+
const server = createServer((req, res) => {
|
|
33
|
+
const a = answer(dir, req.method, req.url ?? "/", { draw: svg });
|
|
34
|
+
res.writeHead(a.status, { "content-type": a.type, "cache-control": "no-cache", ...(a.allow ? { allow: a.allow } : {}) });
|
|
35
|
+
res.end(req.method === "HEAD" ? undefined : a.body);
|
|
36
|
+
});
|
|
37
|
+
server.listen(port, "127.0.0.1", () => {
|
|
38
|
+
const m = readRelease(dir);
|
|
39
|
+
console.log(`serving release ${m.release} of ${m.venture} read-only at http://127.0.0.1:${server.address().port}/`);
|
|
40
|
+
});
|
|
41
|
+
for (const s of ["SIGINT", "SIGTERM"]) process.on(s, () => server.close(() => process.exit(0)));
|