Skip to content
Merged
11 changes: 11 additions & 0 deletions .changeset/38483-scaffold-names-articles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---
'create-objectstack': patch
'@objectstack/example-starter': patch
---

fix(create-objectstack, example-starter): the scaffold summary and the descriptions name the help articles

Clause-②: no
Metadata-protocol: none

`npm create objectstack` now lists the help articles in the "Your project starts with:" block it prints after creating a project: an Articles line beside Companies and Contacts, pointing at `src/objects/` and `src/views/` and at the sample articles in `src/data/`. The `Template: blank — …` line it prints first, the template table and the "What you get" tree in this package's README (the tree now lists `article.object.ts` and the `src/data/` seed), the blank template's description in `objectstack.config.ts` and in `objectstack.manifest.json`, and the Starter's package description (in English and in Simplified Chinese), its app description (in English and in Simplified Chinese) and its `package.json` description now read companies, contacts and help articles, with tasks and notes from the platform in the menu. A scaffolded project still drops the template's description from its own files.
16 changes: 9 additions & 7 deletions content/docs/getting-started/build-with-claude-code.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ The scaffolder does more than copy files. It:
────────────────────────────────────────
Environment: support-desk
Namespace: support_desk
Template: blank — Companies and contacts, with platform tasks and notes in the menu — ready to extend
Template: blank — Companies, contacts and help articles, with tasks and notes from the platform in the menu — ready to extend
…
→ Installing AI skills for your coding agent from @objectstack/skills@<version>...
…
Expand Down Expand Up @@ -282,10 +282,12 @@ thing to check.

What it does **not** touch is what the `blank` template scaffolded in step 1:
the companies and contacts (`src/objects/company.object.ts` and
`contact.object.ts`, seven fields each). Nothing asked for them to go, so they
stay in the project — which is why the counts below read **three** objects and
**eighteen** fields, not one and four. Delete them once the ticket object has
replaced them and the same run reports `1 Objects 4 Fields`.
`contact.object.ts`, seven fields each) and the help articles
(`article.object.ts`, four fields, with its view and sample articles). Nothing
asked for them to go, so they stay in the project — which is why the counts
below read **four** objects and **twenty-two** fields, not one and four. Delete
them once the ticket object has replaced them and the same run reports
`1 Objects 4 Fields`.

This is the same metadata that powers the REST API, the Console UI, **and the MCP
tools exposed to AI** — define it once, and ObjectStack derives the rest.
Expand Down Expand Up @@ -347,8 +349,8 @@ Once it's clean:

Support Desk v0.1.0

Data: 3 Objects 18 Fields
UI: 1 Apps 3 Views 1 Actions
Data: 4 Objects 22 Fields
UI: 1 Apps 4 Views 1 Actions
Logic: 0 Flows
Security: 0 Positions 0 Permissions
Runtime: 3 plugins
Expand Down
2 changes: 1 addition & 1 deletion content/docs/getting-started/your-first-project.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ bundle) with `--skip-skills` if you prefer — `AGENTS.md` is always written.

| Template | Source | Description |
|:---|:---|:---|
| `blank` *(default)* | bundled, works offline | Companies and contacts, with platform tasks and notes in the menu — ready to extend |
| `blank` *(default)* | bundled, works offline | Companies, contacts and help articles, with tasks and notes from the platform in the menu — ready to extend |

```bash
npm create objectstack@latest my-app -- --template blank
Expand Down
2 changes: 1 addition & 1 deletion examples/app-starter/objectstack.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineStack({
version: '0.1.0',
type: 'app',
name: 'Starter',
description: 'Companies and contacts, with the platform\'s tasks and notes in the menu.',
description: 'Companies, contacts and help articles, with the platform\'s tasks and notes in the menu.',
// Protocol major this package is authored against (ADR-0087).
engines: { protocol: '^19' },
// A starter is taken over by the organization that installs it: an
Expand Down
2 changes: 1 addition & 1 deletion examples/app-starter/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@objectstack/example-starter",
"version": "0.1.1-next.2",
"description": "Starter app: companies and their contacts, with the platform's tasks and notes in the menu",
"description": "Starter app: companies, contacts and help articles, with the platform's tasks and notes in the menu",
"license": "Apache-2.0",
"private": true,
"main": "./objectstack.config.ts",
Expand Down
6 changes: 3 additions & 3 deletions examples/app-starter/src/translations/starter.translation.ts
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ export const StarterTranslationBundle = defineTranslationBundle({
apps: {
biz_app: {
label: 'Starter',
description: 'Companies and contacts, with tasks and notes',
description: 'Companies, contacts and help articles, with tasks and notes',
},
},
},

'zh-CN': {
// The package's own name, keyed by its manifest id (objectstack#35513).
packages: {
'com.example.starter': { name: '入门示例', description: '公司与联系人,菜单中附带平台的任务和备注。' },
'com.example.starter': { name: '入门示例', description: '公司、联系人与知识文章,菜单中附带平台的任务和备注。' },
},
objects: {
biz_company: {
Expand Down Expand Up @@ -176,7 +176,7 @@ export const StarterTranslationBundle = defineTranslationBundle({
apps: {
biz_app: {
label: '起步应用',
description: '公司和联系人,以及任务和备忘',
description: '公司、联系人与知识文章,菜单中附带平台的任务和备注。',
},
},
datasets: {
Expand Down
17 changes: 10 additions & 7 deletions packages/create-objectstack/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ npx create-objectstack my-app --skip-install

| Template | Source | Description |
| --- | --- | --- |
| `blank` *(default)* | bundled (offline) | Companies and contacts, with platform tasks and notes in the menu — ready to extend |
| `blank` *(default)* | bundled (offline) | Companies, contacts and help articles, with tasks and notes from the platform in the menu — ready to extend |

`blank` is bundled inside the npm package, so scaffolding never needs network
access.
Expand Down Expand Up @@ -85,13 +85,16 @@ my-app/
├── README.md
├── AGENTS.md # conventions for coding agents
└── src/
├── objects/ # companies and contacts: the platform's
│ ├── index.ts # Starter app, as source
├── objects/ # companies, contacts and help articles:
│ ├── index.ts # the platform's Starter app, as source
│ ├── company.object.ts
│ └── contact.object.ts
├── views/ # a grid and a board for each
├── apps/main.app.ts # the menu: companies, contacts, and the
│ # platform's tasks and notes
│ ├── contact.object.ts
│ └── article.object.ts
├── views/ # a grid and a board for companies and
│ # contacts, a grid for articles
├── data/ # the seed: sample help articles
├── apps/main.app.ts # the menu: companies, contacts, articles,
│ # and the platform's tasks and notes
├── actions/index.ts # an empty barrel for each directory
├── flows/index.ts # `objectstack generate` writes into,
├── dashboards/index.ts # already wired into objectstack.config.ts
Expand Down
18 changes: 11 additions & 7 deletions packages/create-objectstack/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
*
* The template's own `manifest.description` is DROPPED from both
* objectstack.manifest.json and objectstack.config.ts rather than carried
* over unrewritten (#9263): it describes the bundled template ("Companies
* and contacts, with tasks and notes from the platform in the menu."), not the project
* over unrewritten (#9263): it describes the bundled template ("Companies,
* contacts and help articles, with tasks and notes from the platform in the menu."), not the project
* being scaffolded, and there is nothing but the project name to derive a
* replacement from — which would only restate `name`/`displayName`. `os
* validate` already omits the description line entirely when the field is
Expand Down Expand Up @@ -194,7 +194,7 @@ function rewriteProjectIdentity(
// file refuses each, and publish refuses `category` and `visibility` — the
// list is RETIRED_TEMPLATE_MANIFEST_KEYS in rewrite-identity.ts), and DROP
// .description (#9263). The template ships a generic line describing
// ITSELF ("Companies and contacts, with tasks and notes from the platform in the menu."),
// ITSELF ("Companies, contacts and help articles, with tasks and notes from the platform in the menu."),
// not the project being scaffolded, and there is nothing but the project
// name to derive a replacement from — a name-derived sentence would be a
// bare restatement of `name`/`displayName` (e.g. "Support Desk — an
Expand Down Expand Up @@ -678,12 +678,16 @@ const program = new Command()
console.log('');

// What the project holds on day one, so the first `dev` run is not a
// surprise: the bundled template's companies and contacts (the
// platform's Starter app, as source), and the platform's tasks and notes
// in its menu. `blank-template-starter-parity.test.ts` holds these lines
// to the template's tree.
// surprise: the bundled template's companies, contacts and help articles
// (the platform's Starter app, as source) with the sample articles it
// seeds, and the platform's tasks and notes in its menu.
// `blank-template-starter-parity.test.ts` holds these lines to the
// template's tree, and `scaffold-description.test.ts` holds the printed
// block to the template's object files: an object added there fails it
// until a line here names it.
console.log(chalk.bold(' Your project starts with:'));
console.log(chalk.dim(' Companies and Contacts src/objects/, with their lists in src/views/'));
console.log(chalk.dim(' Articles src/objects/ and src/views/, with sample help articles in src/data/'));
console.log(chalk.dim(" Tasks and Notes the platform's own, in the menu of src/apps/main.app.ts"));
console.log('');

Expand Down
72 changes: 67 additions & 5 deletions packages/create-objectstack/src/scaffold-description.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,20 +30,22 @@ const TSX = path.join(REPO_ROOT, 'node_modules', '.bin', 'tsx');
const INDEX_TS = path.join(PKG_ROOT, 'src', 'index.ts');

const TEMPLATE_DESCRIPTION_CONFIG =
'Companies and contacts, with tasks and notes from the platform in the menu.';
'Companies, contacts and help articles, with tasks and notes from the platform in the menu.';
const TEMPLATE_DESCRIPTION_MANIFEST =
'ObjectStack environment that starts with companies and contacts, with tasks and notes from the platform in the menu.';
'ObjectStack environment that starts with companies, contacts and help articles, with tasks and notes from the platform in the menu.';

let tmp: string;
let projectDir: string;
/** What the scaffolder printed, colour codes stripped. */
let printed: string;

beforeEach(() => {
tmp = fs.mkdtempSync(path.join(os.tmpdir(), 'create-objectstack-desc-'));
execFileSync(
printed = execFileSync(
TSX,
[INDEX_TS, 'support-desk', '--template', 'blank', '--skip-install', '--skip-skills'],
{ cwd: tmp, stdio: 'pipe' },
);
{ cwd: tmp, stdio: 'pipe', encoding: 'utf8' },
).replace(/\u001b\[[0-9;]*m/g, '');
projectDir = path.join(tmp, 'support-desk');
}, 30_000);

Expand Down Expand Up @@ -120,3 +122,63 @@ describe('scaffolded project description (#9263)', () => {
expect(messages).toEqual([]);
});
});

// The closing "Your project starts with:" block lists what a new project holds
// on day one. Its expected entries are derived from the template, not listed
// here: every object file under the template's `src/objects/` must be named by
// its plural label, and a template that seeds sample data must point at
// `src/data/`. So the next object added to the template fails this until the
// summary in index.ts names it.
describe('the scaffolder\'s closing summary names every object the template ships', () => {
const OBJECTS_DIR = path.join(PKG_ROOT, 'src', 'templates', 'blank', 'src', 'objects');
const DATA_INDEX = path.join(PKG_ROOT, 'src', 'templates', 'blank', 'src', 'data', 'index.ts');

/** The printed block: the lines after the heading, up to the first blank line. */
function summaryBlock(): string {
const lines = printed.split('\n');
const start = lines.findIndex((l) => l.trim() === 'Your project starts with:');
expect(start, 'the scaffolder no longer prints "Your project starts with:"').toBeGreaterThanOrEqual(0);
const end = lines.findIndex((l, i) => i > start && l.trim() === '');
return lines.slice(start + 1, end).join('\n');
}

/** Each template object file's `pluralLabel`, one per file. */
function templateObjectLabels(): string[] {
const files = fs.readdirSync(OBJECTS_DIR).filter((f) => f.endsWith('.object.ts'));
return files.map((f) => {
const label = /\bpluralLabel:\s*'([^']+)'/.exec(fs.readFileSync(path.join(OBJECTS_DIR, f), 'utf8'))?.[1];
expect(label, `${f} declares no pluralLabel, so the summary cannot be checked against it`).toBeTruthy();
return label as string;
});
}

it('names each template object by its plural label', () => {
const block = summaryBlock();
const labels = templateObjectLabels();
// Control: the derivation read real files, so a moved directory cannot pass vacuously.
expect(labels).toEqual(expect.arrayContaining(['Companies', 'Contacts', 'Articles']));
for (const label of labels) {
expect(block, `the summary does not name ${label}, an object the template ships`).toMatch(
new RegExp(`\\b${label}\\b`),
);
}
});

it('names each template object in the printed Template line too', () => {
// The line comes from the template registry's description, printed before
// the files are written; it describes the same tree, so it is held to it.
const line = printed.split('\n').find((l) => l.trim().startsWith('Template: blank'));
expect(line, 'the scaffolder no longer prints "Template: blank — …"').toBeDefined();
for (const label of templateObjectLabels()) {
expect(line, `the Template line does not name ${label}, an object the template ships`).toMatch(
new RegExp(`\\b${label}\\b`, 'i'),
);
}
});

it('points at src/data/ while the template seeds sample data', () => {
const seeds = /^export\s/m.test(fs.readFileSync(DATA_INDEX, 'utf8'));
expect(seeds, 'control: the template seeds sample data').toBe(true);
expect(summaryBlock()).toContain('src/data/');
});
});
2 changes: 1 addition & 1 deletion packages/create-objectstack/src/template-registry.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export interface TemplateInfo {
*/
export const TEMPLATES: Record<string, TemplateInfo> = {
blank: {
description: 'Companies and contacts, with platform tasks and notes in the menu — ready to extend',
description: 'Companies, contacts and help articles, with tasks and notes from the platform in the menu — ready to extend',
source: { kind: 'bundled', dir: 'blank' },
},
};
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export default defineStack({
version: '0.1.0',
type: 'app',
name: 'Blank Starter',
description: 'Companies and contacts, with tasks and notes from the platform in the menu.',
description: 'Companies, contacts and help articles, with tasks and notes from the platform in the menu.',
// Protocol compatibility range: the metadata-protocol major this app is
// authored against. The runtime checks it before it loads anything, so a
// runtime outside the range refuses this app at the boundary with the exact
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@
"$schema": "https://schemas.objectstack.dev/template-manifest.json",
"namespace": "blank",
"displayName": "Blank Starter",
"description": "ObjectStack environment that starts with companies and contacts, with tasks and notes from the platform in the menu.",
"description": "ObjectStack environment that starts with companies, contacts and help articles, with tasks and notes from the platform in the menu.",
"readmePath": "README.md"
}
Loading
Loading