@docyrus/docyrus 0.0.46 → 0.0.50

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.46",
3
+ "version": "0.0.50",
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
  }
@@ -27,15 +27,16 @@ Docyrus concepts you should understand and use accurately:
27
27
 
28
28
  Project plan system:
29
29
 
30
- The project-plan is a repo-tracked work graph stored at `docyrus/project-plan/project-plan.json`. It organizes work into sections (standalone groupings like phases or feature areas), features, and tasks. A derived `PROJECT_PLAN.md` is always kept in sync. Features are also synced into the knowledge base features document when it exists.
30
+ The project-plan is a repo-tracked work graph stored at `docyrus/project-plan/project-plan.json`. It organizes work into sections (standalone groupings like phases or feature areas), features, and tasks. A derived `PROJECT_PLAN.md` is always kept in sync. Features are also synced into the knowledge base features document when it exists. Sections, features, and tasks each support an optional integer `order` field that controls display sequence (lower = first; entities without an order sort after ordered ones).
31
31
 
32
32
  - `docyrus project-plan show --json` — view the full hierarchy with statuses; returns `{ graph, hierarchy }`
33
33
  - `docyrus project-plan get-task --taskId <id> --json` — inspect a task and its linked local subtasks
34
34
  - `docyrus project-plan set-task-status --taskId <id> --status <status>` — advance task status (`planned` → `in_progress` → `done`, or `blocked`)
35
35
  - `docyrus project-plan create-linked-todo --taskId <id> [--title <title>] [--body <body>]` — create a local `.pi/todos` subtask linked to an agent-assigned canonical task
36
- - `docyrus project-plan upsert-section --title <title> [--id <id>] [--slug <slug>] [--summary <summary>]` — create or update a section
37
- - `docyrus project-plan upsert-feature --sectionId <id> --title <title> [--featureId <id>] [--slug <slug>] [--summary <summary>]` — create or update a feature
38
- - `docyrus project-plan upsert-task --featureId <id> --title <title> --type <type> --assignee <assignee> [--taskId <id>] [--status <status>] [--summary <summary>] [--acceptanceCriteria <json-array>]` — create or update a task
36
+ - `docyrus project-plan upsert-section --title <title> [--id <id>] [--slug <slug>] [--summary <summary>] [--order <n>]` — create or update a section
37
+ - `docyrus project-plan upsert-feature --sectionId <id> --title <title> [--featureId <id>] [--slug <slug>] [--summary <summary>] [--order <n>]` — create or update a feature
38
+ - `docyrus project-plan upsert-task --featureId <id> --title <title> --type <type> --assignee <assignee> [--taskId <id>] [--status <status>] [--summary <summary>] [--acceptanceCriteria <json-array>] [--order <n>]` — create or update a task
39
+ - `docyrus project-plan set-order --sectionId|--featureId|--taskId <id> --order <n>` — set display order on an existing entity (lower = first; unordered items sort last)
39
40
  - `docyrus project-plan check` — validate section references and graph integrity
40
41
  - `docyrus project-plan ensure` — initialize an empty project-plan graph if it does not yet exist
41
42
 
@@ -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
@@ -72,7 +83,7 @@ Schema-first workflow for new Docyrus-backed apps and major features:
72
83
 
73
84
  Project plan system:
74
85
 
75
- The project-plan is a repo-tracked work graph stored at `docyrus/project-plan/project-plan.json` with a derived `PROJECT_PLAN.md` always kept in sync. Work is organized into sections (standalone groupings like phases or feature areas), features, and tasks. Features are also synced into the knowledge base features document when it exists. Tasks have a type (`new-implementation`, `bug-fix`, `api-test`, `browser-automation-test`, `work`), an assignee (`agent` or `user`), a status (`planned`, `in_progress`, `blocked`, `done`), and optional acceptance criteria.
86
+ The project-plan is a repo-tracked work graph stored at `docyrus/project-plan/project-plan.json` with a derived `PROJECT_PLAN.md` always kept in sync. Work is organized into sections (standalone groupings like phases or feature areas), features, and tasks. Features are also synced into the knowledge base features document when it exists. Tasks have a type (`new-implementation`, `bug-fix`, `api-test`, `browser-automation-test`, `work`), an assignee (`agent` or `user`), a status (`planned`, `in_progress`, `blocked`, `done`), and optional acceptance criteria. Sections, features, and tasks each support an optional integer `order` field that controls display sequence (lower = first; entities without an order sort after ordered ones).
76
87
 
77
88
  Key commands:
78
89
 
@@ -80,9 +91,10 @@ Key commands:
80
91
  - `docyrus project-plan get-task --taskId <id> --json` — inspect a specific task and its linked local subtasks
81
92
  - `docyrus project-plan set-task-status --taskId <id> --status <status>` — advance task status (`planned` → `in_progress` → `done`, or `blocked`)
82
93
  - `docyrus project-plan create-linked-todo --taskId <id> [--title <title>] [--body <body>]` — create a local `.pi/todos` subtask linked to an agent-assigned canonical task
83
- - `docyrus project-plan upsert-section --title <title> [--id <id>] [--slug <slug>] [--summary <summary>]` — create or update a section
84
- - `docyrus project-plan upsert-feature --sectionId <id> --title <title> [--featureId <id>] [--slug <slug>] [--summary <summary>]` — create or update a feature
85
- - `docyrus project-plan upsert-task --featureId <id> --title <title> --type <type> --assignee <assignee> [--taskId <id>] [--status <status>] [--summary <summary>] [--acceptanceCriteria <json-array>]` — create or update a task
94
+ - `docyrus project-plan upsert-section --title <title> [--id <id>] [--slug <slug>] [--summary <summary>] [--order <n>]` — create or update a section
95
+ - `docyrus project-plan upsert-feature --sectionId <id> --title <title> [--featureId <id>] [--slug <slug>] [--summary <summary>] [--order <n>]` — create or update a feature
96
+ - `docyrus project-plan upsert-task --featureId <id> --title <title> --type <type> --assignee <assignee> [--taskId <id>] [--status <status>] [--summary <summary>] [--acceptanceCriteria <json-array>] [--order <n>]` — create or update a task
97
+ - `docyrus project-plan set-order --sectionId|--featureId|--taskId <id> --order <n>` — set display order on an existing entity (lower = first; unordered items sort last)
86
98
  - `docyrus project-plan check` — validate section references and graph integrity
87
99
  - `docyrus project-plan ensure` — initialize an empty project-plan graph if it does not yet exist
88
100
 
@@ -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.
@@ -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