create-objectstack 14.7.0 → 15.0.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/README.md
CHANGED
|
@@ -1,15 +1,19 @@
|
|
|
1
1
|
# create-objectstack
|
|
2
2
|
|
|
3
|
-
Scaffold a new [ObjectStack](https://objectstack.
|
|
3
|
+
Scaffold a new [ObjectStack](https://objectstack.ai) project in seconds.
|
|
4
|
+
|
|
5
|
+
```bash
|
|
6
|
+
npm create objectstack@latest my-app
|
|
7
|
+
```
|
|
4
8
|
|
|
5
9
|
## Usage
|
|
6
10
|
|
|
7
11
|
```bash
|
|
8
|
-
#
|
|
12
|
+
# Create a project in a new directory (blank template)
|
|
9
13
|
npx create-objectstack my-app
|
|
10
14
|
|
|
11
15
|
# Use a specific template
|
|
12
|
-
npx create-objectstack my-app --template
|
|
16
|
+
npx create-objectstack my-app --template todo
|
|
13
17
|
|
|
14
18
|
# Scaffold in the current directory
|
|
15
19
|
npx create-objectstack
|
|
@@ -20,80 +24,71 @@ npx create-objectstack my-app --skip-install
|
|
|
20
24
|
|
|
21
25
|
## Templates
|
|
22
26
|
|
|
23
|
-
| Template | Description |
|
|
24
|
-
| --- | --- |
|
|
25
|
-
| `
|
|
26
|
-
| `
|
|
27
|
-
| `
|
|
27
|
+
| Template | Source | Description |
|
|
28
|
+
| --- | --- | --- |
|
|
29
|
+
| `blank` *(default)* | bundled (offline) | Minimal starter — one object, REST API, ready to extend |
|
|
30
|
+
| `todo` | remote | Universal task & project management starter |
|
|
31
|
+
| `compliance` | remote | Compliance posture & evidence management (SOC2 / ISO27001) |
|
|
32
|
+
| `content` | remote | Content marketing pipeline — editorial calendar & channel ROI |
|
|
33
|
+
| `contracts` | remote | Post-signature CLM — approvals, obligations, renewals |
|
|
34
|
+
| `procurement` | remote | Source-to-pay — vendors, POs, receipts, invoice matching |
|
|
35
|
+
|
|
36
|
+
Remote templates are fetched from
|
|
37
|
+
[`objectstack-ai/templates`](https://github.com/objectstack-ai/templates) at
|
|
38
|
+
scaffold time and require network access; `blank` is bundled and always works
|
|
39
|
+
offline.
|
|
28
40
|
|
|
29
41
|
## Options
|
|
30
42
|
|
|
31
43
|
| Option | Description |
|
|
32
44
|
| --- | --- |
|
|
33
45
|
| `[name]` | Project name (defaults to current directory name) |
|
|
34
|
-
| `-t, --template <name>` | Project template (default: `
|
|
46
|
+
| `-t, --template <name>` | Project template (default: `blank`) |
|
|
35
47
|
| `--skip-install` | Skip dependency installation |
|
|
48
|
+
| `--skip-skills` | Skip installing the ObjectStack AI skills bundle |
|
|
36
49
|
| `-V, --version` | Show version |
|
|
37
50
|
| `-h, --help` | Show help |
|
|
38
51
|
|
|
39
|
-
## What
|
|
52
|
+
## What it does
|
|
53
|
+
|
|
54
|
+
1. Copies the template into the target directory and rewrites its identity:
|
|
55
|
+
`package.json` name, `objectstack.manifest.json` name/displayName, the
|
|
56
|
+
`objectstack.config.ts` manifest literals, and the README title. A
|
|
57
|
+
**namespace** is derived from the project name (`my-app` → `my_app`) and
|
|
58
|
+
every object name in the template is re-prefixed to match
|
|
59
|
+
(`blank_note` → `my_app_note`).
|
|
60
|
+
2. Installs dependencies (pnpm if available, otherwise npm).
|
|
61
|
+
3. Installs the ObjectStack AI skills bundle for coding agents
|
|
62
|
+
(`npx skills add objectstack-ai/framework --all`).
|
|
63
|
+
4. Writes `AGENTS.md` and `.github/copilot-instructions.md` with the project
|
|
64
|
+
conventions — unless the template ships its own.
|
|
40
65
|
|
|
41
|
-
|
|
66
|
+
## What Gets Generated (blank)
|
|
42
67
|
|
|
43
68
|
```
|
|
44
69
|
my-app/
|
|
45
|
-
├── objectstack.config.ts
|
|
70
|
+
├── objectstack.config.ts # defineStack() entry point
|
|
71
|
+
├── objectstack.manifest.json # name, namespace, version
|
|
46
72
|
├── package.json
|
|
47
73
|
├── tsconfig.json
|
|
48
74
|
├── .gitignore
|
|
49
75
|
├── README.md
|
|
76
|
+
├── AGENTS.md # conventions for coding agents
|
|
50
77
|
└── src/
|
|
51
78
|
└── objects/
|
|
52
79
|
├── index.ts
|
|
53
|
-
└──
|
|
80
|
+
└── note.object.ts
|
|
54
81
|
```
|
|
55
82
|
|
|
56
|
-
|
|
83
|
+
Next steps inside the project:
|
|
57
84
|
|
|
85
|
+
```bash
|
|
86
|
+
npm run dev # start the dev server
|
|
87
|
+
npm run validate # verify metadata: schema + predicates + bindings
|
|
58
88
|
```
|
|
59
|
-
my-app/
|
|
60
|
-
├── objectstack.config.ts
|
|
61
|
-
├── package.json
|
|
62
|
-
├── tsconfig.json
|
|
63
|
-
├── .gitignore
|
|
64
|
-
├── README.md
|
|
65
|
-
└── src/
|
|
66
|
-
├── objects/
|
|
67
|
-
│ ├── index.ts
|
|
68
|
-
│ ├── contact.ts
|
|
69
|
-
│ ├── company.ts
|
|
70
|
-
│ └── deal.ts
|
|
71
|
-
├── views/
|
|
72
|
-
│ ├── contact_list.ts
|
|
73
|
-
│ ├── company_list.ts
|
|
74
|
-
│ └── deal_list.ts
|
|
75
|
-
└── apps/
|
|
76
|
-
├── index.ts
|
|
77
|
-
└── crm.ts
|
|
78
|
-
```
|
|
79
|
-
|
|
80
|
-
### plugin
|
|
81
89
|
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
├── objectstack.config.ts
|
|
85
|
-
├── package.json
|
|
86
|
-
├── tsconfig.json
|
|
87
|
-
├── .gitignore
|
|
88
|
-
├── README.md
|
|
89
|
-
├── src/
|
|
90
|
-
│ ├── index.ts
|
|
91
|
-
│ └── objects/
|
|
92
|
-
│ ├── index.ts
|
|
93
|
-
│ └── sample.ts
|
|
94
|
-
└── test/
|
|
95
|
-
└── sample.test.ts
|
|
96
|
-
```
|
|
90
|
+
See the docs:
|
|
91
|
+
[Your First Project](https://docs.objectstack.ai/docs/getting-started/your-first-project).
|
|
97
92
|
|
|
98
93
|
## License
|
|
99
94
|
|
package/dist/index.js
CHANGED
|
@@ -11,9 +11,24 @@ import { createGunzip } from "zlib";
|
|
|
11
11
|
import { createWriteStream, createReadStream } from "fs";
|
|
12
12
|
import { mkdtemp, rm } from "fs/promises";
|
|
13
13
|
import * as tar from "tar";
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
14
|
+
|
|
15
|
+
// src/pkg-utils.ts
|
|
16
|
+
function syncObjectStackDeps(pkg, version) {
|
|
17
|
+
if (!/^\d+\.\d+\.\d+/.test(version) || version.startsWith("0.")) return;
|
|
18
|
+
for (const deps of [pkg.dependencies, pkg.devDependencies]) {
|
|
19
|
+
if (!deps) continue;
|
|
20
|
+
for (const dep of Object.keys(deps)) {
|
|
21
|
+
if (dep.startsWith("@objectstack/")) {
|
|
22
|
+
deps[dep] = `^${version}`;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
// src/index.ts
|
|
29
|
+
var __filename2 = fileURLToPath(import.meta.url);
|
|
30
|
+
var __dirname2 = path.dirname(__filename2);
|
|
31
|
+
var BUNDLED_TEMPLATES_DIR = path.resolve(__dirname2, "templates");
|
|
17
32
|
var REMOTE_REPO = "objectstack-ai/templates";
|
|
18
33
|
var REMOTE_BRANCH = "main";
|
|
19
34
|
var REMOTE_TARBALL_URL = `https://codeload.github.com/${REMOTE_REPO}/tar.gz/refs/heads/${REMOTE_BRANCH}`;
|
|
@@ -59,7 +74,7 @@ function sanitizeNamespace(name) {
|
|
|
59
74
|
}
|
|
60
75
|
function readCliVersion() {
|
|
61
76
|
try {
|
|
62
|
-
const pkgPath = path.resolve(
|
|
77
|
+
const pkgPath = path.resolve(__dirname2, "..", "package.json");
|
|
63
78
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
64
79
|
return String(pkg.version || "0.0.0");
|
|
65
80
|
} catch {
|
|
@@ -196,6 +211,7 @@ function rewriteProjectIdentity(targetDir, projectName, namespace) {
|
|
|
196
211
|
try {
|
|
197
212
|
const pkg = JSON.parse(fs.readFileSync(pkgPath, "utf8"));
|
|
198
213
|
pkg.name = projectName;
|
|
214
|
+
syncObjectStackDeps(pkg, readCliVersion());
|
|
199
215
|
fs.writeFileSync(pkgPath, JSON.stringify(pkg, null, 2) + "\n");
|
|
200
216
|
} catch {
|
|
201
217
|
}
|
|
@@ -9,7 +9,17 @@ pnpm install
|
|
|
9
9
|
pnpm dev
|
|
10
10
|
```
|
|
11
11
|
|
|
12
|
-
The REST API is served at `http://localhost:3000/api`.
|
|
12
|
+
The REST API is served at `http://localhost:3000/api/v1`. Data endpoints
|
|
13
|
+
require a session — the dev server seeds a login-ready admin
|
|
14
|
+
(`admin@objectos.ai` / `admin123`) on an empty database:
|
|
15
|
+
|
|
16
|
+
```bash
|
|
17
|
+
curl -c cookies.txt -X POST http://localhost:3000/api/v1/auth/sign-in/email \
|
|
18
|
+
-H "Content-Type: application/json" \
|
|
19
|
+
-d '{"email":"admin@objectos.ai","password":"admin123"}'
|
|
20
|
+
|
|
21
|
+
curl -b cookies.txt "http://localhost:3000/api/v1/data/<your_object>"
|
|
22
|
+
```
|
|
13
23
|
|
|
14
24
|
## Layout
|
|
15
25
|
|
|
@@ -11,13 +11,13 @@
|
|
|
11
11
|
"typecheck": "tsc --noEmit"
|
|
12
12
|
},
|
|
13
13
|
"dependencies": {
|
|
14
|
-
"@objectstack/spec": "^
|
|
15
|
-
"@objectstack/runtime": "^
|
|
16
|
-
"@objectstack/driver-memory": "^
|
|
17
|
-
"@objectstack/plugin-hono-server": "^
|
|
14
|
+
"@objectstack/spec": "^15.0.0",
|
|
15
|
+
"@objectstack/runtime": "^15.0.0",
|
|
16
|
+
"@objectstack/driver-memory": "^15.0.0",
|
|
17
|
+
"@objectstack/plugin-hono-server": "^15.0.0"
|
|
18
18
|
},
|
|
19
19
|
"devDependencies": {
|
|
20
|
-
"@objectstack/cli": "^
|
|
21
|
-
"typescript": "^
|
|
20
|
+
"@objectstack/cli": "^15.0.0",
|
|
21
|
+
"typescript": "^6.0.0"
|
|
22
22
|
}
|
|
23
23
|
}
|
|
@@ -16,11 +16,15 @@ export const Note = ObjectSchema.create({
|
|
|
16
16
|
searchable: true,
|
|
17
17
|
maxLength: 200,
|
|
18
18
|
}),
|
|
19
|
-
body: Field.
|
|
19
|
+
body: Field.textarea({
|
|
20
20
|
label: 'Body',
|
|
21
21
|
}),
|
|
22
22
|
},
|
|
23
23
|
|
|
24
|
+
// Org-wide default (OWD): who can see records they don't own. The security
|
|
25
|
+
// posture gate (ADR-0090) requires an explicit, authored decision here.
|
|
26
|
+
sharingModel: 'private',
|
|
27
|
+
|
|
24
28
|
enable: {
|
|
25
29
|
apiEnabled: true,
|
|
26
30
|
searchable: true,
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "create-objectstack",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "15.0.0",
|
|
4
4
|
"description": "Create a new ObjectStack project — npx create-objectstack",
|
|
5
5
|
"bin": {
|
|
6
6
|
"create-objectstack": "./bin/create-objectstack.js"
|
|
@@ -23,7 +23,8 @@
|
|
|
23
23
|
"@types/node": "^26.1.1",
|
|
24
24
|
"@types/tar": "^7.0.87",
|
|
25
25
|
"tsup": "^8.5.1",
|
|
26
|
-
"typescript": "^6.0.3"
|
|
26
|
+
"typescript": "^6.0.3",
|
|
27
|
+
"vitest": "^4.1.10"
|
|
27
28
|
},
|
|
28
29
|
"repository": {
|
|
29
30
|
"type": "git",
|
|
@@ -44,6 +45,7 @@
|
|
|
44
45
|
},
|
|
45
46
|
"scripts": {
|
|
46
47
|
"build": "tsup",
|
|
47
|
-
"dev": "tsup --watch"
|
|
48
|
+
"dev": "tsup --watch",
|
|
49
|
+
"test": "vitest run"
|
|
48
50
|
}
|
|
49
51
|
}
|