Skip to content

Commit 00e6146

Browse files
committed
fix(create-objectstack): the blank starter wires every generator barrel
`npm create objectstack`'s blank config imported ./src/objects alone, so every `os g view|action|flow|dashboard|app|skill` scaffold was written and never loaded, and `os validate` counted 0 of them. The config now wires the seven barrels `os init` wires, in the lines `os init` renders (`exportsOf` over `export {};` barrels), and `requires` gains `triggers` beside the `automation` its connectors already needed. Claude-Session: https://claude.ai/code/session_01UYBdGBzWSrAMzpW8ah3GbP Co-authored-by: Claude <noreply@anthropic.com>
1 parent c74de10 commit 00e6146

7 files changed

Lines changed: 66 additions & 3 deletions

File tree

‎packages/create-objectstack/src/templates/blank/objectstack.config.ts‎

Lines changed: 36 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,24 @@ import { defineStack } from '@objectstack/spec';
22
import { ConnectorRestPlugin } from '@objectstack/connector-rest';
33
import { ConnectorOpenApiPlugin } from '@objectstack/connector-openapi';
44
import { ConnectorMcpPlugin } from '@objectstack/connector-mcp';
5-
import * as objects from './src/objects/index.js';
5+
import * as objects from './src/objects';
6+
import * as views from './src/views';
7+
import * as actions from './src/actions';
8+
import * as flows from './src/flows';
9+
import * as dashboards from './src/dashboards';
10+
import * as apps from './src/apps';
11+
import * as skills from './src/skills';
612

13+
// Every value a barrel exports, as the list a stack key takes: typed by what
14+
// the barrel exports, and an empty list while it exports nothing yet.
15+
const exportsOf = <M extends object>(barrel: M): M[keyof M][] => Object.values(barrel);
16+
17+
// This file is a MODULE, and the whole module is the stack: the default
18+
// export below is the base, and every NAMED export is merged onto it as a
19+
// top-level stack key under its own name. A helper exported from here is
20+
// therefore read as a stack key and the build refuses it — keep helpers in a
21+
// sibling module and import them. Only names the stack schema declares
22+
// (onEnable, functions, the collections) belong here as named exports.
723
export default defineStack({
824
manifest: {
925
id: 'com.example.blank',
@@ -27,7 +43,12 @@ export default defineStack({
2743
// connector executors below register their provider factories with it —
2844
// without `automation` loaded they have nowhere to register and boot fails,
2945
// so keep this capability whenever `plugins:` lists a connector.
30-
requires: ['automation'],
46+
//
47+
// `triggers` fires a flow that starts on a record change, the kind
48+
// `objectstack generate flow NAME` writes: without it this config stops
49+
// loading once it holds such a flow. It can go if this project will never
50+
// hold one.
51+
requires: ['automation', 'triggers'],
3152

3253
// Generic connector executors, default-present so you can add a `connectors:`
3354
// entry naming `provider: 'rest' | 'openapi' | 'mcp'` and have it materialize
@@ -43,5 +64,17 @@ export default defineStack({
4364
new ConnectorMcpPlugin(),
4465
],
4566

46-
objects: Object.values(objects),
67+
// Every directory `objectstack generate` writes into is wired here: its
68+
// index.ts exports what the directory holds, and each list below hands
69+
// those exports to the stack. `objectstack generate view NAME` adds a file
70+
// and one export line, and the view is part of this stack with no edit to
71+
// this file. A directory that is not wired here is never loaded, and
72+
// `objectstack validate` neither counts nor checks what it holds.
73+
objects: exportsOf(objects),
74+
views: exportsOf(views),
75+
actions: exportsOf(actions),
76+
flows: exportsOf(flows),
77+
dashboards: exportsOf(dashboards),
78+
apps: exportsOf(apps),
79+
skills: exportsOf(skills),
4780
});
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The actions in this directory. `objectstack generate action NAME` writes one
2+
// here and adds its export line below. objectstack.config.ts hands every
3+
// export of this file to the stack, so a action exported here is part of it,
4+
// and a action file this index does not export is never loaded.
5+
export {};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The apps in this directory. `objectstack generate app NAME` writes one
2+
// here and adds its export line below. objectstack.config.ts hands every
3+
// export of this file to the stack, so a app exported here is part of it,
4+
// and a app file this index does not export is never loaded.
5+
export {};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The dashboards in this directory. `objectstack generate dashboard NAME` writes one
2+
// here and adds its export line below. objectstack.config.ts hands every
3+
// export of this file to the stack, so a dashboard exported here is part of it,
4+
// and a dashboard file this index does not export is never loaded.
5+
export {};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The flows in this directory. `objectstack generate flow NAME` writes one
2+
// here and adds its export line below. objectstack.config.ts hands every
3+
// export of this file to the stack, so a flow exported here is part of it,
4+
// and a flow file this index does not export is never loaded.
5+
export {};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The skills in this directory. `objectstack generate skill NAME` writes one
2+
// here and adds its export line below. objectstack.config.ts hands every
3+
// export of this file to the stack, so a skill exported here is part of it,
4+
// and a skill file this index does not export is never loaded.
5+
export {};
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
// The views in this directory. `objectstack generate view NAME` writes one
2+
// here and adds its export line below. objectstack.config.ts hands every
3+
// export of this file to the stack, so a view exported here is part of it,
4+
// and a view file this index does not export is never loaded.
5+
export {};

0 commit comments

Comments
 (0)