flows, listing translate, scan 2.2 + --originality, prices export with subscriptions, site sections
- storebound flow list|validate|run: repo-local workflows (store/workflows/*.yml, storebound.workflows.*), writes dry unless --apply, owner steps never run, --from / --resume; init templates for app and game; MCP flow_list + dry flow_run; release-flows skill - storebound listing translate|check|reviewed: per-language listing drafts with store limits and keyword rules, agent or --translate hook, marked until reviewed; MCP listing_translate / listing_check; listing-localization skill - scan: Apple 2.2 beta/demo/test wording rule; scan --originality [--against] - prices export includes subscriptions; prices import skips their rows - site: rejection scan section, Desktop app section with fixture-mode screenshots, Everything else grid, FAQ 4.3 answer - README, CHANGELOG, adapters, API tables
This commit is contained in:
parent
e44897ca4e
commit
526dfd3b09
45 changed files with 2176 additions and 53 deletions
|
|
@ -7,35 +7,42 @@
|
|||
// (mechanic, content, differentiator sentence) is the portfolio-originality skill.
|
||||
import { realpathSync } from 'node:fs';
|
||||
import { relative } from 'node:path';
|
||||
import { loadConfig } from './lib/config';
|
||||
import { loadConfig, type ShipConfig } from './lib/config';
|
||||
import type { Ctx } from './lib/ctx';
|
||||
import { done, log, printJson, warn } from './lib/log';
|
||||
import { DEFAULT_THRESHOLD, findApps, fingerprint, report } from './lib/originality';
|
||||
import { type AppFingerprint, DEFAULT_THRESHOLD, findApps, fingerprint, type OriginalityReport, report } from './lib/originality';
|
||||
import { textTable } from './lib/table';
|
||||
|
||||
const TAG = 'originality';
|
||||
|
||||
export async function run(ctx: Ctx): Promise<void> {
|
||||
const { config, root, resolve } = ctx.loaded;
|
||||
const a = ctx.args;
|
||||
const folders = (a.list('against').length ? a.list('against') : config.originality?.against ?? []).map(f => resolve(f));
|
||||
/** The 4.3 comparison of one app against the apps in `against` (also used by `storebound scan --originality`). */
|
||||
export async function compareAgainst(o: { config: ShipConfig; root: string; resolve(p: string): string }, against: string[], thresholdArg?: number, onSkip: (msg: string) => void = () => {}): Promise<{ report: OriginalityReport; me: AppFingerprint; others: number }> {
|
||||
const { config, root, resolve } = o;
|
||||
const folders = (against.length ? against : config.originality?.against ?? []).map(f => resolve(f));
|
||||
if (!folders.length) throw new Error('nothing to compare with: --against <folder of another app, or a folder holding several> (or originality.against in the config)');
|
||||
const threshold = a.has('threshold') ? a.num('threshold', DEFAULT_THRESHOLD) : config.originality?.threshold ?? DEFAULT_THRESHOLD;
|
||||
const threshold = thresholdArg ?? config.originality?.threshold ?? DEFAULT_THRESHOLD;
|
||||
if (!(threshold > 0 && threshold < 1)) throw new Error('--threshold: between 0 and 1');
|
||||
const self = realpathSync(root);
|
||||
const configs = findApps(folders.map(f => { try { return realpathSync(f); } catch { return f; } }), self);
|
||||
if (!configs.length) throw new Error(`no other app (storebound.config.ts) in ${folders.map(f => relative(root, f) || '.').join(', ')}`);
|
||||
const json = a.has('json');
|
||||
if (!json) log(TAG, `${config.app.name} vs ${configs.length} app(s), offline`);
|
||||
const me = fingerprint(config, root);
|
||||
const others = [];
|
||||
for (const p of configs) {
|
||||
try {
|
||||
const l = await loadConfig(p);
|
||||
others.push(fingerprint(l.config, l.root));
|
||||
} catch (e) { warn(TAG, `${p}: skipped (${(e as Error).message.split('\n')[0]?.slice(0, 160)})`); }
|
||||
} catch (e) { onSkip(`${p}: skipped (${(e as Error).message.split('\n')[0]?.slice(0, 160)})`); }
|
||||
}
|
||||
const r = report(me, others, threshold);
|
||||
return { report: report(me, others, threshold), me, others: configs.length };
|
||||
}
|
||||
|
||||
export async function run(ctx: Ctx): Promise<void> {
|
||||
const { config, root } = ctx.loaded;
|
||||
const a = ctx.args;
|
||||
const json = a.has('json');
|
||||
const { report: r, me, others } = await compareAgainst(ctx.loaded, a.list('against'), a.has('threshold') ? a.num('threshold', DEFAULT_THRESHOLD) : undefined, m => warn(TAG, m));
|
||||
if (!json) log(TAG, `${config.app.name} vs ${others} app(s), offline`);
|
||||
const threshold = r.threshold;
|
||||
if (json) { printJson(r); if (r.flagged) process.exitCode = 1; return; }
|
||||
for (const n of me.notes) warn(TAG, `${config.app.name}: ${n}`);
|
||||
const pct = (x: number | null) => (x === null ? '-' : `${Math.round(x * 100)}%`);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue