breakaway 1.1.0 → 1.1.1-main.1

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": "breakaway",
3
- "version": "1.1.0",
3
+ "version": "1.1.1-main.1",
4
4
  "description": "The task board for you and your coding agents: a Cloudflare Worker, its web app, Taskwarrior sync, and the CLI (npx breakaway).",
5
5
  "license": "FSL-1.1-Apache-2.0",
6
6
  "type": "module",
@@ -4,5 +4,5 @@
4
4
  * and how to update it. scripts/tasks/version.test.js fails when the copied files change and this doesn't:
5
5
  * so it lives in the board's package (CLD-135) and the CLI imports it from here.
6
6
  */
7
- export const CLI_VERSION = 48;
8
- export const CLI_FINGERPRINT = '7c36714250586dd5';
7
+ export const CLI_VERSION = 50;
8
+ export const CLI_FINGERPRINT = '2eb2f4fbe777547e';
package/src/install.js CHANGED
@@ -25,19 +25,6 @@ export const DEFAULTS = Object.freeze({
25
25
  channel: 'stable',
26
26
  });
27
27
 
28
- /**
29
- * What a Worker deployed without `TASKS_INSTALL` is: samewave's board as it ran before installs were
30
- * configurable, so its Durable Object, secrets, and links stay where they were. The compatibility fallback.
31
- */
32
- export const LEGACY = Object.freeze({
33
- name: 'samewave tasks',
34
- worker: 'samewave-tasks',
35
- url: 'https://tasks.samewave.dev',
36
- secretsPrefix: 'SAMEWAVE_TASKS_',
37
- store: 'samewave',
38
- docs: 'https://github.com/TheAnarchoX/samewave/blob/main/docs/tasks.md',
39
- });
40
-
41
28
  /** The Secrets Store secrets the Worker binds, by the part of the name after the prefix; the binding is `TASKS_<key>`. */
42
29
  export const SECRET_KEYS = [
43
30
  'CLIENT_ID',
@@ -131,7 +118,7 @@ export function parseInstall(raw) {
131
118
  }
132
119
 
133
120
  /**
134
- * The install a Worker runs as: its `TASKS_INSTALL` var, or samewave's names when it has none. An install
121
+ * The install a Worker runs as: its `TASKS_INSTALL` var, or a new install's defaults when it has none. An install
135
122
  * without a `url` (a new install's, on workers.dev) has a null `url`: the board
136
123
  * then goes by the address it was last opened at (the Durable Object's homeUrl()).
137
124
  *
@@ -141,13 +128,13 @@ export function parseInstall(raw) {
141
128
  export function install(env) {
142
129
  const set = env?.TASKS_INSTALL;
143
130
  const raw = typeof set === 'string' ? safeParse(set) : set;
144
- if (!raw || typeof raw !== 'object') return LEGACY;
131
+ if (!raw || typeof raw !== 'object') return { ...DEFAULTS, installRepository: null };
145
132
  return {
146
- name: String(raw.name || LEGACY.name),
147
- worker: String(raw.worker || LEGACY.worker),
133
+ name: String(raw.name || DEFAULTS.name),
134
+ worker: String(raw.worker || DEFAULTS.worker),
148
135
  url: raw.url ? String(raw.url) : null,
149
136
  secretsPrefix: String(raw.secretsPrefix || DEFAULTS.secretsPrefix),
150
- store: String(raw.store || LEGACY.store),
137
+ store: String(raw.store || DEFAULTS.store),
151
138
  docs: raw.docs ? String(raw.docs) : null,
152
139
  installRepository: raw.installRepository ? String(raw.installRepository) : null,
153
140
  channel: raw.channel === 'main' ? 'main' : 'stable',
@@ -162,7 +149,7 @@ function safeParse(text) {
162
149
  }
163
150
  }
164
151
 
165
- /** A Secrets Store secret's name on this install: `CLIENT_ID` → `SAMEWAVE_TASKS_CLIENT_ID` on samewave's. */
152
+ /** A Secrets Store secret's name on this install: `CLIENT_ID` → `BREAKAWAY_CLIENT_ID` on an install with the default prefix. */
166
153
  export const secretName = (inst, key) => `${inst.secretsPrefix}${key}`;
167
154
 
168
155
  /** A link into the install's docs, or null when it has none. */
package/src/repos.js CHANGED
@@ -4,15 +4,15 @@
4
4
  * the Durable Object; the table and the API are in store-repos.js.
5
5
  *
6
6
  * Every task belongs to one repository through its `repo` property, and a task without one belongs to
7
- * the default repository (the legacy install's, from before repositories), so no existing task, history, or replica changes.
8
- * A fresh install has no legacy repository: its first registered repository is its default (CLD-131). Ideas (IDEA) and
7
+ * the default repository (the install's first, from before repositories), so no existing task, history, or replica changes.
8
+ * A fresh install has no such repository: its first registered repository is its default (CLD-131). Ideas (IDEA) and
9
9
  * Routines (RUN) are install-wide (the owner's answer in CLD-119); every other area belongs to exactly one
10
10
  * repository, and a prefix to exactly one area, so a work ID means one task across the install.
11
11
  */
12
12
  import { AREA_NAMES, InputError, PROJECTS } from './model.js';
13
13
 
14
- /** The repository a task without `repo` belongs to on an install from before repositories, registered from its settings. */
15
- export const DEFAULT_REPO = 'samewave';
14
+ /** The slug a task without `repo` falls back to while the registry has no default: nothing is registered, so no task is. */
15
+ export const NO_REPO = 'default';
16
16
  /** Areas shared by the whole install: the owner's inbox and saved prompts, not a repository's work. */
17
17
  export const SHARED_AREAS = { ideas: 'IDEA', routines: 'RUN' };
18
18
 
@@ -25,35 +25,42 @@ export const JSON_FIELDS = ['pipeline', 'routine', 'settings'];
25
25
  const MAX_JSON = 4096;
26
26
 
27
27
  /**
28
- * Whether an empty registry gets the legacy repository's row by itself: only on an install from before repositories,
29
- * one that already holds tasks or names its repository in TASKS_GITHUB_REPO. A fresh install starts
30
- * with no repository, and its owner registers the first (CLD-131).
28
+ * Whether an empty registry gets a first row by itself: only on an install that names its repository in
29
+ * TASKS_GITHUB_REPO. A fresh install starts with no repository, and its owner registers the first (CLD-131).
31
30
  */
32
- export const seedsDefault = (env, holdsTasks) => Boolean(holdsTasks || env?.TASKS_GITHUB_REPO);
31
+ export const seedsDefault = (env) => Boolean(env?.TASKS_GITHUB_REPO);
33
32
 
34
- /** The registry's first row on such an install: the legacy install as the board runs it today (`TASKS_GITHUB_REPO`, `PROJECTS`, release.js). */
33
+ /** A repository's slug from its GitHub name: `acme/widgets` → `widgets`. */
34
+ export const slugOfGithub = (github) => {
35
+ const slug = String(github)
36
+ .split('/')
37
+ .pop()
38
+ .toLowerCase()
39
+ .replace(/[^a-z0-9-]+/gu, '-')
40
+ .replace(/^[^a-z]+|-+$/gu, '');
41
+ return SLUG.test(slug) ? slug : NO_REPO;
42
+ };
43
+
44
+ /** The registry's first row on such an install: `TASKS_GITHUB_REPO` with the model's areas, and no pipeline until its owner sets one. */
35
45
  export function defaultRepo(env) {
36
- const github = String(env.TASKS_GITHUB_REPO || 'TheAnarchoX/samewave');
46
+ const github = String(env.TASKS_GITHUB_REPO);
47
+ const slug = slugOfGithub(github);
37
48
  return {
38
- slug: DEFAULT_REPO,
49
+ slug,
39
50
  github,
40
- name: 'samewave',
51
+ name: slug,
41
52
  defaultBranch: 'main',
42
53
  areas: Object.entries(PROJECTS)
43
54
  .filter(([project]) => !(project in SHARED_AREAS))
44
55
  .map(([project, prefix]) => ({ project, prefix, name: AREA_NAMES[project] ?? project })),
45
- pipeline: {
46
- workers: { staging: 'samewave-staging', production: 'samewave' },
47
- workflows: { deploy: 'deploy.yml', promote: 'promote.yml', rollback: 'rollback.yml' },
48
- deployPaths: '.github/deploy-paths.json',
49
- },
56
+ pipeline: null,
50
57
  routine: null,
51
58
  settings: null,
52
59
  };
53
60
  }
54
61
 
55
62
  /** The repository a task belongs to: its `repo`, or the default. */
56
- export const repoSlugOf = (map, fallback = DEFAULT_REPO) => map?.repo || fallback;
63
+ export const repoSlugOf = (map, fallback = NO_REPO) => map?.repo || fallback;
57
64
 
58
65
  /** The work-ID prefix for `project` in `repo` (a registry row), or null when the area isn't the repository's. */
59
66
  export function prefixFor(repo, project) {