struere 0.7.1 → 0.7.2
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/dist/bin/struere.js +95 -46
- package/dist/cli/commands/docs.d.ts.map +1 -1
- package/dist/cli/index.js +95 -46
- package/package.json +1 -1
package/dist/bin/struere.js
CHANGED
|
@@ -20657,34 +20657,13 @@ function getResourceDirectories(cwd) {
|
|
|
20657
20657
|
}
|
|
20658
20658
|
|
|
20659
20659
|
// src/cli/commands/docs.ts
|
|
20660
|
-
var
|
|
20660
|
+
var DOCS_BASE = "https://docs.struere.dev";
|
|
20661
20661
|
var ALL_TARGETS = ["claude", "cursor", "copilot"];
|
|
20662
20662
|
var TARGET_FILES = {
|
|
20663
20663
|
claude: "CLAUDE.md",
|
|
20664
20664
|
cursor: ".cursorrules",
|
|
20665
20665
|
copilot: ".github/copilot-instructions.md"
|
|
20666
20666
|
};
|
|
20667
|
-
var TARGET_HEADERS = {
|
|
20668
|
-
claude: `# Struere Workspace
|
|
20669
|
-
|
|
20670
|
-
> This is a Struere workspace project. You define agents, entity types, roles, and custom tools here. The CLI syncs them to Convex.
|
|
20671
|
-
`,
|
|
20672
|
-
cursor: `# Struere Workspace
|
|
20673
|
-
|
|
20674
|
-
This is a Struere workspace project. You define agents, entity types, roles, and custom tools here. The CLI syncs them to Convex.
|
|
20675
|
-
`,
|
|
20676
|
-
copilot: `# Struere Workspace
|
|
20677
|
-
|
|
20678
|
-
This is a Struere workspace project. You define agents, entity types, roles, and custom tools here. The CLI syncs them to Convex.
|
|
20679
|
-
`
|
|
20680
|
-
};
|
|
20681
|
-
async function fetchFrameworkDocs() {
|
|
20682
|
-
const response = await fetch(DOCS_URL, { signal: AbortSignal.timeout(15000) });
|
|
20683
|
-
if (!response.ok) {
|
|
20684
|
-
throw new Error(`Failed to fetch docs: ${response.status} ${response.statusText}`);
|
|
20685
|
-
}
|
|
20686
|
-
return await response.text();
|
|
20687
|
-
}
|
|
20688
20667
|
function buildProjectContext(orgName, resources) {
|
|
20689
20668
|
const lines = [];
|
|
20690
20669
|
lines.push(`## This Project`);
|
|
@@ -20695,7 +20674,7 @@ function buildProjectContext(orgName, resources) {
|
|
|
20695
20674
|
lines.push(`### Agents (${resources.agents.length})`);
|
|
20696
20675
|
for (const agent of resources.agents) {
|
|
20697
20676
|
const tools = agent.tools?.length ? ` \u2014 tools: ${agent.tools.join(", ")}` : "";
|
|
20698
|
-
lines.push(`-
|
|
20677
|
+
lines.push(`- **${agent.name}** (\`${agent.slug}\`) v${agent.version}${tools}`);
|
|
20699
20678
|
}
|
|
20700
20679
|
}
|
|
20701
20680
|
if (resources.entityTypes.length > 0) {
|
|
@@ -20704,7 +20683,7 @@ function buildProjectContext(orgName, resources) {
|
|
|
20704
20683
|
for (const et of resources.entityTypes) {
|
|
20705
20684
|
const fields = et.schema?.properties ? Object.keys(et.schema.properties).join(", ") : "";
|
|
20706
20685
|
const fieldStr = fields ? ` \u2014 fields: ${fields}` : "";
|
|
20707
|
-
lines.push(`-
|
|
20686
|
+
lines.push(`- **${et.name}** (\`${et.slug}\`)${fieldStr}`);
|
|
20708
20687
|
}
|
|
20709
20688
|
}
|
|
20710
20689
|
if (resources.roles.length > 0) {
|
|
@@ -20712,37 +20691,113 @@ function buildProjectContext(orgName, resources) {
|
|
|
20712
20691
|
lines.push(`### Roles (${resources.roles.length})`);
|
|
20713
20692
|
for (const role of resources.roles) {
|
|
20714
20693
|
const policyCount = role.policies?.length || 0;
|
|
20715
|
-
lines.push(`-
|
|
20694
|
+
lines.push(`- **${role.name}** \u2014 ${policyCount} ${policyCount === 1 ? "policy" : "policies"}`);
|
|
20716
20695
|
}
|
|
20717
20696
|
}
|
|
20718
20697
|
if (resources.triggers.length > 0) {
|
|
20719
20698
|
lines.push("");
|
|
20720
20699
|
lines.push(`### Triggers (${resources.triggers.length})`);
|
|
20721
20700
|
for (const trigger of resources.triggers) {
|
|
20722
|
-
lines.push(`-
|
|
20701
|
+
lines.push(`- **${trigger.name}** (\`${trigger.slug}\`) \u2014 on \`${trigger.on.entityType}.${trigger.on.action}\``);
|
|
20723
20702
|
}
|
|
20724
20703
|
}
|
|
20725
20704
|
if (resources.customTools.length > 0) {
|
|
20726
20705
|
lines.push("");
|
|
20727
20706
|
lines.push(`### Custom Tools (${resources.customTools.length})`);
|
|
20728
20707
|
for (const tool of resources.customTools) {
|
|
20729
|
-
lines.push(`-
|
|
20708
|
+
lines.push(`- **${tool.name}** \u2014 ${tool.description}`);
|
|
20730
20709
|
}
|
|
20731
20710
|
}
|
|
20732
|
-
lines.push("");
|
|
20733
20711
|
return lines.join(`
|
|
20734
20712
|
`);
|
|
20735
20713
|
}
|
|
20736
|
-
function
|
|
20737
|
-
const
|
|
20738
|
-
|
|
20714
|
+
function buildDocument(projectContext) {
|
|
20715
|
+
const lines = [];
|
|
20716
|
+
lines.push(`# Struere Workspace`);
|
|
20717
|
+
lines.push("");
|
|
20718
|
+
lines.push(`> This is a Struere workspace project. You define agents, entity types, roles, triggers, and custom tools here. The CLI syncs them to the Convex backend.`);
|
|
20719
|
+
lines.push("");
|
|
20739
20720
|
if (projectContext) {
|
|
20740
|
-
|
|
20721
|
+
lines.push(projectContext);
|
|
20722
|
+
lines.push("");
|
|
20741
20723
|
}
|
|
20742
|
-
|
|
20743
|
-
|
|
20744
|
-
|
|
20745
|
-
|
|
20724
|
+
lines.push(`## Project Structure`);
|
|
20725
|
+
lines.push("");
|
|
20726
|
+
lines.push("```");
|
|
20727
|
+
lines.push("agents/ # Agent definitions (one file per agent)");
|
|
20728
|
+
lines.push("entity-types/ # Entity type schemas (like DB tables)");
|
|
20729
|
+
lines.push("roles/ # RBAC roles with policies, scope rules, field masks");
|
|
20730
|
+
lines.push("triggers/ # Automation rules (react to entity changes)");
|
|
20731
|
+
lines.push("tools/index.ts # Custom tools shared by all agents");
|
|
20732
|
+
lines.push("evals/*.eval.yaml # Test suites for agent evaluation");
|
|
20733
|
+
lines.push("struere.json # Organization config (auto-generated)");
|
|
20734
|
+
lines.push("```");
|
|
20735
|
+
lines.push("");
|
|
20736
|
+
lines.push(`## CLI Commands`);
|
|
20737
|
+
lines.push("");
|
|
20738
|
+
lines.push("| Command | Description |");
|
|
20739
|
+
lines.push("|---------|-------------|");
|
|
20740
|
+
lines.push("| `struere dev` | Watch files and sync to Convex on save |");
|
|
20741
|
+
lines.push("| `struere deploy` | Push development config to production |");
|
|
20742
|
+
lines.push("| `struere add agent\\|entity-type\\|role\\|trigger\\|eval <name>` | Scaffold a new resource |");
|
|
20743
|
+
lines.push("| `struere status` | Compare local vs remote state |");
|
|
20744
|
+
lines.push("| `struere pull` | Download remote resources to local files |");
|
|
20745
|
+
lines.push("| `struere docs` | Regenerate this file |");
|
|
20746
|
+
lines.push("");
|
|
20747
|
+
lines.push(`## Key Patterns`);
|
|
20748
|
+
lines.push("");
|
|
20749
|
+
lines.push("- **Imports**: `import { defineAgent, defineEntityType, defineRole, defineTrigger, defineTools } from 'struere'`");
|
|
20750
|
+
lines.push("- **Default model**: `claude-sonnet-4` (provider: `anthropic`). Also supports `openai` and `google`");
|
|
20751
|
+
lines.push("- **Template variables**: `{{agentName}}`, `{{organizationName}}`, `{{currentTime}}`, `{{entityTypes}}`, `{{roles}}`");
|
|
20752
|
+
lines.push('- **Template queries**: `{{entity.query({"type": "customer", "limit": 5})}}`');
|
|
20753
|
+
lines.push("- **Scope rule values**: `actor.userId`, `actor.entityId`, `actor.organizationId`, `actor.relatedIds:TYPE`, `literal:VALUE`");
|
|
20754
|
+
lines.push("- **Policy actions**: `create`, `read`, `update`, `delete`, `list` (deny overrides allow)");
|
|
20755
|
+
lines.push("- **Entity link/unlink params**: `fromId`, `toId`, `relationType`");
|
|
20756
|
+
lines.push("- **Trigger events**: `{{trigger.entityId}}`, `{{trigger.data.X}}`, `{{steps.NAME.X}}`");
|
|
20757
|
+
lines.push("");
|
|
20758
|
+
lines.push(`## Documentation`);
|
|
20759
|
+
lines.push("");
|
|
20760
|
+
lines.push(`Fetch these URLs for detailed documentation on each topic:`);
|
|
20761
|
+
lines.push("");
|
|
20762
|
+
lines.push("### SDK");
|
|
20763
|
+
lines.push(`- [SDK Overview](${DOCS_BASE}/sdk/overview.md)`);
|
|
20764
|
+
lines.push(`- [defineAgent](${DOCS_BASE}/sdk/define-agent.md)`);
|
|
20765
|
+
lines.push(`- [defineEntityType](${DOCS_BASE}/sdk/define-entity-type.md)`);
|
|
20766
|
+
lines.push(`- [defineRole](${DOCS_BASE}/sdk/define-role.md)`);
|
|
20767
|
+
lines.push(`- [defineTrigger](${DOCS_BASE}/sdk/define-trigger.md)`);
|
|
20768
|
+
lines.push(`- [defineTools](${DOCS_BASE}/sdk/define-tools.md)`);
|
|
20769
|
+
lines.push("");
|
|
20770
|
+
lines.push("### Tools");
|
|
20771
|
+
lines.push(`- [Built-in Tools](${DOCS_BASE}/tools/built-in-tools.md)`);
|
|
20772
|
+
lines.push(`- [Custom Tools](${DOCS_BASE}/tools/custom-tools.md)`);
|
|
20773
|
+
lines.push(`- [System Prompt Templates](${DOCS_BASE}/tools/system-prompt-templates.md)`);
|
|
20774
|
+
lines.push("");
|
|
20775
|
+
lines.push("### Platform");
|
|
20776
|
+
lines.push(`- [Entities](${DOCS_BASE}/platform/entities.md)`);
|
|
20777
|
+
lines.push(`- [Permissions](${DOCS_BASE}/platform/permissions.md)`);
|
|
20778
|
+
lines.push(`- [Agents](${DOCS_BASE}/platform/agents.md)`);
|
|
20779
|
+
lines.push(`- [Events](${DOCS_BASE}/platform/events.md)`);
|
|
20780
|
+
lines.push(`- [Triggers](${DOCS_BASE}/platform/triggers.md)`);
|
|
20781
|
+
lines.push(`- [Environment Isolation](${DOCS_BASE}/platform/environment-isolation.md)`);
|
|
20782
|
+
lines.push("");
|
|
20783
|
+
lines.push("### CLI");
|
|
20784
|
+
lines.push(`- [CLI Overview](${DOCS_BASE}/cli/overview.md)`);
|
|
20785
|
+
lines.push(`- [struere init](${DOCS_BASE}/cli/init.md)`);
|
|
20786
|
+
lines.push(`- [struere dev](${DOCS_BASE}/cli/dev.md)`);
|
|
20787
|
+
lines.push(`- [struere add](${DOCS_BASE}/cli/add.md)`);
|
|
20788
|
+
lines.push(`- [struere deploy](${DOCS_BASE}/cli/deploy.md)`);
|
|
20789
|
+
lines.push("");
|
|
20790
|
+
lines.push("### API & Integrations");
|
|
20791
|
+
lines.push(`- [Chat API](${DOCS_BASE}/api/chat.md)`);
|
|
20792
|
+
lines.push(`- [Webhooks](${DOCS_BASE}/api/webhooks.md)`);
|
|
20793
|
+
lines.push(`- [WhatsApp Integration](${DOCS_BASE}/integrations/whatsapp.md)`);
|
|
20794
|
+
lines.push("");
|
|
20795
|
+
lines.push("### Reference");
|
|
20796
|
+
lines.push(`- [Project Structure](${DOCS_BASE}/reference/project-structure.md)`);
|
|
20797
|
+
lines.push(`- [Model Configuration](${DOCS_BASE}/reference/model-configuration.md)`);
|
|
20798
|
+
lines.push("");
|
|
20799
|
+
lines.push(`Full docs: ${DOCS_BASE}/llms-full.txt`);
|
|
20800
|
+
return lines.join(`
|
|
20746
20801
|
`);
|
|
20747
20802
|
}
|
|
20748
20803
|
function writeTarget(cwd, target, content) {
|
|
@@ -20755,12 +20810,6 @@ function writeTarget(cwd, target, content) {
|
|
|
20755
20810
|
}
|
|
20756
20811
|
async function generateDocs(cwd, targets) {
|
|
20757
20812
|
const generated = [];
|
|
20758
|
-
let frameworkDocs;
|
|
20759
|
-
try {
|
|
20760
|
-
frameworkDocs = await fetchFrameworkDocs();
|
|
20761
|
-
} catch (err) {
|
|
20762
|
-
return { generated, error: err instanceof Error ? err.message : String(err) };
|
|
20763
|
-
}
|
|
20764
20813
|
let projectContext = null;
|
|
20765
20814
|
const project = loadProject(cwd);
|
|
20766
20815
|
if (project) {
|
|
@@ -20779,8 +20828,8 @@ async function generateDocs(cwd, targets) {
|
|
|
20779
20828
|
});
|
|
20780
20829
|
}
|
|
20781
20830
|
}
|
|
20831
|
+
const content = buildDocument(projectContext);
|
|
20782
20832
|
for (const target of targets) {
|
|
20783
|
-
const content = assembleDocument(target, projectContext, frameworkDocs);
|
|
20784
20833
|
writeTarget(cwd, target, content);
|
|
20785
20834
|
generated.push(TARGET_FILES[target]);
|
|
20786
20835
|
}
|
|
@@ -20804,10 +20853,10 @@ var docsCommand = new Command("docs").description("Generate AI context files (CL
|
|
|
20804
20853
|
} else {
|
|
20805
20854
|
targets = [...ALL_TARGETS];
|
|
20806
20855
|
}
|
|
20807
|
-
spinner.start("
|
|
20856
|
+
spinner.start("Generating context files");
|
|
20808
20857
|
const { generated, error } = await generateDocs(cwd, targets);
|
|
20809
20858
|
if (error) {
|
|
20810
|
-
spinner.fail("Failed to
|
|
20859
|
+
spinner.fail("Failed to generate docs");
|
|
20811
20860
|
console.log(source_default.red("Error:"), error);
|
|
20812
20861
|
process.exit(1);
|
|
20813
20862
|
}
|
|
@@ -23160,7 +23209,7 @@ entitiesCommand.command("search <type> <query>").description("Search entities").
|
|
|
23160
23209
|
// package.json
|
|
23161
23210
|
var package_default = {
|
|
23162
23211
|
name: "struere",
|
|
23163
|
-
version: "0.7.
|
|
23212
|
+
version: "0.7.2",
|
|
23164
23213
|
description: "Build, test, and deploy AI agents",
|
|
23165
23214
|
keywords: [
|
|
23166
23215
|
"ai",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUnC,KAAK,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;
|
|
1
|
+
{"version":3,"file":"docs.d.ts","sourceRoot":"","sources":["../../../src/cli/commands/docs.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAA;AAUnC,KAAK,MAAM,GAAG,QAAQ,GAAG,QAAQ,GAAG,SAAS,CAAA;AAwK7C,wBAAsB,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,OAAO,EAAE,MAAM,EAAE,GAAG,OAAO,CAAC;IAAE,SAAS,EAAE,MAAM,EAAE,CAAC;IAAC,KAAK,CAAC,EAAE,MAAM,CAAA;CAAE,CAAC,CAwBnH;AAED,eAAO,MAAM,WAAW,SAsCpB,CAAA"}
|
package/dist/cli/index.js
CHANGED
|
@@ -1323,34 +1323,13 @@ function getResourceDirectories(cwd) {
|
|
|
1323
1323
|
}
|
|
1324
1324
|
|
|
1325
1325
|
// src/cli/commands/docs.ts
|
|
1326
|
-
var
|
|
1326
|
+
var DOCS_BASE = "https://docs.struere.dev";
|
|
1327
1327
|
var ALL_TARGETS = ["claude", "cursor", "copilot"];
|
|
1328
1328
|
var TARGET_FILES = {
|
|
1329
1329
|
claude: "CLAUDE.md",
|
|
1330
1330
|
cursor: ".cursorrules",
|
|
1331
1331
|
copilot: ".github/copilot-instructions.md"
|
|
1332
1332
|
};
|
|
1333
|
-
var TARGET_HEADERS = {
|
|
1334
|
-
claude: `# Struere Workspace
|
|
1335
|
-
|
|
1336
|
-
> This is a Struere workspace project. You define agents, entity types, roles, and custom tools here. The CLI syncs them to Convex.
|
|
1337
|
-
`,
|
|
1338
|
-
cursor: `# Struere Workspace
|
|
1339
|
-
|
|
1340
|
-
This is a Struere workspace project. You define agents, entity types, roles, and custom tools here. The CLI syncs them to Convex.
|
|
1341
|
-
`,
|
|
1342
|
-
copilot: `# Struere Workspace
|
|
1343
|
-
|
|
1344
|
-
This is a Struere workspace project. You define agents, entity types, roles, and custom tools here. The CLI syncs them to Convex.
|
|
1345
|
-
`
|
|
1346
|
-
};
|
|
1347
|
-
async function fetchFrameworkDocs() {
|
|
1348
|
-
const response = await fetch(DOCS_URL, { signal: AbortSignal.timeout(15000) });
|
|
1349
|
-
if (!response.ok) {
|
|
1350
|
-
throw new Error(`Failed to fetch docs: ${response.status} ${response.statusText}`);
|
|
1351
|
-
}
|
|
1352
|
-
return await response.text();
|
|
1353
|
-
}
|
|
1354
1333
|
function buildProjectContext(orgName, resources) {
|
|
1355
1334
|
const lines = [];
|
|
1356
1335
|
lines.push(`## This Project`);
|
|
@@ -1361,7 +1340,7 @@ function buildProjectContext(orgName, resources) {
|
|
|
1361
1340
|
lines.push(`### Agents (${resources.agents.length})`);
|
|
1362
1341
|
for (const agent of resources.agents) {
|
|
1363
1342
|
const tools = agent.tools?.length ? ` \u2014 tools: ${agent.tools.join(", ")}` : "";
|
|
1364
|
-
lines.push(`-
|
|
1343
|
+
lines.push(`- **${agent.name}** (\`${agent.slug}\`) v${agent.version}${tools}`);
|
|
1365
1344
|
}
|
|
1366
1345
|
}
|
|
1367
1346
|
if (resources.entityTypes.length > 0) {
|
|
@@ -1370,7 +1349,7 @@ function buildProjectContext(orgName, resources) {
|
|
|
1370
1349
|
for (const et of resources.entityTypes) {
|
|
1371
1350
|
const fields = et.schema?.properties ? Object.keys(et.schema.properties).join(", ") : "";
|
|
1372
1351
|
const fieldStr = fields ? ` \u2014 fields: ${fields}` : "";
|
|
1373
|
-
lines.push(`-
|
|
1352
|
+
lines.push(`- **${et.name}** (\`${et.slug}\`)${fieldStr}`);
|
|
1374
1353
|
}
|
|
1375
1354
|
}
|
|
1376
1355
|
if (resources.roles.length > 0) {
|
|
@@ -1378,37 +1357,113 @@ function buildProjectContext(orgName, resources) {
|
|
|
1378
1357
|
lines.push(`### Roles (${resources.roles.length})`);
|
|
1379
1358
|
for (const role of resources.roles) {
|
|
1380
1359
|
const policyCount = role.policies?.length || 0;
|
|
1381
|
-
lines.push(`-
|
|
1360
|
+
lines.push(`- **${role.name}** \u2014 ${policyCount} ${policyCount === 1 ? "policy" : "policies"}`);
|
|
1382
1361
|
}
|
|
1383
1362
|
}
|
|
1384
1363
|
if (resources.triggers.length > 0) {
|
|
1385
1364
|
lines.push("");
|
|
1386
1365
|
lines.push(`### Triggers (${resources.triggers.length})`);
|
|
1387
1366
|
for (const trigger of resources.triggers) {
|
|
1388
|
-
lines.push(`-
|
|
1367
|
+
lines.push(`- **${trigger.name}** (\`${trigger.slug}\`) \u2014 on \`${trigger.on.entityType}.${trigger.on.action}\``);
|
|
1389
1368
|
}
|
|
1390
1369
|
}
|
|
1391
1370
|
if (resources.customTools.length > 0) {
|
|
1392
1371
|
lines.push("");
|
|
1393
1372
|
lines.push(`### Custom Tools (${resources.customTools.length})`);
|
|
1394
1373
|
for (const tool of resources.customTools) {
|
|
1395
|
-
lines.push(`-
|
|
1374
|
+
lines.push(`- **${tool.name}** \u2014 ${tool.description}`);
|
|
1396
1375
|
}
|
|
1397
1376
|
}
|
|
1398
|
-
lines.push("");
|
|
1399
1377
|
return lines.join(`
|
|
1400
1378
|
`);
|
|
1401
1379
|
}
|
|
1402
|
-
function
|
|
1403
|
-
const
|
|
1404
|
-
|
|
1380
|
+
function buildDocument(projectContext) {
|
|
1381
|
+
const lines = [];
|
|
1382
|
+
lines.push(`# Struere Workspace`);
|
|
1383
|
+
lines.push("");
|
|
1384
|
+
lines.push(`> This is a Struere workspace project. You define agents, entity types, roles, triggers, and custom tools here. The CLI syncs them to the Convex backend.`);
|
|
1385
|
+
lines.push("");
|
|
1405
1386
|
if (projectContext) {
|
|
1406
|
-
|
|
1387
|
+
lines.push(projectContext);
|
|
1388
|
+
lines.push("");
|
|
1407
1389
|
}
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1411
|
-
|
|
1390
|
+
lines.push(`## Project Structure`);
|
|
1391
|
+
lines.push("");
|
|
1392
|
+
lines.push("```");
|
|
1393
|
+
lines.push("agents/ # Agent definitions (one file per agent)");
|
|
1394
|
+
lines.push("entity-types/ # Entity type schemas (like DB tables)");
|
|
1395
|
+
lines.push("roles/ # RBAC roles with policies, scope rules, field masks");
|
|
1396
|
+
lines.push("triggers/ # Automation rules (react to entity changes)");
|
|
1397
|
+
lines.push("tools/index.ts # Custom tools shared by all agents");
|
|
1398
|
+
lines.push("evals/*.eval.yaml # Test suites for agent evaluation");
|
|
1399
|
+
lines.push("struere.json # Organization config (auto-generated)");
|
|
1400
|
+
lines.push("```");
|
|
1401
|
+
lines.push("");
|
|
1402
|
+
lines.push(`## CLI Commands`);
|
|
1403
|
+
lines.push("");
|
|
1404
|
+
lines.push("| Command | Description |");
|
|
1405
|
+
lines.push("|---------|-------------|");
|
|
1406
|
+
lines.push("| `struere dev` | Watch files and sync to Convex on save |");
|
|
1407
|
+
lines.push("| `struere deploy` | Push development config to production |");
|
|
1408
|
+
lines.push("| `struere add agent\\|entity-type\\|role\\|trigger\\|eval <name>` | Scaffold a new resource |");
|
|
1409
|
+
lines.push("| `struere status` | Compare local vs remote state |");
|
|
1410
|
+
lines.push("| `struere pull` | Download remote resources to local files |");
|
|
1411
|
+
lines.push("| `struere docs` | Regenerate this file |");
|
|
1412
|
+
lines.push("");
|
|
1413
|
+
lines.push(`## Key Patterns`);
|
|
1414
|
+
lines.push("");
|
|
1415
|
+
lines.push("- **Imports**: `import { defineAgent, defineEntityType, defineRole, defineTrigger, defineTools } from 'struere'`");
|
|
1416
|
+
lines.push("- **Default model**: `claude-sonnet-4` (provider: `anthropic`). Also supports `openai` and `google`");
|
|
1417
|
+
lines.push("- **Template variables**: `{{agentName}}`, `{{organizationName}}`, `{{currentTime}}`, `{{entityTypes}}`, `{{roles}}`");
|
|
1418
|
+
lines.push('- **Template queries**: `{{entity.query({"type": "customer", "limit": 5})}}`');
|
|
1419
|
+
lines.push("- **Scope rule values**: `actor.userId`, `actor.entityId`, `actor.organizationId`, `actor.relatedIds:TYPE`, `literal:VALUE`");
|
|
1420
|
+
lines.push("- **Policy actions**: `create`, `read`, `update`, `delete`, `list` (deny overrides allow)");
|
|
1421
|
+
lines.push("- **Entity link/unlink params**: `fromId`, `toId`, `relationType`");
|
|
1422
|
+
lines.push("- **Trigger events**: `{{trigger.entityId}}`, `{{trigger.data.X}}`, `{{steps.NAME.X}}`");
|
|
1423
|
+
lines.push("");
|
|
1424
|
+
lines.push(`## Documentation`);
|
|
1425
|
+
lines.push("");
|
|
1426
|
+
lines.push(`Fetch these URLs for detailed documentation on each topic:`);
|
|
1427
|
+
lines.push("");
|
|
1428
|
+
lines.push("### SDK");
|
|
1429
|
+
lines.push(`- [SDK Overview](${DOCS_BASE}/sdk/overview.md)`);
|
|
1430
|
+
lines.push(`- [defineAgent](${DOCS_BASE}/sdk/define-agent.md)`);
|
|
1431
|
+
lines.push(`- [defineEntityType](${DOCS_BASE}/sdk/define-entity-type.md)`);
|
|
1432
|
+
lines.push(`- [defineRole](${DOCS_BASE}/sdk/define-role.md)`);
|
|
1433
|
+
lines.push(`- [defineTrigger](${DOCS_BASE}/sdk/define-trigger.md)`);
|
|
1434
|
+
lines.push(`- [defineTools](${DOCS_BASE}/sdk/define-tools.md)`);
|
|
1435
|
+
lines.push("");
|
|
1436
|
+
lines.push("### Tools");
|
|
1437
|
+
lines.push(`- [Built-in Tools](${DOCS_BASE}/tools/built-in-tools.md)`);
|
|
1438
|
+
lines.push(`- [Custom Tools](${DOCS_BASE}/tools/custom-tools.md)`);
|
|
1439
|
+
lines.push(`- [System Prompt Templates](${DOCS_BASE}/tools/system-prompt-templates.md)`);
|
|
1440
|
+
lines.push("");
|
|
1441
|
+
lines.push("### Platform");
|
|
1442
|
+
lines.push(`- [Entities](${DOCS_BASE}/platform/entities.md)`);
|
|
1443
|
+
lines.push(`- [Permissions](${DOCS_BASE}/platform/permissions.md)`);
|
|
1444
|
+
lines.push(`- [Agents](${DOCS_BASE}/platform/agents.md)`);
|
|
1445
|
+
lines.push(`- [Events](${DOCS_BASE}/platform/events.md)`);
|
|
1446
|
+
lines.push(`- [Triggers](${DOCS_BASE}/platform/triggers.md)`);
|
|
1447
|
+
lines.push(`- [Environment Isolation](${DOCS_BASE}/platform/environment-isolation.md)`);
|
|
1448
|
+
lines.push("");
|
|
1449
|
+
lines.push("### CLI");
|
|
1450
|
+
lines.push(`- [CLI Overview](${DOCS_BASE}/cli/overview.md)`);
|
|
1451
|
+
lines.push(`- [struere init](${DOCS_BASE}/cli/init.md)`);
|
|
1452
|
+
lines.push(`- [struere dev](${DOCS_BASE}/cli/dev.md)`);
|
|
1453
|
+
lines.push(`- [struere add](${DOCS_BASE}/cli/add.md)`);
|
|
1454
|
+
lines.push(`- [struere deploy](${DOCS_BASE}/cli/deploy.md)`);
|
|
1455
|
+
lines.push("");
|
|
1456
|
+
lines.push("### API & Integrations");
|
|
1457
|
+
lines.push(`- [Chat API](${DOCS_BASE}/api/chat.md)`);
|
|
1458
|
+
lines.push(`- [Webhooks](${DOCS_BASE}/api/webhooks.md)`);
|
|
1459
|
+
lines.push(`- [WhatsApp Integration](${DOCS_BASE}/integrations/whatsapp.md)`);
|
|
1460
|
+
lines.push("");
|
|
1461
|
+
lines.push("### Reference");
|
|
1462
|
+
lines.push(`- [Project Structure](${DOCS_BASE}/reference/project-structure.md)`);
|
|
1463
|
+
lines.push(`- [Model Configuration](${DOCS_BASE}/reference/model-configuration.md)`);
|
|
1464
|
+
lines.push("");
|
|
1465
|
+
lines.push(`Full docs: ${DOCS_BASE}/llms-full.txt`);
|
|
1466
|
+
return lines.join(`
|
|
1412
1467
|
`);
|
|
1413
1468
|
}
|
|
1414
1469
|
function writeTarget(cwd, target, content) {
|
|
@@ -1421,12 +1476,6 @@ function writeTarget(cwd, target, content) {
|
|
|
1421
1476
|
}
|
|
1422
1477
|
async function generateDocs(cwd, targets) {
|
|
1423
1478
|
const generated = [];
|
|
1424
|
-
let frameworkDocs;
|
|
1425
|
-
try {
|
|
1426
|
-
frameworkDocs = await fetchFrameworkDocs();
|
|
1427
|
-
} catch (err) {
|
|
1428
|
-
return { generated, error: err instanceof Error ? err.message : String(err) };
|
|
1429
|
-
}
|
|
1430
1479
|
let projectContext = null;
|
|
1431
1480
|
const project = loadProject(cwd);
|
|
1432
1481
|
if (project) {
|
|
@@ -1445,8 +1494,8 @@ async function generateDocs(cwd, targets) {
|
|
|
1445
1494
|
});
|
|
1446
1495
|
}
|
|
1447
1496
|
}
|
|
1497
|
+
const content = buildDocument(projectContext);
|
|
1448
1498
|
for (const target of targets) {
|
|
1449
|
-
const content = assembleDocument(target, projectContext, frameworkDocs);
|
|
1450
1499
|
writeTarget(cwd, target, content);
|
|
1451
1500
|
generated.push(TARGET_FILES[target]);
|
|
1452
1501
|
}
|
|
@@ -1470,10 +1519,10 @@ var docsCommand = new Command2("docs").description("Generate AI context files (C
|
|
|
1470
1519
|
} else {
|
|
1471
1520
|
targets = [...ALL_TARGETS];
|
|
1472
1521
|
}
|
|
1473
|
-
spinner.start("
|
|
1522
|
+
spinner.start("Generating context files");
|
|
1474
1523
|
const { generated, error } = await generateDocs(cwd, targets);
|
|
1475
1524
|
if (error) {
|
|
1476
|
-
spinner.fail("Failed to
|
|
1525
|
+
spinner.fail("Failed to generate docs");
|
|
1477
1526
|
console.log(chalk2.red("Error:"), error);
|
|
1478
1527
|
process.exit(1);
|
|
1479
1528
|
}
|
|
@@ -3854,7 +3903,7 @@ entitiesCommand.command("search <type> <query>").description("Search entities").
|
|
|
3854
3903
|
// package.json
|
|
3855
3904
|
var package_default = {
|
|
3856
3905
|
name: "struere",
|
|
3857
|
-
version: "0.7.
|
|
3906
|
+
version: "0.7.2",
|
|
3858
3907
|
description: "Build, test, and deploy AI agents",
|
|
3859
3908
|
keywords: [
|
|
3860
3909
|
"ai",
|