@dboio/cli 0.19.0 → 0.19.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.
@@ -0,0 +1,87 @@
1
+ ---
2
+ name: changelog
3
+ description: >-
4
+ Changelog and Track API logging instructions. Load this skill at SessionStart
5
+ or any time Claude needs to know when and how to write changelog.md entries
6
+ and submit log entries to the Track task_log API. Applies to all projects
7
+ unless the local CLAUDE.md explicitly opts out.
8
+ user-invokable: false
9
+ ---
10
+
11
+ # Changelog & Track Logging
12
+
13
+ Track all changes made by Claude across sessions. Log entries **after** making changes, not before.
14
+
15
+ ## Opt-out
16
+
17
+ If the current project's CLAUDE.md (or any CLAUDE.md in the directory hierarchy) contains an explicit directive such as **"Do not write changelog entries or call the Track API for this project"** or **"Skip all changelog.md writes and Track API calls"**, honour it and do not log anything for that project. The local directive overrides these instructions.
18
+
19
+ ## When to log
20
+
21
+ - **Always**: after writing or editing source files in any project
22
+ - **Additionally for DBO apps** (has `.dbo/` or `.app/config.json`): after pushing any asset to the server
23
+
24
+ ## File location
25
+
26
+ - `<project-memory-dir>/changelog.md`
27
+ - The project memory directory is the per-project auto-memory path shown in the session context (e.g., `~/.claude/projects/<encoded-path>/memory/`)
28
+ - If `changelog.md` does not exist, create it with the header row before adding the first entry
29
+
30
+ ## Format
31
+
32
+ ```
33
+ | Date | Time | Asset Type | Name | UID | Description |
34
+ |------|------|-----------|------|-----|-------------|
35
+ | YYYY-MM-DD | HH:MM | type | Name | uid | Short description |
36
+ ```
37
+
38
+ - **Date**: `YYYY-MM-DD`
39
+ - **Time**: `HH:MM` in the user's local timezone (24-hour format)
40
+ - **DBO projects**: Asset Type from `_entity` in the metadata JSON (output, content, entity, security, site, etc.)
41
+ - **Non-DBO projects**: Asset Type is the file role (e.g., view, model, controller, service, config). UID column can be left as `---`
42
+ - **Description**: 50–75 chars max, focus on *why* not *what*
43
+
44
+ ## Track API — Remote task_log
45
+
46
+ In addition to the local `changelog.md`, write each log entry to the centralized Track `task_log` table via the REST API. This applies from **any project**, not just Track itself.
47
+
48
+ ### Auth
49
+
50
+ - Cookie file: `~/.claude/track-cookies.txt`
51
+ - To log in: user runs `~/.claude/track-changelog` in a terminal
52
+ - Track domain: `beta-track.dbo.io`
53
+
54
+ ### Session check (run once per session, before the first log entry)
55
+
56
+ ```bash
57
+ curl -s -b ~/.claude/track-cookies.txt 'https://beta-track.dbo.io/api/o/asqor6nmxuiwqbhldlki7g'
58
+ ```
59
+
60
+ - Returns a JSON array with `ContactID`, `FirstName`, etc. → session is valid; use the `ContactID` value for all log entries this session
61
+ - Returns `[]` → **not logged in**. Tell the user: "Track Access Denied. Run `~/.claude/track-changelog` and try again." Do NOT retry or attempt to log in on their behalf.
62
+
63
+ ### Writing a log entry
64
+
65
+ ```bash
66
+ curl -s -b ~/.claude/track-cookies.txt \
67
+ 'https://beta-track.dbo.io/api/input/submit?_confirm=true' \
68
+ --data-urlencode 'RowID:add1;column:todoes.task_log.ContactID=<ContactID from session>' \
69
+ --data-urlencode 'RowID:add1;column:todoes.task_log.AssistantContactID=27' \
70
+ --data-urlencode 'RowID:add1;column:todoes.task_log.Date=_{now}' \
71
+ --data-urlencode 'RowID:add1;column:todoes.task_log.Summary=<summary, max 100 chars>' \
72
+ --data-urlencode 'RowID:add1;column:todoes.task_log.Description=<detailed description>'
73
+ ```
74
+
75
+ Field notes:
76
+ - **ContactID**: from the session check response (the human user's ID)
77
+ - **AssistantContactID**: always `27` (Claude's fixed Contact ID in Track)
78
+ - **Date**: `_{now}` — the server resolves this to the current datetime
79
+ - **Summary**: short title of what was done, max 100 chars
80
+ - **Description**: detailed explanation of why/how the change was made; can be longer. ASCII only — no unicode arrows, emoji, or non-ASCII characters
81
+ - **TaskID**: include if the work relates to a known task: `--data-urlencode 'RowID:add1;column:todoes.task_log.TaskID=<id>'`
82
+ - **TimeID**: omit (a server trigger will associate it automatically)
83
+
84
+ ### Error handling
85
+
86
+ - If the API returns `"Successful": false` or an HTTP error, write the entry to `changelog.md` anyway and warn the user about the Track API failure
87
+ - If the session expires mid-conversation (403 or `[]` on a subsequent check), tell the user to re-run `~/.claude/track-changelog`
@@ -1095,34 +1095,8 @@ export async function performClone(source, options = {}) {
1095
1095
  const effectiveDomain = options.domain || config.domain;
1096
1096
  let appJson;
1097
1097
 
1098
- // Fetch schema if missing, explicitly requested, or server has a newer version
1098
+ // Load local schema (server fetch deferred until after auth validation)
1099
1099
  let schema = await loadSchema();
1100
- let shouldFetch = !schema || options.schema;
1101
- if (!shouldFetch && schema) {
1102
- try {
1103
- shouldFetch = await isSchemaStale({ domain: effectiveDomain, verbose: options.verbose });
1104
- if (shouldFetch) log.dim(` Server schema is newer — refreshing _system dependency baseline`);
1105
- } catch {
1106
- // Can't check — continue with local schema
1107
- }
1108
- }
1109
- if (shouldFetch) {
1110
- try {
1111
- schema = await fetchSchema({ domain: effectiveDomain, verbose: options.verbose });
1112
- await saveSchema(schema);
1113
- log.dim(` Refreshed _system dependency baseline`);
1114
- } catch (err) {
1115
- if (!schema) log.warn(` Could not fetch schema: ${err.message}`);
1116
- // Continue with stale schema or null
1117
- }
1118
- }
1119
-
1120
- // Regenerate metadata_schema.json for any new entity types
1121
- if (schema) {
1122
- const existing = await loadMetadataSchema();
1123
- const updated = generateMetadataFromSchema(schema, existing ?? {});
1124
- await saveMetadataSchema(updated);
1125
- }
1126
1100
 
1127
1101
  // Step 1: Source mismatch detection (skip in pull mode)
1128
1102
  // Warn when the user provides an explicit source that differs from the stored one.
@@ -1148,7 +1122,9 @@ export async function performClone(source, options = {}) {
1148
1122
  }
1149
1123
  }
1150
1124
 
1151
- // Step 2: Load the app JSON — retry loop with fallback prompt on failure
1125
+ // Step 2: Load the app JSON — retry loop with fallback prompt on failure.
1126
+ // This runs BEFORE schema/dependency sync so that the login prompt fires
1127
+ // here if the session is expired (not buried inside a silent dependency clone).
1152
1128
  let activeSource = source;
1153
1129
  while (true) {
1154
1130
  try {
@@ -1178,6 +1154,35 @@ export async function performClone(source, options = {}) {
1178
1154
  throw new Error('Invalid app JSON: missing UID or children');
1179
1155
  }
1180
1156
 
1157
+ // Fetch schema if missing, explicitly requested, or server has a newer version.
1158
+ // Runs AFTER app fetch so that login prompt fires first on expired session.
1159
+ let shouldFetchSchema = !schema || options.schema;
1160
+ if (!shouldFetchSchema && schema) {
1161
+ try {
1162
+ shouldFetchSchema = await isSchemaStale({ domain: effectiveDomain, verbose: options.verbose });
1163
+ if (shouldFetchSchema) log.dim(` Server schema is newer — refreshing _system dependency baseline`);
1164
+ } catch {
1165
+ // Can't check — continue with local schema
1166
+ }
1167
+ }
1168
+ if (shouldFetchSchema) {
1169
+ try {
1170
+ schema = await fetchSchema({ domain: effectiveDomain, verbose: options.verbose });
1171
+ await saveSchema(schema);
1172
+ log.dim(` Refreshed _system dependency baseline`);
1173
+ } catch (err) {
1174
+ if (!schema) log.warn(` Could not fetch schema: ${err.message}`);
1175
+ // Continue with stale schema or null
1176
+ }
1177
+ }
1178
+
1179
+ // Regenerate metadata_schema.json for any new entity types
1180
+ if (schema) {
1181
+ const existing = await loadMetadataSchema();
1182
+ const updated = generateMetadataFromSchema(schema, existing ?? {});
1183
+ await saveMetadataSchema(updated);
1184
+ }
1185
+
1181
1186
  // Domain change detection
1182
1187
  if (effectiveDomain) {
1183
1188
  const { changed, proceed } = await checkDomainChange(effectiveDomain, options);
@@ -1,97 +0,0 @@
1
- ---
2
- name: cli
3
- description: Run DBO.io CLI commands for local file sync, project management, and deployment (push/pull/clone/add/rm/diff/build/deploy). NOT for direct API operations — use docs/ for that.
4
- allowed-tools: Read, Write, Glob, Bash(git status:*), Bash(git branch:*), Bash(git diff:*), Bash(ls:*), Bash(dbo init:*), Bash(dbo login:*), Bash(dbo status:*), Bash(dbo deploy:*), Bash(dbo add:*), Bash(dbo clone:*), Bash(dbo push:*), Bash(dbo pull:*), Bash(dbo diff:*), Bash(dbo rm:*), Bash(dbo mv:*), Bash(dbo run:*), Bash(dbo install:*), Bash(git stash:*), Bash(grep:*), Bash(which dbo:*)
5
- user-invokable: true
6
- ---
7
-
8
- # DBO CLI Skill
9
-
10
- Run `dbo` CLI commands for local file sync, project management, and deployment.
11
-
12
- ## When to use this skill
13
-
14
- Use this skill when the user wants to:
15
- - Run a local workflow command (push, pull, clone, add, rm, diff, build, deploy)
16
- - Set up a project (`dbo init`, `dbo login`, `dbo clone`)
17
- - Deploy files to the server (`dbo push`, `dbo deploy`)
18
-
19
- ## When NOT to use this skill
20
-
21
- Do NOT use this skill for direct API operations. The following CLI commands are thin wrappers around REST endpoints — use the `docs/` reference instead for the canonical API syntax:
22
- - `dbo input` wraps `POST /api/input/submit` — use `docs/dbo-cheat-sheet.md`
23
- - `dbo output` wraps `GET /api/output/` — use `docs/dbo-output-query.md`
24
- - `dbo content` wraps `GET /api/content/` — use `docs/dbo-cheat-sheet.md`
25
- - `dbo media` wraps `GET /api/media/` — use `docs/dbo-cheat-sheet.md`
26
- - `dbo upload` wraps `POST /api/upload/submit` — use `docs/dbo-cheat-sheet.md`
27
- - `dbo message` wraps `GET /api/message/` — use `docs/dbo-cheat-sheet.md`
28
- - `dbo cache` wraps `/api/cache/` — use `docs/dbo-cheat-sheet.md`
29
-
30
- Also do NOT use this skill for:
31
- - **Entity schemas / column names** — use `docs/dbo-core-entities.md`
32
- - **Token/tag syntax** (`#{...}`, `<#_embed>`, etc.) — use `docs/dbo-cheat-sheet.md`
33
- - **Building server-side templates or content records** — use `docs/`
34
-
35
- All doc files are bundled in the `docs/` subdirectory of this plugin (copied during npm publish). When working in the repo, the API docs are at the repo root `docs/` and the CLI README is at `tools/cli/README.md`.
36
-
37
- For detailed CLI command flags, options, and behavior — read `docs/dbo-cli-readme.md`.
38
-
39
- ## Running commands
40
-
41
- **If `$ARGUMENTS` is empty**, show the command table and guide interactively.
42
-
43
- **If `$ARGUMENTS` is provided**, check if command exists in the command table in the available commands (use best guess, eg: initialize => init), then on match run the command:**:
44
-
45
- ```bash
46
- dbo $ARGUMENTS
47
- ```
48
-
49
- ## Command overview
50
-
51
- These are the local workflow commands this skill covers:
52
-
53
- | Command | Description |
54
- |---------|-------------|
55
- | `init` | Initialize .dbo/ configuration |
56
- | `login` / `logout` | Authenticate / clear session |
57
- | `status` | Show config, domain, session info |
58
- | `clone` | Clone an app to local project |
59
- | `pull` | Pull records to local files |
60
- | `push` | Push local changes (default: current dir) |
61
- | `add` | Add a new file to DBO.io |
62
- | `diff` | Compare local vs server |
63
- | `rm` | Remove file, stage server deletion |
64
- | `deploy` | Deploy via .dbo/deploy_config.json manifest |
65
- | `build` | Run build hooks (.dbo/scripts.json) |
66
- | `run` | Run named script (.dbo/scripts.json) |
67
- | `install` | Install/upgrade CLI, plugins (alias: `i`) |
68
-
69
- ## Common workflows
70
-
71
- ```bash
72
- # Setup
73
- dbo init --domain my-domain.com --app myapp --clone
74
- dbo login
75
-
76
- # Edit and push
77
- dbo push # push all changes in current dir
78
- dbo push lib/bins/app/assets/ # push specific directory
79
- dbo push colors.css # push single file
80
-
81
- # Build and push (with script hooks)
82
- dbo build # run build hooks only
83
- dbo push # build + push (hooks run automatically)
84
- dbo push --no-build # push without build phase
85
- dbo push --no-scripts # push without any hooks
86
-
87
- # Pull
88
- dbo pull -e content --filter 'AppID=10100'
89
-
90
- # Add new files
91
- dbo add assets/css/newstyle.css
92
- dbo add . # scan for un-added files
93
-
94
- # Compare and merge
95
- dbo diff # compare all local vs server
96
- dbo diff -y # auto-accept all server changes
97
- ```