rhachet-roles-bhuild 0.7.0 → 0.8.3
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/dist/access/daos/daoRadioTask/daoRadioTaskViaGhIssues.d.ts +41 -0
- package/dist/access/daos/daoRadioTask/daoRadioTaskViaGhIssues.js +229 -0
- package/dist/access/daos/daoRadioTask/daoRadioTaskViaGhIssues.js.map +1 -0
- package/dist/access/daos/daoRadioTask/daoRadioTaskViaOsFileops.d.ts +39 -0
- package/dist/access/daos/daoRadioTask/daoRadioTaskViaOsFileops.js +243 -0
- package/dist/access/daos/daoRadioTask/daoRadioTaskViaOsFileops.js.map +1 -0
- package/dist/access/daos/daoRadioTask/index.d.ts +13 -0
- package/dist/access/daos/daoRadioTask/index.js +10 -0
- package/dist/access/daos/daoRadioTask/index.js.map +1 -0
- package/dist/contract/cli/give.feedback.d.ts +6 -4
- package/dist/contract/cli/give.feedback.js +49 -7
- package/dist/contract/cli/give.feedback.js.map +1 -1
- package/dist/contract/cli/radioTaskPull.d.ts +10 -0
- package/dist/contract/cli/radioTaskPull.js +147 -0
- package/dist/contract/cli/radioTaskPull.js.map +1 -0
- package/dist/contract/cli/radioTaskPush.d.ts +9 -0
- package/dist/contract/cli/radioTaskPush.js +107 -0
- package/dist/contract/cli/radioTaskPush.js.map +1 -0
- package/dist/domain.objects/IdempotencyMode.d.ts +10 -0
- package/dist/domain.objects/IdempotencyMode.js +15 -0
- package/dist/domain.objects/IdempotencyMode.js.map +1 -0
- package/dist/domain.objects/RadioChannel.d.ts +10 -0
- package/dist/domain.objects/RadioChannel.js +15 -0
- package/dist/domain.objects/RadioChannel.js.map +1 -0
- package/dist/domain.objects/RadioContext.d.ts +32 -0
- package/dist/domain.objects/RadioContext.js +12 -0
- package/dist/domain.objects/RadioContext.js.map +1 -0
- package/dist/domain.objects/RadioTask.d.ts +63 -0
- package/dist/domain.objects/RadioTask.js +21 -0
- package/dist/domain.objects/RadioTask.js.map +1 -0
- package/dist/domain.objects/RadioTaskRepo.d.ts +18 -0
- package/dist/domain.objects/RadioTaskRepo.js +8 -0
- package/dist/domain.objects/RadioTaskRepo.js.map +1 -0
- package/dist/domain.objects/RadioTaskStatus.d.ts +11 -0
- package/dist/domain.objects/RadioTaskStatus.js +16 -0
- package/dist/domain.objects/RadioTaskStatus.js.map +1 -0
- package/dist/domain.operations/behavior/feedback/getLatestFeedbackVersion.d.ts +8 -0
- package/dist/domain.operations/behavior/feedback/getLatestFeedbackVersion.js +41 -0
- package/dist/domain.operations/behavior/feedback/getLatestFeedbackVersion.js.map +1 -0
- package/dist/domain.operations/behavior/feedback/giveFeedback.d.ts +5 -2
- package/dist/domain.operations/behavior/feedback/giveFeedback.js +28 -4
- package/dist/domain.operations/behavior/feedback/giveFeedback.js.map +1 -1
- package/dist/domain.operations/behavior/feedback/initFeedbackTemplate.d.ts +1 -0
- package/dist/domain.operations/behavior/feedback/initFeedbackTemplate.js +2 -1
- package/dist/domain.operations/behavior/feedback/initFeedbackTemplate.js.map +1 -1
- package/dist/domain.operations/behavior/init/templates/.ref.[feedback].v1.[given].by_human.md +1 -1
- package/dist/domain.operations/behavior/render/computeFeedbackOutput.d.ts +8 -0
- package/dist/domain.operations/behavior/render/computeFeedbackOutput.js +28 -0
- package/dist/domain.operations/behavior/render/computeFeedbackOutput.js.map +1 -0
- package/dist/domain.operations/radio/auth/getGithubTokenByAuthArg.d.ts +42 -0
- package/dist/domain.operations/radio/auth/getGithubTokenByAuthArg.js +74 -0
- package/dist/domain.operations/radio/auth/getGithubTokenByAuthArg.js.map +1 -0
- package/dist/domain.operations/radio/bootstrap/bootstrapRadioDir.d.ts +12 -0
- package/dist/domain.operations/radio/bootstrap/bootstrapRadioDir.js +144 -0
- package/dist/domain.operations/radio/bootstrap/bootstrapRadioDir.js.map +1 -0
- package/dist/domain.operations/radio/bootstrap/getRadioPath.d.ts +24 -0
- package/dist/domain.operations/radio/bootstrap/getRadioPath.js +58 -0
- package/dist/domain.operations/radio/bootstrap/getRadioPath.js.map +1 -0
- package/dist/domain.operations/radio/task/format/composeTaskIntoGhIssues.d.ts +11 -0
- package/dist/domain.operations/radio/task/format/composeTaskIntoGhIssues.js +49 -0
- package/dist/domain.operations/radio/task/format/composeTaskIntoGhIssues.js.map +1 -0
- package/dist/domain.operations/radio/task/format/composeTaskIntoOsFileops.d.ts +8 -0
- package/dist/domain.operations/radio/task/format/composeTaskIntoOsFileops.js +54 -0
- package/dist/domain.operations/radio/task/format/composeTaskIntoOsFileops.js.map +1 -0
- package/dist/domain.operations/radio/task/format/extractTaskFromGhIssues.d.ts +17 -0
- package/dist/domain.operations/radio/task/format/extractTaskFromGhIssues.js +55 -0
- package/dist/domain.operations/radio/task/format/extractTaskFromGhIssues.js.map +1 -0
- package/dist/domain.operations/radio/task/format/extractTaskFromOsFileops.d.ts +8 -0
- package/dist/domain.operations/radio/task/format/extractTaskFromOsFileops.js +85 -0
- package/dist/domain.operations/radio/task/format/extractTaskFromOsFileops.js.map +1 -0
- package/dist/domain.operations/radio/task/pull/radioTaskPull.d.ts +62 -0
- package/dist/domain.operations/radio/task/pull/radioTaskPull.js +81 -0
- package/dist/domain.operations/radio/task/pull/radioTaskPull.js.map +1 -0
- package/dist/domain.operations/radio/task/push/radioTaskPush.d.ts +25 -0
- package/dist/domain.operations/radio/task/push/radioTaskPush.js +56 -0
- package/dist/domain.operations/radio/task/push/radioTaskPush.js.map +1 -0
- package/dist/domain.operations/radio/task/push/setFullRadioTask.d.ts +21 -0
- package/dist/domain.operations/radio/task/push/setFullRadioTask.js +63 -0
- package/dist/domain.operations/radio/task/push/setFullRadioTask.js.map +1 -0
- package/dist/domain.operations/radio/task/push/setPartRadioTask.d.ts +23 -0
- package/dist/domain.operations/radio/task/push/setPartRadioTask.js +142 -0
- package/dist/domain.operations/radio/task/push/setPartRadioTask.js.map +1 -0
- package/dist/domain.roles/behaver/skills/give.feedback.sh +20 -9
- package/dist/domain.roles/dispatcher/getDispatcherRole.d.ts +2 -0
- package/dist/domain.roles/dispatcher/getDispatcherRole.js +30 -0
- package/dist/domain.roles/dispatcher/getDispatcherRole.js.map +1 -0
- package/dist/domain.roles/dispatcher/readme.md +12 -0
- package/dist/domain.roles/dispatcher/skills/radio.task.pull.sh +25 -0
- package/dist/domain.roles/dispatcher/skills/radio.task.push.sh +25 -0
- package/dist/domain.roles/getRoleRegistry.js +2 -1
- package/dist/domain.roles/getRoleRegistry.js.map +1 -1
- package/dist/index.d.ts +2 -0
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/infra/git/getCurrentActor.d.ts +6 -0
- package/dist/infra/git/getCurrentActor.js +45 -0
- package/dist/infra/git/getCurrentActor.js.map +1 -0
- package/dist/infra/git/getCurrentBranch.d.ts +5 -0
- package/dist/infra/git/getCurrentBranch.js +27 -0
- package/dist/infra/git/getCurrentBranch.js.map +1 -0
- package/dist/infra/git/getRepoFromGitContext.d.ts +6 -0
- package/dist/infra/git/getRepoFromGitContext.js +54 -0
- package/dist/infra/git/getRepoFromGitContext.js.map +1 -0
- package/dist/infra/shell/shx.d.ts +8 -0
- package/dist/infra/shell/shx.js +19 -0
- package/dist/infra/shell/shx.js.map +1 -0
- package/dist/infra/types/assure.d.ts +5 -0
- package/dist/infra/types/assure.js +19 -0
- package/dist/infra/types/assure.js.map +1 -0
- package/package.json +4 -2
- package/readme.md +113 -0
- package/rhachet.repo.yml +8 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import type { ContextGithubAuth, ContextGitRepo } from '../../../domain.objects/RadioContext';
|
|
2
|
+
import { RadioTask } from '../../../domain.objects/RadioTask';
|
|
3
|
+
import type { RadioTaskRepo } from '../../../domain.objects/RadioTaskRepo';
|
|
4
|
+
import { RadioTaskStatus } from '../../../domain.objects/RadioTaskStatus';
|
|
5
|
+
/**
|
|
6
|
+
* .what = dao for github issues channel
|
|
7
|
+
* .why = enables radio task persistence via github issues
|
|
8
|
+
*
|
|
9
|
+
* .critical = never use default env's GH_TOKEN; must be explicitly provided
|
|
10
|
+
*/
|
|
11
|
+
export declare const daoRadioTaskViaGhIssues: {
|
|
12
|
+
get: {
|
|
13
|
+
one: {
|
|
14
|
+
byPrimary: (input: {
|
|
15
|
+
exid: string;
|
|
16
|
+
}, context: ContextGithubAuth & ContextGitRepo) => Promise<RadioTask | null>;
|
|
17
|
+
byUnique: (input: {
|
|
18
|
+
repo: RadioTaskRepo;
|
|
19
|
+
title: string;
|
|
20
|
+
}, context: ContextGithubAuth & ContextGitRepo) => Promise<RadioTask | null>;
|
|
21
|
+
};
|
|
22
|
+
all: (input: {
|
|
23
|
+
repo: RadioTaskRepo;
|
|
24
|
+
filter?: {
|
|
25
|
+
status?: RadioTaskStatus;
|
|
26
|
+
};
|
|
27
|
+
limit?: number;
|
|
28
|
+
}, context: ContextGithubAuth & ContextGitRepo) => Promise<RadioTask[]>;
|
|
29
|
+
};
|
|
30
|
+
set: {
|
|
31
|
+
findsert: (input: {
|
|
32
|
+
task: RadioTask;
|
|
33
|
+
}, context: ContextGithubAuth & ContextGitRepo) => Promise<RadioTask>;
|
|
34
|
+
upsert: (input: {
|
|
35
|
+
task: RadioTask;
|
|
36
|
+
}, context: ContextGithubAuth & ContextGitRepo) => Promise<RadioTask>;
|
|
37
|
+
};
|
|
38
|
+
del: (input: {
|
|
39
|
+
exid: string;
|
|
40
|
+
}, context: ContextGithubAuth & ContextGitRepo) => Promise<void>;
|
|
41
|
+
};
|
|
@@ -0,0 +1,229 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.daoRadioTaskViaGhIssues = void 0;
|
|
27
|
+
const child_process_1 = require("child_process");
|
|
28
|
+
const fs = __importStar(require("fs"));
|
|
29
|
+
const helpful_errors_1 = require("helpful-errors");
|
|
30
|
+
const os = __importStar(require("os"));
|
|
31
|
+
const path = __importStar(require("path"));
|
|
32
|
+
const util_1 = require("util");
|
|
33
|
+
const RadioTask_1 = require("../../../domain.objects/RadioTask");
|
|
34
|
+
const RadioTaskStatus_1 = require("../../../domain.objects/RadioTaskStatus");
|
|
35
|
+
const composeTaskIntoGhIssues_1 = require("../../../domain.operations/radio/task/format/composeTaskIntoGhIssues");
|
|
36
|
+
const extractTaskFromGhIssues_1 = require("../../../domain.operations/radio/task/format/extractTaskFromGhIssues");
|
|
37
|
+
const execAsync = (0, util_1.promisify)(child_process_1.exec);
|
|
38
|
+
const writeFileAsync = (0, util_1.promisify)(fs.writeFile);
|
|
39
|
+
const unlinkAsync = (0, util_1.promisify)(fs.unlink);
|
|
40
|
+
/**
|
|
41
|
+
* .what = convert Date to IsoDateStamp
|
|
42
|
+
* .why = format date for RadioTask fields
|
|
43
|
+
*/
|
|
44
|
+
const toIsoDateStamp = (date) => {
|
|
45
|
+
return date.toISOString().split('T')[0];
|
|
46
|
+
};
|
|
47
|
+
/**
|
|
48
|
+
* .what = run gh cli command and return stdout
|
|
49
|
+
* .why = wraps exec with proper error handler and explicit token auth
|
|
50
|
+
*
|
|
51
|
+
* .critical = never use default env's GH_TOKEN; must be explicitly provided
|
|
52
|
+
*/
|
|
53
|
+
const runGhCommand = async (command, context) => {
|
|
54
|
+
// strip default env tokens to prevent accidental use
|
|
55
|
+
const { GH_TOKEN: _removed, GITHUB_TOKEN: _removed2, ...envWithoutToken } = process.env;
|
|
56
|
+
// build env: explicit token or unset for gh cli session auth
|
|
57
|
+
const env = context.github.auth.token !== null
|
|
58
|
+
? { ...envWithoutToken, GH_TOKEN: context.github.auth.token }
|
|
59
|
+
: envWithoutToken; // as-human: no GH_TOKEN, use gh cli session
|
|
60
|
+
const { stdout } = await execAsync(command, { env });
|
|
61
|
+
return stdout.trim();
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* .what = dao for github issues channel
|
|
65
|
+
* .why = enables radio task persistence via github issues
|
|
66
|
+
*
|
|
67
|
+
* .critical = never use default env's GH_TOKEN; must be explicitly provided
|
|
68
|
+
*/
|
|
69
|
+
exports.daoRadioTaskViaGhIssues = {
|
|
70
|
+
get: {
|
|
71
|
+
one: {
|
|
72
|
+
byPrimary: async (input, context) => {
|
|
73
|
+
const { repo } = context.git;
|
|
74
|
+
const repoSlug = `${repo.owner}/${repo.name}`;
|
|
75
|
+
try {
|
|
76
|
+
const json = await runGhCommand(`gh issue view ${input.exid} --repo ${repoSlug} --json number,title,body,state,assignees,createdAt,author`, context);
|
|
77
|
+
const issue = JSON.parse(json);
|
|
78
|
+
// verify this is a radio task
|
|
79
|
+
if (!issue.title.startsWith('🎙️ task -')) {
|
|
80
|
+
throw new helpful_errors_1.BadRequestError('issue is not a radio task', {
|
|
81
|
+
exid: input.exid,
|
|
82
|
+
title: issue.title,
|
|
83
|
+
});
|
|
84
|
+
}
|
|
85
|
+
return (0, extractTaskFromGhIssues_1.extractTaskFromGhIssues)({
|
|
86
|
+
issueNumber: String(issue.number),
|
|
87
|
+
title: issue.title,
|
|
88
|
+
body: issue.body,
|
|
89
|
+
state: issue.state.toLowerCase(),
|
|
90
|
+
assignees: issue.assignees.map((a) => a.login),
|
|
91
|
+
repo: repo,
|
|
92
|
+
createdAt: toIsoDateStamp(new Date(issue.createdAt)),
|
|
93
|
+
createdBy: issue.author.login,
|
|
94
|
+
});
|
|
95
|
+
}
|
|
96
|
+
catch (error) {
|
|
97
|
+
// exec errors have stderr in the error object
|
|
98
|
+
const errorMessage = error instanceof Error ? error.message : String(error);
|
|
99
|
+
const stderr = error?.stderr ?? '';
|
|
100
|
+
const fullError = `${errorMessage} ${stderr}`;
|
|
101
|
+
if (fullError.includes('Could not resolve'))
|
|
102
|
+
return null;
|
|
103
|
+
if (fullError.includes('not found'))
|
|
104
|
+
return null;
|
|
105
|
+
throw error;
|
|
106
|
+
}
|
|
107
|
+
},
|
|
108
|
+
byUnique: async (input, context) => {
|
|
109
|
+
const { repo } = context.git;
|
|
110
|
+
const repoSlug = `${repo.owner}/${repo.name}`;
|
|
111
|
+
const searchTitle = `🎙️ task - ${input.title}`;
|
|
112
|
+
const json = await runGhCommand(`gh issue list --repo ${repoSlug} --search "${searchTitle} in:title" --state all --json number,title,body,state,assignees,createdAt,author --limit 10`, context);
|
|
113
|
+
const issues = JSON.parse(json);
|
|
114
|
+
// find exact match
|
|
115
|
+
const match = issues.find((issue) => issue.title === searchTitle);
|
|
116
|
+
if (!match)
|
|
117
|
+
return null;
|
|
118
|
+
return (0, extractTaskFromGhIssues_1.extractTaskFromGhIssues)({
|
|
119
|
+
issueNumber: String(match.number),
|
|
120
|
+
title: match.title,
|
|
121
|
+
body: match.body,
|
|
122
|
+
state: match.state.toLowerCase(),
|
|
123
|
+
assignees: match.assignees.map((a) => a.login),
|
|
124
|
+
repo: input.repo,
|
|
125
|
+
createdAt: toIsoDateStamp(new Date(match.createdAt)),
|
|
126
|
+
createdBy: match.author.login,
|
|
127
|
+
});
|
|
128
|
+
},
|
|
129
|
+
},
|
|
130
|
+
all: async (input, context) => {
|
|
131
|
+
const { repo } = context.git;
|
|
132
|
+
const repoSlug = `${repo.owner}/${repo.name}`;
|
|
133
|
+
const limit = input.limit ?? 100;
|
|
134
|
+
const stateFlag = input.filter?.status === RadioTaskStatus_1.RadioTaskStatus.DELIVERED
|
|
135
|
+
? '--state closed'
|
|
136
|
+
: '--state all';
|
|
137
|
+
const json = await runGhCommand(`gh issue list --repo ${repoSlug} --search "🎙️ task - in:title" ${stateFlag} --json number,title,body,state,assignees,createdAt,author --limit ${limit}`, context);
|
|
138
|
+
const issues = JSON.parse(json);
|
|
139
|
+
const tasks = issues
|
|
140
|
+
.filter((issue) => issue.title.startsWith('🎙️ task -'))
|
|
141
|
+
.map((issue) => (0, extractTaskFromGhIssues_1.extractTaskFromGhIssues)({
|
|
142
|
+
issueNumber: String(issue.number),
|
|
143
|
+
title: issue.title,
|
|
144
|
+
body: issue.body,
|
|
145
|
+
state: issue.state.toLowerCase(),
|
|
146
|
+
assignees: issue.assignees.map((a) => a.login),
|
|
147
|
+
repo: input.repo,
|
|
148
|
+
createdAt: toIsoDateStamp(new Date(issue.createdAt)),
|
|
149
|
+
createdBy: issue.author.login,
|
|
150
|
+
}));
|
|
151
|
+
// filter by status if specified
|
|
152
|
+
if (input.filter?.status) {
|
|
153
|
+
return tasks.filter((task) => task.status === input.filter.status);
|
|
154
|
+
}
|
|
155
|
+
return tasks;
|
|
156
|
+
},
|
|
157
|
+
},
|
|
158
|
+
set: {
|
|
159
|
+
findsert: async (input, context) => {
|
|
160
|
+
const { repo } = context.git;
|
|
161
|
+
const repoSlug = `${repo.owner}/${repo.name}`;
|
|
162
|
+
// check if task already exists
|
|
163
|
+
const taskFound = await exports.daoRadioTaskViaGhIssues.get.one.byUnique({ repo: input.task.repo, title: input.task.title }, context);
|
|
164
|
+
if (taskFound)
|
|
165
|
+
return taskFound;
|
|
166
|
+
// create new issue
|
|
167
|
+
const { title, body } = (0, composeTaskIntoGhIssues_1.composeTaskIntoGhIssues)({ task: input.task });
|
|
168
|
+
// write body to temp file to preserve newlines
|
|
169
|
+
const tempFile = path.join(os.tmpdir(), `radio-task-${Date.now()}.md`);
|
|
170
|
+
await writeFileAsync(tempFile, body);
|
|
171
|
+
try {
|
|
172
|
+
const output = await runGhCommand(`gh issue create --repo ${repoSlug} --title "${title.replace(/"/g, '\\"')}" --body-file "${tempFile}"`, context);
|
|
173
|
+
// parse issue number from URL output (e.g., "https://github.com/owner/repo/issues/123")
|
|
174
|
+
const issueNumberMatch = output.match(/\/issues\/(\d+)/);
|
|
175
|
+
if (!issueNumberMatch)
|
|
176
|
+
throw new Error(`failed to parse issue number from: ${output}`);
|
|
177
|
+
return new RadioTask_1.RadioTask({
|
|
178
|
+
...input.task,
|
|
179
|
+
exid: issueNumberMatch[1],
|
|
180
|
+
});
|
|
181
|
+
}
|
|
182
|
+
finally {
|
|
183
|
+
await unlinkAsync(tempFile).catch(() => { });
|
|
184
|
+
}
|
|
185
|
+
},
|
|
186
|
+
upsert: async (input, context) => {
|
|
187
|
+
const { repo } = context.git;
|
|
188
|
+
const repoSlug = `${repo.owner}/${repo.name}`;
|
|
189
|
+
// check if task exists
|
|
190
|
+
const taskFound = input.task.exid
|
|
191
|
+
? await exports.daoRadioTaskViaGhIssues.get.one.byPrimary({ exid: input.task.exid }, context)
|
|
192
|
+
: await exports.daoRadioTaskViaGhIssues.get.one.byUnique({ repo: input.task.repo, title: input.task.title }, context);
|
|
193
|
+
if (!taskFound) {
|
|
194
|
+
// create new issue
|
|
195
|
+
return exports.daoRadioTaskViaGhIssues.set.findsert(input, context);
|
|
196
|
+
}
|
|
197
|
+
// update issue
|
|
198
|
+
const { title, body } = (0, composeTaskIntoGhIssues_1.composeTaskIntoGhIssues)({ task: input.task });
|
|
199
|
+
// write body to temp file to preserve newlines
|
|
200
|
+
const tempFile = path.join(os.tmpdir(), `radio-task-edit-${Date.now()}.md`);
|
|
201
|
+
await writeFileAsync(tempFile, body);
|
|
202
|
+
try {
|
|
203
|
+
await runGhCommand(`gh issue edit ${taskFound.exid} --repo ${repoSlug} --title "${title.replace(/"/g, '\\"')}" --body-file "${tempFile}"`, context);
|
|
204
|
+
}
|
|
205
|
+
finally {
|
|
206
|
+
await unlinkAsync(tempFile).catch(() => { });
|
|
207
|
+
}
|
|
208
|
+
// add assignee for CLAIMED status
|
|
209
|
+
if (input.task.status === RadioTaskStatus_1.RadioTaskStatus.CLAIMED &&
|
|
210
|
+
input.task.claimedBy) {
|
|
211
|
+
await runGhCommand(`gh issue edit ${taskFound.exid} --repo ${repoSlug} --add-assignee "${input.task.claimedBy}"`, context);
|
|
212
|
+
}
|
|
213
|
+
// close issue for DELIVERED status
|
|
214
|
+
if (input.task.status === RadioTaskStatus_1.RadioTaskStatus.DELIVERED) {
|
|
215
|
+
await runGhCommand(`gh issue close ${taskFound.exid} --repo ${repoSlug}`, context);
|
|
216
|
+
}
|
|
217
|
+
return new RadioTask_1.RadioTask({
|
|
218
|
+
...input.task,
|
|
219
|
+
exid: taskFound.exid,
|
|
220
|
+
});
|
|
221
|
+
},
|
|
222
|
+
},
|
|
223
|
+
del: async (input, context) => {
|
|
224
|
+
const { repo } = context.git;
|
|
225
|
+
const repoSlug = `${repo.owner}/${repo.name}`;
|
|
226
|
+
await runGhCommand(`gh issue close ${input.exid} --repo ${repoSlug} --reason "not planned"`, context);
|
|
227
|
+
},
|
|
228
|
+
};
|
|
229
|
+
//# sourceMappingURL=daoRadioTaskViaGhIssues.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daoRadioTaskViaGhIssues.js","sourceRoot":"","sources":["../../../../src/access/daos/daoRadioTask/daoRadioTaskViaGhIssues.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,iDAAqC;AACrC,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,iBAAiB,SAAS,CAAC,IAAI,WAAW,QAAQ,oBAAoB,KAAK,CAAC,IAAI,CAAC,SAAS,GAAG,EAC7F,OAAO,CACR,CAAC;YACJ,CAAC;YAED,mCAAmC;YACnC,IAAI,KAAK,CAAC,IAAI,CAAC,MAAM,KAAK,iCAAe,CAAC,SAAS,EAAE,CAAC;gBACpD,MAAM,YAAY,CAChB,kBAAkB,SAAS,CAAC,IAAI,WAAW,QAAQ,EAAE,EACrD,OAAO,CACR,CAAC;YACJ,CAAC;YAED,OAAO,IAAI,qBAAS,CAAC;gBACnB,GAAG,KAAK,CAAC,IAAI;gBACb,IAAI,EAAE,SAAS,CAAC,IAAI;aACrB,CAAC,CAAC;QACL,CAAC;KACF;IAED,GAAG,EAAE,KAAK,EACR,KAAuB,EACvB,OAA2C,EAC5B,EAAE;QACjB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,CAAC,GAAG,CAAC;QAC7B,MAAM,QAAQ,GAAG,GAAG,IAAI,CAAC,KAAK,IAAI,IAAI,CAAC,IAAI,EAAE,CAAC;QAE9C,MAAM,YAAY,CAChB,kBAAkB,KAAK,CAAC,IAAI,WAAW,QAAQ,yBAAyB,EACxE,OAAO,CACR,CAAC;IACJ,CAAC;CACF,CAAC"}
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import type { ContextGitRepo } from '../../../domain.objects/RadioContext';
|
|
2
|
+
import { RadioTask } from '../../../domain.objects/RadioTask';
|
|
3
|
+
import type { RadioTaskRepo } from '../../../domain.objects/RadioTaskRepo';
|
|
4
|
+
import { RadioTaskStatus } from '../../../domain.objects/RadioTaskStatus';
|
|
5
|
+
/**
|
|
6
|
+
* .what = dao for local filesystem channel
|
|
7
|
+
* .why = enables radio task persistence via filesystem for offline access
|
|
8
|
+
*/
|
|
9
|
+
export declare const daoRadioTaskViaOsFileops: {
|
|
10
|
+
get: {
|
|
11
|
+
one: {
|
|
12
|
+
byPrimary: (input: {
|
|
13
|
+
exid: string;
|
|
14
|
+
}, context: ContextGitRepo) => Promise<RadioTask | null>;
|
|
15
|
+
byUnique: (input: {
|
|
16
|
+
repo: RadioTaskRepo;
|
|
17
|
+
title: string;
|
|
18
|
+
}, context: ContextGitRepo) => Promise<RadioTask | null>;
|
|
19
|
+
};
|
|
20
|
+
all: (input: {
|
|
21
|
+
repo: RadioTaskRepo;
|
|
22
|
+
filter?: {
|
|
23
|
+
status?: RadioTaskStatus;
|
|
24
|
+
};
|
|
25
|
+
limit?: number;
|
|
26
|
+
}, context: ContextGitRepo) => Promise<RadioTask[]>;
|
|
27
|
+
};
|
|
28
|
+
set: {
|
|
29
|
+
findsert: (input: {
|
|
30
|
+
task: RadioTask;
|
|
31
|
+
}, context: ContextGitRepo) => Promise<RadioTask>;
|
|
32
|
+
upsert: (input: {
|
|
33
|
+
task: RadioTask;
|
|
34
|
+
}, context: ContextGitRepo) => Promise<RadioTask>;
|
|
35
|
+
};
|
|
36
|
+
del: (input: {
|
|
37
|
+
exid: string;
|
|
38
|
+
}, context: ContextGitRepo) => Promise<void>;
|
|
39
|
+
};
|
|
@@ -0,0 +1,243 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
|
|
3
|
+
if (k2 === undefined) k2 = k;
|
|
4
|
+
var desc = Object.getOwnPropertyDescriptor(m, k);
|
|
5
|
+
if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
|
|
6
|
+
desc = { enumerable: true, get: function() { return m[k]; } };
|
|
7
|
+
}
|
|
8
|
+
Object.defineProperty(o, k2, desc);
|
|
9
|
+
}) : (function(o, m, k, k2) {
|
|
10
|
+
if (k2 === undefined) k2 = k;
|
|
11
|
+
o[k2] = m[k];
|
|
12
|
+
}));
|
|
13
|
+
var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
|
|
14
|
+
Object.defineProperty(o, "default", { enumerable: true, value: v });
|
|
15
|
+
}) : function(o, v) {
|
|
16
|
+
o["default"] = v;
|
|
17
|
+
});
|
|
18
|
+
var __importStar = (this && this.__importStar) || function (mod) {
|
|
19
|
+
if (mod && mod.__esModule) return mod;
|
|
20
|
+
var result = {};
|
|
21
|
+
if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
|
|
22
|
+
__setModuleDefault(result, mod);
|
|
23
|
+
return result;
|
|
24
|
+
};
|
|
25
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
+
exports.daoRadioTaskViaOsFileops = void 0;
|
|
27
|
+
const crypto = __importStar(require("crypto"));
|
|
28
|
+
const fs = __importStar(require("fs/promises"));
|
|
29
|
+
const os = __importStar(require("os"));
|
|
30
|
+
const path = __importStar(require("path"));
|
|
31
|
+
const RadioTask_1 = require("../../../domain.objects/RadioTask");
|
|
32
|
+
const RadioTaskStatus_1 = require("../../../domain.objects/RadioTaskStatus");
|
|
33
|
+
const composeTaskIntoOsFileops_1 = require("../../../domain.operations/radio/task/format/composeTaskIntoOsFileops");
|
|
34
|
+
const extractTaskFromOsFileops_1 = require("../../../domain.operations/radio/task/format/extractTaskFromOsFileops");
|
|
35
|
+
/**
|
|
36
|
+
* .what = generate a short unique id
|
|
37
|
+
* .why = create exid for new tasks
|
|
38
|
+
*/
|
|
39
|
+
const genShortId = () => {
|
|
40
|
+
return crypto.randomUUID().slice(0, 8);
|
|
41
|
+
};
|
|
42
|
+
/**
|
|
43
|
+
* .what = convert Date to IsoDateStamp
|
|
44
|
+
* .why = format date for RadioTask fields
|
|
45
|
+
*/
|
|
46
|
+
const toIsoDateStamp = (date) => {
|
|
47
|
+
return date.toISOString().split('T')[0];
|
|
48
|
+
};
|
|
49
|
+
/**
|
|
50
|
+
* .what = compute global radio directory path for a repo
|
|
51
|
+
* .why = consistent path resolution for task storage
|
|
52
|
+
*/
|
|
53
|
+
const getGlobalRadioDir = (repo) => {
|
|
54
|
+
return path.join(os.homedir(), 'git', '.radio', repo.owner, repo.name);
|
|
55
|
+
};
|
|
56
|
+
/**
|
|
57
|
+
* .what = compute task file path from exid
|
|
58
|
+
* .why = consistent file name for task storage
|
|
59
|
+
*/
|
|
60
|
+
const getTaskFilePath = (radioDir, exid) => {
|
|
61
|
+
return path.join(radioDir, `task.${exid}._.md`);
|
|
62
|
+
};
|
|
63
|
+
/**
|
|
64
|
+
* .what = compute status flag file path
|
|
65
|
+
* .why = enables fast status queries via glob
|
|
66
|
+
*/
|
|
67
|
+
const getStatusFlagPath = (radioDir, exid, status) => {
|
|
68
|
+
return path.join(radioDir, `task.${exid}._.status=${status}.flag`);
|
|
69
|
+
};
|
|
70
|
+
/**
|
|
71
|
+
* .what = compute backup file path with iso timestamp
|
|
72
|
+
* .why = preserves prior versions on edit
|
|
73
|
+
*/
|
|
74
|
+
const getBackupFilePath = (radioDir, exid) => {
|
|
75
|
+
const isoNow = toIsoDateStamp(new Date());
|
|
76
|
+
return path.join(radioDir, `task.${exid}.bak.${isoNow}.md`);
|
|
77
|
+
};
|
|
78
|
+
/**
|
|
79
|
+
* .what = check if a path exists
|
|
80
|
+
* .why = helper for file existence checks
|
|
81
|
+
*/
|
|
82
|
+
const pathExists = async (filePath) => {
|
|
83
|
+
try {
|
|
84
|
+
await fs.access(filePath);
|
|
85
|
+
return true;
|
|
86
|
+
}
|
|
87
|
+
catch {
|
|
88
|
+
return false;
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
/**
|
|
92
|
+
* .what = ensure directory exists
|
|
93
|
+
* .why = bootstrap radio directory structure
|
|
94
|
+
*/
|
|
95
|
+
const ensureDir = async (dirPath) => {
|
|
96
|
+
await fs.mkdir(dirPath, { recursive: true });
|
|
97
|
+
};
|
|
98
|
+
/**
|
|
99
|
+
* .what = remove all status flag files for a task
|
|
100
|
+
* .why = clean up before set of new status
|
|
101
|
+
*/
|
|
102
|
+
const removeStatusFlags = async (radioDir, exid) => {
|
|
103
|
+
for (const status of Object.values(RadioTaskStatus_1.RadioTaskStatus)) {
|
|
104
|
+
const flagPath = getStatusFlagPath(radioDir, exid, status);
|
|
105
|
+
if (await pathExists(flagPath)) {
|
|
106
|
+
await fs.rm(flagPath);
|
|
107
|
+
}
|
|
108
|
+
}
|
|
109
|
+
};
|
|
110
|
+
/**
|
|
111
|
+
* .what = dao for local filesystem channel
|
|
112
|
+
* .why = enables radio task persistence via filesystem for offline access
|
|
113
|
+
*/
|
|
114
|
+
exports.daoRadioTaskViaOsFileops = {
|
|
115
|
+
get: {
|
|
116
|
+
one: {
|
|
117
|
+
byPrimary: async (input, context) => {
|
|
118
|
+
const radioDir = getGlobalRadioDir(context.git.repo);
|
|
119
|
+
const filePath = getTaskFilePath(radioDir, input.exid);
|
|
120
|
+
if (!(await pathExists(filePath)))
|
|
121
|
+
return null;
|
|
122
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
123
|
+
return (0, extractTaskFromOsFileops_1.extractTaskFromOsFileops)({ content });
|
|
124
|
+
},
|
|
125
|
+
byUnique: async (input, context) => {
|
|
126
|
+
const radioDir = getGlobalRadioDir(context.git.repo);
|
|
127
|
+
// list all task files and find by title
|
|
128
|
+
if (!(await pathExists(radioDir)))
|
|
129
|
+
return null;
|
|
130
|
+
const files = await fs.readdir(radioDir);
|
|
131
|
+
const taskFiles = files.filter((f) => f.startsWith('task.') && f.endsWith('._.md'));
|
|
132
|
+
for (const file of taskFiles) {
|
|
133
|
+
const filePath = path.join(radioDir, file);
|
|
134
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
135
|
+
const task = (0, extractTaskFromOsFileops_1.extractTaskFromOsFileops)({ content });
|
|
136
|
+
if (task.title === input.title)
|
|
137
|
+
return task;
|
|
138
|
+
}
|
|
139
|
+
return null;
|
|
140
|
+
},
|
|
141
|
+
},
|
|
142
|
+
all: async (input, context) => {
|
|
143
|
+
const radioDir = getGlobalRadioDir(context.git.repo);
|
|
144
|
+
const limit = input.limit ?? 100;
|
|
145
|
+
if (!(await pathExists(radioDir)))
|
|
146
|
+
return [];
|
|
147
|
+
const files = await fs.readdir(radioDir);
|
|
148
|
+
// if filter by status, use flag files for fast query
|
|
149
|
+
if (input.filter?.status) {
|
|
150
|
+
const flagPattern = `._.status=${input.filter.status}.flag`;
|
|
151
|
+
const flagFiles = files.filter((f) => f.endsWith(flagPattern));
|
|
152
|
+
const tasks = [];
|
|
153
|
+
for (const flagFile of flagFiles.slice(0, limit)) {
|
|
154
|
+
const exid = flagFile.replace('task.', '').replace(flagPattern, '');
|
|
155
|
+
const filePath = getTaskFilePath(radioDir, exid);
|
|
156
|
+
if (await pathExists(filePath)) {
|
|
157
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
158
|
+
tasks.push((0, extractTaskFromOsFileops_1.extractTaskFromOsFileops)({ content }));
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
return tasks;
|
|
162
|
+
}
|
|
163
|
+
// no filter, read all task files
|
|
164
|
+
const taskFiles = files.filter((f) => f.startsWith('task.') && f.endsWith('._.md'));
|
|
165
|
+
const tasks = [];
|
|
166
|
+
for (const file of taskFiles.slice(0, limit)) {
|
|
167
|
+
const filePath = path.join(radioDir, file);
|
|
168
|
+
const content = await fs.readFile(filePath, 'utf-8');
|
|
169
|
+
tasks.push((0, extractTaskFromOsFileops_1.extractTaskFromOsFileops)({ content }));
|
|
170
|
+
}
|
|
171
|
+
return tasks;
|
|
172
|
+
},
|
|
173
|
+
},
|
|
174
|
+
set: {
|
|
175
|
+
findsert: async (input, context) => {
|
|
176
|
+
const radioDir = getGlobalRadioDir(context.git.repo);
|
|
177
|
+
// check if task already exists
|
|
178
|
+
const taskFound = await exports.daoRadioTaskViaOsFileops.get.one.byUnique({ repo: input.task.repo, title: input.task.title }, context);
|
|
179
|
+
if (taskFound)
|
|
180
|
+
return taskFound;
|
|
181
|
+
// ensure directory exists
|
|
182
|
+
await ensureDir(radioDir);
|
|
183
|
+
// generate exid if not provided
|
|
184
|
+
const exid = input.task.exid || genShortId();
|
|
185
|
+
const taskWithExid = new RadioTask_1.RadioTask({ ...input.task, exid });
|
|
186
|
+
// write task file
|
|
187
|
+
const filePath = getTaskFilePath(radioDir, exid);
|
|
188
|
+
const content = (0, composeTaskIntoOsFileops_1.composeTaskIntoOsFileops)({ task: taskWithExid });
|
|
189
|
+
await fs.writeFile(filePath, content, 'utf-8');
|
|
190
|
+
// write status flag
|
|
191
|
+
if (taskWithExid.status !== RadioTaskStatus_1.RadioTaskStatus.DELIVERED) {
|
|
192
|
+
const flagPath = getStatusFlagPath(radioDir, exid, taskWithExid.status);
|
|
193
|
+
await fs.writeFile(flagPath, '', 'utf-8');
|
|
194
|
+
}
|
|
195
|
+
return taskWithExid;
|
|
196
|
+
},
|
|
197
|
+
upsert: async (input, context) => {
|
|
198
|
+
const radioDir = getGlobalRadioDir(context.git.repo);
|
|
199
|
+
// check if task exists
|
|
200
|
+
const taskFound = input.task.exid
|
|
201
|
+
? await exports.daoRadioTaskViaOsFileops.get.one.byPrimary({ exid: input.task.exid }, context)
|
|
202
|
+
: await exports.daoRadioTaskViaOsFileops.get.one.byUnique({ repo: input.task.repo, title: input.task.title }, context);
|
|
203
|
+
if (!taskFound) {
|
|
204
|
+
// create new task
|
|
205
|
+
return exports.daoRadioTaskViaOsFileops.set.findsert(input, context);
|
|
206
|
+
}
|
|
207
|
+
// ensure directory exists
|
|
208
|
+
await ensureDir(radioDir);
|
|
209
|
+
const exid = taskFound.exid;
|
|
210
|
+
// create backup before overwrite
|
|
211
|
+
const taskFilePath = getTaskFilePath(radioDir, exid);
|
|
212
|
+
if (await pathExists(taskFilePath)) {
|
|
213
|
+
const backupPath = getBackupFilePath(radioDir, exid);
|
|
214
|
+
await fs.copyFile(taskFilePath, backupPath);
|
|
215
|
+
}
|
|
216
|
+
// merge with found task
|
|
217
|
+
const taskMerged = new RadioTask_1.RadioTask({
|
|
218
|
+
...taskFound,
|
|
219
|
+
...input.task,
|
|
220
|
+
exid,
|
|
221
|
+
});
|
|
222
|
+
// write task file
|
|
223
|
+
const content = (0, composeTaskIntoOsFileops_1.composeTaskIntoOsFileops)({ task: taskMerged });
|
|
224
|
+
await fs.writeFile(taskFilePath, content, 'utf-8');
|
|
225
|
+
// update status flag
|
|
226
|
+
await removeStatusFlags(radioDir, exid);
|
|
227
|
+
if (taskMerged.status !== RadioTaskStatus_1.RadioTaskStatus.DELIVERED) {
|
|
228
|
+
const flagPath = getStatusFlagPath(radioDir, exid, taskMerged.status);
|
|
229
|
+
await fs.writeFile(flagPath, '', 'utf-8');
|
|
230
|
+
}
|
|
231
|
+
return taskMerged;
|
|
232
|
+
},
|
|
233
|
+
},
|
|
234
|
+
del: async (input, context) => {
|
|
235
|
+
const radioDir = getGlobalRadioDir(context.git.repo);
|
|
236
|
+
const filePath = getTaskFilePath(radioDir, input.exid);
|
|
237
|
+
if (await pathExists(filePath)) {
|
|
238
|
+
await fs.rm(filePath);
|
|
239
|
+
}
|
|
240
|
+
await removeStatusFlags(radioDir, input.exid);
|
|
241
|
+
},
|
|
242
|
+
};
|
|
243
|
+
//# sourceMappingURL=daoRadioTaskViaOsFileops.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"daoRadioTaskViaOsFileops.js","sourceRoot":"","sources":["../../../../src/access/daos/daoRadioTask/daoRadioTaskViaOsFileops.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA,+CAAiC;AACjC,gDAAkC;AAElC,uCAAyB;AACzB,2CAA6B;AAG7B,iEAA8D;AAE9D,6EAA0E;AAC1E,oHAAiH;AACjH,oHAAiH;AAEjH;;;GAGG;AACH,MAAM,UAAU,GAAG,GAAW,EAAE;IAC9B,OAAO,MAAM,CAAC,UAAU,EAAE,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC;AACzC,CAAC,CAAC;AAEF;;;GAGG;AACH,MAAM,cAAc,GAAG,CAAC,IAAU,EAAgB,EAAE;IAClD,OAAO,IAAI,CAAC,WAAW,EAAE,CAAC,KAA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RadioChannel } from '../../../domain.objects/RadioChannel';
|
|
2
|
+
import { type ContextGithubAuth, type ContextGitRepo, isContextGithubAuth } from '../../../domain.objects/RadioContext';
|
|
3
|
+
import { daoRadioTaskViaGhIssues } from './daoRadioTaskViaGhIssues';
|
|
4
|
+
import { daoRadioTaskViaOsFileops } from './daoRadioTaskViaOsFileops';
|
|
5
|
+
export { daoRadioTaskViaGhIssues, daoRadioTaskViaOsFileops, isContextGithubAuth, };
|
|
6
|
+
export type { ContextGithubAuth, ContextGitRepo };
|
|
7
|
+
/**
|
|
8
|
+
* .what = generic context type that requires auth based on channel
|
|
9
|
+
* .why = enables type-safe context requirements per channel
|
|
10
|
+
*
|
|
11
|
+
* .critical = GH_ISSUES requires ContextGithubAuth; OS_FILEOPS only needs ContextGitRepo
|
|
12
|
+
*/
|
|
13
|
+
export type ContextDispatchRadio<TChannel extends RadioChannel> = TChannel extends RadioChannel.GH_ISSUES ? ContextGithubAuth & ContextGitRepo : ContextGitRepo;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.isContextGithubAuth = exports.daoRadioTaskViaOsFileops = exports.daoRadioTaskViaGhIssues = void 0;
|
|
4
|
+
const RadioContext_1 = require("../../../domain.objects/RadioContext");
|
|
5
|
+
Object.defineProperty(exports, "isContextGithubAuth", { enumerable: true, get: function () { return RadioContext_1.isContextGithubAuth; } });
|
|
6
|
+
const daoRadioTaskViaGhIssues_1 = require("./daoRadioTaskViaGhIssues");
|
|
7
|
+
Object.defineProperty(exports, "daoRadioTaskViaGhIssues", { enumerable: true, get: function () { return daoRadioTaskViaGhIssues_1.daoRadioTaskViaGhIssues; } });
|
|
8
|
+
const daoRadioTaskViaOsFileops_1 = require("./daoRadioTaskViaOsFileops");
|
|
9
|
+
Object.defineProperty(exports, "daoRadioTaskViaOsFileops", { enumerable: true, get: function () { return daoRadioTaskViaOsFileops_1.daoRadioTaskViaOsFileops; } });
|
|
10
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/access/daos/daoRadioTask/index.ts"],"names":[],"mappings":";;;AACA,uEAI8C;AAO5C,oGARA,kCAAmB,OAQA;AANrB,uEAAoE;AAIlE,wGAJO,iDAAuB,OAIP;AAHzB,yEAAsE;AAIpE,yGAJO,mDAAwB,OAIP"}
|
|
@@ -1,18 +1,20 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* .what = create a feedback file for a behavior artifact
|
|
2
|
+
* .what = create or find a feedback file for a behavior artifact
|
|
3
3
|
*
|
|
4
4
|
* .why = enables structured feedback on any behavior artifact
|
|
5
5
|
* with placeholder substitution and version support
|
|
6
6
|
*
|
|
7
7
|
* usage:
|
|
8
|
-
* give.feedback.sh --against <name>
|
|
8
|
+
* give.feedback.sh --against <name> # open latest or create v1
|
|
9
9
|
* give.feedback.sh --against <name> --behavior <name> # explicit behavior
|
|
10
|
-
* give.feedback.sh --against <name> --version 2
|
|
10
|
+
* give.feedback.sh --against <name> --version 2 # open or create v2
|
|
11
|
+
* give.feedback.sh --against <name> --version ++ # create next version
|
|
12
|
+
* give.feedback.sh --against <name> --open codium # open in editor
|
|
11
13
|
* give.feedback.sh --against <name> --template <path> # custom template
|
|
12
14
|
*
|
|
13
15
|
* guarantee:
|
|
14
16
|
* - fail-fast if artifact not found
|
|
15
|
-
* - fail-fast if feedback file already exists
|
|
16
17
|
* - fail-fast if template not found
|
|
18
|
+
* - findsert: if feedback exists, open it
|
|
17
19
|
*/
|
|
18
20
|
export declare const giveFeedback: () => void;
|