Skip to content

Commit b6f6a2e

Browse files
kriszypclaude
andauthored
feat: log application path and table init during startup (#1109)
* feat: log application path and table init during startup Adds info-level log lines so users know their app directory was found and each GraphQL-schema table was initialised, filling the confidence gap when running `harper dev /path/to/app`. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: add worker-0 guard and optional chaining to startup logs - Wrap app-path log in getWorkerIndex() === 0 to avoid duplicate lines from worker threads - Use harperLogger.info?.() optional chaining per Harper conventions - Add ?. to properties.find() for robustness Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> * fix: remove accidentally committed cache file, ignore cache/ dir cache/projects.json is a Claude Code internal file containing a machine-local path. Add cache/ to .gitignore to prevent recurrence. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com> --------- Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 109acd9 commit b6f6a2e

3 files changed

Lines changed: 8 additions & 0 deletions

File tree

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ harper-*.tgz
5050
# AI
5151
.antigravitycli/
5252
.claude/
53+
cache/
5354

5455
# YCSB benchmark results (generated)
5556
benchmarks/ycsb/results/

components/componentLoader.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,7 @@ export function loadComponentDirectories(loadedPluginModules?: Map<any, any>, lo
7777
}
7878
const hdbAppFolder = process.env.RUN_HDB_APP;
7979
if (hdbAppFolder) {
80+
if (getWorkerIndex() === 0) harperLogger.info?.('Loading application from ' + hdbAppFolder);
8081
cfsLoaded.push(
8182
loadComponent(hdbAppFolder, resources, hdbAppFolder, {
8283
isRoot: false,

resources/graphql.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import { Resources } from './Resources.ts';
66
import type { NamedTypeNode, StringValueNode } from 'graphql';
77
import { once } from 'node:events';
88
import { ClientError } from '../utility/errors/hdbError.ts';
9+
import harperLogger from '../utility/logging/harper_logger.ts';
910

1011
const PRIMITIVE_TYPES = ['ID', 'Int', 'Float', 'Long', 'String', 'Boolean', 'Date', 'Bytes', 'Any', 'BigInt', 'Blob'];
1112

@@ -261,6 +262,11 @@ async function processGraphQLSchema(gqlContent, urlPath, filePath, resources) {
261262
// with graphql database definitions, this is a declaration that the table should exist and that it
262263
// should be created if it does not exist
263264
typeDef.tableClass = table(typeDef);
265+
if (getWorkerIndex() === 0) {
266+
const pk = (typeDef.properties as any[])?.find((p) => p.isPrimaryKey)?.name ?? 'id';
267+
const schemaPart = typeDef.database ? `, schema: ${typeDef.database}` : '';
268+
harperLogger.info?.(`Initialized table "${typeDef.table}"${schemaPart}, primaryKey: ${pk}`);
269+
}
264270
if (typeDef.export) {
265271
// allow empty string to be used to declare a table on the root path
266272
if (typeDef.export.name === '') resources.set(dirname(urlPath), typeDef.tableClass);

0 commit comments

Comments
 (0)