Skip to content

Commit cf245d0

Browse files
Copilothotlong
andcommitted
Fix code review issues in README documentation
Co-authored-by: hotlong <50353452+hotlong@users.noreply.github.com>
1 parent 49f3942 commit cf245d0

5 files changed

Lines changed: 55 additions & 19 deletions

File tree

packages/cli/README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -122,8 +122,8 @@ objectstack dev @objectstack/core
122122
```
123123

124124
**Behavior:**
125-
- **Single Package Mode**: If `objectstack.config.ts` exists in current directory, delegates to `objectstack serve --dev`
126-
- **Monorepo Mode**: If in workspace root, runs `pnpm dev` with optional package filter
125+
- **Single Package Mode**: If `objectstack.config.ts` exists in current directory, delegates to `objectstack serve --dev` to start a development server with hot reload
126+
- **Monorepo Mode**: If `pnpm-workspace.yaml` exists in current directory (workspace root), executes `pnpm dev` with optional package filter to run development builds across multiple packages in the workspace. The command uses pnpm's workspace filtering to target specific packages or all packages.
127127

128128
### `objectstack compile`
129129

packages/metadata/README.md

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -349,14 +349,22 @@ async function versionMetadata() {
349349

350350
const objects = await manager.loadMany('object');
351351

352+
// Get git user name safely
353+
let modifiedBy = 'unknown';
354+
try {
355+
modifiedBy = execSync('git config user.name', { encoding: 'utf-8' }).trim();
356+
} catch (error) {
357+
console.warn('Could not get git user name, using "unknown"');
358+
}
359+
352360
// Add version metadata
353361
const versioned = objects.map(obj => ({
354362
...obj,
355363
metadata: {
356364
...obj.metadata,
357365
version: '2.0.0',
358366
lastModified: new Date().toISOString(),
359-
modifiedBy: execSync('git config user.name').toString().trim()
367+
modifiedBy
360368
}
361369
}));
362370

@@ -368,9 +376,13 @@ async function versionMetadata() {
368376
});
369377
}
370378

371-
// Commit to version control
372-
execSync('git add metadata/');
373-
execSync('git commit -m "Version bump to 2.0.0"');
379+
// Commit to version control (if git is available)
380+
try {
381+
execSync('git add metadata/', { stdio: 'inherit' });
382+
execSync('git commit -m "Version bump to 2.0.0"', { stdio: 'inherit' });
383+
} catch (error) {
384+
console.warn('Git commit failed, changes are staged but not committed');
385+
}
374386
}
375387
```
376388

packages/objectql/README.md

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -285,11 +285,15 @@ ql.registerHook('beforeInsert', async (ctx) => {
285285
ql.registerHook('afterInsert', async (ctx) => {
286286
console.log(`Created ${ctx.object}:`, ctx.result);
287287

288-
// Trigger events
289-
await eventBus.emit('data:created', {
290-
object: ctx.object,
291-
id: ctx.result.id
292-
});
288+
// Trigger events - get event bus from kernel or context
289+
// Note: eventBus should be injected or accessed from context
290+
const eventBus = ctx.getService?.('event-bus');
291+
if (eventBus) {
292+
await eventBus.emit('data:created', {
293+
object: ctx.object,
294+
id: ctx.result.id
295+
});
296+
}
293297
});
294298

295299
ql.registerHook('beforeUpdate', async (ctx) => {

packages/runtime/README.md

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -411,9 +411,10 @@ import { Plugin, PluginContext } from '@objectstack/core';
411411

412412
export class ConnectionPoolPlugin implements Plugin {
413413
name = 'connection-pool';
414+
private pool: any;
414415

415416
async init(ctx: PluginContext) {
416-
const pool = {
417+
this.pool = {
417418
connections: new Map(),
418419

419420
getConnection(name: string) {
@@ -431,12 +432,14 @@ export class ConnectionPoolPlugin implements Plugin {
431432
}
432433
};
433434

434-
ctx.registerService('connection-pool', pool);
435+
ctx.registerService('connection-pool', this.pool);
435436
}
436437

437438
async destroy() {
438-
const pool = kernel.getService('connection-pool');
439-
pool.closeAll();
439+
// Use stored reference from init phase
440+
if (this.pool) {
441+
this.pool.closeAll();
442+
}
440443
}
441444
}
442445
```

packages/spec/README.md

Lines changed: 21 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -97,14 +97,31 @@ const app: UI.App = {
9797

9898
### 🤖 AI-Ready Context
9999

100-
This package includes a `prompts/` directory containing system instructions and architectural context. This is useful for:
100+
This package includes a `prompts/` directory in the package root containing system instructions and architectural context:
101+
102+
```
103+
node_modules/@objectstack/spec/prompts/
104+
├── architecture.md # System architecture overview
105+
├── plugin/ # Plugin development guides
106+
└── development/ # Development workflows
107+
```
108+
109+
These prompts are useful for:
101110
1. **AI Agents**: Creating agents that understand ObjectStack.
102111
2. **IDE Context**: Adding `node_modules/@objectstack/spec/prompts/*.md` to your Cursor/Copilot context.
103-
3. **LLM Auto-Discovery**: The `llms.txt` file in the root provides a knowledge base for autonomous agents.
112+
3. **LLM Auto-Discovery**: The `llms.txt` file in the repository root provides a knowledge base for autonomous agents.
104113

105114
```typescript
106-
import context from '@objectstack/spec/prompts/architecture.md?raw'; // If using Vite/bundler
107-
// Or just read the file from disk
115+
// If using Vite/bundler with raw import support
116+
import context from '@objectstack/spec/prompts/architecture.md?raw';
117+
118+
// Or read from disk in Node.js
119+
import fs from 'fs';
120+
import path from 'path';
121+
const context = fs.readFileSync(
122+
path.join(process.cwd(), 'node_modules/@objectstack/spec/prompts/architecture.md'),
123+
'utf-8'
124+
);
108125
```
109126

110127
#### 1. Namespace Imports from Root

0 commit comments

Comments
 (0)