@docyrus/docyrus 0.0.48 → 0.0.51

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@docyrus/docyrus",
3
- "version": "0.0.48",
3
+ "version": "0.0.51",
4
4
  "private": false,
5
5
  "description": "Docyrus API CLI",
6
6
  "main": "./main.js",
@@ -14,6 +14,11 @@
14
14
  * GET /api/sessions/:sessionId/config
15
15
  *
16
16
  * Config is stored at: <agentDir>/session-config/<sessionId>.json
17
+ *
18
+ * GitHub token auto-refresh:
19
+ * When a push fails with an authentication error, the extension automatically
20
+ * calls `docyrus auth github` (using DOCYRUS_SANDBOX_APP_ID) to regenerate the
21
+ * token and retry the push.
17
22
  */
18
23
 
19
24
  import type { ExtensionAPI } from "@mariozechner/pi-coding-agent";
@@ -69,6 +74,34 @@ async function isAutoCommitEnabled(sessionId: string): Promise<boolean> {
69
74
  }
70
75
  }
71
76
 
77
+ function isGithubAuthError(stderr: string): boolean {
78
+ const lower = stderr.toLowerCase();
79
+ return (
80
+ lower.includes("authentication failed")
81
+ || lower.includes("invalid username or password")
82
+ || lower.includes("could not read username")
83
+ || lower.includes("the requested url returned error: 401")
84
+ || lower.includes("the requested url returned error: 403")
85
+ || lower.includes("bad credentials")
86
+ );
87
+ }
88
+
89
+ async function tryRefreshGithubToken(cwd: string): Promise<boolean> {
90
+ const appId = process.env.DOCYRUS_SANDBOX_APP_ID?.trim();
91
+ if (!appId) {
92
+ return false;
93
+ }
94
+
95
+ try {
96
+ await execFile("docyrus", ["auth", "github", "--appId", appId, "--cwd", cwd], { cwd });
97
+ return true;
98
+ } catch (error: unknown) {
99
+ const err = error as { stderr?: string; message?: string };
100
+ process.stderr.write(`[server-auto-commit] github token refresh failed: ${err.stderr || err.message || String(error)}\n`);
101
+ return false;
102
+ }
103
+ }
104
+
72
105
  export default function(_pi: ExtensionAPI) {
73
106
  _pi.on("agent_end", async(_event, ctx) => {
74
107
  const sessionId = ctx.sessionManager.getSessionId();
@@ -96,6 +129,19 @@ export default function(_pi: ExtensionAPI) {
96
129
 
97
130
  const push = await runGit(["push", "--no-verify"], ctx.cwd);
98
131
  if (push.code !== 0) {
132
+ if (isGithubAuthError(push.stderr)) {
133
+ process.stderr.write(`[server-auto-commit] push failed with auth error, attempting token refresh\n`);
134
+ const refreshed = await tryRefreshGithubToken(ctx.cwd);
135
+ if (refreshed) {
136
+ const retryPush = await runGit(["push", "--no-verify"], ctx.cwd);
137
+ if (retryPush.code === 0) {
138
+ process.stderr.write(`[server-auto-commit] committed and pushed after token refresh at ${timestamp}\n`);
139
+ return;
140
+ }
141
+ process.stderr.write(`[server-auto-commit] push still failed after token refresh: ${retryPush.stderr}\n`);
142
+ return;
143
+ }
144
+ }
99
145
  process.stderr.write(`[server-auto-commit] git push failed: ${push.stderr}\n`);
100
146
  return;
101
147
  }
@@ -28,6 +28,17 @@ Core behavior:
28
28
  - Treat `.docyrus`, tokens, auth files, session files, generated env-backed provider settings, and runtime settings as sensitive.
29
29
  - When platform capability is uncertain, verify against the active tenant context, the local CLI, and the discovered OpenAPI spec before making claims.
30
30
 
31
+ End-user UI purity:
32
+
33
+ - Apps you build are production tools for business end users, not developer dashboards. Every screen must look and behave like a finished product, not a prototype or progress report.
34
+ - Never render project-plan metadata, task descriptions, acceptance criteria, feature summaries, implementation notes, knowledge-base content, or any other developer-facing context in the app UI. These are your internal references for understanding the work — they must never appear on screen.
35
+ - Never display technical badges, tags, or banners that describe implementation status, backend capabilities, data-source wiring, or architecture decisions (e.g., "Docyrus katalog senkronu hazır", "Mock yerine gerçek veri kullanılıyor").
36
+ - Never add "next step" buttons, development roadmap panels, or progress summaries that describe remaining implementation work.
37
+ - Never show explanatory paragraphs or headings that describe what the app is or how it works from a developer perspective. Page titles and descriptions must be written for end users performing their daily work.
38
+ - All visible text, labels, descriptions, and placeholders must be written from the end-user perspective — as if the app has always existed and the user is simply using it.
39
+ - Dashboard cards and stats must display real operational metrics from data sources (record counts, status breakdowns, date ranges), not descriptions of what the metric represents technically or how it is fetched.
40
+ - If a screen has no real data to display yet, show an appropriate empty state (e.g., "Henüz kayıt yok" / "No records yet") rather than developer notes about what will be wired later.
41
+
31
42
  Docyrus platform model you should understand and use accurately:
32
43
 
33
44
  - apps as top-level containers for product surface area
@@ -9,6 +9,7 @@ description: >
9
9
  - User says "document changes", "what changed since last release"
10
10
  - User wants to "prepare a release" and needs a changelog entry
11
11
  - User asks to "clean up" or "reformat" an existing changelog
12
+ - User runs `docyrus release new-version` and needs changelog content
12
13
 
13
14
  **Covers:** Any git-based project.
14
15
 
@@ -183,6 +184,41 @@ Flag breaking changes regardless of convention:
183
184
 
184
185
  Mark breaking entries with **BREAKING:** prefix in the changelog.
185
186
 
187
+ ### Phase 3b — Docyrus Backend Modifications
188
+
189
+ In addition to code changes, scan for Docyrus platform modifications made through the CLI or API. These should be included alongside code changes in the changelog.
190
+
191
+ **Detection methods:**
192
+
193
+ 1. Search git diff for changes to `docyrus/` directory files (data-sources.plan.json, knowledge files, project-plan changes)
194
+ 2. Look for commit messages containing: `docyrus studio`, `data source`, `field`, `enum`, `app`
195
+ 3. Check for `docyrus/project-plan/` changes that reference architecture tasks
196
+ 4. Look for `.docyrus/` configuration changes
197
+
198
+ **Map to changelog categories:**
199
+
200
+ - **Added** — New data sources created, new fields added, new enum options, new apps provisioned
201
+ - **Changed** — Field type changes, enum updates, data source configuration changes, knowledge graph updates
202
+ - **Removed** — Deleted data sources, removed fields, removed enum options
203
+
204
+ **Entry format for backend changes:**
205
+
206
+ ```markdown
207
+ - Add "Contacts" data source with 12 fields (name, email, phone, ...)
208
+ - Add "Priority" enum to Opportunity data source (Low, Medium, High, Critical)
209
+ - Update "Account" data source: add "industry" and "revenue" fields
210
+ - Remove deprecated "legacy_status" field from Tasks data source
211
+ ```
212
+
213
+ When both code changes and Docyrus platform changes exist, include platform changes under a **Docyrus Platform** heading within the version section:
214
+
215
+ ```markdown
216
+ ### Docyrus Platform
217
+
218
+ - Add "Contacts" data source with name, email, phone fields
219
+ - Update "Opportunity" enum: add Critical priority level
220
+ ```
221
+
186
222
  ### Phase 4 — Entry Writing
187
223
 
188
224
  Transform raw commit data into human-readable changelog entries.
@@ -196,7 +196,7 @@ Use `DataGridViewSelect` as the default saved-view UI for Docyrus grids, and per
196
196
  14. **`DataGridViewSelect` needs a TanStack table instance** and should receive `fields` when you want the built-in filter builder/editor experience.
197
197
  15. **Data view creation requires `name` and `tenant_data_source_id`**.
198
198
  16. **Use `dataViews.update(viewId, { archived: true })` for soft-delete** and `dataViews.remove(viewId)` only for irreversible hard-delete.
199
- 17. **Regenerate collections after schema changes** by rebuilding the tenant OpenAPI spec, downloading the latest `openapi.json`, and re-running the collection generator.
199
+ 17. **Regenerate collections after schema changes** by rebuilding the tenant OpenAPI spec, downloading the latest `openapi.json`, and re-running the collection generator. Use `--apps <appSlug>` or `--dataSources <appSlug/dataSourceSlug>` flags to regenerate only the affected collections instead of all (e.g., `pnpm generate-orm -- --dataSources crm/contacts crm/accounts`).
200
200
  18. **ACL endpoints are usually raw-client integrations** — use `useDocyrusClient()` or `RestApiClient` for roles, user-role assignments, role queries, record sharing, and ownership transfer.
201
201
  19. **Prefer role `uid` values** for ACL role writes, user-role `roleIds`, and role-query `roleIds`.
202
202
  20. **Treat `PUT /v1/users/acl/users/:userId/roles` as full replacement** and `POST /v1/users/acl/users/:userId/roles` as additive.
@@ -21,6 +21,28 @@ Collections are auto-generated from `openapi.json` using `@docyrus/tanstack-db-g
21
21
 
22
22
  **Generate command**: `pnpm generate-orm` (runs `@docyrus/tanstack-db-generator openapi.json`)
23
23
 
24
+ The generator supports filtering to regenerate only specific collections:
25
+
26
+ ```bash
27
+ # Generate all collections
28
+ pnpm generate-orm
29
+
30
+ # Generate collections for specific apps only
31
+ pnpm generate-orm -- --apps crm support
32
+
33
+ # Generate only specific data source collections (appSlug/dataSourceSlug format)
34
+ pnpm generate-orm -- --dataSources crm/contacts crm/accounts
35
+
36
+ # Combine both filters (intersection — must match both)
37
+ pnpm generate-orm -- --apps crm --dataSources crm/contacts
38
+
39
+ # Comma-separated values are also accepted
40
+ pnpm generate-orm -- --apps crm,support
41
+ pnpm generate-orm -- --dataSources crm/contacts,crm/accounts
42
+ ```
43
+
44
+ **Prefer targeted regeneration** (`--apps` or `--dataSources`) over full regeneration when you only changed a few data sources. This is faster and avoids unnecessary file churn.
45
+
24
46
  **Key files:**
25
47
  - `src/collections/<app>-<entity>.collection.ts` — generated React hooks with CRUD methods + entity types
26
48
  - `src/collections/types.ts` — shared query types (filters, calculations, formulas, etc.)
@@ -0,0 +1,103 @@
1
+ ---
2
+ name: release-manager
3
+ description: >
4
+ Manage project releases, version bumping, changelog generation, and GitHub release creation using the docyrus release CLI.
5
+ Handles SemVer versioning, changelog assembly (including Docyrus platform changes), git tagging, and optional GitHub release publishing.
6
+
7
+ **Triggers — use this skill when:**
8
+ - User says "release", "new version", "bump version", "tag release", "cut a release"
9
+ - User wants to publish, ship, or prepare a release
10
+ - User asks about the current version, release status, or unreleased changes
11
+ - User says "what's changed since last release"
12
+
13
+ **Covers:** Projects using the docyrus project plan system with package.json versioning.
14
+ ---
15
+
16
+ # Release Manager
17
+
18
+ Manage releases using the `docyrus release` CLI commands.
19
+
20
+ ## Quick Reference
21
+
22
+ ### Check release status
23
+
24
+ ```bash
25
+ docyrus release status --json
26
+ ```
27
+
28
+ Returns: current version, latest git tag, unreleased commit count, and suggested bump type.
29
+
30
+ ### Create a release (auto-detect bump)
31
+
32
+ ```bash
33
+ docyrus release new-version
34
+ ```
35
+
36
+ Automatically detects the bump type from commits:
37
+ - Breaking changes → **major**
38
+ - New features (`feat:`) → **minor**
39
+ - Fixes and other changes → **patch**
40
+
41
+ ### Create a release with explicit bump
42
+
43
+ ```bash
44
+ docyrus release new-version --bump minor
45
+ ```
46
+
47
+ ### Create a release with explicit version
48
+
49
+ ```bash
50
+ docyrus release new-version --version 1.0.0
51
+ ```
52
+
53
+ ### Preview a release (dry run)
54
+
55
+ ```bash
56
+ docyrus release new-version --bump minor --dryRun
57
+ ```
58
+
59
+ Shows the changelog preview and version bump without committing any changes.
60
+
61
+ ### Skip specific steps
62
+
63
+ ```bash
64
+ docyrus release new-version --bump patch --skipGithubRelease
65
+ docyrus release new-version --bump minor --skipTag
66
+ docyrus release new-version --bump minor --skipChangelog
67
+ ```
68
+
69
+ ## Release Workflow
70
+
71
+ When `docyrus release new-version` runs, it performs these steps in order:
72
+
73
+ 1. **Read current version** from `package.json`
74
+ 2. **Extract commits** since the last git tag
75
+ 3. **Detect bump type** (or use the provided one)
76
+ 4. **Generate changelog** — categorizes commits into Added/Changed/Fixed/Removed/Security, plus Docyrus Platform changes
77
+ 5. **Update CHANGELOG.md** — inserts new version section at the top
78
+ 6. **Update package.json** — bumps the version number
79
+ 7. **Update project-plan.json** — sets the `projectVersion` field
80
+ 8. **Git commit** — `chore(release): vX.Y.Z`
81
+ 9. **Git tag** — `vX.Y.Z`
82
+ 10. **GitHub release** — creates a release via `gh release create` (requires `gh` CLI)
83
+
84
+ ## Docyrus Platform Changes
85
+
86
+ The changelog generator automatically detects Docyrus backend modifications:
87
+
88
+ - New data sources, fields, and enums created via `docyrus studio`
89
+ - Data source architecture changes from `data-sources.plan.json`
90
+ - Knowledge graph updates
91
+
92
+ These appear under a **Docyrus Platform** section in the changelog.
93
+
94
+ ## Version Initialization
95
+
96
+ When a project plan is first created, `package.json` is initialized to version `0.1.0`. Each phase and feature is stamped with the current `projectVersion` at creation time.
97
+
98
+ ## After Release
99
+
100
+ After creating a release, consider:
101
+ - Pushing the commit and tag: `git push && git push --tags`
102
+ - Notifying the team about the new version
103
+ - If authenticated with Docyrus, the release record is automatically created in the platform